[poppler] 3 commits - qt6/src
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Aug 21 18:00:39 UTC 2020
qt6/src/poppler-annotation-private.h | 4 +-
qt6/src/poppler-annotation.cc | 54 ++++++++++++++++++++++++-----------
qt6/src/poppler-annotation.h | 23 +++++++++-----
3 files changed, 54 insertions(+), 27 deletions(-)
New commits:
commit 171bd475f0cc2c98ccd864adf3fd73ecfd4af7cd
Author: Albert Astals Cid <aacid at kde.org>
Date: Fri Aug 21 19:55:32 2020 +0200
qt6: Make inplaceAlign return an enum not an int
diff --git a/qt6/src/poppler-annotation.cc b/qt6/src/poppler-annotation.cc
index 2fbd66be..fd77a651 100644
--- a/qt6/src/poppler-annotation.cc
+++ b/qt6/src/poppler-annotation.cc
@@ -1408,12 +1408,12 @@ public:
QString textIcon;
QFont textFont;
QColor textColor;
- int inplaceAlign; // 0:left, 1:center, 2:right
+ TextAnnotation::InplaceAlignPosition inplaceAlign;
QVector<QPointF> inplaceCallout;
TextAnnotation::InplaceIntent inplaceIntent;
};
-TextAnnotationPrivate::TextAnnotationPrivate() : AnnotationPrivate(), textType(TextAnnotation::Linked), textIcon(QStringLiteral("Note")), inplaceAlign(0), inplaceIntent(TextAnnotation::Unknown) { }
+TextAnnotationPrivate::TextAnnotationPrivate() : AnnotationPrivate(), textType(TextAnnotation::Linked), textIcon(QStringLiteral("Note")), inplaceAlign(TextAnnotation::InplaceAlignLeft), inplaceIntent(TextAnnotation::Unknown) { }
Annotation *TextAnnotationPrivate::makeAlias()
{
@@ -1590,7 +1590,7 @@ void TextAnnotation::setTextColor(const QColor &color)
d->setDefaultAppearanceToNative();
}
-int TextAnnotation::inplaceAlign() const
+TextAnnotation::InplaceAlignPosition TextAnnotation::inplaceAlign() const
{
Q_D(const TextAnnotation);
@@ -1599,13 +1599,33 @@ int TextAnnotation::inplaceAlign() const
if (d->pdfAnnot->getType() == Annot::typeFreeText) {
const AnnotFreeText *ftextann = static_cast<const AnnotFreeText *>(d->pdfAnnot);
- return ftextann->getQuadding();
+ switch (ftextann->getQuadding()) {
+ case quaddingLeftJustified:
+ return InplaceAlignLeft;
+ case quaddingCentered:
+ return InplaceAlignCenter;
+ case quaddingRightJustified:
+ return InplaceAlignRight;
+ }
}
- return 0;
+ return InplaceAlignLeft;
+}
+
+static AnnotFreeText::AnnotFreeTextQuadding alignToQuadding(TextAnnotation::InplaceAlignPosition align)
+{
+ switch (align) {
+ case TextAnnotation::InplaceAlignLeft:
+ return AnnotFreeText::quaddingLeftJustified;
+ case TextAnnotation::InplaceAlignCenter:
+ return AnnotFreeText::quaddingCentered;
+ case TextAnnotation::InplaceAlignRight:
+ return AnnotFreeText::quaddingRightJustified;
+ }
+ return AnnotFreeText::quaddingLeftJustified;
}
-void TextAnnotation::setInplaceAlign(int align)
+void TextAnnotation::setInplaceAlign(InplaceAlignPosition align)
{
Q_D(TextAnnotation);
@@ -1616,7 +1636,7 @@ void TextAnnotation::setInplaceAlign(int align)
if (d->pdfAnnot->getType() == Annot::typeFreeText) {
AnnotFreeText *ftextann = static_cast<AnnotFreeText *>(d->pdfAnnot);
- ftextann->setQuadding((AnnotFreeText::AnnotFreeTextQuadding)align);
+ ftextann->setQuadding(alignToQuadding(align));
}
}
diff --git a/qt6/src/poppler-annotation.h b/qt6/src/poppler-annotation.h
index f5522ebf..6fad7e3e 100644
--- a/qt6/src/poppler-annotation.h
+++ b/qt6/src/poppler-annotation.h
@@ -436,6 +436,12 @@ public:
Callout,
TypeWriter
};
+ enum InplaceAlignPosition
+ {
+ InplaceAlignLeft,
+ InplaceAlignCenter,
+ InplaceAlignRight
+ };
TextAnnotation(TextType type);
~TextAnnotation() override;
@@ -472,9 +478,8 @@ public:
QColor textColor() const;
void setTextColor(const QColor &color);
- // 0:left, 1:center, 2:right
- int inplaceAlign() const;
- void setInplaceAlign(int align);
+ InplaceAlignPosition inplaceAlign() const;
+ void setInplaceAlign(InplaceAlignPosition align);
QPointF calloutPoint(int id) const;
QVector<QPointF> calloutPoints() const;
commit f9480192c02789e687156fd2c297980dde6461ac
Author: Albert Astals Cid <aacid at kde.org>
Date: Fri Aug 21 19:44:50 2020 +0200
qt6: Remove useless A_BASE enum value
diff --git a/qt6/src/poppler-annotation.h b/qt6/src/poppler-annotation.h
index ed73d737..f5522ebf 100644
--- a/qt6/src/poppler-annotation.h
+++ b/qt6/src/poppler-annotation.h
@@ -166,8 +166,7 @@ public:
AMovie = 11, ///< MovieAnnotation
AScreen = 12, ///< ScreenAnnotation
AWidget = 13, ///< WidgetAnnotation
- ARichMedia = 14, ///< RichMediaAnnotation
- A_BASE = 0
+ ARichMedia = 14 ///< RichMediaAnnotation
};
/**
commit d1bb49c3368fa2c16c43abbc800566bb2905e429
Author: Albert Astals Cid <aacid at kde.org>
Date: Fri Aug 21 19:44:27 2020 +0200
qt6: Make flags method actually return flags and not int
diff --git a/qt6/src/poppler-annotation-private.h b/qt6/src/poppler-annotation-private.h
index 32d10369..288ab6f1 100644
--- a/qt6/src/poppler-annotation-private.h
+++ b/qt6/src/poppler-annotation-private.h
@@ -2,7 +2,7 @@
* Copyright (C) 2007, Pino Toscano <pino at kde.org>
* Copyright (C) 2012, Tobias Koenig <tokoe at kdab.com>
* Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso at hotmail.it>
- * Copyright (C) 2012, 2014, 2018, 2019, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2012, 2014, 2018-2020, Albert Astals Cid <aacid at kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -60,7 +60,7 @@ public:
QDateTime creationDate; // before or equal to modifyDate
/* properties: look/interaction related */
- int flags;
+ Annotation::Flags flags;
QRectF boundary;
/* style and popup */
diff --git a/qt6/src/poppler-annotation.cc b/qt6/src/poppler-annotation.cc
index 0ebd0daf..2fbd66be 100644
--- a/qt6/src/poppler-annotation.cc
+++ b/qt6/src/poppler-annotation.cc
@@ -1,5 +1,5 @@
/* poppler-annotation.cc: qt interface to poppler
- * Copyright (C) 2006, 2009, 2012-2015, 2018, 2019 Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2006, 2009, 2012-2015, 2018-2020 Albert Astals Cid <aacid at kde.org>
* Copyright (C) 2006, 2008, 2010 Pino Toscano <pino at kde.org>
* Copyright (C) 2012, Guillermo A. Amaral B. <gamaral at kde.org>
* Copyright (C) 2012-2014 Fabio D'Urso <fabiodurso at hotmail.it>
@@ -61,7 +61,7 @@
namespace Poppler {
// BEGIN Annotation implementation
-AnnotationPrivate::AnnotationPrivate() : flags(0), revisionScope(Annotation::Root), revisionType(Annotation::None), pdfAnnot(nullptr), pdfPage(nullptr), parentDoc(nullptr) { }
+AnnotationPrivate::AnnotationPrivate() : revisionScope(Annotation::Root), revisionType(Annotation::None), pdfAnnot(nullptr), pdfPage(nullptr), parentDoc(nullptr) { }
void AnnotationPrivate::addRevision(Annotation *ann, Annotation::RevScope scope, Annotation::RevType type)
{
@@ -1077,9 +1077,9 @@ void Annotation::setCreationDate(const QDateTime &date)
#endif
}
-static int fromPdfFlags(int flags)
+static Annotation::Flags fromPdfFlags(int flags)
{
- int qtflags = 0;
+ Annotation::Flags qtflags;
if (flags & Annot::flagHidden)
qtflags |= Annotation::Hidden;
@@ -1089,8 +1089,10 @@ static int fromPdfFlags(int flags)
qtflags |= Annotation::FixedRotation;
if (!(flags & Annot::flagPrint))
qtflags |= Annotation::DenyPrint;
- if (flags & Annot::flagReadOnly)
- qtflags |= (Annotation::DenyWrite | Annotation::DenyDelete);
+ if (flags & Annot::flagReadOnly) {
+ qtflags |= Annotation::DenyWrite;
+ qtflags |= Annotation::DenyDelete;
+ }
if (flags & Annot::flagLocked)
qtflags |= Annotation::DenyDelete;
if (flags & Annot::flagToggleNoView)
@@ -1099,7 +1101,7 @@ static int fromPdfFlags(int flags)
return qtflags;
}
-static int toPdfFlags(int qtflags)
+static int toPdfFlags(Annotation::Flags qtflags)
{
int flags = 0;
@@ -1121,7 +1123,7 @@ static int toPdfFlags(int qtflags)
return flags;
}
-int Annotation::flags() const
+Annotation::Flags Annotation::flags() const
{
Q_D(const Annotation);
@@ -1131,7 +1133,7 @@ int Annotation::flags() const
return fromPdfFlags(d->pdfAnnot->getFlags());
}
-void Annotation::setFlags(int flags)
+void Annotation::setFlags(Annotation::Flags flags)
{
Q_D(Annotation);
diff --git a/qt6/src/poppler-annotation.h b/qt6/src/poppler-annotation.h
index 701d6d3b..ed73d737 100644
--- a/qt6/src/poppler-annotation.h
+++ b/qt6/src/poppler-annotation.h
@@ -175,7 +175,7 @@ public:
*
* They can be OR'd together (e.g. Annotation::FixedRotation | Annotation::DenyPrint).
*
- * \sa flags(), setFlags(int)
+ * \sa flags(), setFlags()
*/
// NOTE: Only flags that are known to work are documented
enum Flag
@@ -189,6 +189,7 @@ public:
ToggleHidingOnMouse = 64,
External = 128
};
+ Q_DECLARE_FLAGS(Flags, Flag)
enum LineStyle
{
@@ -253,15 +254,15 @@ public:
/**
* Returns this annotation's flags
*
- * \sa Flag, setFlags(int)
+ * \sa Flag, setFlags()
*/
- int flags() const;
+ Flags flags() const;
/**
* Sets this annotation's flags
*
* \sa Flag, flags(), \ref annotFixedRotation
*/
- void setFlags(int flags);
+ void setFlags(Flags flags);
/**
* Returns this annotation's boundary rectangle in normalized coordinates
More information about the poppler
mailing list