diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-02-21 12:32:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-02-21 16:13:06 +0100 |
commit | 8f231fc5df201c45d16bce0b4b17f727842b2121 (patch) | |
tree | 1eba8f98d459e1f261dc9edc791e67b9675aec4b /sd/source/ui | |
parent | 98173f6222cec22170b53c7d9c94c6ce5b08b4d9 (diff) |
loplugin:refcounting in sd
Change-Id: Ic95aa7a3c1fdab1baef744ec85ffc9c98dee5f1e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111272
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui')
-rw-r--r-- | sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/accessibility/AccessibleSlideSorterView.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/framework/configuration/Configuration.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/controller/SlsClipboard.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/controller/SlsTransferableData.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/inc/controller/SlsTransferableData.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopage.cxx | 16 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unosrch.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drviews5.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/view/outlnvsh.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/view/sdview2.cxx | 23 |
12 files changed, 34 insertions, 47 deletions
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx index a8c81225130b..fde0cd953677 100644 --- a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx @@ -188,7 +188,7 @@ Reference<XAccessibleStateSet> SAL_CALL { ThrowIfDisposed(); const SolarMutexGuard aSolarGuard; - ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper(); + rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet = new ::utl::AccessibleStateSetHelper(); if (mxParent.is()) { diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx index ee663f2fbb1a..3ce13b899ef9 100644 --- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx @@ -285,7 +285,7 @@ Reference<XAccessibleStateSet > SAL_CALL { ThrowIfDisposed(); const SolarMutexGuard aSolarGuard; - ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper(); + rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet = new ::utl::AccessibleStateSetHelper(); pStateSet->AddState(AccessibleStateType::FOCUSABLE); pStateSet->AddState(AccessibleStateType::SELECTABLE); diff --git a/sd/source/ui/framework/configuration/Configuration.cxx b/sd/source/ui/framework/configuration/Configuration.cxx index 53bbaa339316..f155e0992e68 100644 --- a/sd/source/ui/framework/configuration/Configuration.cxx +++ b/sd/source/ui/framework/configuration/Configuration.cxx @@ -182,12 +182,10 @@ Reference<util::XCloneable> SAL_CALL Configuration::createClone() ::osl::MutexGuard aGuard (maMutex); ThrowIfDisposed(); - Configuration* pConfiguration = new Configuration( + return new Configuration( mxBroadcaster, mbBroadcastRequestEvents, *mpResourceContainer); - - return Reference<util::XCloneable>(pConfiguration); } //----- XNamed ---------------------------------------------------------------- diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx index 25e2aaea7b56..c7f333a5f0b9 100644 --- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx +++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx @@ -429,17 +429,17 @@ void Clipboard::CreateSlideTransferable ( return; mrSlideSorter.GetView().BrkAction(); - SdTransferable* pTransferable = TransferableData::CreateTransferable ( + rtl::Reference<SdTransferable> pTransferable = TransferableData::CreateTransferable ( pDocument, dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell()), aRepresentatives); if (bDrag) - SD_MOD()->pTransferDrag = pTransferable; + SD_MOD()->pTransferDrag = pTransferable.get(); else - SD_MOD()->pTransferClip = pTransferable; + SD_MOD()->pTransferClip = pTransferable.get(); - pDocument->CreatingDataObj (pTransferable); + pDocument->CreatingDataObj (pTransferable.get()); pTransferable->SetWorkDocument(pDocument->AllocSdDrawDocument()); std::unique_ptr<TransferableObjectDescriptor> pObjDesc(new TransferableObjectDescriptor); pTransferable->GetWorkDocument()->GetDocSh() diff --git a/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx b/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx index b340642553cc..2aac76fe0600 100644 --- a/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx +++ b/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx @@ -23,12 +23,12 @@ namespace sd::slidesorter::controller { -SdTransferable* TransferableData::CreateTransferable ( +rtl::Reference<SdTransferable> TransferableData::CreateTransferable ( SdDrawDocument* pSrcDoc, SlideSorterViewShell* pViewShell, const ::std::vector<Representative>& rRepresentatives) { - SdTransferable* pTransferable = new SdTransferable (pSrcDoc, nullptr, false/*bInitOnGetData*/); + rtl::Reference<SdTransferable> pTransferable = new SdTransferable (pSrcDoc, nullptr, false/*bInitOnGetData*/); auto pData = std::make_shared<TransferableData>(pViewShell, rRepresentatives); pTransferable->AddUserData(pData); return pTransferable; diff --git a/sd/source/ui/slidesorter/inc/controller/SlsTransferableData.hxx b/sd/source/ui/slidesorter/inc/controller/SlsTransferableData.hxx index 7354697f05e1..24380f831d17 100644 --- a/sd/source/ui/slidesorter/inc/controller/SlsTransferableData.hxx +++ b/sd/source/ui/slidesorter/inc/controller/SlsTransferableData.hxx @@ -49,7 +49,7 @@ public: bool mbIsExcluded; }; - static SdTransferable* CreateTransferable ( + static rtl::Reference<SdTransferable> CreateTransferable ( SdDrawDocument* pSrcDoc, SlideSorterViewShell* pViewShell, const ::std::vector<TransferableData::Representative>& rRepresentatives); diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx index d2f6d32ab191..60bc5fadec77 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx @@ -264,16 +264,14 @@ css::uno::Reference<css::accessibility::XAccessible> assert(mpSlideSorter); - ::accessibility::AccessibleSlideSorterView *pAccessibleView = + rtl::Reference<::accessibility::AccessibleSlideSorterView> pAccessibleView = new ::accessibility::AccessibleSlideSorterView( *mpSlideSorter, pWindow); - css::uno::Reference< css::accessibility::XAccessible> xRet(pAccessibleView); - pAccessibleView->Init(); - return xRet; + return pAccessibleView; } void SlideSorterViewShell::SwitchViewFireFocus(const css::uno::Reference< css::accessibility::XAccessible >& xAcc ) diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index af642f7b1f36..26db26b2a12e 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -1371,7 +1371,7 @@ Reference< drawing::XShape > SdGenericDrawPage::CreateShape(SdrObject *pObj) co { PresObjKind eKind = GetPage()->GetPresObjKind(pObj); - SvxShape* pShape = nullptr; + rtl::Reference<SvxShape> pShape; if(pObj->GetObjInventor() == SdrInventor::Default) { @@ -2442,11 +2442,10 @@ void SdDrawPage::setBackground( const Any& rValue ) } else { - SdUnoPageBackground* pBackground = new SdUnoPageBackground(); + rtl::Reference<SdUnoPageBackground> pBackground = new SdUnoPageBackground(); Reference< beans::XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() ); - Reference< beans::XPropertySet > xDestSet( static_cast<beans::XPropertySet*>(pBackground) ); - Reference< beans::XPropertySetInfo > xDestSetInfo( xDestSet->getPropertySetInfo() ); + Reference< beans::XPropertySetInfo > xDestSetInfo( pBackground->getPropertySetInfo() ); const Sequence< beans::Property > aProperties( xDestSetInfo->getProperties() ); @@ -2454,7 +2453,7 @@ void SdDrawPage::setBackground( const Any& rValue ) { const OUString aPropName( rProp.Name ); if( xSetInfo->hasPropertyByName( aPropName ) ) - xDestSet->setPropertyValue( aPropName, + pBackground->setPropertyValue( aPropName, xSet->getPropertyValue( aPropName ) ); } @@ -2811,11 +2810,10 @@ void SdMasterPage::setBackground( const Any& rValue ) } else { - SdUnoPageBackground* pBackground = new SdUnoPageBackground(); + rtl::Reference<SdUnoPageBackground> pBackground = new SdUnoPageBackground(); Reference< beans::XPropertySetInfo > xInputSetInfo( xInputSet->getPropertySetInfo(), UNO_SET_THROW ); - Reference< beans::XPropertySet > xDestSet( static_cast<beans::XPropertySet*>(pBackground) ); - Reference< beans::XPropertySetInfo > xDestSetInfo( xDestSet->getPropertySetInfo(), UNO_SET_THROW ); + Reference< beans::XPropertySetInfo > xDestSetInfo( pBackground->getPropertySetInfo(), UNO_SET_THROW ); const uno::Sequence< beans::Property> aProperties( xDestSetInfo->getProperties() ); @@ -2823,7 +2821,7 @@ void SdMasterPage::setBackground( const Any& rValue ) { const OUString aPropName( rProp.Name ); if( xInputSetInfo->hasPropertyByName( aPropName ) ) - xDestSet->setPropertyValue( aPropName, xInputSet->getPropertyValue( aPropName ) ); + pBackground->setPropertyValue( aPropName, xInputSet->getPropertyValue( aPropName ) ); } pBackground->fillItemSet( static_cast<SdDrawDocument*>(&SvxFmDrawPage::mpPage->getSdrModelFromSdrPage()), aSet ); diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx index e23d2c26b5df..3afda2d5d646 100644 --- a/sd/source/ui/unoidl/unosrch.cxx +++ b/sd/source/ui/unoidl/unosrch.cxx @@ -550,7 +550,7 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( const uno:: if(pParent) { - SvxUnoTextRange *pRange = new SvxUnoTextRange( *pParent ); + rtl::Reference<SvxUnoTextRange> pRange = new SvxUnoTextRange( *pParent ); xFound = pRange; pRange->SetSelection(aSelection); } diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx index d632d24a46d0..7d92475aac0e 100644 --- a/sd/source/ui/view/drviews5.cxx +++ b/sd/source/ui/view/drviews5.cxx @@ -581,16 +581,14 @@ css::uno::Reference<css::accessibility::XAccessible> { if (GetViewShellBase().GetController() != nullptr) { - accessibility::AccessibleDrawDocumentView* pDocumentView = + rtl::Reference<accessibility::AccessibleDrawDocumentView> pDocumentView = new accessibility::AccessibleDrawDocumentView ( pWindow, this, GetViewShellBase().GetController(), pWindow->GetAccessibleParentWindow()->GetAccessible()); pDocumentView->Init(); - return css::uno::Reference<css::accessibility::XAccessible> - (static_cast< css::uno::XWeak*>(pDocumentView), - css::uno::UNO_QUERY); + return pDocumentView; } SAL_WARN("sd", "DrawViewShell::CreateAccessibleDocumentView: no controller"); diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index 7068a519a96a..f106b943a8b1 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -1828,16 +1828,14 @@ css::uno::Reference<css::accessibility::XAccessible> OSL_ASSERT (GetViewShell()!=nullptr); if (GetViewShell()->GetController() != nullptr) { - ::accessibility::AccessibleOutlineView* pDocumentView = + rtl::Reference<::accessibility::AccessibleOutlineView> pDocumentView = new ::accessibility::AccessibleOutlineView ( pWindow, this, GetViewShell()->GetController(), pWindow->GetAccessibleParentWindow()->GetAccessible()); pDocumentView->Init(); - return css::uno::Reference<css::accessibility::XAccessible> - (static_cast< css::uno::XWeak*>(pDocumentView), - css::uno::UNO_QUERY); + return pDocumentView; } SAL_WARN("sd", "OutlineViewShell::CreateAccessibleDocumentView: no controller"); diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index 7f5caafe6733..f71246ea651e 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -81,12 +81,11 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateClipboardDat { // since SdTransferable::CopyToClipboard is called, this // dynamically created object is destroyed automatically - SdTransferable* pTransferable = new SdTransferable( &mrDoc, nullptr, false ); - css::uno::Reference< css::datatransfer::XTransferable > xRet( pTransferable ); + rtl::Reference<SdTransferable> pTransferable = new SdTransferable( &mrDoc, nullptr, false ); - SD_MOD()->pTransferClip = pTransferable; + SD_MOD()->pTransferClip = pTransferable.get(); - mrDoc.CreatingDataObj( pTransferable ); + mrDoc.CreatingDataObj( pTransferable.get() ); pTransferable->SetWorkDocument( static_cast<SdDrawDocument*>(CreateMarkedObjModel().release()) ); mrDoc.CreatingDataObj( nullptr ); @@ -138,15 +137,14 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateClipboardDat pTransferable->SetObjectDescriptor( std::move(pObjDesc) ); pTransferable->CopyToClipboard( mpViewSh->GetActiveWindow() ); - return xRet; + return pTransferable; } css::uno::Reference< css::datatransfer::XTransferable > View::CreateDragDataObject( View* pWorkView, vcl::Window& rWindow, const Point& rDragPos ) { - SdTransferable* pTransferable = new SdTransferable( &mrDoc, pWorkView, false ); - css::uno::Reference< css::datatransfer::XTransferable > xRet( pTransferable ); + rtl::Reference<SdTransferable> pTransferable = new SdTransferable( &mrDoc, pWorkView, false ); - SD_MOD()->pTransferDrag = pTransferable; + SD_MOD()->pTransferDrag = pTransferable.get(); std::unique_ptr<TransferableObjectDescriptor> pObjDesc(new TransferableObjectDescriptor); OUString aDisplayName; @@ -187,17 +185,16 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateDragDataObje pTransferable->SetObjectDescriptor( std::move(pObjDesc) ); pTransferable->StartDrag( &rWindow, DND_ACTION_COPYMOVE | DND_ACTION_LINK ); - return xRet; + return pTransferable; } css::uno::Reference< css::datatransfer::XTransferable > View::CreateSelectionDataObject( View* pWorkView, vcl::Window& rWindow ) { - SdTransferable* pTransferable = new SdTransferable( &mrDoc, pWorkView, true ); - css::uno::Reference< css::datatransfer::XTransferable > xRet( pTransferable ); + rtl::Reference<SdTransferable> pTransferable = new SdTransferable( &mrDoc, pWorkView, true ); std::unique_ptr<TransferableObjectDescriptor> pObjDesc(new TransferableObjectDescriptor); const ::tools::Rectangle aMarkRect( GetAllMarkedRect() ); - SD_MOD()->pTransferSelection = pTransferable; + SD_MOD()->pTransferSelection = pTransferable.get(); if( mpDocSh ) { @@ -211,7 +208,7 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateSelectionDat pTransferable->SetObjectDescriptor( std::move(pObjDesc) ); pTransferable->CopyToSelection( &rWindow ); - return xRet; + return pTransferable; } void View::UpdateSelectionClipboard( bool bForceDeselect ) |