include/svx/annotation/Annotation.hxx           |   15 +++++++++++++++
 include/svx/annotation/AnnotationObject.hxx     |    2 ++
 include/svx/annotation/ObjectAnnotationData.hxx |    8 +++++++-
 include/svx/svdpage.hxx                         |    1 +
 sd/source/core/annotations/Annotation.cxx       |    9 +++++++--
 svx/source/annotation/Annotation.cxx            |    1 +
 6 files changed, 33 insertions(+), 3 deletions(-)

New commits:
commit 46c261603fc60ad30e80cbf6903b573ac98a66ee
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Mon Jun 10 13:41:51 2024 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Tue Jun 11 14:44:37 2024 +0200

    annot: document new annotation classes and methods
    
    Change-Id: I71d1055a30e0e8eedcd8fa71b47e74e90f1aac93
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168595
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/include/svx/annotation/Annotation.hxx 
b/include/svx/annotation/Annotation.hxx
index 8ea57af4d88f..436827b13fc6 100644
--- a/include/svx/annotation/Annotation.hxx
+++ b/include/svx/annotation/Annotation.hxx
@@ -30,6 +30,7 @@ namespace sdr::annotation
 {
 class Annotation;
 
+/** Type of the annotation / comment change. */
 enum class CommentNotificationType
 {
     Add,
@@ -37,10 +38,14 @@ enum class CommentNotificationType
     Remove
 };
 
+/** LOKit notify for a view */
 SVXCORE_DLLPUBLIC void LOKCommentNotify(CommentNotificationType nType,
                                         const SfxViewShell* pViewShell, 
Annotation& rAnnotation);
+
+/** LOKit notify for all views */
 SVXCORE_DLLPUBLIC void LOKCommentNotifyAll(CommentNotificationType nType, 
Annotation& rAnnotation);
 
+/** Type of the annotation (that is supported) */
 enum class AnnotationType
 {
     None,
@@ -53,6 +58,7 @@ enum class AnnotationType
     FreeText,
 };
 
+/** Annotation data that is used at annotation creation */
 struct CreationInfo
 {
     AnnotationType meType = AnnotationType::None;
@@ -69,6 +75,7 @@ struct CreationInfo
     Color maColor = COL_TRANSPARENT;
 };
 
+/** Data of an annotation */
 struct SVXCORE_DLLPUBLIC AnnotationData
 {
     css::geometry::RealPoint2D m_Position;
@@ -82,6 +89,11 @@ struct SVXCORE_DLLPUBLIC AnnotationData
     void set(Annotation& rAnnotation);
 };
 
+/** Annotation object, responsible for handling of the annotation.
+ *
+ * Implements the XAnnotation UNO API, handles undo/redo and notifications ()
+ *
+ **/
 class SVXCORE_DLLPUBLIC Annotation
     : public ::comphelper::WeakComponentImplHelper<css::office::XAnnotation>,
       public ::cppu::PropertySetMixin<css::office::XAnnotation>
@@ -121,6 +133,7 @@ public:
         
comphelper::WeakComponentImplHelper<css::office::XAnnotation>::release();
     }
 
+    // Changes without triggering notification broadcast
     css::geometry::RealPoint2D GetPosition() const { return m_Position; }
     void SetPosition(const css::geometry::RealPoint2D& rValue) { m_Position = 
rValue; }
 
@@ -152,12 +165,14 @@ public:
     SdrPage const* getPage() const { return mpPage; }
     SdrPage* getPage() { return mpPage; }
 
+    // Unique ID of the annotation
     sal_uInt32 GetId() const { return m_nId; }
 
     CreationInfo const& getCreationInfo() { return maCreationInfo; }
     void setCreationInfo(CreationInfo const& rCreationInfo) { maCreationInfo = 
rCreationInfo; }
 };
 
+/** Vector of annotations */
 typedef std::vector<rtl::Reference<Annotation>> AnnotationVector;
 
 } // namespace sdr::annotation
