summaryrefslogtreecommitdiffstats
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
parentestablish ScViewData always ctored from ScDocShell& or ScDocument& (diff)
downloadcore-bf3d1b8e8f89bfdb409c70cfea126f36474d4772.tar.gz
core-bf3d1b8e8f89bfdb409c70cfea126f36474d4772.zip
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>
-rw-r--r--sc/qa/unit/bugfix-test.cxx6
-rw-r--r--sc/qa/unit/screenshots/screenshots.cxx6
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx4
-rw-r--r--sc/source/ui/Accessibility/AccessibleCell.cxx2
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocument.cxx17
-rw-r--r--sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx2
-rw-r--r--sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx2
-rw-r--r--sc/source/ui/StatisticsDialogs/SamplingDialog.cxx2
-rw-r--r--sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx2
-rw-r--r--sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx2
-rw-r--r--sc/source/ui/app/inputhdl.cxx46
-rw-r--r--sc/source/ui/app/inputwin.cxx30
-rw-r--r--sc/source/ui/app/scmod.cxx4
-rw-r--r--sc/source/ui/condformat/condformatdlg.cxx26
-rw-r--r--sc/source/ui/dbgui/PivotLayoutDialog.cxx2
-rw-r--r--sc/source/ui/dbgui/consdlg.cxx43
-rw-r--r--sc/source/ui/dbgui/dbnamdlg.cxx2
-rw-r--r--sc/source/ui/dbgui/filtdlg.cxx4
-rw-r--r--sc/source/ui/dbgui/foptmgr.cxx2
-rw-r--r--sc/source/ui/dbgui/pfiltdlg.cxx4
-rw-r--r--sc/source/ui/dbgui/scendlg.cxx4
-rw-r--r--sc/source/ui/dbgui/sfiltdlg.cxx2
-rw-r--r--sc/source/ui/dbgui/tpsort.cxx13
-rw-r--r--sc/source/ui/dbgui/tpsubt.cxx4
-rw-r--r--sc/source/ui/drawfunc/drawsh.cxx6
-rw-r--r--sc/source/ui/drawfunc/drawsh2.cxx2
-rw-r--r--sc/source/ui/drawfunc/drawsh5.cxx4
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx4
-rw-r--r--sc/source/ui/drawfunc/fuins1.cxx10
-rw-r--r--sc/source/ui/drawfunc/fuins2.cxx16
-rw-r--r--sc/source/ui/drawfunc/fupoor.cxx2
-rw-r--r--sc/source/ui/drawfunc/fusel.cxx10
-rw-r--r--sc/source/ui/drawfunc/fusel2.cxx2
-rw-r--r--sc/source/ui/drawfunc/futext3.cxx2
-rw-r--r--sc/source/ui/formdlg/formula.cxx4
-rw-r--r--sc/source/ui/inc/condformatdlg.hxx2
-rw-r--r--sc/source/ui/inc/consdlg.hxx2
-rw-r--r--sc/source/ui/inc/crnrdlg.hxx2
-rw-r--r--sc/source/ui/inc/drawview.hxx2
-rw-r--r--sc/source/ui/inc/highred.hxx2
-rw-r--r--sc/source/ui/inc/namedlg.hxx2
-rw-r--r--sc/source/ui/inc/olinewin.hxx2
-rw-r--r--sc/source/ui/inc/viewdata.hxx4
-rw-r--r--sc/source/ui/miscdlgs/acredlin.cxx6
-rw-r--r--sc/source/ui/miscdlgs/anyrefdg.cxx20
-rw-r--r--sc/source/ui/miscdlgs/autofmt.cxx6
-rw-r--r--sc/source/ui/miscdlgs/conflictsdlg.cxx2
-rw-r--r--sc/source/ui/miscdlgs/crnrdlg.cxx92
-rw-r--r--sc/source/ui/miscdlgs/datafdlg.cxx4
-rw-r--r--sc/source/ui/miscdlgs/highred.cxx16
-rw-r--r--sc/source/ui/miscdlgs/instbdlg.cxx2
-rw-r--r--sc/source/ui/namedlg/namedefdlg.cxx2
-rw-r--r--sc/source/ui/namedlg/namedlg.cxx16
-rw-r--r--sc/source/ui/navipi/navcitem.cxx2
-rw-r--r--sc/source/ui/navipi/navipi.cxx20
-rw-r--r--sc/source/ui/optdlg/tpusrlst.cxx2
-rw-r--r--sc/source/ui/pagedlg/tphf.cxx4
-rw-r--r--sc/source/ui/uitest/uiobject.cxx22
-rw-r--r--sc/source/ui/undo/undoblk.cxx2
-rw-r--r--sc/source/ui/unoobj/docuno.cxx6
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx27
-rw-r--r--sc/source/ui/vba/vbanames.cxx8
-rw-r--r--sc/source/ui/vba/vbanames.hxx2
-rw-r--r--sc/source/ui/vba/vbaworksheets.cxx2
-rw-r--r--sc/source/ui/view/auditsh.cxx2
-rw-r--r--sc/source/ui/view/cellsh.cxx170
-rw-r--r--sc/source/ui/view/cellsh1.cxx164
-rw-r--r--sc/source/ui/view/cellsh2.cxx86
-rw-r--r--sc/source/ui/view/cellsh3.cxx28
-rw-r--r--sc/source/ui/view/cellsh4.cxx4
-rw-r--r--sc/source/ui/view/cliputil.cxx6
-rw-r--r--sc/source/ui/view/colrowba.cxx46
-rw-r--r--sc/source/ui/view/dbfunc.cxx26
-rw-r--r--sc/source/ui/view/dbfunc2.cxx6
-rw-r--r--sc/source/ui/view/dbfunc3.cxx132
-rw-r--r--sc/source/ui/view/drawvie3.cxx15
-rw-r--r--sc/source/ui/view/drawvie4.cxx10
-rw-r--r--sc/source/ui/view/drawview.cxx48
-rw-r--r--sc/source/ui/view/editsh.cxx10
-rw-r--r--sc/source/ui/view/formatsh.cxx68
-rw-r--r--sc/source/ui/view/gridwin.cxx304
-rw-r--r--sc/source/ui/view/gridwin2.cxx26
-rw-r--r--sc/source/ui/view/gridwin3.cxx10
-rw-r--r--sc/source/ui/view/gridwin4.cxx154
-rw-r--r--sc/source/ui/view/gridwin5.cxx20
-rw-r--r--sc/source/ui/view/gridwin_dbgutil.cxx22
-rw-r--r--sc/source/ui/view/hdrcont.cxx26
-rw-r--r--sc/source/ui/view/pgbrksh.cxx2
-rw-r--r--sc/source/ui/view/pivotsh.cxx6
-rw-r--r--sc/source/ui/view/select.cxx38
-rw-r--r--sc/source/ui/view/tabcont.cxx88
-rw-r--r--sc/source/ui/view/tabview.cxx116
-rw-r--r--sc/source/ui/view/tabview2.cxx162
-rw-r--r--sc/source/ui/view/tabview3.cxx166
-rw-r--r--sc/source/ui/view/tabview4.cxx54
-rw-r--r--sc/source/ui/view/tabview5.cxx34
-rw-r--r--sc/source/ui/view/tabvwsh.cxx4
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx38
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx17
-rw-r--r--sc/source/ui/view/tabvwsh5.cxx10
-rw-r--r--sc/source/ui/view/tabvwsh8.cxx4
-rw-r--r--sc/source/ui/view/tabvwsha.cxx71
-rw-r--r--sc/source/ui/view/tabvwshb.cxx8
-rw-r--r--sc/source/ui/view/tabvwshc.cxx28
-rw-r--r--sc/source/ui/view/tabvwshe.cxx8
-rw-r--r--sc/source/ui/view/tabvwshf.cxx98
-rw-r--r--sc/source/ui/view/tabvwshg.cxx8
-rw-r--r--sc/source/ui/view/tabvwshh.cxx16
-rw-r--r--sc/source/ui/view/viewdata.cxx95
-rw-r--r--sc/source/ui/view/viewfun2.cxx229
-rw-r--r--sc/source/ui/view/viewfun3.cxx237
-rw-r--r--sc/source/ui/view/viewfun4.cxx36
-rw-r--r--sc/source/ui/view/viewfun5.cxx24
-rw-r--r--sc/source/ui/view/viewfun6.cxx2
-rw-r--r--sc/source/ui/view/viewfun7.cxx30
-rw-r--r--sc/source/ui/view/viewfunc.cxx170
116 files changed, 1859 insertions, 1897 deletions
diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx
index 62e356ddb6d2..df5817a06be2 100644
--- a/sc/qa/unit/bugfix-test.cxx
+++ b/sc/qa/unit/bugfix-test.cxx
@@ -169,12 +169,12 @@ void ScFiltersTest::testTdf91979()
ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false);
CPPUNIT_ASSERT(pViewShell != nullptr);
auto& aViewData = pViewShell->GetViewData();
- auto* pDoc = aViewData.GetDocument();
+ auto& rDoc = aViewData.GetDocument();
// Check coordinates of a distant cell
Point aPos = aViewData.GetScrPos(MAXCOL - 1, 10000, SC_SPLIT_TOPLEFT, true);
- int nColWidth = ScViewData::ToPixel(pDoc->GetColWidth(0, 0), aViewData.GetPPTX());
- int nRowHeight = ScViewData::ToPixel(pDoc->GetRowHeight(0, 0), aViewData.GetPPTY());
+ int nColWidth = ScViewData::ToPixel(rDoc.GetColWidth(0, 0), aViewData.GetPPTX());
+ int nRowHeight = ScViewData::ToPixel(rDoc.GetRowHeight(0, 0), aViewData.GetPPTY());
CPPUNIT_ASSERT_EQUAL(static_cast<long>((MAXCOL - 1) * nColWidth), aPos.getX());
CPPUNIT_ASSERT_EQUAL(static_cast<long>(10000 * nRowHeight), aPos.getY());
}
diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx
index 632466e828f1..08100126a7ae 100644
--- a/sc/qa/unit/screenshots/screenshots.cxx
+++ b/sc/qa/unit/screenshots/screenshots.cxx
@@ -236,16 +236,16 @@ VclPtr<VclAbstractDialog> ScScreenshotTest::createDialogByID(sal_uInt32 nID)
case 14: // "modules/scalc/ui/formatcellsdialog.ui"
{
ScViewData& rViewData = mpViewShell->GetViewData();
- ScDocument *pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
const ScPatternAttr *pAttr = mpViewShell->GetSelectionPattern();
std::unique_ptr<SvxNumberInfoItem> pNumberInfoItem;
mpItemSet.reset(new SfxItemSet(pAttr->GetItemSet()));
mpItemSet->Put(SfxUInt32Item(ATTR_VALUE_FORMAT,
- pAttr->GetNumberFormat( pDoc->GetFormatTable() ) ) );
+ pAttr->GetNumberFormat( rDoc.GetFormatTable() ) ) );
- pNumberInfoItem = ScTabViewShell::MakeNumberInfoItem(pDoc, &rViewData);
+ pNumberInfoItem = ScTabViewShell::MakeNumberInfoItem(&rDoc, &rViewData);
mpItemSet->MergeRange(SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO);
mpItemSet->Put(*pNumberInfoItem);
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 965dac89f5c9..fa560813b30f 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -655,7 +655,7 @@ void ScTiledRenderingTest::testViewLock()
const ScViewData* pViewData = ScDocShell::GetViewData();
ScTabViewShell* pViewShell = pViewData->GetViewShell();
CPPUNIT_ASSERT(pViewShell);
- SdrModel* pDrawModel = pViewData->GetDocument()->GetDrawLayer();
+ SdrModel* pDrawModel = pViewData->GetDocument().GetDrawLayer();
SdrPage* pDrawPage = pDrawModel->GetPage(0);
SdrObject* pObject = pDrawPage->GetObj(0);
SdrView* pView = pViewShell->GetScDrawView();
@@ -838,7 +838,7 @@ void ScTiledRenderingTest::testCreateViewGraphicSelection()
const ScViewData* pViewData = ScDocShell::GetViewData();
ScTabViewShell* pViewShell = pViewData->GetViewShell();
CPPUNIT_ASSERT(pViewShell);
- SdrModel* pDrawModel = pViewData->GetDocument()->GetDrawLayer();
+ SdrModel* pDrawModel = pViewData->GetDocument().GetDrawLayer();
SdrPage* pDrawPage = pDrawModel->GetPage(0);
SdrObject* pObject = pDrawPage->GetObj(0);
SdrView* pView = pViewShell->GetScDrawView();
diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx
index 800cca592385..e036a9fbd41e 100644
--- a/sc/source/ui/Accessibility/AccessibleCell.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -366,7 +366,7 @@ ScDocument* ScAccessibleCell::GetDocument(ScTabViewShell* pViewShell)
{
ScDocument* pDoc = nullptr;
if (pViewShell)
- pDoc = pViewShell->GetViewData().GetDocument();
+ pDoc = &pViewShell->GetViewData().GetDocument();
return pDoc;
}
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 34c131741384..42b7ee4bcc73 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -323,12 +323,12 @@ ScChildrenShapes::ScChildrenShapes(ScAccessibleDocument* pAccessibleDocument, Sc
return;
ScViewData& rViewData = pViewShell->GetViewData();
- SfxBroadcaster* pDrawBC = rViewData.GetDocument()->GetDrawBroadcaster();
+ SfxBroadcaster* pDrawBC = rViewData.GetDocument().GetDrawBroadcaster();
if (pDrawBC)
{
StartListening(*pDrawBC);
- maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(rViewData.GetDocument()->GetDrawLayer()) );
+ maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(rViewData.GetDocument().GetDrawLayer()) );
maShapeTreeInfo.SetSdrView(rViewData.GetScDrawView());
maShapeTreeInfo.SetController(nullptr);
maShapeTreeInfo.SetDevice(pViewShell->GetWindowByPos(meSplitPos));
@@ -342,7 +342,7 @@ ScChildrenShapes::~ScChildrenShapes()
delete pShapeData;
if (mpViewShell)
{
- SfxBroadcaster* pDrawBC = mpViewShell->GetViewData().GetDocument()->GetDrawBroadcaster();
+ SfxBroadcaster* pDrawBC = mpViewShell->GetViewData().GetDocument().GetDrawBroadcaster();
if (pDrawBC)
EndListening(*pDrawBC);
}
@@ -356,12 +356,12 @@ void ScChildrenShapes::SetDrawBroadcaster()
return;
ScViewData& rViewData = mpViewShell->GetViewData();
- SfxBroadcaster* pDrawBC = rViewData.GetDocument()->GetDrawBroadcaster();
+ SfxBroadcaster* pDrawBC = rViewData.GetDocument().GetDrawBroadcaster();
if (pDrawBC)
{
StartListening(*pDrawBC, DuplicateHandling::Prevent);
- maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(rViewData.GetDocument()->GetDrawLayer()) );
+ maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(rViewData.GetDocument().GetDrawLayer()) );
maShapeTreeInfo.SetSdrView(rViewData.GetScDrawView());
maShapeTreeInfo.SetController(nullptr);
maShapeTreeInfo.SetDevice(mpViewShell->GetWindowByPos(meSplitPos));
@@ -874,10 +874,9 @@ SdrPage* ScChildrenShapes::GetDrawPage() const
SdrPage* pDrawPage = nullptr;
if (mpViewShell)
{
- ScDocument* pDoc = mpViewShell->GetViewData().GetDocument();
- if (pDoc && pDoc->GetDrawLayer())
+ ScDocument& rDoc = mpViewShell->GetViewData().GetDocument();
+ if (ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer())
{
- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
if (pDrawLayer->HasObjects() && (pDrawLayer->GetPageCount() > nTab))
pDrawPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(static_cast<sal_Int16>(nTab)));
}
@@ -2198,7 +2197,7 @@ OUString ScAccessibleDocument::GetCurrentCellDescription()
ScDocument *ScAccessibleDocument::GetDocument() const
{
- return mpViewShell ? mpViewShell->GetViewData().GetDocument() : nullptr;
+ return mpViewShell ? &mpViewShell->GetViewData().GetDocument() : nullptr;
}
ScAddress ScAccessibleDocument::GetCurCellAddress() const
diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index 9fb0f38b422b..055e1941f9d8 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -1374,7 +1374,7 @@ ScDocument* ScAccessibleSpreadsheet::GetDocument(ScTabViewShell* pViewShell)
{
ScDocument* pDoc = nullptr;
if (pViewShell)
- pDoc = pViewShell->GetViewData().GetDocument();
+ pDoc = &pViewShell->GetViewData().GetDocument();
return pDoc;
}
diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
index dea6561288a6..ebb1d8b06390 100644
--- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
@@ -49,7 +49,7 @@ ScRandomNumberGeneratorDialog::ScRandomNumberGeneratorDialog(
"modules/scalc/ui/randomnumbergenerator.ui",
"RandomNumberGeneratorDialog")
, mpViewData(pViewData)
- , mrDoc(*pViewData->GetDocument())
+ , mrDoc(pViewData->GetDocument())
, mbDialogLostFocus(false)
, mxInputRangeText(m_xBuilder->weld_label("cell-range-label"))
, mxInputRangeEdit(new formula::RefEdit(m_xBuilder->weld_entry("cell-range-edit")))
diff --git a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
index 62a93829c707..1113254c6f1e 100644
--- a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
@@ -25,7 +25,7 @@ ScSamplingDialog::ScSamplingDialog(SfxBindings* pSfxBindings, SfxChildWindow* pC
"modules/scalc/ui/samplingdialog.ui", "SamplingDialog")
, mpActiveEdit(nullptr)
, mViewData(pViewData)
- , mDocument(*pViewData->GetDocument())
+ , mDocument(pViewData->GetDocument())
, mInputRange(ScAddress::INITIALIZE_INVALID)
, mAddressDetails(mDocument.GetAddressConvention(), 0, 0)
, mOutputAddress(ScAddress::INITIALIZE_INVALID)
diff --git a/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx b/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx
index 959d7ee2dee3..a4a44f16a972 100644
--- a/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx
@@ -59,7 +59,7 @@ ScStatisticsInputOutputDialog::ScStatisticsInputOutputDialog(
, mxGroupByColumnsRadio(m_xBuilder->weld_radio_button("groupedby-columns-radio"))
, mxGroupByRowsRadio(m_xBuilder->weld_radio_button("groupedby-rows-radio"))
, mViewData(pViewData)
- , mDocument(*pViewData->GetDocument())
+ , mDocument(pViewData->GetDocument())
, mInputRange(ScAddress::INITIALIZE_INVALID)
, mAddressDetails(mDocument.GetAddressConvention(), 0, 0)
, mOutputAddress(ScAddress::INITIALIZE_INVALID)
diff --git a/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx b/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx
index ab2b3c7fbd62..787c61bb3c3b 100644
--- a/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx
@@ -32,7 +32,7 @@ ScStatisticsTwoVariableDialog::ScStatisticsTwoVariableDialog(
, mxOutputRangeEdit(new formula::RefEdit(m_xBuilder->weld_entry("output-range-edit")))
, mxOutputRangeButton(new formula::RefButton(m_xBuilder->weld_button("output-range-button")))
, mViewData(pViewData)
- , mDocument(*pViewData->GetDocument())
+ , mDocument(pViewData->GetDocument())
, mVariable1Range(ScAddress::INITIALIZE_INVALID)
, mVariable2Range(ScAddress::INITIALIZE_INVALID)
, mAddressDetails(mDocument.GetAddressConvention(), 0, 0 )
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index d3ad4244d7de..28e2d83acd4b 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -596,9 +596,9 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew )
ScRange aJustified = rNew;
aJustified.PutInOrder(); // Always display Ref in the Formula the right way
- ScDocument* pDoc = pDocView->GetViewData().GetDocument();
- const ScAddress::Details aAddrDetails( *pDoc, aCursorPos );
- OUString aNewStr(aJustified.Format(*pDoc, rData.nFlags, aAddrDetails));
+ ScDocument& rDoc = pDocView->GetViewData().GetDocument();
+ const ScAddress::Details aAddrDetails( rDoc, aCursorPos );
+ OUString aNewStr(aJustified.Format(rDoc, rData.nFlags, aAddrDetails));
ESelection aOldSel( 0, nOldStart, 0, nOldEnd );
SfxItemSet aSet( mpEditEngine->GetEmptyItemSet() );
@@ -850,7 +850,7 @@ void ScInputHandler::UpdateRefDevice()
nCtrl &= ~EEControlBits::FORMAT100; // when formatting for screen, use the actual MapMode
mpEditEngine->SetControlWord( nCtrl );
if ( bTextWysiwyg && pActiveViewSh )
- mpEditEngine->SetRefDevice( pActiveViewSh->GetViewData().GetDocument()->GetPrinter() );
+ mpEditEngine->SetRefDevice( pActiveViewSh->GetViewData().GetDocument().GetPrinter() );
else
mpEditEngine->SetRefDevice( nullptr );
@@ -910,7 +910,7 @@ void ScInputHandler::UpdateSpellSettings( bool bFromStartTab )
return;
ScViewData& rViewData = pActiveViewSh->GetViewData();
- bool bOnlineSpell = rViewData.GetDocument()->GetDocOptions().IsAutoSpell();
+ bool bOnlineSpell = rViewData.GetDocument().GetDocOptions().IsAutoSpell();
// SetDefaultLanguage is independent of the language attributes,
// ScGlobal::GetEditDefaultLanguage is always used.
@@ -937,10 +937,10 @@ void ScInputHandler::UpdateSpellSettings( bool bFromStartTab )
if ( nCntrl != nOld )
mpEditEngine->SetControlWord(nCntrl);
- ScDocument* pDoc = rViewData.GetDocument();
- pDoc->ApplyAsianEditSettings( *mpEditEngine );
+ ScDocument& rDoc = rViewData.GetDocument();
+ rDoc.ApplyAsianEditSettings( *mpEditEngine );
mpEditEngine->SetDefaultHorizontalTextDirection(
- pDoc->GetEditTextDirection( rViewData.GetTabNo() ) );
+ rDoc.GetEditTextDirection( rViewData.GetTabNo() ) );
mpEditEngine->SetFirstWordCapitalization( false );
}
@@ -2645,7 +2645,7 @@ void ScInputHandler::DataChanged( bool bFromTopNotify, bool bSetModified )
}
if (!bNeedGrow)
{
- bNeedGrow = rViewData.GetDocument()->IsLayoutRTL( rViewData.GetTabNo() );
+ bNeedGrow = rViewData.GetDocument().IsLayoutRTL( rViewData.GetTabNo() );
}
if (bNeedGrow)
{
@@ -2946,12 +2946,12 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
// Test if valid (always with simple string)
if ( bModified && nValidation && pActiveViewSh )
{
- ScDocument* pDoc = pActiveViewSh->GetViewData().GetDocument();
- const ScValidationData* pData = pDoc->GetValidationEntry( nValidation );
+ ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocument();
+ const ScValidationData* pData = rDoc.GetValidationEntry( nValidation );
if (pData && pData->HasErrMsg())
{
// #i67990# don't use pLastPattern in EnterHandler
- const ScPatternAttr* pPattern = pDoc->GetPattern( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() );
+ const ScPatternAttr* pPattern = rDoc.GetPattern( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() );
bool bOk;
@@ -2995,8 +2995,8 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
// Check for input into DataPilot table
if ( bModified && pActiveViewSh && !bForget )
{
- ScDocument* pDoc = pActiveViewSh->GetViewData().GetDocument();
- ScDPObject* pDPObj = pDoc->GetDPAtCursor( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() );
+ ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocument();
+ ScDPObject* pDPObj = rDoc.GetDPAtCursor( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() );
if ( pDPObj )
{
// Any input within the DataPilot table is either a valid renaming
@@ -3015,12 +3015,12 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
// it still has to be treated as number, not EditEngine object.
if ( pActiveViewSh )
{
- ScDocument* pDoc = pActiveViewSh->GetViewData().GetDocument();
+ ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocument();
// #i67990# don't use pLastPattern in EnterHandler
- const ScPatternAttr* pPattern = pDoc->GetPattern( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() );
+ const ScPatternAttr* pPattern = rDoc.GetPattern( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() );
if (pPattern)
{
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+ SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
// without conditional format, as in ScColumn::SetString
sal_uInt32 nFormat = pPattern->GetNumberFormat( pFormatter );
double nVal;
@@ -3080,8 +3080,8 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
if ( pCommonAttrs )
{
- ScDocument* pDoc = pActiveViewSh->GetViewData().GetDocument();
- pCellAttrs = std::make_unique<ScPatternAttr>(pDoc->GetPool());
+ ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocument();
+ pCellAttrs = std::make_unique<ScPatternAttr>(rDoc.GetPool());
pCellAttrs->GetFromEditItemSet( pCommonAttrs.get() );
}
}
@@ -3312,7 +3312,7 @@ void ScInputHandler::CancelHandler()
if (pExecuteSh)
pExecuteSh->StopEditShell();
- aCursorPos.Set(pExecuteSh->GetViewData().GetDocument()->MaxCol()+1,0,0); // Invalid flag
+ aCursorPos.Set(pExecuteSh->GetViewData().GetDocument().MaxCol()+1,0,0); // Invalid flag
mpEditEngine->SetTextCurrentDefaults(OUString());
if ( !pLastState && pExecuteSh )
@@ -3337,7 +3337,7 @@ bool ScInputHandler::IsModalMode( const SfxObjectShell* pDocSh )
{
// References to unnamed document; that doesn't work
return bFormulaMode && pRefViewSh
- && pRefViewSh->GetViewData().GetDocument()->GetDocumentShell() != pDocSh
+ && pRefViewSh->GetViewData().GetDocument().GetDocumentShell() != pDocSh
&& !pDocSh->HasName();
}
@@ -3380,7 +3380,7 @@ void ScInputHandler::SetReference( const ScRange& rRef, const ScDocument& rDoc )
const ScDocument* pThisDoc = nullptr;
if (pRefViewSh)
- pThisDoc = pRefViewSh->GetViewData().GetDocument();
+ pThisDoc = &pRefViewSh->GetViewData().GetDocument();
bool bOtherDoc = (pThisDoc != &rDoc);
if (bOtherDoc && !rDoc.GetDocumentShell()->HasName())
{
@@ -4046,7 +4046,7 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState,
// Is the range a name?
//! Find by Timer?
if ( pActiveViewSh )
- pActiveViewSh->GetViewData().GetDocument()->
+ pActiveViewSh->GetViewData().GetDocument().
GetRangeAtBlock( ScRange( rSPos, rEPos ), &aPosStr );
if ( aPosStr.isEmpty() ) // Not a name -> format
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 7db170669a97..03cf77098523 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -391,8 +391,8 @@ void ScInputWindow::Select()
const OUString& rString = aTextWindow.GetTextString();
const sal_Int32 nLen = rString.getLength();
- ScDocument* pDoc = pViewSh->GetViewData().GetDocument();
- CellType eCellType = pDoc->GetCellType( pViewSh->GetViewData().GetCurPos() );
+ ScDocument& rDoc = pViewSh->GetViewData().GetDocument();
+ CellType eCellType = rDoc.GetCellType( pViewSh->GetViewData().GetCurPos() );
switch ( eCellType )
{
case CELLTYPE_VALUE:
@@ -1476,8 +1476,8 @@ void ScTextWnd::InitEditEngine()
if ( mpViewShell )
{
pDocSh = mpViewShell->GetViewData().GetDocShell();
- ScDocument* pDoc = mpViewShell->GetViewData().GetDocument();
- pNew = std::make_unique<ScFieldEditEngine>(pDoc, pDoc->GetEnginePool(), pDoc->GetEditPool());
+ ScDocument& rDoc = mpViewShell->GetViewData().GetDocument();
+ pNew = std::make_unique<ScFieldEditEngine>(&rDoc, rDoc.GetEnginePool(), rDoc.GetEditPool());
}
else
pNew = std::make_unique<ScFieldEditEngine>(nullptr, EditEngine::CreatePool(), nullptr, true);
@@ -2020,8 +2020,8 @@ void ScTextWnd::MakeDialogEditView()
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
if ( pViewSh )
{
- ScDocument* pDoc = pViewSh->GetViewData().GetDocument();
- pNew = std::make_unique<ScFieldEditEngine>(pDoc, pDoc->GetEnginePool(), pDoc->GetEditPool());
+ ScDocument& rDoc = pViewSh->GetViewData().GetDocument();
+ pNew = std::make_unique<ScFieldEditEngine>(&rDoc, rDoc.GetEnginePool(), rDoc.GetEditPool());
}
else
pNew = std::make_unique<ScFieldEditEngine>(nullptr, EditEngine::CreatePool(), nullptr, true);
@@ -2313,9 +2313,9 @@ static ScNameInputType lcl_GetInputType( const OUString& rText )
if ( pViewSh )
{
ScViewData& rViewData = pViewSh->GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
SCTAB nTab = rViewData.GetTabNo();
- formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
+ formula::FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention();
// test in same order as in SID_CURRENTCELL execute
@@ -2326,20 +2326,20 @@ static ScNameInputType lcl_GetInputType( const OUString& rText )
if (rText == ScResId(STR_MANAGE_NAMES))
eRet = SC_MANAGE_NAMES;
- else if ( aRange.Parse( rText, pDoc, eConv ) & ScRefFlags::VALID )
+ else if ( aRange.Parse( rText, &rDoc, eConv ) & ScRefFlags::VALID )
eRet = SC_NAME_INPUT_RANGE;
- else if ( aAddress.Parse( rText, pDoc, eConv ) & ScRefFlags::VALID )
+ else if ( aAddress.Parse( rText, &rDoc, eConv ) & ScRefFlags::VALID )
eRet = SC_NAME_INPUT_CELL;
- else if ( ScRangeUtil::MakeRangeFromName( rText, *pDoc, nTab, aRange, RUTL_NAMES, eConv ) )
+ else if ( ScRangeUtil::MakeRangeFromName( rText, rDoc, nTab, aRange, RUTL_NAMES, eConv ) )
eRet = SC_NAME_INPUT_NAMEDRANGE;
- else if ( ScRangeUtil::MakeRangeFromName( rText, *pDoc, nTab, aRange, RUTL_DBASE, eConv ) )
+ else if ( ScRangeUtil::MakeRangeFromName( rText, rDoc, nTab, aRange, RUTL_DBASE, eConv ) )
eRet = SC_NAME_INPUT_DATABASE;
else if ( comphelper::string::isdigitAsciiString( rText ) &&
- ( nNumeric = rText.toInt32() ) > 0 && nNumeric <= pDoc->MaxRow()+1 )
+ ( nNumeric = rText.toInt32() ) > 0 && nNumeric <= rDoc.MaxRow()+1 )
eRet = SC_NAME_INPUT_ROW;
- else if ( pDoc->GetTable( rText, nNameTab ) )
+ else if ( rDoc.GetTable( rText, nNameTab ) )
eRet = SC_NAME_INPUT_SHEET;
- else if ( ScRangeData::IsNameValid( rText, pDoc ) == ScRangeData::NAME_VALID ) // nothing found, create new range?
+ else if ( ScRangeData::IsNameValid( rText, &rDoc ) == ScRangeData::NAME_VALID ) // nothing found, create new range?
{
if ( rViewData.GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
eRet = SC_NAME_INPUT_DEFINE;
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 8c9bf33d3056..9426658f1894 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1002,7 +1002,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
if ( rOldOpt != rNewOpt )
{
rViewData.SetOptions( rNewOpt ); // Changes rOldOpt
- rViewData.GetDocument()->SetViewOptions( rNewOpt );
+ rViewData.GetDocument().SetViewOptions( rNewOpt );
if (pDocSh)
pDocSh->SetDocumentModified();
bRepaint = true;
@@ -1033,7 +1033,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
{
aNewViewOpt.SetGridOptions( aNewGridOpt );
rViewData.SetOptions( aNewViewOpt );
- rViewData.GetDocument()->SetViewOptions( aNewViewOpt );
+ rViewData.GetDocument().SetViewOptions( aNewViewOpt );
if (pDocSh)
pDocSh->SetDocumentModified();
bRepaint = true;
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 40756b7866d2..09432d8f6454 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -51,11 +51,11 @@ ScCondFormatList::~ScCondFormatList()
Freeze();
}
-void ScCondFormatList::init(ScDocument* pDoc,
+void ScCondFormatList::init(ScDocument& rDoc,
const ScConditionalFormat* pFormat, const ScRangeList& rRanges,
const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType)
{
- mpDoc = pDoc;
+ mpDoc = &rDoc;
maPos = rPos;
maRanges = rRanges;
@@ -440,8 +440,8 @@ ScCondFormatDlg::ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pCW,
}
else if (!mpDlgItem->IsManaged())
{
- ScDocument* pDoc = mpViewData->GetDocument();
- pFormat = pDoc->GetCondFormList(mpViewData->GetTabNo())->GetFormat ( mnKey );
+ ScDocument& rDoc = mpViewData->GetDocument();
+ pFormat = rDoc.GetCondFormList(mpViewData->GetTabNo())->GetFormat ( mnKey );
}
ScRangeList aRange;
@@ -474,8 +474,8 @@ ScCondFormatDlg::ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pCW,
mxEdRange->SetGetFocusHdl( LINK( this, ScCondFormatDlg, RangeGetFocusHdl ) );
OUString aRangeString;
- const ScDocument* pDoc = pViewData->GetDocument();
- aRange.Format(aRangeString, ScRefFlags::VALID, *pDoc, pDoc->GetAddressConvention());
+ const ScDocument& rDoc = pViewData->GetDocument();
+ aRange.Format(aRangeString, ScRefFlags::VALID, rDoc, rDoc.GetAddressConvention());
mxEdRange->SetText(aRangeString);
msBaseTitle = m_xDialog->get_title();
@@ -547,9 +547,9 @@ void ScCondFormatDlg::SetReference(const ScRange& rRef, ScDocument&)
else
nFlags = ScRefFlags::RANGE_ABS;
- const ScDocument* pDoc = mpViewData->GetDocument();
- OUString aRefStr(rRef.Format(*pDoc, nFlags,
- ScAddress::Details(pDoc->GetAddressConvention(), 0, 0)));
+ const ScDocument& rDoc = mpViewData->GetDocument();
+ OUString aRefStr(rRef.Format(rDoc, nFlags,
+ ScAddress::Details(rDoc.GetAddressConvention(), 0, 0)));
if (pEdit != mxEdRange.get())
{
Selection sel = pEdit->GetSelection();
@@ -570,8 +570,8 @@ std::unique_ptr<ScConditionalFormat> ScCondFormatDlg::GetConditionalFormat() con
return nullptr;
ScRangeList aRange;
- ScRefFlags nFlags = aRange.Parse(aRangeStr, *mpViewData->GetDocument(),
- mpViewData->GetDocument()->GetAddressConvention(), maPos.Tab());
+ ScRefFlags nFlags = aRange.Parse(aRangeStr, mpViewData->GetDocument(),
+ mpViewData->GetDocument().GetAddressConvention(), maPos.Tab());
mxCondFormList->SetRange(aRange);
std::unique_ptr<ScConditionalFormat> pFormat = mxCondFormList->GetConditionalFormat();
@@ -671,8 +671,8 @@ IMPL_LINK(ScCondFormatDlg, EdRangeModifyHdl, formula::RefEdit&, rEdit, void)
{
OUString aRangeStr = rEdit.GetText();
ScRangeList aRange;
- ScRefFlags nFlags = aRange.Parse(aRangeStr, *mpViewData->GetDocument(),
- mpViewData->GetDocument()->GetAddressConvention());
+ ScRefFlags nFlags = aRange.Parse(aRangeStr, mpViewData->GetDocument(),
+ mpViewData->GetDocument().GetAddressConvention());
if(nFlags & ScRefFlags::VALID)
{
rEdit.GetWidget()->set_message_type(weld::EntryMessageType::Normal);
diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
index 73e5a820178e..f8aa54ad60d4 100644
--- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
@@ -74,7 +74,7 @@ ScPivotLayoutDialog::ScPivotLayoutDialog(
, maPivotTableObject(*pPivotTableObject)
, mpPreviouslyFocusedListBox(nullptr)
, mpViewData(pViewData)
- , mrDocument(*pViewData->GetDocument())
+ , mrDocument(pViewData->GetDocument())
, mbNewPivotTable(bNewPivotTable)
, maAddressDetails(mrDocument.GetAddressConvention(), 0, 0)
, mbDialogLostFocus(false)
diff --git a/sc/source/ui/dbgui/consdlg.cxx b/sc/source/ui/dbgui/consdlg.cxx
index e0609a493386..3c63a9f14692 100644
--- a/sc/source/ui/dbgui/consdlg.cxx
+++ b/sc/source/ui/dbgui/consdlg.cxx
@@ -75,7 +75,7 @@ ScConsolidateDlg::ScConsolidateDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::W
).GetData() )
, rViewData ( static_cast<ScTabViewShell*>(SfxViewShell::Current())->
GetViewData() )
- , pDoc ( static_cast<ScTabViewShell*>(SfxViewShell::Current())->
+ , rDoc ( static_cast<ScTabViewShell*>(SfxViewShell::Current())->
GetViewData().GetDocument() )
, nAreaDataCount ( 0 )
, nWhichCons ( rArgSet.GetPool()->GetWhich( SID_CONSOLIDATE ) )
@@ -109,8 +109,6 @@ ScConsolidateDlg::~ScConsolidateDlg()
void ScConsolidateDlg::Init()
{
- OSL_ENSURE( pDoc, "Error in Ctor" );
-
OUString aStr;
sal_uInt16 i=0;
@@ -148,23 +146,23 @@ void ScConsolidateDlg::Init()
// read consolidation areas
m_xLbConsAreas->clear();
- const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
+ const formula::FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention();
for ( i=0; i<theConsData.nDataAreaCount; i++ )
{
const ScArea& rArea = theConsData.pDataAreas[i];
- if ( rArea.nTab < pDoc->GetTableCount() )
+ if ( rArea.nTab < rDoc.GetTableCount() )
{
aStr = ScRange( rArea.nColStart, rArea.nRowStart, rArea.nTab,
- rArea.nColEnd, rArea.nRowEnd, rArea.nTab ).Format( *pDoc,
+ rArea.nColEnd, rArea.nRowEnd, rArea.nTab ).Format( rDoc,
ScRefFlags::RANGE_ABS_3D, eConv );
m_xLbConsAreas->append_text(aStr);
}
}
- if ( theConsData.nTab < pDoc->GetTableCount() )
+ if ( theConsData.nTab < rDoc.GetTableCount() )
{
aStr = ScAddress( theConsData.nCol, theConsData.nRow, theConsData.nTab
- ).Format( ScRefFlags::ADDR_ABS_3D, pDoc, eConv );
+ ).Format( ScRefFlags::ADDR_ABS_3D, &rDoc, eConv );
m_xEdDestArea->SetText( aStr );
}
else
@@ -173,8 +171,8 @@ void ScConsolidateDlg::Init()
// Use the ScAreaData helper class to save those range names from the
// RangeNames and database ranges that appear in the ListBoxes.
- ScRangeName* pRangeNames = pDoc->GetRangeName();
- ScDBCollection* pDbNames = pDoc->GetDBCollection();
+ ScRangeName* pRangeNames = rDoc.GetRangeName();
+ ScDBCollection* pDbNames = rDoc.GetDBCollection();
size_t nRangeCount = pRangeNames ? pRangeNames->size() : 0;
size_t nDbCount = pDbNames ? pDbNames->getNamedDBs().size() : 0;
@@ -188,10 +186,10 @@ void ScConsolidateDlg::Init()
OUString aStrName;
sal_uInt16 nAt = 0;
ScRange aRange;
- ScAreaNameIterator aIter( *pDoc );
+ ScAreaNameIterator aIter( rDoc );
while ( aIter.Next( aStrName, aRange ) )
{
- OUString aStrArea(aRange.Format(*pDoc, ScRefFlags::ADDR_ABS_3D, eConv));
+ OUString aStrArea(aRange.Format(rDoc, ScRefFlags::ADDR_ABS_3D, eConv));
pAreaData[nAt++].Set( aStrName, aStrArea );
}
}
@@ -284,18 +282,17 @@ void ScConsolidateDlg::Deactivate()
bool ScConsolidateDlg::VerifyEdit( formula::RefEdit* pEd )
{
- if ( !pDoc ||
- ((pEd != m_xEdDataArea.get()) && (pEd != m_xEdDestArea.get())) )
+ if (pEd != m_xEdDataArea.get() && pEd != m_xEdDestArea.get())
return false;
SCTAB nTab = rViewData.GetTabNo();
bool bEditOk = false;
OUString theCompleteStr;
- const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
+ const formula::FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention();
if ( pEd == m_xEdDataArea.get() )
{
- bEditOk = ScRangeUtil::IsAbsArea( pEd->GetText(), *pDoc,
+ bEditOk = ScRangeUtil::IsAbsArea( pEd->GetText(), rDoc,
nTab, &theCompleteStr, nullptr, nullptr, eConv );
}
else if ( pEd == m_xEdDestArea.get() )
@@ -303,7 +300,7 @@ bool ScConsolidateDlg::VerifyEdit( formula::RefEdit* pEd )
OUString aPosStr;
ScRangeUtil::CutPosString( pEd->GetText(), aPosStr );
- bEditOk = ScRangeUtil::IsAbsPos( aPosStr, *pDoc,
+ bEditOk = ScRangeUtil::IsAbsPos( aPosStr, rDoc,
nTab, &theCompleteStr, nullptr, eConv );
}
@@ -337,9 +334,9 @@ IMPL_LINK_NOARG(ScConsolidateDlg, OkHdl, weld::Button&, void)
ScRefAddress aDestAddress;
SCTAB nTab = rViewData.GetTabNo();
OUString aDestPosStr( m_xEdDestArea->GetText() );
- const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
+ const formula::FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention();
- if ( ScRangeUtil::IsAbsPos( aDestPosStr, *pDoc, nTab, nullptr, &aDestAddress, eConv ) )
+ if ( ScRangeUtil::IsAbsPos( aDestPosStr, rDoc, nTab, nullptr, &aDestAddress, eConv ) )
{
ScConsolidateParam theOutParam( theConsData );
std::unique_ptr<ScArea[]> pDataAreas(new ScArea[nDataAreaCount]);
@@ -347,7 +344,7 @@ IMPL_LINK_NOARG(ScConsolidateDlg, OkHdl, weld::Button&, void)
for ( sal_Int32 i=0; i<nDataAreaCount; ++i )
{
ScRangeUtil::MakeArea(m_xLbConsAreas->get_text(i),
- pDataAreas[i], *pDoc, nTab, eConv);
+ pDataAreas[i], rDoc, nTab, eConv);
}
theOutParam.nCol = aDestAddress.Col();
@@ -389,9 +386,9 @@ IMPL_LINK( ScConsolidateDlg, ClickHdl, weld::Button&, rBtn, void )
OUString aNewEntry( m_xEdDataArea->GetText() );
std::unique_ptr<ScArea[]> ppAreas;
sal_uInt16 nAreaCount = 0;
- const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
+ const formula::FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention();
- if ( ScRangeUtil::IsAbsTabArea( aNewEntry, pDoc, &ppAreas, &nAreaCount, true, eConv ) )
+ if ( ScRangeUtil::IsAbsTabArea( aNewEntry, &rDoc, &ppAreas, &nAreaCount, true, eConv ) )
{
// IsAbsTabArea() creates an array of ScArea pointers,
// which have been created dynamically as well.
@@ -402,7 +399,7 @@ IMPL_LINK( ScConsolidateDlg, ClickHdl, weld::Button&, rBtn, void )
const ScArea& rArea = ppAreas[i];
OUString aNewArea = ScRange( rArea.nColStart, rArea.nRowStart, rArea.nTab,
rArea.nColEnd, rArea.nRowEnd, rArea.nTab
- ).Format(*pDoc, ScRefFlags::RANGE_ABS_3D, eConv);
+ ).Format(rDoc, ScRefFlags::RANGE_ABS_3D, eConv);
if (m_xLbConsAreas->find_text(aNewArea) == -1)
{
diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx
index 45c0b5c71dd4..8b79e7fa3f5e 100644
--- a/sc/source/ui/dbgui/dbnamdlg.cxx
+++ b/sc/source/ui/dbgui/dbnamdlg.cxx
@@ -131,7 +131,7 @@ ScDbNameDlg::ScDbNameDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pPa
: ScAnyRefDlgController(pB, pCW, pParent,
"modules/scalc/ui/definedatabaserangedialog.ui", "DefineDatabaseRangeDialog")
, pViewData(ptrViewData)
- , rDoc(*ptrViewData->GetDocument())
+ , rDoc(ptrViewData->GetDocument())
, bRefInputMode(false)
, aAddrDetails(rDoc.GetAddressConvention(), 0, 0)
, aLocalDbCol(*(rDoc.GetDBCollection()))
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index 2e4ac4730545..46f32bf78fd6 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -162,7 +162,7 @@ void ScFilterDlg::Init( const SfxItemSet& rArgSet )
m_xBtnRemove4->connect_clicked( LINK( this, ScFilterDlg, BtnRemoveHdl ) );
pViewData = rQueryItem.GetViewData();
- pDoc = pViewData ? pViewData->GetDocument() : nullptr;
+ pDoc = pViewData ? &pViewData->GetDocument() : nullptr;
nSrcTab = pViewData ? pViewData->GetTabNo() : static_cast<SCTAB>(0);
// for easier access:
@@ -1325,7 +1325,7 @@ void ScFilterDlg::SetValString( const OUString& rQueryStr, const ScQueryEntry::I
{
if (rQueryStr.isEmpty())
{
- pDoc = pViewData ? pViewData->GetDocument() : nullptr;
+ pDoc = pViewData ? &pViewData->GetDocument() : nullptr;
if (rItem.meType == ScQueryEntry::ByValue)
{
if (pDoc)
diff --git a/sc/source/ui/dbgui/foptmgr.cxx b/sc/source/ui/dbgui/foptmgr.cxx
index 31cb7efa245a..cecf9be64afc 100644
--- a/sc/source/ui/dbgui/foptmgr.cxx
+++ b/sc/source/ui/dbgui/foptmgr.cxx
@@ -48,7 +48,7 @@ ScFilterOptionsMgr::ScFilterOptionsMgr(
const OUString& refStrUndefined )
: pViewData ( ptrViewData ),
- pDoc ( ptrViewData ? ptrViewData->GetDocument() : nullptr ),
+ pDoc ( ptrViewData ? &ptrViewData->GetDocument() : nullptr ),
pBtnCase ( refBtnCase ),
pBtnRegExp ( refBtnRegExp ),
pBtnHeader ( refBtnHeader ),
diff --git a/sc/source/ui/dbgui/pfiltdlg.cxx b/sc/source/ui/dbgui/pfiltdlg.cxx
index 98b0580bdda9..2c257ac686d2 100644
--- a/sc/source/ui/dbgui/pfiltdlg.cxx
+++ b/sc/source/ui/dbgui/pfiltdlg.cxx
@@ -89,7 +89,7 @@ void ScPivotFilterDlg::Init( const SfxItemSet& rArgSet )
m_xBtnUnique->set_active( !theQueryData.bDuplicate );
pViewData = rQueryItem.GetViewData();
- pDoc = pViewData ? pViewData->GetDocument() : nullptr;
+ pDoc = pViewData ? &pViewData->GetDocument() : nullptr;
// for easier access:
aFieldLbArr [0] = m_xLbField1.get();
@@ -307,7 +307,7 @@ const ScQueryItem& ScPivotFilterDlg::GetOutputItem()
sal_Int32 nConnect1 = m_xLbConnect1->get_active();
sal_Int32 nConnect2 = m_xLbConnect2->get_active();
- svl::SharedStringPool& rPool = pViewData->GetDocument()->GetSharedStringPool();
+ svl::SharedStringPool& rPool = pViewData->GetDocument().GetSharedStringPool();
for ( SCSIZE i=0; i<3; i++ )
{
diff --git a/sc/source/ui/dbgui/scendlg.cxx b/sc/source/ui/dbgui/scendlg.cxx
index 5a30dcec7c07..42c27e558210 100644
--- a/sc/source/ui/dbgui/scendlg.cxx
+++ b/sc/source/ui/dbgui/scendlg.cxx
@@ -128,7 +128,7 @@ void ScNewScenarioDlg::SetScenarioData(const OUString& rName, const OUString& rC
IMPL_LINK_NOARG(ScNewScenarioDlg, OkHdl, weld::Button&, void)
{
OUString aName = comphelper::string::strip(m_xEdName->get_text(), ' ');
- ScDocument* pDoc = static_cast<ScTabViewShell*>(SfxViewShell::Current())->GetViewData().GetDocument();
+ ScDocument& rDoc = static_cast<ScTabViewShell*>(SfxViewShell::Current())->GetViewData().GetDocument();
m_xEdName->set_text(aName);
@@ -140,7 +140,7 @@ IMPL_LINK_NOARG(ScNewScenarioDlg, OkHdl, weld::Button&, void)
xInfoBox->run();
m_xEdName->grab_focus();
}
- else if ( !bIsEdit && !pDoc->ValidNewTabName( aName ) )
+ else if ( !bIsEdit && !rDoc.ValidNewTabName( aName ) )
{
std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
VclMessageType::Info, VclButtonsType::Ok,
diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx
index 4d966ce9ddea..585e862d3c33 100644
--- a/sc/source/ui/dbgui/sfiltdlg.cxx
+++ b/sc/source/ui/dbgui/sfiltdlg.cxx
@@ -122,7 +122,7 @@ void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet )
m_xEdFilterArea->SetModifyHdl ( LINK( this, ScSpecialFilterDlg, FilterAreaModHdl ) );
pViewData = rQueryItem.GetViewData();
- pDoc = pViewData ? pViewData->GetDocument() : nullptr;
+ pDoc = pViewData ? &pViewData->GetDocument() : nullptr;
m_xEdFilterArea->SetText( EMPTY_OUSTRING ); // may be overwritten below
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index 6fc4d45655af..a0f7c14a923c 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -317,10 +317,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField )
if ( !pViewData )
return;
- ScDocument* pDoc = pViewData->GetDocument();
-
- if ( !pDoc )
- return;
+ ScDocument& rDoc = pViewData->GetDocument();
for (sal_uInt16 j = nStartField; j < nSortKeyCount; ++j)
{
@@ -339,12 +336,12 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField )
if ( bSortByRows )
{
OUString aFieldName;
- SCCOL nMaxCol = pDoc->ClampToAllocatedColumns(nTab, aSortData.nCol2);
+ SCCOL nMaxCol = rDoc.ClampToAllocatedColumns(nTab, aSortData.nCol2);
SCCOL col;
for ( col=nFirstSortCol; col<=nMaxCol && i<SC_MAXFIELDS; col++ )
{
- aFieldName = pDoc->GetString(col, nFirstSortRow, nTab);
+ aFieldName = rDoc.GetString(col, nFirstSortRow, nTab);
if ( !bHasHeader || aFieldName.isEmpty() )
{
aFieldName = ScGlobal::ReplaceOrAppend( aStrColumn, "%1", ScColToAlpha( col ));
@@ -365,7 +362,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField )
for ( row=nFirstSortRow; row<=nMaxRow && i<SC_MAXFIELDS; row++ )
{
- aFieldName = pDoc->GetString(nFirstSortCol, row, nTab);
+ aFieldName = rDoc.GetString(nFirstSortCol, row, nTab);
if ( !bHasHeader || aFieldName.isEmpty() )
{
aFieldName = ScGlobal::ReplaceOrAppend( aStrRow, "%1", OUString::number( row+1));
@@ -530,7 +527,7 @@ void ScTabPageSortOptions::Init()
m_xLbLanguage->connect_changed( LINK( this, ScTabPageSortOptions, FillAlgorHdl ) );
pViewData = rSortItem.GetViewData();
- pDoc = pViewData ? pViewData->GetDocument() : nullptr;
+ pDoc = pViewData ? &pViewData->GetDocument() : nullptr;
OSL_ENSURE( pViewData, "ViewData not found! :-/" );
diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx
index 92ff178eeaef..30133dce08ad 100644
--- a/sc/source/ui/dbgui/tpsubt.cxx
+++ b/sc/source/ui/dbgui/tpsubt.cxx
@@ -72,7 +72,7 @@ void ScTpSubTotalGroup::Init()
GetItemSet().Get( nWhichSubTotals ));
pViewData = rSubTotalItem.GetViewData();
- pDoc = pViewData ? pViewData->GetDocument() : nullptr;
+ pDoc = pViewData ? &pViewData->GetDocument() : nullptr;
OSL_ENSURE( pViewData && pDoc, "ViewData or Document not found :-(" );
@@ -448,7 +448,7 @@ void ScTpSubTotalOptions::Init()
GetItemSet().Get( nWhichSubTotals ));
pViewData = rSubTotalItem.GetViewData();
- pDoc = pViewData ? pViewData->GetDocument() : nullptr;
+ pDoc = pViewData ? &pViewData->GetDocument() : nullptr;
OSL_ENSURE( pViewData && pDoc, "ViewData or Document not found!" );
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index ab0baaf89402..5b63d210f2df 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -180,7 +180,7 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
sal_uInt16 nSlot = rReq.GetSlot();
vcl::Window* pWin = pViewData->GetActiveWin();
ScDrawView* pView = pViewData->GetScDrawView();
- SdrModel* pDoc = pViewData->GetDocument()->GetDrawLayer();
+ SdrModel* pDoc = pViewData->GetDocument().GetDrawLayer();
const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
const size_t nMarkCount = rMarkList.GetMarkCount();
@@ -484,7 +484,7 @@ void ScDrawShell::ExecuteLineDlg( const SfxRequest& rReq )
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxLineTabDialog( pViewData->GetDialogParent(),
&aNewAttr,
- pViewData->GetDocument()->GetDrawLayer(),
+ pViewData->GetDocument().GetDrawLayer(),
pObj,
bHasMarked));
@@ -518,7 +518,7 @@ void ScDrawShell::ExecuteAreaDlg( const SfxRequest& rReq )
weld::Window* pWin = pViewData->GetDialogParent();
VclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog(
pWin, &aNewAttr,
- pViewData->GetDocument()->GetDrawLayer(), true));
+ pViewData->GetDocument().GetDrawLayer(), true));
pDlg->StartExecuteAsync([=](sal_Int32 nResult){
if ( nResult == RET_OK )
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx
index 15d70334c028..1fb57fcaae1e 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -69,7 +69,7 @@ ScDrawShell::ScDrawShell( ScViewData* pData ) :
SetPool( &pViewData->GetScDrawView()->GetModel()->GetItemPool() );
SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
SetUndoManager( pMgr );
- if ( !pViewData->GetDocument()->IsUndoEnabled() )
+ if ( !pViewData->GetDocument().IsUndoEnabled() )
{
pMgr->SetMaxUndoActionCount( 0 );
}
diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx
index 5b1dd28f08ea..1c4e9f24c2f5 100644
--- a/sc/source/ui/drawfunc/drawsh5.cxx
+++ b/sc/source/ui/drawfunc/drawsh5.cxx
@@ -495,7 +495,7 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq )
{
// graphics objects must have names
// (all graphics are supposed to be in the navigator)
- ScDrawLayer* pModel = pViewData->GetDocument()->GetDrawLayer();
+ ScDrawLayer* pModel = pViewData->GetDocument().GetDrawLayer();
if(pModel)
{
@@ -611,7 +611,7 @@ IMPL_LINK( ScDrawShell, NameObjectHdl, AbstractSvxObjectNameDialog&, rDialog, bo
OUString aName;
rDialog.GetName( aName );
- ScDrawLayer* pModel = pViewData->GetDocument()->GetDrawLayer();
+ ScDrawLayer* pModel = pViewData->GetDocument().GetDrawLayer();
if ( !aName.isEmpty() && pModel )
{
SCTAB nDummyTab;
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index c4a83616eef5..73027fc89771 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -115,7 +115,7 @@ ScDrawTextObjectBar::ScDrawTextObjectBar(ScViewData* pData) :
// At the switching-over the UndoManager is changed to edit mode
SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
SetUndoManager( pMgr );
- if ( !pViewData->GetDocument()->IsUndoEnabled() )
+ if ( !pViewData->GetDocument().IsUndoEnabled() )
{
pMgr->SetMaxUndoActionCount( 0 );
}
@@ -1158,7 +1158,7 @@ void ScDrawTextObjectBar::GetAttrState( SfxItemSet& rDestSet )
if ( eAttrDir == SvxFrameDirection::Environment )
{
// get "environment" direction from page style
- if ( pViewData->GetDocument()->GetEditTextDirection( pViewData->GetTabNo() ) == EEHorizontalTextDirection::R2L )
+ if ( pViewData->GetDocument().GetEditTextDirection( pViewData->GetTabNo() ) == EEHorizontalTextDirection::R2L )
eAttrDir = SvxFrameDirection::Horizontal_RL_TB;
else
eAttrDir = SvxFrameDirection::Horizontal_LR_TB;
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 2a17b04b582f..bd2bbeb3b3ad 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -172,7 +172,7 @@ static void lcl_InsertGraphic( const Graphic& rGraphic,
Point aInsertPos = rViewSh.GetInsertPos();
ScViewData& rData = rViewSh.GetViewData();
- if ( rData.GetDocument()->IsNegativePage( rData.GetTabNo() ) )
+ if ( rData.GetDocument().IsNegativePage( rData.GetTabNo() ) )
aInsertPos.AdjustX( -(aLogicSize.Width()) ); // move position to left edge
ScLimitSizeOnDrawPage( aLogicSize, aInsertPos, pPage->GetSize() );
@@ -193,7 +193,7 @@ static void lcl_InsertGraphic( const Graphic& rGraphic,
pObj->SetName(aName);
if (aAnchorType == SCA_CELL || aAnchorType == SCA_CELL_RESIZE)
- ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *(rData.GetDocument()), rData.GetTabNo(),
+ ScDrawLayer::SetCellAnchoredFromPosition(*pObj, rData.GetDocument(), rData.GetTabNo(),
aAnchorType == SCA_CELL_RESIZE);
// don't select if from (dispatch) API, to allow subsequent cell operations
@@ -229,7 +229,7 @@ static void lcl_InsertMedia( const OUString& rMediaURL, bool bApi,
ScLimitSizeOnDrawPage( aSize, aInsertPos, pPage->GetSize() );
- if( rData.GetDocument()->IsNegativePage( rData.GetTabNo() ) )
+ if( rData.GetDocument().IsNegativePage( rData.GetTabNo() ) )
aInsertPos.AdjustX( -(aSize.Width()) );
OUString realURL;
@@ -240,7 +240,7 @@ static void lcl_InsertMedia( const OUString& rMediaURL, bool bApi,
else
{
uno::Reference<frame::XModel> const xModel(
- rData.GetDocument()->GetDocumentShell()->GetModel());
+ rData.GetDocument().GetDocumentShell()->GetModel());
#if HAVE_FEATURE_AVMEDIA
bool const bRet = ::avmedia::EmbedMedia(xModel, rMediaURL, realURL);
if (!bRet) { return; }
@@ -250,7 +250,7 @@ static void lcl_InsertMedia( const OUString& rMediaURL, bool bApi,
}
SdrMediaObj* pObj = new SdrMediaObj(
- *rData.GetDocument()->GetDrawLayer(),
+ *rData.GetDocument().GetDrawLayer(),
tools::Rectangle(aInsertPos, aSize));
pObj->setURL( realURL, ""/*TODO?*/ );
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index 015457d6b08d..e606054eb089 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -107,8 +107,8 @@ void lcl_ChartInit(const uno::Reference <embed::XEmbeddedObject>& xObj, ScViewDa
PutInOrder( nRow1, nRow2 );
if (nCol2 >= nCol1 || nRow2 >= nRow1)
{
- ScDocument* pDoc = pViewData->GetDocument();
- pDoc->LimitChartArea( nTab1, nCol1,nRow1, nCol2,nRow2 );
+ ScDocument& rDoc = pViewData->GetDocument();
+ rDoc.LimitChartArea( nTab1, nCol1,nRow1, nCol2,nRow2 );
ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
aRangeString = aRange.Format(rScDoc, ScRefFlags::RANGE_ABS_3D, rScDoc.GetAddressConvention());
@@ -341,7 +341,7 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView*
ScViewData& rData = rViewSh.GetViewData();
Point aPnt = rViewSh.GetInsertPos();
- if ( rData.GetDocument()->IsNegativePage( rData.GetTabNo() ) )
+ if ( rData.GetDocument().IsNegativePage( rData.GetTabNo() ) )
aPnt.AdjustX( -(aSize.Width()) ); // move position to left edge
tools::Rectangle aRect (aPnt, aSize);
SdrOle2Obj* pObj = new SdrOle2Obj(
@@ -429,10 +429,10 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV
}
else
{
- ScDocument* pDocument = rViewSh.GetViewData().GetDocument();
- ScDPObject* pObject = pDocument->GetDPAtCursor(rViewSh.GetViewData().GetCurX(),
- rViewSh.GetViewData().GetCurY(),
- rViewSh.GetViewData().GetTabNo());
+ ScDocument& rDocument = rViewSh.GetViewData().GetDocument();
+ ScDPObject* pObject = rDocument.GetDPAtCursor(rViewSh.GetViewData().GetCurX(),
+ rViewSh.GetViewData().GetCurY(),
+ rViewSh.GetViewData().GetTabNo());
if (pObject)
{
aRangeString = pObject->GetName();
@@ -453,7 +453,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV
ScRangeList aRanges;
aMultiMark.FillRangeListWithMarks( &aRanges, false );
OUString aStr;
- aRanges.Format( aStr, ScRefFlags::RANGE_ABS_3D, *pDocument, pDocument->GetAddressConvention() );
+ aRanges.Format( aStr, ScRefFlags::RANGE_ABS_3D, rDocument, rDocument.GetAddressConvention() );
aRangeString = aStr;
// get "total" range for positioning
diff --git a/sc/source/ui/drawfunc/fupoor.cxx b/sc/source/ui/drawfunc/fupoor.cxx
index 2a6fa9cf29db..1db8e6a99d6d 100644
--- a/sc/source/ui/drawfunc/fupoor.cxx
+++ b/sc/source/ui/drawfunc/fupoor.cxx
@@ -81,7 +81,7 @@ void FuPoor::ForceScroll(const Point& aPixPos)
if ( aPixPos.Y() >= aSize.Height() ) dy = 1;
ScViewData& rViewData = rViewShell.GetViewData();
- if ( rViewData.GetDocument()->IsNegativePage( rViewData.GetTabNo() ) )
+ if ( rViewData.GetDocument().IsNegativePage( rViewData.GetTabNo() ) )
dx = -dx;
ScSplitPos eWhich = rViewData.GetActivePart();
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index e3c306574a73..e592085d14de 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -343,7 +343,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
bool bCopy = false;
ScViewData& rViewData = rViewShell.GetViewData();
- ScDocument* pDocument = rViewData.GetDocument();
+ ScDocument& rDocument = rViewData.GetDocument();
SdrPageView* pPageView = ( pView ? pView->GetSdrPageView() : nullptr );
SdrPage* pPage = ( pPageView ? pPageView->GetPage() : nullptr );
::std::vector< OUString > aExcludedChartNames;
@@ -360,7 +360,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
{
ScChartHelper::GetChartNames( aExcludedChartNames, pPage );
}
- if ( pView && pDocument )
+ if ( pView )
{
const SdrMarkList& rSdrMarkList = pView->GetMarkedObjectList();
const size_t nMarkCount = rSdrMarkList.GetMarkCount();
@@ -370,7 +370,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
pObj = ( pMark ? pMark->GetMarkedSdrObj() : nullptr );
if ( pObj )
{
- ScChartHelper::AddRangesIfProtectedChart( aProtectedChartRangesVector, pDocument, pObj );
+ ScChartHelper::AddRangesIfProtectedChart( aProtectedChartRangesVector, &rDocument, pObj );
}
}
}
@@ -514,14 +514,14 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
rViewShell.GetViewData().GetDispatcher().
Execute(SID_OBJECT_SELECT, SfxCallMode::SLOT | SfxCallMode::RECORD);
- if ( bCopy && pDocument && pPage )
+ if ( bCopy && pPage )
{
ScDocShell* pDocShell = rViewData.GetDocShell();
ScModelObj* pModelObj = ( pDocShell ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocShell->GetModel() ) : nullptr );
if ( pModelObj )
{
SCTAB nTab = rViewData.GetTabNo();
- ScChartHelper::CreateProtectedChartListenersAndNotify( pDocument, pPage, pModelObj, nTab,
+ ScChartHelper::CreateProtectedChartListenersAndNotify( &rDocument, pPage, pModelObj, nTab,
aProtectedChartRangesVector, aExcludedChartNames );
}
}
diff --git a/sc/source/ui/drawfunc/fusel2.cxx b/sc/source/ui/drawfunc/fusel2.cxx
index b4ab7cefa6db..12024f29da62 100644
--- a/sc/source/ui/drawfunc/fusel2.cxx
+++ b/sc/source/ui/drawfunc/fusel2.cxx
@@ -120,7 +120,7 @@ bool FuSelection::IsNoteCaptionClicked( const Point& rPos ) const
if( pPageView )
{
const ScViewData& rViewData = rViewShell.GetViewData();
- ScDocument& rDoc = *rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
SCTAB nTab = rViewData.GetTabNo();
ScDocShell* pDocSh = rViewData.GetDocShell();
bool bProtectDoc = rDoc.IsTabProtected( nTab ) || (pDocSh && pDocSh->IsReadOnly());
diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx
index 307cd87ec609..8411f75f62ed 100644
--- a/sc/source/ui/drawfunc/futext3.cxx
+++ b/sc/source/ui/drawfunc/futext3.cxx
@@ -48,7 +48,7 @@ void FuText::StopEditMode()
pView->LockInternalLayer();
ScViewData& rViewData = rViewShell.GetViewData();
- ScDocument& rDoc = *rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
OSL_ENSURE( pDrawLayer && (pDrawLayer == pDrDoc), "FuText::StopEditMode - missing or different drawing layers" );
diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index b57f5531d7ea..b1d703ecd60f 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -85,7 +85,7 @@ ScFormulaDlg::ScFormulaDlg(SfxBindings* pB, SfxChildWindow* pCW,
}
}
- m_pDoc = pViewData->GetDocument();
+ m_pDoc = &pViewData->GetDocument();
m_xParser.set(ScServiceProvider::MakeInstance(ScServiceProvider::Type::FORMULAPARS,
static_cast<ScDocShell*>(m_pDoc->GetDocumentShell())),uno::UNO_QUERY);
uno::Reference< beans::XPropertySet> xSet(m_xParser,uno::UNO_QUERY);
@@ -114,7 +114,7 @@ ScFormulaDlg::ScFormulaDlg(SfxBindings* pB, SfxChildWindow* pCW,
pScMod->SetRefInputHdl(pInputHdl);
- m_pDoc = pViewData->GetDocument();
+ m_pDoc = &pViewData->GetDocument();
SCCOL nCol = pViewData->GetCurX();
SCROW nRow = pViewData->GetCurY();
SCTAB nTab = pViewData->GetTabNo();
diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx
index 30c81b6dafdc..a4997f7bfaaa 100644
--- a/sc/source/ui/inc/condformatdlg.hxx
+++ b/sc/source/ui/inc/condformatdlg.hxx
@@ -51,7 +51,7 @@ public:
weld::Container* GetContainer() { return mxGrid.get(); }
~ScCondFormatList();
- void init(ScDocument* pDoc, const ScConditionalFormat* pFormat,
+ void init(ScDocument& rDoc, const ScConditionalFormat* pFormat,
const ScRangeList& rRanges, const ScAddress& rPos,
condformat::dialog::ScCondFormatDialogType eType);
diff --git a/sc/source/ui/inc/consdlg.hxx b/sc/source/ui/inc/consdlg.hxx
index 098c1424243a..6abcfc85599e 100644
--- a/sc/source/ui/inc/consdlg.hxx
+++ b/sc/source/ui/inc/consdlg.hxx
@@ -48,7 +48,7 @@ private:
ScConsolidateParam theConsData;
ScViewData& rViewData;
- ScDocument* pDoc;
+ ScDocument& rDoc;
std::unique_ptr<ScAreaData[]> pAreaData;
size_t nAreaDataCount;
sal_uInt16 nWhichCons;
diff --git a/sc/source/ui/inc/crnrdlg.hxx b/sc/source/ui/inc/crnrdlg.hxx
index bfca95248a0b..10a577b89262 100644
--- a/sc/source/ui/inc/crnrdlg.hxx
+++ b/sc/source/ui/inc/crnrdlg.hxx
@@ -51,7 +51,7 @@ private:
typedef std::unordered_map< OUString, ScRange > NameRangeMap;
NameRangeMap aRangeMap;
ScViewData* pViewData;
- ScDocument* pDoc;
+ ScDocument& rDoc;
bool bDlgLostFocus;
formula::RefEdit* m_pEdActive;
diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx
index 444ce0d7b421..6ecf44456059 100644
--- a/sc/source/ui/inc/drawview.hxx
+++ b/sc/source/ui/inc/drawview.hxx
@@ -35,7 +35,7 @@ class ScDrawView final : public FmFormView
{
ScViewData* pViewData;
VclPtr<OutputDevice> pDev; //! needed ?
- ScDocument* pDoc;
+ ScDocument& rDoc;
SCTAB nTab;
Fraction aScaleX; // Factor for Drawing-MapMode
Fraction aScaleY;
diff --git a/sc/source/ui/inc/highred.hxx b/sc/source/ui/inc/highred.hxx
index 316c5a62ee07..566811eacd22 100644
--- a/sc/source/ui/inc/highred.hxx
+++ b/sc/source/ui/inc/highred.hxx
@@ -33,7 +33,7 @@ class ScHighlightChgDlg : public ScAnyRefDlgController
{
private:
ScViewData* pViewData;
- ScDocument* pDoc;
+ ScDocument& rDoc;
ScChangeViewSettings aChangeViewSet;
std::unique_ptr<weld::CheckButton> m_xHighlightBox;
diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx
index e7bb0a1df579..405fe99d0328 100644
--- a/sc/source/ui/inc/namedlg.hxx
+++ b/sc/source/ui/inc/namedlg.hxx
@@ -40,7 +40,7 @@ private:
OUString maStrInfoDefault;
ScViewData* mpViewData;
- ScDocument* mpDoc;
+ ScDocument& mrDoc;
const ScAddress maCursorPos;
bool mbDataChanged;
diff --git a/sc/source/ui/inc/olinewin.hxx b/sc/source/ui/inc/olinewin.hxx
index 806960cc762f..9c8e79672727 100644
--- a/sc/source/ui/inc/olinewin.hxx
+++ b/sc/source/ui/inc/olinewin.hxx
@@ -79,7 +79,7 @@ private:
void InitSettings();
/** Returns the calc document. */
- ScDocument& GetDoc() const { return *mrViewData.GetDocument(); }
+ ScDocument& GetDoc() const { return mrViewData.GetDocument(); }
/** Returns the current sheet index. */
SCTAB GetTab() const { return mrViewData.GetTabNo(); }
/** Returns the outline array of the corresponding document. */
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index faebd6ee5aa6..fb60399c56b8 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -155,7 +155,7 @@ class ScBoundsProvider
typedef ScPositionHelper::value_type value_type;
typedef SCCOLROW index_type;
- ScDocument* pDoc;
+ ScDocument& rDoc;
const SCTAB nTab;
const bool bColumnHeader;
const index_type MAX_INDEX;
@@ -379,7 +379,7 @@ public:
void WriteUserDataSequence(css::uno::Sequence <css::beans::PropertyValue>& rSettings) const;
void ReadUserDataSequence(const css::uno::Sequence <css::beans::PropertyValue>& rSettings);
- ScDocument* GetDocument() const;
+ ScDocument& GetDocument() const;
bool IsActive() const { return bActive; }
void Activate(bool bActivate) { bActive = bActivate; }
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index 7d5b3a3569b2..2c2aa60f5031 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -74,7 +74,7 @@ ScAcceptChgDlg::ScAcceptChgDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Windo
, aSelectionIdle("ScAcceptChgDlg SelectionIdle")
, aReOpenIdle("ScAcceptChgDlg ReOpenIdle")
, pViewData( ptrViewData )
- , pDoc( ptrViewData->GetDocument() )
+ , pDoc( &ptrViewData->GetDocument() )
, aStrInsertCols(ScResId(STR_CHG_INSERT_COLS))
, aStrInsertRows(ScResId(STR_CHG_INSERT_ROWS))
, aStrInsertTabs(ScResId(STR_CHG_INSERT_TABS))
@@ -159,9 +159,9 @@ void ScAcceptChgDlg::ReInit(ScViewData* ptrViewData)
{
pViewData=ptrViewData;
if (pViewData)
- pDoc=ptrViewData->GetDocument();
+ pDoc = &ptrViewData->GetDocument();
else
- pDoc=nullptr;
+ pDoc = nullptr;
bNoSelection=false;
bIgnoreMsg=false;
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);
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index c8a172f0a331..1dddf426b60e 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -424,9 +424,9 @@ void ScAutoFmtPreview::Init()
void ScAutoFmtPreview::DetectRTL(const ScViewData *pViewData)
{
SCTAB nCurrentTab = pViewData->GetTabNo();
- ScDocument* pDoc = pViewData->GetDocument();
- mbRTL = pDoc->IsLayoutRTL(nCurrentTab);
- xBreakIter = pDoc->GetBreakIterator();
+ ScDocument& rDoc = pViewData->GetDocument();
+ mbRTL = rDoc.IsLayoutRTL(nCurrentTab);
+ xBreakIter = rDoc.GetBreakIterator();
}
void ScAutoFmtPreview::CalcCellArray( bool bFitWidthP )
diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx
index e2b935c54954..d05007d984f2 100644
--- a/sc/source/ui/miscdlgs/conflictsdlg.cxx
+++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx
@@ -343,7 +343,7 @@ ScConflictsDlg::ScConflictsDlg(weld::Window* pParent, ScViewData* pViewData, ScD
, m_xLbConflicts(new SvxRedlinTable(m_xBuilder->weld_tree_view("container"), nullptr))
{
OSL_ENSURE( mpViewData, "ScConflictsDlg CTOR: mpViewData is null!" );
- mpOwnDoc = ( mpViewData ? mpViewData->GetDocument() : nullptr );
+ mpOwnDoc = ( mpViewData ? &mpViewData->GetDocument() : nullptr );
OSL_ENSURE( mpOwnDoc, "ScConflictsDlg CTOR: mpOwnDoc is null!" );
mpOwnTrack = ( mpOwnDoc ? mpOwnDoc->GetChangeTrack() : nullptr );
OSL_ENSURE( mpOwnTrack, "ScConflictsDlg CTOR: mpOwnTrack is null!" );
diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx
index 4c3e1749e6fc..31dd29e9b879 100644
--- a/sc/source/ui/miscdlgs/crnrdlg.cxx
+++ b/sc/source/ui/miscdlgs/crnrdlg.cxx
@@ -61,7 +61,7 @@ ScColRowNameRangesDlg::ScColRowNameRangesDlg( SfxBindings* pB,
: ScAnyRefDlgController(pB, pCW, pParent, "modules/scalc/ui/namerangesdialog.ui", "NameRangesDialog")
, pViewData(ptrViewData)
- , pDoc(ptrViewData->GetDocument())
+ , rDoc(ptrViewData->GetDocument())
, bDlgLostFocus(false)
, m_pEdActive(nullptr)
, m_xLbRange(m_xBuilder->weld_tree_view("range"))
@@ -84,8 +84,8 @@ ScColRowNameRangesDlg::ScColRowNameRangesDlg( SfxBindings* pB,
m_xRbAssign2->SetReferences(this, m_xEdAssign2.get());
m_xEdAssign2->SetReferences(this, m_xDataFT.get());
- xColNameRanges = pDoc->GetColNameRanges()->Clone();
- xRowNameRanges = pDoc->GetRowNameRanges()->Clone();
+ xColNameRanges = rDoc.GetColNameRanges()->Clone();
+ xRowNameRanges = rDoc.GetRowNameRanges()->Clone();
Init();
}
@@ -165,11 +165,11 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& rLabelRange, bool bRef
SCCOL nCol2 = theCurArea.aEnd.Col();
SCROW nRow1 = theCurArea.aStart.Row();
SCROW nRow2 = theCurArea.aEnd.Row();
- if ( (static_cast<SCCOLROW>(nCol2 - nCol1) >= nRow2 - nRow1) || (nCol1 == 0 && nCol2 == pDoc->MaxCol()) )
+ if ( (static_cast<SCCOLROW>(nCol2 - nCol1) >= nRow2 - nRow1) || (nCol1 == 0 && nCol2 == rDoc.MaxCol()) )
{ // Column headers and the limiting case of the whole sheet
m_xBtnColHead->set_active(true);
m_xBtnRowHead->set_active(false);
- if ( nRow2 == pDoc->MaxRow() )
+ if ( nRow2 == rDoc.MaxRow() )
{
if ( nRow1 == 0 )
bValid = false; // limiting case of the whole sheet
@@ -182,14 +182,14 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& rLabelRange, bool bRef
else
{ // Header at top, data below
theCurData.aStart.SetRow( nRow2 + 1 );
- theCurData.aEnd.SetRow( pDoc->MaxRow() );
+ theCurData.aEnd.SetRow( rDoc.MaxRow() );
}
}
else
{ // Column headers
m_xBtnRowHead->set_active(true);
m_xBtnColHead->set_active(false);
- if ( nCol2 == pDoc->MaxCol() )
+ if ( nCol2 == rDoc.MaxCol() )
{ // Header at the right, data to the left
theCurData.aStart.SetCol( 0 );
theCurData.aEnd.SetCol( nCol2 - 1 );
@@ -197,13 +197,13 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& rLabelRange, bool bRef
else
{ // Header at the left, data to the right
theCurData.aStart.SetCol( nCol2 + 1 );
- theCurData.aEnd.SetCol( pDoc->MaxCol() );
+ theCurData.aEnd.SetCol( rDoc.MaxCol() );
}
}
if ( bValid )
{
- const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
- OUString aStr(theCurArea.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, eConv));
+ const formula::FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention();
+ OUString aStr(theCurArea.Format(rDoc, ScRefFlags::RANGE_ABS_3D, eConv));
if(bRef)
m_xEdAssign->SetRefString( aStr );
@@ -211,7 +211,7 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& rLabelRange, bool bRef
m_xEdAssign->SetText( aStr );
m_xEdAssign->SetCursorAtLast();
- aStr = theCurData.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, eConv);
+ aStr = theCurData.Format(rDoc, ScRefFlags::RANGE_ABS_3D, eConv);
if(bRef)
m_xEdAssign2->SetRefString( aStr );
@@ -253,7 +253,7 @@ void ScColRowNameRangesDlg::AdjustColRowData( const ScRange& rDataRange, bool bR
SCROW nRow1 = theCurArea.aStart.Row();
SCROW nRow2 = theCurArea.aEnd.Row();
if ( nRow1 > 0
- && (theCurData.aEnd.Row() < nRow2 || nRow2 == pDoc->MaxRow()) )
+ && (theCurData.aEnd.Row() < nRow2 || nRow2 == rDoc.MaxRow()) )
{ // Data above header
theCurData.aEnd.SetRow( nRow1 - 1 );
if ( theCurData.aStart.Row() > theCurData.aEnd.Row() )
@@ -276,7 +276,7 @@ void ScColRowNameRangesDlg::AdjustColRowData( const ScRange& rDataRange, bool bR
SCCOL nCol1 = theCurArea.aStart.Col();
SCCOL nCol2 = theCurArea.aEnd.Col();
if ( nCol1 > 0
- && (theCurData.aEnd.Col() < nCol2 || nCol2 == pDoc->MaxCol()) )
+ && (theCurData.aEnd.Col() < nCol2 || nCol2 == rDoc.MaxCol()) )
{ // Data left of header
theCurData.aEnd.SetCol( nCol1 - 1 );
if ( theCurData.aStart.Col() > theCurData.aEnd.Col() )
@@ -290,7 +290,7 @@ void ScColRowNameRangesDlg::AdjustColRowData( const ScRange& rDataRange, bool bR
}
}
}
- OUString aStr(theCurData.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, pDoc->GetAddressConvention()));
+ OUString aStr(theCurData.Format(rDoc, ScRefFlags::RANGE_ABS_3D, rDoc.GetAddressConvention()));
if(bRef)
m_xEdAssign2->SetRefString( aStr );
@@ -361,7 +361,7 @@ void ScColRowNameRangesDlg::UpdateNames()
SCROW nRow2;
SCTAB nTab2;
OUString rString;
- const ScAddress::Details aDetails(pDoc->GetAddressConvention());
+ const ScAddress::Details aDetails(rDoc.GetAddressConvention());
OUString strDelim(" --- ");
OUString aString = strDelim + ScResId( STR_COLUMN ) + strDelim;
@@ -369,12 +369,12 @@ void ScColRowNameRangesDlg::UpdateNames()
if ( xColNameRanges->size() > 0 )
{
std::vector<const ScRangePair*> aSortArray(xColNameRanges->CreateNameSortedArray(
- pDoc ));
+ &rDoc ));
nCount = aSortArray.size();
for ( j=0; j < nCount; j++ )
{
const ScRange aRange(aSortArray[j]->GetRange(0));
- aString = aRange.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, aDetails);
+ aString = aRange.Format(rDoc, ScRefFlags::RANGE_ABS_3D, aDetails);
//@008 get range parameters from document
aSortArray[j]->GetRange(0).GetVars( nCol1, nRow1, nTab1,
@@ -383,12 +383,12 @@ void ScColRowNameRangesDlg::UpdateNames()
if(q>nCol2) q=nCol2;
//@008 construct string
OUStringBuffer strShow = " [";
- rString = pDoc->GetString(nCol1, nRow1, nTab1);
+ rString = rDoc.GetString(nCol1, nRow1, nTab1);
strShow.append(rString);
for(SCCOL i=nCol1+1;i<=q;i++)
{
strShow.append(", ");
- rString = pDoc->GetString(i, nRow1, nTab1);
+ rString = rDoc.GetString(i, nRow1, nTab1);
strShow.append(rString);
}
if(q<nCol2) // Too long? Add ",..."
@@ -408,12 +408,12 @@ void ScColRowNameRangesDlg::UpdateNames()
if ( xRowNameRanges->size() > 0 )
{
std::vector<const ScRangePair*> aSortArray(xRowNameRanges->CreateNameSortedArray(
- pDoc ));
+ &rDoc ));
nCount = aSortArray.size();
for ( j=0; j < nCount; j++ )
{
const ScRange aRange(aSortArray[j]->GetRange(0));
- aString = aRange.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, aDetails);
+ aString = aRange.Format(rDoc, ScRefFlags::RANGE_ABS_3D, aDetails);
//@008 Build string for rows below
aSortArray[j]->GetRange(0).GetVars( nCol1, nRow1, nTab1,
@@ -421,12 +421,12 @@ void ScColRowNameRangesDlg::UpdateNames()
SCROW q=nRow1+3;
if(q>nRow2) q=nRow2;
OUStringBuffer strShow = " [";
- rString = pDoc->GetString(nCol1, nRow1, nTab1);
+ rString = rDoc.GetString(nCol1, nRow1, nTab1);
strShow.append(rString);
for(SCROW i=nRow1+1;i<=q;i++)
{
strShow.append(", ");
- rString = pDoc->GetString(nCol1, i, nTab1);
+ rString = rDoc.GetString(nCol1, i, nTab1);
strShow.append(rString);
}
if(q<nRow2)
@@ -455,16 +455,16 @@ void ScColRowNameRangesDlg::UpdateRangeData( const ScRange& rRange, bool bColNam
if ( bFound )
{
- const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
+ const formula::FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention();
theCurArea = rRange;
- OUString aStr(theCurArea.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, eConv));
+ OUString aStr(theCurArea.Format(rDoc, ScRefFlags::RANGE_ABS_3D, eConv));
m_xEdAssign->SetText( aStr );
m_xBtnAdd->set_sensitive(false);
m_xBtnRemove->set_sensitive(true);
m_xBtnColHead->set_active(bColName);
m_xBtnRowHead->set_active(!bColName);
theCurData = pPair->GetRange(1);
- aStr = theCurData.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, eConv);
+ aStr = theCurData.Format(rDoc, ScRefFlags::RANGE_ABS_3D, eConv);
m_xEdAssign2->SetText( aStr );
}
else
@@ -492,12 +492,12 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, OkBtnHdl, weld::Button&, void)
AddBtnHdl(*m_xBtnAdd);
// assign RangeLists to the references in the document
- pDoc->GetColNameRangesRef() = xColNameRanges;
- pDoc->GetRowNameRangesRef() = xRowNameRanges;
+ rDoc.GetColNameRangesRef() = xColNameRanges;
+ rDoc.GetRowNameRangesRef() = xRowNameRanges;
// changed ranges need to take effect
- pDoc->CompileColRowNameFormula();
+ rDoc.CompileColRowNameFormula();
ScDocShell* pDocShell = pViewData->GetDocShell();
- pDocShell->PostPaint(ScRange(0, 0, 0, pDoc->MaxCol(), pDoc->MaxRow(), MAXTAB), PaintPartFlags::Grid);
+ pDocShell->PostPaint(ScRange(0, 0, 0, rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB), PaintPartFlags::Grid);
pDocShell->SetDocumentModified();
response(RET_OK);
@@ -517,10 +517,10 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, AddBtnHdl, weld::Button&, void)
if (aNewArea.isEmpty() || aNewData.isEmpty())
return;
- const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
+ const formula::FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention();
ScRange aRange1, aRange2;
- bool bOk1 = (aRange1.ParseAny( aNewArea, *pDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID;
- if ( bOk1 && (aRange2.ParseAny( aNewData, *pDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID)
+ bool bOk1 = (aRange1.ParseAny( aNewArea, rDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID;
+ if ( bOk1 && (aRange2.ParseAny( aNewData, rDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID)
{
theCurArea = aRange1;
AdjustColRowData( aRange2 );
@@ -690,10 +690,10 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, Range1DataModifyHdl, formula::RefEdit&, v
{
OUString aNewArea( m_xEdAssign->GetText() );
bool bValid = false;
- if (!aNewArea.isEmpty() && pDoc)
+ if (!aNewArea.isEmpty())
{
ScRange aRange;
- if ( (aRange.ParseAny(aNewArea, *pDoc, pDoc->GetAddressConvention() ) & ScRefFlags::VALID) == ScRefFlags::VALID)
+ if ( (aRange.ParseAny(aNewArea, rDoc, rDoc.GetAddressConvention() ) & ScRefFlags::VALID) == ScRefFlags::VALID)
{
SetColRowData( aRange );
bValid = true;
@@ -725,7 +725,7 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, Range2DataModifyHdl, formula::RefEdit&, v
if ( !aNewData.isEmpty() )
{
ScRange aRange;
- if ( (aRange.ParseAny(aNewData, *pDoc, pDoc->GetAddressConvention() ) & ScRefFlags::VALID) == ScRefFlags::VALID)
+ if ( (aRange.ParseAny(aNewData, rDoc, rDoc.GetAddressConvention() ) & ScRefFlags::VALID) == ScRefFlags::VALID)
{
AdjustColRowData( aRange );
m_xBtnAdd->set_sensitive(true);
@@ -745,15 +745,15 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, ColClickHdl, weld::Button&, void)
if (!m_xBtnColHead->get_active())
return;
- if ( theCurArea.aStart.Row() == 0 && theCurArea.aEnd.Row() == pDoc->MaxRow() )
+ if ( theCurArea.aStart.Row() == 0 && theCurArea.aEnd.Row() == rDoc.MaxRow() )
{
- theCurArea.aEnd.SetRow( pDoc->MaxRow() - 1 );
- OUString aStr(theCurArea.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, pDoc->GetAddressConvention()));
+ theCurArea.aEnd.SetRow( rDoc.MaxRow() - 1 );
+ OUString aStr(theCurArea.Format(rDoc, ScRefFlags::RANGE_ABS_3D, rDoc.GetAddressConvention()));
m_xEdAssign->SetText( aStr );
}
ScRange aRange( theCurData );
- aRange.aStart.SetRow( std::min( static_cast<long>(theCurArea.aEnd.Row() + 1), static_cast<long>(pDoc->MaxRow()) ) );
- aRange.aEnd.SetRow( pDoc->MaxRow() );
+ aRange.aStart.SetRow( std::min( static_cast<long>(theCurArea.aEnd.Row() + 1), static_cast<long>(rDoc.MaxRow()) ) );
+ aRange.aEnd.SetRow( rDoc.MaxRow() );
AdjustColRowData( aRange );
}
@@ -763,15 +763,15 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, RowClickHdl, weld::Button&, void)
if (!m_xBtnRowHead->get_active())
return;
- if ( theCurArea.aStart.Col() == 0 && theCurArea.aEnd.Col() == pDoc->MaxCol() )
+ if ( theCurArea.aStart.Col() == 0 && theCurArea.aEnd.Col() == rDoc.MaxCol() )
{
- theCurArea.aEnd.SetCol( pDoc->MaxCol() - 1 );
- OUString aStr(theCurArea.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, pDoc->GetAddressConvention()));
+ theCurArea.aEnd.SetCol( rDoc.MaxCol() - 1 );
+ OUString aStr(theCurArea.Format(rDoc, ScRefFlags::RANGE_ABS_3D, rDoc.GetAddressConvention()));
m_xEdAssign->SetText( aStr );
}
ScRange aRange( theCurData );
- aRange.aStart.SetCol( static_cast<SCCOL>(std::min( static_cast<long>(theCurArea.aEnd.Col() + 1), static_cast<long>(pDoc->MaxCol()) )) );
- aRange.aEnd.SetCol( pDoc->MaxCol() );
+ aRange.aStart.SetCol( static_cast<SCCOL>(std::min( static_cast<long>(theCurArea.aEnd.Col() + 1), static_cast<long>(rDoc.MaxCol()) )) );
+ aRange.aEnd.SetCol( rDoc.MaxCol() );
AdjustColRowData( aRange );
}
diff --git a/sc/source/ui/miscdlgs/datafdlg.cxx b/sc/source/ui/miscdlgs/datafdlg.cxx
index d6026c8b7937..df21fb4c26b7 100644
--- a/sc/source/ui/miscdlgs/datafdlg.cxx
+++ b/sc/source/ui/miscdlgs/datafdlg.cxx
@@ -47,8 +47,8 @@ ScDataFormDlg::ScDataFormDlg(weld::Window* pParent, ScTabViewShell* pTabViewShel
OSL_ENSURE( pTabViewShell, "pTabViewShell is NULL! :-/" );
ScViewData& rViewData = pTabViewShell->GetViewData();
- pDoc = rViewData.GetDocument();
- if (pDoc)
+ pDoc = &rViewData.GetDocument();
+
{
ScRange aRange;
rViewData.GetSimpleArea( aRange );
diff --git a/sc/source/ui/miscdlgs/highred.cxx b/sc/source/ui/miscdlgs/highred.cxx
index 584119681fa0..c6cc22765e0d 100644
--- a/sc/source/ui/miscdlgs/highred.cxx
+++ b/sc/source/ui/miscdlgs/highred.cxx
@@ -29,7 +29,7 @@ ScHighlightChgDlg::ScHighlightChgDlg(SfxBindings* pB, SfxChildWindow* pCW, weld:
ScViewData* ptrViewData)
: ScAnyRefDlgController(pB, pCW, pParent, "modules/scalc/ui/showchangesdialog.ui", "ShowChangesDialog")
, pViewData(ptrViewData)
- , pDoc(ptrViewData->GetDocument())
+ , rDoc(ptrViewData->GetDocument())
, m_xHighlightBox(m_xBuilder->weld_check_button("showchanges"))
, m_xCbAccept(m_xBuilder->weld_check_button("showaccepted"))
, m_xCbReject(m_xBuilder->weld_check_button("showrejected"))
@@ -59,9 +59,9 @@ ScHighlightChgDlg::~ScHighlightChgDlg()
void ScHighlightChgDlg::Init()
{
- OSL_ENSURE( pViewData && pDoc, "ViewData or Document not found!" );
+ OSL_ENSURE( pViewData, "ViewData or Document not found!" );
- ScChangeTrack* pChanges=pDoc->GetChangeTrack();
+ ScChangeTrack* pChanges = rDoc.GetChangeTrack();
if(pChanges!=nullptr)
{
aChangeViewSet.SetTheAuthorToShow(pChanges->GetUser());
@@ -71,7 +71,7 @@ void ScHighlightChgDlg::Init()
m_xFilterCtr->InsertAuthor(rItem);
}
- ScChangeViewSettings* pViewSettings=pDoc->GetChangeViewSettings();
+ ScChangeViewSettings* pViewSettings = rDoc.GetChangeViewSettings();
if(pViewSettings!=nullptr)
aChangeViewSet=*pViewSettings;
@@ -116,7 +116,7 @@ void ScHighlightChgDlg::Init()
if ( !aChangeViewSet.GetTheRangeList().empty() )
{
const ScRange & rRangeEntry = aChangeViewSet.GetTheRangeList().front();
- OUString aRefStr(rRangeEntry.Format(*pDoc, ScRefFlags::RANGE_ABS_3D));
+ OUString aRefStr(rRangeEntry.Format(rDoc, ScRefFlags::RANGE_ABS_3D));
m_xFilterCtr->SetRange(aRefStr);
}
m_xFilterCtr->Enable(true);
@@ -212,10 +212,10 @@ IMPL_LINK_NOARG(ScHighlightChgDlg, OKBtnHdl, weld::Button&, void)
aChangeViewSet.SetHasComment(m_xFilterCtr->IsComment());
aChangeViewSet.SetTheComment(m_xFilterCtr->GetComment());
ScRangeList aLocalRangeList;
- aLocalRangeList.Parse(m_xFilterCtr->GetRange(), *pDoc);
+ aLocalRangeList.Parse(m_xFilterCtr->GetRange(), rDoc);
aChangeViewSet.SetTheRangeList(aLocalRangeList);
- aChangeViewSet.AdjustDateMode( *pDoc );
- pDoc->SetChangeViewSettings(aChangeViewSet);
+ aChangeViewSet.AdjustDateMode( rDoc );
+ rDoc.SetChangeViewSettings(aChangeViewSet);
pViewData->GetDocShell()->PostPaintGridAll();
response(RET_OK);
}
diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx
index 473646d227f9..a2f19ab05c8b 100644
--- a/sc/source/ui/miscdlgs/instbdlg.cxx
+++ b/sc/source/ui/miscdlgs/instbdlg.cxx
@@ -37,7 +37,7 @@
ScInsertTableDlg::ScInsertTableDlg(weld::Window* pParent, ScViewData& rData, SCTAB nTabCount, bool bFromFile)
: GenericDialogController(pParent, "modules/scalc/ui/insertsheet.ui", "InsertSheetDialog")
, rViewData(rData)
- , rDoc(*rData.GetDocument())
+ , rDoc(rData.GetDocument())
, pDocShTables(nullptr)
, bMustClose(false)
, nSelTabIndex(0)
diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx
index 920f4d52ce11..9a4ec692bd7c 100644
--- a/sc/source/ui/namedlg/namedefdlg.cxx
+++ b/sc/source/ui/namedlg/namedefdlg.cxx
@@ -30,7 +30,7 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, weld::Window*
const ScAddress& aCursorPos, const bool bUndo )
: ScAnyRefDlgController( pB, pCW, pParent, "modules/scalc/ui/definename.ui", "DefineNameDialog")
, mbUndo( bUndo )
- , mrDoc(*pViewData->GetDocument())
+ , mrDoc(pViewData->GetDocument())
, mpDocShell ( pViewData->GetDocShell() )
, maCursorPos( aCursorPos )
, maGlobalNameStr ( ScResId(STR_GLOBAL_SCOPE) )
diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx
index 2b237dedf16c..140e74eb547e 100644
--- a/sc/source/ui/namedlg/namedlg.cxx
+++ b/sc/source/ui/namedlg/namedlg.cxx
@@ -54,7 +54,7 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParen
, maStrMultiSelect(ScResId(STR_MULTI_SELECT))
, mpViewData(ptrViewData)
- , mpDoc(ptrViewData->GetDocument())
+ , mrDoc(ptrViewData->GetDocument())
, maCursorPos(aCursorPos)
, mbDataChanged(false)
, mbCloseWithoutUndo(false)
@@ -83,7 +83,7 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParen
if (!pRangeMap)
{
std::map<OUString, ScRangeName*> aRangeMap;
- mpDoc->GetRangeNameMap(aRangeMap);
+ mrDoc.GetRangeNameMap(aRangeMap);
for (const auto& [aTemp, pRangeName] : aRangeMap)
{
m_RangeMap.insert(std::make_pair(aTemp, std::make_unique<ScRangeName>(*pRangeName)));
@@ -102,8 +102,6 @@ ScNameDlg::~ScNameDlg()
void ScNameDlg::Init()
{
- OSL_ENSURE( mpViewData && mpDoc, "ViewData or Document not found!" );
-
//init UI
std::unique_ptr<weld::TreeView> xTreeView(m_xBuilder->weld_tree_view("names"));
@@ -136,11 +134,11 @@ void ScNameDlg::Init()
// Initialize scope list.
m_xLbScope->append_text(maGlobalNameStr);
m_xLbScope->set_active(0);
- SCTAB n = mpDoc->GetTableCount();
+ SCTAB n = mrDoc.GetTableCount();
for (SCTAB i = 0; i < n; ++i)
{
OUString aTabName;
- mpDoc->GetName(i, aTabName);
+ mrDoc.GetName(i, aTabName);
m_xLbScope->append_text(aTabName);
}
@@ -250,7 +248,7 @@ bool ScNameDlg::IsNameValid()
ScRangeName* pRangeName = GetRangeName( aScope );
- if (ScRangeData::IsNameValid( aName, mpDoc ) != ScRangeData::NAME_VALID)
+ if (ScRangeData::IsNameValid( aName, &mrDoc ) != ScRangeData::NAME_VALID)
{
m_xFtInfo->set_label_type(weld::LabelType::Error);
m_xFtInfo->set_label(maErrInvalidNameStr);
@@ -268,7 +266,7 @@ bool ScNameDlg::IsNameValid()
bool ScNameDlg::IsFormulaValid()
{
- ScCompiler aComp( mpDoc, maCursorPos, mpDoc->GetGrammar());
+ ScCompiler aComp( &mrDoc, maCursorPos, mrDoc.GetGrammar());
std::unique_ptr<ScTokenArray> pCode = aComp.CompileString(m_xEdAssign->GetText());
if (pCode->GetCodeError() != FormulaError::NONE)
{
@@ -388,7 +386,7 @@ void ScNameDlg::NameModified()
if ( m_xBtnPrintArea->get_active() ) nType |= ScRangeData::Type::PrintArea;
if ( m_xBtnCriteria->get_active() ) nType |= ScRangeData::Type::Criteria;
- ScRangeData* pNewEntry = new ScRangeData( *mpDoc, aNewName, aExpr,
+ ScRangeData* pNewEntry = new ScRangeData( mrDoc, aNewName, aExpr,
maCursorPos, nType);
pNewEntry->SetIndex( nIndex);
pNewRangeName->insert(pNewEntry, false /*bReuseFreeIndex*/);
diff --git a/sc/source/ui/navipi/navcitem.cxx b/sc/source/ui/navipi/navcitem.cxx
index a3ba855cc27c..bac2b45e179d 100644
--- a/sc/source/ui/navipi/navcitem.cxx
+++ b/sc/source/ui/navipi/navcitem.cxx
@@ -51,7 +51,7 @@ void ScNavigatorControllerItem::StateChanged( sal_uInt16 /* nSID */, SfxItemStat
const OUString& aAddress( pCellPosItem->GetValue() );
ScAddress aScAddress;
ScViewData* pViewData = rNavigatorDlg.GetViewData();
- aScAddress.Parse(aAddress, pViewData ? pViewData->GetDocument() : nullptr);
+ aScAddress.Parse(aAddress, pViewData ? &pViewData->GetDocument() : nullptr);
SCCOL nCol = aScAddress.Col()+1;
SCROW nRow = aScAddress.Row()+1;
diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index d0bf33ae0d95..1ff33a64cfd4 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -136,7 +136,7 @@ IMPL_LINK(ScNavigatorDlg, ParseRowInputHdl, int*, result, bool)
// nKeyGroup is no longer set at VCL, in cause of lack of keyinput
ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() );
- auto& rDoc = *pViewSh->GetViewData().GetDocument();
+ auto& rDoc = pViewSh->GetViewData().GetDocument();
if ( CharClass::isAsciiNumeric(aStrCol) )
nCol = NumStrToAlpha( rDoc.GetSheetLimits(), aStrCol );
else
@@ -347,14 +347,14 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, vcl::Window* pParent)
set_id("NavigatorPanelParent"); // for uitests
GetViewData();
- ScDocument* pDoc = pViewData->GetDocument();
- m_xEdRow->set_range(1, SCNAV_MAXROW(pDoc->GetSheetLimits()));
+ ScDocument& rDoc = pViewData->GetDocument();
+ m_xEdRow->set_range(1, SCNAV_MAXROW(rDoc.GetSheetLimits()));
m_xEdRow->set_width_chars(5);
//max rows is 1,000,000, which is too long for typical use
m_xEdRow->connect_activate(LINK(this, ScNavigatorDlg, ExecuteRowHdl));
- m_xEdCol->set_range(1, SCNAV_MAXCOL(pDoc->GetSheetLimits()));
- m_xEdCol->set_width_chars(SCNAV_COLDIGITS(pDoc->GetSheetLimits())); // 1...256...18278 or A...IV...ZZZ
+ m_xEdCol->set_range(1, SCNAV_MAXCOL(rDoc.GetSheetLimits()));
+ m_xEdCol->set_width_chars(SCNAV_COLDIGITS(rDoc.GetSheetLimits())); // 1...256...18278 or A...IV...ZZZ
m_xEdCol->connect_activate(LINK(this, ScNavigatorDlg, ExecuteColHdl));
m_xEdCol->connect_output(LINK(this, ScNavigatorDlg, FormatRowOutputHdl));
m_xEdCol->connect_input(LINK(this, ScNavigatorDlg, ParseRowInputHdl));
@@ -607,19 +607,19 @@ void ScNavigatorDlg::SetCurrentTableStr( const OUString& rName )
{
if (!GetViewData()) return;
- ScDocument* pDoc = pViewData->GetDocument();
- SCTAB nCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pViewData->GetDocument();
+ SCTAB nCount = rDoc.GetTableCount();
OUString aTabName;
SCTAB nLastSheet = 0;
for (SCTAB i = 0; i<nCount; i++)
{
- pDoc->GetName(i, aTabName);
+ rDoc.GetName(i, aTabName);
if (aTabName == rName)
{
// Check if this is a Scenario sheet and if so select the sheet
// where it belongs to, which is the previous non-Scenario sheet.
- if (pDoc->IsScenario(i))
+ if (rDoc.IsScenario(i))
{
SetCurrentTable(nLastSheet);
return;
@@ -632,7 +632,7 @@ void ScNavigatorDlg::SetCurrentTableStr( const OUString& rName )
}
else
{
- if (!pDoc->IsScenario(i))
+ if (!rDoc.IsScenario(i))
nLastSheet = i;
}
}
diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx
index e0e4ed90e3c2..33f5bad417a7 100644
--- a/sc/source/ui/optdlg/tpusrlst.cxx
+++ b/sc/source/ui/optdlg/tpusrlst.cxx
@@ -105,7 +105,7 @@ void ScTpUserLists::Init()
SCROW nEndRow = 0;
pViewData = &pViewSh->GetViewData();
- pDoc = pViewData->GetDocument();
+ pDoc = &pViewData->GetDocument();
pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab,
nEndCol, nEndRow, nEndTab );
diff --git a/sc/source/ui/pagedlg/tphf.cxx b/sc/source/ui/pagedlg/tphf.cxx
index b4689f51197f..b5e53311b6aa 100644
--- a/sc/source/ui/pagedlg/tphf.cxx
+++ b/sc/source/ui/pagedlg/tphf.cxx
@@ -59,9 +59,9 @@ ScHFPage::ScHFPage(weld::Container* pPage, weld::DialogController* pController,
if ( pViewSh )
{
ScViewData& rViewData = pViewSh->GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
- aStrPageStyle = pDoc->GetPageStyle( rViewData.GetTabNo() );
+ aStrPageStyle = rDoc.GetPageStyle( rViewData.GetTabNo() );
}
m_xBtnEdit->connect_clicked(LINK(this, ScHFPage, BtnHdl));
diff --git a/sc/source/ui/uitest/uiobject.cxx b/sc/source/ui/uitest/uiobject.cxx
index 18609b38af10..21b101b5bf46 100644
--- a/sc/source/ui/uitest/uiobject.cxx
+++ b/sc/source/ui/uitest/uiobject.cxx
@@ -34,19 +34,19 @@
namespace {
-ScAddress get_address_from_string(const ScDocument* pDoc, const OUString& rStr)
+ScAddress get_address_from_string(const ScDocument& rDoc, const OUString& rStr)
{
ScAddress aAddr;
sal_Int32 nOffset = 0;
- ScRangeStringConverter::GetAddressFromString(aAddr, rStr, pDoc, formula::FormulaGrammar::CONV_OOO, nOffset);
+ ScRangeStringConverter::GetAddressFromString(aAddr, rStr, &rDoc, formula::FormulaGrammar::CONV_OOO, nOffset);
return aAddr;
}
-ScRange get_range_from_string(const ScDocument* pDoc, const OUString& rStr)
+ScRange get_range_from_string(const ScDocument& rDoc, const OUString& rStr)
{
ScRange aRange;
sal_Int32 nOffset = 0;
- ScRangeStringConverter::GetRangeFromString(aRange, rStr, pDoc, formula::FormulaGrammar::CONV_OOO, nOffset);
+ ScRangeStringConverter::GetRangeFromString(aRange, rStr, &rDoc, formula::FormulaGrammar::CONV_OOO, nOffset);
return aRange;
}
@@ -75,15 +75,15 @@ StringMap ScGridWinUIObject::get_state()
ScRangeList aMarkedArea = mxGridWindow->getViewData()->GetMarkData().GetMarkedRanges();
OUString aMarkedAreaString;
- ScRangeStringConverter::GetStringFromRangeList(aMarkedAreaString, &aMarkedArea, mxGridWindow->getViewData()->GetDocument(), formula::FormulaGrammar::CONV_OOO);
+ ScRangeStringConverter::GetStringFromRangeList(aMarkedAreaString, &aMarkedArea, &mxGridWindow->getViewData()->GetDocument(), formula::FormulaGrammar::CONV_OOO);
aMap["MarkedArea"] = aMarkedAreaString;
- ScDocument* pDoc = mxGridWindow->getViewData()->GetDocument();
+ ScDocument& rDoc = mxGridWindow->getViewData()->GetDocument();
ScAddress aPos( mxGridWindow->getViewData()->GetCurX() , mxGridWindow->getViewData()->GetCurY() , mxGridWindow->getViewData()->GetTabNo() );
- if ( pDoc->HasNote( aPos ) )
+ if ( rDoc.HasNote( aPos ) )
{
- ScPostIt* pNote = pDoc->GetNote(aPos);
+ ScPostIt* pNote = rDoc.GetNote(aPos);
assert(pNote);
aMap["CurrentCellCommentText"] = pNote->GetText();
}
@@ -270,9 +270,9 @@ void ScGridWinUIObject::execute(const OUString& rAction,
{
auto itr = rParameters.find("SETTEXT");
const OUString rStr = itr->second;
- ScDocument* pDoc = mxGridWindow->getViewData()->GetDocument();
+ ScDocument& rDoc = mxGridWindow->getViewData()->GetDocument();
ScAddress aPos( mxGridWindow->getViewData()->GetCurX() , mxGridWindow->getViewData()->GetCurY() , mxGridWindow->getViewData()->GetTabNo() );
- pDoc->GetOrCreateNote( aPos )->SetText( aPos , rStr );
+ rDoc.GetOrCreateNote( aPos )->SetText( aPos , rStr );
}
}
else if (rAction == "SIDEBAR")
@@ -320,7 +320,7 @@ namespace {
ScDrawLayer* get_draw_layer(VclPtr<ScGridWindow> const & xGridWindow)
{
- return xGridWindow->getViewData()->GetDocument()->GetDrawLayer();
+ return xGridWindow->getViewData()->GetDocument().GetDrawLayer();
}
SdrPage* get_draw_page(VclPtr<ScGridWindow> const & xGridWindow, SCTAB nTab)
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 2ef4fae1490a..a7a265135a44 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1770,7 +1770,7 @@ bool ScUndoUseScenario::CanRepeat(SfxRepeatTarget& rTarget) const
if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr)
{
ScViewData& rViewData = static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->GetViewData();
- return !rViewData.GetDocument()->IsScenario( rViewData.GetTabNo() );
+ return !rViewData.GetDocument().IsScenario( rViewData.GetTabNo() );
}
return false;
}
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index b99ed1692f13..acb75f463952 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -594,7 +594,7 @@ int ScModelObj::getPart()
OUString ScModelObj::getPartInfo( int nPart )
{
ScViewData* pViewData = ScDocShell::GetViewData();
- const bool bIsVisible = pViewData->GetDocument()->IsVisible(nPart);
+ const bool bIsVisible = pViewData->GetDocument().IsVisible(nPart);
//FIXME: Implement IsSelected().
const bool bIsSelected = false; //pViewData->GetDocument()->IsSelected(nPart);
@@ -610,7 +610,7 @@ OUString ScModelObj::getPartName( int nPart )
{
OUString sTabName;
ScViewData* pViewData = ScDocShell::GetViewData();
- pViewData->GetDocument()->GetName(nPart, sTabName);
+ pViewData->GetDocument().GetName(nPart, sTabName);
return sTabName;
}
@@ -618,7 +618,7 @@ OUString ScModelObj::getPartHash( int nPart )
{
sal_Int64 nHashCode;
ScViewData* pViewData = ScDocShell::GetViewData();
- return (pViewData->GetDocument()->GetHashCode(nPart, nHashCode) ? OUString::number(nHashCode) : OUString());
+ return (pViewData->GetDocument().GetHashCode(nPart, nHashCode) ? OUString::number(nHashCode) : OUString());
}
VclPtr<vcl::Window> ScModelObj::getDocWindow()
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 89ca54957688..052618d69786 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -376,8 +376,8 @@ awt::Rectangle ScViewPaneBase::GetVisArea() const
pViewShell->GetViewData().GetActivePart() :
static_cast<ScSplitPos>(nPane);
ScGridWindow* pWindow = static_cast<ScGridWindow*>(pViewShell->GetWindowByPos(eWhich));
- ScDocument* pDoc = pViewShell->GetViewData().GetDocument();
- if (pWindow && pDoc)
+ ScDocument& rDoc = pViewShell->GetViewData().GetDocument();
+ if (pWindow)
{
ScHSplitPos eWhichH = ((eWhich == SC_SPLIT_TOPLEFT) || (eWhich == SC_SPLIT_BOTTOMLEFT)) ?
SC_SPLIT_LEFT : SC_SPLIT_RIGHT;
@@ -386,10 +386,10 @@ awt::Rectangle ScViewPaneBase::GetVisArea() const
ScAddress aCell(pViewShell->GetViewData().GetPosX(eWhichH),
pViewShell->GetViewData().GetPosY(eWhichV),
pViewShell->GetViewData().GetTabNo());
- tools::Rectangle aCellRect( pDoc->GetMMRect( aCell.Col(), aCell.Row(), aCell.Col(), aCell.Row(), aCell.Tab() ) );
+ tools::Rectangle aCellRect( rDoc.GetMMRect( aCell.Col(), aCell.Row(), aCell.Col(), aCell.Row(), aCell.Tab() ) );
Size aVisSize( pWindow->PixelToLogic( pWindow->GetSizePixel(), pWindow->GetDrawMapMode( true ) ) );
Point aVisPos( aCellRect.TopLeft() );
- if ( pDoc->IsLayoutRTL( aCell.Tab() ) )
+ if ( rDoc.IsLayoutRTL( aCell.Tab() ) )
{
aVisPos = aCellRect.TopRight();
aVisPos.AdjustX( -(aVisSize.Width()) );
@@ -1062,7 +1062,7 @@ void SAL_CALL ScTabViewObj::setActiveSheet( const uno::Reference<sheet::XSpreads
if ( rRanges.size() == 1 )
{
SCTAB nNewTab = rRanges[ 0 ].aStart.Tab();
- if ( pViewSh->GetViewData().GetDocument()->HasTable(nNewTab) )
+ if ( pViewSh->GetViewData().GetDocument().HasTable(nNewTab) )
pViewSh->SetTabNo( nNewTab );
}
}
@@ -1085,11 +1085,10 @@ uno::Reference< uno::XInterface > ScTabViewObj::GetClickedObject(const Point& rP
xTarget.set(uno::Reference<table::XCell>(pCellObj), uno::UNO_QUERY);
- ScDocument* pDoc = rData.GetDocument();
- if (pDoc && pDoc->GetDrawLayer())
+ ScDocument& rDoc = rData.GetDocument();
+ if (ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer())
{
SdrPage* pDrawPage = nullptr;
- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
if (pDrawLayer->HasObjects() && (pDrawLayer->GetPageCount() > nTab))
pDrawPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
@@ -1127,12 +1126,12 @@ bool ScTabViewObj::IsMouseListening() const
// also include sheet events, because MousePressed must be called for them
ScViewData& rViewData = GetViewShell()->GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
SCTAB nTab = rViewData.GetTabNo();
return
- pDoc->HasSheetEventScript( nTab, ScSheetEventId::RIGHTCLICK, true ) ||
- pDoc->HasSheetEventScript( nTab, ScSheetEventId::DOUBLECLICK, true ) ||
- pDoc->HasSheetEventScript( nTab, ScSheetEventId::SELECT, true );
+ rDoc.HasSheetEventScript( nTab, ScSheetEventId::RIGHTCLICK, true ) ||
+ rDoc.HasSheetEventScript( nTab, ScSheetEventId::DOUBLECLICK, true ) ||
+ rDoc.HasSheetEventScript( nTab, ScSheetEventId::SELECT, true );
}
@@ -1812,7 +1811,7 @@ void SAL_CALL ScTabViewObj::setPropertyValue(
return;
rViewData.SetOptions( aNewOpt );
- rViewData.GetDocument()->SetViewOptions( aNewOpt );
+ rViewData.GetDocument().SetViewOptions( aNewOpt );
rViewData.GetDocShell()->SetDocumentModified(); //! really?
pViewSh->UpdateFixPos();
@@ -2136,7 +2135,7 @@ uno::Sequence<sal_Int32> ScTabViewObj::getSelectedSheets()
// #i95280# when printing from the shell, the view is never activated,
// so Excel view settings must also be evaluated here.
- ScExtDocOptions* pExtOpt = rViewData.GetDocument()->GetExtDocOptions();
+ ScExtDocOptions* pExtOpt = rViewData.GetDocument().GetExtDocOptions();
if (pExtOpt && pExtOpt->IsChanged())
{
pViewSh->GetViewData().ReadExtOptions(*pExtOpt); // Excel view settings
diff --git a/sc/source/ui/vba/vbanames.cxx b/sc/source/ui/vba/vbanames.cxx
index 6f2c2c5a255a..0fb1a1b677a3 100644
--- a/sc/source/ui/vba/vbanames.cxx
+++ b/sc/source/ui/vba/vbanames.cxx
@@ -72,7 +72,7 @@ ScVbaNames::~ScVbaNames()
{
}
-ScDocument *
+ScDocument&
ScVbaNames::getScDocument()
{
uno::Reference< frame::XModel > xModel( getModel() , uno::UNO_SET_THROW );
@@ -104,12 +104,12 @@ ScVbaNames::Add( const css::uno::Any& Name ,
NameLocal >>= sName;
if ( !sName.isEmpty() )
{
- if ( ScRangeData::IsNameValid( sName , getScDocument() ) != ScRangeData::NAME_VALID )
+ if ( ScRangeData::IsNameValid( sName , &getScDocument() ) != ScRangeData::NAME_VALID )
{
const sal_Int32 nIndex{ sName.indexOf('!') };
if (nIndex>=0)
sName = sName.copy(nIndex+1);
- if ( ScRangeData::IsNameValid( sName , getScDocument() ) != ScRangeData::NAME_VALID )
+ if ( ScRangeData::IsNameValid( sName , &getScDocument() ) != ScRangeData::NAME_VALID )
throw uno::RuntimeException( "This Name is not valid ." );
}
}
@@ -149,7 +149,7 @@ ScVbaNames::Add( const css::uno::Any& Name ,
if ( !xRange.is() && !sFormula.isEmpty() )
{
ScAddress aBlank;
- ScCompiler aComp( getScDocument(), aBlank, eGram );
+ ScCompiler aComp( &getScDocument(), aBlank, eGram );
std::unique_ptr<ScTokenArray> pTokens(aComp.CompileString(sFormula));
if ( pTokens )
{
diff --git a/sc/source/ui/vba/vbanames.hxx b/sc/source/ui/vba/vbanames.hxx
index c84209063ace..f826428861dc 100644
--- a/sc/source/ui/vba/vbanames.hxx
+++ b/sc/source/ui/vba/vbanames.hxx
@@ -38,7 +38,7 @@ class ScVbaNames final : public ScVbaNames_BASE
public:
ScVbaNames( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XNamedRanges >& xNames , const css::uno::Reference< css::frame::XModel >& xModel );
- ScDocument* getScDocument();
+ ScDocument& getScDocument();
virtual ~ScVbaNames() override;
diff --git a/sc/source/ui/vba/vbaworksheets.cxx b/sc/source/ui/vba/vbaworksheets.cxx
index 3953cb881815..fbef67a68e32 100644
--- a/sc/source/ui/vba/vbaworksheets.cxx
+++ b/sc/source/ui/vba/vbaworksheets.cxx
@@ -505,7 +505,7 @@ void ScVbaWorksheets::PrintPreview( const css::uno::Any& /*EnableChanges*/ )
ScPreviewShell* pPrvShell = static_cast< ScPreviewShell* >( pShell );
ScPreview* pPrvView = pPrvShell->GetPreview();
- const ScDocument& rDoc = *pViewShell->GetViewData().GetDocument();
+ const ScDocument& rDoc = pViewShell->GetViewData().GetDocument();
ScMarkData aMarkData(rDoc.GetSheetLimits());
sal_Int32 nElems = getCount();
for ( sal_Int32 nItem = 1; nItem <= nElems; ++nItem )
diff --git a/sc/source/ui/view/auditsh.cxx b/sc/source/ui/view/auditsh.cxx
index 457cc4e00217..600dd4f221f8 100644
--- a/sc/source/ui/view/auditsh.cxx
+++ b/sc/source/ui/view/auditsh.cxx
@@ -47,7 +47,7 @@ ScAuditingShell::ScAuditingShell(ScViewData* pData) :
SetPool( &pViewData->GetViewShell()->GetPool() );
SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
SetUndoManager( pMgr );
- if ( !pViewData->GetDocument()->IsUndoEnabled() )
+ if ( !pViewData->GetDocument().IsUndoEnabled() )
{
pMgr->SetMaxUndoActionCount( 0 );
}
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 3885415df7a6..01d9feb25107 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -104,7 +104,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
bool bSimpleArea = (eMarkType == SC_MARK_SIMPLE);
bool bOnlyNotBecauseOfMatrix;
bool bEditable = pTabViewShell->SelectionEditable( &bOnlyNotBecauseOfMatrix );
- ScDocument* pDoc = GetViewData()->GetDocument();
+ ScDocument& rDoc = GetViewData()->GetDocument();
ScDocShell* pDocShell = GetViewData()->GetDocShell();
ScMarkData& rMark = GetViewData()->GetMarkData();
SCCOL nCol1, nCol2;
@@ -129,19 +129,19 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
bDisable = true;
if ( !bDisable && bEditable )
{ // do not damage matrix
- bDisable = pDoc->HasSelectedBlockMatrixFragment(
+ bDisable = rDoc.HasSelectedBlockMatrixFragment(
nCol1, nRow1, nCol2, nRow1, rMark ); // first row
}
}
break;
case FID_FILL_TO_TOP:
{
- bDisable = (!bSimpleArea) || (nRow1 == pDoc->MaxRow() && nRow2 == pDoc->MaxRow());
+ bDisable = (!bSimpleArea) || (nRow1 == rDoc.MaxRow() && nRow2 == rDoc.MaxRow());
if (!bDisable && GetViewData()->SelectionForbidsCellFill())
bDisable = true;
if ( !bDisable && bEditable )
{ // do not damage matrix
- bDisable = pDoc->HasSelectedBlockMatrixFragment(
+ bDisable = rDoc.HasSelectedBlockMatrixFragment(
nCol1, nRow2, nCol2, nRow2, rMark ); // last row
}
}
@@ -153,19 +153,19 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
bDisable = true;
if ( !bDisable && bEditable )
{ // do not damage matrix
- bDisable = pDoc->HasSelectedBlockMatrixFragment(
+ bDisable = rDoc.HasSelectedBlockMatrixFragment(
nCol1, nRow1, nCol1, nRow2, rMark ); // first column
}
}
break;
case FID_FILL_TO_LEFT:
{
- bDisable = (!bSimpleArea) || (nCol1 == pDoc->MaxCol() && nCol2 == pDoc->MaxCol());
+ bDisable = (!bSimpleArea) || (nCol1 == rDoc.MaxCol() && nCol2 == rDoc.MaxCol());
if (!bDisable && GetViewData()->SelectionForbidsCellFill())
bDisable = true;
if ( !bDisable && bEditable )
{ // do not damage matrix
- bDisable = pDoc->HasSelectedBlockMatrixFragment(
+ bDisable = rDoc.HasSelectedBlockMatrixFragment(
nCol2, nRow1, nCol2, nRow2, rMark ); // last column
}
}
@@ -186,7 +186,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
case FID_FILL_SERIES: // fill block
case SID_OPENDLG_TABOP: // multiple-cell operations, are at least 2 cells marked?
- if (pDoc->GetChangeTrack()!=nullptr &&nWhich ==SID_OPENDLG_TABOP)
+ if (rDoc.GetChangeTrack()!=nullptr &&nWhich ==SID_OPENDLG_TABOP)
bDisable = true;
else
bDisable = (!bSimpleArea) || (nCol1 == nCol2 && nRow1 == nRow2);
@@ -196,13 +196,13 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
if ( !bDisable && bEditable && nWhich == FID_FILL_SERIES )
{ // do not damage matrix
- bDisable = pDoc->HasSelectedBlockMatrixFragment(
+ bDisable = rDoc.HasSelectedBlockMatrixFragment(
nCol1, nRow1, nCol2, nRow1, rMark ) // first row
- || pDoc->HasSelectedBlockMatrixFragment(
+ || rDoc.HasSelectedBlockMatrixFragment(
nCol1, nRow2, nCol2, nRow2, rMark ) // last row
- || pDoc->HasSelectedBlockMatrixFragment(
+ || rDoc.HasSelectedBlockMatrixFragment(
nCol1, nRow1, nCol1, nRow2, rMark ) // first column
- || pDoc->HasSelectedBlockMatrixFragment(
+ || rDoc.HasSelectedBlockMatrixFragment(
nCol2, nRow1, nCol2, nRow2, rMark ); // last column
}
break;
@@ -235,10 +235,10 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
eAction = sc::ColRowEditAction::InsertRowsAfter;
bDisable = (!bSimpleArea) || GetViewData()->SimpleColMarked();
- if (!bEditable && nCol1 == 0 && nCol2 == pDoc->MaxCol())
+ if (!bEditable && nCol1 == 0 && nCol2 == rDoc.MaxCol())
{
// See if row insertions are allowed.
- bEditable = pDoc->IsEditActionAllowed(eAction, rMark, nRow1, nRow2);
+ bEditable = rDoc.IsEditActionAllowed(eAction, rMark, nRow1, nRow2);
}
break;
}
@@ -255,10 +255,10 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
eAction = sc::ColRowEditAction::InsertColumnsAfter;
bDisable = (!bSimpleArea) || GetViewData()->SimpleRowMarked();
- if (!bEditable && nRow1 == 0 && nRow2 == pDoc->MaxRow())
+ if (!bEditable && nRow1 == 0 && nRow2 == rDoc.MaxRow())
{
// See if row insertions are allowed.
- bEditable = pDoc->IsEditActionAllowed(eAction, rMark, nCol1, nCol2);
+ bEditable = rDoc.IsEditActionAllowed(eAction, rMark, nCol1, nCol2);
}
break;
}
@@ -306,7 +306,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
case SID_CONVERT_FORMULA_TO_VALUE:
{
// Check and see if the marked range has at least one formula cell.
- bDisable = !pDoc->HasFormulaCell(aMarkRange);
+ bDisable = !rDoc.HasFormulaCell(aMarkRange);
}
break;
}
@@ -548,7 +548,7 @@ bool checkDestRanges(ScViewData& rViewData)
// Multiple destination ranges.
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
vcl::Window* pWin = rViewData.GetActiveWin();
if (!pWin)
return false;
@@ -571,7 +571,7 @@ bool checkDestRanges(ScViewData& rViewData)
aMark.MarkToSimple();
aMark.FillRangeListWithMarks(&aRanges, false);
- return ScClipUtil::CheckDestRanges(pDoc, nColSize, nRowSize, aMark, aRanges);
+ return ScClipUtil::CheckDestRanges(&rDoc, nColSize, nRowSize, aMark, aRanges);
}
}
@@ -652,13 +652,13 @@ void ScCellShell::GetState(SfxItemSet &rSet)
ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
ScDocShell* pDocSh = GetViewData()->GetDocShell();
ScViewData* pData = GetViewData();
- ScDocument* pDoc = pData->GetDocument();
+ ScDocument& rDoc = pData->GetDocument();
ScMarkData& rMark = pData->GetMarkData();
SCCOL nPosX = pData->GetCurX();
SCROW nPosY = pData->GetCurY();
SCTAB nTab = pData->GetTabNo();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
SCTAB nTabSelCount = rMark.GetSelectCount();
SfxWhichIter aIter(rSet);
@@ -668,7 +668,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
switch ( nWhich )
{
case SID_DETECTIVE_REFRESH:
- if (!pDoc->HasDetectiveOperations())
+ if (!rDoc.HasDetectiveOperations())
rSet.DisableItem( nWhich );
break;
@@ -677,7 +677,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
ScRange aRange;
if ( pData->GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
{
- OUString aStr(aRange.Format(*pDoc, ScRefFlags::VALID | ScRefFlags::TAB_3D));
+ OUString aStr(aRange.Format(rDoc, ScRefFlags::VALID | ScRefFlags::TAB_3D));
rSet.Put( SfxStringItem( nWhich, aStr ) );
}
}
@@ -687,7 +687,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
{
// always take cursor position, do not use top-left cell of selection
OUString aNoteText;
- if ( const ScPostIt* pNote = pDoc->GetNote(nPosX, nPosY, nTab) )
+ if ( const ScPostIt* pNote = rDoc.GetNote(nPosX, nPosY, nTab) )
aNoteText = pNote->GetText();
rSet.Put( SfxStringItem( nWhich, aNoteText ) );
}
@@ -708,10 +708,10 @@ void ScCellShell::GetState(SfxItemSet &rSet)
case SID_RANGE_FORMULA:
{
OUString aString;
- pDoc->GetFormula( nPosX, nPosY, nTab, aString );
+ rDoc.GetFormula( nPosX, nPosY, nTab, aString );
if( aString.isEmpty() )
{
- pDoc->GetInputString( nPosX, nPosY, nTab, aString );
+ rDoc.GetInputString( nPosX, nPosY, nTab, aString );
}
rSet.Put( SfxStringItem( nWhich, aString ) );
}
@@ -719,7 +719,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
case SID_RANGE_TEXTVALUE:
{
- OUString aString = pDoc->GetString(nPosX, nPosY, nTab);
+ OUString aString = rDoc.GetString(nPosX, nPosY, nTab);
rSet.Put( SfxStringItem( nWhich, aString ) );
}
break;
@@ -780,7 +780,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
else
{
SCSIZE nSelected, nTotal;
- pDoc->GetFilterSelCount( nPosX, nPosY, nTab, nSelected, nTotal );
+ rDoc.GetFilterSelCount( nPosX, nPosY, nTab, nSelected, nTotal );
if( nTotal )
{
OUString aStr = ScResId( STR_FILTER_SELCOUNT );
@@ -799,15 +799,15 @@ void ScCellShell::GetState(SfxItemSet &rSet)
case SID_TABLE_CELL:
{
// Test, if error under cursor
- // (not pDoc->GetErrCode, to avoid erasing circular references)
+ // (not rDoc.GetErrCode, to avoid erasing circular references)
// In interpreter may happen via rescheduled Basic
- if ( pDoc->IsInInterpreter() )
+ if ( rDoc.IsInInterpreter() )
rSet.Put( SfxStringItem( nWhich, "..." ) );
else
{
FormulaError nErrCode = FormulaError::NONE;
- ScFormulaCell* pCell = pDoc->GetFormulaCell(ScAddress(nPosX, nPosY, nTab));
+ ScFormulaCell* pCell = rDoc.GetFormulaCell(ScAddress(nPosX, nPosY, nTab));
if (pCell && !pCell->IsRunning())
nErrCode = pCell->GetErrCode();
@@ -821,13 +821,13 @@ void ScCellShell::GetState(SfxItemSet &rSet)
case SID_DATA_SELECT:
// HasSelectionData includes column content and validity,
// page fields have to be checked separately.
- if ( !pDoc->HasSelectionData( nPosX, nPosY, nTab ) &&
+ if ( !rDoc.HasSelectionData( nPosX, nPosY, nTab ) &&
!pTabViewShell->HasPageFieldDataAtCursor() )
rSet.DisableItem( nWhich );
break;
case FID_CURRENTVALIDATION:
- if ( !pDoc->HasValidationData( nPosX, nPosY, nTab ))
+ if ( !rDoc.HasValidationData( nPosX, nPosY, nTab ))
rSet.DisableItem( nWhich );
break;
@@ -840,17 +840,17 @@ void ScCellShell::GetState(SfxItemSet &rSet)
break;
case FID_MERGE_ON:
- if ( pDoc->GetChangeTrack() || !pTabViewShell->TestMergeCells() )
+ if ( rDoc.GetChangeTrack() || !pTabViewShell->TestMergeCells() )
rSet.DisableItem( nWhich );
break;
case FID_MERGE_OFF:
- if ( pDoc->GetChangeTrack() || !pTabViewShell->TestRemoveMerge() )
+ if ( rDoc.GetChangeTrack() || !pTabViewShell->TestRemoveMerge() )
rSet.DisableItem( nWhich );
break;
case FID_MERGE_TOGGLE:
- if ( pDoc->GetChangeTrack() )
+ if ( rDoc.GetChangeTrack() )
rSet.DisableItem( nWhich );
else
{
@@ -864,22 +864,22 @@ void ScCellShell::GetState(SfxItemSet &rSet)
break;
case FID_INS_ROWBRK:
- if ( nPosY==0 || (pDoc->HasRowBreak(nPosY, nTab) & ScBreakType::Manual) || pDoc->IsTabProtected(nTab) )
+ if ( nPosY==0 || (rDoc.HasRowBreak(nPosY, nTab) & ScBreakType::Manual) || rDoc.IsTabProtected(nTab) )
rSet.DisableItem( nWhich );
break;
case FID_INS_COLBRK:
- if ( nPosX==0 || (pDoc->HasColBreak(nPosX, nTab) & ScBreakType::Manual) || pDoc->IsTabProtected(nTab) )
+ if ( nPosX==0 || (rDoc.HasColBreak(nPosX, nTab) & ScBreakType::Manual) || rDoc.IsTabProtected(nTab) )
rSet.DisableItem( nWhich );
break;
case FID_DEL_ROWBRK:
- if ( nPosY==0 || !(pDoc->HasRowBreak(nPosY, nTab) & ScBreakType::Manual) || pDoc->IsTabProtected(nTab) )
+ if ( nPosY==0 || !(rDoc.HasRowBreak(nPosY, nTab) & ScBreakType::Manual) || rDoc.IsTabProtected(nTab) )
rSet.DisableItem( nWhich );
break;
case FID_DEL_COLBRK:
- if ( nPosX==0 || !(pDoc->HasColBreak(nPosX, nTab) & ScBreakType::Manual) || pDoc->IsTabProtected(nTab) )
+ if ( nPosX==0 || !(rDoc.HasColBreak(nPosX, nTab) & ScBreakType::Manual) || rDoc.IsTabProtected(nTab) )
rSet.DisableItem( nWhich );
break;
@@ -891,8 +891,8 @@ void ScCellShell::GetState(SfxItemSet &rSet)
case SID_INSERT_CURRENT_DATE:
case SID_INSERT_CURRENT_TIME:
{
- if ( pDoc->IsTabProtected(nTab) &&
- pDoc->HasAttrib(nPosX, nPosY, nTab, nPosX, nPosY, nTab, HasAttrFlags::Protected))
+ if ( rDoc.IsTabProtected(nTab) &&
+ rDoc.HasAttrib(nPosX, nPosY, nTab, nPosX, nPosY, nTab, HasAttrFlags::Protected))
rSet.DisableItem( nWhich );
}
break;
@@ -902,18 +902,18 @@ void ScCellShell::GetState(SfxItemSet &rSet)
std::vector<OUString> aList;
Color aDummyCol;
- if ( !pDoc->IsScenario(nTab) )
+ if ( !rDoc.IsScenario(nTab) )
{
OUString aStr;
ScScenarioFlags nFlags;
SCTAB nScTab = nTab + 1;
- bool bSheetProtected = pDoc->IsTabProtected(nTab);
+ bool bSheetProtected = rDoc.IsTabProtected(nTab);
- while ( pDoc->IsScenario(nScTab) )
+ while ( rDoc.IsScenario(nScTab) )
{
- pDoc->GetName( nScTab, aStr );
+ rDoc.GetName( nScTab, aStr );
aList.push_back(aStr);
- pDoc->GetScenarioData( nScTab, aStr, aDummyCol, nFlags );
+ rDoc.GetScenarioData( nScTab, aStr, aDummyCol, nFlags );
aList.push_back(aStr);
// Protection is sal_True if both Sheet and Scenario are protected
aList.push_back((bSheetProtected && (nFlags & ScScenarioFlags::Protected)) ? OUString("1") : OUString("0"));
@@ -924,7 +924,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
{
OUString aComment;
ScScenarioFlags nDummyFlags;
- pDoc->GetScenarioData( nTab, aComment, aDummyCol, nDummyFlags );
+ rDoc.GetScenarioData( nTab, aComment, aDummyCol, nDummyFlags );
OSL_ENSURE( aList.empty(), "List not empty!" );
aList.push_back(aComment);
}
@@ -940,25 +940,25 @@ void ScCellShell::GetState(SfxItemSet &rSet)
case FID_COL_OPT_WIDTH:
case FID_ROW_OPT_HEIGHT:
case FID_DELETE_CELL:
- if ( pDoc->IsTabProtected(nTab) || pDocSh->IsReadOnly())
+ if ( rDoc.IsTabProtected(nTab) || pDocSh->IsReadOnly())
rSet.DisableItem( nWhich );
break;
case SID_OUTLINE_MAKE:
{
- if ( GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(),
+ if ( GetViewData()->GetDocument().GetDPAtCursor( GetViewData()->GetCurX(),
GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) )
{
//! test for data pilot operation
}
- else if (pDoc->GetChangeTrack()!=nullptr || GetViewData()->IsMultiMarked())
+ else if (rDoc.GetChangeTrack()!=nullptr || GetViewData()->IsMultiMarked())
{
rSet.DisableItem( nWhich );
}
}
break;
case SID_OUTLINE_SHOW:
- if ( GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(),
+ if ( GetViewData()->GetDocument().GetDPAtCursor( GetViewData()->GetCurX(),
GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) )
{
//! test for data pilot operation
@@ -968,7 +968,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
break;
case SID_OUTLINE_HIDE:
- if ( GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(),
+ if ( GetViewData()->GetDocument().GetDPAtCursor( GetViewData()->GetCurX(),
GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) )
{
//! test for data pilot operation
@@ -979,7 +979,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
case SID_OUTLINE_REMOVE:
{
- if ( GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(),
+ if ( GetViewData()->GetDocument().GetDPAtCursor( GetViewData()->GetCurX(),
GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) )
{
//! test for data pilot operation
@@ -996,7 +996,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
case FID_COL_WIDTH:
{
- SfxUInt16Item aWidthItem( FID_COL_WIDTH, pDoc->GetColWidth( nPosX , nTab) );
+ SfxUInt16Item aWidthItem( FID_COL_WIDTH, rDoc.GetColWidth( nPosX , nTab) );
rSet.Put( aWidthItem );
if ( pDocSh->IsReadOnly())
rSet.DisableItem( nWhich );
@@ -1007,7 +1007,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
case FID_ROW_HEIGHT:
{
- SfxUInt16Item aHeightItem( FID_ROW_HEIGHT, pDoc->GetRowHeight( nPosY , nTab) );
+ SfxUInt16Item aHeightItem( FID_ROW_HEIGHT, rDoc.GetRowHeight( nPosY , nTab) );
rSet.Put( aHeightItem );
//XXX disable if not conclusive
if ( pDocSh->IsReadOnly())
@@ -1030,8 +1030,8 @@ void ScCellShell::GetState(SfxItemSet &rSet)
case FID_NOTE_VISIBLE:
{
- const ScPostIt* pNote = pDoc->GetNote(nPosX, nPosY, nTab);
- if ( pNote && pDoc->IsBlockEditable( nTab, nPosX,nPosY, nPosX,nPosY ) )
+ const ScPostIt* pNote = rDoc.GetNote(nPosX, nPosY, nTab);
+ if ( pNote && rDoc.IsBlockEditable( nTab, nPosX,nPosY, nPosX,nPosY ) )
rSet.Put( SfxBoolItem( nWhich, pNote->IsCaptionShown() ) );
else
rSet.DisableItem( nWhich );
@@ -1046,8 +1046,8 @@ void ScCellShell::GetState(SfxItemSet &rSet)
if (!rMark.IsMarked() && !rMark.IsMultiMarked())
{
// Check current cell
- const ScPostIt* pNote = pDoc->GetNote(nPosX, nPosY, nTab);
- if ( pNote && pDoc->IsBlockEditable( nTab, nPosX,nPosY, nPosX,nPosY ) )
+ const ScPostIt* pNote = rDoc.GetNote(nPosX, nPosY, nTab);
+ if ( pNote && rDoc.IsBlockEditable( nTab, nPosX,nPosY, nPosX,nPosY ) )
if ( pNote->IsCaptionShown() != bSearchForHidden)
bEnable = true;
}
@@ -1058,11 +1058,11 @@ void ScCellShell::GetState(SfxItemSet &rSet)
pData->GetMultiArea(aRangesRef);
ScRangeList aRanges = *aRangesRef;
std::vector<sc::NoteEntry> aNotes;
- pDoc->GetNotesInRange(aRanges, aNotes);
+ rDoc.GetNotesInRange(aRanges, aNotes);
for(const auto& rNote : aNotes)
{
const ScAddress& rAdr = rNote.maPos;
- if( pDoc->IsBlockEditable( rAdr.Tab(), rAdr.Col(), rAdr.Row(), rAdr.Col(), rAdr.Row() ))
+ if( rDoc.IsBlockEditable( rAdr.Tab(), rAdr.Col(), rAdr.Row(), rAdr.Col(), rAdr.Row() ))
{
if (rNote.mpNote->IsCaptionShown() != bSearchForHidden)
{
@@ -1086,7 +1086,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
for (auto const& rTab : rMark.GetSelectedTabs())
{
- if (pDoc->HasTabNotes( rTab ))
+ if (rDoc.HasTabNotes( rTab ))
{
bHasNotes = true;
break;
@@ -1105,10 +1105,10 @@ void ScCellShell::GetState(SfxItemSet &rSet)
for (auto const& rTab : rMark.GetSelectedTabs())
{
- if (pDoc->HasTabNotes( rTab ))
+ if (rDoc.HasTabNotes( rTab ))
{
bHasNotes = true;
- aRanges.push_back(ScRange(0,0,rTab,pDoc->MaxCol(),pDoc->MaxRow(),rTab));
+ aRanges.push_back(ScRange(0,0,rTab,rDoc.MaxCol(),rDoc.MaxRow(),rTab));
}
}
@@ -1116,7 +1116,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
rSet.DisableItem( nWhich );
else
{
- CommentCaptionState eState = pDoc->GetAllNoteCaptionsState( aRanges );
+ CommentCaptionState eState = rDoc.GetAllNoteCaptionsState( aRanges );
bool bAllNotesInShown = (eState != ALLHIDDEN && eState != MIXED);
rSet.Put( SfxBoolItem( SID_TOGGLE_NOTES, bAllNotesInShown) );
}
@@ -1128,18 +1128,18 @@ void ScCellShell::GetState(SfxItemSet &rSet)
bool bEnable = false;
if ( rMark.IsMarked() || rMark.IsMultiMarked() )
{
- if ( pDoc->IsSelectionEditable( rMark ) )
+ if ( rDoc.IsSelectionEditable( rMark ) )
{
// look for at least one note in selection
ScRangeList aRanges;
rMark.FillRangeListWithMarks( &aRanges, false );
- bEnable = pDoc->ContainsNotesInRange( aRanges );
+ bEnable = rDoc.ContainsNotesInRange( aRanges );
}
}
else
{
- bEnable = pDoc->IsBlockEditable( nTab, nPosX,nPosY, nPosX,nPosY ) &&
- pDoc->GetNote(nPosX, nPosY, nTab);
+ bEnable = rDoc.IsBlockEditable( nTab, nPosX,nPosY, nPosX,nPosY ) &&
+ rDoc.GetNote(nPosX, nPosY, nTab);
}
if ( !bEnable )
rSet.DisableItem( nWhich );
@@ -1149,8 +1149,8 @@ void ScCellShell::GetState(SfxItemSet &rSet)
case SID_OPENDLG_CONSOLIDATE:
case SCITEM_CONSOLIDATEDATA:
{
- if(pDoc->GetChangeTrack()!=nullptr)
- rSet.DisableItem( nWhich);
+ if (rDoc.GetChangeTrack()!=nullptr)
+ rSet.DisableItem( nWhich);
}
break;
@@ -1188,9 +1188,8 @@ void ScCellShell::GetState(SfxItemSet &rSet)
{
ScAddress aCurrentAddress( nPosX, nPosY, nTab );
- if ( pDoc &&
- !pDoc->IsAddressInRangeName( RangeNameScope::GLOBAL, aCurrentAddress ) &&
- !pDoc->IsAddressInRangeName( RangeNameScope::SHEET, aCurrentAddress ))
+ if ( !rDoc.IsAddressInRangeName( RangeNameScope::GLOBAL, aCurrentAddress ) &&
+ !rDoc.IsAddressInRangeName( RangeNameScope::SHEET, aCurrentAddress ))
{
rSet.DisableItem( nWhich );
}
@@ -1199,7 +1198,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
case SID_SPELL_DIALOG:
{
- if ( pDoc && pData && pDoc->IsTabProtected( pData->GetTabNo() ) )
+ if ( pData && rDoc.IsTabProtected( pData->GetTabNo() ) )
{
bool bVisible = false;
SfxViewFrame* pViewFrame = ( pTabViewShell ? pTabViewShell->GetViewFrame() : nullptr );
@@ -1223,18 +1222,15 @@ void ScCellShell::GetState(SfxItemSet &rSet)
case SID_OPENDLG_CURRENTCONDFRMT:
case SID_OPENDLG_CURRENTCONDFRMT_MANAGER:
{
- if ( pDoc )
- {
- const SfxPoolItem* pItem = pDoc->GetAttr( nPosX, nPosY, nTab, ATTR_CONDITIONAL );
- const ScCondFormatItem* pCondFormatItem = static_cast<const ScCondFormatItem*>(pItem);
+ const SfxPoolItem* pItem = rDoc.GetAttr( nPosX, nPosY, nTab, ATTR_CONDITIONAL );
+ const ScCondFormatItem* pCondFormatItem = static_cast<const ScCondFormatItem*>(pItem);
- if ( pCondFormatItem->GetCondFormatData().empty() )
- rSet.DisableItem( nWhich );
- else if ( pCondFormatItem->GetCondFormatData().size() == 1 )
- rSet.DisableItem( SID_OPENDLG_CURRENTCONDFRMT_MANAGER );
- else if ( pCondFormatItem->GetCondFormatData().size() > 1 )
- rSet.DisableItem( SID_OPENDLG_CURRENTCONDFRMT );
- }
+ if ( pCondFormatItem->GetCondFormatData().empty() )
+ rSet.DisableItem( nWhich );
+ else if ( pCondFormatItem->GetCondFormatData().size() == 1 )
+ rSet.DisableItem( SID_OPENDLG_CURRENTCONDFRMT_MANAGER );
+ else if ( pCondFormatItem->GetCondFormatData().size() > 1 )
+ rSet.DisableItem( SID_OPENDLG_CURRENTCONDFRMT );
}
break;
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index e12fcfe69ce8..c116e7588dae 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -279,8 +279,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
eCmd = INS_INSROWS_BEFORE;
else
{
- ScDocument* pDoc = GetViewData()->GetDocument();
- bool bTheFlag=(pDoc->GetChangeTrack()!=nullptr);
+ ScDocument& rDoc = GetViewData()->GetDocument();
+ bool bTheFlag=(rDoc.GetChangeTrack()!=nullptr);
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
@@ -347,10 +347,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
else
{
ScRange aRange;
- ScDocument* pDoc = GetViewData()->GetDocument();
+ ScDocument& rDoc = GetViewData()->GetDocument();
bool bTheFlag=GetViewData()->IsMultiMarked() ||
(GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE_FILTERED) ||
- (pDoc->GetChangeTrack() != nullptr);
+ (rDoc.GetChangeTrack() != nullptr);
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
@@ -416,9 +416,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
ScopedVclPtr<AbstractScDeleteContentsDlg> pDlg(pFact->CreateScDeleteContentsDlg(pTabViewShell->GetFrameWeld()));
- ScDocument* pDoc = GetViewData()->GetDocument();
+ ScDocument& rDoc = GetViewData()->GetDocument();
SCTAB nTab = GetViewData()->GetTabNo();
- if ( pDoc->IsTabProtected(nTab) )
+ if ( rDoc.IsTabProtected(nTab) )
pDlg->DisableObjects();
if (pDlg->Execute() == RET_OK)
{
@@ -554,8 +554,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
eFillDir=FILL_TO_BOTTOM;
}
- ScDocument* pDoc = GetViewData()->GetDocument();
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+ ScDocument& rDoc = GetViewData()->GetDocument();
+ SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
if( pReqArgs )
{
@@ -625,8 +625,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
{
sal_uInt32 nPrivFormat;
CellType eCellType;
- pDoc->GetNumberFormat( nStartCol, nStartRow, nStartTab, nPrivFormat );
- pDoc->GetCellType( nStartCol, nStartRow, nStartTab,eCellType );
+ rDoc.GetNumberFormat( nStartCol, nStartRow, nStartTab, nPrivFormat );
+ rDoc.GetCellType( nStartCol, nStartRow, nStartTab,eCellType );
const SvNumberformat* pPrivEntry = pFormatter->GetEntry( nPrivFormat );
const SCSIZE nSelectHeight = nEndRow - nStartRow + 1;
const SCSIZE nSelectWidth = nEndCol - nStartCol + 1;
@@ -656,15 +656,15 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
double fInputEndVal = 0.0;
OUString aEndStr;
- pDoc->GetInputString( nStartCol, nStartRow, nStartTab, aStartStr);
- pDoc->GetValue( nStartCol, nStartRow, nStartTab, fStartVal );
+ rDoc.GetInputString( nStartCol, nStartRow, nStartTab, aStartStr);
+ rDoc.GetValue( nStartCol, nStartRow, nStartTab, fStartVal );
if(eFillDir==FILL_TO_BOTTOM && nStartRow < nEndRow )
{
- pDoc->GetInputString( nStartCol, nStartRow+1, nStartTab, aEndStr);
+ rDoc.GetInputString( nStartCol, nStartRow+1, nStartTab, aEndStr);
if(!aEndStr.isEmpty())
{
- pDoc->GetValue( nStartCol, nStartRow+1, nStartTab, fInputEndVal);
+ rDoc.GetValue( nStartCol, nStartRow+1, nStartTab, fInputEndVal);
fIncVal=fInputEndVal-fStartVal;
}
}
@@ -672,17 +672,17 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
{
if(nStartCol < nEndCol)
{
- pDoc->GetInputString( nStartCol+1, nStartRow, nStartTab, aEndStr);
+ rDoc.GetInputString( nStartCol+1, nStartRow, nStartTab, aEndStr);
if(!aEndStr.isEmpty())
{
- pDoc->GetValue( nStartCol+1, nStartRow, nStartTab, fInputEndVal);
+ rDoc.GetValue( nStartCol+1, nStartRow, nStartTab, fInputEndVal);
fIncVal=fInputEndVal-fStartVal;
}
}
}
if(eFillCmd==FILL_DATE)
{
- const Date& rNullDate = pDoc->GetFormatTable()->GetNullDate();
+ const Date& rNullDate = rDoc.GetFormatTable()->GetNullDate();
Date aStartDate = rNullDate;
aStartDate.AddDays(fStartVal);
Date aEndDate = rNullDate;
@@ -708,7 +708,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
ScopedVclPtr<AbstractScFillSeriesDlg> pDlg(pFact->CreateScFillSeriesDlg( pTabViewShell->GetFrameWeld(),
- *pDoc,
+ rDoc,
eFillDir, eFillCmd, eFillDateCmd,
aStartStr, fIncVal, fMaxVal,
nSelectHeight, nSelectWidth, nPossDir));
@@ -807,7 +807,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
GetViewData()->GetFillData( nStartCol, nStartRow, nEndCol, nEndRow );
SCCOL nFillCol = GetViewData()->GetRefEndX();
SCROW nFillRow = GetViewData()->GetRefEndY();
- ScDocument* pDoc = GetViewData()->GetDocument();
+ ScDocument& rDoc = GetViewData()->GetDocument();
if( pReqArgs != nullptr )
{
@@ -818,7 +818,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
ScAddress aScAddress;
OUString aArg = static_cast<const SfxStringItem*>(pItem)->GetValue();
- if( aScAddress.Parse( aArg, pDoc, pDoc->GetAddressConvention() ) & ScRefFlags::VALID )
+ if( aScAddress.Parse( aArg, &rDoc, rDoc.GetAddressConvention() ) & ScRefFlags::VALID )
{
nFillRow = aScAddress.Row();
nFillCol = aScAddress.Col();
@@ -836,7 +836,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
{
SCCOL nMergeCol = nStartCol;
SCROW nMergeRow = nStartRow;
- if ( GetViewData()->GetDocument()->ExtendMerge(
+ if ( GetViewData()->GetDocument().ExtendMerge(
nStartCol, nStartRow, nMergeCol, nMergeRow,
GetViewData()->GetTabNo() ) )
{
@@ -889,7 +889,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
if( ! rReq.IsAPI() )
{
ScAddress aAdr( nFillCol, nFillRow, 0 );
- OUString aAdrStr(aAdr.Format(ScRefFlags::RANGE_ABS, pDoc, pDoc->GetAddressConvention()));
+ OUString aAdrStr(aAdr.Format(ScRefFlags::RANGE_ABS, &rDoc, rDoc.GetAddressConvention()));
rReq.AppendItem( SfxStringItem( FID_FILL_AUTO, aAdrStr ) );
rReq.Done();
@@ -1058,7 +1058,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
// SID_AUTO_OUTLINE, SID_OUTLINE_DELETEALL in Execute (in docsh.idl)
case SID_OUTLINE_HIDE:
- if ( GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(),
+ if ( GetViewData()->GetDocument().GetDPAtCursor( GetViewData()->GetCurX(),
GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) )
pTabViewShell->SetDataPilotDetails( false );
else
@@ -1068,7 +1068,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
case SID_OUTLINE_SHOW:
{
- ScDPObject* pDPObj = GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(),
+ ScDPObject* pDPObj = GetViewData()->GetDocument().GetDPAtCursor( GetViewData()->GetCurX(),
GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
if ( pDPObj )
{
@@ -1104,7 +1104,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
bool bColumns = false;
bool bOk = true;
- if ( GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(),
+ if ( GetViewData()->GetDocument().GetDPAtCursor( GetViewData()->GetCurX(),
GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) )
{
ScDPNumGroupInfo aNumInfo;
@@ -1115,7 +1115,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
if ( pTabViewShell->HasSelectionForDateGroup( aNumInfo, nParts ) )
{
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
- const Date& rNullDate( GetViewData()->GetDocument()->GetFormatTable()->GetNullDate() );
+ const Date& rNullDate( GetViewData()->GetDocument().GetFormatTable()->GetNullDate() );
ScopedVclPtr<AbstractScDPDateGroupDlg> pDlg( pFact->CreateScDPDateGroupDlg(
pTabViewShell->GetFrameWeld(),
aNumInfo, nParts, rNullDate ) );
@@ -1191,7 +1191,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
bool bColumns = false;
bool bOk = true;
- if ( GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(),
+ if ( GetViewData()->GetDocument().GetDPAtCursor( GetViewData()->GetCurX(),
GetViewData()->GetCurY(), GetViewData()->GetTabNo() ) )
{
pTabViewShell->UngroupDataPilot();
@@ -1322,8 +1322,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
ScPasteFunc nFunction = ScPasteFunc::NONE;
InsCellCmd eMoveMode = INS_NONE;
- ScDocument* pDoc = GetViewData()->GetDocument();
- bool bOtherDoc = !pDoc->IsClipboardSource();
+ ScDocument& rDoc = GetViewData()->GetDocument();
+ bool bOtherDoc = !rDoc.IsClipboardSource();
// keep a reference in case the clipboard is changed during dialog or PasteFromClip
const ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(GetViewData()->GetActiveWin()));
if ( pOwnClip )
@@ -1368,7 +1368,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
ScopedVclPtr<AbstractScInsertContentsDlg> pDlg(pFact->CreateScInsertContentsDlg(pTabViewShell->GetFrameWeld()));
pDlg->SetOtherDoc( bOtherDoc );
// if ChangeTrack MoveMode disable
- pDlg->SetChangeTrack( pDoc->GetChangeTrack() != nullptr );
+ pDlg->SetChangeTrack( rDoc.GetChangeTrack() != nullptr );
// fdo#56098 disable shift if necessary
if (!bOtherDoc)
{
@@ -1413,15 +1413,15 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
CellShiftDisabledFlags nDisableShiftY = CellShiftDisabledFlags::NONE;
//check if horizontal shift will fit
- if ( !pData->GetDocument()->IsBlockEmpty( nStartTab,
- pDoc->MaxCol() - nRangeSizeX, nStartY,
- pDoc->MaxCol(), nStartY + nRangeSizeY ) )
+ if ( !pData->GetDocument().IsBlockEmpty( nStartTab,
+ rDoc.MaxCol() - nRangeSizeX, nStartY,
+ rDoc.MaxCol(), nStartY + nRangeSizeY ) )
nDisableShiftX = CellShiftDisabledFlags::Right;
//check if vertical shift will fit
- if ( !pData->GetDocument()->IsBlockEmpty( nStartTab,
- nStartX, pDoc->MaxRow() - nRangeSizeY,
- nStartX + nRangeSizeX, pDoc->MaxRow() ) )
+ if ( !pData->GetDocument().IsBlockEmpty( nStartTab,
+ nStartX, rDoc.MaxRow() - nRangeSizeY,
+ nStartX + nRangeSizeX, rDoc.MaxRow() ) )
nDisableShiftY = CellShiftDisabledFlags::Down;
if ( nDisableShiftX != CellShiftDisabledFlags::NONE || nDisableShiftY != CellShiftDisabledFlags::NONE)
@@ -1530,7 +1530,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
nPosY = GetViewData()->GetCurY();
}
ScAddress aCellPos(nPosX, nPosY, GetViewData()->GetTabNo());
- auto pObj = std::make_shared<ScImportExport>(GetViewData()->GetDocument(), aCellPos);
+ auto pObj = std::make_shared<ScImportExport>(&GetViewData()->GetDocument(), aCellPos);
pObj->SetOverwriting(true);
if (pDlg->Execute()) {
ScAsciiOptions aOptions;
@@ -1887,7 +1887,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
static_cast<const ScConsolidateItem*>(pItem)->GetData();
pTabViewShell->Consolidate( rParam );
- GetViewData()->GetDocument()->SetConsolidateDlgData( std::unique_ptr<ScConsolidateParam>(new ScConsolidateParam(rParam)) );
+ GetViewData()->GetDocument().SetConsolidateDlgData( std::unique_ptr<ScConsolidateParam>(new ScConsolidateParam(rParam)) );
rReq.Done();
}
@@ -1999,8 +1999,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
ScViewData* pData = GetViewData();
pData->GetMarkData().FillRangeListWithMarks(&aRangeList, false);
- ScDocument* pDoc = GetViewData()->GetDocument();
- if(pDoc->IsTabProtected(pData->GetTabNo()))
+ ScDocument& rDoc = GetViewData()->GetDocument();
+ if(rDoc.IsTabProtected(pData->GetTabNo()))
{
pTabViewShell->ErrorMessage( STR_ERR_CONDFORMAT_PROTECTED );
break;
@@ -2014,8 +2014,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
// try to find an existing conditional format
const ScConditionalFormat* pCondFormat = nullptr;
- const ScPatternAttr* pPattern = pDoc->GetPattern(aPos.Col(), aPos.Row(), aPos.Tab());
- ScConditionalFormatList* pList = pDoc->GetCondFormList(aPos.Tab());
+ const ScPatternAttr* pPattern = rDoc.GetPattern(aPos.Col(), aPos.Row(), aPos.Tab());
+ ScConditionalFormatList* pList = rDoc.GetCondFormList(aPos.Tab());
const ScCondFormatIndexes& rCondFormats = pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData();
bool bContainsCondFormat = !rCondFormats.empty();
bool bCondFormatDlg = false;
@@ -2045,13 +2045,13 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
const SfxInt16Item* pParam = rReq.GetArg<SfxInt16Item>(FN_PARAM_1);
if (pParam && nSlot == SID_OPENDLG_ICONSET)
{
- auto pFormat = std::make_unique<ScConditionalFormat>(0, pDoc);
+ auto pFormat = std::make_unique<ScConditionalFormat>(0, &rDoc);
pFormat->SetRange(aRangeList);
ScIconSetType eIconSetType = limit_cast<ScIconSetType>(pParam->GetValue(), IconSet_3Arrows, IconSet_5Boxes);
const int nSteps = ScIconSetFormat::getIconSetElements(eIconSetType);
- ScIconSetFormat* pEntry = new ScIconSetFormat(pDoc);
+ ScIconSetFormat* pEntry = new ScIconSetFormat(&rDoc);
ScIconSetFormatData* pIconSetFormatData = new ScIconSetFormatData(eIconSetType);
pIconSetFormatData->m_Entries.emplace_back(new ScColorScaleEntry(0, COL_RED, COLORSCALE_PERCENT));
@@ -2291,9 +2291,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
case FID_NOTE_VISIBLE:
{
- ScDocument* pDoc = GetViewData()->GetDocument();
+ ScDocument& rDoc = GetViewData()->GetDocument();
ScAddress aPos( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
- if( ScPostIt* pNote = pDoc->GetNote(aPos) )
+ if( ScPostIt* pNote = rDoc.GetNote(aPos) )
{
bool bShow;
const SfxPoolItem* pItem;
@@ -2320,14 +2320,14 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
{
bool bShowNote = nSlot == FID_SHOW_NOTE;
ScViewData* pData = GetViewData();
- ScDocument* pDoc = pData->GetDocument();
+ ScDocument& rDoc = pData->GetDocument();
ScMarkData& rMark = pData->GetMarkData();
if (!rMark.IsMarked() && !rMark.IsMultiMarked())
{
// Check current cell
ScAddress aPos( pData->GetCurX(), pData->GetCurY(), pData->GetTabNo() );
- if( pDoc->GetNote(aPos) )
+ if( rDoc.GetNote(aPos) )
{
pData->GetDocShell()->GetDocFunc().ShowNote( aPos, bShowNote );
}
@@ -2347,7 +2347,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
{
// get notes
std::vector<sc::NoteEntry> aNotes;
- pDoc->GetAllNoteEntries(rTab, aNotes);
+ rDoc.GetAllNoteEntries(rTab, aNotes);
for (const sc::NoteEntry& rNote : aNotes)
{
@@ -2359,7 +2359,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
// check if cell is editable
const SCTAB nRangeTab = rRange->aStart.Tab();
- if (pDoc->IsBlockEditable( nRangeTab, rAdr.Col(), rAdr.Row(), rAdr.Col(), rAdr.Row() ))
+ if (rDoc.IsBlockEditable( nRangeTab, rAdr.Col(), rAdr.Row(), rAdr.Col(), rAdr.Row() ))
{
pData->GetDocShell()->GetDocFunc().ShowNote( rAdr, bShowNote );
bDone = true;
@@ -2387,7 +2387,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
bool bShowNote = nSlot == FID_SHOW_ALL_NOTES;
ScViewData* pData = GetViewData();
ScMarkData& rMark = pData->GetMarkData();
- ScDocument* pDoc = pData->GetDocument();
+ ScDocument& rDoc = pData->GetDocument();
std::vector<sc::NoteEntry> aNotes;
OUString aUndo = ScResId( bShowNote ? STR_UNDO_SHOWALLNOTES : STR_UNDO_HIDEALLNOTES );
@@ -2395,7 +2395,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
for (auto const& rTab : rMark.GetSelectedTabs())
{
- pDoc->GetAllNoteEntries(rTab, aNotes);
+ rDoc.GetAllNoteEntries(rTab, aNotes);
}
for (const sc::NoteEntry& rNote : aNotes)
@@ -2412,15 +2412,15 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
{
ScViewData* pData = GetViewData();
ScMarkData& rMark = pData->GetMarkData();
- ScDocument* pDoc = pData->GetDocument();
+ ScDocument& rDoc = pData->GetDocument();
ScRangeList aRanges;
std::vector<sc::NoteEntry> aNotes;
for (auto const& rTab : rMark.GetSelectedTabs())
- aRanges.push_back(ScRange(0,0,rTab,pDoc->MaxCol(),pDoc->MaxRow(),rTab));
+ aRanges.push_back(ScRange(0,0,rTab,rDoc.MaxCol(),rDoc.MaxRow(),rTab));
- CommentCaptionState eState = pDoc->GetAllNoteCaptionsState( aRanges );
- pDoc->GetNotesInRange(aRanges, aNotes);
+ CommentCaptionState eState = rDoc.GetAllNoteCaptionsState( aRanges );
+ rDoc.GetNotesInRange(aRanges, aNotes);
bool bShowNote = (eState == ALLHIDDEN || eState == MIXED);
OUString aUndo = ScResId( bShowNote ? STR_UNDO_SHOWALLNOTES : STR_UNDO_HIDEALLNOTES );
@@ -2465,13 +2465,13 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
{
ScViewData* pData = GetViewData();
ScMarkData& rMark = pData->GetMarkData();
- ScDocument* pDoc = pData->GetDocument();
- ScMarkData aNewMark(pDoc->GetSheetLimits());
+ ScDocument& rDoc = pData->GetDocument();
+ ScMarkData aNewMark(rDoc.GetSheetLimits());
ScRangeList aRangeList;
for (auto const& rTab : rMark.GetSelectedTabs())
{
- aRangeList.push_back(ScRange(0,0,rTab,pDoc->MaxCol(),pDoc->MaxRow(),rTab));
+ aRangeList.push_back(ScRange(0,0,rTab,rDoc.MaxCol(),rDoc.MaxRow(),rTab));
}
aNewMark.MarkFromRangeList( aRangeList, true );
@@ -2572,9 +2572,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
ScViewData* pData = GetViewData();
- ScDocument* pDoc = pData->GetDocument();
+ ScDocument& rDoc = pData->GetDocument();
- if(pDoc->IsTabProtected(pData->GetTabNo()))
+ if (rDoc.IsTabProtected(pData->GetTabNo()))
{
pTabViewShell->ErrorMessage( STR_ERR_CONDFORMAT_PROTECTED );
break;
@@ -2593,10 +2593,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
}
if (!pList)
- pList = pDoc->GetCondFormList( aPos.Tab() );
+ pList = rDoc.GetCondFormList( aPos.Tab() );
VclPtr<AbstractScCondFormatManagerDlg> pDlg(pFact->CreateScCondFormatMgrDlg(
- pTabViewShell->GetFrameWeld(), pDoc, pList));
+ pTabViewShell->GetFrameWeld(), &rDoc, pList));
if (pDlgItem)
pDlg->SetModified();
@@ -2745,10 +2745,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
ScViewData* pData = GetViewData();
SCTAB aTab = pData->GetTabNo();
ScMarkData& rMark = pData->GetMarkData();
- ScDocument* pDoc = pData->GetDocument();
+ ScDocument& rDoc = pData->GetDocument();
ScRangeList rRangeList;
- pDoc->GetUnprotectedCells(rRangeList, aTab);
+ rDoc.GetUnprotectedCells(rRangeList, aTab);
rMark.MarkFromRangeList(rRangeList, true);
pTabViewShell->SetMarkData(rMark);
}
@@ -2835,12 +2835,12 @@ void ScCellShell::ExecuteDataPilotDialog()
ScModule* pScMod = SC_MOD();
ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
ScViewData* pData = GetViewData();
- ScDocument* pDoc = pData->GetDocument();
+ ScDocument& rDoc = pData->GetDocument();
std::unique_ptr<ScDPObject> pNewDPObject;
// ScPivot is no longer used...
- ScDPObject* pDPObj = pDoc->GetDPAtCursor(
+ ScDPObject* pDPObj = rDoc.GetDPAtCursor(
pData->GetCurX(), pData->GetCurY(),
pData->GetTabNo() );
if ( pDPObj ) // on an existing table?
@@ -2873,7 +2873,7 @@ void ScCellShell::ExecuteDataPilotDialog()
pTabViewShell->GetFrameWeld(), bEnableExt));
// Populate named ranges (if any).
- ScRangeName* pRangeName = pDoc->GetRangeName();
+ ScRangeName* pRangeName = rDoc.GetRangeName();
if (pRangeName)
{
ScRangeName::const_iterator itr = pRangeName->begin(), itrEnd = pRangeName->end();
@@ -2898,7 +2898,7 @@ void ScCellShell::ExecuteDataPilotDialog()
pServDlg->GetParName(),
pServDlg->GetParUser(),
pServDlg->GetParPass() );
- pNewDPObject.reset(new ScDPObject(pDoc));
+ pNewDPObject.reset(new ScDPObject(&rDoc));
pNewDPObject->SetServiceData( aServDesc );
}
}
@@ -2910,21 +2910,21 @@ void ScCellShell::ExecuteDataPilotDialog()
assert(pDataDlg && "Dialog create fail!");
if ( pDataDlg->Execute() == RET_OK )
{
- ScImportSourceDesc aImpDesc(pDoc);
+ ScImportSourceDesc aImpDesc(&rDoc);
pDataDlg->GetValues( aImpDesc );
- pNewDPObject.reset(new ScDPObject(pDoc));
+ pNewDPObject.reset(new ScDPObject(&rDoc));
pNewDPObject->SetImportDesc( aImpDesc );
}
}
else if (pTypeDlg->IsNamedRange())
{
OUString aName = pTypeDlg->GetSelectedNamedRange();
- ScSheetSourceDesc aShtDesc(pDoc);
+ ScSheetSourceDesc aShtDesc(&rDoc);
aShtDesc.SetRangeName(aName);
pSrcErrorId = aShtDesc.CheckSourceRange();
if (!pSrcErrorId)
{
- pNewDPObject.reset(new ScDPObject(pDoc));
+ pNewDPObject.reset(new ScDPObject(&rDoc));
pNewDPObject->SetSheetDesc(aShtDesc);
}
}
@@ -2938,7 +2938,7 @@ void ScCellShell::ExecuteDataPilotDialog()
// Shrink the range to the data area.
SCCOL nStartCol = aRange.aStart.Col(), nEndCol = aRange.aEnd.Col();
SCROW nStartRow = aRange.aStart.Row(), nEndRow = aRange.aEnd.Row();
- if (pDoc->ShrinkToDataArea(aRange.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow))
+ if (rDoc.ShrinkToDataArea(aRange.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow))
{
aRange.aStart.SetCol(nStartCol);
aRange.aStart.SetRow(nStartRow);
@@ -2949,7 +2949,7 @@ void ScCellShell::ExecuteDataPilotDialog()
}
bool bOK = true;
- if ( pDoc->HasSubTotalCells( aRange ) )
+ if ( rDoc.HasSubTotalCells( aRange ) )
{
// confirm selection if it contains SubTotal cells
std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pTabViewShell->GetFrameWeld(),
@@ -2961,17 +2961,17 @@ void ScCellShell::ExecuteDataPilotDialog()
}
if (bOK)
{
- ScSheetSourceDesc aShtDesc(pDoc);
+ ScSheetSourceDesc aShtDesc(&rDoc);
aShtDesc.SetSourceRange(aRange);
pSrcErrorId = aShtDesc.CheckSourceRange();
if (!pSrcErrorId)
{
- pNewDPObject.reset(new ScDPObject(pDoc));
+ pNewDPObject.reset(new ScDPObject(&rDoc));
pNewDPObject->SetSheetDesc( aShtDesc );
}
// output below source data
- if ( aRange.aEnd.Row()+2 <= pDoc->MaxRow() - 4 )
+ if ( aRange.aEnd.Row()+2 <= rDoc.MaxRow() - 4 )
aDestPos = ScAddress( aRange.aStart.Col(),
aRange.aEnd.Row()+2,
aRange.aStart.Tab() );
@@ -3110,20 +3110,20 @@ void ScCellShell::ExecuteFillSingleEdit()
{
// Get the initial text value from the above cell.
- ScDocument* pDoc = GetViewData()->GetDocument();
+ ScDocument& rDoc = GetViewData()->GetDocument();
ScAddress aPrevPos = aCurPos;
aPrevPos.IncRow(-1);
- ScRefCellValue aCell(*pDoc, aPrevPos);
+ ScRefCellValue aCell(rDoc, aPrevPos);
if (aCell.meType == CELLTYPE_FORMULA)
{
aInit = "=";
const ScTokenArray* pCode = aCell.mpFormula->GetCode();
- sc::TokenStringContext aCxt(pDoc, pDoc->GetGrammar());
+ sc::TokenStringContext aCxt(&rDoc, rDoc.GetGrammar());
aInit += pCode->CreateString(aCxt, aCurPos);
}
else
- aInit = aCell.getString(pDoc);
+ aInit = aCell.getString(&rDoc);
}
SC_MOD()->SetInputMode(SC_INPUT_TABLE, &aInit);
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index a3da043a8fe3..ff3daca0b8cf 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -98,12 +98,11 @@ static bool lcl_GetTextToColumnsRange( const ScViewData* pData, ScRange& rRange,
bRet = true;
}
- const ScDocument* pDoc = pData->GetDocument();
- OSL_ENSURE( pDoc, "lcl_GetTextToColumnsRange: pDoc is null!" );
+ const ScDocument& rDoc = pData->GetDocument();
if ( bDoEmptyCheckOnly )
{
- if ( bRet && pDoc->IsBlockEmpty( rRange.aStart.Tab(), rRange.aStart.Col(),
+ if ( bRet && rDoc.IsBlockEmpty( rRange.aStart.Tab(), rRange.aStart.Col(),
rRange.aStart.Row(), rRange.aEnd.Col(),
rRange.aEnd.Row() ) )
{
@@ -116,7 +115,7 @@ static bool lcl_GetTextToColumnsRange( const ScViewData* pData, ScRange& rRange,
SCCOL nStartCol = rRange.aStart.Col(), nEndCol = rRange.aEnd.Col();
SCROW nStartRow = rRange.aStart.Row(), nEndRow = rRange.aEnd.Row();
bool bShrunk = false;
- pDoc->ShrinkToUsedDataArea( bShrunk, rRange.aStart.Tab(), nStartCol, nStartRow,
+ rDoc.ShrinkToUsedDataArea( bShrunk, rRange.aStart.Tab(), nStartCol, nStartRow,
nEndCol, nEndRow, false, false, true );
if ( bShrunk )
{
@@ -132,7 +131,7 @@ static bool lcl_GetSortParam( const ScViewData* pData, const ScSortParam& rSortP
{
ScTabViewShell* pTabViewShell = pData->GetViewShell();
ScDBData* pDBData = pTabViewShell->GetDBData();
- ScDocument* pDoc = pData->GetDocument();
+ ScDocument& rDoc = pData->GetDocument();
SCTAB nTab = pData->GetTabNo();
ScDirection eFillDir = DIR_TOP;
bool bSort = true;
@@ -143,14 +142,14 @@ static bool lcl_GetSortParam( const ScViewData* pData, const ScSortParam& rSortP
if( rSortParam.nRow1 != rSortParam.nRow2 )
eFillDir = DIR_TOP;
- if( rSortParam.nRow2 == pDoc->MaxRow() )
+ if( rSortParam.nRow2 == rDoc.MaxRow() )
{
// Assume that user selected entire column(s), but cater for the
// possibility that the start row is not the first row.
- SCSIZE nCount = pDoc->GetEmptyLinesInBlock( rSortParam.nCol1, rSortParam.nRow1, nTab,
+ SCSIZE nCount = rDoc.GetEmptyLinesInBlock( rSortParam.nCol1, rSortParam.nRow1, nTab,
rSortParam.nCol2, rSortParam.nRow2, nTab, eFillDir );
aExternalRange = ScRange( rSortParam.nCol1,
- ::std::min( rSortParam.nRow1 + sal::static_int_cast<SCROW>( nCount ), pDoc->MaxRow()), nTab,
+ ::std::min( rSortParam.nRow1 + sal::static_int_cast<SCROW>( nCount ), rDoc.MaxRow()), nTab,
rSortParam.nCol2, rSortParam.nRow2, nTab);
aExternalRange.PutInOrder();
}
@@ -167,7 +166,7 @@ static bool lcl_GetSortParam( const ScViewData* pData, const ScSortParam& rSortP
SCCOL nStartCol = aExternalRange.aStart.Col();
SCROW nEndRow = aExternalRange.aEnd.Row();
SCCOL nEndCol = aExternalRange.aEnd.Col();
- pDoc->GetDataArea( aExternalRange.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow, false, false );
+ rDoc.GetDataArea( aExternalRange.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow, false, false );
aExternalRange.aStart.SetRow( nStartRow );
aExternalRange.aStart.SetCol( nStartCol );
aExternalRange.aEnd.SetRow( nEndRow );
@@ -179,10 +178,10 @@ static bool lcl_GetSortParam( const ScViewData* pData, const ScSortParam& rSortP
(rSortParam.nRow1 == rSortParam.nRow2 && aExternalRange.aStart.Row() != aExternalRange.aEnd.Row())))
{
pTabViewShell->AddHighlightRange( aExternalRange,COL_LIGHTBLUE );
- OUString aExtendStr( aExternalRange.Format(*pDoc, ScRefFlags::VALID));
+ OUString aExtendStr( aExternalRange.Format(rDoc, ScRefFlags::VALID));
ScRange aCurrentRange( rSortParam.nCol1, rSortParam.nRow1, nTab, rSortParam.nCol2, rSortParam.nRow2, nTab );
- OUString aCurrentStr(aCurrentRange.Format(*pDoc, ScRefFlags::VALID));
+ OUString aCurrentStr(aCurrentRange.Format(rDoc, ScRefFlags::VALID));
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
@@ -386,10 +385,10 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
{
SCCOL nCol = GetViewData()->GetCurX();
SCCOL nTab = GetViewData()->GetTabNo();
- ScDocument* pDoc = GetViewData()->GetDocument();
+ ScDocument& rDoc = GetViewData()->GetDocument();
pDBData->GetSortParam( aSortParam );
- bool bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, nTab );
+ bool bHasHeader = rDoc.HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, nTab );
if( nCol < aSortParam.nCol1 )
nCol = aSortParam.nCol1;
@@ -435,10 +434,10 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
if( lcl_GetSortParam( pData, aSortParam ) )
{
- ScDocument* pDoc = GetViewData()->GetDocument();
+ ScDocument& rDoc = GetViewData()->GetDocument();
pDBData->GetSortParam( aSortParam );
- bool bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, pData->GetTabNo() );
+ bool bHasHeader = rDoc.HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, pData->GetTabNo() );
if( bHasHeader )
aSortParam.bHasHeader = bHasHeader;
@@ -504,11 +503,11 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
if( lcl_GetSortParam( pData, aSortParam ) )
{
- ScDocument* pDoc = GetViewData()->GetDocument();
+ ScDocument& rDoc = GetViewData()->GetDocument();
SfxItemSet aArgSet( GetPool(), svl::Items<SCITEM_SORTDATA, SCITEM_SORTDATA>{} );
pDBData->GetSortParam( aSortParam );
- bool bHasHeader = pDoc->HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, pData->GetTabNo() );
+ bool bHasHeader = rDoc.HasColHeader( aSortParam.nCol1, aSortParam.nRow1, aSortParam.nCol2, aSortParam.nRow2, pData->GetTabNo() );
if( bHasHeader )
aSortParam.bHasHeader = bHasHeader;
@@ -702,8 +701,8 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
}
else
{
- ScDocument* pDoc = GetViewData()->GetDocument();
- ScDBCollection* pDBCol = pDoc->GetDBCollection();
+ ScDocument& rDoc = GetViewData()->GetDocument();
+ ScDBCollection* pDBCol = rDoc.GetDBCollection();
if ( pDBCol )
{
@@ -729,8 +728,8 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
case SID_DATA_STREAMS:
{
sc::DataStreamDlg aDialog(GetViewData()->GetDocShell(), pTabViewShell->GetFrameWeld());
- ScDocument *pDoc = GetViewData()->GetDocument();
- sc::DocumentLinkManager& rMgr = pDoc->GetDocLinkManager();
+ ScDocument& rDoc = GetViewData()->GetDocument();
+ sc::DocumentLinkManager& rMgr = rDoc.GetDocLinkManager();
sc::DataStream* pStrm = rMgr.getDataStream();
if (pStrm)
aDialog.Init(*pStrm);
@@ -741,8 +740,8 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
break;
case SID_DATA_STREAMS_PLAY:
{
- ScDocument *pDoc = GetViewData()->GetDocument();
- sc::DocumentLinkManager& rMgr = pDoc->GetDocLinkManager();
+ ScDocument& rDoc = GetViewData()->GetDocument();
+ sc::DocumentLinkManager& rMgr = rDoc.GetDocLinkManager();
sc::DataStream* pStrm = rMgr.getDataStream();
if (pStrm)
pStrm->StartImport();
@@ -750,8 +749,8 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
break;
case SID_DATA_STREAMS_STOP:
{
- ScDocument *pDoc = GetViewData()->GetDocument();
- sc::DocumentLinkManager& rMgr = pDoc->GetDocLinkManager();
+ ScDocument& rDoc = GetViewData()->GetDocument();
+ sc::DocumentLinkManager& rMgr = rDoc.GetDocLinkManager();
sc::DataStream* pStrm = rMgr.getDataStream();
if (pStrm)
pStrm->StopImport();
@@ -761,21 +760,21 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
{
auto xDoc = o3tl::make_shared<ScDocument>();
xDoc->InsertTab(0, "test");
- ScDocument* pDoc = GetViewData()->GetDocument();
- ScDataProviderDlg aDialog(pTabViewShell->GetDialogParent(), xDoc, pDoc);
+ ScDocument& rDoc = GetViewData()->GetDocument();
+ ScDataProviderDlg aDialog(pTabViewShell->GetDialogParent(), xDoc, &rDoc);
if (aDialog.run() == RET_OK)
{
- aDialog.import(pDoc);
+ aDialog.import(&rDoc);
}
}
break;
case SID_DATA_PROVIDER_REFRESH:
{
- ScDocument* pDoc = GetViewData()->GetDocument();
- auto& rDataMapper = pDoc->GetExternalDataMapper();
+ ScDocument& rDoc = GetViewData()->GetDocument();
+ auto& rDataMapper = rDoc.GetExternalDataMapper();
for (auto& rDataSource : rDataMapper.getDataSources())
{
- rDataSource.refresh(pDoc, false);
+ rDataSource.refresh(&rDoc, false);
}
}
break;
@@ -805,16 +804,16 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
ScValidErrorStyle eErrStyle = SC_VALERR_STOP;
OUString aErrTitle, aErrText;
- ScDocument* pDoc = GetViewData()->GetDocument();
+ ScDocument& rDoc = GetViewData()->GetDocument();
SCCOL nCurX = GetViewData()->GetCurX();
SCROW nCurY = GetViewData()->GetCurY();
SCTAB nTab = GetViewData()->GetTabNo();
ScAddress aCursorPos( nCurX, nCurY, nTab );
- sal_uLong nIndex = pDoc->GetAttr(
+ sal_uLong nIndex = rDoc.GetAttr(
nCurX, nCurY, nTab, ATTR_VALIDDATA )->GetValue();
if ( nIndex )
{
- const ScValidationData* pOldData = pDoc->GetValidationEntry( nIndex );
+ const ScValidationData* pOldData = rDoc.GetValidationEntry( nIndex );
if ( pOldData )
{
eMode = pOldData->GetDataMode();
@@ -824,7 +823,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
{
SvNumFormatType nType = ( eMode == SC_VALID_DATE ) ? SvNumFormatType::DATE
: SvNumFormatType::TIME;
- nNumFmt = pDoc->GetFormatTable()->GetStandardFormat(
+ nNumFmt = rDoc.GetFormatTable()->GetStandardFormat(
nType, ScGlobal::eLnge );
}
aExpr1 = pOldData->GetExpression( aCursorPos, 0, nNumFmt );
@@ -873,7 +872,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
{
sal_uInt32 nNumIndex = 0;
double nVal;
- if (pDoc->GetFormatTable()->IsNumberFormat(aTemp1, nNumIndex, nVal))
+ if (rDoc.GetFormatTable()->IsNumberFormat(aTemp1, nNumIndex, nVal))
aExpr1 = ::rtl::math::doubleToUString( nVal,
rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
ScGlobal::getLocaleDataPtr()->getNumDecimalSep()[0], true);
@@ -890,7 +889,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
{
sal_uInt32 nNumIndex = 0;
double nVal;
- if (pDoc->GetFormatTable()->IsNumberFormat(aTemp2, nNumIndex, nVal))
+ if (rDoc.GetFormatTable()->IsNumberFormat(aTemp2, nNumIndex, nVal))
aExpr2 = ::rtl::math::doubleToUString( nVal,
rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
ScGlobal::getLocaleDataPtr()->getNumDecimalSep()[0], true);
@@ -938,7 +937,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
if ( pOutSet->GetItemState( FID_VALID_ERRTEXT, true, &pItem ) == SfxItemState::SET )
aErrText = static_cast<const SfxStringItem*>(pItem)->GetValue();
- ScValidationData aData( eMode, eOper, aExpr1, aExpr2, *pDoc, aCursorPos );
+ ScValidationData aData( eMode, eOper, aExpr1, aExpr2, rDoc, aCursorPos );
aData.SetIgnoreBlank( bBlank );
aData.SetListType( nListType );
@@ -966,10 +965,9 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
if ( lcl_GetTextToColumnsRange( pData, aRange, false ) )
{
- ScDocument* pDoc = pData->GetDocument();
- OSL_ENSURE( pDoc, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pDoc is null!" );
+ ScDocument& rDoc = pData->GetDocument();
- ScImportExport aExport( pDoc, aRange );
+ ScImportExport aExport( &rDoc, aRange );
aExport.SetExportTextOptions( ScExportTextOptions( ScExportTextOptions::None, 0, false ) );
// #i87703# text to columns fails with tab separator
@@ -992,7 +990,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
OUString aUndo = ScResId( STR_UNDO_TEXTTOCOLUMNS );
pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, pData->GetViewShell()->GetViewShellId() );
- ScImportExport aImport( pDoc, aRange.aStart );
+ ScImportExport aImport( &rDoc, aRange.aStart );
ScAsciiOptions aOptions;
pDlg->GetOptions( aOptions );
pDlg->SaveParameters();
@@ -1191,8 +1189,8 @@ void ScCellShell::GetDBState( SfxItemSet& rSet )
break;
case SID_DATA_PROVIDER_REFRESH:
{
- ScDocument* pDoc = GetViewData()->GetDocument();
- auto& rDataMapper = pDoc->GetExternalDataMapper();
+ ScDocument& rViewDoc = GetViewData()->GetDocument();
+ auto& rDataMapper = rViewDoc.GetExternalDataMapper();
if (rDataMapper.getDataSources().empty())
rSet.DisableItem(nWhich);
}
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index c7a40214c053..5cc6e7691813 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -330,8 +330,8 @@ void ScCellShell::Execute( SfxRequest& rReq )
{
OUString aStr = static_cast<const SfxStringItem&>(pReqArgs->
Get( SID_INSERT_MATRIX )).GetValue();
- ScDocument* pDoc = GetViewData()->GetDocument();
- pTabViewShell->EnterMatrix( aStr, pDoc->GetGrammar() );
+ ScDocument& rDoc = GetViewData()->GetDocument();
+ pTabViewShell->EnterMatrix( aStr, rDoc.GetGrammar() );
rReq.Done();
}
}
@@ -400,8 +400,8 @@ void ScCellShell::Execute( SfxRequest& rReq )
}
else
{
- ScDocument* pDoc = GetViewData()->GetDocument();
- pTabViewShell->EnterMatrix( aString, pDoc->GetGrammar() );
+ ScDocument& rDoc = GetViewData()->GetDocument();
+ pTabViewShell->EnterMatrix( aString, rDoc.GetGrammar() );
rReq.Done();
}
}
@@ -534,11 +534,11 @@ void ScCellShell::Execute( SfxRequest& rReq )
case SID_SCENARIOS:
{
- ScDocument* pDoc = GetViewData()->GetDocument();
+ ScDocument& rDoc = GetViewData()->GetDocument();
ScMarkData& rMark = GetViewData()->GetMarkData();
SCTAB nTab = GetViewData()->GetTabNo();
- if ( pDoc->IsScenario(nTab) )
+ if ( rDoc.IsScenario(nTab) )
{
rMark.MarkToMulti();
if ( rMark.IsMultiMarked() )
@@ -581,7 +581,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
ScScenarioFlags nFlags;
OUString aTmp;
- pDoc->GetName(nTab, aTmp);
+ rDoc.GetName(nTab, aTmp);
aBaseName = aTmp + "_" + ScResId(STR_SCENARIO) + "_";
// first test, if the prefix is recognised as valid,
@@ -589,7 +589,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
bool bPrefix = ScDocument::ValidTabName( aBaseName );
OSL_ENSURE(bPrefix, "invalid sheet name");
- while ( pDoc->IsScenario(nTab+i) )
+ while ( rDoc.IsScenario(nTab+i) )
i++;
bool bValid;
@@ -598,9 +598,9 @@ void ScCellShell::Execute( SfxRequest& rReq )
{
aName = aBaseName + OUString::number( i );
if (bPrefix)
- bValid = pDoc->ValidNewTabName( aName );
+ bValid = rDoc.ValidNewTabName( aName );
else
- bValid = !pDoc->GetTable( aName, nDummy );
+ bValid = !rDoc.GetTable( aName, nDummy );
++i;
}
while ( !bValid && i <= MAXTAB + 2 );
@@ -624,7 +624,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
}
else
{
- bool bSheetProtected = pDoc->IsTabProtected(nTab);
+ bool bSheetProtected = rDoc.IsTabProtected(nTab);
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
ScopedVclPtr<AbstractScNewScenarioDlg> pNewDlg(pFact->CreateScNewScenarioDlg(pTabViewShell->GetFrameWeld(), aName, false, bSheetProtected));
@@ -693,7 +693,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
{
ScViewData* pData = GetViewData();
FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric();
- sal_uInt16 nCurHeight = pData->GetDocument()->
+ sal_uInt16 nCurHeight = pData->GetDocument().
GetRowHeight( pData->GetCurY(),
pData->GetTabNo() );
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
@@ -792,7 +792,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
{
FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric();
ScViewData* pData = GetViewData();
- sal_uInt16 nCurHeight = pData->GetDocument()->
+ sal_uInt16 nCurHeight = pData->GetDocument().
GetColWidth( pData->GetCurX(),
pData->GetTabNo() );
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
@@ -882,7 +882,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
case FID_MERGE_OFF:
case FID_MERGE_TOGGLE:
{
- if ( !GetViewData()->GetDocument()->GetChangeTrack() )
+ if ( !GetViewData()->GetDocument().GetChangeTrack() )
{
// test whether to merge or to split
bool bMerge = false;
diff --git a/sc/source/ui/view/cellsh4.cxx b/sc/source/ui/view/cellsh4.cxx
index 56d74cd4b86a..3243400faaf1 100644
--- a/sc/source/ui/view/cellsh4.cxx
+++ b/sc/source/ui/view/cellsh4.cxx
@@ -107,7 +107,7 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq )
}
SCCOLROW nRTLSign = 1;
- if ( pData->GetDocument()->IsLayoutRTL( pData->GetTabNo() ) )
+ if ( pData->GetDocument().IsLayoutRTL( pData->GetTabNo() ) )
{
//! evaluate cursor movement option?
nRTLSign = -1;
@@ -266,7 +266,7 @@ void ScCellShell::ExecuteCursorSel( SfxRequest& rReq )
SCROW nMovY = nRepeat;
// Horizontal direction depends on whether or not the UI language is RTL.
SCCOL nMovX = nRepeat;
- if (GetViewData()->GetDocument()->IsLayoutRTL(GetViewData()->GetTabNo()))
+ if (GetViewData()->GetDocument().IsLayoutRTL(GetViewData()->GetTabNo()))
{
// mirror horizontal movement for right-to-left mode.
nMovX = -nRepeat;
diff --git a/sc/source/ui/view/cliputil.cxx b/sc/source/ui/view/cliputil.cxx
index bdee23c43a2a..ff3878e600f2 100644
--- a/sc/source/ui/view/cliputil.cxx
+++ b/sc/source/ui/view/cliputil.cxx
@@ -46,8 +46,8 @@ bool lcl_checkClassification(ScDocument* pSourceDoc, const ScDocument* pDestinat
void ScClipUtil::PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTabViewShell, bool bShowDialog )
{
const ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(pViewData->GetActiveWin()));
- ScDocument* pThisDoc = pViewData->GetDocument();
- ScDPObject* pDPObj = pThisDoc->GetDPAtCursor( pViewData->GetCurX(),
+ ScDocument& rThisDoc = pViewData->GetDocument();
+ ScDPObject* pDPObj = rThisDoc.GetDPAtCursor( pViewData->GetCurX(),
pViewData->GetCurY(), pViewData->GetTabNo() );
if ( pOwnClip && pDPObj )
{
@@ -84,7 +84,7 @@ void ScClipUtil::PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTab
// For multi-range paste, we paste values by default.
nFlags &= ~InsertDeleteFlags::FORMULA;
- if (lcl_checkClassification(pClipDoc, pThisDoc))
+ if (lcl_checkClassification(pClipDoc, &rThisDoc))
pTabViewShell->PasteFromClip( nFlags, pClipDoc,
ScPasteFunc::NONE, false, false, false, INS_NONE, InsertDeleteFlags::NONE,
bShowDialog ); // allow warning dialog
diff --git a/sc/source/ui/view/colrowba.cxx b/sc/source/ui/view/colrowba.cxx
index ed16810c7065..69e6118d46ec 100644
--- a/sc/source/ui/view/colrowba.cxx
+++ b/sc/source/ui/view/colrowba.cxx
@@ -51,7 +51,7 @@ static OUString lcl_MetricString( long nTwips, const OUString& rText )
ScColBar::ScColBar( vcl::Window* pParent, ScHSplitPos eWhich,
ScHeaderFunctionSet* pFuncSet, ScHeaderSelectionEngine* pEng,
ScTabView* pTab ) :
- ScHeaderControl( pParent, pEng, pTab->GetViewData().GetDocument()->MaxCol()+1, false, pTab ),
+ ScHeaderControl( pParent, pEng, pTab->GetViewData().GetDocument().MaxCol()+1, false, pTab ),
meWhich( eWhich ),
mpFuncSet( pFuncSet )
{
@@ -70,17 +70,17 @@ SCCOLROW ScColBar::GetPos() const
sal_uInt16 ScColBar::GetEntrySize( SCCOLROW nEntryNo ) const
{
const ScViewData& rViewData = pTabView->GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
SCTAB nTab = rViewData.GetTabNo();
- if (pDoc->ColHidden(static_cast<SCCOL>(nEntryNo), nTab))
+ if (rDoc.ColHidden(static_cast<SCCOL>(nEntryNo), nTab))
return 0;
else
- return static_cast<sal_uInt16>(ScViewData::ToPixel( pDoc->GetColWidth( static_cast<SCCOL>(nEntryNo), nTab ), rViewData.GetPPTX() ));
+ return static_cast<sal_uInt16>(ScViewData::ToPixel( rDoc.GetColWidth( static_cast<SCCOL>(nEntryNo), nTab ), rViewData.GetPPTX() ));
}
OUString ScColBar::GetEntryText( SCCOLROW nEntryNo ) const
{
- return pTabView->GetViewData().GetDocument()->GetAddressConvention() == formula::FormulaGrammar::CONV_XL_R1C1
+ return pTabView->GetViewData().GetDocument().GetAddressConvention() == formula::FormulaGrammar::CONV_XL_R1C1
? OUString::number(nEntryNo + 1)
: ScColToAlpha( static_cast<SCCOL>(nEntryNo) );
}
@@ -105,16 +105,16 @@ void ScColBar::SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewSize )
std::vector<sc::ColRowSpan> aRanges;
if ( rMark.IsColumnMarked( static_cast<SCCOL>(nPos) ) )
{
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
SCCOL nStart = 0;
- while (nStart<=pDoc->MaxCol())
+ while (nStart<=rDoc.MaxCol())
{
- while (nStart<pDoc->MaxCol() && !rMark.IsColumnMarked(nStart))
+ while (nStart<rDoc.MaxCol() && !rMark.IsColumnMarked(nStart))
++nStart;
if (rMark.IsColumnMarked(nStart))
{
SCCOL nEnd = nStart;
- while (nEnd<pDoc->MaxCol() && rMark.IsColumnMarked(nEnd))
+ while (nEnd<rDoc.MaxCol() && rMark.IsColumnMarked(nEnd))
++nEnd;
if (!rMark.IsColumnMarked(nEnd))
--nEnd;
@@ -122,7 +122,7 @@ void ScColBar::SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewSize )
nStart = nEnd+1;
}
else
- nStart = pDoc->MaxCol()+1;
+ nStart = rDoc.MaxCol()+1;
}
}
else
@@ -205,13 +205,13 @@ OUString ScColBar::GetDragHelp( long nVal )
bool ScColBar::IsLayoutRTL() const // override only for columns
{
const ScViewData& rViewData = pTabView->GetViewData();
- return rViewData.GetDocument()->IsLayoutRTL( rViewData.GetTabNo() );
+ return rViewData.GetDocument().IsLayoutRTL( rViewData.GetTabNo() );
}
ScRowBar::ScRowBar( vcl::Window* pParent, ScVSplitPos eWhich,
ScHeaderFunctionSet* pFuncSet, ScHeaderSelectionEngine* pEng,
ScTabView* pTab ) :
- ScHeaderControl( pParent, pEng, pTab->GetViewData().GetDocument()->MaxRow()+1, true, pTab ),
+ ScHeaderControl( pParent, pEng, pTab->GetViewData().GetDocument().MaxRow()+1, true, pTab ),
meWhich( eWhich ),
mpFuncSet( pFuncSet )
{
@@ -230,13 +230,13 @@ SCCOLROW ScRowBar::GetPos() const
sal_uInt16 ScRowBar::GetEntrySize( SCCOLROW nEntryNo ) const
{
const ScViewData& rViewData = pTabView->GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
SCTAB nTab = rViewData.GetTabNo();
SCROW nLastRow = -1;
- if (pDoc->RowHidden(nEntryNo, nTab, nullptr, &nLastRow))
+ if (rDoc.RowHidden(nEntryNo, nTab, nullptr, &nLastRow))
return 0;
else
- return static_cast<sal_uInt16>(ScViewData::ToPixel( pDoc->GetOriginalHeight( nEntryNo,
+ return static_cast<sal_uInt16>(ScViewData::ToPixel( rDoc.GetOriginalHeight( nEntryNo,
nTab ), rViewData.GetPPTY() ));
}
@@ -265,16 +265,16 @@ void ScRowBar::SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewSize )
std::vector<sc::ColRowSpan> aRanges;
if ( rMark.IsRowMarked( nPos ) )
{
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
SCROW nStart = 0;
- while (nStart<=pDoc->MaxRow())
+ while (nStart<=rDoc.MaxRow())
{
- while (nStart<pDoc->MaxRow() && !rMark.IsRowMarked(nStart))
+ while (nStart<rDoc.MaxRow() && !rMark.IsRowMarked(nStart))
++nStart;
if (rMark.IsRowMarked(nStart))
{
SCROW nEnd = nStart;
- while (nEnd<pDoc->MaxRow() && rMark.IsRowMarked(nEnd))
+ while (nEnd<rDoc.MaxRow() && rMark.IsRowMarked(nEnd))
++nEnd;
if (!rMark.IsRowMarked(nEnd))
--nEnd;
@@ -282,7 +282,7 @@ void ScRowBar::SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewSize )
nStart = nEnd+1;
}
else
- nStart = pDoc->MaxRow()+1;
+ nStart = rDoc.MaxRow()+1;
}
}
else
@@ -365,15 +365,15 @@ OUString ScRowBar::GetDragHelp( long nVal )
SCCOLROW ScRowBar::GetHiddenCount( SCCOLROW nEntryNo ) const // override only for rows
{
const ScViewData& rViewData = pTabView->GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
SCTAB nTab = rViewData.GetTabNo();
- return pDoc->GetHiddenRowCount( nEntryNo, nTab );
+ return rDoc.GetHiddenRowCount( nEntryNo, nTab );
}
bool ScRowBar::IsMirrored() const // override only for rows
{
const ScViewData& rViewData = pTabView->GetViewData();
- return rViewData.GetDocument()->IsLayoutRTL( rViewData.GetTabNo() );
+ return rViewData.GetDocument().IsLayoutRTL( rViewData.GetTabNo() );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index 2f559ddea045..de6a8326112e 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -52,8 +52,8 @@ ScDBFunc::~ScDBFunc()
void ScDBFunc::GotoDBArea( const OUString& rDBName )
{
- ScDocument* pDoc = GetViewData().GetDocument();
- ScDBCollection* pDBCol = pDoc->GetDBCollection();
+ ScDocument& rDoc = GetViewData().GetDocument();
+ ScDBCollection* pDBCol = rDoc.GetDBCollection();
ScDBData* pData = pDBCol->getNamedDBs().findByUpperName(ScGlobal::getCharClassPtr()->uppercase(rDBName));
if (!pData)
return;
@@ -278,7 +278,7 @@ void ScDBFunc::ToggleAutoFilter()
ScDocShellModificator aModificator( *pDocSh );
ScQueryParam aParam;
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScDBData* pDBData = GetDBData(false, SC_DB_AUTOFILTER, ScGetDBSelection::RowDown);
pDBData->SetByRow( true ); //! undo, retrieve beforehand ??
@@ -296,7 +296,7 @@ void ScDBFunc::ToggleAutoFilter()
for (nCol=aParam.nCol1; nCol<=aParam.nCol2 && bHasAuto; nCol++)
{
- nFlag = pDoc->GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG )->GetValue();
+ nFlag = rDoc.GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG )->GetValue();
if ( !(nFlag & ScMF::Auto) )
bHasAuto = false;
@@ -308,8 +308,8 @@ void ScDBFunc::ToggleAutoFilter()
for (nCol=aParam.nCol1; nCol<=aParam.nCol2; nCol++)
{
- nFlag = pDoc->GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG )->GetValue();
- pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag & ~ScMF::Auto ) );
+ nFlag = rDoc.GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG )->GetValue();
+ rDoc.ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag & ~ScMF::Auto ) );
}
// use a list action for the AutoFilter buttons (ScUndoAutoFilter) and the filter operation
@@ -338,9 +338,9 @@ void ScDBFunc::ToggleAutoFilter()
}
else // show filter buttons
{
- if ( !pDoc->IsBlockEmpty( nTab,
- aParam.nCol1, aParam.nRow1,
- aParam.nCol2, aParam.nRow2 ) )
+ if ( !rDoc.IsBlockEmpty( nTab,
+ aParam.nCol1, aParam.nRow1,
+ aParam.nCol2, aParam.nRow2 ) )
{
if (!bHeader)
{
@@ -364,8 +364,8 @@ void ScDBFunc::ToggleAutoFilter()
for (nCol=aParam.nCol1; nCol<=aParam.nCol2; nCol++)
{
- nFlag = pDoc->GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG )->GetValue();
- pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag | ScMF::Auto ) );
+ nFlag = rDoc.GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG )->GetValue();
+ rDoc.ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag | ScMF::Auto ) );
}
pDocSh->PostPaint(ScRange(aParam.nCol1, nRow, nTab, aParam.nCol2, nRow, nTab),
PaintPartFlags::Grid);
@@ -431,8 +431,8 @@ void ScDBFunc::HideAutoFilter()
bool ScDBFunc::ImportData( const ScImportParam& rParam )
{
- ScDocument* pDoc = GetViewData().GetDocument();
- ScEditableTester aTester( pDoc, GetViewData().GetTabNo(), rParam.nCol1,rParam.nRow1,
+ ScDocument& rDoc = GetViewData().GetDocument();
+ ScEditableTester aTester( &rDoc, GetViewData().GetTabNo(), rParam.nCol1,rParam.nRow1,
rParam.nCol2,rParam.nRow2 );
if ( !aTester.IsEditable() )
{
diff --git a/sc/source/ui/view/dbfunc2.cxx b/sc/source/ui/view/dbfunc2.cxx
index 866611f4089f..f5b8cf6cba77 100644
--- a/sc/source/ui/view/dbfunc2.cxx
+++ b/sc/source/ui/view/dbfunc2.cxx
@@ -25,13 +25,13 @@ void ScDBFunc::UpdateCharts( bool bAllCharts )
{
sal_uInt16 nFound = 0;
ScViewData& rViewData = GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
- if ( pDoc->GetDrawLayer() )
+ if ( rDoc.GetDrawLayer() )
nFound = DoUpdateCharts( ScAddress( rViewData.GetCurX(),
rViewData.GetCurY(),
rViewData.GetTabNo()),
- pDoc,
+ &rDoc,
bAllCharts );
if ( !nFound && !bAllCharts )
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 5f19e0f7af59..9e7fe04c9b94 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -137,15 +137,15 @@ void ScDBFunc::TestRemoveOutline( bool& rCol, bool& rRow )
if (GetViewData().GetSimpleArea(nStartCol,nStartRow,nStartTab,nEndCol,nEndRow,nEndTab) == SC_MARK_SIMPLE)
{
SCTAB nTab = nStartTab;
- ScDocument* pDoc = GetViewData().GetDocument();
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
+ ScDocument& rDoc = GetViewData().GetDocument();
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
if (pTable)
{
ScOutlineEntry* pEntry;
SCCOLROW nStart;
SCCOLROW nEnd;
- bool bColMarked = ( nStartRow == 0 && nEndRow == pDoc->MaxRow() );
- bool bRowMarked = ( nStartCol == 0 && nEndCol == pDoc->MaxCol() );
+ bool bColMarked = ( nStartRow == 0 && nEndRow == rDoc.MaxRow() );
+ bool bRowMarked = ( nStartCol == 0 && nEndCol == rDoc.MaxCol() );
// columns
@@ -211,9 +211,9 @@ void ScDBFunc::RemoveAllOutlines( bool bRecord )
void ScDBFunc::AutoOutline( )
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
SCTAB nTab = GetViewData().GetTabNo();
- ScRange aRange( 0,0,nTab, pDoc->MaxCol(),pDoc->MaxRow(),nTab ); // the complete sheet, if nothing is marked
+ ScRange aRange( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab ); // the complete sheet, if nothing is marked
ScMarkData& rMark = GetViewData().GetMarkData();
if ( rMark.IsMarked() || rMark.IsMultiMarked() )
{
@@ -315,9 +315,9 @@ bool ScDBFunc::OutlinePossible(bool bHide)
if (GetViewData().GetSimpleArea(nStartCol,nStartRow,nStartTab,nEndCol,nEndRow,nEndTab) == SC_MARK_SIMPLE)
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
SCTAB nTab = GetViewData().GetTabNo();
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
if (pTable)
{
SCCOLROW nStart;
@@ -630,8 +630,8 @@ bool ScDBFunc::MakePivotTable(
}
ScDocShell* pDocSh = GetViewData().GetDocShell();
- ScDocument* pDoc = GetViewData().GetDocument();
- bool bUndo = pDoc->IsUndoEnabled();
+ ScDocument& rDoc = GetViewData().GetDocument();
+ bool bUndo = rDoc.IsUndoEnabled();
ScRange aDestRange = rDest;
if ( bNewTable )
@@ -641,16 +641,16 @@ bool ScDBFunc::MakePivotTable(
OUString aName( ScResId(STR_PIVOT_TABLE) );
OUString aStr;
- pDoc->GetName( nSrcTab, aStr );
+ rDoc.GetName( nSrcTab, aStr );
aName += "_" + aStr + "_";
SCTAB nNewTab = nSrcTab+1;
SCTAB i=1;
- while ( !pDoc->InsertTab( nNewTab, lcl_MakePivotTabName( aName, i ) ) && i <= MAXTAB )
+ while ( !rDoc.InsertTab( nNewTab, lcl_MakePivotTabName( aName, i ) ) && i <= MAXTAB )
i++;
- bool bAppend = ( nNewTab+1 == pDoc->GetTableCount() );
+ bool bAppend = ( nNewTab+1 == rDoc.GetTableCount() );
if (bUndo)
{
pDocSh->GetUndoManager()->AddUndoAction(
@@ -663,7 +663,7 @@ bool ScDBFunc::MakePivotTable(
aDestRange = ScRange( 0, 0, nNewTab );
}
- ScDPObject* pDPObj = pDoc->GetDPAtCursor(
+ ScDPObject* pDPObj = rDoc.GetDPAtCursor(
aDestRange.aStart.Col(), aDestRange.aStart.Row(), aDestRange.aStart.Tab() );
ScDPObject aObj( rSource );
@@ -721,11 +721,11 @@ void ScDBFunc::DeletePivotTable()
void ScDBFunc::RecalcPivotTable()
{
ScDocShell* pDocSh = GetViewData().GetDocShell();
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
- ScDPObject* pDPObj = pDoc->GetDPAtCursor( GetViewData().GetCurX(),
- GetViewData().GetCurY(),
- GetViewData().GetTabNo() );
+ ScDPObject* pDPObj = rDoc.GetDPAtCursor( GetViewData().GetCurX(),
+ GetViewData().GetCurY(),
+ GetViewData().GetTabNo() );
if (pDPObj)
{
// Remove existing data cache for the data that this datapilot uses,
@@ -741,7 +741,7 @@ void ScDBFunc::RecalcPivotTable()
void ScDBFunc::GetSelectedMemberList(ScDPUniqueStringSet& rEntries, long& rDimension)
{
- ScDPObject* pDPObj = GetViewData().GetDocument()->GetDPAtCursor( GetViewData().GetCurX(),
+ ScDPObject* pDPObj = GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
GetViewData().GetCurY(), GetViewData().GetTabNo() );
if ( !pDPObj )
return;
@@ -810,9 +810,9 @@ bool ScDBFunc::HasSelectionForDateGroup( ScDPNumGroupInfo& rOldInfo, sal_Int32&
SCCOL nCurX = GetViewData().GetCurX();
SCROW nCurY = GetViewData().GetCurY();
SCTAB nTab = GetViewData().GetTabNo();
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
- ScDPObject* pDPObj = pDoc->GetDPAtCursor( nCurX, nCurY, nTab );
+ ScDPObject* pDPObj = rDoc.GetDPAtCursor( nCurX, nCurY, nTab );
if ( pDPObj )
{
ScDPUniqueStringSet aEntries;
@@ -891,19 +891,19 @@ bool ScDBFunc::HasSelectionForDateGroup( ScDPNumGroupInfo& rOldInfo, sal_Int32&
SCCOL nSelCol = aSelRange.aStart.Col();
SCROW nSelRow = aSelRange.aStart.Row();
SCTAB nSelTab = aSelRange.aStart.Tab();
- if ( pDoc->HasValueData( nSelCol, nSelRow, nSelTab ) )
+ if ( rDoc.HasValueData( nSelCol, nSelRow, nSelTab ) )
{
- sal_uLong nIndex = pDoc->GetAttr(
+ sal_uLong nIndex = rDoc.GetAttr(
nSelCol, nSelRow, nSelTab, ATTR_VALUE_FORMAT)->GetValue();
- SvNumFormatType nType = pDoc->GetFormatTable()->GetType(nIndex);
+ SvNumFormatType nType = rDoc.GetFormatTable()->GetType(nIndex);
if ( nType == SvNumFormatType::DATE || nType == SvNumFormatType::TIME || nType == SvNumFormatType::DATETIME )
{
bFound = true;
// use currently selected value for automatic limits
if( rOldInfo.mbAutoStart )
- rOldInfo.mfStart = pDoc->GetValue( aSelRange.aStart );
+ rOldInfo.mfStart = rDoc.GetValue( aSelRange.aStart );
if( rOldInfo.mbAutoEnd )
- rOldInfo.mfEnd = pDoc->GetValue( aSelRange.aStart );
+ rOldInfo.mfEnd = rDoc.GetValue( aSelRange.aStart );
}
}
}
@@ -923,9 +923,9 @@ bool ScDBFunc::HasSelectionForNumGroup( ScDPNumGroupInfo& rOldInfo )
SCCOL nCurX = GetViewData().GetCurX();
SCROW nCurY = GetViewData().GetCurY();
SCTAB nTab = GetViewData().GetTabNo();
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
- ScDPObject* pDPObj = pDoc->GetDPAtCursor( nCurX, nCurY, nTab );
+ ScDPObject* pDPObj = rDoc.GetDPAtCursor( nCurX, nCurY, nTab );
if ( pDPObj )
{
ScDPUniqueStringSet aEntries;
@@ -964,15 +964,15 @@ bool ScDBFunc::HasSelectionForNumGroup( ScDPNumGroupInfo& rOldInfo )
if ( (GetViewData().GetSimpleArea( aSelRange ) == SC_MARK_SIMPLE) &&
aSelRange.aStart == aSelRange.aEnd )
{
- if ( pDoc->HasValueData( aSelRange.aStart.Col(), aSelRange.aStart.Row(),
+ if ( rDoc.HasValueData( aSelRange.aStart.Col(), aSelRange.aStart.Row(),
aSelRange.aStart.Tab() ) )
{
bFound = true;
// use currently selected value for automatic limits
if( rOldInfo.mbAutoStart )
- rOldInfo.mfStart = pDoc->GetValue( aSelRange.aStart );
+ rOldInfo.mfStart = rDoc.GetValue( aSelRange.aStart );
if( rOldInfo.mbAutoEnd )
- rOldInfo.mfEnd = pDoc->GetValue( aSelRange.aStart );
+ rOldInfo.mfEnd = rDoc.GetValue( aSelRange.aStart );
}
}
}
@@ -984,7 +984,7 @@ bool ScDBFunc::HasSelectionForNumGroup( ScDPNumGroupInfo& rOldInfo )
void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nParts )
{
- ScDPObject* pDPObj = GetViewData().GetDocument()->GetDPAtCursor( GetViewData().GetCurX(),
+ ScDPObject* pDPObj = GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
GetViewData().GetCurY(), GetViewData().GetTabNo() );
if (!pDPObj)
return;
@@ -1082,7 +1082,7 @@ void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nPar
void ScDBFunc::NumGroupDataPilot( const ScDPNumGroupInfo& rInfo )
{
- ScDPObject* pDPObj = GetViewData().GetDocument()->GetDPAtCursor( GetViewData().GetCurX(),
+ ScDPObject* pDPObj = GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
GetViewData().GetCurY(), GetViewData().GetTabNo() );
if (!pDPObj)
return;
@@ -1124,7 +1124,7 @@ void ScDBFunc::NumGroupDataPilot( const ScDPNumGroupInfo& rInfo )
void ScDBFunc::GroupDataPilot()
{
- ScDPObject* pDPObj = GetViewData().GetDocument()->GetDPAtCursor( GetViewData().GetCurX(),
+ ScDPObject* pDPObj = GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
GetViewData().GetCurY(), GetViewData().GetTabNo() );
if (!pDPObj)
return;
@@ -1259,7 +1259,7 @@ void ScDBFunc::GroupDataPilot()
void ScDBFunc::UngroupDataPilot()
{
- ScDPObject* pDPObj = GetViewData().GetDocument()->GetDPAtCursor( GetViewData().GetCurX(),
+ ScDPObject* pDPObj = GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
GetViewData().GetCurY(), GetViewData().GetTabNo() );
if (!pDPObj)
return;
@@ -1381,12 +1381,12 @@ void ScDBFunc::DataPilotInput( const ScAddress& rPos, const OUString& rString )
{
using namespace ::com::sun::star::sheet;
- ScDocument* pDoc = GetViewData().GetDocument();
- ScDPObject* pDPObj = pDoc->GetDPAtCursor( rPos.Col(), rPos.Row(), rPos.Tab() );
+ ScDocument& rDoc = GetViewData().GetDocument();
+ ScDPObject* pDPObj = rDoc.GetDPAtCursor( rPos.Col(), rPos.Row(), rPos.Tab() );
if (!pDPObj)
return;
- OUString aOldText = pDoc->GetString(rPos.Col(), rPos.Row(), rPos.Tab());
+ OUString aOldText = rDoc.GetString(rPos.Col(), rPos.Row(), rPos.Tab());
if ( aOldText == rString )
{
@@ -1641,7 +1641,7 @@ void ScDBFunc::DataPilotInput( const ScAddress& rPos, const OUString& rString )
pDPObj->SetSaveData( aData );
if (bNeedReloadGroups)
{
- ScDPCollection* pDPs = pDoc->GetDPCollection();
+ ScDPCollection* pDPs = rDoc.GetDPCollection();
if (pDPs)
{
std::set<ScDPObject*> aRefs;
@@ -1817,9 +1817,9 @@ void ScDBFunc::DataPilotSort(ScDPObject* pDPObj, long nDimIndex, bool bAscending
bool ScDBFunc::DataPilotMove( const ScRange& rSource, const ScAddress& rDest )
{
bool bRet = false;
- ScDocument* pDoc = GetViewData().GetDocument();
- ScDPObject* pDPObj = pDoc->GetDPAtCursor( rSource.aStart.Col(), rSource.aStart.Row(), rSource.aStart.Tab() );
- if ( pDPObj && pDPObj == pDoc->GetDPAtCursor( rDest.Col(), rDest.Row(), rDest.Tab() ) )
+ ScDocument& rDoc = GetViewData().GetDocument();
+ ScDPObject* pDPObj = rDoc.GetDPAtCursor( rSource.aStart.Col(), rSource.aStart.Row(), rSource.aStart.Tab() );
+ if ( pDPObj && pDPObj == rDoc.GetDPAtCursor( rDest.Col(), rDest.Row(), rDest.Tab() ) )
{
sheet::DataPilotTableHeaderData aDestData;
pDPObj->GetHeaderPositionData( rDest, aDestData );
@@ -1908,7 +1908,7 @@ bool ScDBFunc::HasSelectionForDrillDown( css::sheet::DataPilotFieldOrientation&
{
bool bRet = false;
- ScDPObject* pDPObj = GetViewData().GetDocument()->GetDPAtCursor( GetViewData().GetCurX(),
+ ScDPObject* pDPObj = GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
GetViewData().GetCurY(), GetViewData().GetTabNo() );
if ( pDPObj )
{
@@ -1943,7 +1943,7 @@ bool ScDBFunc::HasSelectionForDrillDown( css::sheet::DataPilotFieldOrientation&
void ScDBFunc::SetDataPilotDetails(bool bShow, const OUString* pNewDimensionName)
{
- ScDPObject* pDPObj = GetViewData().GetDocument()->GetDPAtCursor( GetViewData().GetCurX(),
+ ScDPObject* pDPObj = GetViewData().GetDocument().GetDPAtCursor( GetViewData().GetCurX(),
GetViewData().GetCurY(), GetViewData().GetTabNo() );
if ( !pDPObj )
return;
@@ -2029,8 +2029,8 @@ void ScDBFunc::SetDataPilotDetails(bool bShow, const OUString* pNewDimensionName
void ScDBFunc::ShowDataPilotSourceData( ScDPObject& rDPObj, const Sequence<sheet::DataPilotFieldFilter>& rFilters )
{
- ScDocument* pDoc = GetViewData().GetDocument();
- if (pDoc->GetDocumentShell()->IsReadOnly())
+ ScDocument& rDoc = GetViewData().GetDocument();
+ if (rDoc.GetDocumentShell()->IsReadOnly())
{
ErrorMessage(STR_READONLYERR);
return;
@@ -2053,7 +2053,7 @@ void ScDBFunc::ShowDataPilotSourceData( ScDPObject& rDPObj, const Sequence<sheet
SCTAB nNewTab = GetViewData().GetTabNo();
ScDocumentUniquePtr pInsDoc(new ScDocument(SCDOCMODE_CLIP));
- pInsDoc->ResetClip( pDoc, nNewTab );
+ pInsDoc->ResetClip( &rDoc, nNewTab );
for (SCROW nRow = 0; nRow < nRowSize; ++nRow)
{
for (SCCOL nCol = 0; nCol < nColSize; ++nCol)
@@ -2101,7 +2101,7 @@ void ScDBFunc::ShowDataPilotSourceData( ScDPObject& rDPObj, const Sequence<sheet
pMgr->EnterListAction( aUndo, aUndo, 0, GetViewData().GetViewShell()->GetViewShellId() );
OUString aNewTabName;
- pDoc->CreateValidTabName(aNewTabName);
+ rDoc.CreateValidTabName(aNewTabName);
if ( InsertTable(aNewTabName, nNewTab) )
PasteFromClip( InsertDeleteFlags::ALL, pInsDoc.get() );
@@ -2115,9 +2115,9 @@ void ScDBFunc::RepeatDB( bool bRecord )
SCCOL nCurX = GetViewData().GetCurX();
SCROW nCurY = GetViewData().GetCurY();
SCTAB nTab = GetViewData().GetTabNo();
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScDBData* pDBData = GetDBData();
- if (bRecord && !pDoc->IsUndoEnabled())
+ if (bRecord && !rDoc.IsUndoEnabled())
bRecord = false;
ScQueryParam aQueryParam;
@@ -2139,8 +2139,8 @@ void ScDBFunc::RepeatDB( bool bRecord )
ScRange aNewQuery;
if (bQuery && !aQueryParam.bInplace)
{
- ScDBData* pDest = pDoc->GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
- aQueryParam.nDestTab, ScDBDataPortion::TOP_LEFT );
+ ScDBData* pDest = rDoc.GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
+ aQueryParam.nDestTab, ScDBDataPortion::TOP_LEFT );
if (pDest && pDest->IsDoSize())
{
pDest->GetArea( aOldQuery );
@@ -2164,9 +2164,9 @@ void ScDBFunc::RepeatDB( bool bRecord )
if (bRecord)
{
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
+ ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
if (pTable)
{
pUndoTab.reset(new ScOutlineTable( *pTable ));
@@ -2178,24 +2178,24 @@ void ScDBFunc::RepeatDB( bool bRecord )
pTable->GetColArray().GetRange( nOutStartCol, nOutEndCol );
pTable->GetRowArray().GetRange( nOutStartRow, nOutEndRow );
- pUndoDoc->InitUndo( pDoc, nTab, nTab, true, true );
- pDoc->CopyToDocument( static_cast<SCCOL>(nOutStartCol), 0, nTab, static_cast<SCCOL>(nOutEndCol), pDoc->MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc );
- pDoc->CopyToDocument( 0, nOutStartRow, nTab, pDoc->MaxCol(), nOutEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ rDoc.CopyToDocument( static_cast<SCCOL>(nOutStartCol), 0, nTab, static_cast<SCCOL>(nOutEndCol), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc );
+ rDoc.CopyToDocument( 0, nOutStartRow, nTab, rDoc.MaxCol(), nOutEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc );
}
else
- pUndoDoc->InitUndo( pDoc, nTab, nTab, false, true );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
// Record data range - including filter results
- pDoc->CopyToDocument( 0,nStartRow,nTab, pDoc->MaxCol(),nEndRow,nTab, InsertDeleteFlags::ALL, false, *pUndoDoc );
+ rDoc.CopyToDocument( 0,nStartRow,nTab, rDoc.MaxCol(),nEndRow,nTab, InsertDeleteFlags::ALL, false, *pUndoDoc );
// all formulas for reference
- pDoc->CopyToDocument( 0,0,0, pDoc->MaxCol(),pDoc->MaxRow(),nTabCount-1, InsertDeleteFlags::FORMULA, false, *pUndoDoc );
+ rDoc.CopyToDocument( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),nTabCount-1, InsertDeleteFlags::FORMULA, false, *pUndoDoc );
// data base and other ranges
- ScRangeName* pDocRange = pDoc->GetRangeName();
+ ScRangeName* pDocRange = rDoc.GetRangeName();
if (!pDocRange->empty())
pUndoRange.reset(new ScRangeName( *pDocRange ));
- ScDBCollection* pDocDB = pDoc->GetDBCollection();
+ ScDBCollection* pDocDB = rDoc.GetDBCollection();
if (!pDocDB->empty())
pUndoDB.reset(new ScDBCollection( *pDocDB ));
}
@@ -2219,7 +2219,7 @@ void ScDBFunc::RepeatDB( bool bRecord )
ScRange aAdvSource;
if (pDBData->GetAdvancedQuerySource(aAdvSource))
{
- pDoc->CreateQueryParam(aAdvSource, aQueryParam);
+ rDoc.CreateQueryParam(aAdvSource, aQueryParam);
Query( aQueryParam, &aAdvSource, false );
}
else
@@ -2247,8 +2247,8 @@ void ScDBFunc::RepeatDB( bool bRecord )
const ScRange* pNew = nullptr;
if (bQuerySize)
{
- ScDBData* pDest = pDoc->GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
- aQueryParam.nDestTab, ScDBDataPortion::TOP_LEFT );
+ ScDBData* pDest = rDoc.GetDBAtCursor( aQueryParam.nDestCol, aQueryParam.nDestRow,
+ aQueryParam.nDestTab, ScDBDataPortion::TOP_LEFT );
if (pDest)
{
pDest->GetArea( aNewQuery );
@@ -2268,7 +2268,7 @@ void ScDBFunc::RepeatDB( bool bRecord )
}
GetViewData().GetDocShell()->PostPaint(
- ScRange(0, 0, nTab, pDoc->MaxCol(), pDoc->MaxRow(), nTab),
+ ScRange(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab),
PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top | PaintPartFlags::Size);
}
else // "no not execute any operations"
diff --git a/sc/source/ui/view/drawvie3.cxx b/sc/source/ui/view/drawvie3.cxx
index 83dcd0305fc5..b8e9623fe172 100644
--- a/sc/source/ui/view/drawvie3.cxx
+++ b/sc/source/ui/view/drawvie3.cxx
@@ -36,10 +36,10 @@
ScDrawView::ScDrawView(
OutputDevice* pOut,
ScViewData* pData )
-: FmFormView(*pData->GetDocument()->GetDrawLayer(), pOut),
+: FmFormView(*pData->GetDocument().GetDrawLayer(), pOut),
pViewData( pData ),
pDev( pOut ),
- pDoc( pData->GetDocument() ),
+ rDoc( pData->GetDocument() ),
nTab( pData->GetTabNo() ),
pDropMarkObj( nullptr ),
bInConstruct( true )
@@ -67,7 +67,7 @@ void ScDrawView::SetPageAnchored()
for( size_t i=0; i<nCount; ++i )
{
SdrObject* pObj = pMark->GetMark(i)->GetMarkedSdrObj();
- AddUndo (std::make_unique<ScUndoAnchorData>( pObj, pDoc, nTab ));
+ AddUndo (std::make_unique<ScUndoAnchorData>( pObj, &rDoc, nTab ));
ScDrawLayer::SetPageAnchored( *pObj );
}
EndUndo();
@@ -82,9 +82,6 @@ void ScDrawView::SetPageAnchored()
void ScDrawView::SetCellAnchored(bool bResizeWithCell)
{
- if (!pDoc)
- return;
-
if( !AreObjectsMarked() )
return;
@@ -95,8 +92,8 @@ void ScDrawView::SetCellAnchored(bool bResizeWithCell)
for( size_t i=0; i<nCount; ++i )
{
SdrObject* pObj = pMark->GetMark(i)->GetMarkedSdrObj();
- AddUndo (std::make_unique<ScUndoAnchorData>( pObj, pDoc, nTab ));
- ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *pDoc, nTab, bResizeWithCell);
+ AddUndo (std::make_unique<ScUndoAnchorData>( pObj, &rDoc, nTab ));
+ ScDrawLayer::SetCellAnchoredFromPosition(*pObj, rDoc, nTab, bResizeWithCell);
}
EndUndo();
@@ -180,7 +177,7 @@ void ScDrawView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
{
const SdrHint* pSdrHint = static_cast<const SdrHint*>( &rHint );
- adjustAnchoredPosition(*pSdrHint, *pDoc, nTab);
+ adjustAnchoredPosition(*pSdrHint, rDoc, nTab);
FmFormView::Notify( rBC,rHint );
}
else if (dynamic_cast<const ScTabDeletedHint*>(&rHint)) // Sheet has been deleted
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index f4331b034f71..7717979a39b4 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -334,7 +334,7 @@ void ScDrawView::DoCopy()
const SdrMarkList& rMarkList = GetMarkedObjectList();
std::vector<ScRange> aRanges;
bool bAnyOle = false, bOneOle = false;
- getOleSourceRanges( rMarkList, bAnyOle, bOneOle, &aRanges, pDoc );
+ getOleSourceRanges( rMarkList, bAnyOle, bOneOle, &aRanges, &rDoc );
// update ScGlobal::xDrawClipDocShellRef
ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle ) );
@@ -344,7 +344,7 @@ void ScDrawView::DoCopy()
// document. We need to do this before CreateMarkedObjModel() below.
ScDocShellRef xDocSh = ScGlobal::xDrawClipDocShellRef;
ScDocument& rClipDoc = xDocSh->GetDocument();
- copyChartRefDataToClipDoc(pDoc, &rClipDoc, aRanges);
+ copyChartRefDataToClipDoc(&rDoc, &rClipDoc, aRanges);
}
std::unique_ptr<SdrModel> pModel(CreateMarkedObjModel());
ScDrawLayer::SetGlobalDrawPersist(nullptr);
@@ -418,14 +418,14 @@ void ScDrawView::CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const
SCCOL nEndCol = 0;
SCROW nEndRow = 0;
- pDoc->GetTableArea( nTab, nEndCol, nEndRow );
+ rDoc.GetTableArea( nTab, nEndCol, nEndRow );
if (nEndCol<20)
nEndCol = 20;
if (nEndRow<20)
nEndRow = 1000;
Fraction aZoom(1,1);
- ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, pDev, aZoom,aZoom,
+ ScDrawUtil::CalcScale( &rDoc, nTab, 0,0, nEndCol,nEndRow, pDev, aZoom,aZoom,
nPPTX, nPPTY, rFractX,rFractY );
}
@@ -549,7 +549,7 @@ void ScDrawView::FitToCellSize()
std::unique_ptr<SdrUndoGroup> pUndoGroup(new SdrUndoGroup(*GetModel()));
tools::Rectangle aGraphicRect = pObj->GetSnapRect();
- tools::Rectangle aCellRect = ScDrawLayer::GetCellRect( *pDoc, pObjData->maStart, true);
+ tools::Rectangle aCellRect = ScDrawLayer::GetCellRect( rDoc, pObjData->maStart, true);
// For graphic objects, we want to keep the aspect ratio
if (pObj->shouldKeepAspectRatio())
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index 4fe6c0cbdc76..e372d060bb44 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -82,7 +82,7 @@ void ScDrawView::Construct()
ShowSdrPage(GetModel()->GetPage(nViewTab));
bool bEx = pViewData->GetViewShell()->IsDrawSelMode();
- bool bProt = pDoc->IsTabProtected( nViewTab ) ||
+ bool bProt = rDoc.IsTabProtected( nViewTab ) ||
pViewData->GetSfxDocShell()->IsReadOnly();
SdrLayer* pLayer;
@@ -318,14 +318,14 @@ void ScDrawView::RecalcScale()
SCCOL nEndCol = 0;
SCROW nEndRow = 0;
- pDoc->GetTableArea( nTab, nEndCol, nEndRow );
+ rDoc.GetTableArea( nTab, nEndCol, nEndRow );
if (nEndCol<20)
nEndCol = 20;
if (nEndRow<20)
nEndRow = 20;
ScDrawUtil::CalcScale(
- pDoc, nTab, 0, 0, nEndCol, nEndRow, pDev, aZoomX, aZoomY, nPPTX, nPPTY,
+ &rDoc, nTab, 0, 0, nEndCol, nEndRow, pDev, aZoomX, aZoomY, nPPTX, nPPTY,
aScaleX, aScaleY);
// clear all evtl existing GridOffset vectors
@@ -647,11 +647,11 @@ void ScDrawView::UpdateUserViewOptions()
SdrObject* ScDrawView::GetObjectByName(const OUString& rName)
{
- SfxObjectShell* pShell = pDoc->GetDocumentShell();
+ SfxObjectShell* pShell = rDoc.GetDocumentShell();
if (pShell)
{
SdrModel* pDrawLayer = GetModel();
- sal_uInt16 nTabCount = pDoc->GetTableCount();
+ sal_uInt16 nTabCount = rDoc.GetTableCount();
for (sal_uInt16 i=0; i<nTabCount; i++)
{
SdrPage* pPage = pDrawLayer->GetPage(i);
@@ -680,11 +680,11 @@ void ScDrawView::SelectCurrentViewObject( const OUString& rName )
{
sal_uInt16 nObjectTab = 0;
SdrObject* pFound = nullptr;
- SfxObjectShell* pShell = pDoc->GetDocumentShell();
+ SfxObjectShell* pShell = rDoc.GetDocumentShell();
if (pShell)
{
SdrModel* pDrawLayer = GetModel();
- sal_uInt16 nTabCount = pDoc->GetTableCount();
+ sal_uInt16 nTabCount = rDoc.GetTableCount();
for (sal_uInt16 i=0; i<nTabCount && !pFound; i++)
{
SdrPage* pPage = pDrawLayer->GetPage(i);
@@ -715,7 +715,7 @@ void ScDrawView::SelectCurrentViewObject( const OUString& rName )
pView->ScrollToObject( pFound );
if ( pFound->GetLayer() == SC_LAYER_BACK &&
!pViewData->GetViewShell()->IsDrawSelMode() &&
- !pDoc->IsTabProtected( nTab ) &&
+ !rDoc.IsTabProtected( nTab ) &&
!pViewData->GetSfxDocShell()->IsReadOnly() )
{
SdrLayer* pLayer = GetModel()->GetLayerAdmin().GetLayerPerID(SC_LAYER_BACK);
@@ -734,11 +734,11 @@ bool ScDrawView::SelectObject( const OUString& rName )
SCTAB nObjectTab = 0;
SdrObject* pFound = nullptr;
- SfxObjectShell* pShell = pDoc->GetDocumentShell();
+ SfxObjectShell* pShell = rDoc.GetDocumentShell();
if (pShell)
{
SdrModel* pDrawLayer = GetModel();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
for (SCTAB i=0; i<nTabCount && !pFound; i++)
{
SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(i));
@@ -775,7 +775,7 @@ bool ScDrawView::SelectObject( const OUString& rName )
(this is reversed in MarkListHasChanged when nothing is selected) */
if ( pFound->GetLayer() == SC_LAYER_BACK &&
!pViewData->GetViewShell()->IsDrawSelMode() &&
- !pDoc->IsTabProtected( nTab ) &&
+ !rDoc.IsTabProtected( nTab ) &&
!pViewData->GetSfxDocShell()->IsReadOnly() )
{
LockBackgroundLayer(false);
@@ -857,13 +857,13 @@ void ScDrawView::DeleteMarked()
ScDrawObjData* pCaptData = nullptr;
if( SdrObject* pCaptObj = GetMarkedNoteCaption( &pCaptData ) )
{
- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
ScDocShell* pDocShell = pViewData ? pViewData->GetDocShell() : nullptr;
SfxUndoManager* pUndoMgr = pDocShell ? pDocShell->GetUndoManager() : nullptr;
- bool bUndo = pDrawLayer && pDocShell && pUndoMgr && pDoc->IsUndoEnabled();
+ bool bUndo = pDrawLayer && pDocShell && pUndoMgr && rDoc.IsUndoEnabled();
// remove the cell note from document, we are its owner now
- std::unique_ptr<ScPostIt> pNote = pDoc->ReleaseNote( pCaptData->maStart );
+ std::unique_ptr<ScPostIt> pNote = rDoc.ReleaseNote( pCaptData->maStart );
OSL_ENSURE( pNote, "ScDrawView::DeleteMarked - cell note missing in document" );
if( pNote )
{
@@ -951,13 +951,13 @@ void ScDrawView::SyncForGrid( SdrObject* pObj )
ScDrawLayer::GetCellAnchorFromPosition(
aObjRect,
aAnchor,
- *pDoc,
+ rDoc,
GetTab());
aOldStt = aAnchor.maStart;
}
MapMode aDrawMode = pGridWin->GetDrawMapMode();
// find pos anchor position
- Point aOldPos( pDoc->GetColOffset( aOldStt.Col(), aOldStt.Tab() ), pDoc->GetRowOffset( aOldStt.Row(), aOldStt.Tab() ) );
+ Point aOldPos( rDoc.GetColOffset( aOldStt.Col(), aOldStt.Tab() ), rDoc.GetRowOffset( aOldStt.Row(), aOldStt.Tab() ) );
aOldPos.setX( sc::TwipsToHMM( aOldPos.X() ) );
aOldPos.setY( sc::TwipsToHMM( aOldPos.Y() ) );
// find position of same point on the screen ( e.g. grid )
@@ -965,7 +965,7 @@ void ScDrawView::SyncForGrid( SdrObject* pObj )
Point aCurPosHmm = pGridWin->PixelToLogic(aCurPos, aDrawMode );
Point aGridOff = aCurPosHmm - aOldPos;
// fdo#63878 Fix the X position for RTL Sheet
- if( pDoc->IsNegativePage( GetTab() ) )
+ if( rDoc.IsNegativePage( GetTab() ) )
aGridOff.setX( aCurPosHmm.getX() + aOldPos.getX() );
}
@@ -1026,7 +1026,7 @@ bool ScDrawView::calculateGridOffsetForSdrObject(
ScDrawLayer::GetCellAnchorFromPosition(
aObjRect,
aAnchor,
- *pDoc,
+ rDoc,
GetTab());
aOldStt = aAnchor.maStart;
}
@@ -1034,7 +1034,7 @@ bool ScDrawView::calculateGridOffsetForSdrObject(
MapMode aDrawMode = pGridWin->GetDrawMapMode();
// find pos anchor position
- Point aOldPos(pDoc->GetColOffset(aOldStt.Col(), aOldStt.Tab()), pDoc->GetRowOffset(aOldStt.Row(), aOldStt.Tab()));
+ Point aOldPos(rDoc.GetColOffset(aOldStt.Col(), aOldStt.Tab()), rDoc.GetRowOffset(aOldStt.Row(), aOldStt.Tab()));
aOldPos.setX(sc::TwipsToHMM(aOldPos.X()));
aOldPos.setY(sc::TwipsToHMM(aOldPos.Y()));
@@ -1045,7 +1045,7 @@ bool ScDrawView::calculateGridOffsetForSdrObject(
Point aGridOff(aCurPosHmm - aOldPos);
// fdo#63878 Fix the X position for RTL Sheet
- if(pDoc->IsNegativePage(GetTab()))
+ if(rDoc.IsNegativePage(GetTab()))
{
aGridOff.setX(aCurPosHmm.getX() + aOldPos.getX());
}
@@ -1075,14 +1075,14 @@ bool ScDrawView::calculateGridOffsetForB2DRange(
ScDrawLayer::GetCellAnchorFromPosition(
aRectangle,
aAnchor,
- *pDoc,
+ rDoc,
GetTab());
ScAddress aOldStt(aAnchor.maStart);
MapMode aDrawMode = pGridWin->GetDrawMapMode();
// find pos anchor position
- Point aOldPos(pDoc->GetColOffset(aOldStt.Col(), aOldStt.Tab()), pDoc->GetRowOffset(aOldStt.Row(), aOldStt.Tab()));
+ Point aOldPos(rDoc.GetColOffset(aOldStt.Col(), aOldStt.Tab()), rDoc.GetRowOffset(aOldStt.Row(), aOldStt.Tab()));
aOldPos.setX(sc::TwipsToHMM(aOldPos.X()));
aOldPos.setY(sc::TwipsToHMM(aOldPos.Y()));
@@ -1093,7 +1093,7 @@ bool ScDrawView::calculateGridOffsetForB2DRange(
Point aGridOff(aCurPosHmm - aOldPos);
// fdo#63878 Fix the X position for RTL Sheet
- if(pDoc->IsNegativePage(GetTab()))
+ if(rDoc.IsNegativePage(GetTab()))
{
aGridOff.setX(aCurPosHmm.getX() + aOldPos.getX());
}
@@ -1106,7 +1106,7 @@ bool ScDrawView::calculateGridOffsetForB2DRange(
// support enhanced text edit for draw objects
SdrUndoManager* ScDrawView::getSdrUndoManagerForEnhancedTextEdit() const
{
- return pDoc ? dynamic_cast< SdrUndoManager* >(pDoc->GetUndoManager()) : nullptr;
+ return dynamic_cast<SdrUndoManager*>(rDoc.GetUndoManager());
}
// #i123922# helper to apply a Graphic to an existing SdrObject
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index fff2c90738b1..89e47e6e993e 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -433,11 +433,11 @@ void ScEditShell::Execute( SfxRequest& rReq )
{
// if string contains WEAK characters, set all fonts
SvtScriptType nSetScript;
- ScDocument* pDoc = pViewData->GetDocument();
- if ( pDoc->HasStringWeakCharacters( aString ) )
+ ScDocument& rDoc = pViewData->GetDocument();
+ if ( rDoc.HasStringWeakCharacters( aString ) )
nSetScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
else
- nSetScript = pDoc->GetStringScriptType( aString );
+ nSetScript = rDoc.GetStringScriptType( aString );
SfxItemSet aSet( pTableView->GetEmptyItemSet() );
SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, GetPool() );
@@ -534,8 +534,8 @@ void ScEditShell::Execute( SfxRequest& rReq )
OUString aText = pEngine->GetText();
ESelection aSel = pEditView->GetSelection(); // current View
- ScDocument* pDoc = pViewData->GetDocument();
- ScRefFinder aFinder(aText, pViewData->GetCurPos(), *pDoc, pDoc->GetAddressConvention());
+ ScDocument& rDoc = pViewData->GetDocument();
+ ScRefFinder aFinder(aText, pViewData->GetCurPos(), rDoc, rDoc.GetAddressConvention());
aFinder.ToggleRel( aSel.nStartPos, aSel.nEndPos );
if (aFinder.GetFound())
{
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 65828a3258d2..e783194e60ca 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -138,7 +138,7 @@ ScFormatShell::ScFormatShell(ScViewData* pData) :
SetPool( &pTabViewShell->GetPool() );
SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
SetUndoManager( pMgr );
- if ( !pViewData->GetDocument()->IsUndoEnabled() )
+ if ( !pViewData->GetDocument().IsUndoEnabled() )
{
pMgr->SetMaxUndoActionCount( 0 );
}
@@ -151,14 +151,14 @@ ScFormatShell::~ScFormatShell()
void ScFormatShell::GetStyleState( SfxItemSet& rSet )
{
- ScDocument* pDoc = GetViewData()->GetDocument();
+ ScDocument& rDoc = GetViewData()->GetDocument();
ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
- SfxStyleSheetBasePool* pStylePool = pDoc->GetStyleSheetPool();
+ SfxStyleSheetBasePool* pStylePool = rDoc.GetStyleSheetPool();
bool bProtected = false;
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
for (SCTAB i=0; i<nTabCount && !bProtected; i++)
- if (pDoc->IsTabProtected(i)) // look after protected table
+ if (rDoc.IsTabProtected(i)) // look after protected table
bProtected = true;
SfxWhichIter aIter(rSet);
@@ -193,7 +193,7 @@ void ScFormatShell::GetStyleState( SfxItemSet& rSet )
case SID_STYLE_FAMILY4: // page style sheets
{
SCTAB nCurTab = GetViewData()->GetTabNo();
- OUString aPageStyle = pDoc->GetPageStyle( nCurTab );
+ OUString aPageStyle = rDoc.GetPageStyle( nCurTab );
SfxStyleSheet* pStyleSheet = pStylePool ? static_cast<SfxStyleSheet*>(pStylePool->
Find( aPageStyle, SfxStyleFamily::Page )) : nullptr;
@@ -303,7 +303,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
SfxItemSet aItemSet( GetPool() );
- ScPatternAttr aNewAttrs( GetViewData()->GetDocument()->GetPool() );
+ ScPatternAttr aNewAttrs( GetViewData()->GetDocument().GetPool() );
SfxItemSet& rNewSet = aNewAttrs.GetItemSet();
rNewSet.Put( aItemSet, false );
@@ -326,7 +326,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
SfxItemSet aItemSet( GetPool() );
- ScPatternAttr aNewAttrs( GetViewData()->GetDocument()->GetPool() );
+ ScPatternAttr aNewAttrs( GetViewData()->GetDocument().GetPool() );
SfxItemSet& rNewSet = aNewAttrs.GetItemSet();
rNewSet.Put( aItemSet, false );
rDoc.ApplySelectionPattern( aNewAttrs, aPreviewMark );
@@ -1063,8 +1063,8 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
if ( pReqArgs->HasItem( SID_NUMBER_CURRENCY, &pItem ) )
{
sal_uInt32 nNewFormat = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
- ScDocument* pDoc = pViewData->GetDocument();
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+ ScDocument& rDoc = pViewData->GetDocument();
+ SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
const SfxItemSet& rOldSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
LanguageType eOldLang = rOldSet.Get( ATTR_LANGUAGE_FORMAT ).GetLanguage();
@@ -1073,7 +1073,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
if ( nOldFormat != nNewFormat )
{
const SvNumberformat* pNewEntry = pFormatter->GetEntry( nNewFormat );
- ScPatternAttr aNewAttrs( pDoc->GetPool() );
+ ScPatternAttr aNewAttrs( rDoc.GetPool() );
SfxItemSet& rSet = aNewAttrs.GetItemSet();
LanguageType eNewLang = pNewEntry ? pNewEntry->GetLanguage() : LANGUAGE_DONTKNOW;
if ( eNewLang != eOldLang && eNewLang != LANGUAGE_DONTKNOW )
@@ -1117,8 +1117,8 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
break;
case SID_NUMBER_THOUSANDS:
{
- ScDocument* pDoc = pViewData->GetDocument();
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+ ScDocument& rDoc = pViewData->GetDocument();
+ SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
sal_uInt32 nCurrentNumberFormat;
bool bThousand(false);
bool bNegRed(false);
@@ -1126,7 +1126,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
sal_uInt16 nLeadZeroes(0);
LanguageType eLanguage = ScGlobal::eLnge;
- pDoc->GetNumberFormat(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo(), nCurrentNumberFormat);
+ rDoc.GetNumberFormat(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo(), nCurrentNumberFormat);
const SvNumberformat* pEntry = pFormatter->GetEntry(nCurrentNumberFormat);
if (pEntry)
@@ -1152,11 +1152,11 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
if(pReqArgs)
{
const SfxPoolItem* pItem;
- ScDocument* pDoc = pViewData->GetDocument();
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+ ScDocument& rDoc = pViewData->GetDocument();
+ SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
sal_uInt32 nCurrentNumberFormat;
- pDoc->GetNumberFormat(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo(), nCurrentNumberFormat);
+ rDoc.GetNumberFormat(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo(), nCurrentNumberFormat);
const SvNumberformat* pEntry = pFormatter->GetEntry(nCurrentNumberFormat);
if(!pEntry)
@@ -1233,7 +1233,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
// considered.
const SfxItemSet& rOldSet =
pTabViewShell->GetSelectionPattern()->GetItemSet();
- SfxItemPool* pDocPool = GetViewData()->GetDocument()->GetPool();
+ SfxItemPool* pDocPool = GetViewData()->GetDocument().GetPool();
SfxItemSet aNewSet( *pDocPool, svl::Items<ATTR_PATTERN_START, ATTR_PATTERN_END>{} );
aNewSet.Put( *pItem );
pTabViewShell->ApplyAttributes( &aNewSet, &rOldSet );
@@ -1663,7 +1663,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
sal_uInt16 nSlot = rReq.GetSlot();
pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox
- ScDocument* pDoc = GetViewData()->GetDocument();
+ ScDocument& rDoc = GetViewData()->GetDocument();
if ( !pNewAttrs )
{
switch ( nSlot )
@@ -1700,8 +1700,8 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
case SID_ATTR_CHAR_ENDPREVIEW_FONT:
{
- pDoc->SetPreviewFont(nullptr);
- pTabViewShell->UpdateSelectionArea( pDoc->GetPreviewSelection() );
+ rDoc.SetPreviewFont(nullptr);
+ pTabViewShell->UpdateSelectionArea( rDoc.GetPreviewSelection() );
break;
}
case SID_ATTR_CHAR_COLOR:
@@ -1769,8 +1769,8 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
aSetItem.PutItemForScriptType( nScript, rFont );
ScMarkData aFuncMark( pViewData->GetMarkData() );
- ScViewUtil::UnmarkFiltered( aFuncMark, pDoc );
- pDoc->SetPreviewFont( aSetItem.GetItemSet().Clone() );
+ ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc );
+ rDoc.SetPreviewFont( aSetItem.GetItemSet().Clone() );
aFuncMark.MarkToMulti();
if ( !aFuncMark.IsMarked() && !aFuncMark.IsMultiMarked() )
@@ -1781,7 +1781,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
ScRange aRange( nCol, nRow, nTab );
aFuncMark.SetMarkArea( aRange );
}
- pDoc->SetPreviewSelection( aFuncMark );
+ rDoc.SetPreviewSelection( aFuncMark );
pTabViewShell->UpdateSelectionArea( aFuncMark );
break;
}
@@ -1903,12 +1903,12 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
const ScPatternAttr* pOldAttrs = pTabViewShell->GetSelectionPattern();
std::unique_ptr<SfxItemSet> pOldSet(
new SfxItemSet(
- *(pDoc->GetPool()),
+ *rDoc.GetPool(),
svl::Items<ATTR_PATTERN_START,
ATTR_PATTERN_END>{} ));
std::unique_ptr<SfxItemSet> pNewSet(
new SfxItemSet(
- *(pDoc->GetPool()),
+ *rDoc.GetPool(),
svl::Items<ATTR_PATTERN_START,
ATTR_PATTERN_END>{} ));
const SfxPoolItem& rBorderAttr =
@@ -2506,11 +2506,11 @@ void ScFormatShell::GetAlignState( SfxItemSet& rSet )
void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
{
ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
const SfxItemState eItemState = rAttrSet.GetItemState( ATTR_VALUE_FORMAT );
sal_uInt32 nNumberFormat = rAttrSet.Get(ATTR_VALUE_FORMAT).GetValue();
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+ SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
// If item state is default or set it
// indicates one number format so we
// don't have to iterate over all
@@ -2705,7 +2705,7 @@ void ScFormatShell::ExecuteTextDirection( const SfxRequest& rReq )
case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
{
bool bVert = (nSlot == SID_TEXTDIRECTION_TOP_TO_BOTTOM);
- ScPatternAttr aAttr( GetViewData()->GetDocument()->GetPool() );
+ ScPatternAttr aAttr( GetViewData()->GetDocument().GetPool() );
SfxItemSet& rItemSet = aAttr.GetItemSet();
rItemSet.Put( ScVerticalStackCell( bVert ) );
rItemSet.Put( SfxBoolItem( ATTR_VERTICAL_ASIAN, bVert ) );
@@ -2746,7 +2746,7 @@ void ScFormatShell::GetTextDirectionState( SfxItemSet& rSet )
{
SvxFrameDirection eCellDir = rAttrSet.Get( ATTR_WRITINGDIR ).GetValue();
if ( eCellDir == SvxFrameDirection::Environment )
- eBidiDir = GetViewData()->GetDocument()->
+ eBidiDir = GetViewData()->GetDocument().
GetEditTextDirection( GetViewData()->GetTabNo() );
else if ( eCellDir == SvxFrameDirection::Horizontal_RL_TB )
eBidiDir = EEHorizontalTextDirection::R2L;
@@ -2836,9 +2836,9 @@ void ScFormatShell::StateFormatPaintbrush( SfxItemSet& rSet )
SvNumFormatType ScFormatShell::GetCurrentNumberFormatType()
{
SvNumFormatType nType = SvNumFormatType::ALL;
- ScDocument* pDoc = GetViewData()->GetDocument();
+ ScDocument& rDoc = GetViewData()->GetDocument();
ScMarkData aMark(GetViewData()->GetMarkData());
- const SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+ const SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
if (!pFormatter)
return nType;
@@ -2866,7 +2866,7 @@ SvNumFormatType ScFormatShell::GetCurrentNumberFormatType()
{
ScRange aColRange(nCol, nRow1, aRange.aStart.Tab());
aColRange.aEnd.SetRow(nRow2);
- sal_uInt32 nNumFmt = pDoc->GetNumberFormat(aColRange);
+ sal_uInt32 nNumFmt = rDoc.GetNumberFormat(aColRange);
SvNumFormatType nThisType = pFormatter->GetType(nNumFmt);
if (bFirstItem)
{
@@ -2883,7 +2883,7 @@ SvNumFormatType ScFormatShell::GetCurrentNumberFormatType()
else
{
sal_uInt32 nNumFmt;
- pDoc->GetNumberFormat( pViewData->GetCurX(), pViewData->GetCurY(),
+ rDoc.GetNumberFormat( pViewData->GetCurX(), pViewData->GetCurY(),
pViewData->GetTabNo(), nNumFmt );
nType = pFormatter->GetType( nNumFmt );
}
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index ddf50551b635..0144dd264b55 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -348,18 +348,18 @@ void ScFilterFloatingWindow::dispose()
FloatingWindow::dispose();
}
-static bool lcl_IsEditableMatrix( ScDocument* pDoc, const ScRange& rRange )
+static bool lcl_IsEditableMatrix( ScDocument& rDoc, const ScRange& rRange )
{
// If it is an editable range and if there is a Matrix cell at the bottom right with an
// origin top left then the range will be set to contain the exact matrix.
//! Extract the MatrixEdges functions directly from the column ???
- if ( !pDoc->IsBlockEditable( rRange.aStart.Tab(), rRange.aStart.Col(),rRange.aStart.Row(),
+ if ( !rDoc.IsBlockEditable( rRange.aStart.Tab(), rRange.aStart.Col(),rRange.aStart.Row(),
rRange.aEnd.Col(),rRange.aEnd.Row() ) )
return false;
- ScRefCellValue aCell(*pDoc, rRange.aEnd);
+ ScRefCellValue aCell(rDoc, rRange.aEnd);
ScAddress aPos;
- return (aCell.meType == CELLTYPE_FORMULA && aCell.mpFormula->GetMatrixOrigin(pDoc, aPos) && aPos == rRange.aStart);
+ return (aCell.meType == CELLTYPE_FORMULA && aCell.mpFormula->GetMatrixOrigin(&rDoc, aPos) && aPos == rRange.aStart);
}
static void lcl_UnLockComment( ScDrawView* pView, const Point& rPos, const ScViewData* pViewData )
@@ -367,7 +367,7 @@ static void lcl_UnLockComment( ScDrawView* pView, const Point& rPos, const ScVie
if (!pView || !pViewData)
return;
- ScDocument& rDoc = *pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
ScAddress aCellPos( pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo() );
ScPostIt* pNote = rDoc.GetNote( aCellPos );
SdrObject* pObj = pNote ? pNote->GetCaption() : nullptr;
@@ -429,7 +429,7 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos
mpOODragRect(),
mpOOHeader(),
mpOOShrink(),
- maVisibleRange(pData->GetDocument()),
+ maVisibleRange(&pData->GetDocument()),
pViewData( pData ),
eWhich( eWhichPos ),
mpNoteMarker(),
@@ -648,17 +648,17 @@ void collectUIInformation(const OUString& aRow, const OUString& aCol , const OUS
void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow)
{
SCTAB nTab = pViewData->GetTabNo();
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
bool bLOKActive = comphelper::LibreOfficeKit::isActive();
mpAutoFilterPopup.disposeAndClear();
- int nColWidth = ScViewData::ToPixel(pDoc->GetColWidth(nCol, nTab), pViewData->GetPPTX());
- mpAutoFilterPopup.reset(VclPtr<ScCheckListMenuWindow>::Create(this, pDoc, false, nColWidth));
+ int nColWidth = ScViewData::ToPixel(rDoc.GetColWidth(nCol, nTab), pViewData->GetPPTX());
+ mpAutoFilterPopup.reset(VclPtr<ScCheckListMenuWindow>::Create(this, &rDoc, false, nColWidth));
ScCheckListMenuControl& rControl = mpAutoFilterPopup->get_widget();
// Estimate the width (in pixels) of the longest text in the list
ScFilterEntries aFilterEntries;
- pDoc->GetFilterEntries(nCol, nRow, nTab, aFilterEntries);
+ rDoc.GetFilterEntries(nCol, nRow, nTab, aFilterEntries);
int nMaxTextWidth = 0;
if (aFilterEntries.size() <= 10)
{
@@ -718,7 +718,7 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow)
}
tools::Rectangle aCellRect(OutputToScreenPixel(aPos), Size(nSizeX, nSizeY));
- ScDBData* pDBData = pDoc->GetDBAtCursor(nCol, nRow, nTab, ScDBDataPortion::AREA);
+ ScDBData* pDBData = rDoc.GetDBAtCursor(nCol, nRow, nTab, ScDBDataPortion::AREA);
if (!pDBData)
return;
@@ -776,7 +776,7 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow)
ScCheckListMenuControl::Config aConfig;
aConfig.mbAllowEmptySet = false;
- aConfig.mbRTL = pViewData->GetDocument()->IsLayoutRTL(pViewData->GetTabNo());
+ aConfig.mbRTL = pViewData->GetDocument().IsLayoutRTL(pViewData->GetTabNo());
rControl.setConfig(aConfig);
if (IsMouseCaptured())
ReleaseMouse();
@@ -814,8 +814,8 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode)
if (!pDBData)
return;
- ScDocument* pDoc = pViewData->GetDocument();
- svl::SharedStringPool& rPool = pDoc->GetSharedStringPool();
+ ScDocument& rDoc = pViewData->GetDocument();
+ svl::SharedStringPool& rPool = rDoc.GetSharedStringPool();
switch (eMode)
{
case AutoFilterMode::SortAscending:
@@ -961,7 +961,7 @@ void ScGridWindow::LaunchPageFieldMenu( SCCOL nCol, SCROW nRow )
return;
SCTAB nTab = pViewData->GetTabNo();
- ScDPObject* pDPObj = pViewData->GetDocument()->GetDPAtCursor(nCol, nRow, nTab);
+ ScDPObject* pDPObj = pViewData->GetDocument().GetDPAtCursor(nCol, nRow, nTab);
if (!pDPObj)
return;
@@ -974,7 +974,7 @@ void ScGridWindow::LaunchPageFieldMenu( SCCOL nCol, SCROW nRow )
void ScGridWindow::LaunchDPFieldMenu( SCCOL nCol, SCROW nRow )
{
SCTAB nTab = pViewData->GetTabNo();
- ScDPObject* pDPObj = pViewData->GetDocument()->GetDPAtCursor(nCol, nRow, nTab);
+ ScDPObject* pDPObj = pViewData->GetDocument().GetDPAtCursor(nCol, nRow, nTab);
if (!pDPObj)
return;
@@ -1037,7 +1037,7 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange )
{
bool bMenuAtTop = true;
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
mpFilterBox.disposeAndClear();
mpFilterFloat.disposeAndClear();
@@ -1046,18 +1046,18 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange )
if (nRow == 0)
{
nRow = rScenRange.aEnd.Row() + 1; // Range at very the top -> Button below
- if (nRow>pDoc->MaxRow()) nRow = pDoc->MaxRow();
+ if (nRow>rDoc.MaxRow()) nRow = rDoc.MaxRow();
bMenuAtTop = false;
}
SCTAB nTab = pViewData->GetTabNo();
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
long nSizeX = 0;
long nSizeY = 0;
pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
// The button height should not use the merged cell height, should still use single row height
- nSizeY = ScViewData::ToPixel(pDoc->GetRowHeight(nRow, nTab), pViewData->GetPPTY());
+ nSizeY = ScViewData::ToPixel(rDoc.GetRowHeight(nRow, nTab), pViewData->GetPPTY());
Point aPos = pViewData->GetScrPos( nCol, nRow, eWhich );
if ( bLayoutRTL )
aPos.AdjustX( -nSizeX );
@@ -1086,15 +1086,15 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange )
rFilterBox.freeze();
OUString aCurrent;
OUString aTabName;
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
SCTAB nEntryCount = 0;
- for (SCTAB i=nTab+1; i<nTabCount && pDoc->IsScenario(i); i++)
+ for (SCTAB i=nTab+1; i<nTabCount && rDoc.IsScenario(i); i++)
{
- if (pDoc->HasScenarioRange( i, rScenRange ))
- if (pDoc->GetName( i, aTabName ))
+ if (rDoc.HasScenarioRange( i, rScenRange ))
+ if (rDoc.GetName( i, aTabName ))
{
rFilterBox.append_text(aTabName);
- if (pDoc->IsActiveScenario(i))
+ if (rDoc.IsActiveScenario(i))
aCurrent = aTabName;
++nEntryCount;
}
@@ -1127,9 +1127,9 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow )
mpFilterBox.disposeAndClear();
mpFilterFloat.disposeAndClear();
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
long nSizeX = 0;
long nSizeY = 0;
@@ -1175,7 +1175,7 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow )
bool bEmpty = false;
std::vector<ScTypedStrData> aStrings; // case sensitive
// Fill List
- pDoc->GetDataEntries(nCol, nRow, nTab, aStrings);
+ rDoc.GetDataEntries(nCol, nRow, nTab, aStrings);
if (aStrings.empty())
bEmpty = true;
@@ -1203,17 +1203,17 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow )
sal_Int32 nSelPos = -1;
- sal_uLong nIndex = pDoc->GetAttr( nCol, nRow, nTab, ATTR_VALIDDATA )->GetValue();
+ sal_uLong nIndex = rDoc.GetAttr( nCol, nRow, nTab, ATTR_VALIDDATA )->GetValue();
if ( nIndex )
{
- const ScValidationData* pData = pDoc->GetValidationEntry( nIndex );
+ const ScValidationData* pData = rDoc.GetValidationEntry( nIndex );
if (pData)
{
std::unique_ptr<ScTypedStrData> pNew;
- OUString aDocStr = pDoc->GetString(nCol, nRow, nTab);
- if ( pDoc->HasValueData( nCol, nRow, nTab ) )
+ OUString aDocStr = rDoc.GetString(nCol, nRow, nTab);
+ if ( rDoc.HasValueData( nCol, nRow, nTab ) )
{
- double fVal = pDoc->GetValue(ScAddress(nCol, nRow, nTab));
+ double fVal = rDoc.GetValue(ScAddress(nCol, nRow, nTab));
pNew.reset(new ScTypedStrData(aDocStr, fVal, ScTypedStrData::Value));
}
else
@@ -1344,9 +1344,9 @@ bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, bool bAction )
if ( pViewData->IsActive() && !bOleActive )
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
// Auto-Fill
@@ -1382,10 +1382,10 @@ bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, bool bAction )
// Embedded rectangle
- if (pDoc->IsEmbedded())
+ if (rDoc.IsEmbedded())
{
ScRange aRange;
- pDoc->GetEmbedded( aRange );
+ rDoc.GetEmbedded( aRange );
if ( pViewData->GetTabNo() == aRange.aStart.Tab() )
{
Point aStartPos = pViewData->GetScrPos( aRange.aStart.Col(), aRange.aStart.Row(), eWhich );
@@ -1465,13 +1465,13 @@ void ScGridWindow::MouseButtonDown( const MouseEvent& rMEvt )
bool ScGridWindow::IsCellCoveredByText(SCCOL nPosX, SCROW nPosY, SCTAB nTab, SCCOL &rTextStartPosX)
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
// find the first non-empty cell (this, or to the left)
SCCOL nNonEmptyX = nPosX;
for (; nNonEmptyX >= 0; --nNonEmptyX)
{
- ScRefCellValue aCell(*pDoc, ScAddress(nNonEmptyX, nPosY, nTab));
+ ScRefCellValue aCell(rDoc, ScAddress(nNonEmptyX, nPosY, nTab));
if (!aCell.isEmpty())
break;
}
@@ -1485,18 +1485,18 @@ bool ScGridWindow::IsCellCoveredByText(SCCOL nPosX, SCROW nPosY, SCTAB nTab, SCC
// to the left, there is no cell that would contain (potentially
// overrunning) text
- if (nNonEmptyX < 0 || pDoc->HasAttrib(nNonEmptyX, nPosY, nTab, nPosX, nPosY, nTab, HasAttrFlags::Merged | HasAttrFlags::Overlapped))
+ if (nNonEmptyX < 0 || rDoc.HasAttrib(nNonEmptyX, nPosY, nTab, nPosX, nPosY, nTab, HasAttrFlags::Merged | HasAttrFlags::Overlapped))
return false;
double nPPTX = pViewData->GetPPTX();
double nPPTY = pViewData->GetPPTY();
ScTableInfo aTabInfo;
- pDoc->FillInfo(aTabInfo, 0, nPosY, nPosX, nPosY, nTab, nPPTX, nPPTY, false, false);
+ rDoc.FillInfo(aTabInfo, 0, nPosY, nPosX, nPosY, nTab, nPPTX, nPPTY, false, false);
Fraction aZoomX = pViewData->GetZoomX();
Fraction aZoomY = pViewData->GetZoomY();
- ScOutputData aOutputData(this, OUTTYPE_WINDOW, aTabInfo, pDoc, nTab,
+ ScOutputData aOutputData(this, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab,
0, 0, 0, nPosY, nPosX, nPosY, nPPTX, nPPTY,
&aZoomX, &aZoomY);
@@ -1565,7 +1565,7 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta
bool bFormulaMode = pScMod->IsFormulaMode(); // next click -> reference
bool bEditMode = pViewData->HasEditView(eWhich); // also in Mode==SC_INPUT_TYPE
bool bDouble = (rMEvt.GetClicks() == 2);
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
// DeactivateIP does only happen when MarkListHasChanged
@@ -1585,7 +1585,7 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta
SCTAB nTab = pViewData->GetTabNo();
pViewData->GetPosFromPixel(aPos.X(), aPos.Y(), eWhich, nPosX, nPosY);
- ScRefCellValue aCell(*pDoc, ScAddress(nPosX, nPosY, nTab));
+ ScRefCellValue aCell(rDoc, ScAddress(nPosX, nPosY, nTab));
bool bIsEmpty = aCell.isEmpty();
bool bIsCoveredByText = bIsEmpty && IsCellCoveredByText(nPosX, nPosY, nTab, nNonEmptyX);
@@ -1779,8 +1779,8 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta
SCCOL nRealPosX;
SCROW nRealPosY;
pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nRealPosX, nRealPosY, false );//the real row/col
- const ScMergeFlagAttr* pRealPosAttr = pDoc->GetAttr( nRealPosX, nRealPosY, nTab, ATTR_MERGE_FLAG );
- const ScMergeFlagAttr* pAttr = pDoc->GetAttr( nPosX, nPosY, nTab, ATTR_MERGE_FLAG );
+ const ScMergeFlagAttr* pRealPosAttr = rDoc.GetAttr( nRealPosX, nRealPosY, nTab, ATTR_MERGE_FLAG );
+ const ScMergeFlagAttr* pAttr = rDoc.GetAttr( nPosX, nPosY, nTab, ATTR_MERGE_FLAG );
if( pRealPosAttr->HasAutoFilter() )
{
SC_MOD()->InputEnterHandler();
@@ -1893,7 +1893,7 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta
void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
aCurMousePos = rMEvt.GetPosPixel();
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
ScMarkData& rMark = pViewData->GetMarkData();
// #i41690# detect a MouseButtonUp call from within MouseButtonDown
// (possible through Reschedule from storing an OLE object that is deselected)
@@ -2089,7 +2089,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
// Check on undo already done above
- ScStyleSheetPool* pStylePool = pViewData->GetDocument()->
+ ScStyleSheetPool* pStylePool = pViewData->GetDocument().
GetStyleSheetPool();
if ( pStylePool )
{
@@ -2108,8 +2108,8 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
break;
case SfxStyleFamily::Page:
- pViewData->GetDocument()->SetPageStyle( pViewData->GetTabNo(),
- pStyleSheet->GetName() );
+ pViewData->GetDocument().SetPageStyle( pViewData->GetTabNo(),
+ pStyleSheet->GetName() );
ScPrintFunc( pViewData->GetDocShell(),
pViewData->GetViewShell()->GetPrinter(true),
@@ -2150,7 +2150,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
SCROW nPosY;
SCTAB nTab = pViewData->GetTabNo();
pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
- ScDPObject* pDPObj = pDoc->GetDPAtCursor( nPosX, nPosY, nTab );
+ ScDPObject* pDPObj = rDoc.GetDPAtCursor( nPosX, nPosY, nTab );
if ( pDPObj && pDPObj->GetSaveData()->GetDrillDown() )
{
ScAddress aCellPos( nPosX, nPosY, pViewData->GetTabNo() );
@@ -2191,11 +2191,11 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
}
// Check for cell protection attribute.
- ScTableProtection* pProtect = pDoc->GetTabProtection( nTab );
+ ScTableProtection* pProtect = rDoc.GetTabProtection( nTab );
bool bEditAllowed = true;
if ( pProtect && pProtect->isProtected() )
{
- bool bCellProtected = pDoc->HasAttrib(nPosX, nPosY, nTab, nPosX, nPosY, nTab, HasAttrFlags::Protected);
+ bool bCellProtected = rDoc.HasAttrib(nPosX, nPosY, nTab, nPosX, nPosY, nTab, HasAttrFlags::Protected);
bool bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
bool bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
@@ -2213,7 +2213,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
// case we used the double-click to select the empty cell
if (bIsTiledRendering && bDouble)
{
- ScRefCellValue aCell(*pViewData->GetDocument(), ScAddress(nPosX, nPosY, nTab));
+ ScRefCellValue aCell(pViewData->GetDocument(), ScAddress(nPosX, nPosY, nTab));
if (aCell.isEmpty())
return;
}
@@ -2254,7 +2254,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
bool isTiledRendering = comphelper::LibreOfficeKit::isActive();
// ScGlobal::OpenURL() only understands Calc A1 style syntax.
// Convert it to Calc A1 before calling OpenURL().
- if (pDoc->GetAddressConvention() == formula::FormulaGrammar::CONV_OOO)
+ if (rDoc.GetAddressConvention() == formula::FormulaGrammar::CONV_OOO)
{
if (aUrl.startsWith("#")) {
ScGlobal::OpenURL(aUrl, aTarget, isTiledRendering);
@@ -2283,7 +2283,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
ScAddress aTempAddr;
ScAddress::ExternalInfo aExtInfo;
- ScRefFlags nRes = aTempAddr.Parse(aUrl, pDoc, pDoc->GetAddressConvention(), &aExtInfo);
+ ScRefFlags nRes = aTempAddr.Parse(aUrl, &rDoc, rDoc.GetAddressConvention(), &aExtInfo);
if (!(nRes & ScRefFlags::VALID))
{
// Not a reference string. Pass it through unmodified.
@@ -2295,7 +2295,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
if (aExtInfo.mbExternal)
{
// External reference.
- ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
+ ScExternalRefManager* pRefMgr = rDoc.GetExternalRefManager();
const OUString* pStr = pRefMgr->getExternalFileName(aExtInfo.mnFileId);
if (pStr)
aBuf.append(*pStr);
@@ -2311,14 +2311,14 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
// Internal reference.
aBuf.append('#');
- OUString aUrlCalcA1(aTempAddr.Format(ScRefFlags::ADDR_ABS_3D, pDoc, formula::FormulaGrammar::CONV_OOO));
+ OUString aUrlCalcA1(aTempAddr.Format(ScRefFlags::ADDR_ABS_3D, &rDoc, formula::FormulaGrammar::CONV_OOO));
aBuf.append(aUrlCalcA1);
ScGlobal::OpenURL(aBuf.makeStringAndClear(), aTarget, isTiledRendering);
}
}
// fire worksheet_followhyperlink event
- uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents = pDoc->GetVbaEventProcessor();
+ uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents = rDoc.GetVbaEventProcessor();
if( xVbaEvents.is() ) try
{
Point aPos = rMEvt.GetPosPixel();
@@ -2328,7 +2328,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
OUString sURL;
ScRefCellValue aCell;
- if (lcl_GetHyperlinkCell(pDoc, nPosX, nPosY, nTab, aCell, sURL))
+ if (lcl_GetHyperlinkCell(&rDoc, nPosX, nPosY, nTab, aCell, sURL))
{
ScAddress aCellPos( nPosX, nPosY, nTab );
uno::Reference< table::XCell > xCell( new ScCellObj( pViewData->GetDocShell(), aCellPos ) );
@@ -2370,7 +2370,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
ScRange aScRange;
rMark.GetMarkArea( aScRange );
- aAddr = aScRange.Format(*pDoc, ScRefFlags::RANGE_ABS);
+ aAddr = aScRange.Format(rDoc, ScRefFlags::RANGE_ABS);
if ( aScRange.aStart == aScRange.aEnd )
{
// make sure there is a range selection string even for a single cell
@@ -2939,14 +2939,14 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
if ( bMouse )
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
- const ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
bool bSelectAllowed = true;
if ( pProtect && pProtect->isProtected() )
{
// This sheet is protected. Check if a context menu is allowed on this cell.
- bool bCellProtected = pDoc->HasAttrib(nCellX, nCellY, nTab, nCellX, nCellY, nTab, HasAttrFlags::Protected);
+ bool bCellProtected = rDoc.HasAttrib(nCellX, nCellY, nTab, nCellX, nCellY, nTab, HasAttrFlags::Protected);
bool bSelProtected = pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
bool bSelUnprotected = pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
@@ -2963,7 +2963,7 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
{
// Find the first string to the left for spell checking in case the current cell is empty.
ScAddress aPos(nCellX, nCellY, nTab);
- ScRefCellValue aSpellCheckCell(*pDoc, aPos);
+ ScRefCellValue aSpellCheckCell(rDoc, aPos);
while (aSpellCheckCell.meType == CELLTYPE_NONE)
{
// Loop until we get the first non-empty cell in the row.
@@ -2971,7 +2971,7 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
if (aPos.Col() < 0)
break;
- aSpellCheckCell.assign(*pDoc, aPos);
+ aSpellCheckCell.assign(rDoc, aPos);
}
if (aPos.Col() >= 0 && (aSpellCheckCell.meType == CELLTYPE_STRING || aSpellCheckCell.meType == CELLTYPE_EDIT))
@@ -3048,9 +3048,9 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
else if ( !bMouse )
{
// non-edit menu by keyboard -> use lower right of cell cursor position
- ScDocument* aDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTabNo = pViewData->GetTabNo();
- bool bLayoutIsRTL = aDoc->IsLayoutRTL(nTabNo);
+ bool bLayoutIsRTL = rDoc.IsLayoutRTL(nTabNo);
SCCOL nCurX = pViewData->GetCurX();
SCROW nCurY = pViewData->GetCurY();
@@ -3267,11 +3267,11 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt)
}
else if (rKeyCode.GetCode() == KEY_F7)
{
- ScDocument* pDoc = pViewData->GetDocument();
- auto& rMapper = pDoc->GetExternalDataMapper();
+ ScDocument& rDoc = pViewData->GetDocument();
+ auto& rMapper = rDoc.GetExternalDataMapper();
for (auto& itr : rMapper.getDataSources())
{
- itr.refresh(pDoc);
+ itr.refresh(&rDoc);
}
return;
}
@@ -3290,7 +3290,7 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt)
ScRange aRef(
pViewData->GetRefStartX(), pViewData->GetRefStartY(), pViewData->GetRefStartZ(),
pViewData->GetRefEndX(), pViewData->GetRefEndY(), pViewData->GetRefEndZ() );
- SC_MOD()->SetReference( aRef, *pViewData->GetDocument() );
+ SC_MOD()->SetReference( aRef, pViewData->GetDocument() );
}
pViewData->GetViewShell()->SelectionChanged();
return ;
@@ -3423,7 +3423,7 @@ void ScGridWindow::UpdateInputContext()
void ScGridWindow::DropScroll( const Point& rMousePos )
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCCOL nDx = 0;
SCROW nDy = 0;
Size aSize = GetOutputSizePixel();
@@ -3433,7 +3433,7 @@ void ScGridWindow::DropScroll( const Point& rMousePos )
if ( rMousePos.X() < SCROLL_SENSITIVE && pViewData->GetPosX(WhichH(eWhich)) > 0 )
nDx = -1;
if ( rMousePos.X() >= aSize.Width() - SCROLL_SENSITIVE
- && pViewData->GetPosX(WhichH(eWhich)) < pDoc->MaxCol() )
+ && pViewData->GetPosX(WhichH(eWhich)) < rDoc.MaxCol() )
nDx = 1;
}
if (aSize.Height() > SCROLL_SENSITIVE * 3)
@@ -3441,7 +3441,7 @@ void ScGridWindow::DropScroll( const Point& rMousePos )
if ( rMousePos.Y() < SCROLL_SENSITIVE && pViewData->GetPosY(WhichV(eWhich)) > 0 )
nDy = -1;
if ( rMousePos.Y() >= aSize.Height() - SCROLL_SENSITIVE
- && pViewData->GetPosY(WhichV(eWhich)) < pDoc->MaxRow() )
+ && pViewData->GetPosY(WhichV(eWhich)) < rDoc.MaxRow() )
nDy = 1;
}
@@ -3528,11 +3528,11 @@ sal_Int8 ScGridWindow::AcceptPrivateDrop( const AcceptDropEvent& rEvt )
Point aPos = rEvt.maPosPixel;
ScDocument* pSourceDoc = rData.pCellTransfer->GetSourceDocument();
- ScDocument* pThisDoc = pViewData->GetDocument();
- if (pSourceDoc == pThisDoc)
+ ScDocument& rThisDoc = pViewData->GetDocument();
+ if (pSourceDoc == &rThisDoc)
{
OUString aName;
- if ( pThisDoc->HasChartAtPoint(pViewData->GetTabNo(), PixelToLogic(aPos), aName ))
+ if ( rThisDoc.HasChartAtPoint(pViewData->GetTabNo(), PixelToLogic(aPos), aName ))
{
if (bDragRect) // Remove rectangle
{
@@ -3549,7 +3549,7 @@ sal_Int8 ScGridWindow::AcceptPrivateDrop( const AcceptDropEvent& rEvt )
if (rData.pCellTransfer->GetDragSourceFlags() & ScDragSrc::Table) // whole sheet?
{
- bool bOk = pThisDoc->IsDocEditable();
+ bool bOk = rThisDoc.IsDocEditable();
return bOk ? rEvt.mnAction : 0; // don't draw selection frame
}
@@ -3570,19 +3570,19 @@ sal_Int8 ScGridWindow::AcceptPrivateDrop( const AcceptDropEvent& rEvt )
SCCOL nNewDragX = nPosX - rData.pCellTransfer->GetDragHandleX();
if (nNewDragX<0) nNewDragX=0;
- if (nNewDragX+(nSizeX-1) > pThisDoc->MaxCol())
- nNewDragX = pThisDoc->MaxCol()-(nSizeX-1);
+ if (nNewDragX+(nSizeX-1) > rThisDoc.MaxCol())
+ nNewDragX = rThisDoc.MaxCol()-(nSizeX-1);
SCROW nNewDragY = nPosY - rData.pCellTransfer->GetDragHandleY();
if (nNewDragY<0) nNewDragY=0;
- if (nNewDragY+(nSizeY-1) > pThisDoc->MaxRow())
- nNewDragY = pThisDoc->MaxRow()-(nSizeY-1);
+ if (nNewDragY+(nSizeY-1) > rThisDoc.MaxRow())
+ nNewDragY = rThisDoc.MaxRow()-(nSizeY-1);
// don't break scenario ranges, don't drop on filtered
SCTAB nTab = pViewData->GetTabNo();
- ScRange aDropRange = lcl_MakeDropRange( pThisDoc, nNewDragX, nNewDragY, nTab, aSourceRange );
- if ( lcl_TestScenarioRedliningDrop( pThisDoc, aDropRange ) ||
+ ScRange aDropRange = lcl_MakeDropRange( &rThisDoc, nNewDragX, nNewDragY, nTab, aSourceRange );
+ if ( lcl_TestScenarioRedliningDrop( &rThisDoc, aDropRange ) ||
lcl_TestScenarioRedliningDrop( pSourceDoc, aSourceRange ) ||
- ScViewUtil::HasFiltered( aDropRange, pThisDoc) )
+ ScViewUtil::HasFiltered( aDropRange, &rThisDoc) )
{
if (bDragRect)
{
@@ -3597,12 +3597,12 @@ sal_Int8 ScGridWindow::AcceptPrivateDrop( const AcceptDropEvent& rEvt )
// check for datapilot item sorting
ScDPObject* pDPObj = nullptr;
- if ( pThisDoc == pSourceDoc && ( pDPObj = pThisDoc->GetDPAtCursor( nNewDragX, nNewDragY, nTab ) ) != nullptr )
+ if ( &rThisDoc == pSourceDoc && ( pDPObj = rThisDoc.GetDPAtCursor( nNewDragX, nNewDragY, nTab ) ) != nullptr )
{
// drop on DataPilot table: sort or nothing
bool bDPSort = false;
- if ( pThisDoc->GetDPAtCursor( nSourceStartX, nSourceStartY, aSourceRange.aStart.Tab() ) == pDPObj )
+ if ( rThisDoc.GetDPAtCursor( nSourceStartX, nSourceStartY, aSourceRange.aStart.Tab() ) == pDPObj )
{
sheet::DataPilotTableHeaderData aDestData;
pDPObj->GetHeaderPositionData( ScAddress(nNewDragX, nNewDragY, nTab), aDestData );
@@ -3657,7 +3657,7 @@ sal_Int8 ScGridWindow::AcceptPrivateDrop( const AcceptDropEvent& rEvt )
}
else if ( aState.mnState & KEY_MOD2 )
{
- if ( pThisDoc == pSourceDoc && nTab == aSourceRange.aStart.Tab() )
+ if ( &rThisDoc == pSourceDoc && nTab == aSourceRange.aStart.Tab() )
{
long nDeltaX = labs( static_cast< long >( nNewDragX - nSourceStartX ) );
long nDeltaY = labs( static_cast< long >( nNewDragY - nSourceStartY ) );
@@ -3732,14 +3732,14 @@ sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& rEvt )
if ( pViewData->GetDocShell()->IsReadOnly() )
return DND_ACTION_NONE;
- ScDocument* pThisDoc = pViewData->GetDocument();
+ ScDocument& rThisDoc = pViewData->GetDocument();
sal_Int8 nRet = DND_ACTION_NONE;
if (rData.pCellTransfer)
{
ScRange aSource = rData.pCellTransfer->GetRange();
- if ( aSource.aStart.Col() != 0 || aSource.aEnd.Col() != pThisDoc->MaxCol() ||
- aSource.aStart.Row() != 0 || aSource.aEnd.Row() != pThisDoc->MaxRow() )
+ if ( aSource.aStart.Col() != 0 || aSource.aEnd.Col() != rThisDoc.MaxCol() ||
+ aSource.aStart.Row() != 0 || aSource.aEnd.Row() != rThisDoc.MaxRow() )
DropScroll( rEvt.maPosPixel );
nRet = AcceptPrivateDrop( rEvt );
@@ -3761,7 +3761,7 @@ sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& rEvt )
// internal bookmarks (from Navigator)
// local jumps from an unnamed document are possible only within a document
- if ( !rData.pJumpLocalDoc || rData.pJumpLocalDoc == pViewData->GetDocument() )
+ if ( !rData.pJumpLocalDoc || rData.pJumpLocalDoc == &pViewData->GetDocument() )
nRet = rEvt.mnAction;
}
else
@@ -3780,7 +3780,7 @@ sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& rEvt )
if ( rEvt.mbDefault && nMyAction == DND_ACTION_MOVE )
nMyAction = DND_ACTION_COPY;
- SdrObject* pHitObj = pThisDoc->GetObjectAtPoint(
+ SdrObject* pHitObj = rThisDoc.GetObjectAtPoint(
pViewData->GetTabNo(), PixelToLogic(rEvt.maPosPixel) );
if ( pHitObj && nMyAction == DND_ACTION_LINK )
{
@@ -3867,9 +3867,9 @@ sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& rEvt )
SCROW nPosY;
pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
SCTAB nTab = pViewData->GetTabNo();
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
- ScEditableTester aTester( pDoc, nTab, nPosX,nPosY, nPosX,nPosY );
+ ScEditableTester aTester( &rDoc, nTab, nPosX,nPosY, nPosX,nPosY );
if ( !aTester.IsFormatEditable() )
nRet = DND_ACTION_NONE; // forbidden
}
@@ -4022,7 +4022,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos
ScDocument* pSourceDoc = pTransObj->GetSourceDocument();
ScDocShell* pDocSh = pViewData->GetDocShell();
- ScDocument* pThisDoc = pViewData->GetDocument();
+ ScDocument& rThisDoc = pViewData->GetDocument();
ScViewFunc* pView = pViewData->GetView();
SCTAB nThisTab = pViewData->GetTabNo();
ScDragSrc nFlags = pTransObj->GetDragSourceFlags();
@@ -4065,7 +4065,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos
bool bFiltered = (bIsMove && pTransObj->HasFilteredRows());
if (!bFiltered)
{
- if (pSourceDoc != pThisDoc && ((nFlags & ScDragSrc::Table) ||
+ if (pSourceDoc != &rThisDoc && ((nFlags & ScDragSrc::Table) ||
(!bIsLink && meDragInsertMode == INS_NONE)))
{
// Nothing. Either entire sheet to be dropped, or the one case
@@ -4075,16 +4075,16 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos
}
else
// Don't copy or move to filtered destination.
- bFiltered = ScViewUtil::HasFiltered( aDest, pThisDoc);
+ bFiltered = ScViewUtil::HasFiltered( aDest, &rThisDoc);
}
bool bDone = false;
- if (!bFiltered && pSourceDoc == pThisDoc)
+ if (!bFiltered && pSourceDoc == &rThisDoc)
{
if (nFlags & ScDragSrc::Table) // whole sheet?
{
- if ( pThisDoc->IsDocEditable() )
+ if ( rThisDoc.IsDocEditable() )
{
SCTAB nSrcTab = aSource.aStart.Tab();
pViewData->GetDocShell()->MoveTable( nSrcTab, nThisTab, !bIsMove, true ); // with Undo
@@ -4095,9 +4095,9 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos
else // move/copy block
{
OUString aChartName;
- if (pThisDoc->HasChartAtPoint( nThisTab, rLogicPos, aChartName ))
+ if (rThisDoc.HasChartAtPoint( nThisTab, rLogicPos, aChartName ))
{
- OUString aRangeName(aSource.Format(*pThisDoc, ScRefFlags::RANGE_ABS_3D));
+ OUString aRangeName(aSource.Format(rThisDoc, ScRefFlags::RANGE_ABS_3D));
SfxStringItem aNameItem( SID_CHART_NAME, aChartName );
SfxStringItem aRangeItem( SID_CHART_SOURCE, aRangeName );
sal_uInt16 nId = bIsMove ? SID_CHART_SOURCE : SID_CHART_ADDSOURCE;
@@ -4106,7 +4106,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos
{ &aRangeItem, &aNameItem });
bDone = true;
}
- else if ( pThisDoc->GetDPAtCursor( nDestPosX, nDestPosY, nThisTab ) )
+ else if ( rThisDoc.GetDPAtCursor( nDestPosX, nDestPosY, nThisTab ) )
{
// drop on DataPilot table: try to sort, fail if that isn't possible
@@ -4188,12 +4188,12 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos
if ( eCmd == DelCellCmd::CellsUp && nDestPosY > aSource.aEnd.Row() )
{
ScRange aErrorRange( ScAddress::UNINITIALIZED );
- bDone = aDest.Move( 0, -nSizeY, 0, aErrorRange, pThisDoc );
+ bDone = aDest.Move( 0, -nSizeY, 0, aErrorRange, &rThisDoc );
}
else if ( eCmd == DelCellCmd::CellsLeft && nDestPosX > aSource.aEnd.Col() )
{
ScRange aErrorRange( ScAddress::UNINITIALIZED );
- bDone = aDest.Move( -nSizeX, 0, 0, aErrorRange, pThisDoc );
+ bDone = aDest.Move( -nSizeX, 0, 0, aErrorRange, &rThisDoc );
}
pDocSh->UpdateOle( pViewData );
pView->CellContentChanged();
@@ -4234,7 +4234,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos
{
if (nFlags & ScDragSrc::Table) // copy/link sheets between documents
{
- if ( pThisDoc->IsDocEditable() )
+ if ( rThisDoc.IsDocEditable() )
{
ScDocShell* pSrcShell = pTransObj->GetSourceDocShell();
@@ -4451,7 +4451,7 @@ sal_Int8 ScGridWindow::ExecuteDrop( const ExecuteDropEvent& rEvt )
// internal bookmark (from Navigator)
// bookmark clipboard formats are in PasteScDataObject
- if ( !rData.pJumpLocalDoc || rData.pJumpLocalDoc == pViewData->GetDocument() )
+ if ( !rData.pJumpLocalDoc || rData.pJumpLocalDoc == &pViewData->GetDocument() )
{
pViewData->GetViewShell()->InsertBookmark( rData.aJumpText, rData.aJumpTarget,
nPosX, nPosY );
@@ -4459,8 +4459,8 @@ sal_Int8 ScGridWindow::ExecuteDrop( const ExecuteDropEvent& rEvt )
}
}
- ScDocument* pThisDoc = pViewData->GetDocument();
- SdrObject* pHitObj = pThisDoc->GetObjectAtPoint( pViewData->GetTabNo(), PixelToLogic(aPos) );
+ ScDocument& rThisDoc = pViewData->GetDocument();
+ SdrObject* pHitObj = rThisDoc.GetObjectAtPoint( pViewData->GetTabNo(), PixelToLogic(aPos) );
if ( pHitObj && bIsLink )
{
// dropped on drawing object
@@ -4661,7 +4661,7 @@ void ScGridWindow::UpdateFormulas(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2)
if (nX2 < nX1) nX2 = nX1;
if (nY2 < nY1) nY2 = nY1;
- ScDocument& rDoc = *pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
if (nX2 > rDoc.MaxCol()) nX2 = rDoc.MaxCol();
if (nY2 > rDoc.MaxRow()) nY2 = rDoc.MaxRow();
@@ -4831,9 +4831,9 @@ bool ScGridWindow::HitRangeFinder( const Point& rMouse, RfCorner& rCorner,
if ( pRangeFinder && !pRangeFinder->IsHidden() &&
pRangeFinder->GetDocName() == pViewData->GetDocShell()->GetTitle() )
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
long nLayoutSign = bLayoutRTL ? -1 : 1;
SCCOL nPosX;
@@ -5150,22 +5150,22 @@ void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, bool bUp )
}
else
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
long nStartX = nPosX - nRFAddX;
if ( nStartX < 0 ) nStartX = 0;
long nStartY = nPosY - nRFAddY;
if ( nStartY < 0 ) nStartY = 0;
long nEndX = nStartX + aOld.aEnd.Col() - aOld.aStart.Col();
- if ( nEndX > pDoc->MaxCol() )
+ if ( nEndX > rDoc.MaxCol() )
{
- nStartX -= ( nEndX - pDoc->MaxRow() );
- nEndX = pDoc->MaxCol();
+ nStartX -= ( nEndX - rDoc.MaxRow() );
+ nEndX = rDoc.MaxCol();
}
long nEndY = nStartY + aOld.aEnd.Row() - aOld.aStart.Row();
- if ( nEndY > pDoc->MaxRow() )
+ if ( nEndY > rDoc.MaxRow() )
{
- nStartY -= ( nEndY - pDoc->MaxRow() );
- nEndY = pDoc->MaxRow();
+ nStartY -= ( nEndY - rDoc.MaxRow() );
+ nEndY = rDoc.MaxRow();
}
aNew.aStart.SetCol(static_cast<SCCOL>(nStartX));
@@ -5465,12 +5465,12 @@ bool ScGridWindow::IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCROW nRow
bool ScGridWindow::HasScenarioButton( const Point& rPosPixel, ScRange& rScenRange )
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
- SCTAB nTabCount = pDoc->GetTableCount();
- if ( nTab+1<nTabCount && pDoc->IsScenario(nTab+1) && !pDoc->IsScenario(nTab) )
+ SCTAB nTabCount = rDoc.GetTableCount();
+ if ( nTab+1<nTabCount && rDoc.IsScenario(nTab+1) && !rDoc.IsScenario(nTab) )
{
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
Size aButSize = pViewData->GetScenButSize();
long nBWidth = aButSize.Width();
@@ -5481,9 +5481,9 @@ bool ScGridWindow::HasScenarioButton( const Point& rPosPixel, ScRange& rScenRang
//! cache the Ranges in Table!!!!
- ScMarkData aMarks(pDoc->GetSheetLimits());
- for (SCTAB i=nTab+1; i<nTabCount && pDoc->IsScenario(i); i++)
- pDoc->MarkScenario( i, nTab, aMarks, false, ScScenarioFlags::ShowFrame );
+ ScMarkData aMarks(rDoc.GetSheetLimits());
+ for (SCTAB i=nTab+1; i<nTabCount && rDoc.IsScenario(i); i++)
+ rDoc.MarkScenario( i, nTab, aMarks, false, ScScenarioFlags::ShowFrame );
ScRangeList aRanges;
aMarks.FillRangeListWithMarks( &aRanges, false );
@@ -5493,7 +5493,7 @@ bool ScGridWindow::HasScenarioButton( const Point& rPosPixel, ScRange& rScenRang
ScRange aRange = aRanges[j];
// Always extend scenario frame to merged cells where no new non-covered cells
// are framed
- pDoc->ExtendTotalMerge( aRange );
+ rDoc.ExtendTotalMerge( aRange );
bool bTextBelow = ( aRange.aStart.Row() == 0 );
@@ -5562,16 +5562,16 @@ bool ScGridWindow::ContinueOnlineSpelling()
if (!mpSpellCheckCxt->maPos.isValid())
return false;
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
ScDPCollection* pDPs = nullptr;
- if (pDoc->HasPivotTable())
- pDPs = pDoc->GetDPCollection();
+ if (rDoc.HasPivotTable())
+ pDPs = rDoc.GetDPCollection();
SCTAB nTab = pViewData->GetTabNo();
SpellCheckStatus aStatus;
ScHorizontalCellIterator aIter(
- pDoc, nTab, maVisibleRange.mnCol1, mpSpellCheckCxt->maPos.mnRow, maVisibleRange.mnCol2, maVisibleRange.mnRow2);
+ &rDoc, nTab, maVisibleRange.mnCol1, mpSpellCheckCxt->maPos.mnRow, maVisibleRange.mnCol2, maVisibleRange.mnRow2);
ScRangeList aPivotRanges = pDPs ? pDPs->GetAllTableRanges(nTab) : ScRangeList();
@@ -5579,27 +5579,27 @@ bool ScGridWindow::ContinueOnlineSpelling()
SCROW nRow;
ScRefCellValue* pCell = aIter.GetNext(nCol, nRow);
SCROW nEndRow = 0;
- bool bHidden = pCell && pDoc->RowHidden(nRow, nTab, nullptr, &nEndRow);
+ bool bHidden = pCell && rDoc.RowHidden(nRow, nTab, nullptr, &nEndRow);
bool bSkip = pCell && (nRow < mpSpellCheckCxt->maPos.mnRow || bHidden);
while (bSkip)
{
pCell = aIter.GetNext(nCol, nRow);
if (pCell && nRow > nEndRow)
{
- bHidden = pDoc->RowHidden(nRow, nTab, nullptr, &nEndRow);
+ bHidden = rDoc.RowHidden(nRow, nTab, nullptr, &nEndRow);
}
bSkip = pCell && (nRow < mpSpellCheckCxt->maPos.mnRow || bHidden);
}
SCCOL nEndCol = 0;
- bHidden = pCell && pDoc->ColHidden(nCol, nTab, nullptr, &nEndCol);
+ bHidden = pCell && rDoc.ColHidden(nCol, nTab, nullptr, &nEndCol);
bSkip = pCell && (nCol < mpSpellCheckCxt->maPos.mnCol || bHidden);
while (bSkip)
{
pCell = aIter.GetNext(nCol, nRow);
if (pCell && nCol > nEndCol)
{
- bHidden = pDoc->ColHidden(nCol, nTab, nullptr, &nEndCol);
+ bHidden = rDoc.ColHidden(nCol, nTab, nullptr, &nEndCol);
}
bSkip = pCell && (nCol < mpSpellCheckCxt->maPos.mnCol || bHidden);
}
@@ -5632,7 +5632,7 @@ bool ScGridWindow::ContinueOnlineSpelling()
// NB: For spell-checking, we currently only use the primary
// language; not CJK nor CTL.
- const ScPatternAttr* pPattern = pDoc->GetPattern(nCol, nRow, nTab);
+ const ScPatternAttr* pPattern = rDoc.GetPattern(nCol, nRow, nTab);
LanguageType nCellLang = pPattern->GetItem(ATTR_FONT_LANGUAGE).GetValue();
if (nCellLang == LANGUAGE_SYSTEM)
@@ -5649,7 +5649,7 @@ bool ScGridWindow::ContinueOnlineSpelling()
{
// ScTabEditEngine is needed
// because MapMode must be set for some old documents
- pEngine.reset(new ScTabEditEngine(pDoc));
+ pEngine.reset(new ScTabEditEngine(&rDoc));
pEngine->SetControlWord(
pEngine->GetControlWord() | (EEControlBits::ONLINESPELLING | EEControlBits::ALLOWBIGOBJS));
pEngine->SetStatusEventHdl(LINK(&aStatus, SpellCheckStatus, EventHdl));
@@ -5684,7 +5684,7 @@ bool ScGridWindow::ContinueOnlineSpelling()
// Broadcast for re-paint.
ScPaintHint aHint(ScRange(nCol, nRow, nTab), PaintPartFlags::Grid);
aHint.SetPrintFlag(false);
- pDoc->GetDocumentShell()->Broadcast(aHint);
+ rDoc.GetDocumentShell()->Broadcast(aHint);
}
bSpellCheckPerformed = true;
@@ -6166,7 +6166,7 @@ void updateLibreOfficeKitAutoFill(const ScViewData* pViewData, tools::Rectangle
void ScGridWindow::UpdateCursorOverlay()
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
MapMode aDrawMode = GetDrawMapMode();
MapMode aOldMode = GetMapMode();
@@ -6186,7 +6186,7 @@ void ScGridWindow::UpdateCursorOverlay()
SCCOL nX = pViewData->GetCurX();
SCROW nY = pViewData->GetCurY();
- const ScPatternAttr* pPattern = pDoc->GetPattern(nX,nY,nTab);
+ const ScPatternAttr* pPattern = rDoc.GetPattern(nX,nY,nTab);
if (!comphelper::LibreOfficeKit::isActive() && !maVisibleRange.isInside(nX, nY))
{
@@ -6227,7 +6227,7 @@ void ScGridWindow::UpdateCursorOverlay()
if ( bVis && !bOverlapped && !pViewData->HasEditView(eWhich) && pViewData->IsActive() )
{
Point aScrPos = pViewData->GetScrPos( nX, nY, eWhich, true );
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
// completely right of/below the screen?
// (test with logical start position in aScrPos)
@@ -6375,9 +6375,9 @@ void ScGridWindow::UpdateSelectionOverlay()
{
std::vector< basegfx::B2DRange > aRanges;
const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
for(const tools::Rectangle & rRA : aRects)
{
@@ -6460,8 +6460,8 @@ void ScGridWindow::UpdateAutoFillOverlay()
}
SCTAB nTab = pViewData->GetTabNo();
- ScDocument* pDoc = pViewData->GetDocument();
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ ScDocument& rDoc = pViewData->GetDocument();
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
float fScaleFactor = GetDPIScaleFactor();
// Size should be even
@@ -6558,26 +6558,26 @@ void ScGridWindow::UpdateDragRectOverlay()
long nSizeXPix=0;
long nSizeYPix=0;
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
double nPPTX = pViewData->GetPPTX();
double nPPTY = pViewData->GetPPTY();
SCCOLROW i;
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
long nLayoutSign = bLayoutRTL ? -1 : 1;
- if (pDoc->ValidCol(nX2) && nX2>=nX1)
+ if (rDoc.ValidCol(nX2) && nX2>=nX1)
for (i=nX1; i<=nX2; i++)
- nSizeXPix += ScViewData::ToPixel( pDoc->GetColWidth( static_cast<SCCOL>(i), nTab ), nPPTX );
+ nSizeXPix += ScViewData::ToPixel( rDoc.GetColWidth( static_cast<SCCOL>(i), nTab ), nPPTX );
else
{
aScrPos.AdjustX( -nLayoutSign );
nSizeXPix += 2;
}
- if (pDoc->ValidRow(nY2) && nY2>=nY1)
+ if (rDoc.ValidRow(nY2) && nY2>=nY1)
for (i=nY1; i<=nY2; i++)
- nSizeYPix += ScViewData::ToPixel( pDoc->GetRowHeight( i, nTab ), nPPTY );
+ nSizeYPix += ScViewData::ToPixel( rDoc.GetRowHeight( i, nTab ), nPPTY );
else
{
aScrPos.AdjustY( -1 );
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index 2bf3eab908f6..636559a2e132 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -53,9 +53,9 @@ using std::vector;
DataPilotFieldOrientation ScGridWindow::GetDPFieldOrientation( SCCOL nCol, SCROW nRow ) const
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
- ScDPObject* pDPObj = pDoc->GetDPAtCursor(nCol, nRow, nTab);
+ ScDPObject* pDPObj = rDoc.GetDPAtCursor(nCol, nRow, nTab);
if (!pDPObj)
return DataPilotFieldOrientation_HIDDEN;
@@ -103,24 +103,24 @@ bool ScGridWindow::DoPageFieldSelection( SCCOL nCol, SCROW nRow )
bool ScGridWindow::DoAutoFilterButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt )
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
Point aScrPos = pViewData->GetScrPos(nCol, nRow, eWhich);
Point aDiffPix = rMEvt.GetPosPixel();
aDiffPix -= aScrPos;
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
if ( bLayoutRTL )
aDiffPix.setX( -aDiffPix.X() );
long nSizeX, nSizeY;
pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
// The button height should not use the merged cell height, should still use single row height
- nSizeY = ScViewData::ToPixel(pDoc->GetRowHeight(nRow, nTab), pViewData->GetPPTY());
+ nSizeY = ScViewData::ToPixel(rDoc.GetRowHeight(nRow, nTab), pViewData->GetPPTY());
Size aScrSize(nSizeX-1, nSizeY-1);
// Check if the mouse cursor is clicking on the popup arrow box.
- mpFilterButton.reset(new ScDPFieldButton(this, &GetSettings().GetStyleSettings(), &pViewData->GetZoomY(), pDoc));
+ mpFilterButton.reset(new ScDPFieldButton(this, &GetSettings().GetStyleSettings(), &pViewData->GetZoomY(), &rDoc));
mpFilterButton->setBoundingBox(aScrPos, aScrSize, bLayoutRTL);
mpFilterButton->setPopupLeft(bLayoutRTL); // #i114944# AutoFilter button is left-aligned in RTL
Point aPopupPos;
@@ -147,10 +147,10 @@ bool ScGridWindow::DoAutoFilterButton( SCCOL nCol, SCROW nRow, const MouseEvent&
void ScGridWindow::DoPushPivotButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt, bool bButton, bool bPopup )
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
- ScDPObject* pDPObj = pDoc->GetDPAtCursor(nCol, nRow, nTab);
+ ScDPObject* pDPObj = rDoc.GetDPAtCursor(nCol, nRow, nTab);
if (pDPObj)
{
@@ -206,7 +206,7 @@ void ScGridWindow::DoPushPivotButton( SCCOL nCol, SCROW nRow, const MouseEvent&
pViewData->GetViewShell()->GetFrameWeld(), aArgSet, nSrcTab));
if ( pDlg->Execute() == RET_OK )
{
- ScSheetSourceDesc aNewDesc(pDoc);
+ ScSheetSourceDesc aNewDesc(&rDoc);
if (pDesc)
aNewDesc = *pDesc;
@@ -342,7 +342,7 @@ void ScGridWindow::DPTestMouse( const MouseEvent& rMEvt, bool bMove )
bool ScGridWindow::DPTestFieldPopupArrow(
const MouseEvent& rMEvt, const ScAddress& rPos, const ScAddress& rDimPos, ScDPObject* pDPObj)
{
- bool bLayoutRTL = pViewData->GetDocument()->IsLayoutRTL( pViewData->GetTabNo() );
+ bool bLayoutRTL = pViewData->GetDocument().IsLayoutRTL( pViewData->GetTabNo() );
// Get the geometry of the cell.
Point aScrPos = pViewData->GetScrPos(rPos.Col(), rPos.Row(), eWhich);
@@ -467,7 +467,7 @@ void ScGridWindow::DPLaunchFieldPopupMenu(const Point& rScrPos, const Size& rScr
const ScDPLabelData& rLabelData = pDPData->maLabels;
mpDPFieldPopup.disposeAndClear();
- mpDPFieldPopup.reset(VclPtr<ScCheckListMenuWindow>::Create(this, pViewData->GetDocument(), bDimOrientNotPage));
+ mpDPFieldPopup.reset(VclPtr<ScCheckListMenuWindow>::Create(this, &pViewData->GetDocument(), bDimOrientNotPage));
ScCheckListMenuControl& rControl = mpDPFieldPopup->get_widget();
rControl.setExtendedData(std::move(pDPData));
@@ -532,7 +532,7 @@ void ScGridWindow::DPLaunchFieldPopupMenu(const Point& rScrPos, const Size& rScr
ScCheckListMenuControl::Config aConfig;
aConfig.mbAllowEmptySet = false;
- aConfig.mbRTL = pViewData->GetDocument()->IsLayoutRTL(pViewData->GetTabNo());
+ aConfig.mbRTL = pViewData->GetDocument().IsLayoutRTL(pViewData->GetTabNo());
rControl.setConfig(aConfig);
if (IsMouseCaptured())
ReleaseMouse();
@@ -610,7 +610,7 @@ T lcl_getValidValue(T value, T defvalue)
bool ScGridWindow::UpdateVisibleRange()
{
- ScDocument const& rDoc = *pViewData->GetDocument();
+ ScDocument const& rDoc = pViewData->GetDocument();
SCCOL nPosX = 0;
SCROW nPosY = 0;
SCCOL nXRight = rDoc.MaxCol();
diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx
index 7c80764221a5..a68f525ff3c7 100644
--- a/sc/source/ui/view/gridwin3.cxx
+++ b/sc/source/ui/view/gridwin3.cxx
@@ -245,7 +245,7 @@ void ScGridWindow::DrawSdrGrid( const tools::Rectangle& rDrawingRect, OutputDevi
MapMode ScGridWindow::GetDrawMapMode( bool bForce )
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
// FIXME this shouldn't be necessary once we change the entire Calc to
// work in the logic coordinates (ideally 100ths of mm - so that it is
@@ -257,7 +257,7 @@ MapMode ScGridWindow::GetDrawMapMode( bool bForce )
}
SCTAB nTab = pViewData->GetTabNo();
- bool bNegativePage = pDoc->IsNegativePage( nTab );
+ bool bNegativePage = rDoc.IsNegativePage( nTab );
MapMode aDrawMode = pViewData->GetLogicMode();
@@ -272,10 +272,10 @@ MapMode ScGridWindow::GetDrawMapMode( bool bForce )
{
SCCOL nEndCol = 0;
SCROW nEndRow = 0;
- pDoc->GetTableArea( nTab, nEndCol, nEndRow );
+ rDoc.GetTableArea( nTab, nEndCol, nEndRow );
if (nEndCol<20) nEndCol = 20;
if (nEndRow<20) nEndRow = 1000;
- ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, this,
+ ScDrawUtil::CalcScale( &rDoc, nTab, 0,0, nEndCol,nEndRow, this,
pViewData->GetZoomX(),pViewData->GetZoomY(),
pViewData->GetPPTX(),pViewData->GetPPTY(),
aScaleX,aScaleY );
@@ -316,7 +316,7 @@ void ScGridWindow::CreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddres
const ScViewOptions& rOpts = pViewData->GetOptions();
if(rOpts.GetOption( VOPT_ANCHOR ))
{
- bool bNegativePage = pViewData->GetDocument()->IsNegativePage( pViewData->GetTabNo() );
+ bool bNegativePage = pViewData->GetDocument().IsNegativePage( pViewData->GetTabNo() );
Point aPos = pViewData->GetScrPos( rAddress.Col(), rAddress.Row(), eWhich, true );
aPos = PixelToLogic(aPos);
rHdl.AddHdl(std::make_unique<SdrHdl>(aPos, bNegativePage ? SdrHdlKind::Anchor_TR : SdrHdlKind::Anchor));
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index b937499555c5..3e2368bf3067 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -88,7 +88,7 @@ static void lcl_LimitRect( tools::Rectangle& rRect, const tools::Rectangle& rVis
static void lcl_DrawOneFrame( vcl::RenderContext* pDev, const tools::Rectangle& rInnerPixel,
const OUString& rTitle, const Color& rColor, bool bTextBelow,
double nPPTX, double nPPTY, const Fraction& rZoomY,
- ScDocument* pDoc, ScViewData* pButtonViewData, bool bLayoutRTL )
+ ScDocument& rDoc, ScViewData* pButtonViewData, bool bLayoutRTL )
{
// pButtonViewData is only used to set the button size,
// can otherwise be NULL!
@@ -113,7 +113,7 @@ static void lcl_DrawOneFrame( vcl::RenderContext* pDev, const tools::Rectangle&
// use ScPatternAttr::GetFont only for font size
vcl::Font aAttrFont;
- pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN).
+ rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN).
GetFont(aAttrFont,SC_AUTOCOL_BLACK,pDev,&rZoomY);
// everything else from application font
@@ -187,29 +187,29 @@ static void lcl_DrawOneFrame( vcl::RenderContext* pDev, const tools::Rectangle&
static void lcl_DrawScenarioFrames( OutputDevice* pDev, ScViewData* pViewData, ScSplitPos eWhich,
SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 )
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
- SCTAB nTabCount = pDoc->GetTableCount();
- if ( nTab+1 >= nTabCount || !pDoc->IsScenario(nTab+1) || pDoc->IsScenario(nTab) )
+ SCTAB nTabCount = rDoc.GetTableCount();
+ if ( nTab+1 >= nTabCount || !rDoc.IsScenario(nTab+1) || rDoc.IsScenario(nTab) )
return;
if ( nX1 > 0 ) --nX1;
if ( nY1>=2 ) nY1 -= 2; // Hack: Header row affects two cells
else if ( nY1 > 0 ) --nY1;
- if ( nX2 < pDoc->MaxCol() ) ++nX2;
- if ( nY2 < pDoc->MaxRow()-1 ) nY2 += 2; // Hack: Header row affects two cells
- else if ( nY2 < pDoc->MaxRow() ) ++nY2;
+ if ( nX2 < rDoc.MaxCol() ) ++nX2;
+ if ( nY2 < rDoc.MaxRow()-1 ) nY2 += 2; // Hack: Header row affects two cells
+ else if ( nY2 < rDoc.MaxRow() ) ++nY2;
ScRange aViewRange( nX1,nY1,nTab, nX2,nY2,nTab );
//! cache the ranges in table!!!!
- ScMarkData aMarks(pDoc->GetSheetLimits());
- for (SCTAB i=nTab+1; i<nTabCount && pDoc->IsScenario(i); i++)
- pDoc->MarkScenario( i, nTab, aMarks, false, ScScenarioFlags::ShowFrame );
+ ScMarkData aMarks(rDoc.GetSheetLimits());
+ for (SCTAB i=nTab+1; i<nTabCount && rDoc.IsScenario(i); i++)
+ rDoc.MarkScenario( i, nTab, aMarks, false, ScScenarioFlags::ShowFrame );
ScRangeListRef xRanges = new ScRangeList;
aMarks.FillRangeListWithMarks( xRanges.get(), false );
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
long nLayoutSign = bLayoutRTL ? -1 : 1;
for (size_t j = 0, n = xRanges->size(); j < n; ++j)
@@ -217,7 +217,7 @@ static void lcl_DrawScenarioFrames( OutputDevice* pDev, ScViewData* pViewData, S
ScRange aRange = (*xRanges)[j];
// Always extend scenario frame to merged cells where no new non-covered cells
// are framed
- pDoc->ExtendTotalMerge( aRange );
+ rDoc.ExtendTotalMerge( aRange );
//! -> Extend repaint when merging !!!
@@ -237,13 +237,13 @@ static void lcl_DrawScenarioFrames( OutputDevice* pDev, ScViewData* pViewData, S
OUString aCurrent;
Color aColor( COL_LIGHTGRAY );
- for (SCTAB nAct=nTab+1; nAct<nTabCount && pDoc->IsScenario(nAct); nAct++)
- if ( pDoc->IsActiveScenario(nAct) && pDoc->HasScenarioRange(nAct,aRange) )
+ for (SCTAB nAct=nTab+1; nAct<nTabCount && rDoc.IsScenario(nAct); nAct++)
+ if ( rDoc.IsActiveScenario(nAct) && rDoc.HasScenarioRange(nAct,aRange) )
{
OUString aDummyComment;
ScScenarioFlags nDummyFlags;
- pDoc->GetName( nAct, aCurrent );
- pDoc->GetScenarioData( nAct, aDummyComment, aColor, nDummyFlags );
+ rDoc.GetName( nAct, aCurrent );
+ rDoc.GetScenarioData( nAct, aDummyComment, aColor, nDummyFlags );
}
if (aCurrent.isEmpty())
@@ -254,7 +254,7 @@ static void lcl_DrawScenarioFrames( OutputDevice* pDev, ScViewData* pViewData, S
lcl_DrawOneFrame( pDev, tools::Rectangle( aStartPos, aEndPos ),
aCurrent, aColor, bTextBelow,
pViewData->GetPPTX(), pViewData->GetPPTY(), pViewData->GetZoomY(),
- pDoc, pViewData, bLayoutRTL );
+ rDoc, pViewData, bLayoutRTL );
}
}
}
@@ -361,8 +361,8 @@ void ScGridWindow::InvalidateLOKViewCursor(const tools::Rectangle& rCursorRect,
void ScGridWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& rRect )
{
- ScDocument* pDoc = pViewData->GetDocument();
- if ( pDoc->IsInInterpreter() )
+ ScDocument& rDoc = pViewData->GetDocument();
+ if ( rDoc.IsInInterpreter() )
{
// Via Reschedule, interpreted cells do not trigger Invalidate again,
// otherwise for instance an error box would never appear (bug 36381).
@@ -400,7 +400,7 @@ void ScGridWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const tools::R
double nPPTY = pViewData->GetPPTY();
tools::Rectangle aMirroredPixel = aPixRect;
- if ( pDoc->IsLayoutRTL( nTab ) )
+ if ( rDoc.IsLayoutRTL( nTab ) )
{
// mirror and swap
long nWidth = GetSizePixel().Width();
@@ -408,26 +408,26 @@ void ScGridWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const tools::R
aMirroredPixel.SetRight( nWidth - 1 - aPixRect.Left() );
}
- long nScrX = ScViewData::ToPixel( pDoc->GetColWidth( nX1, nTab ), nPPTX );
- while ( nScrX <= aMirroredPixel.Left() && nX1 < pDoc->MaxCol() )
+ long nScrX = ScViewData::ToPixel( rDoc.GetColWidth( nX1, nTab ), nPPTX );
+ while ( nScrX <= aMirroredPixel.Left() && nX1 < rDoc.MaxCol() )
{
++nX1;
- nScrX += ScViewData::ToPixel( pDoc->GetColWidth( nX1, nTab ), nPPTX );
+ nScrX += ScViewData::ToPixel( rDoc.GetColWidth( nX1, nTab ), nPPTX );
}
SCCOL nX2 = nX1;
- while ( nScrX <= aMirroredPixel.Right() && nX2 < pDoc->MaxCol() )
+ while ( nScrX <= aMirroredPixel.Right() && nX2 < rDoc.MaxCol() )
{
++nX2;
- nScrX += ScViewData::ToPixel( pDoc->GetColWidth( nX2, nTab ), nPPTX );
+ nScrX += ScViewData::ToPixel( rDoc.GetColWidth( nX2, nTab ), nPPTX );
}
long nScrY = 0;
- ScViewData::AddPixelsWhile( nScrY, aPixRect.Top(), nY1, pDoc->MaxRow(), nPPTY, pDoc, nTab);
+ ScViewData::AddPixelsWhile( nScrY, aPixRect.Top(), nY1, rDoc.MaxRow(), nPPTY, &rDoc, nTab);
SCROW nY2 = nY1;
- if (nScrY <= aPixRect.Bottom() && nY2 < pDoc->MaxRow())
+ if (nScrY <= aPixRect.Bottom() && nY2 < rDoc.MaxRow())
{
++nY2;
- ScViewData::AddPixelsWhile( nScrY, aPixRect.Bottom(), nY2, pDoc->MaxRow(), nPPTY, pDoc, nTab);
+ ScViewData::AddPixelsWhile( nScrY, aPixRect.Bottom(), nY2, rDoc.MaxRow(), nPPTY, &rDoc, nTab);
}
Draw( nX1,nY1,nX2,nY2, ScUpdateMode::Marks ); // don't continue with painting
@@ -437,7 +437,7 @@ void ScGridWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const tools::R
void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode )
{
- ScDocument& rDoc = *pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
// let's ignore the normal Draw() attempts when doing the tiled rendering,
// all the rendering should go through PaintTile() in that case.
@@ -606,7 +606,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
bool bLogicText)
{
ScModule* pScMod = SC_MOD();
- ScDocument& rDoc = *pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
const ScViewOptions& rOpts = pViewData->GetOptions();
bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
bool bNoBackgroundAndGrid = bIsTiledRendering
@@ -1284,7 +1284,7 @@ namespace
{
public:
ScLOKDrawView(OutputDevice* pOut, ScViewData& rData) :
- FmFormView(*rData.GetDocument()->GetDrawLayer(), pOut),
+ FmFormView(*rData.GetDocument().GetDrawLayer(), pOut),
pScDrawView(rData.GetScDrawView())
{
}
@@ -1354,7 +1354,7 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
const double fTileRightPixel = static_cast<double>(nTilePosX + nTileWidth) * nOutputWidth / nTileWidth;
SCTAB nTab = pViewData->GetTabNo();
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
const double fPPTX = pViewData->GetPPTX();
const double fPPTY = pViewData->GetPPTY();
@@ -1384,8 +1384,8 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
nBottomRightTileCol++;
nBottomRightTileRow++;
- if (nBottomRightTileCol > pDoc->MaxCol())
- nBottomRightTileCol = pDoc->MaxCol();
+ if (nBottomRightTileCol > rDoc.MaxCol())
+ nBottomRightTileCol = rDoc.MaxCol();
if (nBottomRightTileRow > MAXTILEDROW)
nBottomRightTileRow = MAXTILEDROW;
@@ -1393,7 +1393,7 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
// size of the document including drawings, charts, etc.
SCCOL nEndCol = 0;
SCROW nEndRow = 0;
- pDoc->GetTiledRenderingArea(nTab, nEndCol, nEndRow);
+ rDoc.GetTiledRenderingArea(nTab, nEndCol, nEndRow);
if (nEndCol < nBottomRightTileCol)
nEndCol = nBottomRightTileCol;
@@ -1417,14 +1417,14 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
rDevice.SetMapMode(aAbsMode);
ScTableInfo aTabInfo(nEndRow + 3);
- pDoc->FillInfo(aTabInfo, nTopLeftTileCol, nTopLeftTileRow,
+ rDoc.FillInfo(aTabInfo, nTopLeftTileCol, nTopLeftTileRow,
nBottomRightTileCol, nBottomRightTileRow,
nTab, fPPTX, fPPTY, false, false);
// FIXME: is this called some
// Point aScrPos = pViewData->GetScrPos( nX1, nY1, eWhich );
- ScOutputData aOutputData(&rDevice, OUTTYPE_WINDOW, aTabInfo, pDoc, nTab,
+ ScOutputData aOutputData(&rDevice, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab,
-nTopLeftTileColOffset,
-nTopLeftTileRowOffset,
nTopLeftTileCol, nTopLeftTileRow,
@@ -1432,7 +1432,7 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
fPPTX, fPPTY, nullptr, nullptr);
// setup the SdrPage so that drawinglayer works correctly
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
if (pModel)
{
bool bPrintTwipsMsgs = comphelper::LibreOfficeKit::isCompatFlagSet(
@@ -1454,8 +1454,8 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
rDevice.SetMapMode(aOriginalMode);
// Flag drawn formula cells "unchanged".
- pDoc->ResetChanged(ScRange(nTopLeftTileCol, nTopLeftTileRow, nTab, nBottomRightTileCol, nBottomRightTileRow, nTab));
- pDoc->PrepareFormulaCalc();
+ rDoc.ResetChanged(ScRange(nTopLeftTileCol, nTopLeftTileRow, nTab, nBottomRightTileCol, nBottomRightTileRow, nTab));
+ rDoc.PrepareFormulaCalc();
pViewData->SetZoom(origZoomX, origZoomY, true);
if (bChangeZoom)
@@ -1584,7 +1584,7 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
if (!pPageData)
return;
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
Size aWinSize = GetOutputSizePixel();
const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
@@ -1595,14 +1595,14 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
if ( nPageScript == SvtScriptType::NONE )
{
// get script type of translated "Page" string only once
- nPageScript = pDoc->GetStringScriptType( aPageStr );
+ nPageScript = rDoc.GetStringScriptType( aPageStr );
if (nPageScript == SvtScriptType::NONE)
nPageScript = ScGlobal::GetDefaultScriptType();
}
vcl::Font aFont;
std::unique_ptr<ScEditEngineDefaulter> pEditEng;
- const ScPatternAttr& rDefPattern = pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN);
+ const ScPatternAttr& rDefPattern = rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN);
if ( nPageScript == SvtScriptType::LATIN )
{
// use single font and call DrawText directly
@@ -1670,7 +1670,7 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
if ( nBreak >= nX1 && nBreak <= nX2+1 )
{
//! Search for hidden
- if (pDoc->HasColBreak(nBreak, nTab) & ScBreakType::Manual)
+ if (rDoc.HasColBreak(nBreak, nTab) & ScBreakType::Manual)
rRenderContext.SetFillColor( aManual );
else
rRenderContext.SetFillColor( aAutomatic );
@@ -1689,7 +1689,7 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
if ( nBreak >= nY1 && nBreak <= nY2+1 )
{
//! Search for hidden
- if (pDoc->HasRowBreak(nBreak, nTab) & ScBreakType::Manual)
+ if (rDoc.HasRowBreak(nBreak, nTab) & ScBreakType::Manual)
rRenderContext.SetFillColor( aManual );
else
rRenderContext.SetFillColor( aAutomatic );
@@ -1783,8 +1783,8 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo
{
aComboButton.SetOutputDevice( pContentDev );
- ScDocument* pDoc = pViewData->GetDocument();
- ScDPFieldButton aCellBtn(pContentDev, &GetSettings().GetStyleSettings(), &pViewData->GetZoomY(), pDoc);
+ ScDocument& rDoc = pViewData->GetDocument();
+ ScDPFieldButton aCellBtn(pContentDev, &GetSettings().GetStyleSettings(), &pViewData->GetZoomY(), &rDoc);
SCCOL nCol;
SCROW nRow;
@@ -1797,7 +1797,7 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo
RowInfo* pRowInfo = rTabInfo.mpRowInfo.get();
sal_uInt16 nArrCount = rTabInfo.mnArrCount;
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
Point aOldPos = aComboButton.GetPosPixel(); // store state for MouseDown/Up
Size aOldSize = aComboButton.GetSizePixel();
@@ -1835,7 +1835,7 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo
}
if (bNewData)
{
- pDBData = pDoc->GetDBAtCursor( nCol, nRow, nTab, ScDBDataPortion::AREA );
+ pDBData = rDoc.GetDBAtCursor( nCol, nRow, nTab, ScDBDataPortion::AREA );
if (pDBData)
pDBData->GetQueryParam( *pQueryParam );
else
@@ -1871,9 +1871,9 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo
SCROW nStartRow = nRow;
//if address(nCol,nRow) is not the start pos of the merge area, the value of the nSizeX will be incorrect, it will be the length of the cell.
//should first get the start pos of the merge area, then get the nSizeX through the start pos.
- pDoc->ExtendOverlapped(nStartCol, nStartRow,nCol, nRow, nTab);//get nStartCol,nStartRow
+ rDoc.ExtendOverlapped(nStartCol, nStartRow,nCol, nRow, nTab);//get nStartCol,nStartRow
pViewData->GetMergeSizePixel( nStartCol, nStartRow, nSizeX, nSizeY );//get nSizeX
- nSizeY = ScViewData::ToPixel(pDoc->GetRowHeight(nRow, nTab), pViewData->GetPPTY());
+ nSizeY = ScViewData::ToPixel(rDoc.GetRowHeight(nRow, nTab), pViewData->GetPPTY());
Point aScrPos = pViewData->GetScrPos( nCol, nRow, eWhich );
aCellBtn.setBoundingBox(aScrPos, Size(nSizeX-1, nSizeY-1), bLayoutRTL);
@@ -1904,7 +1904,7 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo
long nPosY = aScrPos.Y();
// bLayoutRTL is handled in setBoundingBox
- OUString aStr = pDoc->GetString(nCol, nRow, nTab);
+ OUString aStr = rDoc.GetString(nCol, nRow, nTab);
aCellBtn.setText(aStr);
aCellBtn.setBoundingBox(Point(nPosX, nPosY), Size(nSizeX-1, nSizeY-1), bLayoutRTL);
aCellBtn.setPopupLeft(false); // DataPilot popup is always right-aligned for now
@@ -1934,9 +1934,9 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo
tools::Rectangle ScGridWindow::GetListValButtonRect( const ScAddress& rButtonPos )
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
long nLayoutSign = bLayoutRTL ? -1 : 1;
ScDDComboBoxButton aButton( this ); // for optimal size
@@ -1950,19 +1950,19 @@ tools::Rectangle ScGridWindow::GetListValButtonRect( const ScAddress& rButtonPos
pViewData->GetMergeSizePixel( nCol, nRow, nCellSizeX, nDummy );
// for height, only the cell's row is used, excluding merged cells
- long nCellSizeY = ScViewData::ToPixel( pDoc->GetRowHeight( nRow, nTab ), pViewData->GetPPTY() );
+ long nCellSizeY = ScViewData::ToPixel( rDoc.GetRowHeight( nRow, nTab ), pViewData->GetPPTY() );
long nAvailable = nCellSizeX;
// left edge of next cell if there is a non-hidden next column
SCCOL nNextCol = nCol + 1;
- const ScMergeAttr* pMerge = pDoc->GetAttr( nCol,nRow,nTab, ATTR_MERGE );
+ const ScMergeAttr* pMerge = rDoc.GetAttr( nCol,nRow,nTab, ATTR_MERGE );
if ( pMerge->GetColMerge() > 1 )
nNextCol = nCol + pMerge->GetColMerge(); // next cell after the merged area
- while ( nNextCol <= pDoc->MaxCol() && pDoc->ColHidden(nNextCol, nTab) )
+ while ( nNextCol <= rDoc.MaxCol() && rDoc.ColHidden(nNextCol, nTab) )
++nNextCol;
- bool bNextCell = ( nNextCol <= pDoc->MaxCol() );
+ bool bNextCell = ( nNextCol <= rDoc.MaxCol() );
if ( bNextCell )
- nAvailable = ScViewData::ToPixel( pDoc->GetColWidth( nNextCol, nTab ), pViewData->GetPPTX() );
+ nAvailable = ScViewData::ToPixel( rDoc.GetColWidth( nNextCol, nTab ), pViewData->GetPPTX() );
if ( nAvailable < aBtnSize.Width() )
aBtnSize.setWidth( nAvailable );
@@ -1984,8 +1984,8 @@ tools::Rectangle ScGridWindow::GetListValButtonRect( const ScAddress& rButtonPos
bool ScGridWindow::IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab )
{
- ScDocument* pDoc = pViewData->GetDocument();
- ScDBData* pDBData = pDoc->GetDBAtCursor( nCol, nRow, nTab, ScDBDataPortion::AREA );
+ ScDocument& rDoc = pViewData->GetDocument();
+ ScDBData* pDBData = rDoc.GetDBAtCursor( nCol, nRow, nTab, ScDBDataPortion::AREA );
ScQueryParam aQueryParam;
if ( pDBData )
@@ -2043,10 +2043,10 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData,
ScMarkData aMultiMark( rMarkData );
aMultiMark.SetMarking( false );
aMultiMark.MarkToMulti();
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
long nLayoutSign = bLayoutRTL ? -1 : 1;
if ( !aMultiMark.IsMultiMarked() )
return;
@@ -2063,7 +2063,7 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData,
SCCOL nTestX2 = nX2;
SCROW nTestY2 = nY2;
- pDoc->ExtendMerge( nX1,nY1, nTestX2,nTestY2, nTab );
+ rDoc.ExtendMerge( nX1,nY1, nTestX2,nTestY2, nTab );
SCCOL nPosX = pViewData->GetPosX( eHWhich );
SCROW nPosY = pViewData->GetPosY( eVWhich );
@@ -2080,12 +2080,12 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData,
{
// limit the selection to only what is visible on the screen
SCCOL nXRight = nPosX + pViewData->VisibleCellsX(eHWhich);
- if (nXRight > pDoc->MaxCol())
- nXRight = pDoc->MaxCol();
+ if (nXRight > rDoc.MaxCol())
+ nXRight = rDoc.MaxCol();
SCROW nYBottom = nPosY + pViewData->VisibleCellsY(eVWhich);
- if (nYBottom > pDoc->MaxRow())
- nYBottom = pDoc->MaxRow();
+ if (nYBottom > rDoc.MaxRow())
+ nYBottom = rDoc.MaxRow();
// is the selection visible at all?
if (nX1 > nXRight || nY1 > nYBottom)
@@ -2100,7 +2100,7 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData,
{
SCCOL nMaxTiledCol;
SCROW nMaxTiledRow;
- pDoc->GetTiledRenderingArea(nTab, nMaxTiledCol, nMaxTiledRow);
+ rDoc.GetTiledRenderingArea(nTab, nMaxTiledCol, nMaxTiledRow);
if (nX2 > nMaxTiledCol)
nX2 = nMaxTiledCol;
@@ -2121,7 +2121,7 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData,
{
bool bFirstRow = ( nY == nPosY ); // first visible row?
bool bDoHidden = false; // repeat hidden ?
- sal_uInt16 nHeightTwips = pDoc->GetRowHeight( nY,nTab );
+ sal_uInt16 nHeightTwips = rDoc.GetRowHeight( nY,nTab );
bool bDoRow = ( nHeightTwips != 0 );
if (bDoRow)
{
@@ -2146,7 +2146,7 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData,
if (nX2 < nX1) // the rest of the merge
{
SCCOL nStartX = nX1;
- while ( pDoc->GetAttr(nStartX,nY,nTab,ATTR_MERGE_FLAG)->IsHorOverlapped() )
+ while ( rDoc.GetAttr(nStartX,nY,nTab,ATTR_MERGE_FLAG)->IsHorOverlapped() )
--nStartX;
if (nStartX <= nX2)
nLoopEndX = nX1;
@@ -2158,7 +2158,7 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData,
long nScrX = aScrPos.X();
for (SCCOL nX=nX1; nX<=nLoopEndX; nX++)
{
- long nWidth = pDoc->GetColWidth(nX, nTab);
+ long nWidth = rDoc.GetColWidth(nX, nTab);
if (!bInPrintTwips)
nWidth = ScViewData::ToPixel(nWidth, nPPTX);
@@ -2167,15 +2167,15 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData,
long nEndX = nScrX + ( nWidth - 1 ) * nLayoutSign;
SCROW nThisY = nY;
- const ScPatternAttr* pPattern = pDoc->GetPattern( nX, nY, nTab );
+ const ScPatternAttr* pPattern = rDoc.GetPattern( nX, nY, nTab );
const ScMergeFlagAttr* pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG);
if ( pMergeFlag->IsVerOverlapped() && ( bDoHidden || bFirstRow ) )
{
while ( pMergeFlag->IsVerOverlapped() && nThisY > 0 &&
- (pDoc->RowHidden(nThisY-1, nTab) || bFirstRow) )
+ (rDoc.RowHidden(nThisY-1, nTab) || bFirstRow) )
{
--nThisY;
- pPattern = pDoc->GetPattern( nX, nThisY, nTab );
+ pPattern = rDoc.GetPattern( nX, nThisY, nTab );
pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG);
}
}
@@ -2187,7 +2187,7 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData,
while ( pMergeFlag->IsHorOverlapped() )
{
--nThisX;
- pPattern = pDoc->GetPattern( nThisX, nThisY, nTab );
+ pPattern = rDoc.GetPattern( nThisX, nThisY, nTab );
pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG);
}
}
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index 0d54b07471a4..f9f20670a991 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -48,7 +48,7 @@ bool ScGridWindow::ShowNoteMarker( SCCOL nPosX, SCROW nPosY, bool bKeyboard )
{
bool bDone = false;
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
ScAddress aCellPos( nPosX, nPosY, nTab );
@@ -57,8 +57,8 @@ bool ScGridWindow::ShowNoteMarker( SCCOL nPosX, SCROW nPosY, bool bKeyboard )
// change tracking
- ScChangeTrack* pTrack = pDoc->GetChangeTrack();
- ScChangeViewSettings* pSettings = pDoc->GetChangeViewSettings();
+ ScChangeTrack* pTrack = rDoc.GetChangeTrack();
+ ScChangeViewSettings* pSettings = rDoc.GetChangeViewSettings();
if ( pTrack && pTrack->GetFirst() && pSettings && pSettings->ShowChanges())
{
const ScChangeAction* pFound = nullptr;
@@ -68,7 +68,7 @@ bool ScGridWindow::ShowNoteMarker( SCCOL nPosX, SCROW nPosY, bool bKeyboard )
while (pAction)
{
if ( pAction->IsVisible() &&
- ScViewUtil::IsActionShown( *pAction, *pSettings, *pDoc ) )
+ ScViewUtil::IsActionShown( *pAction, *pSettings, rDoc ) )
{
ScChangeActionType eType = pAction->GetType();
const ScBigRange& rBig = pAction->GetBigRange();
@@ -139,7 +139,7 @@ bool ScGridWindow::ShowNoteMarker( SCCOL nPosX, SCROW nPosY, bool bKeyboard )
aTrackText += aComStr + "\n( ";
}
OUString aTmp;
- pFound->GetDescription(aTmp, pDoc);
+ pFound->GetDescription(aTmp, &rDoc);
aTrackText += aTmp;
if(!aComStr.isEmpty())
{
@@ -149,7 +149,7 @@ bool ScGridWindow::ShowNoteMarker( SCCOL nPosX, SCROW nPosY, bool bKeyboard )
}
// Note, only if it is not already displayed on the Drawing Layer:
- const ScPostIt* pNote = pDoc->GetNote( aCellPos );
+ const ScPostIt* pNote = rDoc.GetNote( aCellPos );
if ( (!aTrackText.isEmpty()) || (pNote && !pNote->IsCaptionShown()) )
{
bool bNew = true;
@@ -193,7 +193,7 @@ bool ScGridWindow::ShowNoteMarker( SCCOL nPosX, SCROW nPosY, bool bKeyboard )
aMapMode.SetOrigin( aOrigin );
mpNoteMarker.reset(new ScNoteMarker(pLeft, pRight, pBottom, pDiagonal,
- pDoc, aCellPos, aTrackText,
+ &rDoc, aCellPos, aTrackText,
aMapMode, bLeftEdge, bFast, bKeyboard));
}
@@ -311,12 +311,12 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
aHelpText = SfxHelp::GetURLHelpText(
INetURLObject::decode(aUrl, INetURLObject::DecodeMechanism::Unambiguous));
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCCOL nPosX;
SCROW nPosY;
SCTAB nTab = pViewData->GetTabNo();
pViewData->GetPosFromPixel( aPosPixel.X(), aPosPixel.Y(), eWhich, nPosX, nPosY );
- const ScPatternAttr* pPattern = pDoc->GetPattern( nPosX, nPosY, nTab );
+ const ScPatternAttr* pPattern = rDoc.GetPattern( nPosX, nPosY, nTab );
// bForceToTop = sal_False, use the cell's real position
aPixRect = pViewData->GetEditArea( eWhich, nPosX, nPosY, this, pPattern, false );
@@ -360,7 +360,7 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
bool ScGridWindow::IsMyModel(const SdrEditView* pSdrView)
{
return pSdrView &&
- pSdrView->GetModel() == pViewData->GetDocument()->GetDrawLayer();
+ pSdrView->GetModel() == pViewData->GetDocument().GetDrawLayer();
}
void ScGridWindow::HideNoteMarker()
diff --git a/sc/source/ui/view/gridwin_dbgutil.cxx b/sc/source/ui/view/gridwin_dbgutil.cxx
index 1b2e2eb12023..22a6198bc29f 100644
--- a/sc/source/ui/view/gridwin_dbgutil.cxx
+++ b/sc/source/ui/view/gridwin_dbgutil.cxx
@@ -41,11 +41,11 @@ void dumpScDrawObjData(const ScGridWindow& rWindow, const ScDrawObjData& rData,
void ScGridWindow::dumpColumnInformationPixel()
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
for (SCCOL nCol = 0; nCol <= 20; ++nCol)
{
- sal_uInt16 nWidth = pDoc->GetColWidth(nCol, nTab);
+ sal_uInt16 nWidth = rDoc.GetColWidth(nCol, nTab);
long nPixel = LogicToPixel(Point(nWidth, 0), MapMode(MapUnit::MapTwip)).getX();
std::cout << "Column: " << nCol << ", Width: " << nPixel << "px" << std::endl;
}
@@ -53,11 +53,11 @@ void ScGridWindow::dumpColumnInformationPixel()
void ScGridWindow::dumpColumnInformationHmm()
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
for (SCCOL nCol = 0; nCol <= 20; ++nCol)
{
- sal_uInt16 nWidth = pDoc->GetColWidth(nCol, nTab);
+ sal_uInt16 nWidth = rDoc.GetColWidth(nCol, nTab);
long nPixel = LogicToLogic(Point(nWidth, 0), MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM)).getX();
std::cout << "Column: " << nCol << ", Width: " << nPixel << "hmm" << std::endl;
}
@@ -65,7 +65,7 @@ void ScGridWindow::dumpColumnInformationHmm()
void ScGridWindow::dumpCellProperties()
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
const ScMarkData& rMark = pViewData->GetMarkData();
SCTAB nTab = pViewData->GetTabNo();
@@ -105,7 +105,7 @@ void ScGridWindow::dumpCellProperties()
{
for (SCROW nRow = rRange.aStart.Row(); nRow <= rRange.aEnd.Row(); ++nRow)
{
- const ScPatternAttr* pPatternAttr = pDoc->GetPattern(nCol, nRow, nTab);
+ const ScPatternAttr* pPatternAttr = rDoc.GetPattern(nCol, nRow, nTab);
xmlTextWriterStartElement(writer, BAD_CAST("cell"));
xmlTextWriterWriteAttribute(writer, BAD_CAST("column"), BAD_CAST(OString::number(nCol).getStr()));
xmlTextWriterWriteAttribute(writer, BAD_CAST("row"), BAD_CAST(OString::number(nRow).getStr()));
@@ -126,8 +126,8 @@ void ScGridWindow::dumpCellProperties()
void ScGridWindow::dumpGraphicInformation()
{
- ScDocument* pDoc = pViewData->GetDocument();
- ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ ScDocument& rDoc = pViewData->GetDocument();
+ ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
if (!pDrawLayer)
return;
@@ -156,8 +156,8 @@ void ScGridWindow::dumpColumnCellStorage()
// Get the current cursor position.
ScAddress aCurPos = pViewData->GetCurPos();
- ScDocument* pDoc = pViewData->GetDocument();
- const ScDPObject* pDP = pDoc->GetDPAtCursor(aCurPos.Col(), aCurPos.Row(), aCurPos.Tab());
+ ScDocument& rDoc = pViewData->GetDocument();
+ const ScDPObject* pDP = rDoc.GetDPAtCursor(aCurPos.Col(), aCurPos.Row(), aCurPos.Tab());
if (pDP)
{
// Dump the pivot table info if the cursor is over a pivot table.
@@ -167,7 +167,7 @@ void ScGridWindow::dumpColumnCellStorage()
}
// Dump the column cell storage info.
- pDoc->DumpColumnStorage(aCurPos.Tab(), aCurPos.Col());
+ rDoc.DumpColumnStorage(aCurPos.Tab(), aCurPos.Col());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx
index 6ef5f6e98104..85c9e1323eaa 100644
--- a/sc/source/ui/view/hdrcont.cxx
+++ b/sc/source/ui/view/hdrcont.cxx
@@ -569,8 +569,8 @@ bool ScHeaderControl::IsSelectionAllowed(SCCOLROW nPos) const
ScViewData& rViewData = pViewSh->GetViewData();
sal_uInt16 nTab = rViewData.GetTabNo();
- ScDocument* pDoc = rViewData.GetDocument();
- const ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ ScDocument& rDoc = rViewData.GetDocument();
+ const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
bool bSelectAllowed = true;
if ( pProtect && pProtect->isProtected() )
{
@@ -580,13 +580,13 @@ bool ScHeaderControl::IsSelectionAllowed(SCCOLROW nPos) const
{
// row header
SCROW nRPos = static_cast<SCROW>(nPos);
- bCellsProtected = pDoc->HasAttrib(0, nRPos, nTab, pDoc->MaxCol(), nRPos, nTab, HasAttrFlags::Protected);
+ bCellsProtected = rDoc.HasAttrib(0, nRPos, nTab, rDoc.MaxCol(), nRPos, nTab, HasAttrFlags::Protected);
}
else
{
// column header
SCCOL nCPos = static_cast<SCCOL>(nPos);
- bCellsProtected = pDoc->HasAttrib(nCPos, 0, nTab, nCPos, pDoc->MaxRow(), nTab, HasAttrFlags::Protected);
+ bCellsProtected = rDoc.HasAttrib(nCPos, 0, nTab, nCPos, rDoc.MaxRow(), nTab, HasAttrFlags::Protected);
}
bool bSelProtected = pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
@@ -622,16 +622,16 @@ void ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt )
if( !rMEvt.IsShift() )
pTabView->DoneRefMode( rMEvt.IsMod1() );
ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
- ScDocument* pDoc = pViewSh->GetViewData().GetDocument();
+ ScDocument& rDoc = pViewSh->GetViewData().GetDocument();
if( !bVertical )
{
pTabView->InitRefMode( nHitNo, 0, nTab, SC_REFTYPE_REF );
- pTabView->UpdateRef( nHitNo, pDoc->MaxRow(), nTab );
+ pTabView->UpdateRef( nHitNo, rDoc.MaxRow(), nTab );
}
else
{
pTabView->InitRefMode( 0, nHitNo, nTab, SC_REFTYPE_REF );
- pTabView->UpdateRef( pDoc->MaxCol(), nHitNo, nTab );
+ pTabView->UpdateRef( rDoc.MaxCol(), nHitNo, nTab );
}
bInRefMode = true;
return;
@@ -772,11 +772,11 @@ void ScHeaderControl::MouseMove( const MouseEvent& rMEvt )
SCCOLROW nHitNo = GetMousePos( rMEvt, bTmp );
SCTAB nTab = pTabView->GetViewData().GetTabNo();
ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
- ScDocument* pDoc = pViewSh->GetViewData().GetDocument();
+ ScDocument& rDoc = pViewSh->GetViewData().GetDocument();
if( !bVertical )
- pTabView->UpdateRef( nHitNo, pDoc->MaxRow(), nTab );
+ pTabView->UpdateRef( nHitNo, rDoc.MaxRow(), nTab );
else
- pTabView->UpdateRef( pDoc->MaxCol(), nHitNo, nTab );
+ pTabView->UpdateRef( rDoc.MaxCol(), nHitNo, nTab );
return;
}
@@ -852,14 +852,14 @@ void ScHeaderControl::Command( const CommandEvent& rCEvt )
return;
SCTAB nTab = rViewData.GetTabNo();
- ScDocument* pDoc = pViewSh->GetViewData().GetDocument();
+ ScDocument& rDoc = pViewSh->GetViewData().GetDocument();
ScRange aNewRange;
if ( bVertical )
aNewRange = ScRange( 0, sal::static_int_cast<SCROW>(nPos), nTab,
- pDoc->MaxCol(), sal::static_int_cast<SCROW>(nPos), nTab );
+ rDoc.MaxCol(), sal::static_int_cast<SCROW>(nPos), nTab );
else
aNewRange = ScRange( sal::static_int_cast<SCCOL>(nPos), 0, nTab,
- sal::static_int_cast<SCCOL>(nPos), pDoc->MaxRow(), nTab );
+ sal::static_int_cast<SCCOL>(nPos), rDoc.MaxRow(), nTab );
// see if any part of the range is already selected
ScRangeList aRanges;
diff --git a/sc/source/ui/view/pgbrksh.cxx b/sc/source/ui/view/pgbrksh.cxx
index 5e56feee127a..def2d41fd71d 100644
--- a/sc/source/ui/view/pgbrksh.cxx
+++ b/sc/source/ui/view/pgbrksh.cxx
@@ -42,7 +42,7 @@ ScPageBreakShell::ScPageBreakShell( ScTabViewShell* pViewSh ) :
ScViewData& rViewData = pViewSh->GetViewData();
SfxUndoManager* pMgr = rViewData.GetSfxDocShell()->GetUndoManager();
SetUndoManager( pMgr );
- if ( !rViewData.GetDocument()->IsUndoEnabled() )
+ if ( !rViewData.GetDocument().IsUndoEnabled() )
{
pMgr->SetMaxUndoActionCount( 0 );
}
diff --git a/sc/source/ui/view/pivotsh.cxx b/sc/source/ui/view/pivotsh.cxx
index 34f2ffc60c50..654ad6f279f8 100644
--- a/sc/source/ui/view/pivotsh.cxx
+++ b/sc/source/ui/view/pivotsh.cxx
@@ -54,7 +54,7 @@ ScPivotShell::ScPivotShell( ScTabViewShell* pViewSh ) :
ScViewData& rViewData = pViewSh->GetViewData();
SfxUndoManager* pMgr = rViewData.GetSfxDocShell()->GetUndoManager();
SetUndoManager( pMgr );
- if ( !rViewData.GetDocument()->IsUndoEnabled() )
+ if ( !rViewData.GetDocument().IsUndoEnabled() )
{
pMgr->SetMaxUndoActionCount( 0 );
}
@@ -105,7 +105,7 @@ void ScPivotShell::Execute( const SfxRequest& rReq )
if( pDlg->Execute() == RET_OK )
{
- ScSheetSourceDesc aNewDesc(rViewData.GetDocument());
+ ScSheetSourceDesc aNewDesc(&rViewData.GetDocument());
if( pDesc )
aNewDesc = *pDesc;
@@ -161,7 +161,7 @@ void ScPivotShell::GetState( SfxItemSet& rSet )
ScDPObject* ScPivotShell::GetCurrDPObject()
{
const ScViewData& rViewData = pViewShell->GetViewData();
- return rViewData.GetDocument()->GetDPAtCursor(
+ return rViewData.GetDocument().GetDPAtCursor(
rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo() );
}
diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx
index 3aa42c29a77f..464c550909d3 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -342,16 +342,16 @@ void ScViewFunctionSet::SetCursorAtPoint( const Point& rPointPixel, bool /* bDon
{
bool bLeft, bTop;
pViewData->GetMouseQuadrant( aEffPos, GetWhich(), nPosX, nPosY, bLeft, bTop );
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
SCTAB nTab = pViewData->GetTabNo();
if ( bLeft && !bRightScroll )
- do --nPosX; while ( nPosX>=0 && pDoc->ColHidden( nPosX, nTab ) );
+ do --nPosX; while ( nPosX>=0 && rDoc.ColHidden( nPosX, nTab ) );
if ( bTop && !bBottomScroll )
{
if (--nPosY >= 0)
{
- nPosY = pDoc->LastVisibleRow(0, nPosY, nTab);
- if (!pDoc->ValidRow(nPosY))
+ nPosY = rDoc.LastVisibleRow(0, nPosY, nTab);
+ if (!rDoc.ValidRow(nPosY))
nPosY = -1;
}
}
@@ -418,14 +418,14 @@ bool ScViewFunctionSet::SetCursorAtCell( SCCOL nPosX, SCROW nPosY, bool bScroll
{
ScTabView* pView = pViewData->GetView();
SCTAB nTab = pViewData->GetTabNo();
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
- if ( pDoc->IsTabProtected(nTab) )
+ if ( rDoc.IsTabProtected(nTab) )
{
if (nPosX < 0 || nPosY < 0)
return false;
- ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
if (!pProtect)
return false;
@@ -435,7 +435,7 @@ bool ScViewFunctionSet::SetCursorAtCell( SCCOL nPosX, SCROW nPosY, bool bScroll
if ( bSkipProtected && bSkipUnprotected )
return false;
- bool bCellProtected = pDoc->HasAttrib(nPosX, nPosY, nTab, nPosX, nPosY, nTab, HasAttrFlags::Protected);
+ bool bCellProtected = rDoc.HasAttrib(nPosX, nPosY, nTab, nPosX, nPosY, nTab, HasAttrFlags::Protected);
if ( (bCellProtected && bSkipProtected) || (!bCellProtected && bSkipUnprotected) )
// Don't select this cell!
return false;
@@ -504,8 +504,8 @@ bool ScViewFunctionSet::SetCursorAtCell( SCCOL nPosX, SCROW nPosY, bool bScroll
long nSizeX = 0;
for (SCCOL i=nPosX+1; i<=nEndX; i++)
- nSizeX += pDoc->GetColWidth( i, nTab );
- long nSizeY = static_cast<long>(pDoc->GetRowHeight( nPosY+1, nEndY, nTab ));
+ nSizeX += rDoc.GetColWidth( i, nTab );
+ long nSizeY = static_cast<long>(rDoc.GetRowHeight( nPosY+1, nEndY, nTab ));
SCCOL nDelStartX = nStartX;
SCROW nDelStartY = nStartY;
@@ -555,13 +555,13 @@ bool ScViewFunctionSet::SetCursorAtCell( SCCOL nPosX, SCROW nPosY, bool bScroll
{
// in SetCursorAtPoint hidden columns are skipped.
// They must be skipped here too, or the result will always be the first hidden column.
- do ++nPosX; while ( nPosX<nStartX && pDoc->ColHidden(nPosX, nTab) );
+ do ++nPosX; while ( nPosX<nStartX && rDoc.ColHidden(nPosX, nTab) );
for (SCCOL i=nPosX; i<nStartX; i++)
- nSizeX += pDoc->GetColWidth( i, nTab );
+ nSizeX += rDoc.GetColWidth( i, nTab );
}
else
for (SCCOL i=nEndX+1; i<=nPosX; i++)
- nSizeX += pDoc->GetColWidth( i, nTab );
+ nSizeX += rDoc.GetColWidth( i, nTab );
long nSizeY = 0;
if ( bNegY )
@@ -570,14 +570,14 @@ bool ScViewFunctionSet::SetCursorAtCell( SCCOL nPosX, SCROW nPosY, bool bScroll
// They must be skipped here too, or the result will always be the first hidden row.
if (++nPosY < nStartY)
{
- nPosY = pDoc->FirstVisibleRow(nPosY, nStartY-1, nTab);
- if (!pDoc->ValidRow(nPosY))
+ nPosY = rDoc.FirstVisibleRow(nPosY, nStartY-1, nTab);
+ if (!rDoc.ValidRow(nPosY))
nPosY = nStartY;
}
- nSizeY += pDoc->GetRowHeight( nPosY, nStartY-1, nTab );
+ nSizeY += rDoc.GetRowHeight( nPosY, nStartY-1, nTab );
}
else
- nSizeY += pDoc->GetRowHeight( nEndY+1, nPosY, nTab );
+ nSizeY += rDoc.GetRowHeight( nEndY+1, nPosY, nTab );
if ( nSizeX > nSizeY ) // Fill only ever in one direction
{
@@ -606,9 +606,9 @@ bool ScViewFunctionSet::SetCursorAtCell( SCCOL nPosX, SCROW nPosY, bool bScroll
ScFillMode nMode = pViewData->GetFillMode();
if ( nMode == ScFillMode::EMBED_LT || nMode == ScFillMode::EMBED_RB )
{
- OSL_ENSURE( pDoc->IsEmbedded(), "!pDoc->IsEmbedded()" );
+ OSL_ENSURE( rDoc.IsEmbedded(), "!rDoc.IsEmbedded()" );
ScRange aRange;
- pDoc->GetEmbedded( aRange);
+ rDoc.GetEmbedded( aRange);
ScRefType eRefMode = (nMode == ScFillMode::EMBED_LT) ? SC_REFTYPE_EMBED_LT : SC_REFTYPE_EMBED_RB;
if (pViewData->GetRefType() != eRefMode)
{
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index 7e42a16d1a13..3196e2cf4820 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -46,28 +46,28 @@ ScTabControl::ScTabControl( vcl::Window* pParent, ScViewData* pData )
, nSelPageIdByMouse(TabBar::PAGE_NOT_FOUND)
, bErrorShown(false)
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
OUString aString;
Color aTabBgColor;
- SCTAB nCount = pDoc->GetTableCount();
+ SCTAB nCount = rDoc.GetTableCount();
for (SCTAB i=0; i<nCount; i++)
{
- if (pDoc->IsVisible(i))
+ if (rDoc.IsVisible(i))
{
- if (pDoc->GetName(i,aString))
+ if (rDoc.GetName(i,aString))
{
- if ( pDoc->IsScenario(i) )
+ if ( rDoc.IsScenario(i) )
InsertPage( static_cast<sal_uInt16>(i)+1, aString, TabBarPageBits::Blue);
else
InsertPage( static_cast<sal_uInt16>(i)+1, aString );
- if ( pDoc->IsTabProtected(i) )
+ if ( rDoc.IsTabProtected(i) )
SetProtectionSymbol(static_cast<sal_uInt16>(i)+1, true);
- if ( !pDoc->IsDefaultTabBgColor(i) )
+ if ( !rDoc.IsDefaultTabBgColor(i) )
{
- aTabBgColor = pDoc->GetTabBgColor(i);
+ aTabBgColor = rDoc.GetTabBgColor(i);
SetTabBgColor( static_cast<sal_uInt16>(i)+1, aTabBgColor );
}
}
@@ -94,14 +94,14 @@ IMPL_LINK(ScTabControl, ShowPageList, const CommandEvent &, rEvent, void)
sal_uInt16 nCurPageId = GetCurPageId();
- ScDocument* pDoc = pViewData->GetDocument();
- SCTAB nCount = pDoc->GetTableCount();
+ ScDocument& rDoc = pViewData->GetDocument();
+ SCTAB nCount = rDoc.GetTableCount();
for (SCTAB i=0; i<nCount; ++i)
{
- if (pDoc->IsVisible(i))
+ if (rDoc.IsVisible(i))
{
OUString aString;
- if (pDoc->GetName(i, aString))
+ if (rDoc.GetName(i, aString))
{
sal_uInt16 nId = static_cast<sal_uInt16>(i)+1;
aPopup->InsertItem(nId, aString, MenuItemBits::CHECKABLE);
@@ -144,15 +144,15 @@ SCTAB ScTabControl::GetPrivatDropPos(const Point& rPos )
if(nPos !=0 )
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
- SCTAB nCount = pDoc->GetTableCount();
+ SCTAB nCount = rDoc.GetTableCount();
sal_uInt16 nViewPos=0;
nRealPos = nCount;
for (SCTAB i=0; i<nCount; i++)
{
- if (pDoc->IsVisible(i))
+ if (rDoc.IsVisible(i))
{
nViewPos++;
if(nViewPos==nPos)
@@ -160,7 +160,7 @@ SCTAB ScTabControl::GetPrivatDropPos(const Point& rPos )
SCTAB j;
for (j=i+1; j<nCount; j++)
{
- if (pDoc->IsVisible(j))
+ if (rDoc.IsVisible(j))
{
break;
}
@@ -225,13 +225,13 @@ void ScTabControl::AddTabClick()
TabBar::AddTabClick();
// Insert a new sheet at the right end, with default name.
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
ScModule* pScMod = SC_MOD();
- if (!pDoc->IsDocEditable() || pScMod->IsTableLocked())
+ if (!rDoc.IsDocEditable() || pScMod->IsTableLocked())
return;
OUString aName;
- pDoc->CreateValidTabName(aName);
- SCTAB nTabCount = pDoc->GetTableCount();
+ rDoc.CreateValidTabName(aName);
+ SCTAB nTabCount = rDoc.GetTableCount();
pViewData->GetViewShell()->InsertTable(aName, nTabCount);
}
@@ -244,9 +244,9 @@ void ScTabControl::Select()
nMouseClickPageId = TabBar::PAGE_NOT_FOUND;
ScModule* pScMod = SC_MOD();
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
ScMarkData& rMark = pViewData->GetMarkData();
- SCTAB nCount = pDoc->GetTableCount();
+ SCTAB nCount = rDoc.GetTableCount();
SCTAB i;
if ( pScMod->IsTableLocked() ) // may not be switched now ?
@@ -314,16 +314,16 @@ void ScTabControl::Select()
ScRange aRange(
pViewData->GetRefStartX(), pViewData->GetRefStartY(), pViewData->GetRefStartZ(),
pViewData->GetRefEndX(), pViewData->GetRefEndY(), pViewData->GetRefEndZ() );
- pScMod->SetReference( aRange, *pDoc, &rMark );
+ pScMod->SetReference( aRange, rDoc, &rMark );
pScMod->EndReference(); // due to Auto-Hide
}
}
void ScTabControl::UpdateInputContext()
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
WinBits nStyle = GetStyle();
- if (pDoc->GetDocumentShell()->IsReadOnly())
+ if (rDoc.GetDocumentShell()->IsReadOnly())
// no insert sheet tab for readonly doc.
SetStyle(nStyle & ~WB_INSERTTAB);
else
@@ -332,11 +332,11 @@ void ScTabControl::UpdateInputContext()
void ScTabControl::UpdateStatus()
{
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
ScMarkData& rMark = pViewData->GetMarkData();
bool bActive = pViewData->IsActive();
- SCTAB nCount = pDoc->GetTableCount();
+ SCTAB nCount = rDoc.GetTableCount();
SCTAB i;
OUString aString;
SCTAB nMaxCnt = std::max( nCount, static_cast<SCTAB>(GetMaxId()) );
@@ -345,10 +345,10 @@ void ScTabControl::UpdateStatus()
bool bModified = false; // sheet name
for (i=0; i<nMaxCnt && !bModified; i++)
{
- if (pDoc->IsVisible(i))
+ if (rDoc.IsVisible(i))
{
- pDoc->GetName(i,aString);
- aTabBgColor = pDoc->GetTabBgColor(i);
+ rDoc.GetName(i,aString);
+ aTabBgColor = rDoc.GetTabBgColor(i);
}
else
{
@@ -364,21 +364,21 @@ void ScTabControl::UpdateStatus()
Clear();
for (i=0; i<nCount; i++)
{
- if (pDoc->IsVisible(i))
+ if (rDoc.IsVisible(i))
{
- if (pDoc->GetName(i,aString))
+ if (rDoc.GetName(i,aString))
{
- if ( pDoc->IsScenario(i) )
+ if ( rDoc.IsScenario(i) )
InsertPage(static_cast<sal_uInt16>(i)+1, aString, TabBarPageBits::Blue);
else
InsertPage( static_cast<sal_uInt16>(i)+1, aString );
- if ( pDoc->IsTabProtected(i) )
+ if ( rDoc.IsTabProtected(i) )
SetProtectionSymbol(static_cast<sal_uInt16>(i)+1, true);
- if ( !pDoc->IsDefaultTabBgColor(i) )
+ if ( !rDoc.IsDefaultTabBgColor(i) )
{
- aTabBgColor = pDoc->GetTabBgColor(i);
+ aTabBgColor = rDoc.GetTabBgColor(i);
SetTabBgColor(static_cast<sal_uInt16>(i)+1, aTabBgColor );
}
}
@@ -530,10 +530,10 @@ sal_Int8 ScTabControl::ExecuteDrop( const ExecuteDropEvent& rEvt )
{
EndSwitchPage();
- ScDocument* pDoc = pViewData->GetDocument();
+ ScDocument& rDoc = pViewData->GetDocument();
const ScDragData& rData = SC_MOD()->GetDragData();
if ( rData.pCellTransfer && (rData.pCellTransfer->GetDragSourceFlags() & ScDragSrc::Table) &&
- rData.pCellTransfer->GetSourceDocument() == pDoc )
+ rData.pCellTransfer->GetSourceDocument() == &rDoc )
{
// moving of tables within the document
SCTAB nPos = GetPrivatDropPos( rEvt.maPosPixel );
@@ -546,10 +546,10 @@ sal_Int8 ScTabControl::ExecuteDrop( const ExecuteDropEvent& rEvt )
}
else
{
- if ( !pDoc->GetChangeTrack() && pDoc->IsDocEditable() )
+ if ( !rDoc.GetChangeTrack() && rDoc.IsDocEditable() )
{
//! use table selection from the tab control where dragging was started?
- pViewData->GetView()->MoveTable( lcl_DocShellNr(pDoc), nPos, rEvt.mnAction != DND_ACTION_MOVE );
+ pViewData->GetView()->MoveTable( lcl_DocShellNr(&rDoc), nPos, rEvt.mnAction != DND_ACTION_MOVE );
rData.pCellTransfer->SetDragWasInternal(); // don't delete
return DND_ACTION_COPY;
@@ -569,13 +569,13 @@ sal_Int8 ScTabControl::AcceptDrop( const AcceptDropEvent& rEvt )
return rEvt.mnAction;
}
- const ScDocument* pDoc = pViewData->GetDocument();
+ const ScDocument& rDoc = pViewData->GetDocument();
const ScDragData& rData = SC_MOD()->GetDragData();
if ( rData.pCellTransfer && (rData.pCellTransfer->GetDragSourceFlags() & ScDragSrc::Table) &&
- rData.pCellTransfer->GetSourceDocument() == pDoc )
+ rData.pCellTransfer->GetSourceDocument() == &rDoc )
{
// moving of tables within the document
- if ( !pDoc->GetChangeTrack() && pDoc->IsDocEditable() )
+ if ( !rDoc.GetChangeTrack() && rDoc.IsDocEditable() )
{
ShowDropPos( rEvt.maPosPixel );
return rEvt.mnAction;
@@ -592,7 +592,7 @@ sal_Int8 ScTabControl::AcceptDrop( const AcceptDropEvent& rEvt )
bool ScTabControl::StartRenaming()
{
- return pViewData->GetDocument()->IsDocEditable();
+ return pViewData->GetDocument().IsDocEditable();
}
TabBarAllowRenamingReturnCode ScTabControl::AllowRenaming()
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index e8b9e037bb1d..14f7a45cb1e9 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -94,7 +94,7 @@ void ScCornerButton::Paint(vcl::RenderContext& rRenderContext, const tools::Rect
Window::Paint(rRenderContext, rRect);
- bool bLayoutRTL = pViewData->GetDocument()->IsLayoutRTL( pViewData->GetTabNo() );
+ bool bLayoutRTL = pViewData->GetDocument().IsLayoutRTL( pViewData->GetTabNo() );
long nDarkX = bLayoutRTL ? 0 : nPosX;
// both buttons have the same look now - only dark right/bottom lines
@@ -145,7 +145,7 @@ namespace
bool lcl_HasColOutline( const ScViewData& rViewData )
{
- const ScOutlineTable* pTable = rViewData.GetDocument()->GetOutlineTable(rViewData.GetTabNo());
+ const ScOutlineTable* pTable = rViewData.GetDocument().GetOutlineTable(rViewData.GetTabNo());
if (pTable)
{
const ScOutlineArray& rArray = pTable->GetColArray();
@@ -157,7 +157,7 @@ bool lcl_HasColOutline( const ScViewData& rViewData )
bool lcl_HasRowOutline( const ScViewData& rViewData )
{
- const ScOutlineTable* pTable = rViewData.GetDocument()->GetOutlineTable(rViewData.GetTabNo());
+ const ScOutlineTable* pTable = rViewData.GetDocument().GetOutlineTable(rViewData.GetTabNo());
if (pTable)
{
const ScOutlineArray& rArray = pTable->GetRowArray();
@@ -229,7 +229,7 @@ void ScTabView::InitScrollBar( ScrollBar& rScrollBar, long nMaxVal )
rScrollBar.SetScrollHdl( LINK(this, ScTabView, ScrollHdl) );
rScrollBar.SetEndScrollHdl( LINK(this, ScTabView, EndScrollHdl) );
- rScrollBar.EnableRTL( aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() ) );
+ rScrollBar.EnableRTL( aViewData.GetDocument().IsLayoutRTL( aViewData.GetTabNo() ) );
}
// Scroll-Timer
@@ -280,7 +280,7 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner )
if (bHasHint)
RemoveHintWindow();
- bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
+ bool bLayoutRTL = aViewData.GetDocument().IsLayoutRTL( aViewData.GetTabNo() );
long nTotalWidth = rSize.Width();
if ( bLayoutRTL )
nTotalWidth += 2*rOffset.X();
@@ -796,7 +796,7 @@ void ScTabView::GetBorderSize( SvBorder& rBorder, const Size& /* rSize */ )
bool bOutlMode = aViewData.IsOutlineMode();
bool bHOutline = bOutlMode && lcl_HasColOutline(aViewData);
bool bVOutline = bOutlMode && lcl_HasRowOutline(aViewData);
- bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
+ bool bLayoutRTL = aViewData.GetDocument().IsLayoutRTL( aViewData.GetTabNo() );
rBorder = SvBorder();
@@ -1012,7 +1012,7 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll, void )
nViewPos = aViewData.GetPosY( (pScroll == aVScrollTop.get()) ?
SC_SPLIT_TOP : SC_SPLIT_BOTTOM );
- bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
+ bool bLayoutRTL = aViewData.GetDocument().IsLayoutRTL( aViewData.GetTabNo() );
ScrollType eType = pScroll->GetType();
if ( eType == ScrollType::Drag )
@@ -1146,7 +1146,7 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll, void )
void ScTabView::ScrollX( long nDeltaX, ScHSplitPos eWhich, bool bUpdBars )
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCCOL nOldX = aViewData.GetPosX(eWhich);
SCCOL nNewX = nOldX + static_cast<SCCOL>(nDeltaX);
if ( nNewX < 0 )
@@ -1154,16 +1154,16 @@ void ScTabView::ScrollX( long nDeltaX, ScHSplitPos eWhich, bool bUpdBars )
nDeltaX -= nNewX;
nNewX = 0;
}
- if ( nNewX > pDoc->MaxCol() )
+ if ( nNewX > rDoc.MaxCol() )
{
- nDeltaX -= nNewX - pDoc->MaxCol();
- nNewX = pDoc->MaxCol();
+ nDeltaX -= nNewX - rDoc.MaxCol();
+ nNewX = rDoc.MaxCol();
}
SCCOL nDir = ( nDeltaX > 0 ) ? 1 : -1;
SCTAB nTab = aViewData.GetTabNo();
- while ( pDoc->ColHidden(nNewX, nTab) &&
- nNewX+nDir >= 0 && nNewX+nDir <= pDoc->MaxCol() )
+ while ( rDoc.ColHidden(nNewX, nTab) &&
+ nNewX+nDir >= 0 && nNewX+nDir <= rDoc.MaxCol() )
nNewX = sal::static_int_cast<SCCOL>( nNewX + nDir );
// freeze
@@ -1184,7 +1184,7 @@ void ScTabView::ScrollX( long nDeltaX, ScHSplitPos eWhich, bool bUpdBars )
HideAllCursors();
- if ( nNewX >= 0 && nNewX <= pDoc->MaxCol() && nDeltaX )
+ if ( nNewX >= 0 && nNewX <= rDoc.MaxCol() && nDeltaX )
{
SCCOL nTrackX = std::max( nOldX, nNewX );
@@ -1229,7 +1229,7 @@ void ScTabView::ScrollX( long nDeltaX, ScHSplitPos eWhich, bool bUpdBars )
void ScTabView::ScrollY( long nDeltaY, ScVSplitPos eWhich, bool bUpdBars )
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCROW nOldY = aViewData.GetPosY(eWhich);
SCROW nNewY = nOldY + static_cast<SCROW>(nDeltaY);
if ( nNewY < 0 )
@@ -1237,16 +1237,16 @@ void ScTabView::ScrollY( long nDeltaY, ScVSplitPos eWhich, bool bUpdBars )
nDeltaY -= nNewY;
nNewY = 0;
}
- if ( nNewY > pDoc->MaxRow() )
+ if ( nNewY > rDoc.MaxRow() )
{
- nDeltaY -= nNewY - pDoc->MaxRow();
- nNewY = pDoc->MaxRow();
+ nDeltaY -= nNewY - rDoc.MaxRow();
+ nNewY = rDoc.MaxRow();
}
SCROW nDir = ( nDeltaY > 0 ) ? 1 : -1;
SCTAB nTab = aViewData.GetTabNo();
- while ( pDoc->RowHidden(nNewY, nTab) &&
- nNewY+nDir >= 0 && nNewY+nDir <= pDoc->MaxRow() )
+ while ( rDoc.RowHidden(nNewY, nTab) &&
+ nNewY+nDir >= 0 && nNewY+nDir <= rDoc.MaxRow() )
nNewY += nDir;
// freeze
@@ -1267,7 +1267,7 @@ void ScTabView::ScrollY( long nDeltaY, ScVSplitPos eWhich, bool bUpdBars )
HideAllCursors();
- if ( nNewY >= 0 && nNewY <= pDoc->MaxRow() && nDeltaY )
+ if ( nNewY >= 0 && nNewY <= rDoc.MaxRow() && nDeltaY )
{
SCROW nTrackY = std::max( nOldY, nNewY );
@@ -1328,11 +1328,11 @@ SCROW lcl_LastVisible( const ScViewData& rViewData )
// If many rows are hidden at end of the document (what kind of idiot does that?),
// then there should not be a switch to wide row headers because of this
//! as a member to the document???
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
SCTAB nTab = rViewData.GetTabNo();
- SCROW nVis = pDoc->MaxRow();
- while ( nVis > 0 && pDoc->GetRowHeight( nVis, nTab ) == 0 )
+ SCROW nVis = rDoc.MaxRow();
+ while ( nVis > 0 && rDoc.GetRowHeight( nVis, nTab ) == 0 )
--nVis;
return nVis;
}
@@ -1344,8 +1344,8 @@ void ScTabView::UpdateHeaderWidth( const ScVSplitPos* pWhich, const SCROW* pPosY
if (!pRowBar[SC_SPLIT_BOTTOM])
return;
- ScDocument* pDoc = aViewData.GetDocument();
- SCROW nEndPos = pDoc->MaxRow();
+ ScDocument& rDoc = aViewData.GetDocument();
+ SCROW nEndPos = rDoc.MaxRow();
if ( !aViewData.GetViewShell()->GetViewFrame()->GetFrame().IsInPlace() )
{
// for OLE Inplace always MAXROW
@@ -1355,7 +1355,7 @@ void ScTabView::UpdateHeaderWidth( const ScVSplitPos* pWhich, const SCROW* pPosY
else
nEndPos = aViewData.GetPosY( SC_SPLIT_BOTTOM );
nEndPos += aViewData.CellsAtY( nEndPos, 1, SC_SPLIT_BOTTOM ); // VisibleCellsY
- if (nEndPos > pDoc->MaxRow())
+ if (nEndPos > rDoc.MaxRow())
nEndPos = lcl_LastVisible( aViewData );
if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
@@ -1366,7 +1366,7 @@ void ScTabView::UpdateHeaderWidth( const ScVSplitPos* pWhich, const SCROW* pPosY
else
nTopEnd = aViewData.GetPosY( SC_SPLIT_TOP );
nTopEnd += aViewData.CellsAtY( nTopEnd, 1, SC_SPLIT_TOP );// VisibleCellsY
- if (nTopEnd > pDoc->MaxRow())
+ if (nTopEnd > rDoc.MaxRow())
nTopEnd = lcl_LastVisible( aViewData );
if ( nTopEnd > nEndPos )
@@ -1524,7 +1524,7 @@ void ScTabView::DoHSplit(long nSplitPos)
// nSplitPos is the real pixel position on the frame window,
// mirroring for RTL has to be done here.
- bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
+ bool bLayoutRTL = aViewData.GetDocument().IsLayoutRTL( aViewData.GetTabNo() );
if ( bLayoutRTL )
nSplitPos = pFrameWin->GetOutputSizePixel().Width() - nSplitPos - 1;
@@ -1566,9 +1566,9 @@ void ScTabView::DoHSplit(long nSplitPos)
if ( nLeftWidth < 0 ) nLeftWidth = 0;
nNewDelta = nOldDelta + aViewData.CellsAtX( nOldDelta, 1, SC_SPLIT_LEFT,
static_cast<sal_uInt16>(nLeftWidth) );
- ScDocument* pDoc = aViewData.GetDocument();
- if ( nNewDelta > pDoc->MaxCol() )
- nNewDelta = pDoc->MaxCol();
+ ScDocument& rDoc = aViewData.GetDocument();
+ if ( nNewDelta > rDoc.MaxCol() )
+ nNewDelta = rDoc.MaxCol();
aViewData.SetPosX( SC_SPLIT_RIGHT, nNewDelta );
if ( nNewDelta > aViewData.GetCurX() )
ActivatePart( (WhichV(aViewData.GetActivePart()) == SC_SPLIT_BOTTOM) ?
@@ -1639,9 +1639,9 @@ void ScTabView::DoVSplit(long nSplitPos)
if ( nTopHeight < 0 ) nTopHeight = 0;
nNewDelta = nOldDelta + aViewData.CellsAtY( nOldDelta, 1, SC_SPLIT_TOP,
static_cast<sal_uInt16>(nTopHeight) );
- ScDocument* pDoc = aViewData.GetDocument();
- if ( nNewDelta > pDoc->MaxRow() )
- nNewDelta = pDoc->MaxRow();
+ ScDocument& rDoc = aViewData.GetDocument();
+ if ( nNewDelta > rDoc.MaxRow() )
+ nNewDelta = rDoc.MaxRow();
aViewData.SetPosY( SC_SPLIT_BOTTOM, nNewDelta );
if ( nNewDelta > aViewData.GetCurY() )
ActivatePart( (WhichH(aViewData.GetActivePart()) == SC_SPLIT_LEFT) ?
@@ -1666,17 +1666,17 @@ void ScTabView::DoVSplit(long nSplitPos)
Point ScTabView::GetInsertPos() const
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCCOL nCol = aViewData.GetCurX();
SCROW nRow = aViewData.GetCurY();
SCTAB nTab = aViewData.GetTabNo();
long nPosX = 0;
for (SCCOL i=0; i<nCol; i++)
- nPosX += pDoc->GetColWidth(i,nTab);
+ nPosX += rDoc.GetColWidth(i,nTab);
nPosX = static_cast<long>(nPosX * HMM_PER_TWIPS);
- if ( pDoc->IsNegativePage( nTab ) )
+ if ( rDoc.IsNegativePage( nTab ) )
nPosX = -nPosX;
- long nPosY = static_cast<long>(pDoc->GetRowHeight( 0, nRow-1, nTab));
+ long nPosY = static_cast<long>(rDoc.GetRowHeight( 0, nRow-1, nTab));
nPosY = static_cast<long>(nPosY * HMM_PER_TWIPS);
return Point(nPosX,nPosY);
}
@@ -1706,13 +1706,13 @@ Point ScTabView::GetChartInsertPos( const Size& rSize, const ScRange& rCellRange
MapMode aDrawMode = pWin->GetDrawMapMode();
tools::Rectangle aVisible( pWin->PixelToLogic( tools::Rectangle( Point(0,0), pWin->GetOutputSizePixel() ), aDrawMode ) );
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
long nLayoutSign = bLayoutRTL ? -1 : 1;
- long nDocX = static_cast<long>( static_cast<double>(pDoc->GetColOffset( pDoc->MaxCol() + 1, nTab )) * HMM_PER_TWIPS ) * nLayoutSign;
- long nDocY = static_cast<long>( static_cast<double>(pDoc->GetRowOffset( pDoc->MaxRow() + 1, nTab )) * HMM_PER_TWIPS );
+ long nDocX = static_cast<long>( static_cast<double>(rDoc.GetColOffset( rDoc.MaxCol() + 1, nTab )) * HMM_PER_TWIPS ) * nLayoutSign;
+ long nDocY = static_cast<long>( static_cast<double>(rDoc.GetRowOffset( rDoc.MaxRow() + 1, nTab )) * HMM_PER_TWIPS );
if ( aVisible.Left() * nLayoutSign > nDocX * nLayoutSign )
aVisible.SetLeft( nDocX );
@@ -1725,7 +1725,7 @@ Point ScTabView::GetChartInsertPos( const Size& rSize, const ScRange& rCellRange
// get the logic position of the selection
- tools::Rectangle aSelection = pDoc->GetMMRect( rCellRange.aStart.Col(), rCellRange.aStart.Row(),
+ tools::Rectangle aSelection = rDoc.GetMMRect( rCellRange.aStart.Col(), rCellRange.aStart.Row(),
rCellRange.aEnd.Col(), rCellRange.aEnd.Row(), nTab );
long nLeftSpace = aSelection.Left() - aVisible.Left();
@@ -1824,9 +1824,9 @@ Point ScTabView::GetChartDialogPos( const Size& rDialogSize, const tools::Rectan
tools::Rectangle aDesktop = pWin->GetDesktopRectPixel();
Size aSpace = pWin->LogicToPixel( Size(8, 12), MapMode(MapUnit::MapAppFont));
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
bool bCenterHor = false;
@@ -1920,7 +1920,7 @@ void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMethod, SCCOLRO
ePos = SC_SPLIT_TOPLEFT;
vcl::Window* pWin = pGridWin[ePos];
- bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
+ bool bLayoutRTL = aViewData.GetDocument().IsLayoutRTL( aViewData.GetTabNo() );
if ( bFreeze )
{
@@ -2204,7 +2204,7 @@ void ScTabView::StartDataSelect()
// Do autofilter if the current cell has autofilter button. Otherwise do
// a normal data select popup.
const ScMergeFlagAttr* pAttr =
- aViewData.GetDocument()->GetAttr(
+ aViewData.GetDocument().GetAttr(
nCol, nRow, aViewData.GetTabNo(), ATTR_MERGE_FLAG);
if (pAttr->HasAutoFilter())
@@ -2289,13 +2289,13 @@ namespace
long lcl_GetRowHeightPx(const ScViewData &rViewData, SCROW nRow, SCTAB nTab)
{
- const sal_uInt16 nSize = rViewData.GetDocument()->GetRowHeight(nRow, nTab);
+ const sal_uInt16 nSize = rViewData.GetDocument().GetRowHeight(nRow, nTab);
return ScViewData::ToPixel(nSize, rViewData.GetPPTY());
}
long lcl_GetColWidthPx(const ScViewData &rViewData, SCCOL nCol, SCTAB nTab)
{
- const sal_uInt16 nSize = rViewData.GetDocument()->GetColWidth(nCol, nTab);
+ const sal_uInt16 nSize = rViewData.GetDocument().GetColWidth(nCol, nTab);
return ScViewData::ToPixel(nSize, rViewData.GetPPTX());
}
@@ -2536,11 +2536,11 @@ private:
void lcl_ExtendTiledDimension(bool bColumn, const SCCOLROW nEnd, const SCCOLROW nExtra,
ScTabView& rTabView, ScViewData& rViewData)
{
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
// If we are approaching current max tiled row/col, signal a size changed event
// and invalidate the involved area
SCCOLROW nMaxTiledIndex = bColumn ? rViewData.GetMaxTiledCol() : rViewData.GetMaxTiledRow();
- SCCOLROW nHardLimit = !bColumn ? MAXTILEDROW : pDoc ? pDoc->MaxCol() : MAXCOL;
+ SCCOLROW nHardLimit = !bColumn ? MAXTILEDROW : rDoc.MaxCol();
if (nMaxTiledIndex >= nHardLimit)
return;
@@ -2598,9 +2598,7 @@ void lcl_ExtendTiledDimension(bool bColumn, const SCCOLROW nEnd, const SCCOLROW
void ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle, tools::JsonWriter& rJsonWriter)
{
- ScDocument* pDoc = aViewData.GetDocument();
- if (!pDoc)
- return;
+ ScDocument& rDoc = aViewData.GetDocument();
if (rRectangle.IsEmpty())
return;
@@ -2656,7 +2654,7 @@ void ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle, tools::J
// per each level store the index of the first group intersecting
// [nStartRow, nEndRow] range
- const ScOutlineTable* pTable = pDoc->GetOutlineTable(nTab);
+ const ScOutlineTable* pTable = rDoc.GetOutlineTable(nTab);
const ScOutlineArray* pRowArray = pTable ? &(pTable->GetRowArray()) : nullptr;
size_t nRowGroupDepth = 0;
std::vector<size_t> aRowGroupIndexes;
@@ -2842,9 +2840,7 @@ OString ScTabView::getSheetGeometryData(bool bColumns, bool bRows, bool bSizes,
return aStream.str();
};
- ScDocument* pDoc = aViewData.GetDocument();
- if (!pDoc)
- return getJSONString(aTree).c_str();
+ ScDocument& rDoc = aViewData.GetDocument();
if ((!bSizes && !bHidden && !bFiltered && !bGroups) ||
(!bColumns && !bRows))
@@ -2893,7 +2889,7 @@ OString ScTabView::getSheetGeometryData(bool bColumns, bool bRows, bool bSizes,
if (!rGeomEntry.bEnabled)
continue;
- OString aGeomDataEncoding = pDoc->dumpSheetGeomData(nTab, bDimIsCol, rGeomEntry.eType);
+ OString aGeomDataEncoding = rDoc.dumpSheetGeomData(nTab, bDimIsCol, rGeomEntry.eType);
// TODO: Investigate if we can avoid the copy of the 'value' string in put().
aDimTree.put(rGeomEntry.pKey, aGeomDataEncoding.getStr());
}
diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index 7442cb261acb..54b42b81d871 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -301,21 +301,21 @@ void moveCursorByMergedCell(
void ScTabView::PaintMarks(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow )
{
- auto pDoc = aViewData.GetDocument();
- if (!pDoc->ValidCol(nStartCol)) nStartCol = pDoc->MaxCol();
- if (!pDoc->ValidRow(nStartRow)) nStartRow = pDoc->MaxRow();
- if (!pDoc->ValidCol(nEndCol)) nEndCol = pDoc->MaxCol();
- if (!pDoc->ValidRow(nEndRow)) nEndRow = pDoc->MaxRow();
+ auto& rDoc = aViewData.GetDocument();
+ if (!rDoc.ValidCol(nStartCol)) nStartCol = rDoc.MaxCol();
+ if (!rDoc.ValidRow(nStartRow)) nStartRow = rDoc.MaxRow();
+ if (!rDoc.ValidCol(nEndCol)) nEndCol = rDoc.MaxCol();
+ if (!rDoc.ValidRow(nEndRow)) nEndRow = rDoc.MaxRow();
- bool bLeft = (nStartCol==0 && nEndCol==pDoc->MaxCol());
- bool bTop = (nStartRow==0 && nEndRow==pDoc->MaxRow());
+ bool bLeft = (nStartCol==0 && nEndCol==rDoc.MaxCol());
+ bool bTop = (nStartRow==0 && nEndRow==rDoc.MaxRow());
if (bLeft)
PaintLeftArea( nStartRow, nEndRow );
if (bTop)
PaintTopArea( nStartCol, nEndCol );
- aViewData.GetDocument()->ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow,
+ aViewData.GetDocument().ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow,
aViewData.GetTabNo() );
PaintArea( nStartCol, nStartRow, nEndCol, nEndRow, ScUpdateMode::Marks );
}
@@ -355,9 +355,9 @@ void ScTabView::InitBlockMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
if (IsBlockMode())
return;
- auto pDoc = aViewData.GetDocument();
- if (!pDoc->ValidCol(nCurX)) nCurX = pDoc->MaxCol();
- if (!pDoc->ValidRow(nCurY)) nCurY = pDoc->MaxRow();
+ auto& rDoc = aViewData.GetDocument();
+ if (!rDoc.ValidCol(nCurX)) nCurX = rDoc.MaxCol();
+ if (!rDoc.ValidRow(nCurY)) nCurY = rDoc.MaxRow();
ScMarkData& rMark = aViewData.GetMarkData();
SCTAB nTab = aViewData.GetTabNo();
@@ -391,13 +391,13 @@ void ScTabView::InitBlockMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
if (bBlockCols)
{
nBlockStartY = nBlockStartYOrig = 0;
- nBlockEndY = pDoc->MaxRow();
+ nBlockEndY = rDoc.MaxRow();
}
if (bBlockRows)
{
nBlockStartX = nBlockStartXOrig = 0;
- nBlockEndX = pDoc->MaxCol();
+ nBlockEndX = rDoc.MaxCol();
}
rMark.SetMarkArea( ScRange( nBlockStartX,nBlockStartY, nTab, nBlockEndX,nBlockEndY, nTab ) );
@@ -428,8 +428,8 @@ void ScTabView::DoneBlockMode( bool bContinue )
// the sheet may be invalid at this point because DoneBlockMode from SetTabNo is
// called (for example, when the current sheet is closed from another View)
SCTAB nTab = aViewData.GetTabNo();
- ScDocument* pDoc = aViewData.GetDocument();
- if ( pDoc->HasTable(nTab) )
+ ScDocument& rDoc = aViewData.GetDocument();
+ if ( rDoc.HasTable(nTab) )
PaintBlock( true ); // true -> delete block
else
rMark.ResetMark();
@@ -448,9 +448,9 @@ bool ScTabView::IsBlockMode() const
void ScTabView::MarkCursor( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
bool bCols, bool bRows, bool bCellSelection )
{
- ScDocument* pDocument = aViewData.GetDocument();
- if (!pDocument->ValidCol(nCurX)) nCurX = pDocument->MaxCol();
- if (!pDocument->ValidRow(nCurY)) nCurY = pDocument->MaxRow();
+ ScDocument& rDocument = aViewData.GetDocument();
+ if (!rDocument.ValidCol(nCurX)) nCurX = rDocument.MaxCol();
+ if (!rDocument.ValidRow(nCurY)) nCurY = rDocument.MaxRow();
if (!IsBlockMode())
{
@@ -459,9 +459,9 @@ void ScTabView::MarkCursor( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
}
if (bCols)
- nCurY = pDocument->MaxRow();
+ nCurY = rDocument.MaxRow();
if (bRows)
- nCurX = pDocument->MaxCol();
+ nCurX = rDocument.MaxCol();
ScMarkData& rMark = aViewData.GetMarkData();
OSL_ENSURE(rMark.IsMarked() || rMark.IsMultiMarked(), "MarkCursor, !IsMarked()");
@@ -507,7 +507,7 @@ void ScTabView::MarkCursor( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
// move to the lower-right corner of the merged anchor cell, and so on.
const ScMergeAttr* pMergeAttr =
- pDocument->GetAttr( nBlockStartXOrig, nBlockStartYOrig, nTab, ATTR_MERGE );
+ rDocument.GetAttr( nBlockStartXOrig, nBlockStartYOrig, nTab, ATTR_MERGE );
if ( pMergeAttr->IsMerged() )
{
SCCOL nColSpan = pMergeAttr->GetColMerge();
@@ -532,7 +532,7 @@ void ScTabView::MarkCursor( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
// nCurXOffset/nCurYOffset may also be specified in the previous code
// block, in which case whichever value is greater will take on.
- pMergeAttr = pDocument->GetAttr( nCurX, nCurY, nTab, ATTR_MERGE );
+ pMergeAttr = rDocument.GetAttr( nCurX, nCurY, nTab, ATTR_MERGE );
if ( pMergeAttr->IsMerged() )
{
SCCOL nColSpan = pMergeAttr->GetColMerge();
@@ -571,8 +571,8 @@ void ScTabView::MarkCursor( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
nBlockStartX = nBlockStartX + nBlockStartXOffset >= 0 ? nBlockStartX + nBlockStartXOffset : 0;
nBlockStartY = nBlockStartY + nBlockStartYOffset >= 0 ? nBlockStartY + nBlockStartYOffset : 0;
- nBlockEndX = std::min<SCCOL>(nCurX + nCurXOffset, pDocument->MaxCol());
- nBlockEndY = std::min(nCurY + nCurYOffset, pDocument->MaxRow());
+ nBlockEndX = std::min<SCCOL>(nCurX + nCurXOffset, rDocument.MaxCol());
+ nBlockEndY = std::min(nCurY + nCurYOffset, rDocument.MaxRow());
}
else
{
@@ -675,7 +675,7 @@ void ScTabView::GetAreaMoveEndPosition(SCCOL nMovX, SCROW nMovY, ScFollowMode eM
nNewY = nCurY;
}
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
// FindAreaPos knows only -1 or 1 as direction
@@ -687,22 +687,22 @@ void ScTabView::GetAreaMoveEndPosition(SCCOL nMovX, SCROW nMovY, ScFollowMode eM
SCCOLROW i;
if ( nMovX > 0 )
for ( i=0; i<nMovX; i++ )
- pDoc->FindAreaPos( nNewX, nVirtualY, nTab, SC_MOVE_RIGHT );
+ rDoc.FindAreaPos( nNewX, nVirtualY, nTab, SC_MOVE_RIGHT );
if ( nMovX < 0 )
for ( i=0; i<-nMovX; i++ )
- pDoc->FindAreaPos( nNewX, nVirtualY, nTab, SC_MOVE_LEFT );
+ rDoc.FindAreaPos( nNewX, nVirtualY, nTab, SC_MOVE_LEFT );
if ( nMovY > 0 )
for ( i=0; i<nMovY; i++ )
- pDoc->FindAreaPos( nVirtualX, nNewY, nTab, SC_MOVE_DOWN );
+ rDoc.FindAreaPos( nVirtualX, nNewY, nTab, SC_MOVE_DOWN );
if ( nMovY < 0 )
for ( i=0; i<-nMovY; i++ )
- pDoc->FindAreaPos( nVirtualX, nNewY, nTab, SC_MOVE_UP );
+ rDoc.FindAreaPos( nVirtualX, nNewY, nTab, SC_MOVE_UP );
if (eMode==SC_FOLLOW_JUMP) // bottom right do not show too much grey
{
- if (nMovX != 0 && nNewX == pDoc->MaxCol())
+ if (nMovX != 0 && nNewX == rDoc.MaxCol())
eMode = SC_FOLLOW_LINE;
- if (nMovY != 0 && nNewY == pDoc->MaxRow())
+ if (nMovY != 0 && nNewY == rDoc.MaxRow())
eMode = SC_FOLLOW_LINE;
}
@@ -726,11 +726,11 @@ void ScTabView::GetAreaMoveEndPosition(SCCOL nMovX, SCROW nMovY, ScFollowMode eM
void ScTabView::SkipCursorHorizontal(SCCOL& rCurX, SCROW& rCurY, SCCOL nOldX, SCCOL nMovX)
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
bool bSkipProtected = false, bSkipUnprotected = false;
- ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
if (pProtect && pProtect->isProtected())
{
bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
@@ -739,14 +739,14 @@ void ScTabView::SkipCursorHorizontal(SCCOL& rCurX, SCROW& rCurY, SCCOL nOldX, SC
bool bSkipCell = false;
bool bHFlip = false;
- auto nMaxCol = pDoc->ClampToAllocatedColumns(nTab, pDoc->MaxCol());
+ auto nMaxCol = rDoc.ClampToAllocatedColumns(nTab, rDoc.MaxCol());
do
{
- bSkipCell = pDoc->ColHidden(rCurX, nTab) || pDoc->IsHorOverlapped(rCurX, rCurY, nTab);
+ bSkipCell = rDoc.ColHidden(rCurX, nTab) || rDoc.IsHorOverlapped(rCurX, rCurY, nTab);
if (bSkipProtected && !bSkipCell)
- bSkipCell = pDoc->HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected);
+ bSkipCell = rDoc.HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected);
if (bSkipUnprotected && !bSkipCell)
- bSkipCell = !pDoc->HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected);
+ bSkipCell = !rDoc.HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected);
if (bSkipCell)
{
@@ -776,21 +776,21 @@ void ScTabView::SkipCursorHorizontal(SCCOL& rCurX, SCROW& rCurY, SCCOL nOldX, SC
}
while (bSkipCell);
- if (pDoc->IsVerOverlapped(rCurX, rCurY, nTab))
+ if (rDoc.IsVerOverlapped(rCurX, rCurY, nTab))
{
aViewData.SetOldCursor(rCurX, rCurY);
- while (pDoc->IsVerOverlapped(rCurX, rCurY, nTab))
+ while (rDoc.IsVerOverlapped(rCurX, rCurY, nTab))
--rCurY;
}
}
void ScTabView::SkipCursorVertical(SCCOL& rCurX, SCROW& rCurY, SCROW nOldY, SCROW nMovY)
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
bool bSkipProtected = false, bSkipUnprotected = false;
- ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
if (pProtect && pProtect->isProtected())
{
bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
@@ -802,15 +802,15 @@ void ScTabView::SkipCursorVertical(SCCOL& rCurX, SCROW& rCurY, SCROW nOldY, SCRO
do
{
SCROW nLastRow = -1;
- bSkipCell = pDoc->RowHidden(rCurY, nTab, nullptr, &nLastRow) || pDoc->IsVerOverlapped( rCurX, rCurY, nTab );
+ bSkipCell = rDoc.RowHidden(rCurY, nTab, nullptr, &nLastRow) || rDoc.IsVerOverlapped( rCurX, rCurY, nTab );
if (bSkipProtected && !bSkipCell)
- bSkipCell = pDoc->HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected);
+ bSkipCell = rDoc.HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected);
if (bSkipUnprotected && !bSkipCell)
- bSkipCell = !pDoc->HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected);
+ bSkipCell = !rDoc.HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected);
if (bSkipCell)
{
- if (rCurY <= 0 || rCurY >= pDoc->MaxRow())
+ if (rCurY <= 0 || rCurY >= rDoc.MaxRow())
{
if (bVFlip)
{
@@ -836,10 +836,10 @@ void ScTabView::SkipCursorVertical(SCCOL& rCurX, SCROW& rCurY, SCROW nOldY, SCRO
}
while (bSkipCell);
- if (pDoc->IsHorOverlapped(rCurX, rCurY, nTab))
+ if (rDoc.IsHorOverlapped(rCurX, rCurY, nTab))
{
aViewData.SetOldCursor(rCurX, rCurY);
- while (pDoc->IsHorOverlapped(rCurX, rCurY, nTab))
+ while (rDoc.IsHorOverlapped(rCurX, rCurY, nTab))
--rCurX;
}
}
@@ -856,7 +856,7 @@ void ScTabView::ExpandBlock(SCCOL nMovX, SCROW nMovY, ScFollowMode eMode)
// initialize formula reference mode if it hasn't already.
InitRefMode(aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo(), SC_REFTYPE_REF);
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
if (aViewData.IsRefMode())
{
@@ -868,60 +868,60 @@ void ScTabView::ExpandBlock(SCCOL nMovX, SCROW nMovY, ScFollowMode eMode)
bool bSelectLocked = true;
bool bSelectUnlocked = true;
- ScTableProtection* pTabProtection = pDoc->GetTabProtection(nRefTab);
+ ScTableProtection* pTabProtection = rDoc.GetTabProtection(nRefTab);
if (pTabProtection && pTabProtection->isProtected())
{
bSelectLocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
bSelectUnlocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
}
- moveCursorByProtRule(nNewX, nNewY, nMovX, nMovY, nRefTab, pDoc);
- checkBoundary(pDoc, nNewX, nNewY);
+ moveCursorByProtRule(nNewX, nNewY, nMovX, nMovY, nRefTab, &rDoc);
+ checkBoundary(&rDoc, nNewX, nNewY);
if (nMovX)
{
SCCOL nTempX = nNewX;
- while (pDoc->IsHorOverlapped(nTempX, nNewY, nRefTab))
+ while (rDoc.IsHorOverlapped(nTempX, nNewY, nRefTab))
{
if (nMovX > 0)
++nTempX;
else
--nTempX;
- if (!checkBoundary(pDoc, nTempX, nNewY))
+ if (!checkBoundary(&rDoc, nTempX, nNewY))
break;
}
- if (isCellQualified(pDoc, nTempX, nNewY, nRefTab, bSelectLocked, bSelectUnlocked))
+ if (isCellQualified(&rDoc, nTempX, nNewY, nRefTab, bSelectLocked, bSelectUnlocked))
nNewX = nTempX;
}
if (nMovY)
{
SCROW nTempY = nNewY;
- while (pDoc->IsVerOverlapped(nNewX, nTempY, nRefTab))
+ while (rDoc.IsVerOverlapped(nNewX, nTempY, nRefTab))
{
if (nMovY > 0)
++nTempY;
else
--nTempY;
- if (!checkBoundary(pDoc, nNewX, nTempY))
+ if (!checkBoundary(&rDoc, nNewX, nTempY))
break;
}
- if (isCellQualified(pDoc, nNewX, nTempY, nRefTab, bSelectLocked, bSelectUnlocked))
+ if (isCellQualified(&rDoc, nNewX, nTempY, nRefTab, bSelectLocked, bSelectUnlocked))
nNewY = nTempY;
}
- pDoc->SkipOverlapped(nNewX, nNewY, nRefTab);
+ rDoc.SkipOverlapped(nNewX, nNewY, nRefTab);
UpdateRef(nNewX, nNewY, nRefTab);
SCCOL nTargetCol = nNewX;
SCROW nTargetRow = nNewY;
if (((aViewData.GetRefStartX() == 0) || (aViewData.GetRefStartY() == 0)) &&
- ((nNewX != pDoc->MaxCol()) || (nNewY != pDoc->MaxRow())))
+ ((nNewX != rDoc.MaxCol()) || (nNewY != rDoc.MaxRow())))
{
// Row selection
- if ((aViewData.GetRefStartX() == 0) && (nNewX == pDoc->MaxCol()))
+ if ((aViewData.GetRefStartX() == 0) && (nNewX == rDoc.MaxCol()))
nTargetCol = aViewData.GetCurX();
// Column selection
- if ((aViewData.GetRefStartY() == 0) && (nNewY == pDoc->MaxRow()))
+ if ((aViewData.GetRefStartY() == 0) && (nNewY == rDoc.MaxRow()))
nTargetRow = aViewData.GetCurY();
}
AlignToCursor(nTargetCol, nTargetRow, eMode);
@@ -939,17 +939,17 @@ void ScTabView::ExpandBlock(SCCOL nMovX, SCROW nMovY, ScFollowMode eMode)
if (!IsBlockMode())
InitBlockMode(nOrigX, nOrigY, nTab, true);
- moveCursorByProtRule(nBlockEndX, nBlockEndY, nMovX, nMovY, nTab, pDoc);
- checkBoundary(pDoc, nBlockEndX, nBlockEndY);
- moveCursorByMergedCell(nBlockEndX, nBlockEndY, nMovX, nMovY, nTab, pDoc, aViewData);
- checkBoundary(pDoc, nBlockEndX, nBlockEndY);
+ moveCursorByProtRule(nBlockEndX, nBlockEndY, nMovX, nMovY, nTab, &rDoc);
+ checkBoundary(&rDoc, nBlockEndX, nBlockEndY);
+ moveCursorByMergedCell(nBlockEndX, nBlockEndY, nMovX, nMovY, nTab, &rDoc, aViewData);
+ checkBoundary(&rDoc, nBlockEndX, nBlockEndY);
MarkCursor(nBlockEndX, nBlockEndY, nTab, false, false, true);
// Check if the entire row(s) or column(s) are selected.
ScSplitPos eActive = aViewData.GetActivePart();
- bool bRowSelected = (nBlockStartX == 0 && nBlockEndX == pDoc->MaxCol());
- bool bColSelected = (nBlockStartY == 0 && nBlockEndY == pDoc->MaxRow());
+ bool bRowSelected = (nBlockStartX == 0 && nBlockEndX == rDoc.MaxCol());
+ bool bColSelected = (nBlockStartY == 0 && nBlockEndY == rDoc.MaxRow());
SCCOL nAlignX = bRowSelected ? aViewData.GetPosX(WhichH(eActive)) : nBlockEndX;
SCROW nAlignY = bColSelected ? aViewData.GetPosY(WhichV(eActive)) : nBlockEndY;
AlignToCursor(nAlignX, nAlignY, eMode);
@@ -1062,7 +1062,7 @@ void ScTabView::PaintBlock( bool bReset )
void ScTabView::SelectAll( bool bContinue )
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
ScMarkData& rMark = aViewData.GetMarkData();
SCTAB nTab = aViewData.GetTabNo();
@@ -1070,22 +1070,22 @@ void ScTabView::SelectAll( bool bContinue )
{
ScRange aMarkRange;
rMark.GetMarkArea( aMarkRange );
- if ( aMarkRange == ScRange( 0,0,nTab, pDoc->MaxCol(),pDoc->MaxRow(),nTab ) )
+ if ( aMarkRange == ScRange( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab ) )
return;
}
DoneBlockMode( bContinue );
InitBlockMode( 0,0,nTab );
- MarkCursor( pDoc->MaxCol(),pDoc->MaxRow(),nTab );
+ MarkCursor( rDoc.MaxCol(),rDoc.MaxRow(),nTab );
SelectionChanged();
}
void ScTabView::SelectAllTables()
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
ScMarkData& rMark = aViewData.GetMarkData();
- SCTAB nCount = pDoc->GetTableCount();
+ SCTAB nCount = rDoc.GetTableCount();
if (nCount>1)
{
@@ -1101,10 +1101,10 @@ void ScTabView::SelectAllTables()
void ScTabView::DeselectAllTables()
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
ScMarkData& rMark = aViewData.GetMarkData();
SCTAB nTab = aViewData.GetTabNo();
- SCTAB nCount = pDoc->GetTableCount();
+ SCTAB nCount = rDoc.GetTableCount();
for (SCTAB i=0; i<nCount; i++)
rMark.SelectTable( i, ( i == nTab ) );
@@ -1190,7 +1190,7 @@ sal_uInt16 ScTabView::CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom )
case SvxZoomType::OPTIMAL: // nZoom corresponds to the optimal size
{
ScMarkData& rMark = aViewData.GetMarkData();
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
if (!rMark.IsMarked() && !rMark.IsMultiMarked())
nZoom = 100; // nothing selected
@@ -1257,7 +1257,7 @@ sal_uInt16 ScTabView::CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom )
sal_uInt16 nTest = (nMin+nMax+1)/2;
if ( lcl_FitsInWindow(
nPPTX, nPPTY, nTest, aWinSize.Width(), aWinSize.Height(),
- pDoc, nTab, nStartCol, nStartRow, nEndCol, nEndRow,
+ &rDoc, nTab, nStartCol, nStartRow, nEndCol, nEndRow,
nFixPosX, nFixPosY ) )
nMin = nTest;
else
@@ -1285,10 +1285,10 @@ sal_uInt16 ScTabView::CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom )
case SvxZoomType::PAGEWIDTH: // nZoom corresponds to the page width
{
SCTAB nCurTab = aViewData.GetTabNo();
- ScDocument* pDoc = aViewData.GetDocument();
- ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ ScDocument& rDoc = aViewData.GetDocument();
+ ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
SfxStyleSheetBase* pStyleSheet =
- pStylePool->Find( pDoc->GetPageStyle( nCurTab ),
+ pStylePool->Find( rDoc.GetPageStyle( nCurTab ),
SfxStyleFamily::Page );
OSL_ENSURE( pStyleSheet, "PageStyle not found :-/" );
@@ -1321,7 +1321,7 @@ sal_uInt16 ScTabView::CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom )
aWinSize.AdjustWidth(nOtherWidth );
for ( SCCOL nCol = aViewData.GetPosX(SC_SPLIT_LEFT);
nCol < aViewData.GetFixPosX(); nCol++ )
- aPageSize.AdjustWidth(pDoc->GetColWidth( nCol, nCurTab ) );
+ aPageSize.AdjustWidth(rDoc.GetColWidth( nCol, nCurTab ) );
}
else if ( nOtherWidth > aWinSize.Width() )
aWinSize.setWidth( nOtherWidth );
@@ -1334,7 +1334,7 @@ sal_uInt16 ScTabView::CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom )
if ( eVMode == SC_SPLIT_FIX )
{
aWinSize.AdjustHeight(nOtherHeight );
- aPageSize.AdjustHeight(pDoc->GetRowHeight(
+ aPageSize.AdjustHeight(rDoc.GetRowHeight(
aViewData.GetPosY(SC_SPLIT_TOP),
aViewData.GetFixPosY()-1, nCurTab) );
}
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 981b127b86ae..430321186193 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -157,9 +157,9 @@ void ScExtraEditViewManager::Modifier<ScExtraEditViewManager::Remover>(ScGridWin
void ScTabView::ClickCursor( SCCOL nPosX, SCROW nPosY, bool bControl )
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
- pDoc->SkipOverlapped(nPosX, nPosY, nTab);
+ rDoc.SkipOverlapped(nPosX, nPosY, nTab);
bool bRefMode = SC_MOD()->IsFormulaMode();
@@ -396,7 +396,7 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew )
if (nPosX <= aViewData.GetMaxTiledCol() - 10 && nPosY <= aViewData.GetMaxTiledRow() - 25)
return;
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
ScDocShell* pDocSh = aViewData.GetDocShell();
ScModelObj* pModelObj = pDocSh ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocSh->GetModel() ) : nullptr;
Size aOldSize(0, 0);
@@ -404,7 +404,7 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew )
aOldSize = pModelObj->getDocumentSize();
if (nPosX > aViewData.GetMaxTiledCol() - 10)
- aViewData.SetMaxTiledCol(std::min<SCCOL>(std::max(nPosX, aViewData.GetMaxTiledCol()) + 10, pDoc->MaxCol()));
+ aViewData.SetMaxTiledCol(std::min<SCCOL>(std::max(nPosX, aViewData.GetMaxTiledCol()) + 10, rDoc.MaxCol()));
if (nPosY > aViewData.GetMaxTiledRow() - 25)
aViewData.SetMaxTiledRow(std::min<SCROW>(std::max(nPosY, aViewData.GetMaxTiledRow()) + 25, MAXTILEDROW));
@@ -630,8 +630,8 @@ void ScTabView::CursorPosChanged()
// Broadcast, so that other Views of the document also switch
- ScDocument* pDoc = aViewData.GetDocument();
- bool bDP = nullptr != pDoc->GetDPAtCursor(
+ ScDocument& rDoc = aViewData.GetDocument();
+ bool bDP = nullptr != rDoc.GetDPAtCursor(
aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo() );
aViewData.GetViewShell()->SetPivotShell(bDP);
@@ -780,14 +780,14 @@ void ScTabView::TestHintWindow()
bool bListValButton = false;
ScAddress aListValPos;
- ScDocument* pDoc = aViewData.GetDocument();
- const SfxUInt32Item* pItem = pDoc->GetAttr( aViewData.GetCurX(),
- aViewData.GetCurY(),
- aViewData.GetTabNo(),
- ATTR_VALIDDATA );
+ ScDocument& rDoc = aViewData.GetDocument();
+ const SfxUInt32Item* pItem = rDoc.GetAttr( aViewData.GetCurX(),
+ aViewData.GetCurY(),
+ aViewData.GetTabNo(),
+ ATTR_VALIDDATA );
if ( pItem->GetValue() )
{
- const ScValidationData* pData = pDoc->GetValidationEntry( pItem->GetValue() );
+ const ScValidationData* pData = rDoc.GetValidationEntry( pItem->GetValue() );
OSL_ENSURE(pData,"ValidationData not found");
OUString aTitle, aMessage;
@@ -1099,14 +1099,14 @@ void ScTabView::AlignToCursor( SCCOL nCurX, SCROW nCurY, ScFollowMode eMode,
break;
}
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
if (bDoLine)
{
while ( nCurX >= nNewDeltaX+nSizeX )
{
nNewDeltaX = nCurX-nSizeX+1;
SCTAB nTab = aViewData.GetTabNo();
- while ( nNewDeltaX < pDoc->MaxCol() && !pDoc->GetColWidth( nNewDeltaX, nTab ) )
+ while ( nNewDeltaX < rDoc.MaxCol() && !rDoc.GetColWidth( nNewDeltaX, nTab ) )
++nNewDeltaX;
nSizeX = aViewData.CellsAtX( nNewDeltaX, 1, eAlignX );
}
@@ -1114,7 +1114,7 @@ void ScTabView::AlignToCursor( SCCOL nCurX, SCROW nCurY, ScFollowMode eMode,
{
nNewDeltaY = nCurY-nSizeY+1;
SCTAB nTab = aViewData.GetTabNo();
- while ( nNewDeltaY < pDoc->MaxRow() && !pDoc->GetRowHeight( nNewDeltaY, nTab ) )
+ while ( nNewDeltaY < rDoc.MaxRow() && !rDoc.GetRowHeight( nNewDeltaY, nTab ) )
++nNewDeltaY;
nSizeY = aViewData.CellsAtY( nNewDeltaY, 1, eAlignY );
}
@@ -1126,15 +1126,15 @@ void ScTabView::AlignToCursor( SCCOL nCurX, SCROW nCurY, ScFollowMode eMode,
if ( nNewDeltaX != nDeltaX )
nSizeX = aViewData.CellsAtX( nNewDeltaX, 1, eAlignX );
- if (nNewDeltaX+nSizeX-1 > pDoc->MaxCol())
- nNewDeltaX = pDoc->MaxCol()-nSizeX+1;
+ if (nNewDeltaX+nSizeX-1 > rDoc.MaxCol())
+ nNewDeltaX = rDoc.MaxCol()-nSizeX+1;
if (nNewDeltaX < 0)
nNewDeltaX = 0;
if ( nNewDeltaY != nDeltaY )
nSizeY = aViewData.CellsAtY( nNewDeltaY, 1, eAlignY );
- if (nNewDeltaY+nSizeY-1 > pDoc->MaxRow())
- nNewDeltaY = pDoc->MaxRow()-nSizeY+1;
+ if (nNewDeltaY+nSizeY-1 > rDoc.MaxRow())
+ nNewDeltaY = rDoc.MaxRow()-nSizeY+1;
if (nNewDeltaY < 0)
nNewDeltaY = 0;
@@ -1187,15 +1187,15 @@ void ScTabView::MoveCursorAbs( SCCOL nCurX, SCROW nCurY, ScFollowMode eMode,
if (!bKeepOld)
aViewData.ResetOldCursor();
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
// #i123629#
if( aViewData.GetViewShell()->GetForceFocusOnCurCell() )
- aViewData.GetViewShell()->SetForceFocusOnCurCell( !pDoc->ValidColRow(nCurX, nCurY) );
+ aViewData.GetViewShell()->SetForceFocusOnCurCell( !rDoc.ValidColRow(nCurX, nCurY) );
if (nCurX < 0) nCurX = 0;
if (nCurY < 0) nCurY = 0;
- if (nCurX > pDoc->MaxCol()) nCurX = pDoc->MaxCol();
- if (nCurY > pDoc->MaxRow()) nCurY = pDoc->MaxRow();
+ if (nCurX > rDoc.MaxCol()) nCurX = rDoc.MaxCol();
+ if (nCurY > rDoc.MaxRow()) nCurY = rDoc.MaxRow();
// FIXME: this is to limit the number of rows handled in the Online
// to 1000; this will be removed again when the performance
@@ -1259,11 +1259,11 @@ void ScTabView::MoveCursorAbs( SCCOL nCurX, SCROW nCurY, ScFollowMode eMode,
void ScTabView::MoveCursorRel( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode,
bool bShift, bool bKeepSel )
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
bool bSkipProtected = false, bSkipUnprotected = false;
- ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
if ( pProtect && pProtect->isProtected() )
{
bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
@@ -1305,10 +1305,10 @@ void ScTabView::MoveCursorRel( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode,
aViewData.ResetOldCursor();
- if (nMovX != 0 && pDoc->ValidColRow(nCurX,nCurY))
+ if (nMovX != 0 && rDoc.ValidColRow(nCurX,nCurY))
SkipCursorHorizontal(nCurX, nCurY, nOldX, nMovX);
- if (nMovY != 0 && pDoc->ValidColRow(nCurX,nCurY))
+ if (nMovY != 0 && rDoc.ValidColRow(nCurX,nCurY))
SkipCursorVertical(nCurX, nCurY, nOldY, nMovY);
MoveCursorAbs( nCurX, nCurY, eMode, bShift, false, true, bKeepSel );
@@ -1332,7 +1332,7 @@ void ScTabView::MoveCursorArea( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, bo
void ScTabView::MoveCursorEnd( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, bool bShift, bool bKeepSel )
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
SCCOL nCurX;
@@ -1344,7 +1344,7 @@ void ScTabView::MoveCursorEnd( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, boo
SCCOL nUsedX = 0;
SCROW nUsedY = 0;
if ( nMovX > 0 || nMovY > 0 )
- pDoc->GetPrintArea( nTab, nUsedX, nUsedY ); // get end
+ rDoc.GetPrintArea( nTab, nUsedX, nUsedY ); // get end
if (nMovX<0)
nNewX=0;
@@ -1362,7 +1362,7 @@ void ScTabView::MoveCursorEnd( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, boo
void ScTabView::MoveCursorScreen( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, bool bShift )
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
SCCOL nCurX;
@@ -1393,7 +1393,7 @@ void ScTabView::MoveCursorScreen( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode,
nNewY=nPosY+nAddY;
aViewData.SetOldCursor( nNewX,nNewY );
- pDoc->SkipOverlapped(nNewX, nNewY, nTab);
+ rDoc.SkipOverlapped(nNewX, nNewY, nTab);
MoveCursorAbs( nNewX, nNewY, eMode, bShift, false, true );
}
@@ -1432,11 +1432,11 @@ void ScTabView::MoveCursorEnter( bool bShift ) // bShift -> up/down
SCTAB nTab = aViewData.GetTabNo();
ScMarkData& rMark = aViewData.GetMarkData();
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
if (rMark.IsMarked() || rMark.IsMultiMarked())
{
- pDoc->GetNextPos( nNewX, nNewY, nTab, nMoveX, nMoveY, true, false, rMark );
+ rDoc.GetNextPos( nNewX, nNewY, nTab, nMoveX, nMoveY, true, false, rMark );
MoveCursorRel( nNewX - nCurX, nNewY - nCurY, SC_FOLLOW_LINE, false, true );
@@ -1448,7 +1448,7 @@ void ScTabView::MoveCursorEnter( bool bShift ) // bShift -> up/down
{
// After Tab and Enter back to the starting column again.
const SCCOL nTabStartCol = ((nMoveY != 0 && !nMoveX) ? aViewData.GetTabStartCol() : SC_TABSTART_NONE);
- pDoc->GetNextPos( nNewX, nNewY, nTab, nMoveX, nMoveY, false, true, rMark, nTabStartCol );
+ rDoc.GetNextPos( nNewX, nNewY, nTab, nMoveX, nMoveY, false, true, rMark, nTabStartCol );
MoveCursorRel( nNewX - nCurX, nNewY - nCurY, SC_FOLLOW_LINE, false);
}
@@ -1543,8 +1543,8 @@ void ScTabView::FindNextUnprot( bool bShift, bool bInSelection )
SCROW nNewY = nCurY;
SCTAB nTab = aViewData.GetTabNo();
- ScDocument* pDoc = aViewData.GetDocument();
- pDoc->GetNextPos( nNewX,nNewY, nTab, nMove,0, bMarked, true, rMark );
+ ScDocument& rDoc = aViewData.GetDocument();
+ rDoc.GetNextPos( nNewX,nNewY, nTab, nMove,0, bMarked, true, rMark );
SCCOL nTabCol = aViewData.GetTabStartCol();
if ( nTabCol == SC_TABSTART_NONE )
@@ -1577,10 +1577,10 @@ void ScTabView::MarkColumns()
}
SCTAB nTab = aViewData.GetTabNo();
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
DoneBlockMode();
InitBlockMode( nStartCol,0, nTab );
- MarkCursor( nEndCol, pDoc->MaxRow(), nTab );
+ MarkCursor( nEndCol, rDoc.MaxRow(), nTab );
SelectionChanged();
}
@@ -1605,17 +1605,17 @@ void ScTabView::MarkRows()
}
SCTAB nTab = aViewData.GetTabNo();
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
DoneBlockMode();
InitBlockMode( 0,nStartRow, nTab );
- MarkCursor( pDoc->MaxCol(), nEndRow, nTab );
+ MarkCursor( rDoc.MaxCol(), nEndRow, nTab );
SelectionChanged();
}
void ScTabView::MarkColumns(SCCOL nCol, sal_Int16 nModifier)
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCCOL nStartCol = nCol;
SCTAB nTab = aViewData.GetTabNo();
@@ -1624,7 +1624,7 @@ void ScTabView::MarkColumns(SCCOL nCol, sal_Int16 nModifier)
DoneBlockMode( nModifier != 0 );
InitBlockMode( nStartCol, 0, nTab, true, true);
- MarkCursor( nCol, pDoc->MaxRow(), nTab );
+ MarkCursor( nCol, rDoc.MaxRow(), nTab );
bMoveIsShift = false;
SetCursor( nCol, 0 );
SelectionChanged();
@@ -1632,7 +1632,7 @@ void ScTabView::MarkColumns(SCCOL nCol, sal_Int16 nModifier)
void ScTabView::MarkRows(SCROW nRow, sal_Int16 nModifier)
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCROW nStartRow = nRow;
SCTAB nTab = aViewData.GetTabNo();
@@ -1641,7 +1641,7 @@ void ScTabView::MarkRows(SCROW nRow, sal_Int16 nModifier)
DoneBlockMode( nModifier != 0 );
InitBlockMode( 0, nStartRow, nTab, true, false, true );
- MarkCursor( pDoc->MaxCol(), nRow, nTab );
+ MarkCursor( rDoc.MaxCol(), nRow, nTab );
bMoveIsShift = false;
SetCursor( 0, nRow );
SelectionChanged();
@@ -1649,14 +1649,14 @@ void ScTabView::MarkRows(SCROW nRow, sal_Int16 nModifier)
void ScTabView::MarkDataArea( bool bIncludeCursor )
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
SCCOL nStartCol = aViewData.GetCurX();
SCROW nStartRow = aViewData.GetCurY();
SCCOL nEndCol = nStartCol;
SCROW nEndRow = nStartRow;
- pDoc->GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, bIncludeCursor, false );
+ rDoc.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, bIncludeCursor, false );
HideAllCursors();
DoneBlockMode();
@@ -1669,10 +1669,10 @@ void ScTabView::MarkDataArea( bool bIncludeCursor )
void ScTabView::MarkMatrixFormula()
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
ScAddress aCursor( aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo() );
ScRange aMatrix;
- if ( pDoc->GetMatrixFormulaRange( aCursor, aMatrix ) )
+ if ( rDoc.GetMatrixFormulaRange( aCursor, aMatrix ) )
{
MarkRange( aMatrix, false ); // cursor is already within the range
}
@@ -1680,7 +1680,7 @@ void ScTabView::MarkMatrixFormula()
void ScTabView::MarkRange( const ScRange& rRange, bool bSetCursor, bool bContinue )
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCTAB nTab = rRange.aStart.Tab();
SetTabNo( nTab );
@@ -1690,8 +1690,8 @@ void ScTabView::MarkRange( const ScRange& rRange, bool bSetCursor, bool bContinu
{
SCCOL nAlignX = rRange.aStart.Col();
SCROW nAlignY = rRange.aStart.Row();
- bool bCol = ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == pDoc->MaxCol() ) && !aViewData.GetDocument()->IsInVBAMode();
- bool bRow = ( rRange.aStart.Row() == 0 && rRange.aEnd.Row() == pDoc->MaxRow() );
+ bool bCol = ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == rDoc.MaxCol() ) && !aViewData.GetDocument().IsInVBAMode();
+ bool bRow = ( rRange.aStart.Row() == 0 && rRange.aEnd.Row() == rDoc.MaxRow() );
if ( bCol )
nAlignX = aViewData.GetPosX(WhichH(aViewData.GetActivePart()));
if ( bRow )
@@ -1704,7 +1704,7 @@ void ScTabView::MarkRange( const ScRange& rRange, bool bSetCursor, bool bContinu
{
SCCOL nPosX = rRange.aStart.Col();
SCROW nPosY = rRange.aStart.Row();
- pDoc->SkipOverlapped(nPosX, nPosY, nTab);
+ rDoc.SkipOverlapped(nPosX, nPosY, nTab);
aViewData.ResetOldCursor();
SetCursor( nPosX, nPosY );
@@ -1750,14 +1750,14 @@ void ScTabView::SelectNextTab( short nDir, bool bExtendSelection )
return;
OSL_ENSURE( nDir==-1 || nDir==1, "SelectNextTab: invalid value");
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
if (nDir<0)
{
if (!nTab)
return;
--nTab;
- while (!pDoc->IsVisible(nTab))
+ while (!rDoc.IsVisible(nTab))
{
if (!nTab)
return;
@@ -1766,11 +1766,11 @@ void ScTabView::SelectNextTab( short nDir, bool bExtendSelection )
}
else
{
- SCTAB nCount = pDoc->GetTableCount();
+ SCTAB nCount = rDoc.GetTableCount();
++nTab;
if (nTab >= nCount)
return;
- while (!pDoc->IsVisible(nTab))
+ while (!rDoc.IsVisible(nTab))
{
++nTab;
if (nTab >= nCount)
@@ -1816,17 +1816,17 @@ void ScTabView::SetTabNo( SCTAB nTab, bool bNew, bool bExtendSelection, bool bSa
// not InputEnterHandler due to reference input
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
- pDoc->MakeTable( nTab );
+ rDoc.MakeTable( nTab );
// Update pending row heights before switching the sheet, so Reschedule from the progress bar
// doesn't paint the new sheet with old heights
aViewData.GetDocShell()->UpdatePendingRowHeights( nTab );
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
SCTAB nOldPos = nTab;
- while (!pDoc->IsVisible(nTab)) // search for next visible
+ while (!rDoc.IsVisible(nTab)) // search for next visible
{
bool bUp = (nTab>=nOldPos);
if (bUp)
@@ -1846,7 +1846,7 @@ void ScTabView::SetTabNo( SCTAB nTab, bool bNew, bool bExtendSelection, bool bSa
else
{
OSL_FAIL("no visible sheets");
- pDoc->SetVisible( 0, true );
+ rDoc.SetVisible( 0, true );
}
}
}
@@ -1878,7 +1878,7 @@ void ScTabView::SetTabNo( SCTAB nTab, bool bNew, bool bExtendSelection, bool bSa
bool bAllSelected = true;
for (SCTAB nSelTab = 0; nSelTab < nTabCount; ++nSelTab)
{
- if (!pDoc->IsVisible(nSelTab) || rMark.GetTableSelect(nSelTab))
+ if (!rDoc.IsVisible(nSelTab) || rMark.GetTableSelect(nSelTab))
{
if (nTab == nSelTab)
// This tab is already in selection. Keep the current
@@ -2274,7 +2274,7 @@ void ScTabView::KillEditView( bool bNoPaint )
void ScTabView::UpdateFormulas(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow)
{
- if ( aViewData.GetDocument()->IsAutoCalcShellDisabled() )
+ if ( aViewData.GetDocument().IsAutoCalcShellDisabled() )
return;
for (sal_uInt16 i = 0; i < 4; i++)
@@ -2303,7 +2303,7 @@ void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO
SCCOL nCol2;
SCROW nRow2;
bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
PutInOrder( nStartCol, nEndCol );
PutInOrder( nStartRow, nEndRow );
@@ -2366,7 +2366,7 @@ void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO
if (bOut)
continue;
- bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
+ bool bLayoutRTL = aViewData.GetDocument().IsLayoutRTL( aViewData.GetTabNo() );
long nLayoutSign = bLayoutRTL ? -1 : 1;
Point aStart = aViewData.GetScrPos( nCol1, nRow1, static_cast<ScSplitPos>(i) );
@@ -2393,7 +2393,7 @@ void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO
aEnd.AdjustY( -1 );
// #i85232# include area below cells (could be done in GetScrPos?)
- if ( eMode == ScUpdateMode::All && nRow2 >= pDoc->MaxRow() && !bIsTiledRendering )
+ if ( eMode == ScUpdateMode::All && nRow2 >= rDoc.MaxRow() && !bIsTiledRendering )
aEnd.setY( pGridWin[i]->GetOutputSizePixel().Height() );
aStart.AdjustX( -nLayoutSign ); // include change marks
@@ -2429,7 +2429,7 @@ void ScTabView::PaintRangeFinderEntry (const ScRangeFindData* pData, const SCTAB
aRef.PutInOrder(); // PutInOrder for the queries below
if ( aRef.aStart == aRef.aEnd ) //! ignore sheet?
- aViewData.GetDocument()->ExtendMerge(aRef);
+ aViewData.GetDocument().ExtendMerge(aRef);
if (aRef.aStart.Tab() < nTab || aRef.aEnd.Tab() > nTab)
return;
@@ -2444,28 +2444,28 @@ void ScTabView::PaintRangeFinderEntry (const ScRangeFindData* pData, const SCTAB
bool bHiddenEdge = false;
SCROW nTmp;
- ScDocument* pDoc = aViewData.GetDocument();
- while ( nCol1 > 0 && pDoc->ColHidden(nCol1, nTab) )
+ ScDocument& rDoc = aViewData.GetDocument();
+ while ( nCol1 > 0 && rDoc.ColHidden(nCol1, nTab) )
{
--nCol1;
bHiddenEdge = true;
}
- while ( nCol2 < pDoc->MaxCol() && pDoc->ColHidden(nCol2, nTab) )
+ while ( nCol2 < rDoc.MaxCol() && rDoc.ColHidden(nCol2, nTab) )
{
++nCol2;
bHiddenEdge = true;
}
- nTmp = pDoc->LastVisibleRow(0, nRow1, nTab);
- if (!pDoc->ValidRow(nTmp))
+ nTmp = rDoc.LastVisibleRow(0, nRow1, nTab);
+ if (!rDoc.ValidRow(nTmp))
nTmp = 0;
if (nTmp < nRow1)
{
nRow1 = nTmp;
bHiddenEdge = true;
}
- nTmp = pDoc->FirstVisibleRow(nRow2, pDoc->MaxRow(), nTab);
- if (!pDoc->ValidRow(nTmp))
- nTmp = pDoc->MaxRow();
+ nTmp = rDoc.FirstVisibleRow(nRow2, rDoc.MaxRow(), nTab);
+ if (!rDoc.ValidRow(nTmp))
+ nTmp = rDoc.MaxRow();
if (nTmp > nRow2)
{
nRow2 = nTmp;
@@ -2667,8 +2667,8 @@ void ScTabView::PaintTopArea( SCCOL nStartCol, SCCOL nEndCol )
if (nStartCol>0)
--nStartCol; //! general ?
- ScDocument* pDoc = aViewData.GetDocument();
- bool bLayoutRTL = pDoc->IsLayoutRTL( aViewData.GetTabNo() );
+ ScDocument& rDoc = aViewData.GetDocument();
+ bool bLayoutRTL = rDoc.IsLayoutRTL( aViewData.GetTabNo() );
long nLayoutSign = bLayoutRTL ? -1 : 1;
for (sal_uInt16 i = 0; i < 2; i++)
@@ -2679,7 +2679,7 @@ void ScTabView::PaintTopArea( SCCOL nStartCol, SCCOL nEndCol )
Size aWinSize = pColBar[eWhich]->GetSizePixel();
long nStartX = aViewData.GetScrPos( nStartCol, 0, eWhich ).X();
long nEndX;
- if (nEndCol >= pDoc->MaxCol())
+ if (nEndCol >= rDoc.MaxCol())
nEndX = nStartX + (bLayoutRTL ? 0 : ( aWinSize.Width()-1 ));
else
nEndX = aViewData.GetScrPos( nEndCol+1, 0, eWhich ).X() - nLayoutSign;
@@ -2723,7 +2723,7 @@ void ScTabView::PaintLeftArea( SCROW nStartRow, SCROW nEndRow )
if (nStartRow>0)
--nStartRow;
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
for (sal_uInt16 i = 0; i < 2; i++)
{
ScVSplitPos eWhich = ScVSplitPos(i);
@@ -2732,7 +2732,7 @@ void ScTabView::PaintLeftArea( SCROW nStartRow, SCROW nEndRow )
Size aWinSize = pRowBar[eWhich]->GetSizePixel();
long nStartY = aViewData.GetScrPos( 0, nStartRow, eWhich ).Y();
long nEndY;
- if (nEndRow >= pDoc->MaxRow())
+ if (nEndRow >= rDoc.MaxRow())
nEndY = nStartY + aWinSize.Height() - 1;
else
nEndY = aViewData.GetScrPos( 0, nEndRow+1, eWhich ).Y() - 1;
@@ -2747,11 +2747,11 @@ void ScTabView::PaintLeftArea( SCROW nStartRow, SCROW nEndRow )
bool ScTabView::PaintExtras()
{
bool bRet = false;
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
- if (!pDoc->HasTable(nTab)) // sheet is deleted?
+ if (!rDoc.HasTable(nTab)) // sheet is deleted?
{
- SCTAB nCount = pDoc->GetTableCount();
+ SCTAB nCount = rDoc.GetTableCount();
aViewData.SetTabNo(nCount-1);
bRet = true;
}
diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index 960f47752479..409726a867c4 100644
--- a/sc/source/ui/view/tabview4.cxx
+++ b/sc/source/ui/view/tabview4.cxx
@@ -124,13 +124,13 @@ void ScTabView::StopRefMode()
if ( aViewData.GetTabNo() >= aViewData.GetRefStartZ() &&
aViewData.GetTabNo() <= aViewData.GetRefEndZ() )
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCCOL nStartX = aViewData.GetRefStartX();
SCROW nStartY = aViewData.GetRefStartY();
SCCOL nEndX = aViewData.GetRefEndX();
SCROW nEndY = aViewData.GetRefEndY();
if ( nStartX == nEndX && nStartY == nEndY )
- pDoc->ExtendMerge( nStartX, nStartY, nEndX, nEndY, aViewData.GetTabNo() );
+ rDoc.ExtendMerge( nStartX, nStartY, nEndX, nEndY, aViewData.GetTabNo() );
PaintArea( nStartX,nStartY,nEndX,nEndY, ScUpdateMode::Marks );
}
@@ -160,7 +160,7 @@ void ScTabView::StopRefMode()
void ScTabView::DoneRefMode( bool bContinue )
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
if ( aViewData.GetRefType() == SC_REFTYPE_REF && bContinue )
SC_MOD()->AddRefEntry();
@@ -179,7 +179,7 @@ void ScTabView::DoneRefMode( bool bContinue )
SCCOL nEndX = aViewData.GetRefEndX();
SCROW nEndY = aViewData.GetRefEndY();
if ( nStartX == nEndX && nStartY == nEndY )
- pDoc->ExtendMerge( nStartX, nStartY, nEndX, nEndY, aViewData.GetTabNo() );
+ rDoc.ExtendMerge( nStartX, nStartY, nEndX, nEndY, aViewData.GetTabNo() );
PaintArea( nStartX,nStartY,nEndX,nEndY, ScUpdateMode::Marks );
}
@@ -187,7 +187,7 @@ void ScTabView::DoneRefMode( bool bContinue )
void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ )
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
if (!aViewData.IsRefMode())
{
@@ -212,7 +212,7 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ )
SCCOL nEndX = aViewData.GetRefEndX();
SCROW nEndY = aViewData.GetRefEndY();
if ( nStartX == nEndX && nStartY == nEndY )
- pDoc->ExtendMerge( nStartX, nStartY, nEndX, nEndY, nTab );
+ rDoc.ExtendMerge( nStartX, nStartY, nEndX, nEndY, nTab );
ScUpdateRect aRect( nStartX, nStartY, nEndX, nEndY );
aViewData.SetRefEnd( nCurX, nCurY, nCurZ );
@@ -222,7 +222,7 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ )
nEndX = aViewData.GetRefEndX();
nEndY = aViewData.GetRefEndY();
if ( nStartX == nEndX && nStartY == nEndY )
- pDoc->ExtendMerge( nStartX, nStartY, nEndX, nEndY, nTab );
+ rDoc.ExtendMerge( nStartX, nStartY, nEndX, nEndY, nTab );
aRect.SetNew( nStartX, nStartY, nEndX, nEndY );
ScRefType eType = aViewData.GetRefType();
@@ -231,14 +231,14 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ )
ScRange aRef(
aViewData.GetRefStartX(), aViewData.GetRefStartY(), aViewData.GetRefStartZ(),
aViewData.GetRefEndX(), aViewData.GetRefEndY(), aViewData.GetRefEndZ() );
- SC_MOD()->SetReference( aRef, *pDoc, &rMark );
+ SC_MOD()->SetReference( aRef, rDoc, &rMark );
ShowRefTip();
}
else if ( eType == SC_REFTYPE_EMBED_LT || eType == SC_REFTYPE_EMBED_RB )
{
PutInOrder(nStartX,nEndX);
PutInOrder(nStartY,nEndY);
- pDoc->SetEmbedded( ScRange(nStartX,nStartY,nTab, nEndX,nEndY,nTab) );
+ rDoc.SetEmbedded( ScRange(nStartX,nStartY,nTab, nEndX,nEndY,nTab) );
ScDocShell* pDocSh = aViewData.GetDocShell();
pDocSh->UpdateOle( &aViewData, true );
pDocSh->SetDocumentModified();
@@ -283,7 +283,7 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ )
else if ( aViewData.GetDelMark( aDelRange ) )
aHelpStr = ScResId( STR_QUICKHELP_DELETE );
else if ( nEndX != aMarkRange.aEnd.Col() || nEndY != aMarkRange.aEnd.Row() )
- aHelpStr = pDoc->GetAutoFillPreview( aMarkRange, nEndX, nEndY );
+ aHelpStr = rDoc.GetAutoFillPreview( aMarkRange, nEndX, nEndY );
if (!aHelpStr.getLength())
return;
@@ -310,7 +310,7 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ )
void ScTabView::InitRefMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScRefType eType )
{
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
ScMarkData& rMark = aViewData.GetMarkData();
if (aViewData.IsRefMode())
return;
@@ -325,14 +325,14 @@ void ScTabView::InitRefMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScRefType eT
SCROW nStartY = nCurY;
SCCOL nEndX = nCurX;
SCROW nEndY = nCurY;
- pDoc->ExtendMerge( nStartX, nStartY, nEndX, nEndY, aViewData.GetTabNo() );
+ rDoc.ExtendMerge( nStartX, nStartY, nEndX, nEndY, aViewData.GetTabNo() );
//! draw only markings over content!
PaintArea( nStartX,nStartY,nEndX,nEndY, ScUpdateMode::Marks );
// SetReference without Merge-Adjustment
ScRange aRef( nCurX,nCurY,nCurZ, nCurX,nCurY,nCurZ );
- SC_MOD()->SetReference( aRef, *pDoc, &rMark );
+ SC_MOD()->SetReference( aRef, rDoc, &rMark );
}
ScInputHandler* pInputHandler = SC_MOD()->GetInputHdl();
@@ -396,12 +396,12 @@ void ScTabView::UpdateScrollBars( HeaderType eHeaderType )
long nDiff;
bool bTop = ( aViewData.GetVSplitMode() != SC_SPLIT_NONE );
bool bRight = ( aViewData.GetHSplitMode() != SC_SPLIT_NONE );
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
- bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
SCCOL nUsedX;
SCROW nUsedY;
- pDoc->GetTableArea( nTab, nUsedX, nUsedY ); //! cached !!!!!!!!!!!!!!!
+ rDoc.GetTableArea( nTab, nUsedX, nUsedY ); //! cached !!!!!!!!!!!!!!!
SCCOL nVisXL = 0;
SCCOL nVisXR = 0;
@@ -416,24 +416,24 @@ void ScTabView::UpdateScrollBars( HeaderType eHeaderType )
nStartY = aViewData.GetFixPosY();
nVisXL = aViewData.VisibleCellsX( SC_SPLIT_LEFT );
- long nMaxXL = lcl_GetScrollRange( nUsedX, aViewData.GetPosX(SC_SPLIT_LEFT), nVisXL, pDoc->MaxCol(), 0 );
+ long nMaxXL = lcl_GetScrollRange( nUsedX, aViewData.GetPosX(SC_SPLIT_LEFT), nVisXL, rDoc.MaxCol(), 0 );
SetScrollBar( *aHScrollLeft, nMaxXL, nVisXL, aViewData.GetPosX( SC_SPLIT_LEFT ), bLayoutRTL );
nVisYB = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM );
- long nMaxYB = lcl_GetScrollRange( nUsedY, aViewData.GetPosY(SC_SPLIT_BOTTOM), nVisYB, pDoc->MaxRow(), nStartY );
+ long nMaxYB = lcl_GetScrollRange( nUsedY, aViewData.GetPosY(SC_SPLIT_BOTTOM), nVisYB, rDoc.MaxRow(), nStartY );
SetScrollBar( *aVScrollBottom, nMaxYB, nVisYB, aViewData.GetPosY( SC_SPLIT_BOTTOM ) - nStartY, bLayoutRTL );
if (bRight)
{
nVisXR = aViewData.VisibleCellsX( SC_SPLIT_RIGHT );
- long nMaxXR = lcl_GetScrollRange( nUsedX, aViewData.GetPosX(SC_SPLIT_RIGHT), nVisXR, pDoc->MaxCol(), nStartX );
+ long nMaxXR = lcl_GetScrollRange( nUsedX, aViewData.GetPosX(SC_SPLIT_RIGHT), nVisXR, rDoc.MaxCol(), nStartX );
SetScrollBar( *aHScrollRight, nMaxXR, nVisXR, aViewData.GetPosX( SC_SPLIT_RIGHT ) - nStartX, bLayoutRTL );
}
if (bTop)
{
nVisYT = aViewData.VisibleCellsY( SC_SPLIT_TOP );
- long nMaxYT = lcl_GetScrollRange( nUsedY, aViewData.GetPosY(SC_SPLIT_TOP), nVisYT, pDoc->MaxRow(), 0 );
+ long nMaxYT = lcl_GetScrollRange( nUsedY, aViewData.GetPosY(SC_SPLIT_TOP), nVisYT, rDoc.MaxRow(), 0 );
SetScrollBar( *aVScrollTop, nMaxYT, nVisYT, aViewData.GetPosY( SC_SPLIT_TOP ), bLayoutRTL );
}
@@ -503,8 +503,8 @@ void ScTabView::InterpretVisible()
// make sure all visible cells are interpreted,
// so the next paint will not execute a macro function
- ScDocument* pDoc = aViewData.GetDocument();
- if ( !pDoc->GetAutoCalc() )
+ ScDocument& rDoc = aViewData.GetDocument();
+ if ( !rDoc.GetAutoCalc() )
return;
SCTAB nTab = aViewData.GetTabNo();
@@ -518,12 +518,12 @@ void ScTabView::InterpretVisible()
ScHSplitPos eHWhich = WhichH( ScSplitPos(i) );
ScVSplitPos eVWhich = WhichV( ScSplitPos(i) );
- SCCOL nX1 = pDoc->SanitizeCol( aViewData.GetPosX( eHWhich ));
- SCROW nY1 = pDoc->SanitizeRow( aViewData.GetPosY( eVWhich ));
- SCCOL nX2 = pDoc->SanitizeCol( nX1 + aViewData.VisibleCellsX( eHWhich ));
- SCROW nY2 = pDoc->SanitizeRow( nY1 + aViewData.VisibleCellsY( eVWhich ));
+ SCCOL nX1 = rDoc.SanitizeCol( aViewData.GetPosX( eHWhich ));
+ SCROW nY1 = rDoc.SanitizeRow( aViewData.GetPosY( eVWhich ));
+ SCCOL nX2 = rDoc.SanitizeCol( nX1 + aViewData.VisibleCellsX( eHWhich ));
+ SCROW nY2 = rDoc.SanitizeRow( nY1 + aViewData.VisibleCellsY( eVWhich ));
- pDoc->InterpretDirtyCells(ScRange(nX1, nY1, nTab, nX2, nY2, nTab));
+ rDoc.InterpretDirtyCells(ScRange(nX1, nY1, nTab, nX2, nY2, nTab));
}
}
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 5966443db5d8..8a3b889a3ccc 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -106,10 +106,10 @@ void ScTabView::Init()
explicitly because the parent frame window is already RTL disabled. */
pTabControl->EnableRTL( AllSettings::GetLayoutRTL() );
- InitScrollBar( *aHScrollLeft, aViewData.GetDocument()->MaxCol()+1 );
- InitScrollBar( *aHScrollRight, aViewData.GetDocument()->MaxCol()+1 );
- InitScrollBar( *aVScrollTop, aViewData.GetDocument()->MaxRow()+1 );
- InitScrollBar( *aVScrollBottom, aViewData.GetDocument()->MaxRow()+1 );
+ InitScrollBar( *aHScrollLeft, aViewData.GetDocument().MaxCol()+1 );
+ InitScrollBar( *aHScrollRight, aViewData.GetDocument().MaxCol()+1 );
+ InitScrollBar( *aVScrollTop, aViewData.GetDocument().MaxRow()+1 );
+ InitScrollBar( *aVScrollBottom, aViewData.GetDocument().MaxRow()+1 );
/* #i97900# scrollbars remain in correct RTL mode, needed mirroring etc.
is now handled correctly at the respective places. */
@@ -225,7 +225,7 @@ void ScTabView::MakeDrawView( TriState nForceDesignMode )
if (pDrawView)
return;
- ScDrawLayer* pLayer = aViewData.GetDocument()->GetDrawLayer();
+ ScDrawLayer* pLayer = aViewData.GetDocument().GetDrawLayer();
OSL_ENSURE(pLayer, "Where is the Draw Layer ??");
sal_uInt16 i;
@@ -320,7 +320,7 @@ void ScTabView::TabChanged( bool bSameTabButMoved )
ScDocShell* pDocSh = GetViewData().GetDocShell();
ScModelObj* pModelObj = pDocSh ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocSh->GetModel()) : nullptr;
- if (!(pModelObj && GetViewData().GetDocument()))
+ if (!pModelObj)
return;
Size aDocSize = pModelObj->getDocumentSize();
@@ -345,7 +345,7 @@ void ScTabView::UpdateLayerLocks()
SCTAB nTab = aViewData.GetTabNo();
bool bEx = aViewData.GetViewShell()->IsDrawSelMode();
- bool bProt = aViewData.GetDocument()->IsTabProtected( nTab ) ||
+ bool bProt = aViewData.GetDocument().IsTabProtected( nTab ) ||
aViewData.GetSfxDocShell()->IsReadOnly();
bool bShared = aViewData.GetDocShell()->IsDocShared();
@@ -502,10 +502,10 @@ void ScTabView::DrawEnableAnim(bool bSet)
pDrawView->SetAnimationEnabled();
// animated GIFs must be restarted:
- ScDocument* pDoc = aViewData.GetDocument();
+ ScDocument& rDoc = aViewData.GetDocument();
for (i=0; i<4; i++)
if ( pGridWin[i] && pGridWin[i]->IsVisible() )
- pDoc->StartAnimations( aViewData.GetTabNo() );
+ rDoc.StartAnimations( aViewData.GetTabNo() );
}
}
else
@@ -572,8 +572,8 @@ void ScTabView::MakeVisible( const tools::Rectangle& rHMMRect )
if (!(nScrollX || nScrollY))
return;
- ScDocument* pDoc = aViewData.GetDocument();
- if ( pDoc->IsNegativePage( nTab ) )
+ ScDocument& rDoc = aViewData.GetDocument();
+ if ( rDoc.IsNegativePage( nTab ) )
nScrollX = -nScrollX;
double nPPTX = aViewData.GetPPTX();
@@ -585,9 +585,9 @@ void ScTabView::MakeVisible( const tools::Rectangle& rHMMRect )
long nLinesX=0, nLinesY=0; // columns/rows - scroll at least nScrollX/Y
if (nScrollX > 0)
- while (nScrollX > 0 && nPosX < pDoc->MaxCol())
+ while (nScrollX > 0 && nPosX < rDoc.MaxCol())
{
- nScrollX -= static_cast<long>( pDoc->GetColWidth(nPosX, nTab) * nPPTX );
+ nScrollX -= static_cast<long>( rDoc.GetColWidth(nPosX, nTab) * nPPTX );
++nPosX;
++nLinesX;
}
@@ -595,14 +595,14 @@ void ScTabView::MakeVisible( const tools::Rectangle& rHMMRect )
while (nScrollX < 0 && nPosX > 0)
{
--nPosX;
- nScrollX += static_cast<long>( pDoc->GetColWidth(nPosX, nTab) * nPPTX );
+ nScrollX += static_cast<long>( rDoc.GetColWidth(nPosX, nTab) * nPPTX );
--nLinesX;
}
if (nScrollY > 0)
- while (nScrollY > 0 && nPosY < pDoc->MaxRow())
+ while (nScrollY > 0 && nPosY < rDoc.MaxRow())
{
- nScrollY -= static_cast<long>( pDoc->GetRowHeight(nPosY, nTab) * nPPTY );
+ nScrollY -= static_cast<long>( rDoc.GetRowHeight(nPosY, nTab) * nPPTY );
++nPosY;
++nLinesY;
}
@@ -610,7 +610,7 @@ void ScTabView::MakeVisible( const tools::Rectangle& rHMMRect )
while (nScrollY < 0 && nPosY > 0)
{
--nPosY;
- nScrollY += static_cast<long>( pDoc->GetRowHeight(nPosY, nTab) * nPPTY );
+ nScrollY += static_cast<long>( rDoc.GetRowHeight(nPosY, nTab) * nPPTY );
--nLinesY;
}
diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx
index 38a16b0f1c74..583e25c6af11 100644
--- a/sc/source/ui/view/tabvwsh.cxx
+++ b/sc/source/ui/view/tabvwsh.cxx
@@ -105,8 +105,8 @@ SFX_IMPL_NAMED_VIEWFACTORY( ScTabViewShell, "Default" )
OUString ScTabViewShell::GetFormula(const ScAddress& rAddress)
{
OUString sFormula;
- ScDocument* pDoc = GetViewData().GetDocument();
- ScRefCellValue aCell(*pDoc, rAddress);
+ ScDocument& rDoc = GetViewData().GetDocument();
+ ScRefCellValue aCell(rDoc, rAddress);
if (!aCell.isEmpty() && aCell.meType == CELLTYPE_FORMULA)
{
aCell.mpFormula->GetFormula( sFormula);
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 0beaa6af37f0..86961c989cc5 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -320,11 +320,11 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
bool bFound = false;
ScViewData& rViewData = GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
ScMarkData& rMark = rViewData.GetMarkData();
ScRange aScRange;
ScAddress aScAddress;
- ScRefFlagsAndType aResult = lcl_ParseRangeOrAddress(aScRange, aScAddress, aAddress, pDoc);
+ ScRefFlagsAndType aResult = lcl_ParseRangeOrAddress(aScRange, aScAddress, aAddress, &rDoc);
ScRefFlags nResult = aResult.nResult;
SCTAB nTab = rViewData.GetTabNo();
bool bMark = true;
@@ -367,9 +367,9 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
// Is it a named area (first named ranges then database ranges)?
else
{
- formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention();
- if( ScRangeUtil::MakeRangeFromName( aAddress, *pDoc, nTab, aScRange, RUTL_NAMES, eConv ) ||
- ScRangeUtil::MakeRangeFromName( aAddress, *pDoc, nTab, aScRange, RUTL_DBASE, eConv ) )
+ formula::FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention();
+ if( ScRangeUtil::MakeRangeFromName( aAddress, rDoc, nTab, aScRange, RUTL_NAMES, eConv ) ||
+ ScRangeUtil::MakeRangeFromName( aAddress, rDoc, nTab, aScRange, RUTL_DBASE, eConv ) )
{
nResult |= ScRefFlags::VALID;
if( aScRange.aStart.Tab() != nTab )
@@ -383,7 +383,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
if ( !(nResult & ScRefFlags::VALID) && comphelper::string::isdigitAsciiString(aAddress) )
{
sal_Int32 nNumeric = aAddress.toInt32();
- if ( nNumeric > 0 && nNumeric <= pDoc->MaxRow()+1 )
+ if ( nNumeric > 0 && nNumeric <= rDoc.MaxRow()+1 )
{
// one-based row numbers
@@ -396,7 +396,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
}
}
- if ( !pDoc->ValidRow(aScRange.aStart.Row()) || !pDoc->ValidRow(aScRange.aEnd.Row()) )
+ if ( !rDoc.ValidRow(aScRange.aStart.Row()) || !rDoc.ValidRow(aScRange.aEnd.Row()) )
nResult = ScRefFlags::ZERO;
// we have found something
@@ -438,7 +438,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
// and set cursor
// consider merged cells:
- pDoc->SkipOverlapped(nCol, nRow, nTab);
+ rDoc.SkipOverlapped(nCol, nRow, nTab);
// navigator calls are not part of the API!!!
@@ -475,7 +475,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
// if it is a sheet name, then switch (for Navigator/URL)
SCTAB nNameTab;
- if ( pDoc->GetTable( aAddress, nNameTab ) )
+ if ( rDoc.GetTable( aAddress, nNameTab ) )
{
bFound = true;
if ( nNameTab != nTab )
@@ -508,8 +508,8 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
{
// sheet for basic is one-based
SCTAB nTab = static_cast<const SfxUInt16Item&>(pReqArgs->Get(nSlot)).GetValue() - 1;
- ScDocument* pDoc = GetViewData().GetDocument();
- if ( nTab < pDoc->GetTableCount() )
+ ScDocument& rDoc = GetViewData().GetDocument();
+ if ( nTab < rDoc.GetTableCount() )
{
SetTabNo( nTab );
rBindings.Update( nSlot );
@@ -835,7 +835,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
case SID_SELECT_TABLES:
{
ScViewData& rViewData = GetViewData();
- ScDocument& rDoc = *rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
ScMarkData& rMark = rViewData.GetMarkData();
SCTAB nTabCount = rDoc.GetTableCount();
SCTAB nTab;
@@ -1098,20 +1098,20 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
case FID_PROTECT_DOC:
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
if( pReqArgs )
{
const SfxPoolItem* pItem;
if( pReqArgs->HasItem( FID_PROTECT_DOC, &pItem ) &&
- static_cast<const SfxBoolItem*>(pItem)->GetValue() == pDoc->IsDocProtected() )
+ static_cast<const SfxBoolItem*>(pItem)->GetValue() == rDoc.IsDocProtected() )
{
rReq.Ignore();
break;
}
}
- ScDocProtection* pProtect = pDoc->GetDocProtection();
+ ScDocProtection* pProtect = rDoc.GetDocProtection();
if (pProtect && pProtect->isProtected())
{
bool bCancel = false;
@@ -1165,9 +1165,9 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
case FID_PROTECT_TABLE:
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
SCTAB nTab = GetViewData().GetTabNo();
- bool bOldProtection = pDoc->IsTabProtected(nTab);
+ bool bOldProtection = rDoc.IsTabProtected(nTab);
if( pReqArgs )
{
@@ -1186,7 +1186,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
{
// Unprotect a protected sheet.
- ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
if (pProtect && pProtect->isProtectedWithPass())
{
OUString aText( ScResId(SCSTR_PASSWORDOPT) );
@@ -1218,7 +1218,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
ScTableProtectionDlg aDlg(GetFrameWeld());
- ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
+ ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
if (pProtect)
aDlg.SetDialogData(*pProtect);
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 8f8036b19cfb..13a50fe07048 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -157,7 +157,7 @@ void ScTabViewShell::Activate(bool bMDI)
// bridge, it's done in ImplSetReallyVisible), there are problems if Window::Show
// is called during the ViewShell ctor and reschedules asynchronous calls
// (for example from the FmFormShell ctor).
- ScExtDocOptions* pExtOpt = GetViewData().GetDocument()->GetExtDocOptions();
+ ScExtDocOptions* pExtOpt = GetViewData().GetDocument().GetExtDocOptions();
if ( pExtOpt && pExtOpt->IsChanged() )
{
GetViewData().ReadExtOptions(*pExtOpt); // Excel view settings
@@ -213,9 +213,9 @@ void ScTabViewShell::Deactivate(bool bMDI)
{
HideTip();
- ScDocument* pDoc=GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
- ScChangeTrack* pChanges=pDoc->GetChangeTrack();
+ ScChangeTrack* pChanges = rDoc.GetChangeTrack();
if(pChanges!=nullptr)
{
@@ -418,14 +418,14 @@ void ScTabViewShell::QueryObjAreaPixel( tools::Rectangle& rRect ) const
Size aLogicSize = pWin->PixelToLogic( aPixelSize );
const ScViewData& rViewData = GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
ScSplitPos ePos = rViewData.GetActivePart();
SCCOL nCol = rViewData.GetPosX(WhichH(ePos));
SCROW nRow = rViewData.GetPosY(WhichV(ePos));
SCTAB nTab = rViewData.GetTabNo();
- bool bNegativePage = pDoc->IsNegativePage( nTab );
+ bool bNegativePage = rDoc.IsNegativePage( nTab );
- tools::Rectangle aLogicRect = pDoc->GetMMRect( nCol, nRow, nCol, nRow, nTab );
+ tools::Rectangle aLogicRect = rDoc.GetMMRect( nCol, nRow, nCol, nRow, nTab );
if ( bNegativePage )
{
// use right edge of aLogicRect, and aLogicSize
@@ -1184,9 +1184,8 @@ bool ScTabViewShell::TabKeyInput(const KeyEvent& rKEvt)
if (bHideCursor)
HideAllCursors();
- ScDocument* pDoc = GetViewData().GetDocument();
- if ( pDoc )
- pDoc->KeyInput(); // TimerDelays etc.
+ ScDocument& rDoc = GetViewData().GetDocument();
+ rDoc.KeyInput(); // TimerDelays etc.
if( bInPlace )
{
diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx
index f222d3aa075e..b3101b49487e 100644
--- a/sc/source/ui/view/tabvwsh5.cxx
+++ b/sc/source/ui/view/tabvwsh5.cxx
@@ -189,9 +189,9 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
break;
}
- ScDocument* pDoc = GetViewData().GetDocument();
- if ( nNewTab >= pDoc->GetTableCount() )
- nNewTab = pDoc->GetTableCount() - 1;
+ ScDocument& rDoc = GetViewData().GetDocument();
+ if ( nNewTab >= rDoc.GetTableCount() )
+ nNewTab = rDoc.GetTableCount() - 1;
bool bForce = !bStayOnActiveTab;
SetTabNo( nNewTab, bForce, false, bStayOnActiveTab );
@@ -241,8 +241,8 @@ void ScTabViewShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
case SfxHintId::DocChanged:
{
- ScDocument* pDoc = GetViewData().GetDocument();
- if (!pDoc->HasTable( GetViewData().GetTabNo() ))
+ ScDocument& rDoc = GetViewData().GetDocument();
+ if (!rDoc.HasTable( GetViewData().GetTabNo() ))
{
SetTabNo(0);
}
diff --git a/sc/source/ui/view/tabvwsh8.cxx b/sc/source/ui/view/tabvwsh8.cxx
index c0b8f1a5863b..664f0d1180d9 100644
--- a/sc/source/ui/view/tabvwsh8.cxx
+++ b/sc/source/ui/view/tabvwsh8.cxx
@@ -41,11 +41,11 @@ bool ScTabViewShell::HasSelection( bool bText ) const
if ( bText )
{
// Content contained: Count2 >= 1
- ScDocument* pDoc = pData->GetDocument();
+ ScDocument& rDoc = pData->GetDocument();
ScMarkData& rMark = pData->GetMarkData();
ScAddress aCursor( pData->GetCurX(), pData->GetCurY(), pData->GetTabNo() );
double fVal = 0.0;
- if ( pDoc->GetSelectionFunction( SUBTOTAL_FUNC_CNT2, aCursor, rMark, fVal ) )
+ if ( rDoc.GetSelectionFunction( SUBTOTAL_FUNC_CNT2, aCursor, rMark, fVal ) )
bHas = ( fVal > 0.5 );
}
else
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 696f65839c73..3a1e19672f97 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -106,7 +106,7 @@ bool ScTabViewShell::GetFunction( OUString& rFuncStr, FormulaError nErrCode )
}
if (pGlobStrId)
{
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
SCCOL nPosX = rViewData.GetCurX();
SCROW nPosY = rViewData.GetCurY();
SCTAB nTab = rViewData.GetTabNo();
@@ -115,19 +115,19 @@ bool ScTabViewShell::GetFunction( OUString& rFuncStr, FormulaError nErrCode )
ScAddress aCursor( nPosX, nPosY, nTab );
double nVal;
- if ( pDoc->GetSelectionFunction( eFunc, aCursor, rMark, nVal ) )
+ if ( rDoc.GetSelectionFunction( eFunc, aCursor, rMark, nVal ) )
{
if ( nVal == 0.0 )
aStr += "0";
else
{
// Number in the standard format, the other on the cursor position
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+ SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
sal_uInt32 nNumFmt = 0;
if ( eFunc != SUBTOTAL_FUNC_CNT && eFunc != SUBTOTAL_FUNC_CNT2 && eFunc != SUBTOTAL_FUNC_SELECTION_COUNT)
{
// number format from attributes or formula
- pDoc->GetNumberFormat( nPosX, nPosY, nTab, nNumFmt );
+ rDoc.GetNumberFormat( nPosX, nPosY, nTab, nNumFmt );
}
OUString aValStr;
@@ -159,7 +159,7 @@ bool ScTabViewShell::GetFunction( OUString& rFuncStr, FormulaError nErrCode )
void ScTabViewShell::GetState( SfxItemSet& rSet )
{
ScViewData& rViewData = GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
ScDocShell* pDocShell = rViewData.GetDocShell();
ScMarkData& rMark = rViewData.GetMarkData();
SCCOL nPosX = rViewData.GetCurX();
@@ -203,7 +203,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
{
rSet.DisableItem( nWhich );
}
- else if (pDoc->IsPrintEntireSheet(nTab))
+ else if (rDoc.IsPrintEntireSheet(nTab))
rSet.DisableItem(nWhich);
break;
@@ -236,7 +236,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
case SID_CURRENTCELL:
{
ScAddress aScAddress( GetViewData().GetCurX(), GetViewData().GetCurY(), 0 );
- OUString aAddr(aScAddress.Format(ScRefFlags::ADDR_ABS, nullptr, pDoc->GetAddressConvention()));
+ OUString aAddr(aScAddress.Format(ScRefFlags::ADDR_ABS, nullptr, rDoc.GetAddressConvention()));
SfxStringItem aPosItem( SID_CURRENTCELL, aAddr );
rSet.Put( aPosItem );
@@ -267,7 +267,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
break;
case FID_DEL_MANUALBREAKS:
- if (!pDoc->HasManualBreaks(nTab))
+ if (!rDoc.HasManualBreaks(nTab))
rSet.DisableItem( nWhich );
break;
@@ -275,8 +275,8 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
{
// disable if already set to default
- OUString aStyleName = pDoc->GetPageStyle( nTab );
- ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ OUString aStyleName = rDoc.GetPageStyle( nTab );
+ ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aStyleName,
SfxStyleFamily::Page );
OSL_ENSURE( pStyleSheet, "PageStyle not found" );
@@ -369,7 +369,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
}
else
{
- rSet.Put( SfxBoolItem( nWhich, pDoc->IsDocProtected() ) );
+ rSet.Put( SfxBoolItem( nWhich, rDoc.IsDocProtected() ) );
}
}
break;
@@ -382,14 +382,14 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
}
else
{
- rSet.Put( SfxBoolItem( nWhich, pDoc->IsTabProtected( nTab ) ) );
+ rSet.Put( SfxBoolItem( nWhich, rDoc.IsTabProtected( nTab ) ) );
}
}
break;
case SID_AUTO_OUTLINE:
{
- if (pDoc->GetChangeTrack()!=nullptr || GetViewData().IsMultiMarked())
+ if (rDoc.GetChangeTrack()!=nullptr || GetViewData().IsMultiMarked())
{
rSet.DisableItem( nWhich );
}
@@ -399,7 +399,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
case SID_OUTLINE_DELETEALL:
{
SCTAB nOlTab = GetViewData().GetTabNo();
- ScOutlineTable* pOlTable = pDoc->GetOutlineTable( nOlTab );
+ ScOutlineTable* pOlTable = rDoc.GetOutlineTable( nOlTab );
if (pOlTable == nullptr)
rSet.DisableItem( nWhich );
}
@@ -437,14 +437,14 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
case FID_CHG_SHOW:
{
- if ( pDoc->GetChangeTrack() == nullptr || ( pDocShell && pDocShell->IsDocShared() ) )
+ if ( rDoc.GetChangeTrack() == nullptr || ( pDocShell && pDocShell->IsDocShared() ) )
rSet.DisableItem( nWhich );
}
break;
case FID_CHG_ACCEPT:
{
if(
- ( !pDoc->GetChangeTrack() && !pThisFrame->HasChildWindow(FID_CHG_ACCEPT) )
+ ( !rDoc.GetChangeTrack() && !pThisFrame->HasChildWindow(FID_CHG_ACCEPT) )
||
( pDocShell && pDocShell->IsDocShared() )
)
@@ -486,7 +486,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName)
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
std::shared_ptr<SvxBoxItem> aLineOuter(std::make_shared<SvxBoxItem>(ATTR_BORDER));
std::shared_ptr<SvxBoxInfoItem> aLineInner(std::make_shared<SvxBoxInfoItem>(ATTR_BORDER_INNER));
@@ -521,7 +521,7 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName
GetSelectionFrame( aLineOuter, aLineInner );
//Fix border incorrect for RTL fdo#62399
- if( pDoc->IsLayoutRTL( GetViewData().GetTabNo() ) )
+ if( rDoc.IsLayoutRTL( GetViewData().GetTabNo() ) )
{
std::unique_ptr<SvxBoxItem> aNewFrame(aLineOuter->Clone());
std::unique_ptr<SvxBoxInfoItem> aTempInfo(aLineInner->Clone());
@@ -545,9 +545,9 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName
// Generate NumberFormat Value from Value and Language and box it.
pOldSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT,
- pOldAttrs->GetNumberFormat( pDoc->GetFormatTable() ) ) );
+ pOldAttrs->GetNumberFormat( rDoc.GetFormatTable() ) ) );
- pNumberInfoItem = MakeNumberInfoItem(pDoc, &GetViewData());
+ pNumberInfoItem = MakeNumberInfoItem(&rDoc, &GetViewData());
pOldSet->MergeRange( SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO );
pOldSet->Put(*pNumberInfoItem );
@@ -602,17 +602,14 @@ bool ScTabViewShell::IsRefInputMode() const
( aString[0] == '+' || aString[0] == '-' ) )
{
const ScViewData& rViewData = GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
- if ( pDoc )
+ ScDocument& rDoc = rViewData.GetDocument();
+ const ScAddress aPos( rViewData.GetCurPos() );
+ ScCompiler aComp( &rDoc, aPos, rDoc.GetGrammar() );
+ aComp.SetCloseBrackets( false );
+ std::unique_ptr<ScTokenArray> pArr(aComp.CompileString(aString));
+ if ( pArr && pArr->MayReferenceFollow() )
{
- const ScAddress aPos( rViewData.GetCurPos() );
- ScCompiler aComp( pDoc, aPos, pDoc->GetGrammar() );
- aComp.SetCloseBrackets( false );
- std::unique_ptr<ScTokenArray> pArr(aComp.CompileString(aString));
- if ( pArr && pArr->MayReferenceFollow() )
- {
- return true;
- }
+ return true;
}
}
else
@@ -647,7 +644,7 @@ void ScTabViewShell::UpdateInputHandler( bool bForce /* = sal_False */, bool bSt
OUString aString;
const EditTextObject* pObject = nullptr;
ScViewData& rViewData = GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
SCCOL nPosX = rViewData.GetCurX();
SCROW nPosY = rViewData.GetCurY();
SCTAB nTab = rViewData.GetTabNo();
@@ -669,9 +666,9 @@ void ScTabViewShell::UpdateInputHandler( bool bForce /* = sal_False */, bool bSt
bool bHideFormula = false;
bool bHideAll = false;
- if (pDoc->IsTabProtected(nTab))
+ if (rDoc.IsTabProtected(nTab))
{
- const ScProtectionAttr* pProt = pDoc->GetAttr( nPosX,nPosY,nTab,
+ const ScProtectionAttr* pProt = rDoc.GetAttr( nPosX,nPosY,nTab,
ATTR_PROTECTION);
bHideFormula = pProt->GetHideFormula();
bHideAll = pProt->GetHideCell();
@@ -679,7 +676,7 @@ void ScTabViewShell::UpdateInputHandler( bool bForce /* = sal_False */, bool bSt
if (!bHideAll)
{
- ScRefCellValue rCell(*pDoc, aPos);
+ ScRefCellValue rCell(rDoc, aPos);
if (rCell.meType == CELLTYPE_FORMULA)
{
if (!bHideFormula)
@@ -691,10 +688,10 @@ void ScTabViewShell::UpdateInputHandler( bool bForce /* = sal_False */, bool bSt
}
else
{
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
- sal_uInt32 nNumFmt = pDoc->GetNumberFormat( aPos );
+ SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
+ sal_uInt32 nNumFmt = rDoc.GetNumberFormat( aPos );
- ScCellFormat::GetInputString( rCell, nNumFmt, aString, *pFormatter, pDoc );
+ ScCellFormat::GetInputString( rCell, nNumFmt, aString, *pFormatter, &rDoc );
if (rCell.meType == CELLTYPE_STRING)
{
// Put a ' in front if necessary, so that the string is not
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index d697e7b5934f..58d42e311005 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -539,7 +539,7 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq)
void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet)
{
bool bOle = GetViewFrame()->GetFrame().IsInPlace();
- bool bTabProt = GetViewData().GetDocument()->IsTabProtected(GetViewData().GetTabNo());
+ bool bTabProt = GetViewData().GetDocument().IsTabProtected(GetViewData().GetTabNo());
ScDocShell* pDocShell = GetViewData().GetDocShell();
bool bShared = pDocShell && pDocShell->IsDocShared();
SdrView* pSdrView = GetScDrawView();
@@ -598,11 +598,11 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet)
// if there is no marked area, check the current cell
bool bDisableInsertImage = true;
ScMarkData& rMark = GetViewData().GetMarkData();
- if (!rMark.GetMarkedRanges().empty() && GetViewData().GetDocument()->IsSelectionEditable(rMark))
+ if (!rMark.GetMarkedRanges().empty() && GetViewData().GetDocument().IsSelectionEditable(rMark))
bDisableInsertImage = false;
else
{
- if (GetViewData().GetDocument()->IsBlockEditable
+ if (GetViewData().GetDocument().IsBlockEditable
(GetViewData().GetTabNo(), GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetCurX(), GetViewData().GetCurY()))
{
bDisableInsertImage = false;
@@ -616,7 +616,7 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet)
case SID_LINKS:
{
- if (GetViewData().GetDocument()->GetLinkManager()->GetLinks().empty())
+ if (GetViewData().GetDocument().GetLinkManager()->GetLinks().empty())
rSet.DisableItem( SID_LINKS );
}
break;
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 0a1f0feb41af..b96c30d9d057 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -133,7 +133,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
if(pCW)
pCW->SetHideNotDelete(true);
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
switch( nSlotId )
{
@@ -210,7 +210,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
if (!mbInSwitch)
{
std::map<OUString, ScRangeName*> aRangeMap;
- pDoc->GetRangeNameMap(aRangeMap);
+ rDoc.GetRangeNameMap(aRangeMap);
xResult = std::make_shared<ScNameDefDlg>(pB, pCW, pParent, &GetViewData(), aRangeMap,
ScAddress(GetViewData().GetCurX(),
GetViewData().GetCurY(),
@@ -256,7 +256,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
ScAddress aCurPos( rViewData.GetCurX(),
rViewData.GetCurY(),
rViewData.GetTabNo());
- xResult = std::make_shared<ScSolverDlg>(pB, pCW, pParent, rViewData.GetDocument(), aCurPos);
+ xResult = std::make_shared<ScSolverDlg>(pB, pCW, pParent, &rViewData.GetDocument(), aCurPos);
break;
}
case SID_OPENDLG_TABOP:
@@ -266,7 +266,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
rViewData.GetCurY(),
rViewData.GetTabNo());
- xResult = std::make_shared<ScTabOpDlg>(pB, pCW, pParent, rViewData.GetDocument(), aCurPos);
+ xResult = std::make_shared<ScTabOpDlg>(pB, pCW, pParent, &rViewData.GetDocument(), aCurPos);
break;
}
case SID_OPENDLG_CONSOLIDATE:
@@ -276,7 +276,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
SCITEM_CONSOLIDATEDATA>{} );
const ScConsolidateParam* pDlgData =
- pDoc->GetConsolidateDlgData();
+ rDoc.GetConsolidateDlgData();
if ( !pDlgData )
{
@@ -315,7 +315,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
SCITEM_QUERYDATA>{} );
ScDBData* pDBData = GetDBData(false, SC_DB_MAKE, ScGetDBSelection::RowDown);
- pDBData->ExtendDataArea(pDoc);
+ pDBData->ExtendDataArea(&rDoc);
pDBData->GetQueryParam( aQueryParam );
ScRange aArea;
@@ -340,7 +340,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
SCITEM_QUERYDATA>{} );
ScDBData* pDBData = GetDBData(false, SC_DB_MAKE, ScGetDBSelection::RowDown);
- pDBData->ExtendDataArea(pDoc);
+ pDBData->ExtendDataArea(&rDoc);
pDBData->GetQueryParam( aQueryParam );
ScRange aArea;
@@ -375,7 +375,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
}
case SID_MANAGE_XML_SOURCE:
{
- xResult = std::make_shared<ScXMLSourceDlg>(pB, pCW, pParent, pDoc);
+ xResult = std::make_shared<ScXMLSourceDlg>(pB, pCW, pParent, &rDoc);
break;
}
case SID_OPENDLG_PIVOTTABLE:
@@ -387,7 +387,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
// Check for an existing datapilot output.
ScViewData& rViewData = GetViewData();
rViewData.SetRefTabNo( rViewData.GetTabNo() );
- ScDPObject* pObj = pDoc->GetDPAtCursor(rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo());
+ ScDPObject* pObj = rDoc.GetDPAtCursor(rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo());
xResult = std::make_shared<ScPivotLayoutDialog>(pB, pCW, pParent, &rViewData, pDialogDPObject.get(), pObj == nullptr);
}
@@ -600,7 +600,7 @@ void ScTabViewShell::notifyAllViewsSheetGeomInvalidation(SfxViewShell* pForViewS
bool ScTabViewShell::UseSubTotal(ScRangeList* pRangeList)
{
bool bSubTotal = false;
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
size_t nRangeCount (pRangeList->size());
size_t nRangeIndex (0);
while (!bSubTotal && nRangeIndex < nRangeCount)
@@ -614,7 +614,7 @@ bool ScTabViewShell::UseSubTotal(ScRangeList* pRangeList)
SCROW nRow(rRange.aStart.Row());
while (!bSubTotal && nRow <= nRowEnd)
{
- if (pDoc->RowFiltered(nRow, nTab))
+ if (rDoc.RowFiltered(nRow, nTab))
bSubTotal = true;
else
++nRow;
@@ -626,7 +626,7 @@ bool ScTabViewShell::UseSubTotal(ScRangeList* pRangeList)
if (!bSubTotal)
{
- const ScDBCollection::NamedDBs& rDBs = pDoc->GetDBCollection()->getNamedDBs();
+ const ScDBCollection::NamedDBs& rDBs = rDoc.GetDBCollection()->getNamedDBs();
for (const auto& rxDB : rDBs)
{
const ScDBData& rDB = *rxDB;
@@ -660,7 +660,7 @@ OUString ScTabViewShell::DoAutoSum(bool& rRangeFinder, bool& rSubTotal, const Op
ScRangeList aMarkRangeList;
rRangeFinder = rSubTotal = false;
rMark.FillRangeListWithMarks( &aMarkRangeList, false );
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
// check if one of the marked ranges is empty
bool bEmpty = false;
@@ -668,7 +668,7 @@ OUString ScTabViewShell::DoAutoSum(bool& rRangeFinder, bool& rSubTotal, const Op
for ( size_t i = 0; i < nCount; ++i )
{
const ScRange & rRange( aMarkRangeList[i] );
- if ( pDoc->IsBlockEmpty( rRange.aStart.Tab(),
+ if ( rDoc.IsBlockEmpty( rRange.aStart.Tab(),
rRange.aStart.Col(), rRange.aStart.Row(),
rRange.aEnd.Col(), rRange.aEnd.Row() ) )
{
diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx
index 138d154e046a..66094de71603 100644
--- a/sc/source/ui/view/tabvwshe.cxx
+++ b/sc/source/ui/view/tabvwshe.cxx
@@ -55,12 +55,12 @@ OUString ScTabViewShell::GetSelectionText( bool bWholeWord )
if ( GetViewData().GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
if ( bInFormatDialog && aRange.aStart.Row() != aRange.aEnd.Row() )
{
// limit range to one data row
// (only when the call comes from a format dialog)
- ScHorizontalCellIterator aIter( pDoc, aRange.aStart.Tab(),
+ ScHorizontalCellIterator aIter( &rDoc, aRange.aStart.Tab(),
aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row() );
SCCOL nCol;
@@ -83,7 +83,7 @@ OUString ScTabViewShell::GetSelectionText( bool bWholeWord )
SCTAB nTab1, nTab2;
aRange.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
bool bShrunk;
- pDoc->ShrinkToUsedDataArea( bShrunk, nTab1, nCol1, nRow1, nCol2, nRow2, false);
+ rDoc.ShrinkToUsedDataArea( bShrunk, nTab1, nCol1, nRow1, nCol2, nRow2, false);
if (bShrunk)
{
aRange.aStart.SetCol( nCol1 );
@@ -93,7 +93,7 @@ OUString ScTabViewShell::GetSelectionText( bool bWholeWord )
}
}
- ScImportExport aObj( pDoc, aRange );
+ ScImportExport aObj( &rDoc, aRange );
aObj.SetFormulas( GetViewData().GetOptions().GetOption( VOPT_FORMULAS ) );
OUString aExportOUString;
/* TODO: STRING_TSVC under some circumstances? */
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index b14aacca8eec..f73a5c1636b5 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -61,10 +61,10 @@ using namespace com::sun::star;
void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
{
ScViewData& rViewData = GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
SCTAB nCurrentTab = rViewData.GetTabNo();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
sal_uInt16 nSlot = rReq.GetSlot();
const SfxItemSet* pReqArgs = rReq.GetArgs();
@@ -75,7 +75,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
case FID_TABLE_VISIBLE:
{
OUString aName;
- pDoc->GetName( nCurrentTab, aName );
+ rDoc.GetName( nCurrentTab, aName );
bool bVisible=true;
if( pReqArgs != nullptr )
@@ -87,7 +87,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
if( ! bVisible ) // fade out
{
- if ( pDoc->IsDocEditable() )
+ if ( rDoc.IsDocEditable() )
{
ScMarkData& rMark = rViewData.GetMarkData();
HideTable( rMark );
@@ -104,7 +104,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
case FID_TABLE_HIDE:
{
- if ( pDoc->IsDocEditable() )
+ if ( rDoc.IsDocEditable() )
{
ScMarkData& rMark = rViewData.GetMarkData();
HideTable( rMark );
@@ -139,9 +139,9 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
bool bFirst = true;
for ( SCTAB i=0; i != nTabCount; i++ )
{
- if (!pDoc->IsVisible(i))
+ if (!rDoc.IsVisible(i))
{
- pDoc->GetName( i, aTabName );
+ rDoc.GetName( i, aTabName );
pDlg->Insert( aTabName, bFirst );
bFirst = false;
}
@@ -176,7 +176,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
SCTAB nTabSelCount = rMark.GetSelectCount();
SCTAB nTabNr = nCurrentTab;
- if ( !pDoc->IsDocEditable() )
+ if ( !rDoc.IsDocEditable() )
break; // locked
if ( pReqArgs != nullptr ) // from basic
@@ -189,7 +189,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
pReqArgs->HasItem( nSlot, &pNameItem ) )
{
OUString aName = static_cast<const SfxStringItem*>(pNameItem)->GetValue();
- pDoc->CreateValidTabName(aName);
+ rDoc.CreateValidTabName(aName);
// sheet number from basic: 1-based
// 0 is special, means adding at the end
@@ -241,7 +241,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
for(SCTAB j=nCurrentTab+1;j<nTabCount;j++)
{
- if(!pDoc->IsScenario(j))
+ if(!rDoc.IsScenario(j))
{
nTabAfter=j;
break;
@@ -279,7 +279,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
for(SCTAB j=nSelHigh+1;j<nTabCount;j++)
{
- if(!pDoc->IsScenario(j))
+ if(!rDoc.IsScenario(j))
{
nTabAfter=j;
break;
@@ -323,11 +323,11 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
ScMarkData& rMark = rViewData.GetMarkData();
SCTAB nTabSelCount = rMark.GetSelectCount();
- if ( !pDoc->IsDocEditable() )
+ if ( !rDoc.IsDocEditable() )
break; // everything locked
if ( nSlot != FID_TAB_APPEND &&
- ( pDoc->IsTabProtected( nTabNr ) || nTabSelCount > 1 ) )
+ ( rDoc.IsTabProtected( nTabNr ) || nTabSelCount > 1 ) )
break; // no rename
if( pReqArgs != nullptr )
@@ -376,13 +376,13 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
{
case FID_TAB_APPEND:
aDlgTitle = ScResId(SCSTR_APDTABLE);
- pDoc->CreateValidTabName( aName );
+ rDoc.CreateValidTabName( aName );
pHelpId = HID_SC_APPEND_NAME;
break;
case FID_TAB_RENAME:
aDlgTitle = ScResId(SCSTR_RENAMETAB);
- pDoc->GetName( rViewData.GetTabNo(), aName );
+ rDoc.GetName( rViewData.GetTabNo(), aName );
pHelpId = HID_SC_RENAME_NAME;
break;
}
@@ -441,7 +441,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
case FID_TAB_MOVE:
{
- if ( pDoc->GetChangeTrack() != nullptr )
+ if ( rDoc.GetChangeTrack() != nullptr )
break; // if ChangeTracking is active, then no TabMove
bool bDoIt = false;
@@ -453,7 +453,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
if( pReqArgs != nullptr )
{
- SCTAB nTableCount = pDoc->GetTableCount();
+ SCTAB nTableCount = rDoc.GetTableCount();
const SfxPoolItem* pItem;
if( pReqArgs->HasItem( FID_TAB_MOVE, &pItem ) )
@@ -508,14 +508,14 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
else
{
OUString aDefaultName;
- pDoc->GetName( rViewData.GetTabNo(), aDefaultName );
+ rDoc.GetName( rViewData.GetTabNo(), aDefaultName );
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
ScopedVclPtr<AbstractScMoveTableDlg> pDlg(pFact->CreateScMoveTableDlg(GetFrameWeld(),
aDefaultName));
- SCTAB nTableCount = pDoc->GetTableCount();
+ SCTAB nTableCount = rDoc.GetTableCount();
ScMarkData& rMark = GetViewData().GetMarkData();
SCTAB nTabSelCount = rMark.GetSelectCount();
@@ -595,9 +595,9 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
if (!bDoIt)
{
bool bTabWithPivotTable = false;
- if (pDoc->HasPivotTable())
+ if (rDoc.HasPivotTable())
{
- const ScDPCollection* pDPs = pDoc->GetDPCollection();
+ const ScDPCollection* pDPs = rDoc.GetDPCollection();
if (pDPs)
{
const ScMarkData::MarkedTabsType& rSelectedTabs = rViewData.GetMarkData().GetSelectedTabs();
@@ -658,7 +658,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
ScMarkData& rMark = rViewData.GetMarkData();
for (SCTAB i = 0; i < nTabCount; i++)
{
- if (rMark.GetTableSelect(i) && !pDoc->IsTabProtected(i))
+ if (rMark.GetTableSelect(i) && !rDoc.IsTabProtected(i))
{
TheTabs.push_back(i);
bTabFlag = true;
@@ -684,7 +684,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
{
ScDocShell* pDocSh = rViewData.GetDocShell();
ScDocFunc &rFunc = pDocSh->GetDocFunc();
- bool bSet = !pDoc->IsLayoutRTL( nCurrentTab );
+ bool bSet = !rDoc.IsLayoutRTL( nCurrentTab );
const ScMarkData& rMark = rViewData.GetMarkData();
if ( rMark.GetSelectCount() != 0 )
@@ -724,10 +724,10 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
SCTAB nTabNr = rViewData.GetTabNo();
ScMarkData& rMark = rViewData.GetMarkData();
SCTAB nTabSelCount = rMark.GetSelectCount();
- if ( !pDoc->IsDocEditable() )
+ if ( !rDoc.IsDocEditable() )
break;
- if ( pDoc->IsTabProtected( nTabNr ) ) // ||nTabSelCount > 1
+ if ( rDoc.IsTabProtected( nTabNr ) ) // ||nTabSelCount > 1
break;
if( pReqArgs != nullptr )
@@ -745,7 +745,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
pTabColorList(new ScUndoTabColorInfo::List);
for (const auto& rTab : rMark)
{
- if ( !pDoc->IsTabProtected(rTab) )
+ if ( !rDoc.IsTabProtected(rTab) )
{
ScUndoTabColorInfo aTabColorInfo(rTab);
aTabColorInfo.maNewTabBgColor = aColor;
@@ -768,7 +768,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
sal_uInt16 nRet = RET_OK; /// temp
bool bDone = false; /// temp
- Color aTabBgColor = pDoc->GetTabBgColor( nCurrentTab );
+ Color aTabBgColor = rDoc.GetTabBgColor( nCurrentTab );
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
ScopedVclPtr<AbstractScTabBgColorDlg> pDlg(pFact->CreateScTabBgColorDlg(
GetFrameWeld(),
@@ -788,7 +788,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
{
for (const auto& rTab : rMark)
{
- if ( !pDoc->IsTabProtected(rTab) )
+ if ( !rDoc.IsTabProtected(rTab) )
{
ScUndoTabColorInfo aTabColorInfo(rTab);
aTabColorInfo.maNewTabBgColor = aSelectedColor;
@@ -846,12 +846,12 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
void ScTabViewShell::GetStateTable( SfxItemSet& rSet )
{
ScViewData& rViewData = GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
ScDocShell* pDocShell = rViewData.GetDocShell();
ScMarkData& rMark = GetViewData().GetMarkData();
SCTAB nTab = rViewData.GetTabNo();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
SCTAB nTabSelCount = rMark.GetSelectCount();
SfxWhichIter aIter(rSet);
@@ -863,7 +863,7 @@ void ScTabViewShell::GetStateTable( SfxItemSet& rSet )
{
case FID_TABLE_VISIBLE:
- rSet.Put( SfxBoolItem( nWhich, pDoc->IsVisible(nTab) ));
+ rSet.Put( SfxBoolItem( nWhich, rDoc.IsVisible(nTab) ));
break;
case FID_TABLE_HIDE:
@@ -871,9 +871,9 @@ void ScTabViewShell::GetStateTable( SfxItemSet& rSet )
sal_uInt16 nVis = 0;
// enable menu : check to make sure we won't hide all sheets. we need at least one visible at all times.
for ( SCTAB i=0; i < nTabCount && nVis<nTabSelCount + 1; i++ )
- if (pDoc->IsVisible(i))
+ if (rDoc.IsVisible(i))
++nVis;
- if ( nVis<=nTabSelCount || !pDoc->IsDocEditable() )
+ if ( nVis<=nTabSelCount || !rDoc.IsDocEditable() )
rSet.DisableItem( nWhich );
}
break;
@@ -882,25 +882,25 @@ void ScTabViewShell::GetStateTable( SfxItemSet& rSet )
{
bool bHasHidden = false;
for ( SCTAB i=0; i < nTabCount && !bHasHidden; i++ )
- if (!pDoc->IsVisible(i))
+ if (!rDoc.IsVisible(i))
bHasHidden = true;
- if ( !bHasHidden || pDoc->IsDocProtected() || nTabSelCount > 1 )
+ if ( !bHasHidden || rDoc.IsDocProtected() || nTabSelCount > 1 )
rSet.DisableItem( nWhich );
}
break;
case FID_DELETE_TABLE:
{
- if ( pDoc->GetChangeTrack() )
+ if ( rDoc.GetChangeTrack() )
rSet.DisableItem( nWhich );
else
{
sal_uInt16 nVis = 0;
for ( SCTAB i=0; i < nTabCount && nVis<2; i++ )
- if (pDoc->IsVisible(i))
+ if (rDoc.IsVisible(i))
++nVis;
- if ( pDoc->IsTabProtected(nTab)
- || !pDoc->IsDocEditable()
+ if ( rDoc.IsTabProtected(nTab)
+ || !rDoc.IsDocEditable()
|| nVis < 2
|| nTabSelCount == nTabCount)
rSet.DisableItem( nWhich );
@@ -911,15 +911,15 @@ void ScTabViewShell::GetStateTable( SfxItemSet& rSet )
case FID_INS_TABLE:
case FID_INS_TABLE_EXT:
case FID_TAB_APPEND:
- if ( !pDoc->IsDocEditable() ||
+ if ( !rDoc.IsDocEditable() ||
nTabCount > MAXTAB ||
( nWhich == FID_INS_TABLE_EXT && pDocShell && pDocShell->IsDocShared() ) )
rSet.DisableItem( nWhich );
break;
case FID_TAB_MOVE:
- if ( !pDoc->IsDocEditable()
- || pDoc->GetChangeTrack() != nullptr
+ if ( !rDoc.IsDocEditable()
+ || rDoc.GetChangeTrack() != nullptr
|| nTabCount > MAXTAB)
rSet.DisableItem( nWhich );
break;
@@ -928,8 +928,8 @@ void ScTabViewShell::GetStateTable( SfxItemSet& rSet )
// FID_TAB_RENAME - "name"-property for Basic
case FID_TAB_MENU_RENAME:
- if ( !pDoc->IsDocEditable() ||
- pDoc->IsTabProtected(nTab) ||nTabSelCount > 1 ||
+ if ( !rDoc.IsDocEditable() ||
+ rDoc.IsTabProtected(nTab) ||nTabSelCount > 1 ||
( pDocShell && pDocShell->IsDocShared() ) )
rSet.DisableItem( nWhich );
break;
@@ -937,7 +937,7 @@ void ScTabViewShell::GetStateTable( SfxItemSet& rSet )
case FID_TAB_RENAME:
{
OUString aTabName;
- pDoc->GetName( nTab, aTabName );
+ rDoc.GetName( nTab, aTabName );
rSet.Put( SfxStringItem( nWhich, aTabName ));
@@ -950,22 +950,22 @@ void ScTabViewShell::GetStateTable( SfxItemSet& rSet )
if ( !aLangOpt.IsCTLFontEnabled() )
rSet.DisableItem( nWhich );
else
- rSet.Put( SfxBoolItem( nWhich, pDoc->IsLayoutRTL( nTab ) ) );
+ rSet.Put( SfxBoolItem( nWhich, rDoc.IsLayoutRTL( nTab ) ) );
}
break;
case FID_TAB_MENU_SET_TAB_BG_COLOR:
{
- if ( !pDoc->IsDocEditable()
+ if ( !rDoc.IsDocEditable()
|| ( pDocShell && pDocShell->IsDocShared() )
- || pDoc->IsTabProtected(nTab) )
+ || rDoc.IsTabProtected(nTab) )
rSet.DisableItem( nWhich );
}
break;
case FID_TAB_SET_TAB_BG_COLOR:
{
- Color aColor = pDoc->GetTabBgColor( nTab );
+ Color aColor = rDoc.GetTabBgColor( nTab );
rSet.Put( SvxColorItem( aColor, nWhich ) );
}
break;
diff --git a/sc/source/ui/view/tabvwshg.cxx b/sc/source/ui/view/tabvwshg.cxx
index 3b6f46250879..007d437b7833 100644
--- a/sc/source/ui/view/tabvwshg.cxx
+++ b/sc/source/ui/view/tabvwshg.cxx
@@ -45,9 +45,9 @@ void ScTabViewShell::InsertURLButton( const OUString& rName, const OUString& rUR
// protected sheet ?
ScViewData& rViewData = GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
SCTAB nTab = rViewData.GetTabNo();
- if ( pDoc->IsTabProtected(nTab) )
+ if ( rDoc.IsTabProtected(nTab) )
{
ErrorMessage(STR_PROTECTIONERR);
return;
@@ -78,7 +78,7 @@ void ScTabViewShell::InsertURLButton( const OUString& rName, const OUString& rUR
xPropSet->setPropertyValue("Label", uno::Any(rName) );
- OUString aTmp = INetURLObject::GetAbsURL( pDoc->GetDocumentShell()->GetMedium()->GetBaseURL(), rURL );
+ OUString aTmp = INetURLObject::GetAbsURL( rDoc.GetDocumentShell()->GetMedium()->GetBaseURL(), rURL );
xPropSet->setPropertyValue("TargetURL", uno::Any(aTmp) );
if( !rTarget.isEmpty() )
@@ -104,7 +104,7 @@ void ScTabViewShell::InsertURLButton( const OUString& rName, const OUString& rUR
// Size as in 3.1:
Size aSize = GetActiveWin()->PixelToLogic(Size(140, 20));
- if ( pDoc->IsNegativePage(nTab) )
+ if ( rDoc.IsNegativePage(nTab) )
aPos.AdjustX( -(aSize.Width()) );
pObj->SetLogicRect(tools::Rectangle(aPos, aSize));
diff --git a/sc/source/ui/view/tabvwshh.cxx b/sc/source/ui/view/tabvwshh.cxx
index 24a3a66b9876..6a4e8422319c 100644
--- a/sc/source/ui/view/tabvwshh.cxx
+++ b/sc/source/ui/view/tabvwshh.cxx
@@ -210,9 +210,8 @@ void ScTabViewShell::AddAccessibilityObject( SfxListener& rObject )
pAccessibilityBroadcaster.reset( new SfxBroadcaster );
rObject.StartListening( *pAccessibilityBroadcaster );
- ScDocument* pDoc = GetViewData().GetDocument();
- if (pDoc)
- pDoc->AddUnoObject(rObject);
+ ScDocument& rDoc = GetViewData().GetDocument();
+ rDoc.AddUnoObject(rObject);
}
void ScTabViewShell::RemoveAccessibilityObject( SfxListener& rObject )
@@ -222,9 +221,8 @@ void ScTabViewShell::RemoveAccessibilityObject( SfxListener& rObject )
if (pAccessibilityBroadcaster)
{
rObject.EndListening( *pAccessibilityBroadcaster );
- ScDocument* pDoc = GetViewData().GetDocument();
- if (pDoc)
- pDoc->RemoveUnoObject(rObject);
+ ScDocument& rDoc = GetViewData().GetDocument();
+ rDoc.RemoveUnoObject(rObject);
}
else
{
@@ -245,15 +243,15 @@ bool ScTabViewShell::HasAccessibilityObjects() const
bool ScTabViewShell::ExecuteRetypePassDlg(ScPasswordHash eDesiredHash)
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScRetypePassDlg aDlg(GetFrameWeld());
- aDlg.SetDataFromDocument(*pDoc);
+ aDlg.SetDataFromDocument(rDoc);
aDlg.SetDesiredHash(eDesiredHash);
if (aDlg.run() != RET_OK)
return false;
- aDlg.WriteNewDataToDocument(*pDoc);
+ aDlg.WriteNewDataToDocument(rDoc);
return true;
}
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index ada3884b5af4..efd90da3b03c 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -281,10 +281,10 @@ long ScPositionHelper::computePosition(index_type nIndex, const std::function<lo
}
ScBoundsProvider::ScBoundsProvider(const ScViewData &rView, SCTAB nT, bool bColHeader)
- : pDoc(rView.GetDocument())
+ : rDoc(rView.GetDocument())
, nTab(nT)
, bColumnHeader(bColHeader)
- , MAX_INDEX(bColHeader ? pDoc->MaxCol() : MAXTILEDROW)
+ , MAX_INDEX(bColHeader ? rDoc.MaxCol() : MAXTILEDROW)
, mfPPTX(rView.GetPPTX())
, mfPPTY(rView.GetPPTY())
, nFirstIndex(-1)
@@ -323,7 +323,7 @@ void ScBoundsProvider::GetEndIndexAndPosition(SCROW& nIndex, long& nPosition) co
long ScBoundsProvider::GetSize(index_type nIndex) const
{
- const sal_uInt16 nSize = bColumnHeader ? pDoc->GetColWidth(nIndex, nTab) : pDoc->GetRowHeight(nIndex, nTab);
+ const sal_uInt16 nSize = bColumnHeader ? rDoc.GetColWidth(nIndex, nTab) : rDoc.GetRowHeight(nIndex, nTab);
return ScViewData::ToPixel(nSize, bColumnHeader ? mfPPTX : mfPPTY);
}
@@ -588,7 +588,7 @@ void ScViewDataTable::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>
pSettings[SC_TABLE_SHOWGRID].Value <<= bShowGrid;
// Common SdrModel processing
- rViewData.GetDocument()->GetDrawLayer()->WriteUserDataSequence(rSettings);
+ rViewData.GetDocument().GetDrawLayer()->WriteUserDataSequence(rSettings);
}
void ScViewDataTable::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue>& aSettings, ScViewData& rViewData, SCTAB nTab, bool& rHasZoom )
@@ -609,12 +609,12 @@ void ScViewDataTable::ReadUserDataSequence(const uno::Sequence <beans::PropertyV
if (sName == SC_CURSORPOSITIONX)
{
rSetting.Value >>= nTemp32;
- nCurX = rViewData.GetDocument()->SanitizeCol( static_cast<SCCOL>(nTemp32));
+ nCurX = rViewData.GetDocument().SanitizeCol( static_cast<SCCOL>(nTemp32));
}
else if (sName == SC_CURSORPOSITIONY)
{
rSetting.Value >>= nTemp32;
- nCurY = rViewData.GetDocument()->SanitizeRow( static_cast<SCROW>(nTemp32));
+ nCurY = rViewData.GetDocument().SanitizeRow( static_cast<SCROW>(nTemp32));
}
else if (sName == SC_HORIZONTALSPLITMODE)
{
@@ -654,22 +654,22 @@ void ScViewDataTable::ReadUserDataSequence(const uno::Sequence <beans::PropertyV
else if (sName == SC_POSITIONLEFT)
{
rSetting.Value >>= nTemp32;
- nPosX[SC_SPLIT_LEFT] = rViewData.GetDocument()->SanitizeCol( static_cast<SCCOL>(nTemp32));
+ nPosX[SC_SPLIT_LEFT] = rViewData.GetDocument().SanitizeCol( static_cast<SCCOL>(nTemp32));
}
else if (sName == SC_POSITIONRIGHT)
{
rSetting.Value >>= nTemp32;
- nPosX[SC_SPLIT_RIGHT] = rViewData.GetDocument()->SanitizeCol( static_cast<SCCOL>(nTemp32));
+ nPosX[SC_SPLIT_RIGHT] = rViewData.GetDocument().SanitizeCol( static_cast<SCCOL>(nTemp32));
}
else if (sName == SC_POSITIONTOP)
{
rSetting.Value >>= nTemp32;
- nPosY[SC_SPLIT_TOP] = rViewData.GetDocument()->SanitizeRow( static_cast<SCROW>(nTemp32));
+ nPosY[SC_SPLIT_TOP] = rViewData.GetDocument().SanitizeRow( static_cast<SCROW>(nTemp32));
}
else if (sName == SC_POSITIONBOTTOM)
{
rSetting.Value >>= nTemp32;
- nPosY[SC_SPLIT_BOTTOM] = rViewData.GetDocument()->SanitizeRow( static_cast<SCROW>(nTemp32));
+ nPosY[SC_SPLIT_BOTTOM] = rViewData.GetDocument().SanitizeRow( static_cast<SCROW>(nTemp32));
}
else if (sName == SC_ZOOMTYPE)
{
@@ -708,21 +708,21 @@ void ScViewDataTable::ReadUserDataSequence(const uno::Sequence <beans::PropertyV
rSetting.Value >>= aColor;
if (aColor != COL_AUTO)
{
- ScDocument* pDoc = rViewData.GetDocument();
- pDoc->SetTabBgColor(nTab, aColor);
+ ScDocument& rDoc = rViewData.GetDocument();
+ rDoc.SetTabBgColor(nTab, aColor);
}
}
// Fallback to common SdrModel processing
- else rViewData.GetDocument()->GetDrawLayer()->ReadUserDataSequenceValue(&rSetting);
+ else rViewData.GetDocument().GetDrawLayer()->ReadUserDataSequenceValue(&rSetting);
}
if (eHSplitMode == SC_SPLIT_FIX)
- nFixPosX = rViewData.GetDocument()->SanitizeCol( static_cast<SCCOL>( bHasHSplitInTwips ? nTempPosHTw : nTempPosH ));
+ nFixPosX = rViewData.GetDocument().SanitizeCol( static_cast<SCCOL>( bHasHSplitInTwips ? nTempPosHTw : nTempPosH ));
else
nHSplitPos = bHasHSplitInTwips ? static_cast< long >( nTempPosHTw * rViewData.GetPPTX() ) : nTempPosH;
if (eVSplitMode == SC_SPLIT_FIX)
- nFixPosY = rViewData.GetDocument()->SanitizeRow( static_cast<SCROW>( bHasVSplitInTwips ? nTempPosVTw : nTempPosV ));
+ nFixPosY = rViewData.GetDocument().SanitizeRow( static_cast<SCROW>( bHasVSplitInTwips ? nTempPosVTw : nTempPosV ));
else
nVSplitPos = bHasVSplitInTwips ? static_cast< long >( nTempPosVTw * rViewData.GetPPTY() ) : nTempPosV;
@@ -867,15 +867,12 @@ void ScViewData::InitData(ScDocument& rDocument)
}
}
-ScDocument* ScViewData::GetDocument() const
+ScDocument& ScViewData::GetDocument() const
{
if (pDoc)
- return pDoc;
- else if (pDocShell)
- return &pDocShell->GetDocument();
-
- OSL_FAIL("no document on ViewData");
- return nullptr;
+ return *pDoc;
+ assert(pDocShell && "we must have one of pDoc and pDocShell");
+ return pDocShell->GetDocument();
}
ScViewData::~ScViewData() COVERITY_NOEXCEPT_FALSE
@@ -1164,7 +1161,7 @@ ScMarkType ScViewData::GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark )
if ( rNewMark.IsMarked() && !rNewMark.IsMultiMarked() )
{
rNewMark.GetMarkArea( rRange );
- if (ScViewUtil::HasFiltered( rRange, GetDocument()))
+ if (ScViewUtil::HasFiltered( rRange, &GetDocument()))
eMarkType = SC_MARK_SIMPLE_FILTERED;
else
eMarkType = SC_MARK_SIMPLE;
@@ -1808,7 +1805,7 @@ void ScViewData::EditGrowX()
bool bLOKPrintTwips = bLOKActive && comphelper::LibreOfficeKit::isCompatFlagSet(
comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs);
- ScDocument* pLocalDoc = GetDocument();
+ ScDocument& rLocalDoc = GetDocument();
ScSplitPos eWhich = GetActivePart();
ScHSplitPos eHWhich = WhichH(eWhich);
@@ -1817,7 +1814,7 @@ void ScViewData::EditGrowX()
if ( !pCurView || !bEditActive[eWhich])
return;
- bool bLayoutRTL = pLocalDoc->IsLayoutRTL( nTabNo );
+ bool bLayoutRTL = rLocalDoc.IsLayoutRTL( nTabNo );
ScEditEngineDefaulter* pEngine =
static_cast<ScEditEngineDefaulter*>( pCurView->GetEditEngine() );
@@ -1846,7 +1843,7 @@ void ScViewData::EditGrowX()
bool bAsianVertical = pEngine->IsVertical();
// get bGrow... variables the same way as in SetEditEngine
- const ScPatternAttr* pPattern = pLocalDoc->GetPattern( nEditCol, nEditRow, nTabNo );
+ const ScPatternAttr* pPattern = rLocalDoc.GetPattern( nEditCol, nEditRow, nTabNo );
SvxCellHorJustify eJust = pPattern->GetItem( ATTR_HOR_JUSTIFY ).GetValue();
bool bGrowCentered = ( eJust == SvxCellHorJustify::Center );
bool bGrowToLeft = ( eJust == SvxCellHorJustify::Right ); // visual left
@@ -1866,7 +1863,7 @@ void ScViewData::EditGrowX()
if ( nEditStartCol > nLeft )
{
--nEditStartCol;
- long nColWidth = pLocalDoc->GetColWidth( nEditStartCol, nTabNo );
+ long nColWidth = rLocalDoc.GetColWidth( nEditStartCol, nTabNo );
long nLeftPix = ToPixel( nColWidth, nPPTX );
nLogicLeft = pWin->PixelToLogic(Size(nLeftPix,0)).Width();
if (bLOKPrintTwips)
@@ -1877,7 +1874,7 @@ void ScViewData::EditGrowX()
if ( nEditEndCol < nRight )
{
++nEditEndCol;
- long nColWidth = pLocalDoc->GetColWidth( nEditEndCol, nTabNo );
+ long nColWidth = rLocalDoc.GetColWidth( nEditEndCol, nTabNo );
long nRightPix = ToPixel( nColWidth, nPPTX );
nLogicRight = pWin->PixelToLogic(Size(nRightPix,0)).Width();
if (bLOKPrintTwips)
@@ -1918,7 +1915,7 @@ void ScViewData::EditGrowX()
while (aArea.GetWidth() + 0 < nTextWidth && nEditStartCol > nLeft)
{
--nEditStartCol;
- long nColWidth = pLocalDoc->GetColWidth( nEditStartCol, nTabNo );
+ long nColWidth = rLocalDoc.GetColWidth( nEditStartCol, nTabNo );
long nPix = ToPixel( nColWidth, nPPTX );
long nLogicWidth = pWin->PixelToLogic(Size(nPix,0)).Width();
long& nLogicWidthPTwips = nColWidth;
@@ -1960,7 +1957,7 @@ void ScViewData::EditGrowX()
while (aArea.GetWidth() + 0 < nTextWidth && nEditEndCol < nRight)
{
++nEditEndCol;
- long nColWidth = pLocalDoc->GetColWidth( nEditEndCol, nTabNo );
+ long nColWidth = rLocalDoc.GetColWidth( nEditEndCol, nTabNo );
long nPix = ToPixel( nColWidth, nPPTX );
long nLogicWidth = pWin->PixelToLogic(Size(nPix,0)).Width();
long& nLogicWidthPTwips = nColWidth;
@@ -2157,8 +2154,8 @@ void ScViewData::EditGrowY( bool bInitial )
while (aArea.GetHeight() + nAllowedExtra < nTextHeight && nEditEndRow < nBottom && !bMaxReached)
{
++nEditEndRow;
- ScDocument* pLocalDoc = GetDocument();
- long nRowHeight = pLocalDoc->GetRowHeight( nEditEndRow, nTabNo );
+ ScDocument& rLocalDoc = GetDocument();
+ long nRowHeight = rLocalDoc.GetRowHeight( nEditEndRow, nTabNo );
long nPix = ToPixel( nRowHeight, nPPTY );
aArea.AdjustBottom(pWin->PixelToLogic(Size(0,nPix)).Height() );
if (bLOKPrintTwips)
@@ -3639,7 +3636,7 @@ void ScViewData::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>& rSe
uno::Sequence <beans::PropertyValue> aTableViewSettings;
maTabData[nTab]->WriteUserDataSequence(aTableViewSettings, *this, nTab);
OUString sTabName;
- GetDocument()->GetName( nTab, sTabName );
+ GetDocument().GetName( nTab, sTabName );
try
{
xNameContainer->insertByName(sTabName, uno::Any(aTableViewSettings));
@@ -3659,7 +3656,7 @@ void ScViewData::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>& rSe
pSettings[SC_TABLE_VIEWSETTINGS].Value <<= xNameContainer;
OUString sName;
- GetDocument()->GetName( nTabNo, sName );
+ GetDocument().GetName( nTabNo, sName );
pSettings[SC_ACTIVE_TABLE].Name = SC_ACTIVETABLE;
pSettings[SC_ACTIVE_TABLE].Value <<= sName;
pSettings[SC_HORIZONTAL_SCROLL_BAR_WIDTH].Name = SC_HORIZONTALSCROLLBARWIDTH;
@@ -3716,18 +3713,18 @@ void ScViewData::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>& rSe
}
// Common SdrModel processing
- GetDocument()->GetDrawLayer()->WriteUserDataSequence(rSettings);
+ GetDocument().GetDrawLayer()->WriteUserDataSequence(rSettings);
}
void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue>& rSettings)
{
- std::vector<bool> aHasZoomVect( GetDocument()->GetTableCount(), false );
+ std::vector<bool> aHasZoomVect( GetDocument().GetTableCount(), false );
sal_Int32 nTemp32(0);
sal_Int16 nTemp16(0);
bool bPageMode(false);
- EnsureTabDataSize(GetDocument()->GetTableCount());
+ EnsureTabDataSize(GetDocument().GetTableCount());
for (const auto& rSetting : rSettings)
{
@@ -3742,7 +3739,7 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue>
for (const OUString& sTabName : aNames)
{
SCTAB nTab(0);
- if (GetDocument()->GetTable(sTabName, nTab))
+ if (GetDocument().GetTable(sTabName, nTab))
{
uno::Any aAny = xNameContainer->getByName(sTabName);
uno::Sequence<beans::PropertyValue> aTabSettings;
@@ -3766,7 +3763,7 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue>
if(rSetting.Value >>= sTabName)
{
SCTAB nTab(0);
- if (GetDocument()->GetTable(sTabName, nTab))
+ if (GetDocument().GetTable(sTabName, nTab))
nTabNo = nTab;
}
}
@@ -3867,7 +3864,7 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence <beans::PropertyValue>
else if ( sName == SC_UNO_RASTERSYNC )
aGridOpt.SetSynchronize( ScUnoHelpFunctions::GetBoolFromAny( rSetting.Value ) );
// Fallback to common SdrModel processing
- else GetDocument()->GetDrawLayer()->ReadUserDataSequenceValue(&rSetting);
+ else GetDocument().GetDrawLayer()->ReadUserDataSequenceValue(&rSetting);
pOptions->SetGridOptions(aGridOpt);
}
@@ -3938,15 +3935,15 @@ bool ScViewData::UpdateFixX( SCTAB nTab ) // true = value chan
if (!pView || maTabData[nTab]->eHSplitMode != SC_SPLIT_FIX)
return false;
- ScDocument* pLocalDoc = GetDocument();
- if (!pLocalDoc->HasTable(nTab)) // if called from reload, the sheet may not exist
+ ScDocument& rLocalDoc = GetDocument();
+ if (!rLocalDoc.HasTable(nTab)) // if called from reload, the sheet may not exist
return false;
SCCOL nFix = maTabData[nTab]->nFixPosX;
long nNewPos = 0;
for (SCCOL nX=maTabData[nTab]->nPosX[SC_SPLIT_LEFT]; nX<nFix; nX++)
{
- sal_uInt16 nTSize = pLocalDoc->GetColWidth( nX, nTab );
+ sal_uInt16 nTSize = rLocalDoc.GetColWidth( nX, nTab );
if (nTSize)
{
long nPix = ToPixel( nTSize, nPPTX );
@@ -3973,15 +3970,15 @@ bool ScViewData::UpdateFixY( SCTAB nTab ) // true = value changed
if (!pView || maTabData[nTab]->eVSplitMode != SC_SPLIT_FIX)
return false;
- ScDocument* pLocalDoc = GetDocument();
- if (!pLocalDoc->HasTable(nTab)) // if called from reload, the sheet may not exist
+ ScDocument& rLocalDoc = GetDocument();
+ if (!rLocalDoc.HasTable(nTab)) // if called from reload, the sheet may not exist
return false;
SCROW nFix = maTabData[nTab]->nFixPosY;
long nNewPos = 0;
for (SCROW nY=maTabData[nTab]->nPosY[SC_SPLIT_TOP]; nY<nFix; nY++)
{
- sal_uInt16 nTSize = pLocalDoc->GetRowHeight( nY, nTab );
+ sal_uInt16 nTSize = rLocalDoc.GetRowHeight( nY, nTab );
if (nTSize)
{
long nPix = ToPixel( nTSize, nPPTY );
@@ -4002,8 +3999,8 @@ bool ScViewData::UpdateFixY( SCTAB nTab ) // true = value changed
void ScViewData::UpdateOutlinerFlags( Outliner& rOutl ) const
{
- ScDocument* pLocalDoc = GetDocument();
- bool bOnlineSpell = pLocalDoc->GetDocOptions().IsAutoSpell();
+ ScDocument& rLocalDoc = GetDocument();
+ bool bOnlineSpell = rLocalDoc.GetDocOptions().IsAutoSpell();
EEControlBits nCntrl = rOutl.GetControlWord();
nCntrl |= EEControlBits::MARKNONURLFIELDS;
@@ -4028,7 +4025,7 @@ void ScViewData::UpdateOutlinerFlags( Outliner& rOutl ) const
}
rOutl.SetDefaultHorizontalTextDirection(
- pLocalDoc->GetEditTextDirection( nTabNo ) );
+ rLocalDoc.GetEditTextDirection( nTabNo ) );
}
ScAddress ScViewData::GetCurPos() const
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index a731910e94c5..c7190a4084a7 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -476,7 +476,7 @@ static sal_Int8 GetSubTotal( const OpCode eCode )
bool ScViewFunc::GetAutoSumArea( ScRangeList& rRangeList )
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
SCTAB nTab = GetViewData().GetTabNo();
SCCOL nCol = GetViewData().GetCurX();
@@ -495,24 +495,24 @@ bool ScViewFunc::GetAutoSumArea( ScRangeList& rRangeList )
ScAutoSum eSum;
if ( nRow != 0
- && ((eSum = lcl_IsAutoSumData( pDoc, nCol, nRow-1, nTab,
+ && ((eSum = lcl_IsAutoSumData( &rDoc, nCol, nRow-1, nTab,
DIR_TOP, nExtend /*out*/ )) == ScAutoSumData )
- && ((eSum = lcl_IsAutoSumData( pDoc, nCol, nRow-1, nTab,
+ && ((eSum = lcl_IsAutoSumData( &rDoc, nCol, nRow-1, nTab,
DIR_LEFT, nExtend /*out*/ )) == ScAutoSumData )
)
{
bRow = true;
nSeekRow = nRow - 1;
}
- else if ( nCol != 0 && (eSum = lcl_IsAutoSumData( pDoc, nCol-1, nRow, nTab,
+ else if ( nCol != 0 && (eSum = lcl_IsAutoSumData( &rDoc, nCol-1, nRow, nTab,
DIR_LEFT, nExtend /*out*/ )) == ScAutoSumData )
{
bCol = true;
nSeekCol = nCol - 1;
}
- else if ( (eSum = lcl_SeekAutoSumData( pDoc, nCol, nSeekRow, nTab, DIR_TOP, nExtend /*out*/ )) != ScAutoSumNone )
+ else if ( (eSum = lcl_SeekAutoSumData( &rDoc, nCol, nSeekRow, nTab, DIR_TOP, nExtend /*out*/ )) != ScAutoSumNone )
bRow = true;
- else if (( eSum = lcl_SeekAutoSumData( pDoc, nSeekCol, nRow, nTab, DIR_LEFT, nExtend /*out*/ )) != ScAutoSumNone )
+ else if (( eSum = lcl_SeekAutoSumData( &rDoc, nSeekCol, nRow, nTab, DIR_LEFT, nExtend /*out*/ )) != ScAutoSumNone )
bCol = true;
if ( bCol || bRow )
@@ -540,13 +540,13 @@ bool ScViewFunc::GetAutoSumArea( ScRangeList& rRangeList )
{
if ( bRow )
{
- while ( nStartRow != 0 && lcl_IsAutoSumData( pDoc, nCol,
+ while ( nStartRow != 0 && lcl_IsAutoSumData( &rDoc, nCol,
nStartRow-1, nTab, DIR_TOP, nExtend /*out*/ ) == eSum )
--nStartRow;
}
else
{
- while ( nStartCol != 0 && lcl_IsAutoSumData( pDoc, nStartCol-1,
+ while ( nStartCol != 0 && lcl_IsAutoSumData( &rDoc, nStartCol-1,
nRow, nTab, DIR_LEFT, nExtend /*out*/ ) == eSum )
--nStartCol;
}
@@ -558,7 +558,7 @@ bool ScViewFunc::GetAutoSumArea( ScRangeList& rRangeList )
if ( bRow )
{
nEndRow = static_cast< SCROW >( nExtend );
- bContinue = lcl_FindNextSumEntryInColumn( pDoc, nCol, nEndRow /*inout*/, nTab, nExtend /*out*/, 0 );
+ bContinue = lcl_FindNextSumEntryInColumn( &rDoc, nCol, nEndRow /*inout*/, nTab, nExtend /*out*/, 0 );
if ( bContinue )
{
nStartRow = nEndRow;
@@ -567,7 +567,7 @@ bool ScViewFunc::GetAutoSumArea( ScRangeList& rRangeList )
else
{
nEndCol = static_cast< SCCOL >( nExtend );
- bContinue = lcl_FindNextSumEntryInRow( pDoc, nEndCol /*inout*/, nRow, nTab, nExtend /*out*/, 0 );
+ bContinue = lcl_FindNextSumEntryInRow( &rDoc, nEndCol /*inout*/, nRow, nTab, nExtend /*out*/, 0 );
if ( bContinue )
{
nStartCol = nEndCol;
@@ -588,7 +588,7 @@ void ScViewFunc::EnterAutoSum(const ScRangeList& rRangeList, bool bSubTotal, con
bool ScViewFunc::AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor, bool bContinue , const OpCode eCode)
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
const SCTAB nTab = rRange.aStart.Tab();
SCCOL nStartCol = rRange.aStart.Col();
SCROW nStartRow = rRange.aStart.Row();
@@ -602,7 +602,7 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor
{
for ( SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol )
{
- if ( lcl_IsAutoSumData( pDoc, nCol, nRow, nTab, DIR_TOP, nExtend ) != ScAutoSumNone )
+ if ( lcl_IsAutoSumData( &rDoc, nCol, nRow, nTab, DIR_TOP, nExtend ) != ScAutoSumNone )
{
bRowData = true;
break;
@@ -625,7 +625,7 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor
{
for ( SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow )
{
- if ( lcl_IsAutoSumData( pDoc, nCol, nRow, nTab, DIR_LEFT, nExtend ) != ScAutoSumNone )
+ if ( lcl_IsAutoSumData( &rDoc, nCol, nRow, nTab, DIR_LEFT, nExtend ) != ScAutoSumNone )
{
bColData = true;
break;
@@ -642,8 +642,8 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor
return false;
}
- const bool bEndRowEmpty = pDoc->IsBlockEmpty( nTab, nStartCol, nEndRow, nEndCol, nEndRow );
- const bool bEndColEmpty = pDoc->IsBlockEmpty( nTab, nEndCol, nStartRow, nEndCol, nEndRow );
+ const bool bEndRowEmpty = rDoc.IsBlockEmpty( nTab, nStartCol, nEndRow, nEndCol, nEndRow );
+ const bool bEndColEmpty = rDoc.IsBlockEmpty( nTab, nEndCol, nStartRow, nEndCol, nEndRow );
bool bRow = ( nStartRow != nEndRow ) && ( bEndRowEmpty || !bEndColEmpty );
bool bCol = ( nStartCol != nEndCol ) && ( bEndColEmpty || nStartRow == nEndRow );
@@ -651,12 +651,12 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor
SCROW nInsRow = nEndRow;
if ( bRow && !bEndRowEmpty )
{
- if ( nInsRow < pDoc->MaxRow() )
+ if ( nInsRow < rDoc.MaxRow() )
{
++nInsRow;
- while ( !pDoc->IsBlockEmpty( nTab, nStartCol, nInsRow, nEndCol, nInsRow ) )
+ while ( !rDoc.IsBlockEmpty( nTab, nStartCol, nInsRow, nEndCol, nInsRow ) )
{
- if ( nInsRow < pDoc->MaxRow() )
+ if ( nInsRow < rDoc.MaxRow() )
{
++nInsRow;
}
@@ -677,12 +677,12 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor
SCCOL nInsCol = nEndCol;
if ( bCol && !bEndColEmpty )
{
- if ( nInsCol < pDoc->MaxCol() )
+ if ( nInsCol < rDoc.MaxCol() )
{
++nInsCol;
- while ( !pDoc->IsBlockEmpty( nTab, nInsCol, nStartRow, nInsCol, nEndRow ) )
+ while ( !rDoc.IsBlockEmpty( nTab, nInsCol, nStartRow, nInsCol, nEndRow ) )
{
- if ( nInsCol < pDoc->MaxCol() )
+ if ( nInsCol < rDoc.MaxCol() )
{
++nInsCol;
}
@@ -732,12 +732,12 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor
for ( SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol )
{
- if ( !pDoc->IsBlockEmpty( nTab, nCol, nStartRow, nCol, nSumEndRow ) )
+ if ( !rDoc.IsBlockEmpty( nTab, nCol, nStartRow, nCol, nSumEndRow ) )
{
ScRangeList aRangeList;
// Include the originally selected start row.
const ScRange aRange( nCol, rRange.aStart.Row(), nTab, nCol, nSumEndRow, nTab );
- if ( (eSum = lcl_GetAutoSumForColumnRange( pDoc, aRangeList, aRange )) != ScAutoSumNone )
+ if ( (eSum = lcl_GetAutoSumForColumnRange( &rDoc, aRangeList, aRange )) != ScAutoSumNone )
{
if (++nRowSums == 1)
nRowSumsStartCol = aRangeList[0].aStart.Col();
@@ -769,12 +769,12 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor
for ( SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow )
{
- if ( !pDoc->IsBlockEmpty( nTab, nStartCol, nRow, nSumEndCol, nRow ) )
+ if ( !rDoc.IsBlockEmpty( nTab, nStartCol, nRow, nSumEndCol, nRow ) )
{
ScRangeList aRangeList;
// Include the originally selected start column.
const ScRange aRange( rRange.aStart.Col(), nRow, nTab, nSumEndCol, nRow, nTab );
- if ( (eSum = lcl_GetAutoSumForRowRange( pDoc, aRangeList, aRange )) != ScAutoSumNone )
+ if ( (eSum = lcl_GetAutoSumForRowRange( &rDoc, aRangeList, aRange )) != ScAutoSumNone )
{
if (++nColSums == 1)
nColSumsStartRow = aRangeList[0].aStart.Row();
@@ -809,8 +809,8 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor
OUString ScViewFunc::GetAutoSumFormula( const ScRangeList& rRangeList, bool bSubTotal, const ScAddress& rAddr , const OpCode eCode)
{
ScViewData& rViewData = GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
- std::unique_ptr<ScTokenArray> pArray(new ScTokenArray(*pDoc));
+ ScDocument& rDoc = rViewData.GetDocument();
+ std::unique_ptr<ScTokenArray> pArray(new ScTokenArray(rDoc));
pArray->AddOpCode(bSubTotal ? ocSubTotal : eCode);
pArray->AddOpCode(ocOpen);
@@ -831,14 +831,14 @@ OUString ScViewFunc::GetAutoSumFormula( const ScRangeList& rRangeList, bool bSub
if (i != 0)
pArray->AddOpCode(ocSep);
ScComplexRefData aRef;
- aRef.InitRangeRel(pDoc, r, rAddr);
+ aRef.InitRangeRel(&rDoc, r, rAddr);
pArray->AddDoubleReference(aRef);
}
}
pArray->AddOpCode(ocClose);
- ScCompiler aComp(pDoc, rAddr, *pArray, pDoc->GetGrammar());
+ ScCompiler aComp(&rDoc, rAddr, *pArray, rDoc.GetGrammar());
OUStringBuffer aBuf;
aComp.CreateStringFromTokenArray(aBuf);
OUString aFormula = aBuf.makeStringAndClear();
@@ -877,12 +877,12 @@ void ScViewFunc::EnterBlock( const OUString& rString, const EditTextObject* pDat
return;
}
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
OUString aNewStr = rString;
if ( pData )
{
- const ScPatternAttr* pOldPattern = pDoc->GetPattern( nCol, nRow, nTab );
- ScTabEditEngine aEngine( *pOldPattern, pDoc->GetEnginePool(), pDoc );
+ const ScPatternAttr* pOldPattern = rDoc.GetPattern( nCol, nRow, nTab );
+ ScTabEditEngine aEngine( *pOldPattern, rDoc.GetEnginePool(), &rDoc );
aEngine.SetTextCurrentDefaults(*pData);
ScEditAttrTester aTester( &aEngine );
@@ -900,17 +900,17 @@ void ScViewFunc::EnterBlock( const OUString& rString, const EditTextObject* pDat
ScAddress aPos( nCol, nRow, nTab );
ScDocumentUniquePtr pInsDoc(new ScDocument( SCDOCMODE_CLIP ));
- pInsDoc->ResetClip( pDoc, nTab );
+ pInsDoc->ResetClip( &rDoc, nTab );
if (aNewStr[0] == '=') // Formula ?
{
// SetString not possible, because in Clipboard-Documents nothing will be compiled!
- pInsDoc->SetFormulaCell(aPos, new ScFormulaCell(pDoc, aPos, aNewStr));
+ pInsDoc->SetFormulaCell(aPos, new ScFormulaCell(&rDoc, aPos, aNewStr));
}
else if ( pData )
{
// A copy of pData will be stored.
- pInsDoc->SetEditText(aPos, *pData, pDoc->GetEditPool());
+ pInsDoc->SetEditText(aPos, *pData, rDoc.GetEditPool());
}
else
pInsDoc->SetString( nCol, nRow, nTab, aNewStr );
@@ -928,10 +928,10 @@ void ScViewFunc::EnterBlock( const OUString& rString, const EditTextObject* pDat
// MarkData was already MarkToSimple'ed in PasteFromClip
ScRange aRange;
rMark.GetMarkArea( aRange );
- std::unique_ptr<ScPatternAttr> pPattern(new ScPatternAttr( pDoc->GetPool() ));
+ std::unique_ptr<ScPatternAttr> pPattern(new ScPatternAttr( rDoc.GetPool() ));
pPattern->GetItemSet().Put( *pItem );
- SvNumFormatType nNewType = pDoc->GetFormatTable()->GetType( pItem->GetValue() );
- pDoc->ApplyPatternIfNumberformatIncompatible( aRange, rMark,
+ SvNumFormatType nNewType = rDoc.GetFormatTable()->GetType( pItem->GetValue() );
+ rDoc.ApplyPatternIfNumberformatIncompatible( aRange, rMark,
*pPattern, nNewType );
}
}
@@ -1271,8 +1271,8 @@ bool ScViewFunc::TestRemoveMerge()
ScRange aRange;
if (GetViewData().GetSimpleArea( aRange ) == SC_MARK_SIMPLE)
{
- ScDocument* pDoc = GetViewData().GetDocument();
- if ( pDoc->HasAttrib( aRange, HasAttrFlags::Merged ) )
+ ScDocument& rDoc = GetViewData().GetDocument();
+ if ( rDoc.HasAttrib( aRange, HasAttrFlags::Merged ) )
bMerged = true;
}
return bMerged;
@@ -1315,9 +1315,9 @@ bool ScViewFunc::RemoveMerge()
}
else if (GetViewData().GetSimpleArea( aRange ) == SC_MARK_SIMPLE)
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScRange aExtended( aRange );
- pDoc->ExtendMerge( aExtended );
+ rDoc.ExtendMerge( aExtended );
ScDocShell* pDocSh = GetViewData().GetDocShell();
const ScMarkData& rMark = GetViewData().GetMarkData();
ScCellMergeOption aOption(aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row());
@@ -1330,8 +1330,8 @@ bool ScViewFunc::RemoveMerge()
aOption.maTabs.insert(i);
aExtended.aStart.SetTab(i);
aExtended.aEnd.SetTab(i);
- pDoc->ExtendMerge(aExtended);
- pDoc->ExtendOverlapped(aExtended);
+ rDoc.ExtendMerge(aExtended);
+ rDoc.ExtendOverlapped(aExtended);
// Expand the current range to be inclusive of all merged
// areas on all sheets.
@@ -1699,22 +1699,22 @@ void ScViewFunc::FillCrossDblClick()
SCCOL nEndX = aRange.aEnd.Col();
SCROW nEndY = aRange.aEnd.Row();
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
- if (nEndY >= pDoc->MaxRow())
+ if (nEndY >= rDoc.MaxRow())
// Nothing to fill.
return;
// Make sure the selection is not empty
- if ( pDoc->IsBlockEmpty( nTab, nStartX, nStartY, nEndX, nEndY ) )
+ if ( rDoc.IsBlockEmpty( nTab, nStartX, nStartY, nEndX, nEndY ) )
return;
// If there is data in all columns immediately below the selection then
// switch to overwriting fill.
- SCROW nOverWriteEndRow = pDoc->MaxRow();
+ SCROW nOverWriteEndRow = rDoc.MaxRow();
for (SCCOL nCol = nStartX; nCol <= nEndX; ++nCol)
{
- if (pDoc->HasData( nCol, nEndY + 1, nTab))
+ if (rDoc.HasData( nCol, nEndY + 1, nTab))
{
// Determine the shortest data column to end the fill.
SCROW nY = nEndY + 1;
@@ -1722,9 +1722,9 @@ void ScViewFunc::FillCrossDblClick()
// the current row is the last row of a data block and an empty
// cell follows. Somewhat unexpected behaviour...
// So check beforehand if there is one non-empty cell following.
- if (pDoc->HasData( nCol, nY + 1, nTab))
+ if (rDoc.HasData( nCol, nY + 1, nTab))
{
- pDoc->FindAreaPos( nCol, nY, nTab, SC_MOVE_DOWN);
+ rDoc.FindAreaPos( nCol, nY, nTab, SC_MOVE_DOWN);
if (nOverWriteEndRow > nY)
nOverWriteEndRow = nY;
}
@@ -1749,7 +1749,7 @@ void ScViewFunc::FillCrossDblClick()
// Non-overwriting fill follows.
const bool bDataLeft = (nStartX > 0);
- if (!bDataLeft && nEndX >= pDoc->MaxCol())
+ if (!bDataLeft && nEndX >= rDoc.MaxCol())
// Absolutely no data left or right of selection.
return;
@@ -1760,32 +1760,32 @@ void ScViewFunc::FillCrossDblClick()
SCCOL nMovX = (bDataLeft ? nStartX - 1 : nEndX + 1);
SCROW nMovY = nStartY;
- bool bDataFound = (pDoc->HasData( nMovX, nStartY, nTab) && pDoc->HasData( nMovX, nStartY + 1, nTab));
- if (!bDataFound && bDataLeft && nEndX < pDoc->MaxCol())
+ bool bDataFound = (rDoc.HasData( nMovX, nStartY, nTab) && rDoc.HasData( nMovX, nStartY + 1, nTab));
+ if (!bDataFound && bDataLeft && nEndX < rDoc.MaxCol())
{
nMovX = nEndX + 1; // check right
- bDataFound = (pDoc->HasData( nMovX, nStartY, nTab) && pDoc->HasData( nMovX, nStartY + 1, nTab));
+ bDataFound = (rDoc.HasData( nMovX, nStartY, nTab) && rDoc.HasData( nMovX, nStartY + 1, nTab));
}
- if (!(bDataFound && pDoc->IsBlockEmpty( nTab, nStartX, nEndY + 1, nEndX, nEndY + 1, true)))
+ if (!(bDataFound && rDoc.IsBlockEmpty( nTab, nStartX, nEndY + 1, nEndX, nEndY + 1, true)))
return;
// Get end of data left or right.
- pDoc->FindAreaPos( nMovX, nMovY, nTab, SC_MOVE_DOWN);
+ rDoc.FindAreaPos( nMovX, nMovY, nTab, SC_MOVE_DOWN);
// Find minimum end row of below empty area and data right.
for (SCCOL nX = nStartX; nX <= nEndX; ++nX)
{
SCROW nY = nEndY + 1;
// Get next row with data in this column.
- pDoc->FindAreaPos( nX, nY, nTab, SC_MOVE_DOWN);
- if (nMovY == pDoc->MaxRow() && nY == pDoc->MaxRow())
+ rDoc.FindAreaPos( nX, nY, nTab, SC_MOVE_DOWN);
+ if (nMovY == rDoc.MaxRow() && nY == rDoc.MaxRow())
{
// FindAreaPos() returns MAXROW also if there is no data at all
// from the start, so check if that contains data if the nearby
// (left or right) data ends there and increment if no data
// here, pretending the next data would be thereafter so nMovY
// will not be decremented.
- if (!pDoc->HasData( nX, nY, nTab))
+ if (!rDoc.HasData( nX, nY, nTab))
++nY;
}
if (nMovY > nY - 1)
@@ -1843,9 +1843,9 @@ ScAutoFormatData* ScViewFunc::CreateAutoFormatData()
{
if ( nEndCol-nStartCol >= 3 && nEndRow-nStartRow >= 3 )
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
pData = new ScAutoFormatData;
- pDoc->GetAutoFormatData( nStartTab, nStartCol,nStartRow,nEndCol,nEndRow, *pData );
+ rDoc.GetAutoFormatData( nStartTab, nStartCol,nStartRow,nEndCol,nEndRow, *pData );
}
}
return pData;
@@ -2165,16 +2165,13 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
void ScViewFunc::Solve( const ScSolveParam& rParam )
{
- ScDocument* pDoc = GetViewData().GetDocument();
-
- if ( !pDoc )
- return;
+ ScDocument& rDoc = GetViewData().GetDocument();
SCCOL nDestCol = rParam.aRefVariableCell.Col();
SCROW nDestRow = rParam.aRefVariableCell.Row();
SCTAB nDestTab = rParam.aRefVariableCell.Tab();
- ScEditableTester aTester( pDoc, nDestTab, nDestCol,nDestRow, nDestCol,nDestRow );
+ ScEditableTester aTester( &rDoc, nDestTab, nDestCol,nDestRow, nDestCol,nDestRow );
if (!aTester.IsEditable())
{
ErrorMessage(aTester.GetMessageId());
@@ -2192,7 +2189,7 @@ void ScViewFunc::Solve( const ScSolveParam& rParam )
GetFrameWin()->EnterWait();
bool bExact =
- pDoc->Solver(
+ rDoc.Solver(
rParam.aRefFormulaCell.Col(),
rParam.aRefFormulaCell.Row(),
rParam.aRefFormulaCell.Tab(),
@@ -2202,9 +2199,9 @@ void ScViewFunc::Solve( const ScSolveParam& rParam )
GetFrameWin()->LeaveWait();
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+ SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
sal_uLong nFormat = 0;
- const ScPatternAttr* pPattern = pDoc->GetPattern( nDestCol, nDestRow, nDestTab );
+ const ScPatternAttr* pPattern = rDoc.GetPattern( nDestCol, nDestRow, nDestTab );
if ( pPattern )
nFormat = pPattern->GetNumberFormat( pFormatter );
const Color* p;
@@ -2281,8 +2278,8 @@ void ScViewFunc::ExtendScenario()
// Undo: apply attributes
- ScDocument* pDoc = GetViewData().GetDocument();
- ScPatternAttr aPattern( pDoc->GetPool() );
+ ScDocument& rDoc = GetViewData().GetDocument();
+ ScPatternAttr aPattern( rDoc.GetPool() );
aPattern.GetItemSet().Put( ScMergeFlagAttr( ScMF::Scenario ) );
aPattern.GetItemSet().Put( ScProtectionAttr( true ) );
ApplySelectionPattern(aPattern);
@@ -2767,12 +2764,12 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell,
void ScViewFunc::MoveTable(
sal_uInt16 nDestDocNo, SCTAB nDestTab, bool bCopy, const OUString* pNewTabName )
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScDocShell* pDocShell = GetViewData().GetDocShell();
ScDocument* pDestDoc = nullptr;
ScDocShell* pDestShell = nullptr;
ScTabViewShell* pDestViewSh = nullptr;
- bool bUndo (pDoc->IsUndoEnabled());
+ bool bUndo (rDoc.IsUndoEnabled());
bool bRename = pNewTabName && !pNewTabName->isEmpty();
bool bNewDoc = (nDestDocNo == SC_DOC_NEW);
@@ -2821,7 +2818,7 @@ void ScViewFunc::MoveTable(
pDestDoc = &pDestShell->GetDocument();
- if (pDestDoc != pDoc)
+ if (pDestDoc != &rDoc)
{
if (bNewDoc)
{
@@ -2830,7 +2827,7 @@ void ScViewFunc::MoveTable(
pDestDoc->RenameTab( 0, "______42_____" );
}
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
SCTAB nTabSelCount = rMark.GetSelectCount();
vector<SCTAB> TheTabs;
@@ -2840,13 +2837,13 @@ void ScViewFunc::MoveTable(
if(rMark.GetTableSelect(i))
{
OUString aTabName;
- pDoc->GetName( i, aTabName);
+ rDoc.GetName( i, aTabName);
TheTabs.push_back(i);
for(SCTAB j=i+1;j<nTabCount;j++)
{
- if((!pDoc->IsVisible(j)) && pDoc->IsScenario(j))
+ if((!rDoc.IsVisible(j)) && rDoc.IsScenario(j))
{
- pDoc->GetName( j, aTabName);
+ rDoc.GetName( j, aTabName);
TheTabs.push_back(j);
i=j;
}
@@ -2857,7 +2854,7 @@ void ScViewFunc::MoveTable(
GetFrameWin()->EnterWait();
- if (pDoc->GetDrawLayer())
+ if (rDoc.GetDrawLayer())
pDestShell->MakeDrawLayer();
if (!bNewDoc && bUndo)
@@ -2874,7 +2871,7 @@ void ScViewFunc::MoveTable(
if (bRename)
aName = *pNewTabName;
else
- pDoc->GetName( TheTabs[j], aName );
+ rDoc.GetName( TheTabs[j], aName );
pDestDoc->CreateValidTabName( aName );
if ( !pDestDoc->InsertTab( nDestTab1, aName ) )
@@ -2882,10 +2879,10 @@ void ScViewFunc::MoveTable(
nErrVal = 0; // total error
break; // for
}
- ScRange aRange( 0, 0, TheTabs[j], pDoc->MaxCol(), pDoc->MaxRow(), TheTabs[j] );
+ ScRange aRange( 0, 0, TheTabs[j], rDoc.MaxCol(), rDoc.MaxRow(), TheTabs[j] );
aParam.maRanges.push_back(aRange);
}
- pDoc->SetClipParam(aParam);
+ rDoc.SetClipParam(aParam);
if ( nErrVal > 0 )
{
nDestTab1 = nDestTab;
@@ -2964,7 +2961,7 @@ void ScViewFunc::MoveTable(
pDestViewSh->TabChanged(); // pages on the drawing layer
}
- pDestShell->PostPaint( 0,0,0, pDoc->MaxCol(), pDoc->MaxRow(), MAXTAB,
+ pDestShell->PostPaint( 0,0,0, rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB,
PaintPartFlags::Grid | PaintPartFlags::Top | PaintPartFlags::Left |
PaintPartFlags::Extras | PaintPartFlags::Size );
// PaintPartFlags::Size for outline
@@ -2984,7 +2981,7 @@ void ScViewFunc::MoveTable(
else
{
// Move or copy within the same document.
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
unique_ptr< vector<SCTAB> > pSrcTabs(new vector<SCTAB>);
unique_ptr< vector<SCTAB> > pDestTabs(new vector<SCTAB>);
@@ -3000,14 +2997,14 @@ void ScViewFunc::MoveTable(
if(rMark.GetTableSelect(i))
{
OUString aTabName;
- pDoc->GetName( i, aTabName);
+ rDoc.GetName( i, aTabName);
pTabNames->push_back(aTabName);
for(SCTAB j=i+1;j<nTabCount;j++)
{
- if((!pDoc->IsVisible(j)) && pDoc->IsScenario(j))
+ if((!rDoc.IsVisible(j)) && rDoc.IsScenario(j))
{
- pDoc->GetName( j, aTabName);
+ rDoc.GetName( j, aTabName);
pTabNames->push_back(aTabName);
i=j;
}
@@ -3017,45 +3014,45 @@ void ScViewFunc::MoveTable(
}
if (bCopy && bUndo)
- pDoc->BeginDrawUndo(); // drawing layer must do its own undo actions
+ rDoc.BeginDrawUndo(); // drawing layer must do its own undo actions
- pDoc->GetName( nDestTab, aDestName);
+ rDoc.GetName( nDestTab, aDestName);
SCTAB nDestTab1=nDestTab;
SCTAB nMovTab=0;
for (size_t j = 0, n = pTabNames->size(); j < n; ++j)
{
- nTabCount = pDoc->GetTableCount();
+ nTabCount = rDoc.GetTableCount();
const OUString& rStr = (*pTabNames)[j];
- if(!pDoc->GetTable(rStr,nMovTab))
+ if(!rDoc.GetTable(rStr,nMovTab))
{
nMovTab=nTabCount;
}
- if(!pDoc->GetTable(aDestName,nDestTab1))
+ if(!rDoc.GetTable(aDestName,nDestTab1))
{
nDestTab1=nTabCount;
}
pDocShell->MoveTable( nMovTab, nDestTab1, bCopy, false ); // Undo is here
- if(bCopy && pDoc->IsScenario(nMovTab))
+ if(bCopy && rDoc.IsScenario(nMovTab))
{
OUString aComment;
Color aColor;
ScScenarioFlags nFlags;
- pDoc->GetScenarioData(nMovTab, aComment,aColor, nFlags);
- pDoc->SetScenario(nDestTab1,true);
- pDoc->SetScenarioData(nDestTab1,aComment,aColor,nFlags);
- bool bActive = pDoc->IsActiveScenario(nMovTab );
- pDoc->SetActiveScenario( nDestTab1, bActive );
- bool bVisible=pDoc->IsVisible(nMovTab);
- pDoc->SetVisible(nDestTab1,bVisible );
+ rDoc.GetScenarioData(nMovTab, aComment,aColor, nFlags);
+ rDoc.SetScenario(nDestTab1,true);
+ rDoc.SetScenarioData(nDestTab1,aComment,aColor,nFlags);
+ bool bActive = rDoc.IsActiveScenario(nMovTab );
+ rDoc.SetActiveScenario( nDestTab1, bActive );
+ bool bVisible=rDoc.IsVisible(nMovTab);
+ rDoc.SetVisible(nDestTab1,bVisible );
}
pSrcTabs->push_back(nMovTab);
if(!bCopy)
{
- if(!pDoc->GetTable(rStr,nDestTab1))
+ if(!rDoc.GetTable(rStr,nDestTab1))
{
nDestTab1=nTabCount;
}
@@ -3074,9 +3071,9 @@ void ScViewFunc::MoveTable(
{
SCTAB nRenameTab = (*pDestTabs)[j];
OUString aTabName = *pNewTabName;
- pDoc->CreateValidTabName( aTabName );
+ rDoc.CreateValidTabName( aTabName );
pDestNames->push_back(aTabName);
- pDoc->RenameTab(nRenameTab, aTabName);
+ rDoc.RenameTab(nRenameTab, aTabName);
}
}
else
@@ -3103,7 +3100,7 @@ void ScViewFunc::MoveTable(
SCTAB nNewTab = nDestTab;
if (nNewTab == SC_TAB_APPEND)
- nNewTab = pDoc->GetTableCount()-1;
+ nNewTab = rDoc.GetTableCount()-1;
else if (!bCopy && nTab<nDestTab)
nNewTab--;
@@ -3111,7 +3108,7 @@ void ScViewFunc::MoveTable(
//#i29848# adjust references to data on the copied sheet
if( bCopy )
- ScChartHelper::AdjustRangesOfChartsOnDestinationPage( pDoc, pDestDoc, nTab, nNewTab );
+ ScChartHelper::AdjustRangesOfChartsOnDestinationPage( &rDoc, pDestDoc, nTab, nNewTab );
}
}
@@ -3216,11 +3213,11 @@ void ScViewFunc::InsertSpecialChar( const OUString& rStr, const vcl::Font& rFont
// if string contains WEAK characters, set all fonts
SvtScriptType nScript;
- ScDocument* pDoc = GetViewData().GetDocument();
- if ( pDoc->HasStringWeakCharacters( rStr ) )
+ ScDocument& rDoc = GetViewData().GetDocument();
+ if ( rDoc.HasStringWeakCharacters( rStr ) )
nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
else
- nScript = pDoc->GetStringScriptType( rStr );
+ nScript = rDoc.GetStringScriptType( rStr );
SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, pViewShell->GetPool() );
aSetItem.PutItemForScriptType( nScript, aFontItem );
@@ -3276,9 +3273,9 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine,
return;
}
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScMarkData aFuncMark( GetViewData().GetMarkData() ); // local copy for UnmarkFiltered
- ScViewUtil::UnmarkFiltered( aFuncMark, pDoc );
+ ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc );
ScDocShell* pDocSh = GetViewData().GetDocShell();
const ScPatternAttr* pSelAttrs = GetSelectionPattern();
const SfxItemSet& rSelItemSet = pSelAttrs->GetItemSet();
@@ -3300,11 +3297,11 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine,
if( (eItemState != SfxItemState::DONTCARE) && (eTLBRState != SfxItemState::DONTCARE) && (eBLTRState != SfxItemState::DONTCARE) )
{
std::unique_ptr<SfxItemSet> pOldSet(new SfxItemSet(
- *(pDoc->GetPool()),
+ *rDoc.GetPool(),
svl::Items<ATTR_PATTERN_START,
ATTR_PATTERN_END>{} ));
std::unique_ptr<SfxItemSet> pNewSet(new SfxItemSet(
- *(pDoc->GetPool()),
+ *rDoc.GetPool(),
svl::Items<ATTR_PATTERN_START,
ATTR_PATTERN_END>{} ));
@@ -3354,7 +3351,7 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine,
else // if ( eItemState == SfxItemState::DONTCARE )
{
aFuncMark.MarkToMulti();
- pDoc->ApplySelectionLineStyle( aFuncMark, pLine, bColorOnly );
+ rDoc.ApplySelectionLineStyle( aFuncMark, pLine, bColorOnly );
}
ScRange aMarkRange;
@@ -3377,8 +3374,8 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine,
void ScViewFunc::SetValidation( const ScValidationData& rNew )
{
- ScDocument* pDoc = GetViewData().GetDocument();
- sal_uLong nIndex = pDoc->AddValidationEntry(rNew); // for it there is no Undo
+ ScDocument& rDoc = GetViewData().GetDocument();
+ sal_uLong nIndex = rDoc.AddValidationEntry(rNew); // for it there is no Undo
SfxUInt32Item aItem( ATTR_VALIDDATA, nIndex );
ApplyAttr( aItem ); // with Paint and Undo...
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index a1e3051562fb..aba8c6666765 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -98,10 +98,10 @@ void ScViewFunc::CutToClip()
ScRange aRange; // delete this range
if ( GetViewData().GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScDocShell* pDocSh = GetViewData().GetDocShell();
ScMarkData& rMark = GetViewData().GetMarkData();
- const bool bRecord(pDoc->IsUndoEnabled()); // Undo/Redo
+ const bool bRecord(rDoc.IsUndoEnabled()); // Undo/Redo
ScDocShellModificator aModificator( *pDocSh );
@@ -116,27 +116,27 @@ void ScViewFunc::CutToClip()
CopyToClip( nullptr, true, false, true/*bIncludeObjects*/ ); // copy to clipboard
ScAddress aOldEnd( aRange.aEnd ); // combined cells in this range?
- pDoc->ExtendMerge( aRange, true );
+ rDoc.ExtendMerge( aRange, true );
ScDocumentUniquePtr pUndoDoc;
if ( bRecord )
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndoSelected( pDoc, rMark );
+ pUndoDoc->InitUndoSelected( &rDoc, rMark );
// all sheets - CopyToDocument skips those that don't exist in pUndoDoc
ScRange aCopyRange = aRange;
aCopyRange.aStart.SetTab(0);
- aCopyRange.aEnd.SetTab(pDoc->GetTableCount()-1);
- pDoc->CopyToDocument( aCopyRange, (InsertDeleteFlags::ALL & ~InsertDeleteFlags::OBJECTS) | InsertDeleteFlags::NOCAPTIONS, false, *pUndoDoc );
- pDoc->BeginDrawUndo();
+ aCopyRange.aEnd.SetTab(rDoc.GetTableCount()-1);
+ rDoc.CopyToDocument( aCopyRange, (InsertDeleteFlags::ALL & ~InsertDeleteFlags::OBJECTS) | InsertDeleteFlags::NOCAPTIONS, false, *pUndoDoc );
+ rDoc.BeginDrawUndo();
}
sal_uInt16 nExtFlags = 0;
pDocSh->UpdatePaintExt( nExtFlags, aRange );
rMark.MarkToMulti();
- pDoc->DeleteSelection( InsertDeleteFlags::ALL, rMark );
- pDoc->DeleteObjectsInSelection( rMark );
+ rDoc.DeleteSelection( InsertDeleteFlags::ALL, rMark );
+ rDoc.DeleteObjectsInSelection( rMark );
rMark.MarkToSimple();
if ( !AdjustRowHeight( aRange.aStart.Row(), aRange.aEnd.Row() ) )
@@ -216,11 +216,10 @@ bool ScViewFunc::CopyToClipSingleRange( ScDocument* pClipDoc, const ScRangeList&
ScRange aRange = rRanges[0];
ScClipParam aClipParam( aRange, bCut );
aClipParam.maRanges = rRanges;
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScMarkData& rMark = GetViewData().GetMarkData();
- if ( !pDoc
- || pDoc->HasSelectedBlockMatrixFragment( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), rMark ) )
+ if (rDoc.HasSelectedBlockMatrixFragment( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), rMark ) )
return false;
bool bSysClip = false;
@@ -232,14 +231,14 @@ bool ScViewFunc::CopyToClipSingleRange( ScDocument* pClipDoc, const ScRangeList&
}
if ( !bCut )
{
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->ResetLastCut();
}
if ( bSysClip && bIncludeObjects )
{
- bool bAnyOle = pDoc->HasOLEObjectsInArea( aRange );
+ bool bAnyOle = rDoc.HasOLEObjectsInArea( aRange );
// Update ScGlobal::xDrawClipDocShellRef.
ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle ) );
}
@@ -247,9 +246,9 @@ bool ScViewFunc::CopyToClipSingleRange( ScDocument* pClipDoc, const ScRangeList&
// is this necessary?, will setting the doc id upset the
// following paste operation with range? would be nicer to just set this always
// and lose the 'if' above
- aClipParam.setSourceDocID( pDoc->GetDocumentID() );
+ aClipParam.setSourceDocID( rDoc.GetDocumentID() );
- if (SfxObjectShell* pObjectShell = pDoc->GetDocumentShell())
+ if (SfxObjectShell* pObjectShell = rDoc.GetDocumentShell())
{
// Copy document properties from pObjectShell to pClipDoc (to its clip options, as it has no object shell).
uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(pObjectShell->GetModel(), uno::UNO_QUERY);
@@ -259,7 +258,7 @@ bool ScViewFunc::CopyToClipSingleRange( ScDocument* pClipDoc, const ScRangeList&
pClipDoc->SetClipOptions(std::move(pOptions));
}
- pDoc->CopyToClip( aClipParam, pClipDoc, &rMark, false, bIncludeObjects );
+ rDoc.CopyToClip( aClipParam, pClipDoc, &rMark, false, bIncludeObjects );
if (ScDrawLayer* pDrawLayer = pClipDoc->GetDrawLayer())
{
ScClipParam& rClipDocClipParam = pClipDoc->GetClipParam();
@@ -270,7 +269,7 @@ bool ScViewFunc::CopyToClipSingleRange( ScDocument* pClipDoc, const ScRangeList&
SdrPage* pPage = pDrawLayer->GetPage( static_cast< sal_uInt16 >( nTab ) );
if ( pPage )
{
- ScChartHelper::FillProtectedChartRangesVector( rRangesVector, pDoc, pPage );
+ ScChartHelper::FillProtectedChartRangesVector( rRangesVector, &rDoc, pPage );
}
}
}
@@ -278,7 +277,7 @@ bool ScViewFunc::CopyToClipSingleRange( ScDocument* pClipDoc, const ScRangeList&
if ( bSysClip )
{
ScDrawLayer::SetGlobalDrawPersist(nullptr);
- ScGlobal::SetClipDocName( pDoc->GetDocumentShell()->GetTitle( SFX_TITLE_FULLNAME ) );
+ ScGlobal::SetClipDocName( rDoc.GetDocumentShell()->GetTitle( SFX_TITLE_FULLNAME ) );
}
pClipDoc->ExtendMerge( aRange, true );
@@ -321,7 +320,7 @@ bool ScViewFunc::CopyToClipMultiRange( const ScDocument* pInputClipDoc, const Sc
ScClipParam aClipParam( rRanges[0], bCut );
aClipParam.maRanges = rRanges;
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScMarkData& rMark = GetViewData().GetMarkData();
bool bDone = false;
bool bSuccess = false;
@@ -343,7 +342,7 @@ bool ScViewFunc::CopyToClipMultiRange( const ScDocument* pInputClipDoc, const Sc
for ( size_t i = 1; i < aClipParam.maRanges.size(); ++i )
{
p = &aClipParam.maRanges[i];
- if ( pDoc->HasSelectedBlockMatrixFragment(
+ if ( rDoc.HasSelectedBlockMatrixFragment(
p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(), rMark) )
{
if (!bApi)
@@ -394,9 +393,9 @@ bool ScViewFunc::CopyToClipMultiRange( const ScDocument* pInputClipDoc, const Sc
}
if (!bValidRanges)
break;
- pDoc->CopyToClip(aClipParam, pDocClip.get(), &rMark, false, bIncludeObjects );
+ rDoc.CopyToClip(aClipParam, pDocClip.get(), &rMark, false, bIncludeObjects );
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->ResetLastCut(); // no more cut-mode
@@ -431,20 +430,20 @@ ScTransferObj* ScViewFunc::CopyToTransferable()
ScRange aRange;
if ( GetViewData().GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScMarkData& rMark = GetViewData().GetMarkData();
- if ( !pDoc->HasSelectedBlockMatrixFragment(
+ if ( !rDoc.HasSelectedBlockMatrixFragment(
aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(),
rMark ) )
{
ScDocumentUniquePtr pClipDoc(new ScDocument( SCDOCMODE_CLIP )); // create one (deleted by ScTransferObj)
- bool bAnyOle = pDoc->HasOLEObjectsInArea( aRange, &rMark );
+ bool bAnyOle = rDoc.HasOLEObjectsInArea( aRange, &rMark );
ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle ) );
ScClipParam aClipParam(aRange, false);
- pDoc->CopyToClip(aClipParam, pClipDoc.get(), &rMark, false, true);
+ rDoc.CopyToClip(aClipParam, pClipDoc.get(), &rMark, false, true);
ScDrawLayer::SetGlobalDrawPersist(nullptr);
pClipDoc->ExtendMerge( aRange, true );
@@ -971,10 +970,10 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
SCROW nDestSizeY;
pClipDoc->GetClipArea( nDestSizeX, nDestSizeY, bIncludeFiltered );
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScDocShell* pDocSh = GetViewData().GetDocShell();
SfxUndoManager* pUndoMgr = pDocSh->GetUndoManager();
- const bool bRecord(pDoc->IsUndoEnabled());
+ const bool bRecord(rDoc.IsUndoEnabled());
ScDocShellModificator aModificator( *pDocSh );
@@ -998,13 +997,13 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
nEndRow = nStartRow + nDestSizeY;
nEndTab = nStartTab;
aMarkRange = ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab);
- if (ScViewUtil::HasFiltered( aMarkRange, pDoc))
+ if (ScViewUtil::HasFiltered( aMarkRange, &rDoc))
{
bMarkIsFiltered = true;
// Fit to clipboard's row count unfiltered rows. If there is no
// fit assume that pasting is not possible. Note that nDestSizeY is
// size-1 (difference).
- if (!ScViewUtil::FitToUnfilteredRows( aMarkRange, pDoc, nDestSizeY+1))
+ if (!ScViewUtil::FitToUnfilteredRows( aMarkRange, &rDoc, nDestSizeY+1))
bNoPaste = true;
}
aFilteredMark.SetMarkArea( aMarkRange);
@@ -1033,7 +1032,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
ScRangeList aRangeList;
if (bMarkIsFiltered)
{
- ScViewUtil::UnmarkFiltered( aFilteredMark, pDoc);
+ ScViewUtil::UnmarkFiltered( aFilteredMark, &rDoc);
aFilteredMark.FillRangeListWithMarks( &aRangeList, false);
nUnfilteredRows = 0;
size_t ListSize = aRangeList.size();
@@ -1097,11 +1096,11 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
// introduce filtered rows where there weren't any before, so
// we also need to test for that.
aMarkRange = ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab);
- if (bMarkIsFiltered || ScViewUtil::HasFiltered( aMarkRange, pDoc))
+ if (bMarkIsFiltered || ScViewUtil::HasFiltered( aMarkRange, &rDoc))
{
bMarkIsFiltered = true;
// Worst case: all rows up to the end of the sheet are filtered.
- if (!ScViewUtil::FitToUnfilteredRows( aMarkRange, pDoc, nDestSizeY+1))
+ if (!ScViewUtil::FitToUnfilteredRows( aMarkRange, &rDoc, nDestSizeY+1))
{
ErrorMessage(STR_PASTE_FULL);
return false;
@@ -1111,7 +1110,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
aFilteredMark.SetMarkArea( aMarkRange);
if (bMarkIsFiltered)
{
- ScViewUtil::UnmarkFiltered( aFilteredMark, pDoc);
+ ScViewUtil::UnmarkFiltered( aFilteredMark, &rDoc);
aFilteredMark.FillRangeListWithMarks( &aRangeList, true);
}
}
@@ -1127,7 +1126,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
nEndTab = nStartTab;
}
- bool bOffLimits = !pDoc->ValidCol(nEndCol) || !pDoc->ValidRow(nEndRow);
+ bool bOffLimits = !rDoc.ValidCol(nEndCol) || !rDoc.ValidRow(nEndRow);
// target-range, as displayed:
ScRange aUserRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab );
@@ -1162,7 +1161,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
if ( bAskIfNotEmpty )
{
ScRangeList aTestRanges(aUserRange);
- if (!checkDestRangeForOverwrite(aTestRanges, pDoc, aFilteredMark, GetViewData().GetDialogParent()))
+ if (!checkDestRangeForOverwrite(aTestRanges, &rDoc, aFilteredMark, GetViewData().GetDialogParent()))
return false;
}
}
@@ -1191,11 +1190,11 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
return false;
}
- pDoc->ExtendMergeSel( nStartCol,nStartRow, nUndoEndCol,nUndoEndRow, aFilteredMark );
+ rDoc.ExtendMergeSel( nStartCol,nStartRow, nUndoEndCol,nUndoEndRow, aFilteredMark );
// check cell-protection
- ScEditableTester aTester( pDoc, nStartTab, nStartCol,nStartRow, nUndoEndCol,nUndoEndRow );
+ ScEditableTester aTester( &rDoc, nStartTab, nStartCol,nStartRow, nUndoEndCol,nUndoEndRow );
if (!aTester.IsEditable())
{
ErrorMessage(aTester.GetMessageId());
@@ -1213,9 +1212,9 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
}
if (bClipOver)
- if (lcl_SelHasAttrib( pDoc, nStartCol,nStartRow, nUndoEndCol,nUndoEndRow, aFilteredMark, HasAttrFlags::Overlapped ))
+ if (lcl_SelHasAttrib( &rDoc, nStartCol,nStartRow, nUndoEndCol,nUndoEndRow, aFilteredMark, HasAttrFlags::Overlapped ))
{ // "Cell merge not possible if cells already merged"
- ScDocAttrIterator aIter( pDoc, nStartTab, nStartCol, nStartRow, nUndoEndCol, nUndoEndRow );
+ ScDocAttrIterator aIter( &rDoc, nStartTab, nStartCol, nStartRow, nUndoEndCol, nUndoEndRow );
const ScPatternAttr* pPattern = nullptr;
SCCOL nCol = -1;
SCROW nRow1 = -1;
@@ -1227,8 +1226,8 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
if (rMergeFlag.IsMerged() || rMergeFlagAttr.IsOverlapped())
{
ScRange aRange(nCol, nRow1, nStartTab);
- pDoc->ExtendOverlapped(aRange);
- pDoc->ExtendMerge(aRange, true);
+ rDoc.ExtendOverlapped(aRange);
+ rDoc.ExtendMerge(aRange, true);
rDocFunc.UnmergeCells(aRange, bRecord, nullptr /*TODO: should pass combined UndoDoc if bRecord*/);
}
}
@@ -1236,13 +1235,13 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
if ( !bCutMode )
{
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->ResetLastCut(); // no more cut-mode
}
- bool bColInfo = ( nStartRow==0 && nEndRow==pDoc->MaxRow() );
- bool bRowInfo = ( nStartCol==0 && nEndCol==pDoc->MaxCol() );
+ bool bColInfo = ( nStartRow==0 && nEndRow==rDoc.MaxRow() );
+ bool bRowInfo = ( nStartCol==0 && nEndCol==rDoc.MaxCol() );
ScDocumentUniquePtr pUndoDoc;
std::unique_ptr<ScDocument> pRefUndoDoc;
@@ -1251,19 +1250,19 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
if ( bRecord )
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndoSelected( pDoc, aFilteredMark, bColInfo, bRowInfo );
+ pUndoDoc->InitUndoSelected( &rDoc, aFilteredMark, bColInfo, bRowInfo );
// all sheets - CopyToDocument skips those that don't exist in pUndoDoc
- SCTAB nTabCount = pDoc->GetTableCount();
- pDoc->CopyToDocument( nStartCol, nStartRow, 0, nUndoEndCol, nUndoEndRow, nTabCount-1,
+ SCTAB nTabCount = rDoc.GetTableCount();
+ rDoc.CopyToDocument( nStartCol, nStartRow, 0, nUndoEndCol, nUndoEndRow, nTabCount-1,
nUndoFlags, false, *pUndoDoc );
if ( bCutMode )
{
pRefUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pRefUndoDoc->InitUndo( pDoc, 0, nTabCount-1 );
+ pRefUndoDoc->InitUndo( &rDoc, 0, nTabCount-1 );
- pUndoData.reset(new ScRefUndoData( pDoc ));
+ pUndoData.reset(new ScRefUndoData( &rDoc ));
}
}
@@ -1289,55 +1288,55 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
if ( nFlags & InsertDeleteFlags::CONTENTS )
{
pMixDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pMixDoc->InitUndo( pDoc, nStartTab, nEndTab );
- pDoc->CopyToDocument(nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab,
+ pMixDoc->InitUndo( &rDoc, nStartTab, nEndTab );
+ rDoc.CopyToDocument(nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab,
InsertDeleteFlags::CONTENTS, false, *pMixDoc);
}
}
/* Make draw layer and start drawing undo.
- Needed before AdjustBlockHeight to track moved drawing objects.
- - Needed before pDoc->CopyFromClip to track inserted note caption objects.
+ - Needed before rDoc.CopyFromClip to track inserted note caption objects.
*/
if ( bPasteDraw )
pDocSh->MakeDrawLayer();
if ( bRecord )
- pDoc->BeginDrawUndo();
+ rDoc.BeginDrawUndo();
InsertDeleteFlags nNoObjFlags = nFlags & ~InsertDeleteFlags::OBJECTS;
if (!bAsLink)
{
// copy normally (original range)
- pDoc->CopyFromClip( aUserRange, aFilteredMark, nNoObjFlags,
+ rDoc.CopyFromClip( aUserRange, aFilteredMark, nNoObjFlags,
pRefUndoDoc.get(), pClipDoc, true, false, bIncludeFiltered,
bSkipEmpty, (bMarkIsFiltered ? &aRangeList : nullptr) );
// adapt refs manually in case of transpose
if ( bTranspose && bCutMode && (nFlags & InsertDeleteFlags::CONTENTS) )
- pDoc->UpdateTranspose( aUserRange.aStart, pOrigClipDoc, aFilteredMark, pRefUndoDoc.get() );
+ rDoc.UpdateTranspose( aUserRange.aStart, pOrigClipDoc, aFilteredMark, pRefUndoDoc.get() );
}
else if (!bTranspose)
{
// copy with bAsLink=TRUE
- pDoc->CopyFromClip( aUserRange, aFilteredMark, nNoObjFlags, pRefUndoDoc.get(), pClipDoc,
+ rDoc.CopyFromClip( aUserRange, aFilteredMark, nNoObjFlags, pRefUndoDoc.get(), pClipDoc,
true, true, bIncludeFiltered, bSkipEmpty );
}
else
{
// copy all content (TransClipDoc contains only formula)
- pDoc->CopyFromClip( aUserRange, aFilteredMark, nContFlags, pRefUndoDoc.get(), pClipDoc );
+ rDoc.CopyFromClip( aUserRange, aFilteredMark, nContFlags, pRefUndoDoc.get(), pClipDoc );
}
// skipped rows and merged cells don't mix
if ( !bIncludeFiltered && pClipDoc->HasClipFilteredRows() )
rDocFunc.UnmergeCells( aUserRange, false, nullptr );
- pDoc->ExtendMergeSel( nStartCol, nStartRow, nEndCol, nEndRow, aFilteredMark, true ); // refresh
+ rDoc.ExtendMergeSel( nStartCol, nStartRow, nEndCol, nEndRow, aFilteredMark, true ); // refresh
// new range
if ( pMixDoc ) // calculate with original data?
{
- pDoc->MixDocument( aUserRange, nFunction, bSkipEmpty, pMixDoc.get() );
+ rDoc.MixDocument( aUserRange, nFunction, bSkipEmpty, pMixDoc.get() );
}
pMixDoc.reset();
@@ -1358,7 +1357,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
// Paste the drawing objects after the row heights have been updated.
- pDoc->CopyFromClip( aUserRange, aFilteredMark, InsertDeleteFlags::OBJECTS, pRefUndoDoc.get(), pClipDoc,
+ rDoc.CopyFromClip( aUserRange, aFilteredMark, InsertDeleteFlags::OBJECTS, pRefUndoDoc.get(), pClipDoc,
true, false, bIncludeFiltered );
}
@@ -1367,7 +1366,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
// if necessary, delete autofilter-heads
if (bCutMode)
- if (pDoc->RefreshAutoFilter( nClipStartX,nClipStartY, nClipStartX+nClipSizeX,
+ if (rDoc.RefreshAutoFilter( nClipStartX,nClipStartY, nClipStartX+nClipSizeX,
nClipStartY+nClipSizeY, nStartTab ))
{
pDocSh->PostPaint(
@@ -1386,13 +1385,13 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
if (pRefUndoDoc)
{
pRedoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pRedoDoc->InitUndo( pDoc, nStartTab, nEndTab, bColInfo, bRowInfo );
+ pRedoDoc->InitUndo( &rDoc, nStartTab, nEndTab, bColInfo, bRowInfo );
// move adapted refs to Redo-Doc
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
pRedoDoc->AddUndoTab( 0, nTabCount-1 );
- pDoc->CopyUpdated( pRefUndoDoc.get(), pRedoDoc.get() );
+ rDoc.CopyUpdated( pRefUndoDoc.get(), pRedoDoc.get() );
// move old refs to Undo-Doc
@@ -1435,12 +1434,12 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
if (bColInfo)
{
nPaint |= PaintPartFlags::Top;
- nUndoEndCol = pDoc->MaxCol(); // just for drawing !
+ nUndoEndCol = rDoc.MaxCol(); // just for drawing !
}
if (bRowInfo)
{
nPaint |= PaintPartFlags::Left;
- nUndoEndRow = pDoc->MaxRow(); // just for drawing !
+ nUndoEndRow = rDoc.MaxRow(); // just for drawing !
}
pDocSh->PostPaint(
ScRange(nStartCol, nStartRow, nStartTab, nUndoEndCol, nUndoEndRow, nEndTab),
@@ -1456,9 +1455,9 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
ScModelObj* pModelObj = comphelper::getUnoTunnelImplementation<ScModelObj>( pDocSh->GetModel() );
if ( pPage && pModelObj )
{
- bool bSameDoc = ( rClipParam.getSourceDocID() == pDoc->GetDocumentID() );
+ bool bSameDoc = ( rClipParam.getSourceDocID() == rDoc.GetDocumentID() );
const ScRangeListVector& rProtectedChartRangesVector( rClipParam.maProtectedChartRangesVector );
- ScChartHelper::CreateProtectedChartListenersAndNotify( pDoc, pPage, pModelObj, nStartTab,
+ ScChartHelper::CreateProtectedChartListenersAndNotify( &rDoc, pPage, pModelObj, nStartTab,
rProtectedChartRangesVector, aExcludedChartNames, bSameDoc );
}
}
@@ -1474,7 +1473,7 @@ bool ScViewFunc::PasteMultiRangesFromClip(
InsCellCmd eMoveMode, InsertDeleteFlags nUndoFlags)
{
ScViewData& rViewData = GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
ScDocShell* pDocSh = rViewData.GetDocShell();
ScMarkData aMark(rViewData.GetMarkData());
const ScAddress& rCurPos = rViewData.GetCurPos();
@@ -1498,7 +1497,7 @@ bool ScViewFunc::PasteMultiRangesFromClip(
nRowSize = static_cast<SCROW>(nTempColSize);
}
- if (!pDoc->ValidCol(rCurPos.Col()+nColSize-1) || !pDoc->ValidRow(rCurPos.Row()+nRowSize-1))
+ if (!rDoc.ValidCol(rCurPos.Col()+nColSize-1) || !rDoc.ValidRow(rCurPos.Row()+nRowSize-1))
{
ErrorMessage(STR_PASTE_FULL);
return false;
@@ -1518,9 +1517,9 @@ bool ScViewFunc::PasteMultiRangesFromClip(
// Extend the marked range to account for filtered rows in the destination
// area.
- if (ScViewUtil::HasFiltered(aMarkedRange, pDoc))
+ if (ScViewUtil::HasFiltered(aMarkedRange, &rDoc))
{
- if (!ScViewUtil::FitToUnfilteredRows(aMarkedRange, pDoc, nRowSize))
+ if (!ScViewUtil::FitToUnfilteredRows(aMarkedRange, &rDoc, nRowSize))
return false;
}
@@ -1531,7 +1530,7 @@ bool ScViewFunc::PasteMultiRangesFromClip(
if (bAskIfNotEmpty)
{
ScRangeList aTestRanges(aMarkedRange);
- if (!checkDestRangeForOverwrite(aTestRanges, pDoc, aMark, GetViewData().GetDialogParent()))
+ if (!checkDestRangeForOverwrite(aTestRanges, &rDoc, aMark, GetViewData().GetDialogParent()))
return false;
}
@@ -1541,17 +1540,17 @@ bool ScViewFunc::PasteMultiRangesFromClip(
bool bInsertCells = (eMoveMode != INS_NONE);
if (bInsertCells)
{
- if (!InsertCells(eMoveMode, pDoc->IsUndoEnabled(), true))
+ if (!InsertCells(eMoveMode, rDoc.IsUndoEnabled(), true))
return false;
}
bool bRowInfo = ( aMarkedRange.aStart.Col()==0 && aMarkedRange.aEnd.Col()==pClipDoc->MaxCol() );
ScDocumentUniquePtr pUndoDoc;
- if (pDoc->IsUndoEnabled())
+ if (rDoc.IsUndoEnabled())
{
pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO));
- pUndoDoc->InitUndoSelected(pDoc, aMark, false, bRowInfo);
- pDoc->CopyToDocument(aMarkedRange, nUndoFlags, false, *pUndoDoc, &aMark);
+ pUndoDoc->InitUndoSelected(&rDoc, aMark, false, bRowInfo);
+ rDoc.CopyToDocument(aMarkedRange, nUndoFlags, false, *pUndoDoc, &aMark);
}
ScDocumentUniquePtr pMixDoc;
@@ -1560,33 +1559,33 @@ bool ScViewFunc::PasteMultiRangesFromClip(
if ( nFlags & InsertDeleteFlags::CONTENTS )
{
pMixDoc.reset(new ScDocument(SCDOCMODE_UNDO));
- pMixDoc->InitUndoSelected(pDoc, aMark);
- pDoc->CopyToDocument(aMarkedRange, InsertDeleteFlags::CONTENTS, false, *pMixDoc, &aMark);
+ pMixDoc->InitUndoSelected(&rDoc, aMark);
+ rDoc.CopyToDocument(aMarkedRange, InsertDeleteFlags::CONTENTS, false, *pMixDoc, &aMark);
}
}
/* Make draw layer and start drawing undo.
- Needed before AdjustBlockHeight to track moved drawing objects.
- - Needed before pDoc->CopyFromClip to track inserted note caption objects.
+ - Needed before rDoc.CopyFromClip to track inserted note caption objects.
*/
if (nFlags & InsertDeleteFlags::OBJECTS)
pDocSh->MakeDrawLayer();
- if (pDoc->IsUndoEnabled())
- pDoc->BeginDrawUndo();
+ if (rDoc.IsUndoEnabled())
+ rDoc.BeginDrawUndo();
InsertDeleteFlags nNoObjFlags = nFlags & ~InsertDeleteFlags::OBJECTS;
- pDoc->CopyMultiRangeFromClip(rCurPos, aMark, nNoObjFlags, pClipDoc,
+ rDoc.CopyMultiRangeFromClip(rCurPos, aMark, nNoObjFlags, pClipDoc,
true, bAsLink, false, bSkipEmpty);
if (pMixDoc)
- pDoc->MixDocument(aMarkedRange, nFunction, bSkipEmpty, pMixDoc.get());
+ rDoc.MixDocument(aMarkedRange, nFunction, bSkipEmpty, pMixDoc.get());
AdjustBlockHeight(); // update row heights before pasting objects
if (nFlags & InsertDeleteFlags::OBJECTS)
{
// Paste the drawing objects after the row heights have been updated.
- pDoc->CopyMultiRangeFromClip(rCurPos, aMark, InsertDeleteFlags::OBJECTS, pClipDoc,
+ rDoc.CopyMultiRangeFromClip(rCurPos, aMark, InsertDeleteFlags::OBJECTS, pClipDoc,
true, false, false, true);
}
@@ -1600,7 +1599,7 @@ bool ScViewFunc::PasteMultiRangesFromClip(
pDocSh->PostPaint(aTmp, PaintPartFlags::Grid);
}
- if (pDoc->IsUndoEnabled())
+ if (rDoc.IsUndoEnabled())
{
SfxUndoManager* pUndoMgr = pDocSh->GetUndoManager();
OUString aUndo = ScResId(
@@ -1660,13 +1659,13 @@ bool ScViewFunc::PasteFromClipToMultiRanges(
}
const ScAddress& rCurPos = rViewData.GetCurPos();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
ScRange aSrcRange = rClipParam.getWholeRange();
SCROW nRowSize = aSrcRange.aEnd.Row() - aSrcRange.aStart.Row() + 1;
SCCOL nColSize = aSrcRange.aEnd.Col() - aSrcRange.aStart.Col() + 1;
- if (!pDoc->ValidCol(rCurPos.Col()+nColSize-1) || !pDoc->ValidRow(rCurPos.Row()+nRowSize-1))
+ if (!rDoc.ValidCol(rCurPos.Col()+nColSize-1) || !rDoc.ValidRow(rCurPos.Row()+nRowSize-1))
{
ErrorMessage(STR_PASTE_FULL);
return false;
@@ -1677,7 +1676,7 @@ bool ScViewFunc::PasteFromClipToMultiRanges(
ScRangeList aRanges;
aMark.MarkToSimple();
aMark.FillRangeListWithMarks(&aRanges, false);
- if (!ScClipUtil::CheckDestRanges(pDoc, nColSize, nRowSize, aMark, aRanges))
+ if (!ScClipUtil::CheckDestRanges(&rDoc, nColSize, nRowSize, aMark, aRanges))
{
ErrorMessage(STR_MSSG_PASTEFROMCLIP_0);
return false;
@@ -1693,18 +1692,18 @@ bool ScViewFunc::PasteFromClipToMultiRanges(
if (bAskIfNotEmpty)
{
- if (!checkDestRangeForOverwrite(aRanges, pDoc, aMark, GetViewData().GetDialogParent()))
+ if (!checkDestRangeForOverwrite(aRanges, &rDoc, aMark, GetViewData().GetDialogParent()))
return false;
}
ScDocumentUniquePtr pUndoDoc;
- if (pDoc->IsUndoEnabled())
+ if (rDoc.IsUndoEnabled())
{
pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO));
- pUndoDoc->InitUndoSelected(pDoc, aMark);
+ pUndoDoc->InitUndoSelected(&rDoc, aMark);
for (size_t i = 0, n = aRanges.size(); i < n; ++i)
{
- pDoc->CopyToDocument(
+ rDoc.CopyToDocument(
aRanges[i], nUndoFlags, false, *pUndoDoc, &aMark);
}
}
@@ -1715,10 +1714,10 @@ bool ScViewFunc::PasteFromClipToMultiRanges(
if (nFlags & InsertDeleteFlags::CONTENTS)
{
pMixDoc.reset(new ScDocument(SCDOCMODE_UNDO));
- pMixDoc->InitUndoSelected(pDoc, aMark);
+ pMixDoc->InitUndoSelected(&rDoc, aMark);
for (size_t i = 0, n = aRanges.size(); i < n; ++i)
{
- pDoc->CopyToDocument(
+ rDoc.CopyToDocument(
aRanges[i], InsertDeleteFlags::CONTENTS, false, *pMixDoc, &aMark);
}
}
@@ -1726,13 +1725,13 @@ bool ScViewFunc::PasteFromClipToMultiRanges(
if (nFlags & InsertDeleteFlags::OBJECTS)
pDocSh->MakeDrawLayer();
- if (pDoc->IsUndoEnabled())
- pDoc->BeginDrawUndo();
+ if (rDoc.IsUndoEnabled())
+ rDoc.BeginDrawUndo();
// First, paste everything but the drawing objects.
for (size_t i = 0, n = aRanges.size(); i < n; ++i)
{
- pDoc->CopyFromClip(
+ rDoc.CopyFromClip(
aRanges[i], aMark, (nFlags & ~InsertDeleteFlags::OBJECTS), nullptr, pClipDoc,
false, false, true, bSkipEmpty);
}
@@ -1740,7 +1739,7 @@ bool ScViewFunc::PasteFromClipToMultiRanges(
if (pMixDoc)
{
for (size_t i = 0, n = aRanges.size(); i < n; ++i)
- pDoc->MixDocument(aRanges[i], nFunction, bSkipEmpty, pMixDoc.get());
+ rDoc.MixDocument(aRanges[i], nFunction, bSkipEmpty, pMixDoc.get());
}
AdjustBlockHeight(); // update row heights before pasting objects
@@ -1750,7 +1749,7 @@ bool ScViewFunc::PasteFromClipToMultiRanges(
{
for (size_t i = 0, n = aRanges.size(); i < n; ++i)
{
- pDoc->CopyFromClip(
+ rDoc.CopyFromClip(
aRanges[i], aMark, InsertDeleteFlags::OBJECTS, nullptr, pClipDoc,
false, false, true, bSkipEmpty);
}
@@ -1764,7 +1763,7 @@ bool ScViewFunc::PasteFromClipToMultiRanges(
nPaint |= PaintPartFlags::Left;
pDocSh->PostPaint(aRanges, nPaint);
- if (pDoc->IsUndoEnabled())
+ if (rDoc.IsUndoEnabled())
{
SfxUndoManager* pUndoMgr = pDocSh->GetUndoManager();
OUString aUndo = ScResId(
@@ -1925,11 +1924,11 @@ bool ScViewFunc::LinkBlock( const ScRange& rSource, const ScAddress& rDestPos )
// run with paste
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScDocumentUniquePtr pClipDoc(new ScDocument( SCDOCMODE_CLIP ));
- pDoc->CopyTabToClip( rSource.aStart.Col(), rSource.aStart.Row(),
- rSource.aEnd.Col(), rSource.aEnd.Row(),
- rSource.aStart.Tab(), pClipDoc.get() );
+ rDoc.CopyTabToClip( rSource.aStart.Col(), rSource.aStart.Row(),
+ rSource.aEnd.Col(), rSource.aEnd.Row(),
+ rSource.aStart.Tab(), pClipDoc.get() );
// mark destination area (set cursor, no marks)
@@ -1951,15 +1950,13 @@ void ScViewFunc::DataFormPutData( SCROW nCurrentRow ,
std::vector<std::unique_ptr<ScDataFormFragment>>& rEdits,
sal_uInt16 aColLength )
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScDocShell* pDocSh = GetViewData().GetDocShell();
ScMarkData& rMark = GetViewData().GetMarkData();
ScDocShellModificator aModificator( *pDocSh );
SfxUndoManager* pUndoMgr = pDocSh->GetUndoManager();
- if ( !pDoc )
- return;
- const bool bRecord( pDoc->IsUndoEnabled());
+ const bool bRecord( rDoc.IsUndoEnabled());
ScDocumentUniquePtr pUndoDoc;
ScDocumentUniquePtr pRedoDoc;
std::unique_ptr<ScRefUndoData> pUndoData;
@@ -1968,32 +1965,32 @@ void ScViewFunc::DataFormPutData( SCROW nCurrentRow ,
SCTAB nEndTab = nTab;
{
- ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack();
if ( pChangeTrack )
pChangeTrack->ResetLastCut(); // no more cut-mode
}
ScRange aUserRange( nStartCol, nCurrentRow, nStartTab, nEndCol, nCurrentRow, nEndTab );
- bool bColInfo = ( nStartRow==0 && nEndRow==pDoc->MaxRow() );
- bool bRowInfo = ( nStartCol==0 && nEndCol==pDoc->MaxCol() );
+ bool bColInfo = ( nStartRow==0 && nEndRow==rDoc.MaxRow() );
+ bool bRowInfo = ( nStartCol==0 && nEndCol==rDoc.MaxCol() );
SCCOL nUndoEndCol = nStartCol+aColLength-1;
SCROW nUndoEndRow = nCurrentRow;
if ( bRecord )
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndoSelected( pDoc , rMark , bColInfo , bRowInfo );
- pDoc->CopyToDocument( aUserRange , InsertDeleteFlags::VALUE , false, *pUndoDoc );
+ pUndoDoc->InitUndoSelected( &rDoc , rMark , bColInfo , bRowInfo );
+ rDoc.CopyToDocument( aUserRange , InsertDeleteFlags::VALUE , false, *pUndoDoc );
}
sal_uInt16 nExtFlags = 0;
pDocSh->UpdatePaintExt( nExtFlags, nStartCol, nStartRow, nStartTab , nEndCol, nEndRow, nEndTab ); // content before the change
- pDoc->BeginDrawUndo();
+ rDoc.BeginDrawUndo();
for(sal_uInt16 i = 0; i < aColLength; i++)
{
if (rEdits[i] != nullptr)
{
OUString aFieldName = rEdits[i]->m_xEdit->get_text();
- pDoc->SetString( nStartCol + i, nCurrentRow, nTab, aFieldName );
+ rDoc.SetString( nStartCol + i, nCurrentRow, nTab, aFieldName );
}
}
pDocSh->UpdatePaintExt( nExtFlags, nStartCol, nCurrentRow, nStartTab, nEndCol, nCurrentRow, nEndTab ); // content after the change
@@ -2008,12 +2005,12 @@ void ScViewFunc::DataFormPutData( SCROW nCurrentRow ,
if (bColInfo)
{
nPaint |= PaintPartFlags::Top;
- nUndoEndCol = pDoc->MaxCol(); // just for drawing !
+ nUndoEndCol = rDoc.MaxCol(); // just for drawing !
}
if (bRowInfo)
{
nPaint |= PaintPartFlags::Left;
- nUndoEndRow = pDoc->MaxRow(); // just for drawing !
+ nUndoEndRow = rDoc.MaxRow(); // just for drawing !
}
pDocSh->PostPaint(
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 2c9f55dc7dd4..338edcf56715 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -178,11 +178,11 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow,
}
void ScViewFunc::DoRefConversion()
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScMarkData& rMark = GetViewData().GetMarkData();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
bool bRecord = true;
- if (!pDoc->IsUndoEnabled())
+ if (!rDoc.IsUndoEnabled())
bRecord = false;
ScRange aMarkRange;
@@ -197,7 +197,7 @@ void ScViewFunc::DoRefConversion()
aMarkRange = ScRange( GetViewData().GetCurX(),
GetViewData().GetCurY(), GetViewData().GetTabNo() );
}
- ScEditableTester aTester( pDoc, aMarkRange.aStart.Col(), aMarkRange.aStart.Row(),
+ ScEditableTester aTester( &rDoc, aMarkRange.aStart.Col(), aMarkRange.aStart.Row(),
aMarkRange.aEnd.Col(), aMarkRange.aEnd.Row(),rMark );
if (!aTester.IsEditable())
{
@@ -213,7 +213,7 @@ void ScViewFunc::DoRefConversion()
{
pUndoDoc.reset( new ScDocument( SCDOCMODE_UNDO ) );
SCTAB nTab = aMarkRange.aStart.Tab();
- pUndoDoc->InitUndo( pDoc, nTab, nTab );
+ pUndoDoc->InitUndo( &rDoc, nTab, nTab );
if ( rMark.GetSelectCount() > 1 )
{
@@ -224,7 +224,7 @@ void ScViewFunc::DoRefConversion()
ScRange aCopyRange = aMarkRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, InsertDeleteFlags::ALL, bMulti, *pUndoDoc, &rMark );
+ rDoc.CopyToDocument( aCopyRange, InsertDeleteFlags::ALL, bMulti, *pUndoDoc, &rMark );
}
ScRangeListRef xRanges;
@@ -238,7 +238,7 @@ void ScViewFunc::DoRefConversion()
ScRange aRange = (*xRanges)[j];
aRange.aStart.SetTab(i);
aRange.aEnd.SetTab(i);
- ScCellIterator aIter( pDoc, aRange );
+ ScCellIterator aIter( &rDoc, aRange );
for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
{
if (aIter.getType() != CELLTYPE_FORMULA)
@@ -258,19 +258,19 @@ void ScViewFunc::DoRefConversion()
nLen -= 2;
aOld = aOld.copy( 1, nLen);
}
- ScRefFinder aFinder( aOld, aIter.GetPos(), *pDoc, pDoc->GetAddressConvention() );
+ ScRefFinder aFinder( aOld, aIter.GetPos(), rDoc, rDoc.GetAddressConvention() );
aFinder.ToggleRel( 0, nLen );
if (aFinder.GetFound())
{
ScAddress aPos = pCell->aPos;
const OUString& aNew = aFinder.GetText();
- ScCompiler aComp( pDoc, aPos, pDoc->GetGrammar());
+ ScCompiler aComp( &rDoc, aPos, rDoc.GetGrammar());
std::unique_ptr<ScTokenArray> pArr(aComp.CompileString(aNew));
ScFormulaCell* pNewCell =
new ScFormulaCell(
- pDoc, aPos, *pArr, formula::FormulaGrammar::GRAM_DEFAULT, eMatrixMode);
+ &rDoc, aPos, *pArr, formula::FormulaGrammar::GRAM_DEFAULT, eMatrixMode);
- pDoc->SetFormulaCell(aPos, pNewCell);
+ rDoc.SetFormulaCell(aPos, pNewCell);
bOk = true;
}
}
@@ -280,7 +280,7 @@ void ScViewFunc::DoRefConversion()
{
ScDocumentUniquePtr pRedoDoc(new ScDocument( SCDOCMODE_UNDO ));
SCTAB nTab = aMarkRange.aStart.Tab();
- pRedoDoc->InitUndo( pDoc, nTab, nTab );
+ pRedoDoc->InitUndo( &rDoc, nTab, nTab );
if ( rMark.GetSelectCount() > 1 )
{
@@ -291,7 +291,7 @@ void ScViewFunc::DoRefConversion()
ScRange aCopyRange = aMarkRange;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, InsertDeleteFlags::ALL, bMulti, *pRedoDoc, &rMark );
+ rDoc.CopyToDocument( aCopyRange, InsertDeleteFlags::ALL, bMulti, *pRedoDoc, &rMark );
pDocSh->GetUndoManager()->AddUndoAction(
std::make_unique<ScUndoRefConversion>( pDocSh,
@@ -648,7 +648,7 @@ bool ScViewFunc::PasteFile( const Point& rPos, const OUString& rFile, bool bLink
if (bLink) // for bLink everything, which is not graphics, as URL
{
tools::Rectangle aRect( rPos, Size(0,0) );
- ScRange aRange = GetViewData().GetDocument()->
+ ScRange aRange = GetViewData().GetDocument().
GetRange( GetViewData().GetTabNo(), aRect );
SCCOL nPosX = aRange.aStart.Col();
SCROW nPosY = aRange.aStart.Row();
@@ -714,18 +714,18 @@ void ScViewFunc::InsertBookmark( const OUString& rDescription, const OUString& r
// insert into not edited cell
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
SCTAB nTab = GetViewData().GetTabNo();
ScAddress aCellPos( nPosX, nPosY, nTab );
- EditEngine aEngine( pDoc->GetEnginePool() );
+ EditEngine aEngine( rDoc.GetEnginePool() );
- const EditTextObject* pOld = pDoc->GetEditText(aCellPos);
+ const EditTextObject* pOld = rDoc.GetEditText(aCellPos);
if (pOld)
aEngine.SetText(*pOld);
else
{
OUString aOld;
- pDoc->GetInputString(nPosX, nPosY, nTab, aOld);
+ rDoc.GetInputString(nPosX, nPosY, nTab, aOld);
if (!aOld.isEmpty())
aEngine.SetText(aOld);
}
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 4b576632b407..b99b7805ebdf 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -77,8 +77,8 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
const uno::Reference<datatransfer::XTransferable>& rxTransferable,
SCCOL nPosX, SCROW nPosY, const Point* pLogicPos, bool bLink, bool bAllowDialogs )
{
- ScDocument* pDoc = GetViewData().GetDocument();
- pDoc->SetPastingDrawFromOtherDoc( true );
+ ScDocument& rDoc = GetViewData().GetDocument();
+ rDoc.SetPastingDrawFromOtherDoc( true );
Point aPos; // inserting position (1/100 mm)
if (pLogicPos)
@@ -95,10 +95,10 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
SCTAB nTab = GetViewData().GetTabNo();
long nXT = 0;
for (SCCOL i=0; i<nPosX; i++)
- nXT += pDoc->GetColWidth(i,nTab);
- if (pDoc->IsNegativePage(nTab))
+ nXT += rDoc.GetColWidth(i,nTab);
+ if (rDoc.IsNegativePage(nTab))
nXT = -nXT;
- sal_uLong nYT = pDoc->GetRowHeight( 0, nPosY-1, nTab);
+ sal_uLong nYT = rDoc.GetRowHeight( 0, nPosY-1, nTab);
aPos = Point( static_cast<long>(nXT * HMM_PER_TWIPS), static_cast<long>(nYT * HMM_PER_TWIPS) );
}
}
@@ -296,7 +296,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
else
{
ScAddress aCellPos( nPosX, nPosY, GetViewData().GetTabNo() );
- auto pObj = std::make_shared<ScImportExport>(GetViewData().GetDocument(), aCellPos);
+ auto pObj = std::make_shared<ScImportExport>(&GetViewData().GetDocument(), aCellPos);
pObj->SetOverwriting( true );
@@ -351,7 +351,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
bAllowDialogs = bAllowDialogs && !SC_MOD()->IsInExecuteDrop();
- pDlg->StartExecuteAsync([this, pDlg, pDoc, pStrm, nFormatId, pStrBuffer, pObj, bAllowDialogs](sal_Int32 nResult){
+ pDlg->StartExecuteAsync([this, pDlg, &rDoc, pStrm, nFormatId, pStrBuffer, pObj, bAllowDialogs](sal_Int32 nResult){
bool bShowErrorDialog = bAllowDialogs;
if (RET_OK == nResult)
{
@@ -376,7 +376,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
InvalidateAttribs();
GetViewData().UpdateInputHandler();
- pDoc->SetPastingDrawFromOtherDoc( false );
+ rDoc.SetPastingDrawFromOtherDoc( false );
if (bShowErrorDialog)
ErrorMessage(STR_PASTE_ERROR);
@@ -424,7 +424,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
else
{
ScAddress aCellPos( nPosX,nPosY,nTab );
- sTarget = aCellPos.Format(ScRefFlags::ADDR_ABS_3D, pDoc, pDoc->GetAddressConvention());
+ sTarget = aCellPos.Format(ScRefFlags::ADDR_ABS_3D, &rDoc, rDoc.GetAddressConvention());
}
SfxStringItem aTarget(FN_PARAM_1, sTarget);
@@ -562,7 +562,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
{
std::unique_ptr<ScDocument> pInsDoc(new ScDocument( SCDOCMODE_CLIP ));
SCTAB nSrcTab = 0; // Biff5 in clipboard: always sheet 0
- pInsDoc->ResetClip( pDoc, nSrcTab );
+ pInsDoc->ResetClip( &rDoc, nSrcTab );
SfxMedium aMed;
aMed.GetItemSet()->Put( SfxUnoAnyItem( SID_INPUTSTREAM, uno::makeAny( xStm ) ) );
@@ -644,7 +644,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
bRet = PasteBookmark( nFormatId, rxTransferable, nPosX, nPosY );
}
- pDoc->SetPastingDrawFromOtherDoc( false );
+ rDoc.SetPastingDrawFromOtherDoc( false );
return bRet;
}
@@ -728,7 +728,7 @@ bool ScViewFunc::PasteLink( const uno::Reference<datatransfer::XTransferable>& r
// uses Calc A1 syntax even when another formula syntax is specified
// in the UI.
EnterMatrix("='"
- + ScGlobal::GetAbsDocName(pTopic, GetViewData().GetDocument()->GetDocumentShell())
+ + ScGlobal::GetAbsDocName(pTopic, GetViewData().GetDocument().GetDocumentShell())
+ "'#" + pItem
, ::formula::FormulaGrammar::GRAM_NATIVE);
return true;
diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx
index 85676333cc7c..98de38058b5b 100644
--- a/sc/source/ui/view/viewfun6.cxx
+++ b/sc/source/ui/view/viewfun6.cxx
@@ -248,7 +248,7 @@ void ScViewFunc::DetectiveMarkSucc()
return;
ScRangeList aDestRanges;
- ScRefTokenHelper::getRangeListFromTokens(rView.GetDocument(), aDestRanges, aRefTokens, aCurPos);
+ ScRefTokenHelper::getRangeListFromTokens(&rView.GetDocument(), aDestRanges, aRefTokens, aCurPos);
MarkAndJumpToRanges(aDestRanges);
}
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index a438fcca7800..38b9b1e013d1 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -80,14 +80,14 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
// MapMode at Outliner-RefDevice has to be right (as in FuText::MakeOutliner)
//! merge with FuText::MakeOutliner?
MapMode aOldMapMode;
- OutputDevice* pRef = GetViewData().GetDocument()->GetDrawLayer()->GetRefDevice();
+ OutputDevice* pRef = GetViewData().GetDocument().GetDrawLayer()->GetRefDevice();
if (pRef)
{
aOldMapMode = pRef->GetMapMode();
pRef->SetMapMode( MapMode(MapUnit::Map100thMM) );
}
- bool bNegativePage = GetViewData().GetDocument()->IsNegativePage( GetViewData().GetTabNo() );
+ bool bNegativePage = GetViewData().GetDocument().IsNegativePage( GetViewData().GetTabNo() );
SdrView* pDragEditView = nullptr;
ScModule* pScMod = SC_MOD();
@@ -167,7 +167,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
pScDrawView->AddUndo(std::make_unique<SdrUndoInsertObj>( *pNewObj ));
if (ScDrawLayer::IsCellAnchored(*pNewObj))
- ScDrawLayer::SetCellAnchoredFromPosition(*pNewObj, *GetViewData().GetDocument(), nTab,
+ ScDrawLayer::SetCellAnchoredFromPosition(*pNewObj, GetViewData().GetDocument(), nTab,
ScDrawLayer::IsResizeWithCell(*pNewObj));
}
}
@@ -175,13 +175,13 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
if (bPasteIsMove)
pDragEditView->DeleteMarked();
- ScDocument* pDocument = GetViewData().GetDocument();
+ ScDocument& rDocument = GetViewData().GetDocument();
ScDocShell* pDocShell = GetViewData().GetDocShell();
ScModelObj* pModelObj = ( pDocShell ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocShell->GetModel() ) : nullptr );
- if ( pDocument && pDestPage && pModelObj && pDrawTrans )
+ if ( pDestPage && pModelObj && pDrawTrans )
{
const ScRangeListVector& rProtectedChartRangesVector( pDrawTrans->GetProtectedChartRangesVector() );
- ScChartHelper::CreateProtectedChartListenersAndNotify( pDocument, pDestPage, pModelObj, nTab,
+ ScChartHelper::CreateProtectedChartListenersAndNotify( &rDocument, pDestPage, pModelObj, nTab,
rProtectedChartRangesVector, aExcludedChartNames, bSameDoc );
}
}
@@ -215,12 +215,12 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
// #89247# Set flag for ScDocument::UpdateChartListeners() which is
// called during paste.
if ( !bSameDocClipboard )
- GetViewData().GetDocument()->SetPastingDrawFromOtherDoc( true );
+ GetViewData().GetDocument().SetPastingDrawFromOtherDoc( true );
pScDrawView->Paste(*pModel, aPos, nullptr, nOptions);
if ( !bSameDocClipboard )
- GetViewData().GetDocument()->SetPastingDrawFromOtherDoc( false );
+ GetViewData().GetDocument().SetPastingDrawFromOtherDoc( false );
// Paste puts all objects on the active (front) layer
// controls must be on SC_LAYER_CONTROLS
@@ -234,7 +234,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
pObject->NbcSetLayer(SC_LAYER_CONTROLS);
if (ScDrawLayer::IsCellAnchored(*pObject))
- ScDrawLayer::SetCellAnchoredFromPosition(*pObject, *GetViewData().GetDocument(), nTab,
+ ScDrawLayer::SetCellAnchoredFromPosition(*pObject, GetViewData().GetDocument(), nTab,
ScDrawLayer::IsResizeWithCell(*pObject));
pObject = aIter.Next();
@@ -242,17 +242,17 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
}
// all graphics objects must have names
- GetViewData().GetDocument()->EnsureGraphicNames();
+ GetViewData().GetDocument().EnsureGraphicNames();
- ScDocument* pDocument = GetViewData().GetDocument();
+ ScDocument& rDocument = GetViewData().GetDocument();
ScDocShell* pDocShell = GetViewData().GetDocShell();
ScModelObj* pModelObj = ( pDocShell ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocShell->GetModel() ) : nullptr );
const ScDrawTransferObj* pTransferObj = ScDrawTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(GetViewData().GetActiveWin()));
- if ( pDocument && pPage && pModelObj && ( pTransferObj || pDrawTrans ) )
+ if ( pPage && pModelObj && ( pTransferObj || pDrawTrans ) )
{
const ScRangeListVector& rProtectedChartRangesVector(
pTransferObj ? pTransferObj->GetProtectedChartRangesVector() : pDrawTrans->GetProtectedChartRangesVector() );
- ScChartHelper::CreateProtectedChartListenersAndNotify( pDocument, pPage, pModelObj, nTab,
+ ScChartHelper::CreateProtectedChartListenersAndNotify( &rDocument, pPage, pModelObj, nTab,
rProtectedChartRangesVector, aExcludedChartNames, bSameDocClipboard );
}
}
@@ -342,7 +342,7 @@ bool ScViewFunc::PasteObject( const Point& rPos, const uno::Reference < embed::X
// don't call AdjustInsertPos
Point aInsPos = rPos;
- if ( GetViewData().GetDocument()->IsNegativePage( GetViewData().GetTabNo() ) )
+ if ( GetViewData().GetDocument().IsNegativePage( GetViewData().GetTabNo() ) )
aInsPos.AdjustX( -(aSize.Width()) );
tools::Rectangle aRect( aInsPos, aSize );
@@ -425,7 +425,7 @@ bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic,
Size aSize = pWin->LogicToLogic( rGraphic.GetPrefSize(), &aSourceMap, &aDestMap );
- if ( GetViewData().GetDocument()->IsNegativePage( GetViewData().GetTabNo() ) )
+ if ( GetViewData().GetDocument().IsNegativePage( GetViewData().GetTabNo() ) )
aPos.AdjustX( -(aSize.Width()) );
GetViewData().GetViewShell()->SetDrawShell( true );
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 091f23324220..9bf109b8ba14 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -260,16 +260,16 @@ sal_uInt16 ScViewFunc::GetOptimalColWidth( SCCOL nCol, SCTAB nTab, bool bFormula
bool ScViewFunc::SelectionEditable( bool* pOnlyNotBecauseOfMatrix /* = NULL */ )
{
bool bRet;
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScMarkData& rMark = GetViewData().GetMarkData();
if (rMark.IsMarked() || rMark.IsMultiMarked())
- bRet = pDoc->IsSelectionEditable( rMark, pOnlyNotBecauseOfMatrix );
+ bRet = rDoc.IsSelectionEditable( rMark, pOnlyNotBecauseOfMatrix );
else
{
SCCOL nCol = GetViewData().GetCurX();
SCROW nRow = GetViewData().GetCurY();
SCTAB nTab = GetViewData().GetTabNo();
- bRet = pDoc->IsBlockEditable( nTab, nCol, nRow, nCol, nRow,
+ bRet = rDoc.IsBlockEditable( nTab, nCol, nRow, nCol, nRow,
pOnlyNotBecauseOfMatrix );
}
return bRet;
@@ -343,16 +343,16 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
const OUString& rString,
const EditTextObject* pData )
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScMarkData rMark(GetViewData().GetMarkData());
- bool bRecord = pDoc->IsUndoEnabled();
+ bool bRecord = rDoc.IsUndoEnabled();
SCTAB i;
ScDocShell* pDocSh = GetViewData().GetDocShell();
ScDocFunc &rFunc = GetViewData().GetDocFunc();
ScDocShellModificator aModificator( *pDocSh );
- ScEditableTester aTester( pDoc, nCol,nRow, nCol,nRow, rMark );
+ ScEditableTester aTester( &rDoc, nCol,nRow, nCol,nRow, rMark );
if (!aTester.IsEditable())
{
ErrorMessage(aTester.GetMessageId());
@@ -389,8 +389,8 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
if ( aString.getLength() > 1 )
{
sal_uInt32 nFormat = 0;
- pDoc->GetNumberFormat( nCol, nRow, nTab, nFormat );
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+ rDoc.GetNumberFormat( nCol, nRow, nTab, nFormat );
+ SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
double fNumber = 0;
if ( !pFormatter->IsNumberFormat( aString, nFormat, fNumber ) )
{
@@ -405,7 +405,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
{ // formula, compile with autoCorrection
i = rMark.GetFirstSelected();
ScAddress aPos( nCol, nRow, i );
- ScCompiler aComp( pDoc, aPos, pDoc->GetGrammar(), true, false );
+ ScCompiler aComp( &rDoc, aPos, rDoc.GetGrammar(), true, false );
//2do: enable/disable autoCorrection via calcoptions
aComp.SetAutoCorrection( true );
if ( rString[0] == '+' || rString[0] == '-' )
@@ -506,14 +506,14 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
}
}
- ScFormulaCell aCell(pDoc, aPos, std::move( pArr ), formula::FormulaGrammar::GRAM_DEFAULT, ScMatrixMode::NONE);
+ ScFormulaCell aCell(&rDoc, aPos, std::move( pArr ), formula::FormulaGrammar::GRAM_DEFAULT, ScMatrixMode::NONE);
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+ SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
for (const auto& rTab : rMark)
{
i = rTab;
aPos.SetTab( i );
- const sal_uInt32 nIndex = pDoc->GetAttr(
+ const sal_uInt32 nIndex = rDoc.GetAttr(
nCol, nRow, i, ATTR_VALUE_FORMAT )->GetValue();
const SvNumFormatType nType = pFormatter->GetType( nIndex);
if (nType == SvNumFormatType::TEXT ||
@@ -529,7 +529,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
}
else
{
- ScFormulaCell* pCell = new ScFormulaCell( aCell, *pDoc, aPos );
+ ScFormulaCell* pCell = new ScFormulaCell( aCell, rDoc, aPos );
if ( nError != FormulaError::NONE )
{
pCell->GetCode()->DelRPN();
@@ -546,9 +546,9 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
const SvNumberformat* pEntry = pFormatter->GetEntry( nIndex);
const LanguageType nLang = (pEntry ? pEntry->GetLanguage() : ScGlobal::eLnge);
const sal_uInt32 nFormat = pFormatter->GetStandardFormat( SvNumFormatType::NUMBER, nLang);
- ScPatternAttr aPattern( pDoc->GetPool());
+ ScPatternAttr aPattern( rDoc.GetPool());
aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nFormat));
- ScMarkData aMark(pDoc->GetSheetLimits());
+ ScMarkData aMark(rDoc.GetSheetLimits());
aMark.SelectTable( i, true);
aMark.SetMarkArea( ScRange( aPos));
rFunc.ApplyAttributes( aMark, aPattern, false);
@@ -586,31 +586,31 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
rFunc.EndListAction();
aModificator.SetDocumentModified();
- lcl_PostRepaintCondFormat( pDoc->GetCondFormat( nCol, nRow, nTab ), pDocSh );
+ lcl_PostRepaintCondFormat( rDoc.GetCondFormat( nCol, nRow, nTab ), pDocSh );
}
// enter value in single cell (on nTab only)
void ScViewFunc::EnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rValue )
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScDocShell* pDocSh = GetViewData().GetDocShell();
- if ( !(pDoc && pDocSh) )
+ if (!pDocSh)
return;
- bool bUndo(pDoc->IsUndoEnabled());
+ bool bUndo(rDoc.IsUndoEnabled());
ScDocShellModificator aModificator( *pDocSh );
- ScEditableTester aTester( pDoc, nTab, nCol,nRow, nCol,nRow );
+ ScEditableTester aTester( &rDoc, nTab, nCol,nRow, nCol,nRow );
if (aTester.IsEditable())
{
ScAddress aPos( nCol, nRow, nTab );
ScCellValue aUndoCell;
if (bUndo)
- aUndoCell.assign(*pDoc, aPos);
+ aUndoCell.assign(rDoc, aPos);
- pDoc->SetValue( nCol, nRow, nTab, rValue );
+ rDoc.SetValue( nCol, nRow, nTab, rValue );
// because of ChangeTrack after change in document
if (bUndo)
@@ -767,16 +767,16 @@ void ScViewFunc::EnterMatrix( const OUString& rString, ::formula::FormulaGrammar
// nothing marked -> temporarily calculate block
// with size of result formula to get the size
- ScDocument* pDoc = rData.GetDocument();
+ ScDocument& rDoc = rData.GetDocument();
SCTAB nTab = rData.GetTabNo();
- ScFormulaCell aFormCell( pDoc, ScAddress(nCol,nRow,nTab), rString, eGram, ScMatrixMode::Formula );
+ ScFormulaCell aFormCell( &rDoc, ScAddress(nCol,nRow,nTab), rString, eGram, ScMatrixMode::Formula );
SCSIZE nSizeX;
SCSIZE nSizeY;
aFormCell.GetResultDimensions( nSizeX, nSizeY );
if ( nSizeX != 0 && nSizeY != 0 &&
- nCol+nSizeX-1 <= sal::static_int_cast<SCSIZE>(pDoc->MaxCol()) &&
- nRow+nSizeY-1 <= sal::static_int_cast<SCSIZE>(pDoc->MaxRow()) )
+ nCol+nSizeX-1 <= sal::static_int_cast<SCSIZE>(rDoc.MaxCol()) &&
+ nRow+nSizeY-1 <= sal::static_int_cast<SCSIZE>(rDoc.MaxRow()) )
{
ScRange aResult( nCol, nRow, nTab,
sal::static_int_cast<SCCOL>(nCol+nSizeX-1),
@@ -804,20 +804,20 @@ SvtScriptType ScViewFunc::GetSelectionScriptType()
{
SvtScriptType nScript = SvtScriptType::NONE;
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
const ScMarkData& rMark = GetViewData().GetMarkData();
if ( !rMark.IsMarked() && !rMark.IsMultiMarked() )
{
// no selection -> cursor
- nScript = pDoc->GetScriptType( GetViewData().GetCurX(),
+ nScript = rDoc.GetScriptType( GetViewData().GetCurX(),
GetViewData().GetCurY(), GetViewData().GetTabNo());
}
else
{
ScRangeList aRanges;
rMark.FillRangeListWithMarks( &aRanges, false );
- nScript = pDoc->GetRangeScriptType(aRanges);
+ nScript = rDoc.GetRangeScriptType(aRanges);
}
if (nScript == SvtScriptType::NONE)
@@ -832,11 +832,11 @@ const ScPatternAttr* ScViewFunc::GetSelectionPattern()
// The displayed state is always that of the whole selection including filtered rows.
const ScMarkData& rMark = GetViewData().GetMarkData();
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
if ( rMark.IsMarked() || rMark.IsMultiMarked() )
{
- // MarkToMulti is no longer necessary for pDoc->GetSelectionPattern
- const ScPatternAttr* pAttr = pDoc->GetSelectionPattern( rMark );
+ // MarkToMulti is no longer necessary for rDoc.GetSelectionPattern
+ const ScPatternAttr* pAttr = rDoc.GetSelectionPattern( rMark );
return pAttr;
}
else
@@ -847,7 +847,7 @@ const ScPatternAttr* ScViewFunc::GetSelectionPattern()
ScMarkData aTempMark( rMark ); // copy sheet selection
aTempMark.SetMarkArea( ScRange( nCol, nRow, nTab ) );
- const ScPatternAttr* pAttr = pDoc->GetSelectionPattern( aTempMark );
+ const ScPatternAttr* pAttr = rDoc.GetSelectionPattern( aTempMark );
return pAttr;
}
}
@@ -856,17 +856,17 @@ void ScViewFunc::GetSelectionFrame(
std::shared_ptr<SvxBoxItem>& rLineOuter,
std::shared_ptr<SvxBoxInfoItem>& rLineInner )
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
const ScMarkData& rMark = GetViewData().GetMarkData();
if ( rMark.IsMarked() || rMark.IsMultiMarked() )
{
- pDoc->GetSelectionFrame( rMark, *rLineOuter, *rLineInner );
+ rDoc.GetSelectionFrame( rMark, *rLineOuter, *rLineInner );
}
else
{
const ScPatternAttr* pAttrs =
- pDoc->GetPattern( GetViewData().GetCurX(),
+ rDoc.GetPattern( GetViewData().GetCurX(),
GetViewData().GetCurY(),
GetViewData().GetTabNo() );
@@ -908,7 +908,7 @@ void ScViewFunc::ApplyAttributes( const SfxItemSet* pDialogSet,
if ( nNewFormat != nOldFormat )
{
SvNumberFormatter* pFormatter =
- GetViewData().GetDocument()->GetFormatTable();
+ GetViewData().GetDocument().GetFormatTable();
const SvNumberformat* pOldEntry = pFormatter->GetEntry( nOldFormat );
LanguageType eOldLang =
pOldEntry ? pOldEntry->GetLanguage() : LANGUAGE_DONTKNOW;
@@ -1005,7 +1005,7 @@ void ScViewFunc::ApplyAttr( const SfxPoolItem& rAttrItem, bool bAdjustBlockHeigh
return;
}
- ScPatternAttr aNewAttrs( std::make_unique<SfxItemSet>( *GetViewData().GetDocument()->GetPool(),
+ ScPatternAttr aNewAttrs( std::make_unique<SfxItemSet>( *GetViewData().GetDocument().GetPool(),
svl::Items<ATTR_PATTERN_START, ATTR_PATTERN_END>{} ) );
aNewAttrs.GetItemSet().Put( rAttrItem );
@@ -1026,11 +1026,11 @@ void ScViewFunc::ApplyAttr( const SfxPoolItem& rAttrItem, bool bAdjustBlockHeigh
void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem& rNewOuter,
const SvxBoxInfoItem* pNewInner )
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScMarkData aFuncMark( GetViewData().GetMarkData() ); // local copy for UnmarkFiltered
- ScViewUtil::UnmarkFiltered( aFuncMark, pDoc );
+ ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc );
bool bRecord = true;
- if (!pDoc->IsUndoEnabled())
+ if (!rDoc.IsUndoEnabled())
bRecord = false;
bool bRemoveAdjCellBorder = rNewOuter.IsRemoveAdjacentCellBorder();
@@ -1063,11 +1063,11 @@ void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem
{
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
SCTAB nStartTab = aMarkRange.aStart.Tab();
- SCTAB nTabCount = pDoc->GetTableCount();
+ SCTAB nTabCount = rDoc.GetTableCount();
bool bCopyOnlyMarked = false;
if( !bRemoveAdjCellBorder )
bCopyOnlyMarked = bMulti;
- pUndoDoc->InitUndo( pDoc, nStartTab, nStartTab );
+ pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab );
for (const auto& rTab : aFuncMark)
if (rTab != nStartTab)
pUndoDoc->AddUndoTab( rTab, rTab );
@@ -1075,7 +1075,7 @@ void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem
ScRange aCopyRange = aMarkRangeWithEnvelope;
aCopyRange.aStart.SetTab(0);
aCopyRange.aEnd.SetTab(nTabCount-1);
- pDoc->CopyToDocument( aCopyRange, InsertDeleteFlags::ATTRIB, bCopyOnlyMarked, *pUndoDoc, &aFuncMark );
+ rDoc.CopyToDocument( aCopyRange, InsertDeleteFlags::ATTRIB, bCopyOnlyMarked, *pUndoDoc, &aFuncMark );
pDocSh->GetUndoManager()->AddUndoAction(
std::make_unique<ScUndoSelectionAttr>(
@@ -1088,12 +1088,12 @@ void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem
sal_uInt16 nExt = SC_PF_TESTMERGE;
pDocSh->UpdatePaintExt( nExt, aMarkRangeWithEnvelope ); // content before the change
- pDoc->ApplySelectionFrame(aFuncMark, rNewOuter, pNewInner);
+ rDoc.ApplySelectionFrame(aFuncMark, rNewOuter, pNewInner);
pDocSh->UpdatePaintExt( nExt, aMarkRangeWithEnvelope ); // content after the change
aFuncMark.MarkToMulti();
- pDoc->ApplySelectionPattern( rAttr, aFuncMark );
+ rDoc.ApplySelectionPattern( rAttr, aFuncMark );
pDocSh->PostPaint( aMarkRange, PaintPartFlags::Grid, nExt );
pDocSh->UpdateOle(&GetViewData());
@@ -1285,7 +1285,7 @@ void ScViewFunc::ApplyUserItemSet( const SfxItemSet& rItemSet )
return;
}
- ScPatternAttr aNewAttrs( GetViewData().GetDocument()->GetPool() );
+ ScPatternAttr aNewAttrs( GetViewData().GetDocument().GetPool() );
SfxItemSet& rNewSet = aNewAttrs.GetItemSet();
rNewSet.Put( rItemSet, false );
ApplySelectionPattern( aNewAttrs );
@@ -1300,15 +1300,15 @@ const SfxStyleSheet* ScViewFunc::GetStyleSheetFromMarked()
const ScStyleSheet* pSheet = nullptr;
ScViewData& rViewData = GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
ScMarkData& rMark = rViewData.GetMarkData();
if ( rMark.IsMarked() || rMark.IsMultiMarked() )
- pSheet = pDoc->GetSelectionStyle( rMark ); // MarkToMulti isn't necessary
+ pSheet = rDoc.GetSelectionStyle( rMark ); // MarkToMulti isn't necessary
else
- pSheet = pDoc->GetStyle( rViewData.GetCurX(),
- rViewData.GetCurY(),
- rViewData.GetTabNo() );
+ pSheet = rDoc.GetStyle( rViewData.GetCurX(),
+ rViewData.GetCurY(),
+ rViewData.GetTabNo() );
return pSheet;
}
@@ -1414,20 +1414,20 @@ void ScViewFunc::RemoveStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet )
if ( !pStyleSheet) return;
ScViewData& rViewData = GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
ScDocShell* pDocSh = rViewData.GetDocShell();
ScDocShellModificator aModificator( *pDocSh );
ScopedVclPtrInstance< VirtualDevice > pVirtDev;
pVirtDev->SetMapMode(MapMode(MapUnit::MapPixel));
- pDoc->StyleSheetChanged( pStyleSheet, true, pVirtDev,
+ rDoc.StyleSheetChanged( pStyleSheet, true, pVirtDev,
rViewData.GetPPTX(),
rViewData.GetPPTY(),
rViewData.GetZoomX(),
rViewData.GetZoomY() );
- pDocSh->PostPaint( 0,0,0, pDoc->MaxCol(), pDoc->MaxRow(), MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
+ pDocSh->PostPaint( 0,0,0, rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
aModificator.SetDocumentModified();
ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
@@ -1440,20 +1440,20 @@ void ScViewFunc::UpdateStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet )
if ( !pStyleSheet) return;
ScViewData& rViewData = GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
+ ScDocument& rDoc = rViewData.GetDocument();
ScDocShell* pDocSh = rViewData.GetDocShell();
ScDocShellModificator aModificator( *pDocSh );
ScopedVclPtrInstance< VirtualDevice > pVirtDev;
pVirtDev->SetMapMode(MapMode(MapUnit::MapPixel));
- pDoc->StyleSheetChanged( pStyleSheet, false, pVirtDev,
+ rDoc.StyleSheetChanged( pStyleSheet, false, pVirtDev,
rViewData.GetPPTX(),
rViewData.GetPPTY(),
rViewData.GetZoomX(),
rViewData.GetZoomY() );
- pDocSh->PostPaint( 0,0,0, pDoc->MaxCol(), pDoc->MaxRow(), MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
+ pDocSh->PostPaint( 0,0,0, rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
aModificator.SetDocumentModified();
ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
@@ -1500,7 +1500,7 @@ void ScViewFunc::OnLOKInsertDeleteColumn(SCCOL nStartCol, long nOffset)
aMultiMark.MarkToMulti();
if (aMultiMark.IsMultiMarked())
{
- aMultiMark.ShiftCols(pTabViewShell->GetViewData().GetDocument(), nStartCol, nOffset);
+ aMultiMark.ShiftCols(&pTabViewShell->GetViewData().GetDocument(), nStartCol, nOffset);
pTabViewShell->SetMarkData(aMultiMark);
}
}
@@ -1556,7 +1556,7 @@ void ScViewFunc::OnLOKInsertDeleteRow(SCROW nStartRow, long nOffset)
aMultiMark.MarkToMulti();
if (aMultiMark.IsMultiMarked())
{
- aMultiMark.ShiftRows(pTabViewShell->GetViewData().GetDocument(), nStartRow, nOffset);
+ aMultiMark.ShiftRows(&pTabViewShell->GetViewData().GetDocument(), nStartRow, nOffset);
pTabViewShell->SetMarkData(aMultiMark);
}
}
@@ -1956,13 +1956,13 @@ void ScViewFunc::DeleteContents( InsertDeleteFlags nFlags )
ScRange aMarkRange;
bool bSimple = false;
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
ScDocShell* pDocSh = GetViewData().GetDocShell();
ScMarkData aFuncMark( GetViewData().GetMarkData() ); // local copy for UnmarkFiltered
- ScViewUtil::UnmarkFiltered( aFuncMark, pDoc );
+ ScViewUtil::UnmarkFiltered( aFuncMark, &rDoc );
bool bRecord =true;
- if (!pDoc->IsUndoEnabled())
+ if (!rDoc.IsUndoEnabled())
bRecord = false;
if ( !aFuncMark.IsMarked() && !aFuncMark.IsMultiMarked() )
@@ -1971,7 +1971,7 @@ void ScViewFunc::DeleteContents( InsertDeleteFlags nFlags )
aMarkRange.aStart.SetRow(GetViewData().GetCurY());
aMarkRange.aStart.SetTab(GetViewData().GetTabNo());
aMarkRange.aEnd = aMarkRange.aStart;
- if ( pDoc->HasAttrib( aMarkRange, HasAttrFlags::Merged ) )
+ if ( rDoc.HasAttrib( aMarkRange, HasAttrFlags::Merged ) )
{
aFuncMark.SetMarkArea( aMarkRange );
}
@@ -2617,18 +2617,18 @@ void ScViewFunc::SetNumberFormat( SvNumFormatType nFormatType, sal_uLong nAdd )
sal_uInt32 nNumberFormat = 0;
ScViewData& rViewData = GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
- SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable();
+ ScDocument& rDoc = rViewData.GetDocument();
+ SvNumberFormatter* pNumberFormatter = rDoc.GetFormatTable();
LanguageType eLanguage = ScGlobal::eLnge;
- ScPatternAttr aNewAttrs( pDoc->GetPool() );
+ ScPatternAttr aNewAttrs( rDoc.GetPool() );
// always take language from cursor position, even if there is a selection
sal_uInt32 nCurrentNumberFormat;
- pDoc->GetNumberFormat( rViewData.GetCurX(),
- rViewData.GetCurY(),
- rViewData.GetTabNo(),
- nCurrentNumberFormat );
+ rDoc.GetNumberFormat( rViewData.GetCurX(),
+ rViewData.GetCurY(),
+ rViewData.GetTabNo(),
+ nCurrentNumberFormat );
const SvNumberformat* pEntry = pNumberFormatter->GetEntry( nCurrentNumberFormat );
if (pEntry)
eLanguage = pEntry->GetLanguage(); // else keep ScGlobal::eLnge
@@ -2652,13 +2652,13 @@ void ScViewFunc::SetNumFmtByStr( const OUString& rCode )
}
ScViewData& rViewData = GetViewData();
- ScDocument* pDoc = rViewData.GetDocument();
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+ ScDocument& rDoc = rViewData.GetDocument();
+ SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
// language always from cursor position
sal_uInt32 nCurrentNumberFormat;
- pDoc->GetNumberFormat( rViewData.GetCurX(), rViewData.GetCurY(),
+ rDoc.GetNumberFormat( rViewData.GetCurX(), rViewData.GetCurY(),
rViewData.GetTabNo(), nCurrentNumberFormat );
const SvNumberformat* pEntry = pFormatter->GetEntry( nCurrentNumberFormat );
LanguageType eLanguage = pEntry ? pEntry->GetLanguage() : ScGlobal::eLnge;
@@ -2679,7 +2679,7 @@ void ScViewFunc::SetNumFmtByStr( const OUString& rCode )
if ( bOk ) // valid format?
{
- ScPatternAttr aNewAttrs( pDoc->GetPool() );
+ ScPatternAttr aNewAttrs( rDoc.GetPool() );
SfxItemSet& rSet = aNewAttrs.GetItemSet();
rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumberFormat ) );
rSet.Put( SvxLanguageItem( eLanguage, ATTR_LANGUAGE_FORMAT ) );
@@ -2699,15 +2699,15 @@ void ScViewFunc::ChangeNumFmtDecimals( bool bIncrement )
return;
}
- ScDocument* pDoc = GetViewData().GetDocument();
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+ ScDocument& rDoc = GetViewData().GetDocument();
+ SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
SCCOL nCol = GetViewData().GetCurX();
SCROW nRow = GetViewData().GetCurY();
SCTAB nTab = GetViewData().GetTabNo();
sal_uInt32 nOldFormat;
- pDoc->GetNumberFormat( nCol, nRow, nTab, nOldFormat );
+ rDoc.GetNumberFormat( nCol, nRow, nTab, nOldFormat );
const SvNumberformat* pOldEntry = pFormatter->GetEntry( nOldFormat );
if (!pOldEntry)
{
@@ -2740,7 +2740,7 @@ void ScViewFunc::ChangeNumFmtDecimals( bool bIncrement )
{
// with "Standard" the decimal places depend on cell content
// 0 if empty or text -> no decimal places
- double nVal = pDoc->GetValue( ScAddress( nCol, nRow, nTab ) );
+ double nVal = rDoc.GetValue( ScAddress( nCol, nRow, nTab ) );
// the ways of the Numberformatters are unfathomable, so try:
OUString aOut;
@@ -2813,7 +2813,7 @@ void ScViewFunc::ChangeNumFmtDecimals( bool bIncrement )
if (!bError)
{
- ScPatternAttr aNewAttrs( pDoc->GetPool() );
+ ScPatternAttr aNewAttrs( rDoc.GetPool() );
SfxItemSet& rSet = aNewAttrs.GetItemSet();
rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
// ATTR_LANGUAGE_FORMAT not
@@ -2925,7 +2925,7 @@ CreateNameFlags ScViewFunc::GetCreateNameFlags()
SCTAB nDummy;
if (GetViewData().GetSimpleArea(nStartCol,nStartRow,nDummy,nEndCol,nEndRow,nDummy) == SC_MARK_SIMPLE)
{
- ScDocument* pDoc = GetViewData().GetDocument();
+ ScDocument& rDoc = GetViewData().GetDocument();
SCTAB nTab = GetViewData().GetTabNo();
bool bOk;
SCCOL i;
@@ -2936,7 +2936,7 @@ CreateNameFlags ScViewFunc::GetCreateNameFlags()
SCCOL nLastCol = nEndCol;
if (nStartCol+1 < nEndCol) { ++nFirstCol; --nLastCol; }
for (i=nFirstCol; i<=nLastCol && bOk; i++)
- if (!pDoc->HasStringData( i,nStartRow,nTab ))
+ if (!rDoc.HasStringData( i,nStartRow,nTab ))
bOk = false;
if (bOk)
nFlags |= CreateNameFlags::Top;
@@ -2944,7 +2944,7 @@ CreateNameFlags ScViewFunc::GetCreateNameFlags()
{
bOk = true;
for (i=nFirstCol; i<=nLastCol && bOk; i++)
- if (!pDoc->HasStringData( i,nEndRow,nTab ))
+ if (!rDoc.HasStringData( i,nEndRow,nTab ))
bOk = false;
if (bOk)
nFlags |= CreateNameFlags::Bottom;
@@ -2955,7 +2955,7 @@ CreateNameFlags ScViewFunc::GetCreateNameFlags()
SCROW nLastRow = nEndRow;
if (nStartRow+1 < nEndRow) { ++nFirstRow; --nLastRow; }
for (j=nFirstRow; j<=nLastRow && bOk; j++)
- if (!pDoc->HasStringData( nStartCol,j,nTab ))
+ if (!rDoc.HasStringData( nStartCol,j,nTab ))
bOk = false;
if (bOk)
nFlags |= CreateNameFlags::Left;
@@ -2963,7 +2963,7 @@ CreateNameFlags ScViewFunc::GetCreateNameFlags()
{
bOk = true;
for (j=nFirstRow; j<=nLastRow && bOk; j++)
- if (!pDoc->HasStringData( nEndCol,j,nTab ))
+ if (!rDoc.HasStringData( nEndCol,j,nTab ))
bOk = false;
if (bOk)
nFlags |= CreateNameFlags::Right;