diff options
author | Eike Rathke <erack@redhat.com> | 2021-03-30 14:05:31 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2021-03-30 18:15:52 +0200 |
commit | 5464dabc9025b100b782f517a0e86e0d45cdb4e7 (patch) | |
tree | cf39153b9129449031927b39d7e7cbb33e295a1f | |
parent | 4761b5f9820719ad400f7114dc647799a345a836 (diff) |
ScDocument::GetRangeAtBlock() name is always passed, so use reference
Change-Id: I1dec40b6da2375b292ba4c9912c4736fcd7ca551
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113348
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/documen3.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/optsolver.cxx | 4 |
4 files changed, 7 insertions, 9 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 0d3078327390..f9582dc4837b 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -820,7 +820,7 @@ public: void RefreshDirtyTableColumnNames(); SC_DLLPUBLIC sc::ExternalDataMapper& GetExternalDataMapper(); - SC_DLLPUBLIC const ScRangeData* GetRangeAtBlock( const ScRange& rBlock, OUString* pName, + SC_DLLPUBLIC const ScRangeData* GetRangeAtBlock( const ScRange& rBlock, OUString& rName, bool* pSheetLocal = nullptr ) const; SC_DLLPUBLIC bool HasPivotTable() const; diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 6f6a9a6f27d6..e3da76da859c 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -234,7 +234,7 @@ bool ScDocument::InsertNewRangeName( SCTAB nTab, const OUString& rName, const Sc return pLocalNames->insert(pName); } -const ScRangeData* ScDocument::GetRangeAtBlock( const ScRange& rBlock, OUString* pName, bool* pSheetLocal ) const +const ScRangeData* ScDocument::GetRangeAtBlock( const ScRange& rBlock, OUString& rName, bool* pSheetLocal ) const { const ScRangeData* pData = nullptr; if (rBlock.aStart.Tab() == rBlock.aEnd.Tab()) @@ -245,8 +245,7 @@ const ScRangeData* ScDocument::GetRangeAtBlock( const ScRange& rBlock, OUString* pData = pLocalNames->findByRange( rBlock ); if (pData) { - if (pName) - *pName = pData->GetName(); + rName = pData->GetName(); if (pSheetLocal) *pSheetLocal = true; return pData; @@ -258,8 +257,7 @@ const ScRangeData* ScDocument::GetRangeAtBlock( const ScRange& rBlock, OUString* pData = pRangeName->findByRange( rBlock ); if (pData) { - if (pName) - *pName = pData->GetName(); + rName = pData->GetName(); if (pSheetLocal) *pSheetLocal = false; } diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 109035c62a82..0d50b77775eb 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -4110,7 +4110,7 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState, //! Find by Timer? if ( pActiveViewSh ) pActiveViewSh->GetViewData().GetDocument(). - GetRangeAtBlock( ScRange( rSPos, rEPos ), &aPosStr, &bSheetLocal); + GetRangeAtBlock( ScRange( rSPos, rEPos ), aPosStr, &bSheetLocal); if ( aPosStr.isEmpty() ) // Not a name -> format { diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx index dec0442b5d2a..3476efaa456b 100644 --- a/sc/source/ui/miscdlgs/optsolver.cxx +++ b/sc/source/ui/miscdlgs/optsolver.cxx @@ -355,7 +355,7 @@ void ScOptSolverDlg::Init(const ScAddress& rCursorPos) { m_xRbMax->set_active(true); OUString aCursorStr; - if ( !mrDoc.GetRangeAtBlock( ScRange(rCursorPos), &aCursorStr ) ) + if ( !mrDoc.GetRangeAtBlock( ScRange(rCursorPos), aCursorStr ) ) aCursorStr = rCursorPos.Format(ScRefFlags::ADDR_ABS, nullptr, mrDoc.GetAddressConvention()); m_xEdObjectiveCell->SetRefString( aCursorStr ); if ( bImplHasElements ) @@ -465,7 +465,7 @@ void ScOptSolverDlg::SetReference( const ScRange& rRef, ScDocument& rDocP ) aNewRef.aEnd = aAdr; OUString aName; - if ( rDocP.GetRangeAtBlock( aNewRef, &aName ) ) // named range: show name + if ( rDocP.GetRangeAtBlock( aNewRef, aName ) ) // named range: show name aStr = aName; else // format cell/range reference { |