sc/source/ui/Accessibility/AccessiblePreviewCell.cxx | 4 +-- sc/source/ui/inc/prevloc.hxx | 2 - sc/source/ui/view/preview.cxx | 12 ++++++---- sc/source/ui/view/prevloc.cxx | 22 ++++++++----------- 4 files changed, 20 insertions(+), 20 deletions(-)
New commits: commit 3dd3fff576e6f7505e76e01399177fbff43441ac Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Jun 4 17:56:51 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu Jun 5 07:29:22 2025 +0200 sc preview: Use return value instead of out param Change-Id: Id25f5086fcbb87f35955cdd77d2a418f31276717 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186198 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx index 12b553ea56b0..6e49a19981c3 100644 --- a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx +++ b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx @@ -196,7 +196,7 @@ AbsoluteScreenPixelRectangle ScAccessiblePreviewCell::GetBoundingBoxOnScreen() tools::Rectangle aCellRect; if (mpViewShell) { - mpViewShell->GetLocationData().GetCellPosition( maCellAddress, aCellRect ); + aCellRect = mpViewShell->GetLocationData().GetCellPosition(maCellAddress); vcl::Window* pWindow = mpViewShell->GetWindow(); if (pWindow) { @@ -212,7 +212,7 @@ tools::Rectangle ScAccessiblePreviewCell::GetBoundingBox() tools::Rectangle aCellRect; if (mpViewShell) { - mpViewShell->GetLocationData().GetCellPosition( maCellAddress, aCellRect ); + aCellRect = mpViewShell->GetLocationData().GetCellPosition(maCellAddress); uno::Reference<XAccessible> xAccParent = getAccessibleParent(); if (xAccParent.is()) { diff --git a/sc/source/ui/inc/prevloc.hxx b/sc/source/ui/inc/prevloc.hxx index 17a7353b7bb1..fb3a5ea5722b 100644 --- a/sc/source/ui/inc/prevloc.hxx +++ b/sc/source/ui/inc/prevloc.hxx @@ -136,7 +136,7 @@ public: // Check if any cells (including column/row headers) are in the visible area bool HasCellsInRange( const tools::Rectangle& rVisiblePixel ) const; - void GetCellPosition( const ScAddress& rCellPos, tools::Rectangle& rCellRect ) const; + tools::Rectangle GetCellPosition(const ScAddress& rCellPos) const; // returns the rectangle where the EditEngine draws the text of a Header Cell // if bColHeader is true it returns the rectangle of the header of the column in rCellPos diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index b8c9467b0df0..4b351c34a6f6 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -418,24 +418,26 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) mvRight.resize(aPageArea.aEnd.Col()+1); if( !bLayoutRTL ) { - pLocationData->GetCellPosition( aPageArea.aStart, aRectPosition ); + aRectPosition = pLocationData->GetCellPosition(aPageArea.aStart); nLeftPosition = aRectPosition.Left(); for( SCCOL i = aPageArea.aStart.Col(); i <= aPageArea.aEnd.Col(); i++ ) { - pLocationData->GetCellPosition( ScAddress( i,aPageArea.aStart.Row(),aPageArea.aStart.Tab()),aRectCellPosition ); + aRectCellPosition = pLocationData->GetCellPosition( + ScAddress(i, aPageArea.aStart.Row(), aPageArea.aStart.Tab())); mvRight[i] = aRectCellPosition.Right(); } } else { - pLocationData->GetCellPosition( aPageArea.aEnd, aRectPosition ); + aRectPosition = pLocationData->GetCellPosition(aPageArea.aEnd); nLeftPosition = aRectPosition.Right()+1; - pLocationData->GetCellPosition( aPageArea.aStart,aRectCellPosition ); + aRectCellPosition = pLocationData->GetCellPosition(aPageArea.aStart); mvRight[ aPageArea.aEnd.Col() ] = aRectCellPosition.Left(); for( SCCOL i = aPageArea.aEnd.Col(); i > aPageArea.aStart.Col(); i-- ) { - pLocationData->GetCellPosition( ScAddress( i,aPageArea.aEnd.Row(),aPageArea.aEnd.Tab()),aRectCellPosition ); + aRectCellPosition = pLocationData->GetCellPosition( + ScAddress(i, aPageArea.aEnd.Row(), aPageArea.aEnd.Tab())); mvRight[ i-1 ] = mvRight[ i ] + aRectCellPosition.Right() - aRectCellPosition.Left() + 1; } } diff --git a/sc/source/ui/view/prevloc.cxx b/sc/source/ui/view/prevloc.cxx index 1e2375ab5c07..82fc9257f805 100644 --- a/sc/source/ui/view/prevloc.cxx +++ b/sc/source/ui/view/prevloc.cxx @@ -306,17 +306,17 @@ tools::Rectangle ScPreviewLocationData::GetOffsetPixel( const ScAddress& rCellPo return tools::Rectangle( Point( aOffsetPixel.Width(), aOffsetPixel.Height() ), aSizePixel ); } -void ScPreviewLocationData::GetCellPosition( const ScAddress& rCellPos, tools::Rectangle& rCellRect ) const +tools::Rectangle ScPreviewLocationData::GetCellPosition(const ScAddress& rCellPos) const { ScPreviewLocationEntry* pEntry = lcl_GetEntryByAddress( m_Entries, rCellPos, SC_PLOC_CELLRANGE ); - if ( pEntry ) - { - tools::Rectangle aOffsetRect = GetOffsetPixel( rCellPos, pEntry->aCellRange ); - rCellRect = tools::Rectangle( aOffsetRect.Left() + pEntry->aPixelRect.Left(), - aOffsetRect.Top() + pEntry->aPixelRect.Top(), - aOffsetRect.Right() + pEntry->aPixelRect.Left(), - aOffsetRect.Bottom() + pEntry->aPixelRect.Top() ); - } + if (!pEntry) + return tools::Rectangle(); + + tools::Rectangle aOffsetRect = GetOffsetPixel(rCellPos, pEntry->aCellRange); + return tools::Rectangle(aOffsetRect.Left() + pEntry->aPixelRect.Left(), + aOffsetRect.Top() + pEntry->aPixelRect.Top(), + aOffsetRect.Right() + pEntry->aPixelRect.Left(), + aOffsetRect.Bottom() + pEntry->aPixelRect.Top()); } bool ScPreviewLocationData::HasCellsInRange( const tools::Rectangle& rVisiblePixel ) const @@ -693,9 +693,7 @@ tools::Rectangle ScPreviewLocationData::GetCellOutputRect(const ScAddress& rCell { // first a stupid implementation // NN says here should be done more - tools::Rectangle aRect; - GetCellPosition(rCellPos, aRect); - return aRect; + return GetCellPosition(rCellPos); } // GetMainCellRange is used for links in PDF export