diff options
author | Noel Grandin <noel@peralex.com> | 2014-07-21 15:53:14 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-07-23 13:26:17 +0200 |
commit | 262bde9b3eddf8937d3ce57939dddb1c20b1daaa (patch) | |
tree | 00f6876fb51bd8ca0e7e66cb4d3b765f4e30a5d6 /sc | |
parent | f2940a4bfffec5bc34fb03cb32205bff4708a027 (diff) |
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
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/docpool.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/docpool.cxx | 137 |
2 files changed, 17 insertions, 121 deletions
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 |