move the transform() hierarchy within the private class; allow AnnotationObjectRect to use the trasform() stuff

svn path=/trunk/KDE/kdegraphics/okular/; revision=661202
remotes/origin/KDE/4.0
Pino Toscano 19 years ago
parent bfe21b46f8
commit 94355bce65
  1. 62
      core/annotations.cpp
  2. 45
      core/annotations.h
  3. 8
      core/annotations_p.h
  4. 3
      core/area.cpp

@ -783,11 +783,10 @@ void Annotation::store( QDomNode & annNode, QDomDocument & document ) const
} }
} }
void Annotation::transform( const QMatrix &matrix ) void AnnotationPrivate::transform( const QMatrix &matrix )
{ {
Q_D( Annotation ); m_transformedBoundary = m_boundary;
d->m_transformedBoundary = d->m_boundary; m_transformedBoundary.transform( matrix );
d->m_transformedBoundary.transform( matrix );
} }
//END Annotation implementation //END Annotation implementation
@ -805,6 +804,8 @@ class Okular::TextAnnotationPrivate : public Okular::AnnotationPrivate
{ {
} }
virtual void transform( const QMatrix &matrix );
TextAnnotation::TextType m_textType; TextAnnotation::TextType m_textType;
QString m_textIcon; QString m_textIcon;
QFont m_textFont; QFont m_textFont;
@ -1031,14 +1032,13 @@ void TextAnnotation::store( QDomNode & node, QDomDocument & document ) const
} }
} }
void TextAnnotation::transform( const QMatrix &matrix ) void TextAnnotationPrivate::transform( const QMatrix &matrix )
{ {
Q_D( TextAnnotation ); AnnotationPrivate::transform( matrix );
Annotation::transform( matrix );
for ( int i = 0; i < 3; ++i ) { for ( int i = 0; i < 3; ++i ) {
d->m_transformedInplaceCallout[i] = d->m_inplaceCallout[i]; m_transformedInplaceCallout[i] = m_inplaceCallout[i];
d->m_transformedInplaceCallout[i].transform( matrix ); m_transformedInplaceCallout[i].transform( matrix );
} }
} }
@ -1055,6 +1055,8 @@ class Okular::LineAnnotationPrivate : public Okular::AnnotationPrivate
{ {
} }
virtual void transform( const QMatrix &matrix );
QLinkedList<NormalizedPoint> m_linePoints; QLinkedList<NormalizedPoint> m_linePoints;
QLinkedList<NormalizedPoint> m_transformedLinePoints; QLinkedList<NormalizedPoint> m_transformedLinePoints;
LineAnnotation::TermStyle m_lineStartStyle; LineAnnotation::TermStyle m_lineStartStyle;
@ -1294,14 +1296,13 @@ void LineAnnotation::store( QDomNode & node, QDomDocument & document ) const
} }
} }
void LineAnnotation::transform( const QMatrix &matrix ) void LineAnnotationPrivate::transform( const QMatrix &matrix )
{ {
Q_D( LineAnnotation ); AnnotationPrivate::transform( matrix );
Annotation::transform( matrix );
d->m_transformedLinePoints = d->m_linePoints; m_transformedLinePoints = m_linePoints;
QMutableLinkedListIterator<NormalizedPoint> it( d->m_transformedLinePoints ); QMutableLinkedListIterator<NormalizedPoint> it( m_transformedLinePoints );
while ( it.hasNext() ) while ( it.hasNext() )
it.next().transform( matrix ); it.next().transform( matrix );
} }
@ -1417,11 +1418,6 @@ void GeomAnnotation::store( QDomNode & node, QDomDocument & document ) const
geomElement.setAttribute( "width", d->m_geomWidthPt ); geomElement.setAttribute( "width", d->m_geomWidthPt );
} }
void GeomAnnotation::transform( const QMatrix &matrix )
{
Annotation::transform( matrix );
}
/** HighlightAnnotation [Annotation] */ /** HighlightAnnotation [Annotation] */
class HighlightAnnotation::Quad::Private class HighlightAnnotation::Quad::Private
@ -1533,6 +1529,8 @@ class Okular::HighlightAnnotationPrivate : public Okular::AnnotationPrivate
{ {
} }
virtual void transform( const QMatrix &matrix );
HighlightAnnotation::HighlightType m_highlightType; HighlightAnnotation::HighlightType m_highlightType;
QList< HighlightAnnotation::Quad > m_highlightQuads; QList< HighlightAnnotation::Quad > m_highlightQuads;
}; };
@ -1651,12 +1649,11 @@ Annotation::SubType HighlightAnnotation::subType() const
return AHighlight; return AHighlight;
} }
void HighlightAnnotation::transform( const QMatrix &matrix ) void HighlightAnnotationPrivate::transform( const QMatrix &matrix )
{ {
Q_D( HighlightAnnotation ); AnnotationPrivate::transform( matrix );
Annotation::transform( matrix );
QMutableListIterator<HighlightAnnotation::Quad> it( d->m_highlightQuads ); QMutableListIterator<HighlightAnnotation::Quad> it( m_highlightQuads );
while ( it.hasNext() ) while ( it.hasNext() )
it.next().transform( matrix ); it.next().transform( matrix );
} }
@ -1737,11 +1734,6 @@ void StampAnnotation::store( QDomNode & node, QDomDocument & document ) const
stampElement.setAttribute( "icon", d->m_stampIconName ); stampElement.setAttribute( "icon", d->m_stampIconName );
} }
void StampAnnotation::transform( const QMatrix &matrix )
{
Annotation::transform( matrix );
}
/** InkAnnotation [Annotation] */ /** InkAnnotation [Annotation] */
class Okular::InkAnnotationPrivate : public Okular::AnnotationPrivate class Okular::InkAnnotationPrivate : public Okular::AnnotationPrivate
@ -1752,6 +1744,8 @@ class Okular::InkAnnotationPrivate : public Okular::AnnotationPrivate
{ {
} }
virtual void transform( const QMatrix &matrix );
QList< QLinkedList<NormalizedPoint> > m_inkPaths; QList< QLinkedList<NormalizedPoint> > m_inkPaths;
QList< QLinkedList<NormalizedPoint> > m_transformedInkPaths; QList< QLinkedList<NormalizedPoint> > m_transformedInkPaths;
}; };
@ -1872,15 +1866,15 @@ void InkAnnotation::store( QDomNode & node, QDomDocument & document ) const
} }
} }
void InkAnnotation::transform( const QMatrix &matrix ) void InkAnnotationPrivate::transform( const QMatrix &matrix )
{ {
Q_D( InkAnnotation ); AnnotationPrivate::transform( matrix );
Annotation::transform( matrix );
d->m_transformedInkPaths = d->m_inkPaths; m_transformedInkPaths = m_inkPaths;
for ( int i = 0; i < d->m_transformedInkPaths.count(); ++i ) { for ( int i = 0; i < m_transformedInkPaths.count(); ++i )
QMutableLinkedListIterator<NormalizedPoint> it( d->m_transformedInkPaths[ i ] ); {
QMutableLinkedListIterator<NormalizedPoint> it( m_transformedInkPaths[ i ] );
while ( it.hasNext() ) while ( it.hasNext() )
it.next().transform( matrix ); it.next().transform( matrix );
} }

@ -24,6 +24,7 @@
namespace Okular { namespace Okular {
class Annotation; class Annotation;
class AnnotationObjectRect;
class AnnotationPrivate; class AnnotationPrivate;
class TextAnnotationPrivate; class TextAnnotationPrivate;
class LineAnnotationPrivate; class LineAnnotationPrivate;
@ -78,6 +79,8 @@ class OKULAR_EXPORT AnnotationUtils
*/ */
class OKULAR_EXPORT Annotation class OKULAR_EXPORT Annotation
{ {
friend class AnnotationObjectRect;
public: public:
/** /**
* Describes the type of annotation as defined in PDF standard. * Describes the type of annotation as defined in PDF standard.
@ -559,12 +562,6 @@ class OKULAR_EXPORT Annotation
*/ */
virtual void store( QDomNode & node, QDomDocument & document ) const; virtual void store( QDomNode & node, QDomDocument & document ) const;
/**
* Transforms the annotation coordinates with the transformation defined
* by @p matrix.
*/
virtual void transform( const QMatrix &matrix );
protected: protected:
Annotation( AnnotationPrivate &dd ); Annotation( AnnotationPrivate &dd );
Annotation( AnnotationPrivate &dd, const QDomNode &description ); Annotation( AnnotationPrivate &dd, const QDomNode &description );
@ -705,12 +702,6 @@ class OKULAR_EXPORT TextAnnotation : public Annotation
*/ */
void store( QDomNode &node, QDomDocument &document ) const; void store( QDomNode &node, QDomDocument &document ) const;
/**
* Transforms the text annotation coordinates with the transformation defined
* by @p matrix.
*/
virtual void transform( const QMatrix &matrix );
private: private:
Q_DECLARE_PRIVATE( TextAnnotation ) Q_DECLARE_PRIVATE( TextAnnotation )
Q_DISABLE_COPY( TextAnnotation ) Q_DISABLE_COPY( TextAnnotation )
@ -871,12 +862,6 @@ class OKULAR_EXPORT LineAnnotation : public Annotation
*/ */
void store( QDomNode &node, QDomDocument &document ) const; void store( QDomNode &node, QDomDocument &document ) const;
/**
* Transforms the line annotation coordinates with the transformation defined
* by @p matrix.
*/
virtual void transform( const QMatrix &matrix );
private: private:
Q_DECLARE_PRIVATE( LineAnnotation ) Q_DECLARE_PRIVATE( LineAnnotation )
Q_DISABLE_COPY( LineAnnotation ) Q_DISABLE_COPY( LineAnnotation )
@ -949,12 +934,6 @@ class OKULAR_EXPORT GeomAnnotation : public Annotation
*/ */
void store( QDomNode &node, QDomDocument &document ) const; void store( QDomNode &node, QDomDocument &document ) const;
/**
* Transforms the geometrical annotation coordinates with the transformation defined
* by @p matrix.
*/
virtual void transform( const QMatrix &matrix );
private: private:
Q_DECLARE_PRIVATE( GeomAnnotation ) Q_DECLARE_PRIVATE( GeomAnnotation )
Q_DISABLE_COPY( GeomAnnotation ) Q_DISABLE_COPY( GeomAnnotation )
@ -1098,12 +1077,6 @@ class OKULAR_EXPORT HighlightAnnotation : public Annotation
*/ */
void store( QDomNode &node, QDomDocument &document ) const; void store( QDomNode &node, QDomDocument &document ) const;
/**
* Transforms the highlight annotation coordinates with the transformation defined
* by @p matrix.
*/
virtual void transform( const QMatrix &matrix );
private: private:
Q_DECLARE_PRIVATE( HighlightAnnotation ) Q_DECLARE_PRIVATE( HighlightAnnotation )
Q_DISABLE_COPY( HighlightAnnotation ) Q_DISABLE_COPY( HighlightAnnotation )
@ -1148,12 +1121,6 @@ class OKULAR_EXPORT StampAnnotation : public Annotation
*/ */
void store( QDomNode &node, QDomDocument &document ) const; void store( QDomNode &node, QDomDocument &document ) const;
/**
* Transforms the stamp annotation coordinates with the transformation defined
* by @p matrix.
*/
virtual void transform( const QMatrix &matrix );
private: private:
Q_DECLARE_PRIVATE( StampAnnotation ) Q_DECLARE_PRIVATE( StampAnnotation )
Q_DISABLE_COPY( StampAnnotation ) Q_DISABLE_COPY( StampAnnotation )
@ -1204,12 +1171,6 @@ class OKULAR_EXPORT InkAnnotation : public Annotation
*/ */
void store( QDomNode &node, QDomDocument &document ) const; void store( QDomNode &node, QDomDocument &document ) const;
/**
* Transforms the ink annotation coordinates with the transformation defined
* by @p matrix.
*/
virtual void transform( const QMatrix &matrix );
private: private:
Q_DECLARE_PRIVATE( InkAnnotation ) Q_DECLARE_PRIVATE( InkAnnotation )
Q_DISABLE_COPY( InkAnnotation ) Q_DISABLE_COPY( InkAnnotation )

@ -18,6 +18,8 @@
#include <QtCore/QString> #include <QtCore/QString>
#include <QtGui/QColor> #include <QtGui/QColor>
class QMatrix;
namespace Okular { namespace Okular {
class AnnotationPrivate class AnnotationPrivate
@ -27,6 +29,12 @@ class AnnotationPrivate
virtual ~AnnotationPrivate(); virtual ~AnnotationPrivate();
/**
* Transforms the annotation coordinates with the transformation
* defined by @p matrix.
*/
virtual void transform( const QMatrix &matrix );
QString m_author; QString m_author;
QString m_contents; QString m_contents;
QString m_uniqueName; QString m_uniqueName;

@ -16,6 +16,7 @@
#include "action.h" #include "action.h"
#include "annotations.h" #include "annotations.h"
#include "annotations_p.h"
#include "sourcereference.h" #include "sourcereference.h"
using namespace Okular; using namespace Okular;
@ -297,7 +298,7 @@ AnnotationObjectRect::~AnnotationObjectRect()
void AnnotationObjectRect::transform( const QMatrix &matrix ) void AnnotationObjectRect::transform( const QMatrix &matrix )
{ {
m_annotation->transform( matrix ); m_annotation->d_func()->transform( matrix );
} }
/** class SourceRefObjectRect **/ /** class SourceRefObjectRect **/

Loading…
Cancel
Save