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 1deed7d8f804b54493625deffd35487e4c64f6d5
Author:     Tomaž Vajngerl <[email protected]>
AuthorDate: Mon Jun 10 13:41:51 2024 +0900
Commit:     Miklos Vajna <[email protected]>
CommitDate: Tue Jun 18 11:25:51 2024 +0200

    annot: document new annotation classes and methods
    
    Change-Id: I71d1055a30e0e8eedcd8fa71b47e74e90f1aac93
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168654
    Tested-by: Miklos Vajna <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/include/svx/annotation/Annotation.hxx 
b/include/svx/annotation/Annotation.hxx
index 0950335c8734..6464d96c8ce2 100644
--- a/include/svx/annotation/Annotation.hxx
+++ b/include/svx/annotation/Annotation.hxx
@@ -31,6 +31,7 @@ namespace sdr::annotation
 {
 class Annotation;
 
+/** Type of the annotation / comment change. */
 enum class CommentNotificationType
 {
     Add,
@@ -38,10 +39,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,
@@ -54,6 +59,7 @@ enum class AnnotationType
     FreeText,
 };
 
+/** Annotation data that is used at annotation creation */
 struct CreationInfo
 {
     AnnotationType meType = AnnotationType::None;
@@ -70,6 +76,7 @@ struct CreationInfo
     Color maColor = COL_TRANSPARENT;
 };
 
+/** Data of an annotation */
 struct SVXCORE_DLLPUBLIC AnnotationData
 {
     css::geometry::RealPoint2D m_Position;
@@ -83,6 +90,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
     : protected ::cppu::BaseMutex,
       public ::cppu::WeakComponentImplHelper<css::office::XAnnotation>,
@@ -123,6 +135,7 @@ public:
         ::cppu::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; }
 
@@ -156,12 +169,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 cc6d4f47492f..32bd6903501a 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -557,6 +557,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 dfd0bd0546a3..2906e641e86d 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 92660c74c82b..d2689474c2e0 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