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)
62 if (thisDistance < distance) {
92static double strokeDistance(
double distance,
double penWidth)
94 return fmax(distance - pow(penWidth, 2), 0);
107 int typeNumber = annElement.
attribute(QStringLiteral(
"type")).
toInt();
108 switch (typeNumber) {
110 annotation =
new TextAnnotation(annElement);
113 annotation =
new LineAnnotation(annElement);
116 annotation =
new GeomAnnotation(annElement);
119 annotation =
new HighlightAnnotation(annElement);
122 annotation =
new StampAnnotation(annElement);
125 annotation =
new InkAnnotation(annElement);
128 annotation =
new CaretAnnotation(annElement);
142 ann->
store(annElement, document);
151 if (element.
tagName() == name) {
163 if (annotation->
subType() ==
Annotation::AText && (
static_cast<const TextAnnotation *
>(annotation)->textType() == TextAnnotation::Linked)) {
167 return rect24.
united(rect);
177 static std::unique_ptr<QSvgRenderer> svgStampFile;
178 if (!svgStampFile.get()) {
181 svgStampFile = std::make_unique<QSvgRenderer>(stampFile);
182 if (!svgStampFile->isValid()) {
183 svgStampFile.reset();
206 pixmap.
load(nameOrPath);
218AnnotationProxy::AnnotationProxy()
228class Annotation::Style::Private
240 , m_effectIntensity(1.0)
253 double m_effectIntensity;
274 if (
this != &other) {
293 d->m_opacity = opacity;
323 d->m_xCorners = xCorners;
328 return d->m_xCorners;
333 d->m_yCorners = yCorners;
338 return d->m_yCorners;
353 d->m_spaces = spaces;
363 d->m_effect = effect;
373 d->m_effectIntensity = intensity;
378 return d->m_effectIntensity;
381class Annotation::Window::Private
417 if (
this != &other) {
436 d->m_topLeft = point;
456 d->m_height = height;
476 d->m_summary = summary;
484class Annotation::Revision::Private
488 : m_annotation(nullptr)
495 RevisionScope m_scope;
517 if (
this != &other) {
526 d->m_annotation = annotation;
531 return d->m_annotation;
554AnnotationPrivate::AnnotationPrivate()
557 , m_disposeFunc(nullptr)
561AnnotationPrivate::~AnnotationPrivate()
564 if (m_revisions.isEmpty()) {
569 delete revision.annotation();
573AnnotationPrivate *AnnotationPrivate::get(
Annotation *a)
575 return a ? a->d_ptr :
nullptr;
578Annotation::Annotation(AnnotationPrivate &dd)
583Annotation::Annotation(AnnotationPrivate &dd,
const QDomNode &description)
586 d_ptr->setAnnotationProperties(description);
591 if (d_ptr->m_disposeFunc) {
592 d_ptr->m_disposeFunc(
this);
619 return d->m_contents;
625 d->m_uniqueName = name;
631 return d->m_uniqueName;
637 d->m_modifyDate = date;
643 return d->m_modifyDate;
649 d->m_creationDate = date;
655 return d->m_creationDate;
673 d->m_boundary = rectangle;
674 d->resetTransformation();
676 d->transform(d->m_page->rotationMatrix());
683 return d->m_boundary;
689 return d->m_transformedBoundary;
696 d->resetTransformation();
698 d->transform(d->m_page->rotationMatrix());
705 d->adjust(deltaCoord1, deltaCoord2);
706 d->resetTransformation();
708 d->transform(d->m_page->rotationMatrix());
715 return d->openDialogAfterCreation();
745 return d->m_revisions;
751 return d->m_revisions;
763 return d->m_nativeId;
769 d->m_disposeFunc = func;
775 d->m_nativeData = data;
781 return d->m_nativeData.get();
789 if (!d->m_page || !d->m_page->m_doc->m_parent->canModifyPageAnnotation(
this)) {
806 if (!d->m_page || !d->m_page->m_doc->m_parent->canModifyPageAnnotation(
this)) {
810 return d->canBeResized();
821 if (!d->m_author.isEmpty()) {
824 if (!d->m_contents.isEmpty()) {
825 e.
setAttribute(QStringLiteral(
"contents"), d->m_contents);
827 if (!d->m_uniqueName.isEmpty()) {
828 e.
setAttribute(QStringLiteral(
"uniqueName"), d->m_uniqueName);
830 if (d->m_modifyDate.isValid()) {
833 if (d->m_creationDate.isValid()) {
841 if (d->m_style.color().isValid()) {
844 if (d->m_style.opacity() != 1.0) {
857 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) {
861 psE.
setAttribute(QStringLiteral(
"style"), (
int)d->m_style.lineStyle());
864 psE.
setAttribute(QStringLiteral(
"marks"), d->m_style.marks());
865 psE.
setAttribute(QStringLiteral(
"spaces"), d->m_style.spaces());
869 if (d->m_style.lineEffect() !=
NoEffect || d->m_style.effectIntensity() != 1.0) {
872 peE.
setAttribute(QStringLiteral(
"effect"), (
int)d->m_style.lineEffect());
877 if (d->m_window.flags() != -1 || !d->m_window.title().isEmpty() || !d->m_window.summary().isEmpty()) {
880 wE.
setAttribute(QStringLiteral(
"flags"), d->m_window.flags());
883 wE.
setAttribute(QStringLiteral(
"width"), d->m_window.width());
884 wE.
setAttribute(QStringLiteral(
"height"), d->m_window.height());
885 wE.
setAttribute(QStringLiteral(
"title"), d->m_window.title());
886 wE.
setAttribute(QStringLiteral(
"summary"), d->m_window.summary());
890 if (d->m_revisions.isEmpty()) {
895 for (
const Revision &revision : std::as_const(d->m_revisions)) {
900 r.
setAttribute(QStringLiteral(
"revScope"), (
int)revision.scope());
901 r.
setAttribute(QStringLiteral(
"revType"), (
int)revision.type());
919 Okular::PagePrivate *p = d_ptr->m_page;
920 QVariant nativeID = d_ptr->m_nativeId;
925 AnnotationPrivate *new_d_ptr = d_ptr->getNewAnnotationPrivate();
930 d_ptr->setAnnotationProperties(node);
934 d_ptr->m_nativeId = nativeID;
935 d_ptr->m_flags = d_ptr->m_flags | internalFlags;
936 d_ptr->m_disposeFunc = disposeFunc;
939 d_ptr->transform(d_ptr->m_page->rotationMatrix());
942double AnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
944 return m_transformedBoundary.distanceSqr(x, y, xScale, yScale);
947void AnnotationPrivate::annotationTransform(
const QTransform &matrix)
949 resetTransformation();
953void AnnotationPrivate::transform(
const QTransform &matrix)
955 m_transformedBoundary.transform(matrix);
958void AnnotationPrivate::baseTransform(
const QTransform &matrix)
960 m_boundary.transform(matrix);
963void AnnotationPrivate::resetTransformation()
965 m_transformedBoundary = m_boundary;
970 m_boundary.left = m_boundary.left + coord.
x;
971 m_boundary.right = m_boundary.right + coord.
x;
972 m_boundary.top = m_boundary.top + coord.
y;
973 m_boundary.bottom = m_boundary.bottom + coord.
y;
978 m_boundary.left = m_boundary.left + qBound(-m_boundary.left, deltaCoord1.
x, m_boundary.right - m_boundary.left);
979 m_boundary.top = m_boundary.top + qBound(-m_boundary.top, deltaCoord1.
y, m_boundary.bottom - m_boundary.top);
981 m_boundary.right = m_boundary.right + qBound(m_boundary.left - m_boundary.right, deltaCoord2.
x, 1. - m_boundary.right);
982 m_boundary.bottom = m_boundary.bottom + qBound(m_boundary.top - m_boundary.bottom, deltaCoord2.
y, 1. - m_boundary.bottom);
985bool AnnotationPrivate::openDialogAfterCreation()
const
990void AnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
1000 m_author = e.
attribute(QStringLiteral(
"author"));
1003 m_contents = e.
attribute(QStringLiteral(
"contents"));
1006 m_uniqueName = e.
attribute(QStringLiteral(
"uniqueName"));
1023 m_style.setOpacity(e.
attribute(QStringLiteral(
"opacity")).toDouble());
1039 m_style.setWidth(ee.
attribute(QStringLiteral(
"width")).toDouble());
1041 m_style.setXCorners(ee.
attribute(QStringLiteral(
"xcr")).toDouble());
1042 m_style.setYCorners(ee.
attribute(QStringLiteral(
"ycr")).toDouble());
1043 m_style.setMarks(ee.
attribute(QStringLiteral(
"marks")).toInt());
1044 m_style.setSpaces(ee.
attribute(QStringLiteral(
"spaces")).toInt());
1049 m_style.setEffectIntensity(ee.
attribute(QStringLiteral(
"intensity")).toDouble());
1053 m_window.setFlags(ee.
attribute(QStringLiteral(
"flags")).toInt());
1055 m_window.setWidth(ee.
attribute(QStringLiteral(
"width")).toInt());
1056 m_window.setHeight(ee.
attribute(QStringLiteral(
"height")).toInt());
1057 m_window.setTitle(ee.
attribute(QStringLiteral(
"title")));
1058 m_window.setSummary(ee.
attribute(QStringLiteral(
"summary")));
1078 m_revisions.append(revision);
1082 m_transformedBoundary = m_boundary;
1085bool AnnotationPrivate::canBeResized()
const
1094class Okular::TextAnnotationPrivate :
public Okular::AnnotationPrivate
1097 TextAnnotationPrivate()
1098 : AnnotationPrivate()
1099 , m_textType(TextAnnotation::Linked)
1100 , m_textIcon(QStringLiteral(
"Comment"))
1102 , m_inplaceIntent(TextAnnotation::
Unknown)
1107 void baseTransform(
const QTransform &matrix)
override;
1108 void resetTransformation()
override;
1110 bool openDialogAfterCreation()
const override;
1111 void setAnnotationProperties(
const QDomNode &node)
override;
1112 bool canBeResized()
const override;
1113 AnnotationPrivate *getNewAnnotationPrivate()
override;
1115 TextAnnotation::TextType m_textType;
1122 TextAnnotation::InplaceIntent m_inplaceIntent;
1128TextAnnotation::TextAnnotation()
1133TextAnnotation::TextAnnotation(
const QDomNode &description)
1134 :
Annotation(*new TextAnnotationPrivate(), description)
1138TextAnnotation::~TextAnnotation()
1142void TextAnnotation::setTextType(TextType textType)
1144 Q_D(TextAnnotation);
1145 d->m_textType = textType;
1148TextAnnotation::TextType TextAnnotation::textType()
const
1150 Q_D(
const TextAnnotation);
1151 return d->m_textType;
1154void TextAnnotation::setTextIcon(
const QString &icon)
1156 Q_D(TextAnnotation);
1157 d->m_textIcon = icon;
1160QString TextAnnotation::textIcon()
const
1162 Q_D(
const TextAnnotation);
1163 return d->m_textIcon;
1166void TextAnnotation::setTextFont(
const QFont &font)
1168 Q_D(TextAnnotation);
1169 d->m_textFont = font;
1172QFont TextAnnotation::textFont()
const
1174 Q_D(
const TextAnnotation);
1175 return d->m_textFont;
1178void TextAnnotation::setTextColor(
const QColor &color)
1180 Q_D(TextAnnotation);
1181 d->m_textColor = color;
1184QColor TextAnnotation::textColor()
const
1186 Q_D(
const TextAnnotation);
1187 return d->m_textColor;
1190void TextAnnotation::setInplaceAlignment(
int alignment)
1192 Q_D(TextAnnotation);
1193 d->m_inplaceAlign = alignment;
1196int TextAnnotation::inplaceAlignment()
const
1198 Q_D(
const TextAnnotation);
1199 return d->m_inplaceAlign;
1202void TextAnnotation::setInplaceCallout(
const NormalizedPoint &point,
int index)
1204 if (index < 0 || index > 2) {
1208 Q_D(TextAnnotation);
1209 d->m_inplaceCallout[index] = point;
1214 if (index < 0 || index > 2) {
1218 Q_D(
const TextAnnotation);
1219 return d->m_inplaceCallout[index];
1222NormalizedPoint TextAnnotation::transformedInplaceCallout(
int index)
const
1224 if (index < 0 || index > 2) {
1228 Q_D(
const TextAnnotation);
1229 return d->m_transformedInplaceCallout[index];
1232void TextAnnotation::setInplaceIntent(InplaceIntent intent)
1234 Q_D(TextAnnotation);
1235 d->m_inplaceIntent = intent;
1238TextAnnotation::InplaceIntent TextAnnotation::inplaceIntent()
const
1240 Q_D(
const TextAnnotation);
1241 return d->m_inplaceIntent;
1251 Q_D(
const TextAnnotation);
1260 if (d->m_textType != Linked) {
1261 textElement.
setAttribute(QStringLiteral(
"type"), (
int)d->m_textType);
1263 if (!d->m_textIcon.isEmpty()) {
1264 textElement.
setAttribute(QStringLiteral(
"icon"), d->m_textIcon);
1267 textElement.
setAttribute(QStringLiteral(
"font"), d->m_textFont.toString());
1269 if (d->m_textColor.isValid()) {
1270 textElement.
setAttribute(QStringLiteral(
"fontColor"), d->m_textColor.name());
1272 if (d->m_inplaceAlign) {
1273 textElement.
setAttribute(QStringLiteral(
"align"), d->m_inplaceAlign);
1275 if (d->m_inplaceIntent != Unknown) {
1276 textElement.
setAttribute(QStringLiteral(
"intent"), (
int)d->m_inplaceIntent);
1280 if (d->m_inplaceCallout[0].x != 0.0) {
1292void TextAnnotationPrivate::transform(
const QTransform &matrix)
1294 AnnotationPrivate::transform(matrix);
1297 np.transform(matrix);
1301void TextAnnotationPrivate::baseTransform(
const QTransform &matrix)
1303 AnnotationPrivate::baseTransform(matrix);
1306 np.transform(matrix);
1310void TextAnnotationPrivate::resetTransformation()
1312 AnnotationPrivate::resetTransformation();
1314 for (
int i = 0; i < 3; ++i) {
1315 m_transformedInplaceCallout[i] = m_inplaceCallout[i];
1321 AnnotationPrivate::translate(coord);
1323#define ADD_COORD(c1, c2) \
1325 c1.x = c1.x + c2.x; \
1326 c1.y = c1.y + c2.y; \
1328 ADD_COORD(m_inplaceCallout[0], coord)
1329 ADD_COORD(m_inplaceCallout[1], coord)
1330 ADD_COORD(m_inplaceCallout[2], coord)
1334bool TextAnnotationPrivate::openDialogAfterCreation()
const
1336 return (m_textType == Okular::TextAnnotation::Linked) || (m_inplaceIntent == TextAnnotation::InplaceIntent::Unknown);
1339void TextAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
1341 Okular::AnnotationPrivate::setAnnotationProperties(node);
1354 m_textType = (TextAnnotation::TextType)e.
attribute(QStringLiteral(
"type")).
toInt();
1357 m_textIcon = e.
attribute(QStringLiteral(
"icon"));
1369 m_inplaceIntent = (TextAnnotation::InplaceIntent)e.
attribute(QStringLiteral(
"intent")).
toInt();
1394 for (
int i = 0; i < 3; ++i) {
1395 m_transformedInplaceCallout[i] = m_inplaceCallout[i];
1399bool TextAnnotationPrivate::canBeResized()
const
1401 if (m_textType != TextAnnotation::Linked) {
1407AnnotationPrivate *TextAnnotationPrivate::getNewAnnotationPrivate()
1409 return new TextAnnotationPrivate();
1414class Okular::LineAnnotationPrivate :
public Okular::AnnotationPrivate
1417 LineAnnotationPrivate()
1418 : AnnotationPrivate()
1419 , m_lineStartStyle(LineAnnotation::
None)
1420 , m_lineEndStyle(LineAnnotation::
None)
1421 , m_lineClosed(false)
1422 , m_lineShowCaption(false)
1423 , m_lineLeadingFwdPt(0)
1424 , m_lineLeadingBackPt(0)
1425 , m_lineIntent(LineAnnotation::
Unknown)
1430 void baseTransform(
const QTransform &matrix)
override;
1431 void resetTransformation()
override;
1433 double distanceSqr(
double x,
double y,
double xScale,
double yScale)
const override;
1434 void setAnnotationProperties(
const QDomNode &node)
override;
1435 AnnotationPrivate *getNewAnnotationPrivate()
override;
1439 LineAnnotation::TermStyle m_lineStartStyle;
1440 LineAnnotation::TermStyle m_lineEndStyle;
1441 bool m_lineClosed : 1;
1442 bool m_lineShowCaption : 1;
1444 double m_lineLeadingFwdPt;
1445 double m_lineLeadingBackPt;
1446 LineAnnotation::LineIntent m_lineIntent;
1449LineAnnotation::LineAnnotation()
1454LineAnnotation::LineAnnotation(
const QDomNode &description)
1455 :
Annotation(*new LineAnnotationPrivate(), description)
1459LineAnnotation::~LineAnnotation()
1465 Q_D(LineAnnotation);
1466 d->m_linePoints = points;
1471 Q_D(
const LineAnnotation);
1472 return d->m_linePoints;
1477 Q_D(
const LineAnnotation);
1478 return d->m_transformedLinePoints;
1481void LineAnnotation::setLineStartStyle(TermStyle style)
1483 Q_D(LineAnnotation);
1484 d->m_lineStartStyle =
style;
1487LineAnnotation::TermStyle LineAnnotation::lineStartStyle()
const
1489 Q_D(
const LineAnnotation);
1490 return d->m_lineStartStyle;
1493void LineAnnotation::setLineEndStyle(TermStyle style)
1495 Q_D(LineAnnotation);
1496 d->m_lineEndStyle =
style;
1499LineAnnotation::TermStyle LineAnnotation::lineEndStyle()
const
1501 Q_D(
const LineAnnotation);
1502 return d->m_lineEndStyle;
1505void LineAnnotation::setLineClosed(
bool closed)
1507 Q_D(LineAnnotation);
1508 d->m_lineClosed = closed;
1511bool LineAnnotation::lineClosed()
const
1513 Q_D(
const LineAnnotation);
1514 return d->m_lineClosed;
1517void LineAnnotation::setLineInnerColor(
const QColor &color)
1519 Q_D(LineAnnotation);
1520 d->m_lineInnerColor = color;
1523QColor LineAnnotation::lineInnerColor()
const
1525 Q_D(
const LineAnnotation);
1526 return d->m_lineInnerColor;
1529void LineAnnotation::setLineLeadingForwardPoint(
double point)
1531 Q_D(LineAnnotation);
1532 d->m_lineLeadingFwdPt = point;
1535double LineAnnotation::lineLeadingForwardPoint()
const
1537 Q_D(
const LineAnnotation);
1538 return d->m_lineLeadingFwdPt;
1541void LineAnnotation::setLineLeadingBackwardPoint(
double point)
1543 Q_D(LineAnnotation);
1544 d->m_lineLeadingBackPt = point;
1547double LineAnnotation::lineLeadingBackwardPoint()
const
1549 Q_D(
const LineAnnotation);
1550 return d->m_lineLeadingBackPt;
1553void LineAnnotation::setShowCaption(
bool show)
1555 Q_D(LineAnnotation);
1556 d->m_lineShowCaption = show;
1559bool LineAnnotation::showCaption()
const
1561 Q_D(
const LineAnnotation);
1562 return d->m_lineShowCaption;
1565void LineAnnotation::setLineIntent(LineIntent intent)
1567 Q_D(LineAnnotation);
1568 d->m_lineIntent = intent;
1571LineAnnotation::LineIntent LineAnnotation::lineIntent()
const
1573 Q_D(
const LineAnnotation);
1574 return d->m_lineIntent;
1584 Q_D(
const LineAnnotation);
1593 if (d->m_lineStartStyle != None) {
1594 lineElement.
setAttribute(QStringLiteral(
"startStyle"), (
int)d->m_lineStartStyle);
1596 if (d->m_lineEndStyle != None) {
1597 lineElement.
setAttribute(QStringLiteral(
"endStyle"), (
int)d->m_lineEndStyle);
1599 if (d->m_lineClosed) {
1600 lineElement.
setAttribute(QStringLiteral(
"closed"), d->m_lineClosed);
1602 if (d->m_lineInnerColor.isValid()) {
1603 lineElement.
setAttribute(QStringLiteral(
"innerColor"), d->m_lineInnerColor.name());
1605 if (d->m_lineLeadingFwdPt != 0.0) {
1608 if (d->m_lineLeadingBackPt != 0.0) {
1611 if (d->m_lineShowCaption) {
1612 lineElement.
setAttribute(QStringLiteral(
"showCaption"), d->m_lineShowCaption);
1614 if (d->m_lineIntent != Unknown) {
1615 lineElement.
setAttribute(QStringLiteral(
"intent"), d->m_lineIntent);
1619 int points = d->m_linePoints.count();
1633void LineAnnotationPrivate::transform(
const QTransform &matrix)
1635 AnnotationPrivate::transform(matrix);
1638 while (it.hasNext()) {
1639 it.next().transform(matrix);
1643void LineAnnotationPrivate::baseTransform(
const QTransform &matrix)
1645 AnnotationPrivate::baseTransform(matrix);
1648 while (it.hasNext()) {
1649 it.next().transform(matrix);
1653void LineAnnotationPrivate::resetTransformation()
1655 AnnotationPrivate::resetTransformation();
1657 m_transformedLinePoints = m_linePoints;
1662 AnnotationPrivate::translate(coord);
1665 while (it.hasNext()) {
1667 p.
x = p.
x + coord.
x;
1668 p.
y = p.
y + coord.
y;
1672void LineAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
1674 Okular::AnnotationPrivate::setAnnotationProperties(node);
1687 m_lineStartStyle = (LineAnnotation::TermStyle)e.
attribute(QStringLiteral(
"startStyle")).
toInt();
1690 m_lineEndStyle = (LineAnnotation::TermStyle)e.
attribute(QStringLiteral(
"endStyle")).
toInt();
1705 m_lineShowCaption = e.
attribute(QStringLiteral(
"showCaption")).
toInt();
1708 m_lineIntent = (LineAnnotation::LineIntent)e.
attribute(QStringLiteral(
"intent")).
toInt();
1724 m_linePoints.append(p);
1731 m_transformedLinePoints = m_linePoints;
1734AnnotationPrivate *LineAnnotationPrivate::getNewAnnotationPrivate()
1736 return new LineAnnotationPrivate();
1739double LineAnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
1744 transformedLinePoints.
append(transformedLinePoints.
first());
1747 if (m_lineInnerColor.
isValid()) {
1749 for (
const NormalizedPoint &p : std::as_const(transformedLinePoints)) {
1758 return strokeDistance(::distanceSqr(x, y, xScale, yScale, transformedLinePoints), m_style.width() * xScale / (m_page->m_width * 2));
1763class Okular::GeomAnnotationPrivate :
public Okular::AnnotationPrivate
1766 GeomAnnotationPrivate()
1767 : AnnotationPrivate()
1768 , m_geomType(GeomAnnotation::InscribedSquare)
1771 void setAnnotationProperties(
const QDomNode &node)
override;
1772 bool canBeResized()
const override;
1773 AnnotationPrivate *getNewAnnotationPrivate()
override;
1774 double distanceSqr(
double x,
double y,
double xScale,
double yScale)
const override;
1776 GeomAnnotation::GeomType m_geomType;
1780GeomAnnotation::GeomAnnotation()
1785GeomAnnotation::GeomAnnotation(
const QDomNode &description)
1786 :
Annotation(*new GeomAnnotationPrivate(), description)
1790GeomAnnotation::~GeomAnnotation()
1794void GeomAnnotation::setGeometricalType(GeomType type)
1796 Q_D(GeomAnnotation);
1797 d->m_geomType =
type;
1800GeomAnnotation::GeomType GeomAnnotation::geometricalType()
const
1802 Q_D(
const GeomAnnotation);
1803 return d->m_geomType;
1806void GeomAnnotation::setGeometricalInnerColor(
const QColor &color)
1808 Q_D(GeomAnnotation);
1809 d->m_geomInnerColor = color;
1812QColor GeomAnnotation::geometricalInnerColor()
const
1814 Q_D(
const GeomAnnotation);
1815 return d->m_geomInnerColor;
1825 Q_D(
const GeomAnnotation);
1834 if (d->m_geomType != InscribedSquare) {
1835 geomElement.
setAttribute(QStringLiteral(
"type"), (
int)d->m_geomType);
1837 if (d->m_geomInnerColor.isValid()) {
1838 geomElement.
setAttribute(QStringLiteral(
"color"), d->m_geomInnerColor.name());
1842void GeomAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
1844 Okular::AnnotationPrivate::setAnnotationProperties(node);
1856 m_geomType = (GeomAnnotation::GeomType)e.
attribute(QStringLiteral(
"type")).
toInt();
1863 m_style.setWidth(e.
attribute(QStringLiteral(
"width")).toInt());
1871bool GeomAnnotationPrivate::canBeResized()
const
1876AnnotationPrivate *GeomAnnotationPrivate::getNewAnnotationPrivate()
1878 return new GeomAnnotationPrivate();
1881double GeomAnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
1885 bool withinShape =
false;
1886 switch (m_geomType) {
1887 case GeomAnnotation::InscribedCircle: {
1889 const double centerX = (m_transformedBoundary.left + m_transformedBoundary.right) / 2.0;
1890 const double centerY = (m_transformedBoundary.top + m_transformedBoundary.bottom) / 2.0;
1891 const double focusX = (m_transformedBoundary.right - centerX);
1892 const double focusY = (m_transformedBoundary.bottom - centerY);
1894 const double focusXSqr = pow(focusX, 2);
1895 const double focusYSqr = pow(focusY, 2);
1904 const double lambda = sqrt(focusXSqr * focusYSqr / (focusYSqr * pow(x - centerX, 2) + focusXSqr * pow(y - centerY, 2)));
1908 if (m_geomInnerColor.
isValid()) {
1917 projection.x += lambda * (x - centerX);
1918 projection.y += lambda * (y - centerY);
1920 distance = projection.distanceSqr(x, y, xScale, yScale);
1924 case GeomAnnotation::InscribedSquare:
1926 if (m_geomInnerColor.
isValid()) {
1927 return AnnotationPrivate::distanceSqr(x, y, xScale, yScale);
1931 NormalizedPoint(m_transformedBoundary.right, m_transformedBoundary.top),
1932 NormalizedPoint(m_transformedBoundary.right, m_transformedBoundary.bottom),
1933 NormalizedPoint(m_transformedBoundary.left, m_transformedBoundary.bottom),
1934 NormalizedPoint(m_transformedBoundary.left, m_transformedBoundary.top)};
1935 distance = ::distanceSqr(x, y, xScale, yScale, edges);
1937 if (m_transformedBoundary.contains(x, y)) {
1944 distance = strokeDistance(distance, m_style.width() * xScale / m_page->m_width);
1952class HighlightAnnotation::Quad::Private
1964 bool m_capStart : 1;
1987 if (
this != &other) {
1996 if (index < 0 || index > 3) {
2000 d->m_points[index] = point;
2005 if (index < 0 || index > 3) {
2009 return d->m_points[index];
2014 if (index < 0 || index > 3) {
2018 return d->m_transformedPoints[index];
2023 d->m_capStart = value;
2028 return d->m_capStart;
2033 d->m_capEnd = value;
2043 d->m_feather = width;
2048 return d->m_feather;
2053 for (
int i = 0; i < 4; ++i) {
2054 d->m_transformedPoints[i] = d->m_points[i];
2055 d->m_transformedPoints[i].transform(matrix);
2059class Okular::HighlightAnnotationPrivate :
public Okular::AnnotationPrivate
2062 HighlightAnnotationPrivate()
2063 : AnnotationPrivate()
2064 , m_highlightType(HighlightAnnotation::
Highlight)
2068 void transform(
const QTransform &matrix)
override;
2069 void baseTransform(
const QTransform &matrix)
override;
2070 double distanceSqr(
double x,
double y,
double xScale,
double yScale)
const override;
2071 void setAnnotationProperties(
const QDomNode &node)
override;
2072 AnnotationPrivate *getNewAnnotationPrivate()
override;
2074 HighlightAnnotation::HighlightType m_highlightType;
2078HighlightAnnotation::HighlightAnnotation()
2079 :
Annotation(*new HighlightAnnotationPrivate())
2083HighlightAnnotation::HighlightAnnotation(
const QDomNode &description)
2084 :
Annotation(*new HighlightAnnotationPrivate(), description)
2088HighlightAnnotation::~HighlightAnnotation()
2092void HighlightAnnotation::setHighlightType(HighlightType type)
2094 Q_D(HighlightAnnotation);
2095 d->m_highlightType =
type;
2098HighlightAnnotation::HighlightType HighlightAnnotation::highlightType()
const
2100 Q_D(
const HighlightAnnotation);
2101 return d->m_highlightType;
2106 Q_D(HighlightAnnotation);
2107 return d->m_highlightQuads;
2112 Q_D(
const HighlightAnnotation);
2113 return d->m_highlightQuads;
2118 Q_D(
const HighlightAnnotation);
2128 hlElement.
setAttribute(QStringLiteral(
"type"), (
int)d->m_highlightType);
2130 if (d->m_highlightQuads.count() < 1) {
2135 for (; it !=
end; ++it) {
2138 const Quad &q = *it;
2162void HighlightAnnotationPrivate::transform(
const QTransform &matrix)
2164 AnnotationPrivate::transform(matrix);
2167 while (it.hasNext()) {
2168 it.next().transform(matrix);
2172void HighlightAnnotationPrivate::baseTransform(
const QTransform &matrix)
2174 AnnotationPrivate::baseTransform(matrix);
2177 while (it.hasNext()) {
2178 it.next().transform(matrix);
2182void HighlightAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2184 Okular::AnnotationPrivate::setAnnotationProperties(node);
2185 m_highlightQuads.clear();
2198 m_highlightType = (HighlightAnnotation::HighlightType)e.
attribute(QStringLiteral(
"type")).
toInt();
2220 m_highlightQuads.append(q);
2228AnnotationPrivate *HighlightAnnotationPrivate::getNewAnnotationPrivate()
2230 return new HighlightAnnotationPrivate();
2233double HighlightAnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
2236 double outsideDistance = DBL_MAX;
2242 pathPoints << quad.transformedPoint(0);
2243 int directionVote = 0;
2244 for (
int i = 1; i < 5; ++i) {
2246 directionVote += (isLeftOfVector(pathPoints.
back(), thisPoint, point)) ? 1 : -1;
2247 pathPoints << thisPoint;
2249 if (abs(directionVote) == 4) {
2255 const double thisOutsideDistance = ::distanceSqr(x, y, xScale, yScale, pathPoints);
2256 if (thisOutsideDistance < outsideDistance) {
2257 outsideDistance = thisOutsideDistance;
2261 return outsideDistance;
2266class Okular::StampAnnotationPrivate :
public Okular::AnnotationPrivate
2269 StampAnnotationPrivate()
2270 : AnnotationPrivate()
2271 , m_stampIconName(QStringLiteral(
"Draft"))
2274 void setAnnotationProperties(
const QDomNode &node)
override;
2275 bool canBeResized()
const override;
2276 AnnotationPrivate *getNewAnnotationPrivate()
override;
2281StampAnnotation::StampAnnotation()
2286StampAnnotation::StampAnnotation(
const QDomNode &description)
2287 :
Annotation(*new StampAnnotationPrivate(), description)
2291StampAnnotation::~StampAnnotation()
2295void StampAnnotation::setStampIconName(
const QString &name)
2297 Q_D(StampAnnotation);
2298 d->m_stampIconName =
name;
2301QString StampAnnotation::stampIconName()
const
2303 Q_D(
const StampAnnotation);
2304 return d->m_stampIconName;
2314 Q_D(
const StampAnnotation);
2324 stampElement.
setAttribute(QStringLiteral(
"icon"), d->m_stampIconName);
2328void StampAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2330 Okular::AnnotationPrivate::setAnnotationProperties(node);
2343 m_stampIconName = e.
attribute(QStringLiteral(
"icon"));
2351bool StampAnnotationPrivate::canBeResized()
const
2356AnnotationPrivate *StampAnnotationPrivate::getNewAnnotationPrivate()
2358 return new StampAnnotationPrivate();
2361#if HAVE_NEW_SIGNATURE_API
2364class Okular::SignatureAnnotationPrivate :
public Okular::AnnotationPrivate
2367 SignatureAnnotationPrivate()
2368 : AnnotationPrivate()
2372 void setAnnotationProperties(
const QDomNode &node)
override;
2373 bool canBeResized()
const override;
2374 AnnotationPrivate *getNewAnnotationPrivate()
override;
2384SignatureAnnotation::SignatureAnnotation()
2385 :
Annotation(*new SignatureAnnotationPrivate())
2389SignatureAnnotation::~SignatureAnnotation()
2398QString SignatureAnnotation::text()
const
2400 Q_D(
const SignatureAnnotation);
2404void SignatureAnnotation::setText(
const QString &text)
2406 Q_D(SignatureAnnotation);
2410QString SignatureAnnotation::leftText()
const
2412 Q_D(
const SignatureAnnotation);
2413 return d->m_leftText;
2416void SignatureAnnotation::setLeftText(
const QString &text)
2418 Q_D(SignatureAnnotation);
2419 d->m_leftText = text;
2422QString SignatureAnnotation::imagePath()
const
2424 Q_D(
const SignatureAnnotation);
2425 return d->m_imagePath;
2428void SignatureAnnotation::setImagePath(
const QString &imagePath)
2430 Q_D(SignatureAnnotation);
2431 d->m_imagePath = imagePath;
2434QString SignatureAnnotation::fieldPartialName()
const
2436 Q_D(
const SignatureAnnotation);
2437 return d->m_fieldPartialName;
2439void SignatureAnnotation::setFieldPartialName(
const QString &fieldPartialName)
2441 Q_D(SignatureAnnotation);
2442 d->m_fieldPartialName = fieldPartialName;
2447 Q_D(SignatureAnnotation);
2448 d->m_signFunction = func;
2453 Q_D(SignatureAnnotation);
2454 return d->m_signFunction(data, fileName);
2457int SignatureAnnotation::page()
const
2459 Q_D(
const SignatureAnnotation);
2463void SignatureAnnotation::setPage(
int page)
2465 Q_D(SignatureAnnotation);
2474void SignatureAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2476 Okular::AnnotationPrivate::setAnnotationProperties(node);
2481bool SignatureAnnotationPrivate::canBeResized()
const
2486AnnotationPrivate *SignatureAnnotationPrivate::getNewAnnotationPrivate()
2488 return new SignatureAnnotationPrivate();
2494class Okular::InkAnnotationPrivate :
public Okular::AnnotationPrivate
2497 InkAnnotationPrivate()
2498 : AnnotationPrivate()
2503 void baseTransform(
const QTransform &matrix)
override;
2504 void resetTransformation()
override;
2505 double distanceSqr(
double x,
double y,
double xScale,
double yScale)
const override;
2507 void setAnnotationProperties(
const QDomNode &node)
override;
2508 AnnotationPrivate *getNewAnnotationPrivate()
override;
2514InkAnnotation::InkAnnotation()
2519InkAnnotation::InkAnnotation(
const QDomNode &description)
2520 :
Annotation(*new InkAnnotationPrivate(), description)
2524InkAnnotation::~InkAnnotation()
2531 d->m_inkPaths = paths;
2536 Q_D(
const InkAnnotation);
2537 return d->m_inkPaths;
2542 Q_D(
const InkAnnotation);
2543 return d->m_transformedInkPaths;
2553 Q_D(
const InkAnnotation);
2562 if (d->m_inkPaths.count() < 1) {
2567 for (; pIt != pEnd; ++pIt) {
2580double InkAnnotationPrivate::distanceSqr(
double x,
double y,
double xScale,
double yScale)
const
2584 const double thisDistance = ::distanceSqr(x, y, xScale, yScale, path);
2585 if (thisDistance < distance) {
2589 return strokeDistance(distance, m_style.width() * xScale / (m_page->m_width * 2));
2592void InkAnnotationPrivate::transform(
const QTransform &matrix)
2594 AnnotationPrivate::transform(matrix);
2596 for (
int i = 0; i < m_transformedInkPaths.
count(); ++i) {
2598 while (it.hasNext()) {
2599 it.next().transform(matrix);
2604void InkAnnotationPrivate::baseTransform(
const QTransform &matrix)
2606 AnnotationPrivate::baseTransform(matrix);
2608 for (
int i = 0; i < m_inkPaths.count(); ++i) {
2610 while (it.hasNext()) {
2611 it.next().transform(matrix);
2616void InkAnnotationPrivate::resetTransformation()
2618 AnnotationPrivate::resetTransformation();
2620 m_transformedInkPaths = m_inkPaths;
2625 AnnotationPrivate::translate(coord);
2627 for (
int i = 0; i < m_inkPaths.count(); ++i) {
2629 while (it.hasNext()) {
2631 p.
x = p.
x + coord.
x;
2632 p.
y = p.
y + coord.
y;
2637void InkAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2639 Okular::AnnotationPrivate::setAnnotationProperties(node);
2680 m_inkPaths.append(path);
2688 m_transformedInkPaths = m_inkPaths;
2691AnnotationPrivate *InkAnnotationPrivate::getNewAnnotationPrivate()
2693 return new InkAnnotationPrivate();
2698class Okular::CaretAnnotationPrivate :
public Okular::AnnotationPrivate
2701 CaretAnnotationPrivate()
2702 : AnnotationPrivate()
2703 , m_symbol(CaretAnnotation::
None)
2707 void setAnnotationProperties(
const QDomNode &node)
override;
2708 AnnotationPrivate *getNewAnnotationPrivate()
override;
2710 CaretAnnotation::CaretSymbol m_symbol;
2713static QString caretSymbolToString(CaretAnnotation::CaretSymbol symbol)
2716 case CaretAnnotation::None:
2717 return QStringLiteral(
"None");
2718 case CaretAnnotation::P:
2719 return QStringLiteral(
"P");
2724static CaretAnnotation::CaretSymbol caretSymbolFromString(
const QString &symbol)
2727 return CaretAnnotation::None;
2729 return CaretAnnotation::P;
2731 return CaretAnnotation::None;
2734void CaretAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2736 Okular::AnnotationPrivate::setAnnotationProperties(node);
2749 m_symbol = caretSymbolFromString(e.
attribute(QStringLiteral(
"symbol")));
2757AnnotationPrivate *CaretAnnotationPrivate::getNewAnnotationPrivate()
2759 return new CaretAnnotationPrivate();
2762CaretAnnotation::CaretAnnotation()
2767CaretAnnotation::CaretAnnotation(
const QDomNode &description)
2768 :
Annotation(*new CaretAnnotationPrivate(), description)
2772CaretAnnotation::~CaretAnnotation()
2776void CaretAnnotation::setCaretSymbol(CaretAnnotation::CaretSymbol symbol)
2778 Q_D(CaretAnnotation);
2779 d->m_symbol = symbol;
2782CaretAnnotation::CaretSymbol CaretAnnotation::caretSymbol()
const
2784 Q_D(
const CaretAnnotation);
2795 Q_D(
const CaretAnnotation);
2804 if (d->m_symbol !=
None) {
2805 caretElement.
setAttribute(QStringLiteral(
"symbol"), caretSymbolToString(d->m_symbol));
2811class Okular::FileAttachmentAnnotationPrivate :
public Okular::AnnotationPrivate
2814 FileAttachmentAnnotationPrivate()
2815 : AnnotationPrivate()
2816 , icon(QStringLiteral(
"PushPin"))
2820 ~FileAttachmentAnnotationPrivate()
override
2825 void setAnnotationProperties(
const QDomNode &node)
override;
2826 AnnotationPrivate *getNewAnnotationPrivate()
override;
2833void FileAttachmentAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2835 Okular::AnnotationPrivate::setAnnotationProperties(node);
2851AnnotationPrivate *FileAttachmentAnnotationPrivate::getNewAnnotationPrivate()
2853 return new FileAttachmentAnnotationPrivate();
2856FileAttachmentAnnotation::FileAttachmentAnnotation()
2857 :
Annotation(*new FileAttachmentAnnotationPrivate())
2861FileAttachmentAnnotation::FileAttachmentAnnotation(
const QDomNode &description)
2862 :
Annotation(*new FileAttachmentAnnotationPrivate(), description)
2866FileAttachmentAnnotation::~FileAttachmentAnnotation()
2885QString FileAttachmentAnnotation::fileIconName()
const
2887 Q_D(
const FileAttachmentAnnotation);
2891void FileAttachmentAnnotation::setFileIconName(
const QString &iconName)
2893 Q_D(FileAttachmentAnnotation);
2897EmbeddedFile *FileAttachmentAnnotation::embeddedFile()
const
2899 Q_D(
const FileAttachmentAnnotation);
2903void FileAttachmentAnnotation::setEmbeddedFile(
EmbeddedFile *ef)
2905 Q_D(FileAttachmentAnnotation);
2911class Okular::SoundAnnotationPrivate :
public Okular::AnnotationPrivate
2914 SoundAnnotationPrivate()
2915 : AnnotationPrivate()
2916 , icon(QStringLiteral(
"Speaker"))
2920 ~SoundAnnotationPrivate()
override
2925 void setAnnotationProperties(
const QDomNode &node)
override;
2926 AnnotationPrivate *getNewAnnotationPrivate()
override;
2933void SoundAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
2935 Okular::AnnotationPrivate::setAnnotationProperties(node);
2951AnnotationPrivate *SoundAnnotationPrivate::getNewAnnotationPrivate()
2953 return new SoundAnnotationPrivate();
2962 :
Annotation(*new SoundAnnotationPrivate(), description)
3011class Okular::MovieAnnotationPrivate :
public Okular::AnnotationPrivate
3014 MovieAnnotationPrivate()
3015 : AnnotationPrivate()
3019 ~MovieAnnotationPrivate()
override
3024 void setAnnotationProperties(
const QDomNode &node)
override;
3025 AnnotationPrivate *getNewAnnotationPrivate()
override;
3031void MovieAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
3033 Okular::AnnotationPrivate::setAnnotationProperties(node);
3049AnnotationPrivate *MovieAnnotationPrivate::getNewAnnotationPrivate()
3051 return new MovieAnnotationPrivate();
3060 :
Annotation(*new MovieAnnotationPrivate(), description)
3097class Okular::ScreenAnnotationPrivate :
public Okular::AnnotationPrivate
3100 ScreenAnnotationPrivate();
3101 ~ScreenAnnotationPrivate()
override;
3103 void setAnnotationProperties(
const QDomNode &node)
override;
3104 AnnotationPrivate *getNewAnnotationPrivate()
override;
3110ScreenAnnotationPrivate::ScreenAnnotationPrivate()
3115ScreenAnnotationPrivate::~ScreenAnnotationPrivate()
3118 qDeleteAll(m_additionalActions);
3121void ScreenAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
3123 Okular::AnnotationPrivate::setAnnotationProperties(node);
3139AnnotationPrivate *ScreenAnnotationPrivate::getNewAnnotationPrivate()
3141 return new ScreenAnnotationPrivate();
3150 :
Annotation(*new ScreenAnnotationPrivate(), description)
3176 if (d->m_additionalActions.contains(type)) {
3177 delete d->m_additionalActions.value(type);
3180 d->m_additionalActions.insert(type,
action);
3186 if (!d->m_additionalActions.contains(type)) {
3189 return d->m_additionalActions.value(type);
3209class Okular::WidgetAnnotationPrivate :
public Okular::AnnotationPrivate
3212 ~WidgetAnnotationPrivate()
override;
3213 void setAnnotationProperties(
const QDomNode &node)
override;
3214 AnnotationPrivate *getNewAnnotationPrivate()
override;
3219WidgetAnnotationPrivate::~WidgetAnnotationPrivate()
3221 qDeleteAll(m_additionalActions);
3224void WidgetAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
3226 Okular::AnnotationPrivate::setAnnotationProperties(node);
3242AnnotationPrivate *WidgetAnnotationPrivate::getNewAnnotationPrivate()
3244 return new WidgetAnnotationPrivate();
3253 :
Annotation(*new WidgetAnnotationPrivate, description)
3279 if (d->m_additionalActions.contains(type)) {
3280 delete d->m_additionalActions.value(type);
3283 d->m_additionalActions.insert(type, action);
3289 if (!d->m_additionalActions.contains(type)) {
3292 return d->m_additionalActions.value(type);
3298class Okular::RichMediaAnnotationPrivate :
public Okular::AnnotationPrivate
3301 RichMediaAnnotationPrivate();
3302 ~RichMediaAnnotationPrivate()
override;
3303 void setAnnotationProperties(
const QDomNode &node)
override;
3304 AnnotationPrivate *getNewAnnotationPrivate()
override;
3311RichMediaAnnotationPrivate::RichMediaAnnotationPrivate()
3313 , embeddedFile(nullptr)
3317RichMediaAnnotationPrivate::~RichMediaAnnotationPrivate()
3320 delete embeddedFile;
3323void RichMediaAnnotationPrivate::setAnnotationProperties(
const QDomNode &node)
3325 Okular::AnnotationPrivate::setAnnotationProperties(node);
3341AnnotationPrivate *RichMediaAnnotationPrivate::getNewAnnotationPrivate()
3343 return new RichMediaAnnotationPrivate();
3347 :
Annotation(*new RichMediaAnnotationPrivate())
3352 :
Annotation(*new RichMediaAnnotationPrivate, description)
3394 return d->embeddedFile;
3401 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.
Type type(const QSqlDatabase &db)
QString path(const QString &relativePath)
QString name(StandardAction id)
const QList< QKeySequence > & end()
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