diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2022-06-29 00:06:03 +1000 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2022-07-11 11:06:53 +0200 |
commit | 934985becc567114c3f38a72322056a628aad7c9 (patch) | |
tree | 54530473a4d3a0a5876aff68b3727d51fa4dc88d /reportdesign | |
parent | a19e01812b60580c656cf31619e212803e2ca0fa (diff) |
tools: rename getHeight/Width() to GetOpenHeight/Width()
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 <quikee@gmail.com>
Diffstat (limited to 'reportdesign')
-rw-r--r-- | reportdesign/source/core/sdr/RptObject.cxx | 4 | ||||
-rw-r--r-- | reportdesign/source/ui/misc/UITools.cxx | 6 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ReportController.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ReportSection.cxx | 18 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ViewsWindow.cxx | 36 |
5 files changed, 33 insertions, 33 deletions
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx index 4c90a556e810..8081e4fa4c00 100644 --- a/reportdesign/source/core/sdr/RptObject.cxx +++ b/reportdesign/source/core/sdr/RptObject.cxx @@ -389,8 +389,8 @@ void OObjectBase::SetPropsFromRect(const tools::Rectangle& _rRect) if ( pPage && !_rRect.IsEmpty() ) { const uno::Reference<report::XSection>& xSection = pPage->getSection(); - assert(_rRect.getHeight() >= 0); - const sal_uInt32 newHeight( ::std::max(tools::Long(0), _rRect.getHeight()+_rRect.Top()) ); + assert(_rRect.getOpenHeight() >= 0); + const sal_uInt32 newHeight( ::std::max(tools::Long(0), _rRect.getOpenHeight()+_rRect.Top()) ); if ( xSection.is() && ( newHeight > xSection->getHeight() ) ) xSection->setHeight( newHeight ); diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index 87062e35c6f6..2eec8fe9fa2a 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -957,8 +957,8 @@ tools::Rectangle getRectangleFromControl(SdrObject* _pControl) if (xComponent.is()) { tools::Rectangle aRect(VCLPoint(xComponent->getPosition()),VCLSize(xComponent->getSize())); - aRect.setHeight(aRect.getHeight() + 1); - aRect.setWidth(aRect.getWidth() + 1); + aRect.setHeight(aRect.getOpenHeight() + 1); + aRect.setWidth(aRect.getOpenWidth() + 1); return aRect; } } @@ -980,7 +980,7 @@ void correctOverlapping(SdrObject* _pControl,OReportSection const & _aReportSect if ( bOverlapping ) { const tools::Rectangle& aLogicRect = pOverlappedObj->GetLogicRect(); - aRect.Move(0,aLogicRect.Top() + aLogicRect.getHeight() - aRect.Top()); + aRect.Move(0,aLogicRect.Top() + aLogicRect.getOpenHeight() - aRect.Top()); xComponent->setPositionY(aRect.Top()); } } diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 7c588a99791c..b53cfad7b87f 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -3579,7 +3579,7 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs) if ( bOverlapping ) { const tools::Rectangle& aLogicRect = pOverlappedObj->GetLogicRect(); - aLabelAndTextfield.Move(0,aLogicRect.Top() + aLogicRect.getHeight() - aLabelAndTextfield.Top()); + aLabelAndTextfield.Move(0,aLogicRect.Top() + aLogicRect.getOpenHeight() - aLabelAndTextfield.Top()); bHasToMove = true; } } diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx index ebbbad48c2e9..ca62459ddb30 100644 --- a/reportdesign/source/ui/report/ReportSection.cxx +++ b/reportdesign/source/ui/report/ReportSection.cxx @@ -255,22 +255,22 @@ void OReportSection::Paste(const uno::Sequence< beans::NamedValue >& _aAllreadyC SdrObject* pNewObj(pObject->CloneSdrObject(*m_pModel)); m_pPage->InsertObject(pNewObj, SAL_MAX_SIZE); tools::Rectangle aRet(VCLPoint(rCopy->getPosition()),VCLSize(rCopy->getSize())); - aRet.setHeight(aRet.getHeight() + 1); - aRet.setWidth(aRet.getWidth() + 1); + aRet.setHeight(aRet.getOpenHeight() + 1); + aRet.setWidth(aRet.getOpenWidth() + 1); bool bOverlapping = true; while ( bOverlapping ) { bOverlapping = isOver(aRet,*m_pPage,*m_pView,true,pNewObj) != nullptr; if ( bOverlapping ) { - aRet.Move(0,aRet.getHeight()+1); + aRet.Move(0,aRet.getOpenHeight()+1); pNewObj->SetLogicRect(aRet); } } m_pView->AddUndo( m_pView->GetModel()->GetSdrUndoFactory().CreateUndoNewObject( *pNewObj ) ); m_pView->MarkObj( pNewObj, m_pView->GetSdrPageView() ); - if ( m_xSection.is() && (o3tl::make_unsigned(aRet.getHeight() + aRet.Top()) > m_xSection->getHeight()) ) - m_xSection->setHeight(aRet.getHeight() + aRet.Top()); + if ( m_xSection.is() && (o3tl::make_unsigned(aRet.getOpenHeight() + aRet.Top()) > m_xSection->getHeight()) ) + m_xSection->setHeight(aRet.getOpenHeight() + aRet.Top()); } } } @@ -538,10 +538,10 @@ void OReportSection::impl_adjustObjectSizePosition(sal_Int32 i_nPaperWidth,sal_I xReportComponent->setPosition(aPos); correctOverlapping(pObject,*this,false); tools::Rectangle aRet(VCLPoint(xReportComponent->getPosition()),VCLSize(xReportComponent->getSize())); - aRet.setHeight(aRet.getHeight() + 1); - aRet.setWidth(aRet.getWidth() + 1); - if ( m_xSection.is() && (o3tl::make_unsigned(aRet.getHeight() + aRet.Top()) > m_xSection->getHeight()) ) - m_xSection->setHeight(aRet.getHeight() + aRet.Top()); + aRet.setHeight(aRet.getOpenHeight() + 1); + aRet.setWidth(aRet.getOpenWidth() + 1); + if ( m_xSection.is() && (o3tl::make_unsigned(aRet.getOpenHeight() + aRet.Top()) > m_xSection->getHeight()) ) + m_xSection->setHeight(aRet.getOpenHeight() + aRet.Top()); pObject->RecalcBoundRect(); } diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index b5ce7a48fe60..9dfec8d91574 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -100,14 +100,14 @@ static bool lcl_getNewRectSize(const tools::Rectangle& _aObjRect,tools::Long& _n break; case ControlModification::CENTER_HORIZONTAL: if ( _aObjRect.Left() < aOverlappingRect.Left() ) - nXTemp += aOverlappingRect.Left() - aNewRect.Left() - aNewRect.getWidth(); + nXTemp += aOverlappingRect.Left() - aNewRect.Left() - aNewRect.getOpenWidth(); else nXTemp += aOverlappingRect.Right() - aNewRect.Left(); bMoveAllowed = _nXMov != nXTemp; break; case ControlModification::CENTER_VERTICAL: if ( _aObjRect.Top() < aOverlappingRect.Top() ) - nYTemp += aOverlappingRect.Top() - aNewRect.Top() - aNewRect.getHeight(); + nYTemp += aOverlappingRect.Top() - aNewRect.Top() - aNewRect.getOpenHeight(); else nYTemp += aOverlappingRect.Bottom() - aNewRect.Top(); bMoveAllowed = _nYMov != nYTemp; @@ -140,9 +140,9 @@ static bool lcl_getNewRectSize(const tools::Rectangle& _aObjRect,tools::Long& _n aNewRect.SetTop( aIntersectionRect.Bottom() ); } } - nYTemp = aNewRect.getHeight(); + nYTemp = aNewRect.getOpenHeight(); bMoveAllowed = _nYMov != nYTemp; - nXTemp = aNewRect.getWidth(); + nXTemp = aNewRect.getOpenWidth(); bMoveAllowed = bMoveAllowed && _nXMov != nXTemp; } } @@ -651,19 +651,19 @@ void OViewsWindow::collectBoundResizeRect(const TRectangleMap& _rSortRectangles, switch(_nControlModification) { case ControlModification::WIDTH_SMALLEST: - if ( _rResize.getWidth() > aObjRect.getWidth() ) + if ( _rResize.getOpenWidth() > aObjRect.getOpenWidth() ) _rResize = aObjRect; break; case ControlModification::HEIGHT_SMALLEST: - if ( _rResize.getHeight() > aObjRect.getHeight() ) + if ( _rResize.getOpenHeight() > aObjRect.getOpenHeight() ) _rResize = aObjRect; break; case ControlModification::WIDTH_GREATEST: - if ( _rResize.getWidth() < aObjRect.getWidth() ) + if ( _rResize.getOpenWidth() < aObjRect.getOpenWidth() ) _rResize = aObjRect; break; case ControlModification::HEIGHT_GREATEST: - if ( _rResize.getHeight() < aObjRect.getHeight() ) + if ( _rResize.getOpenHeight() < aObjRect.getOpenHeight() ) _rResize = aObjRect; break; default: break; @@ -824,16 +824,16 @@ void OViewsWindow::alignMarkedObjects(ControlModification _nControlModification, // resizing control if ( !aResize.IsEmpty() && aObjRect != aResize ) { - nXMov = aResize.getWidth(); - nYMov = aResize.getHeight(); + nXMov = aResize.getOpenWidth(); + nYMov = aResize.getOpenHeight(); switch(_nControlModification) { case ControlModification::WIDTH_GREATEST: case ControlModification::HEIGHT_GREATEST: if ( _nControlModification == ControlModification::HEIGHT_GREATEST ) - nXMov = aObjRect.getWidth(); + nXMov = aObjRect.getOpenWidth(); else if ( _nControlModification == ControlModification::WIDTH_GREATEST ) - nYMov = aObjRect.getHeight(); + nYMov = aObjRect.getOpenHeight(); lcl_getNewRectSize(aObjRect,nXMov,nYMov,pObj,pView,_nControlModification); [[fallthrough]]; case ControlModification::WIDTH_SMALLEST: @@ -845,9 +845,9 @@ void OViewsWindow::alignMarkedObjects(ControlModification _nControlModification, if ( pObjBase ) { if ( _nControlModification == ControlModification::WIDTH_SMALLEST || _nControlModification == ControlModification::WIDTH_GREATEST ) - pObjBase->getReportComponent()->setSize(awt::Size(nXMov,aObjRect.getHeight())); + pObjBase->getReportComponent()->setSize(awt::Size(nXMov,aObjRect.getOpenHeight())); else if ( _nControlModification == ControlModification::HEIGHT_GREATEST || _nControlModification == ControlModification::HEIGHT_SMALLEST ) - pObjBase->getReportComponent()->setSize(awt::Size(aObjRect.getWidth(),nYMov)); + pObjBase->getReportComponent()->setSize(awt::Size(aObjRect.getOpenWidth(),nYMov)); } } break; @@ -1463,7 +1463,7 @@ void OViewsWindow::handleKey(const vcl::KeyCode& _rCode) if ( nCode == KEY_UP ) { aPos.setX( aMarkRect.Left() ); - aPos.setY( aOver.Top() - aMarkRect.getHeight() ); + aPos.setY( aOver.Top() - aMarkRect.getOpenHeight() ); nY += (aPos.Y() - aMarkRect.Top()); } else if ( nCode == KEY_DOWN ) @@ -1474,7 +1474,7 @@ void OViewsWindow::handleKey(const vcl::KeyCode& _rCode) } else if ( nCode == KEY_LEFT ) { - aPos.setX( aOver.Left() - aMarkRect.getWidth() ); + aPos.setX( aOver.Left() - aMarkRect.getOpenWidth() ); aPos.setY( aMarkRect.Top() ); nX += (aPos.X() - aMarkRect.Left()); } @@ -1553,8 +1553,8 @@ void OViewsWindow::handleKey(const vcl::KeyCode& _rCode) case SdrHdlKind::Right: case SdrHdlKind::LowerRight: case SdrHdlKind::Lower: - aNewRect.setWidth(aNewRect.getWidth() + nX); - aNewRect.setHeight(aNewRect.getHeight() + nY); + aNewRect.setWidth(aNewRect.getOpenWidth() + nX); + aNewRect.setHeight(aNewRect.getOpenHeight() + nY); break; default: break; |