offapi/UnoApi_offapi.mk                                                        
 |    1 
 sd/IwyuFilter_sd.yaml                                                          
 |    8 --
 sd/source/console/PresenterPaneFactory.cxx                                     
 |   32 +++-----
 sd/source/console/PresenterPaneFactory.hxx                                     
 |   25 +-----
 sd/source/console/PresenterScreen.cxx                                          
 |   20 ++---
 sd/source/console/PresenterScreen.hxx                                          
 |    6 -
 sd/source/console/PresenterViewFactory.cxx                                     
 |   33 +++-----
 sd/source/console/PresenterViewFactory.hxx                                     
 |   23 +----
 sd/source/ui/framework/configuration/ConfigurationController.cxx               
 |    7 +
 
sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx 
|    8 +-
 
sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.hxx 
|    6 -
 sd/source/ui/framework/configuration/ConfigurationUpdater.cxx                  
 |    1 
 sd/source/ui/framework/configuration/ResourceFactoryManager.cxx                
 |   18 ++--
 sd/source/ui/framework/configuration/ResourceFactoryManager.hxx                
 |   14 +--
 sd/source/ui/framework/factories/BasicPaneFactory.cxx                          
 |   32 ++++----
 sd/source/ui/framework/factories/BasicToolBarFactory.cxx                       
 |    4 -
 sd/source/ui/framework/factories/BasicViewFactory.cxx                          
 |    4 -
 sd/source/ui/framework/factories/Pane.cxx                                      
 |    3 
 sd/source/ui/framework/factories/PresentationFactory.cxx                       
 |   30 +++----
 sd/source/ui/framework/module/ModuleController.cxx                             
 |   12 +--
 sd/source/ui/inc/framework/ConfigurationController.hxx                         
 |    9 +-
 sd/source/ui/inc/framework/ModuleController.hxx                                
 |    5 -
 sd/source/ui/inc/framework/PresentationFactory.hxx                             
 |   38 ++++-----
 sd/source/ui/inc/framework/ResourceFactory.hxx                                 
 |   29 ++++---
 sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx                      
 |   39 +++++-----
 sd/source/ui/inc/framework/factories/BasicToolBarFactory.hxx                   
 |   10 +-
 sd/source/ui/inc/framework/factories/BasicViewFactory.hxx                      
 |   16 +---
 27 files changed, 194 insertions(+), 239 deletions(-)

New commits:
commit 2e75e5a7c9e4f56c29f19ec856b4b98c8498beaf
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Mon Jun 23 08:26:01 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Jun 23 11:07:35 2025 +0200

    [API CHANGE] remove drawing::framework::XResource
    
    these are internal to sd and do not need to be exposed as API
    
    Change-Id: I3a4f483ad86e6e9898ba9b8f96bac28c9f086181
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186808
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index ddeedeca27b7..570b40b4db8a 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2391,7 +2391,6 @@ $(eval $(call 
gb_UnoApi_add_idlfiles,offapi,com/sun/star/drawing/framework,\
        AnchorBindingMode \
        XPane \
        XResource \
-       XResourceFactory \
        XResourceId \
        XView \
 ))
diff --git a/sd/IwyuFilter_sd.yaml b/sd/IwyuFilter_sd.yaml
index fb46be784587..727af5334a08 100644
--- a/sd/IwyuFilter_sd.yaml
+++ b/sd/IwyuFilter_sd.yaml
@@ -121,16 +121,10 @@ excludelist:
     # base class has to be a complete type
     - com/sun/star/container/XNamed.hpp
     sd/source/ui/inc/framework/factories/BasicToolBarFactory.hxx:
-    # base class has to be a complete type
-    - com/sun/star/drawing/framework/XResourceFactory.hpp
     - com/sun/star/lang/XInitialization.hpp
     sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx:
-    # base class has to be a complete type
-    - com/sun/star/drawing/framework/XResourceFactory.hpp
     - com/sun/star/lang/XInitialization.hpp
     sd/source/ui/inc/framework/factories/BasicViewFactory.hxx:
-    # base class has to be a complete type
-    - com/sun/star/drawing/framework/XResourceFactory.hpp
     - com/sun/star/lang/XInitialization.hpp
     sd/source/ui/framework/factories/ChildWindowPane.hxx:
     # base class has to be a complete type
@@ -229,8 +223,6 @@ excludelist:
     # Needed for css shortcut
     - sal/types.h
     sd/source/ui/inc/framework/PresentationFactory.hxx:
-    # base class has to be a complete type
-    - com/sun/star/drawing/framework/XResourceFactory.hpp
     sd/source/ui/inc/framework/ResourceId.hxx:
     # base class has to be a complete type
     - com/sun/star/drawing/framework/XResourceId.hpp
