diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-06-27 11:59:30 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-06-27 11:59:30 +0200 |
commit | 11f623a32540d822d539b7f3978363892feb9fe4 (patch) | |
tree | 33138dc06ebcefea8c7df191ac8910826b7f8bf4 /svtools | |
parent | 85ce665ee43b1f20df593fc36f935c5799418f54 (diff) |
Clean up uses of Any::getValue() in svtools
Change-Id: Id11dc4724fed4e43981534ffac5ec5358f9387b2
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/config/apearcfg.cxx | 5 | ||||
-rw-r--r-- | svtools/source/config/fontsubstconfig.cxx | 7 | ||||
-rw-r--r-- | svtools/source/config/htmlcfg.cxx | 16 | ||||
-rw-r--r-- | svtools/source/uno/treecontrolpeer.cxx | 23 |
4 files changed, 26 insertions, 25 deletions
diff --git a/svtools/source/config/apearcfg.cxx b/svtools/source/config/apearcfg.cxx index 19f16b4ce322..bba8cd0a8725 100644 --- a/svtools/source/config/apearcfg.cxx +++ b/svtools/source/config/apearcfg.cxx @@ -20,6 +20,7 @@ #include <svtools/apearcfg.hxx> +#include <o3tl/any.hxx> #include <tools/debug.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> @@ -71,7 +72,7 @@ SvtTabAppearanceCfg::SvtTabAppearanceCfg() nDragMode = (DragMode)nTmp; break; } - case 2: bMenuMouseFollow = *static_cast<sal_Bool const *>(pValues->getValue()); break; //"Menu/FollowMouse", + case 2: bMenuMouseFollow = *o3tl::doAccess<bool>(*pValues); break; //"Menu/FollowMouse", case 3: { short nTmp; @@ -81,7 +82,7 @@ SvtTabAppearanceCfg::SvtTabAppearanceCfg() } case 4: { short nTmp = 0; *pValues >>= nTmp; nMiddleMouse = static_cast<MouseMiddleButtonAction>(nTmp); break; } //"Dialog/MiddleMouseButton", #if defined( UNX ) - case 5: bFontAntialiasing = *static_cast<sal_Bool const *>(pValues->getValue()); break; // "FontAntialising/Enabled", + case 5: bFontAntialiasing = *o3tl::doAccess<bool>(*pValues); break; // "FontAntialising/Enabled", case 6: *pValues >>= nAAMinPixelHeight; break; // "FontAntialising/MinPixelHeight", #endif } diff --git a/svtools/source/config/fontsubstconfig.cxx b/svtools/source/config/fontsubstconfig.cxx index 473c20ba08eb..6785a3ff8497 100644 --- a/svtools/source/config/fontsubstconfig.cxx +++ b/svtools/source/config/fontsubstconfig.cxx @@ -20,6 +20,7 @@ #include <svtools/fontsubstconfig.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/uno/Sequence.hxx> +#include <o3tl/any.hxx> #include <tools/debug.hxx> #include <vcl/outdev.hxx> @@ -55,7 +56,7 @@ SvtFontSubstConfig::SvtFontSubstConfig() : Sequence<Any> aValues = GetProperties(aNames); DBG_ASSERT(aValues.getConstArray()[0].hasValue(), "no value available"); if(aValues.getConstArray()[0].hasValue()) - bIsEnabled = *static_cast<sal_Bool const *>(aValues.getConstArray()[0].getValue()); + bIsEnabled = *o3tl::doAccess<bool>(aValues.getConstArray()[0]); OUString sPropPrefix(cFontPairs); Sequence<OUString> aNodeNames = GetNodeNames(sPropPrefix, CONFIG_NAME_LOCAL_PATH); @@ -81,8 +82,8 @@ SvtFontSubstConfig::SvtFontSubstConfig() : SubstitutionStruct aInsert; pNodeValues[nName++] >>= aInsert.sFont; pNodeValues[nName++] >>= aInsert.sReplaceBy; - aInsert.bReplaceAlways = *static_cast<sal_Bool const *>(pNodeValues[nName++].getValue()); - aInsert.bReplaceOnScreenOnly = *static_cast<sal_Bool const *>(pNodeValues[nName++].getValue()); + aInsert.bReplaceAlways = *o3tl::doAccess<bool>(pNodeValues[nName++]); + aInsert.bReplaceOnScreenOnly = *o3tl::doAccess<bool>(pNodeValues[nName++]); pImpl->aSubstArr.push_back(aInsert); } } diff --git a/svtools/source/config/htmlcfg.cxx b/svtools/source/config/htmlcfg.cxx index 53f6a8fff2c9..a558b0a8add8 100644 --- a/svtools/source/config/htmlcfg.cxx +++ b/svtools/source/config/htmlcfg.cxx @@ -17,7 +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 <svtools/htmlcfg.hxx> #include <svtools/parhtml.hxx> @@ -127,11 +129,11 @@ void SvxHtmlOptions::Load( const Sequence< OUString >& aNames ) switch(nProp) { case 0: - if(*static_cast<sal_Bool const *>(pValues[nProp].getValue())) + if(*o3tl::doAccess<bool>(pValues[nProp])) pImpl->nFlags |= HTMLCFG_UNKNOWN_TAGS; break;//"Import/UnknownTag", case 1: - if(*static_cast<sal_Bool const *>(pValues[nProp].getValue())) + if(*o3tl::doAccess<bool>(pValues[nProp])) pImpl->nFlags |= HTMLCFG_IGNORE_FONT_FAMILY; break;//"Import/FontSetting", case 2: pValues[nProp] >>= pImpl->aFontSizeArr[0]; break;//"Import/FontSize/Size_1", @@ -157,19 +159,19 @@ void SvxHtmlOptions::Load( const Sequence< OUString >& aNames ) } break; case 10: - if(*static_cast<sal_Bool const *>(pValues[nProp].getValue())) + if(*o3tl::doAccess<bool>(pValues[nProp])) pImpl->nFlags |= HTMLCFG_STAR_BASIC; break;//"Export/Basic", case 11: - if(*static_cast<sal_Bool const *>(pValues[nProp].getValue())) + if(*o3tl::doAccess<bool>(pValues[nProp])) pImpl->nFlags |= HTMLCFG_PRINT_LAYOUT_EXTENSION; break;//"Export/PrintLayout", case 12: - if(*static_cast<sal_Bool const *>(pValues[nProp].getValue())) + if(*o3tl::doAccess<bool>(pValues[nProp])) pImpl->nFlags |= HTMLCFG_LOCAL_GRF; break;//"Export/LocalGraphic", case 13: - if(*static_cast<sal_Bool const *>(pValues[nProp].getValue())) + if(*o3tl::doAccess<bool>(pValues[nProp])) pImpl->nFlags |= HTMLCFG_IS_BASIC_WARNING; break;//"Export/Warning" @@ -178,7 +180,7 @@ void SvxHtmlOptions::Load( const Sequence< OUString >& aNames ) break;//"Export/Encoding" case 15: - if(*static_cast<sal_Bool const *>(pValues[nProp].getValue())) + if(*o3tl::doAccess<bool>(pValues[nProp])) pImpl->nFlags |= HTMLCFG_NUMBERS_ENGLISH_US; break;//"Import/NumbersEnglishUS" } diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index 0df10e9b966a..b6b5fa5c1ea6 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/view/SelectionType.hpp> +#include <o3tl/any.hxx> #include <toolkit/helper/property.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -437,7 +438,7 @@ void TreeControlPeer::ChangeNodesSelection( const Any& rSelection, bool bSelect, Reference< XTreeNode > xTempNode; - const Reference< XTreeNode > *pNodes = nullptr; + Sequence<Reference<XTreeNode>> pNodes; sal_Int32 nCount = 0; if( rSelection.hasValue() ) @@ -450,18 +451,17 @@ void TreeControlPeer::ChangeNodesSelection( const Any& rSelection, bool bSelect, if( xTempNode.is() ) { nCount = 1; - pNodes = &xTempNode; + pNodes = {xTempNode}; } break; } case TypeClass_SEQUENCE: { - if( rSelection.getValueType() == cppu::UnoType<Sequence< Reference< XTreeNode > >>::get() ) + if( auto rSeq = o3tl::tryAccess<Sequence<Reference<XTreeNode>>>( + rSelection) ) { - const Sequence< Reference< XTreeNode > >& rSeq( *static_cast<const Sequence< Reference< XTreeNode > > *>(rSelection.getValue()) ); - nCount = rSeq.getLength(); - if( nCount ) - pNodes = rSeq.getConstArray(); + nCount = rSeq->getLength(); + pNodes = *rSeq; } break; } @@ -476,13 +476,10 @@ void TreeControlPeer::ChangeNodesSelection( const Any& rSelection, bool bSelect, if( bSetSelection ) rTree.SelectAll( false ); - if( pNodes && nCount ) + for( sal_Int32 i = 0; i != nCount; ++i ) { - while( nCount-- ) - { - UnoTreeListEntry* pEntry = getEntry( *pNodes++ ); - rTree.Select( pEntry, bSelect ); - } + UnoTreeListEntry* pEntry = getEntry( pNodes[i] ); + rTree.Select( pEntry, bSelect ); } } |