summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-14 16:42:52 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-15 21:36:27 +0200
commitbf3d1b8e8f89bfdb409c70cfea126f36474d4772 (patch)
tree9d496d04fc1bbd76c15ab215f947ac28587f0e1e /sc/qa
parent957adc83e67276805c6dcd7be1ea23c142c49306 (diff)
establish that ScViewData::GetDocument can always return ScDocument&
we can only be ctored with a ScDocShell& or ScDocument&, and ScDocShell provides a ScDocument& from its GetDocument() so we can always have a ScDocument& when a public ctor has completed some null checks can then be seen to be redundant and are removed Change-Id: Ifaf39cb06e8dbce363999c05ee0aeb3ec4f00428 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102775 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/qa')
-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
3 files changed, 8 insertions, 8 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();