diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-23 11:25:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-23 15:03:25 +0100 |
commit | 94d76cef1f71056fab106caf4cc8e65504475615 (patch) | |
tree | bb31a42873eae96bd402a152211dafe1d232bb65 /sc/source/ui/view | |
parent | e0846b7abe78e55bc1e959143d980208077b13ca (diff) |
TypedWhichId create custom get methods in ScPatternAttr
Change-Id: Iaa326332f5806477dd81463e6b6004a962bac934
Reviewed-on: https://gerrit.libreoffice.org/45128
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/view')
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/formatsh.cxx | 30 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 23 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/view/output.cxx | 28 | ||||
-rw-r--r-- | sc/source/ui/view/output2.cxx | 96 | ||||
-rw-r--r-- | sc/source/ui/view/printfun.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun3.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 19 |
10 files changed, 106 insertions, 121 deletions
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 index 3b6d8e033be5..aa83de67fbed 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -392,8 +392,8 @@ static void lcl_HidePrint( const ScTableInfo& rTabInfo, SCCOL nX1, SCCOL nX2 ) { const CellInfo& rCellInfo = pThisRowInfo->pCellInfo[nX+1]; if (!rCellInfo.bEmptyCellText) - if (static_cast<const ScProtectionAttr&>(rCellInfo.pPatternAttr-> - GetItem(ATTR_PROTECTION, rCellInfo.pConditionSet)).GetHidePrint()) + if (rCellInfo.pPatternAttr-> + GetItem(ATTR_PROTECTION, rCellInfo.pConditionSet).GetHidePrint()) { pThisRowInfo->pCellInfo[nX+1].maCell.clear(); pThisRowInfo->pCellInfo[nX+1].bEmptyCellText = true; diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 7bd2074b7342..1728e4990927 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1312,11 +1312,10 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, bEditActive[eWhich] = true; const ScPatternAttr* pPattern = pDoc->GetPattern( nNewX, nNewY, nTabNo ); - SvxCellHorJustify eJust = static_cast<const SvxHorJustifyItem&>( - pPattern->GetItem( ATTR_HOR_JUSTIFY )).GetValue(); + SvxCellHorJustify eJust = pPattern->GetItem( ATTR_HOR_JUSTIFY ).GetValue(); bool bBreak = ( eJust == SvxCellHorJustify::Block ) || - static_cast<const SfxBoolItem&>(pPattern->GetItem(ATTR_LINEBREAK)).GetValue(); + pPattern->GetItem(ATTR_LINEBREAK).GetValue(); bool bAsianVertical = pNewEngine->IsVertical(); // set by InputHandler @@ -1341,7 +1340,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, // modify members nEditCol etc. only if also extending for needed area nEditCol = nNewX; nEditRow = nNewY; - const ScMergeAttr* pMergeAttr = static_cast<const ScMergeAttr*>(&pPattern->GetItem(ATTR_MERGE)); + const ScMergeAttr* pMergeAttr = &pPattern->GetItem(ATTR_MERGE); nEditEndCol = nEditCol; if (pMergeAttr->GetColMerge() > 1) nEditEndCol += pMergeAttr->GetColMerge() - 1; @@ -1445,7 +1444,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, pNewEngine->InsertView(pEditView[eWhich]); // background color of the cell - 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 ) @@ -1518,8 +1517,7 @@ void ScViewData::EditGrowX() // get bGrow... variables the same way as in SetEditEngine const ScPatternAttr* pPattern = pLocalDoc->GetPattern( nEditCol, nEditRow, nTabNo ); - SvxCellHorJustify eJust = static_cast<const SvxHorJustifyItem&>( - pPattern->GetItem( ATTR_HOR_JUSTIFY )).GetValue(); + SvxCellHorJustify eJust = pPattern->GetItem( ATTR_HOR_JUSTIFY ).GetValue(); bool bGrowCentered = ( eJust == SvxCellHorJustify::Center ); bool bGrowToLeft = ( eJust == SvxCellHorJustify::Right ); // visual left bool bGrowBackwards = bGrowToLeft; // logical left diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 3f18067a8d3f..ee680c06685d 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -1223,8 +1223,8 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, SCROW nRow2 = -1; while ( ( pPattern = aIter.GetNext( nCol, nRow1, nRow2 ) ) != nullptr ) { - const ScMergeAttr* pMergeFlag = static_cast<const ScMergeAttr*>( &pPattern->GetItem(ATTR_MERGE) ); - const ScMergeFlagAttr* pMergeFlagAttr = static_cast<const ScMergeFlagAttr*>( &pPattern->GetItem(ATTR_MERGE_FLAG) ); + const ScMergeAttr* pMergeFlag = &pPattern->GetItem(ATTR_MERGE); + const ScMergeFlagAttr* pMergeFlagAttr = &pPattern->GetItem(ATTR_MERGE_FLAG); if( ( pMergeFlag && pMergeFlag->IsMerged() ) || ( pMergeFlagAttr && pMergeFlagAttr->IsOverlapped() ) ) { ScRange aRange(nCol, nRow1, nStartTab); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index c83dcc1fe6b1..27e9ad05d738 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -200,7 +200,7 @@ void ScViewFunc::DoAutoAttributes( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatternAttr* pSource = rDoc.GetPattern( aFormatSource.Col(), aFormatSource.Row(), nTab ); - if ( !static_cast<const ScMergeAttr&>(pSource->GetItem(ATTR_MERGE)).IsMerged() ) + if ( !pSource->GetItem(ATTR_MERGE).IsMerged() ) { ScRange aRange( nCol, nRow, nTab, nCol, nRow, nTab ); ScMarkData aMark; @@ -869,8 +869,8 @@ void ScViewFunc::GetSelectionFrame( SvxBoxItem& rLineOuter, GetViewData().GetCurY(), GetViewData().GetTabNo() ); - rLineOuter = static_cast<const SvxBoxItem&> (pAttrs->GetItem( ATTR_BORDER )); - rLineInner = static_cast<const SvxBoxInfoItem&>(pAttrs->GetItem( ATTR_BORDER_INNER )); + rLineOuter = pAttrs->GetItem( ATTR_BORDER ); + rLineInner = pAttrs->GetItem( ATTR_BORDER_INNER ); rLineInner.SetTable(false); rLineInner.SetDist(true); rLineInner.SetMinDist(false); @@ -2372,13 +2372,11 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) long nEdit = pHdl->GetTextSize().Width(); // in 0.01 mm const ScPatternAttr* pPattern = rDoc.GetPattern( nCol, nRow, nTab ); - const SvxMarginItem& rMItem = - static_cast<const SvxMarginItem&>(pPattern->GetItem(ATTR_MARGIN)); + const SvxMarginItem& rMItem = pPattern->GetItem(ATTR_MARGIN); sal_uInt16 nMargin = rMItem.GetLeftMargin() + rMItem.GetRightMargin(); - if ( static_cast<const SvxHorJustifyItem&>( pPattern-> - GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SvxCellHorJustify::Left ) + if ( pPattern->GetItem( ATTR_HOR_JUSTIFY ).GetValue() == SvxCellHorJustify::Left ) nMargin = sal::static_int_cast<sal_uInt16>( - nMargin + static_cast<const SfxUInt16Item&>(pPattern->GetItem(ATTR_INDENT)).GetValue() ); + nMargin + pPattern->GetItem(ATTR_INDENT).GetValue() ); nWidth = (sal_uInt16)(nEdit * pDocSh->GetOutputFactor() / HMM_PER_TWIPS) + nMargin + STD_EXTRA_WIDTH; @@ -2427,9 +2425,8 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) { const ScPatternAttr* pPattern = rDoc.GetPattern( nCol, nRow, nTab ); bool bNeedHeight = - static_cast<const SfxBoolItem&>(pPattern->GetItem( ATTR_LINEBREAK )).GetValue() || - static_cast<const SvxHorJustifyItem&>(pPattern-> - GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SvxCellHorJustify::Block; + pPattern->GetItem( ATTR_LINEBREAK ).GetValue() || + pPattern->GetItem( ATTR_HOR_JUSTIFY ).GetValue() == SvxCellHorJustify::Block; if (bNeedHeight) AdjustRowHeight( nRow, nRow ); } |