From f7a86c5cdf4323c99d26512bf78de7f7c380667d Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 12 May 2021 15:07:37 +0200 Subject: simplify the vcl<->toolkit connection No need to store two different pointers and hide the underlying class behind an UNO interface Change-Id: I72c55e912caa9eae1cffa6c9d1b1d480e5668d40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115496 Tested-by: Jenkins Reviewed-by: Noel Grandin --- basctl/source/accessibility/accessibledialogcontrolshape.cxx | 2 +- basctl/source/accessibility/accessibledialogwindow.cxx | 2 +- basctl/source/basicide/baside2.hxx | 2 +- basctl/source/basicide/baside2b.cxx | 9 ++++----- basctl/source/basicide/textwindowpeer.cxx | 2 +- basctl/source/basicide/textwindowpeer.hxx | 9 +++------ 6 files changed, 11 insertions(+), 15 deletions(-) (limited to 'basctl') diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx index f885ff4bda1b..b61385f6671a 100644 --- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx +++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx @@ -495,7 +495,7 @@ Reference< awt::XFont > AccessibleDialogControlShape::getFont( ) vcl::Window* pWindow = GetWindow(); if ( pWindow ) { - Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), UNO_QUERY ); + auto xDev = pWindow->GetComponentInterfaceAs(); if ( xDev.is() ) { vcl::Font aFont; diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx index 0b641c8aca5e..b91e48262a73 100644 --- a/basctl/source/accessibility/accessibledialogwindow.cxx +++ b/basctl/source/accessibility/accessibledialogwindow.cxx @@ -790,7 +790,7 @@ Reference< awt::XFont > AccessibleDialogWindow::getFont( ) Reference< awt::XFont > xFont; if ( m_pDialogWindow ) { - Reference< awt::XDevice > xDev( m_pDialogWindow->GetComponentInterface(), UNO_QUERY ); + auto xDev = m_pDialogWindow->GetComponentInterfaceAs(); if ( xDev.is() ) { vcl::Font aFont; diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index 06045356bccb..fd17b340ca54 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -100,7 +100,7 @@ private: bool bDoSyntaxHighlight; bool bDelayHighlight; - virtual css::uno::Reference< css::awt::XWindowPeer > GetComponentInterface(bool bCreate = true) override; + virtual VCLXWindow* GetComponentInterface(bool bCreate = true) override; CodeCompleteDataCache aCodeCompleteCache; VclPtr pCodeCompleteWnd; OUString GetActualSubName( sal_uLong nLine ); // gets the actual subroutine name according to line number diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index ecba2d5fa873..3168f5090532 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -2040,11 +2040,10 @@ void ComplexEditorWindow::SetLineNumberDisplay(bool b) Resize(); } -uno::Reference< awt::XWindowPeer > +VCLXWindow* EditorWindow::GetComponentInterface(bool bCreate) { - uno::Reference< awt::XWindowPeer > xPeer( - Window::GetComponentInterface(false)); + rtl::Reference< VCLXWindow > xPeer = Window::GetComponentInterface(false); if (!xPeer.is() && bCreate) { // Make sure edit engine and view are available: @@ -2052,9 +2051,9 @@ EditorWindow::GetComponentInterface(bool bCreate) CreateEditEngine(); xPeer = createTextWindowPeer(*GetEditView()); - SetComponentInterface(xPeer); + SetComponentInterface(xPeer.get()); } - return xPeer; + return xPeer.get(); } static sal_uInt32 getCorrectedPropCount(SbxArray* p) diff --git a/basctl/source/basicide/textwindowpeer.cxx b/basctl/source/basicide/textwindowpeer.cxx index fc458453778b..cbe9781fce90 100644 --- a/basctl/source/basicide/textwindowpeer.cxx +++ b/basctl/source/basicide/textwindowpeer.cxx @@ -62,7 +62,7 @@ TextWindowPeer::CreateAccessibleContext() { } -css::uno::Reference basctl::createTextWindowPeer( +rtl::Reference basctl::createTextWindowPeer( TextView & view) { return new TextWindowPeer(view); diff --git a/basctl/source/basicide/textwindowpeer.hxx b/basctl/source/basicide/textwindowpeer.hxx index 077ad32cd79f..701c134c3a5f 100644 --- a/basctl/source/basicide/textwindowpeer.hxx +++ b/basctl/source/basicide/textwindowpeer.hxx @@ -21,17 +21,14 @@ #include -#include +#include -namespace com::sun::star::awt -{ -class XWindowPeer; -} +class VCLXWindow; class TextView; namespace basctl { -css::uno::Reference createTextWindowPeer(TextView& view); +rtl::Reference createTextWindowPeer(TextView& view); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit