From a675428e349d3424ffcc844e9c3884a82cf82ef7 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 22 Nov 2017 14:31:53 +0200 Subject: TypedWhichId for sc constants Change-Id: I25a07d84ae24fdd3b4fbd303beea755169eb9acb Reviewed-on: https://gerrit.libreoffice.org/45084 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/source/ui/Accessibility/AccessibleText.cxx | 2 +- sc/source/ui/app/transobj.cxx | 2 +- sc/source/ui/cctrl/dpcontrol.cxx | 2 +- sc/source/ui/docshell/docsh3.cxx | 7 ++- sc/source/ui/docshell/docsh4.cxx | 40 +++++++--------- sc/source/ui/pagedlg/hfedtdlg.cxx | 21 ++------- sc/source/ui/pagedlg/tphf.cxx | 3 +- sc/source/ui/undo/undocell.cxx | 2 + sc/source/ui/unoobj/afmtuno.cxx | 1 + sc/source/ui/unoobj/cellsuno.cxx | 14 +++--- sc/source/ui/unoobj/defltuno.cxx | 1 + sc/source/ui/unoobj/styleuno.cxx | 36 ++++++++------ sc/source/ui/unoobj/textuno.cxx | 2 +- sc/source/ui/vba/vbaformat.cxx | 4 +- sc/source/ui/view/formatsh.cxx | 46 ++++++++---------- sc/source/ui/view/gridwin4.cxx | 4 +- sc/source/ui/view/preview.cxx | 17 ++++--- sc/source/ui/view/prevwsh.cxx | 4 +- sc/source/ui/view/printfun.cxx | 67 +++++++++++++-------------- sc/source/ui/view/tabvwsha.cxx | 6 +-- sc/source/ui/view/viewfunc.cxx | 13 +++--- 21 files changed, 139 insertions(+), 155 deletions(-) (limited to 'sc/source/ui') diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index 5ceb341135d5..cf9a4e9cca4b 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -1374,7 +1374,7 @@ SvxTextForwarder* ScAccessibleHeaderTextData::GetTextForwarder() // -> use global pool from module SfxItemSet aDefaults( pHdrEngine->GetEmptyItemSet() ); - const ScPatternAttr& rPattern = static_cast(SC_MOD()->GetPool().GetDefaultItem(ATTR_PATTERN)); + const ScPatternAttr& rPattern = SC_MOD()->GetPool().GetDefaultItem(ATTR_PATTERN); rPattern.FillEditItemSet( &aDefaults ); // FillEditItemSet adjusts font height to 1/100th mm, // but for header/footer twips is needed, as in the PatternAttr: diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index e2e57ed657b6..fdbf874ceb66 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -724,7 +724,7 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize) if (pStyleSheet) { const SfxItemSet& rSourceSet = pStyleSheet->GetItemSet(); - aPaperSize = static_cast( rSourceSet.Get(ATTR_PAGE_SIZE)).GetSize(); + aPaperSize = rSourceSet.Get(ATTR_PAGE_SIZE).GetSize(); // CopyStyleFrom copies SetItems with correct pool ScStyleSheetPool* pDestPool = rDestDoc.GetStyleSheetPool(); diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx index 3fdba111c780..e1fabdb3540c 100644 --- a/sc/source/ui/cctrl/dpcontrol.cxx +++ b/sc/source/ui/cctrl/dpcontrol.cxx @@ -121,7 +121,7 @@ void ScDPFieldButton::draw() { // use ScPatternAttr::GetFont only for font size vcl::Font aAttrFont; - static_cast(mpDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)). + mpDoc->GetPool()->GetDefaultItem(ATTR_PATTERN). GetFont( aAttrFont, SC_AUTOCOL_BLACK, mpOutDev, &maZoomY ); aTextFont.SetFontSize( aAttrFont.GetFontSize() ); } diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index b2cdf855982c..35f174613450 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -369,8 +369,7 @@ void ScDocShell::CalcOutputFactor() "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890123456789"); long nPrinterWidth = 0; long nWindowWidth = 0; - const ScPatternAttr* pPattern = static_cast(&aDocument.GetPool()-> - GetDefaultItem(ATTR_PATTERN)); + const ScPatternAttr* pPattern = &aDocument.GetPool()->GetDefaultItem(ATTR_PATTERN); vcl::Font aDefFont; OutputDevice* pRefDev = GetRefDevice(); @@ -537,7 +536,7 @@ sal_uInt16 ScDocShell::SetPrinter( VclPtr const & pNewPrinter, SfxPr if (nDiffFlags & SfxPrinterChangeFlags::CHG_ORIENTATION) { - const SvxPageItem& rOldItem = static_cast(rSet.Get(ATTR_PAGE)); + const SvxPageItem& rOldItem = rSet.Get(ATTR_PAGE); bool bWasLand = rOldItem.IsLandscape(); bool bNewLand = ( pNewPrinter->GetOrientation() == Orientation::Landscape ); if (bNewLand != bWasLand) @@ -547,7 +546,7 @@ sal_uInt16 ScDocShell::SetPrinter( VclPtr const & pNewPrinter, SfxPr rSet.Put( aNewItem ); // flip size - Size aOldSize = static_cast(rSet.Get(ATTR_PAGE_SIZE)).GetSize(); + Size aOldSize = rSet.Get(ATTR_PAGE_SIZE).GetSize(); Size aNewSize(aOldSize.Height(),aOldSize.Width()); SvxSizeItem aNewSItem(ATTR_PAGE_SIZE,aNewSize); rSet.Put( aNewSItem ); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 60beffb4bfff..f70909e4e24e 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -1483,8 +1483,8 @@ void ScDocShell::SetPrintZoom( SCTAB nTab, sal_uInt16 nScale, sal_uInt16 nPages const bool bUndo(aDocument.IsUndoEnabled()); if (bUndo) { - sal_uInt16 nOldScale = static_cast(rSet.Get(ATTR_PAGE_SCALE)).GetValue(); - sal_uInt16 nOldPages = static_cast(rSet.Get(ATTR_PAGE_SCALETOPAGES)).GetValue(); + sal_uInt16 nOldScale = rSet.Get(ATTR_PAGE_SCALE).GetValue(); + sal_uInt16 nOldPages = rSet.Get(ATTR_PAGE_SCALETOPAGES).GetValue(); GetUndoManager()->AddUndoAction( new ScUndoPrintZoom( this, nTab, nOldScale, nOldPages, nScale, nPages ) ); } @@ -1514,9 +1514,9 @@ bool ScDocShell::AdjustPrintZoom( const ScRange& rRange ) if ( pStyleSheet ) { SfxItemSet& rSet = pStyleSheet->GetItemSet(); - bool bHeaders = static_cast(rSet.Get(ATTR_PAGE_HEADERS)).GetValue(); - sal_uInt16 nOldScale = static_cast(rSet.Get(ATTR_PAGE_SCALE)).GetValue(); - sal_uInt16 nOldPages = static_cast(rSet.Get(ATTR_PAGE_SCALETOPAGES)).GetValue(); + bool bHeaders = rSet.Get(ATTR_PAGE_HEADERS).GetValue(); + sal_uInt16 nOldScale = rSet.Get(ATTR_PAGE_SCALE).GetValue(); + sal_uInt16 nOldPages = rSet.Get(ATTR_PAGE_SCALETOPAGES).GetValue(); const ScRange* pRepeatCol = aDocument.GetRepeatColRange( nTab ); const ScRange* pRepeatRow = aDocument.GetRepeatRowRange( nTab ); @@ -1719,21 +1719,17 @@ void ScDocShell::ExecutePageStyle( const SfxViewShell& rCaller, { SfxItemSet& rStyleSet = pStyleSheet->GetItemSet(); - SvxPageUsage eUsage = static_cast( - rStyleSet.Get( ATTR_PAGE )). - GetPageUsage(); - bool bShareHeader = static_cast( - static_cast(rStyleSet - .Get(ATTR_PAGE_HEADERSET)) + SvxPageUsage eUsage = rStyleSet.Get( ATTR_PAGE ).GetPageUsage(); + bool bShareHeader = rStyleSet + .Get(ATTR_PAGE_HEADERSET) .GetItemSet() - .Get(ATTR_PAGE_SHARED)) - .GetValue(); - bool bShareFooter = static_cast( - static_cast(rStyleSet - .Get(ATTR_PAGE_FOOTERSET)) + .Get(ATTR_PAGE_SHARED) + .GetValue(); + bool bShareFooter = rStyleSet + .Get(ATTR_PAGE_FOOTERSET) .GetItemSet() - .Get(ATTR_PAGE_SHARED)) - .GetValue(); + .Get(ATTR_PAGE_SHARED) + .GetValue(); sal_uInt16 nResId = 0; switch ( eUsage ) @@ -2185,13 +2181,13 @@ void ScDocShell::GetPageOnFromPageStyleSet( const SfxItemSet* pStyleSet, const SvxSetItem* pSetItem = nullptr; const SfxItemSet* pSet = nullptr; - pSetItem = static_cast( &pStyleSet->Get( ATTR_PAGE_HEADERSET ) ); + pSetItem = &pStyleSet->Get( ATTR_PAGE_HEADERSET ); pSet = &pSetItem->GetItemSet(); - rbHeader = static_cast(pSet->Get(ATTR_PAGE_ON)).GetValue(); + rbHeader = pSet->Get(ATTR_PAGE_ON).GetValue(); - pSetItem = static_cast( &pStyleSet->Get( ATTR_PAGE_FOOTERSET ) ); + pSetItem = &pStyleSet->Get( ATTR_PAGE_FOOTERSET ); pSet = &pSetItem->GetItemSet(); - rbFooter = static_cast(pSet->Get(ATTR_PAGE_ON)).GetValue(); + rbFooter = pSet->Get(ATTR_PAGE_ON).GetValue(); } #if defined(_WIN32) diff --git a/sc/source/ui/pagedlg/hfedtdlg.cxx b/sc/source/ui/pagedlg/hfedtdlg.cxx index 76a8be272ee4..df9683bc2363 100644 --- a/sc/source/ui/pagedlg/hfedtdlg.cxx +++ b/sc/source/ui/pagedlg/hfedtdlg.cxx @@ -28,26 +28,13 @@ #include #include -// macros from docsh4.cxx -//! use SIDs? - -#define IS_SHARE_HEADER(set) \ - static_cast( \ - static_cast((set).Get(ATTR_PAGE_HEADERSET)).GetItemSet(). \ - Get(ATTR_PAGE_SHARED)).GetValue() - -#define IS_SHARE_FOOTER(set) \ - static_cast( \ - static_cast((set).Get(ATTR_PAGE_FOOTERSET)).GetItemSet(). \ - Get(ATTR_PAGE_SHARED)).GetValue() - ScHFEditDlg::ScHFEditDlg( vcl::Window* pParent, const SfxItemSet& rCoreSet, const OUString& rPageStyle, const OUString& rID, const OUString& rUIXMLDescription ) : SfxTabDialog( pParent, rID, rUIXMLDescription, &rCoreSet ) { - eNumType = static_cast(rCoreSet.Get(ATTR_PAGE)).GetNumType(); + eNumType = rCoreSet.Get(ATTR_PAGE).GetNumType(); OUString aTmp = GetText(); @@ -177,13 +164,15 @@ ScHFEditActiveDlg::ScHFEditActiveDlg( { // #69193a# respect "shared" setting - bool bShareHeader = IS_SHARE_HEADER(rCoreSet); + bool bShareHeader = rCoreSet.Get(ATTR_PAGE_HEADERSET).GetItemSet(). + Get(ATTR_PAGE_SHARED).GetValue(); if ( bShareHeader ) AddTabPage( "header", ScRightHeaderEditPage::Create, nullptr ); else AddTabPage( "header", ScLeftHeaderEditPage::Create, nullptr ); - bool bShareFooter = IS_SHARE_FOOTER(rCoreSet); + bool bShareFooter = rCoreSet.Get(ATTR_PAGE_FOOTERSET).GetItemSet(). + Get(ATTR_PAGE_SHARED).GetValue(); if ( bShareFooter ) AddTabPage( "footer", ScRightFooterEditPage::Create, nullptr ); else diff --git a/sc/source/ui/pagedlg/tphf.cxx b/sc/source/ui/pagedlg/tphf.cxx index a94cca63e746..5a810ac498e3 100644 --- a/sc/source/ui/pagedlg/tphf.cxx +++ b/sc/source/ui/pagedlg/tphf.cxx @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -222,7 +223,7 @@ IMPL_LINK_NOARG(ScHFPage, HFEditHdl, void*, void) pDlg->SetTabPage( ScLeftFooterEditPage::Create( pDlg->get_content_area(), &aDataSet ), nSettingsId ); } - SvxNumType eNumType = static_cast(aDataSet.Get(ATTR_PAGE)).GetNumType(); + SvxNumType eNumType = aDataSet.Get(ATTR_PAGE).GetNumType(); static_cast(pDlg->GetTabPage())->SetNumType(eNumType); aText += " (" + ScGlobal::GetRscString( STR_PAGESTYLE ); diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index 5c10cd3282aa..becde96c8018 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -22,10 +22,12 @@ #include #include #include +#include #include #include #include +#include #include #include #include diff --git a/sc/source/ui/unoobj/afmtuno.cxx b/sc/source/ui/unoobj/afmtuno.cxx index 007da41edc94..a6f8df946c86 100644 --- a/sc/source/ui/unoobj/afmtuno.cxx +++ b/sc/source/ui/unoobj/afmtuno.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 1c948adbdd28..a44dc4ae781d 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -2146,8 +2146,8 @@ static void lcl_SetCellProperty( const SfxItemPropertySimpleEntry& rEntry, const { // language for number formats SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); - sal_uLong nOldFormat = static_cast(rSet.Get( ATTR_VALUE_FORMAT )).GetValue(); - LanguageType eOldLang = static_cast(rSet.Get( ATTR_LANGUAGE_FORMAT )).GetLanguage(); + sal_uLong nOldFormat = rSet.Get( ATTR_VALUE_FORMAT ).GetValue(); + LanguageType eOldLang = rSet.Get( ATTR_LANGUAGE_FORMAT ).GetLanguage(); nOldFormat = pFormatter->GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang ); sal_Int32 nIntVal = 0; @@ -2486,10 +2486,10 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE { ScDocument& rDoc = pDocShell->GetDocument(); - sal_uLong nOldFormat = static_cast( - pDataSet->Get( ATTR_VALUE_FORMAT )).GetValue(); - LanguageType eOldLang = static_cast( - pDataSet->Get( ATTR_LANGUAGE_FORMAT )).GetLanguage(); + sal_uLong nOldFormat = + pDataSet->Get( ATTR_VALUE_FORMAT ).GetValue(); + LanguageType eOldLang = + pDataSet->Get( ATTR_LANGUAGE_FORMAT ).GetLanguage(); nOldFormat = rDoc.GetFormatTable()-> GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang ); rAny <<= (sal_Int32)nOldFormat; @@ -2501,7 +2501,7 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE break; case ATTR_STACKED: { - sal_Int32 nRot = static_cast(pDataSet->Get(ATTR_ROTATE_VALUE)).GetValue(); + sal_Int32 nRot = pDataSet->Get(ATTR_ROTATE_VALUE).GetValue(); bool bStacked = static_cast(pDataSet->Get(pEntry->nWID)).GetValue(); SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( rAny ); } diff --git a/sc/source/ui/unoobj/defltuno.cxx b/sc/source/ui/unoobj/defltuno.cxx index 2705ce07baa6..a8b70f9e9455 100644 --- a/sc/source/ui/unoobj/defltuno.cxx +++ b/sc/source/ui/unoobj/defltuno.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index 3f52656351cc..3cbecb95c7d4 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -21,14 +21,20 @@ #include #include #include +#include #include +#include #include +#include +#include #include #include #include #include #include #include +#include +#include #include #include #include @@ -1137,13 +1143,13 @@ const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( const OUString& rPropName, if ( pEntry ) // only item-WIDs in header/footer map { rpResultEntry = pEntry; - return &static_cast(pStyle->GetItemSet().Get(ATTR_PAGE_HEADERSET)).GetItemSet(); + return &pStyle->GetItemSet().Get(ATTR_PAGE_HEADERSET).GetItemSet(); } pEntry = lcl_GetFooterStyleMap()->getByName( rPropName ); if ( pEntry ) // only item-WIDs in header/footer map { rpResultEntry = pEntry; - return &static_cast(pStyle->GetItemSet().Get(ATTR_PAGE_FOOTERSET)).GetItemSet(); + return &pStyle->GetItemSet().Get(ATTR_PAGE_FOOTERSET).GetItemSet(); } } pEntry = pPropSet->getPropertyMap().getByName( rPropName ); @@ -1490,7 +1496,7 @@ void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const Sfx const SfxItemPropertySimpleEntry* pHeaderEntry = lcl_GetHeaderStyleMap()->getByName( rPropertyName ); if ( pHeaderEntry ) // only item-WIDs in header/footer map { - SvxSetItem aNewHeader( static_cast(rSet.Get(ATTR_PAGE_HEADERSET)) ); + SvxSetItem aNewHeader( rSet.Get(ATTR_PAGE_HEADERSET) ); if (pValue) pPropSet->setPropertyValue( *pHeaderEntry, *pValue, aNewHeader.GetItemSet() ); else @@ -1504,7 +1510,7 @@ void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const Sfx const SfxItemPropertySimpleEntry* pFooterEntry = lcl_GetFooterStyleMap()->getByName( rPropertyName ); if ( pFooterEntry ) // only item-WIDs in header/footer map { - SvxSetItem aNewFooter( static_cast(rSet.Get(ATTR_PAGE_FOOTERSET)) ); + SvxSetItem aNewFooter( rSet.Get(ATTR_PAGE_FOOTERSET) ); if (pValue) pPropSet->setPropertyValue( *pFooterEntry, *pValue, aNewFooter.GetItemSet() ); else @@ -1529,10 +1535,10 @@ void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const Sfx // language for number formats SvNumberFormatter* pFormatter = pDocShell->GetDocument().GetFormatTable(); - sal_uInt32 nOldFormat = static_cast( - rSet.Get( ATTR_VALUE_FORMAT )).GetValue(); - LanguageType eOldLang = static_cast( - rSet.Get( ATTR_LANGUAGE_FORMAT )).GetLanguage(); + sal_uInt32 nOldFormat = + rSet.Get( ATTR_VALUE_FORMAT ).GetValue(); + LanguageType eOldLang = + rSet.Get( ATTR_LANGUAGE_FORMAT ).GetLanguage(); pFormatter->GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang ); sal_uInt32 nNewFormat = 0; @@ -1664,7 +1670,7 @@ void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const Sfx sal_Int16 nPages = 0; if (*pValue >>= nPages) { - ScPageScaleToItem aItem = static_cast(rSet.Get(ATTR_PAGE_SCALETO)); + ScPageScaleToItem aItem = rSet.Get(ATTR_PAGE_SCALETO); if ( rPropertyName == SC_UNO_PAGE_SCALETOX ) aItem.SetWidth(static_cast(nPages)); else @@ -1806,10 +1812,10 @@ uno::Any ScStyleObj::getPropertyValue_Impl( const OUString& aPropertyName ) case ATTR_VALUE_FORMAT: if ( pDocShell ) { - sal_uInt32 nOldFormat = static_cast( - pItemSet->Get( ATTR_VALUE_FORMAT )).GetValue(); - LanguageType eOldLang = static_cast( - pItemSet->Get( ATTR_LANGUAGE_FORMAT )).GetLanguage(); + sal_uInt32 nOldFormat = + pItemSet->Get( ATTR_VALUE_FORMAT ).GetValue(); + LanguageType eOldLang = + pItemSet->Get( ATTR_LANGUAGE_FORMAT ).GetLanguage(); nOldFormat = pDocShell->GetDocument().GetFormatTable()-> GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang ); aAny <<= nOldFormat; @@ -1821,7 +1827,7 @@ uno::Any ScStyleObj::getPropertyValue_Impl( const OUString& aPropertyName ) break; case ATTR_STACKED: { - sal_Int32 nRot = static_cast(pItemSet->Get(ATTR_ROTATE_VALUE)).GetValue(); + sal_Int32 nRot = pItemSet->Get(ATTR_ROTATE_VALUE).GetValue(); bool bStacked = static_cast(pItemSet->Get(nWhich)).GetValue(); SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( aAny ); } @@ -1856,7 +1862,7 @@ uno::Any ScStyleObj::getPropertyValue_Impl( const OUString& aPropertyName ) break; case ATTR_PAGE_SCALETO: { - ScPageScaleToItem aItem(static_cast(pItemSet->Get(ATTR_PAGE_SCALETO))); + ScPageScaleToItem aItem(pItemSet->Get(ATTR_PAGE_SCALETO)); if ( aPropertyName == SC_UNO_PAGE_SCALETOX ) aAny <<= static_cast(aItem.GetWidth()); else diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index 3801904f4a5b..3f7787d7d736 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -219,7 +219,7 @@ SvxTextForwarder* ScHeaderFooterTextData::GetTextForwarder() // -> use global pool from module SfxItemSet aDefaults( pHdrEngine->GetEmptyItemSet() ); - const ScPatternAttr& rPattern = static_cast(SC_MOD()->GetPool().GetDefaultItem(ATTR_PATTERN)); + const ScPatternAttr& rPattern = SC_MOD()->GetPool().GetDefaultItem(ATTR_PATTERN); rPattern.FillEditItemSet( &aDefaults ); // FillEditItemSet adjusts font height to 1/100th mm, // but for header/footer twips is needed, as in the PatternAttr: diff --git a/sc/source/ui/vba/vbaformat.cxx b/sc/source/ui/vba/vbaformat.cxx index 6ad20222c8bb..941c840d1e94 100644 --- a/sc/source/ui/vba/vbaformat.cxx +++ b/sc/source/ui/vba/vbaformat.cxx @@ -565,7 +565,7 @@ ScVbaFormat< Ifc... >::getLocked( ) SfxItemSet* pDataSet = getCurrentDataSet(); if ( pDataSet ) { - const ScProtectionAttr& rProtAttr = static_cast( pDataSet->Get(ATTR_PROTECTION) ); + const ScProtectionAttr& rProtAttr = pDataSet->Get(ATTR_PROTECTION); SfxItemState eState = pDataSet->GetItemState(ATTR_PROTECTION); if(eState != SfxItemState::DONTCARE) aCellProtection <<= rProtAttr.GetProtection(); @@ -598,7 +598,7 @@ ScVbaFormat< Ifc... >::getFormulaHidden( ) SfxItemSet* pDataSet = getCurrentDataSet(); if ( pDataSet ) { - const ScProtectionAttr& rProtAttr = static_cast( pDataSet->Get(ATTR_PROTECTION) ); + const ScProtectionAttr& rProtAttr = pDataSet->Get(ATTR_PROTECTION); SfxItemState eState = pDataSet->GetItemState(ATTR_PROTECTION); if(eState != SfxItemState::DONTCARE) aBoolRet <<= rProtAttr.GetHideFormula(); diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 70c459a6d286..26c5033fec39 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -805,8 +805,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) sal_uLong nFormat = static_cast(pItem)->GetValue(); LanguageType eLang = - static_cast(&rSet.Get( - ATTR_LANGUAGE_FORMAT ))->GetLanguage(); + rSet.Get(ATTR_LANGUAGE_FORMAT ).GetLanguage(); sal_uLong nLangFormat = rDoc.GetFormatTable()-> GetFormatForLanguageIfBuiltIn( nFormat, eLang ); if ( nLangFormat != nFormat ) @@ -889,10 +888,8 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) for (SCTAB nTab=0; nTab(aOldSet. - Get( ATTR_VALUE_FORMAT )).GetValue(); - sal_uLong nNewFormat = static_cast(rNewSet. - Get( ATTR_VALUE_FORMAT )).GetValue(); + sal_uLong nOldFormat = aOldSet.Get( ATTR_VALUE_FORMAT ).GetValue(); + sal_uLong nNewFormat = rNewSet.Get( ATTR_VALUE_FORMAT ).GetValue(); if ( nNewFormat != nOldFormat ) { SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); @@ -1039,7 +1036,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) case SID_NUMBER_TWODEC: { const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); - sal_uInt32 nNumberFormat = static_cast(rAttrSet.Get(ATTR_VALUE_FORMAT)).GetValue(); + sal_uInt32 nNumberFormat = rAttrSet.Get(ATTR_VALUE_FORMAT).GetValue(); if ((nType & css::util::NumberFormat::NUMBER) && nNumberFormat == 4) pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER ); @@ -1087,10 +1084,8 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); const SfxItemSet& rOldSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); - LanguageType eOldLang = static_cast( - rOldSet.Get( ATTR_LANGUAGE_FORMAT ) ).GetLanguage(); - sal_uInt32 nOldFormat = static_cast( - rOldSet.Get( ATTR_VALUE_FORMAT ) ).GetValue(); + LanguageType eOldLang = rOldSet.Get( ATTR_LANGUAGE_FORMAT ).GetLanguage(); + sal_uInt32 nOldFormat = rOldSet.Get( ATTR_VALUE_FORMAT ).GetValue(); if ( nOldFormat != nNewFormat ) { @@ -1949,7 +1944,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) if(SfxItemState::SET == pNewAttrs->GetItemState(ATTR_BORDER_TLBR, true, &pItem)) { SvxLineItem aItem(ATTR_BORDER_TLBR); - aItem.SetLine(static_cast(pNewAttrs->Get(ATTR_BORDER_TLBR)).GetLine()); + aItem.SetLine(pNewAttrs->Get(ATTR_BORDER_TLBR).GetLine()); pNewSet->Put(aItem); rReq.AppendItem(aItem); pTabViewShell->ApplyAttributes(pNewSet.get(), pOldSet.get()); @@ -1960,7 +1955,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) if(SfxItemState::SET == pNewAttrs->GetItemState(ATTR_BORDER_BLTR, true, &pItem )) { SvxLineItem aItem(ATTR_BORDER_BLTR); - aItem.SetLine(static_cast(pNewAttrs->Get(ATTR_BORDER_BLTR)).GetLine()); + aItem.SetLine(pNewAttrs->Get(ATTR_BORDER_BLTR).GetLine()); pNewSet->Put(aItem); rReq.AppendItem(aItem); pTabViewShell->ApplyAttributes(pNewSet.get(), pOldSet.get()); @@ -2001,8 +1996,8 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) case SID_ATTR_BORDER_SHADOW: { - const SvxShadowItem& rNewShadowItem = static_cast( - pNewAttrs->Get( ATTR_SHADOW ) ); + const SvxShadowItem& rNewShadowItem = + pNewAttrs->Get( ATTR_SHADOW ); pTabViewShell->ApplyAttr( rNewShadowItem ); } break; @@ -2021,7 +2016,7 @@ void ScFormatShell::GetAttrState( SfxItemSet& rSet ) { ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); - const SvxBrushItem& rBrushItem = static_cast(rAttrSet.Get( ATTR_BACKGROUND )); + const SvxBrushItem& rBrushItem = rAttrSet.Get( ATTR_BACKGROUND ); SfxWhichIter aIter( rSet ); sal_uInt16 nWhich = aIter.FirstWhich(); @@ -2224,7 +2219,7 @@ void ScFormatShell::GetAttrState( SfxItemSet& rSet ) break; case SID_SCATTR_CELLPROTECTION: { - bool bProtect = static_cast(rAttrSet.Get( ATTR_PROTECTION )).GetProtection(); + bool bProtect = rAttrSet.Get( ATTR_PROTECTION ).GetProtection(); rSet.Put( SfxBoolItem(SID_SCATTR_CELLPROTECTION, bProtect) ); } break; @@ -2273,8 +2268,8 @@ void ScFormatShell::GetTextAttrState( SfxItemSet& rSet ) } else { - FontLineStyle eUnderline = static_cast( - rAttrSet.Get(ATTR_FONT_UNDERLINE)).GetLineStyle(); + FontLineStyle eUnderline = + rAttrSet.Get(ATTR_FONT_UNDERLINE).GetLineStyle(); sal_uInt16 nId = SID_ULINE_VAL_NONE; switch (eUnderline) { @@ -2443,12 +2438,12 @@ void ScFormatShell::GetAlignState( SfxItemSet& rSet ) SvxCellHorJustify eHAlign = SvxCellHorJustify::Standard; bool bHasHAlign = rAttrSet.GetItemState( ATTR_HOR_JUSTIFY ) != SfxItemState::DONTCARE; if( bHasHAlign ) - eHAlign = static_cast(rAttrSet.Get( ATTR_HOR_JUSTIFY )).GetValue(); + eHAlign = rAttrSet.Get( ATTR_HOR_JUSTIFY ).GetValue(); SvxCellVerJustify eVAlign = SvxCellVerJustify::Standard; bool bHasVAlign = rAttrSet.GetItemState( ATTR_VER_JUSTIFY ) != SfxItemState::DONTCARE; if( bHasVAlign ) - eVAlign = static_cast(rAttrSet.Get( ATTR_VER_JUSTIFY )).GetValue(); + eVAlign = rAttrSet.Get( ATTR_VER_JUSTIFY ).GetValue(); while ( nWhich ) { @@ -2488,7 +2483,7 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet ) ScDocument* pDoc = pViewData->GetDocument(); short nType = GetCurrentNumberFormatType(); const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); - sal_uInt32 nNumberFormat = static_cast(rAttrSet.Get(ATTR_VALUE_FORMAT)).GetValue(); + sal_uInt32 nNumberFormat = rAttrSet.Get(ATTR_VALUE_FORMAT).GetValue(); SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); NfIndexTableOffset nOffset = pFormatter->GetIndexTableOffset(nNumberFormat); @@ -2692,16 +2687,15 @@ void ScFormatShell::GetTextDirectionState( SfxItemSet& rSet ) (rAttrSet.GetItemState( ATTR_VERTICAL_ASIAN ) == SfxItemState::DONTCARE) || (rAttrSet.GetItemState( ATTR_STACKED ) == SfxItemState::DONTCARE); bool bLeftRight = !bVertDontCare && - !static_cast(rAttrSet.Get( ATTR_STACKED )).GetValue(); + !rAttrSet.Get( ATTR_STACKED ).GetValue(); bool bTopBottom = !bVertDontCare && !bLeftRight && - static_cast(rAttrSet.Get( ATTR_VERTICAL_ASIAN )).GetValue(); + rAttrSet.Get( ATTR_VERTICAL_ASIAN ).GetValue(); bool bBidiDontCare = (rAttrSet.GetItemState( ATTR_WRITINGDIR ) == SfxItemState::DONTCARE); EEHorizontalTextDirection eBidiDir = EE_HTEXTDIR_DEFAULT; if ( !bBidiDontCare ) { - SvxFrameDirection eCellDir = static_cast( - rAttrSet.Get( ATTR_WRITINGDIR )).GetValue(); + SvxFrameDirection eCellDir = rAttrSet.Get( ATTR_WRITINGDIR ).GetValue(); if ( eCellDir == SvxFrameDirection::Environment ) eBidiDir = (EEHorizontalTextDirection)GetViewData()->GetDocument()-> GetEditTextDirection( GetViewData()->GetTabNo() ); diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index e4a15be8e717..db4bd9f5345b 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -106,7 +106,7 @@ static void lcl_DrawOneFrame( vcl::RenderContext* pDev, const tools::Rectangle& // use ScPatternAttr::GetFont only for font size vcl::Font aAttrFont; - static_cast(pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)). + pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN). GetFont(aAttrFont,SC_AUTOCOL_BLACK,pDev,&rZoomY); // everything else from application font @@ -1342,7 +1342,7 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::Font aFont; std::unique_ptr pEditEng; - const ScPatternAttr& rDefPattern = static_cast(pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)); + const ScPatternAttr& rDefPattern = pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN); if ( nPageScript == SvtScriptType::LATIN ) { // use single font and call DrawText directly diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index ccd0c5cfa4c5..86c6821623c1 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -504,8 +504,7 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) DrawRect(tools::Rectangle(0, 0, aWinEnd.X(), aWinEnd.Y())); const ScPatternAttr& rDefPattern = - static_cast( - rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN)); + rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN); std::unique_ptr pEditEng( new ScEditEngineDefaulter(EditEngine::CreatePool(), true)); @@ -797,7 +796,7 @@ static Size lcl_GetDocPageSize( const ScDocument* pDoc, SCTAB nTab ) if ( pStyleSheet ) { SfxItemSet& rStyleSet = pStyleSheet->GetItemSet(); - return static_cast( rStyleSet.Get(ATTR_PAGE_SIZE)).GetSize(); + return rStyleSet.Get(ATTR_PAGE_SIZE).GetSize(); } else { @@ -1077,7 +1076,7 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) SfxItemSet& rStyleSet = pStyleSheet->GetItemSet(); - SvxLRSpaceItem aLRItem = static_cast( rStyleSet.Get( ATTR_LRSPACE ) ); + SvxLRSpaceItem aLRItem = rStyleSet.Get( ATTR_LRSPACE ); if(( bLeftRulerChange || bRightRulerChange ) && ( aButtonUpPt.X() <= ( 0 - aOffset.X() ) || aButtonUpPt.X() > nWidth * HMM_PER_TWIPS - aOffset.X() ) ) { @@ -1172,7 +1171,7 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) SfxItemSet& rStyleSet = pStyleSheet->GetItemSet(); - SvxULSpaceItem aULItem = static_cast( rStyleSet.Get( ATTR_ULSPACE ) ); + SvxULSpaceItem aULItem = rStyleSet.Get( ATTR_ULSPACE ); if( bTopRulerMove && bTopRulerChange ) { @@ -1192,10 +1191,10 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) if ( rStyleSet.GetItemState( ATTR_PAGE_HEADERSET, false, &pItem ) == SfxItemState::SET ) { const SfxItemSet& rHeaderSet = static_cast(pItem)->GetItemSet(); - Size aHeaderSize = static_cast(rHeaderSet.Get(ATTR_PAGE_SIZE)).GetSize(); + Size aHeaderSize = rHeaderSet.Get(ATTR_PAGE_SIZE).GetSize(); aHeaderSize.Height() = (long)( aButtonUpPt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS - aULItem.GetUpper()); aHeaderSize.Height() = aHeaderSize.Height() * 100 / mnScale; - SvxSetItem aNewHeader( static_cast(rStyleSet.Get(ATTR_PAGE_HEADERSET)) ); + SvxSetItem aNewHeader( rStyleSet.Get(ATTR_PAGE_HEADERSET) ); aNewHeader.GetItemSet().Put( SvxSizeItem( ATTR_PAGE_SIZE, aHeaderSize ) ); rStyleSet.Put( aNewHeader ); pDocShell->SetModified(); @@ -1207,10 +1206,10 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) if( rStyleSet.GetItemState( ATTR_PAGE_FOOTERSET, false, &pItem ) == SfxItemState::SET ) { const SfxItemSet& rFooterSet = static_cast(pItem)->GetItemSet(); - Size aFooterSize = static_cast(rFooterSet.Get(ATTR_PAGE_SIZE)).GetSize(); + Size aFooterSize = rFooterSet.Get(ATTR_PAGE_SIZE).GetSize(); aFooterSize.Height() = (long)( nHeight - aButtonUpPt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS - aULItem.GetLower() ); aFooterSize.Height() = aFooterSize.Height() * 100 / mnScale; - SvxSetItem aNewFooter( static_cast(rStyleSet.Get(ATTR_PAGE_FOOTERSET)) ); + SvxSetItem aNewFooter( rStyleSet.Get(ATTR_PAGE_FOOTERSET) ); aNewFooter.GetItemSet().Put( SvxSizeItem( ATTR_PAGE_SIZE, aFooterSize ) ); rStyleSet.Put( aNewFooter ); pDocShell->SetModified(); diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 1504303c9232..41b7caa91af7 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -245,7 +245,7 @@ bool ScPreviewShell::GetPageSize( Size& aPageSize ) if (!pStyleSheet) return false; const SfxItemSet* pParamSet = &pStyleSheet->GetItemSet(); - aPageSize = static_cast( pParamSet->Get(ATTR_PAGE_SIZE)).GetSize(); + aPageSize = pParamSet->Get(ATTR_PAGE_SIZE).GetSize(); aPageSize.Width() = (long) (aPageSize.Width() * HMM_PER_TWIPS ); aPageSize.Height() = (long) (aPageSize.Height() * HMM_PER_TWIPS ); return true; @@ -841,7 +841,7 @@ void ScPreviewShell::GetState( SfxItemSet& rSet ) if ( pStyleSheet ) { SfxItemSet& rStyleSet = pStyleSheet->GetItemSet(); - sal_uInt16 nCurrentZoom = static_cast(rStyleSet.Get(ATTR_PAGE_SCALE)).GetValue(); + sal_uInt16 nCurrentZoom = rStyleSet.Get(ATTR_PAGE_SCALE).GetValue(); if( nCurrentZoom ) { SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM_SLIDER, MAXZOOM_SLIDER, SID_PREVIEW_SCALINGFACTOR ); diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index 7e882ced930c..3b6d8e033be5 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -424,9 +424,9 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr if (pStyleSheet) { SfxItemSet& rSet = pStyleSheet->GetItemSet(); - bDoGrid = static_cast(rSet.Get(ATTR_PAGE_GRID)).GetValue(); - bNullVal = static_cast(rSet.Get(ATTR_PAGE_NULLVALS)).GetValue(); - bFormula = static_cast(rSet.Get(ATTR_PAGE_FORMULAS)).GetValue(); + bDoGrid = rSet.Get(ATTR_PAGE_GRID).GetValue(); + bNullVal = rSet.Get(ATTR_PAGE_NULLVALS).GetValue(); + bFormula = rSet.Get(ATTR_PAGE_FORMULAS).GetValue(); } else { @@ -616,19 +616,19 @@ static void lcl_FillHFParam( ScPrintHFParam& rParam, const SfxItemSet* pHFSet ) } else { - rParam.bEnable = static_cast( pHFSet->Get(ATTR_PAGE_ON)).GetValue(); - rParam.bDynamic = static_cast( pHFSet->Get(ATTR_PAGE_DYNAMIC)).GetValue(); - rParam.bShared = static_cast( pHFSet->Get(ATTR_PAGE_SHARED)).GetValue(); - rParam.nHeight = static_cast( pHFSet->Get(ATTR_PAGE_SIZE)).GetSize().Height(); - const SvxLRSpaceItem* pHFLR = &static_cast(pHFSet->Get(ATTR_LRSPACE)); + rParam.bEnable = pHFSet->Get(ATTR_PAGE_ON).GetValue(); + rParam.bDynamic = pHFSet->Get(ATTR_PAGE_DYNAMIC).GetValue(); + rParam.bShared = pHFSet->Get(ATTR_PAGE_SHARED).GetValue(); + rParam.nHeight = pHFSet->Get(ATTR_PAGE_SIZE).GetSize().Height(); + const SvxLRSpaceItem* pHFLR = &pHFSet->Get(ATTR_LRSPACE); long nTmp; nTmp = pHFLR->GetLeft(); rParam.nLeft = nTmp < 0 ? 0 : sal_uInt16(nTmp); nTmp = pHFLR->GetRight(); rParam.nRight = nTmp < 0 ? 0 : sal_uInt16(nTmp); - rParam.pBorder = static_cast (&pHFSet->Get(ATTR_BORDER)); - rParam.pBack = static_cast (&pHFSet->Get(ATTR_BACKGROUND)); - rParam.pShadow = static_cast(&pHFSet->Get(ATTR_SHADOW)); + rParam.pBorder = &pHFSet->Get(ATTR_BORDER); + rParam.pBack = &pHFSet->Get(ATTR_BACKGROUND); + rParam.pShadow = &pHFSet->Get(ATTR_SHADOW); // now back in the dialog: // rParam.nHeight += rParam.nDistance; // not in the dialog any more ??? @@ -799,39 +799,39 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions ) return; // TabPage "Page" - const SvxLRSpaceItem* pLRItem = static_cast( &pParamSet->Get( ATTR_LRSPACE ) ); + const SvxLRSpaceItem* pLRItem = &pParamSet->Get( ATTR_LRSPACE ); long nTmp; nTmp = pLRItem->GetLeft(); nLeftMargin = nTmp < 0 ? 0 : sal_uInt16(nTmp); nTmp = pLRItem->GetRight(); nRightMargin = nTmp < 0 ? 0 : sal_uInt16(nTmp); - const SvxULSpaceItem* pULItem = static_cast( &pParamSet->Get( ATTR_ULSPACE ) ); + const SvxULSpaceItem* pULItem = &pParamSet->Get( ATTR_ULSPACE ); nTopMargin = pULItem->GetUpper(); nBottomMargin = pULItem->GetLower(); - const SvxPageItem* pPageItem = static_cast( &pParamSet->Get( ATTR_PAGE ) ); + const SvxPageItem* pPageItem = &pParamSet->Get( ATTR_PAGE ); nPageUsage = pPageItem->GetPageUsage(); bLandscape = pPageItem->IsLandscape(); aFieldData.eNumType = pPageItem->GetNumType(); - bCenterHor = static_cast( pParamSet->Get(ATTR_PAGE_HORCENTER)).GetValue(); - bCenterVer = static_cast( pParamSet->Get(ATTR_PAGE_VERCENTER)).GetValue(); + bCenterHor = pParamSet->Get(ATTR_PAGE_HORCENTER).GetValue(); + bCenterVer = pParamSet->Get(ATTR_PAGE_VERCENTER).GetValue(); - aPageSize = static_cast( pParamSet->Get(ATTR_PAGE_SIZE)).GetSize(); + aPageSize = pParamSet->Get(ATTR_PAGE_SIZE).GetSize(); if ( !aPageSize.Width() || !aPageSize.Height() ) { OSL_FAIL("PageSize Null ?!?!?"); aPageSize = SvxPaperInfo::GetPaperSize( PAPER_A4 ); } - pBorderItem = static_cast (&pParamSet->Get(ATTR_BORDER) ); - pBackgroundItem = static_cast (&pParamSet->Get(ATTR_BACKGROUND) ); - pShadowItem = static_cast(&pParamSet->Get(ATTR_SHADOW) ); + pBorderItem = &pParamSet->Get(ATTR_BORDER); + pBackgroundItem = &pParamSet->Get(ATTR_BACKGROUND); + pShadowItem = &pParamSet->Get(ATTR_SHADOW); // TabPage "Headline" - aHdr.pLeft = static_cast( &pParamSet->Get(ATTR_PAGE_HEADERLEFT) ); // Content - aHdr.pRight = static_cast( &pParamSet->Get(ATTR_PAGE_HEADERRIGHT) ); + aHdr.pLeft = &pParamSet->Get(ATTR_PAGE_HEADERLEFT); // Content + aHdr.pRight = &pParamSet->Get(ATTR_PAGE_HEADERRIGHT); const SvxSetItem* pHeaderSetItem; const SfxItemSet* pHeaderSet = nullptr; @@ -840,14 +840,14 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions ) { pHeaderSet = &pHeaderSetItem->GetItemSet(); // Headline has space below - aHdr.nDistance = static_cast(pHeaderSet->Get(ATTR_ULSPACE)).GetLower(); + aHdr.nDistance = pHeaderSet->Get(ATTR_ULSPACE).GetLower(); } lcl_FillHFParam( aHdr, pHeaderSet ); // TabPage "Footline" - aFtr.pLeft = static_cast( &pParamSet->Get(ATTR_PAGE_FOOTERLEFT) ); // Content - aFtr.pRight = static_cast( &pParamSet->Get(ATTR_PAGE_FOOTERRIGHT) ); + aFtr.pLeft = &pParamSet->Get(ATTR_PAGE_FOOTERLEFT); // Content + aFtr.pRight = &pParamSet->Get(ATTR_PAGE_FOOTERRIGHT); const SvxSetItem* pFooterSetItem; const SfxItemSet* pFooterSet = nullptr; @@ -856,7 +856,7 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions ) { pFooterSet = &pFooterSetItem->GetItemSet(); // Footline has space above - aFtr.nDistance = static_cast(pFooterSet->Get(ATTR_ULSPACE)).GetUpper(); + aFtr.nDistance = pFooterSet->Get(ATTR_ULSPACE).GetUpper(); } lcl_FillHFParam( aFtr, pFooterSet ); @@ -872,20 +872,17 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions ) eState = pParamSet->GetItemState( ATTR_PAGE_SCALE, false, reinterpret_cast(&pScaleItem) ); if ( SfxItemState::DEFAULT == eState ) - pScaleItem = static_cast( - &pParamSet->GetPool()->GetDefaultItem( ATTR_PAGE_SCALE )); + pScaleItem = &pParamSet->GetPool()->GetDefaultItem( ATTR_PAGE_SCALE ); eState = pParamSet->GetItemState( ATTR_PAGE_SCALETO, false, reinterpret_cast(&pScaleToItem) ); if ( SfxItemState::DEFAULT == eState ) - pScaleToItem = static_cast( - &pParamSet->GetPool()->GetDefaultItem( ATTR_PAGE_SCALETO )); + pScaleToItem = &pParamSet->GetPool()->GetDefaultItem( ATTR_PAGE_SCALETO ); eState = pParamSet->GetItemState( ATTR_PAGE_SCALETOPAGES, false, reinterpret_cast(&pScaleToPagesItem) ); if ( SfxItemState::DEFAULT == eState ) - pScaleToPagesItem = static_cast( - &pParamSet->GetPool()->GetDefaultItem( ATTR_PAGE_SCALETOPAGES )); + pScaleToPagesItem = &pParamSet->GetPool()->GetDefaultItem( ATTR_PAGE_SCALETOPAGES ); OSL_ENSURE( pScaleItem && pScaleToItem && pScaleToPagesItem, "Missing ScaleItem! :-/" ); @@ -1690,7 +1687,7 @@ void ScPrintFunc::MakeEditEngine() // Default-Set for alignment pEditDefaults = new SfxItemSet( pEditEngine->GetEmptyItemSet() ); - const ScPatternAttr& rPattern = static_cast(pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)); + const ScPatternAttr& rPattern = pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN); rPattern.FillEditItemSet( pEditDefaults ); // FillEditItemSet adjusts font height to 1/100th mm, // but for header/footer twips is needed, as in the PatternAttr: @@ -1859,7 +1856,7 @@ long ScPrintFunc::DoNotes( long nNoteStart, bool bDoPrint, ScPreviewLocationData vcl::Font aMarkFont; ScAutoFontColorMode eColorMode = bUseStyleColor ? SC_AUTOCOL_DISPLAY : SC_AUTOCOL_PRINT; - static_cast(pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN)).GetFont( aMarkFont, eColorMode ); + pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN).GetFont( aMarkFont, eColorMode ); pDev->SetFont( aMarkFont ); long nMarkLen = pDev->GetTextWidth("GW99999:"); // without Space-Char, because it rarely arrives there @@ -2591,7 +2588,7 @@ void ScPrintFunc::ApplyPrintSettings() aEnumSize.Height() = nTemp; } Paper ePaper = SvxPaperInfo::GetSvxPaper( aEnumSize, MapUnit::MapTwip ); - sal_uInt16 nPaperBin = static_cast(pParamSet->Get(ATTR_PAGE_PAPERBIN)).GetValue(); + sal_uInt16 nPaperBin = pParamSet->Get(ATTR_PAGE_PAPERBIN).GetValue(); pPrinter->SetPaper( ePaper ); if ( PAPER_USER == ePaper ) diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index e481d4dd6576..a0eb6aec055d 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -283,10 +283,8 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) if ( pStyleSheet ) { SfxItemSet& rStyleSet = pStyleSheet->GetItemSet(); - sal_uInt16 nScale = static_cast( - rStyleSet.Get(ATTR_PAGE_SCALE)).GetValue(); - sal_uInt16 nPages = static_cast( - rStyleSet.Get(ATTR_PAGE_SCALETOPAGES)).GetValue(); + sal_uInt16 nScale = rStyleSet.Get(ATTR_PAGE_SCALE).GetValue(); + sal_uInt16 nPages = rStyleSet.Get(ATTR_PAGE_SCALETOPAGES).GetValue(); if ( nScale == 100 && nPages == 0 ) rSet.DisableItem( nWhich ); } diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 591e2ef0b1c7..c83dcc1fe6b1 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -899,9 +900,9 @@ void ScViewFunc::ApplyAttributes( const SfxItemSet* pDialogSet, if ( pDialogSet->GetItemState( ATTR_VALUE_FORMAT ) == SfxItemState::SET ) { // don't reset to default SYSTEM GENERAL if not intended sal_uInt32 nOldFormat = - static_cast(pOldSet->Get( ATTR_VALUE_FORMAT )).GetValue(); + pOldSet->Get( ATTR_VALUE_FORMAT ).GetValue(); sal_uInt32 nNewFormat = - static_cast(pDialogSet->Get( ATTR_VALUE_FORMAT )).GetValue(); + pDialogSet->Get( ATTR_VALUE_FORMAT ).GetValue(); if ( nNewFormat != nOldFormat ) { SvNumberFormatter* pFormatter = @@ -930,10 +931,10 @@ void ScViewFunc::ApplyAttributes( const SfxItemSet* pDialogSet, // font language has changed. Redo the online spelling. ResetAutoSpell(); - const SvxBoxItem& rOldOuter = static_cast (pOldSet->Get(ATTR_BORDER)); - const SvxBoxItem& rNewOuter = static_cast (pDialogSet->Get(ATTR_BORDER)); - const SvxBoxInfoItem& rOldInner = static_cast (pOldSet->Get(ATTR_BORDER_INNER)); - const SvxBoxInfoItem& rNewInner = static_cast (pDialogSet->Get(ATTR_BORDER_INNER)); + const SvxBoxItem& rOldOuter = pOldSet->Get(ATTR_BORDER); + const SvxBoxItem& rNewOuter = pDialogSet->Get(ATTR_BORDER); + const SvxBoxInfoItem& rOldInner = pOldSet->Get(ATTR_BORDER_INNER); + const SvxBoxInfoItem& rNewInner = pDialogSet->Get(ATTR_BORDER_INNER); SfxItemSet& rNewSet = aNewAttrs.GetItemSet(); SfxItemPool* pNewPool = rNewSet.GetPool(); -- cgit