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)
56 if (thisDistance < distance) {
86static double strokeDistance(
double distance,
double penWidth)
88 return fmax(distance - pow(penWidth, 2), 0);
101 int typeNumber = annElement.
attribute(QStringLiteral(
"type")).
toInt();
102 switch (typeNumber) {
104 annotation =
new TextAnnotation(annElement);
107 annotation =
new LineAnnotation(annElement);
110 annotation =
new GeomAnnotation(annElement);
113 annotation =
new HighlightAnnotation(annElement);
116 annotation =
new StampAnnotation(annElement);
119 annotation =
new InkAnnotation(annElement);
122 annotation =
new CaretAnnotation(annElement);
136 ann->
store(annElement, document);
145 if (element.
tagName() == name) {
157 if (annotation->
subType() ==
Annotation::AText && (
static_cast<const TextAnnotation *
>(annotation)->textType() == TextAnnotation::Linked)) {
161 return rect24.
united(rect);
171 static std::unique_ptr<QSvgRenderer> svgStampFile;
172 if (!svgStampFile.get()) {
175 svgStampFile = std::make_unique<QSvgRenderer>(stampFile);
176 if (!svgStampFile->isValid()) {
177 svgStampFile.reset();
200 pixmap.
load(nameOrPath);
212AnnotationProxy::AnnotationProxy()
222class Annotation::Style::Private
234 , m_effectIntensity(1.0)
247 double m_effectIntensity;
268 if (
this != &other) {
287 d->m_opacity = opacity;
317 d->m_xCorners = xCorners;
322 return d->m_xCorners;
327 d->m_yCorners = yCorners;
332 return d->m_yCorners;
347 d->m_spaces = spaces;
357 d->m_effect = effect;
367 d->m_effectIntensity = intensity;
372 return d->m_effectIntensity;
375class Annotation::Window::Private
411 if (
this != &other) {
430 d->m_topLeft = point;
450 d->m_height = height;
470 d->m_summary = summary;
478class Annotation::Revision::Private
482 : m_annotation(nullptr)
489 RevisionScope m_scope;
511 if (
this != &other) {
520 d->m_annotation = annotation;
525 return d->m_annotation;
548AnnotationPrivate::AnnotationPrivate()
551 , m_disposeFunc(nullptr)
555AnnotationPrivate::~AnnotationPrivate()
558 if (m_revisions.isEmpty()) {
563 delete revision.annotation();
567AnnotationPrivate *AnnotationPrivate::get(
Annotation *a)
569 return a ? a->d_ptr :
nullptr;
572Annotation::Annotation(AnnotationPrivate &dd)
577Annotation::Annotation(AnnotationPrivate &dd,
const QDomNode &description)
580 d_ptr->setAnnotationProperties(description);
585 if (d_ptr->m_disposeFunc) {
586 d_ptr->m_disposeFunc(
this);
613 return d->m_contents;
619 d->m_uniqueName = name;
625 return d->m_uniqueName;
631 d->m_modifyDate = date;
637 return d->m_modifyDate;
643 d->m_creationDate = date;
649 return d->m_creationDate;
667 d->m_boundary = rectangle;
668 d->resetTransformation();
670 d->
transform(d->m_page->rotationMatrix());
677 return d->m_boundary;
683 return d->m_transformedBoundary;
690 d->resetTransformation();
692 d->transform(d->m_page->rotationMatrix());
699 d->adjust(deltaCoord1, deltaCoord2);
700 d->resetTransformation();
702 d->transform(d->m_page->rotationMatrix());
709 return d->openDialogAfterCreation();
739 return d->m_revisions;
745 return d->m_revisions;
757 return d->m_nativeId;
763 d->m_disposeFunc = func;
771 if (!d->m_page || !d->m_page->m_doc->m_parent->canModifyPageAnnotation(
this)) {
788 if (!d->m_page || !d->m_page->m_doc->m_parent->canModifyPageAnnotation(
this)) {
792 return d->canBeResized();
803 if (!d->m_author.isEmpty()) {
806 if (!d->m_contents.isEmpty()) {
807 e.
setAttribute(QStringLiteral(
"contents"), d->m_contents);
809 if (!d->m_uniqueName.isEmpty()) {
810 e.
setAttribute(QStringLiteral(
"uniqueName"), d->m_uniqueName);
812 if (d->m_modifyDate.isValid()) {
815 if (d->m_creationDate.isValid()) {
823 if (d->m_style.color().isValid()) {
826 if (d->m_style.opacity() != 1.0) {
839 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) {
843 psE.
setAttribute(QStringLiteral(
"style"), (
int)d->m_style.lineStyle());
846 psE.
setAttribute(QStringLiteral(
"marks"), d->m_style.marks());
847 psE.
setAttribute(QStringLiteral(
"spaces"), d->m_style.spaces());
851 if (d->m_style.lineEffect() !=
NoEffect || d->m_style.effectIntensity() != 1.0) {
854 peE.
setAttribute(QStringLiteral(
"effect"), (
int)d->m_style.lineEffect());
859 if (d->m_window.flags() != -1 || !d->m_window.title().isEmpty() || !d->m_window.summary().isEmpty()) {
862 wE.
setAttribute(QStringLiteral(
"flags"), d->m_window.flags());
865 wE.
setAttribute(QStringLiteral(
"width"), d->m_window.width());
866 wE.
setAttribute(QStringLiteral(
"height"), d->m_window.height());
867 wE.
setAttribute(QStringLiteral(
"title"), d->m_window.title());
868 wE.
setAttribute(QStringLiteral(
"summary"), d->m_window.summary());
872 if (d->m_revisions.isEmpty()) {
877 for (
const Revision &revision : std::as_const(d->m_revisions)) {
882 r.
setAttribute(QStringLiteral(
"revScope"), (int)revision.scope());
883 r.
setAttribute(QStringLiteral(
"revType"), (int)revision.type());
901 Okular::PagePrivate *p = d_ptr->m_page;
902 QVariant nativeID = d_ptr->m_nativeId;
907 AnnotationPrivate *new_d_ptr = d_ptr->getNewAnnotationPrivate();
912 d_ptr->setAnnotationProperties(node);
916 d_ptr->m_nativeId = nativeID;
917 d_ptr->m_flags = d_ptr->m_flags | internalFlags;
918 d_ptr->m_disposeFunc = disposeFunc;
921 d_ptr->transform(d_ptr->m_page->rotationMatrix());
924double AnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
926 return m_transformedBoundary.distanceSqr(x, y, xScale, yScale);
929void AnnotationPrivate::annotationTransform(
const QTransform &matrix)
931 resetTransformation();
935void AnnotationPrivate::transform(
const QTransform &matrix)
937 m_transformedBoundary.transform(matrix);
940void AnnotationPrivate::baseTransform(
const QTransform &matrix)
942 m_boundary.transform(matrix);
945void AnnotationPrivate::resetTransformation()
947 m_transformedBoundary = m_boundary;
952 m_boundary.left = m_boundary.left + coord.
x;
953 m_boundary.right = m_boundary.right + coord.
x;
954 m_boundary.top = m_boundary.top + coord.
y;
955 m_boundary.bottom = m_boundary.bottom + coord.
y;
960 m_boundary.left = m_boundary.left + qBound(-m_boundary.left, deltaCoord1.
x, m_boundary.right - m_boundary.left);
961 m_boundary.top = m_boundary.top + qBound(-m_boundary.top, deltaCoord1.
y, m_boundary.bottom - m_boundary.top);
963 m_boundary.right = m_boundary.right + qBound(m_boundary.left - m_boundary.right, deltaCoord2.
x, 1. - m_boundary.right);
964 m_boundary.bottom = m_boundary.bottom + qBound(m_boundary.top - m_boundary.bottom, deltaCoord2.
y, 1. - m_boundary.bottom);
967bool AnnotationPrivate::openDialogAfterCreation()
const
972void AnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
982 m_author = e.
attribute(QStringLiteral(
"author"));
985 m_contents = e.
attribute(QStringLiteral(
"contents"));
988 m_uniqueName = e.
attribute(QStringLiteral(
"uniqueName"));
1005 m_style.setOpacity(e.
attribute(QStringLiteral(
"opacity")).toDouble());
1021 m_style.setWidth(ee.
attribute(QStringLiteral(
"width")).toDouble());
1023 m_style.setXCorners(ee.
attribute(QStringLiteral(
"xcr")).toDouble());
1024 m_style.setYCorners(ee.
attribute(QStringLiteral(
"ycr")).toDouble());
1025 m_style.setMarks(ee.
attribute(QStringLiteral(
"marks")).toInt());
1026 m_style.setSpaces(ee.
attribute(QStringLiteral(
"spaces")).toInt());
1031 m_style.setEffectIntensity(ee.
attribute(QStringLiteral(
"intensity")).toDouble());
1035 m_window.setFlags(ee.
attribute(QStringLiteral(
"flags")).toInt());
1037 m_window.setWidth(ee.
attribute(QStringLiteral(
"width")).toInt());
1038 m_window.setHeight(ee.
attribute(QStringLiteral(
"height")).toInt());
1039 m_window.setTitle(ee.
attribute(QStringLiteral(
"title")));
1040 m_window.setSummary(ee.
attribute(QStringLiteral(
"summary")));
1060 m_revisions.append(revision);
1064 m_transformedBoundary = m_boundary;
1067bool AnnotationPrivate::canBeResized()
const
1076class Okular::TextAnnotationPrivate :
public Okular::AnnotationPrivate
1079 TextAnnotationPrivate()
1080 : AnnotationPrivate()
1081 , m_textType(TextAnnotation::Linked)
1082 , m_textIcon(QStringLiteral(
"Comment"))
1084 , m_inplaceIntent(TextAnnotation::
Unknown)
1089 void baseTransform(
const QTransform &matrix)
override;
1090 void resetTransformation()
override;
1092 bool openDialogAfterCreation()
const override;
1093 void setAnnotationProperties(
const QDomNode &node)
override;
1094 bool canBeResized()
const override;
1095 AnnotationPrivate *getNewAnnotationPrivate()
override;
1097 TextAnnotation::TextType m_textType;
1104 TextAnnotation::InplaceIntent m_inplaceIntent;
1110TextAnnotation::TextAnnotation()
1115TextAnnotation::TextAnnotation(
const QDomNode &description)
1116 :
Annotation(*new TextAnnotationPrivate(), description)
1120TextAnnotation::~TextAnnotation()
1124void TextAnnotation::setTextType(TextType textType)
1126 Q_D(TextAnnotation);
1127 d->m_textType = textType;
1130TextAnnotation::TextType TextAnnotation::textType()
const
1132 Q_D(
const TextAnnotation);
1133 return d->m_textType;
1136void TextAnnotation::setTextIcon(
const QString &icon)
1138 Q_D(TextAnnotation);
1139 d->m_textIcon = icon;
1142QString TextAnnotation::textIcon()
const
1144 Q_D(
const TextAnnotation);
1145 return d->m_textIcon;
1148void TextAnnotation::setTextFont(
const QFont &font)
1150 Q_D(TextAnnotation);
1151 d->m_textFont = font;
1154QFont TextAnnotation::textFont()
const
1156 Q_D(
const TextAnnotation);
1157 return d->m_textFont;
1160void TextAnnotation::setTextColor(
const QColor &color)
1162 Q_D(TextAnnotation);
1163 d->m_textColor = color;
1166QColor TextAnnotation::textColor()
const
1168 Q_D(
const TextAnnotation);
1169 return d->m_textColor;
1172void TextAnnotation::setInplaceAlignment(
int alignment)
1174 Q_D(TextAnnotation);
1175 d->m_inplaceAlign = alignment;
1178int TextAnnotation::inplaceAlignment()
const
1180 Q_D(
const TextAnnotation);
1181 return d->m_inplaceAlign;
1184void TextAnnotation::setInplaceCallout(
const NormalizedPoint &point,
int index)
1186 if (index < 0 || index > 2) {
1190 Q_D(TextAnnotation);
1191 d->m_inplaceCallout[index] = point;
1196 if (index < 0 || index > 2) {
1200 Q_D(
const TextAnnotation);
1201 return d->m_inplaceCallout[index];
1204NormalizedPoint TextAnnotation::transformedInplaceCallout(
int index)
const
1206 if (index < 0 || index > 2) {
1210 Q_D(
const TextAnnotation);
1211 return d->m_transformedInplaceCallout[index];
1214void TextAnnotation::setInplaceIntent(InplaceIntent intent)
1216 Q_D(TextAnnotation);
1217 d->m_inplaceIntent = intent;
1220TextAnnotation::InplaceIntent TextAnnotation::inplaceIntent()
const
1222 Q_D(
const TextAnnotation);
1223 return d->m_inplaceIntent;
1233 Q_D(
const TextAnnotation);
1242 if (d->m_textType != Linked) {
1243 textElement.
setAttribute(QStringLiteral(
"type"), (
int)d->m_textType);
1245 if (!d->m_textIcon.isEmpty()) {
1246 textElement.
setAttribute(QStringLiteral(
"icon"), d->m_textIcon);
1249 textElement.
setAttribute(QStringLiteral(
"font"), d->m_textFont.toString());
1251 if (d->m_textColor.isValid()) {
1252 textElement.
setAttribute(QStringLiteral(
"fontColor"), d->m_textColor.name());
1254 if (d->m_inplaceAlign) {
1255 textElement.
setAttribute(QStringLiteral(
"align"), d->m_inplaceAlign);
1257 if (d->m_inplaceIntent != Unknown) {
1258 textElement.
setAttribute(QStringLiteral(
"intent"), (
int)d->m_inplaceIntent);
1262 if (d->m_inplaceCallout[0].x != 0.0) {
1274void TextAnnotationPrivate::transform(
const QTransform &matrix)
1276 AnnotationPrivate::transform(matrix);
1279 np.transform(matrix);
1283void TextAnnotationPrivate::baseTransform(
const QTransform &matrix)
1285 AnnotationPrivate::baseTransform(matrix);
1288 np.transform(matrix);
1292void TextAnnotationPrivate::resetTransformation()
1294 AnnotationPrivate::resetTransformation();
1296 for (
int i = 0; i < 3; ++i) {
1297 m_transformedInplaceCallout[i] = m_inplaceCallout[i];
1303 AnnotationPrivate::translate(coord);
1305#define ADD_COORD(c1, c2) \
1307 c1.x = c1.x + c2.x; \
1308 c1.y = c1.y + c2.y; \
1310 ADD_COORD(m_inplaceCallout[0], coord)
1311 ADD_COORD(m_inplaceCallout[1], coord)
1312 ADD_COORD(m_inplaceCallout[2], coord)
1316bool TextAnnotationPrivate::openDialogAfterCreation()
const
1318 return (m_textType == Okular::TextAnnotation::Linked) || (m_inplaceIntent == TextAnnotation::InplaceIntent::Unknown);
1321void TextAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
1323 Okular::AnnotationPrivate::setAnnotationProperties(node);
1336 m_textType = (TextAnnotation::TextType)e.
attribute(QStringLiteral(
"type")).toInt();
1339 m_textIcon = e.
attribute(QStringLiteral(
"icon"));
1351 m_inplaceIntent = (TextAnnotation::InplaceIntent)e.
attribute(QStringLiteral(
"intent")).toInt();
1363 m_inplaceCallout[0].
x = ee.
attribute(QStringLiteral(
"ax")).toDouble();
1364 m_inplaceCallout[0].
y = ee.
attribute(QStringLiteral(
"ay")).toDouble();
1365 m_inplaceCallout[1].
x = ee.
attribute(QStringLiteral(
"bx")).toDouble();
1366 m_inplaceCallout[1].
y = ee.
attribute(QStringLiteral(
"by")).toDouble();
1367 m_inplaceCallout[2].
x = ee.
attribute(QStringLiteral(
"cx")).toDouble();
1368 m_inplaceCallout[2].
y = ee.
attribute(QStringLiteral(
"cy")).toDouble();
1376 for (
int i = 0; i < 3; ++i) {
1377 m_transformedInplaceCallout[i] = m_inplaceCallout[i];
1381bool TextAnnotationPrivate::canBeResized()
const
1383 if (m_textType != TextAnnotation::Linked) {
1389AnnotationPrivate *TextAnnotationPrivate::getNewAnnotationPrivate()
1391 return new TextAnnotationPrivate();
1396class Okular::LineAnnotationPrivate :
public Okular::AnnotationPrivate
1399 LineAnnotationPrivate()
1400 : AnnotationPrivate()
1401 , m_lineStartStyle(LineAnnotation::
None)
1402 , m_lineEndStyle(LineAnnotation::
None)
1403 , m_lineClosed(false)
1404 , m_lineShowCaption(false)
1405 , m_lineLeadingFwdPt(0)
1406 , m_lineLeadingBackPt(0)
1407 , m_lineIntent(LineAnnotation::
Unknown)
1412 void baseTransform(
const QTransform &matrix)
override;
1413 void resetTransformation()
override;
1415 double distanceSqr(
double x,
double y,
double xScale,
double yScale)
const override;
1416 void setAnnotationProperties(
const QDomNode &node)
override;
1417 AnnotationPrivate *getNewAnnotationPrivate()
override;
1421 LineAnnotation::TermStyle m_lineStartStyle;
1422 LineAnnotation::TermStyle m_lineEndStyle;
1423 bool m_lineClosed : 1;
1424 bool m_lineShowCaption : 1;
1426 double m_lineLeadingFwdPt;
1427 double m_lineLeadingBackPt;
1428 LineAnnotation::LineIntent m_lineIntent;
1431LineAnnotation::LineAnnotation()
1436LineAnnotation::LineAnnotation(
const QDomNode &description)
1437 :
Annotation(*new LineAnnotationPrivate(), description)
1441LineAnnotation::~LineAnnotation()
1447 Q_D(LineAnnotation);
1448 d->m_linePoints = points;
1453 Q_D(
const LineAnnotation);
1454 return d->m_linePoints;
1459 Q_D(
const LineAnnotation);
1460 return d->m_transformedLinePoints;
1463void LineAnnotation::setLineStartStyle(TermStyle style)
1465 Q_D(LineAnnotation);
1466 d->m_lineStartStyle =
style;
1469LineAnnotation::TermStyle LineAnnotation::lineStartStyle()
const
1471 Q_D(
const LineAnnotation);
1472 return d->m_lineStartStyle;
1475void LineAnnotation::setLineEndStyle(TermStyle style)
1477 Q_D(LineAnnotation);
1478 d->m_lineEndStyle =
style;
1481LineAnnotation::TermStyle LineAnnotation::lineEndStyle()
const
1483 Q_D(
const LineAnnotation);
1484 return d->m_lineEndStyle;
1487void LineAnnotation::setLineClosed(
bool closed)
1489 Q_D(LineAnnotation);
1490 d->m_lineClosed = closed;
1493bool LineAnnotation::lineClosed()
const
1495 Q_D(
const LineAnnotation);
1496 return d->m_lineClosed;
1499void LineAnnotation::setLineInnerColor(
const QColor &color)
1501 Q_D(LineAnnotation);
1502 d->m_lineInnerColor = color;
1505QColor LineAnnotation::lineInnerColor()
const
1507 Q_D(
const LineAnnotation);
1508 return d->m_lineInnerColor;
1511void LineAnnotation::setLineLeadingForwardPoint(
double point)
1513 Q_D(LineAnnotation);
1514 d->m_lineLeadingFwdPt = point;
1517double LineAnnotation::lineLeadingForwardPoint()
const
1519 Q_D(
const LineAnnotation);
1520 return d->m_lineLeadingFwdPt;
1523void LineAnnotation::setLineLeadingBackwardPoint(
double point)
1525 Q_D(LineAnnotation);
1526 d->m_lineLeadingBackPt = point;
1529double LineAnnotation::lineLeadingBackwardPoint()
const
1531 Q_D(
const LineAnnotation);
1532 return d->m_lineLeadingBackPt;
1535void LineAnnotation::setShowCaption(
bool show)
1537 Q_D(LineAnnotation);
1538 d->m_lineShowCaption = show;
1541bool LineAnnotation::showCaption()
const
1543 Q_D(
const LineAnnotation);
1544 return d->m_lineShowCaption;
1547void LineAnnotation::setLineIntent(LineIntent intent)
1549 Q_D(LineAnnotation);
1550 d->m_lineIntent = intent;
1553LineAnnotation::LineIntent LineAnnotation::lineIntent()
const
1555 Q_D(
const LineAnnotation);
1556 return d->m_lineIntent;
1566 Q_D(
const LineAnnotation);
1575 if (d->m_lineStartStyle != None) {
1576 lineElement.
setAttribute(QStringLiteral(
"startStyle"), (
int)d->m_lineStartStyle);
1578 if (d->m_lineEndStyle != None) {
1579 lineElement.
setAttribute(QStringLiteral(
"endStyle"), (
int)d->m_lineEndStyle);
1581 if (d->m_lineClosed) {
1582 lineElement.
setAttribute(QStringLiteral(
"closed"), d->m_lineClosed);
1584 if (d->m_lineInnerColor.isValid()) {
1585 lineElement.
setAttribute(QStringLiteral(
"innerColor"), d->m_lineInnerColor.name());
1587 if (d->m_lineLeadingFwdPt != 0.0) {
1590 if (d->m_lineLeadingBackPt != 0.0) {
1593 if (d->m_lineShowCaption) {
1594 lineElement.
setAttribute(QStringLiteral(
"showCaption"), d->m_lineShowCaption);
1596 if (d->m_lineIntent != Unknown) {
1597 lineElement.
setAttribute(QStringLiteral(
"intent"), d->m_lineIntent);
1601 int points = d->m_linePoints.count();
1615void LineAnnotationPrivate::transform(
const QTransform &matrix)
1617 AnnotationPrivate::transform(matrix);
1620 while (it.hasNext()) {
1621 it.next().transform(matrix);
1625void LineAnnotationPrivate::baseTransform(
const QTransform &matrix)
1627 AnnotationPrivate::baseTransform(matrix);
1630 while (it.hasNext()) {
1631 it.next().transform(matrix);
1635void LineAnnotationPrivate::resetTransformation()
1637 AnnotationPrivate::resetTransformation();
1639 m_transformedLinePoints = m_linePoints;
1644 AnnotationPrivate::translate(coord);
1647 while (it.hasNext()) {
1649 p.
x = p.
x + coord.
x;
1650 p.
y = p.
y + coord.
y;
1654void LineAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
1656 Okular::AnnotationPrivate::setAnnotationProperties(node);
1669 m_lineStartStyle = (LineAnnotation::TermStyle)e.
attribute(QStringLiteral(
"startStyle")).toInt();
1672 m_lineEndStyle = (LineAnnotation::TermStyle)e.
attribute(QStringLiteral(
"endStyle")).toInt();
1675 m_lineClosed = e.
attribute(QStringLiteral(
"closed")).toInt();
1687 m_lineShowCaption = e.
attribute(QStringLiteral(
"showCaption")).
toInt();
1690 m_lineIntent = (LineAnnotation::LineIntent)e.
attribute(QStringLiteral(
"intent")).toInt();
1704 p.
x = pe.
attribute(QStringLiteral(
"x"), QStringLiteral(
"0.0")).toDouble();
1705 p.
y = pe.
attribute(QStringLiteral(
"y"), QStringLiteral(
"0.0")).toDouble();
1706 m_linePoints.append(p);
1713 m_transformedLinePoints = m_linePoints;
1716AnnotationPrivate *LineAnnotationPrivate::getNewAnnotationPrivate()
1718 return new LineAnnotationPrivate();
1721double LineAnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
1726 transformedLinePoints.
append(transformedLinePoints.
first());
1729 if (m_lineInnerColor.
isValid()) {
1731 for (
const NormalizedPoint &p : std::as_const(transformedLinePoints)) {
1740 return strokeDistance(::distanceSqr(x, y, xScale, yScale, transformedLinePoints), m_style.width() * xScale / (m_page->m_width * 2));
1745class Okular::GeomAnnotationPrivate :
public Okular::AnnotationPrivate
1748 GeomAnnotationPrivate()
1749 : AnnotationPrivate()
1750 , m_geomType(GeomAnnotation::InscribedSquare)
1753 void setAnnotationProperties(
const QDomNode &node)
override;
1754 bool canBeResized()
const override;
1755 AnnotationPrivate *getNewAnnotationPrivate()
override;
1756 double distanceSqr(
double x,
double y,
double xScale,
double yScale)
const override;
1758 GeomAnnotation::GeomType m_geomType;
1762GeomAnnotation::GeomAnnotation()
1767GeomAnnotation::GeomAnnotation(
const QDomNode &description)
1768 :
Annotation(*new GeomAnnotationPrivate(), description)
1772GeomAnnotation::~GeomAnnotation()
1776void GeomAnnotation::setGeometricalType(GeomType type)
1778 Q_D(GeomAnnotation);
1779 d->m_geomType =
type;
1782GeomAnnotation::GeomType GeomAnnotation::geometricalType()
const
1784 Q_D(
const GeomAnnotation);
1785 return d->m_geomType;
1788void GeomAnnotation::setGeometricalInnerColor(
const QColor &color)
1790 Q_D(GeomAnnotation);
1791 d->m_geomInnerColor = color;
1794QColor GeomAnnotation::geometricalInnerColor()
const
1796 Q_D(
const GeomAnnotation);
1797 return d->m_geomInnerColor;
1807 Q_D(
const GeomAnnotation);
1816 if (d->m_geomType != InscribedSquare) {
1817 geomElement.
setAttribute(QStringLiteral(
"type"), (
int)d->m_geomType);
1819 if (d->m_geomInnerColor.isValid()) {
1820 geomElement.
setAttribute(QStringLiteral(
"color"), d->m_geomInnerColor.name());
1824void GeomAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
1826 Okular::AnnotationPrivate::setAnnotationProperties(node);
1838 m_geomType = (GeomAnnotation::GeomType)e.
attribute(QStringLiteral(
"type")).toInt();
1845 m_style.setWidth(e.
attribute(QStringLiteral(
"width")).toInt());
1853bool GeomAnnotationPrivate::canBeResized()
const
1858AnnotationPrivate *GeomAnnotationPrivate::getNewAnnotationPrivate()
1860 return new GeomAnnotationPrivate();
1863double GeomAnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
1867 bool withinShape =
false;
1868 switch (m_geomType) {
1869 case GeomAnnotation::InscribedCircle: {
1871 const double centerX = (m_transformedBoundary.left + m_transformedBoundary.right) / 2.0;
1872 const double centerY = (m_transformedBoundary.top + m_transformedBoundary.bottom) / 2.0;
1873 const double focusX = (m_transformedBoundary.right - centerX);
1874 const double focusY = (m_transformedBoundary.bottom - centerY);
1876 const double focusXSqr = pow(focusX, 2);
1877 const double focusYSqr = pow(focusY, 2);
1886 const double lambda = sqrt(focusXSqr * focusYSqr / (focusYSqr * pow(x - centerX, 2) + focusXSqr * pow(y - centerY, 2)));
1890 if (m_geomInnerColor.
isValid()) {
1899 projection.x += lambda * (x - centerX);
1900 projection.y += lambda * (y - centerY);
1902 distance = projection.distanceSqr(x, y, xScale, yScale);
1906 case GeomAnnotation::InscribedSquare:
1908 if (m_geomInnerColor.
isValid()) {
1909 return AnnotationPrivate::distanceSqr(x, y, xScale, yScale);
1913 NormalizedPoint(m_transformedBoundary.right, m_transformedBoundary.top),
1914 NormalizedPoint(m_transformedBoundary.right, m_transformedBoundary.bottom),
1915 NormalizedPoint(m_transformedBoundary.left, m_transformedBoundary.bottom),
1916 NormalizedPoint(m_transformedBoundary.left, m_transformedBoundary.top)};
1917 distance = ::distanceSqr(x, y, xScale, yScale, edges);
1919 if (m_transformedBoundary.contains(x, y)) {
1926 distance = strokeDistance(distance, m_style.width() * xScale / m_page->m_width);
1934class HighlightAnnotation::Quad::Private
1946 bool m_capStart : 1;
1969 if (
this != &other) {
1978 if (index < 0 || index > 3) {
1982 d->m_points[index] = point;
1987 if (index < 0 || index > 3) {
1991 return d->m_points[index];
1996 if (index < 0 || index > 3) {
2000 return d->m_transformedPoints[index];
2005 d->m_capStart = value;
2010 return d->m_capStart;
2015 d->m_capEnd = value;
2025 d->m_feather = width;
2030 return d->m_feather;
2035 for (
int i = 0; i < 4; ++i) {
2036 d->m_transformedPoints[i] = d->m_points[i];
2037 d->m_transformedPoints[i].transform(matrix);
2041class Okular::HighlightAnnotationPrivate :
public Okular::AnnotationPrivate
2044 HighlightAnnotationPrivate()
2045 : AnnotationPrivate()
2046 , m_highlightType(HighlightAnnotation::
Highlight)
2050 void transform(
const QTransform &matrix)
override;
2051 void baseTransform(
const QTransform &matrix)
override;
2052 double distanceSqr(
double x,
double y,
double xScale,
double yScale)
const override;
2053 void setAnnotationProperties(
const QDomNode &node)
override;
2054 AnnotationPrivate *getNewAnnotationPrivate()
override;
2056 HighlightAnnotation::HighlightType m_highlightType;
2060HighlightAnnotation::HighlightAnnotation()
2061 :
Annotation(*new HighlightAnnotationPrivate())
2065HighlightAnnotation::HighlightAnnotation(
const QDomNode &description)
2066 :
Annotation(*new HighlightAnnotationPrivate(), description)
2070HighlightAnnotation::~HighlightAnnotation()
2074void HighlightAnnotation::setHighlightType(HighlightType type)
2076 Q_D(HighlightAnnotation);
2077 d->m_highlightType =
type;
2080HighlightAnnotation::HighlightType HighlightAnnotation::highlightType()
const
2082 Q_D(
const HighlightAnnotation);
2083 return d->m_highlightType;
2088 Q_D(HighlightAnnotation);
2089 return d->m_highlightQuads;
2094 Q_D(
const HighlightAnnotation);
2095 return d->m_highlightQuads;
2100 Q_D(
const HighlightAnnotation);
2110 hlElement.
setAttribute(QStringLiteral(
"type"), (
int)d->m_highlightType);
2112 if (d->m_highlightQuads.count() < 1) {
2117 for (; it !=
end; ++it) {
2120 const Quad &q = *it;
2144void HighlightAnnotationPrivate::transform(
const QTransform &matrix)
2146 AnnotationPrivate::transform(matrix);
2149 while (it.hasNext()) {
2150 it.next().transform(matrix);
2154void HighlightAnnotationPrivate::baseTransform(
const QTransform &matrix)
2156 AnnotationPrivate::baseTransform(matrix);
2159 while (it.hasNext()) {
2160 it.next().transform(matrix);
2164void HighlightAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2166 Okular::AnnotationPrivate::setAnnotationProperties(node);
2167 m_highlightQuads.clear();
2180 m_highlightType = (HighlightAnnotation::HighlightType)e.
attribute(QStringLiteral(
"type")).toInt();
2202 m_highlightQuads.append(q);
2210AnnotationPrivate *HighlightAnnotationPrivate::getNewAnnotationPrivate()
2212 return new HighlightAnnotationPrivate();
2215double HighlightAnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
2218 double outsideDistance = DBL_MAX;
2224 pathPoints << quad.transformedPoint(0);
2225 int directionVote = 0;
2226 for (
int i = 1; i < 5; ++i) {
2228 directionVote += (isLeftOfVector(pathPoints.
back(), thisPoint, point)) ? 1 : -1;
2229 pathPoints << thisPoint;
2231 if (abs(directionVote) == 4) {
2237 const double thisOutsideDistance = ::distanceSqr(x, y, xScale, yScale, pathPoints);
2238 if (thisOutsideDistance < outsideDistance) {
2239 outsideDistance = thisOutsideDistance;
2243 return outsideDistance;
2248class Okular::StampAnnotationPrivate :
public Okular::AnnotationPrivate
2251 StampAnnotationPrivate()
2252 : AnnotationPrivate()
2253 , m_stampIconName(QStringLiteral(
"Draft"))
2256 void setAnnotationProperties(
const QDomNode &node)
override;
2257 bool canBeResized()
const override;
2258 AnnotationPrivate *getNewAnnotationPrivate()
override;
2263StampAnnotation::StampAnnotation()
2268StampAnnotation::StampAnnotation(
const QDomNode &description)
2269 :
Annotation(*new StampAnnotationPrivate(), description)
2273StampAnnotation::~StampAnnotation()
2277void StampAnnotation::setStampIconName(
const QString &name)
2279 Q_D(StampAnnotation);
2280 d->m_stampIconName =
name;
2283QString StampAnnotation::stampIconName()
const
2285 Q_D(
const StampAnnotation);
2286 return d->m_stampIconName;
2296 Q_D(
const StampAnnotation);
2306 stampElement.
setAttribute(QStringLiteral(
"icon"), d->m_stampIconName);
2310void StampAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2312 Okular::AnnotationPrivate::setAnnotationProperties(node);
2325 m_stampIconName = e.
attribute(QStringLiteral(
"icon"));
2333bool StampAnnotationPrivate::canBeResized()
const
2338AnnotationPrivate *StampAnnotationPrivate::getNewAnnotationPrivate()
2340 return new StampAnnotationPrivate();
2345class Okular::InkAnnotationPrivate :
public Okular::AnnotationPrivate
2348 InkAnnotationPrivate()
2349 : AnnotationPrivate()
2354 void baseTransform(
const QTransform &matrix)
override;
2355 void resetTransformation()
override;
2356 double distanceSqr(
double x,
double y,
double xScale,
double yScale)
const override;
2358 void setAnnotationProperties(
const QDomNode &node)
override;
2359 AnnotationPrivate *getNewAnnotationPrivate()
override;
2365InkAnnotation::InkAnnotation()
2370InkAnnotation::InkAnnotation(
const QDomNode &description)
2371 :
Annotation(*new InkAnnotationPrivate(), description)
2375InkAnnotation::~InkAnnotation()
2382 d->m_inkPaths = paths;
2387 Q_D(
const InkAnnotation);
2388 return d->m_inkPaths;
2393 Q_D(
const InkAnnotation);
2394 return d->m_transformedInkPaths;
2404 Q_D(
const InkAnnotation);
2413 if (d->m_inkPaths.count() < 1) {
2418 for (; pIt != pEnd; ++pIt) {
2431double InkAnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
2435 const double thisDistance = ::distanceSqr(x, y, xScale, yScale, path);
2436 if (thisDistance < distance) {
2440 return strokeDistance(distance, m_style.width() * xScale / (m_page->m_width * 2));
2443void InkAnnotationPrivate::transform(
const QTransform &matrix)
2445 AnnotationPrivate::transform(matrix);
2447 for (
int i = 0; i < m_transformedInkPaths.count(); ++i) {
2449 while (it.hasNext()) {
2450 it.next().transform(matrix);
2455void InkAnnotationPrivate::baseTransform(
const QTransform &matrix)
2457 AnnotationPrivate::baseTransform(matrix);
2459 for (
int i = 0; i < m_inkPaths.count(); ++i) {
2461 while (it.hasNext()) {
2462 it.next().transform(matrix);
2467void InkAnnotationPrivate::resetTransformation()
2469 AnnotationPrivate::resetTransformation();
2471 m_transformedInkPaths = m_inkPaths;
2476 AnnotationPrivate::translate(coord);
2478 for (
int i = 0; i < m_inkPaths.count(); ++i) {
2480 while (it.hasNext()) {
2482 p.
x = p.
x + coord.
x;
2483 p.
y = p.
y + coord.
y;
2488void InkAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2490 Okular::AnnotationPrivate::setAnnotationProperties(node);
2539 m_transformedInkPaths = m_inkPaths;
2542AnnotationPrivate *InkAnnotationPrivate::getNewAnnotationPrivate()
2544 return new InkAnnotationPrivate();
2549class Okular::CaretAnnotationPrivate :
public Okular::AnnotationPrivate
2552 CaretAnnotationPrivate()
2553 : AnnotationPrivate()
2554 , m_symbol(CaretAnnotation::
None)
2558 void setAnnotationProperties(
const QDomNode &node)
override;
2559 AnnotationPrivate *getNewAnnotationPrivate()
override;
2561 CaretAnnotation::CaretSymbol m_symbol;
2564static QString caretSymbolToString(CaretAnnotation::CaretSymbol symbol)
2567 case CaretAnnotation::None:
2568 return QStringLiteral(
"None");
2569 case CaretAnnotation::P:
2570 return QStringLiteral(
"P");
2575static CaretAnnotation::CaretSymbol caretSymbolFromString(
const QString &symbol)
2578 return CaretAnnotation::None;
2580 return CaretAnnotation::P;
2582 return CaretAnnotation::None;
2585void CaretAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2587 Okular::AnnotationPrivate::setAnnotationProperties(node);
2600 m_symbol = caretSymbolFromString(e.
attribute(QStringLiteral(
"symbol")));
2608AnnotationPrivate *CaretAnnotationPrivate::getNewAnnotationPrivate()
2610 return new CaretAnnotationPrivate();
2613CaretAnnotation::CaretAnnotation()
2618CaretAnnotation::CaretAnnotation(
const QDomNode &description)
2619 :
Annotation(*new CaretAnnotationPrivate(), description)
2623CaretAnnotation::~CaretAnnotation()
2627void CaretAnnotation::setCaretSymbol(CaretAnnotation::CaretSymbol symbol)
2629 Q_D(CaretAnnotation);
2630 d->m_symbol = symbol;
2633CaretAnnotation::CaretSymbol CaretAnnotation::caretSymbol()
const
2635 Q_D(
const CaretAnnotation);
2646 Q_D(
const CaretAnnotation);
2655 if (d->m_symbol !=
None) {
2656 caretElement.
setAttribute(QStringLiteral(
"symbol"), caretSymbolToString(d->m_symbol));
2662class Okular::FileAttachmentAnnotationPrivate :
public Okular::AnnotationPrivate
2665 FileAttachmentAnnotationPrivate()
2666 : AnnotationPrivate()
2667 , icon(QStringLiteral(
"PushPin"))
2671 ~FileAttachmentAnnotationPrivate()
override
2676 void setAnnotationProperties(
const QDomNode &node)
override;
2677 AnnotationPrivate *getNewAnnotationPrivate()
override;
2684void FileAttachmentAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2686 Okular::AnnotationPrivate::setAnnotationProperties(node);
2702AnnotationPrivate *FileAttachmentAnnotationPrivate::getNewAnnotationPrivate()
2704 return new FileAttachmentAnnotationPrivate();
2707FileAttachmentAnnotation::FileAttachmentAnnotation()
2708 :
Annotation(*new FileAttachmentAnnotationPrivate())
2712FileAttachmentAnnotation::FileAttachmentAnnotation(
const QDomNode &description)
2713 :
Annotation(*new FileAttachmentAnnotationPrivate(), description)
2717FileAttachmentAnnotation::~FileAttachmentAnnotation()
2736QString FileAttachmentAnnotation::fileIconName()
const
2738 Q_D(
const FileAttachmentAnnotation);
2742void FileAttachmentAnnotation::setFileIconName(
const QString &iconName)
2744 Q_D(FileAttachmentAnnotation);
2748EmbeddedFile *FileAttachmentAnnotation::embeddedFile()
const
2750 Q_D(
const FileAttachmentAnnotation);
2754void FileAttachmentAnnotation::setEmbeddedFile(
EmbeddedFile *ef)
2756 Q_D(FileAttachmentAnnotation);
2762class Okular::SoundAnnotationPrivate :
public Okular::AnnotationPrivate
2765 SoundAnnotationPrivate()
2766 : AnnotationPrivate()
2767 , icon(QStringLiteral(
"Speaker"))
2771 ~SoundAnnotationPrivate()
override
2776 void setAnnotationProperties(
const QDomNode &node)
override;
2777 AnnotationPrivate *getNewAnnotationPrivate()
override;
2784void SoundAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2786 Okular::AnnotationPrivate::setAnnotationProperties(node);
2802AnnotationPrivate *SoundAnnotationPrivate::getNewAnnotationPrivate()
2804 return new SoundAnnotationPrivate();
2813 :
Annotation(*new SoundAnnotationPrivate(), description)
2862class Okular::MovieAnnotationPrivate :
public Okular::AnnotationPrivate
2865 MovieAnnotationPrivate()
2866 : AnnotationPrivate()
2870 ~MovieAnnotationPrivate()
override
2875 void setAnnotationProperties(
const QDomNode &node)
override;
2876 AnnotationPrivate *getNewAnnotationPrivate()
override;
2882void MovieAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2884 Okular::AnnotationPrivate::setAnnotationProperties(node);
2900AnnotationPrivate *MovieAnnotationPrivate::getNewAnnotationPrivate()
2902 return new MovieAnnotationPrivate();
2911 :
Annotation(*new MovieAnnotationPrivate(), description)
2948class Okular::ScreenAnnotationPrivate :
public Okular::AnnotationPrivate
2951 ScreenAnnotationPrivate();
2952 ~ScreenAnnotationPrivate()
override;
2954 void setAnnotationProperties(
const QDomNode &node)
override;
2955 AnnotationPrivate *getNewAnnotationPrivate()
override;
2961ScreenAnnotationPrivate::ScreenAnnotationPrivate()
2966ScreenAnnotationPrivate::~ScreenAnnotationPrivate()
2969 qDeleteAll(m_additionalActions);
2972void ScreenAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2974 Okular::AnnotationPrivate::setAnnotationProperties(node);
2990AnnotationPrivate *ScreenAnnotationPrivate::getNewAnnotationPrivate()
2992 return new ScreenAnnotationPrivate();
3001 :
Annotation(*new ScreenAnnotationPrivate(), description)
3027 if (d->m_additionalActions.contains(type)) {
3028 delete d->m_additionalActions.value(type);
3031 d->m_additionalActions.insert(type,
action);
3037 if (!d->m_additionalActions.contains(type)) {
3040 return d->m_additionalActions.value(type);
3060class Okular::WidgetAnnotationPrivate :
public Okular::AnnotationPrivate
3063 ~WidgetAnnotationPrivate()
override;
3064 void setAnnotationProperties(
const QDomNode &node)
override;
3065 AnnotationPrivate *getNewAnnotationPrivate()
override;
3070WidgetAnnotationPrivate::~WidgetAnnotationPrivate()
3072 qDeleteAll(m_additionalActions);
3075void WidgetAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
3077 Okular::AnnotationPrivate::setAnnotationProperties(node);
3093AnnotationPrivate *WidgetAnnotationPrivate::getNewAnnotationPrivate()
3095 return new WidgetAnnotationPrivate();
3104 :
Annotation(*new WidgetAnnotationPrivate, description)
3130 if (d->m_additionalActions.contains(type)) {
3131 delete d->m_additionalActions.value(type);
3134 d->m_additionalActions.insert(type, action);
3140 if (!d->m_additionalActions.contains(type)) {
3143 return d->m_additionalActions.value(type);
3149class Okular::RichMediaAnnotationPrivate :
public Okular::AnnotationPrivate
3152 RichMediaAnnotationPrivate();
3153 ~RichMediaAnnotationPrivate()
override;
3154 void setAnnotationProperties(
const QDomNode &node)
override;
3155 AnnotationPrivate *getNewAnnotationPrivate()
override;
3162RichMediaAnnotationPrivate::RichMediaAnnotationPrivate()
3164 , embeddedFile(nullptr)
3168RichMediaAnnotationPrivate::~RichMediaAnnotationPrivate()
3171 delete embeddedFile;
3174void RichMediaAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
3176 Okular::AnnotationPrivate::setAnnotationProperties(node);
3192AnnotationPrivate *RichMediaAnnotationPrivate::getNewAnnotationPrivate()
3194 return new RichMediaAnnotationPrivate();
3198 :
Annotation(*new RichMediaAnnotationPrivate())
3203 :
Annotation(*new RichMediaAnnotationPrivate, description)
3245 return d->embeddedFile;
3252 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.
QString name(GameStandardAction id)
QAction * end(const QObject *recvr, const char *slot, QObject *parent)
QString path(const QString &relativePath)
VehicleSection::Type type(QStringView coachNumber, QStringView coachClassification)
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