Revert "simplify the vcl<->toolkit connection"

because it introduces a link-time dependency of vcl on toolkit,
and toolkit already depends on vcl

This reverts commit f7a86c5cdf.

Change-Id: Ibdd4f3e8221d70e2abd8fcbda67f85af3ac0396e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115547
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2021-05-13 14:48:24 +02:00
parent 013a4f1f5c
commit 32b09faca5
46 changed files with 105 additions and 98 deletions
@@ -458,7 +458,7 @@ namespace accessibility
Reference< awt::XFont > xFont;
if ( m_pTabBar )
{
auto xDev = m_pTabBar->GetComponentInterfaceAs<awt::XDevice>();
Reference< awt::XDevice > xDev( m_pTabBar->GetComponentInterface(), UNO_QUERY );
if ( xDev.is() )
{
vcl::Font aFont;
@@ -301,7 +301,7 @@ Reference< awt::XFont > OAccessibleMenuComponent::getFont( )
vcl::Window* pWindow = m_pMenu->GetWindow();
if ( pWindow )
{
auto xDev = pWindow->GetComponentInterfaceAs<awt::XDevice>();
Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), UNO_QUERY );
if ( xDev.is() )
{
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
@@ -495,7 +495,7 @@ Reference< awt::XFont > AccessibleDialogControlShape::getFont( )
vcl::Window* pWindow = GetWindow();
if ( pWindow )
{
auto xDev = pWindow->GetComponentInterfaceAs<awt::XDevice>();
Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), UNO_QUERY );
if ( xDev.is() )
{
vcl::Font aFont;
@@ -790,7 +790,7 @@ Reference< awt::XFont > AccessibleDialogWindow::getFont( )
Reference< awt::XFont > xFont;
if ( m_pDialogWindow )
{
auto xDev = m_pDialogWindow->GetComponentInterfaceAs<awt::XDevice>();
Reference< awt::XDevice > xDev( m_pDialogWindow->GetComponentInterface(), UNO_QUERY );
if ( xDev.is() )
{
vcl::Font aFont;
+1 -1
View File
@@ -100,7 +100,7 @@ private:
bool bDoSyntaxHighlight;
bool bDelayHighlight;
virtual VCLXWindow* GetComponentInterface(bool bCreate = true) override;
virtual css::uno::Reference< css::awt::XWindowPeer > GetComponentInterface(bool bCreate = true) override;
CodeCompleteDataCache aCodeCompleteCache;
VclPtr<CodeCompleteWindow> pCodeCompleteWnd;
OUString GetActualSubName( sal_uLong nLine ); // gets the actual subroutine name according to line number
+5 -4
View File
@@ -2040,10 +2040,11 @@ void ComplexEditorWindow::SetLineNumberDisplay(bool b)
Resize();
}
VCLXWindow*
uno::Reference< awt::XWindowPeer >
EditorWindow::GetComponentInterface(bool bCreate)
{
rtl::Reference< VCLXWindow > xPeer = Window::GetComponentInterface(false);
uno::Reference< awt::XWindowPeer > xPeer(
Window::GetComponentInterface(false));
if (!xPeer.is() && bCreate)
{
// Make sure edit engine and view are available:
@@ -2051,9 +2052,9 @@ EditorWindow::GetComponentInterface(bool bCreate)
CreateEditEngine();
xPeer = createTextWindowPeer(*GetEditView());
SetComponentInterface(xPeer.get());
SetComponentInterface(xPeer);
}
return xPeer.get();
return xPeer;
}
static sal_uInt32 getCorrectedPropCount(SbxArray* p)
+1 -1
View File
@@ -62,7 +62,7 @@ TextWindowPeer::CreateAccessibleContext() {
}
rtl::Reference<VCLXWindow> basctl::createTextWindowPeer(
css::uno::Reference<css::awt::XWindowPeer> basctl::createTextWindowPeer(
TextView & view)
{
return new TextWindowPeer(view);
+6 -3
View File
@@ -21,14 +21,17 @@
#include <sal/config.h>
#include <rtl/ref.hxx>
#include <com/sun/star/uno/Reference.hxx>
class VCLXWindow;
namespace com::sun::star::awt
{
class XWindowPeer;
}
class TextView;
namespace basctl
{
rtl::Reference<VCLXWindow> createTextWindowPeer(TextView& view);
css::uno::Reference<css::awt::XWindowPeer> createTextWindowPeer(TextView& view);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -436,7 +436,7 @@ void SAL_CALL ChartController::attachFrame(
SolarMutexGuard aSolarGuard;
auto pChartWindow = VclPtr<ChartWindow>::Create(this,pParent,pParent?pParent->GetStyle():0);
pChartWindow->SetBackground();//no Background
m_xViewWindow = pChartWindow->GetComponentInterfaceAs<css::awt::XWindow>();
m_xViewWindow.set( pChartWindow->GetComponentInterface(), uno::UNO_QUERY );
pChartWindow->Show();
m_apDropTargetHelper.reset(
new ChartDropTargetHelper( pChartWindow->GetDropTarget(),
@@ -36,7 +36,7 @@ namespace dbaui
using namespace ::com::sun::star;
OConnectionLineAccess::OConnectionLineAccess(OTableConnection* _pLine)
: VCLXAccessibleComponent(_pLine->GetComponentInterface() ? _pLine->GetWindowPeer() : nullptr)
: VCLXAccessibleComponent(_pLine->GetComponentInterface().is() ? _pLine->GetWindowPeer() : nullptr)
,m_pLine(_pLine)
{
}
+1 -1
View File
@@ -33,7 +33,7 @@ namespace dbaui
using namespace ::com::sun::star::lang;
OJoinDesignViewAccess::OJoinDesignViewAccess(OJoinTableView* _pTableView)
:VCLXAccessibleComponent(_pTableView->GetComponentInterface() ? _pTableView->GetWindowPeer() : nullptr)
:VCLXAccessibleComponent(_pTableView->GetComponentInterface().is() ? _pTableView->GetWindowPeer() : nullptr)
,m_pTableView(_pTableView)
{
}
@@ -36,7 +36,7 @@ namespace dbaui
using namespace ::com::sun::star;
OTableWindowAccess::OTableWindowAccess(OTableWindow* _pTable)
:VCLXAccessibleComponent(_pTable->GetComponentInterface() ? _pTable->GetWindowPeer() : nullptr)
:VCLXAccessibleComponent(_pTable->GetComponentInterface().is() ? _pTable->GetWindowPeer() : nullptr)
,m_pTable(_pTable)
{
}
+1 -1
View File
@@ -227,7 +227,7 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame,
pMyWindow->createBottomFrame(pView);
auto xWin = pMyWindow->GetComponentInterfaceAs<awt::XWindow>();
Reference< awt::XWindow > xWin ( pMyWindow->GetComponentInterface(), UNO_QUERY );
Reference< XController > xCtrRef( new BibFrameController_Impl( xWin, m_xDatMan.get() ) );
+3 -3
View File
@@ -661,7 +661,7 @@ void BibFrameController_Impl::addStatusListener(
m_xLastQueriedFocusWin = lcl_GetFocusChild( VCLUnoHelper::GetWindow( m_xWindow ) );
if (m_xLastQueriedFocusWin)
{
Reference<css::awt::XTextComponent> xEdit = m_xLastQueriedFocusWin->GetComponentInterfaceAs<css::awt::XTextComponent>();
Reference<css::awt::XTextComponent> xEdit(m_xLastQueriedFocusWin->GetComponentInterface(), css::uno::UNO_QUERY);
aEvent.IsEnabled = xEdit && xEdit->isEditable() && !xEdit->getSelectedText().isEmpty();
}
}
@@ -670,7 +670,7 @@ void BibFrameController_Impl::addStatusListener(
m_xLastQueriedFocusWin = lcl_GetFocusChild( VCLUnoHelper::GetWindow( m_xWindow ) );
if (m_xLastQueriedFocusWin)
{
auto xEdit = m_xLastQueriedFocusWin->GetComponentInterfaceAs<css::awt::XTextComponent>();
Reference<css::awt::XTextComponent> xEdit(m_xLastQueriedFocusWin->GetComponentInterface(), css::uno::UNO_QUERY);
aEvent.IsEnabled = xEdit && !xEdit->getSelectedText().isEmpty();
}
}
@@ -680,7 +680,7 @@ void BibFrameController_Impl::addStatusListener(
m_xLastQueriedFocusWin = lcl_GetFocusChild( VCLUnoHelper::GetWindow( m_xWindow ) );
if (m_xLastQueriedFocusWin)
{
auto xEdit = m_xLastQueriedFocusWin->GetComponentInterfaceAs<css::awt::XTextComponent>();
Reference<css::awt::XTextComponent> xEdit(m_xLastQueriedFocusWin->GetComponentInterface(), css::uno::UNO_QUERY);
if (xEdit && !xEdit->isEditable())
{
uno::Reference< datatransfer::clipboard::XClipboard > xClip = m_xLastQueriedFocusWin->GetClipboard();
+1 -1
View File
@@ -272,7 +272,7 @@ namespace frm
VclPtrInstance<RichTextControl> pRichTextControl( pEngine, _pParentWindow, _nStyle, nullptr, pPeer.get() );
// some knittings
pRichTextControl->SetComponentInterface( pPeer.get() );
pRichTextControl->SetComponentInterface( pPeer );
// outta here
return pPeer;
@@ -216,7 +216,7 @@ namespace frm
// some knittings
pNavBar->setDispatcher( pPeer.get() );
pNavBar->SetComponentInterface( pPeer.get() );
pNavBar->SetComponentInterface( pPeer );
// we want a faster repeating rate for the slots in this
// toolbox
+2 -3
View File
@@ -27,7 +27,6 @@
#include <com/sun/star/uno/Reference.h>
#include <vcl/dllapi.h>
#include <vcl/vclptr.hxx>
#include <toolkit/awt/vclxwindow.hxx>
namespace vcl { class Window; }
class Menu;
@@ -57,8 +56,8 @@ public:
virtual void ReleaseAllGraphics( OutputDevice* pOutDev ) = 0;
// Window
virtual rtl::Reference<VCLXWindow> GetWindowInterface( vcl::Window* pWindow ) = 0;
virtual void SetWindowInterface( vcl::Window* pWindow, VCLXWindow* pIFace ) = 0;
virtual css::uno::Reference<css::awt::XWindowPeer> GetWindowInterface( vcl::Window* pWindow ) = 0;
virtual void SetWindowInterface( vcl::Window* pWindow, css::uno::Reference< css::awt::XWindowPeer > xIFace ) = 0;
virtual VclPtr<vcl::Window> GetWindow(const css::uno::Reference<css::awt::XWindow>& rxWindow) = 0;
// PopupMenu
+4 -8
View File
@@ -22,7 +22,6 @@
#include <vcl/dllapi.h>
#include <vcl/outdev.hxx>
#include <toolkit/awt/vclxwindow.hxx>
#include <tools/link.hxx>
#include <tools/wintypes.hxx>
#include <vcl/vclenum.hxx>
@@ -1130,13 +1129,10 @@ public:
virtual const SystemEnvData* GetSystemData() const;
// API to set/query the component interfaces
virtual VCLXWindow* GetComponentInterface( bool bCreate = true );
void SetComponentInterface( VCLXWindow* pIFace );
// Utility method to make the GetComponentInterface call sites less verbose
template<typename T>
css::uno::Reference<T> GetComponentInterfaceAs()
{ return css::uno::Reference<T>(static_cast<cppu::OWeakObject*>(GetComponentInterface()), css::uno::UNO_QUERY); }
virtual css::uno::Reference< css::awt::XWindowPeer >
GetComponentInterface( bool bCreate = true );
void SetComponentInterface( css::uno::Reference< css::awt::XWindowPeer > const & xIFace );
/// Interface to register for dialog / window tunneling.
void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier, bool bParent = false);
@@ -1262,7 +1258,7 @@ public:
// set and retrieve for Toolkit
VCLXWindow* GetWindowPeer() const;
void SetWindowPeer( VCLXWindow* pVCLXWindow );
void SetWindowPeer( css::uno::Reference< css::awt::XWindowPeer > const & xPeer, VCLXWindow* pVCLXWindow );
// remember if it was generated by Toolkit
bool IsCreatedWithToolkit() const;
+1 -1
View File
@@ -2660,7 +2660,7 @@ bool ScGridWindow::PreNotify( NotifyEvent& rNEvt )
css::awt::MouseEvent aEvent;
lcl_InitMouseEvent( aEvent, *rNEvt.GetMouseEvent() );
if ( rNEvt.GetWindow() )
aEvent.Source = static_cast<cppu::OWeakObject*>(rNEvt.GetWindow()->GetComponentInterface());
aEvent.Source = rNEvt.GetWindow()->GetComponentInterface();
if ( nType == MouseNotifyEvent::MOUSEBUTTONDOWN)
bDone = pImp->MousePressed( aEvent );
else
+1 -1
View File
@@ -76,7 +76,7 @@ Reference<awt::XWindow> SAL_CALL PresenterHelper::createWindow (
{
pWindow = VclPtr<vcl::Window>::Create(pParentWindow);
}
auto xWindow = pWindow->GetComponentInterfaceAs<awt::XWindow>();
Reference<awt::XWindow> xWindow (pWindow->GetComponentInterface(), UNO_QUERY);
if (bEnableChildTransparentMode)
{
+2 -2
View File
@@ -164,14 +164,14 @@ sal_Bool SAL_CALL IFrameObject::load(
pWin->SetBackground();
pWin->Show();
auto xWindow = pWin->GetComponentInterfaceAs<awt::XWindow>();
uno::Reference < awt::XWindow > xWindow( pWin->GetComponentInterface(), uno::UNO_QUERY );
xFrame->setComponent( xWindow, uno::Reference < frame::XController >() );
// we must destroy the IFrame before the parent is destroyed
xWindow->addEventListener( this );
mxFrame = frame::Frame::create( mxContext );
auto xWin = pWin->GetComponentInterfaceAs<awt::XWindow>();
uno::Reference < awt::XWindow > xWin( pWin->GetComponentInterface(), uno::UNO_QUERY );
mxFrame->initialize( xWin );
mxFrame->setName( maFrmDescr.GetName() );
+2 -1
View File
@@ -567,7 +567,8 @@ uno::Reference< awt::XWindow > SAL_CALL SfxInPlaceClient_Impl::getWindow()
if ( !m_pClient || !m_pClient->GetEditWin() )
throw uno::RuntimeException();
return m_pClient->GetEditWin()->GetComponentInterfaceAs<awt::XWindow>();
uno::Reference< awt::XWindow > xWin( m_pClient->GetEditWin()->GetComponentInterface(), uno::UNO_QUERY );
return xWin;
}
+1 -1
View File
@@ -445,7 +445,7 @@ Reference< XWindow > SAL_CALL SfxBaseController::getComponentWindow()
if ( !m_pData->m_pViewShell )
throw DisposedException();
return GetViewFrame_Impl().GetFrame().GetWindow().GetComponentInterfaceAs<XWindow>();
return Reference< XWindow >( GetViewFrame_Impl().GetFrame().GetWindow().GetComponentInterface(), UNO_QUERY_THROW );
}
OUString SAL_CALL SfxBaseController::getViewControllerName()
+2 -2
View File
@@ -184,7 +184,7 @@ namespace sfx2
KeyEvent aEvent;
lcl_initKeyEvent( aEvent, *_rEvent.GetKeyEvent() );
if ( _rEvent.GetWindow() )
aEvent.Source = static_cast<cppu::OWeakObject*>(_rEvent.GetWindow()->GetComponentInterface());
aEvent.Source = _rEvent.GetWindow()->GetComponentInterface();
::comphelper::OInterfaceIteratorHelper2 aIterator( m_pData->m_aKeyHandlers );
while ( aIterator.hasMoreElements() )
@@ -222,7 +222,7 @@ namespace sfx2
MouseEvent aEvent;
lcl_initMouseEvent( aEvent, *_rEvent.GetMouseEvent() );
if ( _rEvent.GetWindow() )
aEvent.Source = static_cast<cppu::OWeakObject*>(_rEvent.GetWindow()->GetComponentInterface());
aEvent.Source = _rEvent.GetWindow()->GetComponentInterface();
::comphelper::OInterfaceIteratorHelper2 aIterator( m_pData->m_aMouseClickHandlers );
while ( aIterator.hasMoreElements() )
+1 -1
View File
@@ -1392,7 +1392,7 @@ css::uno::Reference< css::accessibility::XAccessible > SwAnnotationWin::CreateAc
rtl::Reference<SidebarWinAccessible> pAcc( new SidebarWinAccessible( *this,
mrView.GetWrtShell(),
mrSidebarItem ) );
SetWindowPeer( pAcc.get() );
SetWindowPeer( pAcc, pAcc.get() );
return pAcc;
}
+1 -1
View File
@@ -26,7 +26,7 @@ class MultiLineEdit : public VclMultiLineEdit
public:
MultiLineEdit( vcl::Window* pParent, WinBits nWinStyle );
virtual VCLXWindow* GetComponentInterface(bool bCreate = true) override;
virtual css::uno::Reference< css::awt::XWindowPeer > GetComponentInterface(bool bCreate = true) override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+2 -2
View File
@@ -51,8 +51,8 @@ public:
virtual void ReleaseAllGraphics( OutputDevice* pOutDev ) override;
// Window
virtual rtl::Reference<VCLXWindow> GetWindowInterface( vcl::Window* pWindow ) override;
virtual void SetWindowInterface( vcl::Window* pWindow, VCLXWindow* pIFace ) override;
virtual css::uno::Reference< css::awt::XWindowPeer> GetWindowInterface( vcl::Window* pWindow ) override;
virtual void SetWindowInterface( vcl::Window* pWindow, css::uno::Reference< css::awt::XWindowPeer> xIFace ) override;
virtual VclPtr<vcl::Window> GetWindow(const css::uno::Reference<css::awt::XWindow>& rxWindow) override;
// Menu
@@ -780,7 +780,7 @@ uno::Reference< awt::XFont > SAL_CALL VCLXAccessibleComponent::getFont( )
VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
auto xDev = pWindow->GetComponentInterfaceAs<awt::XDevice>();
uno::Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), uno::UNO_QUERY );
if ( xDev.is() )
{
vcl::Font aFont;
+3 -3
View File
@@ -1946,9 +1946,9 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow(
else
{
xRef = pNewComp;
pNewWindow->SetComponentInterface( pNewComp.get() );
pNewWindow->SetComponentInterface( xRef );
}
DBG_ASSERT( pNewWindow->GetComponentInterface( false ) == pNewComp.get(),
DBG_ASSERT( pNewWindow->GetComponentInterface( false ) == xRef,
"VCLXToolkit::createWindow: did #133706# resurge?" );
if ( rDescriptor.WindowAttributes & css::awt::WindowAttribute::SHOW )
@@ -2502,7 +2502,7 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent,
break;
}
if (pFocus != nullptr)
xNext = static_cast<cppu::OWeakObject*>(pFocus->GetComponentInterface());
xNext = pFocus->GetComponentInterface();
css::awt::FocusEvent aAwtEvent(
static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()),
static_cast<sal_Int16>(pWindow->GetGetFocusFlags()),
+1 -1
View File
@@ -912,7 +912,7 @@ void VCLXWindow::dispose( )
if ( auto pWindow = GetWindow() )
{
pWindow->RemoveEventListener( LINK( this, VCLXWindow, WindowEventListener ) );
pWindow->SetWindowPeer( nullptr );
pWindow->SetWindowPeer( nullptr, nullptr );
pWindow->SetAccessible( nullptr );
VclPtr<OutputDevice> pOutDev = GetOutputDevice();
+4 -3
View File
@@ -26,10 +26,11 @@ MultiLineEdit::MultiLineEdit(vcl::Window* pParent, WinBits nWinStyle)
}
// virtual
VCLXWindow* MultiLineEdit::GetComponentInterface(bool bCreate)
css::uno::Reference<css::awt::XWindowPeer> MultiLineEdit::GetComponentInterface(bool bCreate)
{
VCLXWindow* xPeer = VclMultiLineEdit::GetComponentInterface(false);
if (!xPeer && bCreate)
css::uno::Reference<css::awt::XWindowPeer> xPeer(
VclMultiLineEdit::GetComponentInterface(false));
if (!xPeer.is() && bCreate)
{
rtl::Reference<VCLXMultiLineEdit> xVCLMEdit(new VCLXMultiLineEdit);
xVCLMEdit->SetWindow(this);
+12 -10
View File
@@ -35,7 +35,7 @@
using namespace ::com::sun::star;
static rtl::Reference<VCLXWindow> CreateXWindow( vcl::Window const * pWindow )
static css::uno::Reference< css::awt::XWindowPeer > CreateXWindow( vcl::Window const * pWindow )
{
switch ( pWindow->GetType() )
{
@@ -145,13 +145,13 @@ css::uno::Reference< css::awt::XToolkit> UnoWrapper::GetVCLToolkit()
return mxToolkit;
}
rtl::Reference<VCLXWindow> UnoWrapper::GetWindowInterface( vcl::Window* pWindow )
css::uno::Reference< css::awt::XWindowPeer> UnoWrapper::GetWindowInterface( vcl::Window* pWindow )
{
rtl::Reference<VCLXWindow> xPeer = pWindow->GetWindowPeer();
css::uno::Reference< css::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer();
if ( !xPeer.is() )
{
xPeer = CreateXWindow( pWindow );
SetWindowInterface( pWindow, xPeer.get() );
SetWindowInterface( pWindow, xPeer );
}
return xPeer;
}
@@ -161,8 +161,10 @@ VclPtr<vcl::Window> UnoWrapper::GetWindow(const css::uno::Reference<css::awt::XW
return VCLUnoHelper::GetWindow(rWindow);
}
void UnoWrapper::SetWindowInterface( vcl::Window* pWindow, VCLXWindow* pVCLXWindow )
void UnoWrapper::SetWindowInterface( vcl::Window* pWindow, css::uno::Reference< css::awt::XWindowPeer> xIFace )
{
VCLXWindow* pVCLXWindow = comphelper::getUnoTunnelImplementation<VCLXWindow>( xIFace );
DBG_ASSERT( pVCLXWindow, "SetComponentInterface - unsupported type" );
if ( !pVCLXWindow )
return;
@@ -176,7 +178,7 @@ void UnoWrapper::SetWindowInterface( vcl::Window* pWindow, VCLXWindow* pVCLXWind
return;
}
pVCLXWindow->SetWindow( pWindow );
pWindow->SetWindowPeer( pVCLXWindow );
pWindow->SetWindowPeer( xIFace, pVCLXWindow );
}
css::uno::Reference<css::awt::XPopupMenu> UnoWrapper::CreateMenuInterface( PopupMenu* pPopupMenu )
@@ -225,7 +227,7 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow )
VclPtr< vcl::Window > pClient = pChild->GetWindow( GetWindowType::Client );
if ( pClient && pClient->GetWindowPeer() )
{
rtl::Reference<VCLXWindow> xComp = pClient->GetComponentInterface( false );
css::uno::Reference< css::lang::XComponent > xComp = pClient->GetComponentInterface( false );
xComp->dispose();
}
@@ -244,7 +246,7 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow )
if ( pClient && pClient->GetWindowPeer() && lcl_ImplIsParent( pWindow, pClient ) )
{
rtl::Reference<VCLXWindow> xComp = pClient->GetComponentInterface( false );
css::uno::Reference< css::lang::XComponent > xComp = pClient->GetComponentInterface( false );
xComp->dispose();
}
@@ -259,13 +261,13 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow )
}
VCLXWindow* pWindowPeer = pWindow->GetWindowPeer();
rtl::Reference<VCLXWindow> xWindowPeerComp = pWindow->GetComponentInterface( false );
uno::Reference< lang::XComponent > xWindowPeerComp = pWindow->GetComponentInterface( false );
OSL_ENSURE( ( pWindowPeer != nullptr ) == xWindowPeerComp.is(),
"UnoWrapper::WindowDestroyed: inconsistency in the window's peers!" );
if ( pWindowPeer )
{
pWindowPeer->SetWindow( nullptr );
pWindow->SetWindowPeer( nullptr );
pWindow->SetWindowPeer( nullptr, nullptr );
}
if ( xWindowPeerComp.is() )
xWindowPeerComp->dispose();
+2 -1
View File
@@ -270,11 +270,12 @@ public:
OUString maQuickHelpText;
OUString maID;
InputContext maInputContext;
css::uno::Reference< css::awt::XWindowPeer > mxWindowPeer;
css::uno::Reference< css::accessibility::XAccessible > mxAccessible;
std::shared_ptr< VclSizeGroup > m_xSizeGroup;
std::vector<VclPtr<FixedText>> m_aMnemonicLabels;
std::unique_ptr<ImplAccessibleInfos> mpAccessibleInfos;
rtl::Reference<VCLXWindow> mxVCLXWindow; // peer window object from toolkit
VCLXWindow* mpVCLXWindow;
vcl::Region maWinRegion; //< region to 'shape' the VCL window (frame coordinates)
vcl::Region maWinClipRegion; //< the (clipping) region that finally corresponds to the VCL window (frame coordinates)
vcl::Region maInvalidateRegion; //< region that has to be redrawn (frame coordinates)
+1 -1
View File
@@ -288,7 +288,7 @@ void LifecycleTest::testLeakage()
void LifecycleTest::testToolkit()
{
LeakTestObject *pVclWin = LeakTestObject::Create<WorkWindow>(nullptr, WB_APP|WB_STDWORK);
auto xWindow = pVclWin->getRef()->GetComponentInterfaceAs<css::awt::XWindow>();
css::uno::Reference<css::awt::XWindow> xWindow(pVclWin->getRef()->GetComponentInterface(), css::uno::UNO_QUERY);
CPPUNIT_ASSERT(xWindow.is());
// test UNO dispose
+5 -2
View File
@@ -1236,7 +1236,8 @@ css::uno::Reference<css::awt::XWindow> SalInstanceContainer::CreateChildFrame()
auto xPage = VclPtr<VclBin>::Create(m_xContainer.get());
xPage->set_expand(true);
xPage->Show();
return xPage->GetComponentInterfaceAs<css::awt::XWindow>();
return css::uno::Reference<css::awt::XWindow>(xPage->GetComponentInterface(),
css::uno::UNO_QUERY);
}
std::unique_ptr<weld::Container> SalInstanceWidget::weld_parent() const
@@ -1406,7 +1407,9 @@ OUString SalInstanceWindow::get_title() const { return m_xWindow->GetText(); }
css::uno::Reference<css::awt::XWindow> SalInstanceWindow::GetXWindow()
{
return m_xWindow->GetComponentInterfaceAs<css::awt::XWindow>();
css::uno::Reference<css::awt::XWindow> xWindow(m_xWindow->GetComponentInterface(),
css::uno::UNO_QUERY);
return xWindow;
}
void SalInstanceWindow::resize_to_request()
+1 -1
View File
@@ -910,7 +910,7 @@ namespace
m_rSpinButton.SpinField::SetText(rText, rSel);
}
virtual void SetEntryTextColor(const ::Color* pColor) override
virtual void SetEntryTextColor(const Color* pColor) override
{
if (pColor)
m_rSpinButton.SetControlForeground(*pColor);
+1 -2
View File
@@ -18,7 +18,6 @@
*/
#include <toolkit/awt/vclxwindow.hxx>
#include <vcl/toolkit/ivctrl.hxx>
#include "imivctl.hxx"
#include <vcl/accessiblefactory.hxx>
@@ -422,7 +421,7 @@ css::uno::Reference< XAccessible > SvtIconChoiceCtrl::CreateAccessible()
css::uno::Reference< XAccessible > xAccParent = pParent->GetAccessible();
if ( xAccParent.is() )
{
rtl::Reference<VCLXWindow> xHoldAlive(GetComponentInterface());
css::uno::Reference< css::awt::XWindowPeer > xHoldAlive(GetComponentInterface());
xAccessible = _pImpl->GetAccessibleFactory().createAccessibleIconChoiceCtrl( *this, xAccParent );
}
}
+1 -2
View File
@@ -23,7 +23,6 @@
- SelectAll( false ) => only repaint the deselected entries
*/
#include <toolkit/awt/vclxwindow.hxx>
#include <vcl/toolkit/treelistbox.hxx>
#include <vcl/accessiblefactory.hxx>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
@@ -3474,7 +3473,7 @@ css::uno::Reference< XAccessible > SvTreeListBox::CreateAccessible()
if ( xAccParent.is() )
{
// need to be done here to get the vclxwindow later on in the accessible
rtl::Reference< VCLXWindow > xHoldAlive(GetComponentInterface());
css::uno::Reference< css::awt::XWindowPeer > xHoldAlive(GetComponentInterface());
xAccessible = pImpl->m_aFactoryAccess.getFactory().createAccessibleTreeListBox( *this, xAccParent );
}
}
+2 -2
View File
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <toolkit/awt/vclxwindow.hxx>
#include <vcl/layout.hxx>
#include <vcl/toolkit/fixed.hxx>
#include <vcl/window.hxx>
@@ -78,7 +77,8 @@ css::uno::Reference< css::accessibility::XAccessible > Window::GetAccessible( bo
css::uno::Reference< css::accessibility::XAccessible > Window::CreateAccessible()
{
return GetComponentInterfaceAs<css::accessibility::XAccessible>();
css::uno::Reference< css::accessibility::XAccessible > xAcc( GetComponentInterface(), css::uno::UNO_QUERY );
return xAcc;
}
void Window::SetAccessible( const css::uno::Reference< css::accessibility::XAccessible >& x )
+1 -1
View File
@@ -846,7 +846,7 @@ bool Dialog::Close()
if ( xWindow->IsDisposed() )
return false;
if ( mpWindowImpl->mxVCLXWindow.is() && IsCreatedWithToolkit() && !IsInExecute() )
if ( mpWindowImpl->mxWindowPeer.is() && IsCreatedWithToolkit() && !IsInExecute() )
return false;
// If there's a cancel button with a custom handler, then always give it a chance to
+1 -1
View File
@@ -625,7 +625,7 @@ bool DockingWindow::Close()
if ( xWindow->IsDisposed() )
return false;
if ( mpWindowImpl->mxVCLXWindow.is() && IsCreatedWithToolkit() )
if ( mpWindowImpl->mxWindowPeer.is() && IsCreatedWithToolkit() )
return false;
Show( false, ShowFlags::NoFocusChange );
+1 -2
View File
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <toolkit/awt/vclxwindow.hxx>
#include <vcl/syswin.hxx>
#include <vcl/window.hxx>
#include <vcl/taskpanelist.hxx>
@@ -620,7 +619,7 @@ bool Window::IsTopWindow() const
{
// #113722#, cache result of expensive queryInterface call
vcl::Window *pThisWin = const_cast<vcl::Window*>(this);
auto xTopWindow = pThisWin->GetComponentInterfaceAs<XTopWindow>();
uno::Reference< XTopWindow > xTopWindow( pThisWin->GetComponentInterface(), UNO_QUERY );
pThisWin->mpWindowImpl->mpWinData->mnIsTopWindow = xTopWindow.is() ? 1 : 0;
}
return mpWindowImpl->mpWinData->mnIsTopWindow == 1;
+1 -1
View File
@@ -270,7 +270,7 @@ bool SystemWindow::Close()
if ( xWindow->IsDisposed() )
return false;
if ( mpWindowImpl->mxVCLXWindow.is() && IsCreatedWithToolkit() )
if ( mpWindowImpl->mxWindowPeer.is() && IsCreatedWithToolkit() )
return false;
// Is Window not closeable, ignore close
+19 -15
View File
@@ -547,8 +547,8 @@ void Window::dispose()
mpWindowImpl->mpFrameData = nullptr;
}
if (mpWindowImpl->mxVCLXWindow)
mpWindowImpl->mxVCLXWindow->dispose();
if (mpWindowImpl->mxWindowPeer)
mpWindowImpl->mxWindowPeer->dispose();
// should be the last statements
mpWindowImpl.reset();
@@ -612,7 +612,7 @@ WindowImpl::WindowImpl( WindowType nType )
mnChildEventListenersIteratingCount = 0;
mpCursor = nullptr; // cursor
maPointer = PointerStyle::Arrow;
mxVCLXWindow = nullptr;
mpVCLXWindow = nullptr;
mpAccessibleInfos = nullptr;
maControlForeground = COL_TRANSPARENT; // no foreground set
maControlBackground = COL_TRANSPARENT; // no background set
@@ -3105,37 +3105,39 @@ const OUString& Window::GetHelpText() const
return mpWindowImpl->maHelpText;
}
void Window::SetWindowPeer( VCLXWindow* pVCLXWindow )
void Window::SetWindowPeer( Reference< css::awt::XWindowPeer > const & xPeer, VCLXWindow* pVCLXWindow )
{
if (!mpWindowImpl || mpWindowImpl->mbInDispose)
return;
// be safe against re-entrance: first clear the old ref, then assign the new one
if (mpWindowImpl->mxVCLXWindow)
if (mpWindowImpl->mxWindowPeer)
{
mpWindowImpl->mxVCLXWindow->dispose();
mpWindowImpl->mxVCLXWindow.clear();
mpWindowImpl->mxWindowPeer->dispose();
mpWindowImpl->mxWindowPeer.clear();
}
mpWindowImpl->mxVCLXWindow = pVCLXWindow;
mpWindowImpl->mxWindowPeer = xPeer;
mpWindowImpl->mpVCLXWindow = pVCLXWindow;
}
VCLXWindow* Window::GetComponentInterface( bool bCreate )
Reference< css::awt::XWindowPeer > Window::GetComponentInterface( bool bCreate )
{
if ( !mpWindowImpl->mxVCLXWindow.is() && bCreate )
if ( !mpWindowImpl->mxWindowPeer.is() && bCreate )
{
UnoWrapperBase* pWrapper = UnoWrapperBase::GetUnoWrapper();
if ( pWrapper )
mpWindowImpl->mxVCLXWindow = pWrapper->GetWindowInterface( this );
mpWindowImpl->mxWindowPeer = pWrapper->GetWindowInterface( this );
}
return mpWindowImpl->mxVCLXWindow.get();
return mpWindowImpl->mxWindowPeer;
}
void Window::SetComponentInterface( VCLXWindow* pIFace )
void Window::SetComponentInterface( Reference< css::awt::XWindowPeer > const & xIFace )
{
UnoWrapperBase* pWrapper = UnoWrapperBase::GetUnoWrapper();
SAL_WARN_IF( !pWrapper, "vcl.window", "SetComponentInterface: No Wrapper!" );
if ( pWrapper )
pWrapper->SetWindowInterface( this, pIFace );
pWrapper->SetWindowInterface( this, xIFace );
}
typedef std::map<vcl::LOKWindowId, VclPtr<vcl::Window>> LOKWindowsMap;
@@ -3687,7 +3689,9 @@ Reference< css::rendering::XCanvas > Window::ImplGetCanvas( bool bSpriteCanvas )
aArg[ 0 ] <<= reinterpret_cast<sal_Int64>(this);
aArg[ 1 ] <<= css::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight );
aArg[ 2 ] <<= mpWindowImpl->mbAlwaysOnTop;
aArg[ 3 ] <<= const_cast<vcl::Window*>(this)->GetComponentInterfaceAs<css::awt::XWindow>();
aArg[ 3 ] <<= Reference< css::awt::XWindow >(
const_cast<vcl::Window*>(this)->GetComponentInterface(),
UNO_QUERY );
aArg[ 4 ] = GetSystemGfxDataAny();
Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
+1 -1
View File
@@ -1250,7 +1250,7 @@ PointerStyle Window::GetPointer() const
VCLXWindow* Window::GetWindowPeer() const
{
return mpWindowImpl ? mpWindowImpl->mxVCLXWindow.get() : nullptr;
return mpWindowImpl ? mpWindowImpl->mpVCLXWindow : nullptr;
}
void Window::SetPosPixel( const Point& rNewPos )
+1 -2
View File
@@ -15,7 +15,6 @@
#include <string_view>
#include <osl/process.h>
#include <toolkit/awt/vclxwindow.hxx>
#include <unx/gtk/gtkdata.hxx>
#include <unx/gtk/gtkinst.hxx>
#include <unx/genprn.h>
@@ -4260,7 +4259,7 @@ public:
// NoActivate otherwise Show grab focus to this widget
xEmbedWindow->Show(true, ShowFlags::NoActivate);
auto xWindow = xEmbedWindow->GetComponentInterfaceAs<css::awt::XWindow>();
css::uno::Reference<css::awt::XWindow> xWindow(xEmbedWindow->GetComponentInterface(), css::uno::UNO_QUERY);
return xWindow;
#else
return nullptr;