diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-04-21 08:56:05 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-04-21 08:56:51 +0200 |
commit | 08a943fc379c5f8af25128c935e93e6a9d82d136 (patch) | |
tree | 3a2e8dd41f7d52985630c168f60d98bdff375c04 | |
parent | 4592d27dca75e73218ddca2039b1a1332adc828c (diff) |
Get rid of trivial comphelper::query_interface wrapper
Change-Id: I2b9dafd2a34d055dcd8b8c4d894be30dc821d3be
-rw-r--r-- | connectivity/source/drivers/ado/AStatement.cxx | 6 | ||||
-rw-r--r-- | connectivity/source/drivers/odbc/OStatement.cxx | 6 | ||||
-rw-r--r-- | forms/source/component/EventThread.cxx | 5 | ||||
-rw-r--r-- | forms/source/component/FormComponent.cxx | 4 | ||||
-rw-r--r-- | forms/source/component/FormattedField.cxx | 5 | ||||
-rw-r--r-- | forms/source/component/FormattedFieldWrapper.cxx | 15 | ||||
-rw-r--r-- | forms/source/component/RadioButton.cxx | 8 | ||||
-rw-r--r-- | forms/source/component/clickableimage.cxx | 2 | ||||
-rw-r--r-- | include/comphelper/uno3.hxx | 25 | ||||
-rw-r--r-- | svx/source/form/fmobj.cxx | 3 |
10 files changed, 29 insertions, 50 deletions
diff --git a/connectivity/source/drivers/ado/AStatement.cxx b/connectivity/source/drivers/ado/AStatement.cxx index 662daf4d1451..a6a893a4523d 100644 --- a/connectivity/source/drivers/ado/AStatement.cxx +++ b/connectivity/source/drivers/ado/AStatement.cxx @@ -21,7 +21,6 @@ #include "ado/AConnection.hxx" #include "ado/AResultSet.hxx" #include <comphelper/property.hxx> -#include <comphelper/uno3.hxx> #include <osl/thread.h> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/queryinterface.hxx> @@ -182,8 +181,9 @@ void OStatement_Base::clearMyResultSet () throw (SQLException) try { - Reference<XCloseable> xCloseable; - if ( ::comphelper::query_interface( m_xResultSet.get(), xCloseable ) ) + Reference<XCloseable> xCloseable( + m_xResultSet.get(), css::uno::UNO_QUERY); + if ( xCloseable.is() ) xCloseable->close(); } catch( const DisposedException& ) { } diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx index 5df41972f75b..2259ca9e1be0 100644 --- a/connectivity/source/drivers/odbc/OStatement.cxx +++ b/connectivity/source/drivers/odbc/OStatement.cxx @@ -25,7 +25,6 @@ #include "odbc/OResultSet.hxx" #include <comphelper/property.hxx> #include "odbc/OTools.hxx" -#include <comphelper/uno3.hxx> #include <osl/thread.h> #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> #include <com/sun/star/sdbc/ResultSetType.hpp> @@ -226,8 +225,9 @@ void OStatement_Base::clearMyResultSet() try { - Reference<XCloseable> xCloseable; - if ( ::comphelper::query_interface( m_xResultSet.get(), xCloseable ) ) + Reference<XCloseable> xCloseable( + m_xResultSet.get(), css::uno::UNO_QUERY); + if ( xCloseable.is() ) xCloseable->close(); } catch( const DisposedException& ) { } diff --git a/forms/source/component/EventThread.cxx b/forms/source/component/EventThread.cxx index 737774baa57b..f03ac9551d09 100644 --- a/forms/source/component/EventThread.cxx +++ b/forms/source/component/EventThread.cxx @@ -40,7 +40,7 @@ OComponentEventThread::OComponentEventThread( ::cppu::OComponentHelper* pCompImp // Hold a reference of the Control { InterfaceRef xIFace(static_cast<XWeak*>(pCompImpl)); - query_interface(xIFace, m_xComp); + m_xComp.set(xIFace, css::uno::UNO_QUERY); } // and add us at the Control @@ -189,7 +189,8 @@ void OComponentEventThread::run() // the mutex is locked. Reference<XControl> xControl; if ( xControlAdapter.is() ) - query_interface(xControlAdapter->queryAdapted(), xControl); + xControl.set( + xControlAdapter->queryAdapted(), css::uno::UNO_QUERY); if( xComp.is() ) processEvent( pCompImpl, pEvt.get(), xControl, bFlag ); diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index 8f0aea69fbae..33f584a9dec3 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -1748,8 +1748,8 @@ void OBoundControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, co } // Check if we and the given model have a common ancestor (up to the forms collection) - Reference<XChild> xCont; - query_interface(static_cast<XWeak*>(this), xCont); + Reference<XChild> xCont( + static_cast<XWeak*>(this), css::uno::UNO_QUERY); Reference< XInterface > xMyTopLevel = xCont->getParent(); while (xMyTopLevel.is()) { diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index f28c34774512..ac7112db484e 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -509,8 +509,9 @@ Reference< XNumberFormatsSupplier > OFormattedModel::calcFormatsSupplier() const Reference<XNumberFormatsSupplier> OFormattedModel::calcFormFormatsSupplier() const { - Reference<XChild> xMe; - query_interface(static_cast<XWeak*>(const_cast<OFormattedModel*>(this)), xMe); + Reference<XChild> xMe( + static_cast<XWeak*>(const_cast<OFormattedModel*>(this)), + css::uno::UNO_QUERY); // By this we make sure that we get the right object even when aggregating DBG_ASSERT(xMe.is(), "OFormattedModel::calcFormFormatsSupplier : I should have a content interface !"); // Iterate through until we reach a StartForm (starting with an own Parent) diff --git a/forms/source/component/FormattedFieldWrapper.cxx b/forms/source/component/FormattedFieldWrapper.cxx index 3ae02677e079..963ab91a59cf 100644 --- a/forms/source/component/FormattedFieldWrapper.cxx +++ b/forms/source/component/FormattedFieldWrapper.cxx @@ -55,17 +55,17 @@ InterfaceRef OFormattedFieldWrapper::createFormattedFieldWrapper(const ::com::su if (bActAsFormatted) { // instantiate an FormattedModel - InterfaceRef xFormattedModel; // (instantiate it directly ..., as the OFormattedModel isn't // registered for any service names anymore) OFormattedModel* pModel = new OFormattedModel(pRef->m_xContext); - query_interface(static_cast<XWeak*>(pModel), xFormattedModel); + InterfaceRef xFormattedModel( + static_cast<XWeak*>(pModel), css::uno::UNO_QUERY); pRef->m_xAggregate = Reference<XAggregation> (xFormattedModel, UNO_QUERY); OSL_ENSURE(pRef->m_xAggregate.is(), "the OFormattedModel didn't have an XAggregation interface !"); // _before_ setting the delegator, give it to the member references - query_interface(xFormattedModel, pRef->m_xFormattedPart); + pRef->m_xFormattedPart.set(xFormattedModel, css::uno::UNO_QUERY); pRef->m_pEditPart = rtl::Reference< OEditModel >(new OEditModel(pRef->m_xContext)); } @@ -98,7 +98,8 @@ Reference< XCloneable > SAL_CALL OFormattedFieldWrapper::createClone() throw (Ru xRef->m_xAggregate = Reference< XAggregation >(xClone, UNO_QUERY); OSL_ENSURE(xRef->m_xAggregate.is(), "invalid aggregate cloned !"); - query_interface( Reference< XInterface >(xClone.get() ), xRef->m_xFormattedPart); + xRef->m_xFormattedPart.set( + Reference< XInterface >(xClone.get()), css::uno::UNO_QUERY); if ( m_pEditPart.is() ) { @@ -217,8 +218,8 @@ void SAL_CALL OFormattedFieldWrapper::write(const Reference<XObjectOutputStream> // for this we transfer the current props of the formatted part to the edit part Reference<XPropertySet> xFormatProps(m_xFormattedPart, UNO_QUERY); - Reference<XPropertySet> xEditProps; - query_interface(static_cast<XWeak*>(m_pEditPart.get()), xEditProps); + Reference<XPropertySet> xEditProps( + static_cast<XWeak*>(m_pEditPart.get()), css::uno::UNO_QUERY); Locale aAppLanguage = Application::GetSettings().GetUILanguageTag().getLocale(); dbtools::TransferFormComponentProperties(xFormatProps, xEditProps, aAppLanguage); @@ -317,7 +318,7 @@ void OFormattedFieldWrapper::ensureAggregate() { // arghhh ... instantiate it directly ... it's dirty, but we really need this aggregate OEditModel* pModel = new OEditModel(m_xContext); - query_interface(static_cast<XWeak*>(pModel), xEditModel); + xEditModel.set(static_cast<XWeak*>(pModel), css::uno::UNO_QUERY); } m_xAggregate = Reference<XAggregation> (xEditModel, UNO_QUERY); diff --git a/forms/source/component/RadioButton.cxx b/forms/source/component/RadioButton.cxx index 03781be00f8a..e02f8e45e719 100644 --- a/forms/source/component/RadioButton.cxx +++ b/forms/source/component/RadioButton.cxx @@ -149,8 +149,8 @@ void ORadioButtonModel::SetSiblingPropsTo(const OUString& rPropName, const Any& Reference<XIndexAccess> xIndexAccess(getParent(), UNO_QUERY); if (xIndexAccess.is()) { - Reference<XPropertySet> xMyProps; - query_interface(static_cast<XWeak*>(this), xMyProps); + Reference<XPropertySet> xMyProps( + static_cast<XWeak*>(this), css::uno::UNO_QUERY); OUString sCurrentGroup; sal_Int32 nNumSiblings = xIndexAccess->getCount(); for (sal_Int32 i=0; i<nNumSiblings; ++i) @@ -226,8 +226,8 @@ void ORadioButtonModel::setControlSource() this->getPropertyValue(PROPERTY_GROUP_NAME) >>= sGroupName; this->getPropertyValue(PROPERTY_NAME) >>= sName; - Reference<XPropertySet> xMyProps; - query_interface(static_cast<XWeak*>(this), xMyProps); + Reference<XPropertySet> xMyProps( + static_cast<XWeak*>(this), css::uno::UNO_QUERY); for (sal_Int32 i=0; i<xIndexAccess->getCount(); ++i) { Reference<XPropertySet> xSiblingProperties(*static_cast<InterfaceRef const *>(xIndexAccess->getByIndex(i).getValue()), UNO_QUERY); diff --git a/forms/source/component/clickableimage.cxx b/forms/source/component/clickableimage.cxx index f8c178a29501..d8d3bd334ca1 100644 --- a/forms/source/component/clickableimage.cxx +++ b/forms/source/component/clickableimage.cxx @@ -738,7 +738,7 @@ namespace frm { Reference<XChild> xChild( xIfc, UNO_QUERY ); xIfc = xChild->getParent(); - query_interface(xIfc, xModel); + xModel.set(xIfc, css::uno::UNO_QUERY); } // Search for the Object shell by iterating over all Object shells diff --git a/include/comphelper/uno3.hxx b/include/comphelper/uno3.hxx index eae94a5866f5..d53f4ab59062 100644 --- a/include/comphelper/uno3.hxx +++ b/include/comphelper/uno3.hxx @@ -180,31 +180,6 @@ namespace comphelper } return _rxOut.is(); } - - /** ask for an iface of an object - usage:<br/> - Reference<XFoo> xFoo;<br/> - if (query_interface(xAnything, xFoo))<br/> - .... - */ - template <class iface> - bool query_interface(const InterfaceRef& _rxObject, ::com::sun::star::uno::Reference<iface>& _rxOut) - { - _rxOut = static_cast<iface*>(NULL); - if (_rxObject.is()) - { - ::com::sun::star::uno::Any aCheck = _rxObject->queryInterface( - cppu::UnoType<iface>::get()); - if(aCheck.hasValue()) - { - _rxOut = *static_cast<const ::com::sun::star::uno::Reference<iface>*>(aCheck.getValue()); - return _rxOut.is(); - } - } - return false; - } - - } // namespace comphelper diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index 7d7bd1bfde04..f70af85136de 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -431,7 +431,8 @@ namespace sReturn = sCurrentIndex; // travel up - if (::comphelper::query_interface(Reference< XInterface >(xParent),xChild)) + xChild.set(xParent, css::uno::UNO_QUERY); + if (xChild.is()) xParent = Reference< ::com::sun::star::container::XIndexAccess>(xChild->getParent(), UNO_QUERY); } |