Kaydet (Commit) 11f623a3 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Clean up uses of Any::getValue() in svtools

Change-Id: Id11dc4724fed4e43981534ffac5ec5358f9387b2
üst 85ce665e
......@@ -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
}
......
......@@ -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);
}
}
......
......@@ -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"
}
......
......@@ -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 );
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment