sc/inc/patattr.hxx | 7 ++ sc/qa/unit/helper/qahelper.cxx | 10 +- sc/qa/unit/subsequent_filters-test.cxx | 9 +- sc/source/core/data/attarray.cxx | 78 +++++++++------------- sc/source/core/data/column.cxx | 8 +- sc/source/core/data/column2.cxx | 45 +++++-------- sc/source/core/data/column3.cxx | 4 - sc/source/core/data/column4.cxx | 7 -- sc/source/core/data/documen4.cxx | 4 - sc/source/core/data/documen6.cxx | 2 sc/source/core/data/document.cxx | 6 - sc/source/core/data/fillinfo.cxx | 33 +++------ sc/source/core/data/global.cxx | 2 sc/source/core/data/patattr.cxx | 11 +-- sc/source/core/data/table1.cxx | 4 - sc/source/core/data/table2.cxx | 4 - sc/source/core/data/table4.cxx | 4 - sc/source/core/tool/detfunc.cxx | 2 sc/source/core/tool/editutil.cxx | 15 ++-- sc/source/core/tool/interpr1.cxx | 3 sc/source/filter/html/htmlexp.cxx | 28 ++++---- sc/source/filter/rtf/rtfexp.cxx | 16 ++-- sc/source/filter/xml/XMLExportDataPilot.cxx | 2 sc/source/ui/app/inputhdl.cxx | 14 +--- sc/source/ui/docshell/docfunc.cxx | 8 +- sc/source/ui/unoobj/cellsuno.cxx | 16 ++-- sc/source/ui/view/cellsh1.cxx | 2 sc/source/ui/view/formatsh.cxx | 30 +++----- sc/source/ui/view/gridwin.cxx | 23 ++---- sc/source/ui/view/gridwin4.cxx | 9 +- sc/source/ui/view/output.cxx | 28 +++----- sc/source/ui/view/output2.cxx | 96 ++++++++++++++-------------- sc/source/ui/view/printfun.cxx | 4 - sc/source/ui/view/viewdata.cxx | 12 +-- sc/source/ui/view/viewfun3.cxx | 4 - sc/source/ui/view/viewfunc.cxx | 19 ++--- 36 files changed, 263 insertions(+), 306 deletions(-)
New commits: commit 94d76cef1f71056fab106caf4cc8e65504475615 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Nov 23 11:25:49 2017 +0200 TypedWhichId create custom get methods in ScPatternAttr Change-Id: Iaa326332f5806477dd81463e6b6004a962bac934 Reviewed-on: https://gerrit.libreoffice.org/45128 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx index 4dddfd6739dd..115072b863f5 100644 --- a/sc/inc/patattr.hxx +++ b/sc/inc/patattr.hxx @@ -69,9 +69,16 @@ public: const SfxPoolItem& GetItem( sal_uInt16 nWhichP ) const { return GetItemSet().Get(nWhichP); } + template<class T> const T& GetItem( TypedWhichId<T> nWhich ) const + { return static_cast<const T&>(GetItem(sal_uInt16(nWhich))); } static const SfxPoolItem& GetItem( sal_uInt16 nWhich, const SfxItemSet& rItemSet, const SfxItemSet* pCondSet ); + template<class T> static const T& GetItem( TypedWhichId<T> nWhich, const SfxItemSet& rItemSet, const SfxItemSet* pCondSet ) + { return static_cast<const T&>(GetItem(sal_uInt16(nWhich), rItemSet, pCondSet)); } + const SfxPoolItem& GetItem( sal_uInt16 nWhich, const SfxItemSet* pCondSet ) const; + template<class T> const T& GetItem( TypedWhichId<T> nWhich, const SfxItemSet* pCondSet ) const + { return static_cast<const T&>(GetItem(sal_uInt16(nWhich), pCondSet)); } /// @param pWhich are no ranges, but single IDs, 0-terminated bool HasItemsSet( const sal_uInt16* pWhich ) const; diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 66d2da055013..b53c8377e1a0 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -226,17 +226,17 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat) CPPUNIT_ASSERT_EQUAL( aKnownGoodStr, aTestStr ); } pPattern = pDoc->GetPattern(1,4,1); - Color aColor = static_cast<const SvxBrushItem&>(pPattern->GetItem(ATTR_BACKGROUND)).GetColor(); + Color aColor = pPattern->GetItem(ATTR_BACKGROUND).GetColor(); CPPUNIT_ASSERT_EQUAL_MESSAGE("background color should be green", Color(COL_LIGHTGREEN), aColor); pPattern = pDoc->GetPattern(2,0,1); - SvxCellHorJustify eHorJustify = static_cast<const SvxHorJustifyItem&>(pPattern->GetItem(ATTR_HOR_JUSTIFY)).GetValue(); + SvxCellHorJustify eHorJustify = pPattern->GetItem(ATTR_HOR_JUSTIFY).GetValue(); CPPUNIT_ASSERT_EQUAL_MESSAGE("cell content should be aligned centre horizontally", SvxCellHorJustify::Center, eHorJustify); //test alignment pPattern = pDoc->GetPattern(2,1,1); - eHorJustify = static_cast<const SvxHorJustifyItem&>(pPattern->GetItem(ATTR_HOR_JUSTIFY)).GetValue(); + eHorJustify = pPattern->GetItem(ATTR_HOR_JUSTIFY).GetValue(); CPPUNIT_ASSERT_EQUAL_MESSAGE("cell content should be aligned right horizontally", SvxCellHorJustify::Right, eHorJustify); pPattern = pDoc->GetPattern(2,2,1); - eHorJustify = static_cast<const SvxHorJustifyItem&>(pPattern->GetItem(ATTR_HOR_JUSTIFY)).GetValue(); + eHorJustify = pPattern->GetItem(ATTR_HOR_JUSTIFY).GetValue(); CPPUNIT_ASSERT_EQUAL_MESSAGE("cell content should be aligned block horizontally", SvxCellHorJustify::Block, eHorJustify); //test Sheet3 only for ods and xlsx @@ -264,7 +264,7 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat) // check actual align applied to cell, should be the same as // the style - eHorJustify = static_cast< const SvxHorJustifyItem& >(pPattern->GetItem( ATTR_HOR_JUSTIFY ) ).GetValue(); + eHorJustify = pPattern->GetItem( ATTR_HOR_JUSTIFY ).GetValue(); CPPUNIT_ASSERT_EQUAL_MESSAGE("cell with 'Excel Built-in Date' style should be aligned centre horizontally", SvxCellHorJustify::Center, eHorJustify); } } diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 6843f9f37fba..9f3bc88ba9f3 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -1836,8 +1836,7 @@ void ScFiltersTest::testRichTextContentODS() CPPUNIT_ASSERT_EQUAL(OUString("All bold"), rDoc.GetString(aPos.Col(), aPos.Row(), aPos.Tab())); const ScPatternAttr* pAttr = rDoc.GetPattern(aPos.Col(), aPos.Row(), aPos.Tab()); CPPUNIT_ASSERT_MESSAGE("Failed to get cell attribute.", pAttr); - const SvxWeightItem& rWeightItem = - static_cast<const SvxWeightItem&>(pAttr->GetItem(ATTR_FONT_WEIGHT)); + const SvxWeightItem& rWeightItem = pAttr->GetItem(ATTR_FONT_WEIGHT); CPPUNIT_ASSERT_EQUAL(WEIGHT_BOLD, rWeightItem.GetWeight()); } @@ -2802,13 +2801,13 @@ void ScFiltersTest::testColumnStyleXLSX() const ScPatternAttr* pPattern = rDoc.GetPattern(0,0,0); CPPUNIT_ASSERT(pPattern); - const ScProtectionAttr& rAttr = static_cast<const ScProtectionAttr&>(pPattern->GetItem(ATTR_PROTECTION)); + const ScProtectionAttr& rAttr = pPattern->GetItem(ATTR_PROTECTION); CPPUNIT_ASSERT(rAttr.GetProtection()); pPattern = rDoc.GetPattern(0,1,0); CPPUNIT_ASSERT(pPattern); - const ScProtectionAttr& rAttrNew = static_cast<const ScProtectionAttr&>(pPattern->GetItem(ATTR_PROTECTION)); + const ScProtectionAttr& rAttrNew = pPattern->GetItem(ATTR_PROTECTION); CPPUNIT_ASSERT(!rAttrNew.GetProtection()); xDocSh->DoClose(); @@ -2823,7 +2822,7 @@ void ScFiltersTest::testColumnStyleAutoFilterXLSX() const ScPatternAttr* pPattern = rDoc.GetPattern(0, 10, 18); CPPUNIT_ASSERT(pPattern); - const ScMergeFlagAttr& rAttr = static_cast<const ScMergeFlagAttr&>(pPattern->GetItem(ATTR_MERGE_FLAG)); + const ScMergeFlagAttr& rAttr = pPattern->GetItem(ATTR_MERGE_FLAG); CPPUNIT_ASSERT(!rAttr.HasAutoFilter()); xDocSh->DoClose(); diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index 0025c6876986..ef4b11cdf09c 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -1045,7 +1045,7 @@ static void lcl_MergeToFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner bool bLeft, SCCOL nDistRight, bool bTop, SCROW nDistBottom ) { // right/bottom border set when connected together - const ScMergeAttr& rMerge = static_cast<const ScMergeAttr&>(pPattern->GetItem(ATTR_MERGE)); + const ScMergeAttr& rMerge = pPattern->GetItem(ATTR_MERGE); if ( rMerge.GetColMerge() == nDistRight + 1 ) nDistRight = 0; if ( rMerge.GetRowMerge() == nDistBottom + 1 ) @@ -1156,7 +1156,7 @@ bool ScAttrArray::ApplyFrame( const SvxBoxItem* pBoxItem, const SvxBoxItem* pOldFrame = &pPattern->GetItemSet().Get( ATTR_BORDER ); // right/bottom border set when connected together - const ScMergeAttr& rMerge = static_cast<const ScMergeAttr&>(pPattern->GetItem(ATTR_MERGE)); + const ScMergeAttr& rMerge = pPattern->GetItem(ATTR_MERGE); if ( rMerge.GetColMerge() == nDistRight + 1 ) nDistRight = 0; if ( rMerge.GetRowMerge() == nDistBottom + 1 ) @@ -1261,15 +1261,13 @@ bool ScAttrArray::HasAttrib_Impl(const ScPatternAttr* pPattern, HasAttrFlags nMa bool bFound = false; if ( nMask & HasAttrFlags::Merged ) { - const ScMergeAttr* pMerge = - static_cast<const ScMergeAttr*>( &pPattern->GetItem( ATTR_MERGE ) ); + const ScMergeAttr* pMerge = &pPattern->GetItem( ATTR_MERGE ); if ( pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1 ) bFound = true; } if ( nMask & ( HasAttrFlags::Overlapped | HasAttrFlags::NotOverlapped | HasAttrFlags::AutoFilter ) ) { - const ScMergeFlagAttr* pMergeFlag = - static_cast<const ScMergeFlagAttr*>( &pPattern->GetItem( ATTR_MERGE_FLAG ) ); + const ScMergeFlagAttr* pMergeFlag = &pPattern->GetItem( ATTR_MERGE_FLAG ); if ( (nMask & HasAttrFlags::Overlapped) && pMergeFlag->IsOverlapped() ) bFound = true; if ( (nMask & HasAttrFlags::NotOverlapped) && !pMergeFlag->IsOverlapped() ) @@ -1279,35 +1277,31 @@ bool ScAttrArray::HasAttrib_Impl(const ScPatternAttr* pPattern, HasAttrFlags nMa } if ( nMask & HasAttrFlags::Lines ) { - const SvxBoxItem* pBox = - static_cast<const SvxBoxItem*>( &pPattern->GetItem( ATTR_BORDER ) ); + const SvxBoxItem* pBox = &pPattern->GetItem( ATTR_BORDER ); if ( pBox->GetLeft() || pBox->GetRight() || pBox->GetTop() || pBox->GetBottom() ) bFound = true; } if ( nMask & HasAttrFlags::Shadow ) { - const SvxShadowItem* pShadow = - static_cast<const SvxShadowItem*>( &pPattern->GetItem( ATTR_SHADOW ) ); + const SvxShadowItem* pShadow = &pPattern->GetItem( ATTR_SHADOW ); if ( pShadow->GetLocation() != SvxShadowLocation::NONE ) bFound = true; } if ( nMask & HasAttrFlags::Conditional ) { - bool bContainsCondFormat = - !static_cast<const ScCondFormatItem&>(pPattern->GetItem( ATTR_CONDITIONAL )).GetCondFormatData().empty(); + bool bContainsCondFormat = pPattern->GetItem( ATTR_CONDITIONAL ).GetCondFormatData().empty(); if ( bContainsCondFormat ) bFound = true; } if ( nMask & HasAttrFlags::Protected ) { - const ScProtectionAttr* pProtect = - static_cast<const ScProtectionAttr*>( &pPattern->GetItem( ATTR_PROTECTION ) ); + const ScProtectionAttr* pProtect = &pPattern->GetItem( ATTR_PROTECTION ); bool bFoundTemp = false; if ( pProtect->GetProtection() || pProtect->GetHideCell() ) bFoundTemp = true; bool bContainsCondFormat = !mvData.empty() && - !static_cast<const ScCondFormatItem&>(pPattern->GetItem( ATTR_CONDITIONAL )).GetCondFormatData().empty(); + !pPattern->GetItem( ATTR_CONDITIONAL ).GetCondFormatData().empty(); if ( bContainsCondFormat && nCol != -1 ) // pDocument->GetCondResult() is valid only for real columns. { SCROW nRowStartCond = std::max<SCROW>( nRow1, i ? mvData[i-1].nEndRow + 1: 0 ); @@ -1343,8 +1337,7 @@ bool ScAttrArray::HasAttrib_Impl(const ScPatternAttr* pPattern, HasAttrFlags nMa } if ( nMask & HasAttrFlags::Rotate ) { - const SfxInt32Item* pRotate = - static_cast<const SfxInt32Item*>( &pPattern->GetItem( ATTR_ROTATE_VALUE ) ); + const SfxInt32Item* pRotate = &pPattern->GetItem( ATTR_ROTATE_VALUE ); // 90 or 270 degrees is former SvxOrientationItem - only look for other values // (see ScPatternAttr::GetCellOrientation) sal_Int32 nAngle = pRotate->GetValue(); @@ -1355,21 +1348,19 @@ bool ScAttrArray::HasAttrib_Impl(const ScPatternAttr* pPattern, HasAttrFlags nMa { if (pPattern->GetCellOrientation() != SvxCellOrientation::Standard) bFound = true; - else if (static_cast<const SfxBoolItem&>(pPattern->GetItem( ATTR_LINEBREAK )).GetValue()) + else if (pPattern->GetItem( ATTR_LINEBREAK ).GetValue()) bFound = true; - else if (static_cast<const SvxHorJustifyItem&>(pPattern-> - GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SvxCellHorJustify::Block) + else if (pPattern->GetItem( ATTR_HOR_JUSTIFY ).GetValue() == SvxCellHorJustify::Block) bFound = true; - else if (!static_cast<const ScCondFormatItem&>(pPattern->GetItem(ATTR_CONDITIONAL)).GetCondFormatData().empty()) + else if (!pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData().empty()) bFound = true; - else if (static_cast<const SfxInt32Item&>(pPattern->GetItem( ATTR_ROTATE_VALUE )).GetValue()) + else if (pPattern->GetItem( ATTR_ROTATE_VALUE ).GetValue()) bFound = true; } if ( nMask & ( HasAttrFlags::ShadowRight | HasAttrFlags::ShadowDown ) ) { - const SvxShadowItem* pShadow = - static_cast<const SvxShadowItem*>( &pPattern->GetItem( ATTR_SHADOW )); + const SvxShadowItem* pShadow = &pPattern->GetItem( ATTR_SHADOW ); SvxShadowLocation eLoc = pShadow->GetLocation(); if ( nMask & HasAttrFlags::ShadowRight ) if ( eLoc == SvxShadowLocation::TopRight || eLoc == SvxShadowLocation::BottomRight ) @@ -1381,8 +1372,7 @@ bool ScAttrArray::HasAttrib_Impl(const ScPatternAttr* pPattern, HasAttrFlags nMa if ( nMask & HasAttrFlags::RightOrCenter ) { // called only if the sheet is LTR, so physical=logical alignment can be assumed - SvxCellHorJustify eHorJust = - static_cast<const SvxHorJustifyItem&>( pPattern->GetItem( ATTR_HOR_JUSTIFY )).GetValue(); + SvxCellHorJustify eHorJust = pPattern->GetItem( ATTR_HOR_JUSTIFY ).GetValue(); if ( eHorJust == SvxCellHorJustify::Right || eHorJust == SvxCellHorJustify::Center ) bFound = true; } @@ -1422,13 +1412,12 @@ bool ScAttrArray::IsMerged( SCROW nRow ) const { SCSIZE nIndex; Search(nRow, nIndex); - const ScMergeAttr& rItem = - static_cast<const ScMergeAttr&>(mvData[nIndex].pPattern->GetItem(ATTR_MERGE)); + const ScMergeAttr& rItem = mvData[nIndex].pPattern->GetItem(ATTR_MERGE); return rItem.IsMerged(); } - return static_cast<const ScMergeAttr&>(pDocument->GetDefPattern()->GetItem(ATTR_MERGE)).IsMerged(); + return pDocument->GetDefPattern()->GetItem(ATTR_MERGE).IsMerged(); } /** @@ -1451,7 +1440,7 @@ bool ScAttrArray::ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow, for (SCSIZE i=nStartIndex; i<=nEndIndex; i++) { pPattern = mvData[i].pPattern; - pItem = static_cast<const ScMergeAttr*>( &pPattern->GetItem( ATTR_MERGE ) ); + pItem = &pPattern->GetItem( ATTR_MERGE ); SCCOL nCountX = pItem->GetColMerge(); SCROW nCountY = pItem->GetRowMerge(); if (nCountX>1 || nCountY>1) @@ -1507,7 +1496,7 @@ void ScAttrArray::RemoveAreaMerge(SCROW nStartRow, SCROW nEndRow) nThisEnd = nEndRow; pPattern = mvData[nIndex].pPattern; - pItem = static_cast<const ScMergeAttr*>( &pPattern->GetItem( ATTR_MERGE ) ); + pItem = &pPattern->GetItem( ATTR_MERGE ); SCCOL nCountX = pItem->GetColMerge(); SCROW nCountY = pItem->GetRowMerge(); if (nCountX>1 || nCountY>1) @@ -1565,7 +1554,7 @@ void ScAttrArray::SetPatternAreaSafe( SCROW nStartRow, SCROW nEndRow, if (nThisRow < nStartRow) nThisRow = nStartRow; nRow = mvData[nIndex].nEndRow; SCROW nAttrRow = std::min( nRow, nEndRow ); - pItem = static_cast<const ScMergeFlagAttr*>( &pOldPattern->GetItem( ATTR_MERGE_FLAG ) ); + pItem = &pOldPattern->GetItem( ATTR_MERGE_FLAG ); if (pItem->IsOverlapped() || pItem->HasAutoFilter()) { @@ -1617,7 +1606,7 @@ bool ScAttrArray::ApplyFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags ) while ( nThisRow <= nEndRow ) { pOldPattern = mvData[nIndex].pPattern; - nOldValue = static_cast<const ScMergeFlagAttr*>( &pOldPattern->GetItem( ATTR_MERGE_FLAG ))->GetValue(); + nOldValue = pOldPattern->GetItem( ATTR_MERGE_FLAG ).GetValue(); if ( (nOldValue | nFlags) != nOldValue ) { nRow = mvData[nIndex].nEndRow; @@ -1654,7 +1643,7 @@ bool ScAttrArray::RemoveFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags ) while ( nThisRow <= nEndRow ) { pOldPattern = mvData[nIndex].pPattern; - nOldValue = static_cast<const ScMergeFlagAttr*>(&pOldPattern->GetItem( ATTR_MERGE_FLAG ))->GetValue(); + nOldValue = pOldPattern->GetItem( ATTR_MERGE_FLAG ).GetValue(); if ( (nOldValue & ~nFlags) != nOldValue ) { nRow = mvData[nIndex].nEndRow; @@ -1780,8 +1769,8 @@ SCROW ScAttrArray::GetNextUnprotected( SCROW nRow, bool bUp ) const SCSIZE nIndex; Search(nRow, nIndex); - while (static_cast<const ScProtectionAttr&>(mvData[nIndex].pPattern-> - GetItem(ATTR_PROTECTION)).GetProtection()) + while (mvData[nIndex].pPattern-> + GetItem(ATTR_PROTECTION).GetProtection()) { if (bUp) { @@ -2172,8 +2161,8 @@ bool ScAttrArray::TestInsertCol( SCROW nStartRow, SCROW nEndRow) const for ( ; nIndex < mvData.size(); nIndex++ ) { - if ( static_cast<const ScMergeFlagAttr&>(mvData[nIndex].pPattern-> - GetItem(ATTR_MERGE_FLAG)).IsHorOverlapped() ) + if ( mvData[nIndex].pPattern-> + GetItem(ATTR_MERGE_FLAG).IsHorOverlapped() ) { bTest = false; // may not be pushed out break; @@ -2192,15 +2181,15 @@ bool ScAttrArray::TestInsertRow( SCSIZE nSize ) const // MAXROW + 1 - nSize = 1st row pushed out if ( mvData.empty() ) - return !static_cast<const ScMergeFlagAttr&>(pDocument->GetDefPattern()-> - GetItem(ATTR_MERGE_FLAG)).IsVerOverlapped(); + return !pDocument->GetDefPattern()-> + GetItem(ATTR_MERGE_FLAG).IsVerOverlapped(); SCSIZE nFirstLost = mvData.size()-1; while ( nFirstLost && mvData[nFirstLost-1].nEndRow >= sal::static_int_cast<SCROW>(MAXROW + 1 - nSize) ) --nFirstLost; - return !static_cast<const ScMergeFlagAttr&>(mvData[nFirstLost].pPattern-> - GetItem(ATTR_MERGE_FLAG)).IsVerOverlapped(); + return !mvData[nFirstLost].pPattern-> + GetItem(ATTR_MERGE_FLAG).IsVerOverlapped(); } void ScAttrArray::InsertRow( SCROW nStartRow, SCSIZE nSize ) @@ -2213,7 +2202,7 @@ void ScAttrArray::InsertRow( SCROW nStartRow, SCSIZE nSize ) // set ScMergeAttr may not be extended (so behind delete again) - bool bDoMerge = static_cast<const ScMergeAttr&>( mvData[nIndex].pPattern->GetItem(ATTR_MERGE)).IsMerged(); + bool bDoMerge = mvData[nIndex].pPattern->GetItem(ATTR_MERGE).IsMerged(); assert( !bDoMerge || nCol != -1 ); @@ -2424,8 +2413,7 @@ void ScAttrArray::CopyArea( std::unique_ptr<ScPatternAttr> pTmpPattern(new ScPatternAttr( *pOldPattern )); ScMF nNewFlags = ScMF::NONE; if ( nStripFlags != ScMF::All ) - nNewFlags = static_cast<const ScMergeFlagAttr&>(pTmpPattern->GetItem(ATTR_MERGE_FLAG)). - GetValue() & ~nStripFlags; + nNewFlags = pTmpPattern->GetItem(ATTR_MERGE_FLAG).GetValue() & ~nStripFlags; if ( nNewFlags != ScMF::NONE ) pTmpPattern->GetItemSet().Put( ScMergeFlagAttr( nNewFlags ) ); diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 505bbf4230d5..ff507715af12 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1765,7 +1765,7 @@ void ScColumn::CopyScenarioFrom( const ScColumn& rSrcCol ) const ScPatternAttr* pPattern = aAttrIter.Next( nStart, nEnd ); while (pPattern) { - if ( static_cast<const ScMergeFlagAttr&>(pPattern->GetItem( ATTR_MERGE_FLAG )).IsScenario() ) + if ( pPattern->GetItem( ATTR_MERGE_FLAG ).IsScenario() ) { DeleteArea( nStart, nEnd, InsertDeleteFlags::CONTENTS ); sc::CopyToDocContext aCxt(*pDocument); @@ -1793,7 +1793,7 @@ void ScColumn::CopyScenarioTo( ScColumn& rDestCol ) const const ScPatternAttr* pPattern = aAttrIter.Next( nStart, nEnd ); while (pPattern) { - if ( static_cast<const ScMergeFlagAttr&>(pPattern->GetItem( ATTR_MERGE_FLAG )).IsScenario() ) + if ( pPattern->GetItem( ATTR_MERGE_FLAG ).IsScenario() ) { rDestCol.DeleteArea( nStart, nEnd, InsertDeleteFlags::CONTENTS ); sc::CopyToDocContext aCxt(*rDestCol.pDocument); @@ -1818,7 +1818,7 @@ bool ScColumn::TestCopyScenarioTo( const ScColumn& rDestCol ) const const ScPatternAttr* pPattern = aAttrIter.Next( nStart, nEnd ); while (pPattern && bOk) { - if ( static_cast<const ScMergeFlagAttr&>(pPattern->GetItem( ATTR_MERGE_FLAG )).IsScenario() ) + if ( pPattern->GetItem( ATTR_MERGE_FLAG ).IsScenario() ) if ( rDestCol.pAttrArray->HasAttrib( nStart, nEnd, HasAttrFlags::Protected ) ) bOk = false; @@ -1836,7 +1836,7 @@ void ScColumn::MarkScenarioIn( ScMarkData& rDestMark ) const const ScPatternAttr* pPattern = aAttrIter.Next( nStart, nEnd ); while (pPattern) { - if ( static_cast<const ScMergeFlagAttr&>(pPattern->GetItem( ATTR_MERGE_FLAG )).IsScenario() ) + if ( pPattern->GetItem( ATTR_MERGE_FLAG ).IsScenario() ) { aRange.aStart.SetRow( nStart ); aRange.aEnd.SetRow( nEnd ); diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index fea8d080dd13..0f0d8dee6347 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -110,8 +110,8 @@ long ScColumn::GetNeededSize( // merged? // Do not merge in conditional formatting - const ScMergeAttr* pMerge = static_cast<const ScMergeAttr*>(&pPattern->GetItem(ATTR_MERGE)); - const ScMergeFlagAttr* pFlag = static_cast<const ScMergeFlagAttr*>(&pPattern->GetItem(ATTR_MERGE_FLAG)); + const ScMergeAttr* pMerge = &pPattern->GetItem(ATTR_MERGE); + const ScMergeFlagAttr* pFlag = &pPattern->GetItem(ATTR_MERGE_FLAG); if ( bWidth ) { @@ -146,8 +146,7 @@ long ScColumn::GetNeededSize( pCondSet->GetItemState(ATTR_HOR_JUSTIFY, true, &pCondItem) == SfxItemState::SET) eHorJust = static_cast<const SvxHorJustifyItem*>(pCondItem)->GetValue(); else - eHorJust = static_cast<const SvxHorJustifyItem&>( - pPattern->GetItem( ATTR_HOR_JUSTIFY )).GetValue(); + eHorJust = pPattern->GetItem( ATTR_HOR_JUSTIFY ).GetValue(); bool bBreak; if ( eHorJust == SvxCellHorJustify::Block ) bBreak = true; @@ -155,7 +154,7 @@ long ScColumn::GetNeededSize( pCondSet->GetItemState(ATTR_LINEBREAK, true, &pCondItem) == SfxItemState::SET) bBreak = static_cast<const SfxBoolItem*>(pCondItem)->GetValue(); else - bBreak = static_cast<const SfxBoolItem&>(pPattern->GetItem(ATTR_LINEBREAK)).GetValue(); + bBreak = pPattern->GetItem(ATTR_LINEBREAK).GetValue(); SvNumberFormatter* pFormatter = pDocument->GetFormatTable(); sal_uLong nFormat = pPattern->GetNumberFormat( pFormatter, pCondSet ); @@ -192,7 +191,7 @@ long ScColumn::GetNeededSize( SvxCellOrientation eOrient = pPattern->GetCellOrientation( pCondSet ); bool bAsianVertical = ( eOrient == SvxCellOrientation::Stacked && - static_cast<const SfxBoolItem&>(pPattern->GetItem( ATTR_VERTICAL_ASIAN, pCondSet )).GetValue() ); + pPattern->GetItem( ATTR_VERTICAL_ASIAN, pCondSet ).GetValue() ); if ( bAsianVertical ) bBreak = false; @@ -207,15 +206,14 @@ long ScColumn::GetNeededSize( pCondSet->GetItemState(ATTR_ROTATE_VALUE, true, &pCondItem) == SfxItemState::SET) nRotate = static_cast<const SfxInt32Item*>(pCondItem)->GetValue(); else - nRotate =static_cast<const SfxInt32Item&>(pPattern->GetItem(ATTR_ROTATE_VALUE)).GetValue(); + nRotate = pPattern->GetItem(ATTR_ROTATE_VALUE).GetValue(); if ( nRotate ) { if (pCondSet && pCondSet->GetItemState(ATTR_ROTATE_MODE, true, &pCondItem) == SfxItemState::SET) eRotMode = static_cast<const SvxRotateModeItem*>(pCondItem)->GetValue(); else - eRotMode = static_cast<const SvxRotateModeItem&>( - pPattern->GetItem(ATTR_ROTATE_MODE)).GetValue(); + eRotMode = pPattern->GetItem(ATTR_ROTATE_MODE).GetValue(); if ( nRotate == 18000 ) eRotMode = SVX_ROTATE_MODE_STANDARD; // no overflow @@ -235,7 +233,7 @@ long ScColumn::GetNeededSize( pCondSet->GetItemState(ATTR_MARGIN, true, &pCondItem) == SfxItemState::SET) pMargin = static_cast<const SvxMarginItem*>(pCondItem); else - pMargin = static_cast<const SvxMarginItem*>(&pPattern->GetItem(ATTR_MARGIN)); + pMargin = &pPattern->GetItem(ATTR_MARGIN); sal_uInt16 nIndent = 0; if ( eHorJust == SvxCellHorJustify::Left ) { @@ -243,7 +241,7 @@ long ScColumn::GetNeededSize( pCondSet->GetItemState(ATTR_INDENT, true, &pCondItem) == SfxItemState::SET) nIndent = static_cast<const SfxUInt16Item*>(pCondItem)->GetValue(); else - nIndent = static_cast<const SfxUInt16Item&>(pPattern->GetItem(ATTR_INDENT)).GetValue(); + nIndent = pPattern->GetItem(ATTR_INDENT).GetValue(); } SvtScriptType nScript = pDocument->GetScriptType(nCol, nRow, nTab); @@ -562,7 +560,7 @@ long ScColumn::GetNeededSize( // 20 * nZoom/100 // Conditional formatting is not interesting here - ScMF nFlags = static_cast<const ScMergeFlagAttr&>(pPattern->GetItem(ATTR_MERGE_FLAG)).GetValue(); + ScMF nFlags = pPattern->GetItem(ATTR_MERGE_FLAG).GetValue(); if (nFlags & ScMF::Auto) nValue += long(rZoomX*20); } @@ -657,7 +655,7 @@ sal_uInt16 ScColumn::GetOptimalColWidth( // font color doesn't matter here pPattern->GetFont( aFont, SC_AUTOCOL_BLACK, pDev, &rZoomX ); pDev->SetFont( aFont ); - const SvxMarginItem* pMargin = static_cast<const SvxMarginItem*>(&pPattern->GetItem(ATTR_MARGIN)); + const SvxMarginItem* pMargin = &pPattern->GetItem(ATTR_MARGIN); long nMargin = (long) ( pMargin->GetLeftMargin() * nPPTX ) + (long) ( pMargin->GetRightMargin() * nPPTX ); @@ -757,16 +755,14 @@ static sal_uInt16 lcl_GetAttribHeight( const ScPatternAttr& rPattern, sal_uInt16 sal_uInt16 nHeight = rFontHeight.GetHeight(); nHeight *= 1.18; - if ( static_cast<const SvxEmphasisMarkItem&>(rPattern. - GetItem(ATTR_FONT_EMPHASISMARK)).GetEmphasisMark() != FontEmphasisMark::NONE ) + if ( rPattern.GetItem(ATTR_FONT_EMPHASISMARK).GetEmphasisMark() != FontEmphasisMark::NONE ) { // add height for emphasis marks //TODO: font metrics should be used instead nHeight += nHeight / 4; } - const SvxMarginItem& rMargin = - static_cast<const SvxMarginItem&>(rPattern.GetItem(ATTR_MARGIN)); + const SvxMarginItem& rMargin = rPattern.GetItem(ATTR_MARGIN); nHeight += rMargin.GetTopMargin() + rMargin.GetBottomMargin(); @@ -799,8 +795,8 @@ void ScColumn::GetOptimalHeight( const ScPatternAttr* pPattern = aIter.Next(nStart,nEnd); while ( pPattern ) { - const ScMergeAttr* pMerge = static_cast<const ScMergeAttr*>(&pPattern->GetItem(ATTR_MERGE)); - const ScMergeFlagAttr* pFlag = static_cast<const ScMergeFlagAttr*>(&pPattern->GetItem(ATTR_MERGE_FLAG)); + const ScMergeAttr* pMerge = &pPattern->GetItem(ATTR_MERGE); + const ScMergeFlagAttr* pFlag = &pPattern->GetItem(ATTR_MERGE_FLAG); if ( pMerge->GetRowMerge() > 1 || pFlag->IsOverlapped() ) { // do nothing - vertically with merged and overlapping, @@ -813,23 +809,20 @@ void ScColumn::GetOptimalHeight( bool bStdOnly = false; if (bStdAllowed) { - bool bBreak = static_cast<const SfxBoolItem&>(pPattern->GetItem(ATTR_LINEBREAK)).GetValue() || - (static_cast<const SvxHorJustifyItem&>(pPattern-> - GetItem( ATTR_HOR_JUSTIFY )).GetValue() == + bool bBreak = pPattern->GetItem(ATTR_LINEBREAK).GetValue() || + (pPattern->GetItem( ATTR_HOR_JUSTIFY ).GetValue() == SvxCellHorJustify::Block); bStdOnly = !bBreak; // conditional formatting: loop all cells if (bStdOnly && - !static_cast<const ScCondFormatItem&>(pPattern->GetItem( - ATTR_CONDITIONAL)).GetCondFormatData().empty()) + !pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData().empty()) { bStdOnly = false; } // rotated text: loop all cells - if ( bStdOnly && static_cast<const SfxInt32Item&>(pPattern-> - GetItem(ATTR_ROTATE_VALUE)).GetValue() ) + if ( bStdOnly && pPattern->GetItem(ATTR_ROTATE_VALUE).GetValue() ) bStdOnly = false; } diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 7a4672978a68..2aebf53e90e0 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -522,7 +522,7 @@ bool ScColumn::UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, const sc:: if (pCFList) { const ScCondFormatItem& rItem = - static_cast<const ScCondFormatItem&>(pPattern->GetItem(ATTR_CONDITIONAL)); + pPattern->GetItem(ATTR_CONDITIONAL); const std::vector<sal_uInt32>& rData = rItem.GetCondFormatData(); pCondSet = pDocument->GetCondResult(aCell, aPos, *pCFList, rData); } @@ -2437,7 +2437,7 @@ void ScColumn::RemoveProtected( SCROW nStartRow, SCROW nEndRow ) const ScPatternAttr* pPattern = aAttrIter.Next( nTop, nBottom ); while (pPattern) { - const ScProtectionAttr* pAttr = static_cast<const ScProtectionAttr*>(&pPattern->GetItem(ATTR_PROTECTION)); + const ScProtectionAttr* pAttr = &pPattern->GetItem(ATTR_PROTECTION); if ( pAttr->GetHideCell() ) DeleteArea( nTop, nBottom, InsertDeleteFlags::CONTENTS ); else if ( pAttr->GetHideFormula() ) diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index 711223d314e8..59b338568acd 100644 --- a/sc/source/core/data/column4.cxx +++ b/sc/source/core/data/column4.cxx @@ -773,7 +773,7 @@ void ScColumn::GetUnprotectedCells( SCROW nStartRow, SCROW nEndRow, ScRangeList& { SCROW nTmpStartRow = nStartRow, nTmpEndRow = nEndRow; const ScPatternAttr* pPattern = pAttrArray->GetPatternRange(nTmpStartRow, nTmpEndRow, nStartRow); - bool bProtection = static_cast<const ScProtectionAttr&>(pPattern->GetItem(ATTR_PROTECTION)).GetProtection(); + bool bProtection = pPattern->GetItem(ATTR_PROTECTION).GetProtection(); if (!bProtection) { // Limit the span to the range in question. @@ -787,7 +787,7 @@ void ScColumn::GetUnprotectedCells( SCROW nStartRow, SCROW nEndRow, ScRangeList& { nStartRow = nTmpEndRow + 1; pPattern = pAttrArray->GetPatternRange(nTmpStartRow, nTmpEndRow, nStartRow); - bool bTmpProtection = static_cast<const ScProtectionAttr&>(pPattern->GetItem(ATTR_PROTECTION)).GetProtection(); + bool bTmpProtection = pPattern->GetItem(ATTR_PROTECTION).GetProtection(); if (!bTmpProtection) { // Limit the span to the range in question. @@ -1011,8 +1011,7 @@ private: if (mpCFList) { maPos.SetRow(nRow); - const ScCondFormatItem& rItem = - static_cast<const ScCondFormatItem&>(pPat->GetItem(ATTR_CONDITIONAL)); + const ScCondFormatItem& rItem = pPat->GetItem(ATTR_CONDITIONAL); const std::vector<sal_uInt32>& rData = rItem.GetCondFormatData(); pCondSet = mrCol.GetDoc().GetCondResult(rCell, maPos, *mpCFList, rData); } diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index cc1a3017e2b4..4f13528d7581 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -775,7 +775,7 @@ const SfxPoolItem* ScDocument::GetEffItem( const SfxPoolItem* pItem; if ( rSet.GetItemState( ATTR_CONDITIONAL, true, &pItem ) == SfxItemState::SET ) { - const std::vector<sal_uInt32>& rIndex = static_cast<const ScCondFormatItem&>(pPattern->GetItem(ATTR_CONDITIONAL)).GetCondFormatData(); + const std::vector<sal_uInt32>& rIndex = pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData(); ScConditionalFormatList* pCondFormList = GetCondFormList( nTab ); if (!rIndex.empty() && pCondFormList) { @@ -816,7 +816,7 @@ const SfxItemSet* ScDocument::GetCondResult( SCCOL nCol, SCROW nRow, SCTAB nTab ScRefCellValue aCell(const_cast<ScDocument&>(*this), aPos); const ScPatternAttr* pPattern = GetPattern( nCol, nRow, nTab ); const std::vector<sal_uInt32>& rIndex = - static_cast<const ScCondFormatItem&>(pPattern->GetItem(ATTR_CONDITIONAL)).GetCondFormatData(); + pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData(); return GetCondResult(aCell, aPos, *pFormatList, rIndex); } diff --git a/sc/source/core/data/documen6.cxx b/sc/source/core/data/documen6.cxx index 9ee7516499fe..a2504d594bd7 100644 --- a/sc/source/core/data/documen6.cxx +++ b/sc/source/core/data/documen6.cxx @@ -140,7 +140,7 @@ SvtScriptType ScDocument::GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab ) const ScPatternAttr* pPattern = GetPattern( nCol, nRow, nTab ); if (!pPattern) return SvtScriptType::NONE; const SfxItemSet* pCondSet = nullptr; - if ( !static_cast<const ScCondFormatItem&>(pPattern->GetItem(ATTR_CONDITIONAL)).GetCondFormatData().empty() ) + if ( !pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData().empty() ) pCondSet = GetCondResult( nCol, nRow, nTab ); sal_uLong nFormat = pPattern->GetNumberFormat( mxPoolHelper->GetFormTable(), pCondSet ); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index e651ce6be9fd..3fb8c338f242 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -5461,11 +5461,9 @@ void ScDocument::ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow, bool bHorOverlapped; if ( pAttrArray->Count() ) - bHorOverlapped = static_cast<const ScMergeFlagAttr&>(pAttrArray->mvData[nIndex].pPattern-> - GetItem(ATTR_MERGE_FLAG)).IsHorOverlapped(); + bHorOverlapped = pAttrArray->mvData[nIndex].pPattern->GetItem(ATTR_MERGE_FLAG).IsHorOverlapped(); else - bHorOverlapped = static_cast<const ScMergeFlagAttr&>(GetDefPattern()-> - GetItem(ATTR_MERGE_FLAG)).IsHorOverlapped(); + bHorOverlapped = GetDefPattern()->GetItem(ATTR_MERGE_FLAG).IsHorOverlapped(); if ( bHorOverlapped ) { SCROW nEndRowSeg = (pAttrArray->Count()) ? pAttrArray->mvData[nIndex].nEndRow : MAXROW; diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index b62ffe43a6df..7829b6007544 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -107,8 +107,8 @@ static void lcl_GetMergeRange( SCCOL nX, SCROW nY, SCSIZE nArrY, !pDoc->RowHidden(rStartY, nTab, nullptr, &nLastRow) && pRowInfo[nArrY].nRowNo == rStartY) { - pMerge = static_cast<const ScMergeAttr*>( &pRowInfo[nArrY].pCellInfo[rStartX+1].pPatternAttr-> - GetItem(ATTR_MERGE)); + pMerge = &pRowInfo[nArrY].pCellInfo[rStartX+1].pPatternAttr-> + GetItem(ATTR_MERGE); } else pMerge = static_cast<const ScMergeAttr*>( pDoc->GetAttr(rStartX,rStartY,nTab,ATTR_MERGE) ); @@ -500,23 +500,17 @@ void ScDocument::FillInfo( pPattern = GetDefPattern(); } - const SvxBrushItem* pBackground = static_cast<const SvxBrushItem*>( - &pPattern->GetItem(ATTR_BACKGROUND)); - const SvxBoxItem* pLinesAttr = static_cast<const SvxBoxItem*>( - &pPattern->GetItem(ATTR_BORDER)); + const SvxBrushItem* pBackground = &pPattern->GetItem(ATTR_BACKGROUND); + const SvxBoxItem* pLinesAttr = &pPattern->GetItem(ATTR_BORDER); - const SvxLineItem* pTLBRLine = static_cast< const SvxLineItem* >( - &pPattern->GetItem( ATTR_BORDER_TLBR ) ); - const SvxLineItem* pBLTRLine = static_cast< const SvxLineItem* >( - &pPattern->GetItem( ATTR_BORDER_BLTR ) ); + const SvxLineItem* pTLBRLine = &pPattern->GetItem( ATTR_BORDER_TLBR ); + const SvxLineItem* pBLTRLine = &pPattern->GetItem( ATTR_BORDER_BLTR ); - const SvxShadowItem* pShadowAttr = static_cast<const SvxShadowItem*>( - &pPattern->GetItem(ATTR_SHADOW)); + const SvxShadowItem* pShadowAttr = &pPattern->GetItem(ATTR_SHADOW); if (pShadowAttr != pDefShadow) bAnyShadow = true; - const ScMergeAttr* pMergeAttr = static_cast<const ScMergeAttr*>( - &pPattern->GetItem(ATTR_MERGE)); + const ScMergeAttr* pMergeAttr = &pPattern->GetItem(ATTR_MERGE); bool bMerged = ( pMergeAttr != pDefMerge && *pMergeAttr != *pDefMerge ); ScMF nOverlap = pPattern->GetItemSet(). Get(ATTR_MERGE_FLAG).GetValue(); @@ -533,15 +527,14 @@ void ScDocument::FillInfo( bool bHidden, bHideFormula; if (bTabProtect) { - const ScProtectionAttr& rProtAttr = static_cast<const ScProtectionAttr&>( - pPattern->GetItem(ATTR_PROTECTION)); + const ScProtectionAttr& rProtAttr = pPattern->GetItem(ATTR_PROTECTION); bHidden = rProtAttr.GetHideCell(); bHideFormula = rProtAttr.GetHideFormula(); } else bHidden = bHideFormula = false; - const std::vector<sal_uInt32>& rCondFormats = static_cast<const ScCondFormatItem&>(pPattern->GetItem(ATTR_CONDITIONAL)).GetCondFormatData(); + const std::vector<sal_uInt32>& rCondFormats = pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData(); bool bContainsCondFormat = !rCondFormats.empty(); do @@ -1056,9 +1049,9 @@ void ScDocument::FillInfo( if( const ScPatternAttr* pPattern = GetPattern( nFirstRealDocCol, nFirstRealDocRow, nTab ) ) { const SfxItemSet* pCond = GetCondResult( nFirstRealDocCol, nFirstRealDocRow, nTab ); - pBox = static_cast< const SvxBoxItem* >( &pPattern->GetItem( ATTR_BORDER, pCond ) ); - pTLBR = static_cast< const SvxLineItem* >( &pPattern->GetItem( ATTR_BORDER_TLBR, pCond ) ); - pBLTR = static_cast< const SvxLineItem* >( &pPattern->GetItem( ATTR_BORDER_BLTR, pCond ) ); + pBox = &pPattern->GetItem( ATTR_BORDER, pCond ); + pTLBR = &pPattern->GetItem( ATTR_BORDER_TLBR, pCond ); + pBLTR = &pPattern->GetItem( ATTR_BORDER_BLTR, pCond ); } else { diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 33d8dab7c8bc..5fa52755596b 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -529,7 +529,7 @@ void ScGlobal::InitTextHeight(const SfxItemPool* pPool) if (nTest > nDefFontHeight) nDefFontHeight = nTest; - const SvxMarginItem* pMargin = static_cast<const SvxMarginItem*>(&pPattern->GetItem(ATTR_MARGIN)); + const SvxMarginItem* pMargin = &pPattern->GetItem(ATTR_MARGIN); nTest = static_cast<sal_uInt16>( nDefFontHeight + pMargin->GetTopMargin() + pMargin->GetBottomMargin() - STD_ROWHEIGHT_DIFF); diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index 16877382a7e6..78dff05264a3 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -147,13 +147,13 @@ SvxCellOrientation ScPatternAttr::GetCellOrientation( const SfxItemSet& rItemSet { SvxCellOrientation eOrient = SvxCellOrientation::Standard; - if( static_cast<const SfxBoolItem&>(GetItem( ATTR_STACKED, rItemSet, pCondSet )).GetValue() ) + if( GetItem( ATTR_STACKED, rItemSet, pCondSet ).GetValue() ) { eOrient = SvxCellOrientation::Stacked; } else { - sal_Int32 nAngle = static_cast<const SfxInt32Item&>(GetItem( ATTR_ROTATE_VALUE, rItemSet, pCondSet )).GetValue(); + sal_Int32 nAngle = GetItem( ATTR_ROTATE_VALUE, rItemSet, pCondSet ).GetValue(); if( nAngle == 9000 ) eOrient = SvxCellOrientation::BottomUp; else if( nAngle == 27000 ) @@ -1297,11 +1297,11 @@ long ScPatternAttr::GetRotateVal( const SfxItemSet* pCondSet ) const long nAttrRotate = 0; if ( GetCellOrientation() == SvxCellOrientation::Standard ) { - bool bRepeat = ( static_cast<const SvxHorJustifyItem&>(GetItem(ATTR_HOR_JUSTIFY, pCondSet)). + bool bRepeat = ( GetItem(ATTR_HOR_JUSTIFY, pCondSet). GetValue() == SvxCellHorJustify::Repeat ); // ignore orientation/rotation if "repeat" is active if ( !bRepeat ) - nAttrRotate = static_cast<const SfxInt32Item&>(GetItem( ATTR_ROTATE_VALUE, pCondSet )).GetValue(); + nAttrRotate = GetItem( ATTR_ROTATE_VALUE, pCondSet ).GetValue(); } return nAttrRotate; } @@ -1313,8 +1313,7 @@ ScRotateDir ScPatternAttr::GetRotateDir( const SfxItemSet* pCondSet ) const long nAttrRotate = GetRotateVal( pCondSet ); if ( nAttrRotate ) { - SvxRotateMode eRotMode = static_cast<const SvxRotateModeItem&>( - GetItem(ATTR_ROTATE_MODE, pCondSet)).GetValue(); + SvxRotateMode eRotMode = GetItem(ATTR_ROTATE_MODE, pCondSet).GetValue(); if ( eRotMode == SVX_ROTATE_MODE_STANDARD || nAttrRotate == 18000 ) nRet = ScRotateDir::Standard; diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 0b23c7474e91..7b275495eb3b 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -1914,8 +1914,8 @@ void ScTable::MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, d const ScPatternAttr* pPattern = GetPattern( rCol, nRow ); const SfxItemSet* pCondSet = pDocument->GetCondResult( rCol, nRow, nTab ); - SvxCellHorJustify eHorJust = static_cast<const SvxHorJustifyItem&>( - pPattern->GetItem( ATTR_HOR_JUSTIFY, pCondSet )).GetValue(); + SvxCellHorJustify eHorJust = + pPattern->GetItem( ATTR_HOR_JUSTIFY, pCondSet ).GetValue(); if ( eHorJust == SvxCellHorJustify::Center ) nMissing /= 2; // distributed into both directions else diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 856eb1697698..0053e5f67f3c 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -2038,8 +2038,8 @@ SCSIZE ScTable::FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCO double nFactor = 0.0; if ( nCol > nX2+1 ) { - long nRotVal = static_cast<const SfxInt32Item&>( pPattern-> - GetItem( ATTR_ROTATE_VALUE, pCondSet )).GetValue(); + long nRotVal = pPattern-> + GetItem( ATTR_ROTATE_VALUE, pCondSet ).GetValue(); double nRealOrient = nRotVal * F_PI18000; // 1/100 degree double nCos = cos( nRealOrient ); double nSin = sin( nRealOrient ); diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 45927fe4de8f..846850300f5f 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -639,7 +639,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, pNewPattern = nullptr; } - const ScCondFormatItem& rCondFormatItem = static_cast<const ScCondFormatItem&>(pSrcPattern->GetItem(ATTR_CONDITIONAL)); + const ScCondFormatItem& rCondFormatItem = pSrcPattern->GetItem(ATTR_CONDITIONAL); const std::vector<sal_uInt32>& rCondFormatIndex = rCondFormatItem.GetCondFormatData(); if ( bVertical && nISrcStart == nISrcEnd && !bHasFiltered ) @@ -1623,7 +1623,7 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, { const ScPatternAttr* pSrcPattern = aCol[nCol].GetPattern(static_cast<SCROW>(nRow)); - const ScCondFormatItem& rCondFormatItem = static_cast<const ScCondFormatItem&>(pSrcPattern->GetItem(ATTR_CONDITIONAL)); + const ScCondFormatItem& rCondFormatItem = pSrcPattern->GetItem(ATTR_CONDITIONAL); const std::vector<sal_uInt32>& rCondFormatIndex = rCondFormatItem.GetCondFormatData(); if (bVertical) diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index c1f0f2483317..780e643ce79f 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -1293,7 +1293,7 @@ bool ScDetectiveFunc::MarkInvalid(bool& rOverflow) const ScPatternAttr* pPattern = aAttrIter.GetNext( nCol, nRow1, nRow2 ); while ( pPattern && nInsCount < SC_DET_MAXCIRCLE ) { - sal_uLong nIndex = static_cast<const SfxUInt32Item&>(pPattern->GetItem(ATTR_VALIDDATA)).GetValue(); + sal_uLong nIndex = pPattern->GetItem(ATTR_VALIDDATA).GetValue(); if (nIndex) { const ScValidationData* pData = pDoc->GetValidationEntry( nIndex ); diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index 92b20d328e4a..90c1ed626fe6 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -289,7 +289,7 @@ tools::Rectangle ScEditUtil::GetEditArea( const ScPatternAttr* pPattern, bool bF bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); long nLayoutSign = bLayoutRTL ? -1 : 1; - const ScMergeAttr* pMerge = static_cast<const ScMergeAttr*>(&pPattern->GetItem(ATTR_MERGE)); + const ScMergeAttr* pMerge = &pPattern->GetItem(ATTR_MERGE); long nCellX = (long) ( pDoc->GetColWidth(nCol,nTab) * nPPTX ); if ( pMerge->GetColMerge() > 1 ) { @@ -304,11 +304,11 @@ tools::Rectangle ScEditUtil::GetEditArea( const ScPatternAttr* pPattern, bool bF nCellY += (long) pDoc->GetScaledRowHeight( nRow+1, nRow+nCountY-1, nTab, nPPTY); } - const SvxMarginItem* pMargin = static_cast<const SvxMarginItem*>(&pPattern->GetItem(ATTR_MARGIN)); + const SvxMarginItem* pMargin = &pPattern->GetItem(ATTR_MARGIN); sal_uInt16 nIndent = 0; - if ( static_cast<const SvxHorJustifyItem&>(pPattern->GetItem(ATTR_HOR_JUSTIFY)).GetValue() == + if ( pPattern->GetItem(ATTR_HOR_JUSTIFY).GetValue() == SvxCellHorJustify::Left ) - nIndent = static_cast<const SfxUInt16Item&>(pPattern->GetItem(ATTR_INDENT)).GetValue(); + nIndent = pPattern->GetItem(ATTR_INDENT).GetValue(); long nPixDifX = (long) ( ( pMargin->GetLeftMargin() + nIndent ) * nPPTX ); aStartPos.X() += nPixDifX * nLayoutSign; nCellX -= nPixDifX + (long) ( pMargin->GetRightMargin() * nPPTX ); // due to line feed, etc. @@ -317,12 +317,11 @@ tools::Rectangle ScEditUtil::GetEditArea( const ScPatternAttr* pPattern, bool bF long nPixDifY; long nTopMargin = (long) ( pMargin->GetTopMargin() * nPPTY ); - SvxCellVerJustify eJust = static_cast<const SvxVerJustifyItem&>(pPattern-> - GetItem(ATTR_VER_JUSTIFY)).GetValue(); + SvxCellVerJustify eJust = pPattern->GetItem(ATTR_VER_JUSTIFY).GetValue(); // asian vertical is always edited top-aligned - bool bAsianVertical = static_cast<const SfxBoolItem&>(pPattern->GetItem( ATTR_STACKED )).GetValue() && - static_cast<const SfxBoolItem&>(pPattern->GetItem( ATTR_VERTICAL_ASIAN )).GetValue(); + bool bAsianVertical = pPattern->GetItem( ATTR_STACKED ).GetValue() && + pPattern->GetItem( ATTR_VERTICAL_ASIAN ).GetValue(); if ( eJust == SvxCellVerJustify::Top || ( bForceToTop && ( SC_MOD()->GetInputOptions().GetTextWysiwyg() || bAsianVertical ) ) ) diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 9fac42814541..fc17e7be64e1 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -8979,8 +8979,7 @@ void ScInterpreter::ScText() const ScPatternAttr* pPattern = pDok->GetPattern( aPos.Col(), aPos.Row(), aPos.Tab() ); if ( pPattern ) - eCellLang = static_cast<const SvxLanguageItem&>( - pPattern->GetItem( ATTR_LANGUAGE_FORMAT )).GetValue(); + eCellLang = pPattern->GetItem( ATTR_LANGUAGE_FORMAT ).GetValue(); else eCellLang = ScGlobal::eLnge; if (bString) diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 853868ec7894..0668e766f6d8 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -842,7 +842,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab ) const ScPatternAttr* pAttr = pDoc->GetPattern( nCol, nRow, nTab ); const SfxItemSet* pCondItemSet = pDoc->GetCondResult( nCol, nRow, nTab ); - const ScMergeFlagAttr& rMergeFlagAttr = static_cast<const ScMergeFlagAttr&>( pAttr->GetItem( ATTR_MERGE_FLAG, pCondItemSet ) ); + const ScMergeFlagAttr& rMergeFlagAttr = pAttr->GetItem( ATTR_MERGE_FLAG, pCondItemSet ); if ( rMergeFlagAttr.IsOverlapped() ) return ; @@ -903,7 +903,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab ) const sal_Char* pChar; sal_uInt16 nHeightPixel; - const ScMergeAttr& rMergeAttr = static_cast<const ScMergeAttr&>( pAttr->GetItem( ATTR_MERGE, pCondItemSet ) ); + const ScMergeAttr& rMergeAttr = pAttr->GetItem( ATTR_MERGE, pCondItemSet ); if ( pGraphEntry || rMergeAttr.IsMerged() ) { SCCOL nC, jC; @@ -965,23 +965,23 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab ) pAttr->GetItem( ScGlobal::GetScriptedWhichID( nScriptType, ATTR_FONT_POSTURE), pCondItemSet) ); - const SvxUnderlineItem& rUnderlineItem = static_cast<const SvxUnderlineItem&>( - pAttr->GetItem( ATTR_FONT_UNDERLINE, pCondItemSet ) ); + const SvxUnderlineItem& rUnderlineItem = + pAttr->GetItem( ATTR_FONT_UNDERLINE, pCondItemSet ); - const SvxCrossedOutItem& rCrossedOutItem = static_cast<const SvxCrossedOutItem&>( - pAttr->GetItem( ATTR_FONT_CROSSEDOUT, pCondItemSet ) ); + const SvxCrossedOutItem& rCrossedOutItem = + pAttr->GetItem( ATTR_FONT_CROSSEDOUT, pCondItemSet ); - const SvxColorItem& rColorItem = static_cast<const SvxColorItem&>( pAttr->GetItem( - ATTR_FONT_COLOR, pCondItemSet ) ); + const SvxColorItem& rColorItem = pAttr->GetItem( + ATTR_FONT_COLOR, pCondItemSet ); - const SvxHorJustifyItem& rHorJustifyItem = static_cast<const SvxHorJustifyItem&>( - pAttr->GetItem( ATTR_HOR_JUSTIFY, pCondItemSet ) ); + const SvxHorJustifyItem& rHorJustifyItem = + pAttr->GetItem( ATTR_HOR_JUSTIFY, pCondItemSet ); - const SvxVerJustifyItem& rVerJustifyItem = static_cast<const SvxVerJustifyItem&>( - pAttr->GetItem( ATTR_VER_JUSTIFY, pCondItemSet ) ); + const SvxVerJustifyItem& rVerJustifyItem = + pAttr->GetItem( ATTR_VER_JUSTIFY, pCondItemSet ); - const SvxBrushItem& rBrushItem = static_cast<const SvxBrushItem&>( pAttr->GetItem( - ATTR_BACKGROUND, pCondItemSet ) ); + const SvxBrushItem& rBrushItem = pAttr->GetItem( + ATTR_BACKGROUND, pCondItemSet ); Color aBgColor; if ( rBrushItem.GetColor().GetTransparency() == 255 ) diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx index a20d29eabdec..ffb06e8ebc65 100644 --- a/sc/source/filter/rtf/rtfexp.cxx +++ b/sc/source/filter/rtf/rtfexp.cxx @@ -107,8 +107,8 @@ void ScRTFExport::WriteRow( SCTAB nTab, SCROW nRow ) for ( nCol = aRange.aStart.Col(); nCol <= nEndCol; nCol++ ) { const ScPatternAttr* pAttr = pDoc->GetPattern( nCol, nRow, nTab ); - const ScMergeAttr& rMergeAttr = static_cast<const ScMergeAttr&>( pAttr->GetItem( ATTR_MERGE )); - const SvxVerJustifyItem& rVerJustifyItem= static_cast<const SvxVerJustifyItem&>(pAttr->GetItem( ATTR_VER_JUSTIFY )); + const ScMergeAttr& rMergeAttr = pAttr->GetItem( ATTR_MERGE ); + const SvxVerJustifyItem& rVerJustifyItem= pAttr->GetItem( ATTR_VER_JUSTIFY ); const sal_Char* pChar; @@ -116,7 +116,7 @@ void ScRTFExport::WriteRow( SCTAB nTab, SCROW nRow ) rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_CLMGF ); else { - const ScMergeFlagAttr& rMergeFlagAttr = static_cast<const ScMergeFlagAttr&>( pAttr->GetItem( ATTR_MERGE_FLAG ) ); + const ScMergeFlagAttr& rMergeFlagAttr = pAttr->GetItem( ATTR_MERGE_FLAG ); if ( rMergeFlagAttr.IsHorOverlapped() ) rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_CLMRG ); } @@ -155,7 +155,7 @@ void ScRTFExport::WriteCell( SCTAB nTab, SCROW nRow, SCCOL nCol ) { const ScPatternAttr* pAttr = pDoc->GetPattern( nCol, nRow, nTab ); - const ScMergeFlagAttr& rMergeFlagAttr = static_cast<const ScMergeFlagAttr&>( pAttr->GetItem( ATTR_MERGE_FLAG ) ); + const ScMergeFlagAttr& rMergeFlagAttr = pAttr->GetItem( ATTR_MERGE_FLAG ); if ( rMergeFlagAttr.IsHorOverlapped() ) { rStrm.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_CELL ); @@ -191,10 +191,10 @@ void ScRTFExport::WriteCell( SCTAB nTab, SCROW nRow, SCCOL nCol ) bool bResetAttr(false); - const SvxHorJustifyItem& rHorJustifyItem = static_cast<const SvxHorJustifyItem&>(pAttr->GetItem( ATTR_HOR_JUSTIFY )); - const SvxWeightItem& rWeightItem = static_cast<const SvxWeightItem&>( pAttr->GetItem( ATTR_FONT_WEIGHT )); - const SvxPostureItem& rPostureItem = static_cast<const SvxPostureItem&>( pAttr->GetItem( ATTR_FONT_POSTURE )); - const SvxUnderlineItem& rUnderlineItem = static_cast<const SvxUnderlineItem&>( pAttr->GetItem( ATTR_FONT_UNDERLINE )); + const SvxHorJustifyItem& rHorJustifyItem = pAttr->GetItem( ATTR_HOR_JUSTIFY ); + const SvxWeightItem& rWeightItem = pAttr->GetItem( ATTR_FONT_WEIGHT ); + const SvxPostureItem& rPostureItem = pAttr->GetItem( ATTR_FONT_POSTURE ); + const SvxUnderlineItem& rUnderlineItem = pAttr->GetItem( ATTR_FONT_UNDERLINE ); const sal_Char* pChar; diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx index ac8419cd6252..fc8e2d537dc3 100644 --- a/sc/source/filter/xml/XMLExportDataPilot.cxx +++ b/sc/source/filter/xml/XMLExportDataPilot.cxx @@ -767,7 +767,7 @@ void ScXMLExportDataPilot::WriteDataPilots() const ScPatternAttr* pAttr = aAttrItr.GetNext(nCol, nRow1, nRow2); while (pAttr) { - const ScMergeFlagAttr& rItem = static_cast<const ScMergeFlagAttr&>(pAttr->GetItem(ATTR_MERGE_FLAG)); + const ScMergeFlagAttr& rItem = pAttr->GetItem(ATTR_MERGE_FLAG); if (rItem.HasPivotButton()) { for (SCROW nButtonRow = nRow1; nButtonRow <= nRow2; ++nButtonRow) diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index aa5fec4e1a86..94f3464c783f 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -793,7 +793,7 @@ void ScInputHandler::UpdateSpellSettings( bool bFromStartTab ) mpEditEngine->SetSpeller( xXSpellChecker1 ); } - bool bHyphen = pLastPattern && static_cast<const SfxBoolItem&>(pLastPattern->GetItem(ATTR_HYPHENATE)).GetValue(); + bool bHyphen = pLastPattern && pLastPattern->GetItem(ATTR_HYPHENATE).GetValue(); if ( bHyphen ) { css::uno::Reference<css::linguistic2::XHyphenator> xXHyphenator( LinguMgr::GetHyphenator() ); mpEditEngine->SetHyphenator( xXHyphenator ); @@ -1962,8 +1962,8 @@ void ScInputHandler::UpdateAdjust( sal_Unicode cTyped ) } bool bAsianVertical = pLastPattern && - static_cast<const SfxBoolItem&>(pLastPattern->GetItem( ATTR_STACKED )).GetValue() && - static_cast<const SfxBoolItem&>(pLastPattern->GetItem( ATTR_VERTICAL_ASIAN )).GetValue(); + pLastPattern->GetItem( ATTR_STACKED ).GetValue() && + pLastPattern->GetItem( ATTR_VERTICAL_ASIAN ).GetValue(); if ( bAsianVertical ) { // Always edit at top of cell -> LEFT when editing vertically @@ -2114,8 +2114,7 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn // Background color must be known for automatic font color. // For transparent cell background, the document background color must be used. - Color aBackCol = static_cast<const SvxBrushItem&>( - pPattern->GetItem( ATTR_BACKGROUND )).GetColor(); + Color aBackCol = pPattern->GetItem( ATTR_BACKGROUND ).GetColor(); ScModule* pScMod = SC_MOD(); if ( aBackCol.GetTransparency() > 0 || Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) @@ -2123,10 +2122,9 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn mpEditEngine->SetBackgroundColor( aBackCol ); // Adjustment - eAttrAdjust = static_cast<const SvxHorJustifyItem&>(pPattern-> - GetItem(ATTR_HOR_JUSTIFY)).GetValue(); + eAttrAdjust = pPattern->GetItem(ATTR_HOR_JUSTIFY).GetValue(); if ( eAttrAdjust == SvxCellHorJustify::Repeat && - static_cast<const SfxBoolItem&>(pPattern->GetItem(ATTR_LINEBREAK)).GetValue() ) + pPattern->GetItem(ATTR_LINEBREAK).GetValue() ) { // #i31843# "repeat" with "line breaks" is treated as default alignment eAttrAdjust = SvxCellHorJustify::Standard; diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index e7f25c4c8a48..cd8b38ce0850 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -1868,8 +1868,8 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, const ScMergeFlagAttr* pMergeFlagAttr = nullptr; while ( ( pPattern = aTestIter.GetNext( nTestCol, nTestRow1, nTestRow2 ) ) != nullptr ) { - const ScMergeAttr* pMergeFlag = static_cast<const ScMergeAttr*>( &pPattern->GetItem(ATTR_MERGE) ); - pMergeFlagAttr = static_cast<const ScMergeFlagAttr*>( &pPattern->GetItem(ATTR_MERGE_FLAG) ); + const ScMergeAttr* pMergeFlag = &pPattern->GetItem(ATTR_MERGE); + pMergeFlagAttr = &pPattern->GetItem(ATTR_MERGE_FLAG); ScMF nNewFlags = pMergeFlagAttr->GetValue() & ( ScMF::Hor | ScMF::Ver ); if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == ScMF::Hor || nNewFlags == ScMF::Ver ) { @@ -2346,8 +2346,8 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, const ScMergeFlagAttr* pMergeFlagAttr = nullptr; while ( ( pPattern = aTestIter.GetNext( nTestCol, nTestRow1, nTestRow2 ) ) != nullptr ) { - const ScMergeAttr* pMergeFlag = static_cast<const ScMergeAttr*>( &pPattern->GetItem( ATTR_MERGE ) ); - pMergeFlagAttr = static_cast<const ScMergeFlagAttr*>( &pPattern->GetItem( ATTR_MERGE_FLAG ) ); + const ScMergeAttr* pMergeFlag = &pPattern->GetItem( ATTR_MERGE ); + pMergeFlagAttr = &pPattern->GetItem( ATTR_MERGE_FLAG ); ScMF nNewFlags = pMergeFlagAttr->GetValue() & ( ScMF::Hor | ScMF::Ver ); if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == ScMF::Hor || nNewFlags == ScMF::Ver ) { diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index a44dc4ae781d..9ef72684da1c 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -2073,12 +2073,12 @@ uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const OUString& aPropert { if (pEntry->nWID == SC_WID_UNO_TBLBORD2) ScHelperFunctions::AssignTableBorder2ToAny( aAny, - static_cast<const SvxBoxItem&>(pPattern->GetItem(ATTR_BORDER)), - static_cast<const SvxBoxInfoItem&>(pPattern->GetItem(ATTR_BORDER_INNER)) ); + pPattern->GetItem(ATTR_BORDER), + pPattern->GetItem(ATTR_BORDER_INNER) ); else ScHelperFunctions::AssignTableBorderToAny( aAny, - static_cast<const SvxBoxItem&>(pPattern->GetItem(ATTR_BORDER)), - static_cast<const SvxBoxInfoItem&>(pPattern->GetItem(ATTR_BORDER_INNER)) ); + pPattern->GetItem(ATTR_BORDER), + pPattern->GetItem(ATTR_BORDER_INNER) ); } } break; @@ -2566,8 +2566,8 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE formula::FormulaGrammar::Grammar eGrammar = (bXML ? rDoc.GetStorageGrammar() : formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML)); - const std::vector<sal_uInt32>& rIndex = static_cast<const ScCondFormatItem&>( - pPattern->GetItem(ATTR_CONDITIONAL)).GetCondFormatData(); + const std::vector<sal_uInt32>& rIndex = + pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData(); sal_uLong nIndex = 0; if(!rIndex.empty()) nIndex = rIndex[0]; @@ -2589,8 +2589,8 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE formula::FormulaGrammar::Grammar eGrammar = (bXML ? rDoc.GetStorageGrammar() : formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML)); - sal_uLong nIndex = static_cast<const SfxUInt32Item&>( - pPattern->GetItem(ATTR_VALIDDATA)).GetValue(); + sal_uLong nIndex = + pPattern->GetItem(ATTR_VALIDDATA).GetValue(); rAny <<= uno::Reference<beans::XPropertySet>( new ScTableValidationObj( &rDoc, nIndex, eGrammar )); } diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index ded46a83bde3..79e3441cc492 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2009,7 +2009,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) const ScConditionalFormat* pCondFormat = nullptr; const ScPatternAttr* pPattern = pDoc->GetPattern(aPos.Col(), aPos.Row(), aPos.Tab()); - const std::vector<sal_uInt32>& rCondFormats = static_cast<const ScCondFormatItem&>(pPattern->GetItem(ATTR_CONDITIONAL)).GetCondFormatData(); + const std::vector<sal_uInt32>& rCondFormats = pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData(); bool bContainsCondFormat = !rCondFormats.empty(); bool bCondFormatDlg = false; if(bContainsCondFormat) diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 26c5033fec39..005a1c7a5174 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -1489,9 +1489,7 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq ) } else { - SvxUnderlineItem aUnderline( static_cast<const SvxUnderlineItem&>( - pAttrs->GetItem( - ATTR_FONT_UNDERLINE ) ) ); + SvxUnderlineItem aUnderline( pAttrs->GetItem( ATTR_FONT_UNDERLINE ) ); eUnderline = (LINESTYLE_NONE != aUnderline.GetLineStyle()) ? LINESTYLE_NONE : LINESTYLE_SINGLE; @@ -1509,8 +1507,7 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq ) case SID_ULINE_VAL_DOUBLE: case SID_ULINE_VAL_DOTTED: { - FontLineStyle eOld = static_cast<const SvxUnderlineItem&>( - pAttrs->GetItem(ATTR_FONT_UNDERLINE)).GetLineStyle(); + FontLineStyle eOld = pAttrs->GetItem(ATTR_FONT_UNDERLINE).GetLineStyle(); FontLineStyle eNew = eOld; switch (nSlot) { @@ -1694,8 +1691,8 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) case SID_BACKGROUND_COLOR: { - SvxBrushItem aBrushItem( static_cast<const SvxBrushItem&>( - pTabViewShell->GetSelectionPattern()->GetItem( ATTR_BACKGROUND ) ) ); + SvxBrushItem aBrushItem( + pTabViewShell->GetSelectionPattern()->GetItem( ATTR_BACKGROUND ) ); aBrushItem.SetColor( COL_TRANSPARENT ); pTabViewShell->ApplyAttr( aBrushItem, false ); } @@ -1704,7 +1701,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) case SID_ATTR_ALIGN_LINEBREAK: // without parameter as toggle { const ScPatternAttr* pAttrs = pTabViewShell->GetSelectionPattern(); - bool bOld = static_cast<const SfxBoolItem&>(pAttrs->GetItem(ATTR_LINEBREAK)).GetValue(); + bool bOld = pAttrs->GetItem(ATTR_LINEBREAK).GetValue(); SfxBoolItem aBreakItem( ATTR_LINEBREAK, !bOld ); pTabViewShell->ApplyAttr( aBreakItem ); @@ -1719,10 +1716,10 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) case SID_SCATTR_CELLPROTECTION: // without parameter as toggle { const ScPatternAttr* pAttrs = pTabViewShell->GetSelectionPattern(); - bool bProtect = static_cast<const ScProtectionAttr&>(pAttrs->GetItem(ATTR_PROTECTION)).GetProtection(); - bool bHideFormula = static_cast<const ScProtectionAttr&>(pAttrs->GetItem(ATTR_PROTECTION)).GetHideFormula(); - bool bHideCell = static_cast<const ScProtectionAttr&>(pAttrs->GetItem(ATTR_PROTECTION)).GetHideCell(); - bool bHidePrint = static_cast<const ScProtectionAttr&>(pAttrs->GetItem(ATTR_PROTECTION)).GetHidePrint(); + bool bProtect = pAttrs->GetItem(ATTR_PROTECTION).GetProtection(); + bool bHideFormula = pAttrs->GetItem(ATTR_PROTECTION).GetHideFormula(); + bool bHideCell = pAttrs->GetItem(ATTR_PROTECTION).GetHideCell(); + bool bHidePrint = pAttrs->GetItem(ATTR_PROTECTION).GetHidePrint(); ScProtectionAttr aProtectionItem( !bProtect, bHideFormula, bHideCell, bHidePrint ); pTabViewShell->ApplyAttr( aProtectionItem ); @@ -1972,9 +1969,9 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) const SvxColorItem rNewColorItem = static_cast<const SvxColorItem&>( pNewAttrs->Get( SID_BACKGROUND_COLOR ) ); - SvxBrushItem aBrushItem( static_cast<const SvxBrushItem&>( + SvxBrushItem aBrushItem( pTabViewShell->GetSelectionPattern()-> - GetItem( ATTR_BACKGROUND ) ) ); + GetItem( ATTR_BACKGROUND ) ); aBrushItem.SetColor( rNewColorItem.GetValue() ); @@ -1984,9 +1981,8 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) case SID_ATTR_BRUSH: { - SvxBrushItem aBrushItem( static_cast<const SvxBrushItem&>( - pTabViewShell->GetSelectionPattern()-> - GetItem( ATTR_BACKGROUND ) ) ); + SvxBrushItem aBrushItem( pTabViewShell->GetSelectionPattern()-> + GetItem( ATTR_BACKGROUND ) ); const SvxBrushItem& rNewBrushItem = static_cast<const SvxBrushItem&>( pNewAttrs->Get( GetPool().GetWhich(nSlot) ) ); aBrushItem.SetColor(rNewBrushItem.GetColor()); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 3bc7ccbb9685..3db50f96447b 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -387,9 +387,9 @@ static bool lcl_GetHyperlinkCell( else { const ScPatternAttr* pPattern = pDoc->GetPattern(aPos); - if ( !static_cast<const SfxStringItem&>(pPattern->GetItem(ATTR_HYPERLINK)).GetValue().isEmpty() ) + if ( !pPattern->GetItem(ATTR_HYPERLINK).GetValue().isEmpty() ) { - rURL = static_cast<const SfxStringItem&>(pPattern->GetItem(ATTR_HYPERLINK)).GetValue(); + rURL = pPattern->GetItem(ATTR_HYPERLINK).GetValue(); bFound = true; } else if (rCell.meType == CELLTYPE_EDIT) @@ -4982,7 +4982,7 @@ namespace { SvxAdjust toSvxAdjust( const ScPatternAttr& rPat ) { SvxCellHorJustify eHorJust = - static_cast<const SvxHorJustifyItem&>(rPat.GetItem(ATTR_HOR_JUSTIFY)).GetValue(); + rPat.GetItem(ATTR_HOR_JUSTIFY).GetValue(); SvxAdjust eSvxAdjust = SvxAdjust::Left; switch (eHorJust) @@ -5081,11 +5081,9 @@ bool ScGridWindow::GetEditUrl( const Point& rPos, if (pPattern->GetCellOrientation() != SvxCellOrientation::Standard) return false; - bool bBreak = static_cast<const SfxBoolItem&>(pPattern->GetItem(ATTR_LINEBREAK)).GetValue() || - (static_cast<const SvxHorJustifyItem&>(pPattern-> - GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SvxCellHorJustify::Block); - SvxCellHorJustify eHorJust = static_cast<const SvxHorJustifyItem&>(pPattern-> - GetItem(ATTR_HOR_JUSTIFY)).GetValue(); + bool bBreak = pPattern->GetItem(ATTR_LINEBREAK).GetValue() || + (pPattern->GetItem( ATTR_HOR_JUSTIFY ).GetValue() == SvxCellHorJustify::Block); + SvxCellHorJustify eHorJust = pPattern->GetItem(ATTR_HOR_JUSTIFY).GetValue(); // EditEngine @@ -5394,8 +5392,7 @@ bool ScGridWindow::ContinueOnlineSpelling() // NB: For spell-checking, we currently only use the primary // language; not CJK nor CTL. const ScPatternAttr* pPattern = pDoc->GetPattern(nCol, nRow, nTab); - LanguageType nCellLang = - static_cast<const SvxLanguageItem&>(pPattern->GetItem(ATTR_FONT_LANGUAGE)).GetValue(); + LanguageType nCellLang = pPattern->GetItem(ATTR_FONT_LANGUAGE).GetValue(); if (nCellLang == LANGUAGE_SYSTEM) nCellLang = Application::GetSettings().GetLanguageTag().getLanguageType(); // never use SYSTEM for spelling @@ -5788,7 +5785,7 @@ void ScGridWindow::UpdateCursorOverlay() // fdo#87382 Also display the cell cursor for the visible part of // merged cells if the view position is part of merged cells. - const ScMergeAttr& rMerge = static_cast<const ScMergeAttr&>(pPattern->GetItem(ATTR_MERGE)); + const ScMergeAttr& rMerge = pPattern->GetItem(ATTR_MERGE); if (rMerge.GetColMerge() <= 1 && rMerge.GetRowMerge() <= 1) return; // not merged and invisible @@ -5800,7 +5797,7 @@ void ScGridWindow::UpdateCursorOverlay() } // don't show the cursor in overlapped cells - const ScMergeFlagAttr& rMergeFlag = static_cast<const ScMergeFlagAttr&>( pPattern->GetItem(ATTR_MERGE_FLAG) ); + const ScMergeFlagAttr& rMergeFlag = pPattern->GetItem(ATTR_MERGE_FLAG); bool bOverlapped = rMergeFlag.IsOverlapped(); // left or above of the screen? @@ -5809,7 +5806,7 @@ void ScGridWindow::UpdateCursorOverlay() { SCCOL nEndX = nX; SCROW nEndY = nY; - const ScMergeAttr& rMerge = static_cast<const ScMergeAttr&>( pPattern->GetItem(ATTR_MERGE) ); + const ScMergeAttr& rMerge = pPattern->GetItem(ATTR_MERGE); if (rMerge.GetColMerge() > 1) nEndX += rMerge.GetColMerge()-1; if (rMerge.GetRowMerge() > 1) diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index db4bd9f5345b..a25a62d3f81d 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1885,8 +1885,7 @@ void ScGridWindow::GetSelectionRects( ::std::vector< tools::Rectangle >& rPixelR SCROW nThisY = nY; const ScPatternAttr* pPattern = pDoc->GetPattern( nX, nY, nTab ); - const ScMergeFlagAttr* pMergeFlag = static_cast<const ScMergeFlagAttr*>( &pPattern-> - GetItem(ATTR_MERGE_FLAG) ); + const ScMergeFlagAttr* pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG); if ( pMergeFlag->IsVerOverlapped() && ( bDoHidden || bFirstRow ) ) { while ( pMergeFlag->IsVerOverlapped() && nThisY > 0 && @@ -1894,7 +1893,7 @@ void ScGridWindow::GetSelectionRects( ::std::vector< tools::Rectangle >& rPixelR { --nThisY; pPattern = pDoc->GetPattern( nX, nThisY, nTab ); - pMergeFlag = static_cast<const ScMergeFlagAttr*>( &pPattern->GetItem(ATTR_MERGE_FLAG) ); + pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG); } } @@ -1906,7 +1905,7 @@ void ScGridWindow::GetSelectionRects( ::std::vector< tools::Rectangle >& rPixelR { --nThisX; pPattern = pDoc->GetPattern( nThisX, nThisY, nTab ); - pMergeFlag = static_cast<const ScMergeFlagAttr*>( &pPattern->GetItem(ATTR_MERGE_FLAG) ); + pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG); } } @@ -1914,7 +1913,7 @@ void ScGridWindow::GetSelectionRects( ::std::vector< tools::Rectangle >& rPixelR { if ( !pMergeFlag->IsOverlapped() ) { - const ScMergeAttr* pMerge = static_cast<const ScMergeAttr*>(&pPattern->GetItem(ATTR_MERGE)); + const ScMergeAttr* pMerge = &pPattern->GetItem(ATTR_MERGE); if (pMerge->GetColMerge() > 0 || pMerge->GetRowMerge() > 0) { Point aEndPos = pViewData->GetScrPos( diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 4c3e0d432a91..6cfa4c2861b1 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -656,7 +656,7 @@ void ScOutputData::SetCellRotations() // add rotation info to Array information const long nAttrRotate(pPattern->GetRotateVal(pCondSet)); - const SvxRotateMode eRotMode(static_cast<const SvxRotateModeItem&>(pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet)).GetValue()); + const SvxRotateMode eRotMode(pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet).GetValue()); const double fOrient((bLayoutRTL ? -1.0 : 1.0) * nAttrRotate * F_PI18000); // 1/100th degrees -> [0..2PI] svx::frame::Array& rArray = mrTabInfo.maArray; @@ -678,8 +678,8 @@ static ScRotateDir lcl_GetRotateDir( const ScDocument* pDoc, SCCOL nCol, SCROW n long nAttrRotate = pPattern->GetRotateVal( pCondSet ); if ( nAttrRotate ) { - SvxRotateMode eRotMode = static_cast<const SvxRotateModeItem&>( - pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet)).GetValue(); + SvxRotateMode eRotMode = + pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet).GetValue(); if ( eRotMode == SVX_ROTATE_MODE_STANDARD ) nRet = ScRotateDir::Standard; @@ -705,8 +705,8 @@ static const SvxBrushItem* lcl_FindBackground( const ScDocument* pDoc, SCCOL nCo { const ScPatternAttr* pPattern = pDoc->GetPattern( nCol, nRow, nTab ); const SfxItemSet* pCondSet = pDoc->GetCondResult( nCol, nRow, nTab ); - const SvxBrushItem* pBackground = static_cast<const SvxBrushItem*>( - &pPattern->GetItem( ATTR_BACKGROUND, pCondSet )); + const SvxBrushItem* pBackground = + &pPattern->GetItem( ATTR_BACKGROUND, pCondSet ); ScRotateDir nDir = lcl_GetRotateDir( pDoc, nCol, nRow, nTab ); @@ -720,7 +720,7 @@ static const SvxBrushItem* lcl_FindBackground( const ScDocument* pDoc, SCCOL nCo --nCol; pPattern = pDoc->GetPattern( nCol, nRow, nTab ); pCondSet = pDoc->GetCondResult( nCol, nRow, nTab ); - pBackground = static_cast<const SvxBrushItem*>(&pPattern->GetItem( ATTR_BACKGROUND, pCondSet )); + pBackground = &pPattern->GetItem( ATTR_BACKGROUND, pCondSet ); } } else if ( nDir == ScRotateDir::Left ) @@ -732,7 +732,7 @@ static const SvxBrushItem* lcl_FindBackground( const ScDocument* pDoc, SCCOL nCo ++nCol; pPattern = pDoc->GetPattern( nCol, nRow, nTab ); pCondSet = pDoc->GetCondResult( nCol, nRow, nTab ); - pBackground = static_cast<const SvxBrushItem*>(&pPattern->GetItem( ATTR_BACKGROUND, pCondSet )); + pBackground = &pPattern->GetItem( ATTR_BACKGROUND, pCondSet ); } } @@ -1080,8 +1080,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext) const ScPatternAttr* pP = pInfo->pPatternAttr; if (pP) { - const ScProtectionAttr& rProt = static_cast<const ScProtectionAttr&>( - pP->GetItem(ATTR_PROTECTION)); + const ScProtectionAttr& rProt = pP->GetItem(ATTR_PROTECTION); if (rProt.GetProtection() || rProt.GetHideCell()) pBackground = ScGlobal::GetProtectedBrushItem(); else @@ -1119,7 +1118,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext) if (pInfo->bMerged && pInfo->pPatternAttr) { const ScMergeAttr* pMerge = - static_cast<const ScMergeAttr*>(&pInfo->pPatternAttr->GetItem(ATTR_MERGE)); + &pInfo->pPatternAttr->GetItem(ATTR_MERGE); nMergedCols = std::max<SCCOL>(1, pMerge->GetColMerge()); } @@ -1551,8 +1550,8 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext) //! LastPattern etc. long nAttrRotate = pPattern->GetRotateVal( pCondSet ); - SvxRotateMode eRotMode = static_cast<const SvxRotateModeItem&>( - pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet)).GetValue(); + SvxRotateMode eRotMode = + pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet).GetValue(); if (nAttrRotate) { @@ -1616,8 +1615,7 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext) const SvxBrushItem* pBackground = pInfo->pBackground; if (!pBackground) - pBackground = static_cast<const SvxBrushItem*>(&pPattern->GetItem( - ATTR_BACKGROUND, pCondSet)); + pBackground = &pPattern->GetItem(ATTR_BACKGROUND, pCondSet); if (bCellContrast) { // high contrast for cell borders and backgrounds -> empty background @@ -2389,7 +2387,7 @@ void ScOutputData::DrawClipMarks() SCCOL nOverX = nX; SCROW nOverY = nY; const ScMergeAttr* pMerge = - static_cast<const ScMergeAttr*>(&pInfo->pPatternAttr->GetItem(ATTR_MERGE)); + &pInfo->pPatternAttr->GetItem(ATTR_MERGE); SCCOL nCountX = pMerge->GetColMerge(); for (SCCOL i=1; i<nCountX; i++) nOutWidth += (long) ( mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX ); diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index c6918b04640f..e05b619c4ec2 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -25,9 +25,14 @@ #include <editeng/brushitem.hxx> #include <svtools/colorcfg.hxx> #include <editeng/colritem.hxx> +#include <editeng/charreliefitem.hxx> +#include <editeng/crossedoutitem.hxx> +#include <editeng/contouritem.hxx> #include <editeng/editobj.hxx> #include <editeng/editstat.hxx> +#include <editeng/emphasismarkitem.hxx> #include <editeng/fhgtitem.hxx> +#include <editeng/forbiddenruleitem.hxx> #include <editeng/forbiddencharacterstable.hxx> #include <editeng/frmdiritem.hxx> #include <editeng/langitem.hxx> @@ -37,6 +42,10 @@ #include <editeng/udlnitem.hxx> #include <editeng/unolingu.hxx> #include <editeng/fontitem.hxx> +#include <editeng/postitem.hxx> +#include <editeng/shdditem.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/wrlmitem.hxx> #include <svl/zforlist.hxx> #include <svl/zformat.hxx> #include <vcl/svapp.hxx> @@ -323,9 +332,9 @@ void ScDrawStringsVars::SetPattern( // alignment - eAttrHorJust = static_cast<const SvxHorJustifyItem&>(pPattern->GetItem( ATTR_HOR_JUSTIFY, pCondSet )).GetValue(); + eAttrHorJust = pPattern->GetItem( ATTR_HOR_JUSTIFY, pCondSet ).GetValue(); - eAttrVerJust = static_cast<const SvxVerJustifyItem&>(pPattern->GetItem( ATTR_VER_JUSTIFY, pCondSet )).GetValue(); + eAttrVerJust = pPattern->GetItem( ATTR_VER_JUSTIFY, pCondSet ).GetValue(); if ( eAttrVerJust == SvxCellVerJustify::Standard ) eAttrVerJust = SvxCellVerJustify::Bottom; @@ -335,7 +344,7 @@ void ScDrawStringsVars::SetPattern( // line break - bLineBreak = static_cast<const SfxBoolItem&>(pPattern->GetItem( ATTR_LINEBREAK, pCondSet )).GetValue(); + bLineBreak = pPattern->GetItem( ATTR_LINEBREAK, pCondSet ).GetValue(); // handle "repeat" alignment @@ -355,7 +364,7 @@ void ScDrawStringsVars::SetPattern( { case SvxCellOrientation::Standard: nRot = 0; - bRotated = static_cast<const SfxInt32Item&>(pPattern->GetItem( ATTR_ROTATE_VALUE, pCondSet )).GetValue() != 0 && + bRotated = pPattern->GetItem( ATTR_ROTATE_VALUE, pCondSet ).GetValue() != 0 && !bRepeat; break; case SvxCellOrientation::Stacked: @@ -404,10 +413,10 @@ void ScDrawStringsVars::SetPattern( if ( bPixelToLogic ) nAscentPixel = pRefDevice->LogicToPixel( Size( 0, nAscentPixel ) ).Height(); - Color aULineColor( static_cast<const SvxUnderlineItem&>(pPattern->GetItem( ATTR_FONT_UNDERLINE, pCondSet )).GetColor() ); + Color aULineColor( pPattern->GetItem( ATTR_FONT_UNDERLINE, pCondSet ).GetColor() ); pDev->SetTextLineColor( aULineColor ); - Color aOLineColor( static_cast<const SvxOverlineItem&>(pPattern->GetItem( ATTR_FONT_OVERLINE, pCondSet )).GetColor() ); + Color aOLineColor( pPattern->GetItem( ATTR_FONT_OVERLINE, pCondSet ).GetColor() ); pDev->SetOverlineColor( aOLineColor ); // number format @@ -415,15 +424,15 @@ void ScDrawStringsVars::SetPattern( nValueFormat = pPattern->GetNumberFormat( pOutput->mpDoc->GetFormatTable(), pCondSet ); // margins - pMargin = static_cast<const SvxMarginItem*>(&pPattern->GetItem( ATTR_MARGIN, pCondSet )); + pMargin = &pPattern->GetItem( ATTR_MARGIN, pCondSet ); if ( eAttrHorJust == SvxCellHorJustify::Left || eAttrHorJust == SvxCellHorJustify::Right ) - nIndent = static_cast<const SfxUInt16Item&>(pPattern->GetItem( ATTR_INDENT, pCondSet )).GetValue(); + nIndent = pPattern->GetItem( ATTR_INDENT, pCondSet ).GetValue(); else nIndent = 0; // "Shrink to fit" - bShrink = static_cast<const SfxBoolItem&>(pPattern->GetItem( ATTR_SHRINKTOFIT, pCondSet )).GetValue(); + bShrink = pPattern->GetItem( ATTR_SHRINKTOFIT, pCondSet ).GetValue(); // at least the text size needs to be retrieved again //! differentiate and do not get the text again from the number format? @@ -460,16 +469,16 @@ void ScDrawStringsVars::SetPatternSimple( const ScPatternAttr* pNew, const SfxIt // margins - pMargin = static_cast<const SvxMarginItem*>(&pPattern->GetItem( ATTR_MARGIN, pCondSet )); + pMargin = &pPattern->GetItem( ATTR_MARGIN, pCondSet ); if ( eAttrHorJust == SvxCellHorJustify::Left ) - nIndent = static_cast<const SfxUInt16Item&>(pPattern->GetItem( ATTR_INDENT, pCondSet )).GetValue(); + nIndent = pPattern->GetItem( ATTR_INDENT, pCondSet ).GetValue(); else nIndent = 0; // "Shrink to fit" - bShrink = static_cast<const SfxBoolItem&>(pPattern->GetItem( ATTR_SHRINKTOFIT, pCondSet )).GetValue(); + bShrink = pPattern->GetItem( ATTR_SHRINKTOFIT, pCondSet ).GetValue(); } inline bool SameValue( const ScRefCellValue& rCell, const ScRefCellValue& rOldCell ) @@ -1125,8 +1134,8 @@ bool ScOutputData::IsAvailable( SCCOL nX, SCROW nY ) return false; const ScPatternAttr* pPattern = mpDoc->GetPattern( nX, nY, nTab ); - return !(static_cast<const ScMergeAttr&>(pPattern->GetItem(ATTR_MERGE)).IsMerged() || - static_cast<const ScMergeFlagAttr&>(pPattern->GetItem(ATTR_MERGE_FLAG)).IsOverlapped()); + return !(pPattern->GetItem(ATTR_MERGE).IsMerged() || + pPattern->GetItem(ATTR_MERGE_FLAG).IsOverlapped()); } // nX, nArrY: loop variables from DrawStrings / DrawEdit @@ -1193,7 +1202,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY } nCellPosY -= (long) mpDoc->GetScaledRowHeight( nCellY, nCompRow-1, nTab, mnPPTY ); - const ScMergeAttr* pMerge = static_cast<const ScMergeAttr*>(&rPattern.GetItem( ATTR_MERGE )); + const ScMergeAttr* pMerge = &rPattern.GetItem( ATTR_MERGE ); bool bMerged = pMerge->IsMerged(); long nMergeCols = pMerge->GetColMerge(); if ( nMergeCols == 0 ) @@ -1327,7 +1336,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY // (for automatic line break: only if not formatting for printer, as in ScColumn::GetNeededSize) if ( eType==OUTTYPE_WINDOW && - ( static_cast<const ScMergeFlagAttr&>(rPattern.GetItem(ATTR_MERGE_FLAG)).GetValue() & (ScMF::Auto|ScMF::Button|ScMF::ButtonPopup) ) && + ( rPattern.GetItem(ATTR_MERGE_FLAG).GetValue() & (ScMF::Auto|ScMF::Button|ScMF::ButtonPopup) ) && ( !bBreak || mpRefDevice == pFmtDevice ) ) { // filter drop-down width is now independent from row height @@ -1635,8 +1644,7 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co } if (aCell.hasNumeric() && - static_cast<const SfxBoolItem&>( - pPattern->GetItem(ATTR_LINEBREAK, pCondSet)).GetValue()) + pPattern->GetItem(ATTR_LINEBREAK, pCondSet).GetValue()) { // Disable line break when the cell content is numeric. aAltPatterns.push_back(o3tl::make_unique<ScPatternAttr>(*pPattern)); @@ -2429,7 +2437,7 @@ void ScOutputData::DrawEditParam::setPatternToEngine(bool bUseStyleColor) mbHyphenatorSet = true; } - Color aBackCol = static_cast<const SvxBrushItem&>(mpPattern->GetItem( ATTR_BACKGROUND, mpCondSet )).GetColor(); + Color aBackCol = mpPattern->GetItem( ATTR_BACKGROUND, mpCondSet ).GetColor(); if ( bUseStyleColor && ( aBackCol.GetTransparency() > 0 || bCellContrast ) ) aBackCol.SetColor( nConfBackColor ); mpEngine->SetBackgroundColor( aBackCol ); @@ -2437,8 +2445,7 @@ void ScOutputData::DrawEditParam::setPatternToEngine(bool bUseStyleColor) void ScOutputData::DrawEditParam::calcMargins(long& rTopM, long& rLeftM, long& rBottomM, long& rRightM, double nPPTX, double nPPTY) const { - const SvxMarginItem& rMargin = - static_cast<const SvxMarginItem&>(mpPattern->GetItem(ATTR_MARGIN, mpCondSet)); + const SvxMarginItem& rMargin = mpPattern->GetItem(ATTR_MARGIN, mpCondSet); sal_uInt16 nIndent = 0; if (meHorJustAttr == SvxCellHorJustify::Left || meHorJustAttr == SvxCellHorJustify::Right) @@ -2990,8 +2997,7 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam) if ( nEngineHeight >= aCellSize.Height() + aRefOne.Height() ) { - const ScMergeAttr* pMerge = - static_cast<const ScMergeAttr*>(&rParam.mpPattern->GetItem(ATTR_MERGE)); + const ScMergeAttr* pMerge = &rParam.mpPattern->GetItem(ATTR_MERGE); bool bMerged = pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1; // Don't clip for text height when printing rows with optimal height, @@ -3175,8 +3181,7 @@ bool ScOutputData::Clip( DrawEditParam& rParam, const Size& aCellSize, const Size& aRefOne = mpRefDevice->PixelToLogic(Size(1,1)); if ( nEngineHeight >= aCellSize.Height() + aRefOne.Height() ) { - const ScMergeAttr* pMerge = - static_cast<const ScMergeAttr*>(&rParam.mpPattern->GetItem(ATTR_MERGE)); + const ScMergeAttr* pMerge = &rParam.mpPattern->GetItem(ATTR_MERGE); const bool bMerged = pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1; // Don't clip for text height when printing rows with optimal height, @@ -3911,8 +3916,7 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam) if ( nEngineHeight >= aCellSize.Height() + aRefOne.Height() ) { - const ScMergeAttr* pMerge = - static_cast<const ScMergeAttr*>(&rParam.mpPattern->GetItem(ATTR_MERGE)); + const ScMergeAttr* pMerge = &rParam.mpPattern->GetItem(ATTR_MERGE); bool bMerged = pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1; // Don't clip for text height when printing rows with optimal height, @@ -4230,8 +4234,7 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam) if ( nEngineHeight >= aCellSize.Height() + aRefOne.Height() ) { - const ScMergeAttr* pMerge = - static_cast<const ScMergeAttr*>(&rParam.mpPattern->GetItem(ATTR_MERGE)); + const ScMergeAttr* pMerge = &rParam.mpPattern->GetItem(ATTR_MERGE); bool bMerged = pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1; // Don't clip for text height when printing rows with optimal height, @@ -4621,17 +4624,16 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) long nCellWidth = (long) pRowInfo[0].pCellInfo[nX+1].nWidth; - SvxCellHorJustify eHorJust = static_cast<const SvxHorJustifyItem&>( - pPattern->GetItem(ATTR_HOR_JUSTIFY, pCondSet)).GetValue(); + SvxCellHorJustify eHorJust = + pPattern->GetItem(ATTR_HOR_JUSTIFY, pCondSet).GetValue(); bool bBreak = ( eHorJust == SvxCellHorJustify::Block ) || - static_cast<const SfxBoolItem&>(pPattern->GetItem(ATTR_LINEBREAK, pCondSet)).GetValue(); + pPattern->GetItem(ATTR_LINEBREAK, pCondSet).GetValue(); bool bRepeat = ( eHorJust == SvxCellHorJustify::Repeat && !bBreak ); - bool bShrink = !bBreak && !bRepeat && static_cast<const SfxBoolItem&> - (pPattern->GetItem( ATTR_SHRINKTOFIT, pCondSet )).GetValue(); + bool bShrink = !bBreak && !bRepeat && + pPattern->GetItem( ATTR_SHRINKTOFIT, pCondSet ).GetValue(); SvxCellOrientation eOrient = pPattern->GetCellOrientation( pCondSet ); - const ScMergeAttr* pMerge = - static_cast<const ScMergeAttr*>(&pPattern->GetItem(ATTR_MERGE)); + const ScMergeAttr* pMerge = &pPattern->GetItem(ATTR_MERGE); bool bMerged = pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1; long nStartX = nPosX; @@ -4669,8 +4671,8 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) nOutHeight += (long) mpDoc->GetScaledRowHeight( nY+1, nY+nCountY-1, nTab, mnPPTY); } - SvxCellVerJustify eVerJust = static_cast<const SvxVerJustifyItem&>( - pPattern->GetItem(ATTR_VER_JUSTIFY, pCondSet)).GetValue(); + SvxCellVerJustify eVerJust = + pPattern->GetItem(ATTR_VER_JUSTIFY, pCondSet).GetValue(); // syntax mode is ignored here... @@ -4706,8 +4708,8 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) bHyphenatorSet = true; } - Color aBackCol = static_cast<const SvxBrushItem&>( - pPattern->GetItem( ATTR_BACKGROUND, pCondSet )).GetColor(); + Color aBackCol = + pPattern->GetItem( ATTR_BACKGROUND, pCondSet ).GetColor(); if ( mbUseStyleColor && ( aBackCol.GetTransparency() > 0 || bCellContrast ) ) aBackCol.SetColor( nConfBackColor ); pEngine->SetBackgroundColor( aBackCol ); @@ -4717,12 +4719,11 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) //! change position and paper size to EditUtil !!! - const SvxMarginItem* pMargin = static_cast<const SvxMarginItem*>( - &pPattern->GetItem(ATTR_MARGIN, pCondSet)); + const SvxMarginItem* pMargin = + &pPattern->GetItem(ATTR_MARGIN, pCondSet); sal_uInt16 nIndent = 0; if ( eHorJust == SvxCellHorJustify::Left ) - nIndent = static_cast<const SfxUInt16Item&>(pPattern-> - GetItem(ATTR_INDENT, pCondSet)).GetValue(); + nIndent = pPattern->GetItem(ATTR_INDENT, pCondSet).GetValue(); long nTotalHeight = nOutHeight; // without subtracting the margin if ( bPixelToLogic ) @@ -4744,12 +4745,11 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) SvxRotateMode eRotMode = SVX_ROTATE_MODE_STANDARD; if ( eOrient == SvxCellOrientation::Standard ) { - nAttrRotate = static_cast<const SfxInt32Item&>(pPattern-> - GetItem(ATTR_ROTATE_VALUE, pCondSet)).GetValue(); + nAttrRotate = pPattern-> + GetItem(ATTR_ROTATE_VALUE, pCondSet).GetValue(); if ( nAttrRotate ) { - eRotMode = static_cast<const SvxRotateModeItem&>( - pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet)).GetValue(); + eRotMode = pPattern->GetItem(ATTR_ROTATE_MODE, pCondSet).GetValue(); if ( nAttrRotate == 18000 ) eRotMode = SVX_ROTATE_MODE_STANDARD; // no overflow diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits