[Libreoffice-commits] core.git: 16 commits - cppcanvas/source cui/source dbaccess/source desktop/source extensions/source filter/source forms/source framework/source oox/source sc/source sd/source sfx2/source starmath/source svx/source sw/source vbahelper/source
Stephan Bergmann
sbergman at redhat.com
Fri Jun 10 16:56:30 UTC 2016
cppcanvas/source/uno/uno_mtfrenderer.cxx | 3
cui/source/options/optasian.cxx | 3
dbaccess/source/ui/browser/exsrcbrw.cxx | 28
dbaccess/source/ui/browser/formadapter.cxx | 4
desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx | 15
extensions/source/bibliography/bibconfig.cxx | 3
extensions/source/bibliography/bibload.cxx | 7
extensions/source/bibliography/datman.cxx | 22
extensions/source/bibliography/general.cxx | 3
extensions/source/bibliography/toolbar.cxx | 17
filter/source/graphicfilter/icgm/actimpr.cxx | 9
filter/source/msfilter/escherex.cxx | 76 +-
filter/source/msfilter/eschesdo.cxx | 17
filter/source/msfilter/eschesdo.hxx | 3
filter/source/xsltfilter/OleHandler.cxx | 2
forms/source/component/Button.cxx | 3
forms/source/component/FormComponent.cxx | 7
forms/source/component/FormattedField.cxx | 4
forms/source/component/Grid.cxx | 2
forms/source/component/ListBox.cxx | 5
forms/source/component/RadioButton.cxx | 4
framework/source/recording/dispatchrecorder.cxx | 14
oox/source/core/xmlfilterbase.cxx | 4
oox/source/export/drawingml.cxx | 159 ++--
sc/source/core/data/dptabsrc.cxx | 6
sc/source/ui/unoobj/docuno.cxx | 15
sc/source/ui/unoobj/miscuno.cxx | 15
sc/source/ui/vba/vbarange.cxx | 3
sc/source/ui/vba/vbaworkbook.cxx | 2
sd/source/filter/eppt/eppt.cxx | 61 -
sd/source/filter/eppt/epptso.cxx | 30
sd/source/filter/eppt/pptx-epptbase.cxx | 7
sd/source/filter/eppt/pptx-epptooxml.cxx | 3
sd/source/filter/eppt/pptx-text.cxx | 162 ++--
sd/source/filter/xml/sdxmlwrp.cxx | 4
sd/source/ui/app/optsitem.cxx | 143 ++--
sfx2/source/appl/opengrf.cxx | 3
starmath/source/unomodel.cxx | 27
svx/source/dialog/rubydialog.cxx | 5
svx/source/items/customshapeitem.cxx | 63 -
svx/source/table/cell.cxx | 8
svx/source/unodraw/XPropertyTable.cxx | 5
svx/source/unodraw/unoshap2.cxx | 25
svx/source/unodraw/unoshape.cxx | 9
svx/source/xoutdev/xattr.cxx | 25
sw/source/core/edit/edlingu.cxx | 5
sw/source/core/fields/authfld.cxx | 7
sw/source/core/fields/dbfld.cxx | 3
sw/source/core/fields/ddefld.cxx | 5
sw/source/core/fields/docufld.cxx | 24
sw/source/core/fields/expfld.cxx | 11
sw/source/core/fields/flddat.cxx | 7
sw/source/core/fields/scrptfld.cxx | 3
sw/source/core/fields/tblcalc.cxx | 6
sw/source/core/fields/usrfld.cxx | 10
sw/source/core/frmedt/fefly1.cxx | 3
sw/source/core/graphic/grfatr.cxx | 3
sw/source/core/layout/atrfrm.cxx | 35 -
sw/source/core/para/paratr.cxx | 5
sw/source/core/txtnode/fmtatr2.cxx | 3
sw/source/core/unocore/swunohelper.cxx | 3
sw/source/core/unocore/unodraw.cxx | 73 +-
sw/source/core/unocore/unofield.cxx | 11
sw/source/core/unocore/unoframe.cxx | 7
sw/source/core/unocore/unoobj.cxx | 22
sw/source/core/unocore/unosett.cxx | 33
sw/source/core/unocore/unosrch.cxx | 5
sw/source/core/unocore/unotbl.cxx | 15
sw/source/filter/html/htmlforw.cxx | 444 ++++++-------
sw/source/filter/ww8/wrtw8esh.cxx | 9
sw/source/filter/xml/XMLRedlineImportHelper.cxx | 9
sw/source/filter/xml/swxml.cxx | 9
sw/source/filter/xml/wrtxml.cxx | 3
sw/source/filter/xml/xmlexp.cxx | 13
sw/source/filter/xml/xmlimp.cxx | 25
sw/source/filter/xml/xmltble.cxx | 3
sw/source/filter/xml/xmltexti.cxx | 5
sw/source/ui/dbui/dbinsdlg.cxx | 13
sw/source/ui/misc/glossary.cxx | 3
sw/source/uibase/config/modcfg.cxx | 31
sw/source/uibase/config/prtopt.cxx | 33
sw/source/uibase/config/usrpref.cxx | 9
sw/source/uibase/envelp/envimg.cxx | 5
sw/source/uibase/envelp/labimg.cxx | 11
sw/source/uibase/uiview/view.cxx | 3
sw/source/uibase/uiview/view2.cxx | 5
sw/source/uibase/uno/SwXDocumentSettings.cxx | 93 +-
sw/source/uibase/uno/unomod.cxx | 98 +-
sw/source/uibase/uno/unotxdoc.cxx | 27
sw/source/uibase/uno/unotxvw.cxx | 3
sw/source/uibase/utlui/navicfg.cxx | 5
vbahelper/source/vbahelper/vbahelper.cxx | 5
92 files changed, 1121 insertions(+), 1077 deletions(-)
New commits:
commit fd8f328462fc20d9a3a03b5f8ceb78faedeaa602
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jun 10 18:55:53 2016 +0200
Clean up uses of Any::getValue() in cppcanvas
Change-Id: I9a69b35ee7dc2da3912a72361e0e742bf480e6be
diff --git a/cppcanvas/source/uno/uno_mtfrenderer.cxx b/cppcanvas/source/uno/uno_mtfrenderer.cxx
index 6d2c311..503047f 100644
--- a/cppcanvas/source/uno/uno_mtfrenderer.cxx
+++ b/cppcanvas/source/uno/uno_mtfrenderer.cxx
@@ -11,6 +11,7 @@
#include <cppcanvas/vclfactory.hxx>
#include <comphelper/servicedecl.hxx>
#include <cppuhelper/factory.hxx>
+#include <o3tl/any.hxx>
using namespace ::com::sun::star;
@@ -34,7 +35,7 @@ void MtfRenderer::draw (double fScaleX, double fScaleY) throw (uno::RuntimeExcep
void MtfRenderer::setFastPropertyValue( sal_Int32 nHandle, const uno::Any& aAny) throw (uno::RuntimeException, std::exception)
{
if (nHandle == 0) {
- mpMetafile = reinterpret_cast<GDIMetaFile*>( *static_cast<const sal_Int64*>(aAny.getValue()) );
+ mpMetafile = reinterpret_cast<GDIMetaFile*>( *o3tl::doAccess<sal_Int64>(aAny) );
}
}
commit d453d74b09fc812118eba5a996ebbee28fe592cb
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jun 10 18:55:47 2016 +0200
Clean up uses of Any::getValue() in cui
Change-Id: I31da32c90a09cd0746f2d05ed2cbd7ffde3f81e4
diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx
index 8113013..ed4341a 100644
--- a/cui/source/options/optasian.cxx
+++ b/cui/source/options/optasian.cxx
@@ -21,6 +21,7 @@
#include <optasian.hxx>
#include <editeng/langitem.hxx>
#include <editeng/unolingu.hxx>
+#include <o3tl/any.hxx>
#include <dialmgr.hxx>
#include <cuires.hrc>
#include <i18nlangtag/mslangid.hxx>
@@ -263,7 +264,7 @@ void SvxAsianLayoutPage::Reset( const SfxItemSet* )
if(pImpl->xPrSetInfo->hasPropertyByName(sPunct))
{
Any aVal = pImpl->xPrSet->getPropertyValue(sPunct);
- bKernWesternText = !*static_cast<sal_Bool const *>(aVal.getValue());
+ bKernWesternText = !*o3tl::doAccess<bool>(aVal);
}
}
else
commit 0cb1c2fdc106281e1594c4e714f1c79f0ad0ec8d
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jun 10 18:55:42 2016 +0200
Clean up uses of Any::getValue() in dbaccess
Change-Id: Icaad71e51301e017a48ab3f87b151f5e0de26cd9
diff --git a/dbaccess/source/ui/browser/exsrcbrw.cxx b/dbaccess/source/ui/browser/exsrcbrw.cxx
index 2773e27..69db7d2 100644
--- a/dbaccess/source/ui/browser/exsrcbrw.cxx
+++ b/dbaccess/source/ui/browser/exsrcbrw.cxx
@@ -28,6 +28,7 @@
#include <comphelper/processfactory.hxx>
#include "dbustrings.hrc"
#include "dbu_reghelper.hxx"
+#include <o3tl/any.hxx>
#include <tools/diagnose_ex.h>
#include <rtl/strbuf.hxx>
@@ -142,24 +143,25 @@ void SAL_CALL SbaExternalSourceBrowser::dispatch(const css::util::URL& aURL, con
{
if ( pArguments->Name == "ColumnType" )
{
- bool bCorrectType = pArguments->Value.getValueType().equals(::cppu::UnoType<OUString>::get());
- OSL_ENSURE(bCorrectType, "invalid type for argument \"ColumnType\" !");
- if (bCorrectType)
- sControlType = ::comphelper::getString(pArguments->Value);
+ auto s = o3tl::tryAccess<OUString>(pArguments->Value);
+ OSL_ENSURE(s, "invalid type for argument \"ColumnType\" !");
+ if (s)
+ sControlType = *s;
}
else if ( pArguments->Name == "ColumnPosition" )
{
- bool bCorrectType = pArguments->Value.getValueType().equals(::cppu::UnoType<sal_Int16>::get());
- OSL_ENSURE(bCorrectType, "invalid type for argument \"ColumnPosition\" !");
- if (bCorrectType)
- nControlPos = ::comphelper::getINT16(pArguments->Value);
+ auto n = o3tl::tryAccess<sal_Int16>(pArguments->Value);
+ OSL_ENSURE(n, "invalid type for argument \"ColumnPosition\" !");
+ if (n)
+ nControlPos = *n;
}
else if ( pArguments->Name == "ColumnProperties" )
{
- bool bCorrectType = pArguments->Value.getValueType().equals(cppu::UnoType<Sequence< css::beans::PropertyValue>>::get());
- OSL_ENSURE(bCorrectType, "invalid type for argument \"ColumnProperties\" !");
- if (bCorrectType)
- aControlProps = *static_cast<Sequence< css::beans::PropertyValue> const *>(pArguments->Value.getValue());
+ auto s = o3tl::tryAccess<Sequence<css::beans::PropertyValue>>(
+ pArguments->Value);
+ OSL_ENSURE(s, "invalid type for argument \"ColumnProperties\" !");
+ if (s)
+ aControlProps = *s;
}
else
SAL_WARN("dbaccess.ui", "SbaExternalSourceBrowser::dispatch(AddGridColumn) : unknown argument (" << pArguments->Name << ") !");
@@ -221,7 +223,7 @@ void SAL_CALL SbaExternalSourceBrowser::dispatch(const css::util::URL& aURL, con
{
if ( (pArguments->Name == "MasterForm") && (pArguments->Value.getValueTypeClass() == TypeClass_INTERFACE) )
{
- xMasterForm.set(*static_cast<Reference< XInterface > const *>(pArguments->Value.getValue()), UNO_QUERY);
+ xMasterForm.set(pArguments->Value, UNO_QUERY);
break;
}
}
diff --git a/dbaccess/source/ui/browser/formadapter.cxx b/dbaccess/source/ui/browser/formadapter.cxx
index 2ba33e9..f66fb41 100644
--- a/dbaccess/source/ui/browser/formadapter.cxx
+++ b/dbaccess/source/ui/browser/formadapter.cxx
@@ -1375,7 +1375,7 @@ void SbaXFormAdapter::implInsert(const Any& aElement, sal_Int32 nIndex, const OU
throw css::lang::IllegalArgumentException();
}
- Reference< css::form::XFormComponent > xElement(*static_cast<Reference< XInterface > const *>(aElement.getValue()), UNO_QUERY);
+ Reference< css::form::XFormComponent > xElement(aElement, UNO_QUERY);
if (!xElement.is())
{
throw css::lang::IllegalArgumentException();
@@ -1544,7 +1544,7 @@ void SAL_CALL SbaXFormAdapter::replaceByIndex(sal_Int32 _rIndex, const Any& Elem
throw css::lang::IllegalArgumentException();
}
- Reference< css::form::XFormComponent > xElement(*static_cast<Reference< XInterface > const *>(Element.getValue()), UNO_QUERY);
+ Reference< css::form::XFormComponent > xElement(Element, UNO_QUERY);
if (!xElement.is())
{
throw css::lang::IllegalArgumentException();
commit e5ca1f73a08a05c957b73929cafa748ba82a033c
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jun 10 18:55:35 2016 +0200
Clean up uses of Any::getValue() in desktop
Change-Id: I20cc2dba64a07012c7d03ab5d2aca56dd8cfb042
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index a440d9e..d3598f3 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -50,6 +50,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/uno/TypeClass.hpp>
+#include <o3tl/any.hxx>
#include <osl/diagnose.h>
#include <osl/mutex.hxx>
#include <rtl/ref.hxx>
@@ -562,8 +563,8 @@ void ProgressCmdEnv::update_( uno::Any const & rStatus )
OUString text;
if ( rStatus.hasValue() && !( rStatus >>= text) )
{
- if ( rStatus.getValueTypeClass() == uno::TypeClass_EXCEPTION )
- text = static_cast< uno::Exception const *>( rStatus.getValue() )->Message;
+ if ( auto e = o3tl::tryAccess<uno::Exception>(rStatus) )
+ text = e->Message;
if ( text.isEmpty() )
text = ::comphelper::anyToString( rStatus ); // fallback
@@ -800,11 +801,13 @@ void ExtensionCmdQueue::Thread::execute()
uno::Any exc( ::cppu::getCaughtException() );
OUString msg;
deployment::DeploymentException dpExc;
- if ((exc >>= dpExc) &&
- dpExc.Cause.getValueTypeClass() == uno::TypeClass_EXCEPTION)
+ if (exc >>= dpExc)
{
- // notify error cause only:
- msg = static_cast< uno::Exception const * >( dpExc.Cause.getValue() )->Message;
+ if (auto e = o3tl::tryAccess<uno::Exception>(dpExc.Cause))
+ {
+ // notify error cause only:
+ msg = e->Message;
+ }
}
if (msg.isEmpty()) // fallback for debugging purposes
msg = ::comphelper::anyToString(exc);
commit 177afb1ec39d3ac9c66c7dfdc51ef9ad22e7b752
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jun 10 18:55:25 2016 +0200
Clean up uses of Any::getValue() in extensions
Change-Id: I67b9127d8aa67a702086ef5bc61372ae54c2142e
diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx
index a5d9733..3661903 100644
--- a/extensions/source/bibliography/bibconfig.cxx
+++ b/extensions/source/bibliography/bibconfig.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <comphelper/processfactory.hxx>
+#include <o3tl/any.hxx>
#include <o3tl/make_unique.hxx>
using namespace ::com::sun::star::uno;
@@ -116,7 +117,7 @@ BibConfig::BibConfig()
case 5: pValues[nProp] >>= sQueryText ; break;
case 6: pValues[nProp] >>= sQueryField; break;
case 7:
- bShowColumnAssignmentWarning = *static_cast<sal_Bool const *>(pValues[nProp].getValue());
+ bShowColumnAssignmentWarning = *o3tl::doAccess<bool>(pValues[nProp]);
break;
}
}
diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx
index fb36a2f..3bff83b 100644
--- a/extensions/source/bibliography/bibload.cxx
+++ b/extensions/source/bibliography/bibload.cxx
@@ -401,8 +401,7 @@ Reference< sdb::XColumn > BibliographyLoader::GetIdentifierColumn() const
Reference< sdb::XColumn > xReturn;
if (xColumns.is() && xColumns->hasByName(sIdentifierColumnName))
{
- xReturn.set(*static_cast<Reference< XInterface > const *>(
- xColumns->getByName(sIdentifierColumnName).getValue()), UNO_QUERY);
+ xReturn.set(xColumns->getByName(sIdentifierColumnName), UNO_QUERY);
}
return xReturn;
}
@@ -435,7 +434,7 @@ static OUString lcl_AddProperty(const Reference< XNameAccess >& xColumns,
OUString uRet;
Reference< sdb::XColumn > xCol;
if (xColumns->hasByName(uColumnName))
- xCol.set(*static_cast<Reference< XInterface > const *>(xColumns->getByName(uColumnName).getValue()), UNO_QUERY);
+ xCol.set(xColumns->getByName(uColumnName), UNO_QUERY);
if (xCol.is())
uRet = xCol->getString();
return uRet;
@@ -461,7 +460,7 @@ Any BibliographyLoader::getByName(const OUString& rName) throw
const OUString sIdentifierMapping = pDatMan->GetIdentifierMapping();
Reference< sdb::XColumn > xColumn;
if (xColumns->hasByName(sIdentifierMapping))
- xColumn.set(*static_cast<Reference< XInterface > const *>(xColumns->getByName(sIdentifierMapping).getValue()), UNO_QUERY);
+ xColumn.set(xColumns->getByName(sIdentifierMapping), UNO_QUERY);
if (xColumn.is())
{
do
diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
index d9ff7c9..e9541d2 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.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 <sal/log.hxx>
#include <tools/diagnose_ex.h>
@@ -134,7 +137,7 @@ Reference< XConnection > getConnection(const Reference< XInterface > & xRowSe
if (!xFormProps.is())
return xConn;
- xConn.set(*static_cast<Reference< XInterface > const *>(xFormProps->getPropertyValue("ActiveConnection").getValue()), UNO_QUERY);
+ xConn.set(xFormProps->getPropertyValue("ActiveConnection"), UNO_QUERY);
if (!xConn.is())
{
SAL_INFO("extensions.biblio", "no active connection");
@@ -166,14 +169,13 @@ Reference< XNameAccess > getColumns(const Reference< XForm > & _rxForm)
{
try
{
- DBG_ASSERT((*static_cast<sal_Int32 const *>(xFormProps->getPropertyValue("CommandType").getValue())) == CommandType::TABLE,
+ DBG_ASSERT(*o3tl::forceAccess<sal_Int32>(xFormProps->getPropertyValue("CommandType")) == CommandType::TABLE,
"::getColumns : invalid form (has no table as data source) !");
OUString sTable;
xFormProps->getPropertyValue("Command") >>= sTable;
Reference< XNameAccess > xTables = xSupplyTables->getTables();
if (xTables.is() && xTables->hasByName(sTable))
- xSupplyCols.set(
- *static_cast<Reference< XInterface > const *>(xTables->getByName(sTable).getValue()), UNO_QUERY);
+ xSupplyCols.set(xTables->getByName(sTable), UNO_QUERY);
if (xSupplyCols.is())
xReturn = xSupplyCols->getColumns();
}
@@ -1428,7 +1430,7 @@ void BibDataManager::propertyChange(const beans::PropertyChangeEvent& evt) throw
if( evt.NewValue.getValueType() == cppu::UnoType<io::XInputStream>::get())
{
Reference< io::XDataInputStream > xStream(
- *static_cast<const Reference< io::XInputStream > *>(evt.NewValue.getValue()), UNO_QUERY );
+ evt.NewValue, UNO_QUERY );
aUID <<= xStream->readUTF();
}
else
@@ -1472,13 +1474,12 @@ void BibDataManager::SetMeAsUidListener()
if(!theFieldName.isEmpty())
{
- Reference< XPropertySet > xPropSet;
Any aElement;
aElement = xFields->getByName(theFieldName);
- xPropSet = *static_cast<Reference< XPropertySet > const *>(aElement.getValue());
+ auto xPropSet = o3tl::doAccess<Reference<XPropertySet>>(aElement);
- xPropSet->addPropertyChangeListener(FM_PROP_VALUE, this);
+ (*xPropSet)->addPropertyChangeListener(FM_PROP_VALUE, this);
}
}
@@ -1516,13 +1517,12 @@ void BibDataManager::RemoveMeAsUidListener()
if(!theFieldName.isEmpty())
{
- Reference< XPropertySet > xPropSet;
Any aElement;
aElement = xFields->getByName(theFieldName);
- xPropSet = *static_cast<Reference< XPropertySet > const *>(aElement.getValue());
+ auto xPropSet = o3tl::doAccess<Reference<XPropertySet>>(aElement);
- xPropSet->removePropertyChangeListener(FM_PROP_VALUE, this);
+ (*xPropSet)->removePropertyChangeListener(FM_PROP_VALUE, this);
}
}
diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx
index 7758e4f..f58a7cb 100644
--- a/extensions/source/bibliography/general.cxx
+++ b/extensions/source/bibliography/general.cxx
@@ -129,8 +129,7 @@ void BibPosListener::cursorMoved(const lang::EventObject& /*aEvent*/) throw( uno
if(xValueAcc.is() && xValueAcc->hasByName(uTypeMapping))
{
uno::Any aVal = xValueAcc->getByName(uTypeMapping);
- uno::Reference< uno::XInterface > xInt = *static_cast<uno::Reference< uno::XInterface > const *>(aVal.getValue());
- uno::Reference< sdb::XColumn > xCol(xInt, UNO_QUERY);
+ uno::Reference< sdb::XColumn > xCol(aVal, UNO_QUERY);
DBG_ASSERT(xCol.is(), "BibPosListener::cursorMoved : invalid column (no sdb::XColumn) !");
if (xCol.is())
{
diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx
index 521446c..3cf37e4 100644
--- a/extensions/source/bibliography/toolbar.cxx
+++ b/extensions/source/bibliography/toolbar.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <datman.hxx>
+#include <o3tl/any.hxx>
#include <svx/svxids.hrc>
#include <svtools/miscopt.hxx>
#include <svtools/imgdef.hxx>
@@ -65,10 +66,9 @@ void BibToolBarListener::statusChanged(const css::frame::FeatureStateEvent& rEvt
pToolBar->EnableItem(nIndex,rEvt.IsEnabled);
css::uno::Any aState=rEvt.State;
- if(aState.getValueType()==cppu::UnoType<bool>::get())
+ if(auto bChecked = o3tl::tryAccess<bool>(aState))
{
- bool bChecked= *static_cast<sal_Bool const *>(aState.getValue());
- pToolBar->CheckItem(nIndex, bChecked);
+ pToolBar->CheckItem(nIndex, *bChecked);
}
}
@@ -92,12 +92,11 @@ void BibTBListBoxListener::statusChanged(const css::frame::FeatureStateEvent& rE
pToolBar->EnableSourceList(rEvt.IsEnabled);
Any aState = rEvt.State;
- if(aState.getValueType() == cppu::UnoType<Sequence<OUString>>::get())
+ if(auto pStringSeq = o3tl::tryAccess<Sequence<OUString>>(aState))
{
pToolBar->UpdateSourceList(false);
pToolBar->ClearSourceList();
- Sequence<OUString> const * pStringSeq = static_cast<Sequence<OUString> const *>(aState.getValue());
const OUString* pStringArray = pStringSeq->getConstArray();
sal_uInt32 nCount = pStringSeq->getLength();
@@ -131,11 +130,10 @@ void BibTBQueryMenuListener::statusChanged(const frame::FeatureStateEvent& rEvt)
pToolBar->EnableSourceList(rEvt.IsEnabled);
uno::Any aState=rEvt.State;
- if(aState.getValueType()==cppu::UnoType<Sequence<OUString>>::get())
+ if(auto pStringSeq = o3tl::tryAccess<Sequence<OUString>>(aState))
{
pToolBar->ClearFilterMenu();
- Sequence<OUString> const * pStringSeq = static_cast<Sequence<OUString> const *>(aState.getValue());
const OUString* pStringArray = pStringSeq->getConstArray();
sal_uInt32 nCount = pStringSeq->getLength();
@@ -168,10 +166,9 @@ void BibTBEditListener::statusChanged(const frame::FeatureStateEvent& rEvt)throw
pToolBar->EnableQuery(rEvt.IsEnabled);
uno::Any aState=rEvt.State;
- if(aState.getValueType()== ::cppu::UnoType<OUString>::get())
+ if(auto aStr = o3tl::tryAccess<OUString>(aState))
{
- OUString aStr = *static_cast<OUString const *>(aState.getValue());
- pToolBar->SetQueryString(aStr);
+ pToolBar->SetQueryString(*aStr);
}
}
}
commit e4eb0f6ecee2d82966c0da156185415e5886f60f
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jun 10 18:55:19 2016 +0200
Clean up uses of Any::getValue() in filter
Change-Id: I4cd1b554be56d4d43db4108925397a8498781491
diff --git a/filter/source/graphicfilter/icgm/actimpr.cxx b/filter/source/graphicfilter/icgm/actimpr.cxx
index 2d364c48..c260568 100644
--- a/filter/source/graphicfilter/icgm/actimpr.cxx
+++ b/filter/source/graphicfilter/icgm/actimpr.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 <vcl/bitmapex.hxx>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
@@ -65,7 +68,7 @@ CGMImpressOutAct::CGMImpressOutAct( CGM& rCGM, const uno::Reference< frame::XMod
maXMultiServiceFactory.set( rModel, uno::UNO_QUERY);
if( maXMultiServiceFactory.is() )
{
- maXDrawPage = *static_cast<uno::Reference< drawing::XDrawPage > const *>(maXDrawPages->getByIndex( 0 ).getValue());
+ maXDrawPage = *o3tl::doAccess<uno::Reference<drawing::XDrawPage>>(maXDrawPages->getByIndex( 0 ));
if ( ImplInitPage() )
bStatRet = true;
}
@@ -397,7 +400,7 @@ void CGMImpressOutAct::EndGroup()
uno::Reference< drawing::XShapes > aXShapes = drawing::ShapeCollection::create(comphelper::getProcessComponentContext());
for ( sal_uInt32 i = nFirstIndex; i < nCurrentCount; i++ )
{
- uno::Reference< drawing::XShape > aXShape = *static_cast<uno::Reference< drawing::XShape > const *>(maXShapes->getByIndex( i ).getValue());
+ uno::Reference< drawing::XShape > aXShape = *o3tl::doAccess<uno::Reference<drawing::XShape>>(maXShapes->getByIndex( i ));
if (aXShape.is() )
{
aXShapes->add( aXShape );
@@ -840,7 +843,7 @@ void CGMImpressOutAct::AppendText( char* pString, sal_uInt32 /*nSize*/, FinalFla
{
if ( nFinalTextCount )
{
- uno::Reference< drawing::XShape > aShape = *static_cast<uno::Reference< drawing::XShape > const *>(maXShapes->getByIndex( nFinalTextCount - 1 ).getValue());
+ uno::Reference< drawing::XShape > aShape = *o3tl::doAccess<uno::Reference<drawing::XShape>>(maXShapes->getByIndex( nFinalTextCount - 1 ));
if ( aShape.is() )
{
uno::Reference< text::XText > xText;
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index a926899..e4d7c4b 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -18,6 +18,7 @@
*/
#include "eschesdo.hxx"
+#include <o3tl/any.hxx>
#include <svx/svdxcgv.hxx>
#include <svx/svdomedia.hxx>
#include <svx/xflftrit.hxx>
@@ -437,7 +438,7 @@ void EscherPropertyContainer::CreateGradientProperties(
if (bTransparentGradient && EscherPropertyValueHelper::GetPropertyValue(
aAny, rXPropSet, "FillTransparenceGradient" ) )
{
- pGradient = static_cast<css::awt::Gradient const *>(aAny.getValue());
+ pGradient = o3tl::doAccess<css::awt::Gradient>(aAny);
css::uno::Any aAnyTemp;
const rtl::OUString aPropName( "FillStyle" );
@@ -453,8 +454,8 @@ void EscherPropertyContainer::CreateGradientProperties(
if ( EscherPropertyValueHelper::GetPropertyValue(
aAnyTemp, rXPropSet, "FillColor" ) )
{
- const_cast<css::awt::Gradient *>(pGradient)->StartColor = ImplGetColor( *static_cast<sal_uInt32 const *>(aAnyTemp.getValue()), false );
- const_cast<css::awt::Gradient *>(pGradient)->EndColor = ImplGetColor( *static_cast<sal_uInt32 const *>(aAnyTemp.getValue()), false );
+ const_cast<css::awt::Gradient *>(pGradient)->StartColor = ImplGetColor( *o3tl::doAccess<sal_uInt32>(aAnyTemp), false );
+ const_cast<css::awt::Gradient *>(pGradient)->EndColor = ImplGetColor( *o3tl::doAccess<sal_uInt32>(aAnyTemp), false );
}
}
// gradient and transparency.
@@ -462,7 +463,7 @@ void EscherPropertyContainer::CreateGradientProperties(
{
if ( EscherPropertyValueHelper::GetPropertyValue(
aAny, rXPropSet, "FillGradient" ) )
- pGradient = static_cast<css::awt::Gradient const *>(aAny.getValue());
+ pGradient = o3tl::doAccess<css::awt::Gradient>(aAny);
}
}
@@ -471,7 +472,7 @@ void EscherPropertyContainer::CreateGradientProperties(
else if ( EscherPropertyValueHelper::GetPropertyValue(
aAny, rXPropSet, "FillGradient" ) )
{
- pGradient = static_cast<css::awt::Gradient const *>(aAny.getValue());
+ pGradient = o3tl::doAccess<css::awt::Gradient>(aAny);
}
if ( pGradient )
@@ -540,7 +541,7 @@ void EscherPropertyContainer::CreateGradientProperties(
if (bTransparentGradient && EscherPropertyValueHelper::GetPropertyValue(
aAny, rXPropSet, "FillTransparenceGradient" ) )
{
- pGradient = static_cast<css::awt::Gradient const *>(aAny.getValue());
+ pGradient = o3tl::doAccess<css::awt::Gradient>(aAny);
if ( pGradient )
{
sal_uInt32 nBlue = GetGradientColor( pGradient, nFirstColor ) >> 16;
@@ -622,7 +623,7 @@ void EscherPropertyContainer::CreateFillProperties(
if ( EscherPropertyValueHelper::GetPropertyValue(
aAny, rXPropSet, "FillColor" ) )
{
- sal_uInt32 nFillColor = ImplGetColor( *static_cast<sal_uInt32 const *>(aAny.getValue()) );
+ sal_uInt32 nFillColor = ImplGetColor( *o3tl::doAccess<sal_uInt32>(aAny) );
nFillBackColor = nFillColor ^ 0xffffff;
AddOpt( ESCHER_Prop_fillColor, nFillColor );
}
@@ -639,7 +640,7 @@ void EscherPropertyContainer::CreateFillProperties(
{
sal_uInt16 nTransparency = ( EscherPropertyValueHelper::GetPropertyValue(
aAny, rXPropSet, "FillTransparence", true ) )
- ? *static_cast<sal_Int16 const *>(aAny.getValue()) : 0;
+ ? *o3tl::doAccess<sal_Int16>(aAny) : 0;
if ( nTransparency )
AddOpt( ESCHER_Prop_fillOpacity, ( ( 100 - nTransparency ) << 16 ) / 100 );
}
@@ -825,7 +826,7 @@ void EscherPropertyContainer::CreateTextProperties(
{
sal_uInt16 nAngle = EscherPropertyValueHelper::GetPropertyValue(
aAny, rXPropSet, "RotateAngle", true ) ?
- (sal_uInt16)( ( *static_cast<sal_Int32 const *>(aAny.getValue()) ) + 5 ) / 10 : 0;
+ (sal_uInt16)( ( *o3tl::doAccess<sal_Int32>(aAny) ) + 5 ) / 10 : 0;
if (nAngle==900)
{
AddOpt( ESCHER_Prop_txflTextFlow, ESCHER_txflBtoT );
@@ -865,7 +866,7 @@ bool EscherPropertyContainer::GetLineArrow( const bool bLineStart,
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, sLineName ) )
{
- OUString aArrowStartName = *static_cast<OUString const *>(aAny.getValue());
+ OUString aArrowStartName = *o3tl::doAccess<OUString>(aAny);
sal_Int16 nWhich = bLineStart ? XATTR_LINESTART : XATTR_LINEEND;
OUString aApiName = SvxUnogetApiNameForItem(nWhich, aArrowStartName);
@@ -1018,7 +1019,7 @@ void EscherPropertyContainer::CreateLineProperties(
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "LineDash" ) )
{
ESCHER_LineDashing eDash = ESCHER_LineSolid;
- css::drawing::LineDash const * pLineDash = static_cast<css::drawing::LineDash const *>(aAny.getValue());
+ auto pLineDash = o3tl::doAccess<css::drawing::LineDash>(aAny);
sal_Int32 nDistance = pLineDash->Distance << 1;
switch ( pLineDash->Style )
{
@@ -1074,14 +1075,14 @@ void EscherPropertyContainer::CreateLineProperties(
}
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "LineColor" ) )
{
- sal_uInt32 nLineColor = ImplGetColor( *static_cast<sal_uInt32 const *>(aAny.getValue()) );
+ sal_uInt32 nLineColor = ImplGetColor( *o3tl::doAccess<sal_uInt32>(aAny) );
AddOpt( ESCHER_Prop_lineColor, nLineColor );
AddOpt( ESCHER_Prop_lineBackColor, nLineColor ^ 0xffffff );
}
}
sal_uInt32 nLineSize = ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "LineWidth" ) )
- ? *static_cast<sal_uInt32 const *>(aAny.getValue()) : 0;
+ ? *o3tl::doAccess<sal_uInt32>(aAny) : 0;
if ( nLineSize > 1 )
AddOpt( ESCHER_Prop_lineWidth, nLineSize * 360 ); // 100TH MM -> PT , 1PT = 12700 EMU
@@ -1441,8 +1442,8 @@ bool EscherPropertyContainer::CreateGraphicProperties(
sal_uInt16 nAngle = 0;
if ( rSource == "MetaFile" )
{
- css::uno::Sequence<sal_Int8> aSeq = *static_cast<css::uno::Sequence<sal_Int8> const *>(aAny.getValue());
- const sal_Int8* pAry = aSeq.getArray();
+ auto & aSeq = *o3tl::doAccess<css::uno::Sequence<sal_Int8>>(aAny);
+ const sal_Int8* pAry = aSeq.getConstArray();
sal_uInt32 nAryLen = aSeq.getLength();
// the metafile is already rotated
@@ -1480,11 +1481,11 @@ bool EscherPropertyContainer::CreateGraphicProperties(
}
else if ( rSource == "FillBitmapURL" )
{
- aGraphicUrl = *static_cast<OUString const *>(aAny.getValue());
+ aGraphicUrl = *o3tl::doAccess<OUString>(aAny);
}
else if ( rSource == "GraphicURL" )
{
- aGraphicUrl = *static_cast<OUString const *>(aAny.getValue());
+ aGraphicUrl = *o3tl::doAccess<OUString>(aAny);
bCreateFillStyles = true;
}
else if ( rSource == "FillHatch" )
@@ -1495,7 +1496,7 @@ bool EscherPropertyContainer::CreateGraphicProperties(
Color aBackColor;
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "FillColor" ) )
{
- aBackColor = ImplGetColor( *static_cast<sal_uInt32 const *>(aAny.getValue()), false );
+ aBackColor = ImplGetColor( *o3tl::doAccess<sal_uInt32>(aAny), false );
}
bool bFillBackground = false;
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "FillBackground", true ) )
@@ -1549,7 +1550,7 @@ bool EscherPropertyContainer::CreateGraphicProperties(
else
{
nAngle = bRotate && EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "RotateAngle", true )
- ? (sal_uInt16)( ( *static_cast<sal_Int32 const *>(aAny.getValue()) ) + 5 ) / 10
+ ? (sal_uInt16)( ( *o3tl::doAccess<sal_Int32>(aAny) ) + 5 ) / 10
: 0;
}
@@ -1791,8 +1792,8 @@ tools::PolyPolygon EscherPropertyContainer::GetPolyPolygon( const css::uno::Any&
if ( rAny.getValueType() == cppu::UnoType<css::drawing::PolyPolygonBezierCoords>::get())
{
- css::drawing::PolyPolygonBezierCoords const * pSourcePolyPolygon
- = static_cast<css::drawing::PolyPolygonBezierCoords const *>(rAny.getValue());
+ auto pSourcePolyPolygon
+ = o3tl::doAccess<css::drawing::PolyPolygonBezierCoords>(rAny);
sal_uInt16 nOuterSequenceCount = (sal_uInt16)pSourcePolyPolygon->Coordinates.getLength();
// get pointer of inner sequences
@@ -1838,10 +1839,8 @@ tools::PolyPolygon EscherPropertyContainer::GetPolyPolygon( const css::uno::Any&
}
}
}
- else if ( rAny.getValueType() == cppu::UnoType<css::drawing::PointSequenceSequence>::get() )
+ else if ( auto pSourcePolyPolygon = o3tl::tryAccess<css::drawing::PointSequenceSequence>(rAny) )
{
- css::drawing::PointSequenceSequence const * pSourcePolyPolygon
- = static_cast<css::drawing::PointSequenceSequence const *>(rAny.getValue());
sal_uInt16 nOuterSequenceCount = (sal_uInt16)pSourcePolyPolygon->getLength();
// get pointer to inner sequences
@@ -1876,11 +1875,8 @@ tools::PolyPolygon EscherPropertyContainer::GetPolyPolygon( const css::uno::Any&
}
}
}
- else if ( rAny.getValueType() == cppu::UnoType<css::drawing::PointSequence>::get() )
+ else if ( auto pInnerSequence = o3tl::tryAccess<css::drawing::PointSequence>(rAny) )
{
- css::drawing::PointSequence const * pInnerSequence =
- static_cast<css::drawing::PointSequence const *>(rAny.getValue());
-
bNoError = pInnerSequence != nullptr;
if ( bNoError )
{
@@ -2232,10 +2228,10 @@ bool EscherPropertyContainer::CreateConnectorProperties(
aAny >>= eCt;
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, sEdgeStartPoint ) )
{
- aStartPoint = *static_cast<css::awt::Point const *>(aAny.getValue());
+ aStartPoint = *o3tl::doAccess<css::awt::Point>(aAny);
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, sEdgeEndPoint ) )
{
- aEndPoint = *static_cast<css::awt::Point const *>(aAny.getValue());
+ aEndPoint = *o3tl::doAccess<css::awt::Point>(aAny);
rShapeFlags = SHAPEFLAG_HAVEANCHOR | SHAPEFLAG_HAVESPT | SHAPEFLAG_CONNECTOR;
rGeoRect = css::awt::Rectangle( aStartPoint.X, aStartPoint.Y,
@@ -2348,13 +2344,13 @@ void EscherPropertyContainer::CreateShadowProperties(
{
nShadowFlags |= 2;
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "ShadowColor" ) )
- AddOpt( ESCHER_Prop_shadowColor, ImplGetColor( *static_cast<sal_uInt32 const *>(aAny.getValue()) ) );
+ AddOpt( ESCHER_Prop_shadowColor, ImplGetColor( *o3tl::doAccess<sal_uInt32>(aAny) ) );
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "ShadowXDistance" ) )
- AddOpt( ESCHER_Prop_shadowOffsetX, *static_cast<sal_Int32 const *>(aAny.getValue()) * 360 );
+ AddOpt( ESCHER_Prop_shadowOffsetX, *o3tl::doAccess<sal_Int32>(aAny) * 360 );
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "ShadowYDistance" ) )
- AddOpt( ESCHER_Prop_shadowOffsetY, *static_cast<sal_Int32 const *>(aAny.getValue()) * 360 );
+ AddOpt( ESCHER_Prop_shadowOffsetY, *o3tl::doAccess<sal_Int32>(aAny) * 360 );
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "ShadowTransparence" ) )
- AddOpt( ESCHER_Prop_shadowOpacity, 0x10000 - (((sal_uInt32)*static_cast<sal_uInt16 const *>(aAny.getValue())) * 655 ) );
+ AddOpt( ESCHER_Prop_shadowOpacity, 0x10000 - (((sal_uInt32)*o3tl::doAccess<sal_uInt16>(aAny)) * 655 ) );
}
}
}
@@ -2971,7 +2967,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
uno::Any aFillColor2;
if ( EscherPropertyValueHelper::GetPropertyValue( aFillColor2, aXPropSet, "FillColor2", true ) )
{
- sal_uInt32 nFillColor = ImplGetColor( *static_cast<sal_uInt32 const *>(aFillColor2.getValue()) );
+ sal_uInt32 nFillColor = ImplGetColor( *o3tl::doAccess<sal_uInt32>(aFillColor2) );
AddOpt( DFF_Prop_c3DExtrusionColor, nFillColor );
}
}
@@ -4529,8 +4525,8 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst )
{
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aPropertySet, "PolyPolygon" ) )
{
- css::drawing::PointSequenceSequence const * pSourcePolyPolygon =
- static_cast<css::drawing::PointSequenceSequence const *>(aAny.getValue());
+ auto pSourcePolyPolygon =
+ o3tl::doAccess<css::drawing::PointSequenceSequence>(aAny);
sal_Int32 nOuterSequenceCount = pSourcePolyPolygon->getLength();
css::drawing::PointSequence const * pOuterSequence = pSourcePolyPolygon->getConstArray();
@@ -4571,8 +4567,8 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst )
{
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aPropertySet2, "PolyPolygonBezier" ) )
{
- css::drawing::PolyPolygonBezierCoords const * pSourcePolyPolygon =
- static_cast<css::drawing::PolyPolygonBezierCoords const *>(aAny.getValue());
+ auto pSourcePolyPolygon =
+ o3tl::doAccess<css::drawing::PolyPolygonBezierCoords>(aAny);
sal_Int32 nOuterSequenceCount = pSourcePolyPolygon->Coordinates.getLength();
// Zeiger auf innere sequences holen
@@ -4715,7 +4711,7 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst )
aPoly[ 3 ] = Point( aRect.Right(), aCenter.Y() );
sal_Int32 nAngle = ( EscherPropertyValueHelper::GetPropertyValue( aAny, aPropertySet, "RotateAngle", true ) )
- ? *static_cast<sal_Int32 const *>(aAny.getValue()) : 0;
+ ? *o3tl::doAccess<sal_Int32>(aAny) : 0;
if ( nAngle )
aPoly.Rotate( aRect.TopLeft(), (sal_uInt16)( ( nAngle + 5 ) / 10 ) );
nRule = GetClosestPoint( aPoly, aRefPoint );
diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx
index 4d2a309..1cbb28a8 100644
--- a/filter/source/msfilter/eschesdo.cxx
+++ b/filter/source/msfilter/eschesdo.cxx
@@ -18,6 +18,7 @@
*/
#include "eschesdo.hxx"
+#include <o3tl/any.hxx>
#include <svx/svdobj.hxx>
#include <svx/unoapi.hxx>
#include <svx/svdoashp.hxx>
@@ -211,8 +212,8 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
for( sal_uInt32 n = 0, nCnt = xXIndexAccess->getCount();
n < nCnt; ++n )
{
- ImplEESdrObject aObj( *this, *static_cast<Reference< XShape > const *>(
- xXIndexAccess->getByIndex( n ).getValue()) );
+ ImplEESdrObject aObj( *this, *o3tl::doAccess<Reference<XShape>>(
+ xXIndexAccess->getByIndex( n )) );
if( aObj.IsValid() )
{
aObj.SetOOXML(bOOxmlExport);
@@ -332,7 +333,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
PolyStyle ePolyKind = PolyStyle();
if ( rObj.ImplGetPropertyValue( OUString( "CircleKind" ) ) )
{
- eCircleKind = *( static_cast<CircleKind const *>(rObj.GetUsrAny().getValue()) );
+ eCircleKind = *o3tl::doAccess<CircleKind>(rObj.GetUsrAny());
switch ( eCircleKind )
{
case CircleKind_SECTION :
@@ -367,10 +368,10 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
sal_Int32 nStartAngle, nEndAngle;
if ( !rObj.ImplGetPropertyValue( OUString( "CircleStartAngle" ) ) )
break;
- nStartAngle = *( static_cast<sal_Int32 const *>(rObj.GetUsrAny().getValue()) );
+ nStartAngle = *o3tl::doAccess<sal_Int32>(rObj.GetUsrAny());
if( !rObj.ImplGetPropertyValue( OUString( "CircleEndAngle" ) ) )
break;
- nEndAngle = *( static_cast<sal_Int32 const *>(rObj.GetUsrAny().getValue()) );
+ nEndAngle = *o3tl::doAccess<sal_Int32>(rObj.GetUsrAny());
Point aStart, aEnd, aCenter;
aStart.X() = (sal_Int32)( ( cos( (double)( nStartAngle *
@@ -653,7 +654,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
if( USHRT_MAX != mpEscherEx->GetHellLayerId() &&
rObj.ImplGetPropertyValue( OUString( "LayerID" ) ) &&
- (*static_cast<sal_uInt16 const *>(rObj.GetUsrAny().getValue()) ) == mpEscherEx->GetHellLayerId() )
+ *o3tl::doAccess<sal_uInt16>(rObj.GetUsrAny()) == mpEscherEx->GetHellLayerId() )
{
aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x200020 );
}
@@ -838,8 +839,8 @@ void ImplEESdrWriter::ImplWritePage(
mXStatusIndicator->setValue( nValue );
}
- ImplEESdrObject aObj( *this, *static_cast<Reference< XShape > const *>(
- mXShapes->getByIndex( n ).getValue()) );
+ ImplEESdrObject aObj( *this, *o3tl::doAccess<Reference<XShape>>(
+ mXShapes->getByIndex( n )) );
if( aObj.IsValid() )
{
ImplWriteShape( aObj, rSolverContainer );
diff --git a/filter/source/msfilter/eschesdo.hxx b/filter/source/msfilter/eschesdo.hxx
index 448df68..13e37ed 100644
--- a/filter/source/msfilter/eschesdo.hxx
+++ b/filter/source/msfilter/eschesdo.hxx
@@ -19,6 +19,7 @@
#ifndef INCLUDED_FILTER_SOURCE_MSFILTER_ESCHESDO_HXX
#define INCLUDED_FILTER_SOURCE_MSFILTER_ESCHESDO_HXX
#include <filter/msfilter/escherex.hxx>
+#include <o3tl/any.hxx>
#include <svx/unopage.hxx>
#include <vcl/mapmod.hxx>
@@ -57,7 +58,7 @@ public:
bool ImplGetPropertyValue( const OUString& rString ) { return ImplGetPropertyValue(rString.getStr()); }
sal_Int32 ImplGetInt32PropertyValue( const sal_Unicode* pStr )
- { return ImplGetPropertyValue( pStr ) ? *static_cast<sal_Int32 const *>(mAny.getValue()) : 0; }
+ { return ImplGetPropertyValue( pStr ) ? *o3tl::doAccess<sal_Int32>(mAny) : 0; }
sal_Int32 ImplGetInt32PropertyValue( const OUString& rStr )
{ return ImplGetInt32PropertyValue(rStr.getStr()); }
diff --git a/filter/source/xsltfilter/OleHandler.cxx b/filter/source/xsltfilter/OleHandler.cxx
index d79cd01..6564d2e 100644
--- a/filter/source/xsltfilter/OleHandler.cxx
+++ b/filter/source/xsltfilter/OleHandler.cxx
@@ -102,7 +102,7 @@ namespace XSLT
return "Not Found:";// + streamName;
}
;
- Reference<XInputStream> subStream(*static_cast<Reference< XInterface > const *>(m_storage->getByName(streamName).getValue()), UNO_QUERY);
+ Reference<XInputStream> subStream(m_storage->getByName(streamName), UNO_QUERY);
if (!subStream.is())
{
return "Not Found:";// + streamName;
commit 9741e7a437da478ceb05a6122ee3e4a111d60d18
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jun 10 18:55:13 2016 +0200
Clean up uses of Any::getValue() in forms
Change-Id: I335aabc92ecb5de107dad3ecdfa6e025ec0d1b0f
diff --git a/forms/source/component/Button.cxx b/forms/source/component/Button.cxx
index e49b950..603bf3a 100644
--- a/forms/source/component/Button.cxx
+++ b/forms/source/component/Button.cxx
@@ -25,6 +25,7 @@
#include <comphelper/streamsection.hxx>
#include <comphelper/basicio.hxx>
#include <comphelper/processfactory.hxx>
+#include <o3tl/any.hxx>
#include <tools/diagnose_ex.h>
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
@@ -445,7 +446,7 @@ IMPL_LINK_NOARG_TYPED(OButtonControl, OnClick, void*, void)
if (!xSet.is())
return;
- if (FormButtonType_PUSH == *static_cast<FormButtonType const *>(xSet->getPropertyValue(PROPERTY_BUTTONTYPE).getValue()))
+ if (FormButtonType_PUSH == *o3tl::doAccess<FormButtonType>(xSet->getPropertyValue(PROPERTY_BUTTONTYPE)))
{
// notify the action listeners for a push button
::comphelper::OInterfaceIteratorHelper2 aIter(m_aActionListeners);
diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx
index fd7b2c7..431501c 100644
--- a/forms/source/component/FormComponent.cxx
+++ b/forms/source/component/FormComponent.cxx
@@ -844,12 +844,7 @@ PropertyState OControlModel::getPropertyStateByHandle( sal_Int32 _nHandle )
Any aCurrentValue = getPropertyDefaultByHandle( _nHandle );
Any aDefaultValue; getFastPropertyValue( aDefaultValue, _nHandle );
- bool bEqual = uno_type_equalData(
- const_cast< void* >( aCurrentValue.getValue() ), aCurrentValue.getValueType().getTypeLibType(),
- const_cast< void* >( aDefaultValue.getValue() ), aDefaultValue.getValueType().getTypeLibType(),
- reinterpret_cast< uno_QueryInterfaceFunc >(cpp_queryInterface),
- reinterpret_cast< uno_ReleaseFunc >(cpp_release)
- );
+ bool bEqual = aCurrentValue == aDefaultValue;
return bEqual ? PropertyState_DEFAULT_VALUE : PropertyState_DIRECT_VALUE;
}
diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx
index c027352..56cb7eb 100644
--- a/forms/source/component/FormattedField.cxx
+++ b/forms/source/component/FormattedField.cxx
@@ -27,6 +27,7 @@
#include <comphelper/numbers.hxx>
#include <connectivity/dbtools.hxx>
#include <connectivity/dbconversion.hxx>
+#include <o3tl/any.hxx>
#include <svl/zforlist.hxx>
#include <svl/numuno.hxx>
#include <vcl/svapp.hxx>
@@ -683,9 +684,8 @@ void OFormattedModel::write(const Reference<XObjectOutputStream>& _rxOutStream)
{
Any aLocale = xFormat->getPropertyValue(s_aLocaleProp);
DBG_ASSERT(aLocale.has<Locale>(), "OFormattedModel::write : invalid language property !");
- if (aLocale.has<Locale>())
+ if (auto pLocale = o3tl::tryAccess<Locale>(aLocale))
{
- Locale const * pLocale = static_cast<Locale const *>(aLocale.getValue());
eFormatLanguage = LanguageTag::convertToLanguageType( *pLocale, false);
}
}
diff --git a/forms/source/component/Grid.cxx b/forms/source/component/Grid.cxx
index 45b046b..9433424 100644
--- a/forms/source/component/Grid.cxx
+++ b/forms/source/component/Grid.cxx
@@ -521,7 +521,7 @@ sal_Bool OGridControlModel::convertFastPropertyValue( Any& rConvertedValue, Any&
}
rOldValue = m_aCursorColor;
rConvertedValue = rValue;
- bModified = (rOldValue.getValue() != rConvertedValue.getValue());
+ bModified = rOldValue != rConvertedValue;
}
else
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, getINT32(m_aCursorColor));
diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx
index 6b3f1b4..006a2be 100644
--- a/forms/source/component/ListBox.cxx
+++ b/forms/source/component/ListBox.cxx
@@ -49,6 +49,7 @@
#include <connectivity/formattedcolumnvalue.hxx>
#include <connectivity/dbconversion.hxx>
#include <cppuhelper/queryinterface.hxx>
+#include <o3tl/any.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
#include <unotools/sharedunocomponent.hxx>
@@ -1886,8 +1887,8 @@ namespace frm
bool bModified(false);
Any aValue = xSet->getPropertyValue(PROPERTY_SELECT_SEQ);
- Sequence<sal_Int16> const & rSelection = *static_cast<Sequence<sal_Int16> const *>(aValue.getValue());
- Sequence<sal_Int16> const & rOldSelection = *static_cast<Sequence<sal_Int16> const *>(m_aCurrentSelection.getValue());
+ Sequence<sal_Int16> const & rSelection = *o3tl::doAccess<Sequence<sal_Int16>>(aValue);
+ Sequence<sal_Int16> const & rOldSelection = *o3tl::doAccess<Sequence<sal_Int16>>(m_aCurrentSelection);
sal_Int32 nLen = rSelection.getLength();
if (nLen != rOldSelection.getLength())
bModified = true;
diff --git a/forms/source/component/RadioButton.cxx b/forms/source/component/RadioButton.cxx
index 567eb5c..6192383 100644
--- a/forms/source/component/RadioButton.cxx
+++ b/forms/source/component/RadioButton.cxx
@@ -154,7 +154,7 @@ void ORadioButtonModel::SetSiblingPropsTo(const OUString& rPropName, const Any&
sal_Int32 nNumSiblings = xIndexAccess->getCount();
for (sal_Int32 i=0; i<nNumSiblings; ++i)
{
- Reference<XPropertySet> xSiblingProperties(*static_cast<css::uno::Reference<css::uno::XInterface> const *>(xIndexAccess->getByIndex(i).getValue()), UNO_QUERY);
+ Reference<XPropertySet> xSiblingProperties(xIndexAccess->getByIndex(i), UNO_QUERY);
if (!xSiblingProperties.is())
continue;
if (xMyProps == xSiblingProperties)
@@ -229,7 +229,7 @@ void ORadioButtonModel::setControlSource()
static_cast<XWeak*>(this), css::uno::UNO_QUERY);
for (sal_Int32 i=0; i<xIndexAccess->getCount(); ++i)
{
- Reference<XPropertySet> xSiblingProperties(*static_cast<css::uno::Reference<css::uno::XInterface> const *>(xIndexAccess->getByIndex(i).getValue()), UNO_QUERY);
+ Reference<XPropertySet> xSiblingProperties(xIndexAccess->getByIndex(i), UNO_QUERY);
if (!xSiblingProperties.is())
continue;
commit 7bf2f61ac786e969e33693647b1365aca3b2731c
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jun 10 18:55:07 2016 +0200
Clean up uses of Any::getValue() in framework
Change-Id: I55982944bf2ee3d9aa6899bcc59e94f9342b4036
diff --git a/framework/source/recording/dispatchrecorder.cxx b/framework/source/recording/dispatchrecorder.cxx
index c1bf646..b4298ed 100644
--- a/framework/source/recording/dispatchrecorder.cxx
+++ b/framework/source/recording/dispatchrecorder.cxx
@@ -20,6 +20,7 @@
#include <recording/dispatchrecorder.hxx>
#include <com/sun/star/frame/DispatchStatement.hpp>
#include <com/sun/star/script/Converter.hpp>
+#include <o3tl/any.hxx>
#include <services.h>
#include <vcl/svapp.hxx>
#include <comphelper/processfactory.hxx>
@@ -251,15 +252,14 @@ void SAL_CALL DispatchRecorder::AppendToBuffer( const css::uno::Any& aValue, OUS
else
aArgumentBuffer.append("\"\"");
}
- else if (aValue.getValueType() == cppu::UnoType<cppu::UnoCharType>::get())
+ else if (auto nVal = o3tl::tryAccess<sal_Unicode>(aValue))
{
// character variables are recorded as strings, back conversion must be handled in client code
- sal_Unicode nVal = *static_cast<sal_Unicode const *>(aValue.getValue());
aArgumentBuffer.append("\"");
- if ( (sal_Unicode(nVal) == '\"') )
+ if ( (*nVal == '\"') )
// encode \" to \"\"
- aArgumentBuffer.append((sal_Unicode)nVal);
- aArgumentBuffer.append((sal_Unicode)nVal);
+ aArgumentBuffer.append(*nVal);
+ aArgumentBuffer.append(*nVal);
aArgumentBuffer.append("\"");
}
else
@@ -416,9 +416,7 @@ void SAL_CALL DispatchRecorder::replaceByIndex(sal_Int32 idx, const css::uno::An
}
- css::frame::DispatchStatement const *pStatement;
-
- pStatement = static_cast<css::frame::DispatchStatement const *>(element.getValue());
+ auto pStatement = o3tl::doAccess<css::frame::DispatchStatement>(element);
css::frame::DispatchStatement aStatement(
pStatement->aCommand,
commit 0def3a7dc4c0eacd95eeba71af71eface4f42260
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jun 10 18:55:01 2016 +0200
Clean up uses of Any::getValue() in oox
Change-Id: I76d83ad472eb0cd44b593a86dac1f8c1ee8c3585
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index d179616..99ce23f 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <o3tl/any.hxx>
#include <unotools/mediadescriptor.hxx>
#include <unotools/docinfohelper.hxx>
#include <sax/fshelper.hxx>
@@ -762,8 +763,7 @@ writeCustomProperties( XmlFilterBase& rSelf, const Reference< XDocumentPropertie
break;
case TypeClass_BOOLEAN:
{
- bool val ;
- val = *static_cast<sal_Bool const *>(( aprop[n].Value ).getValue());
+ bool val = *o3tl::forceAccess<bool>(aprop[n].Value);
writeElement( pAppProps, FSNS( XML_vt, XML_bool ), val ? 1 : 0);
}
break;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index c9566bf..ec29c9e 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -67,6 +67,7 @@
#include <com/sun/star/text/XTextField.hpp>
#include <com/sun/star/text/XTextRange.hpp>
#include <com/sun/star/style/CaseMap.hpp>
+#include <o3tl/any.hxx>
#include <tools/stream.hxx>
#include <unotools/fontdefs.hxx>
#include <vcl/cvtgrf.hxx>
@@ -350,7 +351,7 @@ void DrawingML::WriteGradientFill( const Reference< XPropertySet >& rXPropSet )
awt::Gradient aGradient;
if( GETA( FillGradient ) )
{
- aGradient = *static_cast< const awt::Gradient* >( mAny.getValue() );
+ aGradient = *o3tl::doAccess<awt::Gradient>(mAny);
// get InteropGrabBag and search the relevant attributes
awt::Gradient aOriginalGradient;
@@ -1220,10 +1221,10 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
sal_Int32 nCharKerning = 0;
if( GETA( CharHeight ) )
- nSize = (sal_Int32) (100*(*static_cast<float const *>(mAny.getValue())));
+ nSize = (sal_Int32) (100*(*o3tl::doAccess<float>(mAny)));
if( GETA( CharKerning ) )
- nCharKerning = (sal_Int32)(*static_cast<short const *>(mAny.getValue()));
+ nCharKerning = (sal_Int32)(*o3tl::doAccess<sal_Int16>(mAny));
/** While setting values in propertymap,
* CharKerning converted using GetTextSpacingPoint
* i.e set @ http://opengrok.libreoffice.org/xref/core/oox/source/drawingml/textcharacterproperties.cxx#129
@@ -1234,12 +1235,12 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
if ( ( bComplex && GETA( CharWeightComplex ) ) || GETA( CharWeight ) )
{
- if ( *static_cast<float const *>(mAny.getValue()) >= awt::FontWeight::SEMIBOLD )
+ if ( *o3tl::doAccess<float>(mAny) >= awt::FontWeight::SEMIBOLD )
bold = "1";
}
if ( ( bComplex && GETA( CharPostureComplex ) ) || GETA( CharPosture ) )
- switch ( *static_cast<awt::FontSlant const *>(mAny.getValue()) )
+ switch ( *o3tl::doAccess<awt::FontSlant>(mAny) )
{
case awt::FontSlant_OBLIQUE :
case awt::FontSlant_ITALIC :
@@ -1251,7 +1252,7 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
if ( CGETAD( CharUnderline ) )
{
- switch ( *static_cast<sal_Int16 const *>(mAny.getValue()) )
+ switch ( *o3tl::doAccess<sal_Int16>(mAny) )
{
case awt::FontUnderline::SINGLE :
underline = "sng";
@@ -1306,7 +1307,7 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
if ( CGETAD( CharStrikeout ) )
{
- switch ( *static_cast<sal_Int16 const *>(mAny.getValue()) )
+ switch ( *o3tl::doAccess<sal_Int16>(mAny) )
{
case awt::FontStrikeout::NONE :
strikeout = "noStrike";
@@ -1353,7 +1354,7 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
if( GETA( CharCaseMap ) )
{
- switch ( *static_cast<sal_Int16 const *>(mAny.getValue()) )
+ switch ( *o3tl::doAccess<sal_Int16>(mAny) )
{
case CaseMap::UPPERCASE :
cap = "all";
@@ -1380,7 +1381,7 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
// mso doesn't like text color to be placed after typeface
if( CGETAD( CharColor ) )
{
- sal_uInt32 color = *static_cast<sal_uInt32 const *>(mAny.getValue());
+ sal_uInt32 color = *o3tl::doAccess<sal_uInt32>(mAny);
SAL_INFO("oox.shape", "run color: " << color << " auto: " << COL_AUTO);
if( color == COL_AUTO ) // nCharColor depends to the background color
@@ -1396,7 +1397,7 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
if( CGETAD( CharUnderlineColor ) )
{
- sal_uInt32 color = *static_cast<sal_uInt32 const *>(mAny.getValue());
+ sal_uInt32 color = *o3tl::doAccess<sal_uInt32>(mAny);
mpFS->startElementNS( XML_a, XML_uFill,FSEND);
WriteSolidFill( color );
@@ -1470,7 +1471,7 @@ OUString DrawingML::GetFieldValue( const css::uno::Reference< css::text::XTextRa
if( GETA( TextPortionType ) )
{
- aFieldType = OUString( *static_cast<OUString const *>(mAny.getValue()) );
+ aFieldType = *o3tl::doAccess<OUString>(mAny);
SAL_INFO("oox.shape", "field type: " << aFieldType);
}
@@ -1719,73 +1720,68 @@ void DrawingML::WriteParagraphNumbering( const Reference< XPropertySet >& rXProp
for ( sal_Int32 i = 0; i < nPropertyCount; i++ )
{
- const void* pValue = pPropValue[ i ].Value.getValue();
- if ( pValue )
+ OUString aPropName( pPropValue[ i ].Name );
+ SAL_INFO("oox.shape", "pro name: " << aPropName);
+ if ( aPropName == "NumberingType" )
{
- OUString aPropName( pPropValue[ i ].Name );
- SAL_INFO("oox.shape", "pro name: " << aPropName);
- if ( aPropName == "NumberingType" )
- {
- nNumberingType = *( static_cast<sal_Int16 const *>(pValue) );
- }
- else if ( aPropName == "Prefix" )
- {
- if( *static_cast<OUString const *>(pValue) == ")")
- bPBoth = true;
- }
- else if ( aPropName == "Suffix" )
- {
- if( *static_cast<OUString const *>(pValue) == ".")
- bSDot = true;
- else if( *static_cast<OUString const *>(pValue) == ")")
- bPBehind = true;
- }
- else if(aPropName == "BulletColor")
- {
- nBulletColor = *static_cast<sal_uInt32 const *>(pValue);
- bHasBulletColor = true;
- }
- else if ( aPropName == "BulletChar" )
- {
- aBulletChar = OUString ( *( static_cast<OUString const *>(pValue) ) )[ 0 ];
- }
- else if ( aPropName == "BulletFont" )
- {
- aFontDesc = *static_cast<awt::FontDescriptor const *>(pValue);
- bHasFontDesc = true;
+ nNumberingType = *o3tl::doAccess<sal_Int16>(pPropValue[i].Value);
+ }
+ else if ( aPropName == "Prefix" )
+ {
+ if( *o3tl::doAccess<OUString>(pPropValue[i].Value) == ")")
+ bPBoth = true;
+ }
+ else if ( aPropName == "Suffix" )
+ {
+ auto s = o3tl::doAccess<OUString>(pPropValue[i].Value);
+ if( *s == ".")
+ bSDot = true;
+ else if( *s == ")")
+ bPBehind = true;
+ }
+ else if(aPropName == "BulletColor")
+ {
+ nBulletColor = *o3tl::doAccess<sal_uInt32>(pPropValue[i].Value);
+ bHasBulletColor = true;
+ }
+ else if ( aPropName == "BulletChar" )
+ {
+ aBulletChar = (*o3tl::doAccess<OUString>(pPropValue[i].Value))[ 0 ];
+ }
+ else if ( aPropName == "BulletFont" )
+ {
+ aFontDesc = *o3tl::doAccess<awt::FontDescriptor>(pPropValue[i].Value);
+ bHasFontDesc = true;
- // Our numbullet dialog has set the wrong textencoding for our "StarSymbol" font,
- // instead of a Unicode encoding the encoding RTL_TEXTENCODING_SYMBOL was used.
- // Because there might exist a lot of damaged documemts I added this two lines
- // which fixes the bullet problem for the export.
- if ( aFontDesc.Name.equalsIgnoreAsciiCase("StarSymbol") )
- aFontDesc.CharSet = RTL_TEXTENCODING_MS_1252;
+ // Our numbullet dialog has set the wrong textencoding for our "StarSymbol" font,
+ // instead of a Unicode encoding the encoding RTL_TEXTENCODING_SYMBOL was used.
+ // Because there might exist a lot of damaged documemts I added this two lines
+ // which fixes the bullet problem for the export.
+ if ( aFontDesc.Name.equalsIgnoreAsciiCase("StarSymbol") )
+ aFontDesc.CharSet = RTL_TEXTENCODING_MS_1252;
- }
- else if ( aPropName == "BulletRelSize" )
- {
- nBulletRelSize = *static_cast<sal_Int16 const *>(pValue);
- }
- else if ( aPropName == "StartWith" )
- {
- nStartWith = *static_cast<sal_Int16 const *>(pValue);
- }
- else if ( aPropName == "GraphicURL" )
- {
- aGraphicURL = *static_cast<OUString const *>(pValue);
- SAL_INFO("oox.shape", "graphic url: " << aGraphicURL);
- }
- else if ( aPropName == "GraphicSize" )
+ }
+ else if ( aPropName == "BulletRelSize" )
+ {
+ nBulletRelSize = *o3tl::doAccess<sal_Int16>(pPropValue[i].Value);
+ }
+ else if ( aPropName == "StartWith" )
+ {
+ nStartWith = *o3tl::doAccess<sal_Int16>(pPropValue[i].Value);
+ }
+ else if ( aPropName == "GraphicURL" )
+ {
+ aGraphicURL = *o3tl::doAccess<OUString>(pPropValue[i].Value);
+ SAL_INFO("oox.shape", "graphic url: " << aGraphicURL);
+ }
+ else if ( aPropName == "GraphicSize" )
+ {
+ if (auto aSize = o3tl::tryAccess<awt::Size>(pPropValue[i].Value))
{
- if ( pPropValue[ i ].Value.getValueType() == cppu::UnoType<awt::Size>::get())
- {
- // don't cast awt::Size to Size as on 64-bits they are not the same.
- css::awt::Size aSize;
- pPropValue[ i ].Value >>= aSize;
- //aBuGraSize.nA = aSize.Width;
- //aBuGraSize.nB = aSize.Height;
- SAL_INFO("oox.shape", "graphic size: " << aSize.Width << "x" << aSize.Height);
- }
+ // don't cast awt::Size to Size as on 64-bits they are not the same.
+ //aBuGraSize.nA = aSize.Width;
+ //aBuGraSize.nB = aSize.Height;
+ SAL_INFO("oox.shape", "graphic size: " << aSize->Width << "x" << aSize->Height);
}
}
}
@@ -1867,14 +1863,10 @@ sal_Int32 DrawingML::getBulletMarginIndentation (const Reference< XPropertySet >
for ( sal_Int32 i = 0; i < nPropertyCount; i++ )
{
- const void* pValue = pPropValue[ i ].Value.getValue();
- if ( pValue )
- {
- OUString aPropName( pPropValue[ i ].Name );
- SAL_INFO("oox.shape", "pro name: " << aPropName);
- if ( aPropName == propName )
- return *( static_cast<sal_Int32 const *>(pValue) );
- }
+ OUString aPropName( pPropValue[ i ].Name );
+ SAL_INFO("oox.shape", "pro name: " << aPropName);
+ if ( aPropName == propName )
+ return *o3tl::doAccess<sal_Int32>(pPropValue[i].Value);
}
return 0;
@@ -2298,8 +2290,7 @@ void DrawingML::WriteCustomGeometry( const Reference< XShape >& rXShape )
}
- uno::Sequence< beans::PropertyValue > const * pGeometrySeq =
- static_cast<uno::Sequence< beans::PropertyValue > const *>(aAny.getValue());
+ auto pGeometrySeq = o3tl::tryAccess<uno::Sequence<beans::PropertyValue>>(aAny);
if ( pGeometrySeq )
{
commit c97c898f65196292e7084bcad696c666adb9149f
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jun 10 18:54:57 2016 +0200
Clean up uses of Any::getValue() in sc
Change-Id: Ic272f616533021ee2148adaf28eed68301aa4602
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index eb6052c..498c11c 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -24,6 +24,7 @@
#include <unordered_set>
#include <vector>
+#include <o3tl/any.hxx>
#include <rtl/math.hxx>
#include <svl/itemprop.hxx>
#include <svl/intitem.hxx>
@@ -85,9 +86,8 @@ SC_SIMPLE_SERVICE_INFO( ScDPMember, "ScDPMember", "com.sun.star.sheet.
//TODO: move to a header?
static bool lcl_GetBoolFromAny( const uno::Any& aAny )
{
- if ( aAny.getValueTypeClass() == uno::TypeClass_BOOLEAN )
- return *static_cast<sal_Bool const *>(aAny.getValue());
- return false;
+ auto b = o3tl::tryAccess<bool>(aAny);
+ return b && *b;
}
ScDPSource::ScDPSource( ScDPTableData* pD ) :
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 1d9d462..912a4fd 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -22,6 +22,7 @@
#include "scitems.hxx"
#include <editeng/editview.hxx>
#include <editeng/outliner.hxx>
+#include <o3tl/any.hxx>
#include <svx/fmdpage.hxx>
#include <svx/fmview.hxx>
#include <svx/svditer.hxx>
@@ -1035,11 +1036,10 @@ uno::Sequence<uno::Type> SAL_CALL ScModelObj::getTypes() throw(uno::RuntimeExcep
{
const uno::Type& rProvType = cppu::UnoType<lang::XTypeProvider>::get();
uno::Any aNumProv(xNumberAgg->queryAggregation(rProvType));
- if(aNumProv.getValueType() == rProvType)
+ if(auto xNumProv
+ = o3tl::tryAccess<uno::Reference<lang::XTypeProvider>>(aNumProv))
{
- uno::Reference<lang::XTypeProvider> xNumProv(
- *static_cast<uno::Reference<lang::XTypeProvider> const *>(aNumProv.getValue()));
- aAggTypes = xNumProv->getTypes();
+ aAggTypes = (*xNumProv)->getTypes();
}
}
long nAggLen = aAggTypes.getLength();
@@ -2626,11 +2626,10 @@ sal_Int64 SAL_CALL ScModelObj::getSomething(
{
const uno::Type& rTunnelType = cppu::UnoType<lang::XUnoTunnel>::get();
uno::Any aNumTunnel(xNumberAgg->queryAggregation(rTunnelType));
- if(aNumTunnel.getValueType() == rTunnelType)
+ if(auto xTunnelAgg = o3tl::tryAccess<uno::Reference<lang::XUnoTunnel>>(
+ aNumTunnel))
{
- uno::Reference<lang::XUnoTunnel> xTunnelAgg(
- *static_cast<uno::Reference<lang::XUnoTunnel> const *>(aNumTunnel.getValue()));
- return xTunnelAgg->getSomething( rId );
+ return (*xTunnelAgg)->getSomething( rId );
}
}
diff --git a/sc/source/ui/unoobj/miscuno.cxx b/sc/source/ui/unoobj/miscuno.cxx
index a6256fcf..fb870d5 100644
--- a/sc/source/ui/unoobj/miscuno.cxx
+++ b/sc/source/ui/unoobj/miscuno.cxx
@@ -18,6 +18,7 @@
*/
#include <cppuhelper/supportsservice.hxx>
+#include <o3tl/any.hxx>
#include <vcl/svapp.hxx>
#include "miscuno.hxx"
@@ -45,14 +46,7 @@ bool ScUnoHelpFunctions::GetBoolProperty( const uno::Reference<beans::XPropertyS
{
try
{
- uno::Any aAny(xProp->getPropertyValue( rName ));
- //! type conversion???
- // operator >>= shouldn't be used for bool (?)
- if ( aAny.getValueTypeClass() == uno::TypeClass_BOOLEAN )
- {
- //! safe way to get bool value from any???
- bRet = *static_cast<sal_Bool const *>(aAny.getValue());
- }
+ xProp->getPropertyValue( rName ) >>= bRet;
}
catch(uno::Exception&)
{
@@ -131,9 +125,8 @@ OUString ScUnoHelpFunctions::GetStringProperty(
bool ScUnoHelpFunctions::GetBoolFromAny( const uno::Any& aAny )
{
- if ( aAny.getValueTypeClass() == uno::TypeClass_BOOLEAN )
- return *static_cast<sal_Bool const *>(aAny.getValue());
- return false;
+ auto b = o3tl::tryAccess<bool>(aAny);
+ return b && *b;
}
sal_Int16 ScUnoHelpFunctions::GetInt16FromAny( const uno::Any& aAny )
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index c7ad992..40921ee 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -23,6 +23,7 @@
#include <comphelper/unwrapargs.hxx>
#include <comphelper/processfactory.hxx>
+#include <o3tl/any.hxx>
#include <sfx2/objsh.hxx>
#include <com/sun/star/script/ArrayWrapper.hpp>
@@ -950,7 +951,7 @@ protected:
ValueGetter& mValueGetter;
void processValue( sal_Int32 x, sal_Int32 y, const uno::Any& aValue )
{
- uno::Sequence< uno::Sequence< uno::Any > >& aMatrix = *const_cast<css::uno::Sequence<css::uno::Sequence<css::uno::Any>> *>(static_cast<uno::Sequence< uno::Sequence< uno::Any > > const *>(maValue.getValue()));
+ uno::Sequence< uno::Sequence< uno::Any > >& aMatrix = const_cast<css::uno::Sequence<css::uno::Sequence<css::uno::Any>> &>(*o3tl::doAccess<uno::Sequence<uno::Sequence<uno::Any>>>(maValue));
aMatrix[x][y] = aValue;
}
diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx
index ba6c992..6b97d3b 100644
--- a/sc/source/ui/vba/vbaworkbook.cxx
+++ b/sc/source/ui/vba/vbaworkbook.cxx
@@ -82,7 +82,7 @@ ScVbaWorkbook::ResetColors( ) throw (::script::BasicErrorException, ::uno::Runt
ScVbaWorkbook::Colors( const ::uno::Any& Index ) throw (::script::BasicErrorException, ::uno::RuntimeException, std::exception)
{
uno::Any aRet;
- if ( Index.getValue() )
+ if ( Index.hasValue() )
{
sal_Int32 nIndex = 0;
Index >>= nIndex;
commit a7ce813f4898d99084f2b2929823acc9a2747ad4
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jun 10 18:54:49 2016 +0200
Clean up uses of Any::getValue() in sd
Change-Id: Ie4f165efd14d7cdfc99d600f3ddc000d438e0c6a
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
index 3ac5cfc..27184fd 100644
--- a/sd/source/filter/eppt/eppt.cxx
+++ b/sd/source/filter/eppt/eppt.cxx
@@ -19,6 +19,7 @@
#include <eppt.hxx>
#include "epptdef.hxx"
+#include <o3tl/any.hxx>
#include <tools/globname.hxx>
#include <tools/poly.hxx>
#include <vcl/graph.hxx>
@@ -194,7 +195,7 @@ void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_
aAny >>= bVisible;
if ( GetPropertyValue( aAny, mXPagePropSet, "Change" ) )
{
- switch ( *static_cast<sal_Int32 const *>(aAny.getValue()) )
+ switch ( *o3tl::doAccess<sal_Int32>(aAny) )
{
case 1 : // automatic
mnDiaMode++;
@@ -272,7 +273,7 @@ void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_
nBuildFlags |= 256;
if ( GetPropertyValue( aAny, mXPagePropSet, "Duration" ) )// duration of this slide
- nSlideTime = *static_cast<sal_Int32 const *>(aAny.getValue()) << 10; // in ticks
+ nSlideTime = *o3tl::doAccess<sal_Int32>(aAny) << 10; // in ticks
mpPptEscherEx->AddAtom( 16, EPP_SSSlideInfoAtom );
mpStrm->WriteInt32( nSlideTime ) // standtime in ticks
@@ -532,8 +533,7 @@ bool PPTWriter::ImplCreateDocumentSummaryInformation()
uno::Sequence<sal_Int8> aThumbSeq;
if ( GetPageByIndex( 0, NORMAL ) && ImplGetPropertyValue( mXPagePropSet, "PreviewBitmap" ) )
{
- aThumbSeq =
- *static_cast<const uno::Sequence<sal_Int8>*>(mAny.getValue());
+ aThumbSeq = *o3tl::doAccess<uno::Sequence<sal_Int8>>(mAny);
}
sfx2::SaveOlePropertySet( xDocProps, mrStg,
&aThumbSeq, &aGuidSeq, &aHyperSeq);
@@ -621,7 +621,7 @@ void PPTWriter::ImplCreateHeaderFooters( css::uno::Reference< css::beans::XPrope
}
if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, "DateTimeFormat", true ) )
{
- sal_Int32 nFormat = *static_cast<sal_Int32 const *>(aAny.getValue());
+ sal_Int32 nFormat = *o3tl::doAccess<sal_Int32>(aAny);
SvxDateFormat eDateFormat = (SvxDateFormat)( nFormat & 0xf );
SvxTimeFormat eTimeFormat = (SvxTimeFormat)( ( nFormat >> 4 ) & 0xf );
switch( eDateFormat )
@@ -782,7 +782,7 @@ bool PPTWriter::ImplCreateDocument()
if ( ImplGetPropertyValue( "CustomShow" ) )
{
- aCustomShow = *static_cast<OUString const *>(mAny.getValue());
+ aCustomShow = *o3tl::doAccess<OUString>(mAny);
if ( !aCustomShow.isEmpty() )
{
nFlags |= 8;
@@ -792,10 +792,10 @@ bool PPTWriter::ImplCreateDocument()
{
if ( ImplGetPropertyValue( "FirstPage" ) )
{
- OUString aSlideName( *static_cast<OUString const *>(mAny.getValue()) );
+ auto aSlideName = o3tl::doAccess<OUString>(mAny);
std::vector<OUString>::const_iterator pIter = std::find(
- maSlideNameList.begin(),maSlideNameList.end(),aSlideName);
+ maSlideNameList.begin(),maSlideNameList.end(), *aSlideName);
if (pIter != maSlideNameList.end())
{
@@ -872,41 +872,34 @@ bool PPTWriter::ImplCreateDocument()
const sal_Unicode* pCustomShowName = pUString[ i ].getStr();
for ( sal_uInt32 k = 0; k < nNamedShowLen; mpStrm->WriteUInt16( pCustomShowName[ k++ ] ) ) ;
mAny = aXCont->getByName( pUString[ i ] );
- if ( mAny.getValue() )
+ css::uno::Reference< css::container::XIndexContainer > aXIC;
+ if ( mAny >>= aXIC )
{
+ mpPptEscherEx->BeginAtom();
- css::uno::Reference< css::container::XIndexContainer > aXIC;
- if ( mAny >>= aXIC )
+ sal_Int32 nSlideCount = aXIC->getCount();
+ for ( sal_Int32 j = 0; j < nSlideCount; j++ ) // number of slides
{
- mpPptEscherEx->BeginAtom();
-
- sal_Int32 nSlideCount = aXIC->getCount();
- for ( sal_Int32 j = 0; j < nSlideCount; j++ ) // number of slides
+ mAny = aXIC->getByIndex( j );
+ css::uno::Reference< css::drawing::XDrawPage > aXDrawPage;
+ if ( mAny >>= aXDrawPage )
{
- mAny = aXIC->getByIndex( j );
- if ( mAny.getValue() )
+ css::uno::Reference< css::container::XNamed > aXName( aXDrawPage, css::uno::UNO_QUERY );
+ if ( aXName.is() )
{
- css::uno::Reference< css::drawing::XDrawPage > aXDrawPage;
- if ( mAny >>= aXDrawPage )
+ OUString aSlideName( aXName->getName() );
+ std::vector<OUString>::const_iterator pIter = std::find(
+ maSlideNameList.begin(),maSlideNameList.end(),aSlideName);
+
+ if (pIter != maSlideNameList.end())
{
- css::uno::Reference< css::container::XNamed > aXName( aXDrawPage, css::uno::UNO_QUERY );
- if ( aXName.is() )
- {
- OUString aSlideName( aXName->getName() );
- std::vector<OUString>::const_iterator pIter = std::find(
- maSlideNameList.begin(),maSlideNameList.end(),aSlideName);
-
- if (pIter != maSlideNameList.end())
- {
- sal_uInt32 nPageNumber = pIter - maSlideNameList.begin();
- mpStrm->WriteUInt32( nPageNumber + 0x100 ); // unique slide id
- }
- }
+ sal_uInt32 nPageNumber = pIter - maSlideNameList.begin();
+ mpStrm->WriteUInt32( nPageNumber + 0x100 ); // unique slide id
}
}
}
- mpPptEscherEx->EndAtom( EPP_NamedShowSlides );
}
+ mpPptEscherEx->EndAtom( EPP_NamedShowSlides );
}
mpPptEscherEx->CloseContainer(); // EPP_NamedShow
}
@@ -1214,7 +1207,7 @@ void PPTWriter::ImplWriteBackground( css::uno::Reference< css::beans::XPropertyS
{
if ( ImplGetPropertyValue( rXPropSet, "FillColor" ) )
{
- nFillColor = EscherEx::GetColor( *static_cast<sal_uInt32 const *>(mAny.getValue()) );
+ nFillColor = EscherEx::GetColor( *o3tl::doAccess<sal_uInt32>(mAny) );
nFillBackColor = nFillColor ^ 0xffffff;
}
SAL_FALLTHROUGH;
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index b397775..478d89a 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -843,7 +843,7 @@ void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj )
case css::drawing::FillStyle_SOLID :
{
if ( PropValue::GetPropertyValue( aAny, mXPropSet, "FillColor" ) )
- nBackgroundColor = EscherEx::GetColor( *static_cast<sal_uInt32 const *>(aAny.getValue()) );
+ nBackgroundColor = EscherEx::GetColor( *o3tl::doAccess<sal_uInt32>(aAny) );
}
break;
case css::drawing::FillStyle_NONE :
@@ -866,7 +866,7 @@ void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj )
case css::drawing::FillStyle_SOLID :
{
if ( PropValue::GetPropertyValue( aAny, mXBackgroundPropSet, "FillColor" ) )
- nBackgroundColor = EscherEx::GetColor( *static_cast<sal_uInt32 const *>(aAny.getValue()) );
+ nBackgroundColor = EscherEx::GetColor( *o3tl::doAccess<sal_uInt32>(aAny) );
}
break;
default:
@@ -901,7 +901,7 @@ void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj )
if ( PropValue::GetPropertyValue( aAny, aPropSetOfNextShape,
"FillColor", true ) )
{
- if ( nCharColor == EscherEx::GetColor( *static_cast<sal_uInt32 const *>(aAny.getValue()) ) )
+ if ( nCharColor == EscherEx::GetColor( *o3tl::doAccess<sal_uInt32>(aAny) ) )
{
nCharAttr |= 0x200;
}
@@ -1870,7 +1870,7 @@ void PPTWriter::ImplWriteObjectEffect( SvStream& rSt,
{
if ( ImplGetPropertyValue( "Sound" ) )
{
- nSoundRef = maSoundCollection.GetId( *static_cast<OUString const *>(mAny.getValue()) );
+ nSoundRef = maSoundCollection.GetId( *o3tl::doAccess<OUString>(mAny) );
if ( nSoundRef )
nFlags |= 0x10;
}
@@ -1887,7 +1887,7 @@ void PPTWriter::ImplWriteObjectEffect( SvStream& rSt,
if ( bDimHide )
nAfterEffect |= 2;
if ( ImplGetPropertyValue( "DimColor" ) )
- nDimColor = EscherEx::GetColor( *static_cast<sal_uInt32 const *>(mAny.getValue()) ) | 0xfe000000;
+ nDimColor = EscherEx::GetColor( *o3tl::doAccess<sal_uInt32>(mAny) ) | 0xfe000000;
rSt.WriteUInt32( nDimColor ).WriteUInt32( nFlags ).WriteUInt32( nSoundRef ).WriteUInt32( nDelayTime )
.WriteUInt16( basegfx::clamp<sal_Int32>(nOrder, 0, SAL_MAX_UINT16) ) // order of build ( 1.. )
@@ -1956,14 +1956,14 @@ void PPTWriter::ImplWriteClickAction( SvStream& rSt, css::presentation::ClickAct
case css::presentation::ClickAction_SOUND :
{
if ( ImplGetPropertyValue( "Bookmark" ) )
- nSoundRef = maSoundCollection.GetId( *static_cast<OUString const *>(mAny.getValue()) );
+ nSoundRef = maSoundCollection.GetId( *o3tl::doAccess<OUString>(mAny) );
}
break;
case css::presentation::ClickAction_PROGRAM :
{
if ( ImplGetPropertyValue( "Bookmark" ) )
{
- INetURLObject aUrl( *static_cast<OUString const *>(mAny.getValue()) );
+ INetURLObject aUrl( *o3tl::doAccess<OUString>(mAny) );
if ( INetProtocol::File == aUrl.GetProtocol() )
{
aFile = aUrl.PathToFileName();
@@ -1977,7 +1977,7 @@ void PPTWriter::ImplWriteClickAction( SvStream& rSt, css::presentation::ClickAct
{
if ( ImplGetPropertyValue( "Bookmark" ) )
{
- OUString aBookmark( *static_cast<OUString const *>(mAny.getValue()) );
+ OUString aBookmark( *o3tl::doAccess<OUString>(mAny) );
sal_uInt32 nIndex = 0;
std::vector<OUString>::const_iterator pIter;
for ( pIter = maSlideNameList.begin(); pIter != maSlideNameList.end(); ++pIter, nIndex++ )
@@ -2004,7 +2004,7 @@ void PPTWriter::ImplWriteClickAction( SvStream& rSt, css::presentation::ClickAct
{
if ( ImplGetPropertyValue( "Bookmark" ) )
{
- OUString aBookmark( *static_cast<OUString const *>(mAny.getValue()) );
+ OUString aBookmark( *o3tl::doAccess<OUString>(mAny) );
if ( !aBookmark.isEmpty() )
{
nAction = 4;
@@ -2266,9 +2266,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
{
if ( ImplGetPropertyValue( "BoundRect" ) )
{
- css::awt::Rectangle aRect( *static_cast<css::awt::Rectangle const *>(mAny.getValue()) );
- maPosition = MapPoint( css::awt::Point( aRect.X, aRect.Y ) );
- maSize = MapSize( css::awt::Size( aRect.Width, aRect.Height ) );
+ auto aRect = o3tl::doAccess<css::awt::Rectangle>(mAny);
+ maPosition = MapPoint( css::awt::Point( aRect->X, aRect->Y ) );
+ maSize = MapSize( css::awt::Size( aRect->Width, aRect->Height ) );
maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) );
}
mType = "drawing.dontknow";
@@ -2387,10 +2387,10 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
sal_Int32 nStartAngle, nEndAngle;
if ( !ImplGetPropertyValue( "CircleStartAngle" ) )
continue;
- nStartAngle = *static_cast<sal_Int32 const *>(mAny.getValue());
+ nStartAngle = *o3tl::doAccess<sal_Int32>(mAny);
if( !ImplGetPropertyValue( "CircleEndAngle" ) )
continue;
- nEndAngle = *static_cast<sal_Int32 const *>(mAny.getValue());
+ nEndAngle = *o3tl::doAccess<sal_Int32>(mAny);
css::awt::Point aPoint( mXShape->getPosition() );
css::awt::Size aSize( mXShape->getSize() );
css::awt::Point aStart, aEnd, aCenter;
@@ -3409,7 +3409,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
EscherPropertyContainer aPropOpt;
mnAngle = ( PropValue::GetPropertyValue( aAny,
mXPropSet, "RotateAngle", true ) )
- ? *static_cast<sal_Int32 const *>(aAny.getValue())
+ ? *o3tl::doAccess<sal_Int32>(aAny)
: 0;
aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
diff --git a/sd/source/filter/eppt/pptx-epptbase.cxx b/sd/source/filter/eppt/pptx-epptbase.cxx
index 85db3a1..d228d60 100644
--- a/sd/source/filter/eppt/pptx-epptbase.cxx
+++ b/sd/source/filter/eppt/pptx-epptbase.cxx
@@ -20,6 +20,7 @@
#include "eppt.hxx"
#include "epptdef.hxx"
+#include <o3tl/any.hxx>
#include <tools/globname.hxx>
#include <tools/datetime.hxx>
#include <tools/poly.hxx>
@@ -483,7 +484,7 @@ sal_uInt32 PPTWriterBase::GetMasterIndex( PageType ePageType )
if ( aXPropertySet.is() )
{
if ( ImplGetPropertyValue( aXPropertySet, "Number" ) )
- nRetValue |= *static_cast<sal_Int16 const *>(mAny.getValue());
+ nRetValue |= *o3tl::doAccess<sal_Int16>(mAny);
if ( nRetValue & 0xffff ) // avoid overflow
nRetValue--;
}
@@ -522,7 +523,7 @@ bool PPTWriterBase::GetStyleSheets()
aXPropSet( mXModel, UNO_QUERY );
sal_uInt16 nDefaultTab = ( aXPropSet.is() && ImplGetPropertyValue( aXPropSet, "TabStop" ) )
- ? (sal_uInt16)( *static_cast<sal_Int32 const *>(mAny.getValue()) / 4.40972 )
+ ? (sal_uInt16)( *o3tl::doAccess<sal_Int32>(mAny) / 4.40972 )
: 1250;
maStyleSheetList.push_back( new PPTExStyleSheet( nDefaultTab, dynamic_cast<PPTExBulletProvider*>(this) ) );
@@ -733,7 +734,7 @@ bool PPTWriterBase::GetShapeByIndex( sal_uInt32 nIndex, bool bGroup )
mnAngle = ( PropValue::GetPropertyValue( aAny,
mXPropSet, "RotateAngle", true ) )
- ? *static_cast<sal_Int32 const *>(aAny.getValue())
+ ? *o3tl::doAccess<sal_Int32>(aAny)
: 0;
return true;
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 3f39af3..3589abf 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -18,6 +18,7 @@
*/
#include <stdio.h>
+#include <o3tl/any.hxx>
#include <oox/drawingml/chart/chartconverter.hxx>
#include <oox/token/tokens.hxx>
#include <oox/ole/vbaproject.hxx>
@@ -800,7 +801,7 @@ void PowerPointExport::WriteAnimationProperty( const FSHelperPtr& pFS, const Any
switch( rAny.getValueType().getTypeClass() ) {
case TypeClass_STRING:
pFS->singleElementNS( XML_p, XML_strVal,
- XML_val, USS( *static_cast< const OUString* >( rAny.getValue() ) ),
+ XML_val, USS( *o3tl::doAccess<OUString>(rAny) ),
FSEND );
break;
default:
diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx
index 49c1add..4664a8a 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -41,6 +41,7 @@
#include <editeng/frmdir.hxx>
#include <filter/msfilter/util.hxx>
#include <i18nutil/scripttypedetector.hxx>
+#include <o3tl/any.hxx>
#include <sfx2/app.hxx>
#include <svl/languageoptions.hxx>
#include <oox/export/drawingml.hxx>
@@ -231,7 +232,7 @@ void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, bool bGe
meFontName = ePropState;
if ( bOk )
{
- FontCollectionEntry aFontDesc( *static_cast<OUString const *>(mAny.getValue()) );
+ FontCollectionEntry aFontDesc( *o3tl::doAccess<OUString>(mAny) );
sal_uInt32 nCount = rFontCollection.GetCount();
mnFont = (sal_uInt16)rFontCollection.GetId( aFontDesc );
if ( mnFont == nCount )
@@ -258,7 +259,7 @@ void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, bool bGe
meAsianOrComplexFont = ePropState;
if ( bOk )
{
- FontCollectionEntry aFontDesc( *static_cast<OUString const *>(mAny.getValue()) );
+ FontCollectionEntry aFontDesc( *o3tl::doAccess<OUString>(mAny) );
sal_uInt32 nCount = rFontCollection.GetCount();
mnAsianOrComplexFont = (sal_uInt16)rFontCollection.GetId( aFontDesc );
if ( mnAsianOrComplexFont == nCount )
@@ -279,7 +280,7 @@ void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, bool bGe
meAsianOrComplexFont = ePropState;
if ( bOk )
{
- FontCollectionEntry aFontDesc( *static_cast<OUString const *>(mAny.getValue()) );
+ FontCollectionEntry aFontDesc( *o3tl::doAccess<OUString>(mAny) );
sal_uInt32 nCount = rFontCollection.GetCount();
mnAsianOrComplexFont = (sal_uInt16)rFontCollection.GetId( aFontDesc );
if ( mnAsianOrComplexFont == nCount )
@@ -407,7 +408,7 @@ void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, bool bGe
if ( ImplGetPropertyValue( "CharColor", bGetPropStateValue ) )
{
- sal_uInt32 nSOColor = *( static_cast<sal_uInt32 const *>(mAny.getValue()) );
+ sal_uInt32 nSOColor = *( o3tl::doAccess<sal_uInt32>(mAny) );
mnCharColor = nSOColor & 0xff00ff00; // green and hibyte
mnCharColor |= (sal_uInt8)( nSOColor ) << 16; // red and blue is switched
mnCharColor |= (sal_uInt8)( nSOColor >> 16 );
@@ -495,10 +496,10 @@ sal_uInt32 PortionObj::ImplGetTextField( css::uno::Reference< css::text::XTextRa
css::uno::Any aAny;
if ( GetPropertyValue( aAny, rXPropSet, "TextPortionType", true ) )
{
- OUString aTextFieldType( *static_cast<OUString const *>(aAny.getValue()) );
- if ( aTextFieldType == "TextField" )
+ auto aTextFieldType = o3tl::doAccess<OUString>(aAny);
+ if ( *aTextFieldType == "TextField" )
{
- if ( GetPropertyValue( aAny, rXPropSet, aTextFieldType, true ) )
+ if ( GetPropertyValue( aAny, rXPropSet, *aTextFieldType, true ) )
{
css::uno::Reference< css::text::XTextField > aXTextField;
if ( aAny >>= aXTextField )
@@ -519,7 +520,7 @@ sal_uInt32 PortionObj::ImplGetTextField( css::uno::Reference< css::text::XTextRa
{
if ( GetPropertyValue( aAny, xFieldPropSet, "Format", true ) )
{
- nFormat = *static_cast<sal_Int32 const *>(aAny.getValue());
+ nFormat = *o3tl::doAccess<sal_Int32>(aAny);
switch ( nFormat )
{
default:
@@ -540,7 +541,7 @@ sal_uInt32 PortionObj::ImplGetTextField( css::uno::Reference< css::text::XTextRa
else if ( aFieldKind == "URL" )
{
if ( GetPropertyValue( aAny, xFieldPropSet, "URL", true ) )
- rURL = *static_cast<OUString const *>(aAny.getValue());
+ rURL = *o3tl::doAccess<OUString>(aAny);
nRetValue = 4 << 28;
}
else if ( aFieldKind == "Page" )
@@ -561,7 +562,7 @@ sal_uInt32 PortionObj::ImplGetTextField( css::uno::Reference< css::text::XTextRa
{
if ( GetPropertyValue( aAny, xFieldPropSet, "IsFix", true ) )
{
- nFormat = *static_cast<sal_Int32 const *>(aAny.getValue());
+ nFormat = *o3tl::doAccess<sal_Int32>(aAny);
nRetValue |= ( ( ( 2 << 4 ) | nFormat ) << 24 ) | 0x800000;
}
}
@@ -585,7 +586,7 @@ sal_uInt32 PortionObj::ImplGetTextField( css::uno::Reference< css::text::XTextRa
{
if ( GetPropertyValue( aAny, xFieldPropSet, "Format", true ) )
{
- nFormat = *static_cast<sal_Int32 const *>(aAny.getValue());
+ nFormat = *o3tl::doAccess<sal_Int32>(aAny);
switch ( nFormat )
{
default:
@@ -799,12 +800,11 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider* pBuProv, sal_Int1
if ( ( mAny >>= aXIndexReplace ) && nNumberingDepth < aXIndexReplace->getCount() )
{
mAny <<= aXIndexReplace->getByIndex( nNumberingDepth );
- css::uno::Sequence< css::beans::PropertyValue>
- aPropertySequence( *static_cast<css::uno::Sequence< css::beans::PropertyValue> const *>(mAny.getValue()) );
+ auto aPropertySequence = o3tl::doAccess<css::uno::Sequence<css::beans::PropertyValue>>(mAny);
- const css::beans::PropertyValue* pPropValue = aPropertySequence.getArray();
+ const css::beans::PropertyValue* pPropValue = aPropertySequence->getConstArray();
- sal_Int32 nPropertyCount = aPropertySequence.getLength();
+ sal_Int32 nPropertyCount = aPropertySequence->getLength();
if ( nPropertyCount )
{
bExtendedParameters = true;
@@ -814,77 +814,71 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider* pBuProv, sal_Int1
OUString aGraphicURL;
for ( sal_Int32 i = 0; i < nPropertyCount; i++ )
{
- const void* pValue = pPropValue[ i ].Value.getValue();
- if ( pValue )
+ OUString aPropName( pPropValue[ i ].Name );
+ if ( aPropName == "NumberingType" )
+ nNumberingType = *o3tl::doAccess<sal_Int16>(pPropValue[i].Value);
+ else if ( aPropName == "Adjust" )
+ nHorzAdjust = *o3tl::doAccess<sal_Int16>(pPropValue[i].Value);
+ else if ( aPropName == "BulletChar" )
{
- OUString aPropName( pPropValue[ i ].Name );
- if ( aPropName == "NumberingType" )
- nNumberingType = *( static_cast<sal_Int16 const *>(pValue) );
- else if ( aPropName == "Adjust" )
- nHorzAdjust = *( static_cast<sal_Int16 const *>(pValue) );
- else if ( aPropName == "BulletChar" )
- {
- OUString aString( *( static_cast<OUString const *>(pValue) ) );
- if ( !aString.isEmpty() )
- cBulletId = aString[ 0 ];
- }
- else if ( aPropName == "BulletFont" )
- {
- aFontDesc = *static_cast<css::awt::FontDescriptor const *>(pValue);
+ OUString aString( *o3tl::doAccess<OUString>(pPropValue[i].Value) );
+ if ( !aString.isEmpty() )
+ cBulletId = aString[ 0 ];
+ }
+ else if ( aPropName == "BulletFont" )
+ {
+ aFontDesc = *o3tl::doAccess<css::awt::FontDescriptor>(pPropValue[i].Value);
- // Our numbullet dialog has set the wrong textencoding for our "StarSymbol" font,
- // instead of a Unicode encoding the encoding RTL_TEXTENCODING_SYMBOL was used.
- // Because there might exist a lot of damaged documemts I added this two lines
- // which fixes the bullet problem for the export.
- if ( aFontDesc.Name.equalsIgnoreAsciiCase("StarSymbol") )
- aFontDesc.CharSet = RTL_TEXTENCODING_MS_1252;
+ // Our numbullet dialog has set the wrong textencoding for our "StarSymbol" font,
+ // instead of a Unicode encoding the encoding RTL_TEXTENCODING_SYMBOL was used.
+ // Because there might exist a lot of damaged documemts I added this two lines
+ // which fixes the bullet problem for the export.
+ if ( aFontDesc.Name.equalsIgnoreAsciiCase("StarSymbol") )
+ aFontDesc.CharSet = RTL_TEXTENCODING_MS_1252;
- }
- else if ( aPropName == "GraphicURL" )
- aGraphicURL = *static_cast<OUString const *>(pValue);
- else if ( aPropName == "GraphicSize" )
- {
- if ( pPropValue[ i ].Value.getValueType() == cppu::UnoType<css::awt::Size>::get())
- {
- // don't cast awt::Size to Size as on 64-bits they are not the same.
- css::awt::Size aSize;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list