include/svx/unomodel.hxx | 4 +- svx/source/accessibility/svxpixelctlaccessiblecontext.cxx | 17 +++----- svx/source/customshapes/EnhancedCustomShapeEngine.cxx | 12 ++---- svx/source/table/accessibletableshape.cxx | 28 +++++--------- svx/source/unodraw/unomod.cxx | 7 ++- svx/source/unogallery/unogalthemeprovider.cxx | 21 +++------- 6 files changed, 37 insertions(+), 52 deletions(-)
New commits: commit 25ac3297b02c2c32e6d6ee661b89ce7361c2f7d2 Author: Noel Grandin <[email protected]> AuthorDate: Fri Mar 7 14:53:58 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat Mar 8 17:42:14 2025 +0100 use more concrete UNO in svx Change-Id: Ie947ba0209f9166ee1cd065f91341292f2b02668 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182621 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/include/svx/unomodel.hxx b/include/svx/unomodel.hxx index 49a634c6617a..41abe4f48c4b 100644 --- a/include/svx/unomodel.hxx +++ b/include/svx/unomodel.hxx @@ -30,8 +30,10 @@ #include <svx/fmdmod.hxx> #include <svx/svxdllapi.h> #include <cppuhelper/weakref.hxx> +#include <unotools/weakref.hxx> class SdrModel; +class SvxUnoDrawPagesAccess; class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SvxUnoDrawingModel : public SfxBaseModel, // implements SfxListener, OWEAKOBJECT & other @@ -45,7 +47,7 @@ class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SvxUnoDrawingModel private: SdrModel* mpDoc; - css::uno::WeakReference< css::drawing::XDrawPages > mxDrawPagesAccess; + unotools::WeakReference< SvxUnoDrawPagesAccess > mxDrawPagesAccess; css::uno::Reference< css::uno::XInterface > mxDashTable; css::uno::Reference< css::uno::XInterface > mxGradientTable; diff --git a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx index 38a643a2b1f4..c6914c5242e2 100644 --- a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx +++ b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx @@ -64,9 +64,9 @@ uno::Reference< XAccessible > SvxPixelCtlAccessible::getAccessibleChild( sal_Int ::osl::MutexGuard aGuard( m_aMutex ); if ( i < 0 || i >= getAccessibleChildCount()) throw lang::IndexOutOfBoundsException(); - Reference< XAccessible > xChild; - if (mpPixelCtl) - xChild = CreateChild(i, mpPixelCtl->IndexToPoint(i)); + if (!mpPixelCtl) + return nullptr; + rtl::Reference< SvxPixelCtlAccessibleChild > xChild = CreateChild(i, mpPixelCtl->IndexToPoint(i)); return xChild; } @@ -131,13 +131,10 @@ uno::Reference<XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleAtPoin { ::osl::MutexGuard aGuard( m_aMutex ); - Reference< XAccessible > xRet; - - if (mpPixelCtl) - { - tools::Long nIndex = mpPixelCtl->PointToIndex(Point(rPoint.X, rPoint.Y)); - xRet = CreateChild(nIndex, mpPixelCtl->IndexToPoint(nIndex)); - } + if (!mpPixelCtl) + return nullptr; + tools::Long nIndex = mpPixelCtl->PointToIndex(Point(rPoint.X, rPoint.Y)); + rtl::Reference< SvxPixelCtlAccessibleChild > xRet = CreateChild(nIndex, mpPixelCtl->IndexToPoint(nIndex)); return xRet; } diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx index 13155cb681d4..0bbb73ae40e6 100644 --- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx @@ -335,14 +335,12 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render() xRenderedShape.get()); } - Reference< drawing::XShape > xShape; + if (!xRenderedShape) + return nullptr; - if (xRenderedShape) - { - aCustomShape2d.ApplyGluePoints(xRenderedShape.get()); - xShape = SvxDrawPage::CreateShapeByTypeAndInventor( xRenderedShape->GetObjIdentifier(), - xRenderedShape->GetObjInventor(), xRenderedShape.get() ); - } + aCustomShape2d.ApplyGluePoints(xRenderedShape.get()); + rtl::Reference< SvxShape > xShape = SvxDrawPage::CreateShapeByTypeAndInventor( xRenderedShape->GetObjIdentifier(), + xRenderedShape->GetObjInventor(), xRenderedShape.get() ); return xShape; } diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx index 2ef0efef4fd7..a46ee0be467e 100644 --- a/svx/source/table/accessibletableshape.cxx +++ b/svx/source/table/accessibletableshape.cxx @@ -484,31 +484,23 @@ sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleColumnExtentAt( sal_Int32 Reference< XAccessibleTable > SAL_CALL AccessibleTableShape::getAccessibleRowHeaders( ) { - Reference< XAccessibleTable > xRet; SvxTableController* pController = getTableController(); - if( pController ) - { - if( pController->isRowHeader() ) - { - xRet = new AccessibleTableHeaderShape( this, true ); - } - } - return xRet; + if( !pController ) + return nullptr; + if( !pController->isRowHeader() ) + return nullptr; + return new AccessibleTableHeaderShape( this, true ); } Reference< XAccessibleTable > SAL_CALL AccessibleTableShape::getAccessibleColumnHeaders( ) { - Reference< XAccessibleTable > xRet; SvxTableController* pController = getTableController(); - if( pController ) - { - if( pController->isColumnHeader() ) - { - xRet = new AccessibleTableHeaderShape( this, false ); - } - } - return xRet; + if( !pController ) + return nullptr; + if( !pController->isColumnHeader() ) + return nullptr; + return new AccessibleTableHeaderShape( this, false ); } diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx index 7cfb7e22227b..85240ef6da47 100644 --- a/svx/source/unodraw/unomod.cxx +++ b/svx/source/unodraw/unomod.cxx @@ -297,10 +297,13 @@ uno::Reference< drawing::XDrawPages > SAL_CALL SvxUnoDrawingModel::getDrawPages( { ::SolarMutexGuard aGuard; - uno::Reference< drawing::XDrawPages > xDrawPages( mxDrawPagesAccess ); + rtl::Reference< SvxUnoDrawPagesAccess > xDrawPages( mxDrawPagesAccess ); if( !xDrawPages.is() ) - mxDrawPagesAccess = xDrawPages = new SvxUnoDrawPagesAccess(*this); + { + xDrawPages = new SvxUnoDrawPagesAccess(*this); + mxDrawPagesAccess = xDrawPages.get(); + } return xDrawPages; } diff --git a/svx/source/unogallery/unogalthemeprovider.cxx b/svx/source/unogallery/unogalthemeprovider.cxx index 6e8c02037936..6e72d0f392c7 100644 --- a/svx/source/unogallery/unogalthemeprovider.cxx +++ b/svx/source/unogallery/unogalthemeprovider.cxx @@ -202,21 +202,14 @@ sal_Bool SAL_CALL GalleryThemeProvider::hasByName( const OUString& rName ) uno::Reference< gallery::XGalleryTheme > SAL_CALL GalleryThemeProvider::insertNewByName( const OUString& rThemeName ) { const SolarMutexGuard aGuard; - uno::Reference< gallery::XGalleryTheme > xRet; - if( mpGallery ) - { - if( mpGallery->HasTheme( rThemeName ) ) - { - throw container::ElementExistException(); - } - else if( mpGallery->CreateTheme( rThemeName ) ) - { - xRet = new ::unogallery::GalleryTheme( rThemeName ); - } - } - - return xRet; + if( !mpGallery ) + return nullptr; + if( mpGallery->HasTheme( rThemeName ) ) + throw container::ElementExistException(); + if( !mpGallery->CreateTheme( rThemeName ) ) + return nullptr; + return new ::unogallery::GalleryTheme( rThemeName ); }
