summaryrefslogtreecommitdiff
path: root/qt5
diff options
context:
space:
mode:
authorFabio D'Urso <fabiodurso@hotmail.it>2013-03-02 00:55:58 +0100
committerAlbert Astals Cid <aacid@kde.org>2013-06-30 21:10:28 +0200
commitab130c91492765f8be29ed112dd2e2e6f665641b (patch)
treec7fe225e21cc504ac746ef245b09013319afdc02 /qt5
parent35cfb6914e1be4c5eda2f355900b1a0a1fa69d19 (diff)
core: Remove geometry-related arguments from annotation constructors
Removed arguments from annotation constructors related to the geometry of the annotation. This change will make it easier to support creating annotations with flag NoRotate in the next patch (because no special cases will be needed: coordinate conversion code will be able to always assume that the underlying annotation object already exists). Data that used to be taken from these arguments is now replaced by dummy values, which can be modified using appropriate setter methods after the annotation object is created. Affected annotation types: - AnnotLine - AnnotTextMarkup - AnnotPolygon - AnnotInk
Diffstat (limited to 'qt5')
-rw-r--r--qt5/src/poppler-annotation.cc34
1 files changed, 18 insertions, 16 deletions
diff --git a/qt5/src/poppler-annotation.cc b/qt5/src/poppler-annotation.cc
index 956e0286..35cef49a 100644
--- a/qt5/src/poppler-annotation.cc
+++ b/qt5/src/poppler-annotation.cc
@@ -2,7 +2,7 @@
* Copyright (C) 2006, 2009, 2012 Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2006, 2008, 2010 Pino Toscano <pino@kde.org>
* Copyright (C) 2012, Guillermo A. Amaral B. <gamaral@kde.org>
- * Copyright (C) 2012, Fabio D'Urso <fabiodurso@hotmail.it>
+ * Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it>
* Copyright (C) 2012, Tobias Koenig <tokoe@kdab.com>
* Adapting code from
* Copyright (C) 2004 by Enrico Ros <eros.kde@email.it>
@@ -2050,22 +2050,20 @@ Annot* LineAnnotationPrivate::createNativeAnnot(::Page *destPage, DocumentData *
parentDoc = doc;
// Set pdfAnnot
- AnnotPath * path = toAnnotPath(linePoints);
PDFRectangle rect = toPdfRectangle(boundary);
if (lineType == LineAnnotation::StraightLine)
{
- PDFRectangle lrect(path->getX(0), path->getY(0), path->getX(1), path->getY(1));
- pdfAnnot = new AnnotLine(doc->doc, &rect, &lrect);
+ pdfAnnot = new AnnotLine(doc->doc, &rect);
}
else
{
pdfAnnot = new AnnotPolygon(doc->doc, &rect,
- lineClosed ? Annot::typePolygon : Annot::typePolyLine, path );
+ lineClosed ? Annot::typePolygon : Annot::typePolyLine );
}
- delete path;
// Set properties
flushBaseAnnotationProperties();
+ q->setLinePoints(linePoints);
q->setLineStartStyle(lineStartStyle);
q->setLineEndStyle(lineEndStyle);
q->setLineInnerColor(lineInnerColor);
@@ -2897,21 +2895,25 @@ AnnotQuadrilaterals * HighlightAnnotationPrivate::toQuadrilaterals(const QList<
Annot* HighlightAnnotationPrivate::createNativeAnnot(::Page *destPage, DocumentData *doc)
{
+ // Setters are defined in the public class
+ HighlightAnnotation *q = static_cast<HighlightAnnotation*>( makeAlias() );
+
// Set page and document
pdfPage = destPage;
parentDoc = doc;
// Set pdfAnnot
PDFRectangle rect = toPdfRectangle(boundary);
- AnnotQuadrilaterals * quads = toQuadrilaterals(highlightQuads);
- pdfAnnot = new AnnotTextMarkup(destPage->getDoc(), &rect, toAnnotSubType(highlightType), quads);
- delete quads;
+ pdfAnnot = new AnnotTextMarkup(destPage->getDoc(), &rect, toAnnotSubType(highlightType));
// Set properties
flushBaseAnnotationProperties();
+ q->setHighlightQuads(highlightQuads);
highlightQuads.clear(); // Free up memory
+ delete q;
+
return pdfAnnot;
}
@@ -3242,25 +3244,25 @@ AnnotPath **InkAnnotationPrivate::toAnnotPaths(const QList< QLinkedList<QPointF>
Annot* InkAnnotationPrivate::createNativeAnnot(::Page *destPage, DocumentData *doc)
{
+ // Setters are defined in the public class
+ InkAnnotation *q = static_cast<InkAnnotation*>( makeAlias() );
+
// Set page and document
pdfPage = destPage;
parentDoc = doc;
// Set pdfAnnot
PDFRectangle rect = toPdfRectangle(boundary);
- AnnotPath **paths = toAnnotPaths(inkPaths);
- const int pathsNumber = inkPaths.size();
- pdfAnnot = new AnnotInk(destPage->getDoc(), &rect, paths, pathsNumber);
-
- for (int i = 0; i < pathsNumber; ++i)
- delete paths[i];
- delete[] paths;
+ pdfAnnot = new AnnotInk(destPage->getDoc(), &rect);
// Set properties
flushBaseAnnotationProperties();
+ q->setInkPaths(inkPaths);
inkPaths.clear(); // Free up memory
+ delete q;
+
return pdfAnnot;
}