diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-06-10 18:54:49 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-06-10 18:54:49 +0200 |
commit | a7ce813f4898d99084f2b2929823acc9a2747ad4 (patch) | |
tree | 9fe6b88189ba90a4db83aebbb26d25cc5c653dfe /sd | |
parent | 047081b923ac62bc8aa47cf6ca3bc7fe513a9993 (diff) |
Clean up uses of Any::getValue() in sd
Change-Id: Ie4f165efd14d7cdfc99d600f3ddc000d438e0c6a
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/filter/eppt/eppt.cxx | 61 | ||||
-rw-r--r-- | sd/source/filter/eppt/epptso.cxx | 30 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-epptbase.cxx | 7 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 3 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-text.cxx | 162 | ||||
-rw-r--r-- | sd/source/filter/xml/sdxmlwrp.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/app/optsitem.cxx | 143 |
7 files changed, 201 insertions, 209 deletions
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index 3ac5cfc5e647..27184fd7cfc4 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -19,6 +19,7 @@ #include <eppt.hxx> #include "epptdef.hxx" +#include <o3tl/any.hxx> #include <tools/globname.hxx> #include <tools/poly.hxx> #include <vcl/graph.hxx> @@ -194,7 +195,7 @@ void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_ aAny >>= bVisible; if ( GetPropertyValue( aAny, mXPagePropSet, "Change" ) ) { - switch ( *static_cast<sal_Int32 const *>(aAny.getValue()) ) + switch ( *o3tl::doAccess<sal_Int32>(aAny) ) { case 1 : // automatic mnDiaMode++; @@ -272,7 +273,7 @@ void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_ nBuildFlags |= 256; if ( GetPropertyValue( aAny, mXPagePropSet, "Duration" ) )// duration of this slide - nSlideTime = *static_cast<sal_Int32 const *>(aAny.getValue()) << 10; // in ticks + nSlideTime = *o3tl::doAccess<sal_Int32>(aAny) << 10; // in ticks mpPptEscherEx->AddAtom( 16, EPP_SSSlideInfoAtom ); mpStrm->WriteInt32( nSlideTime ) // standtime in ticks @@ -532,8 +533,7 @@ bool PPTWriter::ImplCreateDocumentSummaryInformation() uno::Sequence<sal_Int8> aThumbSeq; if ( GetPageByIndex( 0, NORMAL ) && ImplGetPropertyValue( mXPagePropSet, "PreviewBitmap" ) ) { - aThumbSeq = - *static_cast<const uno::Sequence<sal_Int8>*>(mAny.getValue()); + aThumbSeq = *o3tl::doAccess<uno::Sequence<sal_Int8>>(mAny); } sfx2::SaveOlePropertySet( xDocProps, mrStg, &aThumbSeq, &aGuidSeq, &aHyperSeq); @@ -621,7 +621,7 @@ void PPTWriter::ImplCreateHeaderFooters( css::uno::Reference< css::beans::XPrope } if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, "DateTimeFormat", true ) ) { - sal_Int32 nFormat = *static_cast<sal_Int32 const *>(aAny.getValue()); + sal_Int32 nFormat = *o3tl::doAccess<sal_Int32>(aAny); SvxDateFormat eDateFormat = (SvxDateFormat)( nFormat & 0xf ); SvxTimeFormat eTimeFormat = (SvxTimeFormat)( ( nFormat >> 4 ) & 0xf ); switch( eDateFormat ) @@ -782,7 +782,7 @@ bool PPTWriter::ImplCreateDocument() if ( ImplGetPropertyValue( "CustomShow" ) ) { - aCustomShow = *static_cast<OUString const *>(mAny.getValue()); + aCustomShow = *o3tl::doAccess<OUString>(mAny); if ( !aCustomShow.isEmpty() ) { nFlags |= 8; @@ -792,10 +792,10 @@ bool PPTWriter::ImplCreateDocument() { if ( ImplGetPropertyValue( "FirstPage" ) ) { - OUString aSlideName( *static_cast<OUString const *>(mAny.getValue()) ); + auto aSlideName = o3tl::doAccess<OUString>(mAny); std::vector<OUString>::const_iterator pIter = std::find( - maSlideNameList.begin(),maSlideNameList.end(),aSlideName); + maSlideNameList.begin(),maSlideNameList.end(), *aSlideName); if (pIter != maSlideNameList.end()) { @@ -872,41 +872,34 @@ bool PPTWriter::ImplCreateDocument() const sal_Unicode* pCustomShowName = pUString[ i ].getStr(); for ( sal_uInt32 k = 0; k < nNamedShowLen; mpStrm->WriteUInt16( pCustomShowName[ k++ ] ) ) ; mAny = aXCont->getByName( pUString[ i ] ); - if ( mAny.getValue() ) + css::uno::Reference< css::container::XIndexContainer > aXIC; + if ( mAny >>= aXIC ) { + mpPptEscherEx->BeginAtom(); - css::uno::Reference< css::container::XIndexContainer > aXIC; - if ( mAny >>= aXIC ) + sal_Int32 nSlideCount = aXIC->getCount(); + for ( sal_Int32 j = 0; j < nSlideCount; j++ ) // number of slides { - mpPptEscherEx->BeginAtom(); - - sal_Int32 nSlideCount = aXIC->getCount(); - for ( sal_Int32 j = 0; j < nSlideCount; j++ ) // number of slides + mAny = aXIC->getByIndex( j ); + css::uno::Reference< css::drawing::XDrawPage > aXDrawPage; + if ( mAny >>= aXDrawPage ) { - mAny = aXIC->getByIndex( j ); - if ( mAny.getValue() ) + css::uno::Reference< css::container::XNamed > aXName( aXDrawPage, css::uno::UNO_QUERY ); + if ( aXName.is() ) { - css::uno::Reference< css::drawing::XDrawPage > aXDrawPage; - if ( mAny >>= aXDrawPage ) + OUString aSlideName( aXName->getName() ); + std::vector<OUString>::const_iterator pIter = std::find( + maSlideNameList.begin(),maSlideNameList.end(),aSlideName); + + if (pIter != maSlideNameList.end()) { - css::uno::Reference< css::container::XNamed > aXName( aXDrawPage, css::uno::UNO_QUERY ); - if ( aXName.is() ) - { - OUString aSlideName( aXName->getName() ); - std::vector<OUString>::const_iterator pIter = std::find( - maSlideNameList.begin(),maSlideNameList.end(),aSlideName); - - if (pIter != maSlideNameList.end()) - { - sal_uInt32 nPageNumber = pIter - maSlideNameList.begin(); - mpStrm->WriteUInt32( nPageNumber + 0x100 ); // unique slide id - } - } + sal_uInt32 nPageNumber = pIter - maSlideNameList.begin(); + mpStrm->WriteUInt32( nPageNumber + 0x100 ); // unique slide id } } } - mpPptEscherEx->EndAtom( EPP_NamedShowSlides ); } + mpPptEscherEx->EndAtom( EPP_NamedShowSlides ); } mpPptEscherEx->CloseContainer(); // EPP_NamedShow } @@ -1214,7 +1207,7 @@ void PPTWriter::ImplWriteBackground( css::uno::Reference< css::beans::XPropertyS { if ( ImplGetPropertyValue( rXPropSet, "FillColor" ) ) { - nFillColor = EscherEx::GetColor( *static_cast<sal_uInt32 const *>(mAny.getValue()) ); + nFillColor = EscherEx::GetColor( *o3tl::doAccess<sal_uInt32>(mAny) ); nFillBackColor = nFillColor ^ 0xffffff; } SAL_FALLTHROUGH; diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index b39777577692..478d89aa8c6e 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -843,7 +843,7 @@ void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj ) case css::drawing::FillStyle_SOLID : { if ( PropValue::GetPropertyValue( aAny, mXPropSet, "FillColor" ) ) - nBackgroundColor = EscherEx::GetColor( *static_cast<sal_uInt32 const *>(aAny.getValue()) ); + nBackgroundColor = EscherEx::GetColor( *o3tl::doAccess<sal_uInt32>(aAny) ); } break; case css::drawing::FillStyle_NONE : @@ -866,7 +866,7 @@ void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj ) case css::drawing::FillStyle_SOLID : { if ( PropValue::GetPropertyValue( aAny, mXBackgroundPropSet, "FillColor" ) ) - nBackgroundColor = EscherEx::GetColor( *static_cast<sal_uInt32 const *>(aAny.getValue()) ); + nBackgroundColor = EscherEx::GetColor( *o3tl::doAccess<sal_uInt32>(aAny) ); } break; default: @@ -901,7 +901,7 @@ void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj ) if ( PropValue::GetPropertyValue( aAny, aPropSetOfNextShape, "FillColor", true ) ) { - if ( nCharColor == EscherEx::GetColor( *static_cast<sal_uInt32 const *>(aAny.getValue()) ) ) + if ( nCharColor == EscherEx::GetColor( *o3tl::doAccess<sal_uInt32>(aAny) ) ) { nCharAttr |= 0x200; } @@ -1870,7 +1870,7 @@ void PPTWriter::ImplWriteObjectEffect( SvStream& rSt, { if ( ImplGetPropertyValue( "Sound" ) ) { - nSoundRef = maSoundCollection.GetId( *static_cast<OUString const *>(mAny.getValue()) ); + nSoundRef = maSoundCollection.GetId( *o3tl::doAccess<OUString>(mAny) ); if ( nSoundRef ) nFlags |= 0x10; } @@ -1887,7 +1887,7 @@ void PPTWriter::ImplWriteObjectEffect( SvStream& rSt, if ( bDimHide ) nAfterEffect |= 2; if ( ImplGetPropertyValue( "DimColor" ) ) - nDimColor = EscherEx::GetColor( *static_cast<sal_uInt32 const *>(mAny.getValue()) ) | 0xfe000000; + nDimColor = EscherEx::GetColor( *o3tl::doAccess<sal_uInt32>(mAny) ) | 0xfe000000; rSt.WriteUInt32( nDimColor ).WriteUInt32( nFlags ).WriteUInt32( nSoundRef ).WriteUInt32( nDelayTime ) .WriteUInt16( basegfx::clamp<sal_Int32>(nOrder, 0, SAL_MAX_UINT16) ) // order of build ( 1.. ) @@ -1956,14 +1956,14 @@ void PPTWriter::ImplWriteClickAction( SvStream& rSt, css::presentation::ClickAct case css::presentation::ClickAction_SOUND : { if ( ImplGetPropertyValue( "Bookmark" ) ) - nSoundRef = maSoundCollection.GetId( *static_cast<OUString const *>(mAny.getValue()) ); + nSoundRef = maSoundCollection.GetId( *o3tl::doAccess<OUString>(mAny) ); } break; case css::presentation::ClickAction_PROGRAM : { if ( ImplGetPropertyValue( "Bookmark" ) ) { - INetURLObject aUrl( *static_cast<OUString const *>(mAny.getValue()) ); + INetURLObject aUrl( *o3tl::doAccess<OUString>(mAny) ); if ( INetProtocol::File == aUrl.GetProtocol() ) { aFile = aUrl.PathToFileName(); @@ -1977,7 +1977,7 @@ void PPTWriter::ImplWriteClickAction( SvStream& rSt, css::presentation::ClickAct { if ( ImplGetPropertyValue( "Bookmark" ) ) { - OUString aBookmark( *static_cast<OUString const *>(mAny.getValue()) ); + OUString aBookmark( *o3tl::doAccess<OUString>(mAny) ); sal_uInt32 nIndex = 0; std::vector<OUString>::const_iterator pIter; for ( pIter = maSlideNameList.begin(); pIter != maSlideNameList.end(); ++pIter, nIndex++ ) @@ -2004,7 +2004,7 @@ void PPTWriter::ImplWriteClickAction( SvStream& rSt, css::presentation::ClickAct { if ( ImplGetPropertyValue( "Bookmark" ) ) { - OUString aBookmark( *static_cast<OUString const *>(mAny.getValue()) ); + OUString aBookmark( *o3tl::doAccess<OUString>(mAny) ); if ( !aBookmark.isEmpty() ) { nAction = 4; @@ -2266,9 +2266,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a { if ( ImplGetPropertyValue( "BoundRect" ) ) { - css::awt::Rectangle aRect( *static_cast<css::awt::Rectangle const *>(mAny.getValue()) ); - maPosition = MapPoint( css::awt::Point( aRect.X, aRect.Y ) ); - maSize = MapSize( css::awt::Size( aRect.Width, aRect.Height ) ); + auto aRect = o3tl::doAccess<css::awt::Rectangle>(mAny); + maPosition = MapPoint( css::awt::Point( aRect->X, aRect->Y ) ); + maSize = MapSize( css::awt::Size( aRect->Width, aRect->Height ) ); maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) ); } mType = "drawing.dontknow"; @@ -2387,10 +2387,10 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a sal_Int32 nStartAngle, nEndAngle; if ( !ImplGetPropertyValue( "CircleStartAngle" ) ) continue; - nStartAngle = *static_cast<sal_Int32 const *>(mAny.getValue()); + nStartAngle = *o3tl::doAccess<sal_Int32>(mAny); if( !ImplGetPropertyValue( "CircleEndAngle" ) ) continue; - nEndAngle = *static_cast<sal_Int32 const *>(mAny.getValue()); + nEndAngle = *o3tl::doAccess<sal_Int32>(mAny); css::awt::Point aPoint( mXShape->getPosition() ); css::awt::Size aSize( mXShape->getSize() ); css::awt::Point aStart, aEnd, aCenter; @@ -3409,7 +3409,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a EscherPropertyContainer aPropOpt; mnAngle = ( PropValue::GetPropertyValue( aAny, mXPropSet, "RotateAngle", true ) ) - ? *static_cast<sal_Int32 const *>(aAny.getValue()) + ? *o3tl::doAccess<sal_Int32>(aAny) : 0; aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 ); diff --git a/sd/source/filter/eppt/pptx-epptbase.cxx b/sd/source/filter/eppt/pptx-epptbase.cxx index 85db3a1e2c99..d228d60c9cf3 100644 --- a/sd/source/filter/eppt/pptx-epptbase.cxx +++ b/sd/source/filter/eppt/pptx-epptbase.cxx @@ -20,6 +20,7 @@ #include "eppt.hxx" #include "epptdef.hxx" +#include <o3tl/any.hxx> #include <tools/globname.hxx> #include <tools/datetime.hxx> #include <tools/poly.hxx> @@ -483,7 +484,7 @@ sal_uInt32 PPTWriterBase::GetMasterIndex( PageType ePageType ) if ( aXPropertySet.is() ) { if ( ImplGetPropertyValue( aXPropertySet, "Number" ) ) - nRetValue |= *static_cast<sal_Int16 const *>(mAny.getValue()); + nRetValue |= *o3tl::doAccess<sal_Int16>(mAny); if ( nRetValue & 0xffff ) // avoid overflow nRetValue--; } @@ -522,7 +523,7 @@ bool PPTWriterBase::GetStyleSheets() aXPropSet( mXModel, UNO_QUERY ); sal_uInt16 nDefaultTab = ( aXPropSet.is() && ImplGetPropertyValue( aXPropSet, "TabStop" ) ) - ? (sal_uInt16)( *static_cast<sal_Int32 const *>(mAny.getValue()) / 4.40972 ) + ? (sal_uInt16)( *o3tl::doAccess<sal_Int32>(mAny) / 4.40972 ) : 1250; maStyleSheetList.push_back( new PPTExStyleSheet( nDefaultTab, dynamic_cast<PPTExBulletProvider*>(this) ) ); @@ -733,7 +734,7 @@ bool PPTWriterBase::GetShapeByIndex( sal_uInt32 nIndex, bool bGroup ) mnAngle = ( PropValue::GetPropertyValue( aAny, mXPropSet, "RotateAngle", true ) ) - ? *static_cast<sal_Int32 const *>(aAny.getValue()) + ? *o3tl::doAccess<sal_Int32>(aAny) : 0; return true; diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 3f39af3e3235..3589abfd4c5a 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -18,6 +18,7 @@ */ #include <stdio.h> +#include <o3tl/any.hxx> #include <oox/drawingml/chart/chartconverter.hxx> #include <oox/token/tokens.hxx> #include <oox/ole/vbaproject.hxx> @@ -800,7 +801,7 @@ void PowerPointExport::WriteAnimationProperty( const FSHelperPtr& pFS, const Any switch( rAny.getValueType().getTypeClass() ) { case TypeClass_STRING: pFS->singleElementNS( XML_p, XML_strVal, - XML_val, USS( *static_cast< const OUString* >( rAny.getValue() ) ), + XML_val, USS( *o3tl::doAccess<OUString>(rAny) ), FSEND ); break; default: diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx index 49c1addd42d0..4664a8a051a2 100644 --- a/sd/source/filter/eppt/pptx-text.cxx +++ b/sd/source/filter/eppt/pptx-text.cxx @@ -41,6 +41,7 @@ #include <editeng/frmdir.hxx> #include <filter/msfilter/util.hxx> #include <i18nutil/scripttypedetector.hxx> +#include <o3tl/any.hxx> #include <sfx2/app.hxx> #include <svl/languageoptions.hxx> #include <oox/export/drawingml.hxx> @@ -231,7 +232,7 @@ void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, bool bGe meFontName = ePropState; if ( bOk ) { - FontCollectionEntry aFontDesc( *static_cast<OUString const *>(mAny.getValue()) ); + FontCollectionEntry aFontDesc( *o3tl::doAccess<OUString>(mAny) ); sal_uInt32 nCount = rFontCollection.GetCount(); mnFont = (sal_uInt16)rFontCollection.GetId( aFontDesc ); if ( mnFont == nCount ) @@ -258,7 +259,7 @@ void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, bool bGe meAsianOrComplexFont = ePropState; if ( bOk ) { - FontCollectionEntry aFontDesc( *static_cast<OUString const *>(mAny.getValue()) ); + FontCollectionEntry aFontDesc( *o3tl::doAccess<OUString>(mAny) ); sal_uInt32 nCount = rFontCollection.GetCount(); mnAsianOrComplexFont = (sal_uInt16)rFontCollection.GetId( aFontDesc ); if ( mnAsianOrComplexFont == nCount ) @@ -279,7 +280,7 @@ void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, bool bGe meAsianOrComplexFont = ePropState; if ( bOk ) { - FontCollectionEntry aFontDesc( *static_cast<OUString const *>(mAny.getValue()) ); + FontCollectionEntry aFontDesc( *o3tl::doAccess<OUString>(mAny) ); sal_uInt32 nCount = rFontCollection.GetCount(); mnAsianOrComplexFont = (sal_uInt16)rFontCollection.GetId( aFontDesc ); if ( mnAsianOrComplexFont == nCount ) @@ -407,7 +408,7 @@ void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, bool bGe if ( ImplGetPropertyValue( "CharColor", bGetPropStateValue ) ) { - sal_uInt32 nSOColor = *( static_cast<sal_uInt32 const *>(mAny.getValue()) ); + sal_uInt32 nSOColor = *( o3tl::doAccess<sal_uInt32>(mAny) ); mnCharColor = nSOColor & 0xff00ff00; // green and hibyte mnCharColor |= (sal_uInt8)( nSOColor ) << 16; // red and blue is switched mnCharColor |= (sal_uInt8)( nSOColor >> 16 ); @@ -495,10 +496,10 @@ sal_uInt32 PortionObj::ImplGetTextField( css::uno::Reference< css::text::XTextRa css::uno::Any aAny; if ( GetPropertyValue( aAny, rXPropSet, "TextPortionType", true ) ) { - OUString aTextFieldType( *static_cast<OUString const *>(aAny.getValue()) ); - if ( aTextFieldType == "TextField" ) + auto aTextFieldType = o3tl::doAccess<OUString>(aAny); + if ( *aTextFieldType == "TextField" ) { - if ( GetPropertyValue( aAny, rXPropSet, aTextFieldType, true ) ) + if ( GetPropertyValue( aAny, rXPropSet, *aTextFieldType, true ) ) { css::uno::Reference< css::text::XTextField > aXTextField; if ( aAny >>= aXTextField ) @@ -519,7 +520,7 @@ sal_uInt32 PortionObj::ImplGetTextField( css::uno::Reference< css::text::XTextRa { if ( GetPropertyValue( aAny, xFieldPropSet, "Format", true ) ) { - nFormat = *static_cast<sal_Int32 const *>(aAny.getValue()); + nFormat = *o3tl::doAccess<sal_Int32>(aAny); switch ( nFormat ) { default: @@ -540,7 +541,7 @@ sal_uInt32 PortionObj::ImplGetTextField( css::uno::Reference< css::text::XTextRa else if ( aFieldKind == "URL" ) { if ( GetPropertyValue( aAny, xFieldPropSet, "URL", true ) ) - rURL = *static_cast<OUString const *>(aAny.getValue()); + rURL = *o3tl::doAccess<OUString>(aAny); nRetValue = 4 << 28; } else if ( aFieldKind == "Page" ) @@ -561,7 +562,7 @@ sal_uInt32 PortionObj::ImplGetTextField( css::uno::Reference< css::text::XTextRa { if ( GetPropertyValue( aAny, xFieldPropSet, "IsFix", true ) ) { - nFormat = *static_cast<sal_Int32 const *>(aAny.getValue()); + nFormat = *o3tl::doAccess<sal_Int32>(aAny); nRetValue |= ( ( ( 2 << 4 ) | nFormat ) << 24 ) | 0x800000; } } @@ -585,7 +586,7 @@ sal_uInt32 PortionObj::ImplGetTextField( css::uno::Reference< css::text::XTextRa { if ( GetPropertyValue( aAny, xFieldPropSet, "Format", true ) ) { - nFormat = *static_cast<sal_Int32 const *>(aAny.getValue()); + nFormat = *o3tl::doAccess<sal_Int32>(aAny); switch ( nFormat ) { default: @@ -799,12 +800,11 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider* pBuProv, sal_Int1 if ( ( mAny >>= aXIndexReplace ) && nNumberingDepth < aXIndexReplace->getCount() ) { mAny <<= aXIndexReplace->getByIndex( nNumberingDepth ); - css::uno::Sequence< css::beans::PropertyValue> - aPropertySequence( *static_cast<css::uno::Sequence< css::beans::PropertyValue> const *>(mAny.getValue()) ); + auto aPropertySequence = o3tl::doAccess<css::uno::Sequence<css::beans::PropertyValue>>(mAny); - const css::beans::PropertyValue* pPropValue = aPropertySequence.getArray(); + const css::beans::PropertyValue* pPropValue = aPropertySequence->getConstArray(); - sal_Int32 nPropertyCount = aPropertySequence.getLength(); + sal_Int32 nPropertyCount = aPropertySequence->getLength(); if ( nPropertyCount ) { bExtendedParameters = true; @@ -814,77 +814,71 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider* pBuProv, sal_Int1 OUString aGraphicURL; for ( sal_Int32 i = 0; i < nPropertyCount; i++ ) { - const void* pValue = pPropValue[ i ].Value.getValue(); - if ( pValue ) + OUString aPropName( pPropValue[ i ].Name ); + if ( aPropName == "NumberingType" ) + nNumberingType = *o3tl::doAccess<sal_Int16>(pPropValue[i].Value); + else if ( aPropName == "Adjust" ) + nHorzAdjust = *o3tl::doAccess<sal_Int16>(pPropValue[i].Value); + else if ( aPropName == "BulletChar" ) { - OUString aPropName( pPropValue[ i ].Name ); - if ( aPropName == "NumberingType" ) - nNumberingType = *( static_cast<sal_Int16 const *>(pValue) ); - else if ( aPropName == "Adjust" ) - nHorzAdjust = *( static_cast<sal_Int16 const *>(pValue) ); - else if ( aPropName == "BulletChar" ) - { - OUString aString( *( static_cast<OUString const *>(pValue) ) ); - if ( !aString.isEmpty() ) - cBulletId = aString[ 0 ]; - } - else if ( aPropName == "BulletFont" ) - { - aFontDesc = *static_cast<css::awt::FontDescriptor const *>(pValue); + OUString aString( *o3tl::doAccess<OUString>(pPropValue[i].Value) ); + if ( !aString.isEmpty() ) + cBulletId = aString[ 0 ]; + } + else if ( aPropName == "BulletFont" ) + { + aFontDesc = *o3tl::doAccess<css::awt::FontDescriptor>(pPropValue[i].Value); - // Our numbullet dialog has set the wrong textencoding for our "StarSymbol" font, - // instead of a Unicode encoding the encoding RTL_TEXTENCODING_SYMBOL was used. - // Because there might exist a lot of damaged documemts I added this two lines - // which fixes the bullet problem for the export. - if ( aFontDesc.Name.equalsIgnoreAsciiCase("StarSymbol") ) - aFontDesc.CharSet = RTL_TEXTENCODING_MS_1252; + // Our numbullet dialog has set the wrong textencoding for our "StarSymbol" font, + // instead of a Unicode encoding the encoding RTL_TEXTENCODING_SYMBOL was used. + // Because there might exist a lot of damaged documemts I added this two lines + // which fixes the bullet problem for the export. + if ( aFontDesc.Name.equalsIgnoreAsciiCase("StarSymbol") ) + aFontDesc.CharSet = RTL_TEXTENCODING_MS_1252; - } - else if ( aPropName == "GraphicURL" ) - aGraphicURL = *static_cast<OUString const *>(pValue); - else if ( aPropName == "GraphicSize" ) - { - if ( pPropValue[ i ].Value.getValueType() == cppu::UnoType<css::awt::Size>::get()) - { - // don't cast awt::Size to Size as on 64-bits they are not the same. - css::awt::Size aSize; - pPropValue[ i ].Value >>= aSize; - aBuGraSize.A() = aSize.Width; - aBuGraSize.B() = aSize.Height; - } - } - else if ( aPropName == "StartWith" ) - nStartWith = *static_cast<sal_Int16 const *>(pValue); - else if ( aPropName == "LeftMargin" ) - nTextOfs = nTextOfs + static_cast< sal_Int16 >( *static_cast<sal_Int32 const *>(pValue) / ( 2540.0 / 576 ) ); - else if ( aPropName == "FirstLineOffset" ) - nBulletOfs += (sal_Int16)( *static_cast<sal_Int32 const *>(pValue) / ( 2540.0 / 576 ) ); - else if ( aPropName == "BulletColor" ) - { - sal_uInt32 nSOColor = *static_cast<sal_uInt32 const *>(pValue); - nBulletColor = nSOColor & 0xff00ff00; // green and hibyte - nBulletColor |= (sal_uInt8)( nSOColor ) << 16; // red - nBulletColor |= (sal_uInt8)( nSOColor >> 16 ) | 0xfe000000; // blue - } - else if ( aPropName == "BulletRelSize" ) + } + else if ( aPropName == "GraphicURL" ) + aGraphicURL = *o3tl::doAccess<OUString>(pPropValue[i].Value); + else if ( aPropName == "GraphicSize" ) + { + if (auto aSize = o3tl::tryAccess<css::awt::Size>(pPropValue[i].Value)) { - nBulletRealSize = *static_cast<sal_Int16 const *>(pValue); - nParaFlags |= 0x40; - nBulletFlags |= 8; + // don't cast awt::Size to Size as on 64-bits they are not the same. + aBuGraSize.A() = aSize->Width; + aBuGraSize.B() = aSize->Height; } - else if ( aPropName == "Prefix" ) - sPrefix = *static_cast<OUString const *>(pValue); - else if ( aPropName == "Suffix" ) - sSuffix = *static_cast<OUString const *>(pValue); + } + else if ( aPropName == "StartWith" ) + nStartWith = *o3tl::doAccess<sal_Int16>(pPropValue[i].Value); + else if ( aPropName == "LeftMargin" ) + nTextOfs = nTextOfs + static_cast< sal_Int16 >( *o3tl::doAccess<sal_Int32>(pPropValue[i].Value) / ( 2540.0 / 576 ) ); + else if ( aPropName == "FirstLineOffset" ) + nBulletOfs += (sal_Int16)( *o3tl::doAccess<sal_Int32>(pPropValue[i].Value) / ( 2540.0 / 576 ) ); + else if ( aPropName == "BulletColor" ) + { + sal_uInt32 nSOColor = *o3tl::doAccess<sal_uInt32>(pPropValue[i].Value); + nBulletColor = nSOColor & 0xff00ff00; // green and hibyte + nBulletColor |= (sal_uInt8)( nSOColor ) << 16; // red + nBulletColor |= (sal_uInt8)( nSOColor >> 16 ) | 0xfe000000; // blue + } + else if ( aPropName == "BulletRelSize" ) + { + nBulletRealSize = *o3tl::doAccess<sal_Int16>(pPropValue[i].Value); + nParaFlags |= 0x40; + nBulletFlags |= 8; + } + else if ( aPropName == "Prefix" ) + sPrefix = *o3tl::doAccess<OUString>(pPropValue[i].Value); + else if ( aPropName == "Suffix" ) + sSuffix = *o3tl::doAccess<OUString>(pPropValue[i].Value); #ifdef DBG_UTIL - else if ( ! ( - ( aPropName == "SymbolTextDistance" ) - || ( aPropName == "Graphic" ) ) ) - { - OSL_FAIL( "Unknown Property" ); - } -#endif + else if ( ! ( + ( aPropName == "SymbolTextDistance" ) + || ( aPropName == "Graphic" ) ) ) + { + OSL_FAIL( "Unknown Property" ); } +#endif } if ( !aGraphicURL.isEmpty() ) @@ -1098,7 +1092,7 @@ void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider* pBuProv, bool bG { if ( bGetPropStateValue ) meBullet = GetPropertyState( mXPropSet, "NumberingLevel" ); - nDepth = *static_cast<sal_Int16 const *>(aAny.getValue()); + nDepth = *o3tl::doAccess<sal_Int16>(aAny); if ( nDepth < 0 ) { @@ -1120,7 +1114,7 @@ void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider* pBuProv, bool bG ImplGetNumberingLevel( pBuProv, nDepth, mbIsBullet, bGetPropStateValue ); if ( ImplGetPropertyValue( "ParaTabStops", bGetPropStateValue ) ) - maTabStop = *static_cast<css::uno::Sequence< css::style::TabStop> const *>(mAny.getValue()); + maTabStop = *o3tl::doAccess<css::uno::Sequence<css::style::TabStop>>(mAny); sal_Int16 eTextAdjust( css::style::ParagraphAdjust_LEFT ); if ( GetPropertyValue( aAny, mXPropSet, "ParaAdjust", bGetPropStateValue ) ) aAny >>= eTextAdjust; @@ -1145,7 +1139,7 @@ void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider* pBuProv, bool bG if ( ImplGetPropertyValue( "ParaLineSpacing", bGetPropStateValue ) ) { css::style::LineSpacing aLineSpacing - = *static_cast<css::style::LineSpacing const *>(mAny.getValue()); + = *o3tl::doAccess<css::style::LineSpacing>(mAny); switch ( aLineSpacing.Mode ) { case css::style::LineSpacingMode::FIX : @@ -1168,14 +1162,14 @@ void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider* pBuProv, bool bG if ( ImplGetPropertyValue( "ParaBottomMargin", bGetPropStateValue ) ) { - double fSpacing = *static_cast<sal_uInt32 const *>(mAny.getValue()) + ( 2540.0 / 576.0 ) - 1; + double fSpacing = *o3tl::doAccess<sal_uInt32>(mAny) + ( 2540.0 / 576.0 ) - 1; mnLineSpacingBottom = (sal_Int16)(-( fSpacing * 576.0 / 2540.0 ) ); } meLineSpacingBottom = ePropState; if ( ImplGetPropertyValue( "ParaTopMargin", bGetPropStateValue ) ) { - double fSpacing = *static_cast<sal_uInt32 const *>(mAny.getValue()) + ( 2540.0 / 576.0 ) - 1; + double fSpacing = *o3tl::doAccess<sal_uInt32>(mAny) + ( 2540.0 / 576.0 ) - 1; mnLineSpacingTop = (sal_Int16)(-( fSpacing * 576.0 / 2540.0 ) ); } meLineSpacingTop = ePropState; diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx index bd0db7f58a12..535b51f64eb8 100644 --- a/sd/source/filter/xml/sdxmlwrp.cxx +++ b/sd/source/filter/xml/sdxmlwrp.cxx @@ -363,8 +363,8 @@ sal_Int32 ReadThroughComponent( Any aAny = xProps->getPropertyValue( "Encrypted" ); - bool bEncrypted = aAny.getValueType() == cppu::UnoType<bool>::get() && - *static_cast<sal_Bool const *>(aAny.getValue()); + bool bEncrypted = false; + aAny >>= bEncrypted; Reference <io::XInputStream> xInputStream = xStream->getInputStream(); diff --git a/sd/source/ui/app/optsitem.cxx b/sd/source/ui/app/optsitem.cxx index 6bca731498c5..28864c46b545 100644 --- a/sd/source/ui/app/optsitem.cxx +++ b/sd/source/ui/app/optsitem.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 <svx/svdmodel.hxx> #include <sfx2/app.hxx> #include <sfx2/sfx.hrc> @@ -233,13 +236,13 @@ void SdOptionsLayout::GetPropNameArray( const char**& ppNames, sal_uLong& rCount bool SdOptionsLayout::ReadData( const Any* pValues ) { - if( pValues[0].hasValue() ) SetRulerVisible( *static_cast<sal_Bool const *>(pValues[ 0 ].getValue()) ); - if( pValues[1].hasValue() ) SetHandlesBezier( *static_cast<sal_Bool const *>(pValues[ 1 ].getValue()) ); - if( pValues[2].hasValue() ) SetMoveOutline( *static_cast<sal_Bool const *>(pValues[ 2 ].getValue()) ); - if( pValues[3].hasValue() ) SetDragStripes( *static_cast<sal_Bool const *>(pValues[ 3 ].getValue()) ); - if( pValues[4].hasValue() ) SetHelplines( *static_cast<sal_Bool const *>(pValues[ 4 ].getValue()) ); - if( pValues[5].hasValue() ) SetMetric( (sal_uInt16) *static_cast<sal_Int32 const *>(pValues[ 5 ].getValue()) ); - if( pValues[6].hasValue() ) SetDefTab( (sal_uInt16) *static_cast<sal_Int32 const *>(pValues[ 6 ].getValue()) ); + if( pValues[0].hasValue() ) SetRulerVisible( *o3tl::doAccess<bool>(pValues[ 0 ]) ); + if( pValues[1].hasValue() ) SetHandlesBezier( *o3tl::doAccess<bool>(pValues[ 1 ]) ); + if( pValues[2].hasValue() ) SetMoveOutline( *o3tl::doAccess<bool>(pValues[ 2 ]) ); + if( pValues[3].hasValue() ) SetDragStripes( *o3tl::doAccess<bool>(pValues[ 3 ]) ); + if( pValues[4].hasValue() ) SetHelplines( *o3tl::doAccess<bool>(pValues[ 4 ]) ); + if( pValues[5].hasValue() ) SetMetric( (sal_uInt16) *o3tl::doAccess<sal_Int32>(pValues[ 5 ]) ); + if( pValues[6].hasValue() ) SetDefTab( (sal_uInt16) *o3tl::doAccess<sal_Int32>(pValues[ 6 ]) ); return true; } @@ -523,46 +526,46 @@ void SdOptionsMisc::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) bool SdOptionsMisc::ReadData( const Any* pValues ) { - if( pValues[0].hasValue() ) SetMarkedHitMovesAlways( *static_cast<sal_Bool const *>(pValues[ 0 ].getValue()) ); - if( pValues[1].hasValue() ) SetCrookNoContortion( *static_cast<sal_Bool const *>(pValues[ 1 ].getValue()) ); - if( pValues[2].hasValue() ) SetQuickEdit( *static_cast<sal_Bool const *>(pValues[ 2 ].getValue()) ); - if( pValues[3].hasValue() ) SetMasterPagePaintCaching( *static_cast<sal_Bool const *>(pValues[ 3 ].getValue()) ); - if( pValues[4].hasValue() ) SetDragWithCopy( *static_cast<sal_Bool const *>(pValues[ 4 ].getValue()) ); - if( pValues[5].hasValue() ) SetPickThrough( *static_cast<sal_Bool const *>(pValues[ 5 ].getValue()) ); - if( pValues[6].hasValue() ) SetDoubleClickTextEdit( *static_cast<sal_Bool const *>(pValues[ 6 ].getValue()) ); - if( pValues[7].hasValue() ) SetClickChangeRotation( *static_cast<sal_Bool const *>(pValues[ 7 ].getValue()) ); - if( pValues[9].hasValue() ) SetSolidDragging( *static_cast<sal_Bool const *>(pValues[ 9 ].getValue()) ); - if( pValues[10].hasValue() ) SetDefaultObjectSizeWidth( *static_cast<sal_uInt32 const *>(pValues[ 10 ].getValue()) ); - if( pValues[11].hasValue() ) SetDefaultObjectSizeHeight( *static_cast<sal_uInt32 const *>(pValues[ 11 ].getValue()) ); - if( pValues[12].hasValue() ) SetPrinterIndependentLayout( *static_cast<sal_uInt16 const *>(pValues[ 12 ].getValue()) ); + if( pValues[0].hasValue() ) SetMarkedHitMovesAlways( *o3tl::doAccess<bool>(pValues[ 0 ]) ); + if( pValues[1].hasValue() ) SetCrookNoContortion( *o3tl::doAccess<bool>(pValues[ 1 ]) ); + if( pValues[2].hasValue() ) SetQuickEdit( *o3tl::doAccess<bool>(pValues[ 2 ]) ); + if( pValues[3].hasValue() ) SetMasterPagePaintCaching( *o3tl::doAccess<bool>(pValues[ 3 ]) ); + if( pValues[4].hasValue() ) SetDragWithCopy( *o3tl::doAccess<bool>(pValues[ 4 ]) ); + if( pValues[5].hasValue() ) SetPickThrough( *o3tl::doAccess<bool>(pValues[ 5 ]) ); + if( pValues[6].hasValue() ) SetDoubleClickTextEdit( *o3tl::doAccess<bool>(pValues[ 6 ]) ); + if( pValues[7].hasValue() ) SetClickChangeRotation( *o3tl::doAccess<bool>(pValues[ 7 ]) ); + if( pValues[9].hasValue() ) SetSolidDragging( *o3tl::doAccess<bool>(pValues[ 9 ]) ); + if( pValues[10].hasValue() ) SetDefaultObjectSizeWidth( *o3tl::doAccess<sal_uInt32>(pValues[ 10 ]) ); + if( pValues[11].hasValue() ) SetDefaultObjectSizeHeight( *o3tl::doAccess<sal_uInt32>(pValues[ 11 ]) ); + if( pValues[12].hasValue() ) SetPrinterIndependentLayout( *o3tl::doAccess<sal_uInt16>(pValues[ 12 ]) ); if( pValues[13].hasValue() ) - SetShowComments( *static_cast<sal_Bool const *>(pValues[ 13 ].getValue()) ); + SetShowComments( *o3tl::doAccess<bool>(pValues[ 13 ]) ); // just for Impress if( GetConfigId() == SDCFG_IMPRESS ) { if( pValues[14].hasValue() ) - SetStartWithTemplate( *static_cast<sal_Bool const *>(pValues[ 14 ].getValue()) ); + SetStartWithTemplate( *o3tl::doAccess<bool>(pValues[ 14 ]) ); if( pValues[15].hasValue() ) - SetSummationOfParagraphs( *static_cast<sal_Bool const *>(pValues[ 15 ].getValue()) ); + SetSummationOfParagraphs( *o3tl::doAccess<bool>(pValues[ 15 ]) ); if( pValues[16].hasValue() ) - SetShowUndoDeleteWarning( *static_cast<sal_Bool const *>(pValues[ 16 ].getValue()) ); + SetShowUndoDeleteWarning( *o3tl::doAccess<bool>(pValues[ 16 ]) ); if( pValues[17].hasValue() ) - SetSlideshowRespectZOrder(*static_cast<sal_Bool const *>(pValues[ 17 ].getValue())); + SetSlideshowRespectZOrder(*o3tl::doAccess<bool>(pValues[ 17 ])); if( pValues[18].hasValue() ) - SetPreviewNewEffects(*static_cast<sal_Bool const *>(pValues[ 18 ].getValue())); + SetPreviewNewEffects(*o3tl::doAccess<bool>(pValues[ 18 ])); if( pValues[19].hasValue() ) - SetPreviewChangedEffects(*static_cast<sal_Bool const *>(pValues[ 19 ].getValue())); + SetPreviewChangedEffects(*o3tl::doAccess<bool>(pValues[ 19 ])); if( pValues[20].hasValue() ) - SetPreviewTransitions(*static_cast<sal_Bool const *>(pValues[ 20 ].getValue())); + SetPreviewTransitions(*o3tl::doAccess<bool>(pValues[ 20 ])); if( pValues[21].hasValue() ) - SetDisplay(*static_cast<sal_Int32 const *>(pValues[ 21 ].getValue())); + SetDisplay(*o3tl::doAccess<sal_Int32>(pValues[ 21 ])); if( pValues[22].hasValue() ) SetPresentationPenColor( getSafeValue< sal_Int32 >( pValues[ 22 ] ) ); @@ -571,13 +574,13 @@ bool SdOptionsMisc::ReadData( const Any* pValues ) SetPresentationPenWidth( getSafeValue< double >( pValues[ 23 ] ) ); if( pValues[24].hasValue() ) - SetEnableSdremote( *static_cast<sal_Bool const *>(pValues[ 24 ].getValue()) ); + SetEnableSdremote( *o3tl::doAccess<bool>(pValues[ 24 ]) ); if( pValues[25].hasValue() ) - SetEnablePresenterScreen( *static_cast<sal_Bool const *>(pValues[ 25 ].getValue()) ); + SetEnablePresenterScreen( *o3tl::doAccess<bool>(pValues[ 25 ]) ); if( pValues[26].hasValue() ) { - SetTabBarVisible( *static_cast<sal_Bool const *>(pValues[ 26 ].getValue()) ); + SetTabBarVisible( *o3tl::doAccess<bool>(pValues[ 26 ]) ); } } @@ -808,16 +811,16 @@ void SdOptionsSnap::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) bool SdOptionsSnap::ReadData( const Any* pValues ) { - if( pValues[0].hasValue() ) SetSnapHelplines( *static_cast<sal_Bool const *>(pValues[ 0 ].getValue()) ); - if( pValues[1].hasValue() ) SetSnapBorder( *static_cast<sal_Bool const *>(pValues[ 1 ].getValue()) ); - if( pValues[2].hasValue() ) SetSnapFrame( *static_cast<sal_Bool const *>(pValues[ 2 ].getValue()) ); - if( pValues[3].hasValue() ) SetSnapPoints( *static_cast<sal_Bool const *>(pValues[ 3 ].getValue()) ); - if( pValues[4].hasValue() ) SetOrtho( *static_cast<sal_Bool const *>(pValues[ 4 ].getValue()) ); - if( pValues[5].hasValue() ) SetBigOrtho( *static_cast<sal_Bool const *>(pValues[ 5 ].getValue()) ); - if( pValues[6].hasValue() ) SetRotate( *static_cast<sal_Bool const *>(pValues[ 6 ].getValue()) ); - if( pValues[7].hasValue() ) SetSnapArea( (sal_Int16) *static_cast<sal_Int32 const *>(pValues[ 7 ].getValue()) ); - if( pValues[8].hasValue() ) SetAngle( (sal_Int16) *static_cast<sal_Int32 const *>(pValues[ 8 ].getValue()) ); - if( pValues[9].hasValue() ) SetEliminatePolyPointLimitAngle( (sal_Int16) *static_cast<sal_Int32 const *>(pValues[ 9 ].getValue()) ); + if( pValues[0].hasValue() ) SetSnapHelplines( *o3tl::doAccess<bool>(pValues[ 0 ]) ); + if( pValues[1].hasValue() ) SetSnapBorder( *o3tl::doAccess<bool>(pValues[ 1 ]) ); + if( pValues[2].hasValue() ) SetSnapFrame( *o3tl::doAccess<bool>(pValues[ 2 ]) ); + if( pValues[3].hasValue() ) SetSnapPoints( *o3tl::doAccess<bool>(pValues[ 3 ]) ); + if( pValues[4].hasValue() ) SetOrtho( *o3tl::doAccess<bool>(pValues[ 4 ]) ); + if( pValues[5].hasValue() ) SetBigOrtho( *o3tl::doAccess<bool>(pValues[ 5 ]) ); + if( pValues[6].hasValue() ) SetRotate( *o3tl::doAccess<bool>(pValues[ 6 ]) ); + if( pValues[7].hasValue() ) SetSnapArea( (sal_Int16) *o3tl::doAccess<sal_Int32>(pValues[ 7 ]) ); + if( pValues[8].hasValue() ) SetAngle( (sal_Int16) *o3tl::doAccess<sal_Int32>(pValues[ 8 ]) ); + if( pValues[9].hasValue() ) SetEliminatePolyPointLimitAngle( (sal_Int16) *o3tl::doAccess<sal_Int32>(pValues[ 9 ]) ); return true; } @@ -944,8 +947,8 @@ bool SdOptionsZoom::ReadData( const Any* pValues ) { sal_Int32 x = 1, y = 1; - if( pValues[0].hasValue() ) x = ( *static_cast<sal_Int32 const *>(pValues[ 0 ].getValue()) ); - if( pValues[1].hasValue() ) y = ( *static_cast<sal_Int32 const *>(pValues[ 1 ].getValue()) ); + if( pValues[0].hasValue() ) x = *o3tl::doAccess<sal_Int32>(pValues[ 0 ]); + if( pValues[1].hasValue() ) y = *o3tl::doAccess<sal_Int32>(pValues[ 1 ]); SetScale( x, y ); @@ -1044,27 +1047,27 @@ void SdOptionsGrid::GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) bool SdOptionsGrid::ReadData( const Any* pValues ) { - if( pValues[0].hasValue() ) SetFieldDrawX( *static_cast<sal_Int32 const *>(pValues[ 0 ].getValue()) ); - if( pValues[1].hasValue() ) SetFieldDrawY( *static_cast<sal_Int32 const *>(pValues[ 1 ].getValue()) ); + if( pValues[0].hasValue() ) SetFieldDrawX( *o3tl::doAccess<sal_Int32>(pValues[ 0 ]) ); + if( pValues[1].hasValue() ) SetFieldDrawY( *o3tl::doAccess<sal_Int32>(pValues[ 1 ]) ); if( pValues[2].hasValue() ) { - const sal_uInt32 nDivX = FRound( *static_cast<double const *>(pValues[ 2 ].getValue()) ); + const sal_uInt32 nDivX = FRound( *o3tl::doAccess<double>(pValues[ 2 ]) ); SetFieldDivisionX( SvxOptionsGrid::GetFieldDrawX() / ( nDivX + 1 ) ); } if( pValues[3].hasValue() ) { - const sal_uInt32 nDivY = FRound( *static_cast<double const *>(pValues[ 3 ].getValue()) ); + const sal_uInt32 nDivY = FRound( *o3tl::doAccess<double>(pValues[ 3 ]) ); SetFieldDivisionY( SvxOptionsGrid::GetFieldDrawY() / ( nDivY + 1 ) ); } - if( pValues[4].hasValue() ) SetFieldSnapX( *static_cast<sal_Int32 const *>(pValues[ 4 ].getValue()) ); - if( pValues[5].hasValue() ) SetFieldSnapY( *static_cast<sal_Int32 const *>(pValues[ 5 ].getValue()) ); - if( pValues[6].hasValue() ) SetUseGridSnap( *static_cast<sal_Bool const *>(pValues[ 6 ].getValue()) ); - if( pValues[7].hasValue() ) SetSynchronize( *static_cast<sal_Bool const *>(pValues[ 7 ].getValue()) ); - if( pValues[8].hasValue() ) SetGridVisible( *static_cast<sal_Bool const *>(pValues[ 8 ].getValue()) ); - if( pValues[9].hasValue() ) SetEqualGrid( *static_cast<sal_Bool const *>(pValues[ 9 ].getValue()) ); + if( pValues[4].hasValue() ) SetFieldSnapX( *o3tl::doAccess<sal_Int32>(pValues[ 4 ]) ); + if( pValues[5].hasValue() ) SetFieldSnapY( *o3tl::doAccess<sal_Int32>(pValues[ 5 ]) ); + if( pValues[6].hasValue() ) SetUseGridSnap( *o3tl::doAccess<bool>(pValues[ 6 ]) ); + if( pValues[7].hasValue() ) SetSynchronize( *o3tl::doAccess<bool>(pValues[ 7 ]) ); + if( pValues[8].hasValue() ) SetGridVisible( *o3tl::doAccess<bool>(pValues[ 8 ]) ); + if( pValues[9].hasValue() ) SetEqualGrid( *o3tl::doAccess<bool>(pValues[ 9 ]) ); return true; } @@ -1256,27 +1259,27 @@ void SdOptionsPrint::GetPropNameArray( const char**& ppNames, sal_uLong& rCount bool SdOptionsPrint::ReadData( const Any* pValues ) { - if( pValues[0].hasValue() ) SetDate( *static_cast<sal_Bool const *>(pValues[ 0 ].getValue()) ); - if( pValues[1].hasValue() ) SetTime( *static_cast<sal_Bool const *>(pValues[ 1 ].getValue()) ); - if( pValues[2].hasValue() ) SetPagename( *static_cast<sal_Bool const *>(pValues[ 2 ].getValue()) ); - if( pValues[3].hasValue() ) SetHiddenPages( *static_cast<sal_Bool const *>(pValues[ 3 ].getValue()) ); - if( pValues[4].hasValue() ) SetPagesize( *static_cast<sal_Bool const *>(pValues[ 4 ].getValue()) ); - if( pValues[5].hasValue() ) SetPagetile( *static_cast<sal_Bool const *>(pValues[ 5 ].getValue()) ); - if( pValues[6].hasValue() ) SetBooklet( *static_cast<sal_Bool const *>(pValues[ 6 ].getValue()) ); - if( pValues[7].hasValue() ) SetFrontPage( *static_cast<sal_Bool const *>(pValues[ 7 ].getValue()) ); - if( pValues[8].hasValue() ) SetBackPage( *static_cast<sal_Bool const *>(pValues[ 8 ].getValue()) ); - if( pValues[9].hasValue() ) SetPaperbin( *static_cast<sal_Bool const *>(pValues[ 9 ].getValue()) ); - if( pValues[10].hasValue() ) SetOutputQuality( (sal_uInt16) *static_cast<sal_Int32 const *>(pValues[ 10 ].getValue()) ); - if( pValues[11].hasValue() ) SetDraw( *static_cast<sal_Bool const *>(pValues[ 11 ].getValue()) ); + if( pValues[0].hasValue() ) SetDate( *o3tl::doAccess<bool>(pValues[ 0 ]) ); + if( pValues[1].hasValue() ) SetTime( *o3tl::doAccess<bool>(pValues[ 1 ]) ); + if( pValues[2].hasValue() ) SetPagename( *o3tl::doAccess<bool>(pValues[ 2 ]) ); + if( pValues[3].hasValue() ) SetHiddenPages( *o3tl::doAccess<bool>(pValues[ 3 ]) ); + if( pValues[4].hasValue() ) SetPagesize( *o3tl::doAccess<bool>(pValues[ 4 ]) ); + if( pValues[5].hasValue() ) SetPagetile( *o3tl::doAccess<bool>(pValues[ 5 ]) ); + if( pValues[6].hasValue() ) SetBooklet( *o3tl::doAccess<bool>(pValues[ 6 ]) ); + if( pValues[7].hasValue() ) SetFrontPage( *o3tl::doAccess<bool>(pValues[ 7 ]) ); + if( pValues[8].hasValue() ) SetBackPage( *o3tl::doAccess<bool>(pValues[ 8 ]) ); + if( pValues[9].hasValue() ) SetPaperbin( *o3tl::doAccess<bool>(pValues[ 9 ]) ); + if( pValues[10].hasValue() ) SetOutputQuality( (sal_uInt16) *o3tl::doAccess<sal_Int32>(pValues[ 10 ]) ); + if( pValues[11].hasValue() ) SetDraw( *o3tl::doAccess<bool>(pValues[ 11 ]) ); // just for impress if( GetConfigId() == SDCFG_IMPRESS ) { - if( pValues[12].hasValue() ) SetNotes( *static_cast<sal_Bool const *>(pValues[ 12 ].getValue()) ); - if( pValues[13].hasValue() ) SetHandout( *static_cast<sal_Bool const *>(pValues[ 13 ].getValue()) ); - if( pValues[14].hasValue() ) SetOutline( *static_cast<sal_Bool const *>(pValues[ 14 ].getValue()) ); - if( pValues[15].hasValue() ) SetHandoutHorizontal( *static_cast<sal_Bool const *>(pValues[15].getValue()) ); - if( pValues[16].hasValue() ) SetHandoutPages( (sal_uInt16)*static_cast<sal_Int32 const *>(pValues[16].getValue()) ); + if( pValues[12].hasValue() ) SetNotes( *o3tl::doAccess<bool>(pValues[ 12 ]) ); + if( pValues[13].hasValue() ) SetHandout( *o3tl::doAccess<bool>(pValues[ 13 ]) ); + if( pValues[14].hasValue() ) SetOutline( *o3tl::doAccess<bool>(pValues[ 14 ]) ); + if( pValues[15].hasValue() ) SetHandoutHorizontal( *o3tl::doAccess<bool>(pValues[15]) ); + if( pValues[16].hasValue() ) SetHandoutPages( (sal_uInt16)*o3tl::doAccess<sal_Int32>(pValues[16]) ); } return true; |