Commit 32ca783b authored by Pino Toscano's avatar Pino Toscano

add named viewport resolution

the destination are source specials anchors

svn path=/trunk/KDE/kdegraphics/okular/; revision=968860
parent dc7583eb
......@@ -101,6 +101,12 @@ bool DviGenerator::doCloseDocument()
return true;
}
void DviGenerator::fillViewportFromAnchor( Okular::DocumentViewport &vp,
const Anchor &anch, const Okular::Page *page )
{
fillViewportFromAnchor( vp, anch, page->width(), page->height() );
}
void DviGenerator::fillViewportFromAnchor( Okular::DocumentViewport &vp,
const Anchor &anch, int pW, int pH )
{
......@@ -447,5 +453,24 @@ bool DviGenerator::print( QPrinter& printer )
return true;
}
QVariant DviGenerator::metaData( const QString & key, const QVariant & option ) const
{
if ( key == "NamedViewport" && !option.toString().isEmpty() )
{
const Anchor anchor = m_dviRenderer->parseReference( option.toString() );
if ( anchor.isValid() )
{
const Okular::Page *page = document()->page( anchor.page - 1 );
Q_ASSERT_X( page, "DviGenerator::metaData()", "NULL page as result of valid Anchor" );
Okular::DocumentViewport viewport;
const_cast< DviGenerator * >( this )->fillViewportFromAnchor( viewport, anchor, page );
if ( viewport.isValid() )
{
return viewport.toString();
}
}
}
return QVariant();
}
#include "generator_dvi.moc"
......@@ -38,6 +38,8 @@ class DviGenerator : public Okular::Generator
bool print( QPrinter &printer );
QVariant metaData( const QString & key, const QVariant & option ) const;
protected:
bool doCloseDocument();
QImage image( Okular::PixmapRequest * request );
......@@ -56,6 +58,8 @@ class DviGenerator : public Okular::Generator
Okular::TextPage *extractTextFromPage( dviPageInfo *pageInfo );
void fillViewportFromAnchor( Okular::DocumentViewport &vp, const Anchor &anch,
int pW, int pH );
void fillViewportFromAnchor( Okular::DocumentViewport &vp, const Anchor &anch,
const Okular::Page *page );
QLinkedList<Okular::ObjectRect*> generateDviLinks( const dviPageInfo *pageInfo );
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment