00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _OKULAR_ANNOTATIONS_H_
00011 #define _OKULAR_ANNOTATIONS_H_
00012
00013 #include <QtCore/QString>
00014 #include <QtCore/QDateTime>
00015 #include <QtCore/QLinkedList>
00016 #include <QtCore/QRect>
00017 #include <QtGui/QFont>
00018 #include <QtXml/QDomDocument>
00019 #include <QtXml/QDomElement>
00020
00021 #include <okular/core/okular_export.h>
00022 #include <okular/core/area.h>
00023
00024 namespace Okular {
00025
00026 class Annotation;
00027 class AnnotationObjectRect;
00028 class AnnotationPrivate;
00029 class Document;
00030 class Page;
00031 class PagePrivate;
00032 class TextAnnotationPrivate;
00033 class LineAnnotationPrivate;
00034 class GeomAnnotationPrivate;
00035 class HighlightAnnotationPrivate;
00036 class StampAnnotationPrivate;
00037 class InkAnnotationPrivate;
00038
00042 class OKULAR_EXPORT AnnotationUtils
00043 {
00044 public:
00050 static Annotation * createAnnotation( const QDomElement & element );
00051
00056 static void storeAnnotation( const Annotation * annotation,
00057 QDomElement & element, QDomDocument & document );
00058
00063 static QDomElement findChildElement( const QDomNode & parentNode,
00064 const QString & name );
00065
00070 static QRect annotationGeometry( const Annotation * annotation,
00071 double scaleX, double scaleY );
00072 };
00073
00083 class OKULAR_EXPORT Annotation
00084 {
00086 friend class AnnotationObjectRect;
00087 friend class Document;
00088 friend class Page;
00089 friend class PagePrivate;
00091
00092 public:
00096 enum SubType
00097 {
00098 AText = 1,
00099 ALine = 2,
00100 AGeom = 3,
00101 AHighlight = 4,
00102 AStamp = 5,
00103 AInk = 6,
00104 A_BASE = 0
00105 };
00106
00110 enum Flag
00111 {
00112 Hidden = 1,
00113 FixedSize = 2,
00114 FixedRotation = 4,
00115 DenyPrint = 8,
00116 DenyWrite = 16,
00117 DenyDelete = 32,
00118 ToggleHidingOnMouse = 64,
00119 External = 128
00120 };
00121
00125 enum LineStyle
00126 {
00127 Solid = 1,
00128 Dashed = 2,
00129 Beveled = 4,
00130 Inset = 8,
00131 Underline = 16
00132 };
00133
00137 enum LineEffect
00138 {
00139 NoEffect = 1,
00140 Cloudy = 2
00141 };
00142
00146 enum RevisionScope
00147 {
00148 Reply = 1,
00149 Group = 2,
00150 Delete = 4
00151 };
00152
00156 enum RevisionType
00157 {
00158 None = 1,
00159 Marked = 2,
00160 Unmarked = 4,
00161 Accepted = 8,
00162 Rejected = 16,
00163 Cancelled = 32,
00164 Completed = 64
00165 };
00166
00170 virtual ~Annotation();
00171
00175 void setAuthor( const QString &author );
00176
00180 QString author() const;
00181
00185 void setContents( const QString &contents );
00186
00190 QString contents() const;
00191
00195 void setUniqueName( const QString &name );
00196
00200 QString uniqueName() const;
00201
00207 void setModificationDate( const QDateTime &date );
00208
00212 QDateTime modificationDate() const;
00213
00219 void setCreationDate( const QDateTime &date );
00220
00224 QDateTime creationDate() const;
00225
00230 void setFlags( int flags );
00231
00236 int flags() const;
00237
00241 void setBoundingRectangle( const NormalizedRect &rectangle );
00242
00246 NormalizedRect boundingRectangle() const;
00247
00254 NormalizedRect transformedBoundingRectangle() const;
00255
00259 void translate( const NormalizedPoint &coord );
00260
00265 class OKULAR_EXPORT Style
00266 {
00267 public:
00271 Style();
00272
00276 ~Style();
00277
00278 Style( const Style &other );
00279 Style& operator=( const Style &other );
00280
00284 void setColor( const QColor &color );
00285
00289 QColor color() const;
00290
00294 void setOpacity( double opacity );
00295
00299 double opacity() const;
00300
00304 void setWidth( double width );
00305
00309 double width() const;
00310
00314 void setLineStyle( LineStyle style );
00315
00319 LineStyle lineStyle() const;
00320
00324 void setXCorners( double xCorners );
00325
00329 double xCorners() const;
00330
00334 void setYCorners( double yCorners );
00335
00339 double yCorners() const;
00340
00344 void setMarks( int marks );
00345
00349 int marks() const;
00350
00354 void setSpaces( int spaces );
00355
00359 int spaces() const;
00360
00364 void setLineEffect( LineEffect effect );
00365
00369 LineEffect lineEffect() const;
00370
00374 void setEffectIntensity( double intensity );
00375
00379 double effectIntensity() const;
00380
00381 private:
00382 class Private;
00383 Private* const d;
00384 };
00385
00389 Style & style();
00390
00394 const Style & style() const;
00395
00400 class OKULAR_EXPORT Window
00401 {
00402 public:
00406 Window();
00407
00411 ~Window();
00412
00413 Window( const Window &other );
00414 Window& operator=( const Window &other );
00415
00419 void setFlags( int flags );
00420
00424 int flags() const;
00425
00429 void setTopLeft( const NormalizedPoint &point );
00430
00434 NormalizedPoint topLeft() const;
00435
00439 void setWidth( int width );
00440
00444 int width() const;
00445
00449 void setHeight( int height );
00450
00454 int height() const;
00455
00459 void setTitle( const QString &title );
00460
00464 QString title() const;
00465
00469 void setSummary( const QString &summary );
00470
00474 QString summary() const;
00475
00479 void setText( const QString &text );
00480
00484 QString text() const;
00485
00486 private:
00487 class Private;
00488 Private* const d;
00489 };
00490
00494 Window & window();
00495
00499 const Window & window() const;
00500
00505 class Revision
00506 {
00507 public:
00511 Revision();
00512
00516 ~Revision();
00517
00518 Revision( const Revision &other );
00519 Revision& operator=( const Revision &other );
00520
00524 void setAnnotation( Annotation *annotation );
00525
00529 Annotation *annotation() const;
00530
00535 void setScope( RevisionScope scope );
00536
00540 RevisionScope scope() const;
00541
00546 void setType( RevisionType type );
00547
00551 RevisionType type() const;
00552
00553 private:
00554 class Private;
00555 Private* const d;
00556 };
00557
00561 QLinkedList< Revision > & revisions();
00562
00566 const QLinkedList< Revision > & revisions() const;
00567
00571 virtual SubType subType() const = 0;
00572
00576 virtual void store( QDomNode & node, QDomDocument & document ) const;
00577
00578 protected:
00580 Annotation( AnnotationPrivate &dd );
00581 Annotation( AnnotationPrivate &dd, const QDomNode &description );
00582 Q_DECLARE_PRIVATE( Annotation )
00583 AnnotationPrivate *d_ptr;
00585
00586 private:
00587 Q_DISABLE_COPY( Annotation )
00588 };
00589
00590 class OKULAR_EXPORT TextAnnotation : public Annotation
00591 {
00592 public:
00596 enum TextType
00597 {
00598 Linked,
00599 InPlace
00600 };
00601
00605 enum InplaceIntent
00606 {
00607 Unknown,
00608 Callout,
00609 TypeWriter
00610 };
00611
00615 TextAnnotation();
00616
00620 TextAnnotation( const QDomNode &description );
00621
00625 ~TextAnnotation();
00626
00631 void setTextType( TextType type );
00632
00636 TextType textType() const;
00637
00641 void setTextIcon( const QString &icon );
00642
00646 QString textIcon() const;
00647
00651 void setTextFont( const QFont &font );
00652
00656 QFont textFont() const;
00657
00661 void setInplaceAlignment( int alignment );
00662
00666 int inplaceAlignment() const;
00667
00671 void setInplaceText( const QString &text );
00672
00676 QString inplaceText() const;
00677
00683 void setInplaceCallout( const NormalizedPoint &point, int index );
00684
00690 NormalizedPoint inplaceCallout( int index ) const;
00691
00697 NormalizedPoint transformedInplaceCallout( int index ) const;
00698
00703 void setInplaceIntent( InplaceIntent intent );
00704
00708 InplaceIntent inplaceIntent() const;
00709
00713 SubType subType() const;
00714
00718 void store( QDomNode &node, QDomDocument &document ) const;
00719
00720 private:
00721 Q_DECLARE_PRIVATE( TextAnnotation )
00722 Q_DISABLE_COPY( TextAnnotation )
00723 };
00724
00725 class OKULAR_EXPORT LineAnnotation : public Annotation
00726 {
00727 public:
00731 enum TermStyle
00732 {
00733 Square,
00734 Circle,
00735 Diamond,
00736 OpenArrow,
00737 ClosedArrow,
00738 None,
00739 Butt,
00740 ROpenArrow,
00741 RClosedArrow,
00742 Slash
00743 };
00744
00748 enum LineIntent
00749 {
00750 Unknown,
00751 Arrow,
00752 Dimension,
00753 PolygonCloud
00754 };
00755
00759 LineAnnotation();
00760
00764 explicit LineAnnotation( const QDomNode &description );
00765
00769 ~LineAnnotation();
00770
00774 void setLinePoints( const QLinkedList<NormalizedPoint> &points );
00775
00779 QLinkedList<NormalizedPoint> linePoints() const;
00780
00785 QLinkedList<NormalizedPoint> transformedLinePoints() const;
00786
00791 void setLineStartStyle( TermStyle style );
00792
00796 TermStyle lineStartStyle() const;
00797
00802 void setLineEndStyle( TermStyle style );
00803
00807 TermStyle lineEndStyle() const;
00808
00812 void setLineClosed( bool closed );
00813
00817 bool lineClosed() const;
00818
00822 void setLineInnerColor( const QColor &color );
00823
00827 QColor lineInnerColor() const;
00828
00832 void setLineLeadingForwardPoint( double point );
00833
00837 double lineLeadingForwardPoint() const;
00838
00842 void setLineLeadingBackwardPoint( double point );
00843
00847 double lineLeadingBackwardPoint() const;
00848
00852 void setShowCaption( bool shown );
00853
00857 bool showCaption() const;
00858
00863 void setLineIntent( LineIntent intent );
00864
00868 LineIntent lineIntent() const;
00869
00873 SubType subType() const;
00874
00878 void store( QDomNode &node, QDomDocument &document ) const;
00879
00880 private:
00881 Q_DECLARE_PRIVATE( LineAnnotation )
00882 Q_DISABLE_COPY( LineAnnotation )
00883 };
00884
00885 class OKULAR_EXPORT GeomAnnotation : public Annotation
00886 {
00887 public:
00888
00889 enum GeomType
00890 {
00891 InscribedSquare,
00892 InscribedCircle
00893 };
00894
00898 GeomAnnotation();
00899
00903 GeomAnnotation( const QDomNode &description );
00904
00908 ~GeomAnnotation();
00909
00914 void setGeometricalType( GeomType type );
00915
00919 GeomType geometricalType() const;
00920
00924 void setGeometricalInnerColor( const QColor &color );
00925
00929 QColor geometricalInnerColor() const;
00930
00934 void setGeometricalPointWidth( int width );
00935
00939 int geometricalPointWidth() const;
00940
00944 SubType subType() const;
00945
00950 void store( QDomNode &node, QDomDocument &document ) const;
00951
00952 private:
00953 Q_DECLARE_PRIVATE( GeomAnnotation )
00954 Q_DISABLE_COPY( GeomAnnotation )
00955 };
00956
00957 class OKULAR_EXPORT HighlightAnnotation : public Annotation
00958 {
00959 public:
00963 enum HighlightType
00964 {
00965 Highlight,
00966 Squiggly,
00967 Underline,
00968 StrikeOut
00969 };
00970
00974 HighlightAnnotation();
00975
00979 explicit HighlightAnnotation( const QDomNode &description );
00980
00984 ~HighlightAnnotation();
00985
00990 void setHighlightType( HighlightType type );
00991
00995 HighlightType highlightType() const;
00996
01001 class OKULAR_EXPORT Quad
01002 {
01003 public:
01007 Quad();
01008
01012 ~Quad();
01013
01014 Quad( const Quad &other );
01015 Quad& operator=( const Quad &other );
01016
01022 void setPoint( const NormalizedPoint &point, int index );
01023
01029 NormalizedPoint point( int index ) const;
01030
01036 NormalizedPoint transformedPoint( int index ) const;
01037
01041 void setCapStart( bool value );
01042
01046 bool capStart() const;
01047
01051 void setCapEnd( bool value );
01052
01056 bool capEnd() const;
01057
01061 void setFeather( double width );
01062
01066 double feather() const;
01067
01072 void transform( const QMatrix &matrix );
01073
01074 private:
01075 class Private;
01076 Private* const d;
01077 };
01078
01082 QList< Quad > & highlightQuads();
01083
01087 SubType subType() const;
01088
01093 void store( QDomNode &node, QDomDocument &document ) const;
01094
01095 private:
01096 Q_DECLARE_PRIVATE( HighlightAnnotation )
01097 Q_DISABLE_COPY( HighlightAnnotation )
01098 };
01099
01100 class OKULAR_EXPORT StampAnnotation : public Annotation
01101 {
01102 public:
01106 StampAnnotation();
01107
01111 explicit StampAnnotation( const QDomNode &description );
01112
01116 ~StampAnnotation();
01117
01121 void setStampIconName( const QString &name );
01122
01126 QString stampIconName() const;
01127
01131 SubType subType() const;
01132
01137 void store( QDomNode &node, QDomDocument &document ) const;
01138
01139 private:
01140 Q_DECLARE_PRIVATE( StampAnnotation )
01141 Q_DISABLE_COPY( StampAnnotation )
01142 };
01143
01144 class OKULAR_EXPORT InkAnnotation : public Annotation
01145 {
01146 public:
01150 InkAnnotation();
01151
01155 InkAnnotation( const QDomNode &description );
01156
01160 ~InkAnnotation();
01161
01165 void setInkPaths( const QList< QLinkedList<NormalizedPoint> > &paths );
01166
01170 QList< QLinkedList<NormalizedPoint> > inkPaths() const;
01171
01176 QList< QLinkedList<NormalizedPoint> > transformedInkPaths() const;
01177
01181 SubType subType() const;
01182
01187 void store( QDomNode &node, QDomDocument &document ) const;
01188
01189 private:
01190 Q_DECLARE_PRIVATE( InkAnnotation )
01191 Q_DISABLE_COPY( InkAnnotation )
01192 };
01193
01194 }
01195
01196 #endif