Commit 369803e6 authored by Piotr Szymanski's avatar Piotr Szymanski

- forwardport the support for external linkage in toc

svn path=/trunk/playground/graphics/oKular/kpdf/; revision=434864
parent f5bbf892
......@@ -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 );
}
}
}
......
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