diff options
author | Noel Grandin <noel@peralex.com> | 2014-09-18 15:10:54 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-09-23 17:27:47 +0200 |
commit | 23e1fc277d5651babce17bb74408ef6505f101d2 (patch) | |
tree | edf64a973766400f870095f4ecd25784bfea6ba5 /xmloff | |
parent | 7f895dfbf5fb084d747e52db678d75e3273cd825 (diff) |
loplugin: cstylecast, update PTR_CAST macro to use static_cast
I introduce a template method into the PTR_CAST machinery
to maintain constness.
There is now a FIXME in sd/../docshell.cxx because I needed
to use a dynamic_cast there to work around the games it appears
to be playing with OLE in-place activation.
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>,
dropping the GCC-extension, unnecessary use of typeof from tools/rtti.hxx
Change-Id: Iba5ace1aa27e02b34fcc91af1e658c43371afd03
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/draw/ximpshap.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/draw/ximpstyl.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/text/XMLTextFrameContext.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/text/txtimp.cxx | 16 |
4 files changed, 12 insertions, 12 deletions
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 3a45d5781d2b..f5595f7d68b2 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -639,7 +639,7 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */) if( pStyle && pStyle->ISA(XMLShapeStyleContext) ) { - pDocStyle = PTR_CAST( XMLShapeStyleContext, pStyle ); + pDocStyle = const_cast<XMLShapeStyleContext*>(PTR_CAST( XMLShapeStyleContext, pStyle )); if( pDocStyle->GetStyle().is() ) { @@ -735,7 +735,7 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */) break; const SvXMLStyleContext* pTempStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(XML_STYLE_FAMILY_TEXT_PARAGRAPH, maTextStyleName); - XMLPropStyleContext* pStyle = PTR_CAST( XMLPropStyleContext, pTempStyle ); // use temp var, PTR_CAST is a bad macro, FindStyleChildContext will be called twice + XMLPropStyleContext* pStyle = const_cast<XMLPropStyleContext*>(PTR_CAST( XMLPropStyleContext, pTempStyle )); // use temp var, PTR_CAST is a bad macro, FindStyleChildContext will be called twice if( pStyle == NULL ) break; diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx index b1e4c03bf473..83c2c481bacf 100644 --- a/xmloff/source/draw/ximpstyl.cxx +++ b/xmloff/source/draw/ximpstyl.cxx @@ -222,7 +222,7 @@ void SdXMLDrawingPageStyleContext::Finish( bool bOverwrite ) sal_Int32 nStyle = 0; - SdXMLNumberFormatImportContext* pSdNumStyle = + const SdXMLNumberFormatImportContext* pSdNumStyle = PTR_CAST( SdXMLNumberFormatImportContext, GetStyles()->FindStyleChildContext( XML_STYLE_FAMILY_DATA_STYLE, sStyleName, true ) ); diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 62ea125e1253..166813287f0c 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -1435,7 +1435,7 @@ void XMLTextFrameContext::EndElement() SvXMLImportContext const*const pContext = (pMultiContext) ? &pMultiContext : &m_xImplContext; - XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext ); + XMLTextFrameContext_Impl *pImpl = const_cast<XMLTextFrameContext_Impl*>(PTR_CAST( XMLTextFrameContext_Impl, pContext )); assert(!pMultiContext || pImpl); if( pImpl ) { diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 297b871afd5c..527566712000 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -1224,7 +1224,7 @@ OUString XMLTextImportHelper::ConvertStarFonts( const OUString& rChars, ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)-> FindStyleChildContext( nFamily, rStyleName, true ); - pStyle = PTR_CAST( XMLTextStyleContext,pTempStyle); + pStyle = const_cast<XMLTextStyleContext*>(PTR_CAST( XMLTextStyleContext,pTempStyle)); } if( pStyle ) @@ -1433,7 +1433,7 @@ OUString XMLTextImportHelper::SetStyleAndAttrs( const SvXMLStyleContext* pTempStyle = ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)-> FindStyleChildContext( nFamily, sStyleName, true ); - pStyle = PTR_CAST( XMLTextStyleContext,pTempStyle); + pStyle = const_cast<XMLTextStyleContext*>(PTR_CAST( XMLTextStyleContext,pTempStyle)); } if( pStyle ) sStyleName = pStyle->GetParentName(); @@ -2120,7 +2120,7 @@ void XMLTextImportHelper::SetRuby( ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)-> FindStyleChildContext( XML_STYLE_FAMILY_TEXT_RUBY, rStyleName, true ); - pStyle = PTR_CAST(XMLPropStyleContext,pTempStyle); + pStyle = const_cast<XMLPropStyleContext*>(PTR_CAST(XMLPropStyleContext,pTempStyle)); if (NULL != pStyle) pStyle->FillPropertySet( xPropSet ); @@ -2361,14 +2361,14 @@ sal_Int32 XMLTextImportHelper::GetDataStyleKey(const OUString& sStyleName, // first check if it's a impress and draw only number format // this is needed since its also a SvXMLNumFormatContext, // that was needed to support them for controls in impress/draw also - SdXMLNumberFormatImportContext* pSdNumStyle = PTR_CAST( SdXMLNumberFormatImportContext, pStyle ); + const SdXMLNumberFormatImportContext* pSdNumStyle = PTR_CAST( SdXMLNumberFormatImportContext, pStyle ); if( pSdNumStyle ) { return pSdNumStyle->GetDrawKey(); } else { - SvXMLNumFormatContext* pNumStyle = PTR_CAST( SvXMLNumFormatContext, pStyle ); + SvXMLNumFormatContext* pNumStyle = const_cast<SvXMLNumFormatContext*>(PTR_CAST( SvXMLNumFormatContext, pStyle )); if( pNumStyle ) { if( pIsSystemLanguage != NULL ) @@ -2405,7 +2405,7 @@ XMLPropStyleContext *XMLTextImportHelper::FindAutoFrameStyle( const OUString& rN ((SvXMLStylesContext *)&m_pImpl->m_xAutoStyles)-> FindStyleChildContext( XML_STYLE_FAMILY_SD_GRAPHICS_ID, rName, true ); - pStyle = PTR_CAST( XMLPropStyleContext ,pTempStyle); + pStyle = const_cast<XMLPropStyleContext*>(PTR_CAST( XMLPropStyleContext ,pTempStyle)); } return pStyle; @@ -2422,7 +2422,7 @@ XMLPropStyleContext* XMLTextImportHelper::FindSectionStyle( FindStyleChildContext( XML_STYLE_FAMILY_TEXT_SECTION, rName, true ); - pStyle = PTR_CAST( XMLPropStyleContext,pTempStyle); + pStyle = const_cast<XMLPropStyleContext*>(PTR_CAST( XMLPropStyleContext,pTempStyle)); } return pStyle; @@ -2439,7 +2439,7 @@ XMLPropStyleContext* XMLTextImportHelper::FindPageMaster( FindStyleChildContext( XML_STYLE_FAMILY_PAGE_MASTER, rName, true ); - pStyle = PTR_CAST( XMLPropStyleContext,pTempStyle); + pStyle = const_cast<XMLPropStyleContext*>(PTR_CAST( XMLPropStyleContext,pTempStyle)); } return pStyle; |