include/svx/sdrpagewindow.hxx                       |    3 +-
 include/svx/svdpagv.hxx                             |    4 ++-
 include/toolkit/controls/unocontrolcontainer.hxx    |    4 +--
 include/toolkit/helper/vclunohelper.hxx             |    5 ++--
 solenv/clang-format/excludelist                     |    2 -
 svx/source/accessibility/AccessibleControlShape.cxx |    9 ++++---
 svx/source/form/fmPropBrw.cxx                       |    5 ++--
 svx/source/form/fmview.cxx                          |    2 -
 svx/source/form/fmvwimp.cxx                         |    6 +---
 svx/source/svdraw/sdrpagewindow.cxx                 |   25 ++++++++------------
 svx/source/svdraw/svdpagv.cxx                       |    5 ++--
 toolkit/inc/controls/controlmodelcontainerbase.hxx  |    2 -
 toolkit/source/controls/tabpagemodel.cxx            |    2 -
 toolkit/source/controls/unocontrolcontainer.cxx     |    2 -
 toolkit/source/helper/vclunohelper.cxx              |    4 +--
 15 files changed, 40 insertions(+), 40 deletions(-)

New commits:
commit 497a4090de8a33704df4101fc078a48c4cf71101
Author:     Noel Grandin <[email protected]>
AuthorDate: Sat Jun 14 19:28:51 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Sun Jun 15 22:43:12 2025 +0200

    use more concrete UNO classes
    
    Change-Id: I94202657c9338596f0b16c63bab110d3af7d94df
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186519
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/include/svx/sdrpagewindow.hxx b/include/svx/sdrpagewindow.hxx
index c7278233c313..ed7d6456c99f 100644
--- a/include/svx/sdrpagewindow.hxx
+++ b/include/svx/sdrpagewindow.hxx
@@ -42,6 +42,7 @@ namespace basegfx { class B2DRange; }
 
 class SdrPaintWindow;
 class SdrPageView;
