[Libreoffice-commits] core.git: chart2/source oox/source sc/source sd/source sw/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Feb 25 07:37:51 UTC 2020


 chart2/source/controller/chartapiwrapper/TitleWrapper.cxx         |    3 
 chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx   |    9 +
 chart2/source/controller/main/ObjectHierarchy.cxx                 |    9 +
 chart2/source/tools/ChartViewHelper.cxx                           |    2 
 chart2/source/view/main/ShapeFactory.cxx                          |    3 
 oox/source/core/xmlfilterbase.cxx                                 |    7 -
 oox/source/ppt/pptimport.cxx                                      |    3 
 sc/source/core/data/drwlayer.cxx                                  |    3 
 sc/source/core/tool/chartlock.cxx                                 |    3 
 sc/source/filter/excel/xeroot.cxx                                 |    3 
 sc/source/filter/oox/drawingfragment.cxx                          |    3 
 sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx |    6 -
 sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx     |    6 -
 sd/source/ui/accessibility/AccessiblePresentationShape.cxx        |   11 +-
 sd/source/ui/unoidl/unosrch.cxx                                   |   49 +++-------
 sw/source/core/doc/docedt.cxx                                     |    3 
 sw/source/core/doc/docnew.cxx                                     |    3 
 sw/source/core/edit/edlingu.cxx                                   |    3 
 sw/source/filter/xml/wrtxml.cxx                                   |    4 
 sw/source/uibase/table/tablemgr.cxx                               |   19 +--
 20 files changed, 71 insertions(+), 81 deletions(-)

New commits:
commit b7a1e92a27bc26f222526eb50ab80c0e6966be7a
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sun Feb 23 21:06:10 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Feb 25 08:37:17 2020 +0100

    loplugin:referencecasting
    
    getting --enable-pch=normal working with clang
    means that the plugins now have a better view on some
    stuff, so trigger more warnings
    
    Change-Id: I83ca010c0ef07c8106068362bb50a354e3cf7dae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89312
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
index cffd22e4d56b..c74045752aa2 100644
--- a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/chart2/RelativePosition.hpp>
 #include <com/sun/star/chart2/XTitle.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
 #include <com/sun/star/frame/XModel.hpp>
 
 #include <CharacterProperties.hxx>
