diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-03-03 10:57:21 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-03-03 22:37:35 +0100 |
commit | f92e15bc09def64a718b52812a9cb39e43fb8b5b (patch) | |
tree | 5448da27a291b2bd240f033facd0fb81322e5e15 /sc | |
parent | dd6ff950cbc570a11100a7cce69d51577a26bbd7 (diff) |
improve ScMark* classes a bit
Bin pointless empty destructors, make trivial functions inline,
return value by simply returning it.
Change-Id: Ia71e73262802bbe6b022ca4bafb2b958ffdf39f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130915
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sc')
39 files changed, 90 insertions, 234 deletions
diff --git a/sc/inc/markarr.hxx b/sc/inc/markarr.hxx index de0b3361cfab..03e94b7d302b 100644 --- a/sc/inc/markarr.hxx +++ b/sc/inc/markarr.hxx @@ -52,7 +52,6 @@ public: ScMarkArray( const ScSheetLimits& rLimits ); ScMarkArray( ScMarkArray&& rArray ) noexcept; ScMarkArray( const ScMarkArray& rArray ); - ~ScMarkArray(); void Reset( bool bMarked = false, SCSIZE nNeeded = 1 ); bool GetMark( SCROW nRow ) const; void SetMarkArea( SCROW nStartRow, SCROW nEndRow, bool bMarked ); @@ -82,7 +81,6 @@ class SC_DLLPUBLIC ScMarkArrayIter // iterate over selected range SCSIZE nPos; public: ScMarkArrayIter( const ScMarkArray* pNewArray ); - ~ScMarkArrayIter(); bool Next( SCROW& rTop, SCROW& rBottom ); void reset( const ScMarkArray* pNewArray ); diff --git a/sc/inc/markdata.hxx b/sc/inc/markdata.hxx index 69a7acfde8ab..6c2969e6e50a 100644 --- a/sc/inc/markdata.hxx +++ b/sc/inc/markdata.hxx @@ -67,7 +67,6 @@ public: ScMarkData(ScMarkData&& rData) = default; ScMarkData& operator=(const ScMarkData& rData); ScMarkData& operator=(ScMarkData&& rData); - ~ScMarkData(); void ResetMark(); void SetMarkArea( const ScRange& rRange ); @@ -81,8 +80,8 @@ public: bool IsMarked() const { return bMarked; } bool IsMultiMarked() const { return bMultiMarked; } - void GetMarkArea( ScRange& rRange ) const; - void GetMultiMarkArea( ScRange& rRange ) const; + const ScRange& GetMarkArea() const { return aMarkRange; } + const ScRange& GetMultiMarkArea() const { return aMultiRange; } void SetAreaTab( SCTAB nTab ); @@ -104,7 +103,7 @@ public: // for FillInfo / Document etc. const ScMultiSel& GetMultiSelData() const { return aMultiSel; } - ScMarkArray GetMarkArray( SCCOL nCol ) const; + ScMarkArray GetMarkArray( SCCOL nCol ) const { return aMultiSel.GetMarkArray( nCol ); } bool IsCellMarked( SCCOL nCol, SCROW nRow, bool bNoSimple = false ) const; @@ -157,11 +156,11 @@ public: typedef std::set<SCTAB>::iterator iterator; typedef std::set<SCTAB>::const_iterator const_iterator; typedef std::set<SCTAB>::const_reverse_iterator const_reverse_iterator; - iterator begin(); - iterator end(); - const_iterator begin() const; - const_iterator end() const; - const_reverse_iterator rbegin() const; + iterator begin() { return maTabMarked.begin(); } + iterator end() { return maTabMarked.end(); } + const_iterator begin() const { return maTabMarked.begin(); } + const_iterator end() const { return maTabMarked.end(); } + const_reverse_iterator rbegin() const { return maTabMarked.rbegin(); } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/markmulti.hxx b/sc/inc/markmulti.hxx index 0ddc6530a50c..bb028e14a7a8 100644 --- a/sc/inc/markmulti.hxx +++ b/sc/inc/markmulti.hxx @@ -41,7 +41,6 @@ public: ScMultiSel(ScSheetLimits const &); ScMultiSel(const ScMultiSel& rMultiSel) = default; ScMultiSel(ScMultiSel&& rMultiSel) = default; - ~ScMultiSel(); ScMultiSel& operator=(const ScMultiSel& rMultiSel); ScMultiSel& operator=(ScMultiSel&& rMultiSel); @@ -67,7 +66,7 @@ public: // For faster access from within ScMarkData, instead of creating // ScMultiSelIter with ScFlatBoolRowSegments bottleneck. - const ScMarkArray& GetRowSelArray() const; + const ScMarkArray& GetRowSelArray() const { return aRowSel; } const ScMarkArray* GetMultiSelArray( SCCOL nCol ) const; }; @@ -80,7 +79,6 @@ private: SCROW nNextSegmentStart; public: ScMultiSelIter( const ScMultiSel& rMultiSel, SCCOL nCol ); - ~ScMultiSelIter(); bool Next( SCROW& rTop, SCROW& rBottom ); /** Only to be used by ScMultiSel::IsAllMarked() or otherwise sure that a diff --git a/sc/qa/extras/vba-macro-test.cxx b/sc/qa/extras/vba-macro-test.cxx index a611e9f5cc08..bd2ebe1702e4 100644 --- a/sc/qa/extras/vba-macro-test.cxx +++ b/sc/qa/extras/vba-macro-test.cxx @@ -303,12 +303,7 @@ void VBAMacroTest::testSelectAllChaged() ScTabViewShell* pView = pDocSh->GetBestViewShell(false); CPPUNIT_ASSERT(pView != nullptr); auto const& pViewData = pView->GetViewData(); - - { - ScRange aRange; - pViewData.GetMarkData().GetMarkArea(aRange); - CPPUNIT_ASSERT_EQUAL(ScRange(), aRange); - } + CPPUNIT_ASSERT_EQUAL(ScRange(), pViewData.GetMarkData().GetMarkArea()); uno::Any aRet; uno::Sequence<sal_Int16> aOutParamIndex; @@ -320,12 +315,8 @@ void VBAMacroTest::testSelectAllChaged() "language=Basic&location=document", aParams, aRet, aOutParamIndex, aOutParam); - { - ScRange aRange; - pViewData.GetMarkData().GetMarkArea(aRange); - // A1:E1048576 - CPPUNIT_ASSERT_EQUAL(ScRange(0, 0, 0, 4, MAXROW, 0), aRange); - } + // A1:E1048576 + CPPUNIT_ASSERT_EQUAL(ScRange(0, 0, 0, 4, MAXROW, 0), pViewData.GetMarkData().GetMarkArea()); } void VBAMacroTest::testRangeSelect() @@ -344,12 +335,7 @@ void VBAMacroTest::testRangeSelect() ScTabViewShell* pView = pDocSh->GetBestViewShell(false); CPPUNIT_ASSERT(pView != nullptr); auto const& pViewData = pView->GetViewData(); - - { - ScRange aRange; - pViewData.GetMarkData().GetMarkArea(aRange); - CPPUNIT_ASSERT_EQUAL(ScRange(), aRange); - } + CPPUNIT_ASSERT_EQUAL(ScRange(), pViewData.GetMarkData().GetMarkArea()); uno::Any aRet; uno::Sequence<sal_Int16> aOutParamIndex; @@ -361,12 +347,8 @@ void VBAMacroTest::testRangeSelect() "language=Basic&location=document", aParams, aRet, aOutParamIndex, aOutParam); - { - ScRange aRange; - pViewData.GetMarkData().GetMarkArea(aRange); - // B2:E5 - CPPUNIT_ASSERT_EQUAL(ScRange(1, 1, 0, 4, 1, 0), aRange); - } + // B2:E5 + CPPUNIT_ASSERT_EQUAL(ScRange(1, 1, 0, 4, 1, 0), pViewData.GetMarkData().GetMarkArea()); } void VBAMacroTest::testWindowState() diff --git a/sc/qa/unit/mark_test.cxx b/sc/qa/unit/mark_test.cxx index 91b7af0e54b3..309a62143aff 100644 --- a/sc/qa/unit/mark_test.cxx +++ b/sc/qa/unit/mark_test.cxx @@ -155,9 +155,7 @@ void Test::testSimpleMark( const ScRange& rRange, const ScRange& rSelectionCover CPPUNIT_ASSERT( aMark.IsMarked() ); CPPUNIT_ASSERT( !aMark.IsMultiMarked() ); - ScRange aRangeResult; - aMark.GetMarkArea( aRangeResult ); - CPPUNIT_ASSERT_EQUAL( rRange, aRangeResult ); + CPPUNIT_ASSERT_EQUAL( rRange, aMark.GetMarkArea() ); SCROW nMidRow = ( rRange.aStart.Row() + rRange.aEnd.Row() ) / 2; SCCOL nMidCol = ( rRange.aStart.Col() + rRange.aEnd.Col() ) / 2; diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 1c091b2a767d..5b6cb6d0d824 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -482,8 +482,7 @@ void ScColumn::ClearSelectionItems( const sal_uInt16* pWhich,const ScMarkData& r } else if (rMark.IsMarked()) { - ScRange aRange; - rMark.GetMarkArea(aRange); + const ScRange& aRange = rMark.GetMarkArea(); if (aRange.aStart.Col() <= nCol && nCol <= aRange.aEnd.Col()) { pAttrArray->ClearItems(aRange.aStart.Row(), aRange.aEnd.Row(), pWhich); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index fcae168d4f58..bf269ec860f7 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -1159,8 +1159,7 @@ void ScDocument::Fill(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScProg { PutInOrder( nCol1, nCol2 ); PutInOrder( nRow1, nRow2 ); - ScRange aRange; - rMark.GetMarkArea(aRange); + const ScRange& aRange = rMark.GetMarkArea(); SCTAB nMax = maTabs.size(); for (const auto& rTab : rMark) { diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index aaced69cc651..ae57d12033a9 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3046,8 +3046,7 @@ void ScDocument::CopyMultiRangeFromClip(const ScAddress& rDestPos, const ScMarkD sc::AutoCalcSwitch aACSwitch(*this, false); // turn of auto calc temporarily. NumFmtMergeHandler aNumFmtMergeHdl(*this, *pClipDoc); - ScRange aDestRange; - rMark.GetMarkArea(aDestRange); + const ScRange& aDestRange = rMark.GetMarkArea(); bInsertingFromOtherDoc = true; // No Broadcast/Listener created at Insert @@ -3339,8 +3338,7 @@ void ScDocument::FillTabMarked( SCTAB nSrcTab, const ScMarkData& rMark, bool bOldAutoCalc = GetAutoCalc(); SetAutoCalc( false ); // avoid multiple calculations - ScRange aArea; - rMark.GetMultiMarkArea( aArea ); + const ScRange& aArea = rMark.GetMultiMarkArea(); SCCOL nStartCol = aArea.aStart.Col(); SCROW nStartRow = aArea.aStart.Row(); SCCOL nEndCol = aArea.aEnd.Col(); @@ -4874,8 +4872,7 @@ void ScDocument::ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkDat // ApplySelectionStyle needs multi mark if ( rMark.IsMarked() && !rMark.IsMultiMarked() ) { - ScRange aRange; - rMark.GetMarkArea( aRange ); + const ScRange& aRange = rMark.GetMarkArea(); ApplyStyleArea( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), rMark, rStyle ); } @@ -4946,8 +4943,7 @@ const ScStyleSheet* ScDocument::GetSelectionStyle( const ScMarkData& rMark ) con } if ( rMark.IsMarked() ) { - ScRange aRange; - rMark.GetMarkArea( aRange ); + const ScRange& aRange = rMark.GetMarkArea(); for (SCTAB i=aRange.aStart.Tab(); i<=aRange.aEnd.Tab() && bEqual && i < static_cast<SCTAB>(maTabs.size()); i++) if (maTabs[i] && rMark.GetTableSelect(i)) { @@ -5078,8 +5074,7 @@ std::unique_ptr<ScPatternAttr> ScDocument::CreateSelectionPattern( const ScMarkD } if ( rMark.IsMarked() ) // single selection { - ScRange aRange; - rMark.GetMarkArea(aRange); + const ScRange& aRange = rMark.GetMarkArea(); SCTAB nMax = static_cast<SCTAB>(maTabs.size()); for (const auto& rTab : rMark) { @@ -5157,8 +5152,7 @@ void ScDocument::GetSelectionFrame( const ScMarkData& rMark, } else if( rMark.IsMarked() ) { - ScRange aRange; - rMark.GetMarkArea(aRange); + const ScRange& aRange = rMark.GetMarkArea(); rLineInner.EnableHor( aRange.aStart.Row() != aRange.aEnd.Row() ); rLineInner.EnableVer( aRange.aStart.Col() != aRange.aEnd.Col() ); SCTAB nMax = static_cast<SCTAB>(maTabs.size()); @@ -5367,8 +5361,7 @@ bool ScDocument::IsSelectionEditable( const ScMarkData& rMark, return false; } - ScRange aRange; - rMark.GetMarkArea(aRange); + const ScRange& aRange = rMark.GetMarkArea(); bool bOk = true; bool bMatrix = ( pOnlyNotBecauseOfMatrix != nullptr ); @@ -5894,8 +5887,7 @@ void ScDocument::ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMark // ApplySelectionCache needs multi mark if ( rMark.IsMarked() && !rMark.IsMultiMarked() ) { - ScRange aRange; - rMark.GetMarkArea( aRange ); + const ScRange& aRange = rMark.GetMarkArea(); ApplyPatternArea( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), rMark, rAttr, pDataArray, pIsChanged ); } diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 0c1aa0216581..bd4bd01b6f3e 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -1619,8 +1619,7 @@ void ScDrawLayer::DeleteObjectsInSelection( const ScMarkData& rMark ) if ( !rMark.IsMultiMarked() ) return; - ScRange aMarkRange; - rMark.GetMultiMarkArea( aMarkRange ); + const ScRange& aMarkRange = rMark.GetMultiMarkArea(); SCTAB nTabCount = pDoc->GetTableCount(); for (const SCTAB nTab : rMark) diff --git a/sc/source/core/data/markarr.cxx b/sc/source/core/data/markarr.cxx index 69379edbc742..9b93c32f2d42 100644 --- a/sc/source/core/data/markarr.cxx +++ b/sc/source/core/data/markarr.cxx @@ -42,10 +42,6 @@ ScMarkArray::ScMarkArray( const ScMarkArray & rOther ) operator=(rOther); } -ScMarkArray::~ScMarkArray() -{ -} - void ScMarkArray::Reset( bool bMarked, SCSIZE nNeeded ) { // always create pData here @@ -436,10 +432,6 @@ ScMarkArrayIter::ScMarkArrayIter( const ScMarkArray* pNewArray ) : { } -ScMarkArrayIter::~ScMarkArrayIter() -{ -} - void ScMarkArrayIter::reset( const ScMarkArray* pNewArray ) { pArray = pNewArray; diff --git a/sc/source/core/data/markdata.cxx b/sc/source/core/data/markdata.cxx index 65d1375d4c23..2b3f948d8803 100644 --- a/sc/source/core/data/markdata.cxx +++ b/sc/source/core/data/markdata.cxx @@ -42,10 +42,6 @@ ScMarkData::ScMarkData(const ScSheetLimits& rSheetLimits) : ResetMark(); } -ScMarkData::~ScMarkData() -{ -} - ScMarkData& ScMarkData::operator=(const ScMarkData& rOther) { maTabMarked = rOther.maTabMarked; @@ -108,16 +104,6 @@ void ScMarkData::SetMarkArea( const ScRange& rRange ) } } -void ScMarkData::GetMarkArea( ScRange& rRange ) const -{ - rRange = aMarkRange; //TODO: inline ? -} - -void ScMarkData::GetMultiMarkArea( ScRange& rRange ) const -{ - rRange = aMultiRange; -} - void ScMarkData::SetMultiMarkArea( const ScRange& rRange, bool bMark, bool bSetupMulti ) { if ( aMultiSel.IsEmpty() ) @@ -938,35 +924,4 @@ void ScMarkData::GetSelectionCover( ScRange& rRange ) } } -ScMarkArray ScMarkData::GetMarkArray( SCCOL nCol ) const -{ - return aMultiSel.GetMarkArray( nCol ); -} - -//iterators -ScMarkData::iterator ScMarkData::begin() -{ - return maTabMarked.begin(); -} - -ScMarkData::iterator ScMarkData::end() -{ - return maTabMarked.end(); -} - -ScMarkData::const_iterator ScMarkData::begin() const -{ - return maTabMarked.begin(); -} - -ScMarkData::const_iterator ScMarkData::end() const -{ - return maTabMarked.end(); -} - -ScMarkData::const_reverse_iterator ScMarkData::rbegin() const -{ - return maTabMarked.rbegin(); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/markmulti.cxx b/sc/source/core/data/markmulti.cxx index c2396821a597..dc0ebc528b06 100644 --- a/sc/source/core/data/markmulti.cxx +++ b/sc/source/core/data/markmulti.cxx @@ -30,10 +30,6 @@ ScMultiSel::ScMultiSel(const ScSheetLimits& rSheetLimits) { } -ScMultiSel::~ScMultiSel() -{ -} - ScMultiSel& ScMultiSel::operator=(const ScMultiSel& rOther) { aMultiSelContainer = rOther.aMultiSelContainer; @@ -394,11 +390,6 @@ void ScMultiSel::ShiftRows(SCROW nStartRow, sal_Int32 nRowOffset) aRowSel.Shift(nStartRow, nRowOffset); } -const ScMarkArray& ScMultiSel::GetRowSelArray() const -{ - return aRowSel; -} - const ScMarkArray* ScMultiSel::GetMultiSelArray( SCCOL nCol ) const { if (nCol >= static_cast<SCCOL>(aMultiSelContainer.size())) @@ -442,10 +433,6 @@ ScMultiSelIter::ScMultiSelIter( const ScMultiSel& rMultiSel, SCCOL nCol ) : } } -ScMultiSelIter::~ScMultiSelIter() -{ -} - bool ScMultiSelIter::Next( SCROW& rTop, SCROW& rBottom ) { if (pRowSegs) diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index fd26b42dbe04..ba7c18ad3722 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -1449,9 +1449,9 @@ void ScTable::GetNextPos( SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, { ScRange aRange( ScAddress::UNINITIALIZED); if (rMark.IsMarked()) - rMark.GetMarkArea( aRange); + aRange = rMark.GetMarkArea(); else if (rMark.IsMultiMarked()) - rMark.GetMultiMarkArea( aRange); + aRange = rMark.GetMultiMarkArea(); else { // Covered by assert() above, but for NDEBUG build. diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 9f237804f4e8..8c8bc4e21500 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -3062,9 +3062,9 @@ void ScTable::UpdateSelectionFunction( ScFunctionData& rData, const ScMarkData& ScRangeList aRanges = rMark.GetMarkedRangesForTab( nTab ); ScRange aMarkArea( ScAddress::UNINITIALIZED ); if (rMark.IsMultiMarked()) - rMark.GetMultiMarkArea( aMarkArea ); + aMarkArea = rMark.GetMultiMarkArea(); else if (rMark.IsMarked()) - rMark.GetMarkArea( aMarkArea ); + aMarkArea = rMark.GetMarkArea(); else { assert(!"ScTable::UpdateSelectionFunction - called without anything marked"); diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx index 8f3404e46cbe..f8399b68918a 100644 --- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx +++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx @@ -514,8 +514,7 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint bool bNewMarked = refScMarkData.GetTableSelect(aNewCell.Tab()) && ( bIsMark || bIsMultMark ); // sal_Bool bNewCellSelected = isAccessibleSelected(aNewCell.Row(), aNewCell.Col()); sal_uInt16 nTab = rViewData.GetTabNo(); - ScRange aMarkRange; - refScMarkData.GetMarkArea(aMarkRange); + const ScRange& aMarkRange = refScMarkData.GetMarkArea(); aEvent.OldValue.clear(); ScDocument* pDoc= GetDocument(mpViewShell); //Mark All diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx index 33405d447aa3..6ba63e4dc8db 100644 --- a/sc/source/ui/app/seltrans.cxx +++ b/sc/source/ui/app/seltrans.cxx @@ -264,8 +264,7 @@ void ScSelectionTransferObj::CreateCellData() { ScDocShell* pDocSh = rViewData.GetDocShell(); - ScRange aSelRange; - aNewMark.GetMarkArea( aSelRange ); + const ScRange& aSelRange = aNewMark.GetMarkArea(); ScDocShellRef aDragShellRef; if ( pDocSh->GetDocument().HasOLEObjectsInArea( aSelRange, &aNewMark ) ) { diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 33936761a761..b6c93a86cfc0 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -593,15 +593,13 @@ bool ScDocFunc::DeleteContents( return false; } - ScRange aMarkRange; - ScMarkData aMultiMark = rMark; aMultiMark.SetMarking(false); // for MarkToMulti ScDocumentUniquePtr pUndoDoc; bool bMulti = aMultiMark.IsMultiMarked(); aMultiMark.MarkToMulti(); - aMultiMark.GetMultiMarkArea( aMarkRange ); + const ScRange& aMarkRange = aMultiMark.GetMultiMarkArea(); ScRange aExtendedRange(aMarkRange); if ( rDoc.ExtendMerge( aExtendedRange, true ) ) bMulti = false; @@ -747,11 +745,10 @@ bool ScDocFunc::TransliterateText( const ScMarkData& rMark, TransliterationFlags return false; } - ScRange aMarkRange; ScMarkData aMultiMark = rMark; aMultiMark.SetMarking(false); // for MarkToMulti aMultiMark.MarkToMulti(); - aMultiMark.GetMultiMarkArea( aMarkRange ); + const ScRange& aMarkRange = aMultiMark.GetMultiMarkArea(); if (bRecord) { @@ -1442,9 +1439,9 @@ bool ScDocFunc::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& r ScRange aMultiRange; bool bMulti = rMark.IsMultiMarked(); if ( bMulti ) - rMark.GetMultiMarkArea( aMultiRange ); + aMultiRange = rMark.GetMultiMarkArea(); else - rMark.GetMarkArea( aMultiRange ); + aMultiRange = rMark.GetMarkArea(); if ( bRecord ) { @@ -1514,9 +1511,9 @@ bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName, ScRange aMultiRange; bool bMulti = rMark.IsMultiMarked(); if ( bMulti ) - rMark.GetMultiMarkArea( aMultiRange ); + aMultiRange = rMark.GetMultiMarkArea(); else - rMark.GetMarkArea( aMultiRange ); + aMultiRange = rMark.GetMarkArea(); if ( bRecord ) { @@ -4098,11 +4095,10 @@ void ScDocFunc::ClearItems( const ScMarkData& rMark, const sal_uInt16* pWhich, b // MarkData (GetMarkData), so rMark must be changed to multi selection for ClearSelectionItems // here. - ScRange aMarkRange; ScMarkData aMultiMark = rMark; aMultiMark.SetMarking(false); // for MarkToMulti aMultiMark.MarkToMulti(); - aMultiMark.GetMultiMarkArea( aMarkRange ); + const ScRange& aMarkRange = aMultiMark.GetMultiMarkArea(); if (bUndo) { @@ -4139,8 +4135,7 @@ bool ScDocFunc::ChangeIndent( const ScMarkData& rMark, bool bIncrement, bool bAp return false; } - ScRange aMarkRange; - rMark.GetMultiMarkArea( aMarkRange ); + const ScRange& aMarkRange = rMark.GetMultiMarkArea(); if (bUndo) { diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index 275bb6ff9dc1..eeabf410486a 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -681,8 +681,7 @@ void ScDocShell::UseScenario( SCTAB nTab, const OUString& rName, bool bRecord ) ScDocShellModificator aModificator( *this ); ScMarkData aScenMark(m_aDocument.GetSheetLimits()); m_aDocument.MarkScenario( nSrcTab, nTab, aScenMark ); - ScRange aMultiRange; - aScenMark.GetMultiMarkArea( aMultiRange ); + const ScRange& aMultiRange = aScenMark.GetMultiMarkArea(); SCCOL nStartCol = aMultiRange.aStart.Col(); SCROW nStartRow = aMultiRange.aStart.Row(); SCCOL nEndCol = aMultiRange.aEnd.Col(); diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 7d42d988140b..44ba8fee2c26 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -899,8 +899,7 @@ void ScNavigatorDlg::MarkDataArea() pMarkArea.reset( new ScArea ); pViewSh->MarkDataArea(); - ScRange aMarkRange; - pViewSh->GetViewData().GetMarkData().GetMarkArea(aMarkRange); + const ScRange& aMarkRange = pViewSh->GetViewData().GetMarkData().GetMarkArea(); pMarkArea->nColStart = aMarkRange.aStart.Col(); pMarkArea->nRowStart = aMarkRange.aStart.Row(); pMarkArea->nColEnd = aMarkRange.aEnd.Col(); @@ -926,8 +925,7 @@ void ScNavigatorDlg::StartOfDataArea() if ( GetViewData() ) { ScMarkData& rMark = pViewData->GetMarkData(); - ScRange aMarkRange; - rMark.GetMarkArea( aMarkRange ); + const ScRange& aMarkRange = rMark.GetMarkArea(); SCCOL nCol = aMarkRange.aStart.Col(); SCROW nRow = aMarkRange.aStart.Row(); @@ -944,8 +942,7 @@ void ScNavigatorDlg::EndOfDataArea() if ( GetViewData() ) { ScMarkData& rMark = pViewData->GetMarkData(); - ScRange aMarkRange; - rMark.GetMarkArea( aMarkRange ); + const ScRange& aMarkRange = rMark.GetMarkArea(); SCCOL nCol = aMarkRange.aEnd.Col(); SCROW nRow = aMarkRange.aEnd.Row(); diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index 998330bfe632..77a7bc096860 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -1965,10 +1965,7 @@ bool ScUndoEnterMatrix::CanRepeat(SfxRepeatTarget& rTarget) const static ScRange lcl_GetMultiMarkRange( const ScMarkData& rMark ) { OSL_ENSURE( rMark.IsMultiMarked(), "wrong mark type" ); - - ScRange aRange; - rMark.GetMultiMarkArea( aRange ); - return aRange; + return rMark.GetMultiMarkArea(); } ScUndoIndent::ScUndoIndent( ScDocShell* pNewDocShell, const ScMarkData& rMark, diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index d75d1dba666a..f7bddf569605 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1624,8 +1624,7 @@ bool ScModelObj::FillRenderMarkData( const uno::Any& aSelection, { // #i115266# copy behavior of old printing: // treat multiple selection like a single selection with the enclosing range - ScRange aMultiMarkArea; - rMark.GetMultiMarkArea( aMultiMarkArea ); + const ScRange& aMultiMarkArea = rMark.GetMultiMarkArea(); rMark.ResetMark(); rMark.SetMarkArea( aMultiMarkArea ); } @@ -1858,8 +1857,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 if (lcl_renderSelectionToGraphic( bRenderToGraphic, aStatus)) { assert( aMark.IsMarked()); - ScRange aRange; - aMark.GetMarkArea( aRange ); + const ScRange& aRange = aMark.GetMarkArea(); tools::Rectangle aMMRect( pDocShell->GetDocument().GetMMRect( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab())); @@ -1943,7 +1941,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 } else if ( aMark.IsMarked() ) { - aMark.GetMarkArea( aRange ); + aRange = aMark.GetMarkArea(); pSelRange = &aRange; } @@ -2132,7 +2130,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec } else if ( aMark.IsMarked() ) { - aMark.GetMarkArea( aRange ); + aRange = aMark.GetMarkArea(); pSelRange = &aRange; } diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index db9523332f67..1a5f697a0a99 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -361,8 +361,7 @@ void ScCellShell::GetCellState( SfxItemSet& rSet ) { ScMarkData aMarkData = GetViewData().GetMarkData(); aMarkData.MarkToSimple(); - ScRange aRange; - aMarkData.GetMarkArea(aRange); + const ScRange& aRange = aMarkData.GetMarkArea(); if(aMarkData.IsMarked()) { if (!rDoc.IsBlockEditable( aCursor.Tab(), aRange.aStart.Col(),aRange.aStart.Row(), diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index a3d4b0125437..7314ee15413c 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2802,8 +2802,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) rMark.MarkToMulti(); - ScRange aMultiArea; - rMark.GetMultiMarkArea(aMultiArea); + const ScRange& aMultiArea = rMark.GetMultiMarkArea(); SCCOL nStartCol = aMultiArea.aStart.Col(); SCROW nStartRow = aMultiArea.aStart.Row(); SCCOL nEndCol = aMultiArea.aEnd.Col(); @@ -2842,8 +2841,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) rMark.MarkToMulti(); - ScRange aMultiArea; - rMark.GetMultiMarkArea(aMultiArea); + const ScRange& aMultiArea = rMark.GetMultiMarkArea(); SCCOL nStartCol = aMultiArea.aStart.Col(); SCROW nStartRow = aMultiArea.aStart.Row(); SCCOL nEndCol = aMultiArea.aEnd.Col(); @@ -2949,7 +2947,7 @@ void ScCellShell::ExecuteExternalSource( rMark.MarkToSimple(); if ( rMark.IsMarked() ) { - rMark.GetMarkArea( aLinkRange ); + aLinkRange = rMark.GetMarkArea(); bMove = true; // insert/delete cells to fit range } else diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index c9b13c3503d2..8f160bea96b0 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -79,7 +79,7 @@ static bool lcl_GetTextToColumnsRange( const ScViewData& rData, ScRange& rRange, { if ( !rMark.IsMultiMarked() ) { - rMark.GetMarkArea( rRange ); + rRange = rMark.GetMarkArea(); if ( rRange.aStart.Col() == rRange.aEnd.Col() ) { bRet = true; diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index 517734290d16..1eaea7037361 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -220,7 +220,7 @@ void ScDBFunc::AutoOutline( ) if ( rMark.IsMarked() || rMark.IsMultiMarked() ) { rMark.MarkToMulti(); - rMark.GetMultiMarkArea( aRange ); + aRange = rMark.GetMultiMarkArea(); } ScDocShell* pDocSh = GetViewData().GetDocShell(); diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 598a5879a1e3..df62ac25a409 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -2828,9 +2828,7 @@ SvNumFormatType ScFormatShell::GetCurrentNumberFormatType() if ( aMark.IsMarked() || aMark.IsMultiMarked() ) { aMark.MarkToMulti(); - ScRange aRange; - aMark.GetMultiMarkArea(aRange); - + const ScRange& aRange = aMark.GetMultiMarkArea(); const ScMultiSel& rMultiSel = aMark.GetMultiSelData(); SvNumFormatType nComboType = SvNumFormatType::ALL; diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 467649c9f2cf..e676dcfadd42 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2630,8 +2630,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) OUString aAddr; // CurrentCell if( rMark.IsMarked() ) { - ScRange aScRange; - rMark.GetMarkArea( aScRange ); + const ScRange& aScRange = rMark.GetMarkArea(); aAddr = aScRange.Format(rDoc, ScRefFlags::RANGE_ABS); if ( aScRange.aStart == aScRange.aEnd ) { diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index b92099ea8e1e..9b8d5c634b25 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -2283,8 +2283,7 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData, if (!aMultiMark.IsMultiMarked()) { // simple range case - simplify calculation - ScRange aSimpleRange; - aMultiMark.GetMarkArea( aSimpleRange ); + const ScRange& aSimpleRange = aMultiMark.GetMarkArea(); aMultiMark.MarkToMulti(); if ( !aMultiMark.IsMultiMarked() ) @@ -2332,8 +2331,7 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData, aMultiMark.MarkToMulti(); if ( !aMultiMark.IsMultiMarked() ) return; - ScRange aMultiRange; - aMultiMark.GetMultiMarkArea( aMultiRange ); + const ScRange& aMultiRange = aMultiMark.GetMultiMarkArea(); SCCOL nX1 = aMultiRange.aStart.Col(); SCROW nY1 = aMultiRange.aStart.Row(); SCCOL nX2 = aMultiRange.aEnd.Col(); diff --git a/sc/source/ui/view/gridwin_dbgutil.cxx b/sc/source/ui/view/gridwin_dbgutil.cxx index 83e3ed9c49c6..b141bddd7619 100644 --- a/sc/source/ui/view/gridwin_dbgutil.cxx +++ b/sc/source/ui/view/gridwin_dbgutil.cxx @@ -76,9 +76,7 @@ void ScGridWindow::dumpCellProperties() } else if (rMark.IsMarked()) { - ScRange aRange; - rMark.GetMarkArea(aRange); - aList.Join(aRange); + aList.Join(rMark.GetMarkArea()); } else { diff --git a/sc/source/ui/view/pfuncache.cxx b/sc/source/ui/view/pfuncache.cxx index efb33ddb76a1..b54952cb87d5 100644 --- a/sc/source/ui/view/pfuncache.cxx +++ b/sc/source/ui/view/pfuncache.cxx @@ -42,7 +42,7 @@ ScPrintFuncCache::ScPrintFuncCache( ScDocShell* pD, const ScMarkData& rMark, const ScRange* pSelRange = nullptr; if ( rMark.IsMarked() ) { - rMark.GetMarkArea( aRange ); + aRange = rMark.GetMarkArea(); pSelRange = &aRange; } @@ -86,7 +86,7 @@ void ScPrintFuncCache::InitLocations( const ScMarkData& rMark, OutputDevice* pDe const ScRange* pSelRange = nullptr; if ( rMark.IsMarked() ) { - rMark.GetMarkArea( aRange ); + aRange = rMark.GetMarkArea(); pSelRange = &aRange; } diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 91754ed4cf83..859dc530f797 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -466,8 +466,7 @@ void ScTabView::MarkCursor( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScMarkData& rMark = aViewData.GetMarkData(); OSL_ENSURE(rMark.IsMarked() || rMark.IsMultiMarked(), "MarkCursor, !IsMarked()"); - ScRange aMarkRange; - rMark.GetMarkArea(aMarkRange); + const ScRange& aMarkRange = rMark.GetMarkArea(); if (( aMarkRange.aStart.Col() != nBlockStartX && aMarkRange.aEnd.Col() != nBlockStartX ) || ( aMarkRange.aStart.Row() != nBlockStartY && aMarkRange.aEnd.Row() != nBlockStartY ) || ( meBlockMode == Own )) @@ -1039,12 +1038,12 @@ void ScTabView::PaintBlock( bool bReset ) bool bFlag = rMark.GetMarkingFlag(); rMark.SetMarking(false); rMark.MarkToMulti(); - rMark.GetMultiMarkArea(aMarkRange); + aMarkRange = rMark.GetMultiMarkArea(); rMark.MarkToSimple(); rMark.SetMarking(bFlag); } else - rMark.GetMarkArea(aMarkRange); + aMarkRange = rMark.GetMarkArea(); nBlockStartX = aMarkRange.aStart.Col(); nBlockStartY = aMarkRange.aStart.Row(); @@ -1085,9 +1084,7 @@ void ScTabView::SelectAll( bool bContinue ) if (rMark.IsMarked()) { - ScRange aMarkRange; - rMark.GetMarkArea( aMarkRange ); - if ( aMarkRange == ScRange( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab ) ) + if ( rMark.GetMarkArea() == ScRange( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab ) ) return; } @@ -1216,7 +1213,7 @@ sal_uInt16 ScTabView::CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom ) SCTAB nTab = aViewData.GetTabNo(); ScRange aMarkRange; if ( aViewData.GetSimpleArea( aMarkRange ) != SC_MARK_SIMPLE ) - rMark.GetMultiMarkArea( aMarkRange ); + aMarkRange = rMark.GetMultiMarkArea(); SCCOL nStartCol = aMarkRange.aStart.Col(); SCROW nStartRow = aMarkRange.aStart.Row(); diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 4471b3662c35..2133abda414e 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -499,8 +499,7 @@ void ScTabView::CheckSelectionTransfer() ScMarkData& rMark = aViewData.GetMarkData(); if (rMark.IsMarked()) { - ScRange aMarkRange; - rMark.GetMarkArea( aMarkRange ); + const ScRange& aMarkRange = rMark.GetMarkArea(); OUString aStartAddress = aMarkRange.aStart.GetColRowString(); OUString aEndAddress = aMarkRange.aEnd.GetColRowString(); collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}}); @@ -1570,8 +1569,7 @@ void ScTabView::MarkColumns() ScMarkData& rMark = aViewData.GetMarkData(); if (rMark.IsMarked()) { - ScRange aMarkRange; - rMark.GetMarkArea( aMarkRange ); + const ScRange& aMarkRange = rMark.GetMarkArea(); nStartCol = aMarkRange.aStart.Col(); nEndCol = aMarkRange.aEnd.Col(); } @@ -1598,8 +1596,7 @@ void ScTabView::MarkRows() ScMarkData& rMark = aViewData.GetMarkData(); if (rMark.IsMarked()) { - ScRange aMarkRange; - rMark.GetMarkArea( aMarkRange ); + const ScRange& aMarkRange = rMark.GetMarkArea(); nStartRow = aMarkRange.aStart.Row(); nEndRow = aMarkRange.aEnd.Row(); } @@ -1737,9 +1734,7 @@ void ScTabView::Unmark() void ScTabView::SetMarkData( const ScMarkData& rNew ) { DoneBlockMode(); - ScRange aMarkArea( ScAddress::UNINITIALIZED ); - rNew.GetMarkArea( aMarkArea ); - InitOwnBlockMode( aMarkArea ); + InitOwnBlockMode( rNew.GetMarkArea()); aViewData.GetMarkData() = rNew; MarkDataChanged(); diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index d8c65f902a83..8a65b1c7b917 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -423,8 +423,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) { if (rMark.IsMarked()) // is the same range already marked? { - ScRange aOldMark; - rMark.GetMarkArea( aOldMark ); + ScRange aOldMark = rMark.GetMarkArea(); aOldMark.PutInOrder(); ScRange aCurrent = aScRange; aCurrent.PutInOrder(); diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 98aff34a7526..b77172ce9ba8 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1137,7 +1137,7 @@ ScMarkType ScViewData::GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark ) if ( rNewMark.IsMarked() && !rNewMark.IsMultiMarked() ) { - rNewMark.GetMarkArea( rRange ); + rRange = rNewMark.GetMarkArea(); if (ScViewUtil::HasFiltered(rRange, GetDocument())) eMarkType = SC_MARK_SIMPLE_FILTERED; else diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 49b8fc14f30f..5d7d62d4ad84 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -957,8 +957,7 @@ void ScViewFunc::EnterBlock( const OUString& rString, const EditTextObject* pDat if ( pItem ) { // set number format if incompatible // MarkData was already MarkToSimple'ed in PasteFromClip - ScRange aRange; - rMark.GetMarkArea( aRange ); + const ScRange& aRange = rMark.GetMarkArea(); ScPatternAttr aPattern( rDoc.GetPool() ); aPattern.GetItemSet().Put( *pItem ); SvNumFormatType nNewType = rDoc.GetFormatTable()->GetType( pItem->GetValue() ); @@ -1038,7 +1037,7 @@ void ScViewFunc::AdjustPrintZoom() { ScRange aRange; if ( GetViewData().GetSimpleArea( aRange ) != SC_MARK_SIMPLE ) - GetViewData().GetMarkData().GetMultiMarkArea( aRange ); + aRange = GetViewData().GetMarkData().GetMultiMarkArea(); GetViewData().GetDocShell()->AdjustPrintZoom( aRange ); } @@ -1190,8 +1189,7 @@ bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bCenter ) ScDocShell* pDocSh = GetViewData().GetDocShell(); ScDocument& rDoc = pDocSh->GetDocument(); - ScRange aMarkRange; - rMark.GetMarkArea( aMarkRange ); + const ScRange& aMarkRange = rMark.GetMarkArea(); SCCOL nStartCol = aMarkRange.aStart.Col(); SCROW nStartRow = aMarkRange.aStart.Row(); SCTAB nStartTab = aMarkRange.aStart.Tab(); @@ -1686,9 +1684,9 @@ void ScViewFunc::FillTab( InsertDeleteFlags nFlags, ScPasteFunc nFunction, bool rMark.MarkToSimple(); bool bMulti = rMark.IsMultiMarked(); if (bMulti) - rMark.GetMultiMarkArea( aMarkRange ); + aMarkRange = rMark.GetMultiMarkArea(); else if (rMark.IsMarked()) - rMark.GetMarkArea( aMarkRange ); + aMarkRange = rMark.GetMarkArea(); else aMarkRange = ScRange( GetViewData().GetCurX(), GetViewData().GetCurY(), nTab ); @@ -3425,8 +3423,7 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine, rDoc.ApplySelectionLineStyle( aFuncMark, pLine, bColorOnly ); } - ScRange aMarkRange; - aFuncMark.GetMultiMarkArea( aMarkRange ); + const ScRange& aMarkRange = aFuncMark.GetMultiMarkArea(); SCCOL nStartCol = aMarkRange.aStart.Col(); SCROW nStartRow = aMarkRange.aStart.Row(); SCTAB nStartTab = aMarkRange.aStart.Tab(); diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 5d080719c3e3..031a5b34b3cf 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -1009,8 +1009,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, { // Expand the marked area when the destination area is larger than the // current selection, to get the undo do the right thing. (i#106711) - ScRange aRange; - aFilteredMark.GetMarkArea( aRange ); + ScRange aRange = aFilteredMark.GetMarkArea(); if( (aRange.aEnd.Col() - aRange.aStart.Col()) < nDestSizeX ) { aRange.aEnd.SetCol(aRange.aStart.Col() + nDestSizeX); diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index d3679b13c0d2..024b11e3be2d 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -190,9 +190,9 @@ void ScViewFunc::DoRefConversion() rMark.MarkToSimple(); bool bMulti = rMark.IsMultiMarked(); if (bMulti) - rMark.GetMultiMarkArea( aMarkRange ); + aMarkRange = rMark.GetMultiMarkArea(); else if (rMark.IsMarked()) - rMark.GetMarkArea( aMarkRange ); + aMarkRange = rMark.GetMarkArea(); else { aMarkRange = ScRange( GetViewData().GetCurX(), diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index a1a5083205b8..7f69f8b27b66 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1068,9 +1068,9 @@ void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem aFuncMark.MarkToSimple(); bool bMulti = aFuncMark.IsMultiMarked(); if (bMulti) - aFuncMark.GetMultiMarkArea( aMarkRange ); + aMarkRange = aFuncMark.GetMultiMarkArea(); else if (aFuncMark.IsMarked()) - aFuncMark.GetMarkArea( aMarkRange ); + aMarkRange = aFuncMark.GetMarkArea(); else { aMarkRange = ScRange( GetViewData().GetCurX(), @@ -1180,8 +1180,7 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursor if (aFuncMark.IsMultiMarked() && !bCursorOnly) { - ScRange aMarkRange; - aFuncMark.GetMultiMarkArea( aMarkRange ); + const ScRange& aMarkRange = aFuncMark.GetMultiMarkArea(); SCTAB nTabCount = rDoc.GetTableCount(); for (const auto& rTab : aFuncMark) { @@ -1368,9 +1367,8 @@ void ScViewFunc::SetStyleSheetToMarked( const SfxStyleSheet* pStyleSheet ) if ( aFuncMark.IsMarked() || aFuncMark.IsMultiMarked() ) { - ScRange aMarkRange; aFuncMark.MarkToMulti(); - aFuncMark.GetMultiMarkArea( aMarkRange ); + const ScRange& aMarkRange = aFuncMark.GetMultiMarkArea(); if ( bRecord ) { @@ -3011,9 +3009,9 @@ void ScViewFunc::UpdateSelectionArea( const ScMarkData& rSel, ScPatternAttr* pAt ScDocShell* pDocShell = GetViewData().GetDocShell(); ScRange aMarkRange; if (rSel.IsMultiMarked() ) - rSel.GetMultiMarkArea( aMarkRange ); + aMarkRange = rSel.GetMultiMarkArea(); else - rSel.GetMarkArea( aMarkRange ); + aMarkRange = rSel.GetMarkArea(); bool bSetLines = false; bool bSetAlign = false; diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx index 8e7470f58c85..bf691f778a99 100644 --- a/sc/source/ui/view/viewutil.cxx +++ b/sc/source/ui/view/viewutil.cxx @@ -224,8 +224,7 @@ void ScViewUtil::UnmarkFiltered( ScMarkData& rMark, const ScDocument& rDoc ) { rMark.MarkToMulti(); - ScRange aMultiArea; - rMark.GetMultiMarkArea( aMultiArea ); + const ScRange& aMultiArea = rMark.GetMultiMarkArea(); SCCOL nStartCol = aMultiArea.aStart.Col(); SCROW nStartRow = aMultiArea.aStart.Row(); SCCOL nEndCol = aMultiArea.aEnd.Col(); |