[Libreoffice-commits] core.git: sd/qa sd/source

Noel (via logerrit) logerrit at kemper.freedesktop.org
Mon Feb 15 07:38:48 UTC 2021


 sd/qa/unit/misc-tests.cxx                                 |    8 ++++----
 sd/source/core/annotations/Annotation.cxx                 |   12 +++++-------
 sd/source/core/stlfamily.cxx                              |    2 +-
 sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx |    6 +++---
 sd/source/ui/accessibility/AccessibleSlideSorterView.cxx  |    6 +++---
 sd/source/ui/annotations/annotationmanager.cxx            |    4 ++--
 sd/source/ui/dlg/sdtreelb.cxx                             |    2 +-
 sd/source/ui/framework/configuration/ResourceId.cxx       |    2 +-
 sd/source/ui/framework/factories/BasicViewFactory.cxx     |    2 +-
 sd/source/ui/framework/tools/FrameworkHelper.cxx          |    2 +-
 sd/source/ui/slideshow/slideshow.cxx                      |    5 ++---
 sd/source/ui/slideshow/slideshowimpl.cxx                  |    4 ++--
 sd/source/ui/unoidl/unomodel.cxx                          |    2 +-
 13 files changed, 27 insertions(+), 30 deletions(-)

New commits:
commit 0ae0b7ff575b4148f9c06abd3bac78d0881ec817
Author:     Noel <noel.grandin at collabora.co.uk>
AuthorDate: Fri Feb 12 15:35:49 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Feb 15 08:37:47 2021 +0100

    loplugin:referencecasting in sd
    
    Change-Id: I3d5e0fd3f9d8ea61aad5846a0ee19568a5d365a6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110817
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index 8dc23c0295a3..f23ee5b5cea5 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -163,11 +163,11 @@ sd::DrawDocShellRef SdMiscTest::Load(const OUString& rURL, sal_Int32 nFormat)
     CPPUNIT_ASSERT(xController.is());
 
     // introduce model/view/controller to each other
-    xController->attachModel(xModel2.get());
-    xModel2->connectController(xController.get());
-    xTargetFrame->setComponent(xController->getComponentWindow(), xController.get());
+    xController->attachModel(xModel2);
+    xModel2->connectController(xController);
+    xTargetFrame->setComponent(xController->getComponentWindow(), xController);
     xController->attachFrame(xTargetFrame);
-    xModel2->setCurrentController(xController.get());
+    xModel2->setCurrentController(xController);
 
     sd::ViewShell *pViewShell = xDocSh->GetViewShell();
     CPPUNIT_ASSERT(pViewShell);
diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx
index 8831b3f337a8..7e9d4aff275a 100644
--- a/sd/source/core/annotations/Annotation.cxx
+++ b/sd/source/core/annotations/Annotation.cxx
@@ -298,7 +298,7 @@ uno::Reference<text::XText> SAL_CALL Annotation::getTextRange()
     {
         m_TextRange = TextApiObject::create( static_cast< SdDrawDocument* >( &mpPage->getSdrModelFromSdrPage() ) );
     }
-    return uno::Reference<text::XText>( m_TextRange.get() );
+    return m_TextRange;
 }
 
 std::unique_ptr<SdrUndoAction> CreateUndoInsertOrRemoveAnnotation( const uno::Reference<office::XAnnotation>& xAnnotation, bool bInsert )
@@ -423,7 +423,7 @@ void UndoInsertOrRemoveAnnotation::Undo()
     if( !(pPage && pModel) )
         return;
 
