include/svx/obj3d.hxx        |    1 
 include/svx/svdgeodata.hxx   |   48 +++++++++++++++++++++++++++++++++++++++++++
 include/svx/svdobj.hxx       |   22 -------------------
 include/svx/svdotext.hxx     |    1 
 svx/source/svdraw/svdobj.cxx |   14 ++++--------
 5 files changed, 56 insertions(+), 30 deletions(-)

New commits:
commit 44d0a0ac2ed91228d817a9e4e863eb444c5c3cc8
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Dec 18 12:52:35 2023 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Mon Dec 18 16:06:22 2023 +0100

    unique_ptr->optional in SdrObjGeoData
    
    and move it to its own header file to make the include dependencies
    easier to handle
    
    Change-Id: I9449ebd70d83be332e47e1786422697f76175e53
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160905
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/include/svx/obj3d.hxx b/include/svx/obj3d.hxx
index 13ffc73c9879..54919a49c931 100644
--- a/include/svx/obj3d.hxx
+++ b/include/svx/obj3d.hxx
@@ -22,6 +22,7 @@
 
 #include <svx/svdoattr.hxx>
 #include <svx/svdobj.hxx>
+#include <svx/svdgeodata.hxx>
 #include <basegfx/matrix/b3dhommatrix.hxx>
 #include <basegfx/range/b3drange.hxx>
 #include <basegfx/polygon/b3dpolypolygon.hxx>
diff --git a/include/svx/svdgeodata.hxx b/include/svx/svdgeodata.hxx
new file mode 100644
index 000000000000..7f5a8b9713a4
--- /dev/null
+++ b/include/svx/svdgeodata.hxx
@@ -0,0 +1,48 @@
+/*
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svx/svxdllapi.h>
+#include <svx/svdtypes.hxx>
+#include <svx/svdglue.hxx>
+#include <tools/gen.hxx>
+#include <optional>
+
+/**
+ * All geometrical data of an arbitrary object for use in undo/redo
+ */
+class SVXCORE_DLLPUBLIC SdrObjGeoData
+{
+public:
+    tools::Rectangle aBoundRect;
+    Point aAnchor;
+    std::optional<SdrGluePointList> moGluePoints;
+    bool bMovProt;
+    bool bSizProt;
+    bool bNoPrint;
+    bool bClosedObj;
+    bool mbVisible;
+    SdrLayerID mnLayerID;
+
+public:
+    SdrObjGeoData();
+    virtual ~SdrObjGeoData();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index 892beb56668c..2951d41e8904 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -76,6 +76,7 @@ class Fraction;
 enum class PointerStyle;
 class Graphic;
 class SvxShape;
+class SdrObjGeoData;
 namespace basegfx
 {
     class B2DPoint;
@@ -163,27 +164,6 @@ public:
     sal_uInt16 GetId() const { return m_nIdentifier;}
 };
 
-/**
- * All geometrical data of an arbitrary object for use in undo/redo
- */
-class SVXCORE_DLLPUBLIC SdrObjGeoData
-{
-public:
-    tools::Rectangle                   aBoundRect;
-    Point                       aAnchor;
-    std::unique_ptr<SdrGluePointList>
-                                pGPL;
-    bool                        bMovProt;
-    bool                        bSizProt;
-    bool                        bNoPrint;
-    bool                        bClosedObj;
-    bool                        mbVisible;
-    SdrLayerID                  mnLayerID;
-
-public:
-    SdrObjGeoData();
-    virtual ~SdrObjGeoData();
-};
 
 /**
  * Provides information about various ZObject properties
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index d9c0908e505b..84aea85fdeff 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -25,6 +25,7 @@
 #include <svx/sdtakitm.hxx>
 #include <svx/sdtaditm.hxx>
 #include <svx/svdtrans.hxx>
+#include <svx/svdgeodata.hxx>
 #include <tools/datetime.hxx>
 #include <svl/style.hxx>
 #include <svx/svdtext.hxx>
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index f4d13219db0d..652d965e4c3e 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -1903,13 +1903,9 @@ void SdrObject::SaveGeoData(SdrObjGeoData& rGeo) const
 
     // user-defined gluepoints
     if (m_pPlusData!=nullptr && m_pPlusData->pGluePoints!=nullptr) {
-        if (rGeo.pGPL!=nullptr) {
-            *rGeo.pGPL=*m_pPlusData->pGluePoints;
-        } else {
-            rGeo.pGPL.reset( new SdrGluePointList(*m_pPlusData->pGluePoints) );
-        }
+        rGeo.moGluePoints = *m_pPlusData->pGluePoints;
     } else {
-        rGeo.pGPL.reset();
+        rGeo.moGluePoints.reset();
     }
 }
 
@@ -1926,12 +1922,12 @@ void SdrObject::RestoreGeoData(const SdrObjGeoData& 
rGeo)
     mnLayerID = rGeo.mnLayerID;
 
     // user-defined gluepoints
-    if (rGeo.pGPL!=nullptr) {
+    if (rGeo.moGluePoints) {
         ImpForcePlusData();
         if (m_pPlusData->pGluePoints!=nullptr) {
-            *m_pPlusData->pGluePoints=*rGeo.pGPL;
+            *m_pPlusData->pGluePoints=*rGeo.moGluePoints;
         } else {
-            m_pPlusData->pGluePoints.reset(new SdrGluePointList(*rGeo.pGPL));
+            m_pPlusData->pGluePoints.reset(new 
SdrGluePointList(*rGeo.moGluePoints));
         }
     } else {
         if (m_pPlusData!=nullptr && m_pPlusData->pGluePoints!=nullptr) {

Reply via email to