sd/source/ui/framework/factories/BasicPaneFactory.cxx     |   11 -
 sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx |    5 
 sd/source/ui/inc/unomodel.hxx                             |   19 ++-
 sd/source/ui/unoidl/unocpres.hxx                          |    2 
 sd/source/ui/unoidl/unomodel.cxx                          |   88 ++++++--------
 5 files changed, 62 insertions(+), 63 deletions(-)

New commits:
commit b09c52542fc431ff9e31e5bc1d24623c6bf42ac9
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Sep 18 12:15:53 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Wed Sep 18 21:33:28 2024 +0200

    use more concrete UNO types in sd
    
    Change-Id: I60977cf7e0690b8a01daa2fe6700e89c8a29516b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173609
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx 
b/sd/source/ui/framework/factories/BasicPaneFactory.cxx
index 0d32c1831e76..62a42f2ec2b0 100644
--- a/sd/source/ui/framework/factories/BasicPaneFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx
@@ -28,6 +28,7 @@
 
 #include <comphelper/servicehelper.hxx>
 #include <framework/FrameworkHelper.hxx>
+#include <framework/ConfigurationController.hxx>
 #include <PaneShells.hxx>
 #include <ViewShellBase.hxx>
 #include <PaneChildWindows.hxx>
@@ -96,8 +97,8 @@ BasicPaneFactory::BasicPaneFactory (
         // Tunnel through the controller to obtain access to the ViewShellBase.
         mpViewShellBase = rxController->GetViewShellBase();
 
-        Reference<XConfigurationController> xCC 
(rxController->getConfigurationController());
-        mxConfigurationControllerWeak = xCC;
+        rtl::Reference<sd::framework::ConfigurationController> xCC 
(rxController->getConfigurationControllerImpl());
+        mxConfigurationControllerWeak = xCC.get();
 
         // Add pane factories for the two left panes (one for Impress and one 
for
         // Draw) and the center pane.
@@ -146,7 +147,7 @@ BasicPaneFactory::BasicPaneFactory (
     }
     catch (RuntimeException&)
     {
-        Reference<XConfigurationController> xCC 
(mxConfigurationControllerWeak);
+        rtl::Reference<ConfigurationController> xCC 
(mxConfigurationControllerWeak);
         if (xCC.is())
             xCC->removeResourceFactoryForReference(this);
     }
@@ -158,7 +159,7 @@ BasicPaneFactory::~BasicPaneFactory()
 
 void BasicPaneFactory::disposing(std::unique_lock<std::mutex>&)
 {
-    Reference<XConfigurationController> xCC (mxConfigurationControllerWeak);
+    rtl::Reference<ConfigurationController> xCC 
(mxConfigurationControllerWeak);
     if (xCC.is())
     {
         xCC->removeResourceFactoryForReference(this);
@@ -310,7 +311,7 @@ void SAL_CALL BasicPaneFactory::notifyConfigurationChange (
 void SAL_CALL BasicPaneFactory::disposing (
     const lang::EventObject& rEventObject)
 {
-    if (mxConfigurationControllerWeak.get() == rEventObject.Source)
+    if 
(uno::Reference<XInterface>(cppu::getXWeak(mxConfigurationControllerWeak.get().get()))
 == rEventObject.Source)
     {
         mxConfigurationControllerWeak.clear();
     }
diff --git a/sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx 
b/sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx
index 57395f196bf4..ef97cff00984 100644
--- a/sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx
+++ b/sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx
@@ -23,7 +23,7 @@
 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <comphelper/compbase.hxx>
-#include <cppuhelper/weakref.hxx>
+#include <unotools/weakref.hxx>
 #include <rtl/ref.hxx>
 
 #include <memory>
@@ -37,6 +37,7 @@ class ViewShellBase;
 }
 
 namespace sd::framework {
+class ConfigurationController;
 
 typedef comphelper::WeakComponentImplHelper <
     css::drawing::framework::XResourceFactory,
@@ -85,7 +86,7 @@ public:
 
 private:
     css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
-    css::uno::WeakReference<css::drawing::framework::XConfigurationController>
+    unotools::WeakReference<sd::framework::ConfigurationController>
         mxConfigurationControllerWeak;
     ViewShellBase* mpViewShellBase;
     class PaneDescriptor;
commit ff632abcc3e907304c31c5bd8bbd7c7d4e38d2ab
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Sep 18 11:49:00 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Wed Sep 18 21:33:19 2024 +0200

    use more concrete UNO types in sd
    
    Change-Id: I1176da07dae2ac510ac4acf310ce3e4d499573d5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173607
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index da857eebaef3..02f1ee19ceb7 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -34,6 +34,7 @@
 #include <com/sun/star/beans/XPropertySet.hpp>
 
 #include <rtl/ref.hxx>
+#include <unotools/weakref.hxx>
 
 #include <sfx2/sfxbasemodel.hxx>
 #include <svx/fmdmod.hxx>
@@ -52,6 +53,12 @@ namespace com::sun::star::presentation { class 
XPresentation; }
 class SdDrawDocument;
 class SdPage;
 class SvxItemPropertySet;
+class SdUnoForbiddenCharsTable;
+class SdDrawPagesAccess;
+class SdMasterPagesAccess;
+class SdLayerManager;
+class SdXCustomPresentationAccess;
+class SdDocLinkTargets;
 
 namespace sd {
 class DrawDocShell;
@@ -96,12 +103,12 @@ private:
     const bool mbImpressDoc;
     bool mbClipBoard;
 
-    css::uno::WeakReference< css::drawing::XDrawPages > mxDrawPagesAccess;
-    css::uno::WeakReference< css::drawing::XDrawPages > mxMasterPagesAccess;
-    css::uno::WeakReference< css::container::XNameAccess > mxLayerManager;
-    css::uno::WeakReference< css::container::XNameContainer > 
mxCustomPresentationAccess;
-    css::uno::WeakReference< css::i18n::XForbiddenCharacters > 
mxForbiddenCharacters;
-    css::uno::Reference< css::container::XNameAccess > mxLinks;
+    unotools::WeakReference< SdDrawPagesAccess > mxDrawPagesAccess;
+    unotools::WeakReference< SdMasterPagesAccess > mxMasterPagesAccess;
+    unotools::WeakReference< SdLayerManager > mxLayerManager;
+    unotools::WeakReference< SdXCustomPresentationAccess > 
mxCustomPresentationAccess;
+    unotools::WeakReference< SdUnoForbiddenCharsTable > mxForbiddenCharacters;
+    unotools::WeakReference< SdDocLinkTargets > mxLinks;
 
     css::uno::Reference< css::uno::XInterface > mxDashTable;
     css::uno::Reference< css::uno::XInterface > mxGradientTable;
diff --git a/sd/source/ui/unoidl/unocpres.hxx b/sd/source/ui/unoidl/unocpres.hxx
index f1630d461bdd..ffec7b6182ff 100644
--- a/sd/source/ui/unoidl/unocpres.hxx
+++ b/sd/source/ui/unoidl/unocpres.hxx
@@ -90,7 +90,7 @@ public:
     virtual void SAL_CALL removeEventListener( const css::uno::Reference< 
css::lang::XEventListener >& aListener ) override;
 };
 
-class SdXCustomPresentationAccess : public ::cppu::WeakImplHelper< 
css::container::XNameContainer,
+class SdXCustomPresentationAccess final : public ::cppu::WeakImplHelper< 
css::container::XNameContainer,
                                                                     
css::lang::XSingleServiceFactory,
                                                                     
css::lang::XServiceInfo >
 {
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 8150d6cb3f9a..6351b3356fcd 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -182,8 +182,6 @@ TranslateId SdTPAction::GetClickActionSdResId( 
presentation::ClickAction eCA )
     return {};
 }
 
-namespace {
-
 class SdUnoForbiddenCharsTable : public SvxUnoForbiddenCharsTable,
                                  public SfxListener
 {
@@ -200,6 +198,8 @@ private:
     SdrModel*   mpModel;
 };
 
+namespace {
+
 class SlideBackgroundInfo
 {
 public:
@@ -858,12 +858,13 @@ uno::Reference< drawing::XDrawPages > SAL_CALL 
SdXImpressDocument::getDrawPages(
     if( nullptr == mpDoc )
         throw lang::DisposedException();
 
-    uno::Reference< drawing::XDrawPages >  xDrawPages( mxDrawPagesAccess );
+    rtl::Reference< SdDrawPagesAccess > xDrawPages( mxDrawPagesAccess );
 
     if( !xDrawPages.is() )
     {
         initializeDocument();
-        mxDrawPagesAccess = xDrawPages = new SdDrawPagesAccess(*this);
+        xDrawPages = new SdDrawPagesAccess(*this);
+        mxDrawPagesAccess = xDrawPages.get();
     }
 
     return xDrawPages;
@@ -877,13 +878,14 @@ uno::Reference< drawing::XDrawPages > SAL_CALL 
SdXImpressDocument::getMasterPage
     if( nullptr == mpDoc )
         throw lang::DisposedException();
 
-    uno::Reference< drawing::XDrawPages >  xMasterPages( mxMasterPagesAccess );
+    rtl::Reference< SdMasterPagesAccess > xMasterPages( mxMasterPagesAccess );
 
     if( !xMasterPages.is() )
     {
         if ( !hasControllersLocked() )
             initializeDocument();
-        mxMasterPagesAccess = xMasterPages = new SdMasterPagesAccess(*this);
+        xMasterPages = new SdMasterPagesAccess(*this);
+        mxMasterPagesAccess = xMasterPages.get();
     }
 
     return xMasterPages;
@@ -897,10 +899,13 @@ uno::Reference< container::XNameAccess > SAL_CALL 
SdXImpressDocument::getLayerMa
     if( nullptr == mpDoc )
         throw lang::DisposedException();
 
-    uno::Reference< container::XNameAccess >  xLayerManager( mxLayerManager );
+    rtl::Reference< SdLayerManager >  xLayerManager( mxLayerManager );
 
     if( !xLayerManager.is() )
-        mxLayerManager = xLayerManager = new SdLayerManager(*this);
+    {
+        xLayerManager = new SdLayerManager(*this);
+        mxLayerManager = xLayerManager.get();
+    }
 
     return xLayerManager;
 }
@@ -913,10 +918,13 @@ uno::Reference< container::XNameContainer > SAL_CALL 
SdXImpressDocument::getCust
     if( nullptr == mpDoc )
         throw lang::DisposedException();
 
-    uno::Reference< container::XNameContainer >  xCustomPres( 
mxCustomPresentationAccess );
+    rtl::Reference< SdXCustomPresentationAccess >  xCustomPres( 
mxCustomPresentationAccess );
 
     if( !xCustomPres.is() )
-        mxCustomPresentationAccess = xCustomPres = new 
SdXCustomPresentationAccess(*this);
+    {
+        xCustomPres = new SdXCustomPresentationAccess(*this);
+        mxCustomPresentationAccess = xCustomPres.get();
+    }
 
     return xCustomPres;
 }
@@ -1591,9 +1599,12 @@ uno::Reference< container::XNameAccess > SAL_CALL 
SdXImpressDocument::getLinks()
     if( nullptr == mpDoc )
         throw lang::DisposedException();
 
-    uno::Reference< container::XNameAccess > xLinks( mxLinks );
+    rtl::Reference< SdDocLinkTargets > xLinks( mxLinks );
     if( !xLinks.is() )
-        mxLinks = xLinks = new SdDocLinkTargets( *this );
+    {
+        xLinks = new SdDocLinkTargets( *this );
+        mxLinks = xLinks.get();
+    }
     return xLinks;
 }
 
@@ -3001,12 +3012,13 @@ PointerStyle SdXImpressDocument::getPointer()
 
 uno::Reference< i18n::XForbiddenCharacters > 
SdXImpressDocument::getForbiddenCharsTable()
 {
-    uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbiddenCharacters);
-
-    if( !xForb.is() )
-        mxForbiddenCharacters = xForb = new SdUnoForbiddenCharsTable( mpDoc );
-
-    return xForb;
+    rtl::Reference<SdUnoForbiddenCharsTable> xRef = 
mxForbiddenCharacters.get();
+    if( !xRef )
+    {
+        xRef = new SdUnoForbiddenCharsTable( mpDoc );
+        mxForbiddenCharacters = xRef.get();
+    }
+    return xRef;
 }
 
 void SdXImpressDocument::initializeDocument()
@@ -3307,56 +3319,34 @@ void SAL_CALL SdXImpressDocument::dispose()
     SfxBaseModel::dispose();
     mbDisposed = true;
 
-    uno::Reference< container::XNameAccess > xLinks( mxLinks );
+    rtl::Reference< SdDocLinkTargets > xLinks( mxLinks );
     if( xLinks.is() )
     {
-        uno::Reference< lang::XComponent > xComp( xLinks, uno::UNO_QUERY );
-        if( xComp.is() )
-            xComp->dispose();
-
+        xLinks->dispose();
         xLinks = nullptr;
     }
 
-    uno::Reference< drawing::XDrawPages > xDrawPagesAccess( mxDrawPagesAccess 
);
+    rtl::Reference< SdDrawPagesAccess > xDrawPagesAccess( mxDrawPagesAccess );
     if( xDrawPagesAccess.is() )
     {
-        uno::Reference< lang::XComponent > xComp( xDrawPagesAccess, 
uno::UNO_QUERY );
-        if( xComp.is() )
-            xComp->dispose();
-
+        xDrawPagesAccess->dispose();
         xDrawPagesAccess = nullptr;
     }
 
-    uno::Reference< drawing::XDrawPages > xMasterPagesAccess( 
mxMasterPagesAccess );
+    rtl::Reference< SdMasterPagesAccess > xMasterPagesAccess( 
mxMasterPagesAccess );
     if( xDrawPagesAccess.is() )
     {
-        uno::Reference< lang::XComponent > xComp( xMasterPagesAccess, 
uno::UNO_QUERY );
-        if( xComp.is() )
-            xComp->dispose();
-
-        xDrawPagesAccess = nullptr;
+        xMasterPagesAccess->dispose();
+        xMasterPagesAccess = nullptr;
     }
 
-    uno::Reference< container::XNameAccess > xLayerManager( mxLayerManager );
+    rtl::Reference< SdLayerManager > xLayerManager( mxLayerManager );
     if( xLayerManager.is() )
     {
-        uno::Reference< lang::XComponent > xComp( xLayerManager, 
uno::UNO_QUERY );
-        if( xComp.is() )
-            xComp->dispose();
-
+        xLayerManager->dispose();
         xLayerManager = nullptr;
     }
 
-    uno::Reference< container::XNameContainer > xCustomPresentationAccess( 
mxCustomPresentationAccess );
-    if( xCustomPresentationAccess.is() )
-    {
-        uno::Reference< lang::XComponent > xComp( xCustomPresentationAccess, 
uno::UNO_QUERY );
-        if( xComp.is() )
-            xComp->dispose();
-
-        xCustomPresentationAccess = nullptr;
-    }
-
     mxDashTable = nullptr;
     mxGradientTable = nullptr;
     mxHatchTable = nullptr;

Reply via email to