summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-06-10 18:55:42 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-06-10 18:55:42 +0200
commit0cb1c2fdc106281e1594c4e714f1c79f0ad0ec8d (patch)
tree8b2e53565c5bec33d733341785cc39a94922f931 /dbaccess
parente5ca1f73a08a05c957b73929cafa748ba82a033c (diff)
Clean up uses of Any::getValue() in dbaccess
Change-Id: Icaad71e51301e017a48ab3f87b151f5e0de26cd9
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ui/browser/exsrcbrw.cxx28
-rw-r--r--dbaccess/source/ui/browser/formadapter.cxx4
2 files changed, 17 insertions, 15 deletions
diff --git a/dbaccess/source/ui/browser/exsrcbrw.cxx b/dbaccess/source/ui/browser/exsrcbrw.cxx
index 2773e27f878b..69db7d2dc0fe 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 2ba33e9a4b85..f66fb419840c 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();