7#include "annotations.h"
8#include "annotations_p.h"
11#include <QApplication>
16#include <QStandardPaths>
17#include <QSvgRenderer>
25#include "document_p.h"
41 return ((b.
x - a.
x) * (c.
y - a.
y) - (b.
y - a.
y) * (c.
x - a.
x)) > 0;
49static double distanceSqr(
double x,
double y,
double xScale,
double yScale,
const QList<NormalizedPoint> &path)
58 if (thisDistance < distance) {
88static double strokeDistance(
double distance,
double penWidth)
90 return fmax(distance - pow(penWidth, 2), 0);
103 int typeNumber = annElement.
attribute(QStringLiteral(
"type")).
toInt();
104 switch (typeNumber) {
106 annotation =
new TextAnnotation(annElement);
109 annotation =
new LineAnnotation(annElement);
112 annotation =
new GeomAnnotation(annElement);
115 annotation =
new HighlightAnnotation(annElement);
118 annotation =
new StampAnnotation(annElement);
121 annotation =
new InkAnnotation(annElement);
124 annotation =
new CaretAnnotation(annElement);
138 ann->
store(annElement, document);
147 if (element.
tagName() == name) {
159 if (annotation->
subType() ==
Annotation::AText && (
static_cast<const TextAnnotation *
>(annotation)->textType() == TextAnnotation::Linked)) {
163 return rect24.
united(rect);
173 static std::unique_ptr<QSvgRenderer> svgStampFile;
174 if (!svgStampFile.get()) {
177 svgStampFile = std::make_unique<QSvgRenderer>(stampFile);
178 if (!svgStampFile->isValid()) {
179 svgStampFile.reset();
202 pixmap.
load(nameOrPath);
214AnnotationProxy::AnnotationProxy()
224class Annotation::Style::Private
236 , m_effectIntensity(1.0)
249 double m_effectIntensity;
270 if (
this != &other) {
289 d->m_opacity = opacity;
319 d->m_xCorners = xCorners;
324 return d->m_xCorners;
329 d->m_yCorners = yCorners;
334 return d->m_yCorners;
349 d->m_spaces = spaces;
359 d->m_effect = effect;
369 d->m_effectIntensity = intensity;
374 return d->m_effectIntensity;
377class Annotation::Window::Private
413 if (
this != &other) {
432 d->m_topLeft = point;
452 d->m_height = height;
472 d->m_summary = summary;
480class Annotation::Revision::Private
484 : m_annotation(nullptr)
491 RevisionScope m_scope;
513 if (
this != &other) {
522 d->m_annotation = annotation;
527 return d->m_annotation;
550AnnotationPrivate::AnnotationPrivate()
553 , m_disposeFunc(nullptr)
557AnnotationPrivate::~AnnotationPrivate()
560 if (m_revisions.isEmpty()) {
565 delete revision.annotation();
569AnnotationPrivate *AnnotationPrivate::get(
Annotation *a)
571 return a ? a->d_ptr :
nullptr;
574Annotation::Annotation(AnnotationPrivate &dd)
579Annotation::Annotation(AnnotationPrivate &dd,
const QDomNode &description)
582 d_ptr->setAnnotationProperties(description);
587 if (d_ptr->m_disposeFunc) {
588 d_ptr->m_disposeFunc(
this);
615 return d->m_contents;
621 d->m_uniqueName = name;
627 return d->m_uniqueName;
633 d->m_modifyDate = date;
639 return d->m_modifyDate;
645 d->m_creationDate = date;
651 return d->m_creationDate;
669 d->m_boundary = rectangle;
670 d->resetTransformation();
672 d->transform(d->m_page->rotationMatrix());
679 return d->m_boundary;
685 return d->m_transformedBoundary;
692 d->resetTransformation();
694 d->transform(d->m_page->rotationMatrix());
701 d->adjust(deltaCoord1, deltaCoord2);
702 d->resetTransformation();
704 d->transform(d->m_page->rotationMatrix());
711 return d->openDialogAfterCreation();
741 return d->m_revisions;
747 return d->m_revisions;
759 return d->m_nativeId;
765 d->m_disposeFunc = func;
771 d->m_nativeData = data;
777 return d->m_nativeData.get();
785 if (!d->m_page || !d->m_page->m_doc->m_parent->canModifyPageAnnotation(
this)) {
802 if (!d->m_page || !d->m_page->m_doc->m_parent->canModifyPageAnnotation(
this)) {
806 return d->canBeResized();
817 if (!d->m_author.isEmpty()) {
820 if (!d->m_contents.isEmpty()) {
821 e.
setAttribute(QStringLiteral(
"contents"), d->m_contents);
823 if (!d->m_uniqueName.isEmpty()) {
824 e.
setAttribute(QStringLiteral(
"uniqueName"), d->m_uniqueName);
826 if (d->m_modifyDate.isValid()) {
829 if (d->m_creationDate.isValid()) {
837 if (d->m_style.color().isValid()) {
840 if (d->m_style.opacity() != 1.0) {
853 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) {
857 psE.
setAttribute(QStringLiteral(
"style"), (
int)d->m_style.lineStyle());
860 psE.
setAttribute(QStringLiteral(
"marks"), d->m_style.marks());
861 psE.
setAttribute(QStringLiteral(
"spaces"), d->m_style.spaces());
865 if (d->m_style.lineEffect() !=
NoEffect || d->m_style.effectIntensity() != 1.0) {
868 peE.
setAttribute(QStringLiteral(
"effect"), (
int)d->m_style.lineEffect());
873 if (d->m_window.flags() != -1 || !d->m_window.title().isEmpty() || !d->m_window.summary().isEmpty()) {
876 wE.
setAttribute(QStringLiteral(
"flags"), d->m_window.flags());
879 wE.
setAttribute(QStringLiteral(
"width"), d->m_window.width());
880 wE.
setAttribute(QStringLiteral(
"height"), d->m_window.height());
881 wE.
setAttribute(QStringLiteral(
"title"), d->m_window.title());
882 wE.
setAttribute(QStringLiteral(
"summary"), d->m_window.summary());
886 if (d->m_revisions.isEmpty()) {
891 for (
const Revision &revision : std::as_const(d->m_revisions)) {
896 r.
setAttribute(QStringLiteral(
"revScope"), (
int)revision.scope());
897 r.
setAttribute(QStringLiteral(
"revType"), (
int)revision.type());
915 Okular::PagePrivate *p = d_ptr->m_page;
916 QVariant nativeID = d_ptr->m_nativeId;
921 AnnotationPrivate *new_d_ptr = d_ptr->getNewAnnotationPrivate();
926 d_ptr->setAnnotationProperties(node);
930 d_ptr->m_nativeId = nativeID;
931 d_ptr->m_flags = d_ptr->m_flags | internalFlags;
932 d_ptr->m_disposeFunc = disposeFunc;
935 d_ptr->transform(d_ptr->m_page->rotationMatrix());
938double AnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
940 return m_transformedBoundary.distanceSqr(x, y, xScale, yScale);
943void AnnotationPrivate::annotationTransform(
const QTransform &matrix)
945 resetTransformation();
949void AnnotationPrivate::transform(
const QTransform &matrix)
951 m_transformedBoundary.transform(matrix);
954void AnnotationPrivate::baseTransform(
const QTransform &matrix)
956 m_boundary.transform(matrix);
959void AnnotationPrivate::resetTransformation()
961 m_transformedBoundary = m_boundary;
966 m_boundary.left = m_boundary.left + coord.
x;
967 m_boundary.right = m_boundary.right + coord.
x;
968 m_boundary.top = m_boundary.top + coord.
y;
969 m_boundary.bottom = m_boundary.bottom + coord.
y;
974 m_boundary.left = m_boundary.left + qBound(-m_boundary.left, deltaCoord1.
x, m_boundary.right - m_boundary.left);
975 m_boundary.top = m_boundary.top + qBound(-m_boundary.top, deltaCoord1.
y, m_boundary.bottom - m_boundary.top);
977 m_boundary.right = m_boundary.right + qBound(m_boundary.left - m_boundary.right, deltaCoord2.
x, 1. - m_boundary.right);
978 m_boundary.bottom = m_boundary.bottom + qBound(m_boundary.top - m_boundary.bottom, deltaCoord2.
y, 1. - m_boundary.bottom);
981bool AnnotationPrivate::openDialogAfterCreation()
const
986void AnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
996 m_author = e.
attribute(QStringLiteral(
"author"));
999 m_contents = e.
attribute(QStringLiteral(
"contents"));
1002 m_uniqueName = e.
attribute(QStringLiteral(
"uniqueName"));
1019 m_style.setOpacity(e.
attribute(QStringLiteral(
"opacity")).toDouble());
1035 m_style.setWidth(ee.
attribute(QStringLiteral(
"width")).toDouble());
1037 m_style.setXCorners(ee.
attribute(QStringLiteral(
"xcr")).toDouble());
1038 m_style.setYCorners(ee.
attribute(QStringLiteral(
"ycr")).toDouble());
1039 m_style.setMarks(ee.
attribute(QStringLiteral(
"marks")).toInt());
1040 m_style.setSpaces(ee.
attribute(QStringLiteral(
"spaces")).toInt());
1045 m_style.setEffectIntensity(ee.
attribute(QStringLiteral(
"intensity")).toDouble());
1049 m_window.setFlags(ee.
attribute(QStringLiteral(
"flags")).toInt());
1051 m_window.setWidth(ee.
attribute(QStringLiteral(
"width")).toInt());
1052 m_window.setHeight(ee.
attribute(QStringLiteral(
"height")).toInt());
1053 m_window.setTitle(ee.
attribute(QStringLiteral(
"title")));
1054 m_window.setSummary(ee.
attribute(QStringLiteral(
"summary")));
1074 m_revisions.append(revision);
1078 m_transformedBoundary = m_boundary;
1081bool AnnotationPrivate::canBeResized()
const
1090class Okular::TextAnnotationPrivate :
public Okular::AnnotationPrivate
1093 TextAnnotationPrivate()
1094 : AnnotationPrivate()
1095 , m_textType(TextAnnotation::Linked)
1096 , m_textIcon(QStringLiteral(
"Comment"))
1098 , m_inplaceIntent(TextAnnotation::
Unknown)
1103 void baseTransform(
const QTransform &matrix)
override;
1104 void resetTransformation()
override;
1106 bool openDialogAfterCreation()
const override;
1107 void setAnnotationProperties(
const QDomNode &node)
override;
1108 bool canBeResized()
const override;
1109 AnnotationPrivate *getNewAnnotationPrivate()
override;
1111 TextAnnotation::TextType m_textType;
1118 TextAnnotation::InplaceIntent m_inplaceIntent;
1124TextAnnotation::TextAnnotation()
1129TextAnnotation::TextAnnotation(
const QDomNode &description)
1130 :
Annotation(*new TextAnnotationPrivate(), description)
1134TextAnnotation::~TextAnnotation()
1138void TextAnnotation::setTextType(TextType textType)
1140 Q_D(TextAnnotation);
1141 d->m_textType = textType;
1144TextAnnotation::TextType TextAnnotation::textType()
const
1146 Q_D(
const TextAnnotation);
1147 return d->m_textType;
1150void TextAnnotation::setTextIcon(
const QString &icon)
1152 Q_D(TextAnnotation);
1153 d->m_textIcon = icon;
1156QString TextAnnotation::textIcon()
const
1158 Q_D(
const TextAnnotation);
1159 return d->m_textIcon;
1162void TextAnnotation::setTextFont(
const QFont &font)
1164 Q_D(TextAnnotation);
1165 d->m_textFont = font;
1168QFont TextAnnotation::textFont()
const
1170 Q_D(
const TextAnnotation);
1171 return d->m_textFont;
1174void TextAnnotation::setTextColor(
const QColor &color)
1176 Q_D(TextAnnotation);
1177 d->m_textColor = color;
1180QColor TextAnnotation::textColor()
const
1182 Q_D(
const TextAnnotation);
1183 return d->m_textColor;
1186void TextAnnotation::setInplaceAlignment(
int alignment)
1188 Q_D(TextAnnotation);
1189 d->m_inplaceAlign = alignment;
1192int TextAnnotation::inplaceAlignment()
const
1194 Q_D(
const TextAnnotation);
1195 return d->m_inplaceAlign;
1198void TextAnnotation::setInplaceCallout(
const NormalizedPoint &point,
int index)
1200 if (index < 0 || index > 2) {
1204 Q_D(TextAnnotation);
1205 d->m_inplaceCallout[index] = point;
1210 if (index < 0 || index > 2) {
1214 Q_D(
const TextAnnotation);
1215 return d->m_inplaceCallout[index];
1218NormalizedPoint TextAnnotation::transformedInplaceCallout(
int index)
const
1220 if (index < 0 || index > 2) {
1224 Q_D(
const TextAnnotation);
1225 return d->m_transformedInplaceCallout[index];
1228void TextAnnotation::setInplaceIntent(InplaceIntent intent)
1230 Q_D(TextAnnotation);
1231 d->m_inplaceIntent = intent;
1234TextAnnotation::InplaceIntent TextAnnotation::inplaceIntent()
const
1236 Q_D(
const TextAnnotation);
1237 return d->m_inplaceIntent;
1247 Q_D(
const TextAnnotation);
1256 if (d->m_textType != Linked) {
1257 textElement.
setAttribute(QStringLiteral(
"type"), (
int)d->m_textType);
1259 if (!d->m_textIcon.isEmpty()) {
1260 textElement.
setAttribute(QStringLiteral(
"icon"), d->m_textIcon);
1263 textElement.
setAttribute(QStringLiteral(
"font"), d->m_textFont.toString());
1265 if (d->m_textColor.isValid()) {
1266 textElement.
setAttribute(QStringLiteral(
"fontColor"), d->m_textColor.name());
1268 if (d->m_inplaceAlign) {
1269 textElement.
setAttribute(QStringLiteral(
"align"), d->m_inplaceAlign);
1271 if (d->m_inplaceIntent != Unknown) {
1272 textElement.
setAttribute(QStringLiteral(
"intent"), (
int)d->m_inplaceIntent);
1276 if (d->m_inplaceCallout[0].x != 0.0) {
1288void TextAnnotationPrivate::transform(
const QTransform &matrix)
1290 AnnotationPrivate::transform(matrix);
1293 np.transform(matrix);
1297void TextAnnotationPrivate::baseTransform(
const QTransform &matrix)
1299 AnnotationPrivate::baseTransform(matrix);
1302 np.transform(matrix);
1306void TextAnnotationPrivate::resetTransformation()
1308 AnnotationPrivate::resetTransformation();
1310 for (
int i = 0; i < 3; ++i) {
1311 m_transformedInplaceCallout[i] = m_inplaceCallout[i];
1317 AnnotationPrivate::translate(coord);
1319#define ADD_COORD(c1, c2) \
1321 c1.x = c1.x + c2.x; \
1322 c1.y = c1.y + c2.y; \
1324 ADD_COORD(m_inplaceCallout[0], coord)
1325 ADD_COORD(m_inplaceCallout[1], coord)
1326 ADD_COORD(m_inplaceCallout[2], coord)
1330bool TextAnnotationPrivate::openDialogAfterCreation()
const
1332 return (m_textType == Okular::TextAnnotation::Linked) || (m_inplaceIntent == TextAnnotation::InplaceIntent::Unknown);
1335void TextAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
1337 Okular::AnnotationPrivate::setAnnotationProperties(node);
1350 m_textType = (TextAnnotation::TextType)e.
attribute(QStringLiteral(
"type")).
toInt();
1353 m_textIcon = e.
attribute(QStringLiteral(
"icon"));
1365 m_inplaceIntent = (TextAnnotation::InplaceIntent)e.
attribute(QStringLiteral(
"intent")).
toInt();
1390 for (
int i = 0; i < 3; ++i) {
1391 m_transformedInplaceCallout[i] = m_inplaceCallout[i];
1395bool TextAnnotationPrivate::canBeResized()
const
1397 if (m_textType != TextAnnotation::Linked) {
1403AnnotationPrivate *TextAnnotationPrivate::getNewAnnotationPrivate()
1405 return new TextAnnotationPrivate();
1410class Okular::LineAnnotationPrivate :
public Okular::AnnotationPrivate
1413 LineAnnotationPrivate()
1414 : AnnotationPrivate()
1415 , m_lineStartStyle(LineAnnotation::
None)
1416 , m_lineEndStyle(LineAnnotation::
None)
1417 , m_lineClosed(false)
1418 , m_lineShowCaption(false)
1419 , m_lineLeadingFwdPt(0)
1420 , m_lineLeadingBackPt(0)
1421 , m_lineIntent(LineAnnotation::
Unknown)
1426 void baseTransform(
const QTransform &matrix)
override;
1427 void resetTransformation()
override;
1429 double distanceSqr(
double x,
double y,
double xScale,
double yScale)
const override;
1430 void setAnnotationProperties(
const QDomNode &node)
override;
1431 AnnotationPrivate *getNewAnnotationPrivate()
override;
1435 LineAnnotation::TermStyle m_lineStartStyle;
1436 LineAnnotation::TermStyle m_lineEndStyle;
1437 bool m_lineClosed : 1;
1438 bool m_lineShowCaption : 1;
1440 double m_lineLeadingFwdPt;
1441 double m_lineLeadingBackPt;
1442 LineAnnotation::LineIntent m_lineIntent;
1445LineAnnotation::LineAnnotation()
1450LineAnnotation::LineAnnotation(
const QDomNode &description)
1451 :
Annotation(*new LineAnnotationPrivate(), description)
1455LineAnnotation::~LineAnnotation()
1461 Q_D(LineAnnotation);
1462 d->m_linePoints = points;
1467 Q_D(
const LineAnnotation);
1468 return d->m_linePoints;
1473 Q_D(
const LineAnnotation);
1474 return d->m_transformedLinePoints;
1477void LineAnnotation::setLineStartStyle(TermStyle style)
1479 Q_D(LineAnnotation);
1480 d->m_lineStartStyle =
style;
1483LineAnnotation::TermStyle LineAnnotation::lineStartStyle()
const
1485 Q_D(
const LineAnnotation);
1486 return d->m_lineStartStyle;
1489void LineAnnotation::setLineEndStyle(TermStyle style)
1491 Q_D(LineAnnotation);
1492 d->m_lineEndStyle =
style;
1495LineAnnotation::TermStyle LineAnnotation::lineEndStyle()
const
1497 Q_D(
const LineAnnotation);
1498 return d->m_lineEndStyle;
1501void LineAnnotation::setLineClosed(
bool closed)
1503 Q_D(LineAnnotation);
1504 d->m_lineClosed = closed;
1507bool LineAnnotation::lineClosed()
const
1509 Q_D(
const LineAnnotation);
1510 return d->m_lineClosed;
1513void LineAnnotation::setLineInnerColor(
const QColor &color)
1515 Q_D(LineAnnotation);
1516 d->m_lineInnerColor = color;
1519QColor LineAnnotation::lineInnerColor()
const
1521 Q_D(
const LineAnnotation);
1522 return d->m_lineInnerColor;
1525void LineAnnotation::setLineLeadingForwardPoint(
double point)
1527 Q_D(LineAnnotation);
1528 d->m_lineLeadingFwdPt = point;
1531double LineAnnotation::lineLeadingForwardPoint()
const
1533 Q_D(
const LineAnnotation);
1534 return d->m_lineLeadingFwdPt;
1537void LineAnnotation::setLineLeadingBackwardPoint(
double point)
1539 Q_D(LineAnnotation);
1540 d->m_lineLeadingBackPt = point;
1543double LineAnnotation::lineLeadingBackwardPoint()
const
1545 Q_D(
const LineAnnotation);
1546 return d->m_lineLeadingBackPt;
1549void LineAnnotation::setShowCaption(
bool show)
1551 Q_D(LineAnnotation);
1552 d->m_lineShowCaption = show;
1555bool LineAnnotation::showCaption()
const
1557 Q_D(
const LineAnnotation);
1558 return d->m_lineShowCaption;
1561void LineAnnotation::setLineIntent(LineIntent intent)
1563 Q_D(LineAnnotation);
1564 d->m_lineIntent = intent;
1567LineAnnotation::LineIntent LineAnnotation::lineIntent()
const
1569 Q_D(
const LineAnnotation);
1570 return d->m_lineIntent;
1580 Q_D(
const LineAnnotation);
1589 if (d->m_lineStartStyle != None) {
1590 lineElement.
setAttribute(QStringLiteral(
"startStyle"), (
int)d->m_lineStartStyle);
1592 if (d->m_lineEndStyle != None) {
1593 lineElement.
setAttribute(QStringLiteral(
"endStyle"), (
int)d->m_lineEndStyle);
1595 if (d->m_lineClosed) {
1596 lineElement.
setAttribute(QStringLiteral(
"closed"), d->m_lineClosed);
1598 if (d->m_lineInnerColor.isValid()) {
1599 lineElement.
setAttribute(QStringLiteral(
"innerColor"), d->m_lineInnerColor.name());
1601 if (d->m_lineLeadingFwdPt != 0.0) {
1604 if (d->m_lineLeadingBackPt != 0.0) {
1607 if (d->m_lineShowCaption) {
1608 lineElement.
setAttribute(QStringLiteral(
"showCaption"), d->m_lineShowCaption);
1610 if (d->m_lineIntent != Unknown) {
1611 lineElement.
setAttribute(QStringLiteral(
"intent"), d->m_lineIntent);
1615 int points = d->m_linePoints.count();
1629void LineAnnotationPrivate::transform(
const QTransform &matrix)
1631 AnnotationPrivate::transform(matrix);
1634 while (it.hasNext()) {
1635 it.next().transform(matrix);
1639void LineAnnotationPrivate::baseTransform(
const QTransform &matrix)
1641 AnnotationPrivate::baseTransform(matrix);
1644 while (it.hasNext()) {
1645 it.next().transform(matrix);
1649void LineAnnotationPrivate::resetTransformation()
1651 AnnotationPrivate::resetTransformation();
1653 m_transformedLinePoints = m_linePoints;
1658 AnnotationPrivate::translate(coord);
1661 while (it.hasNext()) {
1663 p.
x = p.
x + coord.
x;
1664 p.
y = p.
y + coord.
y;
1668void LineAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
1670 Okular::AnnotationPrivate::setAnnotationProperties(node);
1683 m_lineStartStyle = (LineAnnotation::TermStyle)e.
attribute(QStringLiteral(
"startStyle")).
toInt();
1686 m_lineEndStyle = (LineAnnotation::TermStyle)e.
attribute(QStringLiteral(
"endStyle")).
toInt();
1701 m_lineShowCaption = e.
attribute(QStringLiteral(
"showCaption")).
toInt();
1704 m_lineIntent = (LineAnnotation::LineIntent)e.
attribute(QStringLiteral(
"intent")).
toInt();
1720 m_linePoints.append(p);
1727 m_transformedLinePoints = m_linePoints;
1730AnnotationPrivate *LineAnnotationPrivate::getNewAnnotationPrivate()
1732 return new LineAnnotationPrivate();
1735double LineAnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
1740 transformedLinePoints.
append(transformedLinePoints.
first());
1743 if (m_lineInnerColor.
isValid()) {
1745 for (
const NormalizedPoint &p : std::as_const(transformedLinePoints)) {
1754 return strokeDistance(::distanceSqr(x, y, xScale, yScale, transformedLinePoints), m_style.width() * xScale / (m_page->m_width * 2));
1759class Okular::GeomAnnotationPrivate :
public Okular::AnnotationPrivate
1762 GeomAnnotationPrivate()
1763 : AnnotationPrivate()
1764 , m_geomType(GeomAnnotation::InscribedSquare)
1767 void setAnnotationProperties(
const QDomNode &node)
override;
1768 bool canBeResized()
const override;
1769 AnnotationPrivate *getNewAnnotationPrivate()
override;
1770 double distanceSqr(
double x,
double y,
double xScale,
double yScale)
const override;
1772 GeomAnnotation::GeomType m_geomType;
1776GeomAnnotation::GeomAnnotation()
1781GeomAnnotation::GeomAnnotation(
const QDomNode &description)
1782 :
Annotation(*new GeomAnnotationPrivate(), description)
1786GeomAnnotation::~GeomAnnotation()
1790void GeomAnnotation::setGeometricalType(GeomType type)
1792 Q_D(GeomAnnotation);
1793 d->m_geomType =
type;
1796GeomAnnotation::GeomType GeomAnnotation::geometricalType()
const
1798 Q_D(
const GeomAnnotation);
1799 return d->m_geomType;
1802void GeomAnnotation::setGeometricalInnerColor(
const QColor &color)
1804 Q_D(GeomAnnotation);
1805 d->m_geomInnerColor = color;
1808QColor GeomAnnotation::geometricalInnerColor()
const
1810 Q_D(
const GeomAnnotation);
1811 return d->m_geomInnerColor;
1821 Q_D(
const GeomAnnotation);
1830 if (d->m_geomType != InscribedSquare) {
1831 geomElement.
setAttribute(QStringLiteral(
"type"), (
int)d->m_geomType);
1833 if (d->m_geomInnerColor.isValid()) {
1834 geomElement.
setAttribute(QStringLiteral(
"color"), d->m_geomInnerColor.name());
1838void GeomAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
1840 Okular::AnnotationPrivate::setAnnotationProperties(node);
1852 m_geomType = (GeomAnnotation::GeomType)e.
attribute(QStringLiteral(
"type")).
toInt();
1859 m_style.setWidth(e.
attribute(QStringLiteral(
"width")).toInt());
1867bool GeomAnnotationPrivate::canBeResized()
const
1872AnnotationPrivate *GeomAnnotationPrivate::getNewAnnotationPrivate()
1874 return new GeomAnnotationPrivate();
1877double GeomAnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
1881 bool withinShape =
false;
1882 switch (m_geomType) {
1883 case GeomAnnotation::InscribedCircle: {
1885 const double centerX = (m_transformedBoundary.left + m_transformedBoundary.right) / 2.0;
1886 const double centerY = (m_transformedBoundary.top + m_transformedBoundary.bottom) / 2.0;
1887 const double focusX = (m_transformedBoundary.right - centerX);
1888 const double focusY = (m_transformedBoundary.bottom - centerY);
1890 const double focusXSqr = pow(focusX, 2);
1891 const double focusYSqr = pow(focusY, 2);
1900 const double lambda = sqrt(focusXSqr * focusYSqr / (focusYSqr * pow(x - centerX, 2) + focusXSqr * pow(y - centerY, 2)));
1904 if (m_geomInnerColor.
isValid()) {
1913 projection.x += lambda * (x - centerX);
1914 projection.y += lambda * (y - centerY);
1916 distance = projection.distanceSqr(x, y, xScale, yScale);
1920 case GeomAnnotation::InscribedSquare:
1922 if (m_geomInnerColor.
isValid()) {
1923 return AnnotationPrivate::distanceSqr(x, y, xScale, yScale);
1927 NormalizedPoint(m_transformedBoundary.right, m_transformedBoundary.top),
1928 NormalizedPoint(m_transformedBoundary.right, m_transformedBoundary.bottom),
1929 NormalizedPoint(m_transformedBoundary.left, m_transformedBoundary.bottom),
1930 NormalizedPoint(m_transformedBoundary.left, m_transformedBoundary.top)};
1931 distance = ::distanceSqr(x, y, xScale, yScale, edges);
1933 if (m_transformedBoundary.contains(x, y)) {
1940 distance = strokeDistance(distance, m_style.width() * xScale / m_page->m_width);
1948class HighlightAnnotation::Quad::Private
1960 bool m_capStart : 1;
1983 if (
this != &other) {
1992 if (index < 0 || index > 3) {
1996 d->m_points[index] = point;
2001 if (index < 0 || index > 3) {
2005 return d->m_points[index];
2010 if (index < 0 || index > 3) {
2014 return d->m_transformedPoints[index];
2019 d->m_capStart = value;
2024 return d->m_capStart;
2029 d->m_capEnd = value;
2039 d->m_feather = width;
2044 return d->m_feather;
2049 for (
int i = 0; i < 4; ++i) {
2050 d->m_transformedPoints[i] = d->m_points[i];
2051 d->m_transformedPoints[i].transform(matrix);
2055class Okular::HighlightAnnotationPrivate :
public Okular::AnnotationPrivate
2058 HighlightAnnotationPrivate()
2059 : AnnotationPrivate()
2060 , m_highlightType(HighlightAnnotation::
Highlight)
2064 void transform(
const QTransform &matrix)
override;
2065 void baseTransform(
const QTransform &matrix)
override;
2066 double distanceSqr(
double x,
double y,
double xScale,
double yScale)
const override;
2067 void setAnnotationProperties(
const QDomNode &node)
override;
2068 AnnotationPrivate *getNewAnnotationPrivate()
override;
2070 HighlightAnnotation::HighlightType m_highlightType;
2074HighlightAnnotation::HighlightAnnotation()
2075 :
Annotation(*new HighlightAnnotationPrivate())
2079HighlightAnnotation::HighlightAnnotation(
const QDomNode &description)
2080 :
Annotation(*new HighlightAnnotationPrivate(), description)
2084HighlightAnnotation::~HighlightAnnotation()
2088void HighlightAnnotation::setHighlightType(HighlightType type)
2090 Q_D(HighlightAnnotation);
2091 d->m_highlightType =
type;
2094HighlightAnnotation::HighlightType HighlightAnnotation::highlightType()
const
2096 Q_D(
const HighlightAnnotation);
2097 return d->m_highlightType;
2102 Q_D(HighlightAnnotation);
2103 return d->m_highlightQuads;
2108 Q_D(
const HighlightAnnotation);
2109 return d->m_highlightQuads;
2114 Q_D(
const HighlightAnnotation);
2124 hlElement.
setAttribute(QStringLiteral(
"type"), (
int)d->m_highlightType);
2126 if (d->m_highlightQuads.count() < 1) {
2131 for (; it !=
end; ++it) {
2134 const Quad &q = *it;
2158void HighlightAnnotationPrivate::transform(
const QTransform &matrix)
2160 AnnotationPrivate::transform(matrix);
2163 while (it.hasNext()) {
2164 it.next().transform(matrix);
2168void HighlightAnnotationPrivate::baseTransform(
const QTransform &matrix)
2170 AnnotationPrivate::baseTransform(matrix);
2173 while (it.hasNext()) {
2174 it.next().transform(matrix);
2178void HighlightAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2180 Okular::AnnotationPrivate::setAnnotationProperties(node);
2181 m_highlightQuads.clear();
2194 m_highlightType = (HighlightAnnotation::HighlightType)e.
attribute(QStringLiteral(
"type")).
toInt();
2216 m_highlightQuads.append(q);
2224AnnotationPrivate *HighlightAnnotationPrivate::getNewAnnotationPrivate()
2226 return new HighlightAnnotationPrivate();
2229double HighlightAnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
2232 double outsideDistance = DBL_MAX;
2238 pathPoints << quad.transformedPoint(0);
2239 int directionVote = 0;
2240 for (
int i = 1; i < 5; ++i) {
2242 directionVote += (isLeftOfVector(pathPoints.
back(), thisPoint, point)) ? 1 : -1;
2243 pathPoints << thisPoint;
2245 if (abs(directionVote) == 4) {
2251 const double thisOutsideDistance = ::distanceSqr(x, y, xScale, yScale, pathPoints);
2252 if (thisOutsideDistance < outsideDistance) {
2253 outsideDistance = thisOutsideDistance;
2257 return outsideDistance;
2262class Okular::StampAnnotationPrivate :
public Okular::AnnotationPrivate
2265 StampAnnotationPrivate()
2266 : AnnotationPrivate()
2267 , m_stampIconName(QStringLiteral(
"Draft"))
2270 void setAnnotationProperties(
const QDomNode &node)
override;
2271 bool canBeResized()
const override;
2272 AnnotationPrivate *getNewAnnotationPrivate()
override;
2277StampAnnotation::StampAnnotation()
2282StampAnnotation::StampAnnotation(
const QDomNode &description)
2283 :
Annotation(*new StampAnnotationPrivate(), description)
2287StampAnnotation::~StampAnnotation()
2291void StampAnnotation::setStampIconName(
const QString &name)
2293 Q_D(StampAnnotation);
2294 d->m_stampIconName =
name;
2297QString StampAnnotation::stampIconName()
const
2299 Q_D(
const StampAnnotation);
2300 return d->m_stampIconName;
2310 Q_D(
const StampAnnotation);
2320 stampElement.
setAttribute(QStringLiteral(
"icon"), d->m_stampIconName);
2324void StampAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2326 Okular::AnnotationPrivate::setAnnotationProperties(node);
2339 m_stampIconName = e.
attribute(QStringLiteral(
"icon"));
2347bool StampAnnotationPrivate::canBeResized()
const
2352AnnotationPrivate *StampAnnotationPrivate::getNewAnnotationPrivate()
2354 return new StampAnnotationPrivate();
2357#if HAVE_NEW_SIGNATURE_API
2360class Okular::SignatureAnnotationPrivate :
public Okular::AnnotationPrivate
2363 SignatureAnnotationPrivate()
2364 : AnnotationPrivate()
2368 void setAnnotationProperties(
const QDomNode &node)
override;
2369 bool canBeResized()
const override;
2370 AnnotationPrivate *getNewAnnotationPrivate()
override;
2380SignatureAnnotation::SignatureAnnotation()
2381 :
Annotation(*new SignatureAnnotationPrivate())
2385SignatureAnnotation::~SignatureAnnotation()
2394QString SignatureAnnotation::text()
const
2396 Q_D(
const SignatureAnnotation);
2400void SignatureAnnotation::setText(
const QString &text)
2402 Q_D(SignatureAnnotation);
2406QString SignatureAnnotation::leftText()
const
2408 Q_D(
const SignatureAnnotation);
2409 return d->m_leftText;
2412void SignatureAnnotation::setLeftText(
const QString &text)
2414 Q_D(SignatureAnnotation);
2415 d->m_leftText = text;
2418QString SignatureAnnotation::imagePath()
const
2420 Q_D(
const SignatureAnnotation);
2421 return d->m_imagePath;
2424void SignatureAnnotation::setImagePath(
const QString &imagePath)
2426 Q_D(SignatureAnnotation);
2427 d->m_imagePath = imagePath;
2430QString SignatureAnnotation::fieldPartialName()
const
2432 Q_D(
const SignatureAnnotation);
2433 return d->m_fieldPartialName;
2435void SignatureAnnotation::setFieldPartialName(
const QString &fieldPartialName)
2437 Q_D(SignatureAnnotation);
2438 d->m_fieldPartialName = fieldPartialName;
2443 Q_D(SignatureAnnotation);
2444 d->m_signFunction = func;
2449 Q_D(SignatureAnnotation);
2450 return d->m_signFunction(data, fileName);
2453int SignatureAnnotation::page()
const
2455 Q_D(
const SignatureAnnotation);
2459void SignatureAnnotation::setPage(
int page)
2461 Q_D(SignatureAnnotation);
2470void SignatureAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2472 Okular::AnnotationPrivate::setAnnotationProperties(node);
2477bool SignatureAnnotationPrivate::canBeResized()
const
2482AnnotationPrivate *SignatureAnnotationPrivate::getNewAnnotationPrivate()
2484 return new SignatureAnnotationPrivate();
2490class Okular::InkAnnotationPrivate :
public Okular::AnnotationPrivate
2493 InkAnnotationPrivate()
2494 : AnnotationPrivate()
2499 void baseTransform(
const QTransform &matrix)
override;
2500 void resetTransformation()
override;
2501 double distanceSqr(
double x,
double y,
double xScale,
double yScale)
const override;
2503 void setAnnotationProperties(
const QDomNode &node)
override;
2504 AnnotationPrivate *getNewAnnotationPrivate()
override;
2510InkAnnotation::InkAnnotation()
2515InkAnnotation::InkAnnotation(
const QDomNode &description)
2516 :
Annotation(*new InkAnnotationPrivate(), description)
2520InkAnnotation::~InkAnnotation()
2527 d->m_inkPaths = paths;
2532 Q_D(
const InkAnnotation);
2533 return d->m_inkPaths;
2538 Q_D(
const InkAnnotation);
2539 return d->m_transformedInkPaths;
2549 Q_D(
const InkAnnotation);
2558 if (d->m_inkPaths.count() < 1) {
2563 for (; pIt != pEnd; ++pIt) {
2576double InkAnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
2580 const double thisDistance = ::distanceSqr(x, y, xScale, yScale, path);
2581 if (thisDistance < distance) {
2585 return strokeDistance(distance, m_style.width() * xScale / (m_page->m_width * 2));
2588void InkAnnotationPrivate::transform(
const QTransform &matrix)
2590 AnnotationPrivate::transform(matrix);
2592 for (
int i = 0; i < m_transformedInkPaths.
count(); ++i) {
2594 while (it.hasNext()) {
2595 it.next().transform(matrix);
2600void InkAnnotationPrivate::baseTransform(
const QTransform &matrix)
2602 AnnotationPrivate::baseTransform(matrix);
2604 for (
int i = 0; i < m_inkPaths.count(); ++i) {
2606 while (it.hasNext()) {
2607 it.next().transform(matrix);
2612void InkAnnotationPrivate::resetTransformation()
2614 AnnotationPrivate::resetTransformation();
2616 m_transformedInkPaths = m_inkPaths;
2621 AnnotationPrivate::translate(coord);
2623 for (
int i = 0; i < m_inkPaths.count(); ++i) {
2625 while (it.hasNext()) {
2627 p.
x = p.
x + coord.
x;
2628 p.
y = p.
y + coord.
y;
2633void InkAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2635 Okular::AnnotationPrivate::setAnnotationProperties(node);
2676 m_inkPaths.append(path);
2684 m_transformedInkPaths = m_inkPaths;
2687AnnotationPrivate *InkAnnotationPrivate::getNewAnnotationPrivate()
2689 return new InkAnnotationPrivate();
2694class Okular::CaretAnnotationPrivate :
public Okular::AnnotationPrivate
2697 CaretAnnotationPrivate()
2698 : AnnotationPrivate()
2699 , m_symbol(CaretAnnotation::
None)
2703 void setAnnotationProperties(
const QDomNode &node)
override;
2704 AnnotationPrivate *getNewAnnotationPrivate()
override;
2706 CaretAnnotation::CaretSymbol m_symbol;
2709static QString caretSymbolToString(CaretAnnotation::CaretSymbol symbol)
2712 case CaretAnnotation::None:
2713 return QStringLiteral(
"None");
2714 case CaretAnnotation::P:
2715 return QStringLiteral(
"P");
2720static CaretAnnotation::CaretSymbol caretSymbolFromString(
const QString &symbol)
2723 return CaretAnnotation::None;
2725 return CaretAnnotation::P;
2727 return CaretAnnotation::None;
2730void CaretAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2732 Okular::AnnotationPrivate::setAnnotationProperties(node);
2745 m_symbol = caretSymbolFromString(e.
attribute(QStringLiteral(
"symbol")));
2753AnnotationPrivate *CaretAnnotationPrivate::getNewAnnotationPrivate()
2755 return new CaretAnnotationPrivate();
2758CaretAnnotation::CaretAnnotation()
2763CaretAnnotation::CaretAnnotation(
const QDomNode &description)
2764 :
Annotation(*new CaretAnnotationPrivate(), description)
2768CaretAnnotation::~CaretAnnotation()
2772void CaretAnnotation::setCaretSymbol(CaretAnnotation::CaretSymbol symbol)
2774 Q_D(CaretAnnotation);
2775 d->m_symbol = symbol;
2778CaretAnnotation::CaretSymbol CaretAnnotation::caretSymbol()
const
2780 Q_D(
const CaretAnnotation);
2791 Q_D(
const CaretAnnotation);
2800 if (d->m_symbol !=
None) {
2801 caretElement.
setAttribute(QStringLiteral(
"symbol"), caretSymbolToString(d->m_symbol));
2807class Okular::FileAttachmentAnnotationPrivate :
public Okular::AnnotationPrivate
2810 FileAttachmentAnnotationPrivate()
2811 : AnnotationPrivate()
2812 , icon(QStringLiteral(
"PushPin"))
2816 ~FileAttachmentAnnotationPrivate()
override
2821 void setAnnotationProperties(
const QDomNode &node)
override;
2822 AnnotationPrivate *getNewAnnotationPrivate()
override;
2829void FileAttachmentAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2831 Okular::AnnotationPrivate::setAnnotationProperties(node);
2847AnnotationPrivate *FileAttachmentAnnotationPrivate::getNewAnnotationPrivate()
2849 return new FileAttachmentAnnotationPrivate();
2852FileAttachmentAnnotation::FileAttachmentAnnotation()
2853 :
Annotation(*new FileAttachmentAnnotationPrivate())
2857FileAttachmentAnnotation::FileAttachmentAnnotation(
const QDomNode &description)
2858 :
Annotation(*new FileAttachmentAnnotationPrivate(), description)
2862FileAttachmentAnnotation::~FileAttachmentAnnotation()
2881QString FileAttachmentAnnotation::fileIconName()
const
2883 Q_D(
const FileAttachmentAnnotation);
2887void FileAttachmentAnnotation::setFileIconName(
const QString &iconName)
2889 Q_D(FileAttachmentAnnotation);
2893EmbeddedFile *FileAttachmentAnnotation::embeddedFile()
const
2895 Q_D(
const FileAttachmentAnnotation);
2899void FileAttachmentAnnotation::setEmbeddedFile(
EmbeddedFile *ef)
2901 Q_D(FileAttachmentAnnotation);
2907class Okular::SoundAnnotationPrivate :
public Okular::AnnotationPrivate
2910 SoundAnnotationPrivate()
2911 : AnnotationPrivate()
2912 , icon(QStringLiteral(
"Speaker"))
2916 ~SoundAnnotationPrivate()
override
2921 void setAnnotationProperties(
const QDomNode &node)
override;
2922 AnnotationPrivate *getNewAnnotationPrivate()
override;
2929void SoundAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2931 Okular::AnnotationPrivate::setAnnotationProperties(node);
2947AnnotationPrivate *SoundAnnotationPrivate::getNewAnnotationPrivate()
2949 return new SoundAnnotationPrivate();
2958 :
Annotation(*new SoundAnnotationPrivate(), description)
3007class Okular::MovieAnnotationPrivate :
public Okular::AnnotationPrivate
3010 MovieAnnotationPrivate()
3011 : AnnotationPrivate()
3015 ~MovieAnnotationPrivate()
override
3020 void setAnnotationProperties(
const QDomNode &node)
override;
3021 AnnotationPrivate *getNewAnnotationPrivate()
override;
3027void MovieAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
3029 Okular::AnnotationPrivate::setAnnotationProperties(node);
3045AnnotationPrivate *MovieAnnotationPrivate::getNewAnnotationPrivate()
3047 return new MovieAnnotationPrivate();
3056 :
Annotation(*new MovieAnnotationPrivate(), description)
3093class Okular::ScreenAnnotationPrivate :
public Okular::AnnotationPrivate
3096 ScreenAnnotationPrivate();
3097 ~ScreenAnnotationPrivate()
override;
3099 void setAnnotationProperties(
const QDomNode &node)
override;
3100 AnnotationPrivate *getNewAnnotationPrivate()
override;
3106ScreenAnnotationPrivate::ScreenAnnotationPrivate()
3111ScreenAnnotationPrivate::~ScreenAnnotationPrivate()
3114 qDeleteAll(m_additionalActions);
3117void ScreenAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
3119 Okular::AnnotationPrivate::setAnnotationProperties(node);
3135AnnotationPrivate *ScreenAnnotationPrivate::getNewAnnotationPrivate()
3137 return new ScreenAnnotationPrivate();
3146 :
Annotation(*new ScreenAnnotationPrivate(), description)
3172 if (d->m_additionalActions.contains(type)) {
3173 delete d->m_additionalActions.value(type);
3176 d->m_additionalActions.insert(type,
action);
3182 if (!d->m_additionalActions.contains(type)) {
3185 return d->m_additionalActions.value(type);
3205class Okular::WidgetAnnotationPrivate :
public Okular::AnnotationPrivate
3208 ~WidgetAnnotationPrivate()
override;
3209 void setAnnotationProperties(
const QDomNode &node)
override;
3210 AnnotationPrivate *getNewAnnotationPrivate()
override;
3215WidgetAnnotationPrivate::~WidgetAnnotationPrivate()
3217 qDeleteAll(m_additionalActions);
3220void WidgetAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
3222 Okular::AnnotationPrivate::setAnnotationProperties(node);
3238AnnotationPrivate *WidgetAnnotationPrivate::getNewAnnotationPrivate()
3240 return new WidgetAnnotationPrivate();
3249 :
Annotation(*new WidgetAnnotationPrivate, description)
3275 if (d->m_additionalActions.contains(type)) {
3276 delete d->m_additionalActions.value(type);
3279 d->m_additionalActions.insert(type, action);
3285 if (!d->m_additionalActions.contains(type)) {
3288 return d->m_additionalActions.value(type);
3294class Okular::RichMediaAnnotationPrivate :
public Okular::AnnotationPrivate
3297 RichMediaAnnotationPrivate();
3298 ~RichMediaAnnotationPrivate()
override;
3299 void setAnnotationProperties(
const QDomNode &node)
override;
3300 AnnotationPrivate *getNewAnnotationPrivate()
override;
3307RichMediaAnnotationPrivate::RichMediaAnnotationPrivate()
3309 , embeddedFile(nullptr)
3313RichMediaAnnotationPrivate::~RichMediaAnnotationPrivate()
3316 delete embeddedFile;
3319void RichMediaAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
3321 Okular::AnnotationPrivate::setAnnotationProperties(node);
3337AnnotationPrivate *RichMediaAnnotationPrivate::getNewAnnotationPrivate()
3339 return new RichMediaAnnotationPrivate();
3343 :
Annotation(*new RichMediaAnnotationPrivate())
3348 :
Annotation(*new RichMediaAnnotationPrivate, description)
3390 return d->embeddedFile;
3397 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.
void setNativeData(std::shared_ptr< void > data)
Sets some native internal data with shared ownership.
Window & window()
Returns a reference to the window object of the annotation.
QString contents() const
Returns the contents of the annotation.
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(*) DisposeDataFunction(const Okular::Annotation *)
A function to be called when the annotation is destroyed.
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.
const void * nativeData() const
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.
Data needed to create a new signature.
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 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)
qsizetype count() const const
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