[Libreoffice-commits] core.git: include/svx svx/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 6 06:51:40 UTC 2019


 include/svx/svdotext.hxx       |    6 ++++--
 svx/source/svdraw/svdocapt.cxx |    3 ++-
 svx/source/svdraw/svdocirc.cxx |    2 +-
 svx/source/svdraw/svdoedge.cxx |    3 ++-
 svx/source/svdraw/svdopath.cxx |   11 +++++------
 svx/source/svdraw/svdorect.cxx |    2 +-
 svx/source/svdraw/svdotxtr.cxx |    6 +++---
 7 files changed, 18 insertions(+), 15 deletions(-)

New commits:
commit 8494a95f29c74b06cfdf78c6a218ddeba81e3914
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Sep 5 17:11:31 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 6 08:50:35 2019 +0200

    return unique_ptr from ImpConvertMakeObj
    
    Change-Id: I24b53dceb79bd43aed92c8130dc33b637410d231
    Reviewed-on: https://gerrit.libreoffice.org/78672
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 9ee22622c5d7..51dae6373526 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -42,6 +42,7 @@
 class OutlinerParaObject;
 class OverflowingText;
 class SdrOutliner;
+class SdrPathObj;
 class SdrTextObj;
 class SdrTextObjTest;
 class SvxFieldItem;
@@ -49,6 +50,7 @@ class ImpSdrObjTextLink;
 class EditStatus;
 class TextChain;
 class TextChainFlow;
+
 enum class EEAnchorMode;
 enum class EETextFormat;
 
@@ -128,9 +130,9 @@ namespace sdr
     } // end of namespace properties
 } // end of namespace sdr
 
-
 //   SdrTextObj
 
+typedef std::unique_ptr<SdrPathObj, SdrObjectFreeOp> SdrPathObjUniquePtr;
 
 class SVX_DLLPUBLIC SdrTextObj : public SdrAttrObj, public svx::ITextProvider
 {
@@ -275,7 +277,7 @@ private:
 
 protected:
     bool ImpCanConvTextToCurve() const;
-    SdrObject* ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPolygon, bool bClosed, bool bBezier) const;
+    SdrPathObjUniquePtr ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPolygon, bool bClosed, bool bBezier) const;
     SdrObject* ImpConvertAddText(SdrObject* pObj, bool bBezier) const;
     void ImpSetTextStyleSheetListeners();
     static void ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, Fraction& rFitXCorrection);
diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx
index 2b30aaa52cef..d07dccc980dc 100644
--- a/svx/source/svdraw/svdocapt.cxx
+++ b/svx/source/svdraw/svdocapt.cxx
@@ -43,6 +43,7 @@
 #include <svx/svdhdl.hxx>
 #include <svx/svdmodel.hxx>
 #include <svx/svdocapt.hxx>
+#include <svx/svdopath.hxx>
 #include <svx/svdogrp.hxx>
 #include <svx/svdpage.hxx>
 #include <svx/svdpool.hxx>