-    uno::Reference<office::XAnnotation> xAnnotation( mxAnnotation.get() );
+    uno::Reference<office::XAnnotation> xAnnotation( mxAnnotation );
     if( mbInsert )
     {
         pPage->removeAnnotation( xAnnotation );
@@ -442,7 +442,7 @@ void UndoInsertOrRemoveAnnotation::Redo()
     if( !(pPage && pModel) )
         return;
 
-    uno::Reference<office::XAnnotation> xAnnotation( mxAnnotation.get() );
+    uno::Reference<office::XAnnotation> xAnnotation( mxAnnotation );
 
     if( mbInsert )
     {
@@ -466,16 +466,14 @@ void UndoAnnotation::Undo()
 {
     maRedoData.get( mxAnnotation );
     maUndoData.set( mxAnnotation );
-    uno::Reference<office::XAnnotation> xAnnotation( mxAnnotation.get() );
-    LOKCommentNotifyAll( CommentNotificationType::Modify, xAnnotation );
+    LOKCommentNotifyAll( CommentNotificationType::Modify, mxAnnotation );
 }
 
 void UndoAnnotation::Redo()
 {
     maUndoData.get( mxAnnotation );
     maRedoData.set( mxAnnotation );
-    uno::Reference<office::XAnnotation> xAnnotation( mxAnnotation.get() );
-    LOKCommentNotifyAll( CommentNotificationType::Modify, xAnnotation );
+    LOKCommentNotifyAll( CommentNotificationType::Modify, mxAnnotation );
 }
 
 } // namespace sd
diff --git a/sd/source/core/stlfamily.cxx b/sd/source/core/stlfamily.cxx
index 0f03615c88f3..8e9150a292ef 100644
--- a/sd/source/core/stlfamily.cxx
+++ b/sd/source/core/stlfamily.cxx
@@ -350,7 +350,7 @@ Any SAL_CALL SdStyleFamily::getByIndex( sal_Int32 Index )
             {
                 PresStyleMap::iterator iter( rStyleSheets.begin() );
                 std::advance(iter, Index);
-                return Any( Reference< XStyle >( (*iter).second.get() ) );
+                return Any( Reference< XStyle >( (*iter).second ) );
             }
         }
         else
diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
index ba7a546045d2..15f5c24dc963 100644
--- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
+++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
@@ -114,7 +114,7 @@ void AccessibleDrawDocumentView::Init()
     if (xPage.is())
     {
         xPage->Init();
-        mpChildrenManager->AddAccessibleShape (xPage.get());
+        mpChildrenManager->AddAccessibleShape (xPage);
         mpChildrenManager->Update ();
     }
 
@@ -309,7 +309,7 @@ void SAL_CALL
             if (xPage.is())
             {
                 xPage->Init();
-                mpChildrenManager->AddAccessibleShape (xPage.get());
+                mpChildrenManager->AddAccessibleShape (xPage);
                 mpChildrenManager->Update (false);
             }
         }
@@ -358,7 +358,7 @@ void SAL_CALL
             if (xPage.is())
             {
                 xPage->Init();
-                mpChildrenManager->AddAccessibleShape (xPage.get());
+                mpChildrenManager->AddAccessibleShape (xPage);
                 mpChildrenManager->Update (false);
             }
         }
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
index b35c1a57e6f0..ee663f2fbb1a 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
@@ -699,10 +699,10 @@ void AccessibleSlideSorterView::Implementation::Clear()
         {
             mrAccessibleSlideSorter.FireAccessibleEvent(
                 AccessibleEventId::CHILD,
-                Any(Reference<XAccessible>(rxPageObject.get())),
+                Any(Reference<XAccessible>(rxPageObject)),
                 Any());
 
-            Reference<XComponent> xComponent (Reference<XWeak>(rxPageObject.get()), UNO_QUERY);
+            Reference<XComponent> xComponent (Reference<XWeak>(rxPageObject), UNO_QUERY);
             if (xComponent.is())
                 xComponent->dispose();
             rxPageObject = nullptr;
@@ -747,7 +747,7 @@ AccessibleSlideSorterObject* AccessibleSlideSorterView::Implementation::GetAcces
                 mrAccessibleSlideSorter.FireAccessibleEvent(
                     AccessibleEventId::CHILD,
                     Any(),
-                    Any(Reference<XAccessible>(maPageObjects[nIndex].get())));
+                    Any(Reference<XAccessible>(maPageObjects[nIndex])));
             }
 
         }
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index 7bb4a0857968..ce004490037a 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -867,7 +867,7 @@ void AnnotationManagerImpl::SelectAnnotation( const css::uno::Reference< css::of
         [&xAnnotation](const rtl::Reference<AnnotationTag>& rxTag) { return rxTag->GetAnnotation() == xAnnotation; });
     if (iter != maTagVector.end())
     {
-        SmartTagReference xTag( (*iter).get() );
+        SmartTagReference xTag( *iter );
         mrBase.GetMainViewShell()->GetView()->getSmartTags().select( xTag );
         (*iter)->OpenPopup( bEdit );
     }
@@ -974,7 +974,7 @@ void AnnotationManagerImpl::CreateTags()
 
         if( xSelectedTag.is() )
         {
-            SmartTagReference xTag( xSelectedTag.get() );
+            SmartTagReference xTag( xSelectedTag );
             mrBase.GetMainViewShell()->GetView()->getSmartTags().select( xTag );
         }
         else
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 98542f75cdfa..992fb8e29cf2 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -747,7 +747,7 @@ void SdPageObjsTLV::Select()
 
     // object is destroyed by internal reference mechanism
     m_xHelper.set(new SdPageObjsTLV::SdPageObjsTransferable(aBookmark, *pDocShell, eDragType));
