Kaydet (Commit) 08a943fc authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Get rid of trivial comphelper::query_interface wrapper

Change-Id: I2b9dafd2a34d055dcd8b8c4d894be30dc821d3be
üst 4592d27d
......@@ -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& ) { }
......
......@@ -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& ) { }
......
......@@ -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 );
......
......@@ -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())
{
......
......@@ -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)
......
......@@ -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);
......
......@@ -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);
......
......@@ -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
......
......@@ -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
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment