- forwardport the support for external linkage in toc

svn path=/trunk/playground/graphics/oKular/kpdf/; revision=434864
remotes/origin/okular3-playground
Piotr Szymanski 21 years ago
parent f5bbf89218
commit 369803e65b
  1. 11
      core/generator_pdf/generator_pdf.cpp
  2. 2
      core/generator_pdf/gp_outputdev.cpp
  3. 36
      ui/toc.cpp

@ -681,6 +681,17 @@ void PDFGenerator::addSynopsisChildren( QDomNode * parent, GList * items )
// TODO add other attributes to the viewport (taken from link)
item.setAttribute( "Viewport", DocumentViewport( pageNumber ).toString() );
}
}
else if ( a && a->getKind() == actionGoToR )
{
LinkGoToR * g = static_cast< LinkGoToR * >( a );
LinkDest * destination = g->getDest();
if ( !destination && g->getNamedDest() )
{
item.setAttribute( "ViewportName", g->getNamedDest()->getCString() );
}
item.setAttribute( "ExternalFileName", g->getFileName()->getCString() );
}
// 3. recursively descend over children

@ -291,7 +291,7 @@ KPDFLink * KPDFOutputDev::generateLink( LinkAction * a )
LinkGoToR * g = (LinkGoToR *) a;
// copy link file
const char * fileName = g->getFileName()->getCString();
// ceate link: fileName, namedDest, object pointer
// create link: fileName, namedDest, object pointer
link = new KPDFLinkGoto( (QString)fileName, decodeViewport( g->getNamedDest(), g->getDest() ) );
}
break;

@ -119,18 +119,36 @@ void TOC::slotExecuted( QListViewItem *i )
if (tocItem == NULL)
return;
const QDomElement & e = tocItem->element();
if ( e.hasAttribute( "Viewport" ) )
QString externalFileName = e.attribute( "ExternalFileName" );
if ( !externalFileName.isEmpty() )
{
KPDFLinkGoto link( externalFileName, DocumentViewport() );
m_document->processLink( &link );
}
else
{
QString externalFileName = e.attribute( "ExternalFileName" );
if ( !externalFileName.isEmpty() )
{
// if the node has a viewport, set it
m_document->setViewport( DocumentViewport( e.attribute( "Viewport" ) ), TOC_ID );
KPDFLinkGoto link( externalFileName, DocumentViewport() );
m_document->processLink( &link );
}
else if ( e.hasAttribute( "ViewportName" ) )
else
{
// if the node references a viewport, get the reference and set it
const QString & page = e.attribute( "ViewportName" );
const QString & viewport = m_document->getMetaData( "NamedViewport", page );
if ( !viewport.isNull() )
m_document->setViewport( DocumentViewport( viewport ), TOC_ID );
if ( e.hasAttribute( "Viewport" ) )
{
// if the node has a viewport, set it
m_document->setViewport( DocumentViewport( e.attribute( "Viewport" ) ), TOC_ID );
}
else if ( e.hasAttribute( "ViewportName" ) )
{
// if the node references a viewport, get the reference and set it
const QString & page = e.attribute( "ViewportName" );
const QString & viewport = m_document->getMetaData( "NamedViewport", page );
if ( !viewport.isNull() )
m_document->setViewport( DocumentViewport( viewport ), TOC_ID );
}
}
}

Loading…
Cancel
Save