- 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. 18
      ui/toc.cpp

@ -682,6 +682,17 @@ void PDFGenerator::addSynopsisChildren( QDomNode * parent, GList * items )
item.setAttribute( "Viewport", DocumentViewport( pageNumber ).toString() ); 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 // 3. recursively descend over children
outlineItem->open(); outlineItem->open();

@ -291,7 +291,7 @@ KPDFLink * KPDFOutputDev::generateLink( LinkAction * a )
LinkGoToR * g = (LinkGoToR *) a; LinkGoToR * g = (LinkGoToR *) a;
// copy link file // copy link file
const char * fileName = g->getFileName()->getCString(); 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() ) ); link = new KPDFLinkGoto( (QString)fileName, decodeViewport( g->getNamedDest(), g->getDest() ) );
} }
break; break;

@ -119,6 +119,23 @@ void TOC::slotExecuted( QListViewItem *i )
if (tocItem == NULL) if (tocItem == NULL)
return; return;
const QDomElement & e = tocItem->element(); const QDomElement & e = tocItem->element();
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() )
{
KPDFLinkGoto link( externalFileName, DocumentViewport() );
m_document->processLink( &link );
}
else
{
if ( e.hasAttribute( "Viewport" ) ) if ( e.hasAttribute( "Viewport" ) )
{ {
// if the node has a viewport, set it // if the node has a viewport, set it
@ -132,6 +149,7 @@ void TOC::slotExecuted( QListViewItem *i )
if ( !viewport.isNull() ) if ( !viewport.isNull() )
m_document->setViewport( DocumentViewport( viewport ), TOC_ID ); m_document->setViewport( DocumentViewport( viewport ), TOC_ID );
} }
}
} }
#include "toc.moc" #include "toc.moc"

Loading…
Cancel
Save