summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-06-10 18:54:28 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-06-10 18:54:28 +0200
commit80c35d97b9b3b60a091aae77de0ffef38cbf531a (patch)
treebd562b66960585a3c5d4145abcbd7098acda81e0 /sw/source
parentb05ab09bccacc8e23685c455e24ab64cbf6e7ae3 (diff)
Clean up uses of Any::getValue() in sw
Change-Id: Ifaa239ab3e285e8cf998339456ece5ce99008af9
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/edit/edlingu.cxx5
-rw-r--r--sw/source/core/fields/authfld.cxx7
-rw-r--r--sw/source/core/fields/dbfld.cxx3
-rw-r--r--sw/source/core/fields/ddefld.cxx5
-rw-r--r--sw/source/core/fields/docufld.cxx24
-rw-r--r--sw/source/core/fields/expfld.cxx11
-rw-r--r--sw/source/core/fields/flddat.cxx7
-rw-r--r--sw/source/core/fields/scrptfld.cxx3
-rw-r--r--sw/source/core/fields/tblcalc.cxx6
-rw-r--r--sw/source/core/fields/usrfld.cxx10
-rw-r--r--sw/source/core/frmedt/fefly1.cxx3
-rw-r--r--sw/source/core/graphic/grfatr.cxx3
-rw-r--r--sw/source/core/layout/atrfrm.cxx35
-rw-r--r--sw/source/core/para/paratr.cxx5
-rw-r--r--sw/source/core/txtnode/fmtatr2.cxx3
-rw-r--r--sw/source/core/unocore/swunohelper.cxx3
-rw-r--r--sw/source/core/unocore/unodraw.cxx73
-rw-r--r--sw/source/core/unocore/unofield.cxx11
-rw-r--r--sw/source/core/unocore/unoframe.cxx7
-rw-r--r--sw/source/core/unocore/unoobj.cxx22
-rw-r--r--sw/source/core/unocore/unosett.cxx33
-rw-r--r--sw/source/core/unocore/unosrch.cxx5
-rw-r--r--sw/source/core/unocore/unotbl.cxx15
-rw-r--r--sw/source/filter/html/htmlforw.cxx444
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx9
-rw-r--r--sw/source/filter/xml/XMLRedlineImportHelper.cxx9
-rw-r--r--sw/source/filter/xml/swxml.cxx9
-rw-r--r--sw/source/filter/xml/wrtxml.cxx3
-rw-r--r--sw/source/filter/xml/xmlexp.cxx13
-rw-r--r--sw/source/filter/xml/xmlimp.cxx25
-rw-r--r--sw/source/filter/xml/xmltble.cxx3
-rw-r--r--sw/source/filter/xml/xmltexti.cxx5
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx13
-rw-r--r--sw/source/ui/misc/glossary.cxx3
-rw-r--r--sw/source/uibase/config/modcfg.cxx31
-rw-r--r--sw/source/uibase/config/prtopt.cxx33
-rw-r--r--sw/source/uibase/config/usrpref.cxx9
-rw-r--r--sw/source/uibase/envelp/envimg.cxx5
-rw-r--r--sw/source/uibase/envelp/labimg.cxx11
-rw-r--r--sw/source/uibase/uiview/view.cxx3
-rw-r--r--sw/source/uibase/uiview/view2.cxx5
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx93
-rw-r--r--sw/source/uibase/uno/unomod.cxx98
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx27
-rw-r--r--sw/source/uibase/uno/unotxvw.cxx3
-rw-r--r--sw/source/uibase/utlui/navicfg.cxx5
46 files changed, 619 insertions, 539 deletions
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index 2ed9f81a5dac..b517487a6c51 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/text/XFlatParagraph.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
#include <comphelper/string.hxx>
+#include <o3tl/any.hxx>
#include <unoflatpara.hxx>
@@ -412,8 +413,8 @@ uno::Any SwConvIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt )
bool SwHyphIter::IsAuto()
{
uno::Reference< beans::XPropertySet > xProp( ::GetLinguPropertySet() );
- return xProp.is() && *static_cast<sal_Bool const *>(xProp->getPropertyValue(
- UPN_IS_HYPH_AUTO ).getValue());
+ return xProp.is() && *o3tl::doAccess<bool>(xProp->getPropertyValue(
+ UPN_IS_HYPH_AUTO ));
}
void SwHyphIter::ShowSelection()
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 53fef8fcc306..ed0b65d9acfc 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -21,6 +21,7 @@
#include <comphelper/string.hxx>
#include <editeng/unolingu.hxx>
#include <editeng/langitem.hxx>
+#include <o3tl/any.hxx>
#include <o3tl/make_unique.hxx>
#include <swtypes.hxx>
#include <tools/resid.hxx>
@@ -413,10 +414,10 @@ bool SwAuthorityFieldType::PutValue( const Any& rAny, sal_uInt16 nWhichId )
break;
}
case FIELD_PROP_BOOL1:
- m_bIsSequence = *static_cast<sal_Bool const *>(rAny.getValue());
+ m_bIsSequence = *o3tl::doAccess<bool>(rAny);
break;
case FIELD_PROP_BOOL2:
- m_bSortByDocument = *static_cast<sal_Bool const *>(rAny.getValue());
+ m_bSortByDocument = *o3tl::doAccess<bool>(rAny);
break;
case FIELD_PROP_LOCALE:
@@ -450,7 +451,7 @@ bool SwAuthorityFieldType::PutValue( const Any& rAny, sal_uInt16 nWhichId )
}
else if(pValue[j].Name == UNO_NAME_IS_SORT_ASCENDING)
{
- aSortKey.bSortAscending = *static_cast<sal_Bool const *>(pValue[j].Value.getValue());
+ aSortKey.bSortAscending = *o3tl::doAccess<bool>(pValue[j].Value);
}
}
m_SortKeyArr.push_back(aSortKey);
diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx
index df209db7691d..16059313c199 100644
--- a/sw/source/core/fields/dbfld.cxx
+++ b/sw/source/core/fields/dbfld.cxx
@@ -18,6 +18,7 @@
*/
#include <float.h>
+#include <o3tl/any.hxx>
#include <sfx2/app.hxx>
#include <svl/zforlist.hxx>
#include <svx/pageitem.hxx>
@@ -391,7 +392,7 @@ bool SwDBField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
switch( nWhichId )
{
case FIELD_PROP_BOOL1:
- if( *static_cast<sal_Bool const *>(rAny.getValue()) )
+ if( *o3tl::doAccess<bool>(rAny) )
SetSubType(GetSubType()&~nsSwExtendedSubType::SUB_OWN_FMT);
else
SetSubType(GetSubType()|nsSwExtendedSubType::SUB_OWN_FMT);
diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx
index 89b74b35408e..99f34553b561 100644
--- a/sw/source/core/fields/ddefld.cxx
+++ b/sw/source/core/fields/ddefld.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 <sfx2/linkmgr.hxx>
#include <doc.hxx>
@@ -341,7 +344,7 @@ bool SwDDEFieldType::PutValue( const uno::Any& rVal, sal_uInt16 nWhichId )
case FIELD_PROP_PAR4: nPart = 1; break;
case FIELD_PROP_SUBTYPE: nPart = 0; break;
case FIELD_PROP_BOOL1:
- SetType( *static_cast<sal_Bool const *>(rVal.getValue()) ?
+ SetType( *o3tl::doAccess<bool>(rVal) ?
SfxLinkUpdateMode::ALWAYS :
SfxLinkUpdateMode::ONCALL );
break;
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index a651c5ac1c22..8872560fa8a6 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -41,6 +41,7 @@
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/util/Duration.hpp>
+#include <o3tl/any.hxx>
#include <unotools/localedatawrapper.hxx>
#include <editeng/unolingu.hxx>
#include <comphelper/processfactory.hxx>
@@ -385,11 +386,11 @@ bool SwAuthorField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
switch( nWhichId )
{
case FIELD_PROP_BOOL1:
- SetFormat( *static_cast<sal_Bool const *>(rAny.getValue()) ? AF_NAME : AF_SHORTCUT );
+ SetFormat( *o3tl::doAccess<bool>(rAny) ? AF_NAME : AF_SHORTCUT );
break;
case FIELD_PROP_BOOL2:
- if( *static_cast<sal_Bool const *>(rAny.getValue()) )
+ if( *o3tl::doAccess<bool>(rAny) )
SetFormat( GetFormat() | AF_FIXED);
else
SetFormat( GetFormat() & ~AF_FIXED);
@@ -562,7 +563,7 @@ bool SwFileNameField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
break;
case FIELD_PROP_BOOL2:
- if( *static_cast<sal_Bool const *>(rAny.getValue()) )
+ if( *o3tl::doAccess<bool>(rAny) )
SetFormat( GetFormat() | FF_FIXED);
else
SetFormat( GetFormat() & ~FF_FIXED);
@@ -1233,7 +1234,7 @@ bool SwDocInfoField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
break;
case FIELD_PROP_BOOL1:
- if(*static_cast<sal_Bool const *>(rAny.getValue()))
+ if(*o3tl::doAccess<bool>(rAny))
nSubType |= DI_SUB_FIXED;
else
nSubType &= ~DI_SUB_FIXED;
@@ -1251,7 +1252,7 @@ bool SwDocInfoField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
break;
case FIELD_PROP_BOOL2:
nSubType &= 0xf0ff;
- if(*static_cast<sal_Bool const *>(rAny.getValue()))
+ if(*o3tl::doAccess<bool>(rAny))
nSubType |= DI_SUB_DATE;
else
nSubType |= DI_SUB_TIME;
@@ -1510,7 +1511,7 @@ bool SwHiddenTextField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
rAny >>= aFALSEText;
break;
case FIELD_PROP_BOOL1:
- bIsHidden = *static_cast<sal_Bool const *>(rAny.getValue());
+ bIsHidden = *o3tl::doAccess<bool>(rAny);
break;
case FIELD_PROP_PAR4:
rAny >>= aContent;
@@ -1609,7 +1610,7 @@ bool SwHiddenParaField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
rAny >>= aCond;
break;
case FIELD_PROP_BOOL1:
- bIsHidden = *static_cast<sal_Bool const *>(rAny.getValue());
+ bIsHidden = *o3tl::doAccess<bool>(rAny);
break;
default:
@@ -1815,10 +1816,9 @@ bool SwPostItField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
OSL_FAIL("Not implemented!");
break;
case FIELD_PROP_DATE:
- if( rAny.getValueType() == ::cppu::UnoType<util::Date>::get() )
+ if( auto aSetDate = o3tl::tryAccess<util::Date>(rAny) )
{
- util::Date aSetDate = *static_cast<util::Date const *>(rAny.getValue());
- aDateTime = Date(aSetDate.Day, aSetDate.Month, aSetDate.Year);
+ aDateTime = Date(aSetDate->Day, aSetDate->Month, aSetDate->Year);
}
break;
case FIELD_PROP_DATE_TIME:
@@ -1970,7 +1970,7 @@ bool SwExtUserField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
}
break;
case FIELD_PROP_BOOL1:
- if( *static_cast<sal_Bool const *>(rAny.getValue()) )
+ if( *o3tl::doAccess<bool>(rAny) )
SetFormat(GetFormat() | AF_FIXED);
else
SetFormat(GetFormat() & ~AF_FIXED);
@@ -2047,7 +2047,7 @@ bool SwRefPageSetField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
switch( nWhichId )
{
case FIELD_PROP_BOOL1:
- bOn = *static_cast<sal_Bool const *>(rAny.getValue());
+ bOn = *o3tl::doAccess<bool>(rAny);
break;
case FIELD_PROP_USHORT1:
rAny >>=nOffset;
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index 37b981c19323..68e882af3a51 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -21,6 +21,7 @@
#include <UndoTable.hxx>
#include <hintids.hxx>
+#include <o3tl/any.hxx>
#include <unotools/collatorwrapper.hxx>
#include <unotools/charclass.hxx>
#include <editeng/unolingu.hxx>
@@ -443,7 +444,7 @@ bool SwGetExpField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
switch( nWhichId )
{
case FIELD_PROP_DOUBLE:
- SwValueField::SetValue(*static_cast<double const *>(rAny.getValue()));
+ SwValueField::SetValue(*o3tl::doAccess<double>(rAny));
break;
case FIELD_PROP_FORMAT:
rAny >>= nTmp;
@@ -466,7 +467,7 @@ bool SwGetExpField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
SetSubType( static_cast<sal_uInt16>((GetSubType() & 0xff00) | nTmp));
break;
case FIELD_PROP_BOOL2:
- if(*static_cast<sal_Bool const *>(rAny.getValue()))
+ if(*o3tl::doAccess<bool>(rAny))
nSubType |= nsSwExtendedSubType::SUB_CMD;
else
nSubType &= (~nsSwExtendedSubType::SUB_CMD);
@@ -973,7 +974,7 @@ bool SwSetExpField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
switch( nWhichId )
{
case FIELD_PROP_BOOL2:
- if(*static_cast<sal_Bool const *>(rAny.getValue()))
+ if(*o3tl::doAccess<bool>(rAny))
nSubType &= ~nsSwExtendedSubType::SUB_INVISIBLE;
else
nSubType |= nsSwExtendedSubType::SUB_INVISIBLE;
@@ -1031,13 +1032,13 @@ bool SwSetExpField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
rAny >>= aPText;
break;
case FIELD_PROP_BOOL3:
- if(*static_cast<sal_Bool const *>(rAny.getValue()))
+ if(*o3tl::doAccess<bool>(rAny))
nSubType |= nsSwExtendedSubType::SUB_CMD;
else
nSubType &= (~nsSwExtendedSubType::SUB_CMD);
break;
case FIELD_PROP_BOOL1:
- SetInputFlag(*static_cast<sal_Bool const *>(rAny.getValue()));
+ SetInputFlag(*o3tl::doAccess<bool>(rAny));
break;
case FIELD_PROP_PAR4:
{
diff --git a/sw/source/core/fields/flddat.cxx b/sw/source/core/fields/flddat.cxx
index 6ff7f5657279..358a20740e0c 100644
--- a/sw/source/core/fields/flddat.cxx
+++ b/sw/source/core/fields/flddat.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/datetime.hxx>
#include <svl/zforlist.hxx>
#include <com/sun/star/util/DateTime.hpp>
@@ -188,14 +191,14 @@ bool SwDateTimeField::PutValue( const uno::Any& rVal, sal_uInt16 nWhichId )
switch( nWhichId )
{
case FIELD_PROP_BOOL1:
- if(*static_cast<sal_Bool const *>(rVal.getValue()))
+ if(*o3tl::doAccess<bool>(rVal))
nSubType |= FIXEDFLD;
else
nSubType &= ~FIXEDFLD;
break;
case FIELD_PROP_BOOL2:
nSubType &= ~(DATEFLD|TIMEFLD);
- nSubType |= *static_cast<sal_Bool const *>(rVal.getValue()) ? DATEFLD : TIMEFLD;
+ nSubType |= *o3tl::doAccess<bool>(rVal) ? DATEFLD : TIMEFLD;
break;
case FIELD_PROP_FORMAT:
rVal >>= nTmp;
diff --git a/sw/source/core/fields/scrptfld.cxx b/sw/source/core/fields/scrptfld.cxx
index d1097cc28911..f2d9a50b1c3a 100644
--- a/sw/source/core/fields/scrptfld.cxx
+++ b/sw/source/core/fields/scrptfld.cxx
@@ -20,6 +20,7 @@
#include <docufld.hxx>
#include <unofldmid.h>
#include <comcore.hrc>
+#include <o3tl/any.hxx>
#include <tools/resid.hxx>
using namespace ::com::sun::star;
@@ -107,7 +108,7 @@ bool SwScriptField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
rAny >>= sCode;
break;
case FIELD_PROP_BOOL1:
- bCodeURL = *static_cast<sal_Bool const *>(rAny.getValue());
+ bCodeURL = *o3tl::doAccess<bool>(rAny);
break;
default:
assert(false);
diff --git a/sw/source/core/fields/tblcalc.cxx b/sw/source/core/fields/tblcalc.cxx
index b97e01b5fe75..6b4e873eba6c 100644
--- a/sw/source/core/fields/tblcalc.cxx
+++ b/sw/source/core/fields/tblcalc.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <o3tl/any.hxx>
+
#include <calbck.hxx>
#include <cntfrm.hxx>
#include <doc.hxx>
@@ -188,7 +192,7 @@ bool SwTableField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
}
break;
case FIELD_PROP_BOOL1:
- if(*static_cast<sal_Bool const *>(rAny.getValue()))
+ if(*o3tl::doAccess<bool>(rAny))
nSubType = nsSwGetSetExpType::GSE_FORMULA|nsSwExtendedSubType::SUB_CMD;
else
nSubType = nsSwGetSetExpType::GSE_FORMULA;
diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx
index e87666dccc6a..3c279dbe4691 100644
--- a/sw/source/core/fields/usrfld.cxx
+++ b/sw/source/core/fields/usrfld.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <o3tl/any.hxx>
+
#include <svl/zforlist.hxx>
#include <svl/zformat.hxx>
@@ -127,13 +131,13 @@ bool SwUserField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
switch( nWhichId )
{
case FIELD_PROP_BOOL1:
- if(*static_cast<sal_Bool const *>(rAny.getValue()))
+ if(*o3tl::doAccess<bool>(rAny))
nSubType &= (~nsSwExtendedSubType::SUB_INVISIBLE);
else
nSubType |= nsSwExtendedSubType::SUB_INVISIBLE;
break;
case FIELD_PROP_BOOL2:
- if(*static_cast<sal_Bool const *>(rAny.getValue()))
+ if(*o3tl::doAccess<bool>(rAny))
nSubType |= nsSwExtendedSubType::SUB_CMD;
else
nSubType &= (~nsSwExtendedSubType::SUB_CMD);
@@ -312,7 +316,7 @@ bool SwUserFieldType::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
rAny >>= aContent;
break;
case FIELD_PROP_BOOL1:
- if(*static_cast<sal_Bool const *>(rAny.getValue()))
+ if(*o3tl::doAccess<bool>(rAny))
{
nType |= nsSwGetSetExpType::GSE_EXPR;
nType &= ~nsSwGetSetExpType::GSE_STRING;
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index eddbe82046a8..302c7062a2cd 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -18,6 +18,7 @@
*/
#include <hintids.hxx>
+#include <o3tl/any.hxx>
#include <svl/itemiter.hxx>
#include <svtools/imapobj.hxx>
#include <svtools/soerr.hxx>
@@ -1643,7 +1644,7 @@ ObjCntType SwFEShell::GetObjCntType( const SdrObject& rObj ) const
if(xInfo->hasPropertyByName( sName ))
{
aVal = xSet->getPropertyValue( sName );
- if( aVal.getValue() && form::FormButtonType_URL == *static_cast<form::FormButtonType const *>(aVal.getValue()) )
+ if( aVal.hasValue() && form::FormButtonType_URL == *o3tl::doAccess<form::FormButtonType>(aVal) )
eType = OBJCNT_URLBUTTON;
}
}
diff --git a/sw/source/core/graphic/grfatr.cxx b/sw/source/core/graphic/grfatr.cxx
index 71cf98283d6b..0ed146ad4b36 100644
--- a/sw/source/core/graphic/grfatr.cxx
+++ b/sw/source/core/graphic/grfatr.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/text/GraphicCrop.hpp>
#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
#include <com/sun/star/drawing/ColorMode.hpp>
+#include <o3tl/any.hxx>
#include <svtools/grfmgr.hxx>
#include <swtypes.hxx>
#include <grfatr.hxx>
@@ -100,7 +101,7 @@ bool SwMirrorGrf::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
bool SwMirrorGrf::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
{
bool bRet = true;
- bool bVal = *static_cast<sal_Bool const *>(rVal.getValue());
+ bool bVal = *o3tl::doAccess<bool>(rVal);
// vertical and horizontal were swapped at some point
nMemberId &= ~CONVERT_TWIPS;
switch ( nMemberId )
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 72b0181d3826..9d73d92c83e8 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/text/TextContentAnchorType.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/text/TextGridMode.hpp>
+#include <o3tl/any.hxx>
#include <svtools/unoimap.hxx>
#include <svtools/imap.hxx>
#include <svtools/imapobj.hxx>
@@ -322,7 +323,7 @@ bool SwFormatFrameSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
break;
case MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH:
{
- bool bSet = *static_cast<sal_Bool const *>(rVal.getValue());
+ bool bSet = *o3tl::doAccess<bool>(rVal);
if(bSet)
SetHeightPercent(SwFormatFrameSize::SYNCED);
else if( SwFormatFrameSize::SYNCED == GetHeightPercent() )
@@ -331,7 +332,7 @@ bool SwFormatFrameSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
break;
case MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT:
{
- bool bSet = *static_cast<sal_Bool const *>(rVal.getValue());
+ bool bSet = *o3tl::doAccess<bool>(rVal);
if(bSet)
SetWidthPercent(SwFormatFrameSize::SYNCED);
else if( SwFormatFrameSize::SYNCED == GetWidthPercent() )
@@ -381,7 +382,7 @@ bool SwFormatFrameSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
break;
case MID_FRMSIZE_IS_AUTO_HEIGHT:
{
- bool bSet = *static_cast<sal_Bool const *>(rVal.getValue());
+ bool bSet = *o3tl::doAccess<bool>(rVal);
SetHeightSizeType(bSet ? ATT_VAR_SIZE : ATT_FIX_SIZE);
}
break;
@@ -1261,13 +1262,13 @@ bool SwFormatSurround::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
break;
case MID_SURROUND_ANCHORONLY:
- SetAnchorOnly( *static_cast<sal_Bool const *>(rVal.getValue()) );
+ SetAnchorOnly( *o3tl::doAccess<bool>(rVal) );
break;
case MID_SURROUND_CONTOUR:
- SetContour( *static_cast<sal_Bool const *>(rVal.getValue()) );
+ SetContour( *o3tl::doAccess<bool>(rVal) );
break;
case MID_SURROUND_CONTOUROUTSIDE:
- SetOutside( *static_cast<sal_Bool const *>(rVal.getValue()) );
+ SetOutside( *o3tl::doAccess<bool>(rVal) );
break;
default:
OSL_ENSURE( false, "unknown MemberId" );
@@ -1497,7 +1498,7 @@ bool SwFormatHoriOrient::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
}
break;
case MID_HORIORIENT_PAGETOGGLE:
- SetPosToggle( *static_cast<sal_Bool const *>(rVal.getValue()));
+ SetPosToggle( *o3tl::doAccess<bool>(rVal));
break;
default:
OSL_ENSURE( false, "unknown MemberId" );
@@ -1886,7 +1887,7 @@ bool SwFormatURL::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
}
break;
case MID_URL_SERVERMAP:
- bIsServerMap = *static_cast<sal_Bool const *>(rVal.getValue());
+ bIsServerMap = *o3tl::doAccess<bool>(rVal);
break;
default:
OSL_ENSURE( false, "unknown MemberId" );
@@ -1982,7 +1983,7 @@ bool SwFormatFootnoteEndAtTextEnd::PutValue( const uno::Any& rVal, sal_uInt8 nMe
{
case MID_COLLECT :
{
- bool bVal = *static_cast<sal_Bool const *>(rVal.getValue());
+ bool bVal = *o3tl::doAccess<bool>(rVal);
if(!bVal && GetValue() >= FTNEND_ATTXTEND)
SetValue(FTNEND_ATPGORDOCEND);
else if(bVal && GetValue() < FTNEND_ATTXTEND)
@@ -1991,7 +1992,7 @@ bool SwFormatFootnoteEndAtTextEnd::PutValue( const uno::Any& rVal, sal_uInt8 nMe
break;
case MID_RESTART_NUM :
{
- bool bVal = *static_cast<sal_Bool const *>(rVal.getValue());
+ bool bVal = *o3tl::doAccess<bool>(rVal);
if(!bVal && GetValue() >= FTNEND_ATTXTEND_OWNNUMSEQ)
SetValue(FTNEND_ATTXTEND);
else if(bVal && GetValue() < FTNEND_ATTXTEND_OWNNUMSEQ)
@@ -2010,7 +2011,7 @@ bool SwFormatFootnoteEndAtTextEnd::PutValue( const uno::Any& rVal, sal_uInt8 nMe
break;
case MID_OWN_NUM :
{
- bool bVal = *static_cast<sal_Bool const *>(rVal.getValue());
+ bool bVal = *o3tl::doAccess<bool>(rVal);
if(!bVal && GetValue() >= FTNEND_ATTXTEND_OWNNUMANDFMT)
SetValue(FTNEND_ATTXTEND_OWNNUMSEQ);
else if(bVal && GetValue() < FTNEND_ATTXTEND_OWNNUMANDFMT)
@@ -2182,7 +2183,7 @@ bool SwFormatLineNumber::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
switch ( nMemberId )
{
case MID_LINENUMBER_COUNT:
- SetCountLines( *static_cast<sal_Bool const *>(rVal.getValue()) );
+ SetCountLines( *o3tl::doAccess<bool>(rVal) );
break;
case MID_LINENUMBER_STARTVALUE:
{
@@ -2344,13 +2345,13 @@ bool SwTextGridItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
}
break;
case MID_GRID_RUBY_BELOW:
- SetRubyTextBelow( *static_cast<sal_Bool const *>(rVal.getValue()) );
+ SetRubyTextBelow( *o3tl::doAccess<bool>(rVal) );
break;
case MID_GRID_PRINT:
- SetPrintGrid( *static_cast<sal_Bool const *>(rVal.getValue()) );
+ SetPrintGrid( *o3tl::doAccess<bool>(rVal) );
break;
case MID_GRID_DISPLAY:
- SetDisplayGrid( *static_cast<sal_Bool const *>(rVal.getValue()) );
+ SetDisplayGrid( *o3tl::doAccess<bool>(rVal) );
break;
case MID_GRID_BASEHEIGHT:
case MID_GRID_BASEWIDTH:
@@ -2409,11 +2410,11 @@ bool SwTextGridItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
break;
}
case MID_GRID_SNAPTOCHARS:
- SetSnapToChars( *static_cast<sal_Bool const *>(rVal.getValue()) );
+ SetSnapToChars( *o3tl::doAccess<bool>(rVal) );
break;
case MID_GRID_STANDARD_MODE:
{
- bool bStandard = *static_cast<sal_Bool const *>(rVal.getValue());
+ bool bStandard = *o3tl::doAccess<bool>(rVal);
SetSquaredMode( !bStandard );
break;
}
diff --git a/sw/source/core/para/paratr.cxx b/sw/source/core/para/paratr.cxx
index 44abc86f09f1..f24c529d518b 100644
--- a/sw/source/core/para/paratr.cxx
+++ b/sw/source/core/para/paratr.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/text/SizeType.hpp>
#include <com/sun/star/text/VertOrientationFormat.hpp>
#include <com/sun/star/text/WrapTextMode.hpp>
+#include <o3tl/any.hxx>
#include <unostyle.hxx>
#include <SwStyleNameMapper.hxx>
#include "paratr.hxx"
@@ -188,7 +189,7 @@ bool SwFormatDrop::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
{
if(rVal.getValueType() == ::cppu::UnoType<style::DropCapFormat>::get())
{
- const style::DropCapFormat* pDrop = static_cast<const style::DropCapFormat*>(rVal.getValue());
+ auto pDrop = o3tl::doAccess<style::DropCapFormat>(rVal);
nLines = pDrop->Lines;
nChars = pDrop->Count;
nDistance = convertMm100ToTwip(pDrop->Distance);
@@ -198,7 +199,7 @@ bool SwFormatDrop::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
}
break;
case MID_DROPCAP_WHOLE_WORD:
- bWholeWord = *static_cast<sal_Bool const *>(rVal.getValue());
+ bWholeWord = *o3tl::doAccess<bool>(rVal);
break;
case MID_DROPCAP_CHAR_STYLE_NAME :
OSL_FAIL("char format cannot be set in PutValue()!");
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index 01cae73ed3b3..bfca27182846 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -23,6 +23,7 @@
#include "unomid.h"
#include <basic/sbxvar.hxx>
+#include <o3tl/any.hxx>
#include <svl/macitem.hxx>
#include <svl/stritem.hxx>
#include <svl/stylepool.hxx>
@@ -503,7 +504,7 @@ bool SwFormatRuby::PutValue( const uno::Any& rVal,
const uno::Type& rType = cppu::UnoType<bool>::get();
if(rVal.hasValue() && rVal.getValueType() == rType)
{
- bool bAbove = *static_cast<sal_Bool const *>(rVal.getValue());
+ bool bAbove = *o3tl::doAccess<bool>(rVal);
nPosition = bAbove ? 0 : 1;
}
}
diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx
index 8dd8028d4a24..75d286148d5c 100644
--- a/sw/source/core/unocore/swunohelper.cxx
+++ b/sw/source/core/unocore/swunohelper.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/types.hxx>
+#include <o3tl/any.hxx>
#include <tools/urlobj.hxx>
#include <tools/datetime.hxx>
#include <rtl/ustring.hxx>
@@ -147,7 +148,7 @@ bool UCB_IsReadOnlyFileName( const OUString& rURL )
ucbhelper::Content aCnt( rURL, css::uno::Reference< css::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
css::uno::Any aAny = aCnt.getPropertyValue("IsReadOnly");
if(aAny.hasValue())
- bIsReadOnly = *static_cast<sal_Bool const *>(aAny.getValue());
+ bIsReadOnly = *o3tl::doAccess<bool>(aAny);
}
catch( css::uno::Exception& )
{
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 417dff8ff9d8..bd54a963b06c 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -54,6 +54,7 @@
#include <rootfrm.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/ulspitem.hxx>
+#include <o3tl/any.hxx>
#include <svx/shapepropertynotifier.hxx>
#include <crstate.hxx>
#include <comphelper/extract.hxx>
@@ -854,8 +855,7 @@ SwFmDrawPage* SwXDrawPage::GetSvxPage()
pDrawPage = new SwFmDrawPage(pPage);
uno::Reference< drawing::XDrawPage > xPage = pDrawPage;
uno::Any aAgg = xPage->queryInterface(cppu::UnoType<uno::XAggregation>::get());
- if(aAgg.getValueType() == cppu::UnoType<uno::XAggregation>::get())
- xPageAgg = *static_cast<uno::Reference< uno::XAggregation > const *>(aAgg.getValue());
+ aAgg >>= xPageAgg;
}
if( xPageAgg.is() )
xPageAgg->setDelegator( static_cast<cppu::OWeakObject*>(this) );
@@ -901,12 +901,11 @@ sal_Int64 SAL_CALL SwXShape::getSomething( const uno::Sequence< sal_Int8 >& rId
{
const uno::Type& rTunnelType = cppu::UnoType<lang::XUnoTunnel>::get();
uno::Any aAgg = xShapeAgg->queryAggregation( rTunnelType );
- if(aAgg.getValueType() == rTunnelType)
+ if(auto xAggTunnel = o3tl::tryAccess<uno::Reference<lang::XUnoTunnel>>(
+ aAgg))
{
- uno::Reference<lang::XUnoTunnel> xAggTunnel =
- *static_cast<uno::Reference<lang::XUnoTunnel> const *>(aAgg.getValue());
- if(xAggTunnel.is())
- return xAggTunnel->getSomething(rId);
+ if(xAggTunnel->is())
+ return (*xAggTunnel)->getSomething(rId);
}
}
return 0;
@@ -932,8 +931,7 @@ SwXShape::SwXShape(uno::Reference< uno::XInterface > & xShape) :
//aAgg contains a reference of the SvxShape!
{
uno::Any aAgg = xShape->queryInterface(rAggType);
- if(aAgg.getValueType() == rAggType)
- xShapeAgg = *static_cast<uno::Reference< uno::XAggregation > const *>(aAgg.getValue());
+ aAgg >>= xShapeAgg;
// #i31698#
if ( xShapeAgg.is() )
{
@@ -1071,11 +1069,10 @@ uno::Reference< beans::XPropertySetInfo > SwXShape::getPropertySetInfo() throw(
{
const uno::Type& rPropSetType = cppu::UnoType<beans::XPropertySet>::get();
uno::Any aPSet = xShapeAgg->queryAggregation( rPropSetType );
- if(aPSet.getValueType() == rPropSetType && aPSet.getValue())
+ if(auto xPrSet = o3tl::tryAccess<uno::Reference<beans::XPropertySet>>(
+ aPSet))
{
- uno::Reference< beans::XPropertySet > xPrSet =
- *static_cast<uno::Reference< beans::XPropertySet > const *>(aPSet.getValue());
- uno::Reference< beans::XPropertySetInfo > xInfo = xPrSet->getPropertySetInfo();
+ uno::Reference< beans::XPropertySetInfo > xInfo = (*xPrSet)->getPropertySetInfo();
// Expand PropertySetInfo!
const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
aRet = new SfxExtItemPropertySetInfo( m_pPropertyMapEntries, aPropSeq );
@@ -1147,7 +1144,7 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a
bool bIsVisible = pDoc->getIDocumentDrawModelAccess().IsVisibleLayerId( pObj->GetLayer() );
if(FmFormInventor != pObj->GetObjInventor())
{
- pObj->SetLayer( *static_cast<sal_Bool const *>(aValue.getValue())
+ pObj->SetLayer( *o3tl::doAccess<bool>(aValue)
? ( bIsVisible ? pDoc->getIDocumentDrawModelAccess().GetHeavenId() : pDoc->getIDocumentDrawModelAccess().GetInvisibleHeavenId() )
: ( bIsVisible ? pDoc->getIDocumentDrawModelAccess().GetHellId() : pDoc->getIDocumentDrawModelAccess().GetInvisibleHellId() ));
}
@@ -1413,18 +1410,15 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a
pItem = pImpl->GetSurround(true);
break;
case FN_TEXT_RANGE:
- {
- const uno::Type rTextRangeType =
- cppu::UnoType<text::XTextRange>::get();
- if(aValue.getValueType() == rTextRangeType)
+ if(auto tr = o3tl::tryAccess<
+ uno::Reference<text::XTextRange>>(aValue))
{
uno::Reference< text::XTextRange > & rRange = pImpl->GetTextRange();
- rRange = *static_cast<uno::Reference< text::XTextRange > const *>(aValue.getValue());
+ rRange = *tr;
}
- }
break;
case RES_OPAQUE :
- pImpl->SetOpaque(*static_cast<sal_Bool const *>(aValue.getValue()));
+ pImpl->SetOpaque(*o3tl::doAccess<bool>(aValue));
break;
// #i26791#
case RES_FOLLOW_TEXT_FLOW:
@@ -1453,13 +1447,13 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a
}
else
{
- uno::Reference< beans::XPropertySet > xPrSet;
const uno::Type& rPSetType =
cppu::UnoType<beans::XPropertySet>::get();
uno::Any aPSet = xShapeAgg->queryAggregation(rPSetType);
- if(aPSet.getValueType() != rPSetType || !aPSet.getValue())
+ auto xPrSet = o3tl::tryAccess<uno::Reference<beans::XPropertySet>>(
+ aPSet);
+ if(!xPrSet)
throw uno::RuntimeException();
- xPrSet = *static_cast<uno::Reference< beans::XPropertySet > const *>(aPSet.getValue());
// #i31698# - setting the caption point of a
// caption object doesn't have to change the object position.
// Thus, keep the position, before the caption point is set and
@@ -1472,10 +1466,10 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a
if( pFormat && pFormat->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() )
{
UnoActionContext aCtx(pFormat->GetDoc());
- xPrSet->setPropertyValue(rPropertyName, aValue);
+ (*xPrSet)->setPropertyValue(rPropertyName, aValue);
}
else
- xPrSet->setPropertyValue(rPropertyName, aValue);
+ (*xPrSet)->setPropertyValue(rPropertyName, aValue);
if (pFormat)
{
@@ -1786,16 +1780,15 @@ uno::Any SwXShape::_getPropAtAggrObj( const OUString& _rPropertyName )
{
uno::Any aRet;
- uno::Reference< beans::XPropertySet > xPrSet;
const uno::Type& rPSetType =
cppu::UnoType<beans::XPropertySet>::get();
uno::Any aPSet = xShapeAgg->queryAggregation(rPSetType);
- if ( aPSet.getValueType() != rPSetType || !aPSet.getValue() )
+ auto xPrSet = o3tl::tryAccess<uno::Reference<beans::XPropertySet>>(aPSet);
+ if ( !xPrSet )
{
throw uno::RuntimeException();
}
- xPrSet = *static_cast<uno::Reference< beans::XPropertySet > const *>(aPSet.getValue());
- aRet = xPrSet->getPropertyValue( _rPropertyName );
+ aRet = (*xPrSet)->getPropertyValue( _rPropertyName );
return aRet;
}
@@ -1910,9 +1903,11 @@ uno::Sequence< beans::PropertyState > SwXShape::getPropertyStates(
{
const uno::Type& rPStateType = cppu::UnoType<XPropertyState>::get();
uno::Any aPState = xShapeAgg->queryAggregation(rPStateType);
- if(aPState.getValueType() != rPStateType || !aPState.getValue())
+ auto ps = o3tl::tryAccess<uno::Reference<XPropertyState>>(
+ aPState);
+ if(!ps)
throw uno::RuntimeException();
- xShapePrState = *static_cast<uno::Reference< XPropertyState > const *>(aPState.getValue());
+ xShapePrState = *ps;
}
pRet[nProperty] = xShapePrState->getPropertyState(pNames[nProperty]);
}
@@ -1975,10 +1970,11 @@ void SwXShape::setPropertyToDefault( const OUString& rPropertyName )
{
const uno::Type& rPStateType = cppu::UnoType<XPropertyState>::get();
uno::Any aPState = xShapeAgg->queryAggregation(rPStateType);
- if(aPState.getValueType() != rPStateType || !aPState.getValue())
+ auto xShapePrState = o3tl::tryAccess<uno::Reference<XPropertyState>>(
+ aPState);
+ if(!xShapePrState)
throw uno::RuntimeException();
- uno::Reference< XPropertyState > xShapePrState = *static_cast<uno::Reference< XPropertyState > const *>(aPState.getValue());
- xShapePrState->setPropertyToDefault( rPropertyName );
+ (*xShapePrState)->setPropertyToDefault( rPropertyName );
}
}
else
@@ -2010,10 +2006,11 @@ uno::Any SwXShape::getPropertyDefault( const OUString& rPropertyName )
{
const uno::Type& rPStateType = cppu::UnoType<XPropertyState>::get();
uno::Any aPState = xShapeAgg->queryAggregation(rPStateType);
- if(aPState.getValueType() != rPStateType || !aPState.getValue())
+ auto xShapePrState = o3tl::tryAccess<uno::Reference<XPropertyState>>(
+ aPState);
+ if(!xShapePrState)
throw uno::RuntimeException();
- uno::Reference< XPropertyState > xShapePrState = *static_cast<uno::Reference< XPropertyState > const *>(aPState.getValue());
- xShapePrState->getPropertyDefault( rPropertyName );
+ (*xShapePrState)->getPropertyDefault( rPropertyName );
}
}
else
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index b0a084f78322..6eabb3793a99 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -88,6 +88,7 @@
#include <tools/datetime.hxx>
#include <tools/urlobj.hxx>
#include <svx/dataaccessdescriptor.hxx>
+#include <o3tl/any.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <textapi.hxx>
@@ -2252,11 +2253,11 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
break;
case FIELD_PROP_DATE :
{
- if(rValue.getValueType() != ::cppu::UnoType<util::Date>::get())
+ auto aTemp = o3tl::tryAccess<util::Date>(rValue);
+ if(!aTemp)
throw lang::IllegalArgumentException();
- util::Date aTemp = *static_cast<const util::Date*>(rValue.getValue());
- m_pImpl->m_pProps->aDate = Date(aTemp.Day, aTemp.Month, aTemp.Year);
+ m_pImpl->m_pProps->aDate = Date(aTemp->Day, aTemp->Month, aTemp->Year);
}
break;
case FIELD_PROP_USHORT1:
@@ -2293,8 +2294,8 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
}
if (pBool)
{
- if( rValue.getValueType() == cppu::UnoType<bool>::get() )
- *pBool = *static_cast<sal_Bool const *>(rValue.getValue());
+ if( auto b = o3tl::tryAccess<bool>(rValue) )
+ *pBool = *b;
else
throw lang::IllegalArgumentException();
}
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 6cbff2e618a0..742cbb7fe0d1 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/embed/Aspects.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <o3tl/any.hxx>
#include <svx/svxids.hrc>
#include <svx/xfillit0.hxx>
#include <svx/xflgrit.hxx>
@@ -1495,7 +1496,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
}
else if(pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR )
{
- pNoText->SetAutomaticContour( *static_cast<sal_Bool const *>(aValue.getValue()) );
+ pNoText->SetAutomaticContour( *o3tl::doAccess<bool>(aValue) );
}
else if(pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR )
{
@@ -1505,7 +1506,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
// used already).
if( !pNoText->HasContour_() ||
!pNoText->IsContourMapModeValid() )
- pNoText->SetPixelContour( *static_cast<sal_Bool const *>(aValue.getValue()) );
+ pNoText->SetPixelContour( *o3tl::doAccess<bool>(aValue) );
else
throw lang::IllegalArgumentException();
}
@@ -3106,7 +3107,7 @@ void SwXFrame::setPosition(const awt::Point& /*aPosition*/) throw( uno::RuntimeE
awt::Size SwXFrame::getSize() throw( uno::RuntimeException, std::exception )
{
const ::uno::Any aVal = getPropertyValue("Size");
- awt::Size const * pRet = static_cast<awt::Size const *>(aVal.getValue());
+ awt::Size const * pRet = o3tl::doAccess<awt::Size>(aVal);
return *pRet;
}
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index edd68067e43f..1a4bc629ea30 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -21,6 +21,7 @@
#include <comphelper/string.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <o3tl/any.hxx>
#include <osl/endian.h>
#include <rtl/ustrbuf.hxx>
#include <unotools/collatorwrapper.hxx>
@@ -2675,9 +2676,9 @@ bool SwUnoCursorHelper::ConvertSortProperties(
// old and new sortdescriptor
if ( rPropName == "IsSortInTable" )
{
- if (aValue.getValueType() == cppu::UnoType<bool>::get())
+ if (auto b = o3tl::tryAccess<bool>(aValue))
{
- rSortOpt.bTable = *static_cast<sal_Bool const *>(aValue.getValue());
+ rSortOpt.bTable = *b;
}
else
{
@@ -2782,10 +2783,10 @@ bool SwUnoCursorHelper::ConvertSortProperties(
bOldSortdescriptor = true;
sal_uInt16 nIndex = rPropName[13];
nIndex = nIndex - '0';
- if (aValue.getValueType() == cppu::UnoType<bool>::get() && nIndex < 3)
+ auto bTemp = o3tl::tryAccess<bool>(aValue);
+ if (bTemp && nIndex < 3)
{
- bool bTemp = *static_cast<sal_Bool const *>(aValue.getValue());
- aKeys[nIndex]->bIsNumeric = bTemp;
+ aKeys[nIndex]->bIsNumeric = *bTemp;
}
else
{
@@ -2799,10 +2800,10 @@ bool SwUnoCursorHelper::ConvertSortProperties(
bOldSortdescriptor = true;
sal_uInt16 nIndex = rPropName[15];
nIndex -= '0';
- if (aValue.getValueType() == cppu::UnoType<bool>::get() && nIndex < 3)
+ auto bTemp = o3tl::tryAccess<bool>(aValue);
+ if (bTemp && nIndex < 3)
{
- bool bTemp = *static_cast<sal_Bool const *>(aValue.getValue());
- aKeys[nIndex]->eSortOrder = (bTemp)
+ aKeys[nIndex]->eSortOrder = (*bTemp)
? SRT_ASCENDING : SRT_DESCENDING;
}
else
@@ -2814,10 +2815,9 @@ bool SwUnoCursorHelper::ConvertSortProperties(
else if ( rPropName == "IsSortColumns" )
{
bNewSortdescriptor = true;
- if (aValue.getValueType() == cppu::UnoType<bool>::get())
+ if (auto bTemp = o3tl::tryAccess<bool>(aValue))
{
- bool bTemp = *static_cast<sal_Bool const *>(aValue.getValue());
- rSortOpt.eDirection = bTemp ? SRT_COLUMNS : SRT_ROWS;
+ rSortOpt.eDirection = *bTemp ? SRT_COLUMNS : SRT_ROWS;
}
else
{
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 9f9991aaed89..f7d522faf517 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -51,6 +51,7 @@
#include <com/sun/star/awt/XBitmap.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <o3tl/any.hxx>
#include <vcl/font.hxx>
#include <editeng/flstitem.hxx>
#include <vcl/metric.hxx>
@@ -385,7 +386,7 @@ void SwXFootnoteProperties::setPropertyValue(const OUString& rPropertyName, cons
break;
case WID_POSITION_END_OF_DOC:
{
- bool bVal = *static_cast<sal_Bool const *>(aValue.getValue());
+ bool bVal = *o3tl::doAccess<bool>(aValue);
aFootnoteInfo.ePos = bVal ? FTNPOS_CHAPTER : FTNPOS_PAGE;
}
break;
@@ -833,7 +834,7 @@ void SwXLineNumberingProperties::setPropertyValue(
{
case WID_NUM_ON:
{
- bool bVal = *static_cast<sal_Bool const *>(aValue.getValue());
+ bool bVal = *o3tl::doAccess<bool>(aValue);
aFontMetric.SetPaintLineNumbers(bVal);
}
break;
@@ -909,19 +910,19 @@ void SwXLineNumberingProperties::setPropertyValue(
break;
case WID_COUNT_EMPTY_LINES :
{
- bool bVal = *static_cast<sal_Bool const *>(aValue.getValue());
+ bool bVal = *o3tl::doAccess<bool>(aValue);
aFontMetric.SetCountBlankLines(bVal);
}
break;
case WID_COUNT_LINES_IN_FRAMES :
{
- bool bVal = *static_cast<sal_Bool const *>(aValue.getValue());
+ bool bVal = *o3tl::doAccess<bool>(aValue);
aFontMetric.SetCountInFlys(bVal);
}
break;
case WID_RESTART_AT_EACH_PAGE :
{
- bool bVal = *static_cast<sal_Bool const *>(aValue.getValue());
+ bool bVal = *o3tl::doAccess<bool>(aValue);
aFontMetric.SetRestartEachPage(bVal);
}
break;
@@ -1182,20 +1183,20 @@ void SwXNumberingRules::replaceByIndex(sal_Int32 nIndex, const uno::Any& rElemen
if(nIndex < 0 || MAXLEVEL <= nIndex)
throw lang::IndexOutOfBoundsException();
- if(rElement.getValueType().getTypeClass() != uno::TypeClass_SEQUENCE)
+ auto rProperties = o3tl::tryAccess<uno::Sequence<beans::PropertyValue>>(
+ rElement);
+ if(!rProperties)
throw lang::IllegalArgumentException();
- const uno::Sequence<beans::PropertyValue>& rProperties =
- *static_cast<const uno::Sequence<beans::PropertyValue>*>(rElement.getValue());
SwNumRule* pRule = nullptr;
if(pNumRule)
SwXNumberingRules::SetNumberingRuleByIndex( *pNumRule,
- rProperties, nIndex);
+ *rProperties, nIndex);
else if(pDocShell)
{
// #i87650# - correction of cws swwarnings:
SwNumRule aNumRule( *(pDocShell->GetDoc()->GetOutlineNumRule()) );
SwXNumberingRules::SetNumberingRuleByIndex( aNumRule,
- rProperties, nIndex);
+ *rProperties, nIndex);
// set character format if needed
const SwCharFormats* pFormats = pDocShell->GetDoc()->GetCharFormats();
const size_t nChCount = pFormats->size();
@@ -1236,7 +1237,7 @@ void SwXNumberingRules::replaceByIndex(sal_Int32 nIndex, const uno::Any& rElemen
nullptr != (pRule = pDoc->FindNumRulePtr( m_sCreatedNumRuleName )))
{
SwXNumberingRules::SetNumberingRuleByIndex( *pRule,
- rProperties, nIndex);
+ *rProperties, nIndex);
pRule->Validate();
}
@@ -2123,13 +2124,13 @@ void SwXNumberingRules::setPropertyValue( const OUString& rPropertyName, const A
if(rPropertyName == UNO_NAME_IS_AUTOMATIC)
{
- bool bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bVal = *o3tl::doAccess<bool>(rValue);
if(!pCreatedRule)
pDocRule ? pDocRule->SetAutoRule(bVal) : pNumRule->SetAutoRule(bVal);
}
else if(rPropertyName == UNO_NAME_IS_CONTINUOUS_NUMBERING)
{
- bool bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bVal = *o3tl::doAccess<bool>(rValue);
pDocRule ? pDocRule->SetContinusNum(bVal) :
pCreatedRule ? pCreatedRule->SetContinusNum(bVal) : pNumRule->SetContinusNum(bVal);
}
@@ -2140,13 +2141,13 @@ void SwXNumberingRules::setPropertyValue( const OUString& rPropertyName, const A
}
else if(rPropertyName == UNO_NAME_IS_ABSOLUTE_MARGINS)
{
- bool bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bVal = *o3tl::doAccess<bool>(rValue);
pDocRule ? pDocRule->SetAbsSpaces(bVal) :
pCreatedRule ? pCreatedRule->SetAbsSpaces(bVal) : pNumRule->SetAbsSpaces(bVal);
}
else if(rPropertyName == UNO_NAME_NUMBERING_IS_OUTLINE)
{
- bool bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bVal = *o3tl::doAccess<bool>(rValue);
SwNumRuleType eNumRuleType = bVal ? OUTLINE_RULE : NUM_RULE;
pDocRule ? pDocRule->SetRuleType(eNumRuleType) :
pCreatedRule ? pCreatedRule->SetRuleType(eNumRuleType) : pNumRule->SetRuleType(eNumRuleType);
@@ -2499,7 +2500,7 @@ void SwXTextColumns::setPropertyValue( const OUString& rPropertyName, const Any&
}
break;
case WID_TXTCOL_LINE_IS_ON:
- bSepLineIsOn = *static_cast<sal_Bool const *>(aValue.getValue());
+ bSepLineIsOn = *o3tl::doAccess<bool>(aValue);
break;
case WID_TXTCOL_AUTO_DISTANCE:
{
diff --git a/sw/source/core/unocore/unosrch.cxx b/sw/source/core/unocore/unosrch.cxx
index 70526383b602..338309acf253 100644
--- a/sw/source/core/unocore/unosrch.cxx
+++ b/sw/source/core/unocore/unosrch.cxx
@@ -24,6 +24,7 @@
#include <unobaseclass.hxx>
#include <unomid.h>
+#include <o3tl/any.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <editeng/unolingu.hxx>
@@ -563,8 +564,8 @@ void SwXTextSearch::setPropertyValue(const OUString& rPropertyName, const uno::A
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
throw beans::PropertyVetoException ("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
bool bVal = false;
- if(aValue.getValueType() == cppu::UnoType<bool>::get())
- bVal = *static_cast<sal_Bool const *>(aValue.getValue());
+ if(auto b = o3tl::tryAccess<bool>(aValue))
+ bVal = *b;
switch(pEntry->nWID)
{
case WID_SEARCH_ALL : bAll = bVal; break;
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 0ff7440d5a91..d66ebe26d500 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -24,6 +24,7 @@
#include <vector>
#include <algorithm>
+#include <o3tl/any.hxx>
#include <svx/svxids.hrc>
#include <editeng/memberids.hrc>
#include <float.h>
@@ -678,8 +679,8 @@ static void lcl_SetTableSeparators(const uno::Any& rVal, SwTable* pTable, SwTabl
if( !nOldCount )
return;
- const uno::Sequence< text::TableColumnSeparator>* pSepSeq =
- static_cast<uno::Sequence< text::TableColumnSeparator> const *>(rVal.getValue());
+ auto pSepSeq =
+ o3tl::tryAccess<uno::Sequence<text::TableColumnSeparator>>(rVal);
if(!pSepSeq || static_cast<size_t>(pSepSeq->getLength()) != nOldCount)
return;
SwTabCols aCols(aOldCols);
@@ -1342,7 +1343,7 @@ void SwXTextTableRow::setPropertyValue(const OUString& rPropertyName, const uno:
SwFormatFrameSize aFrameSize(pLn->GetFrameFormat()->GetFrameSize());
if(FN_UNO_ROW_AUTO_HEIGHT== pEntry->nWID)
{
- bool bSet = *static_cast<sal_Bool const *>(aValue.getValue());
+ bool bSet = *o3tl::doAccess<bool>(aValue);
aFrameSize.SetHeightSizeType(bSet ? ATT_VAR_SIZE : ATT_FIX_SIZE);
}
else
@@ -2588,7 +2589,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const uno::An
case FN_UNO_RANGE_ROW_LABEL:
{
- bool bTmp = *static_cast<sal_Bool const *>(aValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(aValue);
if (m_pImpl->m_bFirstRowAsLabel != bTmp)
{
lcl_SendChartEvent(*this, m_pImpl->m_Listeners);
@@ -2599,7 +2600,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const uno::An
case FN_UNO_RANGE_COL_LABEL:
{
- bool bTmp = *static_cast<sal_Bool const *>(aValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(aValue);
if (m_pImpl->m_bFirstColumnAsLabel != bTmp)
{
lcl_SendChartEvent(*this, m_pImpl->m_Listeners);
@@ -3530,7 +3531,7 @@ SwXCellRange::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
break;
case FN_UNO_RANGE_ROW_LABEL:
{
- bool bTmp = *static_cast<sal_Bool const *>(aValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(aValue);
if (m_pImpl->m_bFirstRowAsLabel != bTmp)
{
lcl_SendChartEvent(*this, m_pImpl->m_ChartListeners);
@@ -3540,7 +3541,7 @@ SwXCellRange::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
break;
case FN_UNO_RANGE_COL_LABEL:
{
- bool bTmp = *static_cast<sal_Bool const *>(aValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(aValue);
if (m_pImpl->m_bFirstColumnAsLabel != bTmp)
{
lcl_SendChartEvent(*this, m_pImpl->m_ChartListeners);
diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx
index 23ab86eb0ca6..d50fe551a8cf 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
#include <comphelper/string.hxx>
#include <hintids.hxx>
+#include <o3tl/any.hxx>
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
#include <svl/macitem.hxx>
@@ -103,27 +104,22 @@ static void lcl_html_outEvents( SvStream& rStrm,
for( nPos = 0 ; nPos < nCount; nPos++ )
{
uno::Any aTmp = xIndexAcc->getByIndex(nPos);
- OSL_ENSURE( aTmp.getValueType() ==
- cppu::UnoType<form::XFormComponent>::get()||
- aTmp.getValueType() ==
- cppu::UnoType<form::XForm>::get(),
- "lcl_html_outEvents: falsche Reflection" );
- if( aTmp.getValueType() ==
- cppu::UnoType<form::XFormComponent>::get())
+ if( auto x1 = o3tl::tryAccess<uno::Reference<form::XFormComponent>>(aTmp) )
{
- if( rFormComp ==
- *static_cast<uno::Reference< form::XFormComponent > const *>(aTmp.getValue()) )
+ if( rFormComp == *x1 )
break;
}
- else if( aTmp.getValueType() ==
- cppu::UnoType<form::XForm>::get())
+ else if( auto x2 = o3tl::tryAccess<uno::Reference<form::XForm>>(aTmp) )
{
- uno::Reference< form::XFormComponent > xFC(
- *static_cast<uno::Reference< form::XForm > const *>(aTmp.getValue()), uno::UNO_QUERY );
+ uno::Reference< form::XFormComponent > xFC( *x2, uno::UNO_QUERY );
if( rFormComp == xFC )
break;
}
+ else
+ {
+ OSL_ENSURE( false, "lcl_html_outEvents: falsche Reflection" );
+ }
}
if( nPos == nCount )
@@ -377,12 +373,12 @@ void SwHTMLWriter::OutHiddenForms()
for( sal_Int32 i=0; i<nCount; i++)
{
uno::Any aTmp = xForms->getByIndex( i );
- OSL_ENSURE( aTmp.getValueType() ==
- cppu::UnoType<form::XForm>::get(),
- "OutHiddenForms: falsche Reflection" );
- if( aTmp.getValueType() ==
- cppu::UnoType<form::XForm>::get())
- OutHiddenForm( *static_cast<uno::Reference< form::XForm > const *>(aTmp.getValue()) );
+ if( auto x = o3tl::tryAccess<uno::Reference<form::XForm>>(aTmp) )
+ OutHiddenForm( *x );
+ else
+ {
+ OSL_ENSURE( false, "OutHiddenForms: falsche Reflection" );
+ }
}
}
@@ -397,33 +393,28 @@ void SwHTMLWriter::OutHiddenForm( const uno::Reference< form::XForm > & rForm )
for( sal_Int32 i=0; i<nCount; i++ )
{
uno::Any aTmp = xFormComps->getByIndex( i );
- OSL_ENSURE( aTmp.getValueType() ==
- cppu::UnoType<form::XFormComponent>::get(),
- "OutHiddenForm: falsche Reflection" );
- if( aTmp.getValueType() !=
- cppu::UnoType<form::XFormComponent>::get())
+ auto xFormComp = o3tl::tryAccess<uno::Reference<form::XFormComponent>>(
+ aTmp);
+ OSL_ENSURE( xFormComp, "OutHiddenForm: falsche Reflection" );
+ if( !xFormComp )
continue;
- uno::Reference< form::XFormComponent > xFormComp =
- *static_cast<uno::Reference< form::XFormComponent > const *>(aTmp.getValue());
- uno::Reference< form::XForm > xForm( xFormComp, uno::UNO_QUERY );
+ uno::Reference< form::XForm > xForm( *xFormComp, uno::UNO_QUERY );
if( xForm.is() )
OutHiddenForm( xForm );
if( bHiddenOnly )
{
- uno::Reference< beans::XPropertySet > xPropSet( xFormComp, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xPropSet( *xFormComp, uno::UNO_QUERY );
OUString sPropName("ClassId");
if( xPropSet->getPropertySetInfo()->hasPropertyByName( sPropName ) )
{
uno::Any aAny2 = xPropSet->getPropertyValue( sPropName );
- if( aAny2.getValueType() == ::cppu::UnoType<sal_Int16>::get() )
+ if( auto n = o3tl::tryAccess<sal_Int16>(aAny2) )
{
- if( form::FormComponentType::HIDDENCONTROL ==
- *static_cast<sal_Int16 const *>(aAny2.getValue()) )
+ if( form::FormComponentType::HIDDENCONTROL == *n )
bHidden = true;
- else if( lcl_html_isHTMLControl(
- *static_cast<sal_Int16 const *>(aAny2.getValue()) ) )
+ else if( lcl_html_isHTMLControl( *n ) )
bHiddenOnly = false;
}
}
@@ -463,46 +454,46 @@ void SwHTMLWriter::OutForm( bool bOn,
uno::Reference< beans::XPropertySet > xFormPropSet( rFormComps, uno::UNO_QUERY );
uno::Any aTmp = xFormPropSet->getPropertyValue( "Name" );
- if( aTmp.getValueType() == ::cppu::UnoType<OUString>::get() &&
- !static_cast<const OUString*>(aTmp.getValue())->isEmpty() )
+ if( auto s = o3tl::tryAccess<OUString>(aTmp) )
{
- sOut += " " OOO_STRING_SVTOOLS_HTML_O_name "=\"";
- Strm().WriteOString( sOut );
- HTMLOutFuncs::Out_String( Strm(), *static_cast<OUString const *>(aTmp.getValue()),
- m_eDestEnc, &m_aNonConvertableCharacters );
- sOut = "\"";
+ if( !s->isEmpty() )
+ {
+ sOut += " " OOO_STRING_SVTOOLS_HTML_O_name "=\"";
+ Strm().WriteOString( sOut );
+ HTMLOutFuncs::Out_String( Strm(), *s,
+ m_eDestEnc, &m_aNonConvertableCharacters );
+ sOut = "\"";
+ }
}
aTmp = xFormPropSet->getPropertyValue( "TargetURL" );
- if( aTmp.getValueType() == ::cppu::UnoType<OUString>::get() &&
- !static_cast<const OUString*>(aTmp.getValue())->isEmpty() )
+ if( auto s = o3tl::tryAccess<OUString>(aTmp) )
{
- sOut += " " OOO_STRING_SVTOOLS_HTML_O_action "=\"";
- Strm().WriteOString( sOut );
- OUString aURL( *static_cast<OUString const *>(aTmp.getValue()) );
- aURL = URIHelper::simpleNormalizedMakeRelative( GetBaseURL(), aURL);
- HTMLOutFuncs::Out_String( Strm(), aURL, m_eDestEnc, &m_aNonConvertableCharacters );
- sOut = "\"";
+ if ( !s->isEmpty() )
+ {
+ sOut += " " OOO_STRING_SVTOOLS_HTML_O_action "=\"";
+ Strm().WriteOString( sOut );
+ OUString aURL
+ = URIHelper::simpleNormalizedMakeRelative( GetBaseURL(), *s);
+ HTMLOutFuncs::Out_String( Strm(), aURL, m_eDestEnc, &m_aNonConvertableCharacters );
+ sOut = "\"";
+ }
}
aTmp = xFormPropSet->getPropertyValue( "SubmitMethod" );
- if( aTmp.getValueType() == cppu::UnoType<form::FormSubmitMethod>::get())
+ if( auto eMethod = o3tl::tryAccess<form::FormSubmitMethod>(aTmp) )
{
- form::FormSubmitMethod eMethod =
- *static_cast<form::FormSubmitMethod const *>(aTmp.getValue());
- if( form::FormSubmitMethod_POST==eMethod )
+ if( form::FormSubmitMethod_POST==*eMethod )
{
sOut += " " OOO_STRING_SVTOOLS_HTML_O_method "=\""
OOO_STRING_SVTOOLS_HTML_METHOD_post "\"";
}
}
aTmp = xFormPropSet->getPropertyValue( "SubmitEncoding" );
- if( aTmp.getValueType()==cppu::UnoType<form::FormSubmitEncoding>::get())
+ if( auto eEncType = o3tl::tryAccess<form::FormSubmitEncoding>(aTmp) )
{
- form::FormSubmitEncoding eEncType =
- *static_cast<form::FormSubmitEncoding const *>(aTmp.getValue());
const sal_Char *pStr = nullptr;
- switch( eEncType )
+ switch( *eEncType )
{
case form::FormSubmitEncoding_MULTIPART:
pStr = OOO_STRING_SVTOOLS_HTML_ET_multipart;
@@ -522,14 +513,16 @@ void SwHTMLWriter::OutForm( bool bOn,
}
aTmp = xFormPropSet->getPropertyValue( "TargetFrame" );
- if( aTmp.getValueType() == ::cppu::UnoType<OUString>::get()&&
- !static_cast<const OUString*>(aTmp.getValue())->isEmpty() )
+ if( auto s = o3tl::tryAccess<OUString>(aTmp) )
{
- sOut += " " OOO_STRING_SVTOOLS_HTML_O_target "=\"";
- Strm().WriteOString( sOut );
- HTMLOutFuncs::Out_String( Strm(), *static_cast<OUString const *>(aTmp.getValue()),
- m_eDestEnc, &m_aNonConvertableCharacters );
- sOut = "\"";
+ if (!s->isEmpty() )
+ {
+ sOut += " " OOO_STRING_SVTOOLS_HTML_O_target "=\"";
+ Strm().WriteOString( sOut );
+ HTMLOutFuncs::Out_String( Strm(), *s,
+ m_eDestEnc, &m_aNonConvertableCharacters );
+ sOut = "\"";
+ }
}
Strm().WriteOString( sOut );
@@ -555,39 +548,33 @@ void SwHTMLWriter::OutHiddenControls(
for( nPos=0; !bDone && nPos < nCount; nPos++ )
{
uno::Any aTmp = rFormComps->getByIndex( nPos );
- OSL_ENSURE( aTmp.getValueType() ==
- cppu::UnoType<form::XFormComponent>::get(),
+ auto x = o3tl::tryAccess<uno::Reference<form::XFormComponent>>(aTmp);
+ OSL_ENSURE( x,
"OutHiddenControls: falsche Reflection" );
- bDone = aTmp.getValueType() ==
- cppu::UnoType<form::XFormComponent>::get()&&
- *static_cast<uno::Reference< form::XFormComponent > const *>(aTmp.getValue()) ==
- xFC;
+ bDone = x && *x == xFC;
}
}
for( ; nPos < nCount; nPos++ )
{
uno::Any aTmp = rFormComps->getByIndex( nPos );
- OSL_ENSURE( aTmp.getValueType() ==
- cppu::UnoType<form::XFormComponent>::get(),
+ auto xFC = o3tl::tryAccess<uno::Reference<form::XFormComponent>>(aTmp);
+ OSL_ENSURE( xFC,
"OutHiddenControls: falsche Reflection" );
- if( aTmp.getValueType() !=
- cppu::UnoType<form::XFormComponent>::get())
+ if( !xFC )
continue;
- uno::Reference< form::XFormComponent > xFC =
- *static_cast<uno::Reference< form::XFormComponent > const *>(aTmp.getValue());
- uno::Reference< beans::XPropertySet > xPropSet( xFC, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xPropSet( *xFC, uno::UNO_QUERY );
OUString sPropName = "ClassId";
if( !xPropSet->getPropertySetInfo()->hasPropertyByName( sPropName ) )
continue;
aTmp = xPropSet->getPropertyValue( sPropName );
- if( aTmp.getValueType() != ::cppu::UnoType<sal_Int16>::get() )
+ auto n = o3tl::tryAccess<sal_Int16>(aTmp);
+ if( !n )
continue;
- if( form::FormComponentType::HIDDENCONTROL ==
- *static_cast<sal_Int16 const *>(aTmp.getValue()) )
+ if( form::FormComponentType::HIDDENCONTROL == *n )
{
if( m_bLFPossible )
OutNewLine( true );
@@ -596,31 +583,35 @@ void SwHTMLWriter::OutHiddenControls(
OOO_STRING_SVTOOLS_HTML_IT_hidden "\"";
aTmp = xPropSet->getPropertyValue( "Name" );
- if( aTmp.getValueType() == ::cppu::UnoType<OUString>::get() &&
- !static_cast<const OUString*>(aTmp.getValue())->isEmpty() )
+ if( auto s = o3tl::tryAccess<OUString>(aTmp) )
{
- sOut += " " OOO_STRING_SVTOOLS_HTML_O_name "=\"";
- Strm().WriteOString( sOut );
- HTMLOutFuncs::Out_String( Strm(), *static_cast<OUString const *>(aTmp.getValue()),
- m_eDestEnc, &m_aNonConvertableCharacters );
- sOut = "\"";
+ if( !s->isEmpty() )
+ {
+ sOut += " " OOO_STRING_SVTOOLS_HTML_O_name "=\"";
+ Strm().WriteOString( sOut );
+ HTMLOutFuncs::Out_String( Strm(), *s,
+ m_eDestEnc, &m_aNonConvertableCharacters );
+ sOut = "\"";
+ }
}
aTmp = xPropSet->getPropertyValue( "HiddenValue" );
- if( aTmp.getValueType() == ::cppu::UnoType<OUString>::get() &&
- !static_cast<const OUString*>(aTmp.getValue())->isEmpty() )
+ if( auto s = o3tl::tryAccess<OUString>(aTmp) )
{
- sOut += " " OOO_STRING_SVTOOLS_HTML_O_value "=\"";
- Strm().WriteOString( sOut );
- HTMLOutFuncs::Out_String( Strm(), *static_cast<OUString const *>(aTmp.getValue()),
- m_eDestEnc, &m_aNonConvertableCharacters );
- sOut = "\"";
+ if( !s->isEmpty() )
+ {
+ sOut += " " OOO_STRING_SVTOOLS_HTML_O_value "=\"";
+ Strm().WriteOString( sOut );
+ HTMLOutFuncs::Out_String( Strm(), *s,
+ m_eDestEnc, &m_aNonConvertableCharacters );
+ sOut = "\"";
+ }
}
sOut += ">";
Strm().WriteOString( sOut );
m_nFormCntrlCnt++;
}
- else if( lcl_html_isHTMLControl( *static_cast<sal_Int16 const *>(aTmp.getValue()) ) )
+ else if( lcl_html_isHTMLControl( *n ) )
{
break;
}
@@ -655,10 +646,12 @@ const SdrObject *SwHTMLWriter::GetHTMLControl( const SwDrawFrameFormat& rFormat
return nullptr;
uno::Any aTmp = xPropSet->getPropertyValue( sPropName );
- if( aTmp.getValueType() == ::cppu::UnoType<sal_Int16>::get()&&
- lcl_html_isHTMLControl( *static_cast<sal_Int16 const *>(aTmp.getValue()) ) )
+ if( auto n = o3tl::tryAccess<sal_Int16>(aTmp) )
{
- return pObj;
+ if( lcl_html_isHTMLControl( *n ) )
+ {
+ return pObj;
+ }
}
return nullptr;
@@ -724,7 +717,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
OString sOptions;
bool bEmptyValue = false;
uno::Any aTmp = xPropSet->getPropertyValue( "ClassId" );
- sal_Int16 nClassId = *static_cast<sal_Int16 const *>(aTmp.getValue());
+ sal_Int16 nClassId = *o3tl::doAccess<sal_Int16>(aTmp);
sal_uInt32 nFrameOpts = HTML_FRMOPTS_CONTROL;
switch( nClassId )
{
@@ -733,24 +726,25 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
eType = (form::FormComponentType::CHECKBOX == nClassId
? TYPE_CHECKBOX : TYPE_RADIO);
aTmp = xPropSet->getPropertyValue( "DefaultState" );
- if( aTmp.getValueType() == ::cppu::UnoType<sal_Int16>::get() &&
- TRISTATE_FALSE != *static_cast<sal_Int16 const *>(aTmp.getValue()) )
+ if( auto n = o3tl::tryAccess<sal_Int16>(aTmp) )
{
- sOptions += " " OOO_STRING_SVTOOLS_HTML_O_checked;
- sOptions += "=\"";
- sOptions += OString(OOO_STRING_SVTOOLS_HTML_O_checked);
- sOptions += "\"";
+ if ( TRISTATE_FALSE != *n )
+ {
+ sOptions += " " OOO_STRING_SVTOOLS_HTML_O_checked;
+ sOptions += "=\"";
+ sOptions += OString(OOO_STRING_SVTOOLS_HTML_O_checked);
+ sOptions += "\"";
+ }
}
aTmp = xPropSet->getPropertyValue( "RefValue" );
- if( aTmp.getValueType() == ::cppu::UnoType<OUString>::get() )
+ if( auto rVal = o3tl::tryAccess<OUString>(aTmp) )
{
- const OUString& rVal = *static_cast<OUString const *>(aTmp.getValue());
- if( rVal.isEmpty() )
+ if( rVal->isEmpty() )
bEmptyValue = true;
- else if( rVal != OOO_STRING_SVTOOLS_HTML_on )
- sValue = rVal;
+ else if( *rVal != OOO_STRING_SVTOOLS_HTML_on )
+ sValue = *rVal;
}
break;
@@ -758,9 +752,8 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
{
form::FormButtonType eButtonType = form::FormButtonType_PUSH;
aTmp = xPropSet->getPropertyValue( "ButtonType" );
- if( aTmp.getValueType() ==
- ::cppu::UnoType<form::FormButtonType>::get() )
- eButtonType = *static_cast<form::FormButtonType const *>(aTmp.getValue());
+ if( auto t = o3tl::tryAccess<form::FormButtonType>(aTmp) )
+ eButtonType = *t;
switch( eButtonType )
{
@@ -776,10 +769,12 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
}
aTmp = xPropSet->getPropertyValue( "Label" );
- if( aTmp.getValueType() == ::cppu::UnoType<OUString>::get() &&
- !static_cast<const OUString*>(aTmp.getValue())->isEmpty() )
+ if( auto s = o3tl::tryAccess<OUString>(aTmp) )
{
- sValue = *static_cast<OUString const *>(aTmp.getValue());
+ if( !s->isEmpty() )
+ {
+ sValue = *s;
+ }
}
}
break;
@@ -789,24 +784,28 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
rHTMLWrt.OutNewLine( true );
eTag = TAG_SELECT;
aTmp = xPropSet->getPropertyValue( "Dropdown" );
- if( aTmp.getValueType() == cppu::UnoType<bool>::get() &&
- !*static_cast<sal_Bool const *>(aTmp.getValue()) )
+ if( auto b1 = o3tl::tryAccess<bool>(aTmp) )
{
- Size aSz( 0, 0 );
- GetControlSize( rFormObj, aSz, rWrt.pDoc );
-
- // wieviele sind sichtbar ??
- if( aSz.Height() )
+ if( !*b1 )
{
- sOptions += " " OOO_STRING_SVTOOLS_HTML_O_size "=\"" +
- OString::number(static_cast<sal_Int32>(aSz.Height())) + "\"";
- }
+ Size aSz( 0, 0 );
+ GetControlSize( rFormObj, aSz, rWrt.pDoc );
- aTmp = xPropSet->getPropertyValue( "MultiSelection" );
- if( aTmp.getValueType() == cppu::UnoType<bool>::get() &&
- *static_cast<sal_Bool const *>(aTmp.getValue()) )
- {
- sOptions += " " OOO_STRING_SVTOOLS_HTML_O_multiple;
+ // wieviele sind sichtbar ??
+ if( aSz.Height() )
+ {
+ sOptions += " " OOO_STRING_SVTOOLS_HTML_O_size "=\"" +
+ OString::number(static_cast<sal_Int32>(aSz.Height())) + "\"";
+ }
+
+ auto aTmp2 = xPropSet->getPropertyValue( "MultiSelection" );
+ if( auto b2 = o3tl::tryAccess<bool>(aTmp2) )
+ {
+ if ( *b2 )
+ {
+ sOptions += " " OOO_STRING_SVTOOLS_HTML_O_multiple;
+ }
+ }
}
}
break;
@@ -821,8 +820,8 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
if( xPropSetInfo->hasPropertyByName( sMultiLine ) )
{
aTmp = xPropSet->getPropertyValue( sMultiLine );
- bMultiLine = aTmp.getValueType() == cppu::UnoType<bool>::get() &&
- *static_cast<sal_Bool const *>(aTmp.getValue());
+ auto b = o3tl::tryAccess<bool>(aTmp);
+ bMultiLine = b && *b;
}
if( bMultiLine )
@@ -845,14 +844,13 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
aTmp = xPropSet->getPropertyValue( "HScroll" );
if( aTmp.getValueType() == cppu::UnoType<void>::get() ||
(aTmp.getValueType() == cppu::UnoType<bool>::get() &&
- !*static_cast<sal_Bool const *>(aTmp.getValue())) )
+ !*o3tl::forceAccess<bool>(aTmp)) )
{
const sal_Char *pWrapStr = nullptr;
- aTmp = xPropSet->getPropertyValue( "HardLineBreaks" );
- pWrapStr =
- (aTmp.getValueType() == cppu::UnoType<bool>::get() &&
- *static_cast<sal_Bool const *>(aTmp.getValue())) ? OOO_STRING_SVTOOLS_HTML_WW_hard
- : OOO_STRING_SVTOOLS_HTML_WW_soft;
+ auto aTmp2 = xPropSet->getPropertyValue( "HardLineBreaks" );
+ auto b = o3tl::tryAccess<bool>(aTmp2);
+ pWrapStr = (b && *b) ? OOO_STRING_SVTOOLS_HTML_WW_hard
+ : OOO_STRING_SVTOOLS_HTML_WW_soft;
sOptions += " " OOO_STRING_SVTOOLS_HTML_O_wrap "=\"" +
OString(pWrapStr) + "\"";
}
@@ -864,9 +862,11 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
if( xPropSetInfo->hasPropertyByName( sEchoChar ) )
{
aTmp = xPropSet->getPropertyValue( sEchoChar );
- if( aTmp.getValueType() == ::cppu::UnoType<sal_Int16>::get() &&
- *static_cast<sal_Int16 const *>(aTmp.getValue()) != 0 )
- eType = TYPE_PASSWORD;
+ if( auto n = o3tl::tryAccess<sal_Int16>(aTmp) )
+ {
+ if( *n != 0 )
+ eType = TYPE_PASSWORD;
+ }
}
if( aSz.Width() )
@@ -876,20 +876,24 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
}
aTmp = xPropSet->getPropertyValue( "MaxTextLen" );
- if( aTmp.getValueType() == ::cppu::UnoType<sal_Int16>::get() &&
- *static_cast<sal_Int16 const *>(aTmp.getValue()) != 0 )
+ if( auto n = o3tl::tryAccess<sal_Int16>(aTmp) )
{
- sOptions += " " OOO_STRING_SVTOOLS_HTML_O_maxlength "=\"" +
- OString::number(static_cast<sal_Int32>(*static_cast<sal_Int16 const *>(aTmp.getValue()))) + "\"";
+ if( *n != 0 )
+ {
+ sOptions += " " OOO_STRING_SVTOOLS_HTML_O_maxlength "=\"" +
+ OString::number(static_cast<sal_Int32>(*n)) + "\"";
+ }
}
if( xPropSetInfo->hasPropertyByName( "DefaultText" ) )
{
aTmp = xPropSet->getPropertyValue( "DefaultText" );
- if( aTmp.getValueType() == ::cppu::UnoType<OUString>::get() &&
- !static_cast<const OUString*>(aTmp.getValue())->isEmpty() )
+ if( auto s = o3tl::tryAccess<OUString>(aTmp) )
{
- sValue = *static_cast<OUString const *>(aTmp.getValue());
+ if( !s->isEmpty() )
+ {
+ sValue = *s;
+ }
}
}
}
@@ -933,21 +937,25 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
}
aTmp = xPropSet->getPropertyValue("Name");
- if( aTmp.getValueType() == ::cppu::UnoType<OUString>::get() &&
- !static_cast<const OUString*>(aTmp.getValue())->isEmpty() )
+ if( auto s = o3tl::tryAccess<OUString>(aTmp) )
{
- sOut += " " OOO_STRING_SVTOOLS_HTML_O_name "=\"";
- rWrt.Strm().WriteOString( sOut );
- HTMLOutFuncs::Out_String( rWrt.Strm(), *static_cast<OUString const *>(aTmp.getValue()),
- rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
- sOut = "\"";
+ if( !s->isEmpty() )
+ {
+ sOut += " " OOO_STRING_SVTOOLS_HTML_O_name "=\"";
+ rWrt.Strm().WriteOString( sOut );
+ HTMLOutFuncs::Out_String( rWrt.Strm(), *s,
+ rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
+ sOut = "\"";
+ }
}
aTmp = xPropSet->getPropertyValue("Enabled");
- if( aTmp.getValueType() == cppu::UnoType<bool>::get() &&
- !*static_cast<sal_Bool const *>(aTmp.getValue()) )
+ if( auto b = o3tl::tryAccess<bool>(aTmp) )
{
- sOut += " " OOO_STRING_SVTOOLS_HTML_O_disabled;
+ if( !*b )
+ {
+ sOut += " " OOO_STRING_SVTOOLS_HTML_O_disabled;
+ }
}
if( !sValue.isEmpty() || bEmptyValue )
@@ -963,16 +971,18 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
if( TYPE_IMAGE == eType )
{
aTmp = xPropSet->getPropertyValue( "ImageURL" );
- if( aTmp.getValueType() == ::cppu::UnoType<OUString>::get() &&
- !static_cast<const OUString*>(aTmp.getValue())->isEmpty() )
+ if( auto s = o3tl::tryAccess<OUString>(aTmp) )
{
- sOut += " " OOO_STRING_SVTOOLS_HTML_O_src "=\"";
- rWrt.Strm().WriteOString( sOut );
+ if( !s->isEmpty() )
+ {
+ sOut += " " OOO_STRING_SVTOOLS_HTML_O_src "=\"";
+ rWrt.Strm().WriteOString( sOut );
- HTMLOutFuncs::Out_String( rWrt.Strm(),
- URIHelper::simpleNormalizedMakeRelative( rWrt.GetBaseURL(), *static_cast<OUString const *>(aTmp.getValue())),
- rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
- sOut = "\"";
+ HTMLOutFuncs::Out_String( rWrt.Strm(),
+ URIHelper::simpleNormalizedMakeRelative( rWrt.GetBaseURL(), *s),
+ rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters );
+ sOut = "\"";
+ }
}
Size aTwipSz( rFormObj.GetLogicRect().GetSize() );
@@ -1003,9 +1013,9 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
}
aTmp = xPropSet->getPropertyValue( "TabIndex" );
- if( aTmp.getValueType() == ::cppu::UnoType<sal_Int16>::get() )
+ if( auto n = o3tl::tryAccess<sal_Int16>(aTmp) )
{
- sal_Int16 nTabIndex = *static_cast<sal_Int16 const *>(aTmp.getValue());
+ sal_Int16 nTabIndex = *n;
if( nTabIndex > 0 )
{
if( nTabIndex >= 32767 )
@@ -1042,63 +1052,63 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
if( xPropSetInfo->hasPropertyByName( "BackgroundColor" ) )
{
aTmp = xPropSet->getPropertyValue( "BackgroundColor" );
- if( aTmp.getValueType() == ::cppu::UnoType<sal_Int32>::get() )
+ if( auto n = o3tl::tryAccess<sal_Int32>(aTmp) )
{
- Color aCol(*static_cast<sal_Int32 const *>(aTmp .getValue()));
+ Color aCol(*n);
aItemSet.Put( SvxBrushItem( aCol, RES_CHRATR_BACKGROUND ) );
}
}
if( xPropSetInfo->hasPropertyByName( "TextColor" ) )
{
aTmp = xPropSet->getPropertyValue( "TextColor" );
- if( aTmp.getValueType() == ::cppu::UnoType<sal_Int32>::get() )
+ if( auto n = o3tl::tryAccess<sal_Int32>(aTmp) )
{
- Color aColor( *static_cast<sal_Int32 const *>(aTmp .getValue()) );
+ Color aColor( *n );
aItemSet.Put( SvxColorItem( aColor, RES_CHRATR_COLOR ) );
}
}
if( xPropSetInfo->hasPropertyByName( "FontHeight" ) )
{
aTmp = xPropSet->getPropertyValue( "FontHeight" );
- if( aTmp.getValueType() == cppu::UnoType<float>::get())
+ if( auto nHeight = o3tl::tryAccess<float>(aTmp) )
{
- float nHeight = *static_cast<float const *>(aTmp.getValue());
- if( nHeight > 0 && (!bEdit || !rtl::math::approxEqual(nHeight, 10.0)) )
- aItemSet.Put( SvxFontHeightItem( sal_Int16(nHeight * 20.), 100, RES_CHRATR_FONTSIZE ) );
+ if( *nHeight > 0 && (!bEdit || !rtl::math::approxEqual(*nHeight, 10.0)) )
+ aItemSet.Put( SvxFontHeightItem( sal_Int16(*nHeight * 20.), 100, RES_CHRATR_FONTSIZE ) );
}
}
if( xPropSetInfo->hasPropertyByName( "FontName" ) )
{
aTmp = xPropSet->getPropertyValue( "FontName" );
- if( aTmp.getValueType() == ::cppu::UnoType<OUString>::get() &&
- !static_cast<const OUString*>(aTmp.getValue())->isEmpty() )
+ if( auto aFName = o3tl::tryAccess<OUString>(aTmp) )
{
- vcl::Font aFixedFont( OutputDevice::GetDefaultFont(
- DefaultFontType::FIXED, LANGUAGE_ENGLISH_US,
- GetDefaultFontFlags::OnlyOne ) );
- OUString aFName( *static_cast<OUString const *>(aTmp.getValue()) );
- if( !bEdit || aFName != aFixedFont.GetFamilyName() )
+ if( !aFName->isEmpty() )
{
- FontFamily eFamily = FAMILY_DONTKNOW;
- if( xPropSetInfo->hasPropertyByName( "FontFamily" ) )
+ vcl::Font aFixedFont( OutputDevice::GetDefaultFont(
+ DefaultFontType::FIXED, LANGUAGE_ENGLISH_US,
+ GetDefaultFontFlags::OnlyOne ) );
+ if( !bEdit || *aFName != aFixedFont.GetFamilyName() )
{
- aTmp = xPropSet->getPropertyValue( "FontFamily" );
- if( aTmp.getValueType() == ::cppu::UnoType<sal_Int16>::get())
- eFamily = (FontFamily)*static_cast<sal_Int16 const *>(aTmp.getValue());
+ FontFamily eFamily = FAMILY_DONTKNOW;
+ if( xPropSetInfo->hasPropertyByName( "FontFamily" ) )
+ {
+ auto aTmp2 = xPropSet->getPropertyValue( "FontFamily" );
+ if( auto n = o3tl::tryAccess<sal_Int16>(aTmp2) )
+ eFamily = (FontFamily)*n;
+ }
+ SvxFontItem aItem( eFamily, *aFName, aEmptyOUStr, PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT );
+ aItemSet.Put( aItem );
}
- SvxFontItem aItem( eFamily, aFName, aEmptyOUStr, PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT );
- aItemSet.Put( aItem );
}
}
}
if( xPropSetInfo->hasPropertyByName( "FontWeight" ) )
{
aTmp = xPropSet->getPropertyValue( "FontWeight" );
- if( aTmp.getValueType() == cppu::UnoType<float>::get())
+ if( auto x = o3tl::tryAccess<float>(aTmp) )
{
FontWeight eWeight =
- VCLUnoHelper::ConvertFontWeight( *static_cast<float const *>(aTmp.getValue()) );
+ VCLUnoHelper::ConvertFontWeight( *x );
if( eWeight != WEIGHT_DONTKNOW && eWeight != WEIGHT_NORMAL )
aItemSet.Put( SvxWeightItem( eWeight, RES_CHRATR_WEIGHT ) );
}
@@ -1106,9 +1116,9 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
if( xPropSetInfo->hasPropertyByName( "FontSlant" ) )
{
aTmp = xPropSet->getPropertyValue( "FontSlant" );
- if( aTmp.getValueType() == ::cppu::UnoType<sal_Int16>::get())
+ if( auto n = o3tl::tryAccess<sal_Int16>(aTmp) )
{
- FontItalic eItalic = (FontItalic)*static_cast<sal_Int16 const *>(aTmp.getValue());
+ FontItalic eItalic = (FontItalic)*n;
if( eItalic != ITALIC_DONTKNOW && eItalic != ITALIC_NONE )
aItemSet.Put( SvxPostureItem( eItalic, RES_CHRATR_POSTURE ) );
}
@@ -1116,10 +1126,9 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
if( xPropSetInfo->hasPropertyByName( "FontLineStyle" ) )
{
aTmp = xPropSet->getPropertyValue( "FontLineStyle" );
- if( aTmp.getValueType() == ::cppu::UnoType<sal_Int16>::get() )
+ if( auto n = o3tl::tryAccess<sal_Int16>(aTmp) )
{
- FontLineStyle eUnderline =
- (FontLineStyle)*static_cast<sal_Int16 const *>(aTmp.getValue());
+ FontLineStyle eUnderline = (FontLineStyle)*n;
if( eUnderline != LINESTYLE_DONTKNOW &&
eUnderline != LINESTYLE_NONE )
aItemSet.Put( SvxUnderlineItem( eUnderline, RES_CHRATR_UNDERLINE ) );
@@ -1128,10 +1137,9 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
if( xPropSetInfo->hasPropertyByName( "FontStrikeout" ) )
{
aTmp = xPropSet->getPropertyValue( "FontStrikeout" );
- if( aTmp.getValueType() == ::cppu::UnoType<sal_Int16>::get())
+ if( auto n = o3tl::tryAccess<sal_Int16>(aTmp) )
{
- FontStrikeout eStrikeout =
- (FontStrikeout)*static_cast<sal_Int16 const *>(aTmp.getValue());
+ FontStrikeout eStrikeout = (FontStrikeout)*n;
if( eStrikeout != STRIKEOUT_DONTKNOW &&
eStrikeout != STRIKEOUT_NONE )
aItemSet.Put( SvxCrossedOutItem( eStrikeout, RES_CHRATR_CROSSEDOUT ) );
@@ -1151,21 +1159,20 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
if( TAG_SELECT == eTag )
{
aTmp = xPropSet->getPropertyValue( "StringItemList" );
- if( aTmp.getValueType() == cppu::UnoType<uno::Sequence<OUString>>::get() )
+ if( auto aList = o3tl::tryAccess<uno::Sequence<OUString>>(aTmp) )
{
rHTMLWrt.IncIndentLevel(); // der Inhalt von Select darf
// eingerueckt werden
- uno::Sequence<OUString> aList( *static_cast<uno::Sequence<OUString> const *>(aTmp.getValue()) );
- sal_Int32 nCnt = aList.getLength();
- const OUString *pStrings = aList.getConstArray();
+ sal_Int32 nCnt = aList->getLength();
+ const OUString *pStrings = aList->getConstArray();
const OUString *pValues = nullptr;
sal_Int32 nValCnt = 0;
- aTmp = xPropSet->getPropertyValue( "ListSource" );
+ auto aTmp2 = xPropSet->getPropertyValue( "ListSource" );
uno::Sequence<OUString> aValList;
- if( aTmp.getValueType() == cppu::UnoType<uno::Sequence<OUString>>::get() )
+ if( auto s = o3tl::tryAccess<uno::Sequence<OUString>>(aTmp2) )
{
- aValList = *static_cast<uno::Sequence<OUString> const *>(aTmp.getValue());
+ aValList = *s;
nValCnt = aValList.getLength();
pValues = aValList.getConstArray();
}
@@ -1175,9 +1182,9 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
sal_Int32 nSel = 0;
sal_Int32 nSelCnt = 0;
uno::Sequence<sal_Int16> aSelList;
- if( aSelTmp.getValueType() ==cppu::UnoType<uno::Sequence<sal_Int16>>::get())
+ if( auto s = o3tl::tryAccess<uno::Sequence<sal_Int16>>(aSelTmp) )
{
- aSelList = *static_cast<uno::Sequence<sal_Int16> const *>(aSelTmp.getValue());
+ aSelList = *s;
nSelCnt = aSelList.getLength();
pSels = aSelList.getConstArray();
}
@@ -1231,10 +1238,12 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
// werden!
OUString sVal;
aTmp = xPropSet->getPropertyValue( "DefaultText" );
- if( aTmp.getValueType() == ::cppu::UnoType<OUString>::get()&&
- !static_cast<const OUString*>(aTmp.getValue())->isEmpty() )
+ if( auto s = o3tl::tryAccess<OUString>(aTmp) )
{
- sVal = *static_cast<OUString const *>(aTmp.getValue());
+ if( !s->isEmpty() )
+ {
+ sVal = *s;
+ }
}
if( !sVal.isEmpty() )
{
@@ -1254,12 +1263,13 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
else if( TYPE_CHECKBOX == eType || TYPE_RADIO == eType )
{
aTmp = xPropSet->getPropertyValue("Label");
- if( aTmp.getValueType() == ::cppu::UnoType<OUString>::get() &&
- !static_cast<const OUString*>(aTmp.getValue())->isEmpty() )
+ if( auto s = o3tl::tryAccess<OUString>(aTmp) )
{
- sValue = *static_cast<OUString const *>(aTmp.getValue());
- HTMLOutFuncs::Out_String( rWrt.Strm(), sValue,
- rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ).WriteChar( ' ' );
+ if( !s->isEmpty() )
+ {
+ HTMLOutFuncs::Out_String( rWrt.Strm(), *s,
+ rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ).WriteChar( ' ' );
+ }
}
}
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 8e0a8f73a2e5..0c1f3c7dae60 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -21,6 +21,7 @@
#include <hintids.hxx>
+#include <o3tl/any.hxx>
#include <vcl/cvtgrf.hxx>
#include <vcl/virdev.hxx>
#include <com/sun/star/drawing/XShape.hpp>
@@ -404,7 +405,7 @@ void WW8Export::DoComboBox(uno::Reference<beans::XPropertySet> xPropSet)
if (nNoStrings)
{
uno::Any aTmp = xPropSet->getPropertyValue("DefaultText");
- const OUString *pStr = static_cast<const OUString *>(aTmp.getValue());
+ auto pStr = o3tl::tryAccess<OUString>(aTmp);
if (pStr)
sSelected = *pStr;
}
@@ -412,7 +413,7 @@ void WW8Export::DoComboBox(uno::Reference<beans::XPropertySet> xPropSet)
OUString sName;
{
uno::Any aTmp = xPropSet->getPropertyValue("Name");
- const OUString *pStr = static_cast<const OUString *>(aTmp.getValue());
+ auto pStr = o3tl::tryAccess<OUString>(aTmp);
if (pStr)
sName = *pStr;
}
@@ -423,7 +424,7 @@ void WW8Export::DoComboBox(uno::Reference<beans::XPropertySet> xPropSet)
try
{
uno::Any aTmp = xPropSet->getPropertyValue("HelpText");
- const OUString *pStr = static_cast<const OUString *>(aTmp.getValue());
+ auto pStr = o3tl::tryAccess<OUString>(aTmp);
if (pStr)
sHelp = *pStr;
}
@@ -434,7 +435,7 @@ void WW8Export::DoComboBox(uno::Reference<beans::XPropertySet> xPropSet)
OUString sToolTip;
{
uno::Any aTmp = xPropSet->getPropertyValue("Name");
- const OUString *pStr = static_cast<const OUString *>(aTmp.getValue());
+ auto pStr = o3tl::tryAccess<OUString>(aTmp);
if (pStr)
sToolTip = *pStr;
}
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index 0952c460795d..c86cd842f3c4 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -27,6 +27,7 @@
#include <tools/datetime.hxx>
#include "poolfmt.hxx"
#include "unoredline.hxx"
+#include <o3tl/any.hxx>
#include <xmloff/xmltoken.hxx>
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
@@ -265,12 +266,12 @@ XMLRedlineImportHelper::XMLRedlineImportHelper(
}
// get redline mode
- bShowChanges = *static_cast<sal_Bool const *>(
+ bShowChanges = *o3tl::doAccess<bool>(
( bHandleShowChanges ? xModelPropertySet : xImportInfoPropertySet )
- ->getPropertyValue( g_sShowChanges ).getValue());
- bRecordChanges = *static_cast<sal_Bool const *>(
+ ->getPropertyValue( g_sShowChanges ));
+ bRecordChanges = *o3tl::doAccess<bool>(
( bHandleRecordChanges ? xModelPropertySet : xImportInfoPropertySet )
- ->getPropertyValue( g_sRecordChanges ).getValue());
+ ->getPropertyValue( g_sRecordChanges ));
{
Any aAny = (bHandleProtectionKey ? xModelPropertySet
: xImportInfoPropertySet )
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index e82ea4d9ef31..a6064e2dac74 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/packages/zip/ZipIOException.hpp>
#include <com/sun/star/packages/WrongPasswordException.hpp>
#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
+#include <o3tl/any.hxx>
#include <sfx2/docfile.hxx>
#include <svtools/sfxecode.hxx>
#include <svl/stritem.hxx>
@@ -343,8 +344,8 @@ sal_Int32 ReadThroughComponent(
Any aAny = xProps->getPropertyValue("Encrypted");
- bool bEncrypted = aAny.getValueType() == cppu::UnoType<bool>::get() &&
- *static_cast<sal_Bool const *>(aAny.getValue());
+ auto b = o3tl::tryAccess<bool>(aAny);
+ bool bEncrypted = b && *b;
uno::Reference <io::XInputStream> xInputStream = xStream->getInputStream();
@@ -910,10 +911,10 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, c
// restore redline mode from import info property set
sal_Int16 nRedlineMode = nsRedlineMode_t::REDLINE_SHOW_INSERT;
aAny = xInfoSet->getPropertyValue( sShowChanges );
- if ( *static_cast<sal_Bool const *>(aAny.getValue()) )
+ if ( *o3tl::doAccess<bool>(aAny) )
nRedlineMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE;
aAny = xInfoSet->getPropertyValue( sRecordChanges );
- if ( *static_cast<sal_Bool const *>(aAny.getValue()) || (aKey.getLength() > 0) )
+ if ( *o3tl::doAccess<bool>(aAny) || (aKey.getLength() > 0) )
nRedlineMode |= nsRedlineMode_t::REDLINE_ON;
else
nRedlineMode |= nsRedlineMode_t::REDLINE_NONE;
diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx
index 2fbdd81aabdc..d62880228987 100644
--- a/sw/source/filter/xml/wrtxml.cxx
+++ b/sw/source/filter/xml/wrtxml.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/frame/XModule.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/genericpropertyset.hxx>
+#include <o3tl/any.hxx>
#include <unotools/streamwrap.hxx>
#include <svx/xmlgrhlp.hxx>
#include <svx/xmleohlp.hxx>
@@ -402,7 +403,7 @@ sal_uInt32 SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >&
nRedlineMode = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
nRedlineMode &= ~nsRedlineMode_t::REDLINE_SHOW_MASK;
nRedlineMode |= nsRedlineMode_t::REDLINE_SHOW_INSERT;
- if ( *static_cast<sal_Bool const *>(aAny.getValue()) )
+ if ( *o3tl::doAccess<bool>(aAny) )
nRedlineMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE;
pDoc->getIDocumentRedlineAccess().SetRedlineMode((RedlineMode_t)( nRedlineMode ));
diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index 58656627fa26..d8e589c1e5db 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -26,6 +26,7 @@
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/xforms/XFormsSupplier.hpp>
+#include <o3tl/any.hxx>
#include <sax/tools/converter.hxx>
#include <svx/svdmodel.hxx>
#include <svx/svdpage.hxx>
@@ -122,9 +123,11 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
sAutoTextMode ) )
{
Any aAny = rInfoSet->getPropertyValue(sAutoTextMode);
- if( aAny.getValueType() == cppu::UnoType<bool>::get() &&
- *static_cast<const sal_Bool*>(aAny.getValue()) )
- setBlockMode();
+ if( auto b = o3tl::tryAccess<bool>(aAny) )
+ {
+ if( *b )
+ setBlockMode();
+ }
}
}
}
@@ -380,8 +383,8 @@ void SwXMLExport::GetViewSettings(Sequence<PropertyValue>& aProps)
const OUString sShowChanges( "ShowChanges" );
if( xInfoSet->getPropertySetInfo()->hasPropertyByName( sShowChanges ) )
{
- bShowRedlineChanges = *static_cast<sal_Bool const *>(xInfoSet->
- getPropertyValue( sShowChanges ).getValue());
+ bShowRedlineChanges = *o3tl::doAccess<bool>(xInfoSet->
+ getPropertyValue( sShowChanges ));
}
}
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 8ee58ceb6bfc..5c8a71cfe78f 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/text/XTextDocument.hpp>
#include <com/sun/star/text/XTextRange.hpp>
+#include <o3tl/any.hxx>
#include <xmloff/xmlnmspe.hxx>
#include <xmloff/xmltkmap.hxx>
#include <xmloff/xmlictxt.hxx>
@@ -542,9 +543,11 @@ void SwXMLImport::startDocument()
if( xPropertySetInfo->hasPropertyByName(sStyleInsertModeOverwrite) )
{
aAny = xImportInfo->getPropertyValue(sStyleInsertModeOverwrite);
- if( aAny.getValueType() == cppu::UnoType<bool>::get() &&
- *static_cast<const sal_Bool*>(aAny.getValue()) )
- bOverwrite = true;
+ if( auto b = o3tl::tryAccess<bool>(aAny) )
+ {
+ if( *b )
+ bOverwrite = true;
+ }
}
setStyleInsertMode( nFamilyMask, bOverwrite );
@@ -566,9 +569,11 @@ void SwXMLImport::startDocument()
if( xPropertySetInfo->hasPropertyByName(sAutoTextMode) )
{
aAny = xImportInfo->getPropertyValue(sAutoTextMode);
- if( aAny.getValueType() == cppu::UnoType<bool>::get() &&
- *static_cast<const sal_Bool*>(aAny.getValue()) )
+ if( auto b = o3tl::tryAccess<bool>(aAny) )
+ {
+ if( *b )
setBlockMode();
+ }
}
// organizer mode
@@ -576,9 +581,11 @@ void SwXMLImport::startDocument()
if( xPropertySetInfo->hasPropertyByName(sOrganizerMode) )
{
aAny = xImportInfo->getPropertyValue(sOrganizerMode);
- if( aAny.getValueType() == cppu::UnoType<bool>::get() &&
- *static_cast<const sal_Bool*>(aAny.getValue()) )
+ if( auto b = o3tl::tryAccess<bool>(aAny) )
+ {
+ if( *b )
setOrganizerMode();
+ }
}
}
@@ -1046,13 +1053,13 @@ void SwXMLImport::SetViewSettings(const Sequence < PropertyValue > & aViewProps)
}
else if ( pValue->Name == "ShowRedlineChanges" )
{
- bShowRedlineChanges = *static_cast<sal_Bool const *>(pValue->Value.getValue());
+ bShowRedlineChanges = *o3tl::doAccess<bool>(pValue->Value);
bChangeShowRedline = true;
}
// Headers and footers are not displayed in BrowseView anymore
else if ( pValue->Name == "InBrowseMode" )
{
- bBrowseMode = *static_cast<sal_Bool const *>(pValue->Value.getValue());
+ bBrowseMode = *o3tl::doAccess<bool>(pValue->Value);
bChangeBrowseMode = true;
}
pValue++;
diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx
index d1bb91069812..f4b89d1985eb 100644
--- a/sw/source/filter/xml/xmltble.cxx
+++ b/sw/source/filter/xml/xmltble.cxx
@@ -49,6 +49,7 @@
#include "unotbl.hxx"
#include "xmltexte.hxx"
#include "xmlexp.hxx"
+#include <o3tl/any.hxx>
#include <o3tl/sorted_vector.hxx>
#include <textboxhelper.hxx>
@@ -843,7 +844,7 @@ void SwXMLExport::ExportTableBox( const SwTableBox& rBox,
// cell protection
aAny = xCellPropertySet->getPropertyValue(g_sIsProtected);
- if (*static_cast<sal_Bool const *>(aAny.getValue()))
+ if (*o3tl::doAccess<bool>(aAny))
{
AddAttribute( XML_NAMESPACE_TABLE, XML_PROTECTED,
XML_TRUE );
diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx
index 710f010b1cdc..a62c92cf45bf 100644
--- a/sw/source/filter/xml/xmltexti.cxx
+++ b/sw/source/filter/xml/xmltexti.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/embed/XVisualObject.hpp>
#include <com/sun/star/embed/Aspects.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <o3tl/any.hxx>
#include <rtl/ustrbuf.hxx>
#include <comphelper/classids.hxx>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -804,13 +805,13 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertFloatingFra
{
case CTF_FRAME_DISPLAY_SCROLLBAR:
{
- bool bYes = *static_cast<sal_Bool const *>(rProp.maValue.getValue());
+ bool bYes = *o3tl::doAccess<bool>(rProp.maValue);
eScrollMode = bYes ? ScrollingYes : ScrollingNo;
}
break;
case CTF_FRAME_DISPLAY_BORDER:
{
- bHasBorder = *static_cast<sal_Bool const *>(rProp.maValue.getValue());
+ bHasBorder = *o3tl::doAccess<bool>(rProp.maValue);
bIsBorderSet = true;
}
break;
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index f97036d88dfd..049f2f90cc7e 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -89,6 +89,7 @@
#include <unomid.h>
#include <IDocumentMarkAccess.hxx>
+#include <o3tl/any.hxx>
#include <o3tl/make_unique.hxx>
#include <memory>
@@ -1664,13 +1665,13 @@ void SwInsertDBColAutoPilot::Load()
pDataSourceProps[5] >>= pNewData->sTmplNm;
pDataSourceProps[6] >>= pNewData->sTAutoFormatNm;
if(pDataSourceProps[7].hasValue())
- pNewData->bIsTable = *static_cast<sal_Bool const *>(pDataSourceProps[7].getValue());
+ pNewData->bIsTable = *o3tl::doAccess<bool>(pDataSourceProps[7]);
if(pDataSourceProps[8].hasValue())
- pNewData->bIsField = *static_cast<sal_Bool const *>(pDataSourceProps[8].getValue());
+ pNewData->bIsField = *o3tl::doAccess<bool>(pDataSourceProps[8]);
if(pDataSourceProps[9].hasValue())
- pNewData->bIsHeadlineOn = *static_cast<sal_Bool const *>(pDataSourceProps[9].getValue());
+ pNewData->bIsHeadlineOn = *o3tl::doAccess<bool>(pDataSourceProps[9]);
if(pDataSourceProps[10].hasValue())
- pNewData->bIsEmptyHeadln = *static_cast<sal_Bool const *>(pDataSourceProps[10].getValue());
+ pNewData->bIsEmptyHeadln = *o3tl::doAccess<bool>(pDataSourceProps[10]);
const OUString sSubNodeName(pNames[nNode] + "/ColumnSet/");
Sequence <OUString> aSubNames = GetNodeNames(sSubNodeName);
@@ -1700,9 +1701,9 @@ void SwInsertDBColAutoPilot::Load()
pSubProps[1] >>= nIndex;
SwInsDBColumn* pInsDBColumn = new SwInsDBColumn(sColumn);
if(pSubProps[2].hasValue())
- pInsDBColumn->bHasFormat = *static_cast<sal_Bool const *>(pSubProps[2].getValue());
+ pInsDBColumn->bHasFormat = *o3tl::doAccess<bool>(pSubProps[2]);
if(pSubProps[3].hasValue())
- pInsDBColumn->bIsDBFormat = *static_cast<sal_Bool const *>(pSubProps[3].getValue());
+ pInsDBColumn->bIsDBFormat = *o3tl::doAccess<bool>(pSubProps[3]);
pSubProps[4] >>= pInsDBColumn->sUsrNumFormat;
OUString sNumberFormatLocale;
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index e477c6a60636..63cc50410805 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -19,6 +19,7 @@
#include <hintids.hxx>
+#include <o3tl/any.hxx>
#include <vcl/menu.hxx>
#include <vcl/layout.hxx>
#include <vcl/help.hxx>
@@ -637,7 +638,7 @@ IMPL_LINK_NOARG_TYPED(SwGlossaryDlg, BibHdl, Button*, void)
Any aAny = aTestContent.getPropertyValue( "IsReadOnly" );
if(aAny.hasValue())
{
- bIsWritable = !*static_cast<sal_Bool const *>(aAny.getValue());
+ bIsWritable = !*o3tl::doAccess<bool>(aAny);
}
}
catch (const Exception&)
diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx
index 418df8767b04..b31dd36904aa 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -19,6 +19,7 @@
#include <hintids.hxx>
#include <comphelper/classids.hxx>
+#include <o3tl/any.hxx>
#include <tools/stream.hxx>
#include <vcl/svapp.hxx>
#include <svl/mailenum.hxx>
@@ -804,7 +805,7 @@ static void lcl_ReadOpt(InsCaptionOpt& rOpt, const Any* pValues, sal_Int32 nProp
switch(nOffset)
{
case 0:
- rOpt.UseCaption() = *static_cast<sal_Bool const *>(pValues[nProp].getValue());
+ rOpt.UseCaption() = *o3tl::doAccess<bool>(pValues[nProp]);
break;//Enable
case 1:
{
@@ -899,7 +900,7 @@ void SwInsertConfig::Load()
{
if (pValues[nProp].hasValue())
{
- bool bBool = nProp < INS_PROP_CAP_OBJECT_TABLE_ENABLE && *static_cast<sal_Bool const *>(pValues[nProp].getValue());
+ bool bBool = nProp < INS_PROP_CAP_OBJECT_TABLE_ENABLE && *o3tl::doAccess<bool>(pValues[nProp]);
switch (nProp)
{
case INS_PROP_TABLE_HEADER:
@@ -1172,9 +1173,9 @@ void SwTableConfig::Load()
case 2 : pValues[nProp] >>= nTemp; nTableHInsert = (sal_uInt16)convertMm100ToTwip(nTemp); break; //"Insert/Row",
case 3 : pValues[nProp] >>= nTemp; nTableVInsert = (sal_uInt16)convertMm100ToTwip(nTemp); break; //"Insert/Column",
case 4 : pValues[nProp] >>= nTemp; eTableChgMode = (TableChgMode)nTemp; break; //"Change/Effect",
- case 5 : bInsTableFormatNum = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; //"Input/NumberRecognition",
- case 6 : bInsTableChangeNumFormat = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; //"Input/NumberFormatRecognition",
- case 7 : bInsTableAlignNum = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; //"Input/Alignment"
+ case 5 : bInsTableFormatNum = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Input/NumberRecognition",
+ case 6 : bInsTableChangeNumFormat = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Input/NumberFormatRecognition",
+ case 7 : bInsTableAlignNum = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Input/Alignment"
}
}
}
@@ -1276,16 +1277,16 @@ void SwMiscConfig::Load()
case 0 : pValues[nProp] >>= sTmp;
sWordDelimiter = SwModuleOptions::ConvertWordDelimiter(sTmp, true);
break;
- case 1 : bDefaultFontsInCurrDocOnly = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 2 : bShowIndexPreview = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 3 : bGrfToGalleryAsLnk = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 4 : bNumAlignSize = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 5 : bSinglePrintJob = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 6 : nMailingFormats = static_cast<MailTextFormats>(*static_cast<sal_uInt8 const *>(pValues[nProp].getValue())); break;
+ case 1 : bDefaultFontsInCurrDocOnly = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 2 : bShowIndexPreview = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 3 : bGrfToGalleryAsLnk = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 4 : bNumAlignSize = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 5 : bSinglePrintJob = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 6 : nMailingFormats = static_cast<MailTextFormats>(*o3tl::doAccess<sal_Int8>(pValues[nProp])); break;
case 7 : pValues[nProp] >>= sTmp; sNameFromColumn = sTmp; break;
case 8 : pValues[nProp] >>= sTmp; sMailingPath = sTmp; break;
case 9 : pValues[nProp] >>= sTmp; sMailName = sTmp; break;
- case 10: bIsNameFromColumn = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
+ case 10: bIsNameFromColumn = *o3tl::doAccess<bool>(pValues[nProp]); break;
case 11: pValues[nProp] >>= bAskForMailMergeInPrint; break;
}
}
@@ -1362,10 +1363,10 @@ void SwCompareConfig::Load()
switch(nProp)
{
case 0 : eCmpMode = (SvxCompareMode) nVal; break;
- case 1 : bUseRsid = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 2 : bIgnorePieces = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
+ case 1 : bUseRsid = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 2 : bIgnorePieces = *o3tl::doAccess<bool>(pValues[nProp]); break;
case 3 : nPieceLen = nVal; break;
- case 4 : m_bStoreRsid = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
+ case 4 : m_bStoreRsid = *o3tl::doAccess<bool>(pValues[nProp]); break;
}
}
}
diff --git a/sw/source/uibase/config/prtopt.cxx b/sw/source/uibase/config/prtopt.cxx
index c86bb31c4d52..7a64b884e140 100644
--- a/sw/source/uibase/config/prtopt.cxx
+++ b/sw/source/uibase/config/prtopt.cxx
@@ -19,6 +19,7 @@
#include <unotools/configmgr.hxx>
#include <prtopt.hxx>
+#include <o3tl/any.hxx>
#include <osl/diagnose.h>
#include <com/sun/star/uno/Sequence.hxx>
@@ -84,11 +85,11 @@ SwPrintOptions::SwPrintOptions(bool bWeb) :
{
switch(nProp)
{
- case 0: m_bPrintGraphic = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 1: m_bPrintTable = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 2: m_bPrintControl = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 3: m_bPrintPageBackground= *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 4: m_bPrintBlackFont = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
+ case 0: m_bPrintGraphic = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 1: m_bPrintTable = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 2: m_bPrintControl = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 3: m_bPrintPageBackground= *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 4: m_bPrintBlackFont = *o3tl::doAccess<bool>(pValues[nProp]); break;
case 5:
{
sal_Int32 nTmp = 0;
@@ -96,18 +97,18 @@ SwPrintOptions::SwPrintOptions(bool bWeb) :
m_nPrintPostIts = static_cast<SwPostItMode>(nTmp);
}
break;
- case 6: m_bPrintReverse = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 7: m_bPrintProspect = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 8: m_bPrintProspectRTL = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 9: m_bPrintSingleJobs = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
+ case 6: m_bPrintReverse = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 7: m_bPrintProspect = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 8: m_bPrintProspectRTL = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 9: m_bPrintSingleJobs = *o3tl::doAccess<bool>(pValues[nProp]); break;
case 10: pValues[nProp] >>= m_sFaxName; break;
- case 11: m_bPaperFromSetup = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 12: m_bPrintDraw = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 13: m_bPrintLeftPages = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 14: m_bPrintRightPages = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 15: m_bPrintEmptyPages = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 16: m_bPrintTextPlaceholder = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 17: m_bPrintHiddenText = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
+ case 11: m_bPaperFromSetup = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 12: m_bPrintDraw = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 13: m_bPrintLeftPages = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 14: m_bPrintRightPages = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 15: m_bPrintEmptyPages = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 16: m_bPrintTextPlaceholder = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 17: m_bPrintHiddenText = *o3tl::doAccess<bool>(pValues[nProp]); break;
}
}
}
diff --git a/sw/source/uibase/config/usrpref.cxx b/sw/source/uibase/config/usrpref.cxx
index b124c797b2ae..adccbb3a5abd 100644
--- a/sw/source/uibase/config/usrpref.cxx
+++ b/sw/source/uibase/config/usrpref.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/stream.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/syslocale.hxx>
@@ -183,7 +186,7 @@ void SwContentViewConfig::Load()
{
if(pValues[nProp].hasValue())
{
- bool bSet = nProp != 16 && *static_cast<sal_Bool const *>(pValues[nProp].getValue());
+ bool bSet = nProp != 16 && *o3tl::doAccess<bool>(pValues[nProp]);
switch(nProp)
{
case 0: rParent.SetGraphic(bSet); break;// "Display/GraphicObject",
@@ -436,7 +439,7 @@ void SwGridConfig::Load()
{
if(pValues[nProp].hasValue())
{
- bool bSet = nProp < 3 && *static_cast<sal_Bool const *>(pValues[nProp].getValue());
+ bool bSet = nProp < 3 && *o3tl::doAccess<bool>(pValues[nProp]);
sal_Int32 nSet = 0;
if(nProp >= 3)
pValues[nProp] >>= nSet;
@@ -522,7 +525,7 @@ void SwCursorConfig::Load()
bool bSet = false;
sal_Int32 nSet = 0;
if(nProp != 1 )
- bSet = *static_cast<sal_Bool const *>(pValues[nProp].getValue());
+ bSet = *o3tl::doAccess<bool>(pValues[nProp]);
else
pValues[nProp] >>= nSet;
switch(nProp)
diff --git a/sw/source/uibase/envelp/envimg.cxx b/sw/source/uibase/envelp/envimg.cxx
index b7591850e20f..9a443fc65297 100644
--- a/sw/source/uibase/envelp/envimg.cxx
+++ b/sw/source/uibase/envelp/envimg.cxx
@@ -19,6 +19,7 @@
#include <hintids.hxx>
#include <comphelper/string.hxx>
+#include <o3tl/any.hxx>
#include <tools/stream.hxx>
#include <tools/resid.hxx>
#include <sfx2/app.hxx>
@@ -188,7 +189,7 @@ SwEnvCfgItem::SwEnvCfgItem() :
{
case 0: pValues[nProp] >>= aEnvItem.aAddrText; break;// "Inscription/Addressee",
case 1: pValues[nProp] >>= aEnvItem.aSendText; break;// "Inscription/Sender",
- case 2: aEnvItem.bSend = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;// "Inscription/UseSender",
+ case 2: aEnvItem.bSend = *o3tl::doAccess<bool>(pValues[nProp]); break;// "Inscription/UseSender",
case 3:
pValues[nProp] >>= aEnvItem.lAddrFromLeft;// "Format/AddresseeFromLeft",
aEnvItem.lAddrFromLeft = convertMm100ToTwip(aEnvItem.lAddrFromLeft);
@@ -218,7 +219,7 @@ SwEnvCfgItem::SwEnvCfgItem() :
sal_Int32 nTemp = 0;
pValues[nProp] >>= nTemp; aEnvItem.eAlign = (SwEnvAlign)nTemp; break;// "Print/Alignment",
}
- case 10: aEnvItem.bPrintFromAbove = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;// "Print/FromAbove",
+ case 10: aEnvItem.bPrintFromAbove = *o3tl::doAccess<bool>(pValues[nProp]); break;// "Print/FromAbove",
case 11:
pValues[nProp] >>= aEnvItem.lShiftRight;
aEnvItem.lShiftRight = convertMm100ToTwip(aEnvItem.lShiftRight);// "Print/Right",
diff --git a/sw/source/uibase/envelp/labimg.cxx b/sw/source/uibase/envelp/labimg.cxx
index e1630a602db4..ceeb44caf3d8 100644
--- a/sw/source/uibase/envelp/labimg.cxx
+++ b/sw/source/uibase/envelp/labimg.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/stream.hxx>
#include <tools/resid.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -286,7 +289,7 @@ SwLabCfgItem::SwLabCfgItem(bool bLabel) :
bNoConfigValues = false;
switch(nProperty)
{
- case 0: aItem.m_bCont = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;// "Medium/Continuous",
+ case 0: aItem.m_bCont = *o3tl::doAccess<bool>(pValues[nProp]); break;// "Medium/Continuous",
case 1: pValues[nProp] >>= aItem.m_aMake; break;// "Medium/Brand",
case 2: pValues[nProp] >>= aItem.m_aType; break;// "Medium/Type",
case 3: pValues[nProp] >>= aItem.m_nCols; break;// "Format/Column",
@@ -323,11 +326,11 @@ SwLabCfgItem::SwLabCfgItem(bool bLabel) :
pValues[nProp] >>= aItem.m_lPHeight;
aItem.m_lPHeight = convertMm100ToTwip(aItem.m_lPHeight);
break;// "Format/PageHeight",
- case 13: aItem.m_bSynchron = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;// "Option/Synchronize",
- case 14: aItem.m_bPage = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;// "Option/Page",
+ case 13: aItem.m_bSynchron = *o3tl::doAccess<bool>(pValues[nProp]); break;// "Option/Synchronize",
+ case 14: aItem.m_bPage = *o3tl::doAccess<bool>(pValues[nProp]); break;// "Option/Page",
case 15: pValues[nProp] >>= aItem.m_nCol; break;// "Option/Column",
case 16: pValues[nProp] >>= aItem.m_nRow; break;// "Option/Row"
- case 17: aItem.m_bAddr = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;// "Inscription/UseAddress",
+ case 17: aItem.m_bAddr = *o3tl::doAccess<bool>(pValues[nProp]); break;// "Inscription/UseAddress",
case 18: pValues[nProp] >>= aItem.m_aWriting; break;// "Inscription/Address",
case 19: pValues[nProp] >>= aItem.m_sDBName; break;// "Inscription/Database"
case 20: pValues[nProp] >>= aItem.m_aPrivFirstName; break;// "PrivateAddress/FirstName",
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 354f007246e2..411431039ced 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <hintids.hxx>
#include <comphelper/string.hxx>
+#include <o3tl/any.hxx>
#include <officecfg/Office/Common.hxx>
#include <vcl/graph.hxx>
#include <vcl/inputctx.hxx>
@@ -1317,7 +1318,7 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue >
}
else if ( pValue->Name == "ViewLayoutBookMode" )
{
- bViewLayoutBookMode = * static_cast<sal_Bool const *>(pValue->Value.getValue());
+ bViewLayoutBookMode = *o3tl::doAccess<bool>(pValue->Value);
bGotViewLayoutBookMode = true;
}
else if ( pValue->Name == "IsSelectedFrame" )
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 996733be191c..f440f31669d9 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/util/SearchAlgorithms2.hpp>
#include <com/sun/star/util/SearchFlags.hpp>
#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <o3tl/any.hxx>
#include <vcl/graphicfilter.hxx>
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
@@ -388,7 +389,7 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq )
{
Any aVal = xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0);
OSL_ENSURE(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found");
- bAsLink = !aVal.hasValue() || *static_cast<sal_Bool const *>(aVal.getValue());
+ bAsLink = !aVal.hasValue() || *o3tl::doAccess<bool>(aVal);
Any aTemplateValue = xCtrlAcc->getValue(
ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
ListboxControlActions::GET_SELECTED_ITEM );
@@ -423,7 +424,7 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq )
{
Any aVal = xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0);
OSL_ENSURE(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found");
- bAsLink = !aVal.hasValue() || *static_cast<sal_Bool const *>(aVal.getValue());
+ bAsLink = !aVal.hasValue() || *o3tl::doAccess<bool>(aVal);
Any aTemplateValue = xCtrlAcc->getValue(
ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
ListboxControlActions::GET_SELECTED_ITEM );
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index db081c43bae7..d672a889ff3f 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.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/mutex.hxx>
#include <sfx2/sfxbasecontroller.hxx>
#include <SwXDocumentSettings.hxx>
@@ -343,7 +346,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
break;
case HANDLE_FIELD_AUTO_UPDATE:
{
- bool bUpdateField = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bUpdateField = *o3tl::doAccess<bool>(rValue);
SwFieldUpdateFlags nFlag = mpDoc->getIDocumentSettingAccess().getFieldUpdateFlags(true);
mpDoc->getIDocumentSettingAccess().setFieldUpdateFlags( bUpdateField ?
nFlag == AUTOUPD_FIELD_AND_CHARTS ?
@@ -354,7 +357,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
break;
case HANDLE_CHART_AUTO_UPDATE:
{
- bool bUpdateChart = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bUpdateChart = *o3tl::doAccess<bool>(rValue);
SwFieldUpdateFlags nFlag = mpDoc->getIDocumentSettingAccess().getFieldUpdateFlags(true);
mpDoc->getIDocumentSettingAccess().setFieldUpdateFlags( (nFlag == AUTOUPD_FIELD_ONLY || nFlag == AUTOUPD_FIELD_AND_CHARTS ) ?
bUpdateChart ?
@@ -379,7 +382,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
break;
case HANDLE_ALIGN_TAB_STOP_POSITION:
{
- bool bAlignTab = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bAlignTab = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TAB_COMPAT, bAlignTab);
}
break;
@@ -445,7 +448,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
break;
case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
{
- bool bIsKern = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bIsKern = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::KERN_ASIAN_PUNCTUATION, bIsKern);
SwEditShell* pEditSh = mpDoc->GetEditShell();
if(pEditSh)
@@ -470,12 +473,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
break;
case HANDLE_APPLY_USER_DATA:
{
- mpDocSh->SetUseUserData( *static_cast<sal_Bool const *>(rValue.getValue()) );
+ mpDocSh->SetUseUserData( *o3tl::doAccess<bool>(rValue) );
}
break;
case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
{
- bool bSaveGlobal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bSaveGlobal = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::GLOBAL_DOCUMENT_SAVE_LINKS, bSaveGlobal );
}
break;
@@ -517,12 +520,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
break;
case HANDLE_SAVE_VERSION_ON_CLOSE:
{
- mpDocSh->SetSaveVersionOnClose( *static_cast<sal_Bool const *>(rValue.getValue()) );
+ mpDocSh->SetSaveVersionOnClose( *o3tl::doAccess<bool>(rValue) );
}
break;
case HANDLE_UPDATE_FROM_TEMPLATE:
{
- mpDocSh->SetQueryLoadTemplate( *static_cast<sal_Bool const *>(rValue.getValue()) );
+ mpDocSh->SetQueryLoadTemplate( *o3tl::doAccess<bool>(rValue) );
}
break;
case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
@@ -552,31 +555,31 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
break;
case HANDLE_IS_ADD_FLY_OFFSET:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_FLY_OFFSETS, bTmp);
}
break;
case HANDLE_IS_ADD_VERTICAL_FLY_OFFSET:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS, bTmp);
}
break;
case HANDLE_IS_ADD_EXTERNAL_LEADING:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_EXT_LEADING, bTmp);
}
break;
case HANDLE_OLD_NUMBERING:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::OLD_NUMBERING, bTmp);
}
break;
case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::OUTLINE_LEVEL_YIELDS_OUTLINE_RULE, bTmp);
}
break;
@@ -590,25 +593,25 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
break;
case HANDLE_USE_FORMER_LINE_SPACING:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::OLD_LINE_SPACING, bTmp);
}
break;
case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS, bTmp);
}
break;
case HANDLE_USE_FORMER_OBJECT_POSITIONING:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::USE_FORMER_OBJECT_POS, bTmp);
}
break;
case HANDLE_USE_FORMER_TEXT_WRAPPING:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::USE_FORMER_TEXT_WRAPPING, bTmp);
}
break;
@@ -629,60 +632,60 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
break;
case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION, bTmp );
}
break;
case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, bTmp);
}
break;
case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, bTmp);
}
break;
case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, bTmp);
}
break;
case HANDLE_TABLE_ROW_KEEP:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TABLE_ROW_KEEP, bTmp);
}
break;
case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, bTmp);
}
break;
case HANDLE_LOAD_READONLY:
{
- mpDocSh->SetLoadReadonly( *static_cast<sal_Bool const *>(rValue.getValue()) );
+ mpDocSh->SetLoadReadonly( *o3tl::doAccess<bool>(rValue) );
}
break;
case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, bTmp);
}
break;
case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME, bTmp);
}
break;
case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::UNIX_FORCE_ZERO_EXT_LEADING, bTmp);
}
break;
@@ -691,7 +694,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
break;
case HANDLE_TABS_RELATIVE_TO_INDENT:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TABS_RELATIVE_TO_INDENT, bTmp);
}
break;
@@ -711,13 +714,13 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
break;
case HANDLE_PROTECT_FORM:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::PROTECT_FORM, bTmp);
}
break;
case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, bTmp);
}
break;
@@ -738,91 +741,91 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
break;
case HANDLE_MATH_BASELINE_ALIGNMENT:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set( DocumentSettingId::MATH_BASELINE_ALIGNMENT, bTmp );
}
break;
case HANDLE_INVERT_BORDER_SPACING:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::INVERT_BORDER_SPACING, bTmp);
}
break;
case HANDLE_COLLAPSE_EMPTY_CELL_PARA:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::COLLAPSE_EMPTY_CELL_PARA, bTmp);
}
break;
case HANDLE_SMALL_CAPS_PERCENTAGE_66:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::SMALL_CAPS_PERCENTAGE_66, bTmp);
}
break;
case HANDLE_TAB_OVERFLOW:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TAB_OVERFLOW, bTmp);
}
break;
case HANDLE_UNBREAKABLE_NUMBERINGS:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::UNBREAKABLE_NUMBERINGS, bTmp);
}
break;
case HANDLE_STYLES_NODEFAULT:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::STYLES_NODEFAULT, bTmp);
}
break;
case HANDLE_FLOATTABLE_NOMARGINS:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::FLOATTABLE_NOMARGINS, bTmp);
}
break;
case HANDLE_CLIPPED_PICTURES:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::CLIPPED_PICTURES, bTmp);
}
break;
case HANDLE_BACKGROUND_PARA_OVER_DRAWINGS:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::BACKGROUND_PARA_OVER_DRAWINGS, bTmp);
}
break;
case HANDLE_EMBED_FONTS:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::EMBED_FONTS, bTmp);
}
break;
case HANDLE_EMBED_SYSTEM_FONTS:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::EMBED_SYSTEM_FONTS, bTmp);
}
break;
case HANDLE_TAB_OVER_MARGIN:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::TAB_OVER_MARGIN, bTmp);
}
break;
case HANDLE_SURROUND_TEXT_WRAP_SMALL:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::SURROUND_TEXT_WRAP_SMALL, bTmp);
}
break;
case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
{
- bool bTmp = *static_cast<sal_Bool const *>(rValue.getValue());
+ bool bTmp = *o3tl::doAccess<bool>(rValue);
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, bTmp);
}
break;
diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index d9622958af09..c6486853568b 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -18,6 +18,7 @@
*/
#include <swtypes.hxx>
+#include <o3tl/any.hxx>
#include <osl/diagnose.h>
#include <unomod.hxx>
#include <unomid.h>
@@ -288,73 +289,73 @@ void SwXPrintSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo,
{
case HANDLE_PRINTSET_LEFT_PAGES:
{
- bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bVal = *o3tl::tryAccess<bool>(rValue);
mpPrtOpt->SetPrintLeftPage(bVal);
}
break;
case HANDLE_PRINTSET_RIGHT_PAGES:
{
- bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bVal = *o3tl::tryAccess<bool>(rValue);
mpPrtOpt->SetPrintRightPage(bVal);
}
break;
case HANDLE_PRINTSET_REVERSED:
{
- bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bVal = *o3tl::tryAccess<bool>(rValue);
mpPrtOpt->SetPrintReverse(bVal);
}
break;
case HANDLE_PRINTSET_PROSPECT:
{
- bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bVal = *o3tl::tryAccess<bool>(rValue);
mpPrtOpt->SetPrintProspect(bVal);
}
break;
case HANDLE_PRINTSET_GRAPHICS:
{
- bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bVal = *o3tl::tryAccess<bool>(rValue);
mpPrtOpt->SetPrintGraphic(bVal);
}
break;
case HANDLE_PRINTSET_TABLES:
{
- bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bVal = *o3tl::tryAccess<bool>(rValue);
mpPrtOpt->SetPrintTable(bVal);
}
break;
case HANDLE_PRINTSET_DRAWINGS:
{
- bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bVal = *o3tl::tryAccess<bool>(rValue);
mpPrtOpt->SetPrintDraw(bVal);
}
break;
case HANDLE_PRINTSET_CONTROLS:
{
- bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bVal = *o3tl::tryAccess<bool>(rValue);
mpPrtOpt->SetPrintControl(bVal);
}
break;
case HANDLE_PRINTSET_PAGE_BACKGROUND:
{
- bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bVal = *o3tl::tryAccess<bool>(rValue);
mpPrtOpt->SetPrintPageBackground(bVal);
}
break;
case HANDLE_PRINTSET_BLACK_FONTS:
{
- bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bVal = *o3tl::tryAccess<bool>(rValue);
mpPrtOpt->SetPrintBlackFont(bVal);
}
break;
case HANDLE_PRINTSET_SINGLE_JOBS:
{
- bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bVal = *o3tl::tryAccess<bool>(rValue);
mpPrtOpt->SetPrintSingleJobs(bVal);
}
break;
case HANDLE_PRINTSET_PAPER_FROM_SETUP:
{
- bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bVal = *o3tl::tryAccess<bool>(rValue);
mpPrtOpt->SetPaperFromSetup(bVal);
}
break;
@@ -371,7 +372,7 @@ void SwXPrintSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo,
break;
case HANDLE_PRINTSET_EMPTY_PAGES:
{
- bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bVal = *o3tl::tryAccess<bool>(rValue);
mpPrtOpt->SetPrintEmptyPages(bVal);
}
break;
@@ -386,19 +387,19 @@ void SwXPrintSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo,
break;
case HANDLE_PRINTSET_PROSPECT_RTL:
{
- bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bVal = *o3tl::tryAccess<bool>(rValue);
mpPrtOpt->SetPrintProspect_RTL(bVal);
}
break;
case HANDLE_PRINTSET_PLACEHOLDER:
{
- bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bVal = *o3tl::tryAccess<bool>(rValue);
mpPrtOpt->SetPrintTextPlaceholder(bVal);
}
break;
case HANDLE_PRINTSET_HIDDEN_TEXT:
{
- bVal = *static_cast<sal_Bool const *>(rValue.getValue());
+ bVal = *o3tl::tryAccess<bool>(rValue);
mpPrtOpt->SetPrintHiddenText(bVal);
}
break;
@@ -585,41 +586,40 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c
IllegalArgumentException, WrappedTargetException,
RuntimeException, std::exception)
{
- bool bVal = HANDLE_VIEWSET_ZOOM != rInfo.mnHandle && *static_cast<sal_Bool const *>(rValue.getValue());
// the API flag should not be set to the application's view settings
switch( rInfo.mnHandle )
{
- case HANDLE_VIEWSET_SHOW_RULER : mpViewOption->SetViewAnyRuler(bVal); break;
- case HANDLE_VIEWSET_HRULER : mpViewOption->SetViewHRuler(bVal); break;
- case HANDLE_VIEWSET_VRULER : mpViewOption->SetViewVRuler(bVal);break;
- case HANDLE_VIEWSET_VRULER_RIGHT : mpViewOption->SetVRulerRight(bVal);break;
- case HANDLE_VIEWSET_HSCROLL : mpViewOption->SetViewHScrollBar(bVal);break;
- case HANDLE_VIEWSET_VSCROLL : mpViewOption->SetViewVScrollBar(bVal);break;
- case HANDLE_VIEWSET_GRAPHICS : mpViewOption->SetGraphic(bVal);break;
- case HANDLE_VIEWSET_TABLES : mpViewOption->SetTable(bVal); break;
- case HANDLE_VIEWSET_DRAWINGS : mpViewOption->SetDraw(bVal); break;
- case HANDLE_VIEWSET_FIELD_COMMANDS : mpViewOption->SetFieldName(bVal); break;
- case HANDLE_VIEWSET_ANNOTATIONS : mpViewOption->SetPostIts(bVal); break;
- case HANDLE_VIEWSET_INDEX_MARK_BACKGROUND : SwViewOption::SetAppearanceFlag(ViewOptFlags::FieldShadings, bVal, true); break;
- case HANDLE_VIEWSET_NONPRINTING_CHARACTERS: mpViewOption->SetViewMetaChars( bVal ); break;
- case HANDLE_VIEWSET_FOOTNOTE_BACKGROUND : SwViewOption::SetAppearanceFlag(ViewOptFlags::FieldShadings, bVal, true); break;
- case HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND : SwViewOption::SetAppearanceFlag(ViewOptFlags::FieldShadings, bVal, true); break;
- case HANDLE_VIEWSET_PARA_BREAKS : mpViewOption->SetParagraph(bVal); break;
- case HANDLE_VIEWSET_SOFT_HYPHENS : mpViewOption->SetSoftHyph(bVal); break;
- case HANDLE_VIEWSET_SPACES : mpViewOption->SetBlank(bVal); break;
- case HANDLE_VIEWSET_PROTECTED_SPACES : mpViewOption->SetHardBlank(bVal); break;
- case HANDLE_VIEWSET_TABSTOPS : mpViewOption->SetTab(bVal); break;
- case HANDLE_VIEWSET_BREAKS : mpViewOption->SetLineBreak(bVal); break;
- case HANDLE_VIEWSET_HIDDEN_TEXT : mpViewOption->SetShowHiddenField(bVal); break;
- case HANDLE_VIEWSET_HIDDEN_CHARACTERS : mpViewOption->SetShowHiddenChar(bVal); break;
- case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : mpViewOption->SetShowHiddenPara(bVal); break;
- case HANDLE_VIEWSET_TABLE_BOUNDARIES : SwViewOption::SetAppearanceFlag(ViewOptFlags::TableBoundaries, bVal, true); break;
- case HANDLE_VIEWSET_TEXT_BOUNDARIES : SwViewOption::SetDocBoundaries(bVal); break;
- case HANDLE_VIEWSET_SMOOTH_SCROLLING : mpViewOption->SetSmoothScroll(bVal); break;
- case HANDLE_VIEWSET_SHOW_CONTENT_TIPS : mpViewOption->SetShowContentTips(bVal); break;
- case HANDLE_VIEWSET_IS_RASTER_VISIBLE : mpViewOption->SetGridVisible(bVal); break;
- case HANDLE_VIEWSET_IS_SNAP_TO_RASTER : mpViewOption->SetSnap(bVal); break;
- case HANDLE_VIEWSET_SCROLLBAR_TIPS : mpViewOption->SetShowScrollBarTips(bVal); break;
+ case HANDLE_VIEWSET_SHOW_RULER : mpViewOption->SetViewAnyRuler(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_HRULER : mpViewOption->SetViewHRuler(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_VRULER : mpViewOption->SetViewVRuler(*o3tl::doAccess<bool>(rValue));break;
+ case HANDLE_VIEWSET_VRULER_RIGHT : mpViewOption->SetVRulerRight(*o3tl::doAccess<bool>(rValue));break;
+ case HANDLE_VIEWSET_HSCROLL : mpViewOption->SetViewHScrollBar(*o3tl::doAccess<bool>(rValue));break;
+ case HANDLE_VIEWSET_VSCROLL : mpViewOption->SetViewVScrollBar(*o3tl::doAccess<bool>(rValue));break;
+ case HANDLE_VIEWSET_GRAPHICS : mpViewOption->SetGraphic(*o3tl::doAccess<bool>(rValue));break;
+ case HANDLE_VIEWSET_TABLES : mpViewOption->SetTable(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_DRAWINGS : mpViewOption->SetDraw(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_FIELD_COMMANDS : mpViewOption->SetFieldName(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_ANNOTATIONS : mpViewOption->SetPostIts(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_INDEX_MARK_BACKGROUND : SwViewOption::SetAppearanceFlag(ViewOptFlags::FieldShadings, *o3tl::doAccess<bool>(rValue), true); break;
+ case HANDLE_VIEWSET_NONPRINTING_CHARACTERS: mpViewOption->SetViewMetaChars( *o3tl::doAccess<bool>(rValue) ); break;
+ case HANDLE_VIEWSET_FOOTNOTE_BACKGROUND : SwViewOption::SetAppearanceFlag(ViewOptFlags::FieldShadings, *o3tl::doAccess<bool>(rValue), true); break;
+ case HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND : SwViewOption::SetAppearanceFlag(ViewOptFlags::FieldShadings, *o3tl::doAccess<bool>(rValue), true); break;
+ case HANDLE_VIEWSET_PARA_BREAKS : mpViewOption->SetParagraph(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_SOFT_HYPHENS : mpViewOption->SetSoftHyph(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_SPACES : mpViewOption->SetBlank(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_PROTECTED_SPACES : mpViewOption->SetHardBlank(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_TABSTOPS : mpViewOption->SetTab(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_BREAKS : mpViewOption->SetLineBreak(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_HIDDEN_TEXT : mpViewOption->SetShowHiddenField(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_HIDDEN_CHARACTERS : mpViewOption->SetShowHiddenChar(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : mpViewOption->SetShowHiddenPara(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_TABLE_BOUNDARIES : SwViewOption::SetAppearanceFlag(ViewOptFlags::TableBoundaries, *o3tl::doAccess<bool>(rValue), true); break;
+ case HANDLE_VIEWSET_TEXT_BOUNDARIES : SwViewOption::SetDocBoundaries(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_SMOOTH_SCROLLING : mpViewOption->SetSmoothScroll(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_SHOW_CONTENT_TIPS : mpViewOption->SetShowContentTips(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_IS_RASTER_VISIBLE : mpViewOption->SetGridVisible(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_IS_SNAP_TO_RASTER : mpViewOption->SetSnap(*o3tl::doAccess<bool>(rValue)); break;
+ case HANDLE_VIEWSET_SCROLLBAR_TIPS : mpViewOption->SetShowScrollBarTips(*o3tl::doAccess<bool>(rValue)); break;
case HANDLE_VIEWSET_RASTER_RESOLUTION_X :
{
sal_Int32 nTmp = 0;
@@ -700,6 +700,7 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c
{
if ( pView )
{
+ bool bVal = *o3tl::doAccess<bool>(rValue);
SwViewOption aOpt(*pView->GetWrtShell().GetViewOptions());
if (!bVal != !aOpt.getBrowseMode())
{
@@ -719,6 +720,7 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c
{
if ( pView )
{
+ bool bVal = *o3tl::doAccess<bool>(rValue);
SwViewOption aOpt(*pView->GetWrtShell().GetViewOptions());
if (!bVal != !aOpt.IsHideWhitespaceMode())
{
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 57a9bc9b21a5..ed63dbb30d31 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.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/mutex.hxx>
#include <vcl/image.hxx>
#include <vcl/virdev.hxx>
@@ -1140,8 +1143,12 @@ void SwXTextDocument::setPagePrintSettings(const Sequence< beans::PropertyValue
}
else if(sName == "IsLandscape")
{
- bException = (cppu::UnoType<bool>::get() != rVal.getValueType());
- aData.SetLandscape(*static_cast<sal_Bool const *>(rVal.getValue()));
+ auto b = o3tl::tryAccess<bool>(rVal);
+ bException = bool(b);
+ if (b)
+ {
+ aData.SetLandscape(*b);
+ }
}
else
bException = true;
@@ -1197,9 +1204,9 @@ void SwXTextDocument::printPages(const Sequence< beans::PropertyValue >& xOption
// Collate-Property
else if ( rProp.Name == UNO_NAME_COLLATE )
{
- if ( rProp.Value.getValueType() == cppu::UnoType<bool>::get())
+ if ( auto b = o3tl::tryAccess<bool>(rProp.Value) )
- aReq.AppendItem(SfxBoolItem( SID_PRINT_COLLATE, *static_cast<sal_Bool const *>(rProp.Value.getValue()) ) );
+ aReq.AppendItem(SfxBoolItem( SID_PRINT_COLLATE, *b ) );
else
throw IllegalArgumentException();
}
@@ -1207,8 +1214,8 @@ void SwXTextDocument::printPages(const Sequence< beans::PropertyValue >& xOption
// Sort-Property
else if ( rProp.Name == UNO_NAME_SORT )
{
- if ( rProp.Value.getValueType() == cppu::UnoType<bool>::get() )
- aReq.AppendItem(SfxBoolItem( SID_PRINT_SORT, *static_cast<sal_Bool const *>(rProp.Value.getValue()) ) );
+ if ( auto b = o3tl::tryAccess<bool>(rProp.Value) )
+ aReq.AppendItem(SfxBoolItem( SID_PRINT_SORT, *b ) );
else
throw IllegalArgumentException();
}
@@ -1835,7 +1842,7 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any&
case WID_DOC_CHANGES_RECORD:
case WID_DOC_CHANGES_SHOW:
{
- bool bSet = *static_cast<sal_Bool const *>(aValue.getValue());
+ bool bSet = *o3tl::doAccess<bool>(aValue);
sal_uInt16 eMode = pDocShell->GetDoc()->getIDocumentRedlineAccess().GetRedlineMode();
if(WID_DOC_CHANGES_SHOW == pEntry->nWID)
{
@@ -1875,7 +1882,7 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any&
}
break;
case WID_DOC_HIDE_TIPS :
- SW_MOD()->GetModuleConfig()->SetHideFieldTips(*static_cast<sal_Bool const *>(aValue.getValue()));
+ SW_MOD()->GetModuleConfig()->SetHideFieldTips(*o3tl::doAccess<bool>(aValue));
break;
case WID_DOC_REDLINE_DISPLAY:
{
@@ -1908,7 +1915,7 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any&
case WID_DOC_AUTOMATIC_CONTROL_FOCUS:
{
SwDrawModel * pDrawDoc;
- bool bAuto = *static_cast<sal_Bool const *>(aValue.getValue());
+ bool bAuto = *o3tl::doAccess<bool>(aValue);
if ( nullptr != ( pDrawDoc = pDocShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel() ) )
pDrawDoc->SetAutoControlFocus( bAuto );
@@ -1928,7 +1935,7 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any&
case WID_DOC_APPLY_FORM_DESIGN_MODE:
{
SwDrawModel * pDrawDoc;
- bool bMode = *static_cast<sal_Bool const *>(aValue.getValue());
+ bool bMode = *o3tl::doAccess<bool>(aValue);
if ( nullptr != ( pDrawDoc = pDocShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel() ) )
pDrawDoc->SetOpenInDesignMode( bMode );
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index 22a2648547b4..1d0c04182fe6 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -18,6 +18,7 @@
*/
#include "viscrs.hxx"
+#include <o3tl/any.hxx>
#include <sfx2/frame.hxx>
#include <sfx2/printer.hxx>
#include <cmdid.h>
@@ -623,7 +624,7 @@ void SAL_CALL SwXTextView::setRubyList(
else if(pProperties[nProp].Name == UNO_NAME_RUBY_IS_ABOVE)
{
bool bValue = !pProperties[nProp].Value.hasValue() ||
- *static_cast<sal_Bool const *>(pProperties[nProp].Value.getValue());
+ *o3tl::doAccess<bool>(pProperties[nProp].Value);
pEntry->GetRubyAttr().SetPosition(bValue ? 0 : 1);
}
}
diff --git a/sw/source/uibase/utlui/navicfg.cxx b/sw/source/uibase/utlui/navicfg.cxx
index f463fc119b66..8ad887ea4bff 100644
--- a/sw/source/uibase/utlui/navicfg.cxx
+++ b/sw/source/uibase/utlui/navicfg.cxx
@@ -20,6 +20,7 @@
#include <swtypes.hxx>
#include <navicfg.hxx>
#include <swcont.hxx>
+#include <o3tl/any.hxx>
#include <osl/diagnose.h>
#include <com/sun/star/uno/Sequence.hxx>
@@ -89,8 +90,8 @@ SwNavigationConfig::SwNavigationConfig() :
break;
}
case 4: pValues[nProp] >>= nActiveBlock; break;
- case 5: bIsSmall = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
- case 6: bIsGlobalActive = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break;
+ case 5: bIsSmall = *o3tl::doAccess<bool>(pValues[nProp]); break;
+ case 6: bIsGlobalActive = *o3tl::doAccess<bool>(pValues[nProp]); break;
}
}
}