include/svx/unopool.hxx | 8 +------- include/svx/unoprov.hxx | 4 ++-- sc/source/ui/unoobj/drdefuno.cxx | 3 ++- sd/source/ui/unoidl/unopool.cxx | 4 ++-- svx/source/unodraw/unopool.cxx | 21 ++------------------- sw/source/uibase/uno/unodefaults.cxx | 2 +- 6 files changed, 10 insertions(+), 32 deletions(-)
New commits: commit ef049c4d10023f866173ea344d13e5d99d485066 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Jul 5 14:37:02 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Jul 5 22:42:38 2023 +0200 simplify SvxUnoDrawPool initialisation Change-Id: Iaca5eec19935c50cc7cade4f3dab139a5232473a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154058 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/svx/unopool.hxx b/include/svx/unopool.hxx index 1f9431f8755d..9e86c957a27f 100644 --- a/include/svx/unopool.hxx +++ b/include/svx/unopool.hxx @@ -30,10 +30,6 @@ class SdrModel; class SfxItemPool; -enum class SvxUnoDrawPoolDefaults { - Drawing, Writer -}; - /** This class implements the service com.sun.star.drawing.Defaults. It works on the SfxItemPool from the given model and the global draw object item pool. @@ -46,10 +42,8 @@ class SVX_DLLPUBLIC SvxUnoDrawPool : public ::cppu::OWeakAggObject, public comphelper::PropertySetHelper { public: - SvxUnoDrawPool(SdrModel* pModel, SvxUnoDrawPoolDefaults nServiceId); + SvxUnoDrawPool(SdrModel* pModel, rtl::Reference<comphelper::PropertySetInfo> const & xDefaults); - /** deprecated */ - SvxUnoDrawPool(SdrModel* pModel); virtual ~SvxUnoDrawPool() noexcept override; /** This returns the item pool from the given model, or the default pool if there is no model and bReadOnly is true. diff --git a/include/svx/unoprov.hxx b/include/svx/unoprov.hxx index fe03bb286dbc..382a8dbd38f1 100644 --- a/include/svx/unoprov.hxx +++ b/include/svx/unoprov.hxx @@ -99,8 +99,8 @@ namespace comphelper { class PropertySetInfo; } namespace SvxPropertySetInfoPool { - UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) rtl::Reference<comphelper::PropertySetInfo> const & getDrawingDefaults() noexcept; - UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) rtl::Reference<comphelper::PropertySetInfo> const & getWriterDrawingDefaults() noexcept; + SVXCORE_DLLPUBLIC rtl::Reference<comphelper::PropertySetInfo> const & getDrawingDefaults() noexcept; + SVXCORE_DLLPUBLIC rtl::Reference<comphelper::PropertySetInfo> const & getWriterDrawingDefaults() noexcept; }; #endif diff --git a/sc/source/ui/unoobj/drdefuno.cxx b/sc/source/ui/unoobj/drdefuno.cxx index 7ad5dc28ecb7..fa2387d28bda 100644 --- a/sc/source/ui/unoobj/drdefuno.cxx +++ b/sc/source/ui/unoobj/drdefuno.cxx @@ -21,12 +21,13 @@ #include <docsh.hxx> #include <drwlayer.hxx> +#include <svx/unoprov.hxx> #include <vcl/svapp.hxx> using namespace ::com::sun::star; ScDrawDefaultsObj::ScDrawDefaultsObj(ScDocShell* pDocSh) : - SvxUnoDrawPool( nullptr ), + SvxUnoDrawPool( nullptr, SvxPropertySetInfoPool::getDrawingDefaults() ), pDocShell( pDocSh ) { // SvxUnoDrawPool is initialized without model, diff --git a/sd/source/ui/unoidl/unopool.cxx b/sd/source/ui/unoidl/unopool.cxx index 7345dc45dfb7..5791aa6984ed 100644 --- a/sd/source/ui/unoidl/unopool.cxx +++ b/sd/source/ui/unoidl/unopool.cxx @@ -21,7 +21,7 @@ #include <comphelper/propertysetinfo.hxx> #include <editeng/eeitem.hxx> #include <svx/unopool.hxx> - +#include <svx/unoprov.hxx> #include <drawdoc.hxx> #include "unopool.hxx" @@ -59,7 +59,7 @@ private: } SdUnoDrawPool::SdUnoDrawPool(SdDrawDocument* pModel) -: SvxUnoDrawPool( pModel ), mpDrawModel( pModel ) +: SvxUnoDrawPool( pModel, SvxPropertySetInfoPool::getDrawingDefaults() ), mpDrawModel( pModel ) { } diff --git a/svx/source/unodraw/unopool.cxx b/svx/source/unodraw/unopool.cxx index e94ccb2d7450..eb897556eff9 100644 --- a/svx/source/unodraw/unopool.cxx +++ b/svx/source/unodraw/unopool.cxx @@ -39,25 +39,8 @@ using namespace ::com::sun::star; using namespace ::cppu; -static rtl::Reference<comphelper::PropertySetInfo> const & getDefaults(SvxUnoDrawPoolDefaults nServiceId) -{ - switch (nServiceId) - { - case SvxUnoDrawPoolDefaults::Drawing: return SvxPropertySetInfoPool::getDrawingDefaults(); - case SvxUnoDrawPoolDefaults::Writer: return SvxPropertySetInfoPool::getWriterDrawingDefaults(); - default: std::abort(); - } -} - -SvxUnoDrawPool::SvxUnoDrawPool(SdrModel* pModel, SvxUnoDrawPoolDefaults nServiceId) -: PropertySetHelper( getDefaults(nServiceId) ), mpModel( pModel ) -{ - init(); -} - -/* deprecated */ -SvxUnoDrawPool::SvxUnoDrawPool(SdrModel* pModel) -: PropertySetHelper( SvxPropertySetInfoPool::getDrawingDefaults() ), mpModel( pModel ) +SvxUnoDrawPool::SvxUnoDrawPool(SdrModel* pModel, rtl::Reference<comphelper::PropertySetInfo> const & xDefaults) +: PropertySetHelper( xDefaults ), mpModel( pModel ) { init(); } diff --git a/sw/source/uibase/uno/unodefaults.cxx b/sw/source/uibase/uno/unodefaults.cxx index b8545c70954d..b12e804108e8 100644 --- a/sw/source/uibase/uno/unodefaults.cxx +++ b/sw/source/uibase/uno/unodefaults.cxx @@ -25,7 +25,7 @@ SwSvxUnoDrawPool::SwSvxUnoDrawPool(SwDoc& rDoc) : SvxUnoDrawPool(rDoc.getIDocumentDrawModelAccess().GetDrawModel(), - SvxUnoDrawPoolDefaults::Writer) + SvxPropertySetInfoPool::getWriterDrawingDefaults()) , m_rDoc(rDoc) { }