-    rtl::Reference<TransferDataContainer> xHelper(m_xHelper.get());
+    rtl::Reference<TransferDataContainer> xHelper(m_xHelper);
     m_xTreeView->enable_drag_source(xHelper, nDNDActions);
 }
 
diff --git a/sd/source/ui/framework/configuration/ResourceId.cxx b/sd/source/ui/framework/configuration/ResourceId.cxx
index e851e2a260dc..981e4105a607 100644
--- a/sd/source/ui/framework/configuration/ResourceId.cxx
+++ b/sd/source/ui/framework/configuration/ResourceId.cxx
@@ -152,7 +152,7 @@ Reference<XResourceId> SAL_CALL
         for (sal_Int32 nIndex=0; nIndex<nAnchorCount; ++nIndex)
             rResourceId->maResourceURLs[nIndex] = maResourceURLs[nIndex+1];
     }
-    return Reference<XResourceId>(rResourceId.get());
+    return rResourceId;
 }
 
 Sequence<OUString> SAL_CALL
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx
index 7cf3a0d94059..52505b8fab0b 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -298,7 +298,7 @@ std::shared_ptr<BasicViewFactory::ViewDescriptor> BasicViewFactory::CreateView (
         // register ViewShellWrapper on pane window
         if (xWindow.is())
         {
-            xWindow->addWindowListener(wrapper.get());
+            xWindow->addWindowListener(wrapper);
             if (pDescriptor->mpViewShell != nullptr)
             {
                 pDescriptor->mpViewShell->Resize();
diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx
index 8c6f702d6f3c..362e80795e5f 100644
--- a/sd/source/ui/framework/tools/FrameworkHelper.cxx
+++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx
@@ -381,7 +381,7 @@ bool FrameworkHelper::IsValid() const
 
 ::std::shared_ptr<ViewShell> FrameworkHelper::GetViewShell (const Reference<XView>& rxView)
 {
-    return lcl_getViewShell( rxView.get() );
+    return lcl_getViewShell( rxView );
 }
 
 Reference<XView> FrameworkHelper::GetView (const Reference<XResourceId>& rxPaneOrViewId)
diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx
index cd10ad249eed..8873162436be 100644
--- a/sd/source/ui/slideshow/slideshow.cxx
+++ b/sd/source/ui/slideshow/slideshow.cxx
@@ -882,8 +882,7 @@ Reference< XSlideShowController > SAL_CALL SlideShow::getController(  )
 {
     ThrowIfDisposed();
 
-    Reference< XSlideShowController > xController( mxController.get() );
-    return xController;
+    return mxController;
 }
 
 // XComponent
@@ -1195,7 +1194,7 @@ bool SlideShow::dependsOn( ViewShellBase const * pViewShellBase )
 
 Reference< presentation::XPresentation2 > CreatePresentation( const SdDrawDocument& rDocument )
 {
-    return Reference< presentation::XPresentation2 >( SlideShow::Create( const_cast< SdDrawDocument* >( &rDocument ) ).get() );
+    return Reference< presentation::XPresentation2 >( SlideShow::Create( const_cast< SdDrawDocument* >( &rDocument ) ) );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index 41c331644ac2..df7f530f4fea 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -604,7 +604,7 @@ void SAL_CALL SlideshowImpl::disposing()
     try
     {
         if( mxView.is() )
-            mxShow->removeView( mxView.get() );
+            mxShow->removeView( mxView );
 
         Reference< XComponent > xComponent( mxShow, UNO_QUERY );
         if( xComponent.is() )
@@ -1078,7 +1078,7 @@ bool SlideshowImpl::startShowImpl( const Sequence< beans::PropertyValue >& aProp
         for( const auto& rProp : aProperties )
             mxShow->setProperty( rProp );
 
-        mxShow->addView( mxView.get() );
+        mxShow->addView( mxView );
 
         mxListenerProxy.set( new SlideShowListenerProxy( this, mxShow ) );
         mxListenerProxy->addAsSlideShowListener();
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 35b1c376940c..f3e965c0d91f 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -763,7 +763,7 @@ uno::Reference< presentation::XPresentation > SAL_CALL SdXImpressDocument::getPr
     if( nullptr == mpDoc )
         throw lang::DisposedException();
 
-    return uno::Reference< presentation::XPresentation >( mpDoc->getPresentation().get() );
+    return mpDoc->getPresentation();
 }
 
 // XHandoutMasterSupplier


More information about the Libreoffice-commits mailing list