summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-08-13 16:44:15 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-08-16 20:09:43 +0200
commit4639ca2f878b04ffc50d9c20d92e90464d2d67a7 (patch)
treeab13b23467e4a8b4902f58632300a2756c113fb7
parent766b95d58299a1f2eb0d05d67e3afbf95bd9334d (diff)
Rename setX/setY to SetPosX/SetPosY, to align with SetPos
Change-Id: I856194f26fefad993f416d7b92b57a9417a3c0a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120546 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--include/tools/gen.hxx28
-rw-r--r--svl/source/items/rectitem.cxx4
-rw-r--r--sw/source/core/text/txtdrop.cxx2
-rw-r--r--sw/source/filter/xml/xmlimp.cxx4
-rw-r--r--sw/source/filter/xml/xmltexti.cxx4
-rw-r--r--tools/qa/cppunit/test_rectangle.cxx4
-rw-r--r--tools/source/generic/gen.cxx14
-rw-r--r--vcl/source/control/button.cxx2
-rw-r--r--vcl/unx/generic/window/salframe.cxx4
-rw-r--r--vcl/unx/gtk3/salnativewidgets-gtk.cxx8
10 files changed, 35 insertions, 39 deletions
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 1cd3928ab67e..5e083e2bffc6 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -501,6 +501,10 @@ public:
tools::Long AdjustRight( tools::Long nHorzMoveDelta );
tools::Long AdjustTop( tools::Long nVertMoveDelta ) { nTop += nVertMoveDelta; return nTop; }
tools::Long AdjustBottom( tools::Long nVertMoveDelta );
+ /// Set the left edge of the rectangle to x, preserving the width
+ inline void SetPosX(tools::Long x);
+ /// Set the top edge of the rectangle to y, preserving the height
+ inline void SetPosY(tools::Long y);
inline void SetPos( const Point& rPoint );
void SetSize( const Size& rSize );
@@ -572,10 +576,6 @@ public:
tools::Long getWidth() const { return Right() - Left(); }
/// Returns the difference between bottom and top, assuming the range includes one end, but not the other.
tools::Long getHeight() const { return Bottom() - Top(); }
- /// Set the left edge of the rectangle to x, preserving the width
- void setX( tools::Long x );
- /// Set the top edge of the rectangle to y, preserving the height
- void setY( tools::Long y );
void setWidth( tools::Long n ) { nRight = nLeft + n; }
void setHeight( tools::Long n ) { nBottom = nTop + n; }
/// Returns the string representation of the rectangle, format is "x, y, width, height".
@@ -636,14 +636,24 @@ inline void tools::Rectangle::Move( tools::Long nHorzMove, tools::Long nVertMove
nBottom += nVertMove;
}
-inline void tools::Rectangle::SetPos( const Point& rPoint )
+inline void tools::Rectangle::SetPosX(tools::Long x)
{
if (!IsWidthEmpty())
- nRight += rPoint.X() - nLeft;
+ nRight += x - nLeft;
+ nLeft = x;
+}
+
+inline void tools::Rectangle::SetPosY(tools::Long y)
+{
if (!IsHeightEmpty())
- nBottom += rPoint.Y() - nTop;
- nLeft = rPoint.X();
- nTop = rPoint.Y();
+ nBottom += y - nTop;
+ nTop = y;
+}
+
+inline void tools::Rectangle::SetPos( const Point& rPoint )
+{
+ SetPosX(rPoint.X());
+ SetPosY(rPoint.Y());
}
inline tools::Rectangle tools::Rectangle::GetUnion( const tools::Rectangle& rRect ) const
diff --git a/svl/source/items/rectitem.cxx b/svl/source/items/rectitem.cxx
index 982b235f116a..43aa86a76d30 100644
--- a/svl/source/items/rectitem.cxx
+++ b/svl/source/items/rectitem.cxx
@@ -117,8 +117,8 @@ bool SfxRectangleItem::PutValue( const css::uno::Any& rVal,
aVal.setWidth( aValue.Width );
aVal.setHeight( aValue.Height );
break;
- case MID_RECT_LEFT: aVal.setX( nVal ); break;
- case MID_RECT_RIGHT: aVal.setY( nVal ); break;
+ case MID_RECT_LEFT: aVal.SetPosX( nVal ); break;
+ case MID_RECT_RIGHT: aVal.SetPosY( nVal ); break;
case MID_WIDTH: aVal.setWidth( nVal ); break;
case MID_HEIGHT: aVal.setHeight( nVal ); break;
default: OSL_FAIL("Wrong MemberID!"); return false;
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index 306f1b3a633b..e0265b5fabfe 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -877,7 +877,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf
if( rFnt.GetTopBorder() )
{
aRect.setHeight(aRect.GetHeight() + rFnt.GetTopBorderSpace());
- aRect.setY(aRect.Top() - rFnt.GetTopBorderSpace());
+ aRect.SetPosY(aRect.Top() - rFnt.GetTopBorderSpace());
}
if( rFnt.GetBottomBorder() )
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 858f9416c34b..cf402e4f3ab6 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1183,12 +1183,12 @@ void SwXMLImport::SetViewSettings(const Sequence < PropertyValue > & aViewProps)
if ( rValue.Name == "ViewAreaTop" )
{
rValue.Value >>= nTmp;
- aRect.setY(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp);
+ aRect.SetPosY(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp);
}
else if ( rValue.Name == "ViewAreaLeft" )
{
rValue.Value >>= nTmp;
- aRect.setX(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp);
+ aRect.SetPosX(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp);
}
else if ( rValue.Name == "ViewAreaWidth" )
{
diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx
index c3d390f93d5e..0c10b3ba9eb0 100644
--- a/sw/source/filter/xml/xmltexti.cxx
+++ b/sw/source/filter/xml/xmltexti.cxx
@@ -478,14 +478,14 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOLEObject(
{
sal_Int32 nVal = 0;
rProp.maValue >>= nVal;
- aVisArea.setX( nVal );
+ aVisArea.SetPosX( nVal );
}
break;
case CTF_OLE_VIS_AREA_TOP:
{
sal_Int32 nVal = 0;
rProp.maValue >>= nVal;
- aVisArea.setY( nVal );
+ aVisArea.SetPosY( nVal );
}
break;
case CTF_OLE_VIS_AREA_WIDTH:
diff --git a/tools/qa/cppunit/test_rectangle.cxx b/tools/qa/cppunit/test_rectangle.cxx
index 23bfaf61ec7a..e4992f3f44f9 100644
--- a/tools/qa/cppunit/test_rectangle.cxx
+++ b/tools/qa/cppunit/test_rectangle.cxx
@@ -52,9 +52,9 @@ void Test::test_rectangle()
CPPUNIT_ASSERT_EQUAL(tools::Long(0), aRect.getWidth());
CPPUNIT_ASSERT_EQUAL(tools::Long(0), aRect.getHeight());
- aRect.setX(12);
+ aRect.SetPosX(12);
CPPUNIT_ASSERT_EQUAL(tools::Long(1), aRect.GetHeight());
- aRect.setY(12);
+ aRect.SetPosY(12);
CPPUNIT_ASSERT_EQUAL(tools::Long(1), aRect.GetWidth());
}
}
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
index abd32a208d70..4d365a575808 100644
--- a/tools/source/generic/gen.cxx
+++ b/tools/source/generic/gen.cxx
@@ -232,18 +232,4 @@ tools::Long tools::Rectangle::AdjustBottom( tools::Long nVertMoveDelta )
return nBottom;
}
-void tools::Rectangle::setX( tools::Long x )
-{
- if (!IsWidthEmpty())
- nRight += x - nLeft;
- nLeft = x;
-}
-
-void tools::Rectangle::setY( tools::Long y )
-{
- if (!IsHeightEmpty())
- nBottom += y - nTop;
- nTop = y;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index e8c1b9854862..517af24408bf 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -453,7 +453,7 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
if (mpButtonData->mbSmallSymbol)
{
nYOffset = (aUnion.GetHeight() - aSymbolSize.Height()) / 2;
- pSymbolRect->setY(aTextPos.Y() + nYOffset);
+ pSymbolRect->SetPosY(aTextPos.Y() + nYOffset);
}
}
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 43f1b98a224a..a47ed1c645fa 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -1680,11 +1680,11 @@ void X11SalFrame::SetWindowState( const SalFrameState *pState )
// change requested properties
if (pState->mnMask & WindowStateMask::X)
{
- aPosSize.setX (pState->mnX);
+ aPosSize.SetPosX (pState->mnX);
}
if (pState->mnMask & WindowStateMask::Y)
{
- aPosSize.setY (pState->mnY);
+ aPosSize.SetPosY (pState->mnY);
}
if (pState->mnMask & WindowStateMask::Width)
{
diff --git a/vcl/unx/gtk3/salnativewidgets-gtk.cxx b/vcl/unx/gtk3/salnativewidgets-gtk.cxx
index ee9674ae288d..0f03b65053fc 100644
--- a/vcl/unx/gtk3/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/salnativewidgets-gtk.cxx
@@ -221,16 +221,16 @@ tools::Rectangle GtkSalGraphics::NWGetSpinButtonRect( ControlPart nPart, tools::
if ( nPart == ControlPart::ButtonUp )
{
if (AllSettings::GetLayoutRTL())
- partRect.setX(aAreaRect.Left());
+ partRect.SetPosX(aAreaRect.Left());
else
- partRect.setX(aAreaRect.Left() + (aAreaRect.GetWidth() - buttonRect.GetWidth()));
+ partRect.SetPosX(aAreaRect.Left() + (aAreaRect.GetWidth() - buttonRect.GetWidth()));
}
else if( nPart == ControlPart::ButtonDown )
{
if (AllSettings::GetLayoutRTL())
- partRect.setX(aAreaRect.Left() + buttonRect.GetWidth());
+ partRect.SetPosX(aAreaRect.Left() + buttonRect.GetWidth());
else
- partRect.setX(aAreaRect.Left() + (aAreaRect.GetWidth() - 2 * buttonRect.GetWidth()));
+ partRect.SetPosX(aAreaRect.Left() + (aAreaRect.GetWidth() - 2 * buttonRect.GetWidth()));
}
else
{