@@ -195,7 +196,7 @@ TitleWrapper::TitleWrapper( ::chart::TitleHelper::eTitleType eTitleType,
         m_aEventListenerContainer( m_aMutex ),
         m_eTitleType(eTitleType)
 {
-    ControllerLockGuardUNO aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
+    ControllerLockGuardUNO aCtrlLockGuard( m_spChart2ModelContact->getChart2Document() );
     if( !getTitleObject().is() ) //#i83831# create an empty title at the model, thus references to properties can be mapped correctly
         TitleHelper::createTitle( m_eTitleType, OUString(), m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
 }
diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
index b2042a6468b9..b191f2a42468 100644
--- a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
+++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx
@@ -24,6 +24,7 @@
 #include <AxisHelper.hxx>
 #include <ControllerLockGuard.hxx>
 #include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
 
 namespace chart
 {
@@ -39,7 +40,7 @@ TitlesAndObjectsTabPage::TitlesAndObjectsTabPage(weld::Container* pPage, weld::D
     , m_xChartModel(xChartModel)
     , m_xCC(xContext)
     , m_bCommitToModel(true)
-    , m_aTimerTriggeredControllerLock( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY ) )
+    , m_aTimerTriggeredControllerLock( m_xChartModel )
     , m_xCB_Grid_X(m_xBuilder->weld_check_button("x"))
     , m_xCB_Grid_Y(m_xBuilder->weld_check_button("y"))
     , m_xCB_Grid_Z(m_xBuilder->weld_check_button("z"))
@@ -63,13 +64,13 @@ void TitlesAndObjectsTabPage::initializePage()
     //init titles
     {
         TitleDialogData aTitleInput;
-        aTitleInput.readFromModel( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY) );
+        aTitleInput.readFromModel( m_xChartModel );
         m_xTitleResources->writeToResources( aTitleInput );
     }
 
     //init legend
     {
-        m_xLegendPositionResources->writeToResources( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY) );
+        m_xLegendPositionResources->writeToResources( m_xChartModel );
     }
 
     //init grid checkboxes
@@ -100,7 +101,7 @@ bool TitlesAndObjectsTabPage::commitPage( ::vcl::WizardTypes::CommitPageReason /
 void TitlesAndObjectsTabPage::commitToModel()
 {
     m_aTimerTriggeredControllerLock.startTimer();
-    uno::Reference< frame::XModel >  xModel( m_xChartModel, uno::UNO_QUERY);
+    uno::Reference< frame::XModel >  xModel = m_xChartModel;
 
     ControllerLockGuardUNO aLockedControllers( xModel );
 
diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx
index 2096ab4d6cce..27b8fb0fe985 100644
--- a/chart2/source/controller/main/ObjectHierarchy.cxx
+++ b/chart2/source/controller/main/ObjectHierarchy.cxx
@@ -37,6 +37,7 @@
 #include <com/sun/star/drawing/XShapes.hpp>
 #include <com/sun/star/chart2/XTitled.hpp>
 #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
 #include <com/sun/star/chart2/XChartTypeContainer.hpp>
 #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
 #include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
@@ -61,7 +62,7 @@ namespace
 struct lcl_ObjectToOID
 {
     explicit lcl_ObjectToOID( const Reference< chart2::XChartDocument > & xChartDoc ) :
-            m_xModel( xChartDoc, uno::UNO_QUERY )
+            m_xModel( xChartDoc )
     {}
 
     ::chart::ObjectIdentifier operator() ( const Reference< uno::XInterface > & xObj )
@@ -192,7 +193,7 @@ void ImplObjectHierarchy::createTree( const Reference< XChartDocument >& xChartD
         return;
 
     //@todo: change ObjectIdentifier to take an XChartDocument rather than XModel
-    Reference< frame::XModel > xModel( xChartDocument, uno::UNO_QUERY );
+    Reference< frame::XModel > xModel = xChartDocument;
     Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartDocument ) );
     ObjectIdentifier aDiaOID;
     if( xDiagram.is() )
@@ -279,7 +280,7 @@ void ImplObjectHierarchy::createLegendTree(
 {
     if( xDiagram.is() && LegendHelper::hasLegend( xDiagram ) )
     {
-        ObjectIdentifier aLegendOID( ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( xDiagram->getLegend(), Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ) ) ) );
+        ObjectIdentifier aLegendOID( ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( xDiagram->getLegend(), xChartDoc ) ) );
         rContainer.push_back( aLegendOID );
 
         // iterate over child shapes of legend and search for matching CIDs
@@ -315,7 +316,7 @@ void ImplObjectHierarchy::createAxesTree(
         // get all axes, also invisible ones
         aAxes = AxisHelper::getAllAxesOfDiagram( xDiagram );
         // Grids
-        Reference< frame::XModel > xChartModel( xChartDoc, uno::UNO_QUERY );
+        Reference< frame::XModel > xChartModel = xChartDoc;
         for( sal_Int32 nA=0; nA<aAxes.getLength(); ++nA )
         {
             Reference< XAxis > xAxis( aAxes[nA] );
diff --git a/chart2/source/tools/ChartViewHelper.cxx b/chart2/source/tools/ChartViewHelper.cxx
index 0e8332b71750..872960f17e41 100644
--- a/chart2/source/tools/ChartViewHelper.cxx
+++ b/chart2/source/tools/ChartViewHelper.cxx
@@ -41,7 +41,7 @@ void ChartViewHelper::setViewToDirtyState( const uno::Reference< frame::XModel >
                     xFact->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
             if( xModifyListener.is() )
             {
-                lang::EventObject aEvent( Reference< lang::XComponent >( xChartModel, uno::UNO_QUERY ) );
+                lang::EventObject aEvent( xChartModel );
                 xModifyListener->modified( aEvent );
             }
         }
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index f6219c650151..1ec43352b8b6 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -39,6 +39,7 @@
 #include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
 #include <com/sun/star/drawing/TextureProjectionMode.hpp>
 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
 #include <com/sun/star/drawing/XShapes2.hpp>
 #include <com/sun/star/graphic/XGraphic.hpp>
 #include <com/sun/star/drawing/XShapes.hpp>
@@ -2524,7 +2525,7 @@ uno::Reference< drawing::XShapes > ShapeFactory::getChartRootShape(
     const uno::Reference< drawing::XDrawPage>& xDrawPage )
 {
     uno::Reference< drawing::XShapes > xRet;
-    uno::Reference< drawing::XShapes > xShapes( xDrawPage, uno::UNO_QUERY );
+    const uno::Reference< drawing::XShapes > xShapes = xDrawPage;
     if( xShapes.is() )
     {
         sal_Int32 nCount = xShapes->getCount();
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index c6e9173ce53f..281f994d18a8 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -25,6 +25,7 @@
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
 #include <com/sun/star/embed/XRelationshipAccess.hpp>
+#include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
 #include <com/sun/star/xml/sax/XFastParser.hpp>
@@ -280,7 +281,7 @@ void XmlFilterBase::importDocumentProperties()
     Reference< XComponentContext > xContext = getComponentContext();
     rtl::Reference< ::oox::core::FilterDetect > xDetector( new ::oox::core::FilterDetect( xContext ) );
     xInputStream = xDetector->extractUnencryptedPackage( aMediaDesc );
-    Reference< XComponent > xModel( getModel(), UNO_QUERY );
+    Reference< XComponent > xModel = getModel();
     Reference< XStorage > xDocumentStorage (
             ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( OFOPXML_STORAGE_FORMAT_STRING, xInputStream ) );
     Reference< XInterface > xTemp = xContext->getServiceManager()->createInstanceWithContext(
@@ -1036,14 +1037,14 @@ void XmlFilterBase::importCustomFragments(css::uno::Reference<css::embed::XStora
 
         aGrabBagProperties["OOXContentTypes"] <<= aContentTypeInfo;
 
-        Reference<XComponent> xModel(getModel(), UNO_QUERY);
+        Reference<XComponent> xModel = getModel();
         oox::core::XmlFilterBase::putPropertiesToDocumentGrabBag(xModel, aGrabBagProperties);
     }
 }
 
 void XmlFilterBase::exportCustomFragments()
 {
-    Reference<XComponent> xModel(getModel(), UNO_QUERY);
+    Reference<XComponent> xModel = getModel();
     uno::Reference<beans::XPropertySet> xPropSet(xModel, uno::UNO_QUERY_THROW);
 
     uno::Reference<beans::XPropertySetInfo> xPropSetInfo = xPropSet->getPropertySetInfo();
diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx
index 1a2ef397febc..868165182c33 100644
--- a/oox/source/ppt/pptimport.cxx
+++ b/oox/source/ppt/pptimport.cxx
@@ -20,6 +20,7 @@
 #include <sal/config.h>
 #include <sal/log.hxx>
 
+#include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/document/XUndoManager.hpp>
@@ -250,7 +251,7 @@ sal_Bool SAL_CALL PowerPointImport::filter( const Sequence< PropertyValue >& rDe
                     xUndoManager->unlock();
             });
 
-            Reference< XComponent > xDocument(getModel(), UNO_QUERY);
+            Reference< XComponent > xDocument = getModel();
             xExporter->setSourceDocument(xDocument);
             if (xFilter->filter(rDescriptor))
                 return true;
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index e9deb74010bc..48a0dacbac4a 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -21,6 +21,7 @@
 #include <com/sun/star/chart/XChartDocument.hpp>
 #include <com/sun/star/chart2/XChartDocument.hpp>
 #include <com/sun/star/embed/XClassifiedObject.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
 
 #include <scitems.hxx>
 #include <editeng/eeitem.hxx>
@@ -1731,7 +1732,7 @@ void ScDrawLayer::CopyFromClip( ScDrawLayer* pClipModel, SCTAB nSourceTab, const
             if ( pNewObject->GetObjIdentifier() == OBJ_OLE2 )
             {
                 uno::Reference< embed::XEmbeddedObject > xIPObj = static_cast<SdrOle2Obj*>(pNewObject)->GetObjRef();
-                uno::Reference< embed::XClassifiedObject > xClassified( xIPObj, uno::UNO_QUERY );
+                uno::Reference< embed::XClassifiedObject > xClassified = xIPObj;
                 SvGlobalName aObjectClassName;
                 if ( xClassified.is() )
                 {
diff --git a/sc/source/core/tool/chartlock.cxx b/sc/source/core/tool/chartlock.cxx
index 7496103e5117..f1ecef38df5e 100644
--- a/sc/source/core/tool/chartlock.cxx
+++ b/sc/source/core/tool/chartlock.cxx
@@ -26,6 +26,7 @@
 #include <document.hxx>
 #include <drwlayer.hxx>
 
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
 #include <com/sun/star/embed/XComponentSupplier.hpp>
 #include <com/sun/star/frame/XModel.hpp>
 
@@ -61,7 +62,7 @@ std::vector< WeakReference< frame::XModel > > lcl_getAllLivingCharts( ScDocument
                 if( ScDocument::IsChart( pObject ) )
                 {
                     uno::Reference< embed::XEmbeddedObject > xIPObj = static_cast<SdrOle2Obj*>(pObject)->GetObjRef();
-                    uno::Reference< embed::XComponentSupplier > xCompSupp( xIPObj, uno::UNO_QUERY );
+                    uno::Reference< embed::XComponentSupplier > xCompSupp = xIPObj;
                     if( xCompSupp.is())
                     {
                         Reference< frame::XModel > xModel( xCompSupp->getComponent(), uno::UNO_QUERY );
diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx
index 6032c72d1c11..e73ee878cd28 100644
--- a/sc/source/filter/excel/xeroot.cxx
+++ b/sc/source/filter/excel/xeroot.cxx
@@ -46,6 +46,7 @@
 
 #include <formulabase.hxx>
 #include <com/sun/star/sheet/FormulaOpCodeMapEntry.hpp>
+#include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 
 using namespace ::com::sun::star;
@@ -233,7 +234,7 @@ void XclExpRoot::InitializeGlobals()
                 SAL_WARN( "sc", "XclExpRoot::InitializeGlobals - no object shell");
                 break;
             }
-            uno::Reference< lang::XComponent > xComponent( pShell->GetModel(), uno::UNO_QUERY);
+            uno::Reference< lang::XComponent > xComponent = pShell->GetModel();
             if (!xComponent.is())
             {
                 SAL_WARN( "sc", "XclExpRoot::InitializeGlobals - no component");
diff --git a/sc/source/filter/oox/drawingfragment.cxx b/sc/source/filter/oox/drawingfragment.cxx
index 700a21576d6c..032a4a5682e4 100644
--- a/sc/source/filter/oox/drawingfragment.cxx
+++ b/sc/source/filter/oox/drawingfragment.cxx
@@ -25,6 +25,7 @@
 #include <com/sun/star/container/XNameReplace.hpp>
 #include <com/sun/star/document/XEventsSupplier.hpp>
 #include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
 #include <com/sun/star/drawing/XShapes.hpp>
 #include <com/sun/star/script/ScriptEventDescriptor.hpp>
 #include <com/sun/star/script/XEventAttacherManager.hpp>
@@ -176,7 +177,7 @@ ContextHandlerRef GroupShapeContext::onCreateContext(
 
 DrawingFragment::DrawingFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
     WorksheetFragmentBase( rHelper, rFragmentPath ),
-    mxDrawPage( rHelper.getDrawPage(), UNO_QUERY )
+    mxDrawPage( rHelper.getDrawPage() )
 {
     OSL_ENSURE( mxDrawPage.is(), "DrawingFragment::DrawingFragment - missing drawing page" );
 }
diff --git a/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx b/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx
index 89fef0c4b934..909f13a156b0 100644
--- a/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx
+++ b/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx
@@ -20,6 +20,7 @@
 #include <AccessiblePresentationGraphicShape.hxx>
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <com/sun/star/drawing/XShapeDescriptor.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
 
 #include <SdShapeTypes.hxx>
 
@@ -65,9 +66,8 @@ OUString
             break;
         default:
             sName = "UnknownAccessibleImpressShape";
-            uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
-            if (xDescriptor.is())
-                sName += ": " + xDescriptor->getShapeType();
+            if (mxShape.is())
+                sName += ": " + mxShape->getShapeType();
     }
 
     return sName;
diff --git a/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx b/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx
index b396a7795f81..0cdba64548c4 100644
--- a/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx
+++ b/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx
@@ -20,6 +20,7 @@
 #include <AccessiblePresentationOLEShape.hxx>
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <com/sun/star/drawing/XShapeDescriptor.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
 
 #include <SdShapeTypes.hxx>
 
@@ -71,9 +72,8 @@ OUString
             break;
         default:
             sName = "UnknownAccessibleImpressOLEShape";
-            uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
-            if (xDescriptor.is())
-                sName += ": " + xDescriptor->getShapeType();
+            if (mxShape.is())
+                sName += ": " + mxShape->getShapeType();
     }
 
     return sName;
diff --git a/sd/source/ui/accessibility/AccessiblePresentationShape.cxx b/sd/source/ui/accessibility/AccessiblePresentationShape.cxx
index 5fef2489825a..d6e157a374fc 100644
--- a/sd/source/ui/accessibility/AccessiblePresentationShape.cxx
+++ b/sd/source/ui/accessibility/AccessiblePresentationShape.cxx
@@ -26,6 +26,7 @@
 #include <svx/ShapeTypeHandler.hxx>
 
 #include <com/sun/star/drawing/XShapeDescriptor.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::accessibility;
@@ -93,9 +94,8 @@ OUString AccessiblePresentationShape::CreateAccessibleBaseName()
             break;
         default:
             sName = SdResId(SID_SD_A11Y_P_UNKNOWN_N);
-            uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
-            if (xDescriptor.is())
-                sName += ": " + xDescriptor->getShapeType();
+            if (mxShape.is())
+                sName += ": " + mxShape->getShapeType();
     }
 
     return sName;
@@ -140,9 +140,8 @@ OUString AccessiblePresentationShape::GetStyle()
             break;
         default:
             sName = SdResId(SID_SD_A11Y_P_UNKNOWN_N_STYLE);
-            uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
-            if (xDescriptor.is())
-                sName += ": " + xDescriptor->getShapeType();
+            if (mxShape.is())
+                sName += ": " + mxShape->getShapeType();
     }
 
     return sName;
diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx
index 0312bb56d413..b3e3064c6a28 100644
--- a/sd/source/ui/unoidl/unosrch.cxx
+++ b/sd/source/ui/unoidl/unosrch.cxx
@@ -21,6 +21,7 @@
 #include <sal/config.h>
 
 #include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
 #include <vcl/svapp.hxx>
 
@@ -117,11 +118,9 @@ sal_Int32 SAL_CALL SdUnoSearchReplaceShape::replaceAll( const uno::Reference< ut
     std::vector<SearchContext_impl> aContexts;
     if(mpPage)
     {
-        uno::Reference< drawing::XDrawPage > xPage( mpPage );
+        xShapes = mpPage;
 
-        xShapes.set( xPage, uno::UNO_QUERY );
-
-        if( xShapes.is() && (xShapes->getCount() > 0) )
+        if( xShapes->getCount() )
         {
             aContexts.push_back(SearchContext_impl(xShapes));
             xShape = aContexts.back().firstShape();
@@ -204,10 +203,9 @@ uno::Reference< css::container::XIndexAccess > SAL_CALL SdUnoSearchReplaceShape:
     std::vector<SearchContext_impl> aContexts;
     if(mpPage)
     {
-        uno::Reference< drawing::XDrawPage >  xPage( mpPage );
-        xShapes.set( xPage, uno::UNO_QUERY );
+        xShapes = mpPage;
 
-        if( xShapes.is() && xShapes->getCount() > 0 )
+        if( xShapes->getCount() > 0 )
         {
             aContexts.push_back(SearchContext_impl(xShapes));
             xShape = aContexts.back().firstShape();
@@ -291,18 +289,8 @@ uno::Reference< drawing::XShape >  SdUnoSearchReplaceShape::GetCurrentShape() co
 {
     uno::Reference< drawing::XShape >  xShape;
 
-    if( mpPage )
-    {
-        uno::Reference< drawing::XDrawPage >  xPage( mpPage );
-        uno::Reference< container::XIndexAccess >  xShapes( xPage, uno::UNO_QUERY );
-        if( xShapes.is() )
-        {
-            if(xShapes->getCount() > 0)
-            {
-                xShapes->getByIndex(0) >>= xShape;
-            }
-        }
-    }
+    if( mpPage && mpPage->getCount() > 0)
+        mpPage->getByIndex(0) >>= xShape;
 
     return xShape;
 
@@ -332,24 +320,17 @@ uno::Reference< css::uno::XInterface > SAL_CALL SdUnoSearchReplaceShape::findNex
 
                 if(mpPage)
                 {
-                    uno::Reference< drawing::XDrawPage >  xPage( mpPage );
-
                     // we do a page wide search, so skip to the next shape here
-                    uno::Reference< container::XIndexAccess > xShapes( xPage, uno::UNO_QUERY );
-
                     // get next shape on our page
-                    if( xShapes.is() )
-                    {
-                        uno::Reference< drawing::XShape > xFound2( GetNextShape( xShapes, xCurrentShape ) );
-                        if( xFound2.is() && (xFound2.get() != xCurrentShape.get()) )
-                            xCurrentShape = xFound2;
-                        else
-                            xCurrentShape = nullptr;
+                    uno::Reference< drawing::XShape > xFound2( GetNextShape( mpPage, xCurrentShape ) );
+                    if( xFound2.is() && (xFound2.get() != xCurrentShape.get()) )
+                        xCurrentShape = xFound2;
+                    else
+                        xCurrentShape = nullptr;
 
-                        xRange.set( xCurrentShape, uno::UNO_QUERY );
-                        if(!(xCurrentShape.is() && (xRange.is())))
-                            xRange = nullptr;
-                    }
+                    xRange.set( xCurrentShape, uno::UNO_QUERY );
+                    if(!(xCurrentShape.is() && (xRange.is())))
+                        xRange = nullptr;
                 }
                 else
                 {
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 56d8f0ed01ad..c73d05f4c2a7 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -41,6 +41,7 @@
 
 #include <vector>
 #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
+#include <com/sun/star/frame/XModel.hpp>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::linguistic2;
@@ -618,7 +619,7 @@ uno::Any SwDoc::Spell( SwPaM& rPaM,
                             uno::Reference< linguistic2::XProofreadingIterator >  xGCIterator( GetGCIterator() );
                             if (xGCIterator.is())
                             {
-                                uno::Reference< lang::XComponent > xDoc( GetDocShell()->GetBaseModel(), uno::UNO_QUERY );
+                                uno::Reference< lang::XComponent > xDoc = GetDocShell()->GetBaseModel();
                                 // Expand the string:
                                 const ModelToViewHelper aConversionMap(*pNd->GetTextNode(), pLayout);
                                 const OUString& aExpandText = aConversionMap.getViewText();
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 9efcc13c0f52..781c1a466e02 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -25,6 +25,7 @@
 #include <proofreadingiterator.hxx>
 #include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp>
 #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
+#include <com/sun/star/frame/XModel.hpp>
 
 #include <comphelper/processfactory.hxx>
 #include <comphelper/random.hxx>
@@ -146,7 +147,7 @@ bool SwDoc::StartGrammarChecking( bool bSkipStart )
         uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( GetGCIterator() );
         if ( xGCIterator.is() )
         {
-            uno::Reference< lang::XComponent >  xDoc( GetDocShell()->GetBaseModel(), uno::UNO_QUERY );
+            uno::Reference< lang::XComponent >  xDoc = GetDocShell()->GetBaseModel();
             uno::Reference< text::XFlatParagraphIteratorProvider >  xFPIP( xDoc, uno::UNO_QUERY );
 
             // start automatic background checking if not active already
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index 62d1b94679a9..a7abd1b50687 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/linguistic2/ProofreadingResult.hpp>
 #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
 #include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
@@ -984,7 +985,7 @@ bool SwEditShell::GetGrammarCorrection(
             uno::Reference< linguistic2::XProofreadingIterator >  xGCIterator( mxDoc->GetGCIterator() );
             if (xGCIterator.is())
             {
-                uno::Reference< lang::XComponent > xDoc( mxDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY );
+                uno::Reference< lang::XComponent > xDoc = mxDoc->GetDocShell()->GetBaseModel();
 
                 // Expand the string:
                 const ModelToViewHelper aConversionMap(*pNode, GetLayout());
diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx
index 4904f63d75dc..4a7d5f879524 100644
--- a/sw/source/filter/xml/wrtxml.cxx
+++ b/sw/source/filter/xml/wrtxml.cxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/document/XExporter.hpp>
 #include <com/sun/star/document/XFilter.hpp>
 #include <com/sun/star/frame/XModule.hpp>
+#include <com/sun/star/frame/XModel.hpp>
 
 #include <comphelper/fileformat.h>
 #include <comphelper/processfactory.hxx>
@@ -248,8 +249,7 @@ ErrCode SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xS
         *pArgs++ <<= xStatusIndicator;
 
     //Get model
-    uno::Reference< lang::XComponent > xModelComp(
-        m_pDoc->GetDocShell()->GetModel(), UNO_QUERY );
+    uno::Reference< lang::XComponent > xModelComp = m_pDoc->GetDocShell()->GetModel();
     OSL_ENSURE( xModelComp.is(), "XMLWriter::Write: got no model" );
     if( !xModelComp.is() )
         return ERR_SWG_WRITE_ERROR;
diff --git a/sw/source/uibase/table/tablemgr.cxx b/sw/source/uibase/table/tablemgr.cxx
index 77adc6b2e716..ecf9b6deafc6 100644
--- a/sw/source/uibase/table/tablemgr.cxx
+++ b/sw/source/uibase/table/tablemgr.cxx
@@ -24,6 +24,7 @@
 #include <com/sun/star/beans/PropertyState.hpp>
 #include <com/sun/star/embed/EmbedVerbs.hpp>
 #include <com/sun/star/embed/XComponentSupplier.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
 
 #include <comphelper/classids.hxx>
 #include <svx/charthelper.hxx>
@@ -222,19 +223,15 @@ uno::Reference< frame::XModel > SwTableFUNC::InsertChart(
         if (ppFlyFrameFormat)
             *ppFlyFrameFormat = pTmp;
 
-        uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY );
-        if( xCompSupp.is())
+        xChartModel.set( xObj->getComponent(), uno::UNO_QUERY );
+        if( xChartModel.is() )
         {
-            xChartModel.set( xCompSupp->getComponent(), uno::UNO_QUERY );
-            if( xChartModel.is() )
-            {
-                // Create a default chart type.
-                uno::Reference<chart2::XChartDocument> xChartDoc(xChartModel, uno::UNO_QUERY);
-                if (xChartDoc.is())
-                    xChartDoc->createDefaultChart();
+            // Create a default chart type.
+            uno::Reference<chart2::XChartDocument> xChartDoc(xChartModel, uno::UNO_QUERY);
+            if (xChartDoc.is())
+                xChartDoc->createDefaultChart();
 
-                xChartModel->lockControllers(); //#i79578# don't request a new replacement image for charts to often - block change notifications
-            }
+            xChartModel->lockControllers(); //#i79578# don't request a new replacement image for charts to often - block change notifications
         }
 
         // set the table name at the OLE-node


More information about the Libreoffice-commits mailing list