sw/inc/textboxhelper.hxx             |    4 ++--
 sw/source/core/doc/textboxhelper.cxx |   28 ++++++++++++++--------------
 sw/source/core/layout/flycnt.cxx     |    2 +-
 3 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit 2488029673365f03b14ddd1e4ccb0993dc1be7b7
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Mar 24 10:18:14 2022 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Mar 24 19:54:48 2022 +0100

    loplugin:constantparam
    
    Change-Id: Ib863ea852792635e521050019a3a190b3eeb681e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132031
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index b700ef596603..3881d897c629 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -125,8 +125,8 @@ public:
     /// If we have an associated TextFrame, then return its XTextFrame.
     static css::uno::Reference<css::text::XTextFrame>
     getUnoTextFrame(css::uno::Reference<css::drawing::XShape> const& xShape);
-    /// Return the textbox rectangle of a draw shape (in twips).
-    static tools::Rectangle getTextRectangle(SdrObject* pShape, bool bAbsolute 
= true);
+    /// Return the textbox rectangle of a draw shape (in relative twips).
+    static tools::Rectangle getRelativeTextRectangle(SdrObject* pShape);
 
     /**
      * Is the frame format a text box?
diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index f1613a8052b3..50af58ae4786 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -548,7 +548,7 @@ uno::Any SwTextBoxHelper::queryInterface(const 
SwFrameFormat* pShape, const uno:
     return aRet;
 }
 
-tools::Rectangle SwTextBoxHelper::getTextRectangle(SdrObject* pShape, bool 
bAbsolute)
+tools::Rectangle SwTextBoxHelper::getRelativeTextRectangle(SdrObject* pShape)
 {
     tools::Rectangle aRet;
     aRet.SetEmpty();
@@ -576,7 +576,7 @@ tools::Rectangle 
SwTextBoxHelper::getTextRectangle(SdrObject* pShape, bool bAbso
         aRet = pShape->GetCurrentBoundRect();
     }
 
-    if (!bAbsolute && pShape)
+    if (pShape)
     {
         // Relative, so count the logic (reference) rectangle, see the 
EnhancedCustomShape2d ctor.
         Point aPoint(pShape->GetSnapRect().Center());
@@ -978,7 +978,7 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, 
sal_uInt16 nWID, sal_u
     {
         changeAnchor(pShape, pObj);
         tools::Rectangle aRect
-            = getTextRectangle(pObj ? pObj : pShape->FindRealSdrObject(), 
/*bAbsolute=*/false);
+            = getRelativeTextRectangle(pObj ? pObj : 
pShape->FindRealSdrObject());
         if (!aRect.IsEmpty())
         {
             if (bAdjustX || bAdjustY)
@@ -1094,8 +1094,8 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& 
rShape, SfxItemSet const&
                     return;
                 SwFormatVertOrient 
aOrient(pItem->StaticWhichCast(RES_VERT_ORIENT));
 
-                tools::Rectangle aRect = getTextRectangle(pObj ? pObj : 
rShape.FindRealSdrObject(),
-                                                          /*bAbsolute=*/false);
+                tools::Rectangle aRect
+                    = getRelativeTextRectangle(pObj ? pObj : 
rShape.FindRealSdrObject());
                 if (!aRect.IsEmpty())
                     aOrient.SetPos(aOrient.GetPos() + aRect.Top());
 
@@ -1124,8 +1124,8 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& 
rShape, SfxItemSet const&
                     return;
                 SwFormatHoriOrient 
aOrient(pItem->StaticWhichCast(RES_HORI_ORIENT));
 
-                tools::Rectangle aRect = getTextRectangle(pObj ? pObj : 
rShape.FindRealSdrObject(),
-                                                          /*bAbsolute=*/false);
+                tools::Rectangle aRect
+                    = getRelativeTextRectangle(pObj ? pObj : 
rShape.FindRealSdrObject());
                 if (!aRect.IsEmpty())
                     aOrient.SetPos(aOrient.GetPos() + aRect.Left());
 
@@ -1145,8 +1145,8 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& 
rShape, SfxItemSet const&
                 SwFormatHoriOrient aHoriOrient(rShape.GetHoriOrient());
                 SwFormatFrameSize aSize(pFormat->GetFrameSize());
 
-                tools::Rectangle aRect = getTextRectangle(pObj ? pObj : 
rShape.FindRealSdrObject(),
-                                                          /*bAbsolute=*/false);
+                tools::Rectangle aRect
+                    = getRelativeTextRectangle(pObj ? pObj : 
rShape.FindRealSdrObject());
                 if (!aRect.IsEmpty())
                 {
                     if (!bInlineAnchored)
@@ -1341,8 +1341,8 @@ bool SwTextBoxHelper::doTextBoxPositioning(SwFrameFormat* 
pShape, SdrObject* pOb
         if (pShape->GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR)
         {
             // Get the text area of the shape
-            tools::Rectangle aRect(
-                getTextRectangle(pObj ? pObj : pShape->FindRealSdrObject(), 
false));
+            tools::Rectangle aRect
+                = getRelativeTextRectangle(pObj ? pObj : 
pShape->FindRealSdrObject());
 
             // Get the left spacing of the text area of the shape
             auto nLeftSpace = pShape->GetLRSpace().GetLeft();
@@ -1421,8 +1421,8 @@ bool SwTextBoxHelper::doTextBoxPositioning(SwFrameFormat* 
pShape, SdrObject* pOb
         else
         {
             // Text area of the shape
-            tools::Rectangle aRect(
-                getTextRectangle(pObj ? pObj : pShape->FindRealSdrObject(), 
false));
+            tools::Rectangle aRect
+                = getRelativeTextRectangle(pObj ? pObj : 
pShape->FindRealSdrObject());
 
             // X Offset of the shape spacing
             auto nLeftSpace = pShape->GetLRSpace().GetLeft();
@@ -1514,7 +1514,7 @@ bool SwTextBoxHelper::syncTextBoxSize(SwFrameFormat* 
pShape, SdrObject* pObj)
 
     if (auto pTextBox = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj))
     {
-        const auto& rSize = getTextRectangle(pObj, false).GetSize();
+        const auto& rSize = getRelativeTextRectangle(pObj).GetSize();
         if (!rSize.IsEmpty())
         {
             SwFormatFrameSize aSize(pTextBox->GetFrameSize());
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 5e9bdfe92ef0..bcaa65233364 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -541,7 +541,7 @@ void SwFlyAtContentFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
     {
         // get the text area of the shape
         const tools::Rectangle aTextRectangle
-            = 
SwTextBoxHelper::getTextRectangle(pShapeFormat->FindRealSdrObject(), false);
+            = 
SwTextBoxHelper::getRelativeTextRectangle(pShapeFormat->FindRealSdrObject());
         // get the original textframe position
         SwFormatHoriOrient aHOri = pShapeFormat->GetHoriOrient();
         SwFormatVertOrient aVOri = pShapeFormat->GetVertOrient();

Reply via email to