7#include "annotations.h"
8#include "annotations_p.h"
11#include <QApplication>
16#include <QStandardPaths>
17#include <QSvgRenderer>
25#include "document_p.h"
39 return ((b.
x - a.
x) * (c.
y - a.
y) - (b.
y - a.
y) * (c.
x - a.
x)) > 0;
47static double distanceSqr(
double x,
double y,
double xScale,
double yScale,
const QList<NormalizedPoint> &path)
57 if (thisDistance < distance) {
87static double strokeDistance(
double distance,
double penWidth)
89 return fmax(distance - pow(penWidth, 2), 0);
102 int typeNumber = annElement.
attribute(QStringLiteral(
"type")).
toInt();
103 switch (typeNumber) {
105 annotation =
new TextAnnotation(annElement);
108 annotation =
new LineAnnotation(annElement);
111 annotation =
new GeomAnnotation(annElement);
114 annotation =
new HighlightAnnotation(annElement);
117 annotation =
new StampAnnotation(annElement);
120 annotation =
new InkAnnotation(annElement);
123 annotation =
new CaretAnnotation(annElement);
137 ann->
store(annElement, document);
146 if (element.
tagName() == name) {
158 if (annotation->
subType() ==
Annotation::AText && (((TextAnnotation *)annotation)->textType() == TextAnnotation::Linked)) {
162 return rect24.
united(rect);
172 static std::unique_ptr<QSvgRenderer> svgStampFile;
173 if (!svgStampFile.get()) {
176 svgStampFile = std::make_unique<QSvgRenderer>(stampFile);
177 if (!svgStampFile->isValid()) {
178 svgStampFile.reset();
201 pixmap.
load(nameOrPath);
213AnnotationProxy::AnnotationProxy()
223class Annotation::Style::Private
235 , m_effectIntensity(1.0)
248 double m_effectIntensity;
269 if (
this != &other) {
288 d->m_opacity = opacity;
318 d->m_xCorners = xCorners;
323 return d->m_xCorners;
328 d->m_yCorners = yCorners;
333 return d->m_yCorners;
348 d->m_spaces = spaces;
358 d->m_effect = effect;
368 d->m_effectIntensity = intensity;
373 return d->m_effectIntensity;
376class Annotation::Window::Private
412 if (
this != &other) {
431 d->m_topLeft = point;
451 d->m_height = height;
471 d->m_summary = summary;
479class Annotation::Revision::Private
483 : m_annotation(nullptr)
490 RevisionScope m_scope;
512 if (
this != &other) {
521 d->m_annotation = annotation;
526 return d->m_annotation;
549AnnotationPrivate::AnnotationPrivate()
552 , m_disposeFunc(nullptr)
556AnnotationPrivate::~AnnotationPrivate()
559 if (m_revisions.isEmpty()) {
564 delete revision.annotation();
568AnnotationPrivate *AnnotationPrivate::get(
Annotation *a)
570 return a ? a->d_ptr :
nullptr;
573Annotation::Annotation(AnnotationPrivate &dd)
578Annotation::Annotation(AnnotationPrivate &dd,
const QDomNode &description)
581 d_ptr->setAnnotationProperties(description);
586 if (d_ptr->m_disposeFunc) {
587 d_ptr->m_disposeFunc(
this);
614 return d->m_contents;
620 d->m_uniqueName = name;
626 return d->m_uniqueName;
632 d->m_modifyDate = date;
638 return d->m_modifyDate;
644 d->m_creationDate = date;
650 return d->m_creationDate;
668 d->m_boundary = rectangle;
669 d->resetTransformation();
671 d->
transform(d->m_page->rotationMatrix());
678 return d->m_boundary;
684 return d->m_transformedBoundary;
691 d->resetTransformation();
693 d->transform(d->m_page->rotationMatrix());
700 d->adjust(deltaCoord1, deltaCoord2);
701 d->resetTransformation();
703 d->transform(d->m_page->rotationMatrix());
710 return d->openDialogAfterCreation();
740 return d->m_revisions;
746 return d->m_revisions;
758 return d->m_nativeId;
764 d->m_disposeFunc = func;
772 if (!d->m_page || !d->m_page->m_doc->m_parent->canModifyPageAnnotation(
this)) {
789 if (!d->m_page || !d->m_page->m_doc->m_parent->canModifyPageAnnotation(
this)) {
793 return d->canBeResized();
804 if (!d->m_author.isEmpty()) {
807 if (!d->m_contents.isEmpty()) {
808 e.
setAttribute(QStringLiteral(
"contents"), d->m_contents);
810 if (!d->m_uniqueName.isEmpty()) {
811 e.
setAttribute(QStringLiteral(
"uniqueName"), d->m_uniqueName);
813 if (d->m_modifyDate.isValid()) {
816 if (d->m_creationDate.isValid()) {
824 if (d->m_style.color().isValid()) {
827 if (d->m_style.opacity() != 1.0) {
840 if (d->m_style.width() != 1 || d->m_style.lineStyle() !=
Solid || d->m_style.xCorners() != 0 || d->m_style.yCorners() != 0.0 || d->m_style.marks() != 3 || d->m_style.spaces() != 0) {
844 psE.
setAttribute(QStringLiteral(
"style"), (
int)d->m_style.lineStyle());
847 psE.
setAttribute(QStringLiteral(
"marks"), d->m_style.marks());
848 psE.
setAttribute(QStringLiteral(
"spaces"), d->m_style.spaces());
852 if (d->m_style.lineEffect() !=
NoEffect || d->m_style.effectIntensity() != 1.0) {
855 peE.
setAttribute(QStringLiteral(
"effect"), (
int)d->m_style.lineEffect());
860 if (d->m_window.flags() != -1 || !d->m_window.title().isEmpty() || !d->m_window.summary().isEmpty()) {
863 wE.
setAttribute(QStringLiteral(
"flags"), d->m_window.flags());
866 wE.
setAttribute(QStringLiteral(
"width"), d->m_window.width());
867 wE.
setAttribute(QStringLiteral(
"height"), d->m_window.height());
868 wE.
setAttribute(QStringLiteral(
"title"), d->m_window.title());
869 wE.
setAttribute(QStringLiteral(
"summary"), d->m_window.summary());
873 if (d->m_revisions.isEmpty()) {
878 for (
const Revision &revision : std::as_const(d->m_revisions)) {
883 r.
setAttribute(QStringLiteral(
"revScope"), (int)revision.scope());
884 r.
setAttribute(QStringLiteral(
"revType"), (int)revision.type());
902 Okular::PagePrivate *p = d_ptr->m_page;
903 QVariant nativeID = d_ptr->m_nativeId;
908 AnnotationPrivate *new_d_ptr = d_ptr->getNewAnnotationPrivate();
913 d_ptr->setAnnotationProperties(node);
917 d_ptr->m_nativeId = nativeID;
918 d_ptr->m_flags = d_ptr->m_flags | internalFlags;
919 d_ptr->m_disposeFunc = disposeFunc;
922 d_ptr->transform(d_ptr->m_page->rotationMatrix());
925double AnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
927 return m_transformedBoundary.distanceSqr(x, y, xScale, yScale);
930void AnnotationPrivate::annotationTransform(
const QTransform &matrix)
932 resetTransformation();
936void AnnotationPrivate::transform(
const QTransform &matrix)
938 m_transformedBoundary.transform(matrix);
941void AnnotationPrivate::baseTransform(
const QTransform &matrix)
943 m_boundary.transform(matrix);
946void AnnotationPrivate::resetTransformation()
948 m_transformedBoundary = m_boundary;
953 m_boundary.left = m_boundary.left + coord.
x;
954 m_boundary.right = m_boundary.right + coord.
x;
955 m_boundary.top = m_boundary.top + coord.
y;
956 m_boundary.bottom = m_boundary.bottom + coord.
y;
961 m_boundary.left = m_boundary.left + qBound(-m_boundary.left, deltaCoord1.
x, m_boundary.right - m_boundary.left);
962 m_boundary.top = m_boundary.top + qBound(-m_boundary.top, deltaCoord1.
y, m_boundary.bottom - m_boundary.top);
964 m_boundary.right = m_boundary.right + qBound(m_boundary.left - m_boundary.right, deltaCoord2.
x, 1. - m_boundary.right);
965 m_boundary.bottom = m_boundary.bottom + qBound(m_boundary.top - m_boundary.bottom, deltaCoord2.
y, 1. - m_boundary.bottom);
968bool AnnotationPrivate::openDialogAfterCreation()
const
973void AnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
983 m_author = e.
attribute(QStringLiteral(
"author"));
986 m_contents = e.
attribute(QStringLiteral(
"contents"));
989 m_uniqueName = e.
attribute(QStringLiteral(
"uniqueName"));
1006 m_style.setOpacity(e.
attribute(QStringLiteral(
"opacity")).toDouble());
1022 m_style.setWidth(ee.
attribute(QStringLiteral(
"width")).toDouble());
1024 m_style.setXCorners(ee.
attribute(QStringLiteral(
"xcr")).toDouble());
1025 m_style.setYCorners(ee.
attribute(QStringLiteral(
"ycr")).toDouble());
1026 m_style.setMarks(ee.
attribute(QStringLiteral(
"marks")).toInt());
1027 m_style.setSpaces(ee.
attribute(QStringLiteral(
"spaces")).toInt());
1032 m_style.setEffectIntensity(ee.
attribute(QStringLiteral(
"intensity")).toDouble());
1036 m_window.setFlags(ee.
attribute(QStringLiteral(
"flags")).toInt());
1038 m_window.setWidth(ee.
attribute(QStringLiteral(
"width")).toInt());
1039 m_window.setHeight(ee.
attribute(QStringLiteral(
"height")).toInt());
1040 m_window.setTitle(ee.
attribute(QStringLiteral(
"title")));
1041 m_window.setSummary(ee.
attribute(QStringLiteral(
"summary")));
1061 m_revisions.append(revision);
1065 m_transformedBoundary = m_boundary;
1068bool AnnotationPrivate::canBeResized()
const
1077class Okular::TextAnnotationPrivate :
public Okular::AnnotationPrivate
1080 TextAnnotationPrivate()
1081 : AnnotationPrivate()
1082 , m_textType(TextAnnotation::Linked)
1083 , m_textIcon(QStringLiteral(
"Comment"))
1085 , m_inplaceIntent(TextAnnotation::
Unknown)
1090 void baseTransform(
const QTransform &matrix)
override;
1091 void resetTransformation()
override;
1093 bool openDialogAfterCreation()
const override;
1094 void setAnnotationProperties(
const QDomNode &node)
override;
1095 bool canBeResized()
const override;
1096 AnnotationPrivate *getNewAnnotationPrivate()
override;
1098 TextAnnotation::TextType m_textType;
1105 TextAnnotation::InplaceIntent m_inplaceIntent;
1111TextAnnotation::TextAnnotation()
1116TextAnnotation::TextAnnotation(
const QDomNode &description)
1117 :
Annotation(*new TextAnnotationPrivate(), description)
1121TextAnnotation::~TextAnnotation()
1125void TextAnnotation::setTextType(TextType textType)
1127 Q_D(TextAnnotation);
1128 d->m_textType = textType;
1131TextAnnotation::TextType TextAnnotation::textType()
const
1133 Q_D(
const TextAnnotation);
1134 return d->m_textType;
1137void TextAnnotation::setTextIcon(
const QString &icon)
1139 Q_D(TextAnnotation);
1140 d->m_textIcon = icon;
1143QString TextAnnotation::textIcon()
const
1145 Q_D(
const TextAnnotation);
1146 return d->m_textIcon;
1149void TextAnnotation::setTextFont(
const QFont &font)
1151 Q_D(TextAnnotation);
1152 d->m_textFont = font;
1155QFont TextAnnotation::textFont()
const
1157 Q_D(
const TextAnnotation);
1158 return d->m_textFont;
1161void TextAnnotation::setTextColor(
const QColor &color)
1163 Q_D(TextAnnotation);
1164 d->m_textColor = color;
1167QColor TextAnnotation::textColor()
const
1169 Q_D(
const TextAnnotation);
1170 return d->m_textColor;
1173void TextAnnotation::setInplaceAlignment(
int alignment)
1175 Q_D(TextAnnotation);
1176 d->m_inplaceAlign = alignment;
1179int TextAnnotation::inplaceAlignment()
const
1181 Q_D(
const TextAnnotation);
1182 return d->m_inplaceAlign;
1185void TextAnnotation::setInplaceCallout(
const NormalizedPoint &point,
int index)
1187 if (index < 0 || index > 2) {
1191 Q_D(TextAnnotation);
1192 d->m_inplaceCallout[index] = point;
1197 if (index < 0 || index > 2) {
1201 Q_D(
const TextAnnotation);
1202 return d->m_inplaceCallout[index];
1205NormalizedPoint TextAnnotation::transformedInplaceCallout(
int index)
const
1207 if (index < 0 || index > 2) {
1211 Q_D(
const TextAnnotation);
1212 return d->m_transformedInplaceCallout[index];
1215void TextAnnotation::setInplaceIntent(InplaceIntent intent)
1217 Q_D(TextAnnotation);
1218 d->m_inplaceIntent = intent;
1221TextAnnotation::InplaceIntent TextAnnotation::inplaceIntent()
const
1223 Q_D(
const TextAnnotation);
1224 return d->m_inplaceIntent;
1234 Q_D(
const TextAnnotation);
1243 if (d->m_textType != Linked) {
1244 textElement.
setAttribute(QStringLiteral(
"type"), (
int)d->m_textType);
1246 if (!d->m_textIcon.isEmpty()) {
1247 textElement.
setAttribute(QStringLiteral(
"icon"), d->m_textIcon);
1250 textElement.
setAttribute(QStringLiteral(
"font"), d->m_textFont.toString());
1252 if (d->m_textColor.isValid()) {
1253 textElement.
setAttribute(QStringLiteral(
"fontColor"), d->m_textColor.name());
1255 if (d->m_inplaceAlign) {
1256 textElement.
setAttribute(QStringLiteral(
"align"), d->m_inplaceAlign);
1258 if (d->m_inplaceIntent != Unknown) {
1259 textElement.
setAttribute(QStringLiteral(
"intent"), (
int)d->m_inplaceIntent);
1263 if (d->m_inplaceCallout[0].x != 0.0) {
1275void TextAnnotationPrivate::transform(
const QTransform &matrix)
1277 AnnotationPrivate::transform(matrix);
1280 np.transform(matrix);
1284void TextAnnotationPrivate::baseTransform(
const QTransform &matrix)
1286 AnnotationPrivate::baseTransform(matrix);
1289 np.transform(matrix);
1293void TextAnnotationPrivate::resetTransformation()
1295 AnnotationPrivate::resetTransformation();
1297 for (
int i = 0; i < 3; ++i) {
1298 m_transformedInplaceCallout[i] = m_inplaceCallout[i];
1304 AnnotationPrivate::translate(coord);
1306#define ADD_COORD(c1, c2) \
1308 c1.x = c1.x + c2.x; \
1309 c1.y = c1.y + c2.y; \
1311 ADD_COORD(m_inplaceCallout[0], coord)
1312 ADD_COORD(m_inplaceCallout[1], coord)
1313 ADD_COORD(m_inplaceCallout[2], coord)
1317bool TextAnnotationPrivate::openDialogAfterCreation()
const
1319 return (m_textType == Okular::TextAnnotation::Linked) || (m_inplaceIntent == TextAnnotation::InplaceIntent::Unknown);
1322void TextAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
1324 Okular::AnnotationPrivate::setAnnotationProperties(node);
1337 m_textType = (TextAnnotation::TextType)e.
attribute(QStringLiteral(
"type")).toInt();
1340 m_textIcon = e.
attribute(QStringLiteral(
"icon"));
1352 m_inplaceIntent = (TextAnnotation::InplaceIntent)e.
attribute(QStringLiteral(
"intent")).toInt();
1364 m_inplaceCallout[0].
x = ee.
attribute(QStringLiteral(
"ax")).toDouble();
1365 m_inplaceCallout[0].
y = ee.
attribute(QStringLiteral(
"ay")).toDouble();
1366 m_inplaceCallout[1].
x = ee.
attribute(QStringLiteral(
"bx")).toDouble();
1367 m_inplaceCallout[1].
y = ee.
attribute(QStringLiteral(
"by")).toDouble();
1368 m_inplaceCallout[2].
x = ee.
attribute(QStringLiteral(
"cx")).toDouble();
1369 m_inplaceCallout[2].
y = ee.
attribute(QStringLiteral(
"cy")).toDouble();
1377 for (
int i = 0; i < 3; ++i) {
1378 m_transformedInplaceCallout[i] = m_inplaceCallout[i];
1382bool TextAnnotationPrivate::canBeResized()
const
1384 if (m_textType != TextAnnotation::Linked) {
1390AnnotationPrivate *TextAnnotationPrivate::getNewAnnotationPrivate()
1392 return new TextAnnotationPrivate();
1397class Okular::LineAnnotationPrivate :
public Okular::AnnotationPrivate
1400 LineAnnotationPrivate()
1401 : AnnotationPrivate()
1402 , m_lineStartStyle(LineAnnotation::
None)
1403 , m_lineEndStyle(LineAnnotation::
None)
1404 , m_lineClosed(false)
1405 , m_lineShowCaption(false)
1406 , m_lineLeadingFwdPt(0)
1407 , m_lineLeadingBackPt(0)
1408 , m_lineIntent(LineAnnotation::
Unknown)
1412 void transform(
const QTransform &matrix)
override;
1413 void baseTransform(
const QTransform &matrix)
override;
1414 void resetTransformation()
override;
1416 double distanceSqr(
double x,
double y,
double xScale,
double yScale)
const override;
1417 void setAnnotationProperties(
const QDomNode &node)
override;
1418 AnnotationPrivate *getNewAnnotationPrivate()
override;
1422 LineAnnotation::TermStyle m_lineStartStyle;
1423 LineAnnotation::TermStyle m_lineEndStyle;
1424 bool m_lineClosed : 1;
1425 bool m_lineShowCaption : 1;
1427 double m_lineLeadingFwdPt;
1428 double m_lineLeadingBackPt;
1429 LineAnnotation::LineIntent m_lineIntent;
1432LineAnnotation::LineAnnotation()
1437LineAnnotation::LineAnnotation(
const QDomNode &description)
1438 :
Annotation(*new LineAnnotationPrivate(), description)
1442LineAnnotation::~LineAnnotation()
1448 Q_D(LineAnnotation);
1449 d->m_linePoints = points;
1454 Q_D(
const LineAnnotation);
1455 return d->m_linePoints;
1460 Q_D(
const LineAnnotation);
1461 return d->m_transformedLinePoints;
1464void LineAnnotation::setLineStartStyle(TermStyle style)
1466 Q_D(LineAnnotation);
1467 d->m_lineStartStyle =
style;
1470LineAnnotation::TermStyle LineAnnotation::lineStartStyle()
const
1472 Q_D(
const LineAnnotation);
1473 return d->m_lineStartStyle;
1476void LineAnnotation::setLineEndStyle(TermStyle style)
1478 Q_D(LineAnnotation);
1479 d->m_lineEndStyle =
style;
1482LineAnnotation::TermStyle LineAnnotation::lineEndStyle()
const
1484 Q_D(
const LineAnnotation);
1485 return d->m_lineEndStyle;
1488void LineAnnotation::setLineClosed(
bool closed)
1490 Q_D(LineAnnotation);
1491 d->m_lineClosed = closed;
1494bool LineAnnotation::lineClosed()
const
1496 Q_D(
const LineAnnotation);
1497 return d->m_lineClosed;
1500void LineAnnotation::setLineInnerColor(
const QColor &color)
1502 Q_D(LineAnnotation);
1503 d->m_lineInnerColor = color;
1506QColor LineAnnotation::lineInnerColor()
const
1508 Q_D(
const LineAnnotation);
1509 return d->m_lineInnerColor;
1512void LineAnnotation::setLineLeadingForwardPoint(
double point)
1514 Q_D(LineAnnotation);
1515 d->m_lineLeadingFwdPt = point;
1518double LineAnnotation::lineLeadingForwardPoint()
const
1520 Q_D(
const LineAnnotation);
1521 return d->m_lineLeadingFwdPt;
1524void LineAnnotation::setLineLeadingBackwardPoint(
double point)
1526 Q_D(LineAnnotation);
1527 d->m_lineLeadingBackPt = point;
1530double LineAnnotation::lineLeadingBackwardPoint()
const
1532 Q_D(
const LineAnnotation);
1533 return d->m_lineLeadingBackPt;
1536void LineAnnotation::setShowCaption(
bool show)
1538 Q_D(LineAnnotation);
1539 d->m_lineShowCaption = show;
1542bool LineAnnotation::showCaption()
const
1544 Q_D(
const LineAnnotation);
1545 return d->m_lineShowCaption;
1548void LineAnnotation::setLineIntent(LineIntent intent)
1550 Q_D(LineAnnotation);
1551 d->m_lineIntent = intent;
1554LineAnnotation::LineIntent LineAnnotation::lineIntent()
const
1556 Q_D(
const LineAnnotation);
1557 return d->m_lineIntent;
1567 Q_D(
const LineAnnotation);
1576 if (d->m_lineStartStyle != None) {
1577 lineElement.
setAttribute(QStringLiteral(
"startStyle"), (
int)d->m_lineStartStyle);
1579 if (d->m_lineEndStyle != None) {
1580 lineElement.
setAttribute(QStringLiteral(
"endStyle"), (
int)d->m_lineEndStyle);
1582 if (d->m_lineClosed) {
1583 lineElement.
setAttribute(QStringLiteral(
"closed"), d->m_lineClosed);
1585 if (d->m_lineInnerColor.isValid()) {
1586 lineElement.
setAttribute(QStringLiteral(
"innerColor"), d->m_lineInnerColor.name());
1588 if (d->m_lineLeadingFwdPt != 0.0) {
1591 if (d->m_lineLeadingBackPt != 0.0) {
1594 if (d->m_lineShowCaption) {
1595 lineElement.
setAttribute(QStringLiteral(
"showCaption"), d->m_lineShowCaption);
1597 if (d->m_lineIntent != Unknown) {
1598 lineElement.
setAttribute(QStringLiteral(
"intent"), d->m_lineIntent);
1602 int points = d->m_linePoints.count();
1616void LineAnnotationPrivate::transform(
const QTransform &matrix)
1618 AnnotationPrivate::transform(matrix);
1621 while (it.hasNext()) {
1622 it.next().transform(matrix);
1626void LineAnnotationPrivate::baseTransform(
const QTransform &matrix)
1628 AnnotationPrivate::baseTransform(matrix);
1631 while (it.hasNext()) {
1632 it.next().transform(matrix);
1636void LineAnnotationPrivate::resetTransformation()
1638 AnnotationPrivate::resetTransformation();
1640 m_transformedLinePoints = m_linePoints;
1645 AnnotationPrivate::translate(coord);
1648 while (it.hasNext()) {
1650 p.
x = p.
x + coord.
x;
1651 p.
y = p.
y + coord.
y;
1655void LineAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
1657 Okular::AnnotationPrivate::setAnnotationProperties(node);
1670 m_lineStartStyle = (LineAnnotation::TermStyle)e.
attribute(QStringLiteral(
"startStyle")).toInt();
1673 m_lineEndStyle = (LineAnnotation::TermStyle)e.
attribute(QStringLiteral(
"endStyle")).toInt();
1676 m_lineClosed = e.
attribute(QStringLiteral(
"closed")).toInt();
1688 m_lineShowCaption = e.
attribute(QStringLiteral(
"showCaption")).
toInt();
1691 m_lineIntent = (LineAnnotation::LineIntent)e.
attribute(QStringLiteral(
"intent")).toInt();
1705 p.
x = pe.
attribute(QStringLiteral(
"x"), QStringLiteral(
"0.0")).toDouble();
1706 p.
y = pe.
attribute(QStringLiteral(
"y"), QStringLiteral(
"0.0")).toDouble();
1707 m_linePoints.append(p);
1714 m_transformedLinePoints = m_linePoints;
1717AnnotationPrivate *LineAnnotationPrivate::getNewAnnotationPrivate()
1719 return new LineAnnotationPrivate();
1722double LineAnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
1727 transformedLinePoints.
append(transformedLinePoints.
first());
1730 if (m_lineInnerColor.
isValid()) {
1741 return strokeDistance(::distanceSqr(x, y, xScale, yScale, transformedLinePoints), m_style.width() * xScale / (m_page->m_width * 2));
1746class Okular::GeomAnnotationPrivate :
public Okular::AnnotationPrivate
1749 GeomAnnotationPrivate()
1750 : AnnotationPrivate()
1751 , m_geomType(GeomAnnotation::InscribedSquare)
1754 void setAnnotationProperties(
const QDomNode &node)
override;
1755 bool canBeResized()
const override;
1756 AnnotationPrivate *getNewAnnotationPrivate()
override;
1757 double distanceSqr(
double x,
double y,
double xScale,
double yScale)
const override;
1759 GeomAnnotation::GeomType m_geomType;
1763GeomAnnotation::GeomAnnotation()
1768GeomAnnotation::GeomAnnotation(
const QDomNode &description)
1769 :
Annotation(*new GeomAnnotationPrivate(), description)
1773GeomAnnotation::~GeomAnnotation()
1777void GeomAnnotation::setGeometricalType(GeomType type)
1779 Q_D(GeomAnnotation);
1780 d->m_geomType =
type;
1783GeomAnnotation::GeomType GeomAnnotation::geometricalType()
const
1785 Q_D(
const GeomAnnotation);
1786 return d->m_geomType;
1789void GeomAnnotation::setGeometricalInnerColor(
const QColor &color)
1791 Q_D(GeomAnnotation);
1792 d->m_geomInnerColor = color;
1795QColor GeomAnnotation::geometricalInnerColor()
const
1797 Q_D(
const GeomAnnotation);
1798 return d->m_geomInnerColor;
1808 Q_D(
const GeomAnnotation);
1817 if (d->m_geomType != InscribedSquare) {
1818 geomElement.
setAttribute(QStringLiteral(
"type"), (
int)d->m_geomType);
1820 if (d->m_geomInnerColor.isValid()) {
1821 geomElement.
setAttribute(QStringLiteral(
"color"), d->m_geomInnerColor.name());
1825void GeomAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
1827 Okular::AnnotationPrivate::setAnnotationProperties(node);
1839 m_geomType = (GeomAnnotation::GeomType)e.
attribute(QStringLiteral(
"type")).toInt();
1846 m_style.setWidth(e.
attribute(QStringLiteral(
"width")).toInt());
1854bool GeomAnnotationPrivate::canBeResized()
const
1859AnnotationPrivate *GeomAnnotationPrivate::getNewAnnotationPrivate()
1861 return new GeomAnnotationPrivate();
1864double GeomAnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
1868 bool withinShape =
false;
1869 switch (m_geomType) {
1870 case GeomAnnotation::InscribedCircle: {
1872 const double centerX = (m_transformedBoundary.left + m_transformedBoundary.right) / 2.0;
1873 const double centerY = (m_transformedBoundary.top + m_transformedBoundary.bottom) / 2.0;
1874 const double focusX = (m_transformedBoundary.right - centerX);
1875 const double focusY = (m_transformedBoundary.bottom - centerY);
1877 const double focusXSqr = pow(focusX, 2);
1878 const double focusYSqr = pow(focusY, 2);
1887 const double lambda = sqrt(focusXSqr * focusYSqr / (focusYSqr * pow(x - centerX, 2) + focusXSqr * pow(y - centerY, 2)));
1891 if (m_geomInnerColor.
isValid()) {
1900 projection.x += lambda * (x - centerX);
1901 projection.y += lambda * (y - centerY);
1903 distance = projection.distanceSqr(x, y, xScale, yScale);
1907 case GeomAnnotation::InscribedSquare:
1909 if (m_geomInnerColor.
isValid()) {
1910 return AnnotationPrivate::distanceSqr(x, y, xScale, yScale);
1914 NormalizedPoint(m_transformedBoundary.right, m_transformedBoundary.top),
1915 NormalizedPoint(m_transformedBoundary.right, m_transformedBoundary.bottom),
1916 NormalizedPoint(m_transformedBoundary.left, m_transformedBoundary.bottom),
1917 NormalizedPoint(m_transformedBoundary.left, m_transformedBoundary.top)};
1918 distance = ::distanceSqr(x, y, xScale, yScale, edges);
1920 if (m_transformedBoundary.contains(x, y)) {
1927 distance = strokeDistance(distance, m_style.width() * xScale / m_page->m_width);
1935class HighlightAnnotation::Quad::Private
1947 bool m_capStart : 1;
1970 if (
this != &other) {
1979 if (index < 0 || index > 3) {
1983 d->m_points[index] = point;
1988 if (index < 0 || index > 3) {
1992 return d->m_points[index];
1997 if (index < 0 || index > 3) {
2001 return d->m_transformedPoints[index];
2006 d->m_capStart = value;
2011 return d->m_capStart;
2016 d->m_capEnd = value;
2026 d->m_feather = width;
2031 return d->m_feather;
2036 for (
int i = 0; i < 4; ++i) {
2037 d->m_transformedPoints[i] = d->m_points[i];
2038 d->m_transformedPoints[i].transform(matrix);
2042class Okular::HighlightAnnotationPrivate :
public Okular::AnnotationPrivate
2045 HighlightAnnotationPrivate()
2046 : AnnotationPrivate()
2047 , m_highlightType(HighlightAnnotation::
Highlight)
2051 void transform(
const QTransform &matrix)
override;
2052 void baseTransform(
const QTransform &matrix)
override;
2053 double distanceSqr(
double x,
double y,
double xScale,
double yScale)
const override;
2054 void setAnnotationProperties(
const QDomNode &node)
override;
2055 AnnotationPrivate *getNewAnnotationPrivate()
override;
2057 HighlightAnnotation::HighlightType m_highlightType;
2061HighlightAnnotation::HighlightAnnotation()
2062 :
Annotation(*new HighlightAnnotationPrivate())
2066HighlightAnnotation::HighlightAnnotation(
const QDomNode &description)
2067 :
Annotation(*new HighlightAnnotationPrivate(), description)
2071HighlightAnnotation::~HighlightAnnotation()
2075void HighlightAnnotation::setHighlightType(HighlightType type)
2077 Q_D(HighlightAnnotation);
2078 d->m_highlightType =
type;
2081HighlightAnnotation::HighlightType HighlightAnnotation::highlightType()
const
2083 Q_D(
const HighlightAnnotation);
2084 return d->m_highlightType;
2089 Q_D(HighlightAnnotation);
2090 return d->m_highlightQuads;
2095 Q_D(
const HighlightAnnotation);
2096 return d->m_highlightQuads;
2101 Q_D(
const HighlightAnnotation);
2111 hlElement.
setAttribute(QStringLiteral(
"type"), (
int)d->m_highlightType);
2113 if (d->m_highlightQuads.count() < 1) {
2118 for (; it !=
end; ++it) {
2121 const Quad &q = *it;
2145void HighlightAnnotationPrivate::transform(
const QTransform &matrix)
2147 AnnotationPrivate::transform(matrix);
2150 while (it.hasNext()) {
2151 it.next().transform(matrix);
2155void HighlightAnnotationPrivate::baseTransform(
const QTransform &matrix)
2157 AnnotationPrivate::baseTransform(matrix);
2160 while (it.hasNext()) {
2161 it.next().transform(matrix);
2165void HighlightAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2167 Okular::AnnotationPrivate::setAnnotationProperties(node);
2168 m_highlightQuads.clear();
2181 m_highlightType = (HighlightAnnotation::HighlightType)e.
attribute(QStringLiteral(
"type")).toInt();
2203 m_highlightQuads.append(q);
2211AnnotationPrivate *HighlightAnnotationPrivate::getNewAnnotationPrivate()
2213 return new HighlightAnnotationPrivate();
2216double HighlightAnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
2219 double outsideDistance = DBL_MAX;
2225 pathPoints << quad.transformedPoint(0);
2226 int directionVote = 0;
2227 for (
int i = 1; i < 5; ++i) {
2229 directionVote += (isLeftOfVector(pathPoints.
back(), thisPoint, point)) ? 1 : -1;
2230 pathPoints << thisPoint;
2232 if (abs(directionVote) == 4) {
2238 const double thisOutsideDistance = ::distanceSqr(x, y, xScale, yScale, pathPoints);
2239 if (thisOutsideDistance < outsideDistance) {
2240 outsideDistance = thisOutsideDistance;
2244 return outsideDistance;
2249class Okular::StampAnnotationPrivate :
public Okular::AnnotationPrivate
2252 StampAnnotationPrivate()
2253 : AnnotationPrivate()
2254 , m_stampIconName(QStringLiteral(
"Draft"))
2257 void setAnnotationProperties(
const QDomNode &node)
override;
2258 bool canBeResized()
const override;
2259 AnnotationPrivate *getNewAnnotationPrivate()
override;
2264StampAnnotation::StampAnnotation()
2269StampAnnotation::StampAnnotation(
const QDomNode &description)
2270 :
Annotation(*new StampAnnotationPrivate(), description)
2274StampAnnotation::~StampAnnotation()
2278void StampAnnotation::setStampIconName(
const QString &name)
2280 Q_D(StampAnnotation);
2281 d->m_stampIconName =
name;
2284QString StampAnnotation::stampIconName()
const
2286 Q_D(
const StampAnnotation);
2287 return d->m_stampIconName;
2297 Q_D(
const StampAnnotation);
2307 stampElement.
setAttribute(QStringLiteral(
"icon"), d->m_stampIconName);
2311void StampAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2313 Okular::AnnotationPrivate::setAnnotationProperties(node);
2326 m_stampIconName = e.
attribute(QStringLiteral(
"icon"));
2334bool StampAnnotationPrivate::canBeResized()
const
2339AnnotationPrivate *StampAnnotationPrivate::getNewAnnotationPrivate()
2341 return new StampAnnotationPrivate();
2346class Okular::InkAnnotationPrivate :
public Okular::AnnotationPrivate
2349 InkAnnotationPrivate()
2350 : AnnotationPrivate()
2355 void baseTransform(
const QTransform &matrix)
override;
2356 void resetTransformation()
override;
2357 double distanceSqr(
double x,
double y,
double xScale,
double yScale)
const override;
2359 void setAnnotationProperties(
const QDomNode &node)
override;
2360 AnnotationPrivate *getNewAnnotationPrivate()
override;
2366InkAnnotation::InkAnnotation()
2371InkAnnotation::InkAnnotation(
const QDomNode &description)
2372 :
Annotation(*new InkAnnotationPrivate(), description)
2376InkAnnotation::~InkAnnotation()
2383 d->m_inkPaths = paths;
2388 Q_D(
const InkAnnotation);
2389 return d->m_inkPaths;
2394 Q_D(
const InkAnnotation);
2395 return d->m_transformedInkPaths;
2405 Q_D(
const InkAnnotation);
2414 if (d->m_inkPaths.count() < 1) {
2419 for (; pIt != pEnd; ++pIt) {
2432double InkAnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
2436 const double thisDistance = ::distanceSqr(x, y, xScale, yScale, path);
2437 if (thisDistance < distance) {
2441 return strokeDistance(distance, m_style.width() * xScale / (m_page->m_width * 2));
2444void InkAnnotationPrivate::transform(
const QTransform &matrix)
2446 AnnotationPrivate::transform(matrix);
2448 for (
int i = 0; i < m_transformedInkPaths.count(); ++i) {
2450 while (it.hasNext()) {
2451 it.next().transform(matrix);
2456void InkAnnotationPrivate::baseTransform(
const QTransform &matrix)
2458 AnnotationPrivate::baseTransform(matrix);
2460 for (
int i = 0; i < m_inkPaths.count(); ++i) {
2462 while (it.hasNext()) {
2463 it.next().transform(matrix);
2468void InkAnnotationPrivate::resetTransformation()
2470 AnnotationPrivate::resetTransformation();
2472 m_transformedInkPaths = m_inkPaths;
2477 AnnotationPrivate::translate(coord);
2479 for (
int i = 0; i < m_inkPaths.count(); ++i) {
2481 while (it.hasNext()) {
2483 p.
x = p.
x + coord.
x;
2484 p.
y = p.
y + coord.
y;
2489void InkAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2491 Okular::AnnotationPrivate::setAnnotationProperties(node);
2540 m_transformedInkPaths = m_inkPaths;
2543AnnotationPrivate *InkAnnotationPrivate::getNewAnnotationPrivate()
2545 return new InkAnnotationPrivate();
2550class Okular::CaretAnnotationPrivate :
public Okular::AnnotationPrivate
2553 CaretAnnotationPrivate()
2554 : AnnotationPrivate()
2555 , m_symbol(CaretAnnotation::
None)
2559 void setAnnotationProperties(
const QDomNode &node)
override;
2560 AnnotationPrivate *getNewAnnotationPrivate()
override;
2562 CaretAnnotation::CaretSymbol m_symbol;
2565static QString caretSymbolToString(CaretAnnotation::CaretSymbol symbol)
2568 case CaretAnnotation::None:
2569 return QStringLiteral(
"None");
2570 case CaretAnnotation::P:
2571 return QStringLiteral(
"P");
2576static CaretAnnotation::CaretSymbol caretSymbolFromString(
const QString &symbol)
2579 return CaretAnnotation::None;
2581 return CaretAnnotation::P;
2583 return CaretAnnotation::None;
2586void CaretAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2588 Okular::AnnotationPrivate::setAnnotationProperties(node);
2601 m_symbol = caretSymbolFromString(e.
attribute(QStringLiteral(
"symbol")));
2609AnnotationPrivate *CaretAnnotationPrivate::getNewAnnotationPrivate()
2611 return new CaretAnnotationPrivate();
2614CaretAnnotation::CaretAnnotation()
2619CaretAnnotation::CaretAnnotation(
const QDomNode &description)
2620 :
Annotation(*new CaretAnnotationPrivate(), description)
2624CaretAnnotation::~CaretAnnotation()
2628void CaretAnnotation::setCaretSymbol(CaretAnnotation::CaretSymbol symbol)
2630 Q_D(CaretAnnotation);
2631 d->m_symbol = symbol;
2634CaretAnnotation::CaretSymbol CaretAnnotation::caretSymbol()
const
2636 Q_D(
const CaretAnnotation);
2647 Q_D(
const CaretAnnotation);
2656 if (d->m_symbol !=
None) {
2657 caretElement.
setAttribute(QStringLiteral(
"symbol"), caretSymbolToString(d->m_symbol));
2663class Okular::FileAttachmentAnnotationPrivate :
public Okular::AnnotationPrivate
2666 FileAttachmentAnnotationPrivate()
2667 : AnnotationPrivate()
2668 , icon(QStringLiteral(
"PushPin"))
2672 ~FileAttachmentAnnotationPrivate()
override
2677 void setAnnotationProperties(
const QDomNode &node)
override;
2678 AnnotationPrivate *getNewAnnotationPrivate()
override;
2685void FileAttachmentAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2687 Okular::AnnotationPrivate::setAnnotationProperties(node);
2703AnnotationPrivate *FileAttachmentAnnotationPrivate::getNewAnnotationPrivate()
2705 return new FileAttachmentAnnotationPrivate();
2708FileAttachmentAnnotation::FileAttachmentAnnotation()
2709 :
Annotation(*new FileAttachmentAnnotationPrivate())
2713FileAttachmentAnnotation::FileAttachmentAnnotation(
const QDomNode &description)
2714 :
Annotation(*new FileAttachmentAnnotationPrivate(), description)
2718FileAttachmentAnnotation::~FileAttachmentAnnotation()
2737QString FileAttachmentAnnotation::fileIconName()
const
2739 Q_D(
const FileAttachmentAnnotation);
2743void FileAttachmentAnnotation::setFileIconName(
const QString &iconName)
2745 Q_D(FileAttachmentAnnotation);
2749EmbeddedFile *FileAttachmentAnnotation::embeddedFile()
const
2751 Q_D(
const FileAttachmentAnnotation);
2755void FileAttachmentAnnotation::setEmbeddedFile(
EmbeddedFile *ef)
2757 Q_D(FileAttachmentAnnotation);
2763class Okular::SoundAnnotationPrivate :
public Okular::AnnotationPrivate
2766 SoundAnnotationPrivate()
2767 : AnnotationPrivate()
2768 , icon(QStringLiteral(
"Speaker"))
2772 ~SoundAnnotationPrivate()
override
2777 void setAnnotationProperties(
const QDomNode &node)
override;
2778 AnnotationPrivate *getNewAnnotationPrivate()
override;
2785void SoundAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2787 Okular::AnnotationPrivate::setAnnotationProperties(node);
2803AnnotationPrivate *SoundAnnotationPrivate::getNewAnnotationPrivate()
2805 return new SoundAnnotationPrivate();
2814 :
Annotation(*new SoundAnnotationPrivate(), description)
2863class Okular::MovieAnnotationPrivate :
public Okular::AnnotationPrivate
2866 MovieAnnotationPrivate()
2867 : AnnotationPrivate()
2871 ~MovieAnnotationPrivate()
override
2876 void setAnnotationProperties(
const QDomNode &node)
override;
2877 AnnotationPrivate *getNewAnnotationPrivate()
override;
2883void MovieAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2885 Okular::AnnotationPrivate::setAnnotationProperties(node);
2901AnnotationPrivate *MovieAnnotationPrivate::getNewAnnotationPrivate()
2903 return new MovieAnnotationPrivate();
2912 :
Annotation(*new MovieAnnotationPrivate(), description)
2949class Okular::ScreenAnnotationPrivate :
public Okular::AnnotationPrivate
2952 ScreenAnnotationPrivate();
2953 ~ScreenAnnotationPrivate()
override;
2955 void setAnnotationProperties(
const QDomNode &node)
override;
2956 AnnotationPrivate *getNewAnnotationPrivate()
override;
2962ScreenAnnotationPrivate::ScreenAnnotationPrivate()
2967ScreenAnnotationPrivate::~ScreenAnnotationPrivate()
2970 qDeleteAll(m_additionalActions);
2973void ScreenAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2975 Okular::AnnotationPrivate::setAnnotationProperties(node);
2991AnnotationPrivate *ScreenAnnotationPrivate::getNewAnnotationPrivate()
2993 return new ScreenAnnotationPrivate();
3002 :
Annotation(*new ScreenAnnotationPrivate(), description)
3028 if (d->m_additionalActions.contains(type)) {
3029 delete d->m_additionalActions.value(type);
3032 d->m_additionalActions.insert(type,
action);
3038 if (!d->m_additionalActions.contains(type)) {
3041 return d->m_additionalActions.value(type);
3061class Okular::WidgetAnnotationPrivate :
public Okular::AnnotationPrivate
3064 ~WidgetAnnotationPrivate()
override;
3065 void setAnnotationProperties(
const QDomNode &node)
override;
3066 AnnotationPrivate *getNewAnnotationPrivate()
override;
3071WidgetAnnotationPrivate::~WidgetAnnotationPrivate()
3073 qDeleteAll(m_additionalActions);
3076void WidgetAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
3078 Okular::AnnotationPrivate::setAnnotationProperties(node);
3094AnnotationPrivate *WidgetAnnotationPrivate::getNewAnnotationPrivate()
3096 return new WidgetAnnotationPrivate();
3105 :
Annotation(*new WidgetAnnotationPrivate, description)
3131 if (d->m_additionalActions.contains(type)) {
3132 delete d->m_additionalActions.value(type);
3135 d->m_additionalActions.insert(type, action);
3141 if (!d->m_additionalActions.contains(type)) {
3144 return d->m_additionalActions.value(type);
3150class Okular::RichMediaAnnotationPrivate :
public Okular::AnnotationPrivate
3153 RichMediaAnnotationPrivate();
3154 ~RichMediaAnnotationPrivate()
override;
3155 void setAnnotationProperties(
const QDomNode &node)
override;
3156 AnnotationPrivate *getNewAnnotationPrivate()
override;
3163RichMediaAnnotationPrivate::RichMediaAnnotationPrivate()
3165 , embeddedFile(nullptr)
3169RichMediaAnnotationPrivate::~RichMediaAnnotationPrivate()
3172 delete embeddedFile;
3175void RichMediaAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
3177 Okular::AnnotationPrivate::setAnnotationProperties(node);
3193AnnotationPrivate *RichMediaAnnotationPrivate::getNewAnnotationPrivate()
3195 return new RichMediaAnnotationPrivate();
3199 :
Annotation(*new RichMediaAnnotationPrivate())
3204 :
Annotation(*new RichMediaAnnotationPrivate, description)
3246 return d->embeddedFile;
3253 delete d->embeddedFile;
Encapsulates data that describes an action.
virtual ~AnnotationProxy()
Destroys the annotation proxy.
static QDomElement findChildElement(const QDomNode &parentNode, const QString &name)
Returns the child element with the given name from the direct children of parentNode or a null elemen...
static QPixmap loadStamp(const QString &nameOrPath, int size, bool keepAspectRatio=true)
Returns a pixmap for a stamp symbol.
static QRect annotationGeometry(const Annotation *annotation, double scaleX, double scaleY)
Returns the geometry of the given annotation scaled by scaleX and scaleY.
static Annotation * createAnnotation(const QDomElement &element)
Restore an annotation (with revisions if needed) from the dom element.
static void storeAnnotation(const Annotation *annotation, QDomElement &element, QDomDocument &document)
Saves the annotation as a child of element taking care of saving all revisions if it has any.
The Revision class contains all information about the revision of the annotation.
Annotation * annotation() const
Returns the annotation the revision belongs to.
Revision()
Creates a new revision.
void setType(RevisionType type)
Sets the type of the revision.
void setScope(RevisionScope scope)
Sets the scope of the revision.
void setAnnotation(Annotation *annotation)
Sets the annotation the revision belongs to.
~Revision()
Destroys the revision.
RevisionType type() const
Returns the type of the revision.
RevisionScope scope() const
Returns the scope of the revision.
The Style class contains all information about style of the annotation.
double opacity() const
Returns the opacity of the style.
void setSpaces(int spaces)
Sets the spaces of the style.
void setColor(const QColor &color)
Sets the color of the style.
LineStyle lineStyle() const
Returns the line style of the style.
double xCorners() const
Returns the x-corners of the style.
~Style()
Destroys the style.
QColor color() const
Returns the color of the style.
void setOpacity(double opacity)
Sets the opacity of the style.
void setYCorners(double yCorners)
Sets the y-corners of the style.
void setEffectIntensity(double intensity)
Sets the effect intensity of the style.
LineEffect lineEffect() const
Returns the line effect of the style.
int marks() const
Returns the marks of the style.
void setLineStyle(LineStyle style)
Sets the line style of the style.
void setXCorners(double xCorners)
Sets the x-corners of the style.
void setMarks(int marks)
Sets the marks of the style.
double effectIntensity() const
Returns the effect intensity of the style.
double yCorners() const
Returns the y-corners of the style.
double width() const
Returns the width of the style.
int spaces() const
Returns the spaces of the style.
void setLineEffect(LineEffect effect)
Sets the line effect of the style.
void setWidth(double width)
Sets the width of the style.
Style()
Creates a new style.
The Window class contains all information about the popup window of the annotation that is used to ed...
int flags() const
Returns the flags of the window.
void setSummary(const QString &summary)
Sets the summary of the window.
QString summary() const
Returns the summary of the window.
~Window()
Destroys the window.
void setHeight(int height)
Sets the height of the window.
void setFlags(int flags)
Sets the flags of the window.
NormalizedPoint topLeft() const
Returns the top-left point of the window.
Window()
Creates a new window.
void setTitle(const QString &title)
Sets the title of the window.
int height() const
Returns the height of the window.
QString title() const
Returns the title of the window.
void setTopLeft(const NormalizedPoint &point)
Sets the top-left point of the window.
void setWidth(int width)
Sets the width of the window.
int width() const
Returns the width of the window.
Annotation struct holds properties shared by all annotations.
bool canBeResized() const
Returns whether the annotation can be resized.
QDateTime modificationDate() const
Returns the last modification date of the annotation.
void setModificationDate(const QDateTime &date)
Sets the last modification date of the annotation.
bool canBeMoved() const
Returns whether the annotation can be moved.
QDateTime creationDate() const
Returns the creation date of the annotation.
QString author() const
Returns the author of the annotation.
NormalizedRect transformedBoundingRectangle() const
Returns the transformed bounding rectangle of the annotation.
Window & window()
Returns a reference to the window object of the annotation.
QString contents() const
Returns the contents of the annotation.
void(* DisposeDataFunction)(const Okular::Annotation *)
A function to be called when the annotation is destroyed.
int flags() const
Returns the flags of the annotation.
void setContents(const QString &contents)
Sets the contents of the annotation.
void adjust(const NormalizedPoint &deltaCoord1, const NormalizedPoint &deltaCoord2)
Adjust the annotation by the specified coordinates.
NormalizedRect boundingRectangle() const
Returns the bounding rectangle of the annotation.
void setBoundingRectangle(const NormalizedRect &rectangle)
Sets the bounding rectangle of the annotation.
RevisionType
Describes the type of revision information.
void setNativeId(const QVariant &id)
Sets the "native" id of the annotation.
void setCreationDate(const QDateTime &date)
Sets the creation date of the annotation.
virtual void store(QDomNode &node, QDomDocument &document) const
Stores the annotation as xml in document under the given parent node.
void setDisposeDataFunction(DisposeDataFunction func)
Sets a function to be called when the annotation is destroyed.
QVariant nativeId() const
Returns the "native" id of the annotation.
@ ExternallyDrawn
Is drawn externally (by the generator which provided it)
@ BeingMoved
Is being moved (mouse drag and drop). If ExternallyDrawn, the generator must not draw it.
@ External
Is stored external.
@ BeingResized
Is being resized (mouse drag and drop). If ExternallyDrawn, the generator must not draw it.
LineEffect
Describes possible line effects for.
QString uniqueName() const
Returns the unique name of the annotation.
QDomNode getAnnotationPropertiesDomNode() const
Retrieve the QDomNode representing this annotation's properties.
virtual ~Annotation()
Destroys the annotation.
void setUniqueName(const QString &name)
Sets the unique name of the annotation.
RevisionScope
Describes the scope of revision information.
AdditionalActionType
Describes the type of additional actions.
void setFlags(int flags)
Sets the flags of the annotation.
LineStyle
Describes possible line styles for.
void setAuthor(const QString &author)
Sets the author of the annotation.
QList< Revision > & revisions()
Returns a reference to the revision list of the annotation.
void translate(const NormalizedPoint &coord)
Move the annotation by the specified coordinates.
Style & style()
Returns a reference to the style object of the annotation.
void setAnnotationProperties(const QDomNode &node)
Sets annotations internal properties according to the contents of node.
bool openDialogAfterCreation() const
Returns whether the annotation dialog should be open after creation of the annotation or not.
SubType
Describes the type of annotation as defined in PDF standard.
@ AHighlight
A highlight annotation.
@ AGeom
A geometrical annotation.
@ AText
A textual annotation.
@ ARichMedia
A rich media annotation.
@ ALine
A line annotation.
@ AMovie
A movie annotation.
@ AFileAttachment
A file attachment annotation.
@ AScreen
A screen annotation.
@ ACaret
A caret annotation.
@ ASound
A sound annotation.
@ AWidget
A widget annotation.
@ AStamp
A stamp annotation.
virtual SubType subType() const =0
Returns the sub type of the annotation.
An embedded file into the document.
Describes a highlight quad of a text markup annotation.
void setCapEnd(bool value)
Sets whether a cap should be used at the end.
~Quad()
Destroys the quad.
double feather() const
Returns the width of the drawing feather.
Quad()
Creates a new quad.
bool capStart() const
Returns whether a cap should be used at the start.
NormalizedPoint point(int index) const
Returns the normalized point at index.
bool capEnd() const
Returns whether a cap should be used at the end.
void setPoint(const NormalizedPoint &point, int index)
Sets the normalized point at index.
void setFeather(double width)
Sets the width of the drawing feather.
void transform(const QTransform &matrix)
Transforms the quad coordinates with the transformation defined by matrix.
void setCapStart(bool value)
Sets whether a cap should be used at the start.
NormalizedPoint transformedPoint(int index) const
Returns the transformed (e.g.
SubType subType() const override
Returns the sub type of the movie annotation.
void store(QDomNode &parentNode, QDomDocument &document) const override
Stores the movie annotation as xml in document under the given parentNode.
~MovieAnnotation() override
Destroys the movie annotation.
void setMovie(Movie *movie)
Sets the new movie object.
Movie * movie() const
Gets the movie object.
MovieAnnotation()
Creates a new movie annotation.
Contains information about a movie object.
NormalizedPoint is a helper class which stores the coordinates of a normalized point.
double distanceSqr(double x, double y, double xScale, double yScale) const
Returns squared distance to normalized point (x, y) on a reference area of size xScale x yScale.
double x
The normalized x coordinate.
double y
The normalized y coordinate.
A NormalizedRect is a rectangle which can be defined by two NormalizedPoints.
double left
The normalized left coordinate.
QRect geometry(int xScale, int yScale) const
Returns the rectangle mapped to a reference area of xScale x yScale.
double top
The normalized top coordinate.
void transform(const QTransform &matrix)
Transforms the normalized rectangle with the operations defined by matrix.
void setAdditionalAction(AdditionalActionType type, Action *action)
Sets the additional action of the given type.
void setAction(Action *action)
Sets the action that is executed when the annotation is triggered.
Action * action() const
Returns the action that is executed when the annotation is triggered or 0 if not action has been defi...
Action * additionalAction(AdditionalActionType type) const
Returns the additional action of the given type or 0 if no action has been defined.
ScreenAnnotation()
Creates a new screen annotation.
~ScreenAnnotation() override
Destroys the screen annotation.
void store(QDomNode &parentNode, QDomDocument &document) const override
Stores the screen annotation as xml in document under the given parentNode.
SubType subType() const override
Returns the sub type of the screen annotation.
QString soundIconName() const
Gets the name of the icon.
void store(QDomNode &node, QDomDocument &document) const override
Stores the sound annotation as xml in document under the given parent node.
~SoundAnnotation() override
Destroys the sound annotation.
void setSoundIconName(const QString &iconName)
Sets the iconName of the icon for the sound annotation.
Sound * sound() const
Gets the sound object.
SubType subType() const override
Returns the sub type of the sound annotation.
SoundAnnotation()
Creates a new sound annotation.
void setSound(Sound *s)
Sets the s representing the sound of the file attachment annotation.
Contains information about a sound object.
Type type(const QSqlDatabase &db)
QString path(const QString &relativePath)
const QList< QKeySequence > & end()
QString name(StandardShortcut id)
KOSM_EXPORT double distance(const std::vector< const OSM::Node * > &path, Coordinate coord)
bool isValid() const const
QDateTime fromString(QStringView string, QStringView format, QCalendar cal)
QString data() const const
QDomElement createElement(const QString &tagName)
QString attribute(const QString &name, const QString &defValue) const const
bool hasAttribute(const QString &name) const const
void setAttribute(const QString &name, const QString &value)
QString tagName() const const
QDomNode appendChild(const QDomNode &newChild)
QDomNode firstChild() const const
bool isElement() const const
bool isNull() const const
QDomNode nextSibling() const const
QDomCDATASection toCDATASection() const const
QDomElement toElement() const const
bool exists() const const
bool fromString(const QString &descrip)
QPixmap pixmap(QWindow *window, const QSize &size, Mode mode, State state) const const
QIcon fromTheme(const QString &name)
void append(QList< T > &&value)
void fill(const QColor &color)
bool isNull() const const
bool load(const QString &fileName, const char *format, Qt::ImageConversionFlags flags)
QPixmap scaled(const QSize &size, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const const
bool containsPoint(const QPointF &point, Qt::FillRule fillRule) const const
QRect united(const QRect &rectangle) const const
QSizeF size() const const
QSize scaled(const QSize &s, Qt::AspectRatioMode mode) const const
QSize toSize() const const
QString locate(StandardLocation type, const QString &fileName, LocateOptions options)
qsizetype count() const const
QString & append(QChar ch)
const_iterator constBegin() const const
const_iterator constEnd() const const
bool isEmpty() const const
QString number(double n, char format, int precision)
double toDouble(bool *ok) const const
int toInt(bool *ok, int base) const const
QString toLower() const const
QRectF boundsOnElement(const QString &id) const const
bool elementExists(const QString &id) const const
bool isValid() const const
void render(QPainter *painter)
KeepAspectRatioByExpanding