+class UnoControlContainer;
 
 class SVXCORE_DLLPUBLIC SdrPageWindow
 {
@@ -60,7 +61,7 @@ public:
     SdrPageView& GetPageView() const;
     SdrPaintWindow& GetPaintWindow() const;
     const SdrPaintWindow* GetOriginalPaintWindow() const;
-    css::uno::Reference<css::awt::XControlContainer> const & 
GetControlContainer( bool _bCreateIfNecessary = true ) const;
+    rtl::Reference<UnoControlContainer> const & GetControlContainer( bool 
_bCreateIfNecessary = true ) const;
 
     // OVERLAYMANAGER
     rtl::Reference< sdr::overlay::OverlayManager > const & GetOverlayManager() 
const;
diff --git a/include/svx/svdpagv.hxx b/include/svx/svdpagv.hxx
index 3b8c2f080db6..67930a8e367b 100644
--- a/include/svx/svdpagv.hxx
+++ b/include/svx/svdpagv.hxx
@@ -20,6 +20,7 @@
 #pragma once
 
 #include <com/sun/star/awt/XControlContainer.hpp>
+#include <rtl/ref.hxx>
 #include <rtl/ustring.hxx>
 #include <tools/color.hxx>
 #include <svx/svdhlpln.hxx>
@@ -38,6 +39,7 @@ class SdrObject;
 class SdrPage;
 class SdrPaintWindow;
 class SdrView;
+class UnoControlContainer;
 
 namespace sdr::contact
 {
@@ -133,7 +135,7 @@ public:
      *      SdrPageView instance, the XControlContainer for this output device 
is returned, <NULL/>
      *      otherwise.
      */
-    css::uno::Reference< css::awt::XControlContainer >
+    rtl::Reference< UnoControlContainer >
         GetControlContainer( const OutputDevice& _rDevice ) const;
 
     /// Sets all elements in the view which support a design and an alive mode 
into the given mode
diff --git a/toolkit/inc/controls/unocontrolcontainer.hxx 
b/include/toolkit/controls/unocontrolcontainer.hxx
similarity index 98%
rename from toolkit/inc/controls/unocontrolcontainer.hxx
rename to include/toolkit/controls/unocontrolcontainer.hxx
index f05fa959e1f7..68b2bf1eea52 100644
--- a/toolkit/inc/controls/unocontrolcontainer.hxx
+++ b/include/toolkit/controls/unocontrolcontainer.hxx
@@ -19,7 +19,7 @@
 
 #pragma once
 
-
+#include <toolkit/dllapi.h>
 #include <com/sun/star/awt/XControlContainer.hpp>
 #include <com/sun/star/awt/XUnoControlContainer.hpp>
 #include <com/sun/star/container/XContainer.hpp>
@@ -41,7 +41,7 @@ typedef ::cppu::AggImplInheritanceHelper4   <   UnoControlBase
                                             ,   
css::container::XIdentifierContainer
                                             >   UnoControlContainer_Base;
 
-class UnoControlContainer : public UnoControlContainer_Base
+class TOOLKIT_DLLPUBLIC UnoControlContainer : public UnoControlContainer_Base
 {
 private:
     std::unique_ptr<UnoControlHolderList>   mpControls;
diff --git a/include/toolkit/helper/vclunohelper.hxx 
b/include/toolkit/helper/vclunohelper.hxx
index c32de33f28aa..41c6920b57fe 100644
--- a/include/toolkit/helper/vclunohelper.hxx
+++ b/include/toolkit/helper/vclunohelper.hxx
@@ -32,7 +32,8 @@
 #include <tools/mapunit.hxx>
 #include <tools/fldunit.hxx>
 #include <tools/poly.hxx>
-
+#include <toolkit/controls/unocontrolcontainer.hxx>
+#include <rtl/ref.hxx>
 
 namespace com::sun::star::uno { template <typename > class Sequence; }
 
@@ -102,7 +103,7 @@ public:
     // Rectangle
     static bool                                     IsZero(const 
css::awt::Rectangle& rRect);
 
-    static css::uno::Reference< css::awt::XControlContainer>  
CreateControlContainer( vcl::Window* pWindow );
+    static rtl::Reference< UnoControlContainer>  CreateControlContainer( 
vcl::Window* pWindow );
 
     // MapUnits
     static MapUnit                                  UnoEmbed2VCLMapUnit( 
sal_Int32 nUnoEmbedMapUnit );
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 451de681b84c..8e6b775f1185 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -5952,6 +5952,7 @@ include/toolkit/awt/vclxwindow.hxx
 include/toolkit/awt/vclxwindows.hxx
 include/toolkit/controls/unocontrol.hxx
 include/toolkit/controls/unocontrolbase.hxx
+include/toolkit/controls/unocontrolcontainer.hxx
 include/toolkit/controls/unocontrolmodel.hxx
 include/toolkit/controls/unocontrols.hxx
 include/toolkit/helper/accessiblefactory.hxx
@@ -13442,7 +13443,6 @@ toolkit/inc/controls/tabpagecontainer.hxx
 toolkit/inc/controls/tabpagemodel.hxx
 toolkit/inc/controls/tkscrollbar.hxx
 toolkit/inc/controls/treecontrolpeer.hxx
-toolkit/inc/controls/unocontrolcontainer.hxx
 toolkit/inc/controls/unocontrolcontainermodel.hxx
 toolkit/inc/helper/accessibilityclient.hxx
 toolkit/inc/helper/btndlg.hxx
diff --git a/svx/source/accessibility/AccessibleControlShape.cxx 
b/svx/source/accessibility/AccessibleControlShape.cxx
index e8b1fa15de75..d819b93e030b 100644
--- a/svx/source/accessibility/AccessibleControlShape.cxx
+++ b/svx/source/accessibility/AccessibleControlShape.cxx
@@ -48,6 +48,7 @@
 #include <sal/log.hxx>
 #include <tools/debug.hxx>
 #include <comphelper/diagnose_ex.hxx>
+#include <toolkit/controls/unocontrolcontainer.hxx>
 
 using namespace ::accessibility;
 using namespace ::com::sun::star::accessibility;
@@ -125,13 +126,13 @@ AccessibleControlShape::~AccessibleControlShape()
 }
 
 namespace {
-    Reference< XContainer > lcl_getControlContainer( const OutputDevice* 
_pWin, const SdrView* _pView )
+    rtl::Reference< UnoControlContainer > lcl_getControlContainer( const 
OutputDevice* _pWin, const SdrView* _pView )
     {
-        Reference< XContainer > xReturn;
+        rtl::Reference< UnoControlContainer > xReturn;
         DBG_ASSERT( _pView, "lcl_getControlContainer: invalid view!" );
         if ( _pView  && _pView->GetSdrPageView())
         {
-            xReturn.set(_pView->GetSdrPageView()->GetControlContainer( *_pWin 
), css::uno::UNO_QUERY);
+            xReturn = _pView->GetSdrPageView()->GetControlContainer( *_pWin );
         }
         return xReturn;
     }
@@ -189,7 +190,7 @@ void AccessibleControlShape::Init()
             // Okay, we will add as listener to the control container where we 
expect our control to appear.
             OSL_ENSURE( !m_bWaitingForControl, "AccessibleControlShape::Init: 
already waiting for the control!" );
 
-            Reference< XContainer > xControlContainer = 
lcl_getControlContainer( pViewWindow->GetOutDev(), maShapeTreeInfo.GetSdrView() 
);
+            rtl::Reference< UnoControlContainer > xControlContainer = 
lcl_getControlContainer( pViewWindow->GetOutDev(), maShapeTreeInfo.GetSdrView() 
);
             OSL_ENSURE( xControlContainer.is(), "AccessibleControlShape::Init: 
unable to find my ControlContainer!" );
             if ( xControlContainer.is() )
             {
diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx
index 466efe1ef8ec..b4b7996598fd 100644
--- a/svx/source/form/fmPropBrw.cxx
+++ b/svx/source/form/fmPropBrw.cxx
@@ -63,6 +63,7 @@
 #include <vcl/svapp.hxx>
 #include <vcl/weld.hxx>
 #include <vcl/weldutils.hxx>
+#include <toolkit/controls/unocontrolcontainer.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::beans;
@@ -421,7 +422,7 @@ void FmPropBrw::impl_createPropertyBrowser_throw( 
FmFormShell* _pFormShell )
         xDocument = _pFormShell->GetObjectShell()->GetModel();
 
     // the context of the controls in our document
-    Reference< awt::XControlContainer > xControlContext;
+    rtl::Reference< UnoControlContainer > xControlContext;
     if ( _pFormShell && _pFormShell->GetFormView() )
     {
         SdrPageView* pPageView = _pFormShell->GetFormView()->GetSdrPageView();
@@ -453,7 +454,7 @@ void FmPropBrw::impl_createPropertyBrowser_throw( 
FmFormShell* _pFormShell )
     {
         ::cppu::ContextEntry_Init( u"ContextDocument"_ustr, Any( xDocument ) ),
         ::cppu::ContextEntry_Init( u"DialogParentWindow"_ustr, Any( 
xParentWindow ) ),
-        ::cppu::ContextEntry_Init( u"ControlContext"_ustr, Any( 
xControlContext ) ),
+        ::cppu::ContextEntry_Init( u"ControlContext"_ustr, Any( 
Reference<awt::XControlContainer>(xControlContext) ) ),
         ::cppu::ContextEntry_Init( u"ControlShapeAccess"_ustr, Any( 
xControlMap ) )
     };
     m_xInspectorContext.set(
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index 3f878a3fed05..991a44fa979f 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -411,7 +411,7 @@ void FmFormView::InsertControlContainer(const Reference< 
css::awt::XControlConta
     {
         const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(i);
 
-        if( rPageWindow.GetControlContainer( false ) == xCC )
+        if( 
uno::Reference<css::awt::XControlContainer>(rPageWindow.GetControlContainer( 
false )) == xCC )
         {
             m_pImpl->addWindow(rPageWindow);
             break;
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index 9f639657f385..3dfd8449c07c 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -529,7 +529,7 @@ void FmXFormView::addWindow(const SdrPageWindow& rWindow)
     if ( !pFormPage )
         return;
 
-    const Reference< XControlContainer >& xCC = rWindow.GetControlContainer();
+    const rtl::Reference< UnoControlContainer > & xCC = 
rWindow.GetControlContainer();
     if  (   xCC.is()
         &&  ( !findWindow( xCC ).is() )
         )
@@ -538,9 +538,7 @@ void FmXFormView::addWindow(const SdrPageWindow& rWindow)
         m_aPageWindowAdapters.push_back( pAdapter );
 
         // listen at the ControlContainer to notice changes
-        Reference< XContainer >  xContainer( xCC, UNO_QUERY );
-        if ( xContainer.is() )
-            xContainer->addContainerListener( this );
+        xCC->addContainerListener( this );
     }
 }
 
diff --git a/svx/source/svdraw/sdrpagewindow.cxx 
b/svx/source/svdraw/sdrpagewindow.cxx
index 01fa11cd9b8c..c0aae8e61521 100644
--- a/svx/source/svdraw/sdrpagewindow.cxx
+++ b/svx/source/svdraw/sdrpagewindow.cxx
@@ -24,6 +24,7 @@
 #include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/controls/unocontrolcontainer.hxx>
 #include <svx/svdview.hxx>
 #include <svx/svdpagv.hxx>
 #include <svx/sdrpaintwindow.hxx>
@@ -51,7 +52,7 @@ struct SdrPageWindow::Impl
     SdrPaintWindow* mpOriginalPaintWindow;
 
     // UNO stuff for xControls
-    uno::Reference<awt::XControlContainer> mxControlContainer;
+    rtl::Reference<UnoControlContainer> mxControlContainer;
 
     Impl( SdrPageView& rPageView, SdrPaintWindow& rPaintWindow ) :
         mpObjectContact(nullptr),
@@ -63,7 +64,7 @@ struct SdrPageWindow::Impl
 };
 
 
-uno::Reference<awt::XControlContainer> const & 
SdrPageWindow::GetControlContainer( bool _bCreateIfNecessary ) const
+rtl::Reference<UnoControlContainer> const & 
SdrPageWindow::GetControlContainer( bool _bCreateIfNecessary ) const
 {
     if (!mpImpl->mxControlContainer.is() && _bCreateIfNecessary)
     {
@@ -83,13 +84,12 @@ uno::Reference<awt::XControlContainer> const & 
SdrPageWindow::GetControlContaine
             // UnoControlContainer::setVisible(...) which calls 
createPeer(...).
             // This will now be called directly from here.
 
-            uno::Reference< awt::XControl > 
xControl(mpImpl->mxControlContainer, uno::UNO_QUERY);
-            if(xControl.is())
+            if(mpImpl->mxControlContainer.is())
             {
-                uno::Reference< uno::XInterface > xContext = 
xControl->getContext();
+                uno::Reference< uno::XInterface > xContext = 
mpImpl->mxControlContainer->getContext();
                 if(!xContext.is())
                 {
-                    xControl->createPeer( uno::Reference<awt::XToolkit>(), 
uno::Reference<awt::XWindowPeer>() );
+                    mpImpl->mxControlContainer->createPeer( 
uno::Reference<awt::XToolkit>(), uno::Reference<awt::XWindowPeer>() );
                 }
             }
         }
@@ -97,19 +97,15 @@ uno::Reference<awt::XControlContainer> const & 
SdrPageWindow::GetControlContaine
         {
             // Printer and VirtualDevice, or rather: no OutDev
             uno::Reference< lang::XMultiServiceFactory > xFactory( 
::comphelper::getProcessServiceFactory() );
-            const_cast< SdrPageWindow* >( this 
)->mpImpl->mxControlContainer.set(xFactory->createInstance(u"com.sun.star.awt.UnoControlContainer"_ustr),
 uno::UNO_QUERY);
+            const_cast< SdrPageWindow* >( this )->mpImpl->mxControlContainer = 
new UnoControlContainer();
             uno::Reference< awt::XControlModel > 
xModel(xFactory->createInstance(u"com.sun.star.awt.UnoControlContainerModel"_ustr),
 uno::UNO_QUERY);
-            uno::Reference< awt::XControl > 
xControl(mpImpl->mxControlContainer, uno::UNO_QUERY);
-            if (xControl.is())
-                xControl->setModel(xModel);
+            mpImpl->mxControlContainer->setModel(xModel);
 
             OutputDevice& rOutDev = rPaintWindow.GetOutputDevice();
             Point aPosPix = rOutDev.GetMapMode().GetOrigin();
             Size aSizePix = rOutDev.GetOutputSizePixel();
 
-            uno::Reference< awt::XWindow > 
xContComp(mpImpl->mxControlContainer, uno::UNO_QUERY);
-            if( xContComp.is() )
-                xContComp->setPosSize(aPosPix.X(), aPosPix.Y(), 
aSizePix.Width(), aSizePix.Height(), awt::PosSize::POSSIZE);
+            mpImpl->mxControlContainer->setPosSize(aPosPix.X(), aPosPix.Y(), 
aSizePix.Width(), aSizePix.Height(), awt::PosSize::POSSIZE);
         }
 
         FmFormView* pViewAsFormView = dynamic_cast< FmFormView* >( &rView );
@@ -140,8 +136,7 @@ SdrPageWindow::~SdrPageWindow()
         pViewAsFormView->RemoveControlContainer(mpImpl->mxControlContainer);
 
     // dispose the control container
-    uno::Reference< lang::XComponent > xComponent(mpImpl->mxControlContainer, 
uno::UNO_QUERY);
-    xComponent->dispose();
+    mpImpl->mxControlContainer->dispose();
 }
 
 SdrPageView& SdrPageWindow::GetPageView() const
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index 1ce89406a18c..41419bc113f1 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -32,6 +32,7 @@
 
 #include <svx/sdrpagewindow.hxx>
 #include <svx/sdrpaintwindow.hxx>
+#include <toolkit/controls/unocontrolcontainer.hxx>
 #include <comphelper/lok.hxx>
 #include <comphelper/scopeguard.hxx>
 #include <basegfx/range/b2irectangle.hxx>
@@ -140,9 +141,9 @@ void 
SdrPageView::RemovePaintWindowFromPageView(SdrPaintWindow& rPaintWindow)
         maPageWindows.erase(it);
 }
 
-css::uno::Reference< css::awt::XControlContainer > 
SdrPageView::GetControlContainer( const OutputDevice& _rDevice ) const
+rtl::Reference< UnoControlContainer > SdrPageView::GetControlContainer( const 
OutputDevice& _rDevice ) const
 {
-    css::uno::Reference< css::awt::XControlContainer > xReturn;
+    rtl::Reference< UnoControlContainer > xReturn;
     const SdrPageWindow* pCandidate = FindPatchedPageWindow( _rDevice );
 
     if ( pCandidate )
diff --git a/toolkit/inc/controls/controlmodelcontainerbase.hxx 
b/toolkit/inc/controls/controlmodelcontainerbase.hxx
index 57c923e90ee9..226367019370 100644
--- a/toolkit/inc/controls/controlmodelcontainerbase.hxx
+++ b/toolkit/inc/controls/controlmodelcontainerbase.hxx
@@ -32,7 +32,7 @@
 #include <cppuhelper/weak.hxx>
 #include <toolkit/helper/listenermultiplexer.hxx>
 #include <toolkit/controls/unocontrolmodel.hxx>
-#include <controls/unocontrolcontainer.hxx>
+#include <toolkit/controls/unocontrolcontainer.hxx>
 #include <cppuhelper/propshlp.hxx>
 #include <com/sun/star/awt/tab/XTabPageModel.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
diff --git a/toolkit/source/controls/tabpagemodel.cxx 
b/toolkit/source/controls/tabpagemodel.cxx
index 9d8fc6b4caa2..5deadb5fb7ca 100644
--- a/toolkit/source/controls/tabpagemodel.cxx
+++ b/toolkit/source/controls/tabpagemodel.cxx
@@ -30,7 +30,7 @@
 #include <vcl/outdev.hxx>
 
 #include <controls/controlmodelcontainerbase.hxx>
-#include <controls/unocontrolcontainer.hxx>
+#include <toolkit/controls/unocontrolcontainer.hxx>
 
 #include <helper/unopropertyarrayhelper.hxx>
 
diff --git a/toolkit/source/controls/unocontrolcontainer.cxx 
b/toolkit/source/controls/unocontrolcontainer.cxx
index 053bfb6c62c4..e41218e867f3 100644
--- a/toolkit/source/controls/unocontrolcontainer.cxx
+++ b/toolkit/source/controls/unocontrolcontainer.cxx
@@ -25,7 +25,7 @@
 
 #include <cppuhelper/implbase.hxx>
 
-#include <controls/unocontrolcontainer.hxx>
+#include <toolkit/controls/unocontrolcontainer.hxx>
 #include <comphelper/sequence.hxx>
 
 #include <tools/debug.hxx>
diff --git a/toolkit/source/helper/vclunohelper.cxx 
b/toolkit/source/helper/vclunohelper.cxx
index 2fbb5fb51998..2fa6503202bd 100644
--- a/toolkit/source/helper/vclunohelper.cxx
+++ b/toolkit/source/helper/vclunohelper.cxx
@@ -43,7 +43,7 @@
 #include <toolkit/awt/vclxwindow.hxx>
 #include <awt/vclxgraphics.hxx>
 #include <toolkit/awt/vclxfont.hxx>
-#include <controls/unocontrolcontainer.hxx>
+#include <toolkit/controls/unocontrolcontainer.hxx>
 #include <controls/unocontrolcontainermodel.hxx>
 #include <comphelper/processfactory.hxx>
 
@@ -145,7 +145,7 @@ tools::Polygon VCLUnoHelper::CreatePolygon( const 
css::uno::Sequence< sal_Int32
     return aPoly;
 }
 
-css::uno::Reference< css::awt::XControlContainer> 
VCLUnoHelper::CreateControlContainer( vcl::Window* pWindow )
+rtl::Reference<UnoControlContainer> VCLUnoHelper::CreateControlContainer( 
vcl::Window* pWindow )
 {
     rtl::Reference<UnoControlContainer> pContainer = new UnoControlContainer( 
pWindow->GetComponentInterface() );
 

Reply via email to