[poppler] 5 commits - poppler/Annot.cc poppler/Annot.h qt4/src

Pino Toscano pino at kemper.freedesktop.org
Sat Apr 5 14:18:01 PDT 2008


 poppler/Annot.cc              |    5 ++
 poppler/Annot.h               |    6 +--
 qt4/src/poppler-annotation.cc |   83 ++++++++++++++++++++++++++++++++++++++++++
 qt4/src/poppler-annotation.h  |   25 ++++++++++++
 4 files changed, 114 insertions(+), 5 deletions(-)

New commits:
commit 28c5ee2e9fc2a24d2f2efb3d74d5cf882a106239
Author: Pino Toscano <pino at kde.org>
Date:   Sat Apr 5 23:19:33 2008 +0200

    typo fix

diff --git a/poppler/Annot.h b/poppler/Annot.h
index 68a1ec4..97c9022 100644
--- a/poppler/Annot.h
+++ b/poppler/Annot.h
@@ -952,7 +952,7 @@ private:
 };
 
 //------------------------------------------------------------------------
-// AnnotGeometry
+// AnnotCaret
 //------------------------------------------------------------------------
 
 class AnnotCaret: public AnnotMarkup {
commit ed02769688466ca72bf35d4223c3822a1245604b
Author: Pino Toscano <pino at kde.org>
Date:   Sat Apr 5 19:36:21 2008 +0200

    read the destination of a link annotation

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 982e88c..4a6e97d 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -1324,7 +1324,9 @@ AnnotLink::~AnnotLink() {
   /*
   if (actionDict)
     delete actionDict;
-
+  */
+  dest.free();
+  /*
   if (uriAction)
     delete uriAction;
   */
@@ -1342,6 +1344,7 @@ void AnnotLink::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) {
   }
   obj1.free();
   */
+  dict->lookup("Dest", &dest);
   if (dict->lookup("H", &obj1)->isName()) {
     GooString *effect = new GooString(obj1.getName());
 
diff --git a/poppler/Annot.h b/poppler/Annot.h
index e0bf89b..68a1ec4 100644
--- a/poppler/Annot.h
+++ b/poppler/Annot.h
@@ -760,7 +760,7 @@ public:
 
   // getters
   Dict *getActionDict() const { return actionDict; }
-  // getDest
+  Object *getDest() { return &dest; }
   AnnotLinkEffect getLinkEffect() const { return linkEffect; }
   Dict *getUriAction() const { return uriAction; }
   AnnotQuadrilaterals *getQuadrilaterals() const { return quadrilaterals; }
@@ -770,7 +770,7 @@ protected:
   void initialize(XRef *xrefA, Catalog *catalog, Dict *dict);
 
   Dict *actionDict;                    // A
-  //Dest
+  Object dest;                         // Dest
   AnnotLinkEffect linkEffect;          // H          (Default I)
   Dict *uriAction;                     // PA
 
commit ca31bf12a9d70bac88e457f7799e9935aba58640
Author: Pino Toscano <pino at kde.org>
Date:   Sat Apr 5 16:48:53 2008 +0200

    variable forgotten in the copy&paste...

diff --git a/qt4/src/poppler-annotation.cc b/qt4/src/poppler-annotation.cc
index 9d76b0f..33c8df2 100644
--- a/qt4/src/poppler-annotation.cc
+++ b/qt4/src/poppler-annotation.cc
@@ -1723,12 +1723,12 @@ void CaretAnnotation::store( QDomNode & node, QDomDocument & document ) const
     Annotation::store( node, document );
 
     // create [caret] element
-    QDomElement stampElement = document.createElement( "caret" );
-    node.appendChild( stampElement );
+    QDomElement caretElement = document.createElement( "caret" );
+    node.appendChild( caretElement );
 
     // append the optional attributes
     if ( d->symbol != "None" )
-        stampElement.setAttribute( "symbol", d->symbol );
+        caretElement.setAttribute( "symbol", d->symbol );
 }
 
 Annotation::SubType CaretAnnotation::subType() const
commit 4168daa141b76e5fcd07d046aca8dac2f3037ff9
Author: Pino Toscano <pino at kde.org>
Date:   Sat Apr 5 16:34:12 2008 +0200

    [Qt4] deserialize also CaretAnnotation's

diff --git a/qt4/src/poppler-annotation.cc b/qt4/src/poppler-annotation.cc
index 8573095..9d76b0f 100644
--- a/qt4/src/poppler-annotation.cc
+++ b/qt4/src/poppler-annotation.cc
@@ -63,6 +63,9 @@ Annotation * AnnotationUtils::createAnnotation( const QDomElement & annElement )
         case Annotation::AInk:
             annotation = new InkAnnotation( annElement );
             break;
+        case Annotation::ACaret:
+            annotation = new CaretAnnotation( annElement );
+            break;
     }
 
     // return created annotation
commit b55bcc2aa95825863bef23ab96364b350a49949d
Author: Pino Toscano <pino at kde.org>
Date:   Sat Apr 5 16:31:31 2008 +0200

    [Qt4] first version of a CaretAnnotation.

