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

Noel Grandin noel.grandin at collabora.co.uk
Mon Feb 26 06:21:13 UTC 2018


 include/svx/svdtrans.hxx        |    2 --
 include/tools/gen.hxx           |    9 +++++++++
 svx/source/engine3d/scene3d.cxx |    2 +-
 svx/source/svdraw/svdobj.cxx    |    2 +-
 svx/source/svdraw/svdocirc.cxx  |    6 +++---
 svx/source/svdraw/svdogrp.cxx   |   12 ++++++------
 svx/source/svdraw/svdomeas.cxx  |    4 ++--
 svx/source/svdraw/svdotxtr.cxx  |    6 +++---
 svx/source/svdraw/svdovirt.cxx  |    2 +-
 svx/source/svdraw/svdpoev.cxx   |    6 +++---
 svx/source/table/svdotable.cxx  |    2 +-
 sw/source/core/draw/dflyobj.cxx |    4 ++--
 12 files changed, 32 insertions(+), 25 deletions(-)

New commits:
commit 9bc8714308b6f4b85a4c756229ac8b670d009f42
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Feb 23 15:52:25 2018 +0200

    move MovePoint and MoveRect into Rectangle and Point
    
    Change-Id: Ie75c7c10288da00aac89479879e0b9fb1a4459b2
    Reviewed-on: https://gerrit.libreoffice.org/50247
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svx/svdtrans.hxx b/include/svx/svdtrans.hxx
index 201f268482a8..97bf7a5456a4 100644
--- a/include/svx/svdtrans.hxx
+++ b/include/svx/svdtrans.hxx
@@ -54,8 +54,6 @@ namespace svx
     inline long Round(double a) { return a>0.0 ? static_cast<long>(a+0.5) : -static_cast<long>((-a)+0.5); }
 }
 
-inline void MoveRect(tools::Rectangle& rRect, const Size& S)    { rRect.Move(S.Width(),S.Height()); }
-inline void MovePoint(Point& rPnt, const Size& S)        { rPnt.AdjustX(S.Width()); rPnt.AdjustY(S.Height()); }
 inline void MovePoly(tools::Polygon& rPoly, const Size& S)      { rPoly.Move(S.Width(),S.Height()); }
 void MoveXPoly(XPolygon& rPoly, const Size& S);
 
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index ce79396e6788..754f6c3b459c 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -69,6 +69,7 @@ inline bool equal(Pair const & p1, Pair const & p2)
 
 // Point
 
