[Libreoffice-commits] core.git: 2 commits - vbahelper/source vcl/qa vcl/source vcl/unx writerfilter/source xmlhelp/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun Jul 21 06:51:42 UTC 2019


 vbahelper/source/msforms/vbacontrol.cxx            |    2 +-
 vbahelper/source/vbahelper/vbashapes.cxx           |    2 +-
 vcl/qa/cppunit/lifecycle.cxx                       |    2 +-
 vcl/source/control/edit.cxx                        |    5 ++---
 vcl/source/control/throbber.cxx                    |    2 +-
 vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx         |    7 +++----
 writerfilter/source/dmapper/DomainMapper_Impl.cxx  |   13 +++++--------
 writerfilter/source/dmapper/DomainMapper_Impl.hxx  |    2 +-
 writerfilter/source/dmapper/ModelEventListener.cxx |    2 +-
 writerfilter/source/dmapper/OLEHandler.cxx         |    2 +-
 writerfilter/source/rtftok/rtfdispatchflag.cxx     |    3 +--
 writerfilter/source/rtftok/rtfdocumentimpl.cxx     |    8 +++-----
 xmlhelp/source/cxxhelp/provider/databases.cxx      |    6 +++---
 xmlhelp/source/treeview/tvread.cxx                 |    2 +-
 14 files changed, 25 insertions(+), 33 deletions(-)

New commits:
commit f9b5657c4cff29f4a0cd65d2789e091f1297a152
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Jul 20 18:27:10 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Jul 21 08:50:50 2019 +0200

    loplugin:referencecasting in writerfilter..xmlhelp
    
    Change-Id: I84954e35f285d968e3a83591c476b3c814c2a13f
    Reviewed-on: https://gerrit.libreoffice.org/76033
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 62eab11b16cc..f566f6d4aa4a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -416,7 +416,7 @@ void DomainMapper_Impl::RemoveLastParagraph( )
             xCursor->gotoEnd(false);
         }
         else
-            xCursor.set(m_aTextAppendStack.top().xCursor, uno::UNO_QUERY);
+            xCursor = m_aTextAppendStack.top().xCursor;
         uno::Reference<container::XEnumerationAccess> xEnumerationAccess(xCursor, uno::UNO_QUERY);
         // Keep the character properties of the last but one paragraph, even if
         // it's empty. This works for headers/footers, and maybe in other cases
@@ -1498,8 +1498,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
                     else
                         xCur->gotoEnd( false );
                     xCur->goLeft( 1 , true );
-                    uno::Reference< text::XTextRange > xParaEnd( xCur, uno::UNO_QUERY );
-                    CheckParaMarkerRedline( xParaEnd );
+                    CheckParaMarkerRedline( xCur );
                 }
 
                 // tdf#118521 set paragraph top or bottom margin based on the paragraph style
@@ -5200,7 +5199,7 @@ void DomainMapper_Impl::PopFieldContext()
                 {
                     xToInsert.set(pContext->GetTC(), uno::UNO_QUERY);
                     if( !xToInsert.is() && !m_bStartTOC && !m_bStartIndex && !m_bStartBibliography )
-                        xToInsert.set( pContext->GetTextField(), uno::UNO_QUERY);
+                        xToInsert = pContext->GetTextField();
                     if( xToInsert.is() && !m_bStartTOC && !m_bStartIndex && !m_bStartBibliography)
                     {
                         PropertyMap aMap;
@@ -5230,8 +5229,7 @@ void DomainMapper_Impl::PopFieldContext()
                             }
                             else
                             {
-                                uno::Reference<text::XTextRange> xTxtRange(xCrsr, uno::UNO_QUERY);
-                                pFormControlHelper->insertControl(xTxtRange);
+                                pFormControlHelper->insertControl(xCrsr);
                             }
                         }
                         else if (!pContext->GetHyperlinkURL().isEmpty() && xCrsr.is())
@@ -5911,9 +5909,8 @@ void DomainMapper_Impl::ApplySettingsTable()
                 }
                 uno::Reference<container::XIndexContainer> xBox = document::IndexedPropertyValues::create(m_xComponentContext);
                 xBox->insertByIndex(sal_Int32(0), uno::makeAny(comphelper::containerToSequence(aViewProps)));
-                uno::Reference<container::XIndexAccess> xIndexAccess(xBox, uno::UNO_QUERY);
                 uno::Reference<document::XViewDataSupplier> xViewDataSupplier(m_xTextDocument, uno::UNO_QUERY);
-                xViewDataSupplier->setViewData(xIndexAccess);
+                xViewDataSupplier->setViewData(xBox);
             }
 
             uno::Reference< beans::XPropertySet > xSettings(m_xTextFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 185c143af47b..40317732273b 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -225,7 +225,7 @@ struct TextAppendContext
         : xTextAppend(xAppend)
     {
         xCursor.set(xCur, css::uno::UNO_QUERY);
-        xInsertPosition.set(xCursor, css::uno::UNO_QUERY);
+        xInsertPosition = xCursor;
     }
 };
 
diff --git a/writerfilter/source/dmapper/ModelEventListener.cxx b/writerfilter/source/dmapper/ModelEventListener.cxx
index bc2286d69dea..3b3c36c9597e 100644
--- a/writerfilter/source/dmapper/ModelEventListener.cxx
+++ b/writerfilter/source/dmapper/ModelEventListener.cxx
@@ -61,7 +61,7 @@ void ModelEventListener::notifyEvent( const document::EventObject& rEvent )
 
             // If we have PAGEREF fields, update fields as well.
             uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(rEvent.Source, uno::UNO_QUERY);
