use more concrete UNO classes

Change-Id: I94202657c9338596f0b16c63bab110d3af7d94df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186519
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
This commit is contained in:
Noel Grandin
2025-06-15 22:43:12 +02:00
parent de9be6b352
commit 497a4090de
15 changed files with 40 additions and 40 deletions
+2 -1
View File
@@ -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;
+3 -1
View File
@@ -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
@@ -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;
+3 -2
View File
@@ -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 );
+1 -1
View File
@@ -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
@@ -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() )
{
+3 -2
View File
@@ -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(
+1 -1
View File
@@ -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;
+2 -4
View File
@@ -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 );
}
}
+10 -15
View File
@@ -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
+3 -2
View File
@@ -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 )
@@ -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>
+1 -1
View File
@@ -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>
@@ -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>
+2 -2
View File
@@ -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() );