diff options
-rw-r--r-- | codemaker/source/cppumaker/cpputype.cxx | 10 | ||||
-rw-r--r-- | comphelper/qa/unit/variadictemplates.cxx | 2 | ||||
-rw-r--r-- | cppu/CppunitTest_cppu_any-external.mk | 26 | ||||
-rw-r--r-- | cppu/Module_cppu.mk | 1 | ||||
-rw-r--r-- | cppu/qa/any-external.cxx | 63 | ||||
-rw-r--r-- | cppu/qa/test_any.cxx | 80 | ||||
-rw-r--r-- | fpicker/source/win32/filepicker/VistaFilePicker.cxx | 3 | ||||
-rw-r--r-- | fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx | 2 | ||||
-rw-r--r-- | fpicker/source/win32/filepicker/asyncrequests.hxx | 4 | ||||
-rw-r--r-- | include/com/sun/star/uno/Any.h | 27 | ||||
-rw-r--r-- | include/com/sun/star/uno/Any.hxx | 31 | ||||
-rw-r--r-- | include/comphelper/propertyvalue.hxx | 2 | ||||
-rw-r--r-- | include/comphelper/unwrapargs.hxx | 2 | ||||
-rw-r--r-- | slideshow/source/inc/tools.hxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/inc/swmodeltestbase.hxx | 4 |
15 files changed, 166 insertions, 93 deletions
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index e87fed09df3b..e3ce8170150b 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -3621,10 +3621,12 @@ void ServiceType::dumpHppFile( u2b(j.name), "param", codemaker::cpp::IdentifierTranslationMode::NonGlobal)); sal_Int32 rank; - if (m_typeMgr->getSort( - b2u(codemaker::UnoType::decompose( - u2b(j.type), &rank))) - == codemaker::UnoType::Sort::Char) + if (resolveOuterTypedefs(j.type) == "any") { + o << "= " << param; + } else if (m_typeMgr->getSort( + b2u(codemaker::UnoType::decompose( + u2b(j.type), &rank))) + == codemaker::UnoType::Sort::Char) { o << "= ::css::uno::Any(&" << param << ", ::cppu::UnoType< "; diff --git a/comphelper/qa/unit/variadictemplates.cxx b/comphelper/qa/unit/variadictemplates.cxx index 0f5dafff6f69..67e76bb79d33 100644 --- a/comphelper/qa/unit/variadictemplates.cxx +++ b/comphelper/qa/unit/variadictemplates.cxx @@ -43,7 +43,7 @@ inline void extract( OUString( "No such argument available!"), xErrorContext, static_cast<sal_Int16>(nArg) ); } - if (! (seq[nArg] >>= v)) { + if (! fromAny(seq[nArg], &v)) { OUStringBuffer buf; buf.append( "Cannot extract ANY { " ); buf.append( seq[nArg].getValueType().getTypeName() ); diff --git a/cppu/CppunitTest_cppu_any-external.mk b/cppu/CppunitTest_cppu_any-external.mk new file mode 100644 index 000000000000..6119e048ba99 --- /dev/null +++ b/cppu/CppunitTest_cppu_any-external.mk @@ -0,0 +1,26 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_CppunitTest_CppunitTest,cppu_any-external)) + +$(eval $(call gb_CppunitTest_add_exception_objects,cppu_any-external, \ + cppu/qa/any-external \ +)) + +$(eval $(call gb_CppunitTest_set_external_code,cppu_any-external)) + +$(eval $(call gb_CppunitTest_use_libraries,cppu_any-external, \ + cppu \ + sal \ + $(gb_UWINAPI) \ +)) + +$(eval $(call gb_CppunitTest_use_udk_api,cppu_any-external)) + +# vim: set noet sw=4 ts=4: diff --git a/cppu/Module_cppu.mk b/cppu/Module_cppu.mk index 51abe4dafb47..d5c47c88a2b6 100644 --- a/cppu/Module_cppu.mk +++ b/cppu/Module_cppu.mk @@ -21,6 +21,7 @@ $(eval $(call gb_Module_add_targets,cppu,\ )) $(eval $(call gb_Module_add_check_targets,cppu,\ + CppunitTest_cppu_any-external \ CppunitTest_cppu_qa_any \ CppunitTest_cppu_qa_recursion \ CppunitTest_cppu_qa_reference \ diff --git a/cppu/qa/any-external.cxx b/cppu/qa/any-external.cxx new file mode 100644 index 000000000000..bac61342786c --- /dev/null +++ b/cppu/qa/any-external.cxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sal/config.h> + +#include <cppunit/TestAssert.h> +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> + +#include <com/sun/star/uno/Any.hxx> +#include <sal/types.h> + +namespace { + +class Test: public CppUnit::TestFixture { +private: + CPPUNIT_TEST_SUITE(Test); + CPPUNIT_TEST(testGet); + CPPUNIT_TEST(testHas); + CPPUNIT_TEST(testExtract); + CPPUNIT_TEST(testInsert); + CPPUNIT_TEST_SUITE_END(); + + void testGet() { + css::uno::Any a(false); + CPPUNIT_ASSERT_EQUAL(a, a.get<css::uno::Any>()); + CPPUNIT_ASSERT_EQUAL(false, a.get<bool>()); + } + + void testHas() { + css::uno::Any a(false); + CPPUNIT_ASSERT_EQUAL(true, a.has<css::uno::Any>()); + CPPUNIT_ASSERT_EQUAL(true, a.has<bool>()); + } + + void testExtract() { + css::uno::Any a1(false); + css::uno::Any a2; + CPPUNIT_ASSERT(a1 >>= a2); + CPPUNIT_ASSERT_EQUAL(a1, a2); + } + + void testInsert() { + css::uno::Any a; + a <<= css::uno::Any(false); + CPPUNIT_ASSERT_EQUAL(css::uno::Any(false), a); + } +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(Test); + +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/cppu/qa/test_any.cxx b/cppu/qa/test_any.cxx index 5959974b0c6e..b6b69eaf9e6b 100644 --- a/cppu/qa/test_any.cxx +++ b/cppu/qa/test_any.cxx @@ -287,10 +287,6 @@ void Test::testVoid() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", !(a >>= b) && b.getLength() == 2); @@ -377,10 +373,6 @@ void Test::testBoolean() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -472,10 +464,6 @@ void Test::testByte() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -567,10 +555,6 @@ void Test::testShort() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -664,10 +648,6 @@ void Test::testUnsignedShort() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -755,10 +735,6 @@ void Test::testLong() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -846,10 +822,6 @@ void Test::testUnsignedLong() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -937,10 +909,6 @@ void Test::testHyper() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -1028,10 +996,6 @@ void Test::testUnsignedHyper() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -1119,10 +1083,6 @@ void Test::testFloat() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -1210,10 +1170,6 @@ void Test::testDouble() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -1306,10 +1262,6 @@ void Test::testChar() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -1397,10 +1349,6 @@ void Test::testString() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -1487,10 +1435,6 @@ void Test::testType() { "css::uno::Type", (a >>= b) && b == cppu::UnoType<sal_Int32>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -1581,10 +1525,6 @@ void Test::testSequence() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -1678,10 +1618,6 @@ void Test::testEnum() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -1773,10 +1709,6 @@ void Test::testStruct() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -1889,10 +1821,6 @@ void Test::testException() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -1999,10 +1927,6 @@ void Test::testInterface() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", @@ -2107,10 +2031,6 @@ void Test::testNull() { !(a >>= b) && b == cppu::UnoType<OUString>::get()); } { - css::uno::Any b(rtl::OUString("2")); - CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a); - } - { css::uno::Sequence< rtl::OUString > b(2); CPPUNIT_ASSERT_MESSAGE( "css::uno::Sequence<rtl::OUString>", diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.cxx b/fpicker/source/win32/filepicker/VistaFilePicker.cxx index 2a8c2477b0fd..c3e95b51ac1b 100644 --- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx +++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx @@ -304,8 +304,7 @@ css::uno::Any SAL_CALL VistaFilePicker::getValue(::sal_Int16 nControlId , rRequest->setArgument(PROP_CONTROL_ACTION, nControlAction); m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::BLOCKED); - const css::uno::Any aValue = rRequest->getArgumentOrDefault(PROP_CONTROL_VALUE, css::uno::Any()); - return aValue; + return rRequest->getValue(PROP_CONTROL_VALUE); } void SAL_CALL VistaFilePicker::enableControl(::sal_Int16 nControlId, diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx index e639beb6d343..e91d3fe735d2 100644 --- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx +++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx @@ -1055,7 +1055,7 @@ void VistaFilePickerImpl::impl_sta_SetControlValue(const RequestRef& rRequest) { ::sal_Int16 nId = rRequest->getArgumentOrDefault(PROP_CONTROL_ID , INVALID_CONTROL_ID ); ::sal_Int16 nAction = rRequest->getArgumentOrDefault(PROP_CONTROL_ACTION, INVALID_CONTROL_ACTION); - css::uno::Any aValue = rRequest->getArgumentOrDefault(PROP_CONTROL_VALUE , css::uno::Any() ); + css::uno::Any aValue = rRequest->getValue(PROP_CONTROL_VALUE); // don't check for right values here ... // most parameters are optional ! diff --git a/fpicker/source/win32/filepicker/asyncrequests.hxx b/fpicker/source/win32/filepicker/asyncrequests.hxx index 2b62ba7e8f5b..c1a3f569fbfa 100644 --- a/fpicker/source/win32/filepicker/asyncrequests.hxx +++ b/fpicker/source/win32/filepicker/asyncrequests.hxx @@ -94,6 +94,10 @@ class Request return m_lArguments.getUnpackedValueOrDefault(sName, aDefault); } + css::uno::Any getValue(OUString const & key) const + { + return m_lArguments.getValue(key); + } void wait(::sal_Int32 nMilliSeconds = WAIT_INFINITE); diff --git a/include/com/sun/star/uno/Any.h b/include/com/sun/star/uno/Any.h index d6c7477d3f4c..6e3d53b43c79 100644 --- a/include/com/sun/star/uno/Any.h +++ b/include/com/sun/star/uno/Any.h @@ -326,6 +326,31 @@ template<typename T> inline Any toAny(T const & value); template<> inline Any toAny(Any const & value); +#if defined LIBO_INTERNAL_ONLY + +/** Extract a value from an Any, if necessary. + + The difference to operator >>= is that operator >>= cannot be called with an + Any as right-hand side (in LIBO_INTERNAL_ONLY), while fromAny just passes on + the given Any (and always succeeds) in the specialization for T = Any. + + @tparam T any type representing a UNO type + + @param any any Any value + + @param value a non-null pointer, receiving the extracted value if + extraction succeeded (and left unmodified otherwise) + + @return true iff extraction succeeded + + @since LibreOffice 5.3 +*/ +template<typename T> inline bool fromAny(Any const & any, T * value); + +template<> inline bool fromAny(Any const & any, Any * value); + +#endif + class BaseReference; /** Template binary <<= operator to set the value of an any. @@ -423,8 +448,10 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, Type & value ); template<> inline bool SAL_CALL operator == ( const Any & rAny, const Type & value ); // any +#if !defined LIBO_INTERNAL_ONLY template<> inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value ); +#endif // interface template<> inline bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value ); diff --git a/include/com/sun/star/uno/Any.hxx b/include/com/sun/star/uno/Any.hxx index 1e1f24e85fc8..0ea1fb9c4ad6 100644 --- a/include/com/sun/star/uno/Any.hxx +++ b/include/com/sun/star/uno/Any.hxx @@ -203,6 +203,10 @@ inline bool Any::has() const cpp_release ); } +#if defined LIBO_INTERNAL_ONLY +template<> bool Any::has<Any>() const = delete; +#endif + inline bool Any::operator == ( const Any & rAny ) const { return ::uno_type_equalData( @@ -233,6 +237,21 @@ template<typename T> Any toAny(T const & value) { return makeAny(value); } template<> Any toAny(Any const & value) { return value; } +#if defined LIBO_INTERNAL_ONLY + +template<typename T> bool fromAny(Any const & any, T * value) { + assert(value != nullptr); + return any >>= *value; +} + +template<> bool fromAny(Any const & any, Any * value) { + assert(value != nullptr); + *value = any; + return true; +} + +#endif + template< class C > inline void SAL_CALL operator <<= ( Any & rAny, const C & value ) { @@ -266,6 +285,10 @@ inline void SAL_CALL operator <<= ( Any & rAny, const rtl::OUStringConcat< C1, C } #endif +#if defined LIBO_INTERNAL_ONLY +template<> void SAL_CALL operator <<=(Any &, Any const &) = delete; +#endif + template< class C > inline bool SAL_CALL operator >>= ( const Any & rAny, C & value ) { @@ -566,6 +589,9 @@ inline bool SAL_CALL operator == ( const Any & rAny, const Type & value ) } // any +#if defined LIBO_INTERNAL_ONLY +template<> bool SAL_CALL operator >>=(Any const &, Any &) = delete; +#else template<> inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value ) { @@ -577,6 +603,7 @@ inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value ) } return true; } +#endif // interface template<> @@ -623,6 +650,10 @@ T Any::get() const return value; } +#if defined LIBO_INTERNAL_ONLY +template<> Any Any::get() const = delete; +#endif + /** Support for Any in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO macros, for example). diff --git a/include/comphelper/propertyvalue.hxx b/include/comphelper/propertyvalue.hxx index 04968d2b010e..ba442c12a931 100644 --- a/include/comphelper/propertyvalue.hxx +++ b/include/comphelper/propertyvalue.hxx @@ -26,7 +26,7 @@ template<typename T> css::beans::PropertyValue makePropertyValue(const OUString& { css::beans::PropertyValue aValue; aValue.Name = rName; - aValue.Value <<= rValue; + aValue.Value = css::uno::toAny(rValue); return aValue; } diff --git a/include/comphelper/unwrapargs.hxx b/include/comphelper/unwrapargs.hxx index 8a8156aacccf..8a2e9aed7d32 100644 --- a/include/comphelper/unwrapargs.hxx +++ b/include/comphelper/unwrapargs.hxx @@ -76,7 +76,7 @@ namespace detail { return unwrapArgsError( OUString( "No such argument available!"), nArg, args... ); } - if( ! ( seq[nArg] >>= v ) ) + if( !fromAny( seq[nArg], &v ) ) { OUStringBuffer buf; buf.append( "Cannot extract ANY { " ); diff --git a/slideshow/source/inc/tools.hxx b/slideshow/source/inc/tools.hxx index 811face5ca6c..a7fc729b0973 100644 --- a/slideshow/source/inc/tools.hxx +++ b/slideshow/source/inc/tools.hxx @@ -316,7 +316,7 @@ namespace slideshow try { const css::uno::Any& a( xPropSet->getPropertyValue( propName ) ); - bool const bRet = (a >>= rValue); + bool const bRet = css::uno::fromAny(a, &rValue); #if OSL_DEBUG_LEVEL > 0 if( !bRet ) OSL_TRACE( "%s: while retrieving property %s, cannot extract Any of type %s\n", diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index eacc0a040d26..3097db6a7d8b 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -421,8 +421,8 @@ protected: T getProperty( const uno::Any& obj, const OUString& name ) const { uno::Reference< beans::XPropertySet > properties( obj, uno::UNO_QUERY_THROW ); - T data = T(); - if (!(properties->getPropertyValue(name) >>= data)) + T data; + if (!css::uno::fromAny(properties->getPropertyValue(name), &data)) { CPPUNIT_FAIL("the property is of unexpected type or void"); } |