From 46087fd1b7186cd181275693e72494c4a07c0c38 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 16 Feb 2012 09:47:29 +0000 Subject: fix up const malformed copy ctors and operator= --- sd/source/filter/eppt/pptx-text.cxx | 19 +++++++++++-------- sd/source/filter/eppt/text.hxx | 12 ++++++------ 2 files changed, 17 insertions(+), 14 deletions(-) (limited to 'sd') diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx index 470ee9d4f78d..db96148eb327 100644 --- a/sd/source/filter/eppt/pptx-text.cxx +++ b/sd/source/filter/eppt/pptx-text.cxx @@ -206,7 +206,7 @@ PortionObj::PortionObj( ::com::sun::star::uno::Reference< ::com::sun::star::text } } -PortionObj::PortionObj( PortionObj& rPortionObj ) +PortionObj::PortionObj( const PortionObj& rPortionObj ) : PropStateValue( rPortionObj ) { ImplConstruct( rPortionObj ); @@ -434,7 +434,7 @@ void PortionObj::ImplClear() delete[] mpText; } -void PortionObj::ImplConstruct( PortionObj& rPortionObj ) +void PortionObj::ImplConstruct( const PortionObj& rPortionObj ) { mbLastPortion = rPortionObj.mbLastPortion; mnTextSize = rPortionObj.mnTextSize; @@ -628,7 +628,7 @@ sal_uInt32 PortionObj::ImplGetTextField( ::com::sun::star::uno::Reference< ::com return nRetValue; } -PortionObj& PortionObj::operator=( PortionObj& rPortionObj ) +PortionObj& PortionObj::operator=( const PortionObj& rPortionObj ) { if ( this != &rPortionObj ) { @@ -704,7 +704,7 @@ ParagraphObj::ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun:: } } -ParagraphObj::ParagraphObj( ParagraphObj& rObj ) +ParagraphObj::ParagraphObj( const ParagraphObj& rObj ) : List() , PropStateValue() , SOParagraph() @@ -1174,7 +1174,7 @@ void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider& rBuProv, sal_Boo meBiDi = ePropState; } -void ParagraphObj::ImplConstruct( ParagraphObj& rParagraphObj ) +void ParagraphObj::ImplConstruct( const ParagraphObj& rParagraphObj ) { mnTextSize = rParagraphObj.mnTextSize; mnTextAdjust = rParagraphObj.mnTextAdjust; @@ -1187,8 +1187,11 @@ void ParagraphObj::ImplConstruct( ParagraphObj& rParagraphObj ) mbForbiddenRules = rParagraphObj.mbForbiddenRules; mnBiDi = rParagraphObj.mnBiDi; - for ( void* pPtr = rParagraphObj.First(); pPtr; pPtr = rParagraphObj.Next() ) - Insert( new PortionObj( *(PortionObj*)pPtr ), LIST_APPEND ); + { + ParagraphObj& rConstApiLossage = const_cast(rParagraphObj); + for ( const void* pPtr = rConstApiLossage.First(); pPtr; pPtr = rConstApiLossage.Next() ) + Insert( new PortionObj( *static_cast(pPtr) ), LIST_APPEND ); + } maTabStop = rParagraphObj.maTabStop; bExtendedParameters = rParagraphObj.bExtendedParameters; @@ -1221,7 +1224,7 @@ sal_uInt32 ParagraphObj::ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosi return mnTextSize; } -ParagraphObj& ParagraphObj::operator=( ParagraphObj& rParagraphObj ) +ParagraphObj& ParagraphObj::operator=( const ParagraphObj& rParagraphObj ) { if ( this != &rParagraphObj ) { diff --git a/sd/source/filter/eppt/text.hxx b/sd/source/filter/eppt/text.hxx index 4deab90d9158..3d0d0f2184f0 100644 --- a/sd/source/filter/eppt/text.hxx +++ b/sd/source/filter/eppt/text.hxx @@ -118,7 +118,7 @@ class PortionObj : public PropStateValue protected : void ImplClear(); - void ImplConstruct( PortionObj& rPortionObj ); + void ImplConstruct( const PortionObj& rPortionObj ); sal_uInt32 ImplGetTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRangeRef, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef, String& rURL ); sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition ); @@ -151,13 +151,13 @@ class PortionObj : public PropStateValue sal_Bool bLast, FontCollection& rFontCollection ); PortionObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef, FontCollection& rFontCollection ); - PortionObj( PortionObj& rPortionObj ); + PortionObj( const PortionObj& rPortionObj ); ~PortionObj(); void Write( SvStream* pStrm, sal_Bool bLast ); sal_uInt32 Count() const { return mnTextSize; }; - PortionObj& operator=( PortionObj& rPortionObj ); + PortionObj& operator=( const PortionObj& rPortionObj ); }; struct ParaFlags @@ -178,7 +178,7 @@ class ParagraphObj : public List, public PropStateValue, public SOParagraph protected : - void ImplConstruct( ParagraphObj& rParagraphObj ); + void ImplConstruct( const ParagraphObj& rParagraphObj ); void ImplClear(); sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition ); void ImplGetParagraphValues( PPTExBulletProvider& rBuProv, sal_Bool bGetPropStateValue = sal_False ); @@ -215,7 +215,7 @@ class ParagraphObj : public List, public PropStateValue, public SOParagraph ParagraphObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContentRef, ParaFlags, FontCollection& rFontCollection, PPTExBulletProvider& rBuProv ); - ParagraphObj( ParagraphObj& rParargraphObj ); + ParagraphObj( const ParagraphObj& rParargraphObj ); ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef, PPTExBulletProvider& rBuProv ); @@ -225,7 +225,7 @@ class ParagraphObj : public List, public PropStateValue, public SOParagraph void Write( SvStream* pStrm ); sal_uInt32 Count() const { return mnTextSize; }; - ParagraphObj& operator=( ParagraphObj& rParagraphObj ); + ParagraphObj& operator=( const ParagraphObj& rParagraphObj ); }; struct ImplTextObj -- cgit