Kaydet (Commit) b030ba2e authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolve: "TODO(Q1): Make GetSystemData method virtual"

and remove the casting silliness, allowing the removal of
cairo_cairo.?xx

If anything is to go wrong I'd guess it'll be the windows directx stuff.

Change-Id: I3e22c07b9c26ade9b27a245fdd8408de540643f4
üst ab25d7cf
......@@ -923,7 +923,7 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( co
sal_IntPtr pIntPtr = 0;
rArguments[ 2 ] >>= pIntPtr;
SystemChildWindow *pParentWindow = reinterpret_cast< SystemChildWindow* >( pIntPtr );
const SystemEnvData* pEnvData = pParentWindow ? pParentWindow->GetSystemChildSystemData() : nullptr;
const SystemEnvData* pEnvData = pParentWindow ? pParentWindow->GetSystemData() : nullptr;
OSL_ASSERT(pEnvData);
if (pEnvData)
{
......
......@@ -184,7 +184,7 @@ namespace
SystemChildWindow *pParentWindow = reinterpret_cast< SystemChildWindow* >( pIntPtr );
const SystemEnvData* pEnvData = pParentWindow ? pParentWindow->GetSystemChildSystemData() : nullptr;
const SystemEnvData* pEnvData = pParentWindow ? pParentWindow->GetSystemData() : nullptr;
if (pEnvData == nullptr)
return -1;
......
......@@ -608,7 +608,7 @@ namespace dxcanvas
mpWindow->SetControlForeground();
mpWindow->SetControlBackground();
const SystemEnvData *pData = mpWindow->GetSystemChildSystemData();
const SystemEnvData *pData = mpWindow->GetSystemData();
const HWND hwnd(reinterpret_cast<HWND>(pData->hWnd));
mhWnd = const_cast<HWND>(hwnd);
......
......@@ -64,7 +64,7 @@ namespace dxcanvas
VCLUnoHelper::GetInterface(&rWindow),
uno::UNO_QUERY_THROW) );
const SystemEnvData *pData = rWindow.GetWindowSystemData();
const SystemEnvData *pData = rWindow.GetSystemData();
const HWND hWnd = reinterpret_cast<HWND>(pData->hWnd);
if( !IsWindow( hWnd ) )
throw lang::NoSupportException( "Passed window has invalid system window, or canvas out-of-process!" );
......
......@@ -322,7 +322,7 @@ namespace oglcanvas
/*
* TODO: moggi: fix it!
// switch buffer, sync etc.
const unx::Window aXWindow=pChildWindow->GetSystemChildSystemData()->aWindow;
const unx::Window aXWindow=pChildWindow->GetSystemData()->aWindow;
unx::glXSwapBuffers(reinterpret_cast<unx::Display*>(mpDisplay),
aXWindow);
pChildWindow->Show();
......
......@@ -271,7 +271,7 @@ namespace dbaui
{
OUString sOldDataSource=getURLNoPrefix();
OUString sNewDataSource;
HWND hWnd = GetParent()->GetWindowSystemData()->hWnd;
HWND hWnd = GetParent()->GetSystemData()->hWnd;
sNewDataSource = getAdoDatalink((LONG_PTR)hWnd,sOldDataSource);
if ( !sNewDataSource.isEmpty() )
{
......
......@@ -44,7 +44,7 @@ public:
virtual ~SystemChildWindow();
virtual void dispose() override;
const SystemEnvData* GetSystemChildSystemData() const;
virtual const SystemEnvData* GetSystemData() const override;
// per default systemchildwindows erase their background for better plugin support
// however, this might not always be required
......
......@@ -1215,8 +1215,8 @@ public:
void SaveBackground( const Point& rPos, const Size& rSize,
const Point& rDestOff, VirtualDevice& rSaveDevice );
const SystemEnvData* GetWindowSystemData() const;
css::uno::Any GetWindowSystemDataAny() const;
virtual const SystemEnvData* GetSystemData() const;
css::uno::Any GetSystemDataAny() const;
// API to set/query the component interfaces
virtual css::uno::Reference< css::awt::XWindowPeer >
......
......@@ -72,7 +72,7 @@ css::uno::Any VCLXSystemDependentWindow::getWindowHandle( const css::uno::Sequen
vcl::Window* pWindow = GetWindow();
if ( pWindow )
{
const SystemEnvData* pSysData = static_cast<SystemChildWindow *>(pWindow)->GetSystemChildSystemData();
const SystemEnvData* pSysData = static_cast<SystemChildWindow *>(pWindow)->GetSystemData();
if( pSysData )
{
#if defined(_WIN32)
......
......@@ -83,7 +83,7 @@ css::uno::Any VCLXTopWindow_Base::getWindowHandle( const css::uno::Sequence< sal
vcl::Window* pWindow = GetWindowImpl();
if ( pWindow )
{
const SystemEnvData* pSysData = static_cast<SystemWindow *>(pWindow)->GetWindowSystemData();
const SystemEnvData* pSysData = static_cast<SystemWindow *>(pWindow)->GetSystemData();
if( pSysData )
{
#if defined (_WIN32)
......
......@@ -127,7 +127,6 @@ $(eval $(call gb_Library_use_externals,vcl,\
endif
$(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/window/cairo_cairo \
vcl/source/window/settings \
vcl/source/window/paint \
vcl/source/window/resource \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_VCL_INC_CAIRO_CAIRO_HXX
#define INCLUDED_VCL_INC_CAIRO_CAIRO_HXX
#include <sal/config.h>
#include <vcl/cairo.hxx>
#include <vcl/dllapi.h>
struct SystemEnvData;
namespace vcl { class Window; }
namespace cairo {
VCL_PLUGIN_PUBLIC const SystemEnvData* GetSysData(const vcl::Window *pOutputWindow);
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -1114,7 +1114,7 @@ bool OpenGLContext::initWindow()
if (m_pChildWindow)
{
InitChildWindow(m_pChildWindow.get());
const SystemEnvData* sysData(m_pChildWindow->GetSystemChildSystemData());
const SystemEnvData* sysData(m_pChildWindow->GetSystemData());
m_aGLWin.hWnd = sysData->hWnd;
}
......@@ -1159,7 +1159,7 @@ bool OpenGLContext::initWindow()
{
m_pChildWindow = VclPtr<SystemChildWindow>::Create(mpWindow, 0, &winData, false);
}
pChildSysData = m_pChildWindow->GetSystemChildSystemData();
pChildSysData = m_pChildWindow->GetSystemData();
}
if (!m_pChildWindow || !pChildSysData)
......@@ -1309,7 +1309,7 @@ SystemWindowData OpenGLContext::generateWinData(vcl::Window* pParent, bool)
aWinData.pVisual = nullptr;
#if !defined(LIBO_HEADLESS)
const SystemEnvData* sysData(pParent->GetWindowSystemData());
const SystemEnvData* sysData(pParent->GetSystemData());
Display *dpy = static_cast<Display*>(sysData->pDisplay);
Window win = sysData->aWindow;
......@@ -1590,7 +1590,7 @@ bool OpenGLContext::supportMultiSampling() const
#if defined(MACOSX)
NSOpenGLView* OpenGLContext::getOpenGLView()
{
return reinterpret_cast<NSOpenGLView*>(m_pChildWindow->GetSystemChildSystemData()->mpNSView);
return reinterpret_cast<NSOpenGLView*>(m_pChildWindow->GetSystemData()->mpNSView);
}
#endif
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <vcl/sysdata.hxx>
#include <vcl/syschild.hxx>
#include "cairo_cairo.hxx"
#ifdef _WIN32
#include <prewin.h>
#include <postwin.h>
#endif
namespace cairo
{
/***************************************************************************************
* Platform independent part of surface backends for LibreOffice Cairo Canvas *
* For the rest of the functions (and the platform-specific derived *
* Surface classes), see platform specific cairo_<platform>_cairo.cxx *
****************************************************************************************/
const SystemEnvData* GetSysData(const vcl::Window *pOutputWindow)
{
const SystemEnvData* pSysData = nullptr;
// check whether we're a SysChild: have to fetch system data
// directly from SystemChildWindow, because the GetSystemData
// method is unfortunately not virtual
const SystemChildWindow* pSysChild = dynamic_cast< const SystemChildWindow* >( pOutputWindow );
if( pSysChild )
pSysData = pSysChild->GetSystemChildSystemData();
else
pSysData = pOutputWindow->GetWindowSystemData();
return pSysData;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -725,7 +725,7 @@ Reference< css::datatransfer::dnd::XDragSource > Window::GetDragSource()
try
{
Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
const SystemEnvData * pEnvData = GetWindowSystemData();
const SystemEnvData * pEnvData = GetSystemData();
if( pEnvData )
{
......
......@@ -112,7 +112,7 @@ void SystemChildWindow::ImplInitSysChild( vcl::Window* pParent, WinBits nStyle,
Window::ImplInit( pParent, nStyle, nullptr );
// we do not paint if it is the right SysChild
if ( GetSystemChildSystemData() )
if ( GetSystemData() )
{
mpWindowImpl->mpSysObj->SetCallback( this, ImplSysChildProc );
SetParentClipMode( ParentClipMode::Clip );
......@@ -148,7 +148,7 @@ void SystemChildWindow::dispose()
Window::dispose();
}
const SystemEnvData* SystemChildWindow::GetSystemChildSystemData() const
const SystemEnvData* SystemChildWindow::GetSystemData() const
{
if ( mpWindowImpl->mpSysObj )
return mpWindowImpl->mpSysObj->GetSystemData();
......@@ -206,16 +206,16 @@ sal_IntPtr SystemChildWindow::GetParentWindowHandle()
sal_IntPtr nRet = 0;
#if defined(_WIN32)
nRet = reinterpret_cast< sal_IntPtr >( GetSystemChildSystemData()->hWnd );
nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->hWnd );
#elif defined MACOSX
// FIXME: this is wrong
nRet = reinterpret_cast< sal_IntPtr >( GetSystemChildSystemData()->mpNSView );
nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->mpNSView );
#elif defined ANDROID
// Nothing
#elif defined IOS
// Nothing
#elif defined UNX
nRet = (sal_IntPtr) GetSystemChildSystemData()->aWindow;
nRet = (sal_IntPtr) GetSystemData()->aWindow;
#endif
return nRet;
......
......@@ -3593,53 +3593,13 @@ Reference< css::rendering::XCanvas > Window::ImplGetCanvas( bool bSpriteCanvas )
// common: first any is VCL pointer to window (for VCL canvas)
aArg[ 0 ] = makeAny( reinterpret_cast<sal_Int64>(this) );
// TODO(Q1): Make GetSystemData method virtual
// check whether we're a SysChild: have to fetch system data
// directly from SystemChildWindow, because the GetSystemData
// method is unfortunately not virtual
const SystemChildWindow* pSysChild = dynamic_cast< const SystemChildWindow* >( this );
if( pSysChild )
{
/*
Note the comment expresses the desire to call the GetSystemChildSystemData variant
which it did initially on
commit 807c11075f63801f5b29a665c01b946bd7554785
Author: Rüdiger Timm <rt@openoffice.org>
Date: Fri Nov 26 19:44:05 2004 +0000
INTEGRATION: CWS presentationengine01 (1.195.30); FILE MERGED
2004/11/17 19:52:23 thb 1.195.30.9: RESYNC: (1.199-1.200); FILE MERGED
but on
commit d551190e8311242eadda4a3e82efff160175cb04
Author: Kurt Zenker <kz@openoffice.org>
Date: Tue Jun 24 10:41:50 2008 +0000
INTEGRATION: CWS canvas05 (1.264.12); FILE MERGED
2008/04/21 07:47:51 thb 1.264.12.5: RESYNC: (1.277-1.278); FILE MERGED
GetSystemData was changed to GetSystemDataAny which does not
have a shadowed call in SystemChildWindow, so that turned this from
using the GetSystemChildSystemData variant to the GetWindowSystemData variant
*/
aArg[ 1 ] = pSysChild->GetWindowSystemDataAny();
aArg[ 5 ] = pSysChild->GetSystemGfxDataAny();
}
else
{
aArg[ 1 ] = GetWindowSystemDataAny();
aArg[ 5 ] = GetSystemGfxDataAny();
}
aArg[ 1 ] = GetSystemDataAny();
aArg[ 2 ] = makeAny( css::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ) );
aArg[ 3 ] = makeAny( mpWindowImpl->mbAlwaysOnTop );
aArg[ 4 ] = makeAny( Reference< css::awt::XWindow >(
const_cast<vcl::Window*>(this)->GetComponentInterface(),
UNO_QUERY ));
aArg[ 5 ] = GetSystemGfxDataAny();
Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
......@@ -3724,16 +3684,16 @@ void Window::ApplySettings(vcl::RenderContext& /*rRenderContext*/)
{
}
const SystemEnvData* Window::GetWindowSystemData() const
const SystemEnvData* Window::GetSystemData() const
{
return mpWindowImpl->mpFrame ? mpWindowImpl->mpFrame->GetSystemData() : nullptr;
}
Any Window::GetWindowSystemDataAny() const
Any Window::GetSystemDataAny() const
{
Any aRet;
const SystemEnvData* pSysData = GetWindowSystemData();
const SystemEnvData* pSysData = GetSystemData();
if( pSysData )
{
Sequence< sal_Int8 > aSeq( reinterpret_cast<sal_Int8 const *>(pSysData), pSysData->nSize );
......
......@@ -157,7 +157,7 @@ void XIMStatusWindow::layout()
if (m_bAnchoredAtRight && IsVisible())
{
SalFrame* pFrame = static_cast<SalFrame*>(GetWindowSystemData()->pSalFrame);
SalFrame* pFrame = static_cast<SalFrame*>(GetSystemData()->pSalFrame);
long nDelta = pFrame->maGeometry.nWidth - m_aWindowSize.Width();
pFrame->SetPosSize( pFrame->maGeometry.nX + nDelta,
pFrame->maGeometry.nY,
......@@ -249,7 +249,7 @@ void XIMStatusWindow::setPosition( SalFrame* pParent )
}
if( IsVisible() )
{
const SystemEnvData* pEnvData = GetWindowSystemData();
const SystemEnvData* pEnvData = GetSystemData();
SalFrame* pStatusFrame = static_cast<SalFrame*>(pEnvData->pSalFrame);
Point aPoint = updatePosition();
pStatusFrame->SetPosSize( aPoint.X(), aPoint.Y(), m_aWindowSize.Width(), m_aWindowSize.Height(), SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y | SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT );
......@@ -260,7 +260,7 @@ void XIMStatusWindow::setPosition( SalFrame* pParent )
IMPL_LINK_NOARG_TYPED(XIMStatusWindow, DelayedShowHdl, void*, void)
{
m_nDelayedEvent = nullptr;
const SystemEnvData* pData = GetWindowSystemData();
const SystemEnvData* pData = GetSystemData();
SalFrame* pStatusFrame = static_cast<SalFrame*>(pData->pSalFrame);
if( m_bDelayedShow )
{
......@@ -348,7 +348,7 @@ IIIMPStatusWindow::IIIMPStatusWindow( SalFrame* pParent, bool bOn ) :
if( pParent )
{
const SystemEnvData* pEnvData = GetWindowSystemData();
const SystemEnvData* pEnvData = GetSystemData();
const SalFrameGeometry& rGeom( pParent->GetUnmirroredGeometry() );
int nDistance = rGeom.nTopDecoration;
......@@ -593,7 +593,7 @@ SalFrame* I18NStatus::getStatusFrame() const
SalFrame* pRet = nullptr;
if( m_pStatusWindow )
{
const SystemEnvData* pData = m_pStatusWindow->GetWindowSystemData();
const SystemEnvData* pData = m_pStatusWindow->GetSystemData();
pRet = static_cast<SalFrame*>(pData->pSalFrame);
}
return pRet;
......
......@@ -881,7 +881,7 @@ namespace
guint get_xid_for_dbus()
{
const vcl::Window *pTopWindow = Application::IsHeadlessModeEnabled() ? nullptr : Application::GetActiveTopWindow();
const SystemEnvData* pEnvData = pTopWindow ? pTopWindow->GetWindowSystemData() : nullptr;
const SystemEnvData* pEnvData = pTopWindow ? pTopWindow->GetSystemData() : nullptr;
return pEnvData ? pEnvData->aWindow : 0;
}
#endif
......
......@@ -23,7 +23,6 @@
#include <X11/Xutil.h>
#include <X11/extensions/Xrender.h>
#include "cairo_cairo.hxx"
#include "cairo_xlib_cairo.hxx"
#include <vcl/sysdata.hxx>
......
......@@ -63,7 +63,6 @@
#include "unx/printergfx.hxx"
#include "xrender_peer.hxx"
#include "cairo_cairo.hxx"
#include "cairo_xlib_cairo.hxx"
#include <cairo-xlib.h>
......@@ -497,7 +496,7 @@ namespace
{
cairo::X11SysData getSysData( const vcl::Window& rWindow )
{
const SystemEnvData* pSysData = cairo::GetSysData(&rWindow);
const SystemEnvData* pSysData = rWindow.GetSystemData();
if( !pSysData )
return cairo::X11SysData();
......
......@@ -9,7 +9,6 @@
#include <utility>
#include "cairo_cairo.hxx"
#include "cairo_gtk3_cairo.hxx"
#include <vcl/sysdata.hxx>
......
......@@ -819,7 +819,7 @@ void UnxFilePicker::initFilePicker()
vcl::Window *pParentWin = Application::GetDefDialogParent();
if ( pParentWin )
{
const SystemEnvData* pSysData = pParentWin->GetWindowSystemData();
const SystemEnvData* pSysData = pParentWin->GetSystemData();
if ( pSysData )
{
snprintf( pWinId, nIdLen, "%ld", pSysData->aWindow ); // unx only
......
......@@ -243,7 +243,7 @@ sal_Int16 SAL_CALL KDE4FilePicker::execute()
vcl::Window *pParentWin = Application::GetDefDialogParent();
if ( pParentWin )
{
const SystemEnvData* pSysData = pParentWin->GetWindowSystemData();
const SystemEnvData* pSysData = pParentWin->GetSystemData();
if ( pSysData )
{
KWindowSystem::setMainWindow( _dialog, pSysData->aWindow); // unx only
......
......@@ -89,7 +89,7 @@ void AccFrameEventListener::HandleChildChangedEvent(Any oldValue, Any newValue)
VCLXWindow* pvclwindow =
dynamic_cast<VCLXWindow*>(m_xAccessible.get());
vcl::Window* window = pvclwindow->GetWindow();
const SystemEnvData* systemdata=window->GetWindowSystemData();
const SystemEnvData* systemdata=window->GetSystemData();
//add this child
pAgent->InsertAccObj(pAcc, m_xAccessible.get(),
......
......@@ -57,7 +57,7 @@ void AccTopWindowListener::HandleWindowOpened( css::accessibility::XAccessible*
const SystemEnvData* systemdata = NULL;
try
{
systemdata = window->GetWindowSystemData();
systemdata = window->GetSystemData();
}
catch(...)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment