From 262bde9b3eddf8937d3ce57939dddb1c20b1daaa Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 21 Jul 2014 15:53:14 +0200 Subject: simplify SfxItemPool::GetPresentation drop the ePresentation parameter, since all 4 of the callsites use SFX_ITEM_PRESENTATION_COMPLETE as the parameter value, and just inline the value into the method. Change-Id: I42c8eae82837c9f9d4edc886d7c760f57b129125 --- include/svl/itempool.hxx | 1 - include/svx/svdpool.hxx | 1 - sc/inc/docpool.hxx | 1 - sc/source/core/data/docpool.cxx | 137 +++++--------------------------------- svl/source/items/itempool.cxx | 3 +- svl/source/items/style.cxx | 3 +- svx/source/dialog/srchdlg.cxx | 1 - svx/source/svdraw/svdattr.cxx | 6 +- sw/source/core/crsr/crstrvl.cxx | 1 - sw/source/uibase/app/docstyle.cxx | 6 +- 10 files changed, 24 insertions(+), 136 deletions(-) diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx index edff1915954a..3fd8450c9de8 100644 --- a/include/svl/itempool.hxx +++ b/include/svl/itempool.hxx @@ -144,7 +144,6 @@ public: string representation of 'rItem' */ virtual SfxItemPresentation GetPresentation( const SfxPoolItem& rItem, - SfxItemPresentation ePresentation, SfxMapUnit ePresentationMetric, OUString& rText, const IntlWrapper * pIntlWrapper = 0 ) const; diff --git a/include/svx/svdpool.hxx b/include/svx/svdpool.hxx index 10e20c60b759..e5c91ba1b224 100644 --- a/include/svx/svdpool.hxx +++ b/include/svx/svdpool.hxx @@ -40,7 +40,6 @@ public: virtual SfxItemPool* Clone() const SAL_OVERRIDE; virtual SfxItemPresentation GetPresentation(const SfxPoolItem& rItem, - SfxItemPresentation ePresentation, SfxMapUnit ePresentationMetric, OUString& rText, const IntlWrapper * pIntlWrapper diff --git a/sc/inc/docpool.hxx b/sc/inc/docpool.hxx index e5be85894a18..ceff3d1210f3 100644 --- a/sc/inc/docpool.hxx +++ b/sc/inc/docpool.hxx @@ -60,7 +60,6 @@ public: void CellStyleCreated( const OUString& rName ); virtual SfxItemPresentation GetPresentation( const SfxPoolItem& rItem, - SfxItemPresentation ePresentation, SfxMapUnit ePresentationMetric, OUString& rText, const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE; diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index 062297e86284..33297310a022 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -793,7 +793,6 @@ static SfxItemPresentation lcl_HFPresentation SfxItemPresentation ScDocumentPool::GetPresentation( const SfxPoolItem& rItem, - SfxItemPresentation ePresentation, SfxMapUnit ePresentationMetric, OUString& rText, const IntlWrapper* pIntl ) const @@ -803,104 +802,39 @@ SfxItemPresentation ScDocumentPool::GetPresentation( OUString aStrNo ( ScGlobal::GetRscString(STR_NO) ); OUString aStrSep(": "); + SfxItemPresentation ePresentationRet = SFX_ITEM_PRESENTATION_COMPLETE; switch( nW ) { case ATTR_PAGE_TOPDOWN: - switch ( ePresentation ) - { - case SFX_ITEM_PRESENTATION_COMPLETE: rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_PRINTDIR) + aStrSep; -// break; // DURCHFALLEN!!! - case SFX_ITEM_PRESENTATION_NAMELESS: rText += ((const SfxBoolItem&)rItem).GetValue() ? ScGlobal::GetRscString(STR_SCATTR_PAGE_TOPDOWN) : ScGlobal::GetRscString(STR_SCATTR_PAGE_LEFTRIGHT) ; - break; - default: - { - // added to avoid warnings - } - } break; case ATTR_PAGE_HEADERS: - switch ( ePresentation ) - { - case SFX_ITEM_PRESENTATION_COMPLETE: rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_HEADERS) + aStrSep; -// break; // DURCHFALLEN!!! - case SFX_ITEM_PRESENTATION_NAMELESS: rText += ((const SfxBoolItem&)rItem).GetValue() ? aStrYes : aStrNo ; - break; - default: - { - // added to avoid warnings - } - } break; case ATTR_PAGE_NULLVALS: - switch ( ePresentation ) - { - case SFX_ITEM_PRESENTATION_COMPLETE: rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_NULLVALS) + aStrSep; -// break; // DURCHFALLEN!!! - case SFX_ITEM_PRESENTATION_NAMELESS: rText += ((const SfxBoolItem&)rItem).GetValue() ? aStrYes : aStrNo ; - break; - default: - { - // added to avoid warnings - } - } break; case ATTR_PAGE_FORMULAS: - switch ( ePresentation ) - { - case SFX_ITEM_PRESENTATION_COMPLETE: rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_FORMULAS) + aStrSep; -// break; // DURCHFALLEN!!! - case SFX_ITEM_PRESENTATION_NAMELESS: rText += ((const SfxBoolItem&)rItem).GetValue() ? aStrYes : aStrNo ; - break; - default: - { - // added to avoid warnings - } - } break; case ATTR_PAGE_NOTES: - switch ( ePresentation ) - { - case SFX_ITEM_PRESENTATION_COMPLETE: rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_NOTES) + aStrSep; -// break; // DURCHFALLEN!!! - case SFX_ITEM_PRESENTATION_NAMELESS: rText += ((const SfxBoolItem&)rItem).GetValue() ? aStrYes : aStrNo ; - break; - default: - { - // added to avoid warnings - } - } break; case ATTR_PAGE_GRID: - switch ( ePresentation ) - { - case SFX_ITEM_PRESENTATION_COMPLETE: rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_GRID) + aStrSep; -// break; // DURCHFALLEN!!! - case SFX_ITEM_PRESENTATION_NAMELESS: rText += ((const SfxBoolItem&)rItem).GetValue() ? aStrYes : aStrNo ; - break; - default: - { - // added to avoid warnings - } - } break; case ATTR_PAGE_SCALETOPAGES: @@ -909,29 +843,14 @@ SfxItemPresentation ScDocumentPool::GetPresentation( if( nPagNo ) { - switch ( ePresentation ) - { - case SFX_ITEM_PRESENTATION_COMPLETE: - { - rText = ScGlobal::GetRscString( STR_SCATTR_PAGE_SCALETOPAGES ) + aStrSep; - } -// break; // DURCHFALLEN!!! - case SFX_ITEM_PRESENTATION_NAMELESS: - { - OUString aPages( ScGlobal::GetRscString( STR_SCATTR_PAGE_SCALE_PAGES ) ); - aPages = aPages.replaceFirst( "%1", OUString::number( nPagNo ) ); - rText += aPages; - } - break; - default: - { - // added to avoid warnings - } - } + rText = ScGlobal::GetRscString( STR_SCATTR_PAGE_SCALETOPAGES ) + aStrSep; + OUString aPages( ScGlobal::GetRscString( STR_SCATTR_PAGE_SCALE_PAGES ) ); + aPages = aPages.replaceFirst( "%1", OUString::number( nPagNo ) ); + rText += aPages; } else { - ePresentation = SFX_ITEM_PRESENTATION_NONE; + ePresentationRet = SFX_ITEM_PRESENTATION_NONE; } } break; @@ -942,23 +861,12 @@ SfxItemPresentation ScDocumentPool::GetPresentation( if( nPagNo ) { - switch ( ePresentation ) - { - case SFX_ITEM_PRESENTATION_COMPLETE: - rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_FIRSTPAGENO) + aStrSep; -// break; // DURCHFALLEN!!! - case SFX_ITEM_PRESENTATION_NAMELESS: - rText += OUString::number( nPagNo ); - break; - default: - { - // added to avoid warnings - } - } + rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_FIRSTPAGENO) + aStrSep; + rText += OUString::number( nPagNo ); } else { - ePresentation = SFX_ITEM_PRESENTATION_NONE; + ePresentationRet = SFX_ITEM_PRESENTATION_NONE; } } break; @@ -969,24 +877,13 @@ SfxItemPresentation ScDocumentPool::GetPresentation( if( nPercent ) { - switch ( ePresentation ) - { - case SFX_ITEM_PRESENTATION_COMPLETE: - rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_SCALE) + aStrSep; -// break; // DURCHFALLEN!!! - case SFX_ITEM_PRESENTATION_NAMELESS: - rText = rText + unicode::formatPercent(nPercent, - Application::GetSettings().GetUILanguageTag()); - break; - default: - { - // added to avoid warnings - } - } + rText = ScGlobal::GetRscString(STR_SCATTR_PAGE_SCALE) + aStrSep; + rText = rText + unicode::formatPercent(nPercent, + Application::GetSettings().GetUILanguageTag()); } else { - ePresentation = SFX_ITEM_PRESENTATION_NONE; + ePresentationRet = SFX_ITEM_PRESENTATION_NONE; } } break; @@ -995,7 +892,7 @@ SfxItemPresentation ScDocumentPool::GetPresentation( { OUString aBuffer; - if( lcl_HFPresentation( rItem, ePresentation, GetMetric( nW ), ePresentationMetric, aBuffer, pIntl ) != SFX_ITEM_PRESENTATION_NONE ) + if( lcl_HFPresentation( rItem, SFX_ITEM_PRESENTATION_COMPLETE, GetMetric( nW ), ePresentationMetric, aBuffer, pIntl ) != SFX_ITEM_PRESENTATION_NONE ) { rText = ScGlobal::GetRscString(STR_HEADER) + " ( " + aBuffer + " ) "; } @@ -1006,7 +903,7 @@ SfxItemPresentation ScDocumentPool::GetPresentation( { OUString aBuffer; - if( lcl_HFPresentation( rItem, ePresentation, GetMetric( nW ), ePresentationMetric, aBuffer, pIntl ) != SFX_ITEM_PRESENTATION_NONE ) + if( lcl_HFPresentation( rItem, SFX_ITEM_PRESENTATION_COMPLETE, GetMetric( nW ), ePresentationMetric, aBuffer, pIntl ) != SFX_ITEM_PRESENTATION_NONE ) { rText = ScGlobal::GetRscString(STR_FOOTER) + " ( " + aBuffer + " ) "; } @@ -1016,11 +913,11 @@ SfxItemPresentation ScDocumentPool::GetPresentation( default: if ( !pIntl ) pIntl = ScGlobal::GetScIntlWrapper(); - ePresentation = rItem.GetPresentation( ePresentation, GetMetric( nW ), ePresentationMetric, rText, pIntl ); + ePresentationRet = rItem.GetPresentation( SFX_ITEM_PRESENTATION_COMPLETE, GetMetric( nW ), ePresentationMetric, rText, pIntl ); break; } - return ePresentation; + return ePresentationRet; } SfxMapUnit ScDocumentPool::GetMetric( sal_uInt16 nWhich ) const diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx index 96c318b1782d..55084997e4a5 100644 --- a/svl/source/items/itempool.cxx +++ b/svl/source/items/itempool.cxx @@ -507,14 +507,13 @@ const OUString& SfxItemPool::GetName() const SfxItemPresentation SfxItemPool::GetPresentation ( const SfxPoolItem& rItem, - SfxItemPresentation ePresent, SfxMapUnit eMetric, OUString& rText, const IntlWrapper * pIntlWrapper ) const { return rItem.GetPresentation( - ePresent, GetMetric(rItem.Which()), eMetric, rText, pIntlWrapper ); + SFX_ITEM_PRESENTATION_COMPLETE, GetMetric(rItem.Which()), eMetric, rText, pIntlWrapper ); } diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 369bebe701eb..9d212345711e 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -343,8 +343,7 @@ OUString SfxStyleSheetBase::GetDescription( SfxMapUnit eMetric ) if ( !IsInvalidItem( pItem ) && pPool->GetPool().GetPresentation( - *pItem, SFX_ITEM_PRESENTATION_COMPLETE, - eMetric, aItemPresentation, &aIntlWrapper ) ) + *pItem, eMetric, aItemPresentation, &aIntlWrapper ) ) { if ( !aDesc.isEmpty() && !aItemPresentation.isEmpty() ) aDesc += " + "; diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index c3c39120a278..d59c09067e0d 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -2058,7 +2058,6 @@ OUString& SvxSearchDialog::BuildAttrText_Impl( OUString& rStr, { OUString aStr; rPool.GetPresentation( *rItem.pItem, - SFX_ITEM_PRESENTATION_COMPLETE, eMapUnit, aStr ); rStr += aStr; } diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 6ba59252e8a8..0ddb21509427 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -396,7 +396,7 @@ SdrItemPool::~SdrItemPool() } SfxItemPresentation SdrItemPool::GetPresentation( - const SfxPoolItem& rItem, SfxItemPresentation ePresentation, + const SfxPoolItem& rItem, SfxMapUnit ePresentationMetric, OUString& rText, const IntlWrapper * pIntlWrapper) const { @@ -411,10 +411,10 @@ SfxItemPresentation SdrItemPool::GetPresentation( TakeItemName(nWhich, aStr); rText = aStr + " " + rText; - return ePresentation; + return SFX_ITEM_PRESENTATION_COMPLETE; } } - return XOutdevItemPool::GetPresentation(rItem,ePresentation,ePresentationMetric,rText,pIntlWrapper); + return XOutdevItemPool::GetPresentation(rItem,ePresentationMetric,rText,pIntlWrapper); } void SdrItemPool::TakeItemName(sal_uInt16 nWhich, OUString& rItemName) diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 90c1713f716a..7d0dfdc834a8 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -1569,7 +1569,6 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt, { OUString aStr; GetDoc()->GetAttrPool().GetPresentation( *pItem, - SFX_ITEM_PRESENTATION_COMPLETE, SFX_MAPUNIT_CM, aStr ); if (!sAttrs.isEmpty()) sAttrs += ", "; diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index d74956eac813..7accf667fefa 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -763,8 +763,7 @@ OUString SwDocStyleSheet::GetDescription(SfxMapUnit eUnit) OUString aItemPresentation; if ( !IsInvalidItem( pItem ) && pPool->GetPool().GetPresentation( - *pItem, SFX_ITEM_PRESENTATION_COMPLETE, - eUnit, aItemPresentation, &aIntlWrapper ) ) + *pItem, eUnit, aItemPresentation, &aIntlWrapper ) ) { if ( !aDesc.isEmpty() && !aItemPresentation.isEmpty() ) aDesc += sPlus; @@ -817,8 +816,7 @@ OUString SwDocStyleSheet::GetDescription(SfxMapUnit eUnit) OUString aItemPresentation; if ( !IsInvalidItem( pItem ) && pPool->GetPool().GetPresentation( - *pItem, SFX_ITEM_PRESENTATION_COMPLETE, - eUnit, aItemPresentation, &aIntlWrapper ) ) + *pItem, eUnit, aItemPresentation, &aIntlWrapper ) ) { bool bIsDefault = false; switch ( pItem->Which() ) -- cgit