include/svx/annotation/ObjectAnnotationData.hxx |   25 ++++++++++
 include/svx/svdobj.hxx                          |    9 +++
 svx/source/svdraw/svdobj.cxx                    |   58 +++++++++++++++---------
 3 files changed, 71 insertions(+), 21 deletions(-)

New commits:
commit 4cd2737d829e8a3413ad3d60a17dded4dcc8938c
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Wed Jun 5 17:23:22 2024 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Wed Jun 5 15:00:54 2024 +0200

    annot: prepare SdrObject to represent an annotation
    
    Change-Id: Iabcc2166ea20cbeac6d2ada7120700a4e8b19303
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168428
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    Tested-by: Jenkins

diff --git a/include/svx/annotation/ObjectAnnotationData.hxx 
b/include/svx/annotation/ObjectAnnotationData.hxx
new file mode 100644
index 000000000000..bdba8ab5a5b9
--- /dev/null
+++ b/include/svx/annotation/ObjectAnnotationData.hxx
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <svx/svxdllapi.h>
+
+namespace sdr::annotation
+{
+/** Contains the annotation data for a SdrObject */
+class ObjectAnnotationData
+{
+public:
+    bool mbIsAnnotation : 1 = false;
+    rtl::Reference<sdr::annotation::Annotation> mxAnnotation;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index 4e03abf18da3..1dd8dd52eb59 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -87,7 +87,7 @@ namespace basegfx
 namespace sdr { class ObjectUser; }
 namespace sdr::properties { class BaseProperties; }
 namespace sdr::contact { class ViewContact; }
-
+namespace sdr::annotation { class ObjectAnnotationData; }
 namespace com::sun::star::drawing { class XShape; }
 namespace svx::diagram { class IDiagramHelper; }
 
@@ -359,6 +359,11 @@ public:
     virtual void SetDecorative(bool isDecorative);
     virtual bool IsDecorative() const;
 
+    // Object representing an annotation
+    bool isAnnotationObject() const;
+    void setAsAnnotationObject(bool bSetAnnotation);
+    std::unique_ptr<sdr::annotation::ObjectAnnotationData>& 
getAnnotationData();
+
     // for group objects
     bool IsGroupObject() const;
     virtual SdrObjList* GetSubList() const;
@@ -895,6 +900,8 @@ protected:
     // #i25616#
     bool                        mbSupportTextIndentingOnLineWidthChange : 1;
 
+    std::unique_ptr<sdr::annotation::ObjectAnnotationData> mpAnnotationData;
+
     virtual ~SdrObject() override;
 
     virtual std::unique_ptr<sdr::properties::BaseProperties> 
CreateObjectSpecificProperties() = 0;
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index b5cd832c096b..9da8c5662f12 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -54,6 +54,7 @@
 #include <sdr/contact/objectcontactofobjlistpainter.hxx>
 #include <svx/sdr/contact/viewcontactofsdrobj.hxx>
 #include <sdr/properties/emptyproperties.hxx>
+#include <svx/annotation/ObjectAnnotationData.hxx>
 #include <svx/sdrhittesthelper.hxx>
 #include <svx/sdrobjectuser.hxx>
 #include <svx/sdrobjectfilter.hxx>
@@ -336,16 +337,17 @@ void impRemoveIncarnatedSdrObjectToSdrModel(SdrObject& 
rSdrObject, SdrModel& rSd
 #endif
 
 SdrObject::SdrObject(SdrModel& rSdrModel)
-:   mpFillGeometryDefiningShape(nullptr)
-    ,mrSdrModelFromSdrObject(rSdrModel)
-    ,m_pUserCall(nullptr)
-    ,mpImpl(new Impl)
-    ,mpParentOfSdrObject(nullptr)
-    ,m_nOrdNum(0)
-    ,mnNavigationPosition(SAL_MAX_UINT32)
-    ,mnLayerID(0)
-    ,mpSvxShape( nullptr )
-    ,mbDoNotInsertIntoPageAutomatically(false)
+    : mpFillGeometryDefiningShape(nullptr)
+    , mrSdrModelFromSdrObject(rSdrModel)
+    , m_pUserCall(nullptr)
+    , mpAnnotationData(new sdr::annotation::ObjectAnnotationData)
+    , mpImpl(new Impl)
+    , mpParentOfSdrObject(nullptr)
+    , m_nOrdNum(0)
+    , mnNavigationPosition(SAL_MAX_UINT32)
+    , mnLayerID(0)
+    , mpSvxShape( nullptr )
+    , mbDoNotInsertIntoPageAutomatically(false)
 {
     m_bVirtObj         =false;
     m_bSnapRectDirty   =true;
@@ -374,16 +376,17 @@ SdrObject::SdrObject(SdrModel& rSdrModel)
 }
 
 SdrObject::SdrObject(SdrModel& rSdrModel, SdrObject const & rSource)
-:   mpFillGeometryDefiningShape(nullptr)
-    ,mrSdrModelFromSdrObject(rSdrModel)
-    ,m_pUserCall(nullptr)
-    ,mpImpl(new Impl)
-    ,mpParentOfSdrObject(nullptr)
-    ,m_nOrdNum(0)
-    ,mnNavigationPosition(SAL_MAX_UINT32)
-    ,mnLayerID(0)
-    ,mpSvxShape( nullptr )
-    ,mbDoNotInsertIntoPageAutomatically(false)
+    : mpFillGeometryDefiningShape(nullptr)
+    , mrSdrModelFromSdrObject(rSdrModel)
+    , m_pUserCall(nullptr)
+    , mpAnnotationData(new sdr::annotation::ObjectAnnotationData)
+    , mpImpl(new Impl)
+    , mpParentOfSdrObject(nullptr)
+    , m_nOrdNum(0)
+    , mnNavigationPosition(SAL_MAX_UINT32)
+    , mnLayerID(0)
+    , mpSvxShape( nullptr )
+    , mbDoNotInsertIntoPageAutomatically(false)
 {
     m_bVirtObj         =false;
     m_bSnapRectDirty   =true;
@@ -889,6 +892,21 @@ bool SdrObject::IsDecorative() const
     return m_pPlusData == nullptr ? false : m_pPlusData->isDecorative;
 }
 
+bool SdrObject::isAnnotationObject() const
+{
+    return mpAnnotationData->mbIsAnnotation;
+}
+
+void SdrObject::setAsAnnotationObject(bool bSetAnnotation)
+{
+    mpAnnotationData->mbIsAnnotation = bSetAnnotation;
+}
+
+std::unique_ptr<sdr::annotation::ObjectAnnotationData>& 
SdrObject::getAnnotationData()
+{
+    return mpAnnotationData;
+}
+
 sal_uInt32 SdrObject::GetOrdNum() const
 {
     if (SdrObjList* pParentList = getParentSdrObjListFromSdrObject())

Reply via email to