+class Size;
 class SAL_WARN_UNUSED SAL_DLLPUBLIC_EXPORT Point final : protected Pair
 {
 public:
@@ -82,6 +83,7 @@ public:
     long&               Y() { return nB; }
 
     void                Move( long nHorzMove, long nVertMove );
+    void                Move( Size const & s );
     long                AdjustX( long nHorzMove ) { nA += nHorzMove; return nA; }
     long                AdjustY( long nVertMove ) { nB += nVertMove; return nB; }
 
@@ -224,6 +226,12 @@ inline std::basic_ostream<charT, traits> & operator <<(
     return stream << size.Width() << 'x' << size.Height();
 }
 
+inline void Point::Move( Size const & s )
+{
+    AdjustX(s.Width());
+    AdjustY(s.Height());
+}
+
 // Range
 
 #define RANGE_MAX   LONG_MAX
@@ -404,6 +412,7 @@ public:
 
     /// Move the top and left edges by a delta, preserving width and height
     inline void         Move( long nHorzMoveDelta, long nVertMoveDelta );
+    void                Move( Size const & s ) { Move(s.Width(), s.Height()); }
     long                AdjustLeft( long nHorzMoveDelta ) { nLeft += nHorzMoveDelta; return nLeft; }
     long                AdjustRight( long nHorzMoveDelta ) { nRight += nHorzMoveDelta; return nRight; }
     long                AdjustTop( long nVertMoveDelta ) { nTop += nVertMoveDelta; return nTop; }
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
index f2a59e5def7f..444331de3472 100644
--- a/svx/source/engine3d/scene3d.cxx
+++ b/svx/source/engine3d/scene3d.cxx
@@ -290,7 +290,7 @@ void E3dScene::NbcSetSnapRect(const tools::Rectangle& rRect)
 void E3dScene::NbcMove(const Size& rSize)
 {
     tools::Rectangle aNewSnapRect = GetSnapRect();
-    MoveRect(aNewSnapRect, rSize);
+    aNewSnapRect.Move(rSize);
     NbcSetSnapRect(aNewSnapRect);
 }
 
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index f1fcfd8c7f08..64d3b886987f 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -1359,7 +1359,7 @@ Pointer SdrObject::GetCreatePointer() const
 // transformations
 void SdrObject::NbcMove(const Size& rSiz)
 {
-    MoveRect(aOutRect,rSiz);
+    aOutRect.Move(rSiz);
     SetRectsDirty();
 }
 
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index 78dd14899b20..dc87f9a5de9a 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -789,9 +789,9 @@ Pointer SdrCircObj::GetCreatePointer() const
 
 void SdrCircObj::NbcMove(const Size& aSiz)
 {
-    MoveRect(maRect,aSiz);
-    MoveRect(aOutRect,aSiz);
-    MoveRect(maSnapRect,aSiz);
+    maRect.Move(aSiz);
+    aOutRect.Move(aSiz);
+    maSnapRect.Move(aSiz);
     SetXPolyDirty();
     SetRectsDirty(true);
 }
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
index 0ad320da6b8c..d2151f14f4e4 100644
--- a/svx/source/svdraw/svdogrp.cxx
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -395,7 +395,7 @@ void SdrObjGroup::NbcSetLogicRect(const tools::Rectangle& rRect)
 
 void SdrObjGroup::NbcMove(const Size& rSiz)
 {
-    MovePoint(aRefPoint,rSiz);
+    aRefPoint.Move(rSiz);
     if (pSub->GetObjCount()!=0) {
         SdrObjList* pOL=pSub.get();
         const size_t nObjCount = pOL->GetObjCount();
@@ -404,7 +404,7 @@ void SdrObjGroup::NbcMove(const Size& rSiz)
             pObj->NbcMove(rSiz);
         }
     } else {
-        MoveRect(aOutRect,rSiz);
+        aOutRect.Move(rSiz);
         SetRectsDirty();
     }
 }
