sc/inc/document.hxx | 18 - sc/qa/unit/pivottable_filters_test.cxx | 7 sc/qa/unit/subsequent_export_test3.cxx | 4 sc/qa/unit/subsequent_export_test4.cxx | 2 sc/qa/unit/subsequent_filters_test.cxx | 8 sc/qa/unit/subsequent_filters_test2.cxx | 5 sc/qa/unit/subsequent_filters_test3.cxx | 8 sc/qa/unit/subsequent_filters_test4.cxx | 8 sc/qa/unit/subsequent_filters_test5.cxx | 4 sc/qa/unit/tiledrendering/tiledrendering.cxx | 4 sc/qa/unit/ucalc_condformat.cxx | 105 +++----- sc/qa/unit/ucalc_copypaste.cxx | 220 ++++++------------ sc/qa/unit/uicalc/uicalc2.cxx | 2 sc/source/core/data/column.cxx | 2 sc/source/core/data/documen3.cxx | 12 sc/source/core/data/documen4.cxx | 2 sc/source/core/data/documen8.cxx | 2 sc/source/core/data/document.cxx | 41 +-- sc/source/core/data/dpobject.cxx | 2 sc/source/core/data/drwlayer.cxx | 10 sc/source/core/data/fillinfo.cxx | 6 sc/source/core/data/formulacell.cxx | 2 sc/source/core/data/table5.cxx | 5 sc/source/core/tool/interpr1.cxx | 8 sc/source/filter/excel/excimp8.cxx | 2 sc/source/filter/excel/excrecds.cxx | 4 sc/source/filter/excel/xistyle.cxx | 10 sc/source/filter/html/htmlexp.cxx | 16 - sc/source/filter/html/htmlimp.cxx | 20 - sc/source/filter/oox/autofilterbuffer.cxx | 2 sc/source/filter/oox/sheetdatabuffer.cxx | 8 sc/source/filter/orcus/autofilter.cxx | 2 sc/source/ui/Accessibility/AccessibleCell.cxx | 22 - sc/source/ui/Accessibility/AccessiblePreviewCell.cxx | 5 sc/source/ui/Accessibility/AccessiblePreviewTable.cxx | 12 sc/source/ui/Accessibility/AccessibleText.cxx | 34 +- sc/source/ui/app/transobj.cxx | 2 sc/source/ui/docshell/docfunc.cxx | 4 sc/source/ui/docshell/docsh.cxx | 8 sc/source/ui/drawfunc/fusel2.cxx | 4 sc/source/ui/unoobj/cellsuno.cxx | 2 sc/source/ui/unoobj/viewuno.cxx | 8 sc/source/ui/view/cellsh.cxx | 10 sc/source/ui/view/cellsh2.cxx | 2 sc/source/ui/view/cliputil.cxx | 4 sc/source/ui/view/dbfunc.cxx | 8 sc/source/ui/view/dbfunc3.cxx | 2 sc/source/ui/view/gridwin.cxx | 32 +- sc/source/ui/view/gridwin2.cxx | 5 sc/source/ui/view/gridwin4.cxx | 13 - sc/source/ui/view/output.cxx | 38 +-- sc/source/ui/view/output2.cxx | 10 sc/source/ui/view/spelleng.cxx | 4 sc/source/ui/view/tabview.cxx | 4 sc/source/ui/view/tabview2.cxx | 20 - sc/source/ui/view/tabview3.cxx | 6 sc/source/ui/view/tabvwsha.cxx | 8 sc/source/ui/view/viewdata.cxx | 20 - sc/source/ui/view/viewfun2.cxx | 21 - sc/source/ui/view/viewfunc.cxx | 2 sc/source/ui/view/viewutil.cxx | 4 61 files changed, 378 insertions(+), 487 deletions(-)
New commits: commit e1bfd17cd8e84af35e3cc456efdf588bc92dc291 Author: Mike Kaganski <[email protected]> AuthorDate: Sun Nov 23 23:52:16 2025 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Mon Nov 24 05:32:34 2025 +0100 ScDocument::GetAttr doesn't return nullptr Change-Id: Iaf2da73a9e5a9c2a5a579a8124beda9bb2689fde Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194400 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 721492ea6893..b76afc608cbc 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1878,22 +1878,22 @@ public: const ScAddress& rCursor, const ScMarkData& rMark, double& rResult ); - SC_DLLPUBLIC const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich ) const; - template<class T> const T* GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, TypedWhichId<T> nWhich ) const + SC_DLLPUBLIC const SfxPoolItem& GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich ) const; + template<class T> const T& GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, TypedWhichId<T> nWhich ) const { - return static_cast<const T*>(GetAttr(nCol, nRow, nTab, sal_uInt16(nWhich))); + return static_cast<const T&>(GetAttr(nCol, nRow, nTab, sal_uInt16(nWhich))); } - SC_DLLPUBLIC const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich, + SC_DLLPUBLIC const SfxPoolItem& GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich, SCROW& nStartRow, SCROW& nEndRow ) const; - template<class T> const T* GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, TypedWhichId<T> nWhich, + template<class T> const T& GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, TypedWhichId<T> nWhich, SCROW& nStartRow, SCROW& nEndRow ) const { - return static_cast<const T*>(GetAttr(nCol, nRow, nTab, sal_uInt16(nWhich), nStartRow, nEndRow)); + return static_cast<const T&>(GetAttr(nCol, nRow, nTab, sal_uInt16(nWhich), nStartRow, nEndRow)); } - SC_DLLPUBLIC const SfxPoolItem* GetAttr( const ScAddress& rPos, sal_uInt16 nWhich ) const; - template<class T> const T* GetAttr( const ScAddress& rPos, TypedWhichId<T> nWhich ) const + SC_DLLPUBLIC const SfxPoolItem& GetAttr( const ScAddress& rPos, sal_uInt16 nWhich ) const; + template<class T> const T& GetAttr( const ScAddress& rPos, TypedWhichId<T> nWhich ) const { - return static_cast<const T*>(GetAttr(rPos, sal_uInt16(nWhich))); + return static_cast<const T&>(GetAttr(rPos, sal_uInt16(nWhich))); } SC_DLLPUBLIC const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; SC_DLLPUBLIC const ScPatternAttr* GetPattern( const ScAddress& rPos ) const; diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index 9aaea68e8dc1..2a526dcde184 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -2701,15 +2701,14 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableCompactLayoutXLSX) { auto& rCase = aCases[nCaseNum]; CPPUNIT_ASSERT_EQUAL(rCase.aContent, rDoc.GetString(rCase.aAddr)); - const ScIndentItem* pIndent = rDoc.GetAttr(rCase.aAddr, ATTR_INDENT); + const ScIndentItem& rIndent = rDoc.GetAttr(rCase.aAddr, ATTR_INDENT); if (rCase.bIndented) { - CPPUNIT_ASSERT(pIndent); - CPPUNIT_ASSERT(pIndent->GetValue() > 0); + CPPUNIT_ASSERT_GREATER(sal_uInt16(0), rIndent.GetValue()); } else { - CPPUNIT_ASSERT(!pIndent || pIndent->GetValue() == 0); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), rIndent.GetValue()); } } diff --git a/sc/qa/unit/subsequent_export_test3.cxx b/sc/qa/unit/subsequent_export_test3.cxx index aa5789d03e25..88715155fcd4 100644 --- a/sc/qa/unit/subsequent_export_test3.cxx +++ b/sc/qa/unit/subsequent_export_test3.cxx @@ -1040,7 +1040,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testCustomXml) // tdf#161453: ensure E1's wrap text attribute was round-tripped ScDocument* pDoc = getScDoc(); - CPPUNIT_ASSERT(pDoc->GetAttr(4, 0, 0, ATTR_LINEBREAK)->GetValue()); + CPPUNIT_ASSERT(pDoc->GetAttr(4, 0, 0, ATTR_LINEBREAK).GetValue()); } #ifdef _WIN32 @@ -1519,7 +1519,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testPreserveTextWhitespace2XLSX) // tdf#158460: ensure B1 is NOT set to wrap text, so Excel keeps displaying as single line SCTAB nTab = 0; SCROW nRow = 0; - CPPUNIT_ASSERT(!getScDoc()->GetAttr(1, nRow, nTab, ATTR_LINEBREAK)->GetValue()); + CPPUNIT_ASSERT(!getScDoc()->GetAttr(1, nRow, nTab, ATTR_LINEBREAK).GetValue()); // Without the fix, this wrapped to two lines high (841). It should be 1 line high (529). int nHeight = convertTwipToMm100(getScDoc()->GetRowHeight(nRow, nTab, false)); CPPUNIT_ASSERT_LESS(600, nHeight); diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 9ddd52f9afc3..d7030eceadc1 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -1939,7 +1939,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf152980) // tdf#161453: ensure A8 was set to wrap text, so Excel doesn't display as single line SCTAB nTab = 0; SCROW nRow = 7; - CPPUNIT_ASSERT(pDoc->GetAttr(0, nRow, nTab, ATTR_LINEBREAK)->GetValue()); + CPPUNIT_ASSERT(pDoc->GetAttr(0, nRow, nTab, ATTR_LINEBREAK).GetValue()); // Without the fix, this was a single line high (446). It should be 3 lines high (1236). int nHeight = convertTwipToMm100(pDoc->GetRowHeight(nRow, nTab, false)); CPPUNIT_ASSERT_GREATER(1000, nHeight); diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx index 7cfe43594bc4..51cb491b77cd 100644 --- a/sc/qa/unit/subsequent_filters_test.cxx +++ b/sc/qa/unit/subsequent_filters_test.cxx @@ -1322,8 +1322,8 @@ void checkCellValidity(const ScAddress& rValBaseAddr, const ScRange& rRange, con SCROW nBRow(rValBaseAddr.Row()); SCTAB nTab(static_cast<sal_Int32>(rValBaseAddr.Tab())); //get from the document the data validation entry we are checking against - const SfxUInt32Item* pItem = rDoc.GetAttr(nBCol, nBRow, nTab, ATTR_VALIDDATA); - const ScValidationData* pValData = rDoc.GetValidationEntry(pItem->GetValue()); + const SfxUInt32Item& rItem = rDoc.GetAttr(nBCol, nBRow, nTab, ATTR_VALIDDATA); + const ScValidationData* pValData = rDoc.GetValidationEntry(rItem.GetValue()); CPPUNIT_ASSERT(pValData); //check that each cell in the expected range is associated with the data validation entry @@ -1331,8 +1331,8 @@ void checkCellValidity(const ScAddress& rValBaseAddr, const ScRange& rRange, con { for (SCROW j = rRange.aStart.Row(); j <= rRange.aEnd.Row(); ++j) { - const SfxUInt32Item* pItemTest = rDoc.GetAttr(i, j, nTab, ATTR_VALIDDATA); - const ScValidationData* pValDataTest = rDoc.GetValidationEntry(pItemTest->GetValue()); + const SfxUInt32Item& rItemTest = rDoc.GetAttr(i, j, nTab, ATTR_VALIDDATA); + const ScValidationData* pValDataTest = rDoc.GetValidationEntry(rItemTest.GetValue()); //prevent string operations for occurring unnecessarily if (!(pValDataTest && pValData->GetKey() == pValDataTest->GetKey())) { diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx index 324bcf4edd03..ca9a392c67f8 100644 --- a/sc/qa/unit/subsequent_filters_test2.cxx +++ b/sc/qa/unit/subsequent_filters_test2.cxx @@ -1035,9 +1035,8 @@ namespace void checkValidationFormula(const ScAddress& rPos, const ScDocument& rDoc, const OUString& rExpectedFormula) { - const SfxUInt32Item* pItem = rDoc.GetAttr(rPos, ATTR_VALIDDATA); - CPPUNIT_ASSERT(pItem); - sal_uInt32 nKey = pItem->GetValue(); + const SfxUInt32Item& rItem = rDoc.GetAttr(rPos, ATTR_VALIDDATA); + sal_uInt32 nKey = rItem.GetValue(); const ScValidationData* pData = rDoc.GetValidationEntry(nKey); CPPUNIT_ASSERT(pData); diff --git a/sc/qa/unit/subsequent_filters_test3.cxx b/sc/qa/unit/subsequent_filters_test3.cxx index 9ea3ab3854c2..11aaaae11bb7 100644 --- a/sc/qa/unit/subsequent_filters_test3.cxx +++ b/sc/qa/unit/subsequent_filters_test3.cxx @@ -268,11 +268,11 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testWrapAndShrinkXLSXML) for (const auto& rC : aChecks) { - const ScLineBreakCell* pLB = pDoc->GetAttr(rC.nCol, rC.nRow, 0, ATTR_LINEBREAK); - CPPUNIT_ASSERT_EQUAL(pLB->GetValue(), rC.bWrapText); + const ScLineBreakCell& rLB = pDoc->GetAttr(rC.nCol, rC.nRow, 0, ATTR_LINEBREAK); + CPPUNIT_ASSERT_EQUAL(rLB.GetValue(), rC.bWrapText); - const ScShrinkToFitCell* pSTF = pDoc->GetAttr(rC.nCol, rC.nRow, 0, ATTR_SHRINKTOFIT); - CPPUNIT_ASSERT_EQUAL(pSTF->GetValue(), rC.bShrinkToFit); + const ScShrinkToFitCell& rSTF = pDoc->GetAttr(rC.nCol, rC.nRow, 0, ATTR_SHRINKTOFIT); + CPPUNIT_ASSERT_EQUAL(rSTF.GetValue(), rC.bShrinkToFit); } } diff --git a/sc/qa/unit/subsequent_filters_test4.cxx b/sc/qa/unit/subsequent_filters_test4.cxx index 88f6f04bc7ca..b1b170de2a0b 100644 --- a/sc/qa/unit/subsequent_filters_test4.cxx +++ b/sc/qa/unit/subsequent_filters_test4.cxx @@ -1731,13 +1731,13 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testCellTextRotation) Degree100 nExpectedAngle = 3267_deg100; // RotateAngle has data type long, meaning Degree100 Degree100 nActualAngle = 0_deg100; - nActualAngle = pDoc->GetAttr(0, 0, 0, ATTR_ROTATE_VALUE)->GetValue(); // col, row, tab, whichId + nActualAngle = pDoc->GetAttr(0, 0, 0, ATTR_ROTATE_VALUE).GetValue(); // col, row, tab, whichId CPPUNIT_ASSERT_EQUAL_MESSAGE("without unit", nExpectedAngle.get(), nActualAngle.get()); - nActualAngle = pDoc->GetAttr(1, 0, 0, ATTR_ROTATE_VALUE)->GetValue(); + nActualAngle = pDoc->GetAttr(1, 0, 0, ATTR_ROTATE_VALUE).GetValue(); CPPUNIT_ASSERT_EQUAL_MESSAGE("degrees", nExpectedAngle.get(), nActualAngle.get()); - nActualAngle = pDoc->GetAttr(2, 0, 0, ATTR_ROTATE_VALUE)->GetValue(); + nActualAngle = pDoc->GetAttr(2, 0, 0, ATTR_ROTATE_VALUE).GetValue(); CPPUNIT_ASSERT_EQUAL_MESSAGE("radians", nExpectedAngle.get(), nActualAngle.get()); - nActualAngle = pDoc->GetAttr(3, 0, 0, ATTR_ROTATE_VALUE)->GetValue(); + nActualAngle = pDoc->GetAttr(3, 0, 0, ATTR_ROTATE_VALUE).GetValue(); CPPUNIT_ASSERT_EQUAL_MESSAGE("grad", nExpectedAngle.get(), nActualAngle.get()); } diff --git a/sc/qa/unit/subsequent_filters_test5.cxx b/sc/qa/unit/subsequent_filters_test5.cxx index 6a71eadc7591..782b038343d6 100644 --- a/sc/qa/unit/subsequent_filters_test5.cxx +++ b/sc/qa/unit/subsequent_filters_test5.cxx @@ -70,9 +70,9 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest5, testTdf151505) CPPUNIT_ASSERT(pAnonDBData->HasAutoFilter()); // also check for the correct handling of the autofilter buttons - auto nFlag = pDoc->GetAttr(0, 0, 0, ATTR_MERGE_FLAG)->GetValue(); + auto nFlag = pDoc->GetAttr(0, 0, 0, ATTR_MERGE_FLAG).GetValue(); CPPUNIT_ASSERT(nFlag & ScMF::Auto); - nFlag = pDoc->GetAttr(1, 0, 0, ATTR_MERGE_FLAG)->GetValue(); + nFlag = pDoc->GetAttr(1, 0, 0, ATTR_MERGE_FLAG).GetValue(); CPPUNIT_ASSERT(nFlag & ScMF::Auto); } diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 0e5710024934..3346d20e54fe 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -2084,8 +2084,8 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testPasteIntoWrapTextCell) // Set Wrap text in A3 pDoc->ApplyAttr(0, 2, 0, ScLineBreakCell(true)); - const ScLineBreakCell* pItem = pDoc->GetAttr(0, 2, 0, ATTR_LINEBREAK); - CPPUNIT_ASSERT(pItem->GetValue()); + const ScLineBreakCell& rItem = pDoc->GetAttr(0, 2, 0, ATTR_LINEBREAK); + CPPUNIT_ASSERT(rItem.GetValue()); ScViewData* pViewData = ScDocShell::GetViewData(); CPPUNIT_ASSERT(pViewData); diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx index fb7ae74d05d9..c2b6e12ecae3 100644 --- a/sc/qa/unit/ucalc_condformat.cxx +++ b/sc/qa/unit/ucalc_condformat.cxx @@ -328,11 +328,10 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testDataBarCondCopyPaste) CPPUNIT_ASSERT(nIndex0 != nPastedKey); CPPUNIT_ASSERT_EQUAL(nIndex1, nPastedKey); - const SfxPoolItem* pItem = m_pDoc->GetAttr(nCol, 3, 0, ATTR_CONDITIONAL); - const ScCondFormatItem* pCondFormatItem = static_cast<const ScCondFormatItem*>(pItem); - CPPUNIT_ASSERT(pCondFormatItem); - CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormatItem->GetCondFormatData().size()); - CPPUNIT_ASSERT_EQUAL(nPastedKey, pCondFormatItem->GetCondFormatData().front()); + const SfxPoolItem& rItem = m_pDoc->GetAttr(nCol, 3, 0, ATTR_CONDITIONAL); + const ScCondFormatItem& rCondFormatItem = static_cast<const ScCondFormatItem&>(rItem); + CPPUNIT_ASSERT_EQUAL(size_t(1), rCondFormatItem.GetCondFormatData().size()); + CPPUNIT_ASSERT_EQUAL(nPastedKey, rCondFormatItem.GetCondFormatData().front()); } // Now paste next to the previous range (immediately below) @@ -355,11 +354,10 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testDataBarCondCopyPaste) CPPUNIT_ASSERT(nIndex1 != nPastedKey); CPPUNIT_ASSERT_EQUAL(nIndex2, nPastedKey); - const SfxPoolItem* pItem = m_pDoc->GetAttr(nCol, 4, 0, ATTR_CONDITIONAL); - const ScCondFormatItem* pCondFormatItem = static_cast<const ScCondFormatItem*>(pItem); - CPPUNIT_ASSERT(pCondFormatItem); - CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormatItem->GetCondFormatData().size()); - CPPUNIT_ASSERT_EQUAL(nPastedKey, pCondFormatItem->GetCondFormatData().front()); + const SfxPoolItem& rItem = m_pDoc->GetAttr(nCol, 4, 0, ATTR_CONDITIONAL); + const ScCondFormatItem& rCondFormatItem = static_cast<const ScCondFormatItem&>(rItem); + CPPUNIT_ASSERT_EQUAL(size_t(1), rCondFormatItem.GetCondFormatData().size()); + CPPUNIT_ASSERT_EQUAL(nPastedKey, rCondFormatItem.GetCondFormatData().front()); } // Now paste next to the previous range (immediately to the right) @@ -382,11 +380,10 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testDataBarCondCopyPaste) CPPUNIT_ASSERT(nIndex1 != nPastedKey); CPPUNIT_ASSERT_EQUAL(nIndex2, nPastedKey); - const SfxPoolItem* pItem = m_pDoc->GetAttr(nCol, 4, 0, ATTR_CONDITIONAL); - const ScCondFormatItem* pCondFormatItem = static_cast<const ScCondFormatItem*>(pItem); - CPPUNIT_ASSERT(pCondFormatItem); - CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormatItem->GetCondFormatData().size()); - CPPUNIT_ASSERT_EQUAL(nPastedKey, pCondFormatItem->GetCondFormatData().front()); + const SfxPoolItem& rItem = m_pDoc->GetAttr(nCol, 4, 0, ATTR_CONDITIONAL); + const ScCondFormatItem& rCondFormatItem = static_cast<const ScCondFormatItem&>(rItem); + CPPUNIT_ASSERT_EQUAL(size_t(1), rCondFormatItem.GetCondFormatData().size()); + CPPUNIT_ASSERT_EQUAL(nPastedKey, rCondFormatItem.GetCondFormatData().front()); } m_pDoc->DeleteTab(0); @@ -485,11 +482,10 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testColorScaleCondCopyPaste) CPPUNIT_ASSERT(nIndex0 != nPastedKey); CPPUNIT_ASSERT_EQUAL(nIndex1, nPastedKey); - const SfxPoolItem* pItem = m_pDoc->GetAttr(nCol, 3, 0, ATTR_CONDITIONAL); - const ScCondFormatItem* pCondFormatItem = static_cast<const ScCondFormatItem*>(pItem); - CPPUNIT_ASSERT(pCondFormatItem); - CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormatItem->GetCondFormatData().size()); - CPPUNIT_ASSERT_EQUAL(nPastedKey, pCondFormatItem->GetCondFormatData().front()); + const SfxPoolItem& rItem = m_pDoc->GetAttr(nCol, 3, 0, ATTR_CONDITIONAL); + const ScCondFormatItem& rCondFormatItem = static_cast<const ScCondFormatItem&>(rItem); + CPPUNIT_ASSERT_EQUAL(size_t(1), rCondFormatItem.GetCondFormatData().size()); + CPPUNIT_ASSERT_EQUAL(nPastedKey, rCondFormatItem.GetCondFormatData().front()); } // Now paste next to the previous range (immediately below) @@ -512,11 +508,10 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testColorScaleCondCopyPaste) CPPUNIT_ASSERT(nIndex1 != nPastedKey); CPPUNIT_ASSERT_EQUAL(nIndex2, nPastedKey); - const SfxPoolItem* pItem = m_pDoc->GetAttr(nCol, 4, 0, ATTR_CONDITIONAL); - const ScCondFormatItem* pCondFormatItem = static_cast<const ScCondFormatItem*>(pItem); - CPPUNIT_ASSERT(pCondFormatItem); - CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormatItem->GetCondFormatData().size()); - CPPUNIT_ASSERT_EQUAL(nPastedKey, pCondFormatItem->GetCondFormatData().front()); + const SfxPoolItem& rItem = m_pDoc->GetAttr(nCol, 4, 0, ATTR_CONDITIONAL); + const ScCondFormatItem& rCondFormatItem = static_cast<const ScCondFormatItem&>(rItem); + CPPUNIT_ASSERT_EQUAL(size_t(1), rCondFormatItem.GetCondFormatData().size()); + CPPUNIT_ASSERT_EQUAL(nPastedKey, rCondFormatItem.GetCondFormatData().front()); } // Now paste next to the previous range (immediately to the right) @@ -539,11 +534,10 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testColorScaleCondCopyPaste) CPPUNIT_ASSERT(nIndex1 != nPastedKey); CPPUNIT_ASSERT_EQUAL(nIndex2, nPastedKey); - const SfxPoolItem* pItem = m_pDoc->GetAttr(nCol, 4, 0, ATTR_CONDITIONAL); - const ScCondFormatItem* pCondFormatItem = static_cast<const ScCondFormatItem*>(pItem); - CPPUNIT_ASSERT(pCondFormatItem); - CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormatItem->GetCondFormatData().size()); - CPPUNIT_ASSERT_EQUAL(nPastedKey, pCondFormatItem->GetCondFormatData().front()); + const SfxPoolItem& rItem = m_pDoc->GetAttr(nCol, 4, 0, ATTR_CONDITIONAL); + const ScCondFormatItem& rCondFormatItem = static_cast<const ScCondFormatItem&>(rItem); + CPPUNIT_ASSERT_EQUAL(size_t(1), rCondFormatItem.GetCondFormatData().size()); + CPPUNIT_ASSERT_EQUAL(nPastedKey, rCondFormatItem.GetCondFormatData().front()); } m_pDoc->DeleteTab(0); @@ -578,12 +572,11 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testCondCopyPaste) aRangeList.Join(aTargetRange); CPPUNIT_ASSERT_EQUAL(aRangeList, pPastedFormat->GetRange()); CPPUNIT_ASSERT_EQUAL(nIndex, pPastedFormat->GetKey()); - const SfxPoolItem* pItem = m_pDoc->GetAttr( 7, 7, 0, ATTR_CONDITIONAL ); - const ScCondFormatItem* pCondFormatItem = static_cast<const ScCondFormatItem*>(pItem); + const SfxPoolItem& rItem = m_pDoc->GetAttr( 7, 7, 0, ATTR_CONDITIONAL ); + const ScCondFormatItem& rCondFormatItem = static_cast<const ScCondFormatItem&>(rItem); - CPPUNIT_ASSERT(pCondFormatItem); - CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormatItem->GetCondFormatData().size()); - CPPUNIT_ASSERT_EQUAL(nIndex, pCondFormatItem->GetCondFormatData().front()); + CPPUNIT_ASSERT_EQUAL(size_t(1), rCondFormatItem.GetCondFormatData().size()); + CPPUNIT_ASSERT_EQUAL(nIndex, rCondFormatItem.GetCondFormatData().front()); m_pDoc->DeleteTab(0); } @@ -618,12 +611,11 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testCondCopyPasteSingleCell) aRangeList.Join(aTargetRange); CPPUNIT_ASSERT_EQUAL(aRangeList, pPastedFormat->GetRange()); CPPUNIT_ASSERT_EQUAL(nIndex, pPastedFormat->GetKey()); - const SfxPoolItem* pItem = m_pDoc->GetAttr( 4, 4, 0, ATTR_CONDITIONAL ); - const ScCondFormatItem* pCondFormatItem = static_cast<const ScCondFormatItem*>(pItem); + const SfxPoolItem& rItem = m_pDoc->GetAttr( 4, 4, 0, ATTR_CONDITIONAL ); + const ScCondFormatItem& rCondFormatItem = static_cast<const ScCondFormatItem&>(rItem); - CPPUNIT_ASSERT(pCondFormatItem); - CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormatItem->GetCondFormatData().size()); - CPPUNIT_ASSERT_EQUAL(nIndex, pCondFormatItem->GetCondFormatData().front() ); + CPPUNIT_ASSERT_EQUAL(size_t(1), rCondFormatItem.GetCondFormatData().size()); + CPPUNIT_ASSERT_EQUAL(nIndex, rCondFormatItem.GetCondFormatData().front() ); m_pDoc->DeleteTab(0); } @@ -662,12 +654,11 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testCondCopyPasteSingleCellToRange) CPPUNIT_ASSERT_EQUAL(aRangeList, pPastedFormat->GetRange()); sal_uInt32 nPastedKey = pPastedFormat->GetKey(); CPPUNIT_ASSERT_EQUAL(nIndex, nPastedKey); - const SfxPoolItem* pItem = m_pDoc->GetAttr( nCol, nRow, 0, ATTR_CONDITIONAL ); - const ScCondFormatItem* pCondFormatItem = static_cast<const ScCondFormatItem*>(pItem); + const SfxPoolItem& rItem = m_pDoc->GetAttr( nCol, nRow, 0, ATTR_CONDITIONAL ); + const ScCondFormatItem& rCondFormatItem = static_cast<const ScCondFormatItem&>(rItem); - CPPUNIT_ASSERT(pCondFormatItem); - CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormatItem->GetCondFormatData().size()); - CPPUNIT_ASSERT_EQUAL(nIndex, pCondFormatItem->GetCondFormatData().front() ); + CPPUNIT_ASSERT_EQUAL(size_t(1), rCondFormatItem.GetCondFormatData().size()); + CPPUNIT_ASSERT_EQUAL(nIndex, rCondFormatItem.GetCondFormatData().front() ); } } @@ -702,12 +693,11 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testCondCopyPasteSingleCellIntoSameFormatRa CPPUNIT_ASSERT_EQUAL(size_t(1), m_pDoc->GetCondFormList(0)->size()); CPPUNIT_ASSERT_EQUAL(aRangeList, pPastedFormat->GetRange()); CPPUNIT_ASSERT_EQUAL(nIndex, pPastedFormat->GetKey()); - const SfxPoolItem* pItem = m_pDoc->GetAttr(2, 2, 0, ATTR_CONDITIONAL); - const ScCondFormatItem* pCondFormatItem = static_cast<const ScCondFormatItem*>(pItem); + const SfxPoolItem& rItem = m_pDoc->GetAttr(2, 2, 0, ATTR_CONDITIONAL); + const ScCondFormatItem& rCondFormatItem = static_cast<const ScCondFormatItem&>(rItem); - CPPUNIT_ASSERT(pCondFormatItem); - CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormatItem->GetCondFormatData().size()); - CPPUNIT_ASSERT_EQUAL(nIndex, pCondFormatItem->GetCondFormatData().front()); + CPPUNIT_ASSERT_EQUAL(size_t(1), rCondFormatItem.GetCondFormatData().size()); + CPPUNIT_ASSERT_EQUAL(nIndex, rCondFormatItem.GetCondFormatData().front()); m_pDoc->DeleteTab(0); } @@ -819,12 +809,11 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testCondCopyPasteSheet) const ScRangeList& rRange = rFormat.GetRange(); CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(0,0,1,3,3,1)), rRange); sal_uInt32 nKey = rFormat.GetKey(); - const SfxPoolItem* pItem = m_pDoc->GetAttr( 2, 2, 1, ATTR_CONDITIONAL ); - const ScCondFormatItem* pCondFormatItem = static_cast<const ScCondFormatItem*>(pItem); + const SfxPoolItem& rItem = m_pDoc->GetAttr( 2, 2, 1, ATTR_CONDITIONAL ); + const ScCondFormatItem& rCondFormatItem = static_cast<const ScCondFormatItem&>(rItem); - CPPUNIT_ASSERT(pCondFormatItem); - CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormatItem->GetCondFormatData().size()); - CPPUNIT_ASSERT_EQUAL( nKey, pCondFormatItem->GetCondFormatData().front() ); + CPPUNIT_ASSERT_EQUAL(size_t(1), rCondFormatItem.GetCondFormatData().size()); + CPPUNIT_ASSERT_EQUAL( nKey, rCondFormatItem.GetCondFormatData().front() ); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -1557,7 +1546,7 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testTdf168943) for (SCROW nRow = 0; nRow <= 5; ++nRow) { // Initial state: no conditional format, so attribute must be default - CPPUNIT_ASSERT(IsDefaultItem(m_pDoc->GetAttr(0, nRow, 0, ATTR_CONDITIONAL))); + CPPUNIT_ASSERT(IsDefaultItem(&m_pDoc->GetAttr(0, nRow, 0, ATTR_CONDITIONAL))); } auto pEntry = new ScCondFormatEntry(ScConditionMode::Direct, u"=42"_ustr, {}, *m_pDoc, @@ -1573,7 +1562,7 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testTdf168943) for (SCROW nRow = 0; nRow <= 5; ++nRow) { // The attribute must be set - CPPUNIT_ASSERT(!IsDefaultItem(m_pDoc->GetAttr(0, nRow, 0, ATTR_CONDITIONAL))); + CPPUNIT_ASSERT(!IsDefaultItem(&m_pDoc->GetAttr(0, nRow, 0, ATTR_CONDITIONAL))); } ScConditionalFormatList* pNewList = new ScConditionalFormatList(); @@ -1585,7 +1574,7 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testTdf168943) // Before the fix, this failed, because ScConditionalFormatList::RemoveFromDocument, called // from SetConditionalFormatList, got a non-multimarked single-contiguous-range mark, and // ScTable::Apply was not prepared for such marks, so did nothing. - CPPUNIT_ASSERT(IsDefaultItem(m_pDoc->GetAttr(0, nRow, 0, ATTR_CONDITIONAL))); + CPPUNIT_ASSERT(IsDefaultItem(&m_pDoc->GetAttr(0, nRow, 0, ATTR_CONDITIONAL))); } m_pDoc->DeleteTab(0); diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index 499abdaf22bb..6e365cf77e73 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -1644,14 +1644,12 @@ void TestCopyPaste::executeCopyPasteSpecial(const SCTAB srcSheet, const SCTAB de m_pDoc->ApplyAttr(2, 4, srcSheet, aBorderItem); m_pDoc->ApplyAttr(2, 5, srcSheet, aBorderItem); // Check border precondition - pItem = m_pDoc->GetAttr(ScAddress(2, 2, srcSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("SrcSheet.B1 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(2, 2, srcSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); - pItem = m_pDoc->GetAttr(ScAddress(2, 3, srcSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("SrcSheet.B2 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(2, 3, srcSheet), ATTR_BORDER); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); @@ -2446,31 +2444,27 @@ void TestCopyPaste::checkCopyPasteSpecialInitial(const SCTAB srcSheet) CPPUNIT_ASSERT_EQUAL(COL_GREEN, static_cast<const SvxBrushItem*>(pItem)->GetColor()); // check border, left and right borders were transformed to top and bottom borders - pItem = m_pDoc->GetAttr(ScAddress(2, 2, srcSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(2, 2, srcSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(2, 3, srcSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(2, 3, srcSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(2, 4, srcSheet), ATTR_BORDER); + pItem = &m_pDoc->GetAttr(ScAddress(2, 4, srcSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(2, 5, srcSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(2, 5, srcSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(2, 6, srcSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(2, 6, srcSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); @@ -2773,31 +2767,27 @@ void TestCopyPaste::checkCopyPasteSpecial(bool bSkipEmpty, bool bCut) CPPUNIT_ASSERT_EQUAL(COL_GREEN, static_cast<const SvxBrushItem*>(pItem)->GetColor()); // check border, left and right borders were transformed to top and bottom borders - pItem = m_pDoc->GetAttr(ScAddress(4, 1, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 1, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 3, destSheet), ATTR_BORDER); + pItem = &m_pDoc->GetAttr(ScAddress(4, 3, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 4, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 4, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 5, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 5, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); @@ -3156,25 +3146,22 @@ void TestCopyPaste::checkCopyPasteSpecialFiltered(bool bSkipEmpty) CPPUNIT_ASSERT_EQUAL(COL_GREEN, static_cast<const SvxBrushItem*>(pItem)->GetColor()); // check border, left and right borders were transformed to top and bottom borders - pItem = m_pDoc->GetAttr(ScAddress(4, 1, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 1, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); + pItem = &m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 3, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 3, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 4, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 4, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); @@ -3412,8 +3399,7 @@ void TestCopyPaste::checkCopyPasteSpecialTranspose(bool bSkipEmpty, bool bCut) CPPUNIT_ASSERT_EQUAL(COL_GREEN, static_cast<const SvxBrushItem*>(pItem)->GetColor()); // check border, left and right borders were transformed to top and bottom borders - pItem = m_pDoc->GetAttr(ScAddress(3, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("D3 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(3, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("D3 has no top border", !static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("D3 has no bottom border", @@ -3427,8 +3413,7 @@ void TestCopyPaste::checkCopyPasteSpecialTranspose(bool bSkipEmpty, bool bCut) CPPUNIT_ASSERT_MESSAGE("E3 has a border", pItem); CPPUNIT_ASSERT_MESSAGE("E3 has top border", static_cast<const SvxBoxItem*>(pItem)->GetTop()); - pItem = m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("E3 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("E3 has top border", static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("E3 has bottom border", @@ -3437,8 +3422,7 @@ void TestCopyPaste::checkCopyPasteSpecialTranspose(bool bSkipEmpty, bool bCut) !static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT_MESSAGE("E3 has no right border", !static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(5, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("F3 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(5, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("F3 has top border", static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("F3 has bottom border", static_cast<const SvxBoxItem*>(pItem)->GetBottom()); @@ -3446,7 +3430,7 @@ void TestCopyPaste::checkCopyPasteSpecialTranspose(bool bSkipEmpty, bool bCut) !static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT_MESSAGE("F3 has no right border", !static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(6, 2, destSheet), ATTR_BORDER); + pItem = &m_pDoc->GetAttr(ScAddress(6, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("G3 has top border", static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("G3 has bottom border", static_cast<const SvxBoxItem*>(pItem)->GetBottom()); @@ -3454,8 +3438,7 @@ void TestCopyPaste::checkCopyPasteSpecialTranspose(bool bSkipEmpty, bool bCut) !static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT_MESSAGE("G3 has no right border", !static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(7, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("H3 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(7, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("H3 has no top border", !static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("H3 has no bottom border", @@ -3901,8 +3884,7 @@ void TestCopyPaste::checkCopyPasteSpecialFilteredTranspose(bool bSkipEmpty) CPPUNIT_ASSERT_EQUAL(COL_GREEN, static_cast<const SvxBrushItem*>(pItem)->GetColor()); // check border, left and right borders were transformed to top and bottom borders - pItem = m_pDoc->GetAttr(ScAddress(3, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("D3 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(3, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("D3 has no top border", !static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("D3 has no bottom border", @@ -3911,8 +3893,7 @@ void TestCopyPaste::checkCopyPasteSpecialFilteredTranspose(bool bSkipEmpty) !static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT_MESSAGE("D3 has no right border", !static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("E3 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("E3 has top border", static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("E3 has bottom border", static_cast<const SvxBoxItem*>(pItem)->GetBottom()); @@ -3920,8 +3901,7 @@ void TestCopyPaste::checkCopyPasteSpecialFilteredTranspose(bool bSkipEmpty) !static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT_MESSAGE("E3 has no right border", !static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(5, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("F3 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(5, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("F3 has top border", static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("F3 has bottom border", static_cast<const SvxBoxItem*>(pItem)->GetBottom()); @@ -3929,8 +3909,7 @@ void TestCopyPaste::checkCopyPasteSpecialFilteredTranspose(bool bSkipEmpty) !static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT_MESSAGE("F3 has no right border", !static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(6, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("G3 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(6, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("G3 has no top border", !static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("G3 has no bottom border", @@ -3939,8 +3918,7 @@ void TestCopyPaste::checkCopyPasteSpecialFilteredTranspose(bool bSkipEmpty) !static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT_MESSAGE("G3 has no right border", !static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(7, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("H3 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(7, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("H3 has no top border", !static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("H3 has no bottom border", @@ -4264,31 +4242,27 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeCol(bool bSkipEmpty) CPPUNIT_ASSERT_EQUAL(COL_GREEN, static_cast<const SvxBrushItem*>(pItem)->GetColor()); // check border, left and right borders were transformed to top and bottom borders - pItem = m_pDoc->GetAttr(ScAddress(4, 1, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 1, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 3, destSheet), ATTR_BORDER); + pItem = &m_pDoc->GetAttr(ScAddress(4, 3, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 4, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 4, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 5, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 5, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); @@ -4575,25 +4549,22 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeColFiltered(bool bSkipEmpty) CPPUNIT_ASSERT_EQUAL(COL_GREEN, static_cast<const SvxBrushItem*>(pItem)->GetColor()); // check border, left and right borders were transformed to top and bottom borders - pItem = m_pDoc->GetAttr(ScAddress(4, 1, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 1, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); + pItem = &m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 3, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 3, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 4, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 4, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); @@ -4894,8 +4865,7 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeColTranspose(bool bSkipEmpty) CPPUNIT_ASSERT_EQUAL(COL_GREEN, static_cast<const SvxBrushItem*>(pItem)->GetColor()); // check border, left and right borders were transformed to top and bottom borders - pItem = m_pDoc->GetAttr(ScAddress(3, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(3, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); @@ -4904,25 +4874,22 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeColTranspose(bool bSkipEmpty) m_pDoc->GetPattern(ScAddress(4, 2, destSheet))->GetItemSet().HasItem(ATTR_BORDER, &pItem); CPPUNIT_ASSERT(pItem); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetTop()); - pItem = m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(5, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(5, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(6, 2, destSheet), ATTR_BORDER); + pItem = &m_pDoc->GetAttr(ScAddress(6, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(7, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(7, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); @@ -5223,8 +5190,7 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeColFilteredTranspose(bool bSk CPPUNIT_ASSERT_EQUAL(COL_GREEN, static_cast<const SvxBrushItem*>(pItem)->GetColor()); // check border, left and right borders were transformed to top and bottom borders - pItem = m_pDoc->GetAttr(ScAddress(3, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(3, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); @@ -5234,19 +5200,17 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeColFilteredTranspose(bool bSk CPPUNIT_ASSERT(pItem); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetTop()); - pItem = m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(5, 2, destSheet), ATTR_BORDER); + pItem = &m_pDoc->GetAttr(ScAddress(5, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(6, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(6, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); @@ -5553,61 +5517,53 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRow(bool bSkipEmpty) CPPUNIT_ASSERT(!pItem); // check border, left and right borders were transformed to top and bottom borders - pItem = m_pDoc->GetAttr(ScAddress(4, 1, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 1, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 3, destSheet), ATTR_BORDER); + pItem = &m_pDoc->GetAttr(ScAddress(4, 3, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 4, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 4, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 5, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 5, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(3, 4, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(3, 4, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 4, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 4, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(5, 4, destSheet), ATTR_BORDER); + pItem = &m_pDoc->GetAttr(ScAddress(5, 4, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(6, 4, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(6, 4, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(7, 4, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(7, 4, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); @@ -5910,55 +5866,48 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRowFiltered(bool bSkipEmpty) CPPUNIT_ASSERT(!pItem); // check border, left and right borders were transformed to top and bottom borders - pItem = m_pDoc->GetAttr(ScAddress(4, 1, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 1, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); + pItem = &m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 3, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 3, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 4, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 4, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(3, 3, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(3, 3, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(4, 3, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 3, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(5, 3, destSheet), ATTR_BORDER); + pItem = &m_pDoc->GetAttr(ScAddress(5, 3, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(6, 3, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(6, 3, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(7, 3, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(7, 3, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetLeft()); @@ -6272,8 +6221,7 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRowTranspose(bool bSkipEmpty) CPPUNIT_ASSERT_EQUAL(COL_GREEN, static_cast<const SvxBrushItem*>(pItem)->GetColor()); // check border, left and right borders were transformed to top and bottom borders - pItem = m_pDoc->GetAttr(ScAddress(3, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("D3 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(3, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("D3 has no top border", !static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("D3 has no bottom border", @@ -6287,8 +6235,7 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRowTranspose(bool bSkipEmpty) CPPUNIT_ASSERT_MESSAGE("E3 has a border", pItem); CPPUNIT_ASSERT_MESSAGE("E3 has top border", static_cast<const SvxBoxItem*>(pItem)->GetTop()); - pItem = m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("E3 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("E3 has top border", static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("E3 has bottom border", static_cast<const SvxBoxItem*>(pItem)->GetBottom()); @@ -6296,8 +6243,7 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRowTranspose(bool bSkipEmpty) !static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT_MESSAGE("E3 has no right border", !static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(5, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("F3 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(5, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("F3 has top border", static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("F3 has bottom border", static_cast<const SvxBoxItem*>(pItem)->GetBottom()); @@ -6305,7 +6251,7 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRowTranspose(bool bSkipEmpty) !static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT_MESSAGE("F3 has no right border", !static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(6, 2, destSheet), ATTR_BORDER); + pItem = &m_pDoc->GetAttr(ScAddress(6, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("G3 has top border", !static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("G3 has bottom border", !static_cast<const SvxBoxItem*>(pItem)->GetBottom()); @@ -6313,8 +6259,7 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRowTranspose(bool bSkipEmpty) !static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT_MESSAGE("G3 has no right border", !static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(7, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("H3 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(7, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("H3 has no top border", !static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("H3 has no bottom border", @@ -6639,8 +6584,7 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRowFilteredTranspose(bool bSk CPPUNIT_ASSERT(!pItem); // check border, left and right borders were transformed to top and bottom borders - pItem = m_pDoc->GetAttr(ScAddress(3, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("D3 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(3, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("D3 has no top border", !static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("D3 has no bottom border", @@ -6652,8 +6596,7 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRowFilteredTranspose(bool bSk m_pDoc->GetPattern(ScAddress(4, 2, destSheet))->GetItemSet().HasItem(ATTR_BORDER, &pItem); CPPUNIT_ASSERT_MESSAGE("E3 has a border", pItem); CPPUNIT_ASSERT_MESSAGE("E3 has top border", static_cast<const SvxBoxItem*>(pItem)->GetTop()); - pItem = m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("E3 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(4, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("E3 has top border", static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("E3 has bottom border", static_cast<const SvxBoxItem*>(pItem)->GetBottom()); @@ -6661,7 +6604,7 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRowFilteredTranspose(bool bSk !static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT_MESSAGE("E3 has no right border", !static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(5, 2, destSheet), ATTR_BORDER); + pItem = &m_pDoc->GetAttr(ScAddress(5, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("F3 has top border", !static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("F3 has bottom border", !static_cast<const SvxBoxItem*>(pItem)->GetBottom()); @@ -6669,8 +6612,7 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRowFilteredTranspose(bool bSk !static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT_MESSAGE("F3 has no right border", !static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(6, 2, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT_MESSAGE("G3 has a border", pItem); + pItem = &m_pDoc->GetAttr(ScAddress(6, 2, destSheet), ATTR_BORDER); CPPUNIT_ASSERT_MESSAGE("G3 has no top border", !static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT_MESSAGE("G3 has no bottom border", @@ -6679,14 +6621,12 @@ void TestCopyPaste::checkCopyPasteSpecialMultiRangeRowFilteredTranspose(bool bSk !static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT_MESSAGE("G3 has no right border", !static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(5, 3, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(5, 3, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetRight()); - pItem = m_pDoc->GetAttr(ScAddress(5, 4, destSheet), ATTR_BORDER); - CPPUNIT_ASSERT(pItem); + pItem = &m_pDoc->GetAttr(ScAddress(5, 4, destSheet), ATTR_BORDER); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetTop()); CPPUNIT_ASSERT(!static_cast<const SvxBoxItem*>(pItem)->GetBottom()); CPPUNIT_ASSERT(static_cast<const SvxBoxItem*>(pItem)->GetLeft()); @@ -9227,18 +9167,12 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, testCopyPasteSkipEmpty) return false; } - const SvxBrushItem* pBrush = mpDoc->GetAttr(aPos, ATTR_BACKGROUND); - if (!pBrush) - { - std::cerr << aPosStr << ": failed to get brush item from the cell." - << std::endl; - return false; - } + const SvxBrushItem& rBrush = mpDoc->GetAttr(aPos, ATTR_BACKGROUND); - if (pBrush->GetColor() != p->maColor) + if (rBrush.GetColor() != p->maColor) { Color aExpected = p->maColor; - Color aActual = pBrush->GetColor(); + Color aActual = rBrush.GetColor(); std::cerr << aPosStr << ": incorrect cell background color: expected=(" << static_cast<int>(aExpected.GetRed()) << "," << static_cast<int>(aExpected.GetGreen()) << "," diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx index e9b88101310b..982825dfdddf 100644 --- a/sc/qa/unit/uicalc/uicalc2.cxx +++ b/sc/qa/unit/uicalc/uicalc2.cxx @@ -1670,7 +1670,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf140027) // check we have no any unnecessary flags ScDocument* pDoc = getScDoc(); - auto nFlag = pDoc->GetAttr(0, 0, 1, ATTR_MERGE_FLAG)->GetValue(); + auto nFlag = pDoc->GetAttr(0, 0, 1, ATTR_MERGE_FLAG).GetValue(); CPPUNIT_ASSERT_EQUAL(ScMF::NONE, nFlag); const ScPatternAttr* pPattern = pDoc->GetPattern(1, 0, 1); diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 0996250e4d49..7dc26e9409b0 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1087,7 +1087,7 @@ namespace { bool canCopyValue(const ScDocument& rDoc, const ScAddress& rPos, InsertDeleteFlags nFlags) { - sal_uInt32 nNumIndex = rDoc.GetAttr(rPos, ATTR_VALUE_FORMAT)->GetValue(); + sal_uInt32 nNumIndex = rDoc.GetAttr(rPos, ATTR_VALUE_FORMAT).GetValue(); SvNumFormatType nType = rDoc.GetFormatTable()->GetType(nNumIndex); if ((nType == SvNumFormatType::DATE) || (nType == SvNumFormatType::TIME) || (nType == SvNumFormatType::DATETIME)) return ((nFlags & InsertDeleteFlags::DATETIME) != InsertDeleteFlags::NONE); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 2d0442c44682..2635cb59f25e 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -1517,7 +1517,7 @@ bool ScDocument::HasAutoFilter( SCCOL nCurCol, SCROW nCurRow, SCTAB nCurTab ) for ( nCol=aParam.nCol1; nCol<=aParam.nCol2 && bHasAutoFilter; nCol++ ) { - nFlag = GetAttr( nCol, nRow, nCurTab, ATTR_MERGE_FLAG )->GetValue(); + nFlag = GetAttr( nCol, nRow, nCurTab, ATTR_MERGE_FLAG ).GetValue(); if ( !(nFlag & ScMF::Auto) ) bHasAutoFilter = false; @@ -1636,7 +1636,7 @@ void ScDocument::GetDataEntries( /* Try to generate the list from list validation. This part is skipped, if bValidation==false, because in that case this function is called to get cell values for auto completion on input. */ - sal_uInt32 nValidation = GetAttr( nCol, nRow, nTab, ATTR_VALIDDATA )->GetValue(); + sal_uInt32 nValidation = GetAttr( nCol, nRow, nTab, ATTR_VALIDDATA ).GetValue(); if( nValidation ) { const ScValidationData* pData = GetValidationEntry( nValidation ); @@ -2094,13 +2094,13 @@ void ScDocument::DoMerge( SCCOL nStartCol, SCROW nStartRow, void ScDocument::RemoveMerge( SCCOL nCol, SCROW nRow, SCTAB nTab ) { - const ScMergeAttr* pAttr = GetAttr( nCol, nRow, nTab, ATTR_MERGE ); + const ScMergeAttr& rAttr = GetAttr( nCol, nRow, nTab, ATTR_MERGE ); - if ( pAttr->GetColMerge() <= 1 && pAttr->GetRowMerge() <= 1 ) + if ( rAttr.GetColMerge() <= 1 && rAttr.GetRowMerge() <= 1 ) return; - SCCOL nEndCol = nCol + pAttr->GetColMerge() - 1; - SCROW nEndRow = nRow + pAttr->GetRowMerge() - 1; + SCCOL nEndCol = nCol + rAttr.GetColMerge() - 1; + SCROW nEndRow = nRow + rAttr.GetRowMerge() - 1; RemoveFlagsTab( nCol, nRow, nEndCol, nEndRow, nTab, ScMF::Hor | ScMF::Ver ); diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index 771c4d81964a..a2d31ef7d3ed 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -841,7 +841,7 @@ ScConditionalFormat* ScDocument::GetCondFormat( SCCOL nCol, SCROW nRow, SCTAB nTab ) const { sal_uInt32 nIndex = 0; - const ScCondFormatIndexes& rCondFormats = GetAttr(nCol, nRow, nTab, ATTR_CONDITIONAL)->GetCondFormatData(); + const ScCondFormatIndexes& rCondFormats = GetAttr(nCol, nRow, nTab, ATTR_CONDITIONAL).GetCondFormatData(); if(!rCondFormats.empty()) nIndex = rCondFormats[0]; diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 8d4d70eb4437..07574c35d741 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -1304,7 +1304,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, Transliteratio sal_uInt16 nWhich = ( nScript == SvtScriptType::ASIAN ) ? ATTR_CJK_FONT_LANGUAGE : ( ( nScript == SvtScriptType::COMPLEX ) ? ATTR_CTL_FONT_LANGUAGE : ATTR_FONT_LANGUAGE ); - nLanguage = static_cast<const SvxLanguageItem*>(GetAttr( nCol, nRow, nTab, nWhich ))->GetValue(); + nLanguage = static_cast<const SvxLanguageItem&>(GetAttr( nCol, nRow, nTab, nWhich )).GetValue(); } uno::Sequence<sal_Int32> aOffsets; diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index aae3d7bbe3b0..eeadfc52f19e 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3858,7 +3858,7 @@ bool ScDocument::HasStringCells( const ScRange& rRange ) const bool ScDocument::HasSelectionData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const { - sal_uInt32 nValidation = GetAttr( nCol, nRow, nTab, ATTR_VALIDDATA )->GetValue(); + sal_uInt32 nValidation = GetAttr(nCol, nRow, nTab, ATTR_VALIDDATA).GetValue(); if( nValidation ) { const ScValidationData* pData = GetValidationEntry( nValidation ); @@ -3870,7 +3870,7 @@ bool ScDocument::HasSelectionData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const bool ScDocument::HasValidationData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const { - sal_uInt32 nValidation = GetAttr( nCol, nRow, nTab, ATTR_VALIDDATA )->GetValue(); + sal_uInt32 nValidation = GetAttr(nCol, nRow, nTab, ATTR_VALIDDATA).GetValue(); if( nValidation ) { const ScValidationData* pData = GetValidationEntry( nValidation ); @@ -4760,37 +4760,37 @@ void ScDocument::ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, S // Attribute ---------------------------------------------------------- -const SfxPoolItem* ScDocument::GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich ) const +const SfxPoolItem& ScDocument::GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const { if (const ScTable* pTable = FetchTable(nTab)) { const SfxPoolItem* pTemp = pTable->GetAttr( nCol, nRow, nWhich ); if (pTemp) - return pTemp; + return *pTemp; else { OSL_FAIL( "Attribute Null" ); } } - return &mxPoolHelper->GetDocPool()->GetUserOrPoolDefaultItem( nWhich ); + return mxPoolHelper->GetDocPool()->GetUserOrPoolDefaultItem(nWhich); } -const SfxPoolItem* ScDocument::GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich, SCROW& nStartRow, SCROW& nEndRow ) const +const SfxPoolItem& ScDocument::GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich, SCROW& nStartRow, SCROW& nEndRow ) const { if (const ScTable* pTable = FetchTable(nTab)) { const SfxPoolItem* pTemp = pTable->GetAttr( nCol, nRow, nWhich, nStartRow, nEndRow ); if (pTemp) - return pTemp; + return *pTemp; else { OSL_FAIL( "Attribute Null" ); } } - return &mxPoolHelper->GetDocPool()->GetUserOrPoolDefaultItem( nWhich ); + return mxPoolHelper->GetDocPool()->GetUserOrPoolDefaultItem(nWhich); } -const SfxPoolItem* ScDocument::GetAttr( const ScAddress& rPos, sal_uInt16 nWhich ) const +const SfxPoolItem& ScDocument::GetAttr(const ScAddress& rPos, sal_uInt16 nWhich) const { return GetAttr(rPos.Col(), rPos.Row(), rPos.Tab(), nWhich); } @@ -5520,7 +5520,7 @@ void ScDocument::ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow, SCCOL nOldCol = rStartCol; SCROW nOldRow = rStartRow; for (nCol=nOldCol; nCol<=nEndCol; nCol++) - while (GetAttr(nCol,rStartRow,nTab,ATTR_MERGE_FLAG)->IsVerOverlapped()) + while (GetAttr(nCol, rStartRow, nTab, ATTR_MERGE_FLAG).IsVerOverlapped()) --rStartRow; //TODO: pass on ? @@ -5551,7 +5551,7 @@ void ScDocument::ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow, SCCOL nTempCol = nOldCol; do --nTempCol; - while (GetAttr(nTempCol,nAttrRow,nTab,ATTR_MERGE_FLAG)->IsHorOverlapped()); + while (GetAttr(nTempCol,nAttrRow,nTab,ATTR_MERGE_FLAG).IsHorOverlapped()); if (nTempCol < rStartCol) rStartCol = nTempCol; } @@ -5763,28 +5763,15 @@ void ScDocument::SkipOverlapped( SCCOL& rCol, SCROW& rRow, SCTAB nTab ) const bool ScDocument::IsHorOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const { - const ScMergeFlagAttr* pAttr = GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ); - if (pAttr) - return pAttr->IsHorOverlapped(); - else - { - OSL_FAIL("Overlapped: Attr==0"); - return false; - } + return GetAttr(nCol, nRow, nTab, ATTR_MERGE_FLAG).IsHorOverlapped(); } bool ScDocument::IsVerOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab, SCROW* nStartRow, SCROW* nEndRow ) const { SCROW dummy; - const ScMergeFlagAttr* pAttr = GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG, + const ScMergeFlagAttr& rAttr = GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG, nStartRow ? *nStartRow : dummy, nEndRow ? *nEndRow : dummy ); - if (pAttr) - return pAttr->IsVerOverlapped(); - else - { - OSL_FAIL("Overlapped: Attr==0"); - return false; - } + return rAttr.IsVerOverlapped(); } void ScDocument::ApplySelectionFrame( const ScMarkData& rMark, diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 86c158dde172..b77cab65a259 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -937,7 +937,7 @@ ScRange ScDPObject::GetOutputRangeByType( sal_Int32 nType ) const static bool lcl_HasButton( const ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab ) { - return pDoc->GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG )->HasPivotButton(); + return pDoc->GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ).HasPivotButton(); } void ScDPObject::RefreshAfterLoad() diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 05baec03ead6..c744dbb48ea3 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -2399,11 +2399,11 @@ tools::Rectangle ScDrawLayer::GetCellRect( const ScDocument& rDoc, const ScAddre ScAddress aEndPos = rPos; if( bMergedCell ) { - const ScMergeAttr* pMerge = rDoc.GetAttr( rPos, ATTR_MERGE ); - if( pMerge->GetColMerge() > 1 ) - aEndPos.IncCol( pMerge->GetColMerge() - 1 ); - if( pMerge->GetRowMerge() > 1 ) - aEndPos.IncRow( pMerge->GetRowMerge() - 1 ); + const ScMergeAttr& rMerge = rDoc.GetAttr( rPos, ATTR_MERGE ); + if( rMerge.GetColMerge() > 1 ) + aEndPos.IncCol( rMerge.GetColMerge() - 1 ); + if( rMerge.GetRowMerge() > 1 ) + aEndPos.IncRow( rMerge.GetRowMerge() - 1 ); } Point aBotRight = aTopLeft; for( SCCOL nCol = rPos.Col(); nCol <= aEndPos.Col(); ++nCol ) diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index 34da5ff9c10e..fd1f56e0e365 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -72,7 +72,7 @@ static void lcl_GetMergeRange( SCCOL nX, SCROW nY, SCSIZE nArrY, } else { - ScMF nOverlap = pDoc->GetAttr( rStartX, rStartY, nTab, ATTR_MERGE_FLAG )->GetValue(); + ScMF nOverlap = pDoc->GetAttr( rStartX, rStartY, nTab, ATTR_MERGE_FLAG ).GetValue(); bHOver = bool(nOverlap & ScMF::Hor); bVOver = bool(nOverlap & ScMF::Ver); } @@ -95,7 +95,7 @@ static void lcl_GetMergeRange( SCCOL nX, SCROW nY, SCSIZE nArrY, else { ScMF nOverlap = pDoc->GetAttr( - rStartX, rStartY, nTab, ATTR_MERGE_FLAG )->GetValue(); + rStartX, rStartY, nTab, ATTR_MERGE_FLAG ).GetValue(); bVOver = bool(nOverlap & ScMF::Ver); } } @@ -110,7 +110,7 @@ static void lcl_GetMergeRange( SCCOL nX, SCROW nY, SCSIZE nArrY, GetItem(ATTR_MERGE); } else - pMerge = pDoc->GetAttr(rStartX,rStartY,nTab,ATTR_MERGE); + pMerge = &pDoc->GetAttr(rStartX,rStartY,nTab,ATTR_MERGE); rEndX = rStartX + pMerge->GetColMerge() - 1; rEndY = rStartY + pMerge->GetRowMerge() - 1; diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index e17e0d69a2de..7597e5f1a136 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2273,7 +2273,7 @@ void ScFormulaCell::InterpretTail( ScInterpreterContext& rContext, ScInterpretTa if ( pCode->IsRecalcModeForced() ) { sal_uInt32 nValidation = rDocument.GetAttr( - aPos.Col(), aPos.Row(), aPos.Tab(), ATTR_VALIDDATA )->GetValue(); + aPos.Col(), aPos.Row(), aPos.Tab(), ATTR_VALIDDATA ).GetValue(); if ( nValidation ) { const ScValidationData* pData = rDocument.GetValidationEntry( nValidation ); diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index 1536cb39e778..5cc62bf9ec48 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -699,7 +699,7 @@ Color ScTable::GetCellBackgroundColor(ScAddress aPos) const } } return bHasConditionalBackgroundColor ? backgroundColor - : GetDoc().GetAttr(aPos, ATTR_BACKGROUND)->GetColor(); + : GetDoc().GetAttr(aPos, ATTR_BACKGROUND).GetColor(); } Color ScTable::GetCellTextColor(ScAddress aPos) const @@ -727,8 +727,7 @@ Color ScTable::GetCellTextColor(ScAddress aPos) const } } - const SvxColorItem* pColor = GetDoc().GetAttr(aPos, ATTR_FONT_COLOR); - return pColor->GetValue(); + return GetDoc().GetAttr(aPos, ATTR_FONT_COLOR).GetValue(); } bool ScTable::IsManualRowHeight(SCROW nRow) const diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 2470ff0623ab..d63b69b62a20 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -2460,8 +2460,8 @@ void ScInterpreter::ScCell() sal_Unicode c = 0; if (aCell.hasString()) { - const SvxHorJustifyItem* pJustAttr = mrDoc.GetAttr( aCellPos, ATTR_HOR_JUSTIFY ); - switch( pJustAttr->GetValue() ) + const SvxHorJustifyItem& rJustAttr = mrDoc.GetAttr( aCellPos, ATTR_HOR_JUSTIFY ); + switch( rJustAttr.GetValue() ) { case SvxCellHorJustify::Standard: case SvxCellHorJustify::Left: @@ -2475,8 +2475,8 @@ void ScInterpreter::ScCell() } else if( aInfoType == "PROTECT" ) { // 1 = cell locked - const ScProtectionAttr* pProtAttr = mrDoc.GetAttr( aCellPos, ATTR_PROTECTION ); - PushInt( pProtAttr->GetProtection() ? 1 : 0 ); + const ScProtectionAttr& rProtAttr = mrDoc.GetAttr( aCellPos, ATTR_PROTECTION ); + PushInt( rProtAttr.GetProtection() ? 1 : 0 ); } // *** FORMATTING *** diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 248e4589971e..1851e7e03a63 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -496,7 +496,7 @@ void XclImpAutoFilterData::SetCellAttribs() ScDocument& rDoc = pExcRoot->pIR->GetDoc(); for ( SCCOL nCol = StartCol(); nCol <= EndCol(); nCol++ ) { - ScMF nFlag = rDoc.GetAttr( nCol, StartRow(), Tab(), ATTR_MERGE_FLAG )->GetValue(); + ScMF nFlag = rDoc.GetAttr( nCol, StartRow(), Tab(), ATTR_MERGE_FLAG ).GetValue(); rDoc.ApplyAttr( nCol, StartRow(), Tab(), ScMergeFlagAttr( nFlag | ScMF::Auto) ); } } diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 221e804338a3..ae764f3844ac 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -998,7 +998,7 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const { SCCOL nCol = static_cast<SCCOL>(rEntry.nField); XclExpAutofilter* pFilter = GetByCol( nCol - aRange.aStart.Col() ); - auto nFlag = rDoc.GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG )->GetValue(); + auto nFlag = rDoc.GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ).GetValue(); bool bIsButtonHidden = !( nFlag & ScMF::Auto ); pFilter->SetButtonHidden( bIsButtonHidden ); @@ -1017,7 +1017,7 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const sal_uInt16 nColId = 0; for ( auto nCol = aRange.aStart.Col(); nCol <= aRange.aEnd.Col(); nCol++, nColId++ ) { - auto nFlag = rDoc.GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG )->GetValue(); + auto nFlag = rDoc.GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ).GetValue(); bool bIsButtonHidden = !( nFlag & ScMF::Auto ); if ( bIsButtonHidden ) { diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index 4e4f094aae03..3f7a19df0189 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -1962,13 +1962,13 @@ void XclImpXFRangeBuffer::SetBorderLine( const ScRange& rRange, SCTAB nScTab, Sv SCROW nFromScRow = (nLine == SvxBoxItemLine::BOTTOM) ? rRange.aEnd.Row() : rRange.aStart.Row(); ScDocument& rDoc = GetDoc(); - const SvxBoxItem* pFromItem = + const SvxBoxItem& rFromItem = rDoc.GetAttr( nFromScCol, nFromScRow, nScTab, ATTR_BORDER ); - const SvxBoxItem* pToItem = + const SvxBoxItem& rToItem = rDoc.GetAttr( rRange.aStart.Col(), rRange.aStart.Row(), nScTab, ATTR_BORDER ); - SvxBoxItem aNewItem( *pToItem ); - aNewItem.SetLine( pFromItem->GetLine( nLine ), nLine ); + SvxBoxItem aNewItem(rToItem); + aNewItem.SetLine(rFromItem.GetLine(nLine), nLine); rDoc.ApplyAttr( rRange.aStart.Col(), rRange.aStart.Row(), nScTab, aNewItem ); } @@ -2071,7 +2071,7 @@ void XclImpXFRangeBuffer::Finalize() // #i93609# merged range in a single row: test if manual row height is needed if( !bMultiRow ) { - bool bTextWrap = rDoc.GetAttr( rStart, ATTR_LINEBREAK )->GetValue(); + bool bTextWrap = rDoc.GetAttr( rStart, ATTR_LINEBREAK ).GetValue(); if( !bTextWrap && (rDoc.GetCellType( rStart ) == CELLTYPE_EDIT) ) if (const EditTextObject* pEditObj = rDoc.GetEditText(rStart)) bTextWrap = pEditObj->GetParagraphCount() > 1; diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 8dfc5c02bddb..771a47de1a3b 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -961,20 +961,16 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC OStringBuffer aStrTD(OOO_STRING_SVTOOLS_HTML_tabledata); // border of the cells - const SvxBoxItem* pBorder = pDoc->GetAttr( nCol, nRow, nTab, ATTR_BORDER ); - if ( pBorder && (pBorder->GetTop() || pBorder->GetBottom() || pBorder->GetLeft() || pBorder->GetRight()) ) + const SvxBoxItem& rBorder = pDoc->GetAttr( nCol, nRow, nTab, ATTR_BORDER ); + if (rBorder.GetTop() || rBorder.GetBottom() || rBorder.GetLeft() || rBorder.GetRight()) { aStrTD.append(" " OOO_STRING_SVTOOLS_HTML_style "=\""); bool bInsertSemicolon = false; - aStrTD.append(BorderToStyle("top", pBorder->GetTop(), - bInsertSemicolon)); - aStrTD.append(BorderToStyle("bottom", pBorder->GetBottom(), - bInsertSemicolon)); - aStrTD.append(BorderToStyle("left", pBorder->GetLeft(), - bInsertSemicolon)); - aStrTD.append(BorderToStyle("right", pBorder->GetRight(), - bInsertSemicolon)); + aStrTD.append(BorderToStyle("top", rBorder.GetTop(), bInsertSemicolon)); + aStrTD.append(BorderToStyle("bottom", rBorder.GetBottom(), bInsertSemicolon)); + aStrTD.append(BorderToStyle("left", rBorder.GetLeft(), bInsertSemicolon)); + aStrTD.append(BorderToStyle("right", rBorder.GetRight(), bInsertSemicolon)); aStrTD.append('"'); } diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx index 1b8845cebd5c..8b5c88e2bfee 100644 --- a/sc/source/filter/html/htmlimp.cxx +++ b/sc/source/filter/html/htmlimp.cxx @@ -132,25 +132,25 @@ void ScHTMLImport::WriteToDocument( if( (pEntry->nColOverlap > 1) || (pEntry->nRowOverlap > 1) ) { SCTAB nTab = maRange.aStart.Tab(); - const ScMergeAttr* pItem = mrDoc.GetAttr( pEntry->nCol, pEntry->nRow, nTab, ATTR_MERGE ); - if( pItem->IsMerged() ) + const ScMergeAttr& rItem = mrDoc.GetAttr(pEntry->nCol, pEntry->nRow, nTab, ATTR_MERGE); + if (rItem.IsMerged()) { - SCCOL nColMerge = pItem->GetColMerge(); - SCROW nRowMerge = pItem->GetRowMerge(); + SCCOL nColMerge = rItem.GetColMerge(); + SCROW nRowMerge = rItem.GetRowMerge(); - const SvxBoxItem* pToItem = mrDoc.GetAttr( pEntry->nCol, pEntry->nRow, nTab, ATTR_BORDER ); - SvxBoxItem aNewItem( *pToItem ); + const SvxBoxItem& rToItem = mrDoc.GetAttr( pEntry->nCol, pEntry->nRow, nTab, ATTR_BORDER ); + SvxBoxItem aNewItem(rToItem); if( nColMerge > 1 ) { - const SvxBoxItem* pFromItem = + const SvxBoxItem& rFromItem = mrDoc.GetAttr( pEntry->nCol + nColMerge - 1, pEntry->nRow, nTab, ATTR_BORDER ); - aNewItem.SetLine( pFromItem->GetLine( SvxBoxItemLine::RIGHT ), SvxBoxItemLine::RIGHT ); + aNewItem.SetLine( rFromItem.GetLine( SvxBoxItemLine::RIGHT ), SvxBoxItemLine::RIGHT ); } if( nRowMerge > 1 ) { - const SvxBoxItem* pFromItem = + const SvxBoxItem& rFromItem = mrDoc.GetAttr( pEntry->nCol, pEntry->nRow + nRowMerge - 1, nTab, ATTR_BORDER ); - aNewItem.SetLine( pFromItem->GetLine( SvxBoxItemLine::BOTTOM ), SvxBoxItemLine::BOTTOM ); + aNewItem.SetLine( rFromItem.GetLine( SvxBoxItemLine::BOTTOM ), SvxBoxItemLine::BOTTOM ); } mrDoc.ApplyAttr( pEntry->nCol, pEntry->nRow, nTab, aNewItem ); } diff --git a/sc/source/filter/oox/autofilterbuffer.cxx b/sc/source/filter/oox/autofilterbuffer.cxx index d5567250fc3a..fb1f380911ae 100644 --- a/sc/source/filter/oox/autofilterbuffer.cxx +++ b/sc/source/filter/oox/autofilterbuffer.cxx @@ -764,7 +764,7 @@ void AutoFilter::finalizeImport( const Reference< XDatabaseRange >& rxDatabaseRa if (rxFilterColumn->isButtonHidden()) { - auto nFlag = rDoc.GetAttr(nCol, nRow, nTab, ATTR_MERGE_FLAG)->GetValue(); + auto nFlag = rDoc.GetAttr(nCol, nRow, nTab, ATTR_MERGE_FLAG).GetValue(); rDoc.ApplyAttr(nCol, nRow, nTab, ScMergeFlagAttr(nFlag & ~ScMF::Auto)); } nCol++; diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx index 03eab737d104..ceac7d5ba8a2 100644 --- a/sc/source/filter/oox/sheetdatabuffer.cxx +++ b/sc/source/filter/oox/sheetdatabuffer.cxx @@ -783,13 +783,13 @@ static void lcl_SetBorderLine( ScDocument& rDoc, const ScRange& rRange, SCTAB nS SCCOL nFromScCol = (nLine == SvxBoxItemLine::RIGHT) ? rRange.aEnd.Col() : rRange.aStart.Col(); SCROW nFromScRow = (nLine == SvxBoxItemLine::BOTTOM) ? rRange.aEnd.Row() : rRange.aStart.Row(); - const SvxBoxItem* pFromItem = + const SvxBoxItem& rFromItem = rDoc.GetAttr( nFromScCol, nFromScRow, nScTab, ATTR_BORDER ); - const SvxBoxItem* pToItem = + const SvxBoxItem& rToItem = rDoc.GetAttr( rRange.aStart.Col(), rRange.aStart.Row(), nScTab, ATTR_BORDER ); - SvxBoxItem aNewItem( *pToItem ); - aNewItem.SetLine( pFromItem->GetLine( nLine ), nLine ); + SvxBoxItem aNewItem(rToItem); + aNewItem.SetLine(rFromItem.GetLine(nLine), nLine); rDoc.ApplyAttr( rRange.aStart.Col(), rRange.aStart.Row(), nScTab, aNewItem ); } diff --git a/sc/source/filter/orcus/autofilter.cxx b/sc/source/filter/orcus/autofilter.cxx index 52eb305cfdde..aa477f06a1f2 100644 --- a/sc/source/filter/orcus/autofilter.cxx +++ b/sc/source/filter/orcus/autofilter.cxx @@ -276,7 +276,7 @@ void ScOrcusAutoFilter::commit() for (SCCOL nCol = mnCol1; nCol <= mnCol2; ++nCol) { - auto nFlag = rDoc.GetAttr(nCol, mnRow1, mnTab, ATTR_MERGE_FLAG)->GetValue(); + auto nFlag = rDoc.GetAttr(nCol, mnRow1, mnTab, ATTR_MERGE_FLAG).GetValue(); rDoc.ApplyAttr(nCol, mnRow1, mnTab, ScMergeFlagAttr(nFlag | ScMF::Auto)); } } diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx index ea7c156fa7b8..24e85cf35c8e 100644 --- a/sc/source/ui/Accessibility/AccessibleCell.cxx +++ b/sc/source/ui/Accessibility/AccessibleCell.cxx @@ -188,8 +188,8 @@ tools::Rectangle ScAccessibleCell::GetBoundingBox() simply expand the cell size to the width of the unrotated text. */ if (mpDoc) { - const ScRotateValueItem* pItem = mpDoc->GetAttr( maCellAddress, ATTR_ROTATE_VALUE ); - if( pItem && (pItem->GetValue() != 0_deg100) ) + const ScRotateValueItem& rItem = mpDoc->GetAttr( maCellAddress, ATTR_ROTATE_VALUE ); + if (rItem.GetValue() != 0_deg100) { tools::Rectangle aParaRect = GetParagraphBoundingBox(); if( !aParaRect.IsEmpty() && (aCellRect.GetWidth() < aParaRect.GetWidth()) ) @@ -302,9 +302,8 @@ bool ScAccessibleCell::IsEditable(sal_Int64 nParentStates) mpDoc) { // here I have to test whether the protection of the table should influence this cell. - const ScProtectionAttr* pItem = mpDoc->GetAttr(maCellAddress, ATTR_PROTECTION); - if (pItem) - bEditable = !pItem->GetProtection(); + const ScProtectionAttr& rItem = mpDoc->GetAttr(maCellAddress, ATTR_PROTECTION); + bEditable = !rItem.GetProtection(); } return bEditable; } @@ -315,9 +314,8 @@ bool ScAccessibleCell::IsOpaque() const bool bOpaque(true); if (mpDoc) { - const SvxBrushItem* pItem = mpDoc->GetAttr(maCellAddress, ATTR_BACKGROUND); - if (pItem) - bOpaque = pItem->GetColor() != COL_TRANSPARENT; + const SvxBrushItem& rItem = mpDoc->GetAttr(maCellAddress, ATTR_BACKGROUND); + bOpaque = rItem.GetColor() != COL_TRANSPARENT; } return bOpaque; } @@ -516,7 +514,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL ScAccessibleCell::getCharacterAtt uno::Sequence< beans::PropertyValue > aAttribs = AccessibleStaticTextBase::getCharacterAttributes( nIndex, aRequestedAttributes ); - sal_uInt16 nParaIndent = mpDoc->GetAttr( maCellAddress, ATTR_INDENT )->GetValue(); + sal_uInt16 nParaIndent = mpDoc->GetAttr( maCellAddress, ATTR_INDENT ).GetValue(); if (nParaIndent > 0) { auto [begin, end] = asNonConstRange(aAttribs); @@ -543,15 +541,15 @@ bool ScAccessibleCell::IsDropdown() const sal_uInt16 nPosX = maCellAddress.Col(); sal_uInt16 nPosY = sal_uInt16(maCellAddress.Row()); sal_uInt16 nTab = maCellAddress.Tab(); - sal_uInt32 nValidation = mpDoc->GetAttr( nPosX, nPosY, nTab, ATTR_VALIDDATA )->GetValue(); + sal_uInt32 nValidation = mpDoc->GetAttr( nPosX, nPosY, nTab, ATTR_VALIDDATA ).GetValue(); if( nValidation ) { const ScValidationData* pData = mpDoc->GetValidationEntry( nValidation ); if( pData && pData->HasSelectionList() ) return true; } - const ScMergeFlagAttr* pAttr = mpDoc->GetAttr( nPosX, nPosY, nTab, ATTR_MERGE_FLAG ); - if( pAttr->HasAutoFilter() ) + const ScMergeFlagAttr& rAttr = mpDoc->GetAttr( nPosX, nPosY, nTab, ATTR_MERGE_FLAG ); + if (rAttr.HasAutoFilter()) { return true; } diff --git a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx index ae6122609106..f505f6d269ec 100644 --- a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx +++ b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx @@ -223,9 +223,8 @@ bool ScAccessiblePreviewCell::IsOpaque() const bool bOpaque(true); if (mpDoc) { - const SvxBrushItem* pItem = mpDoc->GetAttr(maCellAddress, ATTR_BACKGROUND); - if (pItem) - bOpaque = pItem->GetColor() != COL_TRANSPARENT; + const SvxBrushItem& rItem = mpDoc->GetAttr(maCellAddress, ATTR_BACKGROUND); + bOpaque = rItem.GetColor() != COL_TRANSPARENT; } return bOpaque; } diff --git a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx index 0682320d4cf9..21b3e810dd4c 100644 --- a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx +++ b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx @@ -166,10 +166,10 @@ sal_Int32 SAL_CALL ScAccessiblePreviewTable::getAccessibleRowExtentAt( sal_Int32 else { ScDocument& rDoc = mpViewShell->GetDocument(); - const ScMergeAttr* pItem = rDoc.GetAttr( + const ScMergeAttr& rItem = rDoc.GetAttr( static_cast<SCCOL>(rColInfo.nDocIndex), static_cast<SCROW>(rRowInfo.nDocIndex), mpTableInfo->GetTab(), ATTR_MERGE ); - if ( pItem && pItem->GetRowMerge() > 0 ) - nRows = pItem->GetRowMerge(); + if ( rItem.GetRowMerge() > 0 ) + nRows = rItem.GetRowMerge(); } return nRows; @@ -197,10 +197,10 @@ sal_Int32 SAL_CALL ScAccessiblePreviewTable::getAccessibleColumnExtentAt( sal_In else { ScDocument& rDoc = mpViewShell->GetDocument(); - const ScMergeAttr* pItem = rDoc.GetAttr( + const ScMergeAttr& rItem = rDoc.GetAttr( static_cast<SCCOL>(rColInfo.nDocIndex), static_cast<SCROW>(rRowInfo.nDocIndex), mpTableInfo->GetTab(), ATTR_MERGE ); - if ( pItem && pItem->GetColMerge() > 0 ) - nColumns = pItem->GetColMerge(); + if ( rItem.GetColMerge() > 0 ) + nColumns = rItem.GetColMerge(); } return nColumns; diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index 240505559943..4248bb4127af 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -497,25 +497,22 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder() // #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells tools::Long nIndent = 0; - const SvxHorJustifyItem* pHorJustifyItem = rDoc.GetAttr( aCellPos, ATTR_HOR_JUSTIFY ); - SvxCellHorJustify eHorJust = pHorJustifyItem ? pHorJustifyItem->GetValue() : SvxCellHorJustify::Standard; + const SvxHorJustifyItem& rHorJustifyItem = rDoc.GetAttr( aCellPos, ATTR_HOR_JUSTIFY ); + SvxCellHorJustify eHorJust = rHorJustifyItem.GetValue(); if ( eHorJust == SvxCellHorJustify::Left ) { -e ... etc. - the rest is truncated
