summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-02-16 15:47:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-02-17 07:44:18 +0100
commit1c9f0d9d8ee1a13d30be924cddaa94343fd8c840 (patch)
tree60348a9a4784cf2e5cb963045b7f796e4694f909
parent27078ce8cb03f6ba61be5ce75c5231bc8798d6fe (diff)
loplugin:referencecasting in test..toolkit
Change-Id: Ia290ff4849f4d7eda978c7b1e2c7f36de744056f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110997 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--test/source/beans/xpropertyset.cxx8
-rw-r--r--test/source/chart/xchartdata.cxx6
-rw-r--r--test/source/sheet/xactivationbroadcaster.cxx6
-rw-r--r--test/source/util/xrefreshable.cxx4
-rw-r--r--toolkit/source/awt/vclxwindows.cxx2
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.cxx2
-rw-r--r--toolkit/source/controls/grid/sortablegriddatamodel.cxx2
-rw-r--r--toolkit/source/controls/tree/treedatamodel.cxx12
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx2
-rw-r--r--toolkit/source/helper/unowrapper.cxx2
10 files changed, 21 insertions, 25 deletions
diff --git a/test/source/beans/xpropertyset.cxx b/test/source/beans/xpropertyset.cxx
index d42bc836ca88..33c0398650db 100644
--- a/test/source/beans/xpropertyset.cxx
+++ b/test/source/beans/xpropertyset.cxx
@@ -86,7 +86,7 @@ void XPropertySet::testPropertyChangeListener()
{
rtl::Reference<MockedPropertyChangeListener> xListener = new MockedPropertyChangeListener();
xPropSet->addPropertyChangeListener(
- aName, uno::Reference<beans::XPropertyChangeListener>(xListener.get()));
+ aName, uno::Reference<beans::XPropertyChangeListener>(xListener));
if (!isPropertyValueChangeable(aName))
continue;
@@ -94,7 +94,7 @@ void XPropertySet::testPropertyChangeListener()
xListener->m_bListenerCalled = false;
xPropSet->removePropertyChangeListener(
- aName, uno::Reference<beans::XPropertyChangeListener>(xListener.get()));
+ aName, uno::Reference<beans::XPropertyChangeListener>(xListener));
isPropertyValueChangeable(aName);
CPPUNIT_ASSERT(!xListener->m_bListenerCalled);
}
@@ -110,7 +110,7 @@ void XPropertySet::testVetoableChangeListener()
{
rtl::Reference<MockedVetoableChangeListener> xListener = new MockedVetoableChangeListener();
xPropSet->addVetoableChangeListener(
- aName, uno::Reference<beans::XVetoableChangeListener>(xListener.get()));
+ aName, uno::Reference<beans::XVetoableChangeListener>(xListener));
if (!isPropertyValueChangeable(aName))
continue;
@@ -118,7 +118,7 @@ void XPropertySet::testVetoableChangeListener()
xListener->m_bListenerCalled = false;
xPropSet->removeVetoableChangeListener(
- aName, uno::Reference<beans::XVetoableChangeListener>(xListener.get()));
+ aName, uno::Reference<beans::XVetoableChangeListener>(xListener));
isPropertyValueChangeable(aName);
CPPUNIT_ASSERT(!xListener->m_bListenerCalled);
}
diff --git a/test/source/chart/xchartdata.cxx b/test/source/chart/xchartdata.cxx
index dcecf33a0c3d..68a9b82f191e 100644
--- a/test/source/chart/xchartdata.cxx
+++ b/test/source/chart/xchartdata.cxx
@@ -67,11 +67,11 @@ void XChartData::testChartDataChangeEventListener()
rtl::Reference<MockedChartDataChangeEventListener> pListener0
= new MockedChartDataChangeEventListener();
xCD->addChartDataChangeEventListener(
- uno::Reference<chart::XChartDataChangeEventListener>(pListener0.get()));
+ uno::Reference<chart::XChartDataChangeEventListener>(pListener0));
rtl::Reference<MockedChartDataChangeEventListener> pListener1
= new MockedChartDataChangeEventListener();
xCD->addChartDataChangeEventListener(
- uno::Reference<chart::XChartDataChangeEventListener>(pListener1.get()));
+ uno::Reference<chart::XChartDataChangeEventListener>(pListener1));
uno::Reference<chart::XChartDataArray> xCDD(xCD, uno::UNO_QUERY_THROW);
uno::Sequence<uno::Sequence<double>> aData = xCDD->getData();
@@ -84,7 +84,7 @@ void XChartData::testChartDataChangeEventListener()
pListener1->m_bListenerCalled = false;
xCD->removeChartDataChangeEventListener(
- uno::Reference<chart::XChartDataChangeEventListener>(pListener1.get()));
+ uno::Reference<chart::XChartDataChangeEventListener>(pListener1));
aData[0][0] += 1.0;
xCDD->setData(aData);
CPPUNIT_ASSERT(pListener0->m_bListenerCalled);
diff --git a/test/source/sheet/xactivationbroadcaster.cxx b/test/source/sheet/xactivationbroadcaster.cxx
index 93fa5ab93689..6c7769db5a38 100644
--- a/test/source/sheet/xactivationbroadcaster.cxx
+++ b/test/source/sheet/xactivationbroadcaster.cxx
@@ -51,8 +51,7 @@ void XActivationBroadcaster::testAddRemoveActivationEventListener()
xAB->addActivationEventListener(nullptr);
rtl::Reference<MockedActivationEventListener> xListener = new MockedActivationEventListener();
- xAB->addActivationEventListener(
- uno::Reference<sheet::XActivationEventListener>(xListener.get()));
+ xAB->addActivationEventListener(uno::Reference<sheet::XActivationEventListener>(xListener));
uno::Reference<sheet::XSpreadsheetView> xView(xAB, UNO_QUERY_THROW);
uno::Reference<sheet::XSpreadsheet> xSheet1(xView->getActiveSheet(), UNO_SET_THROW);
@@ -62,8 +61,7 @@ void XActivationBroadcaster::testAddRemoveActivationEventListener()
CPPUNIT_ASSERT_MESSAGE("Listener wasn't called", xListener->mbListenerCalled);
- xAB->removeActivationEventListener(
- uno::Reference<sheet::XActivationEventListener>(xListener.get()));
+ xAB->removeActivationEventListener(uno::Reference<sheet::XActivationEventListener>(xListener));
xView->setActiveSheet(xSheet1);
CPPUNIT_ASSERT_MESSAGE("Listener still called after removal", xListener->mbListenerCalled);
}
diff --git a/test/source/util/xrefreshable.cxx b/test/source/util/xrefreshable.cxx
index f448d93e5008..5d145e5b2fbe 100644
--- a/test/source/util/xrefreshable.cxx
+++ b/test/source/util/xrefreshable.cxx
@@ -49,13 +49,13 @@ void XRefreshable::testRefreshListener()
uno::Reference<util::XRefreshable> xRefreshable(init(), uno::UNO_QUERY_THROW);
rtl::Reference<MockedRefreshListener> xListener = new MockedRefreshListener();
- xRefreshable->addRefreshListener(uno::Reference<util::XRefreshListener>(xListener.get()));
+ xRefreshable->addRefreshListener(uno::Reference<util::XRefreshListener>(xListener));
xRefreshable->refresh();
CPPUNIT_ASSERT(xListener->m_bListenerCalled);
xListener->m_bListenerCalled = false;
- xRefreshable->removeRefreshListener(uno::Reference<util::XRefreshListener>(xListener.get()));
+ xRefreshable->removeRefreshListener(uno::Reference<util::XRefreshListener>(xListener));
xRefreshable->refresh();
CPPUNIT_ASSERT(!xListener->m_bListenerCalled);
}
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index 8b9c247190c3..56792659f9b4 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -6986,7 +6986,7 @@ css::uno::Any SVTXFormattedField::getProperty( const OUString& PropertyName )
{
if (!bIsStandardSupplier)
{ // ansonsten void
- css::uno::Reference< css::util::XNumberFormatsSupplier > xSupplier = m_xCurrentSupplier.get();
+ css::uno::Reference< css::util::XNumberFormatsSupplier > xSupplier = m_xCurrentSupplier;
aReturn <<= xSupplier;
}
}
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
index 3d65945cede3..90ecc7576b49 100644
--- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
@@ -267,7 +267,7 @@ private:
for ( sal_Int32 i=0; i<rowElements; ++i )
{
::rtl::Reference< GridColumn > const pGridColumn = new GridColumn();
- Reference< XGridColumn > const xColumn( pGridColumn.get() );
+ Reference< XGridColumn > const xColumn( pGridColumn );
OUString colTitle = "Column " + OUString::number( i + 1 );
pGridColumn->setTitle( colTitle );
pGridColumn->setColumnWidth( 80 /* APPFONT */ );
diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.cxx b/toolkit/source/controls/grid/sortablegriddatamodel.cxx
index ffd9b0f9067b..e657b2d613a2 100644
--- a/toolkit/source/controls/grid/sortablegriddatamodel.cxx
+++ b/toolkit/source/controls/grid/sortablegriddatamodel.cxx
@@ -843,7 +843,7 @@ void lcl_clear( STLCONTAINER& i_container )
{
m_currentSortColumn = -1;
- Reference< XComponent > const delegatorComponent( m_delegator.get() );
+ Reference< XComponent > const delegatorComponent( m_delegator );
m_delegator->removeGridDataListener( this );
m_delegator.clear();
delegatorComponent->dispose();
diff --git a/toolkit/source/controls/tree/treedatamodel.cxx b/toolkit/source/controls/tree/treedatamodel.cxx
index 34d3bf4ab67b..73aea80a53ea 100644
--- a/toolkit/source/controls/tree/treedatamodel.cxx
+++ b/toolkit/source/controls/tree/treedatamodel.cxx
@@ -190,7 +190,7 @@ void SAL_CALL MutableTreeDataModel::setRoot( const Reference< XMutableTreeNode >
throw IllegalArgumentException();
xImpl->mbIsInserted = true;
- mxRootNode.set(xImpl.get());
+ mxRootNode = xImpl;
Reference< XTreeNode > xParentNode;
broadcast( structure_changed, xParentNode, mxRootNode );
@@ -305,8 +305,7 @@ void SAL_CALL MutableTreeNode::setDataValue( const Any& _datavalue )
void SAL_CALL MutableTreeNode::appendChild( const Reference< XMutableTreeNode >& xChildNode )
{
::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- Reference< XTreeNode > xNode( xChildNode.get() );
- MutableTreeNodeRef xImpl( dynamic_cast< MutableTreeNode* >( xNode.get() ) );
+ MutableTreeNodeRef xImpl( dynamic_cast< MutableTreeNode* >( xChildNode.get() ) );
if( !xImpl.is() || xImpl->mbIsInserted || (this == xImpl.get()) )
throw IllegalArgumentException();
@@ -315,7 +314,7 @@ void SAL_CALL MutableTreeNode::appendChild( const Reference< XMutableTreeNode >&
xImpl->setParent(this);
xImpl->mbIsInserted = true;
- broadcast_changes( xNode, true );
+ broadcast_changes( xChildNode, true );
}
void SAL_CALL MutableTreeNode::insertChildByIndex( sal_Int32 nChildIndex, const Reference< XMutableTreeNode >& xChildNode )
@@ -325,8 +324,7 @@ void SAL_CALL MutableTreeNode::insertChildByIndex( sal_Int32 nChildIndex, const
if( (nChildIndex < 0) || (nChildIndex > static_cast<sal_Int32>(maChildren.size())) )
throw IndexOutOfBoundsException();
- Reference< XTreeNode > xNode( xChildNode.get() );
- MutableTreeNodeRef xImpl( dynamic_cast< MutableTreeNode* >( xNode.get() ) );
+ MutableTreeNodeRef xImpl( dynamic_cast< MutableTreeNode* >( xChildNode.get() ) );
if( !xImpl.is() || xImpl->mbIsInserted || (this == xImpl.get()) )
throw IllegalArgumentException();
@@ -338,7 +336,7 @@ void SAL_CALL MutableTreeNode::insertChildByIndex( sal_Int32 nChildIndex, const
maChildren.insert( aIter, xImpl );
xImpl->setParent( this );
- broadcast_changes( xNode, true );
+ broadcast_changes( xChildNode, true );
}
void SAL_CALL MutableTreeNode::removeChildByIndex( sal_Int32 nChildIndex )
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
index 80ebb041299c..a5f7b785f06c 100644
--- a/toolkit/source/controls/unocontrolmodel.cxx
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -450,7 +450,7 @@ IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoControlModel, UnoControlModel_Base, ::cppu:
uno::Reference< util::XCloneable > UnoControlModel::createClone()
{
rtl::Reference<UnoControlModel> pClone = Clone();
- return pClone.get();
+ return pClone;
}
// css::lang::XComponent
diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx
index edac7fe62b34..c3240eee2c4b 100644
--- a/toolkit/source/helper/unowrapper.cxx
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -141,7 +141,7 @@ css::uno::Reference< css::awt::XToolkit> UnoWrapper::GetVCLToolkit()
{
if ( !mxToolkit.is() )
mxToolkit = VCLUnoHelper::CreateToolkit();
- return mxToolkit.get();
+ return mxToolkit;
}
css::uno::Reference< css::awt::XWindowPeer> UnoWrapper::GetWindowInterface( vcl::Window* pWindow )