00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _POPPLER_ANNOTATION_H_
00024 #define _POPPLER_ANNOTATION_H_
00025
00026 #include <QtCore/QDateTime>
00027 #include <QtCore/QLinkedList>
00028 #include <QtCore/QList>
00029 #include <QtCore/QPointF>
00030 #include <QtCore/QRectF>
00031 #include <QtGui/QColor>
00032 #include <QtGui/QFont>
00033 #include <QtXml/QDomDocument>
00034 #include "poppler-export.h"
00035
00036 namespace Poppler {
00037
00038 class Annotation;
00039 class AnnotationPrivate;
00040 class TextAnnotationPrivate;
00041 class LineAnnotationPrivate;
00042 class GeomAnnotationPrivate;
00043 class HighlightAnnotationPrivate;
00044 class StampAnnotationPrivate;
00045 class InkAnnotationPrivate;
00046 class LinkAnnotationPrivate;
00047 class CaretAnnotationPrivate;
00048 class FileAttachmentAnnotationPrivate;
00049 class SoundAnnotationPrivate;
00050 class MovieAnnotationPrivate;
00051 class EmbeddedFile;
00052 class Link;
00053 class SoundObject;
00054 class MovieObject;
00055
00060 class POPPLER_QT4_EXPORT AnnotationUtils
00061 {
00062 public:
00069 static Annotation * createAnnotation( const QDomElement & annElement );
00070
00075 static void storeAnnotation( const Annotation * ann,
00076 QDomElement & annElement, QDomDocument & document );
00077
00082 static QDomElement findChildElement( const QDomNode & parentNode,
00083 const QString & name );
00084 };
00085
00086
00093 class POPPLER_QT4_EXPORT Annotation
00094 {
00095 public:
00096
00097
00098 enum SubType { AText = 1, ALine = 2, AGeom = 3, AHighlight = 4, AStamp = 5,
00099 AInk = 6, ALink = 7, ACaret = 8, AFileAttachment = 9, ASound = 10,
00100 AMovie = 11, A_BASE = 0 };
00101 enum Flag { Hidden = 1, FixedSize = 2, FixedRotation = 4, DenyPrint = 8,
00102 DenyWrite = 16, DenyDelete = 32, ToggleHidingOnMouse = 64, External = 128 };
00103 enum LineStyle { Solid = 1, Dashed = 2, Beveled = 4, Inset = 8, Underline = 16 };
00104 enum LineEffect { NoEffect = 1, Cloudy = 2};
00105 enum RevScope { Reply = 1, Group = 2, Delete = 4 };
00106 enum RevType { None = 1, Marked = 2, Unmarked = 4, Accepted = 8, Rejected = 16, Cancelled = 32, Completed = 64 };
00107
00111 QString author() const;
00115 void setAuthor( const QString &author );
00116
00117 QString contents() const;
00118 void setContents( const QString &contents );
00119
00123 QString uniqueName() const;
00129 void setUniqueName( const QString &uniqueName );
00130
00131 QDateTime modificationDate() const;
00132 void setModificationDate( const QDateTime &date );
00133
00134 QDateTime creationDate() const;
00135 void setCreationDate( const QDateTime &date );
00136
00137 int flags() const;
00138 void setFlags( int flags );
00139
00140 QRectF boundary() const;
00141 void setBoundary( const QRectF &boundary );
00142
00143 struct Style
00144 {
00145
00146 QColor color;
00147 double opacity;
00148
00149 double width;
00150 LineStyle style;
00151 double xCorners;
00152 double yCorners;
00153 int marks;
00154 int spaces;
00155
00156 LineEffect effect;
00157 double effectIntensity;
00158
00159 Style();
00160 } style;
00161
00162
00163 struct Window
00164 {
00165
00166 int flags;
00167
00168 QPointF topLeft;
00169 int width;
00170 int height;
00171
00172 QString title;
00173 QString summary;
00174 QString text;
00175
00176 Window();
00177 } window;
00178
00179
00180 struct Revision
00181 {
00182
00183 Annotation * annotation;
00184
00185 RevScope scope;
00186 RevType type;
00187
00188 Revision();
00189 };
00190
00191 QLinkedList< Revision >& revisions();
00192 const QLinkedList< Revision >& revisions() const;
00193
00194
00198 virtual SubType subType() const = 0;
00199
00203 virtual void store( QDomNode & parentNode, QDomDocument & document ) const;
00204
00208 virtual ~Annotation();
00209
00210 protected:
00212 Annotation( AnnotationPrivate &dd );
00213 Annotation( AnnotationPrivate &dd, const QDomNode &description );
00214 Q_DECLARE_PRIVATE( Annotation )
00215 AnnotationPrivate *d_ptr;
00217
00218 private:
00219 Q_DISABLE_COPY( Annotation )
00220 };
00221
00228 class POPPLER_QT4_EXPORT TextAnnotation : public Annotation
00229 {
00230 public:
00231 TextAnnotation();
00232 TextAnnotation( const QDomNode &node );
00233 virtual ~TextAnnotation();
00234 virtual void store( QDomNode &parentNode, QDomDocument &document ) const;
00235 virtual SubType subType() const;
00236
00237
00238 enum TextType { Linked, InPlace };
00239 enum InplaceIntent { Unknown, Callout, TypeWriter };
00240
00244 TextType textType() const;
00245
00249 void setTextType( TextType type );
00250
00263 QString textIcon() const;
00264
00270 void setTextIcon( const QString &icon );
00271
00272 QFont textFont() const;
00273 void setTextFont( const QFont &font );
00274
00275 int inplaceAlign() const;
00276 void setInplaceAlign( int align );
00277
00278 QString inplaceText() const;
00279 void setInplaceText( const QString &text );
00280
00281 QPointF calloutPoint( int id ) const;
00282 void setCalloutPoint( int id, const QPointF &point );
00283
00284 InplaceIntent inplaceIntent() const;
00285 void setInplaceIntent( InplaceIntent intent );
00286
00287 private:
00288 Q_DECLARE_PRIVATE( TextAnnotation )
00289 Q_DISABLE_COPY( TextAnnotation )
00290 };
00291
00297 class POPPLER_QT4_EXPORT LineAnnotation : public Annotation
00298 {
00299 public:
00300 LineAnnotation();
00301 LineAnnotation( const QDomNode &node );
00302 virtual ~LineAnnotation();
00303 virtual void store( QDomNode &parentNode, QDomDocument &document ) const;
00304 virtual SubType subType() const;
00305
00306
00307 enum TermStyle { Square, Circle, Diamond, OpenArrow, ClosedArrow, None,
00308 Butt, ROpenArrow, RClosedArrow, Slash };
00309 enum LineIntent { Unknown, Arrow, Dimension, PolygonCloud };
00310
00311 QLinkedList<QPointF> linePoints() const;
00312 void setLinePoints( const QLinkedList<QPointF> &points );
00313
00314 TermStyle lineStartStyle() const;
00315 void setLineStartStyle( TermStyle style );
00316
00317 TermStyle lineEndStyle() const;
00318 void setLineEndStyle( TermStyle style );
00319
00320 bool isLineClosed() const;
00321 void setLineClosed( bool closed );
00322
00323 QColor lineInnerColor() const;
00324 void setLineInnerColor( const QColor &color );
00325
00326 double lineLeadingForwardPoint() const;
00327 void setLineLeadingForwardPoint( double point );
00328
00329 double lineLeadingBackPoint() const;
00330 void setLineLeadingBackPoint( double point );
00331
00332 bool lineShowCaption() const;
00333 void setLineShowCaption( bool show );
00334
00335 LineIntent lineIntent() const;
00336 void setLineIntent( LineIntent intent );
00337
00338 private:
00339 Q_DECLARE_PRIVATE( LineAnnotation )
00340 Q_DISABLE_COPY( LineAnnotation )
00341 };
00342
00349 class POPPLER_QT4_EXPORT GeomAnnotation : public Annotation
00350 {
00351 public:
00352 GeomAnnotation();
00353 GeomAnnotation( const QDomNode &node );
00354 virtual ~GeomAnnotation();
00355 virtual void store( QDomNode &parentNode, QDomDocument &document ) const;
00356 virtual SubType subType() const;
00357
00358
00359 enum GeomType { InscribedSquare, InscribedCircle };
00360
00361 GeomType geomType() const;
00362 void setGeomType( GeomType style );
00363
00364 QColor geomInnerColor() const;
00365 void setGeomInnerColor( const QColor &color );
00366
00367 int geomPointWidth() const;
00368 void setGeomPointWidth( int width );
00369
00370 private:
00371 Q_DECLARE_PRIVATE( GeomAnnotation )
00372 Q_DISABLE_COPY( GeomAnnotation )
00373 };
00374
00380 class POPPLER_QT4_EXPORT HighlightAnnotation : public Annotation
00381 {
00382 public:
00383 HighlightAnnotation();
00384 HighlightAnnotation( const QDomNode &node );
00385 virtual ~HighlightAnnotation();
00386 virtual void store( QDomNode &parentNode, QDomDocument &document ) const;
00387 virtual SubType subType() const;
00388
00392 enum HighlightType { Highlight,
00393 Squiggly,
00394 Underline,
00395 StrikeOut
00396 };
00397
00403 struct Quad
00404 {
00405 QPointF points[4];
00406 bool capStart;
00407 bool capEnd;
00408 double feather;
00409 };
00410
00415 HighlightType highlightType() const;
00416
00421 void setHighlightType( HighlightType type );
00422
00426 QList< Quad > highlightQuads() const;
00427
00431 void setHighlightQuads( const QList< Quad > &quads );
00432
00433 private:
00434 Q_DECLARE_PRIVATE( HighlightAnnotation )
00435 Q_DISABLE_COPY( HighlightAnnotation )
00436 };
00437
00443 class POPPLER_QT4_EXPORT StampAnnotation : public Annotation
00444 {
00445 public:
00446 StampAnnotation();
00447 StampAnnotation( const QDomNode &node );
00448 virtual ~StampAnnotation();
00449 virtual void store( QDomNode &parentNode, QDomDocument &document ) const;
00450 virtual SubType subType() const;
00451
00471 QString stampIconName() const;
00472
00478 void setStampIconName( const QString &name );
00479
00480 private:
00481 Q_DECLARE_PRIVATE( StampAnnotation )
00482 Q_DISABLE_COPY( StampAnnotation )
00483 };
00484
00490 class POPPLER_QT4_EXPORT InkAnnotation : public Annotation
00491 {
00492 public:
00493 InkAnnotation();
00494 InkAnnotation( const QDomNode &node );
00495 virtual ~InkAnnotation();
00496 virtual void store( QDomNode &parentNode, QDomDocument &document ) const;
00497 virtual SubType subType() const;
00498
00499 QList< QLinkedList<QPointF> > inkPaths() const;
00500 void setInkPaths( const QList< QLinkedList<QPointF> > &paths );
00501
00502 private:
00503 Q_DECLARE_PRIVATE( InkAnnotation )
00504 Q_DISABLE_COPY( InkAnnotation )
00505 };
00506
00507 class POPPLER_QT4_EXPORT LinkAnnotation : public Annotation
00508 {
00509 public:
00510 LinkAnnotation();
00511 LinkAnnotation( const QDomNode &node );
00512 virtual ~LinkAnnotation();
00513 virtual void store( QDomNode &parentNode, QDomDocument &document ) const;
00514 virtual SubType subType() const;
00515
00516
00517 enum HighlightMode { None, Invert, Outline, Push };
00518
00519 Link* linkDestionation() const;
00520 void setLinkDestination( Link *link );
00521
00522 HighlightMode linkHighlightMode() const;
00523 void setLinkHighlightMode( HighlightMode mode );
00524
00525 QPointF linkRegionPoint( int id ) const;
00526 void setLinkRegionPoint( int id, const QPointF &point );
00527
00528 private:
00529 Q_DECLARE_PRIVATE( LinkAnnotation )
00530 Q_DISABLE_COPY( LinkAnnotation )
00531 };
00532
00538 class POPPLER_QT4_EXPORT CaretAnnotation : public Annotation
00539 {
00540 public:
00541 CaretAnnotation();
00542 CaretAnnotation( const QDomNode &node );
00543 virtual ~CaretAnnotation();
00544 virtual void store( QDomNode &parentNode, QDomDocument &document ) const;
00545 virtual SubType subType() const;
00546
00550 enum CaretSymbol { None, P };
00551
00552 CaretSymbol caretSymbol() const;
00553 void setCaretSymbol( CaretSymbol symbol );
00554
00555 private:
00556 Q_DECLARE_PRIVATE( CaretAnnotation )
00557 Q_DISABLE_COPY( CaretAnnotation )
00558 };
00559
00567 class POPPLER_QT4_EXPORT FileAttachmentAnnotation : public Annotation
00568 {
00569 public:
00570 FileAttachmentAnnotation();
00571 FileAttachmentAnnotation( const QDomNode &node );
00572 virtual ~FileAttachmentAnnotation();
00573 virtual void store( QDomNode &parentNode, QDomDocument &document ) const;
00574 virtual SubType subType() const;
00575
00579 QString fileIconName() const;
00583 void setFileIconName( const QString &icon );
00584
00588 EmbeddedFile* embeddedFile() const;
00594 void setEmbeddedFile( EmbeddedFile *ef );
00595
00596 private:
00597 Q_DECLARE_PRIVATE( FileAttachmentAnnotation )
00598 Q_DISABLE_COPY( FileAttachmentAnnotation )
00599 };
00600
00608 class POPPLER_QT4_EXPORT SoundAnnotation : public Annotation
00609 {
00610 public:
00611 SoundAnnotation();
00612 SoundAnnotation( const QDomNode &node );
00613 virtual ~SoundAnnotation();
00614 virtual void store( QDomNode &parentNode, QDomDocument &document ) const;
00615 virtual SubType subType() const;
00616
00620 QString soundIconName() const;
00624 void setSoundIconName( const QString &icon );
00625
00629 SoundObject* sound() const;
00635 void setSound( SoundObject *ef );
00636
00637 private:
00638 Q_DECLARE_PRIVATE( SoundAnnotation )
00639 Q_DISABLE_COPY( SoundAnnotation )
00640 };
00641
00649 class POPPLER_QT4_EXPORT MovieAnnotation : public Annotation
00650 {
00651 public:
00652 MovieAnnotation();
00653 MovieAnnotation( const QDomNode &node );
00654 virtual ~MovieAnnotation();
00655 virtual void store( QDomNode &parentNode, QDomDocument &document ) const;
00656 virtual SubType subType() const;
00657
00661 MovieObject* movie() const;
00667 void setMovie( MovieObject *movie );
00668
00672 QString movieTitle() const;
00676 void setMovieTitle( const QString &title );
00677
00678 private:
00679 Q_DECLARE_PRIVATE( MovieAnnotation )
00680 Q_DISABLE_COPY( MovieAnnotation )
00681 };
00682
00683 }
00684
00685 #endif