diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-06-10 18:55:13 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-06-10 18:55:13 +0200 |
commit | 9741e7a437da478ceb05a6122ee3e4a111d60d18 (patch) | |
tree | 3396ae737bbfc22d7503b4bc3da000b6593cabd8 /forms | |
parent | 7bf2f61ac786e969e33693647b1365aca3b2731c (diff) |
Clean up uses of Any::getValue() in forms
Change-Id: I335aabc92ecb5de107dad3ecdfa6e025ec0d1b0f
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/component/Button.cxx | 3 | ||||
-rw-r--r-- | forms/source/component/FormComponent.cxx | 7 | ||||
-rw-r--r-- | forms/source/component/FormattedField.cxx | 4 | ||||
-rw-r--r-- | forms/source/component/Grid.cxx | 2 | ||||
-rw-r--r-- | forms/source/component/ListBox.cxx | 5 | ||||
-rw-r--r-- | forms/source/component/RadioButton.cxx | 4 |
6 files changed, 11 insertions, 14 deletions
diff --git a/forms/source/component/Button.cxx b/forms/source/component/Button.cxx index e49b950a6ffd..603bf3aaf740 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 fd7b2c7608ac..431501c6067e 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 c027352e4c5c..56cb7eb822ca 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 45b046b0f071..9433424d7e12 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 6b3f1b4c4635..006a2bec2143 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 567eb5c638e4..61923834b9db 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; |