summaryrefslogtreecommitdiff
path: root/qt4
diff options
context:
space:
mode:
authorPino Toscano <pino@kde.org>2008-11-30 16:17:32 +0100
committerPino Toscano <pino@kde.org>2008-11-30 16:17:32 +0100
commitee191363e22940ae7b06945e68c4738b17c78348 (patch)
tree3975799080e1243e172dbf8180d3615e1fd3357c /qt4
parentf8eaabf1aa7e384619129a7509be85d0c3bfb825 (diff)
move the addTocChildren() implementation in the cpp
Diffstat (limited to 'qt4')
-rw-r--r--qt4/src/poppler-form.cc1
-rw-r--r--qt4/src/poppler-page.cc1
-rw-r--r--qt4/src/poppler-private.cc65
-rw-r--r--qt4/src/poppler-private.h64
4 files changed, 69 insertions, 62 deletions
diff --git a/qt4/src/poppler-form.cc b/qt4/src/poppler-form.cc
index 772cdd91..d9ef0bc1 100644
--- a/qt4/src/poppler-form.cc
+++ b/qt4/src/poppler-form.cc
@@ -22,6 +22,7 @@
#include <Form.h>
#include <Object.h>
+#include <Link.h>
#include "poppler-form.h"
#include "poppler-page-private.h"
diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc
index f5f1281f..e6d5ed95 100644
--- a/qt4/src/poppler-page.cc
+++ b/qt4/src/poppler-page.cc
@@ -34,6 +34,7 @@
#include <ErrorCodes.h>
#include <TextOutputDev.h>
#include <Annot.h>
+#include <Link.h>
#if defined(HAVE_SPLASH)
#include <SplashOutputDev.h>
#include <splash/SplashBitmap.h>
diff --git a/qt4/src/poppler-private.cc b/qt4/src/poppler-private.cc
index d525e562..7b6e2a01 100644
--- a/qt4/src/poppler-private.cc
+++ b/qt4/src/poppler-private.cc
@@ -24,6 +24,10 @@
#include <QtCore/QByteArray>
#include <QtCore/QDebug>
+#include <QtCore/QVariant>
+
+#include <Link.h>
+#include <Outline.h>
namespace Poppler {
@@ -113,4 +117,65 @@ namespace Poppler {
gfree(cstring);
return ret;
}
+
+ void DocumentData::addTocChildren( QDomDocument * docSyn, QDomNode * parent, GooList * items )
+ {
+ int numItems = items->getLength();
+ for ( int i = 0; i < numItems; ++i )
+ {
+ // iterate over every object in 'items'
+ OutlineItem * outlineItem = (OutlineItem *)items->get( i );
+
+ // 1. create element using outlineItem's title as tagName
+ QString name;
+ Unicode * uniChar = outlineItem->getTitle();
+ int titleLength = outlineItem->getTitleLength();
+ name = unicodeToQString(uniChar, titleLength);
+ if ( name.isEmpty() )
+ continue;
+
+ QDomElement item = docSyn->createElement( name );
+ parent->appendChild( item );
+
+ // 2. find the page the link refers to
+ ::LinkAction * a = outlineItem->getAction();
+ if ( a && ( a->getKind() == actionGoTo || a->getKind() == actionGoToR ) )
+ {
+ // page number is contained/referenced in a LinkGoTo
+ LinkGoTo * g = static_cast< LinkGoTo * >( a );
+ LinkDest * destination = g->getDest();
+ if ( !destination && g->getNamedDest() )
+ {
+ // no 'destination' but an internal 'named reference'. we could
+ // get the destination for the page now, but it's VERY time consuming,
+ // so better storing the reference and provide the viewport on demand
+ GooString *s = g->getNamedDest();
+ QChar *charArray = new QChar[s->getLength()];
+ for (int i = 0; i < s->getLength(); ++i) charArray[i] = QChar(s->getCString()[i]);
+ QString aux(charArray, s->getLength());
+ item.setAttribute( "DestinationName", aux );
+ delete[] charArray;
+ }
+ else if ( destination && destination->isOk() )
+ {
+ LinkDestinationData ldd(destination, NULL, this);
+ item.setAttribute( "Destination", LinkDestination(ldd).toString() );
+ }
+ if ( a->getKind() == actionGoToR )
+ {
+ LinkGoToR * g2 = static_cast< LinkGoToR * >( a );
+ item.setAttribute( "ExternalFileName", g2->getFileName()->getCString() );
+ }
+ }
+
+ item.setAttribute( "Open", QVariant( (bool)outlineItem->isOpen() ).toString() );
+
+ // 3. recursively descend over children
+ outlineItem->open();
+ GooList * children = outlineItem->getKids();
+ if ( children )
+ addTocChildren( docSyn, &item, children );
+ }
+ }
+
}
diff --git a/qt4/src/poppler-private.h b/qt4/src/poppler-private.h
index 4ac90940..941f3d6a 100644
--- a/qt4/src/poppler-private.h
+++ b/qt4/src/poppler-private.h
@@ -26,14 +26,11 @@
#define _POPPLER_PRIVATE_H_
#include <QtCore/QPointer>
-#include <QtCore/QVariant>
#include <QtCore/QVector>
#include <config.h>
#include <GfxState.h>
#include <GlobalParams.h>
-#include <Link.h>
-#include <Outline.h>
#include <PDFDoc.h>
#include <FontInfo.h>
#include <OutputDev.h>
@@ -44,6 +41,7 @@
#include "poppler-qt4.h"
+class LinkDest;
class FormWidget;
namespace Poppler {
@@ -150,65 +148,7 @@ namespace Poppler {
return m_outputDev;
}
- void addTocChildren( QDomDocument * docSyn, QDomNode * parent, GooList * items )
- {
- int numItems = items->getLength();
- for ( int i = 0; i < numItems; ++i )
- {
- // iterate over every object in 'items'
- OutlineItem * outlineItem = (OutlineItem *)items->get( i );
-
- // 1. create element using outlineItem's title as tagName
- QString name;
- Unicode * uniChar = outlineItem->getTitle();
- int titleLength = outlineItem->getTitleLength();
- name = unicodeToQString(uniChar, titleLength);
- if ( name.isEmpty() )
- continue;
-
- QDomElement item = docSyn->createElement( name );
- parent->appendChild( item );
-
- // 2. find the page the link refers to
- ::LinkAction * a = outlineItem->getAction();
- if ( a && ( a->getKind() == actionGoTo || a->getKind() == actionGoToR ) )
- {
- // page number is contained/referenced in a LinkGoTo
- LinkGoTo * g = static_cast< LinkGoTo * >( a );
- LinkDest * destination = g->getDest();
- if ( !destination && g->getNamedDest() )
- {
- // no 'destination' but an internal 'named reference'. we could
- // get the destination for the page now, but it's VERY time consuming,
- // so better storing the reference and provide the viewport on demand
- GooString *s = g->getNamedDest();
- QChar *charArray = new QChar[s->getLength()];
- for (int i = 0; i < s->getLength(); ++i) charArray[i] = QChar(s->getCString()[i]);
- QString aux(charArray, s->getLength());
- item.setAttribute( "DestinationName", aux );
- delete[] charArray;
- }
- else if ( destination && destination->isOk() )
- {
- LinkDestinationData ldd(destination, NULL, this);
- item.setAttribute( "Destination", LinkDestination(ldd).toString() );
- }
- if ( a->getKind() == actionGoToR )
- {
- LinkGoToR * g2 = static_cast< LinkGoToR * >( a );
- item.setAttribute( "ExternalFileName", g2->getFileName()->getCString() );
- }
- }
-
- item.setAttribute( "Open", QVariant( (bool)outlineItem->isOpen() ).toString() );
-
- // 3. recursively descend over children
- outlineItem->open();
- GooList * children = outlineItem->getKids();
- if ( children )
- addTocChildren( docSyn, &item, children );
- }
- }
+ void addTocChildren( QDomDocument * docSyn, QDomNode * parent, GooList * items );
void setPaperColor(const QColor &color)
{