@@ -491,7 +491,7 @@ void SdrObjGroup::NbcSetAnchorPos(const Point& rPnt)
 {
     aAnchor=rPnt;
     Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
-    MovePoint(aRefPoint,aSiz);
+    aRefPoint.Move(aSiz);
     SdrObjList* pOL=pSub.get();
     const size_t nObjCount=pOL->GetObjCount();
     for (size_t i=0; i<nObjCount; ++i) {
@@ -536,7 +536,7 @@ void SdrObjGroup::Move(const Size& rSiz)
 {
     if (rSiz.Width()!=0 || rSiz.Height()!=0) {
         tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
-        MovePoint(aRefPoint,rSiz);
+        aRefPoint.Move(rSiz);
         if (pSub->GetObjCount()!=0) {
             // first move the connectors, then everything else
             SdrObjList* pOL=pSub.get();
@@ -550,7 +550,7 @@ void SdrObjGroup::Move(const Size& rSiz)
                 if (!pObj->IsEdgeObj()) pObj->Move(rSiz);
             }
         } else {
-            MoveRect(aOutRect,rSiz);
+            aOutRect.Move(rSiz);
             SetRectsDirty();
         }
 
@@ -690,7 +690,7 @@ void SdrObjGroup::SetAnchorPos(const Point& rPnt)
     bool bChg=aAnchor!=rPnt;
     aAnchor=rPnt;
     Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
-    MovePoint(aRefPoint,aSiz);
+    aRefPoint.Move(aSiz);
     // move the connectors first, everything else afterwards
     SdrObjList* pOL=pSub.get();
     const size_t nObjCount = pOL->GetObjCount();
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index 8e702e9f5a61..63f33c6cbbce 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -1001,8 +1001,8 @@ Pointer SdrMeasureObj::GetCreatePointer() const
 void SdrMeasureObj::NbcMove(const Size& rSiz)
 {
     SdrTextObj::NbcMove(rSiz);
-    MovePoint(aPt1,rSiz);
-    MovePoint(aPt2,rSiz);
+    aPt1.Move(rSiz);
+    aPt2.Move(rSiz);
 }
 
 void SdrMeasureObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
index 6ecdbcb47b22..40eca1077e38 100644
--- a/svx/source/svdraw/svdotxtr.cxx
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -94,9 +94,9 @@ long SdrTextObj::GetShearAngle(bool /*bVertical*/) const
 
 void SdrTextObj::NbcMove(const Size& rSiz)
 {
-    MoveRect(maRect,rSiz);
-    MoveRect(aOutRect,rSiz);
-    MoveRect(maSnapRect,rSiz);
+    maRect.Move(rSiz);
+    aOutRect.Move(rSiz);
+    maSnapRect.Move(rSiz);
     SetRectsDirty(true);
 }
 
diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx
index d7145be8f93a..2ffcdc313473 100644
--- a/svx/source/svdraw/svdovirt.cxx
+++ b/svx/source/svdraw/svdovirt.cxx
@@ -342,7 +342,7 @@ basegfx::B2DPolyPolygon SdrVirtObj::TakeCreatePoly(const SdrDragStat& rDrag) con
 
 void SdrVirtObj::NbcMove(const Size& rSiz)
 {
-    MovePoint(aAnchor,rSiz);
+    aAnchor.Move(rSiz);
     SetRectsDirty();
 }
 
diff --git a/svx/source/svdraw/svdpoev.cxx b/svx/source/svdraw/svdpoev.cxx
index ae1d75bd4a4d..509eb112dd96 100644
--- a/svx/source/svdraw/svdpoev.cxx
+++ b/svx/source/svdraw/svdpoev.cxx
@@ -602,9 +602,9 @@ void SdrPolyEditView::ImpTransformMarkedPoints(PPolyTrFunc pTrFunc, const void*
 
 static void ImpMove(Point& rPt, Point* pC1, Point* pC2, const void* p1, const void* /*p2*/, const void* /*p3*/, const void* /*p4*/)
 {
-    MovePoint(rPt,*static_cast<const Size*>(p1));
-    if (pC1!=nullptr) MovePoint(*pC1,*static_cast<const Size*>(p1));
-    if (pC2!=nullptr) MovePoint(*pC2,*static_cast<const Size*>(p1));
+    rPt.Move(*static_cast<const Size*>(p1));
+    if (pC1!=nullptr) pC1->Move(*static_cast<const Size*>(p1));
+    if (pC2!=nullptr) pC2->Move(*static_cast<const Size*>(p1));
 }
 
 void SdrPolyEditView::MoveMarkedPoints(const Size& rSiz)
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index 4bbd1cb11625..14f9896e9259 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -1853,7 +1853,7 @@ void SdrTableObj::AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool /* bSh
 
 void SdrTableObj::NbcMove(const Size& rSiz)
 {
-    MoveRect(maLogicRect,rSiz);
+    maLogicRect.Move(rSiz);
     SdrTextObj::NbcMove( rSiz );
     if( mpImpl.is() )
         mpImpl->UpdateCells( maRect );
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index ac313abdd9df..cc96d70a4513 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -643,7 +643,7 @@ void SwVirtFlyDrawObj::NbcMove(const Size& rSiz)
         aOutRect = GetFlyFrame()->getFrameArea().SVRect();
     }
 
-    MoveRect( aOutRect, rSiz );
+    aOutRect.Move( rSiz );
     const Point aOldPos( GetFlyFrame()->getFrameArea().Pos() );
     const Point aNewPos( aOutRect.TopLeft() );
     const SwRect aFlyRect( aOutRect );
@@ -1105,7 +1105,7 @@ void SwVirtFlyDrawObj::NbcResize(const Point& rRef, const Fraction& xFact, const
         const Size aDeltaMove(
                 aNewPos.X() - aOldPos.X(),
                 aNewPos.Y() - aOldPos.Y());
-        MoveRect(aOutRect, Size(-aDeltaMove.Width(), -aDeltaMove.Height()));
+        aOutRect.Move(-aDeltaMove.Width(), -aDeltaMove.Height());
 
         // Now, move as needed (no empty delta which was a hack anyways)
         if(bIsTransformableSwFrame)


More information about the Libreoffice-commits mailing list