diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-20 13:30:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-20 17:59:32 +0200 |
commit | 586cfef1df9fb99aaf018029b7f06363e96bc72b (patch) | |
tree | dc4be0619ab5fccdf1e8e8780ddcdfa022e2f0eb /sw/source/filter | |
parent | f44bd7bb0ce23535f5e0ced7966677f4fff943fc (diff) |
loplugin:referencecasting in sw
Change-Id: Ib5de4377b22815ba718559ff6fcfd6ab5a0547a6
Reviewed-on: https://gerrit.libreoffice.org/75999
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/filter')
-rw-r--r-- | sw/source/filter/html/htmlbas.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/html/htmlform.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/html/htmlforw.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/html/htmlplug.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxexport.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/writerhelper.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par4.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8toolbar.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/xml/swxml.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/xml/wrtxml.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlexp.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimp.cxx | 6 |
15 files changed, 19 insertions, 27 deletions
diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index 9750ff7f07a0..482fce55732e 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -119,7 +119,7 @@ void SwHTMLParser::EndScript() aLibName = "Standard"; // get module library container - Reference< script::XLibraryContainer > xModLibContainer( pDocSh->GetBasicContainer(), UNO_QUERY ); + Reference< script::XLibraryContainer > xModLibContainer = pDocSh->GetBasicContainer(); if ( xModLibContainer.is() ) { @@ -161,7 +161,7 @@ void SwHTMLParser::EndScript() } // get dialog library container - Reference< script::XLibraryContainer > xDlgLibContainer( pDocSh->GetDialogContainer(), UNO_QUERY ); + Reference< script::XLibraryContainer > xDlgLibContainer = pDocSh->GetDialogContainer(); if ( xDlgLibContainer.is() ) { diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index f0e14faa4471..78c8d820df34 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -321,7 +321,7 @@ const uno::Reference< drawing::XShapes > & SwHTMLForm_Impl::GetShapes() GetDrawPage(); if( m_xDrawPage.is() ) { - m_xShapes.set( m_xDrawPage, UNO_QUERY ); + m_xShapes = m_xDrawPage; OSL_ENSURE( m_xShapes.is(), "XShapes not received from drawing::XDrawPage" ); } diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index eb8697d99291..87a190b322c0 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -88,8 +88,7 @@ static void lcl_html_outEvents( SvStream& rStrm, rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars ) { - uno::Reference< container::XChild > xChild( rFormComp, uno::UNO_QUERY ); - uno::Reference< uno::XInterface > xParentIfc = xChild->getParent(); + uno::Reference< uno::XInterface > xParentIfc = rFormComp->getParent(); OSL_ENSURE( xParentIfc.is(), "lcl_html_outEvents: no parent interface" ); if( !xParentIfc.is() ) return; diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index f6a60aff7962..222ca88667c0 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -1158,7 +1158,7 @@ sal_uInt16 SwHTMLWriter::GuessOLENodeFrameType( const SwNode& rNode ) SwHTMLFrameType eType = HTML_FRMTYPE_OLE; - uno::Reference < embed::XClassifiedObject > xClass ( rObj.GetOleRef(), uno::UNO_QUERY ); + uno::Reference < embed::XClassifiedObject > xClass = rObj.GetOleRef(); SvGlobalName aClass( xClass->getClassID() ); if( aClass == SvGlobalName( SO3_PLUGIN_CLASSID ) ) { diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 1e5b7ccc9a9c..c67971cc86b6 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -5044,8 +5044,7 @@ void DocxAttributeOutput::WritePostponedChart() OString aRelId; m_nChartCount++; - uno::Reference< frame::XModel > xModel( xChartDoc, uno::UNO_QUERY ); - aRelId = m_rExport.OutputChart( xModel, m_nChartCount, m_pSerializer ); + aRelId = m_rExport.OutputChart( xChartDoc, m_nChartCount, m_pSerializer ); m_pSerializer->singleElementNS( XML_c, XML_chart, FSNS( XML_xmlns, XML_c ), GetExport().GetFilter().getNamespaceURL(OOX_NS(dmlChart)).toUtf8(), diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 813839e4b84a..9a3d37c47b5b 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -1322,13 +1322,13 @@ void DocxExport::WriteVBA() if (!xStorageBasedDocument.is()) return; - uno::Reference<embed::XStorage> xDocumentStorage(xStorageBasedDocument->getDocumentStorage(), uno::UNO_QUERY); + uno::Reference<embed::XStorage> xDocumentStorage = xStorageBasedDocument->getDocumentStorage(); OUString aMacrosName("_MS_VBA_Macros"); if (!xDocumentStorage.is() || !xDocumentStorage->hasByName(aMacrosName)) return; const sal_Int32 nOpenMode = embed::ElementModes::READ; - uno::Reference<io::XStream> xMacrosStream(xDocumentStorage->openStreamElement(aMacrosName, nOpenMode), uno::UNO_QUERY); + uno::Reference<io::XStream> xMacrosStream = xDocumentStorage->openStreamElement(aMacrosName, nOpenMode); uno::Reference<io::XOutputStream> xProjectStream; if (xMacrosStream.is()) { @@ -1352,7 +1352,7 @@ void DocxExport::WriteVBA() if (!xDocumentStorage.is() || !xDocumentStorage->hasByName(aDataName)) return; - uno::Reference<io::XStream> xDataStream(xDocumentStorage->openStreamElement(aDataName, nOpenMode), uno::UNO_QUERY); + uno::Reference<io::XStream> xDataStream = xDocumentStorage->openStreamElement(aDataName, nOpenMode); if (xDataStream.is()) { // Then the data stream, which wants to work with an already set diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 11c99b5f29d1..b7a6141f60a7 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3920,7 +3920,7 @@ bool RtfAttributeOutput::FlyFrameOLEMath(const SwFlyFrameFormat* pFlyFrameFormat return false; m_aRunText->append("{" LO_STRING_SVTOOLS_RTF_MMATH " "); - uno::Reference<util::XCloseable> xClosable(xObj->getComponent(), uno::UNO_QUERY); + uno::Reference<util::XCloseable> xClosable = xObj->getComponent(); if (!xClosable.is()) return false; // gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast directly to the target class, diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx index d3b2789b4333..c013515899ae 100644 --- a/sw/source/filter/ww8/writerhelper.cxx +++ b/sw/source/filter/ww8/writerhelper.cxx @@ -328,9 +328,7 @@ namespace sw OSL_ENSURE( !mrPers.GetEmbeddedObjectContainer().HasEmbeddedObject( mxIPRef ), "Object in adaptor is inserted?!" ); try { - uno::Reference < css::util::XCloseable > xClose( mxIPRef, uno::UNO_QUERY ); - if ( xClose.is() ) - xClose->close(true); + mxIPRef->close(true); } catch ( const css::util::CloseVetoException& ) { diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 1a76791f8e3c..dd0fad0b0421 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1866,9 +1866,8 @@ void SwWW8ImplReader::ImportDop() uno::Reference< uno::XComponentContext > xComponentContext(comphelper::getProcessComponentContext()); uno::Reference<container::XIndexContainer> xBox = document::IndexedPropertyValues::create(xComponentContext); xBox->insertByIndex(sal_Int32(0), uno::makeAny(aViewProps)); - uno::Reference<container::XIndexAccess> xIndexAccess(xBox, uno::UNO_QUERY); uno::Reference<document::XViewDataSupplier> xViewDataSupplier(m_pDocShell->GetModel(), uno::UNO_QUERY); - xViewDataSupplier->setViewData(xIndexAccess); + xViewDataSupplier->setViewData(xBox); } m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::USE_VIRTUAL_DEVICE, !m_xWDop->fUsePrinterMetrics); diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index 6beddecc3691..9bb3521e51ea 100644 --- a/sw/source/filter/ww8/ww8par4.cxx +++ b/sw/source/filter/ww8/ww8par4.cxx @@ -210,7 +210,7 @@ SwFlyFrameFormat* SwWW8ImplReader::InsertOle(SdrOle2Obj &rObject, SwFlyFrameFormat *pRet = nullptr; std::unique_ptr<SfxItemSet> pMathFlySet; - uno::Reference < embed::XClassifiedObject > xClass( rObject.GetObjRef(), uno::UNO_QUERY ); + uno::Reference < embed::XClassifiedObject > xClass = rObject.GetObjRef(); if( xClass.is() ) { SvGlobalName aClassName( xClass->getClassID() ); diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx index c03777bbbdf8..a2406cf34d11 100644 --- a/sw/source/filter/ww8/ww8toolbar.cxx +++ b/sw/source/filter/ww8/ww8toolbar.cxx @@ -579,7 +579,7 @@ SwTBC::ImportToolBarControl( SwCTBWrapper& rWrapper, const css::uno::Reference< return false; if ( !bIsMenuBar ) { - if ( !helper.createMenu( pMenu->Name(), uno::Reference< container::XIndexAccess >( xMenuDesc, uno::UNO_QUERY ) ) ) + if ( !helper.createMenu( pMenu->Name(), xMenuDesc ) ) return false; } else diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index 25c415d65fcd..f82b4709c406 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -529,7 +529,7 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con OSL_ENSURE( pDocSh, "XMLReader::Read: got no doc shell" ); if( !pDocSh ) return ERR_SWG_READ_ERROR; - uno::Reference< lang::XComponent > xModelComp( pDocSh->GetModel(), UNO_QUERY ); + uno::Reference< lang::XComponent > xModelComp = pDocSh->GetModel(); OSL_ENSURE( xModelComp.is(), "XMLReader::Read: got no model" ); if( !xModelComp.is() ) diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx index 5ca7e7212be6..e4cef6663a15 100644 --- a/sw/source/filter/xml/wrtxml.cxx +++ b/sw/source/filter/xml/wrtxml.cxx @@ -543,9 +543,8 @@ bool SwXMLWriter::WriteThroughComponent( xSaxWriter->setOutputStream( xOutputStream ); // prepare arguments (prepend doc handler to given arguments) - uno::Reference<xml::sax::XDocumentHandler> xDocHandler( xSaxWriter,UNO_QUERY); Sequence<Any> aArgs( 1 + rArguments.getLength() ); - aArgs[0] <<= xDocHandler; + aArgs[0] <<= xSaxWriter; std::copy(rArguments.begin(), rArguments.end(), std::next(aArgs.begin())); // get filter component diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index da4020083fbc..20457677a024 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -314,7 +314,7 @@ XMLShapeExport* SwXMLExport::CreateShapeExport() Reference < XDrawPageSupplier > xDPS( GetModel(), UNO_QUERY ); if( xDPS.is() ) { - Reference < XShapes > xShapes( xDPS->getDrawPage(), UNO_QUERY ); + Reference < XShapes > xShapes = xDPS->getDrawPage(); pShapeExport->seekShapes( xShapes ); } diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 0c9f5e84ae84..aee43cb6f1ae 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1186,8 +1186,7 @@ SvTextShapeImportHelper::SvTextShapeImportHelper(SvXMLImport& rImp) : } xPage = xSupplier->getDrawPage(); - Reference<XShapes> xShapes( xPage, UNO_QUERY ); - XMLShapeImportHelper::startPage( xShapes ); + XMLShapeImportHelper::startPage( xPage ); } } @@ -1197,8 +1196,7 @@ SvTextShapeImportHelper::~SvTextShapeImportHelper() if (xPage.is()) { - Reference<XShapes> xShapes( xPage, UNO_QUERY ); - XMLShapeImportHelper::endPage(xShapes); + XMLShapeImportHelper::endPage(xPage); } } |