From 934985becc567114c3f38a72322056a628aad7c9 Mon Sep 17 00:00:00 2001 From: Chris Sherlock Date: Wed, 29 Jun 2022 00:06:03 +1000 Subject: tools: rename getHeight/Width() to GetOpenHeight/Width() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By default Rectangle uses closed interval, if we really want to use half open intervals then we should specifically say as such in the name. Change-Id: Id7a91120ba1a1a4bc330014216b73a692dbf03a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136575 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- sw/qa/extras/tiledrendering/tiledrendering.cxx | 4 ++-- sw/qa/extras/uiwriter/uiwriter.cxx | 2 +- sw/source/core/crsr/FormFieldButton.cxx | 2 +- sw/source/core/crsr/contentcontrolbutton.cxx | 2 +- sw/source/core/doc/textboxhelper.cxx | 10 +++++----- sw/source/core/draw/dflyobj.cxx | 4 ++-- sw/source/filter/html/htmlflywriter.cxx | 4 ++-- sw/source/filter/ww8/docxsdrexport.cxx | 17 +++++++++-------- sw/source/filter/ww8/wrtw8esh.cxx | 12 ++++++------ sw/source/uibase/docvw/HeaderFooterWin.cxx | 2 +- sw/source/uibase/docvw/PageBreakWin.cxx | 4 ++-- 11 files changed, 32 insertions(+), 31 deletions(-) (limited to 'sw') diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index a4a9d7b318b3..15fd2ab4e6c8 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -445,8 +445,8 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testSetGraphicSelection) pXTextDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_END, pHdl->GetPos().getX(), pHdl->GetPos().getY() + 1000); tools::Rectangle aShapeAfter = pObject->GetSnapRect(); // Check that a resize happened, but aspect ratio is not kept. - CPPUNIT_ASSERT_EQUAL(aShapeBefore.getWidth(), aShapeAfter.getWidth()); - CPPUNIT_ASSERT_EQUAL(aShapeBefore.getHeight() + 1000, aShapeAfter.getHeight()); + CPPUNIT_ASSERT_EQUAL(aShapeBefore.getOpenWidth(), aShapeAfter.getOpenWidth()); + CPPUNIT_ASSERT_EQUAL(aShapeBefore.getOpenHeight() + 1000, aShapeAfter.getOpenHeight()); } CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testResetSelection) diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index c1a77a6b8747..d075eab58b22 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -978,7 +978,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testShapeTextboxAutosize) // Shape -> textbox synchronization was missing, the second shape had the // same height as the first, even though the first contained 1 paragraph // and the other 2 ones. - CPPUNIT_ASSERT(pFirst->GetSnapRect().getHeight() < pSecond->GetSnapRect().getHeight()); + CPPUNIT_ASSERT(pFirst->GetSnapRect().getOpenHeight() < pSecond->GetSnapRect().getOpenHeight()); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo82191) diff --git a/sw/source/core/crsr/FormFieldButton.cxx b/sw/source/core/crsr/FormFieldButton.cxx index 43534de207c0..319dcdb9c0dd 100644 --- a/sw/source/core/crsr/FormFieldButton.cxx +++ b/sw/source/core/crsr/FormFieldButton.cxx @@ -121,7 +121,7 @@ void FormFieldButton::Paint(vcl::RenderContext& rRenderContext, const tools::Rec Point aButtonPos(aFrameRect.TopLeft()); aButtonPos.AdjustX(aFrameRect.GetSize().getWidth() - 1); Size aButtonSize(aFrameRect.GetSize()); - aButtonSize.setWidth(GetSizePixel().getWidth() - aFrameRect.getWidth() - nPadding); + aButtonSize.setWidth(GetSizePixel().getWidth() - aFrameRect.getOpenWidth() - nPadding); const tools::Rectangle aButtonRect(tools::Rectangle(aButtonPos, aButtonSize)); // Background & border diff --git a/sw/source/core/crsr/contentcontrolbutton.cxx b/sw/source/core/crsr/contentcontrolbutton.cxx index 34cbd38e663a..310eba3092f1 100644 --- a/sw/source/core/crsr/contentcontrolbutton.cxx +++ b/sw/source/core/crsr/contentcontrolbutton.cxx @@ -111,7 +111,7 @@ void SwContentControlButton::Paint(vcl::RenderContext& rRenderContext, const too Point aButtonPos(aFrameRect.TopLeft()); aButtonPos.AdjustX(aFrameRect.GetSize().getWidth() - nPadding * 2); Size aButtonSize(aFrameRect.GetSize()); - aButtonSize.setWidth(GetSizePixel().getWidth() - aFrameRect.getWidth() - nPadding); + aButtonSize.setWidth(GetSizePixel().getWidth() - aFrameRect.getOpenWidth() - nPadding); const tools::Rectangle aButtonRect(tools::Rectangle(aButtonPos, aButtonSize)); // Background & border diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index 1ac5ccf71787..445abf738141 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -989,8 +989,8 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u } else if (bAdjustSize) { - awt::Size aSize(convertTwipToMm100(aRect.getWidth()), - convertTwipToMm100(aRect.getHeight())); + awt::Size aSize(convertTwipToMm100(aRect.getOpenWidth()), + convertTwipToMm100(aRect.getOpenHeight())); aValue <<= aSize; } } @@ -1105,7 +1105,7 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const& SwFormatFrameSize aSize(pFormat->GetFrameSize()); if (!aRect.IsEmpty()) { - aSize.SetHeight(aRect.getHeight()); + aSize.SetHeight(aRect.getOpenHeight()); aTextBoxSet.Put(aSize); } } @@ -1159,8 +1159,8 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const& aTextBoxSet.Put(aHoriOrient); } - aSize.SetWidth(aRect.getWidth()); - aSize.SetHeight(aRect.getHeight()); + aSize.SetWidth(aRect.getOpenWidth()); + aSize.SetHeight(aRect.getOpenHeight()); aTextBoxSet.Put(aSize); } } diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index b2b7239db0e9..f082e456b5f2 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -945,8 +945,8 @@ void SwVirtFlyDrawObj::NbcCrop(const basegfx::B2DPoint& rRef, double fxFact, dou // Create the new TopLeft of the unrotated, cropped object by creating // as if re-creating the unrotated geometry aNewTopLeft = Point( - basegfx::fround(aRotNewCenter.getX() - (0.5 * aNewRect.getWidth())), - basegfx::fround(aRotNewCenter.getY() - (0.5 * aNewRect.getHeight()))); + basegfx::fround(aRotNewCenter.getX() - (0.5 * aNewRect.getOpenWidth())), + basegfx::fround(aRotNewCenter.getY() - (0.5 * aNewRect.getOpenHeight()))); } // check if we have movement and execute if yes diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 0e27a89d8516..00d6db3dc16f 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -934,9 +934,9 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma const tools::Rectangle& rSnapRect = pObject->GetSnapRect(); aFrameSize.emplace(); aFrameSize->SetWidthSizeType(SwFrameSize::Fixed); - aFrameSize->SetWidth(rSnapRect.getWidth()); + aFrameSize->SetWidth(rSnapRect.getOpenWidth()); aFrameSize->SetHeightSizeType(SwFrameSize::Fixed); - aFrameSize->SetHeight(rSnapRect.getHeight()); + aFrameSize->SetHeight(rSnapRect.getOpenHeight()); pFSItem = &*aFrameSize; } if( (nFrameOptions & HtmlFrmOpts::Size) && diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index c3c5b742e1ed..c3524d3c74d3 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -158,8 +158,8 @@ void lcl_calculateMSOBaseRectangle(const SdrObject& rObj, double& rfMSOLeft, dou // directly usable as 'base rectangle'. double fCenterX = (rObj.GetSnapRect().Left() + rObj.GetSnapRect().Right()) / 2.0; double fCenterY = (rObj.GetSnapRect().Top() + rObj.GetSnapRect().Bottom()) / 2.0; - double fHalfWidth = rObj.GetLogicRect().getWidth() / 2.0; - double fHalfHeight = rObj.GetLogicRect().getHeight() / 2.0; + double fHalfWidth = rObj.GetLogicRect().getOpenWidth() / 2.0; + double fHalfHeight = rObj.GetLogicRect().getOpenHeight() / 2.0; // MSO swaps width and height depending on rotation angle; exception: Word 2007 (vers 12) never // swaps width and height for images. @@ -334,9 +334,9 @@ tools::Polygon lcl_CreateContourPolygon(SdrObject* pSdrObj) basegfx::B2DHomMatrix aTranslateToOrigin( basegfx::utils::createTranslateB2DHomMatrix(-aCenter.X(), -aCenter.Y())); aPolyPolygon.transform(aTranslateToOrigin); - const double fWidth(pSdrObj->GetLogicRect().getWidth()); + const double fWidth(pSdrObj->GetLogicRect().getOpenWidth()); double fScaleX = fWidth == 0.0 ? 1.0 : 21600.0 / fWidth; - const double fHeight(pSdrObj->GetLogicRect().getHeight()); + const double fHeight(pSdrObj->GetLogicRect().getOpenHeight()); double fScaleY = fHeight == 0.0 ? 1.0 : 21600.0 / fHeight; basegfx::B2DHomMatrix aScale(basegfx::utils::createScaleB2DHomMatrix(fScaleX, fScaleY)); aPolyPolygon.transform(aScale); @@ -386,9 +386,9 @@ tools::Polygon lcl_CreateContourPolygon(SdrObject* pSdrObj) basegfx::utils::createTranslateB2DHomMatrix(-aCenter.X(), -aCenter.Y())); aPolyPolygon.transform(aTranslateToOrigin); - const double fWidth(pSdrObj->GetLogicRect().getWidth()); + const double fWidth(pSdrObj->GetLogicRect().getOpenWidth()); double fScaleX = fWidth == 0.0 ? 1.0 : 21600.0 / fWidth; - const double fHeight(pSdrObj->GetLogicRect().getHeight()); + const double fHeight(pSdrObj->GetLogicRect().getOpenHeight()); double fScaleY = fHeight == 0.0 ? 1.0 : 21600.0 / fHeight; basegfx::B2DHomMatrix aScale( basegfx::utils::createScaleB2DHomMatrix(fScaleX, fScaleY)); @@ -1384,7 +1384,8 @@ void DocxSdrExport::writeDMLDrawing(const SdrObject* pSdrObject, const SwFrameFo m_pImpl->getExport().DocxAttrOutput().GetSdtEndBefore(pSdrObject); sax_fastparser::FSHelperPtr pFS = m_pImpl->getSerializer(); - Size aSize(pSdrObject->GetLogicRect().getWidth(), pSdrObject->GetLogicRect().getHeight()); + Size aSize(pSdrObject->GetLogicRect().getOpenWidth(), + pSdrObject->GetLogicRect().getOpenHeight()); startDMLAnchorInline(pFrameFormat, aSize); rtl::Reference pDocPrAttrList @@ -1665,7 +1666,7 @@ void DocxSdrExport::writeDiagram(const SdrObject* sdrObject, const SwFrameFormat uno::UNO_QUERY); // write necessary tags to document.xml - Size aSize(sdrObject->GetSnapRect().getWidth(), sdrObject->GetSnapRect().getHeight()); + Size aSize(sdrObject->GetSnapRect().getOpenWidth(), sdrObject->GetSnapRect().getOpenHeight()); startDMLAnchorInline(&rFrameFormat, aSize); m_pImpl->getDrawingML()->SetFS(m_pImpl->getSerializer()); diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index d2de899f2d3d..bcfc410ffb6e 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -676,8 +676,8 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const const bool bAllowSwap = pObj->GetObjIdentifier() != SdrObjKind::Line && pObj->GetObjIdentifier() != SdrObjKind::Group; if ( bAllowSwap && (( nAngle > 4500_deg100 && nAngle <= 13500_deg100 ) || ( nAngle > 22500_deg100 && nAngle <= 31500_deg100 )) ) { - const tools::Long nWidth = aRect.getWidth(); - const tools::Long nHeight = aRect.getHeight(); + const tools::Long nWidth = aRect.getOpenWidth(); + const tools::Long nHeight = aRect.getOpenHeight(); aRect.setWidth( nHeight ); aRect.setHeight( nWidth ); bHasHeightWidthSwapped = true; @@ -749,10 +749,10 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const { SwTwips nXOff; SwTwips nYOff; - SwTwips nSnapWidth = pObj->GetSnapRect().getWidth(); - SwTwips nSnapHeight = pObj->GetSnapRect().getHeight(); - SwTwips nLogicWidth = pObj->GetLogicRect().getWidth(); - SwTwips nLogicHeight = pObj->GetLogicRect().getHeight(); + SwTwips nSnapWidth = pObj->GetSnapRect().getOpenWidth(); + SwTwips nSnapHeight = pObj->GetSnapRect().getOpenHeight(); + SwTwips nLogicWidth = pObj->GetLogicRect().getOpenWidth(); + SwTwips nLogicHeight = pObj->GetLogicRect().getOpenHeight(); // +1 for to compensate integer arithmetic rounding errors if(bHasHeightWidthSwapped) { diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx index 85d3da00f529..cca26f41e78c 100644 --- a/sw/source/uibase/docvw/HeaderFooterWin.cxx +++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx @@ -323,7 +323,7 @@ void SwHeaderFooterWin::PaintButton() // Create the 'plus' or 'arrow' primitive B2DRectangle aSignArea(B2DPoint(aRect.Right() - BUTTON_WIDTH, 0.0), - B2DSize(aRect.Right(), aRect.getHeight())); + B2DSize(aRect.Right(), aRect.getOpenHeight())); B2DPolygon aSign; bool bIsEmptyHeaderFooter = IsEmptyHeaderFooter(); diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx index 103503d55efc..7356ea31f727 100644 --- a/sw/source/uibase/docvw/PageBreakWin.cxx +++ b/sw/source/uibase/docvw/PageBreakWin.cxx @@ -211,9 +211,9 @@ void SwPageBreakWin::PaintButton() aSeq[2].set(new drawinglayer::primitive2d::DiscreteBitmapPrimitive2D( aBmpEx, B2DPoint(nImgOfstX, 1.0))); - double nTop = double(aRect.getHeight()) / 2.0; + double nTop = double(aRect.getOpenHeight()) / 2.0; double nBottom = nTop + 4.0; - double nLeft = aRect.getWidth() - ARROW_WIDTH - 6.0; + double nLeft = aRect.getOpenWidth() - ARROW_WIDTH - 6.0; if (bRtl) nLeft = ARROW_WIDTH - 2.0; double nRight = nLeft + 8.0; -- cgit v1.2.3