summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-07-24 11:31:39 +0200
committerNoel Grandin <noel@peralex.com>2014-07-29 11:04:01 +0200
commit7e018afaf74ab118fe21d92edc9fb95ddea5d61b (patch)
tree740eb08b1a2841f35f68e8f6257d7abd46d09219 /sc
parent86c0a56a9ee2e3d15286b11afad65568d1a87c11 (diff)
simplify return argument of SfxPoolItem::GetPresentation
since all two of the actual call-sites only care about whether it is a valid presentation or not, not what kind of presentation it is. Change-Id: I75717c88878d37b2897741b0c833ff283b3fee59
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/attrib.hxx10
-rw-r--r--sc/inc/docpool.hxx2
-rw-r--r--sc/source/core/data/attrib.cxx35
-rw-r--r--sc/source/core/data/docpool.cxx23
4 files changed, 35 insertions, 35 deletions
diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx
index df7ed0106b6c..ab083065bc4e 100644
--- a/sc/inc/attrib.hxx
+++ b/sc/inc/attrib.hxx
@@ -111,7 +111,7 @@ public:
virtual ~ScProtectionAttr();
virtual OUString GetValueText() const;
- virtual SfxItemPresentation GetPresentation(
+ virtual bool GetPresentation(
SfxItemPresentation ePres,
SfxMapUnit eCoreMetric,
SfxMapUnit ePresMetric,
@@ -164,7 +164,7 @@ public:
// "pure virtual methods" from SfxPoolItem
virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ virtual bool GetPresentation( SfxItemPresentation ePres,
SfxMapUnit eCoreMetric,
SfxMapUnit ePresMetric,
OUString &rText,
@@ -219,7 +219,7 @@ public:
// "pure virtual Methoden" from SfxPoolItem
virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ virtual bool GetPresentation( SfxItemPresentation ePres,
SfxMapUnit eCoreMetric,
SfxMapUnit ePresMetric,
OUString &rText,
@@ -290,7 +290,7 @@ public:
virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const SAL_OVERRIDE;
virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const SAL_OVERRIDE;
- virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ virtual bool GetPresentation( SfxItemPresentation ePres,
SfxMapUnit eCoreMetric,
SfxMapUnit ePresMetric,
OUString& rText,
@@ -350,7 +350,7 @@ public:
{ mnWidth = nWidth; mnHeight = nHeight; }
inline void SetInvalid() { mnWidth = mnHeight = 0; }
- virtual SfxItemPresentation GetPresentation(
+ virtual bool GetPresentation(
SfxItemPresentation ePresentation,
SfxMapUnit, SfxMapUnit,
OUString& rText,
diff --git a/sc/inc/docpool.hxx b/sc/inc/docpool.hxx
index ceff3d1210f3..db65148a391b 100644
--- a/sc/inc/docpool.hxx
+++ b/sc/inc/docpool.hxx
@@ -58,7 +58,7 @@ public:
void StyleDeleted( ScStyleSheet* pStyle ); // delete templates(?) in organizer
void CellStyleCreated( const OUString& rName );
- virtual SfxItemPresentation GetPresentation(
+ virtual bool GetPresentation(
const SfxPoolItem& rItem,
SfxMapUnit ePresentationMetric,
OUString& rText,
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index 5ff9f05736f8..f0edf65caa28 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -288,7 +288,7 @@ OUString ScProtectionAttr::GetValueText() const
return aValue;
}
-SfxItemPresentation ScProtectionAttr::GetPresentation
+bool ScProtectionAttr::GetPresentation
(
SfxItemPresentation ePres,
SfxMapUnit /* eCoreMetric */,
@@ -332,7 +332,7 @@ SfxItemPresentation ScProtectionAttr::GetPresentation
ePres = SFX_ITEM_PRESENTATION_NONE;
}
- return ePres;
+ return ePres != SFX_ITEM_PRESENTATION_NONE;
}
bool ScProtectionAttr::operator==( const SfxPoolItem& rItem ) const
@@ -403,7 +403,7 @@ SfxPoolItem* ScRangeItem::Clone( SfxItemPool* ) const
return new ScRangeItem( *this );
}
-SfxItemPresentation ScRangeItem::GetPresentation
+bool ScRangeItem::GetPresentation
(
SfxItemPresentation ePres,
SfxMapUnit /* eCoreUnit */,
@@ -433,7 +433,7 @@ SfxItemPresentation ScRangeItem::GetPresentation
}
}
- return ePres;
+ return ePres != SFX_ITEM_PRESENTATION_NONE;
}
// ScTableListItem - List from Tables (-numbers)
@@ -503,7 +503,7 @@ SfxPoolItem* ScTableListItem::Clone( SfxItemPool* ) const
return new ScTableListItem( *this );
}
-SfxItemPresentation ScTableListItem::GetPresentation
+bool ScTableListItem::GetPresentation
(
SfxItemPresentation ePres,
SfxMapUnit /* eCoreUnit */,
@@ -530,11 +530,11 @@ SfxItemPresentation ScTableListItem::GetPresentation
}
rText += ")";
}
- return ePres;
+ return true;
case SFX_ITEM_PRESENTATION_COMPLETE:
rText = OUString();
- return SFX_ITEM_PRESENTATION_NONE;
+ return false;
default:
{
@@ -542,7 +542,7 @@ SfxItemPresentation ScTableListItem::GetPresentation
}
}
- return SFX_ITEM_PRESENTATION_NONE;
+ return false;
}
// ScPageHFItem - Dates from the Head and Foot lines
@@ -842,7 +842,7 @@ ScViewObjectModeItem::~ScViewObjectModeItem()
{
}
-SfxItemPresentation ScViewObjectModeItem::GetPresentation
+bool ScViewObjectModeItem::GetPresentation
(
SfxItemPresentation ePres,
SfxMapUnit /* eCoreUnit */,
@@ -879,15 +879,14 @@ SfxItemPresentation ScViewObjectModeItem::GetPresentation
case SFX_ITEM_PRESENTATION_NAMELESS:
rText += ScGlobal::GetRscString(STR_VOBJ_MODE_SHOW+GetValue());
+ return true;
break;
- default:
- {
+ default: break;
// added to avoid warnings
- }
}
- return ePres;
+ return false;
}
OUString ScViewObjectModeItem::GetValueText( sal_uInt16 nVal ) const
@@ -1022,12 +1021,12 @@ void lclAppendScalePageCount( OUString& rText, sal_uInt16 nPages )
}
} // namespace
-SfxItemPresentation ScPageScaleToItem::GetPresentation(
+bool ScPageScaleToItem::GetPresentation(
SfxItemPresentation ePres, SfxMapUnit, SfxMapUnit, OUString& rText, const IntlWrapper* ) const
{
rText = OUString();
if( !IsValid() || (ePres == SFX_ITEM_PRESENTATION_NONE) )
- return SFX_ITEM_PRESENTATION_NONE;
+ return false;
OUString aName( ScGlobal::GetRscString( STR_SCATTR_PAGE_SCALETO ) );
OUString aValue( ScGlobal::GetRscString( STR_SCATTR_PAGE_SCALE_WIDTH ) );
@@ -1038,21 +1037,23 @@ SfxItemPresentation ScPageScaleToItem::GetPresentation(
switch( ePres )
{
case SFX_ITEM_PRESENTATION_NONE:
+ return false;
break;
case SFX_ITEM_PRESENTATION_NAMELESS:
rText = aValue;
+ return true;
break;
case SFX_ITEM_PRESENTATION_COMPLETE:
rText = aName + " (" + aValue + ")";
+ return true;
break;
default:
OSL_FAIL( "ScPageScaleToItem::GetPresentation - unknown presentation mode" );
- ePres = SFX_ITEM_PRESENTATION_NONE;
}
- return ePres;
+ return false;
}
bool ScPageScaleToItem::QueryValue( uno::Any& rAny, sal_uInt8 nMemberId ) const
diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index 33297310a022..ee6d55788317 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -690,10 +690,9 @@ SfxItemPool* ScDocumentPool::Clone() const
return new SfxItemPool (*this, true);
}
-static SfxItemPresentation lcl_HFPresentation
+static bool lcl_HFPresentation
(
const SfxPoolItem& rItem,
- SfxItemPresentation ePresentation,
SfxMapUnit eCoreMetric,
SfxMapUnit ePresentationMetric,
OUString& rText,
@@ -706,7 +705,7 @@ static SfxItemPresentation lcl_HFPresentation
if ( SFX_ITEM_SET == rSet.GetItemState(ATTR_PAGE_ON,false,&pItem) )
{
if( false == ((const SfxBoolItem*)pItem)->GetValue() )
- return SFX_ITEM_PRESENTATION_NONE;
+ return false;
}
SfxItemIter aIter( rSet );
@@ -773,7 +772,7 @@ static SfxItemPresentation lcl_HFPresentation
default:
if ( !pIntl )
pIntl = ScGlobal::GetScIntlWrapper();
- pItem->GetPresentation( ePresentation, eCoreMetric, ePresentationMetric, aText, pIntl );
+ pItem->GetPresentation( SFX_ITEM_PRESENTATION_COMPLETE, eCoreMetric, ePresentationMetric, aText, pIntl );
}
@@ -788,10 +787,10 @@ static SfxItemPresentation lcl_HFPresentation
rText = comphelper::string::stripEnd(rText, ' ');
rText = comphelper::string::stripEnd(rText, '+');
rText = comphelper::string::stripEnd(rText, ' ');
- return ePresentation;
+ return true;
}
-SfxItemPresentation ScDocumentPool::GetPresentation(
+bool ScDocumentPool::GetPresentation(
const SfxPoolItem& rItem,
SfxMapUnit ePresentationMetric,
OUString& rText,
@@ -802,7 +801,7 @@ SfxItemPresentation ScDocumentPool::GetPresentation(
OUString aStrNo ( ScGlobal::GetRscString(STR_NO) );
OUString aStrSep(": ");
- SfxItemPresentation ePresentationRet = SFX_ITEM_PRESENTATION_COMPLETE;
+ bool ePresentationRet = true;
switch( nW )
{
case ATTR_PAGE_TOPDOWN:
@@ -850,7 +849,7 @@ SfxItemPresentation ScDocumentPool::GetPresentation(
}
else
{
- ePresentationRet = SFX_ITEM_PRESENTATION_NONE;
+ ePresentationRet = false;
}
}
break;
@@ -866,7 +865,7 @@ SfxItemPresentation ScDocumentPool::GetPresentation(
}
else
{
- ePresentationRet = SFX_ITEM_PRESENTATION_NONE;
+ ePresentationRet = false;
}
}
break;
@@ -883,7 +882,7 @@ SfxItemPresentation ScDocumentPool::GetPresentation(
}
else
{
- ePresentationRet = SFX_ITEM_PRESENTATION_NONE;
+ ePresentationRet = false;
}
}
break;
@@ -892,7 +891,7 @@ SfxItemPresentation ScDocumentPool::GetPresentation(
{
OUString aBuffer;
- if( lcl_HFPresentation( rItem, SFX_ITEM_PRESENTATION_COMPLETE, GetMetric( nW ), ePresentationMetric, aBuffer, pIntl ) != SFX_ITEM_PRESENTATION_NONE )
+ if( lcl_HFPresentation( rItem, GetMetric( nW ), ePresentationMetric, aBuffer, pIntl ) )
{
rText = ScGlobal::GetRscString(STR_HEADER) + " ( " + aBuffer + " ) ";
}
@@ -903,7 +902,7 @@ SfxItemPresentation ScDocumentPool::GetPresentation(
{
OUString aBuffer;
- if( lcl_HFPresentation( rItem, SFX_ITEM_PRESENTATION_COMPLETE, GetMetric( nW ), ePresentationMetric, aBuffer, pIntl ) != SFX_ITEM_PRESENTATION_NONE )
+ if( lcl_HFPresentation( rItem, GetMetric( nW ), ePresentationMetric, aBuffer, pIntl ) )
{
rText = ScGlobal::GetRscString(STR_FOOTER) + " ( " + aBuffer + " ) ";
}