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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 16 07:01:32 UTC 2018


 include/svx/svdhdl.hxx       |    2 +-
 svx/source/svdraw/svdhdl.cxx |   26 +++++++++++++-------------
 2 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit 278a093775221f66d5299be54153ff91d168a94c
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Aug 15 14:55:02 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Aug 16 09:01:04 2018 +0200

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

diff --git a/include/svx/svdhdl.hxx b/include/svx/svdhdl.hxx
index 8c719674260f..0e954c16dce0 100644
--- a/include/svx/svdhdl.hxx
+++ b/include/svx/svdhdl.hxx
@@ -165,7 +165,7 @@ private:
     bool                        mbMouseOver;    // is true if the mouse is over this handle
 
 protected:
-    sdr::overlay::OverlayObject* CreateOverlayObject(
+    std::unique_ptr<sdr::overlay::OverlayObject> CreateOverlayObject(
         const basegfx::B2DPoint& rPos,
         BitmapColorIndex eColIndex, BitmapMarkerKind eKindOfMarker,
         Point aMoveOutsideOffset = Point());
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index a0b0291e02b0..d10805516869 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -608,9 +608,9 @@ void SdrHdl::CreateB2dIAObject()
                         }
                         else
                         {
-                            pNewOverlayObject.reset(CreateOverlayObject(
+                            pNewOverlayObject = CreateOverlayObject(
                                                     aPosition, eColIndex, eKindOfMarker,
-                                                    aMoveOutsideOffset));
+                                                    aMoveOutsideOffset);
                         }
                         // OVERLAYMANAGER
                         if (pNewOverlayObject)
@@ -779,11 +779,11 @@ BitmapEx ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, BitmapColorIndex eIndex)
 
 } // end anonymous namespace
 
-sdr::overlay::OverlayObject* SdrHdl::CreateOverlayObject(
+std::unique_ptr<sdr::overlay::OverlayObject> SdrHdl::CreateOverlayObject(
     const basegfx::B2DPoint& rPos,
     BitmapColorIndex eColIndex, BitmapMarkerKind eKindOfMarker, Point aMoveOutsideOffset)
 {
-    sdr::overlay::OverlayObject* pRetval = nullptr;
+    std::unique_ptr<sdr::overlay::OverlayObject> pRetval;
 
     // support bigger sizes
     bool bForceBiggerSize(false);
@@ -862,23 +862,23 @@ sdr::overlay::OverlayObject* SdrHdl::CreateOverlayObject(
         if(eKindOfMarker == BitmapMarkerKind::Anchor || eKindOfMarker == BitmapMarkerKind::AnchorPressed)
         {
             // when anchor is used take upper left as reference point inside the handle
-            pRetval = new sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime);
+            pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime));
         }
         else if(eKindOfMarker == BitmapMarkerKind::AnchorTR || eKindOfMarker == BitmapMarkerKind::AnchorPressedTR)
         {
             // AnchorTR for SW, take top right as (0,0)
-            pRetval = new sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime,
+            pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime,
                 static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1), 0,
-                static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Width() - 1), 0);
+                static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Width() - 1), 0));
         }
         else
         {
             // create centered handle as default
-            pRetval = new sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime,
+            pRetval.reset(new sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime,
                 static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
                 static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
                 static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
-                static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Height() - 1) >> 1);
+                static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Height() - 1) >> 1));
         }
     }
     else
@@ -902,13 +902,13 @@ sdr::overlay::OverlayObject* SdrHdl::CreateOverlayObject(
         if(eKindOfMarker == BitmapMarkerKind::Anchor || eKindOfMarker == BitmapMarkerKind::AnchorPressed)
         {
             // upper left as reference point inside the handle for AnchorPressed, too
-            pRetval = new sdr::overlay::OverlayBitmapEx(rPos, aBmpEx);
+            pRetval.reset(new sdr::overlay::OverlayBitmapEx(rPos, aBmpEx));
         }
         else if(eKindOfMarker == BitmapMarkerKind::AnchorTR || eKindOfMarker == BitmapMarkerKind::AnchorPressedTR)
         {
             // AnchorTR for SW, take top right as (0,0)
-            pRetval = new sdr::overlay::OverlayBitmapEx(rPos, aBmpEx,
-                static_cast<sal_uInt16>(aBmpEx.GetSizePixel().Width() - 1), 0);
+            pRetval.reset(new sdr::overlay::OverlayBitmapEx(rPos, aBmpEx,
+                static_cast<sal_uInt16>(aBmpEx.GetSizePixel().Width() - 1), 0));
         }
         else
         {
@@ -934,7 +934,7 @@ sdr::overlay::OverlayObject* SdrHdl::CreateOverlayObject(
             }
 
             // create centered handle as default
-            pRetval = new sdr::overlay::OverlayBitmapEx(rPos, aBmpEx, nCenX, nCenY);
+            pRetval.reset(new sdr::overlay::OverlayBitmapEx(rPos, aBmpEx, nCenX, nCenY));
         }
     }
 


More information about the Libreoffice-commits mailing list