diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-19 20:09:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-20 07:56:54 +0200 |
commit | 8239e13dac39741003dfbce7099c3197080aafa8 (patch) | |
tree | 99a000030329e6b7363a2036cd27d0d64396f089 /sc/source/ui/unoobj | |
parent | 84abf28e05fc55be867028f3d3a59220ca2669f0 (diff) |
loplugin:referencecasting in sc
Change-Id: Ife30500d1ff67e06afc4d64634febfb4c161c702
Reviewed-on: https://gerrit.libreoffice.org/75976
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/unoobj')
-rw-r--r-- | sc/source/ui/unoobj/TablePivotCharts.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/unoobj/chartuno.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 36 | ||||
-rw-r--r-- | sc/source/ui/unoobj/fielduno.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/unoobj/textuno.cxx | 9 |
5 files changed, 24 insertions, 34 deletions
diff --git a/sc/source/ui/unoobj/TablePivotCharts.cxx b/sc/source/ui/unoobj/TablePivotCharts.cxx index e5e8a88f03fa..a15250afdb62 100644 --- a/sc/source/ui/unoobj/TablePivotCharts.cxx +++ b/sc/source/ui/unoobj/TablePivotCharts.cxx @@ -130,10 +130,9 @@ void SAL_CALL TablePivotCharts::addNewByName(OUString const & rName, uno::Reference<chart2::data::XDataProvider> xDataProvider(pPivotTableDataProvider.release()); uno::Reference<chart2::data::XDataReceiver> xReceiver; - uno::Reference<embed::XComponentSupplier> xCompSupp(xObject, uno::UNO_QUERY); - if (xCompSupp.is()) - xReceiver.set(xCompSupp->getComponent(), uno::UNO_QUERY); + if (xObject.is()) + xReceiver.set(xObject->getComponent(), uno::UNO_QUERY); if (xReceiver.is()) { diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx index b7464631cee5..405cc31ec55c 100644 --- a/sc/source/ui/unoobj/chartuno.cxx +++ b/sc/source/ui/unoobj/chartuno.cxx @@ -207,9 +207,8 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName, ScChart2DataProvider( &rDoc ); // Chart -> DataReceiver uno::Reference< chart2::data::XDataReceiver > xReceiver; - uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY ); - if( xCompSupp.is()) - xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY ); + if( xObj.is()) + xReceiver.set( xObj->getComponent(), uno::UNO_QUERY ); if( xReceiver.is()) { OUString sRangeStr; diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 953c977454da..700a099fd4fb 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1506,30 +1506,26 @@ bool ScModelObj::FillRenderMarkData( const uno::Any& aSelection, else if( xShapes.is() ) { //print a selected ole object - uno::Reference< container::XIndexAccess > xIndexAccess( xShapes, uno::UNO_QUERY ); - if( xIndexAccess.is() ) + // multi selection isn't supported yet + uno::Reference< drawing::XShape > xShape( xShapes->getByIndex(0), uno::UNO_QUERY ); + SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape ); + if( pShape ) { - // multi selection isn't supported yet - uno::Reference< drawing::XShape > xShape( xIndexAccess->getByIndex(0), uno::UNO_QUERY ); - SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape ); - if( pShape ) + SdrObject *pSdrObj = pShape->GetSdrObject(); + if( pDocShell ) { - SdrObject *pSdrObj = pShape->GetSdrObject(); - if( pDocShell ) + ScDocument& rDoc = pDocShell->GetDocument(); + if( pSdrObj ) { - ScDocument& rDoc = pDocShell->GetDocument(); - if( pSdrObj ) + tools::Rectangle aObjRect = pSdrObj->GetCurrentBoundRect(); + SCTAB nCurrentTab = ScDocShell::GetCurTab(); + ScRange aRange = rDoc.GetRange( nCurrentTab, aObjRect ); + rMark.SetMarkArea( aRange ); + + if( rMark.IsMarked() && !rMark.IsMultiMarked() ) { - tools::Rectangle aObjRect = pSdrObj->GetCurrentBoundRect(); - SCTAB nCurrentTab = ScDocShell::GetCurTab(); - ScRange aRange = rDoc.GetRange( nCurrentTab, aObjRect ); - rMark.SetMarkArea( aRange ); - - if( rMark.IsMarked() && !rMark.IsMultiMarked() ) - { - rStatus.SetMode( SC_PRINTSEL_RANGE_EXCLUSIVELY_OLE_AND_DRAW_OBJECTS ); - bDone = true; - } + rStatus.SetMode( SC_PRINTSEL_RANGE_EXCLUSIVELY_OLE_AND_DRAW_OBJECTS ); + bDone = true; } } } diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index c3b49d99c734..8ee9d4374ee0 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -473,8 +473,7 @@ uno::Reference<text::XTextField> ScHeaderFieldsObj::GetObjectByIndex_Impl(sal_In break; } - uno::Reference<text::XTextRange> xTemp(xText, uno::UNO_QUERY); - xTextRange = xTemp; + xTextRange = xText; sal_Int32 nPar = aTempEngine.GetFieldPar(); sal_Int32 nPos = aTempEngine.GetFieldPos(); diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index a294d8edade7..3ef1645d2542 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -424,16 +424,13 @@ void SAL_CALL ScHeaderFooterTextObj::insertTextContent( switch ( aTextData.GetPart() ) { case ScHeaderFooterPart::LEFT: - xTextRange = uno::Reference<text::XTextRange>( - aTextData.GetContentObj()->getLeftText(), uno::UNO_QUERY); + xTextRange = aTextData.GetContentObj()->getLeftText(); break; case ScHeaderFooterPart::CENTER: - xTextRange = uno::Reference<text::XTextRange>( - aTextData.GetContentObj()->getCenterText(), uno::UNO_QUERY); + xTextRange = aTextData.GetContentObj()->getCenterText(); break; case ScHeaderFooterPart::RIGHT: - xTextRange = uno::Reference<text::XTextRange>( - aTextData.GetContentObj()->getRightText(), uno::UNO_QUERY); + xTextRange = aTextData.GetContentObj()->getRightText(); break; } |