diff --git a/sd/source/console/PresenterPaneFactory.cxx 
b/sd/source/console/PresenterPaneFactory.cxx
index 7ec09d881819..81a263e43f7e 100644
--- a/sd/source/console/PresenterPaneFactory.cxx
+++ b/sd/source/console/PresenterPaneFactory.cxx
@@ -37,7 +37,7 @@ namespace sdext::presenter {
 
 //===== PresenterPaneFactory ==================================================
 
-Reference<drawing::framework::XResourceFactory> PresenterPaneFactory::Create (
+rtl::Reference<sd::framework::ResourceFactory> PresenterPaneFactory::Create (
     const Reference<uno::XComponentContext>& rxContext,
     const rtl::Reference<::sd::DrawController>& rxController,
     const ::rtl::Reference<PresenterController>& rpPresenterController)
@@ -45,14 +45,13 @@ Reference<drawing::framework::XResourceFactory> 
PresenterPaneFactory::Create (
     rtl::Reference<PresenterPaneFactory> pFactory (
         new PresenterPaneFactory(rxContext,rpPresenterController));
     pFactory->Register(rxController);
-    return Reference<drawing::framework::XResourceFactory>(pFactory);
+    return pFactory;
 }
 
 PresenterPaneFactory::PresenterPaneFactory (
     const Reference<uno::XComponentContext>& rxContext,
     ::rtl::Reference<PresenterController> xPresenterController)
-    : PresenterPaneFactoryInterfaceBase(m_aMutex),
-      mxComponentContextWeak(rxContext),
+    : mxComponentContextWeak(rxContext),
       mpPresenterController(std::move(xPresenterController))
 {
 }
@@ -88,7 +87,7 @@ PresenterPaneFactory::~PresenterPaneFactory()
 {
 }
 
-void SAL_CALL PresenterPaneFactory::disposing()
+void PresenterPaneFactory::disposing(std::unique_lock<std::mutex>&)
 {
     rtl::Reference<::sd::framework::ConfigurationController> xCC 
(mxConfigurationControllerWeak);
     if (xCC.is())
@@ -110,10 +109,13 @@ void SAL_CALL PresenterPaneFactory::disposing()
 
 //----- XPaneFactory ----------------------------------------------------------
 
-Reference<XResource> SAL_CALL PresenterPaneFactory::createResource (
+Reference<XResource> PresenterPaneFactory::createResource (
     const Reference<XResourceId>& rxPaneId)
 {
-    ThrowIfDisposed();
+    {
+        std::unique_lock l(m_aMutex);
+        throwIfDisposed(l);
+    }
 
     if ( ! rxPaneId.is())
         return nullptr;
@@ -150,9 +152,12 @@ Reference<XResource> SAL_CALL 
PresenterPaneFactory::createResource (
     return xResource;
 }
 
-void SAL_CALL PresenterPaneFactory::releaseResource (const 
Reference<XResource>& rxResource)
+void PresenterPaneFactory::releaseResource (const Reference<XResource>& 
rxResource)
 {
-    ThrowIfDisposed();
+    {
+        std::unique_lock l(m_aMutex);
+        throwIfDisposed(l);
+    }
 
     if ( ! rxResource.is())
         throw lang::IllegalArgumentException();
@@ -262,15 +267,6 @@ Reference<XResource> PresenterPaneFactory::CreatePane (
     return xPane;
 }
 
-void PresenterPaneFactory::ThrowIfDisposed() const
-{
-    if (rBHelper.bDisposed || rBHelper.bInDispose)
-    {
-        throw lang::DisposedException (
-            u"PresenterPaneFactory object has already been disposed"_ustr,
-            const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
-    }
-}
 
 } // end of namespace sdext::presenter
 
diff --git a/sd/source/console/PresenterPaneFactory.hxx 
b/sd/source/console/PresenterPaneFactory.hxx
index e701041538d4..1ca88dd22990 100644
--- a/sd/source/console/PresenterPaneFactory.hxx
+++ b/sd/source/console/PresenterPaneFactory.hxx
@@ -20,11 +20,9 @@
 #ifndef INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERPANEFACTORY_HXX
 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERPANEFACTORY_HXX
 
-#include <cppuhelper/compbase.hxx>
-#include <cppuhelper/basemutex.hxx>
 #include <com/sun/star/frame/XController.hpp>
 #include <com/sun/star/drawing/framework/XPane.hpp>
-#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <framework/ResourceFactory.hxx>
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <rtl/ref.hxx>
 #include <unotools/weakref.hxx>
@@ -38,18 +36,12 @@ namespace sdext::presenter {
 
 class PresenterController;
 
-typedef ::cppu::WeakComponentImplHelper <
-    css::drawing::framework::XResourceFactory
-> PresenterPaneFactoryInterfaceBase;
-
 /** The PresenterPaneFactory provides a fixed set of panes.
 
     In order to make the presenter screen more easily extendable in the
     future the set of supported panes could be made extendable on demand.
 */
-class PresenterPaneFactory
-    : public ::cppu::BaseMutex,
-      public PresenterPaneFactoryInterfaceBase
+class PresenterPaneFactory : public sd::framework::ResourceFactory
 {
 public:
     static constexpr OUString msCurrentSlidePreviewPaneURL
@@ -67,22 +59,22 @@ public:
         shut down and releases its reference to the factory then the factory
         is destroyed.
     */
-    static css::uno::Reference<css::drawing::framework::XResourceFactory> 
Create (
+    static rtl::Reference<sd::framework::ResourceFactory> Create (
         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
         const rtl::Reference<::sd::DrawController>& rxController,
         const ::rtl::Reference<PresenterController>& rpPresenterController);
     virtual ~PresenterPaneFactory() override;
 
-    virtual void SAL_CALL disposing() override;
+    virtual void disposing(std::unique_lock<std::mutex>&) override;
 
-    // XResourceFactory
+    // ResourceFactory
 
     virtual css::uno::Reference<css::drawing::framework::XResource>
-        SAL_CALL createResource (
+        createResource (
             const css::uno::Reference<
                 css::drawing::framework::XResourceId>& rxPaneId) override;
 
-    virtual void SAL_CALL
+    virtual void
         releaseResource (
             const css::uno::Reference<css::drawing::framework::XResource>&
                 rxPane) override;
@@ -108,9 +100,6 @@ private:
         const css::uno::Reference<css::drawing::framework::XResourceId>& 
rxPaneId,
         const css::uno::Reference<css::drawing::framework::XPane>& 
rxParentPane,
         const bool bIsSpritePane);
-
-    /// @throws css::lang::DisposedException
-    void ThrowIfDisposed() const;
 };
 
 }
diff --git a/sd/source/console/PresenterScreen.cxx 
b/sd/source/console/PresenterScreen.cxx
index f5c5fe6117cb..4b50145dcf00 100644
--- a/sd/source/console/PresenterScreen.cxx
+++ b/sd/source/console/PresenterScreen.cxx
@@ -305,12 +305,10 @@ void SAL_CALL PresenterScreen::disposing()
     }
     mxConfigurationControllerWeak.clear();
 
-    Reference<lang::XComponent> xViewFactoryComponent (mxViewFactory, 
UNO_QUERY);
-    if (xViewFactoryComponent.is())
-       xViewFactoryComponent->dispose();
-    Reference<lang::XComponent> xPaneFactoryComponent (mxPaneFactory, 
UNO_QUERY);
-    if (xPaneFactoryComponent.is())
-        xPaneFactoryComponent->dispose();
+    if (mxViewFactory.is())
+       mxViewFactory->dispose();
+    if (mxPaneFactory.is())
+        mxPaneFactory->dispose();
 
     mxModel = nullptr;
 }
@@ -616,14 +614,12 @@ void PresenterScreen::RequestShutdownPresenterScreen()
 
 void PresenterScreen::ShutdownPresenterScreen()
 {
-    Reference<lang::XComponent> xViewFactoryComponent (mxViewFactory, 
UNO_QUERY);
-    if (xViewFactoryComponent.is())
-        xViewFactoryComponent->dispose();
+    if (mxViewFactory.is())
+        mxViewFactory->dispose();
     mxViewFactory = nullptr;
 
-    Reference<lang::XComponent> xPaneFactoryComponent (mxPaneFactory, 
UNO_QUERY);
-    if (xPaneFactoryComponent.is())
-        xPaneFactoryComponent->dispose();
+    if (mxPaneFactory.is())
+        mxPaneFactory->dispose();
     mxPaneFactory = nullptr;
 
     if (mpPresenterController)
diff --git a/sd/source/console/PresenterScreen.hxx 
b/sd/source/console/PresenterScreen.hxx
index 4ecf2c79aa3e..6681e7671793 100644
--- a/sd/source/console/PresenterScreen.hxx
+++ b/sd/source/console/PresenterScreen.hxx
@@ -30,7 +30,7 @@
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/presentation/XPresentation2.hpp>
 #include <framework/Configuration.hxx>
-#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <framework/ResourceFactory.hxx>
 #include <rtl/ref.hxx>
 #include <unotools/weakref.hxx>
 
@@ -141,8 +141,8 @@ private:
     ::rtl::Reference<PresenterController> mpPresenterController;
     rtl::Reference<sd::framework::Configuration> mxSavedConfiguration;
     ::rtl::Reference<PresenterPaneContainer> mpPaneContainer;
-    css::uno::Reference<css::drawing::framework::XResourceFactory> 
mxPaneFactory;
-    css::uno::Reference<css::drawing::framework::XResourceFactory> 
mxViewFactory;
+    rtl::Reference<sd::framework::ResourceFactory> mxPaneFactory;
+    rtl::Reference<sd::framework::ResourceFactory> mxViewFactory;
 
     // IASS: Flag to note if InitializePresenterScreen() was executed
     bool mbIsInitialized;
diff --git a/sd/source/console/PresenterViewFactory.cxx 
b/sd/source/console/PresenterViewFactory.cxx
index 2bdb99329e23..c82f1661e65a 100644
--- a/sd/source/console/PresenterViewFactory.cxx
+++ b/sd/source/console/PresenterViewFactory.cxx
@@ -97,14 +97,13 @@ PresenterViewFactory::PresenterViewFactory (
     const Reference<uno::XComponentContext>& rxContext,
     const rtl::Reference<::sd::DrawController>& rxController,
     ::rtl::Reference<PresenterController> pPresenterController)
-    : PresenterViewFactoryInterfaceBase(m_aMutex),
-      mxComponentContext(rxContext),
+    : mxComponentContext(rxContext),
       mxControllerWeak(rxController),
       mpPresenterController(std::move(pPresenterController))
 {
 }
 
-Reference<drawing::framework::XResourceFactory> PresenterViewFactory::Create (
+rtl::Reference<sd::framework::ResourceFactory> PresenterViewFactory::Create (
     const Reference<uno::XComponentContext>& rxContext,
     const rtl::Reference<::sd::DrawController>& rxController,
     const ::rtl::Reference<PresenterController>& rpPresenterController)
@@ -112,7 +111,7 @@ Reference<drawing::framework::XResourceFactory> 
PresenterViewFactory::Create (
     rtl::Reference<PresenterViewFactory> pFactory (
         new 
PresenterViewFactory(rxContext,rxController,rpPresenterController));
     pFactory->Register(rxController);
-    return Reference<drawing::framework::XResourceFactory>(pFactory);
+    return pFactory;
 }
 
 void PresenterViewFactory::Register (const 
rtl::Reference<::sd::DrawController>& rxController)
@@ -147,7 +146,7 @@ PresenterViewFactory::~PresenterViewFactory()
 {
 }
 
-void SAL_CALL PresenterViewFactory::disposing()
+void PresenterViewFactory::disposing(std::unique_lock<std::mutex>&)
 {
     if (mxConfigurationController.is())
         mxConfigurationController->removeResourceFactoryForReference(this);
@@ -174,10 +173,13 @@ void SAL_CALL PresenterViewFactory::disposing()
 
 //----- XViewFactory ----------------------------------------------------------
 
-Reference<XResource> SAL_CALL PresenterViewFactory::createResource (
+Reference<XResource> PresenterViewFactory::createResource (
     const Reference<XResourceId>& rxViewId)
 {
-    ThrowIfDisposed();
+    {
+        std::unique_lock l(m_aMutex);
+        throwIfDisposed(l);
+    }
 
     Reference<XResource> xView;
 
@@ -200,9 +202,12 @@ Reference<XResource> SAL_CALL 
PresenterViewFactory::createResource (
     return xView;
 }
 
-void SAL_CALL PresenterViewFactory::releaseResource (const 
Reference<XResource>& rxView)
+void PresenterViewFactory::releaseResource (const Reference<XResource>& rxView)
 {
-    ThrowIfDisposed();
+    {
+        std::unique_lock l(m_aMutex);
+        throwIfDisposed(l);
+    }
 
     if ( ! rxView.is())
         return;
@@ -465,16 +470,6 @@ Reference<XView> PresenterViewFactory::CreateHelpView(
         mpPresenterController));
 }
 
-void PresenterViewFactory::ThrowIfDisposed() const
-{
-    if (rBHelper.bDisposed || rBHelper.bInDispose)
-    {
-        throw lang::DisposedException (
-            u"PresenterViewFactory object has already been disposed"_ustr,
-            const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
-    }
-}
-
 //===== CachablePresenterView =================================================
 
 CachablePresenterView::CachablePresenterView()
diff --git a/sd/source/console/PresenterViewFactory.hxx 
b/sd/source/console/PresenterViewFactory.hxx
index be7c20c49931..03c03e4f9993 100644
--- a/sd/source/console/PresenterViewFactory.hxx
+++ b/sd/source/console/PresenterViewFactory.hxx
@@ -21,9 +21,7 @@
 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERVIEWFACTORY_HXX
 
 #include "PresenterController.hxx"
-#include <cppuhelper/compbase.hxx>
-#include <cppuhelper/basemutex.hxx>
-#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <framework/ResourceFactory.hxx>
 #include <com/sun/star/drawing/framework/XView.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <unotools/weakref.hxx>
@@ -34,10 +32,6 @@ namespace sd { class DrawController; }
 
 namespace sdext::presenter {
 
-typedef ::cppu::WeakComponentImplHelper <
-    css::drawing::framework::XResourceFactory
-> PresenterViewFactoryInterfaceBase;
-
 /** Base class for presenter views that allows the view factory to store
     them in a cache and reuse deactivated views.
 */
@@ -72,9 +66,7 @@ protected:
         the notes of the current slide,
         a tool bar
 */
-class PresenterViewFactory
-    : public ::cppu::BaseMutex,
-      public PresenterViewFactoryInterfaceBase
+class PresenterViewFactory : public sd::framework::ResourceFactory
 {
 public:
     static constexpr OUString msCurrentSlidePreviewViewURL
@@ -93,21 +85,21 @@ public:
         shut down and releases its reference to the factory then the factory
         is destroyed.
     */
-    static css::uno::Reference<css::drawing::framework::XResourceFactory> 
Create (
+    static rtl::Reference<sd::framework::ResourceFactory> Create (
         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
         const ::rtl::Reference<::sd::DrawController>& rxController,
         const ::rtl::Reference<PresenterController>& rpPresenterController);
     virtual ~PresenterViewFactory() override;
 
-    virtual void SAL_CALL disposing() override;
+    virtual void disposing(std::unique_lock<std::mutex>&) override;
 
     // XResourceFactory
 
     virtual css::uno::Reference<css::drawing::framework::XResource>
-        SAL_CALL createResource (
+        createResource (
             const css::uno::Reference<css::drawing::framework::XResourceId>& 
rxViewId) override;
 
-    virtual void SAL_CALL
+    virtual void
         releaseResource (
             const css::uno::Reference<css::drawing::framework::XResource>& 
rxPane) override;
 
@@ -153,9 +145,6 @@ private:
     css::uno::Reference<css::drawing::framework::XResource> CreateView(
         const css::uno::Reference<css::drawing::framework::XResourceId>& 
rxViewId,
         const css::uno::Reference<css::drawing::framework::XPane>& 
rxAnchorPane);
-
-    /// @throws css::lang::DisposedException
-    void ThrowIfDisposed() const;
 };
 
 }
diff --git a/sd/source/ui/framework/configuration/ConfigurationController.cxx 
b/sd/source/ui/framework/configuration/ConfigurationController.cxx
index 09675fc98bc5..13db0b008f4b 100644
--- a/sd/source/ui/framework/configuration/ConfigurationController.cxx
+++ b/sd/source/ui/framework/configuration/ConfigurationController.cxx
@@ -20,6 +20,7 @@
 #include <framework/ConfigurationController.hxx>
 #include <framework/Configuration.hxx>
 #include <framework/FrameworkHelper.hxx>
+#include <framework/ResourceFactory.hxx>
 #include <DrawController.hxx>
 #include "ConfigurationUpdater.hxx"
 #include "ConfigurationControllerBroadcaster.hxx"
@@ -439,7 +440,7 @@ void ConfigurationController::restoreConfiguration (
 
 void ConfigurationController::addResourceFactory(
     const OUString& sResourceURL,
-    const Reference<XResourceFactory>& rxResourceFactory)
+    const rtl::Reference<ResourceFactory>& rxResourceFactory)
 {
     ::osl::MutexGuard aGuard (m_aMutex);
     ThrowIfDisposed();
@@ -455,14 +456,14 @@ void ConfigurationController::removeResourceFactoryForURL(
 }
 
 void ConfigurationController::removeResourceFactoryForReference(
-    const Reference<XResourceFactory>& rxResourceFactory)
+    const rtl::Reference<ResourceFactory>& rxResourceFactory)
 {
     ::osl::MutexGuard aGuard (m_aMutex);
     ThrowIfDisposed();
     
mpImplementation->mpResourceFactoryContainer->RemoveFactoryForReference(rxResourceFactory);
 }
 
-Reference<XResourceFactory> ConfigurationController::getResourceFactory (
+rtl::Reference<ResourceFactory> ConfigurationController::getResourceFactory (
     const OUString& sResourceURL)
 {
     ::osl::MutexGuard aGuard (m_aMutex);
diff --git 
a/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx
 
b/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx
index 1754701cf923..e4419359fe79 100644
--- 
a/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx
+++ 
b/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx
@@ -23,7 +23,7 @@
 #include <framework/FrameworkHelper.hxx>
 #include <com/sun/star/lang/DisposedException.hpp>
 #include <framework/Configuration.hxx>
-#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <framework/ResourceFactory.hxx>
 #include <comphelper/diagnose_ex.hxx>
 #include <sal/log.hxx>
 #include <algorithm>
@@ -113,7 +113,7 @@ void 
ConfigurationControllerResourceManager::ActivateResource (
 
     // 1. Get the factory.
     const OUString sResourceURL (rxResourceId->getResourceURL());
-    Reference<XResourceFactory> xFactory 
(mpResourceFactoryContainer->GetFactory(sResourceURL));
+    rtl::Reference<ResourceFactory> xFactory 
(mpResourceFactoryContainer->GetFactory(sResourceURL));
     if ( ! xFactory.is())
     {
         SAL_INFO("sd.fwk", __func__ << ":    no factory found for " << 
sResourceURL);
@@ -204,7 +204,7 @@ void 
ConfigurationControllerResourceManager::DeactivateResource (
             catch (const lang::DisposedException& rException)
             {
                 if ( ! rException.Context.is()
-                    || rException.Context == aDescriptor.mxResourceFactory)
+                    || rException.Context == 
cppu::getXWeak(aDescriptor.mxResourceFactory.get()))
                 {
                     // The factory is disposed and can be removed from the
                     // list of registered factories.
@@ -242,7 +242,7 @@ void 
ConfigurationControllerResourceManager::DeactivateResource (
 
 void ConfigurationControllerResourceManager::AddResource (
     const Reference<XResource>& rxResource,
-    const Reference<XResourceFactory>& rxFactory)
+    const rtl::Reference<ResourceFactory>& rxFactory)
 {
     if ( ! rxResource.is())
     {
diff --git 
a/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.hxx
 
b/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.hxx
index 23da093d0690..590376ca3521 100644
--- 
a/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.hxx
+++ 
b/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.hxx
@@ -28,7 +28,6 @@
 #include <vector>
 
 namespace sd::framework { class Configuration; }
-namespace com::sun::star::drawing::framework { class XResourceFactory; }
 namespace com::sun::star::drawing::framework { class XResource; }
 namespace com::sun::star::drawing::framework { class XResourceId; }
 
@@ -36,6 +35,7 @@ namespace sd::framework {
 
 class ConfigurationControllerBroadcaster;
 class ResourceFactoryManager;
+class ResourceFactory;
 
 /** Manage the set of active resources.  Activate and deactivate resources.
 */
@@ -49,7 +49,7 @@ public:
     struct ResourceDescriptor
     {
         css::uno::Reference<css::drawing::framework::XResource> mxResource;
-        css::uno::Reference<css::drawing::framework::XResourceFactory> 
mxResourceFactory;
+        rtl::Reference<framework::ResourceFactory> mxResourceFactory;
     };
 
     /** A new ResourceManager object is created with the resource factory
@@ -129,7 +129,7 @@ private:
 
     void AddResource (
         const css::uno::Reference<css::drawing::framework::XResource>& 
rxResource,
-        const css::uno::Reference<css::drawing::framework::XResourceFactory>& 
rxFactory);
+        const rtl::Reference<framework::ResourceFactory>& rxFactory);
 
     ResourceDescriptor RemoveResource (
         const css::uno::Reference<css::drawing::framework::XResourceId>& 
rxResourceId);
diff --git a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx 
b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx
index 9ccc1cae6bca..dc92cb62f6b7 100644
--- a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx
+++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx
@@ -26,6 +26,7 @@
 #include <framework/ConfigurationChangeEvent.hxx>
 #include <framework/ConfigurationController.hxx>
 #include <framework/FrameworkHelper.hxx>
+#include <framework/ResourceFactory.hxx>
 #include <DrawController.hxx>
 #include <framework/ConfigurationChangeEvent.hxx>
 
diff --git a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx 
b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
index 4cc97078dd70..f2cfc57e4e82 100644
--- a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
+++ b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
@@ -20,8 +20,8 @@
 #include "ResourceFactoryManager.hxx"
 #include <DrawController.hxx>
 #include <framework/ModuleController.hxx>
+#include <framework/ResourceFactory.hxx>
 #include <tools/wldcrd.hxx>
-#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
 #include <com/sun/star/util/URLTransformer.hpp>
@@ -32,7 +32,6 @@
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::drawing::framework;
 
 #undef VERBOSE
 //#define VERBOSE 1
@@ -51,10 +50,9 @@ ResourceFactoryManager::~ResourceFactoryManager()
 {
     for (auto& rXInterfaceResource : maFactoryMap)
     {
-        Reference<lang::XComponent> xComponent (rXInterfaceResource.second, 
UNO_QUERY);
+        if (rXInterfaceResource.second.is())
+            rXInterfaceResource.second->dispose();
         rXInterfaceResource.second = nullptr;
-        if (xComponent.is())
-            xComponent->dispose();
     }
 
     Reference<lang::XComponent> xComponent (mxURLTransformer, UNO_QUERY);
@@ -64,7 +62,7 @@ ResourceFactoryManager::~ResourceFactoryManager()
 
 void ResourceFactoryManager::AddFactory (
     const OUString& rsURL,
-    const Reference<XResourceFactory>& rxFactory)
+    const rtl::Reference<ResourceFactory>& rxFactory)
 {
     if ( ! rxFactory.is())
         throw lang::IllegalArgumentException();
@@ -119,7 +117,7 @@ void ResourceFactoryManager::RemoveFactoryForURL (
 }
 
 void ResourceFactoryManager::RemoveFactoryForReference(
-    const Reference<XResourceFactory>& rxFactory)
+    const rtl::Reference<ResourceFactory>& rxFactory)
 {
     std::scoped_lock aGuard (maMutex);
 
@@ -140,7 +138,7 @@ void ResourceFactoryManager::RemoveFactoryForReference(
             [&] (FactoryPatternList::value_type const& it) { return it.second 
== rxFactory; });
 }
 
-Reference<XResourceFactory> ResourceFactoryManager::GetFactory (
+rtl::Reference<ResourceFactory> ResourceFactoryManager::GetFactory (
     const OUString& rsCompleteURL)
 {
     OUString sURLBase (rsCompleteURL);
@@ -152,7 +150,7 @@ Reference<XResourceFactory> 
ResourceFactoryManager::GetFactory (
             sURLBase = aURL.Main;
     }
 
-    Reference<XResourceFactory> xFactory = FindFactory(sURLBase);
+    rtl::Reference<ResourceFactory> xFactory = FindFactory(sURLBase);
 
     if ( ! xFactory.is() && mxControllerManager.is())
     {
@@ -171,7 +169,7 @@ Reference<XResourceFactory> 
ResourceFactoryManager::GetFactory (
     return xFactory;
 }
 
-Reference<XResourceFactory> ResourceFactoryManager::FindFactory (const 
OUString& rsURLBase)
+rtl::Reference<ResourceFactory> ResourceFactoryManager::FindFactory (const 
OUString& rsURLBase)
 {
     std::scoped_lock aGuard (maMutex);
     FactoryMap::const_iterator iFactory (maFactoryMap.find(rsURLBase));
diff --git a/sd/source/ui/framework/configuration/ResourceFactoryManager.hxx 
b/sd/source/ui/framework/configuration/ResourceFactoryManager.hxx
index 15bf883e4d03..9efb82c224cf 100644
--- a/sd/source/ui/framework/configuration/ResourceFactoryManager.hxx
+++ b/sd/source/ui/framework/configuration/ResourceFactoryManager.hxx
@@ -30,11 +30,11 @@
 #include <rtl/ref.hxx>
 #include <rtl/ustring.hxx>
 
-namespace com::sun::star::drawing::framework { class XResourceFactory; }
 namespace com::sun::star::util { class XURLTransformer; }
 namespace sd { class DrawController; }
 
 namespace sd::framework {
+class ResourceFactory;
 
 /** Container of resource factories of the drawing framework.
 */
@@ -54,7 +54,7 @@ public:
     */
     void AddFactory (
         const OUString& rsURL,
-        const css::uno::Reference<css::drawing::framework::XResourceFactory>& 
rxFactory);
+        const rtl::Reference<sd::framework::ResourceFactory>& rxFactory);
 
     /** Unregister the specified factory.
         @param rsURL
@@ -72,7 +72,7 @@ public:
         @throws css::uno::RuntimeException
     */
     void RemoveFactoryForReference(
-        const css::uno::Reference<css::drawing::framework::XResourceFactory>& 
rxFactory);
+        const rtl::Reference<sd::framework::ResourceFactory>& rxFactory);
 
     /** Return a factory that can create resources specified by the given URL.
         @param rsCompleteURL
@@ -83,20 +83,20 @@ public:
             is returned.  Otherwise an empty reference is returned.
         @throws css::uno::RuntimeException
     */
-    css::uno::Reference<css::drawing::framework::XResourceFactory> GetFactory (
+    rtl::Reference<sd::framework::ResourceFactory> GetFactory (
         const OUString& rsURL);
 
 private:
     std::mutex maMutex;
     typedef std::unordered_map<
         OUString,
-        css::uno::Reference<css::drawing::framework::XResourceFactory> > 
FactoryMap;
+        rtl::Reference<sd::framework::ResourceFactory> > FactoryMap;
     FactoryMap maFactoryMap;
 
     typedef ::std::vector<
         ::std::pair<
             OUString,
-            css::uno::Reference<css::drawing::framework::XResourceFactory> > >
+            rtl::Reference<sd::framework::ResourceFactory> > >
         FactoryPatternList;
     FactoryPatternList maFactoryPatternList;
 
@@ -111,7 +111,7 @@ private:
             When the factory has not yet been added then return NULL.
         @throws css::uno::RuntimeException
     */
-    css::uno::Reference<css::drawing::framework::XResourceFactory> FindFactory 
(
+    rtl::Reference<sd::framework::ResourceFactory> FindFactory (
         const OUString& rsURLBase);
 };
 
diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx 
b/sd/source/ui/framework/factories/BasicPaneFactory.cxx
index 9633f4ff1623..9dd7cf160901 100644
--- a/sd/source/ui/framework/factories/BasicPaneFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx
@@ -80,7 +80,7 @@ public:
 
 BasicPaneFactory::BasicPaneFactory(
     const rtl::Reference<::sd::DrawController>& rxController)
-    : mpViewShellBase(nullptr)
+    : mxListener(new Listener(*this)), mpViewShellBase(nullptr)
 {
     try
     {
@@ -126,11 +126,11 @@ BasicPaneFactory::BasicPaneFactory(
         if (xCC.is())
         {
             xCC->addConfigurationChangeListener(
-                this,
+                mxListener,
                 FrameworkHelper::msConfigurationUpdateStartEvent,
                 Any(gnConfigurationUpdateStartEvent));
             xCC->addConfigurationChangeListener(
-                this,
+                mxListener,
                 FrameworkHelper::msConfigurationUpdateEndEvent,
                 Any(gnConfigurationUpdateEndEvent));
         }
@@ -153,7 +153,7 @@ void 
BasicPaneFactory::disposing(std::unique_lock<std::mutex>&)
     if (xCC.is())
     {
         xCC->removeResourceFactoryForReference(this);
-        xCC->removeConfigurationChangeListener(this);
+        xCC->removeConfigurationChangeListener(mxListener);
         mxConfigurationControllerWeak.clear();
     }
 
@@ -164,7 +164,7 @@ void 
BasicPaneFactory::disposing(std::unique_lock<std::mutex>&)
             Reference<XComponent> xComponent (rDescriptor.mxPane, UNO_QUERY);
             if (xComponent.is())
             {
-                xComponent->removeEventListener(this);
+                xComponent->removeEventListener(mxListener);
                 xComponent->dispose();
             }
         }
@@ -173,7 +173,7 @@ void 
BasicPaneFactory::disposing(std::unique_lock<std::mutex>&)
 
 //===== XPaneFactory ==========================================================
 
-Reference<XResource> SAL_CALL BasicPaneFactory::createResource (
+Reference<XResource> BasicPaneFactory::createResource (
     const Reference<XResourceId>& rxPaneId)
 {
     ThrowIfDisposed();
@@ -231,7 +231,7 @@ Reference<XResource> SAL_CALL 
BasicPaneFactory::createResource (
         // Listen for the pane being disposed.
         Reference<lang::XComponent> xComponent (xPane, UNO_QUERY);
         if (xComponent.is())
-            xComponent->addEventListener(this);
+            xComponent->addEventListener(mxListener);
     }
     iDescriptor->mbIsReleased = false;
 
@@ -239,7 +239,7 @@ Reference<XResource> SAL_CALL 
BasicPaneFactory::createResource (
     return xPane;
 }
 
-void SAL_CALL BasicPaneFactory::releaseResource (
+void BasicPaneFactory::releaseResource (
     const Reference<XResource>& rxPane)
 {
     ThrowIfDisposed();
@@ -281,7 +281,7 @@ void SAL_CALL BasicPaneFactory::releaseResource (
         {
             // We are disposing the pane and do not have to be informed of
             // that.
-            xComponent->removeEventListener(this);
+            xComponent->removeEventListener(mxListener);
             xComponent->dispose();
         }
     }
@@ -290,7 +290,7 @@ void SAL_CALL BasicPaneFactory::releaseResource (
 
 //===== ConfigurationChangeListener ==========================================
 
-void BasicPaneFactory::notifyConfigurationChange (
+void BasicPaneFactory::Listener::notifyConfigurationChange (
     const ConfigurationChangeEvent& /* rEvent */ )
 {
     // FIXME: nothing to do
@@ -298,12 +298,12 @@ void BasicPaneFactory::notifyConfigurationChange (
 
 //===== lang::XEventListener ==================================================
 
-void SAL_CALL BasicPaneFactory::disposing (
+void SAL_CALL BasicPaneFactory::Listener::disposing (
     const lang::EventObject& rEventObject)
 {
-    if 
(uno::Reference<XInterface>(cppu::getXWeak(mxConfigurationControllerWeak.get().get()))
 == rEventObject.Source)
+    if 
(uno::Reference<XInterface>(cppu::getXWeak(mrParent.mxConfigurationControllerWeak.get().get()))
 == rEventObject.Source)
     {
-        mxConfigurationControllerWeak.clear();
+        mrParent.mxConfigurationControllerWeak.clear();
     }
     else
     {
@@ -312,10 +312,10 @@ void SAL_CALL BasicPaneFactory::disposing (
         Reference<XResource> xPane (rEventObject.Source, UNO_QUERY);
         PaneContainer::iterator iDescriptor (
             ::std::find_if(
-                maPaneContainer.begin(),
-                maPaneContainer.end(),
+                mrParent.maPaneContainer.begin(),
+                mrParent.maPaneContainer.end(),
                 [&] (PaneDescriptor const& rPane) { return 
rPane.ComparePane(xPane); } ));
-        if (iDescriptor != maPaneContainer.end())
+        if (iDescriptor != mrParent.maPaneContainer.end())
         {
             iDescriptor->mxPane = nullptr;
         }
diff --git a/sd/source/ui/framework/factories/BasicToolBarFactory.cxx 
b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx
index 03c013e59b07..eb0ad8fb33b5 100644
--- a/sd/source/ui/framework/factories/BasicToolBarFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx
@@ -102,7 +102,7 @@ void SAL_CALL BasicToolBarFactory::disposing (
 
 //===== XPaneFactory ==========================================================
 
-Reference<XResource> SAL_CALL BasicToolBarFactory::createResource (
+Reference<XResource> BasicToolBarFactory::createResource (
     const Reference<XResourceId>& rxToolBarId)
 {
     ThrowIfDisposed();
@@ -114,7 +114,7 @@ Reference<XResource> SAL_CALL 
BasicToolBarFactory::createResource (
     return xToolBar;
 }
 
-void SAL_CALL BasicToolBarFactory::releaseResource (
+void BasicToolBarFactory::releaseResource (
     const Reference<XResource>& rxToolBar)
 {
     ThrowIfDisposed();
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx 
b/sd/source/ui/framework/factories/BasicViewFactory.cxx
index eaacf0de1f95..786f323a7a10 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -132,7 +132,7 @@ void 
BasicViewFactory::disposing(std::unique_lock<std::mutex>&)
     maViewShellContainer.clear();
 }
 
-Reference<XResource> SAL_CALL BasicViewFactory::createResource (
+Reference<XResource> BasicViewFactory::createResource (
     const Reference<XResourceId>& rxViewId)
 {
     const bool bIsCenterPane (
@@ -179,7 +179,7 @@ Reference<XResource> SAL_CALL 
BasicViewFactory::createResource (
     return xView;
 }
 
-void SAL_CALL BasicViewFactory::releaseResource (const Reference<XResource>& 
rxView)
+void BasicViewFactory::releaseResource (const Reference<XResource>& rxView)
 {
     if ( ! rxView.is())
         throw lang::IllegalArgumentException();
diff --git a/sd/source/ui/framework/factories/Pane.cxx 
b/sd/source/ui/framework/factories/Pane.cxx
index c3e7960067cc..417e4e8c7e25 100644
--- a/sd/source/ui/framework/factories/Pane.cxx
+++ b/sd/source/ui/framework/factories/Pane.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <framework/Pane.hxx>
+#include <framework/ResourceFactory.hxx>
 
 #include <osl/mutex.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
@@ -139,6 +140,8 @@ void Pane::ThrowIfDisposed() const
     }
 }
 
+ResourceFactory::~ResourceFactory() {}
+
 } // end of namespace sd::framework
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/framework/factories/PresentationFactory.cxx 
b/sd/source/ui/framework/factories/PresentationFactory.cxx
index 0651bf7bee46..227c1cf09bae 100644
--- a/sd/source/ui/framework/factories/PresentationFactory.cxx
+++ b/sd/source/ui/framework/factories/PresentationFactory.cxx
@@ -72,7 +72,8 @@ constexpr OUString gsPresentationViewURL = 
u"private:resource/view/Presentation"
 
 PresentationFactory::PresentationFactory (
     const rtl::Reference<::sd::DrawController>& rxController)
-    : mxController(rxController)
+    : mxController(rxController),
+      mxListener(new Listener)
 {
 }
 
@@ -82,10 +83,13 @@ PresentationFactory::~PresentationFactory()
 
 //----- XViewFactory ----------------------------------------------------------
 
-Reference<XResource> SAL_CALL PresentationFactory::createResource (
+Reference<XResource> PresentationFactory::createResource (
     const Reference<XResourceId>& rxViewId)
 {
-    ThrowIfDisposed();
+    {
+        std::unique_lock l(m_aMutex);
+        throwIfDisposed(l);
+    }
 
     if (rxViewId.is())
         if ( ! rxViewId->hasAnchor() && rxViewId->getResourceURL() == 
gsPresentationViewURL)
@@ -94,10 +98,13 @@ Reference<XResource> SAL_CALL 
PresentationFactory::createResource (
     return Reference<XResource>();
 }
 
-void SAL_CALL PresentationFactory::releaseResource (
+void PresentationFactory::releaseResource (
     const Reference<XResource>&)
 {
-    ThrowIfDisposed();
+    {
+        std::unique_lock l(m_aMutex);
+        throwIfDisposed(l);
+    }
 
     if (mxController)
     {
@@ -109,25 +116,16 @@ void SAL_CALL PresentationFactory::releaseResource (
 
 //===== ConfigurationChangeListener ==========================================
 
-void PresentationFactory::notifyConfigurationChange (
+void PresentationFactory::Listener::notifyConfigurationChange (
     const ConfigurationChangeEvent&)
 {}
 
 //===== lang::XEventListener ==================================================
 
-void SAL_CALL PresentationFactory::disposing (
+void SAL_CALL PresentationFactory::Listener::disposing (
     const lang::EventObject&)
 {}
 
-void PresentationFactory::ThrowIfDisposed() const
-{
-    if (m_bDisposed)
-    {
-        throw lang::DisposedException (u"PresentationFactory object has 
already been disposed"_ustr,
-            const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
-    }
-}
-
 void PresentationFactory::install(const rtl::Reference<::sd::DrawController>& 
rxController)
 {
     try
diff --git a/sd/source/ui/framework/module/ModuleController.cxx 
b/sd/source/ui/framework/module/ModuleController.cxx
index 4a56f07c9422..0215942d8fa2 100644
--- a/sd/source/ui/framework/module/ModuleController.cxx
+++ b/sd/source/ui/framework/module/ModuleController.cxx
@@ -129,25 +129,25 @@ void ModuleController::requestResource (const OUString& 
rsResourceURL)
 
     // Check that the factory has already been loaded and not been
     // destroyed in the meantime.
-    Reference<XInterface> xFactory;
+    rtl::Reference<ResourceFactory> xFactory;
     auto iLoadedFactory = maLoadedFactories.find(iFactory->second);
     if (iLoadedFactory != maLoadedFactories.end())
-        xFactory.set(iLoadedFactory->second, UNO_QUERY);
+        xFactory = iLoadedFactory->second;
     if (  xFactory.is())
         return;
 
     // Create the factory service.
     if (iFactory->second == "com.sun.star.drawing.framework.BasicPaneFactory")
-        xFactory = 
uno::Reference<css::drawing::framework::XResourceFactory>(new 
BasicPaneFactory(mxController));
+        xFactory = new BasicPaneFactory(mxController);
     else if (iFactory->second == 
"com.sun.star.drawing.framework.BasicViewFactory")
-        xFactory = 
uno::Reference<css::drawing::framework::XResourceFactory>(new 
BasicViewFactory(mxController));
+        xFactory = new BasicViewFactory(mxController);
     else if (iFactory->second == 
"com.sun.star.drawing.framework.BasicToolBarFactory")
-        xFactory = 
uno::Reference<css::drawing::framework::XResourceFactory>(new 
BasicToolBarFactory(mxController));
+        xFactory = new BasicToolBarFactory(mxController);
     else
         throw RuntimeException(u"unknown factory"_ustr);
 
     // Remember that this factory has been instanced.
-    maLoadedFactories[iFactory->second] = xFactory;
+    maLoadedFactories[iFactory->second] = xFactory.get();
 }
 
 } // end of namespace sd::framework
diff --git a/sd/source/ui/inc/framework/ConfigurationController.hxx 
b/sd/source/ui/inc/framework/ConfigurationController.hxx
index d5f2b6b8952d..0934828829bc 100644
--- a/sd/source/ui/inc/framework/ConfigurationController.hxx
+++ b/sd/source/ui/inc/framework/ConfigurationController.hxx
@@ -22,7 +22,7 @@
 #include <sddllapi.h>
 #include <framework/ConfigurationChangeListener.hxx>
 #include <framework/ConfigurationChangeRequest.hxx>
-#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <com/sun/star/drawing/framework/XResource.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
 
 #include <cppuhelper/basemutex.hxx>
@@ -34,6 +34,7 @@
 namespace sd { class DrawController; }
 
 namespace sd::framework {
+class ResourceFactory;
 
 /** The ResourceActivationMode specifies, for example for the
     
com::sun::star::drawing::framework::XConfigurationController::requestResourceActivation(),
@@ -151,15 +152,15 @@ public:
 
     void addResourceFactory(
         const OUString& sResourceURL,
-        const css::uno::Reference<css::drawing::framework::XResourceFactory>& 
rxResourceFactory);
+        const rtl::Reference<sd::framework::ResourceFactory>& 
rxResourceFactory);
 
     void removeResourceFactoryForURL(
         const OUString& sResourceURL);
 
     void removeResourceFactoryForReference(
-        const css::uno::Reference<css::drawing::framework::XResourceFactory>& 
rxResourceFactory);
+        const rtl::Reference<sd::framework::ResourceFactory>& 
rxResourceFactory);
 
-    css::uno::Reference<css::drawing::framework::XResourceFactory>
+    rtl::Reference<sd::framework::ResourceFactory>
         getResourceFactory (
         const OUString& sResourceURL);
 
diff --git a/sd/source/ui/inc/framework/ModuleController.hxx 
b/sd/source/ui/inc/framework/ModuleController.hxx
index 2237ec0632cf..4471235eb8d8 100644
--- a/sd/source/ui/inc/framework/ModuleController.hxx
+++ b/sd/source/ui/inc/framework/ModuleController.hxx
@@ -21,7 +21,7 @@
 
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <comphelper/compbase.hxx>
-#include <cppuhelper/weakref.hxx>
+#include <unotools/weakref.hxx>
 #include <rtl/ref.hxx>
 
 #include <unordered_map>
@@ -29,6 +29,7 @@
 namespace sd { class DrawController; }
 
 namespace sd::framework {
+class ResourceFactory;
 
 typedef comphelper::WeakComponentImplHelper <> ModuleControllerInterfaceBase;
 
@@ -67,7 +68,7 @@ private:
     rtl::Reference<::sd::DrawController> mxController;
 
     std::unordered_map<OUString, OUString> maResourceToFactoryMap;
-    std::unordered_map<OUString, 
css::uno::WeakReference<css::uno::XInterface>> maLoadedFactories;
+    std::unordered_map<OUString, 
unotools::WeakReference<sd::framework::ResourceFactory>> maLoadedFactories;
 
     ModuleController (const ModuleController&) = delete;
     virtual ~ModuleController() noexcept override;
diff --git a/sd/source/ui/inc/framework/PresentationFactory.hxx 
b/sd/source/ui/inc/framework/PresentationFactory.hxx
index fd8f87207a64..e0a391ad8b58 100644
--- a/sd/source/ui/inc/framework/PresentationFactory.hxx
+++ b/sd/source/ui/inc/framework/PresentationFactory.hxx
@@ -19,26 +19,20 @@
 
 #pragma once
 
-#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <framework/ResourceFactory.hxx>
 #include <framework/ConfigurationChangeListener.hxx>
-#include <comphelper/compbase.hxx>
 #include <rtl/ref.hxx>
 
 namespace sd { class DrawController; }
 
 namespace sd::framework {
 
-typedef cppu::ImplInheritanceHelper <
-    sd::framework::ConfigurationChangeListener,
-    css::drawing::framework::XResourceFactory
-    > PresentationFactoryInterfaceBase;
-
 /** This factory creates a marker view whose existence in a configuration
     indicates that a slideshow is running (in another but associated
     application window).
 */
 class PresentationFactory final
-    : public PresentationFactoryInterfaceBase
+    : public sd::framework::ResourceFactory
 {
 public:
     PresentationFactory (
@@ -50,29 +44,29 @@ public:
     // XResourceFactory
 
     virtual css::uno::Reference<css::drawing::framework::XResource>
-        SAL_CALL createResource (
+        createResource (
             const css::uno::Reference<
                 css::drawing::framework::XResourceId>& rxViewId) override;
 
-    virtual void SAL_CALL releaseResource (
+    virtual void releaseResource (
         const css::uno::Reference<css::drawing::framework::XResource>& xView) 
override;
 
-    // ConfigurationChangeListener
-
-    virtual void notifyConfigurationChange (
-        const sd::framework::ConfigurationChangeEvent& rEvent) override;
+private:
+    class Listener : public sd::framework::ConfigurationChangeListener
+    {
+        using WeakComponentImplHelperBase::disposing;
 
-    // lang::XEventListener
+        // ConfigurationChangeListener
+        virtual void notifyConfigurationChange (
+            const sd::framework::ConfigurationChangeEvent& rEvent) override;
 
-    using WeakComponentImplHelperBase::disposing;
-    virtual void SAL_CALL disposing (
-        const css::lang::EventObject& rEventObject) override;
+        // lang::XEventListener
+        virtual void SAL_CALL disposing (
+            const css::lang::EventObject& rEventObject) override;
+    };
 
-private:
     rtl::Reference<::sd::DrawController> mxController;
-
-    /// @throws css::lang::DisposedException
-    void ThrowIfDisposed() const;
+    rtl::Reference<Listener> mxListener;
 };
 
 } // end of namespace sd::framework
diff --git a/offapi/com/sun/star/drawing/framework/XResourceFactory.idl 
b/sd/source/ui/inc/framework/ResourceFactory.hxx
similarity index 80%
rename from offapi/com/sun/star/drawing/framework/XResourceFactory.idl
rename to sd/source/ui/inc/framework/ResourceFactory.hxx
index 2ed4d8ee740d..49b00f34093c 100644
--- a/offapi/com/sun/star/drawing/framework/XResourceFactory.idl
+++ b/sd/source/ui/inc/framework/ResourceFactory.hxx
@@ -17,19 +17,23 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-module com { module sun { module star { module drawing { module framework {
+#pragma once
 
-interface XResource;
-interface XResourceId;
+#include <com/sun/star/drawing/framework/XResource.hpp>
+#include <comphelper/compbase.hxx>
+#include <sddllapi.h>
 
+namespace sd::framework
+{
 /** Factory and possibly cache for creating and releasing resources.
     <p>A resource factory is created and used by the
     XConfigurationController object.</p>
     <p>A factory may want to implement a cache to reuse previously released
     resources.</p>
 */
-interface XResourceFactory
+class SD_DLLPUBLIC ResourceFactory : public 
comphelper::WeakComponentImplHelper<>
 {
+public:
     /** Create a resource for the given XResourceId object.
         @param xResourceId
             The resource URL of this id specifies the type of resource to
@@ -49,11 +53,9 @@ interface XResourceFactory
         @throws InvalidArgumentException
             when the given URL is not supported by the factory.
     */
-    XResource createResource (
-            [in] XResourceId xResourceId)
-        raises  (   ::com::sun::star::lang::IllegalArgumentException,
-                    ::com::sun::star::lang::WrappedTargetException
-                );
+    virtual ::css::uno::Reference<::css::drawing::framework::XResource>
+    createResource(const 
::css::uno::Reference<::css::drawing::framework::XResourceId>& xResourceId)
+        = 0;
 
     /** Call this method to tell a factory that the given resource is no
         longer in use.  The factory can decide whether to destroy the
@@ -63,9 +65,14 @@ interface XResourceFactory
         @throws InvalidArgumentException
             when the given pane was not created by the same factory.
     */
-    void releaseResource ([in] XResource xResource);
+    virtual void
+    releaseResource(const 
::css::uno::Reference<::css::drawing::framework::XResource>& xResource)
+        = 0;
+
+protected:
+    virtual ~ResourceFactory() override;
 };
 
-}; }; }; }; }; // ::com::sun::star::drawing::framework
+} // end of namespace sd::framework
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx 
b/sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx
index 5f8d26d58a65..b361388652e1 100644
--- a/sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx
+++ b/sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx
@@ -19,10 +19,8 @@
 
 #pragma once
 
-#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
+#include <framework/ResourceFactory.hxx>
 #include <framework/ConfigurationChangeListener.hxx>
-#include <comphelper/compbase.hxx>
 #include <unotools/weakref.hxx>
 #include <rtl/ref.hxx>
 
@@ -38,10 +36,6 @@ class ViewShellBase;
 namespace sd::framework {
 class ConfigurationController;
 
-typedef cppu::ImplInheritanceHelper <
-    sd::framework::ConfigurationChangeListener,
-    css::drawing::framework::XResourceFactory
-    > BasicPaneFactoryInterfaceBase;
 
 /** This factory provides the frequently used standard panes
         private:resource/pane/CenterPane
@@ -53,7 +47,7 @@ typedef cppu::ImplInheritanceHelper <
     show different titles for the left pane in Draw and Impress.
 */
 class BasicPaneFactory final
-    : public BasicPaneFactoryInterfaceBase
+    : public sd::framework::ResourceFactory
 {
 public:
     explicit BasicPaneFactory(
@@ -62,27 +56,36 @@ public:
 
     virtual void disposing(std::unique_lock<std::mutex>&) override;
 
-    // XResourceFactory
+    // ResourceFactory
 
     virtual css::uno::Reference<css::drawing::framework::XResource>
-        SAL_CALL createResource (
+        createResource (
             const css::uno::Reference<css::drawing::framework::XResourceId>& 
rxPaneId) override;
 
-    virtual void SAL_CALL
+    virtual void
         releaseResource (
             const css::uno::Reference<css::drawing::framework::XResource>& 
rxPane) override;
 
-    // ConfigurationChangeListener
+private:
+    class Listener : public sd::framework::ConfigurationChangeListener
+    {
+    public:
+        Listener(BasicPaneFactory& rParent) : mrParent(rParent) {}
 
-    virtual void notifyConfigurationChange (
-        const sd::framework::ConfigurationChangeEvent& rEvent) override;
+        using WeakComponentImplHelperBase::disposing;
 
-    // lang::XEventListener
+        // ConfigurationChangeListener
+        virtual void notifyConfigurationChange (
+            const sd::framework::ConfigurationChangeEvent& rEvent) override;
 
-    virtual void SAL_CALL disposing (
-        const css::lang::EventObject& rEventObject) override;
+        // lang::XEventListener
+        virtual void SAL_CALL disposing (
+            const css::lang::EventObject& rEventObject) override;
 
-private:
+        BasicPaneFactory& mrParent;
+    };
+
+    rtl::Reference<Listener> mxListener;
     unotools::WeakReference<sd::framework::ConfigurationController>
         mxConfigurationControllerWeak;
     ViewShellBase* mpViewShellBase;
diff --git a/sd/source/ui/inc/framework/factories/BasicToolBarFactory.hxx 
b/sd/source/ui/inc/framework/factories/BasicToolBarFactory.hxx
index eba8de21f059..6ffa712c66cb 100644
--- a/sd/source/ui/inc/framework/factories/BasicToolBarFactory.hxx
+++ b/sd/source/ui/inc/framework/factories/BasicToolBarFactory.hxx
@@ -20,7 +20,7 @@
 #pragma once
 
 #include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
+#include <framework/ResourceFactory.hxx>
 #include <comphelper/compbase.hxx>
 #include <rtl/ref.hxx>
 
@@ -30,8 +30,8 @@ namespace sd::framework
 {
 class ConfigurationController;
 
-typedef comphelper::WeakComponentImplHelper <
-    css::drawing::framework::XResourceFactory,
+typedef cppu::ImplInheritanceHelper <
+    sd::framework::ResourceFactory,
     css::lang::XEventListener
     > BasicToolBarFactoryInterfaceBase;
 
@@ -49,12 +49,12 @@ public:
 
     // ToolBarFactory
 
-    virtual css::uno::Reference<css::drawing::framework::XResource> SAL_CALL
+    virtual css::uno::Reference<css::drawing::framework::XResource>
         createResource (
             const css::uno::Reference<
                 css::drawing::framework::XResourceId>& rxToolBarId) override;
 
-    virtual void SAL_CALL
+    virtual void
         releaseResource (
             const css::uno::Reference<css::drawing::framework::XResource>&
                 rxToolBar) override;
diff --git a/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx 
b/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx
index 3167974b7eb6..d2d45579676f 100644
--- a/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx
+++ b/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx
@@ -19,12 +19,8 @@
 
 #pragma once
 
-#include <com/sun/star/drawing/framework/XResourceFactory.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-
-#include <comphelper/compbase.hxx>
+#include <framework/ResourceFactory.hxx>
 #include <rtl/ref.hxx>
-
 #include <vcl/vclptr.hxx>
 #include <memory>
 
@@ -42,10 +38,6 @@ namespace vcl { class Window; }
 namespace sd::framework {
 class ConfigurationController;
 
-typedef comphelper::WeakComponentImplHelper <
-    css::drawing::framework::XResourceFactory
-    > BasicViewFactoryInterfaceBase;
-
 /** Factory for the frequently used standard views of the drawing framework:
         private:resource/view/
         private:resource/view/ImpressView
@@ -59,7 +51,7 @@ typedef comphelper::WeakComponentImplHelper <
     For some views in some panes this class also acts as a cache.
 */
 class BasicViewFactory final
-    : public BasicViewFactoryInterfaceBase
+    : public sd::framework::ResourceFactory
 {
 public:
     BasicViewFactory(const rtl::Reference<::sd::DrawController>& rxController);
@@ -70,10 +62,10 @@ public:
     // XViewFactory
 
     virtual css::uno::Reference<css::drawing::framework::XResource>
-        SAL_CALL createResource (
+        createResource (
             const css::uno::Reference<css::drawing::framework::XResourceId>& 
rxViewId) override;
 
-    virtual void SAL_CALL releaseResource (
+    virtual void releaseResource (
         const css::uno::Reference<css::drawing::framework::XResource>& xView) 
override;
 
 private:

Reply via email to