summaryrefslogtreecommitdiff
path: root/sc/source/ui/miscdlgs/anyrefdg.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-14 16:42:52 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-15 21:36:27 +0200
commitbf3d1b8e8f89bfdb409c70cfea126f36474d4772 (patch)
tree9d496d04fc1bbd76c15ab215f947ac28587f0e1e /sc/source/ui/miscdlgs/anyrefdg.cxx
parent957adc83e67276805c6dcd7be1ea23c142c49306 (diff)
establish that ScViewData::GetDocument can always return ScDocument&
we can only be ctored with a ScDocShell& or ScDocument&, and ScDocShell provides a ScDocument& from its GetDocument() so we can always have a ScDocument& when a public ctor has completed some null checks can then be seen to be redundant and are removed Change-Id: Ifaf39cb06e8dbce363999c05ee0aeb3ec4f00428 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102775 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui/miscdlgs/anyrefdg.cxx')
-rw-r--r--sc/source/ui/miscdlgs/anyrefdg.cxx20
1 files changed, 10 insertions, 10 deletions
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index d8d7777a5efb..968bb5f4cf69 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -117,7 +117,7 @@ void ScFormulaReferenceHelper::ShowSimpleReference(const OUString& rStr)
if ( !pViewData )
return;
- ScDocument* pDoc=pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
ScTabViewShell* pTabViewShell=pViewData->GetViewShell();
ScRangeList aRangeList;
@@ -125,7 +125,7 @@ void ScFormulaReferenceHelper::ShowSimpleReference(const OUString& rStr)
pTabViewShell->DoneRefMode();
pTabViewShell->ClearHighlightRanges();
- if( ParseWithNames( aRangeList, rStr, *pDoc ) )
+ if( ParseWithNames( aRangeList, rStr, rDoc ) )
{
for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i )
{
@@ -193,7 +193,7 @@ void ScFormulaReferenceHelper::ShowFormulaReference(const OUString& rStr)
return;
const ScViewData& rViewData = pTabViewShell->GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
pTabViewShell->DoneRefMode();
pTabViewShell->ClearHighlightRanges();
@@ -212,12 +212,12 @@ void ScFormulaReferenceHelper::ShowFormulaReference(const OUString& rStr)
if(bDoubleRef)
{
ScComplexRefData aRef( *pToken->GetDoubleRef() );
- aRange = aRef.toAbs(*pDoc, aPos);
+ aRange = aRef.toAbs(rDoc, aPos);
}
else
{
ScSingleRefData aRef( *pToken->GetSingleRef() );
- aRange.aStart = aRef.toAbs(*pDoc, aPos);
+ aRange.aStart = aRef.toAbs(rDoc, aPos);
aRange.aEnd = aRange.aStart;
}
Color aColName=ScRangeFindList::GetColorName(nIndex++);
@@ -296,9 +296,9 @@ void ScFormulaReferenceHelper::ReleaseFocus( formula::RefEdit* pEdit )
return;
const ScViewData& rViewData = pViewShell->GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
ScRangeList aRangeList;
- if( !ParseWithNames( aRangeList, m_pRefEdit->GetText(), *pDoc ) )
+ if( !ParseWithNames( aRangeList, m_pRefEdit->GetText(), rDoc ) )
return;
if ( !aRangeList.empty() )
@@ -309,7 +309,7 @@ void ScFormulaReferenceHelper::ReleaseFocus( formula::RefEdit* pEdit )
rRange.aStart.Row(), SC_FOLLOW_JUMP, false, false );
pViewShell->MoveCursorAbs( rRange.aEnd.Col(),
rRange.aEnd.Row(), SC_FOLLOW_JUMP, true, false );
- m_pDlg->SetReference( rRange, *pDoc );
+ m_pDlg->SetReference( rRange, rDoc );
}
}
@@ -319,13 +319,13 @@ void ScFormulaReferenceHelper::Init()
if ( !pViewData )
return;
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCCOL nCol = pViewData->GetCurX();
SCROW nRow = pViewData->GetCurY();
SCTAB nTab = pViewData->GetTabNo();
ScAddress aCursorPos( nCol, nRow, nTab );
- m_pRefComp.reset( new ScCompiler( pDoc, aCursorPos, pDoc->GetGrammar()) );
+ m_pRefComp.reset( new ScCompiler( &rDoc, aCursorPos, rDoc.GetGrammar()) );
m_pRefComp->EnableJumpCommandReorder(false);
m_pRefComp->EnableStopOnError(false);