diff --git a/generators/poppler/annots.cpp b/generators/poppler/annots.cpp index b4179c5fc2c039c752710c7ad180e309c8e8e38f..da7c279a6e500f368ebab3056d2e05b7e33e6c23 100644 --- a/generators/poppler/annots.cpp +++ b/generators/poppler/annots.cpp @@ -258,17 +258,17 @@ void PopplerAnnotationProxy::notifyRemoval(Okular::Annotation *okl_ann, int page } // END PopplerAnnotationProxy implementation -Okular::Annotation *createAnnotationFromPopplerAnnotation(Poppler::Annotation *ann, bool *doDelete) +Okular::Annotation *createAnnotationFromPopplerAnnotation(Poppler::Annotation *popplerAnnotation, bool *doDelete) { - Okular::Annotation *annotation = nullptr; + Okular::Annotation *okularAnnotation = nullptr; *doDelete = true; bool tieToOkularAnn = false; bool externallyDrawn = false; - switch (ann->subType()) { + switch (popplerAnnotation->subType()) { case Poppler::Annotation::AFileAttachment: { - Poppler::FileAttachmentAnnotation *attachann = static_cast(ann); + Poppler::FileAttachmentAnnotation *attachann = static_cast(popplerAnnotation); Okular::FileAttachmentAnnotation *f = new Okular::FileAttachmentAnnotation(); - annotation = f; + okularAnnotation = f; tieToOkularAnn = true; *doDelete = false; @@ -278,9 +278,9 @@ Okular::Annotation *createAnnotationFromPopplerAnnotation(Poppler::Annotation *a break; } case Poppler::Annotation::ASound: { - Poppler::SoundAnnotation *soundann = static_cast(ann); + Poppler::SoundAnnotation *soundann = static_cast(popplerAnnotation); Okular::SoundAnnotation *s = new Okular::SoundAnnotation(); - annotation = s; + okularAnnotation = s; s->setSoundIconName(soundann->soundIconName()); s->setSound(createSoundFromPopplerSound(soundann->sound())); @@ -288,9 +288,9 @@ Okular::Annotation *createAnnotationFromPopplerAnnotation(Poppler::Annotation *a break; } case Poppler::Annotation::AMovie: { - Poppler::MovieAnnotation *movieann = static_cast(ann); + Poppler::MovieAnnotation *movieann = static_cast(popplerAnnotation); Okular::MovieAnnotation *m = new Okular::MovieAnnotation(); - annotation = m; + okularAnnotation = m; tieToOkularAnn = true; *doDelete = false; @@ -299,25 +299,25 @@ Okular::Annotation *createAnnotationFromPopplerAnnotation(Poppler::Annotation *a break; } case Poppler::Annotation::AWidget: { - annotation = new Okular::WidgetAnnotation(); + okularAnnotation = new Okular::WidgetAnnotation(); break; } case Poppler::Annotation::AScreen: { Okular::ScreenAnnotation *m = new Okular::ScreenAnnotation(); - annotation = m; + okularAnnotation = m; tieToOkularAnn = true; *doDelete = false; break; } case Poppler::Annotation::ARichMedia: { - Poppler::RichMediaAnnotation *richmediaann = static_cast(ann); + Poppler::RichMediaAnnotation *richmediaann = static_cast(popplerAnnotation); const QPair result = createMovieFromPopplerRichMedia(richmediaann); if (result.first) { Okular::RichMediaAnnotation *r = new Okular::RichMediaAnnotation(); tieToOkularAnn = true; *doDelete = false; - annotation = r; + okularAnnotation = r; r->setMovie(result.first); r->setEmbeddedFile(result.second); @@ -342,30 +342,30 @@ Okular::Annotation *createAnnotationFromPopplerAnnotation(Poppler::Annotation *a QDomDocument doc; QDomElement root = doc.createElement(QStringLiteral("root")); doc.appendChild(root); - Poppler::AnnotationUtils::storeAnnotation(ann, root, doc); - annotation = Okular::AnnotationUtils::createAnnotation(root); + Poppler::AnnotationUtils::storeAnnotation(popplerAnnotation, root, doc); + okularAnnotation = Okular::AnnotationUtils::createAnnotation(root); break; } } - if (annotation) { + if (okularAnnotation) { // the Contents field might have lines separated by \r - QString contents = ann->contents(); + QString contents = popplerAnnotation->contents(); contents.replace(QLatin1Char('\r'), QLatin1Char('\n')); - annotation->setAuthor(ann->author()); - annotation->setContents(contents); - annotation->setUniqueName(ann->uniqueName()); - annotation->setModificationDate(ann->modificationDate()); - annotation->setCreationDate(ann->creationDate()); - annotation->setFlags(ann->flags() | Okular::Annotation::External); - annotation->setBoundingRectangle(Okular::NormalizedRect::fromQRectF(ann->boundary())); + okularAnnotation->setAuthor(popplerAnnotation->author()); + okularAnnotation->setContents(contents); + okularAnnotation->setUniqueName(popplerAnnotation->uniqueName()); + okularAnnotation->setModificationDate(popplerAnnotation->modificationDate()); + okularAnnotation->setCreationDate(popplerAnnotation->creationDate()); + okularAnnotation->setFlags(popplerAnnotation->flags() | Okular::Annotation::External); + okularAnnotation->setBoundingRectangle(Okular::NormalizedRect::fromQRectF(popplerAnnotation->boundary())); if (externallyDrawn) - annotation->setFlags(annotation->flags() | Okular::Annotation::ExternallyDrawn); + okularAnnotation->setFlags(okularAnnotation->flags() | Okular::Annotation::ExternallyDrawn); // Poppler stores highlight points in swapped order - if (annotation->subType() == Okular::Annotation::AHighlight) { - Okular::HighlightAnnotation *hlann = static_cast(annotation); + if (okularAnnotation->subType() == Okular::Annotation::AHighlight) { + Okular::HighlightAnnotation *hlann = static_cast(okularAnnotation); for (Okular::HighlightAnnotation::Quad &quad : hlann->highlightQuads()) { const Okular::NormalizedPoint p3 = quad.point(3); quad.setPoint(quad.point(0), 3); @@ -376,11 +376,11 @@ Okular::Annotation *createAnnotationFromPopplerAnnotation(Poppler::Annotation *a } } - if (annotation->subType() == Okular::Annotation::AText) { - Okular::TextAnnotation *txtann = static_cast(annotation); + if (okularAnnotation->subType() == Okular::Annotation::AText) { + Okular::TextAnnotation *txtann = static_cast(okularAnnotation); if (txtann->textType() == Okular::TextAnnotation::Linked) { - Poppler::TextAnnotation *ppl_txtann = static_cast(ann); + Poppler::TextAnnotation *ppl_txtann = static_cast(popplerAnnotation); // Poppler and Okular assume a different default icon name in XML // We re-read it via getter, which always tells the right one @@ -392,9 +392,9 @@ Okular::Annotation *createAnnotationFromPopplerAnnotation(Poppler::Annotation *a // TODO clone window // TODO clone revisions if (tieToOkularAnn) { - annotation->setNativeId(QVariant::fromValue(ann)); - annotation->setDisposeDataFunction(disposeAnnotation); + okularAnnotation->setNativeId(QVariant::fromValue(popplerAnnotation)); + okularAnnotation->setDisposeDataFunction(disposeAnnotation); } } - return annotation; + return okularAnnotation; } diff --git a/generators/poppler/annots.h b/generators/poppler/annots.h index 11166b271085b4b90277fa1d14d933696cccf759..6bd4bcebab60400efd4359f0785f22506d7fc63f 100644 --- a/generators/poppler/annots.h +++ b/generators/poppler/annots.h @@ -21,7 +21,7 @@ #include "config-okular-poppler.h" #include "core/annotations.h" -extern Okular::Annotation *createAnnotationFromPopplerAnnotation(Poppler::Annotation *ann, bool *doDelete); +extern Okular::Annotation *createAnnotationFromPopplerAnnotation(Poppler::Annotation *popplerAnnotation, bool *doDelete); class PopplerAnnotationProxy : public Okular::AnnotationProxy {