summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svl/poolitem.hxx15
-rw-r--r--svl/source/config/cjkoptions.cxx3
-rw-r--r--svl/source/items/itemprop.cxx4
-rw-r--r--svl/source/misc/fstathelper.cxx3
-rw-r--r--svl/source/numbers/numfmuno.cxx5
5 files changed, 14 insertions, 16 deletions
diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx
index f2f9f2947f68..986c6e0cf0f2 100644
--- a/include/svl/poolitem.hxx
+++ b/include/svl/poolitem.hxx
@@ -50,18 +50,11 @@ enum SfxItemKind {
inline bool Any2Bool( const css::uno::Any&rValue )
{
bool bValue = false;
- if( rValue.hasValue() )
+ if( !(rValue >>= bValue) )
{
- if( rValue.getValueType() == cppu::UnoType<bool>::get() )
- {
- bValue = *static_cast<sal_Bool const *>(rValue.getValue());
- }
- else
- {
- sal_Int32 nNum = 0;
- if( rValue >>= nNum )
- bValue = nNum != 0;
- }
+ sal_Int32 nNum = 0;
+ if( rValue >>= nNum )
+ bValue = nNum != 0;
}
return bValue;
diff --git a/svl/source/config/cjkoptions.cxx b/svl/source/config/cjkoptions.cxx
index e0b1b9e0dafb..c16cccf4cba5 100644
--- a/svl/source/config/cjkoptions.cxx
+++ b/svl/source/config/cjkoptions.cxx
@@ -19,6 +19,7 @@
#include <svl/cjkoptions.hxx>
+#include <o3tl/any.hxx>
#include <svl/languageoptions.hxx>
#include <i18nlangtag/lang.h>
#include <unotools/configitem.hxx>
@@ -179,7 +180,7 @@ void SvtCJKOptions_Impl::Load()
{
if( pValues[nProp].hasValue() )
{
- bool bValue = *static_cast<sal_Bool const *>(pValues[nProp].getValue());
+ bool bValue = *o3tl::doAccess<bool>(pValues[nProp]);
switch ( nProp )
{
case 0: { bCJKFont = bValue; bROCJKFont = pROStates[nProp]; } break;
diff --git a/svl/source/items/itemprop.cxx b/svl/source/items/itemprop.cxx
index 639c1f357153..69f78e5ac19f 100644
--- a/svl/source/items/itemprop.cxx
+++ b/svl/source/items/itemprop.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 <svl/itemprop.hxx>
#include <svl/itempool.hxx>
#include <svl/itemset.hxx>
@@ -198,7 +200,7 @@ void SfxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry& rEn
if( rEntry.aType.getTypeClass() == TypeClass_ENUM &&
rAny.getValueTypeClass() == TypeClass_LONG )
{
- sal_Int32 nTmp = *static_cast<sal_Int32 const *>(rAny.getValue());
+ sal_Int32 nTmp = *o3tl::forceAccess<sal_Int32>(rAny);
rAny.setValue( &nTmp, rEntry.aType );
}
}
diff --git a/svl/source/misc/fstathelper.cxx b/svl/source/misc/fstathelper.cxx
index 6f8a1840f965..6530ff724429 100644
--- a/svl/source/misc/fstathelper.cxx
+++ b/svl/source/misc/fstathelper.cxx
@@ -19,6 +19,7 @@
#include <com/sun/star/util/DateTime.hpp>
#include <comphelper/processfactory.hxx>
+#include <o3tl/any.hxx>
#include <rtl/ustring.hxx>
#include <svl/fstathelper.hxx>
#include <tools/date.hxx>
@@ -43,7 +44,7 @@ bool FStatHelper::GetModifiedDateTimeOfFile( const OUString& rURL,
if( aAny.hasValue() )
{
bRet = true;
- const util::DateTime* pDT = static_cast<util::DateTime const *>(aAny.getValue());
+ auto pDT = o3tl::doAccess<util::DateTime>(aAny);
if( pDate )
*pDate = Date( pDT->Day, pDT->Month, pDT->Year );
if( pTime )
diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index 0047c3478936..3e9436fcb2a7 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -19,6 +19,7 @@
#include <tools/color.hxx>
#include <i18nlangtag/mslangid.hxx>
+#include <o3tl/any.hxx>
#include <osl/mutex.hxx>
#include <osl/diagnose.h>
#include <rtl/ustring.hxx>
@@ -952,8 +953,8 @@ void SAL_CALL SvNumberFormatSettingsObj::setPropertyValue( const OUString& aProp
if (aPropertyName == PROPERTYNAME_NOZERO)
{
// operator >>= shouldn't be used for bool (?)
- if ( aValue.getValueTypeClass() == uno::TypeClass_BOOLEAN )
- pFormatter->SetNoZero( *static_cast<sal_Bool const *>(aValue.getValue()) );
+ if ( auto b = o3tl::tryAccess<bool>(aValue) )
+ pFormatter->SetNoZero( *b );
}
else if (aPropertyName == PROPERTYNAME_NULLDATE)
{