MCPcopy Create free account
hub / github.com/KDE/okular / performRemovePageAnnotation

Method performRemovePageAnnotation

core/document.cpp:1083–1118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1081}
1082
1083void DocumentPrivate::performRemovePageAnnotation(int page, Annotation *annotation)
1084{
1085 Okular::SaveInterface *iface = qobject_cast<Okular::SaveInterface *>(m_generator);
1086 AnnotationProxy *proxy = iface ? iface->annotationProxy() : nullptr;
1087 bool isExternallyDrawn;
1088
1089 // find out the page
1090 Page *kp = m_pagesVector[page];
1091 if (!m_generator || !kp) {
1092 return;
1093 }
1094
1095 if (annotation->flags() & Annotation::ExternallyDrawn) {
1096 isExternallyDrawn = true;
1097 } else {
1098 isExternallyDrawn = false;
1099 }
1100
1101 // try to remove the annotation
1102 if (m_parent->canRemovePageAnnotation(annotation)) {
1103 // tell the annotation proxy
1104 if (proxy && proxy->supports(AnnotationProxy::Removal)) {
1105 proxy->notifyRemoval(annotation, page);
1106 }
1107
1108 kp->removeAnnotation(annotation); // Also destroys the object
1109
1110 // in case of success, notify observers about the change
1111 notifyAnnotationChanges(page);
1112
1113 if (isExternallyDrawn) {
1114 // Redraw everything, including ExternallyDrawn annotations
1115 refreshPixmaps(page);
1116 }
1117 }
1118}
1119
1120void DocumentPrivate::performModifyPageAnnotation(int page, Annotation *annotation, bool appearanceChanged)
1121{

Callers 2

undoMethod · 0.80
redoMethod · 0.80

Calls 6

annotationProxyMethod · 0.80
supportsMethod · 0.80
notifyRemovalMethod · 0.80
removeAnnotationMethod · 0.80
flagsMethod · 0.45

Tested by

no test coverage detected