diff options
Diffstat (limited to 'xmloff')
26 files changed, 173 insertions, 145 deletions
diff --git a/xmloff/source/core/unoatrcn.cxx b/xmloff/source/core/unoatrcn.cxx index ed811df66157..ea8446278ccb 100644 --- a/xmloff/source/core/unoatrcn.cxx +++ b/xmloff/source/core/unoatrcn.cxx @@ -19,6 +19,7 @@ #include <string.h> #include <com/sun/star/xml/AttributeData.hpp> +#include <o3tl/any.hxx> #include <rtl/ustrbuf.hxx> #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> @@ -157,14 +158,12 @@ sal_Bool SAL_CALL SvUnoAttributeContainer::hasByName(const OUString& aName) thro void SAL_CALL SvUnoAttributeContainer::replaceByName(const OUString& aName, const uno::Any& aElement) throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) { - if( aElement.hasValue() && aElement.getValueType() == cppu::UnoType<xml::AttributeData>::get()) + if( auto pData = o3tl::tryGet<xml::AttributeData>(aElement) ) { sal_uInt16 nAttr = getIndexByName(aName ); if( nAttr == USHRT_MAX ) throw container::NoSuchElementException(); - xml::AttributeData const * pData = static_cast<xml::AttributeData const *>(aElement.getValue()); - sal_Int32 nPos = aName.indexOf( ':' ); if( nPos != -1L ) { @@ -199,15 +198,14 @@ void SAL_CALL SvUnoAttributeContainer::replaceByName(const OUString& aName, cons void SAL_CALL SvUnoAttributeContainer::insertByName(const OUString& aName, const uno::Any& aElement) throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) { - if( !aElement.hasValue() || aElement.getValueType() != cppu::UnoType<xml::AttributeData>::get()) + auto pData = o3tl::tryGet<xml::AttributeData>(aElement); + if( !pData ) throw lang::IllegalArgumentException(); sal_uInt16 nAttr = getIndexByName(aName ); if( nAttr != USHRT_MAX ) throw container::ElementExistException(); - xml::AttributeData const * pData = static_cast<xml::AttributeData const *>(aElement.getValue()); - sal_Int32 nPos = aName.indexOf( ':' ); if( nPos != -1L ) { diff --git a/xmloff/source/draw/XMLImageMapExport.cxx b/xmloff/source/draw/XMLImageMapExport.cxx index 9ea9b5863e88..43ba08306b38 100644 --- a/xmloff/source/draw/XMLImageMapExport.cxx +++ b/xmloff/source/draw/XMLImageMapExport.cxx @@ -18,6 +18,7 @@ */ #include "XMLImageMapExport.hxx" +#include <o3tl/any.hxx> #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> #include <tools/debug.hxx> @@ -199,7 +200,7 @@ void XMLImageMapExport::ExportMapEntry( // is-active aAny = rPropertySet->getPropertyValue(msIsActive); - if (! *static_cast<sal_Bool const *>(aAny.getValue())) + if (! *o3tl::doGet<bool>(aAny)) { mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_NOHREF, XML_NOHREF); } diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx index 97ae81c7b97a..b9180575fe73 100644 --- a/xmloff/source/draw/animationexport.cxx +++ b/xmloff/source/draw/animationexport.cxx @@ -49,7 +49,7 @@ #include <com/sun/star/presentation/ShapeAnimationSubType.hpp> #include <com/sun/star/presentation/EffectCommands.hpp> #include <com/sun/star/drawing/XShape.hpp> - +#include <o3tl/any.hxx> #include <sax/tools/converter.hxx> #include <tools/debug.hxx> @@ -513,7 +513,7 @@ public: void exportAudio( const Reference< XAudio >& xAudio ); void exportCommand( const Reference< XCommand >& xCommand ); - static Reference< XInterface > getParagraphTarget( const ParagraphTarget* pTarget ); + static Reference< XInterface > getParagraphTarget( const ParagraphTarget& pTarget ); static void convertPath( OUStringBuffer& sTmp, const Any& rPath ); void convertValue( XMLTokenEnum eAttributeName, OUStringBuffer& sTmp, const Any& rValue ) const; @@ -1412,14 +1412,14 @@ void AnimationsExporterImpl::exportCommand( const Reference< XCommand >& xComman } } -Reference< XInterface > AnimationsExporterImpl::getParagraphTarget( const ParagraphTarget* pTarget ) +Reference< XInterface > AnimationsExporterImpl::getParagraphTarget( const ParagraphTarget& pTarget ) { - if( pTarget ) try + try { - Reference< XEnumerationAccess > xParaEnumAccess( pTarget->Shape, UNO_QUERY_THROW ); + Reference< XEnumerationAccess > xParaEnumAccess( pTarget.Shape, UNO_QUERY_THROW ); Reference< XEnumeration > xEnumeration( xParaEnumAccess->createEnumeration(), UNO_QUERY_THROW ); - sal_Int32 nParagraph = pTarget->Paragraph; + sal_Int32 nParagraph = pTarget.Paragraph; while( xEnumeration->hasMoreElements() ) { @@ -1450,18 +1450,16 @@ void AnimationsExporterImpl::convertValue( XMLTokenEnum eAttributeName, OUString if( !rValue.hasValue() ) return; - if( rValue.getValueType() == cppu::UnoType<ValuePair>::get() ) + if( auto pValuePair = o3tl::tryGet<ValuePair>(rValue) ) { - const ValuePair* pValuePair = static_cast< const ValuePair* >( rValue.getValue() ); OUStringBuffer sTmp2; convertValue( eAttributeName, sTmp, pValuePair->First ); sTmp.append( ',' ); convertValue( eAttributeName, sTmp2, pValuePair->Second ); sTmp.append( sTmp2.makeStringAndClear() ); } - else if( rValue.getValueType() == cppu::UnoType< Sequence<Any> >::get() ) + else if( auto pSequence = o3tl::tryGet<Sequence<Any>>(rValue) ) { - const Sequence<Any>* pSequence = static_cast< const Sequence<Any>* >( rValue.getValue() ); const sal_Int32 nLength = pSequence->getLength(); sal_Int32 nElement; const Any* pAny = pSequence->getConstArray(); @@ -1478,7 +1476,6 @@ void AnimationsExporterImpl::convertValue( XMLTokenEnum eAttributeName, OUString } else { - OUString aString; sal_Int32 nType; switch( eAttributeName ) @@ -1490,13 +1487,13 @@ void AnimationsExporterImpl::convertValue( XMLTokenEnum eAttributeName, OUString case XML_ANIMATETRANSFORM: case XML_ANIMATEMOTION: { - if( rValue >>= aString ) + if( auto aString = o3tl::tryGet<OUString>(rValue) ) { - sTmp.append( aString ); + sTmp.append( *aString ); } - else if( rValue.getValueType() == cppu::UnoType<double>::get() ) + else if( auto x = o3tl::tryGet<double>(rValue) ) { - sTmp.append( *(static_cast< const double* >( rValue.getValue() )) ); + sTmp.append( *x ); } else { @@ -1530,6 +1527,7 @@ void AnimationsExporterImpl::convertValue( XMLTokenEnum eAttributeName, OUString const XMLPropertyHandler* pHandler = mpSdPropHdlFactory->GetPropertyHandler( nType ); if( pHandler ) { + OUString aString; pHandler->exportXML( aString, rValue, mrExport.GetMM100UnitConverter() ); sTmp.append( aString ); } @@ -1541,9 +1539,8 @@ void AnimationsExporterImpl::convertTiming( OUStringBuffer& sTmp, const Any& rVa if( !rValue.hasValue() ) return; - if( rValue.getValueType() == cppu::UnoType< Sequence<Any> >::get() ) + if( auto pSequence = o3tl::tryGet<Sequence<Any>>(rValue) ) { - const Sequence<Any>* pSequence = static_cast< const Sequence<Any>* >( rValue.getValue() ); const sal_Int32 nLength = pSequence->getLength(); sal_Int32 nElement; const Any* pAny = pSequence->getConstArray(); @@ -1558,22 +1555,19 @@ void AnimationsExporterImpl::convertTiming( OUStringBuffer& sTmp, const Any& rVa sTmp.append( sTmp2.makeStringAndClear() ); } } - else if( rValue.getValueType() == cppu::UnoType<double>::get() ) + else if( auto x = o3tl::tryGet<double>(rValue) ) { - sTmp.append( *(static_cast< const double* >( rValue.getValue() )) ); + sTmp.append( *x ); sTmp.append( 's'); } - else if( rValue.getValueType() == cppu::UnoType<Timing>::get() ) + else if( auto pTiming = o3tl::tryGet<Timing>(rValue) ) { - const Timing* pTiming = static_cast< const Timing* >( rValue.getValue() ); sTmp.append( GetXMLToken( (*pTiming == Timing_MEDIA) ? XML_MEDIA : XML_INDEFINITE ) ); } - else if( rValue.getValueType() == cppu::UnoType<Event>::get() ) + else if( auto pEvent = o3tl::tryGet<Event>(rValue) ) { OUStringBuffer sTmp2; - const Event* pEvent = static_cast< const Event* >( rValue.getValue() ); - if( pEvent->Trigger != EventTrigger::NONE ) { if( pEvent->Source.hasValue() ) @@ -1615,13 +1609,12 @@ void AnimationsExporterImpl::convertTarget( OUStringBuffer& sTmp, const Any& rTa Reference< XInterface > xRef; - if( rTarget.getValueTypeClass() == css::uno::TypeClass_INTERFACE ) + if( !(rTarget >>= xRef) ) { - rTarget >>= xRef; - } - else if( rTarget.getValueType() == cppu::UnoType<ParagraphTarget>::get() ) - { - xRef = getParagraphTarget( static_cast< const ParagraphTarget* >( rTarget.getValue() ) ); + if( auto pt = o3tl::tryGet<ParagraphTarget>(rTarget) ) + { + xRef = getParagraphTarget( *pt ); + } } DBG_ASSERT( xRef.is(), "xmloff::AnimationsExporterImpl::convertTarget(), invalid target type!" ); @@ -1638,15 +1631,13 @@ void AnimationsExporterImpl::prepareValue( const Any& rValue ) if( !rValue.hasValue() ) return; - if( rValue.getValueType() == cppu::UnoType<ValuePair>::get() ) + if( auto pValuePair = o3tl::tryGet<ValuePair>(rValue) ) { - const ValuePair* pValuePair = static_cast< const ValuePair* >( rValue.getValue() ); prepareValue( pValuePair->First ); prepareValue( pValuePair->Second ); } - else if( rValue.getValueType() == cppu::UnoType< Sequence<Any> >::get() ) + else if( auto pSequence = o3tl::tryGet<Sequence<Any>>(rValue) ) { - const Sequence<Any>* pSequence = static_cast< const Sequence<Any>* >( rValue.getValue() ); const sal_Int32 nLength = pSequence->getLength(); sal_Int32 nElement; const Any* pAny = pSequence->getConstArray(); @@ -1660,15 +1651,14 @@ void AnimationsExporterImpl::prepareValue( const Any& rValue ) if( xRef.is() ) mrExport.getInterfaceToIdentifierMapper().registerReference( xRef ); } - else if( rValue.getValueType() == cppu::UnoType<ParagraphTarget>::get() ) + else if( auto pt = o3tl::tryGet<ParagraphTarget>(rValue) ) { - Reference< XInterface> xRef( getParagraphTarget( static_cast< const ParagraphTarget* >( rValue.getValue() ) ) ); + Reference< XInterface> xRef( getParagraphTarget( *pt ) ); if( xRef.is() ) mrExport.getInterfaceToIdentifierMapper().registerReference( xRef ); } - else if( rValue.getValueType() == cppu::UnoType<Event>::get() ) + else if( auto pEvent = o3tl::tryGet<Event>(rValue) ) { - const Event* pEvent = static_cast< const Event* >( rValue.getValue() ); prepareValue( pEvent->Source ); } } diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index ed70149d0574..d851046beb9d 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -85,6 +85,8 @@ #include <comphelper/processfactory.hxx> #include <comphelper/storagehelper.hxx> +#include <o3tl/any.hxx> + #include <rtl/math.hxx> #include <rtl/ustrbuf.hxx> @@ -1995,9 +1997,8 @@ void XMLShapeExport::ImpExportLineShape( // get the two points uno::Any aAny(xPropSet->getPropertyValue("Geometry")); - drawing::PointSequenceSequence const * pSourcePolyPolygon = static_cast<drawing::PointSequenceSequence const *>(aAny.getValue()); - - if(pSourcePolyPolygon) + if (auto pSourcePolyPolygon + = o3tl::tryGet<drawing::PointSequenceSequence>(aAny)) { drawing::PointSequence* pOuterSequence = const_cast<css::drawing::PointSequenceSequence *>(pSourcePolyPolygon)->getArray(); if(pOuterSequence) @@ -2172,7 +2173,7 @@ void XMLShapeExport::ImpExportPolygonShape( // get PolygonBezier uno::Any aAny( xPropSet->getPropertyValue("Geometry") ); const basegfx::B2DPolyPolygon aPolyPolygon( - basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(*static_cast<drawing::PolyPolygonBezierCoords const *>(aAny.getValue()))); + basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(*o3tl::doGet<drawing::PolyPolygonBezierCoords>(aAny))); if(aPolyPolygon.count()) { @@ -2193,7 +2194,7 @@ void XMLShapeExport::ImpExportPolygonShape( // get non-bezier polygon uno::Any aAny( xPropSet->getPropertyValue("Geometry") ); const basegfx::B2DPolyPolygon aPolyPolygon( - basegfx::tools::UnoPointSequenceSequenceToB2DPolyPolygon(*static_cast<drawing::PointSequenceSequence const *>(aAny.getValue()))); + basegfx::tools::UnoPointSequenceSequenceToB2DPolyPolygon(*o3tl::doGet<drawing::PointSequenceSequence>(aAny))); if(!aPolyPolygon.areControlPointsUsed() && 1 == aPolyPolygon.count()) { @@ -2585,7 +2586,7 @@ void XMLShapeExport::ImpExportConnectorShape( if( xProps->getPropertyValue("PolyPolygonBezier") >>= aAny ) { // get PolygonBezier - drawing::PolyPolygonBezierCoords const * pSourcePolyPolygon = static_cast<drawing::PolyPolygonBezierCoords const *>(aAny.getValue()); + auto pSourcePolyPolygon = o3tl::tryGet<drawing::PolyPolygonBezierCoords>(aAny); if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength()) { diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx index 9f482d98092e..bdd752417930 100644 --- a/xmloff/source/draw/ximpcustomshape.cxx +++ b/xmloff/source/draw/ximpcustomshape.cxx @@ -19,6 +19,7 @@ #include "ximpcustomshape.hxx" #include "ximpshap.hxx" +#include <o3tl/any.hxx> #include <rtl/math.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/ustring.hxx> @@ -1219,8 +1220,8 @@ void XMLEnhancedCustomShapeContext::EndElement() case EAS_GluePoints : { uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair > const & rSeq = - *static_cast<uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair > const *>( - aPathIter->Value.getValue()); + *o3tl::doGet<uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair > >( + aPathIter->Value); for ( i = 0; i < rSeq.getLength(); i++ ) { CheckAndResolveEquationParameter( const_cast<css::drawing::EnhancedCustomShapeParameter &>(rSeq[ i ].First), pH ); @@ -1231,8 +1232,8 @@ void XMLEnhancedCustomShapeContext::EndElement() case EAS_TextFrames : { uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > const & rSeq = - *static_cast<uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > const *>( - aPathIter->Value.getValue()); + *o3tl::doGet<uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > >( + aPathIter->Value); for ( i = 0; i < rSeq.getLength(); i++ ) { CheckAndResolveEquationParameter( const_cast<css::drawing::EnhancedCustomShapeParameter &>(rSeq[ i ].TopLeft.First), pH ); @@ -1263,18 +1264,18 @@ void XMLEnhancedCustomShapeContext::EndElement() case EAS_RadiusRangeMinimum : case EAS_RadiusRangeMaximum : { - CheckAndResolveEquationParameter( *const_cast<css::drawing::EnhancedCustomShapeParameter *>(static_cast<css::drawing::EnhancedCustomShapeParameter const *>( - pValues->Value.getValue())), pH ); + CheckAndResolveEquationParameter( const_cast<css::drawing::EnhancedCustomShapeParameter &>(*o3tl::doGet<css::drawing::EnhancedCustomShapeParameter>( + pValues->Value)), pH ); } break; case EAS_Position : case EAS_Polar : { - CheckAndResolveEquationParameter( const_cast<css::drawing::EnhancedCustomShapeParameter &>((*static_cast<css::drawing::EnhancedCustomShapeParameterPair const *>( - pValues->Value.getValue())).First), pH ); - CheckAndResolveEquationParameter( const_cast<css::drawing::EnhancedCustomShapeParameter &>((*static_cast<css::drawing::EnhancedCustomShapeParameterPair const *>( - pValues->Value.getValue())).Second), pH ); + CheckAndResolveEquationParameter( const_cast<css::drawing::EnhancedCustomShapeParameter &>((*o3tl::doGet<css::drawing::EnhancedCustomShapeParameterPair>( + pValues->Value)).First), pH ); + CheckAndResolveEquationParameter( const_cast<css::drawing::EnhancedCustomShapeParameter &>((*o3tl::doGet<css::drawing::EnhancedCustomShapeParameterPair>( + pValues->Value)).Second), pH ); } break; default: diff --git a/xmloff/source/style/XMLPageExport.cxx b/xmloff/source/style/XMLPageExport.cxx index 0d4f4061fa42..d7fc0c18073d 100644 --- a/xmloff/source/style/XMLPageExport.cxx +++ b/xmloff/source/style/XMLPageExport.cxx @@ -18,6 +18,7 @@ */ #include <xmloff/XMLPageExport.hxx> +#include <o3tl/any.hxx> #include <tools/debug.hxx> #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> @@ -92,7 +93,7 @@ bool XMLPageExport::exportStyle( if( xPropSetInfo->hasPropertyByName( sIsPhysical ) ) { Any aAny = xPropSet->getPropertyValue( sIsPhysical ); - if( !*static_cast<sal_Bool const *>(aAny.getValue()) ) + if( !*o3tl::doGet<bool>(aAny) ) return false; } diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx index e246be5f64dc..1092568ddb80 100644 --- a/xmloff/source/style/prstylei.cxx +++ b/xmloff/source/style/prstylei.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <o3tl/any.hxx> #include <tools/debug.hxx> #include <osl/diagnose.h> #include <set> @@ -373,7 +376,7 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite ) if( !bNew && xPropSetInfo->hasPropertyByName( msIsPhysical ) ) { Any aAny = xPropSet->getPropertyValue( msIsPhysical ); - bNew = !*static_cast<sal_Bool const *>(aAny.getValue()); + bNew = !*o3tl::doGet<bool>(aAny); } SetNew( bNew ); if( rName != GetName() ) diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx index f96e1c78f188..d87979d57cba 100644 --- a/xmloff/source/style/styleexp.cxx +++ b/xmloff/source/style/styleexp.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <o3tl/any.hxx> #include <tools/debug.hxx> #include <xmloff/nmspmap.hxx> #include <xmloff/xmlnmspe.hxx> @@ -96,7 +99,7 @@ bool XMLStyleExport::exportStyle( if( xPropSetInfo->hasPropertyByName( sIsPhysical ) ) { aAny = xPropSet->getPropertyValue( sIsPhysical ); - if( !*static_cast<sal_Bool const *>(aAny.getValue()) ) + if( !*o3tl::doGet<bool>(aAny) ) return false; } @@ -164,7 +167,7 @@ bool XMLStyleExport::exportStyle( if( xPropSetInfo->hasPropertyByName( sIsAutoUpdate ) ) { aAny = xPropSet->getPropertyValue( sIsAutoUpdate ); - if( *static_cast<sal_Bool const *>(aAny.getValue()) ) + if( *o3tl::doGet<bool>(aAny) ) GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_AUTO_UPDATE, XML_TRUE ); } @@ -474,7 +477,7 @@ void XMLStyleExport::exportStyleFamily( if (xPropSetInfo->hasPropertyByName( sIsPhysical )) { Any aAny( xPropSet->getPropertyValue( sIsPhysical ) ); - if (!*static_cast<sal_Bool const *>(aAny.getValue())) + if (!*o3tl::doGet<bool>(aAny)) continue; } diff --git a/xmloff/source/style/xmlbahdl.cxx b/xmloff/source/style/xmlbahdl.cxx index 6020dcdce3b2..5574ad6ddba6 100644 --- a/xmloff/source/style/xmlbahdl.cxx +++ b/xmloff/source/style/xmlbahdl.cxx @@ -19,6 +19,7 @@ #include <xmlbahdl.hxx> +#include <o3tl/any.hxx> #include <tools/debug.hxx> #include <sax/tools/converter.hxx> #include <xmloff/xmluconv.hxx> @@ -693,7 +694,7 @@ bool XMLIsTransparentPropHdl::exportXML( OUString& rStrExpValue, const Any& rVal // MIB: This looks a bit strange, because bTransPropValue == bValue should // do the same, but this only applies if 'true' is represented by the same // 8 bit value in bValue and bTransPropValue. Who will ensure this? - bool bValue = *static_cast<sal_Bool const *>(rValue.getValue()); + bool bValue = *o3tl::doGet<bool>(rValue); bool bIsTrans = bTransPropValue ? bValue : !bValue; if( bIsTrans ) diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx index ee4cfdcdd78c..d8470b4e4893 100644 --- a/xmloff/source/style/xmlnume.cxx +++ b/xmloff/source/style/xmlnume.cxx @@ -33,6 +33,8 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <o3tl/any.hxx> + #include <rtl/ustrbuf.hxx> #include <tools/debug.hxx> @@ -674,7 +676,7 @@ void SvxXMLNumRuleExport::exportNumberingRule( xPropSetInfo->hasPropertyByName( sIsContinuousNumbering ) ) { Any aAny( xPropSet->getPropertyValue( sIsContinuousNumbering ) ); - bContNumbering = *static_cast<sal_Bool const *>(aAny.getValue()); + bContNumbering = *o3tl::doGet<bool>(aAny); } if( bContNumbering ) GetExport().AddAttribute( XML_NAMESPACE_TEXT, @@ -702,7 +704,7 @@ void SvxXMLNumRuleExport::exportStyle( const Reference< XStyle >& rStyle ) if( xPropSetInfo->hasPropertyByName( sIsPhysical ) ) { aAny = xPropSet->getPropertyValue( sIsPhysical ); - if( !*static_cast<sal_Bool const *>(aAny.getValue()) ) + if( !*o3tl::doGet<bool>(aAny) ) return; } diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx index 0a8b5b6823c6..a5153de126bd 100644 --- a/xmloff/source/style/xmlnumi.cxx +++ b/xmloff/source/style/xmlnumi.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/style/XStyle.hpp> #include <com/sun/star/io/XOutputStream.hpp> +#include <o3tl/any.hxx> #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> @@ -1183,7 +1184,7 @@ void SvxXMLListStyleContext::CreateAndInsertLate( bool bOverwrite ) if( !bNew && xPropSetInfo->hasPropertyByName( sIsPhysical ) ) { Any aAny = xPropSet->getPropertyValue( sIsPhysical ); - bNew = !*static_cast<sal_Bool const *>(aAny.getValue()); + bNew = !*o3tl::doGet<bool>(aAny); } if ( xPropSetInfo->hasPropertyByName( "Hidden" ) ) diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx index 73aa9053b134..6d9e8d997f1b 100644 --- a/xmloff/source/style/xmlstyle.cxx +++ b/xmloff/source/style/xmlstyle.cxx @@ -695,7 +695,7 @@ Reference < XAutoStyleFamily > SvXMLStylesContext::GetAutoStyles( sal_uInt16 nFa if (xAutoStyleFamilies->hasByName(sName)) { Any aAny = xAutoStyleFamilies->getByName( sName ); - xAutoStyles = *static_cast<Reference<XAutoStyleFamily> const *>(aAny.getValue()); + aAny >>= xAutoStyles; if( bPara ) const_cast<SvXMLStylesContext *>(this)->mxParaAutoStyles = xAutoStyles; else diff --git a/xmloff/source/text/XMLIndexMarkExport.cxx b/xmloff/source/text/XMLIndexMarkExport.cxx index b4f0ad1d7ea9..14c983fe77b3 100644 --- a/xmloff/source/text/XMLIndexMarkExport.cxx +++ b/xmloff/source/text/XMLIndexMarkExport.cxx @@ -18,6 +18,7 @@ */ #include "XMLIndexMarkExport.hxx" +#include <o3tl/any.hxx> #include <tools/debug.hxx> #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> @@ -91,7 +92,7 @@ void XMLIndexMarkExport::ExportIndexMark( // collapsed/alternative text entry? aAny = rPropSet->getPropertyValue(sIsCollapsed); - if (*static_cast<sal_Bool const *>(aAny.getValue())) + if (*o3tl::doGet<bool>(aAny)) { // collapsed entry: needs alternative text nElementNo = 0; @@ -107,7 +108,7 @@ void XMLIndexMarkExport::ExportIndexMark( { // start and end entries: has ID aAny = rPropSet->getPropertyValue(sIsStart); - nElementNo = *static_cast<sal_Bool const *>(aAny.getValue()) ? 1 : 2; + nElementNo = *o3tl::doGet<bool>(aAny) ? 1 : 2; // generate ID OUStringBuffer sBuf; diff --git a/xmloff/source/text/XMLLineNumberingExport.cxx b/xmloff/source/text/XMLLineNumberingExport.cxx index df911191b6a0..6394f81cd03c 100644 --- a/xmloff/source/text/XMLLineNumberingExport.cxx +++ b/xmloff/source/text/XMLLineNumberingExport.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/text/XLineNumberingProperties.hpp> #include <com/sun/star/style/LineNumberPosition.hpp> +#include <o3tl/any.hxx> #include <sax/tools/converter.hxx> #include <xmloff/xmlexp.hxx> #include <xmloff/xmluconv.hxx> @@ -89,7 +90,7 @@ void XMLLineNumberingExport::Export() // enable aAny = xLineNumbering->getPropertyValue(sIsOn); - if (! *static_cast<sal_Bool const *>(aAny.getValue())) + if (! *o3tl::doGet<bool>(aAny)) { rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_NUMBER_LINES, XML_FALSE); @@ -97,7 +98,7 @@ void XMLLineNumberingExport::Export() // count empty lines aAny = xLineNumbering->getPropertyValue(sCountEmptyLines); - if (! *static_cast<sal_Bool const *>(aAny.getValue())) + if (! *o3tl::doGet<bool>(aAny)) { rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_COUNT_EMPTY_LINES, XML_FALSE); @@ -105,7 +106,7 @@ void XMLLineNumberingExport::Export() // count in frames aAny = xLineNumbering->getPropertyValue(sCountLinesInFrames); - if (*static_cast<sal_Bool const *>(aAny.getValue())) + if (*o3tl::doGet<bool>(aAny)) { rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_COUNT_IN_TEXT_BOXES, XML_TRUE); @@ -113,7 +114,7 @@ void XMLLineNumberingExport::Export() // restart numbering aAny = xLineNumbering->getPropertyValue(sRestartAtEachPage); - if (*static_cast<sal_Bool const *>(aAny.getValue())) + if (*o3tl::doGet<bool>(aAny)) { rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_RESTART_ON_PAGE, XML_TRUE); diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx index f7b38efb5edf..ce9bfa37f1b6 100644 --- a/xmloff/source/text/XMLRedlineExport.cxx +++ b/xmloff/source/text/XMLRedlineExport.cxx @@ -18,6 +18,7 @@ */ #include "XMLRedlineExport.hxx" +#include <o3tl/any.hxx> #include <tools/debug.hxx> #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> @@ -213,8 +214,8 @@ void XMLRedlineExport::ExportChangesListElements() Reference<XPropertySet> aDocPropertySet( rExport.GetModel(), uno::UNO_QUERY ); // redlining enabled? - bool bEnabled = *static_cast<sal_Bool const *>(aDocPropertySet->getPropertyValue( - sRecordChanges ).getValue()); + bool bEnabled = *o3tl::doGet<bool>(aDocPropertySet->getPropertyValue( + sRecordChanges )); // only export if we have redlines or attributes if ( aEnumAccess->hasElements() || bEnabled ) @@ -248,7 +249,7 @@ void XMLRedlineExport::ExportChangesListElements() // export only if not in header or footer // (those must be exported with their XText) aAny = xPropSet->getPropertyValue(sIsInHeaderFooter); - if (! *static_cast<sal_Bool const *>(aAny.getValue())) + if (! *o3tl::doGet<bool>(aAny)) { // and finally, export change ExportChangedRegion(xPropSet); @@ -272,8 +273,8 @@ void XMLRedlineExport::ExportChangeAutoStyle( Any aIsStart = rPropSet->getPropertyValue(sIsStart); Any aIsCollapsed = rPropSet->getPropertyValue(sIsCollapsed); - if ( *static_cast<sal_Bool const *>(aIsStart.getValue()) || - *static_cast<sal_Bool const *>(aIsCollapsed.getValue()) ) + if ( *o3tl::doGet<bool>(aIsStart) || + *o3tl::doGet<bool>(aIsCollapsed) ) pCurrentChangesList->push_back(rPropSet); } @@ -315,7 +316,7 @@ void XMLRedlineExport::ExportChangesListAutoStyles() // export only if not in header or footer // (those must be exported with their XText) aAny = xPropSet->getPropertyValue(sIsInHeaderFooter); - if (! *static_cast<sal_Bool const *>(aAny.getValue())) + if (! *o3tl::doGet<bool>(aAny)) { ExportChangeAutoStyle(xPropSet); } @@ -331,7 +332,7 @@ void XMLRedlineExport::ExportChangeInline( // determine element name (depending on collapsed, start/end) enum XMLTokenEnum eElement = XML_TOKEN_INVALID; Any aAny = rPropSet->getPropertyValue(sIsCollapsed); - bool bCollapsed = *static_cast<sal_Bool const *>(aAny.getValue()); + bool bCollapsed = *o3tl::doGet<bool>(aAny); if (bCollapsed) { eElement = XML_CHANGE; @@ -339,7 +340,7 @@ void XMLRedlineExport::ExportChangeInline( else { aAny = rPropSet->getPropertyValue(sIsStart); - const bool bStart = *static_cast<sal_Bool const *>(aAny.getValue()); + const bool bStart = *o3tl::doGet<bool>(aAny); eElement = bStart ? XML_CHANGE_START : XML_CHANGE_END; } @@ -364,7 +365,7 @@ void XMLRedlineExport::ExportChangedRegion( // merge-last-paragraph Any aAny = rPropSet->getPropertyValue(sMergeLastPara); - if( ! *static_cast<sal_Bool const *>(aAny.getValue()) ) + if( ! *o3tl::doGet<bool>(aAny) ) rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_MERGE_LAST_PARAGRAPH, XML_FALSE); @@ -581,11 +582,11 @@ void XMLRedlineExport::ExportStartOrEndRedline( } else if (sIsCollapsed.equals(pValues[i].Name)) { - bIsCollapsed = *static_cast<sal_Bool const *>(pValues[i].Value.getValue()); + bIsCollapsed = *o3tl::doGet<bool>(pValues[i].Value); } else if (sIsStart.equals(pValues[i].Name)) { - bIsStart = *static_cast<sal_Bool const *>(pValues[i].Value.getValue()); + bIsStart = *o3tl::doGet<bool>(pValues[i].Value); } } diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx index 3242abfb1bd4..825e6a0191a5 100644 --- a/xmloff/source/text/XMLSectionExport.cxx +++ b/xmloff/source/text/XMLSectionExport.cxx @@ -18,6 +18,7 @@ */ #include "XMLSectionExport.hxx" +#include <o3tl/any.hxx> #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> @@ -429,7 +430,7 @@ void XMLSectionExport::ExportRegularSectionStart( // #97450# store hidden-status (of conditional sections only) aAny = xPropSet->getPropertyValue(sIsCurrentlyVisible); - if (! *static_cast<sal_Bool const *>(aAny.getValue())) + if (! *o3tl::doGet<bool>(aAny)) { GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_IS_HIDDEN, XML_TRUE); @@ -440,14 +441,14 @@ void XMLSectionExport::ExportRegularSectionStart( eDisplay = XML_NONE; } aAny = xPropSet->getPropertyValue(sIsVisible); - if (! *static_cast<sal_Bool const *>(aAny.getValue())) + if (! *o3tl::doGet<bool>(aAny)) { GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_DISPLAY, eDisplay); } // protect + protection key aAny = xPropSet->getPropertyValue(sIsProtected); - if (*static_cast<sal_Bool const *>(aAny.getValue())) + if (*o3tl::doGet<bool>(aAny)) { GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_PROTECTED, XML_TRUE); } @@ -531,7 +532,7 @@ void XMLSectionExport::ExportRegularSectionStart( sItem); aAny = xPropSet->getPropertyValue(sIsAutomaticUpdate); - if (*static_cast<sal_Bool const *>(aAny.getValue())) + if (*o3tl::doGet<bool>(aAny)) { GetExport().AddAttribute(XML_NAMESPACE_OFFICE, XML_AUTOMATIC_UPDATE, XML_TRUE); @@ -765,7 +766,7 @@ void XMLSectionExport::ExportBaseIndexStart( { // protect + protection key Any aAny = rPropertySet->getPropertyValue(sIsProtected); - if (*static_cast<sal_Bool const *>(aAny.getValue())) + if (*o3tl::doGet<bool>(aAny)) { GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_PROTECTED, XML_TRUE); } @@ -809,7 +810,7 @@ void XMLSectionExport::ExportBaseIndexSource( { // document or chapter index? aAny = rPropertySet->getPropertyValue(sCreateFromChapter); - if (*static_cast<sal_Bool const *>(aAny.getValue())) + if (*o3tl::doGet<bool>(aAny)) { GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_INDEX_SCOPE, XML_CHAPTER); @@ -817,7 +818,7 @@ void XMLSectionExport::ExportBaseIndexSource( // tab-stops relative to margin? aAny = rPropertySet->getPropertyValue(sIsRelativeTabstops); - if (! *static_cast<sal_Bool const *>(aAny.getValue())) + if (! *o3tl::doGet<bool>(aAny)) { GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_RELATIVE_TAB_STOP_POSITION, @@ -914,7 +915,7 @@ void XMLSectionExport::ExportTableAndIllustrationIndexSourceAttributes( { // use caption Any aAny = rPropertySet->getPropertyValue(sCreateFromLabels); - if (! *static_cast<sal_Bool const *>(aAny.getValue())) + if (! *o3tl::doGet<bool>(aAny)) { GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_USE_CAPTION, XML_FALSE); @@ -1284,7 +1285,7 @@ void XMLSectionExport::ExportIndexTemplateElement( case TOK_TPARAM_TAB_RIGHT_ALIGNED: bRightAligned = - *static_cast<sal_Bool const *>(rValues[i].Value.getValue()); + *o3tl::doGet<bool>(rValues[i].Value); break; case TOK_TPARAM_TAB_POSITION: @@ -1294,7 +1295,7 @@ void XMLSectionExport::ExportIndexTemplateElement( // #i21237# case TOK_TPARAM_TAB_WITH_TAB: - bWithTabStop = *static_cast<sal_Bool const *>(rValues[i].Value.getValue()); + bWithTabStop = *o3tl::doGet<bool>(rValues[i].Value); bWithTabStopOK = true; break; @@ -1591,7 +1592,7 @@ void XMLSectionExport::ExportBoolean( OSL_ENSURE(eAttributeName != XML_TOKEN_INVALID, "Need attribute name"); Any aAny = rPropSet->getPropertyValue(sPropertyName); - bool bTmp = *static_cast<sal_Bool const *>(aAny.getValue()); + bool bTmp = *o3tl::doGet<bool>(aAny); // value = value ^ bInvert // omit if value == default @@ -1647,14 +1648,14 @@ void XMLSectionExport::ExportBibliographyConfiguration(SvXMLExport& rExport) rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_SUFFIX, sTmp); aAny = xPropSet->getPropertyValue(sIsNumberEntries); - if (*static_cast<sal_Bool const *>(aAny.getValue())) + if (*o3tl::doGet<bool>(aAny)) { rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_NUMBERED_ENTRIES, XML_TRUE); } aAny = xPropSet->getPropertyValue(sIsSortByPosition); - if (! *static_cast<sal_Bool const *>(aAny.getValue())) + if (! *o3tl::doGet<bool>(aAny)) { rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_SORT_BY_POSITION, XML_FALSE); @@ -1709,7 +1710,7 @@ void XMLSectionExport::ExportBibliographyConfiguration(SvXMLExport& rExport) } else if (rValue.Name == "IsSortAscending") { - bool bTmp = *static_cast<sal_Bool const *>(rValue.Value.getValue()); + bool bTmp = *o3tl::doGet<bool>(rValue.Value); rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_SORT_ASCENDING, bTmp ? XML_TRUE : XML_FALSE); @@ -1749,7 +1750,7 @@ bool XMLSectionExport::IsMuteSection( { Any aAny = xPropSet->getPropertyValue(sIsGlobalDocumentSection); - if ( *static_cast<sal_Bool const *>(aAny.getValue()) ) + if ( *o3tl::doGet<bool>(aAny) ) { Reference<XDocumentIndex> xIndex; if (! GetIndex(rSection, xIndex)) diff --git a/xmloff/source/text/XMLTextColumnsExport.cxx b/xmloff/source/text/XMLTextColumnsExport.cxx index ee797e2c6b70..4d5eee50f365 100644 --- a/xmloff/source/text/XMLTextColumnsExport.cxx +++ b/xmloff/source/text/XMLTextColumnsExport.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <o3tl/any.hxx> #include <rtl/ustrbuf.hxx> @@ -72,7 +75,7 @@ void XMLTextColumnsExport::exportXML( const Any& rAny ) if( xPropSet.is() ) { Any aAny = xPropSet->getPropertyValue( sIsAutomatic ); - if ( *static_cast<sal_Bool const *>(aAny.getValue()) ) + if ( *o3tl::doGet<bool>(aAny) ) { aAny = xPropSet->getPropertyValue( sAutomaticDistance ); sal_Int32 nDistance = 0; @@ -92,7 +95,7 @@ void XMLTextColumnsExport::exportXML( const Any& rAny ) if( xPropSet.is() ) { Any aAny = xPropSet->getPropertyValue( sSeparatorLineIsOn ); - if( *static_cast<sal_Bool const *>(aAny.getValue()) ) + if( *o3tl::doGet<bool>(aAny) ) { // style:width aAny = xPropSet->getPropertyValue( sSeparatorLineWidth ); diff --git a/xmloff/source/text/XMLTextHeaderFooterContext.cxx b/xmloff/source/text/XMLTextHeaderFooterContext.cxx index efa42e333cbf..6dc6e25021eb 100644 --- a/xmloff/source/text/XMLTextHeaderFooterContext.cxx +++ b/xmloff/source/text/XMLTextHeaderFooterContext.cxx @@ -20,6 +20,7 @@ #include <com/sun/star/text/XText.hpp> #include <com/sun/star/text/XParagraphAppend.hpp> #include <com/sun/star/text/XRelativeTextContentRemove.hpp> +#include <o3tl/any.hxx> #include <xmloff/nmspmap.hxx> #include <xmloff/xmlnmspe.hxx> #include "XMLTextHeaderFooterContext.hxx" @@ -58,7 +59,7 @@ XMLTextHeaderFooterContext::XMLTextHeaderFooterContext( SvXMLImport& rImport, sa Any aAny; aAny = xPropSet->getPropertyValue( sOn ); - bool bOn = *static_cast<sal_Bool const *>(aAny.getValue()); + bool bOn = *o3tl::doGet<bool>(aAny); if( bOn ) { @@ -124,7 +125,7 @@ SvXMLImportContext *XMLTextHeaderFooterContext::CreateChildContext( else { aAny = xPropSet->getPropertyValue( sOn ); - bool bOn = *static_cast<sal_Bool const *>(aAny.getValue()); + bool bOn = *o3tl::doGet<bool>(aAny); if( !bOn ) { @@ -138,7 +139,7 @@ SvXMLImportContext *XMLTextHeaderFooterContext::CreateChildContext( // If a header or footer is not shared, share it now. aAny = xPropSet->getPropertyValue( sShareContent ); - bool bShared = *static_cast<sal_Bool const *>(aAny.getValue()); + bool bShared = *o3tl::doGet<bool>(aAny); if( !bShared ) { xPropSet->setPropertyValue( sShareContent, Any(true) ); diff --git a/xmloff/source/text/XMLTextMasterPageContext.cxx b/xmloff/source/text/XMLTextMasterPageContext.cxx index 155d29697ab8..8d39758498c1 100644 --- a/xmloff/source/text/XMLTextMasterPageContext.cxx +++ b/xmloff/source/text/XMLTextMasterPageContext.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/style/PageStyleLayout.hpp> #include <com/sun/star/beans/XMultiPropertyStates.hpp> +#include <o3tl/any.hxx> #include <osl/diagnose.h> #include <xmloff/nmspmap.hxx> #include <xmloff/xmlnmspe.hxx> @@ -147,7 +148,7 @@ XMLTextMasterPageContext::XMLTextMasterPageContext( SvXMLImport& rImport, if( !bNew && xPropSetInfo->hasPropertyByName( sIsPhysical ) ) { aAny = xPropSet->getPropertyValue( sIsPhysical ); - bNew = !*static_cast<sal_Bool const *>(aAny.getValue()); + bNew = !*o3tl::doGet<bool>(aAny); } SetNew( bNew ); diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index 687fa59383ba..d77a548e95ed 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/text/TextContentAnchorType.hpp> #include <com/sun/star/awt/FontUnderline.hpp> #include <com/sun/star/text/XChapterNumberingSupplier.hpp> +#include <o3tl/any.hxx> #include <tools/debug.hxx> #include <tools/color.hxx> #include <xmloff/txtprmap.hxx> @@ -148,7 +149,7 @@ void XMLTextExportPropertySetMapper::handleSpecialItem( { case CTF_DROPCAPWHOLEWORD: DBG_ASSERT( !bDropWholeWord, "drop whole word is set already!" ); - pThis->bDropWholeWord = *static_cast<sal_Bool const *>(rProperty.maValue.getValue()); + pThis->bDropWholeWord = *o3tl::doGet<bool>(rProperty.maValue); break; case CTF_DROPCAPCHARSTYLE: DBG_ASSERT( sDropCharStyle.isEmpty(), "drop char style is set already!" ); @@ -1004,7 +1005,7 @@ void XMLTextExportPropertySetMapper::ContextFilter( } if( pWrapContourModeState && (!pWrapContourState || - !*static_cast<sal_Bool const *>(pWrapContourState ->maValue.getValue()) ) ) + !*o3tl::doGet<bool>(pWrapContourState ->maValue) ) ) pWrapContourModeState->mnIndex = -1; } @@ -1022,7 +1023,7 @@ void XMLTextExportPropertySetMapper::ContextFilter( if( pHoriOrientState && pHoriOrientMirroredState ) { if( pHoriOrientMirrorState && - *static_cast<sal_Bool const *>(pHoriOrientMirrorState->maValue.getValue()) ) + *o3tl::doGet<bool>(pHoriOrientMirrorState->maValue) ) pHoriOrientState->mnIndex = -1; else pHoriOrientMirroredState->mnIndex = -1; @@ -1098,7 +1099,7 @@ void XMLTextExportPropertySetMapper::ContextFilter( if( pShapeHoriOrientState && pShapeHoriOrientMirroredState ) { if( pShapeHoriOrientMirrorState && - *static_cast<sal_Bool const *>(pShapeHoriOrientMirrorState->maValue.getValue()) ) + *o3tl::doGet<bool>(pShapeHoriOrientMirrorState->maValue) ) pShapeHoriOrientState->mnIndex = -1; else pShapeHoriOrientMirroredState->mnIndex = -1; diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index c198d272d056..b87e256af950 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -64,6 +64,7 @@ #include <com/sun/star/text/BibliographyDataType.hpp> #include <com/sun/star/sdb/CommandType.hpp> #include <com/sun/star/rdf/XMetadatable.hpp> +#include <o3tl/any.hxx> #include <rtl/ustrbuf.hxx> #include <tools/debug.hxx> #include <rtl/math.hxx> @@ -2950,7 +2951,7 @@ enum XMLTokenEnum XMLTextFieldExport::MapPageNumberName( enum XMLTokenEnum eName = XML_TOKEN_INVALID; PageNumberType ePage; Any aAny = xPropSet->getPropertyValue(sPropertySubType); - ePage = *static_cast<PageNumberType const *>(aAny.getValue()); + ePage = *o3tl::doGet<PageNumberType>(aAny); switch (ePage) { @@ -3492,7 +3493,7 @@ inline bool GetBoolProperty( const Reference<XPropertySet> & xPropSet) { Any aAny = xPropSet->getPropertyValue(sPropName); - bool bBool = *static_cast<sal_Bool const *>(aAny.getValue()); + bool bBool = *o3tl::doGet<bool>(aAny); return bBool; } diff --git a/xmloff/source/text/txtftne.cxx b/xmloff/source/text/txtftne.cxx index f990e2f33150..97324420ccde 100644 --- a/xmloff/source/text/txtftne.cxx +++ b/xmloff/source/text/txtftne.cxx @@ -26,6 +26,10 @@ * - footnote configuration elements * - endnote configuration elements */ + +#include <sal/config.h> + +#include <o3tl/any.hxx> #include <tools/debug.hxx> #include <rtl/ustrbuf.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -315,7 +319,7 @@ void XMLTextParagraphExport::exportTextFootnoteConfigurationHelper( aAny = rFootnoteConfig->getPropertyValue( sPositionEndOfDoc); GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_FOOTNOTES_POSITION, - ( (*static_cast<sal_Bool const *>(aAny.getValue())) ? + ( (*o3tl::doGet<bool>(aAny)) ? XML_DOCUMENT : XML_PAGE ) ); aAny = rFootnoteConfig->getPropertyValue(sFootnoteCounting); diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx index f89a142d0636..6bc35f5f469f 100644 --- a/xmloff/source/text/txtimppr.cxx +++ b/xmloff/source/text/txtimppr.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <o3tl/any.hxx> #include <osl/thread.h> #include <com/sun/star/awt/FontFamily.hpp> #include <com/sun/star/awt/FontPitch.hpp> @@ -671,7 +674,7 @@ void XMLTextImportPropertyMapper::finished( // #i5775# don't overwrite %transparency with binary transparency if( ( pBackTransparency != nullptr ) && ( pBackTransparent != nullptr ) ) { - if( ! *static_cast<sal_Bool const *>(pBackTransparent->maValue.getValue()) ) + if( ! *o3tl::doGet<bool>(pBackTransparent->maValue) ) pBackTransparent->mnIndex = -1; } diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index efe5a79b4e1e..dfea038f50ae 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <o3tl/any.hxx> #include <xmloff/unointerfacetouniqueidentifiermapper.hxx> #include <tools/debug.hxx> #include <rtl/ustrbuf.hxx> @@ -513,13 +516,13 @@ void XMLTextParagraphExport::Add( sal_uInt16 nFamily, xNumPropSet->getPropertySetInfo() ->hasPropertyByName( "IsAutomatic" ) ) { - bAdd = *static_cast<sal_Bool const *>(xNumPropSet->getPropertyValue( "IsAutomatic" ).getValue()); + bAdd = *o3tl::doGet<bool>(xNumPropSet->getPropertyValue( "IsAutomatic" )); // Check on outline style (#i73361#) if ( bAdd && xNumPropSet->getPropertySetInfo() ->hasPropertyByName( "NumberingIsOutline" ) ) { - bAdd = !(*static_cast<sal_Bool const *>(xNumPropSet->getPropertyValue( "NumberingIsOutline" ).getValue())); + bAdd = !(*o3tl::doGet<bool>(xNumPropSet->getPropertyValue( "NumberingIsOutline" ))); } } else @@ -619,13 +622,13 @@ void XMLTextParagraphExport::Add( sal_uInt16 nFamily, xNumPropSet->getPropertySetInfo() ->hasPropertyByName( "IsAutomatic" ) ) { - bAdd = *static_cast<sal_Bool const *>(xNumPropSet->getPropertyValue( "IsAutomatic" ).getValue()); + bAdd = *o3tl::doGet<bool>(xNumPropSet->getPropertyValue( "IsAutomatic" )); // Check on outline style (#i73361#) if ( bAdd && xNumPropSet->getPropertySetInfo() ->hasPropertyByName( "NumberingIsOutline" ) ) { - bAdd = !(*static_cast<sal_Bool const *>(xNumPropSet->getPropertyValue( "NumberingIsOutline" ).getValue())); + bAdd = !(*o3tl::doGet<bool>(xNumPropSet->getPropertyValue( "NumberingIsOutline" ))); } } else @@ -1456,13 +1459,13 @@ bool XMLTextParagraphExport::collectTextAutoStylesOptimized( bool bIsProgress ) } Any aAny = xAutoStyleFamilies->getByName( sName ); - Reference< XAutoStyleFamily > xAutoStyles = *static_cast<Reference<XAutoStyleFamily> const *>(aAny.getValue()); + Reference< XAutoStyleFamily > xAutoStyles = *o3tl::doGet<Reference<XAutoStyleFamily>>(aAny); Reference < XEnumeration > xAutoStylesEnum( xAutoStyles->createEnumeration() ); while ( xAutoStylesEnum->hasMoreElements() ) { aAny = xAutoStylesEnum->nextElement(); - Reference< XAutoStyle > xAutoStyle = *static_cast<Reference<XAutoStyle> const *>(aAny.getValue()); + Reference< XAutoStyle > xAutoStyle = *o3tl::doGet<Reference<XAutoStyle>>(aAny); Reference < XPropertySet > xPSet( xAutoStyle, uno::UNO_QUERY ); Add( nFamily, xPSet, nullptr, true ); } @@ -1479,7 +1482,7 @@ bool XMLTextParagraphExport::collectTextAutoStylesOptimized( bool bIsProgress ) while ( xTextFieldsEnum->hasMoreElements() ) { Any aAny = xTextFieldsEnum->nextElement(); - Reference< XTextField > xTextField = *static_cast<Reference<XTextField> const *>(aAny.getValue()); + Reference< XTextField > xTextField = *o3tl::doGet<Reference<XTextField>>(aAny); exportTextField( xTextField, bAutoStyles, bIsProgress, !xAutoStylesSupp.is() ); try @@ -1557,7 +1560,7 @@ bool XMLTextParagraphExport::collectTextAutoStylesOptimized( bool bIsProgress ) for( sal_Int32 i = 0; i < nCount; ++i ) { Any aAny = xSections->getByIndex( i ); - Reference< XTextSection > xSection = *static_cast<Reference<XTextSection> const *>(aAny.getValue()); + Reference< XTextSection > xSection = *o3tl::doGet<Reference<XTextSection>>(aAny); Reference < XPropertySet > xPSet( xSection, uno::UNO_QUERY ); Add( XML_STYLE_FAMILY_TEXT_SECTION, xPSet ); } @@ -1575,7 +1578,7 @@ bool XMLTextParagraphExport::collectTextAutoStylesOptimized( bool bIsProgress ) for( sal_Int32 i = 0; i < nCount; ++i ) { Any aAny = xTables->getByIndex( i ); - Reference< XTextTable > xTable = *static_cast<Reference<XTextTable> const *>(aAny.getValue()); + Reference< XTextTable > xTable = *o3tl::doGet<Reference<XTextTable>>(aAny); exportTable( xTable, true, true ); } } @@ -1605,13 +1608,13 @@ bool XMLTextParagraphExport::collectTextAutoStylesOptimized( bool bIsProgress ) xNumPropSet->getPropertySetInfo() ->hasPropertyByName( "IsAutomatic" ) ) { - bAdd = *static_cast<sal_Bool const *>(xNumPropSet->getPropertyValue( "IsAutomatic" ).getValue()); + bAdd = *o3tl::doGet<bool>(xNumPropSet->getPropertyValue( "IsAutomatic" )); // Check on outline style (#i73361#) if ( bAdd && xNumPropSet->getPropertySetInfo() ->hasPropertyByName( "NumberingIsOutline" ) ) { - bAdd = !(*static_cast<sal_Bool const *>(xNumPropSet->getPropertyValue( "NumberingIsOutline" ).getValue())); + bAdd = !(*o3tl::doGet<bool>(xNumPropSet->getPropertyValue( "NumberingIsOutline" ))); } } else @@ -2503,13 +2506,13 @@ void XMLTextParagraphExport::exportTextMark( // start, end, or point-reference? sal_Int8 nElement; - if( *static_cast<sal_Bool const *>(rPropSet->getPropertyValue(sIsCollapsed).getValue()) ) + if( *o3tl::doGet<bool>(rPropSet->getPropertyValue(sIsCollapsed)) ) { nElement = 0; } else { - nElement = *static_cast<sal_Bool const *>(rPropSet->getPropertyValue(sIsStart).getValue()) ? 1 : 2; + nElement = *o3tl::doGet<bool>(rPropSet->getPropertyValue(sIsStart)) ? 1 : 2; } // bookmark, bookmark-start: xml:id and RDFa for RDF metadata @@ -2669,7 +2672,7 @@ XMLShapeExportFlags XMLTextParagraphExport::addTextFrameAttributes( bool bSyncWidth = false; if( xPropSetInfo->hasPropertyByName( sIsSyncWidthToHeight ) ) { - bSyncWidth = *static_cast<sal_Bool const *>(rPropSet->getPropertyValue( sIsSyncWidthToHeight ).getValue()); + bSyncWidth = *o3tl::doGet<bool>(rPropSet->getPropertyValue( sIsSyncWidthToHeight )); if( bSyncWidth ) GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REL_WIDTH, XML_SCALE ); @@ -2697,7 +2700,7 @@ XMLShapeExportFlags XMLTextParagraphExport::addTextFrameAttributes( bool bSyncHeight = false; if( xPropSetInfo->hasPropertyByName( sIsSyncHeightToWidth ) ) { - bSyncHeight = *static_cast<sal_Bool const *>(rPropSet->getPropertyValue( sIsSyncHeightToWidth ).getValue()); + bSyncHeight = *o3tl::doGet<bool>(rPropSet->getPropertyValue( sIsSyncHeightToWidth )); } sal_Int16 nRelHeight = 0; if( !bSyncHeight && xPropSetInfo->hasPropertyByName( sRelativeHeight ) ) @@ -2964,7 +2967,7 @@ void XMLTextParagraphExport::exportContour( if( rPropSetInfo->hasPropertyByName( sIsPixelContour ) ) { - bPixel = *static_cast<sal_Bool const *>(rPropSet->getPropertyValue( sIsPixelContour ).getValue()); + bPixel = *o3tl::doGet<bool>(rPropSet->getPropertyValue( sIsPixelContour )); } // svg: width @@ -3026,8 +3029,8 @@ void XMLTextParagraphExport::exportContour( if( rPropSetInfo->hasPropertyByName( sIsAutomaticContour ) ) { - bool bTmp = *static_cast<sal_Bool const *>(rPropSet->getPropertyValue( - sIsAutomaticContour ).getValue()); + bool bTmp = *o3tl::doGet<bool>(rPropSet->getPropertyValue( + sIsAutomaticContour )); GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_RECREATE_ON_EDIT, bTmp ? XML_TRUE : XML_FALSE ); } @@ -3247,7 +3250,7 @@ bool XMLTextParagraphExport::addHyperlinkAttributes( && ( !rPropState.is() || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( sServerMap ) ) ) { - bServerMap = *static_cast<sal_Bool const *>(rPropSet->getPropertyValue( sServerMap ).getValue()); + bServerMap = *o3tl::doGet<bool>(rPropSet->getPropertyValue( sServerMap )); if ( bServerMap ) bExport = true; } @@ -3624,11 +3627,11 @@ void XMLTextParagraphExport::exportRuby( bool bAutoStyles ) { // early out: a collapsed ruby makes no sense - if (*static_cast<sal_Bool const *>(rPropSet->getPropertyValue(sIsCollapsed).getValue())) + if (*o3tl::doGet<bool>(rPropSet->getPropertyValue(sIsCollapsed))) return; // start value ? - bool bStart = *static_cast<sal_Bool const *>(rPropSet->getPropertyValue(sIsStart).getValue()); + bool bStart = *o3tl::doGet<bool>(rPropSet->getPropertyValue(sIsStart)); if (bAutoStyles) { diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx index 6d3a22735d73..3d4d2fbfee5f 100644 --- a/xmloff/source/text/txtprhdl.cxx +++ b/xmloff/source/text/txtprhdl.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <o3tl/any.hxx> #include <tools/debug.hxx> #include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> @@ -351,7 +354,7 @@ bool XMLOpaquePropHdl_Impl::exportXML( const Any& rValue, const SvXMLUnitConverter& ) const { - if( *static_cast<sal_Bool const *>(rValue.getValue()) ) + if( *o3tl::doGet<bool>(rValue) ) rStrExpValue = GetXMLToken( XML_FOREGROUND ); else rStrExpValue = GetXMLToken( XML_BACKGROUND ); @@ -401,7 +404,7 @@ bool XMLContourModePropHdl_Impl::exportXML( const Any& rValue, const SvXMLUnitConverter& ) const { - if( *static_cast<sal_Bool const *>(rValue.getValue()) ) + if( *o3tl::doGet<bool>(rValue) ) rStrExpValue = GetXMLToken( XML_OUTSIDE ); else rStrExpValue = GetXMLToken( XML_FULL ); @@ -454,7 +457,7 @@ bool XMLParagraphOnlyPropHdl_Impl::exportXML( const Any& rValue, const SvXMLUnitConverter& ) const { - if( *static_cast<sal_Bool const *>(rValue.getValue()) ) + if( *o3tl::doGet<bool>(rValue) ) rStrExpValue = GetXMLToken( XML_1 ); else rStrExpValue = GetXMLToken( XML_NO_LIMIT ); @@ -580,7 +583,7 @@ bool XMLFrameProtectPropHdl_Impl::exportXML( const Any& rValue, const SvXMLUnitConverter& ) const { - if( *static_cast<sal_Bool const *>(rValue.getValue()) ) + if( *o3tl::doGet<bool>(rValue) ) { if( rStrExpValue.isEmpty() || IsXMLToken( rStrExpValue, XML_NONE ) ) @@ -822,7 +825,7 @@ bool XMLGrfMirrorPropHdl_Impl::exportXML( const Any& rValue, const SvXMLUnitConverter& ) const { - if( *static_cast<sal_Bool const *>(rValue.getValue()) ) + if( *o3tl::doGet<bool>(rValue) ) { if( rStrExpValue.isEmpty() || IsXMLToken( rStrExpValue, XML_NONE ) ) @@ -1097,7 +1100,7 @@ bool XMLTextSyncWidthHeightPropHdl_Impl::exportXML( const SvXMLUnitConverter& ) const { bool bRet = false; - if( *static_cast<sal_Bool const *>(rValue.getValue()) ) + if( *o3tl::doGet<bool>(rValue) ) { rStrExpValue = sValue; bRet = true; diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx index eb748ea87696..ccd3a4c8a39a 100644 --- a/xmloff/source/text/txtstyli.cxx +++ b/xmloff/source/text/txtstyli.cxx @@ -39,6 +39,8 @@ #include <com/sun/star/style/ParagraphStyleCategory.hpp> #include <com/sun/star/style/XStyle.hpp> +#include <o3tl/any.hxx> + #include <sax/tools/converter.hxx> #include <tools/debug.hxx> @@ -482,7 +484,7 @@ void XMLTextStyleContext::FillPropertySet( if ( nIndex != -1 ) { Any& rAny = GetProperties()[nIndex].maValue; - bool bVal = *static_cast<sal_Bool const *>(rAny.getValue()); + bool bVal = *o3tl::doGet<bool>(rAny); bHasCombinedCharactersLetter = bVal; } |