@@ -696,7 +697,7 @@ void SdrCaptionObj::RestGeoData(const SdrObjGeoData& rGeo)
 SdrObject* SdrCaptionObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
 {
     SdrObject* pRect=SdrRectObj::DoConvertToPolyObj(bBezier, bAddText);
-    SdrObject* pTail = ImpConvertMakeObj(basegfx::B2DPolyPolygon(aTailPoly.getB2DPolygon()), false, bBezier);
+    SdrObject* pTail = ImpConvertMakeObj(basegfx::B2DPolyPolygon(aTailPoly.getB2DPolygon()), false, bBezier).release();
     SdrObject* pRet=(pTail!=nullptr) ? pTail : pRect;
     if (pTail!=nullptr && pRect!=nullptr) {
         bool bInsRect = true;
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index bc726a64b628..2af9ac8e6d09 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -1151,7 +1151,7 @@ SdrObject* SdrCircObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
 {
     const bool bFill(meCircleKind != SdrCircKind::Arc);
     const basegfx::B2DPolygon aCircPolygon(ImpCalcXPolyCirc(meCircleKind, maRect, nStartAngle, nEndAngle));
-    SdrObject* pRet = ImpConvertMakeObj(basegfx::B2DPolyPolygon(aCircPolygon), bFill, bBezier);
+    SdrObject* pRet = ImpConvertMakeObj(basegfx::B2DPolyPolygon(aCircPolygon), bFill, bBezier).release();
 
     if(bAddText)
     {
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index e9d40f0f298a..07512a1e01d5 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -37,6 +37,7 @@
 #include <svx/svdhdl.hxx>
 #include <svx/svdmodel.hxx>
 #include <svx/svdoedge.hxx>
+#include <svx/svdopath.hxx>
 #include <svx/svdpage.hxx>
 #include <svx/svdpagv.hxx>
 #include <svx/svdpool.hxx>
@@ -2404,7 +2405,7 @@ SdrObject* SdrEdgeObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
 {
     basegfx::B2DPolyPolygon aPolyPolygon;
     aPolyPolygon.append(pEdgeTrack->getB2DPolygon());
-    SdrObject* pRet = ImpConvertMakeObj(aPolyPolygon, false, bBezier);
+    SdrObject* pRet = ImpConvertMakeObj(aPolyPolygon, false, bBezier).release();
 
     if(bAddText)
     {
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 9b4e5f060310..e15e2c9e12a8 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -2676,14 +2676,12 @@ SdrObject* SdrPathObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
     const bool bHideContour(
         !aText.isDefault() && !aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour());
 
-    SdrObject* pRet = bHideContour ?
-        nullptr :
-        ImpConvertMakeObj(GetPathPoly(), IsClosed(), bBezier);
+    SdrObject* pRet = nullptr;
 
-    SdrPathObj* pPath = dynamic_cast<SdrPathObj*>( pRet );
-
-    if(pPath)
+    if(!bHideContour)
     {
+        SdrPathObjUniquePtr pPath = ImpConvertMakeObj(GetPathPoly(), IsClosed(), bBezier);
+
         if(pPath->GetPathPoly().areControlPointsUsed())
         {
             if(!bBezier)
@@ -2700,6 +2698,7 @@ SdrObject* SdrPathObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
                 pPath->SetPathPoly(basegfx::utils::expandToCurve(pPath->GetPathPoly()));
             }
         }
+        pRet = pPath.release();
     }
 
     if(bAddText)
diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx
index 3a3d87308f70..6b8c328b154f 100644
--- a/svx/source/svdraw/svdorect.cxx
+++ b/svx/source/svdraw/svdorect.cxx
@@ -571,7 +571,7 @@ SdrObject* SdrRectObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
     // when used with bAddText==false from other converters
     if((bAddText && !IsTextFrame()) || HasFill() || HasLine())
     {
-        pRet = ImpConvertMakeObj(aPolyPolygon, true, bBezier);
+        pRet = ImpConvertMakeObj(aPolyPolygon, true, bBezier).release();
     }
 
     if(bAddText)
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index 9bc1b66dc654..6a9050b6cb6c 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -430,7 +430,7 @@ bool SdrTextObj::ImpCanConvTextToCurve() const
     return !IsOutlText();
 }
 
-SdrObject* SdrTextObj::ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPolygon, bool bClosed, bool bBezier) const
+SdrPathObjUniquePtr SdrTextObj::ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPolygon, bool bClosed, bool bBezier) const
 {
     SdrObjKind ePathKind = bClosed ? OBJ_PATHFILL : OBJ_PATHLINE;
     basegfx::B2DPolyPolygon aB2DPolyPolygon(rPolyPolygon);
@@ -442,10 +442,10 @@ SdrObject* SdrTextObj::ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPol
         ePathKind = bClosed ? OBJ_POLY : OBJ_PLIN;
     }
 
-    SdrPathObj* pPathObj = new SdrPathObj(
+    SdrPathObjUniquePtr pPathObj(new SdrPathObj(
         getSdrModelFromSdrObject(),
         ePathKind,
-        aB2DPolyPolygon);
+        aB2DPolyPolygon));
 
     if(bBezier)
     {


More information about the Libreoffice-commits mailing list