-            uno::Reference<container::XEnumeration> xEnumeration(xTextFieldsSupplier->getTextFields()->createEnumeration(), uno::UNO_QUERY);
+            uno::Reference<container::XEnumeration> xEnumeration = xTextFieldsSupplier->getTextFields()->createEnumeration();
             sal_Int32 nIndex = 0;
             while(xEnumeration->hasMoreElements())
             {
diff --git a/writerfilter/source/dmapper/OLEHandler.cxx b/writerfilter/source/dmapper/OLEHandler.cxx
index c59e041b28a4..123475515522 100644
--- a/writerfilter/source/dmapper/OLEHandler.cxx
+++ b/writerfilter/source/dmapper/OLEHandler.cxx
@@ -211,7 +211,7 @@ void OLEHandler::importStream(const uno::Reference<uno::XComponentContext>& xCom
     // Set target document.
     uno::Reference<document::XImporter> xImporter(xInterface, uno::UNO_QUERY);
     uno::Reference<document::XEmbeddedObjectSupplier> xSupplier(xOLE, uno::UNO_QUERY);
-    uno::Reference<lang::XComponent> xEmbeddedObject(xSupplier->getEmbeddedObject(), uno::UNO_QUERY);
+    uno::Reference<lang::XComponent> xEmbeddedObject = xSupplier->getEmbeddedObject();
     if (!xEmbeddedObject.is())
         return;
     xImporter->setTargetDocument( xEmbeddedObject );
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index ce0eeec9d5d2..32de52c40b32 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -1015,8 +1015,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
             m_aStates.top().getDrawingObject().setPropertySet(xPropertySet);
             if (xDrawSupplier.is())
             {
-                uno::Reference<drawing::XShapes> xShapes(xDrawSupplier->getDrawPage(),
-                                                         uno::UNO_QUERY);
+                uno::Reference<drawing::XShapes> xShapes = xDrawSupplier->getDrawPage();
                 if (xShapes.is() && nKeyword != RTF_DPTXBX)
                 {
                     // set default VertOrient before inserting
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index b829c8aa9fd2..a022b6c67de3 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -320,8 +320,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
     uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(
         m_xDstDoc, uno::UNO_QUERY);
     if (xDocumentPropertiesSupplier.is())
-        m_xDocumentProperties.set(xDocumentPropertiesSupplier->getDocumentProperties(),
-                                  uno::UNO_QUERY);
+        m_xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties();
 
     m_pGraphicHelper.reset(new oox::GraphicHelper(m_xContext, xFrame, oox::StorageRef()));
 
@@ -958,7 +957,7 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
         uno::Reference<drawing::XDrawPageSupplier> const xDrawSupplier(m_xDstDoc, uno::UNO_QUERY);
         if (xDrawSupplier.is())
         {
-            uno::Reference<drawing::XShapes> xShapes(xDrawSupplier->getDrawPage(), uno::UNO_QUERY);
+            uno::Reference<drawing::XShapes> xShapes = xDrawSupplier->getDrawPage();
             if (xShapes.is())
                 xShapes->add(xShape);
         }
@@ -3119,8 +3118,7 @@ RTFError RTFDocumentImpl::popState()
             uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(
                 m_xDstDoc, uno::UNO_QUERY);
             if (xDocumentPropertiesSupplier.is())
-                m_xDocumentProperties.set(xDocumentPropertiesSupplier->getDocumentProperties(),
-                                          uno::UNO_QUERY);
+                m_xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties();
 
             if (m_xDocumentProperties.is())
             {
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 04aba4c5991e..20f8b51fd861 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -109,7 +109,7 @@ OUString Databases::expandURL( const OUString& aURL, const Reference< uno::XComp
         Reference< uri::XUriReference > uriRef;
         for (;;)
         {
-            uriRef.set( xFac->parse( aRetURL ), UNO_QUERY );
+            uriRef = xFac->parse( aRetURL );
             if ( uriRef.is() )
             {
                 Reference < uri::XVndSunStarExpandUrl > sxUri( uriRef, UNO_QUERY );
@@ -140,7 +140,7 @@ Databases::Databases( bool showBasic,
       vendVersion( "%VENDORVERSION" ),
       vendShort( "%VENDORSHORT" )
 {
-    m_xSMgr.set( m_xContext->getServiceManager(), UNO_QUERY );
+    m_xSMgr = m_xContext->getServiceManager();
 
     m_vAdd[0] = 12;
     m_vAdd[1] = 15;
@@ -1600,7 +1600,7 @@ Reference< XHierarchicalNameAccess > JarFileIterator::implGetJarFromPackage
         aArg.Value <<= OUString(ZIP_STORAGE_FORMAT_STRING);
         aArguments[ 1 ] <<= aArg;
 
-        Reference< XMultiComponentFactory >xSMgr( m_xContext->getServiceManager(), UNO_QUERY );
+        Reference< XMultiComponentFactory >xSMgr = m_xContext->getServiceManager();
         Reference< XInterface > xIfc
             = xSMgr->createInstanceWithArgumentsAndContext(
                 "com.sun.star.packages.comp.ZipPackage",
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index 72f28fef63c8..9dac255a8320 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -1113,7 +1113,7 @@ OUString TreeFileIterator::expandURL( const OUString& aURL )
     Reference< uri::XUriReference > uriRef;
     for (;;)
     {
-        uriRef.set( xFac->parse( aRetURL ), UNO_QUERY );
+        uriRef = xFac->parse( aRetURL );
         if ( uriRef.is() )
         {
             Reference < uri::XVndSunStarExpandUrl > sxUri( uriRef, UNO_QUERY );
commit f292f808a1ced65db45141772dbd6e45c5d151ea
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Jul 20 18:26:32 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Jul 21 08:50:11 2019 +0200

    loplugin:referencecasting in vbahelper..vcl
    
    Change-Id: I2bd9e2c4e8a3d56a7b2168bd2ccff389051e5b4c
    Reviewed-on: https://gerrit.libreoffice.org/76032
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
index 5d32f2d9af72..2775290f9bcd 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -87,7 +87,7 @@ ScVbaControl::getWindowPeer()
     uno::Reference< view::XControlAccess > xControlAccess( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
     try
     {
-        uno::Reference< awt::XControl > xControl( xControlAccess->getControl( xControlModel ), uno::UNO_QUERY );
+        uno::Reference< awt::XControl > xControl = xControlAccess->getControl( xControlModel );
         xWinPeer =  xControl->getPeer();
     }
     catch(const uno::Exception&)
diff --git a/vbahelper/source/vbahelper/vbashapes.cxx b/vbahelper/source/vbahelper/vbashapes.cxx
index 59e0d9df1fb5..6d6bd434b35e 100644
--- a/vbahelper/source/vbahelper/vbashapes.cxx
+++ b/vbahelper/source/vbahelper/vbashapes.cxx
@@ -82,7 +82,7 @@ void ScVbaShapes::initBaseCollection()
     for ( sal_Int32 index=0; index<nLen; ++index )
         aShapes.emplace_back( m_xIndexAccess->getByIndex( index ) , uno::UNO_QUERY );
     uno::Reference< container::XIndexAccess > xShapes( new XNamedObjectCollectionHelper< drawing::XShape >( aShapes ) );
-    m_xIndexAccess.set( xShapes, uno::UNO_QUERY );
+    m_xIndexAccess = xShapes;
     m_xNameAccess.set( xShapes, uno::UNO_QUERY );
 }
 
diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx
index dedc4e8f90b0..32a29e33c326 100644
--- a/vcl/qa/cppunit/lifecycle.cxx
+++ b/vcl/qa/cppunit/lifecycle.cxx
@@ -320,7 +320,7 @@ void LifecycleTest::testToolkit()
     CPPUNIT_ASSERT(xWindow.is());
 
     // test UNO dispose
-    css::uno::Reference<css::lang::XComponent> xWinComponent(xWindow, css::uno::UNO_QUERY);
+    css::uno::Reference<css::lang::XComponent> xWinComponent = xWindow;
     CPPUNIT_ASSERT(xWinComponent.is());
     CPPUNIT_ASSERT(!pVclWin->getRef()->IsDisposed());
     xWinComponent->dispose();
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 8485dfcd41af..37c135fbd1bd 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -238,8 +238,7 @@ void Edit::dispose()
             GetDropTarget()->removeDropTargetListener( xDTL );
         }
 
-        uno::Reference< lang::XEventListener> xEL( mxDnDListener, uno::UNO_QUERY );
-        xEL->disposing( lang::EventObject() );  // #95154# #96585# Empty Source means it's the Client
+        mxDnDListener->disposing( lang::EventObject() );  // #95154# #96585# Empty Source means it's the Client
         mxDnDListener.clear();
     }
 
@@ -808,7 +807,7 @@ void Edit::ImplInsertText( const OUString& rStr, const Selection* pNewSel, bool
 
         // determine if input-sequence-checking should be applied or not
 
-        uno::Reference < i18n::XBreakIterator > xBI( ImplGetBreakIterator(), UNO_QUERY );
+        uno::Reference < i18n::XBreakIterator > xBI = ImplGetBreakIterator();
         bool bIsInputSequenceChecking = rStr.getLength() == 1 &&
                 officecfg::Office::Common::I18N::CTL::CTLFont::get() &&
                 officecfg::Office::Common::I18N::CTL::CTLSequenceChecking::get() &&
diff --git a/vcl/source/control/throbber.cxx b/vcl/source/control/throbber.cxx
index 50621a523637..104a3cc66778 100644
--- a/vcl/source/control/throbber.cxx
+++ b/vcl/source/control/throbber.cxx
@@ -81,7 +81,7 @@ namespace
         {
             Reference< XGraphic > xGraphic;
             aMediaProperties.put( "URL", rImageURL );
-            xGraphic.set( xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_QUERY );
+            xGraphic = xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() );
             aImages.emplace_back( xGraphic );
         }
 
diff --git a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
index 50fb9c0f4d08..ade5ff504539 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
@@ -134,11 +134,10 @@ sal_Int16 SAL_CALL SalGtkFolderPicker::execute()
 
     sal_Int16 retVal = 0;
 
-    uno::Reference< awt::XExtendedToolkit > xToolkit(
-        awt::Toolkit::create(m_xContext),
-        uno::UNO_QUERY);
+    uno::Reference< awt::XExtendedToolkit > xToolkit =
+        awt::Toolkit::create(m_xContext);
 
-    uno::Reference<frame::XDesktop> xDesktop(frame::Desktop::create(m_xContext), uno::UNO_QUERY);
+    uno::Reference<frame::XDesktop> xDesktop = frame::Desktop::create(m_xContext);
 
     GtkWindow *pParent = RunDialog::GetTransientFor();
     if (pParent)


More information about the Libreoffice-commits mailing list