summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-06-10 18:55:25 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-06-10 18:55:25 +0200
commit177afb1ec39d3ac9c66c7dfdc51ef9ad22e7b752 (patch)
tree08dedd8d135640c884b67d4d82ce1faf2a48c28d /extensions
parente4eb0f6ecee2d82966c0da156185415e5886f60f (diff)
Clean up uses of Any::getValue() in extensions
Change-Id: I67b9127d8aa67a702086ef5bc61372ae54c2142e
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/bibliography/bibconfig.cxx3
-rw-r--r--extensions/source/bibliography/bibload.cxx7
-rw-r--r--extensions/source/bibliography/datman.cxx22
-rw-r--r--extensions/source/bibliography/general.cxx3
-rw-r--r--extensions/source/bibliography/toolbar.cxx17
5 files changed, 24 insertions, 28 deletions
diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx
index a5d9733b8301..3661903d9219 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 fb36a2f31bda..3bff83b5ea0a 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 d9ff7c9d0022..e9541d2ca6ae 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 7758e4f0e305..f58a7cbea8e1 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 521446ca7515..3cf37e486b03 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);
}
}
}