diff --git a/include/svx/annotation/AnnotationObject.hxx 
b/include/svx/annotation/AnnotationObject.hxx
index d46f4e7c3150..e372fec1f56a 100644
--- a/include/svx/annotation/AnnotationObject.hxx
+++ b/include/svx/annotation/AnnotationObject.hxx
@@ -16,12 +16,14 @@
 
 namespace sdr::annotation
 {
+/** Annotation data that contains the annotation unique ID and author's ID */
 struct SVXCORE_DLLPUBLIC AnnotationViewData
 {
     sal_Int32 nIndex = -1;
     sal_uInt16 nAuthorIndex = 0;
 };
 
+/** Annotation (sdr) object, which represents an annotation inside the 
document */
 class SVXCORE_DLLPUBLIC AnnotationObject final : public SdrRectObj
 {
 private:
diff --git a/include/svx/annotation/ObjectAnnotationData.hxx 
b/include/svx/annotation/ObjectAnnotationData.hxx
index 50a2f80c80ac..4530df2fb61c 100644
--- a/include/svx/annotation/ObjectAnnotationData.hxx
+++ b/include/svx/annotation/ObjectAnnotationData.hxx
@@ -15,14 +15,20 @@
 
 namespace sdr::annotation
 {
-/** Contains the annotation data for a SdrObject */
+/** Contains the annotation data specific for a SdrObject (which represents an 
annotation) */
 class ObjectAnnotationData
 {
 public:
+    /// Does the (sdr) object represent an annotation
     bool mbIsAnnotation : 1 = false;
+
+    /// The annotation
     rtl::Reference<sdr::annotation::Annotation> mxAnnotation;
+
+    /// Object handling the pop-up window
     std::unique_ptr<sdr::annotation::IAnnotationPopup> mpAnnotationPopup;
 
+    /// Open popup for the annotation
     void openPopup()
     {
         if (mbIsAnnotation && mpAnnotationPopup)
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index 2347a877fd7a..d6e68943e0ac 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -555,6 +555,7 @@ public:
 
     void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 
+    // Annotations
     virtual rtl::Reference<sdr::annotation::Annotation> createAnnotation();
     virtual void addAnnotation(rtl::Reference<sdr::annotation::Annotation> 
const& xAnnotation, int nIndex = -1);
     virtual void 
addAnnotationNoNotify(rtl::Reference<sdr::annotation::Annotation> const& 
xAnnotation, int nIndex = -1);
diff --git a/sd/source/core/annotations/Annotation.cxx 
b/sd/source/core/annotations/Annotation.cxx
index f41b1507cf72..4f442dbbaa1c 100644
--- a/sd/source/core/annotations/Annotation.cxx
+++ b/sd/source/core/annotations/Annotation.cxx
@@ -41,10 +41,13 @@ using namespace css;
 
 namespace com::sun::star::uno { class XComponentContext; }
 
-namespace sd {
+namespace sd
+{
 
-namespace {
+namespace
+{
 
+/** Undo/redo insertion or removal of an annotation to/from the document */
 class UndoInsertOrRemoveAnnotation : public SdrUndoAction
 {
 public:
@@ -61,11 +64,13 @@ protected:
 
 }
 
+/** Creates an annotation */
 rtl::Reference<sdr::annotation::Annotation> createAnnotation(SdPage* pPage)
 {
     return rtl::Reference<Annotation>(new 
Annotation(comphelper::getProcessComponentContext(), pPage));
 }
 
+/** Creates an annotation and adds it to the page */
 rtl::Reference<sdr::annotation::Annotation> 
createAnnotationAndAddToPage(SdPage* pPage)
 {
     rtl::Reference<sdr::annotation::Annotation> xAnnotation = 
createAnnotation(pPage);
diff --git a/svx/source/annotation/Annotation.cxx 
b/svx/source/annotation/Annotation.cxx
index 47b486228624..293e4328a9e7 100644
--- a/svx/source/annotation/Annotation.cxx
+++ b/svx/source/annotation/Annotation.cxx
@@ -58,6 +58,7 @@ OString lcl_LOKGetCommentPayload(CommentNotificationType 
nType, Annotation& rAnn
     return aJsonWriter.finishAndGetAsOString();
 }
 
+/** Undo/redo a modification of an annotation - change of annotation data */
 class UndoAnnotation : public SdrUndoAction
 {
 public:

Reply via email to