diff --git a/qt4/src/poppler-annotation.cc b/qt4/src/poppler-annotation.cc
index 9330da3..8573095 100644
--- a/qt4/src/poppler-annotation.cc
+++ b/qt4/src/poppler-annotation.cc
@@ -1665,6 +1665,86 @@ void LinkAnnotation::setLinkRegionPoint( int id, const QPointF &point )
     d->linkRegion[id] = point;
 }
 
+/** CaretAnnotation [Annotation] */
+class CaretAnnotationPrivate : public AnnotationPrivate
+{
+    public:
+        CaretAnnotationPrivate();
+
+        // data fields
+        QString symbol;
+};
+
+CaretAnnotationPrivate::CaretAnnotationPrivate()
+    : AnnotationPrivate(), symbol( "None" )
+{
+}
+
+CaretAnnotation::CaretAnnotation()
+    : Annotation( *new CaretAnnotationPrivate() )
+{
+}
+
+CaretAnnotation::CaretAnnotation( const QDomNode & node )
+    : Annotation( *new CaretAnnotationPrivate(), node )
+{
+    Q_D( CaretAnnotation );
+
+    // loop through the whole children looking for a 'caret' element
+    QDomNode subNode = node.firstChild();
+    while( subNode.isElement() )
+    {
+        QDomElement e = subNode.toElement();
+        subNode = subNode.nextSibling();
+        if ( e.tagName() != "caret" )
+            continue;
+
+        // parse the attributes
+        if ( e.hasAttribute( "symbol" ) )
+            d->symbol = e.attribute( "symbol" );
+
+        // loading complete
+        break;
+    }
+}
+
+CaretAnnotation::~CaretAnnotation()
+{
+}
+
+void CaretAnnotation::store( QDomNode & node, QDomDocument & document ) const
+{
+    Q_D( const CaretAnnotation );
+
+    // recurse to parent objects storing properties
+    Annotation::store( node, document );
+
+    // create [caret] element
+    QDomElement stampElement = document.createElement( "caret" );
+    node.appendChild( stampElement );
+
+    // append the optional attributes
+    if ( d->symbol != "None" )
+        stampElement.setAttribute( "symbol", d->symbol );
+}
+
+Annotation::SubType CaretAnnotation::subType() const
+{
+    return ACaret;
+}
+
+QString CaretAnnotation::caretSymbol() const
+{
+    Q_D( const CaretAnnotation );
+    return d->symbol;
+}
+
+void CaretAnnotation::setCaretSymbol( const QString &symbol )
+{
+    Q_D( CaretAnnotation );
+    d->symbol = symbol;
+}
+
 //BEGIN utility annotation functions
 QColor convertAnnotColor( AnnotColor *color )
 {
diff --git a/qt4/src/poppler-annotation.h b/qt4/src/poppler-annotation.h
index 520aada..fed389f 100644
--- a/qt4/src/poppler-annotation.h
+++ b/qt4/src/poppler-annotation.h
@@ -42,6 +42,7 @@ class HighlightAnnotationPrivate;
 class StampAnnotationPrivate;
 class InkAnnotationPrivate;
 class LinkAnnotationPrivate;
+class CaretAnnotationPrivate;
 class Link;
 
 /**
@@ -87,7 +88,7 @@ class POPPLER_QT4_EXPORT Annotation
     // enum definitions
     // WARNING!!! oKular uses that very same values so if you change them notify the author!
     enum SubType { AText = 1, ALine = 2, AGeom = 3, AHighlight = 4, AStamp = 5,
-                   AInk = 6, ALink = 7, A_BASE = 0 };
+                   AInk = 6, ALink = 7, ACaret = 8, A_BASE = 0 };
     enum Flag { Hidden = 1, FixedSize = 2, FixedRotation = 4, DenyPrint = 8,
                 DenyWrite = 16, DenyDelete = 32, ToggleHidingOnMouse = 64, External = 128 };
     enum LineStyle { Solid = 1, Dashed = 2, Beveled = 4, Inset = 8, Underline = 16 };
@@ -499,6 +500,28 @@ class POPPLER_QT4_EXPORT LinkAnnotation : public Annotation
     Q_DISABLE_COPY( LinkAnnotation )
 };
 
+/**
+ * \short Caret annotation.
+ *
+ * The caret annotation represents a symbol to indicate the presence of text.
+ */
+class POPPLER_QT4_EXPORT CaretAnnotation : public Annotation
+{
+  public:
+    CaretAnnotation();
+    CaretAnnotation( const QDomNode &node );
+    virtual ~CaretAnnotation();
+    virtual void store( QDomNode &parentNode, QDomDocument &document ) const;
+    virtual SubType subType() const;
+
+    QString caretSymbol() const;
+    void setCaretSymbol( const QString &symbol );
+
+  private:
+    Q_DECLARE_PRIVATE( CaretAnnotation )
+    Q_DISABLE_COPY( CaretAnnotation )
+};
+
 }
 
 #endif


More information about the poppler mailing list