diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-05-19 14:46:50 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-05-19 15:53:14 +0100 |
commit | b030ba2e13a02c231783966b23ded76247bb9690 (patch) | |
tree | 82cfbea3c5ba32cbfb456f3564ef2dfc1e10d62d /vcl/source | |
parent | ab25d7cfec956b6c31551ee5c00bd6bcae4b0bb5 (diff) |
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
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/opengl/OpenGLContext.cxx | 8 | ||||
-rw-r--r-- | vcl/source/window/cairo_cairo.cxx | 51 | ||||
-rw-r--r-- | vcl/source/window/mouse.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/syschild.cxx | 10 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 50 |
5 files changed, 15 insertions, 106 deletions
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index f36c61010f30..f254974727c9 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -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 diff --git a/vcl/source/window/cairo_cairo.cxx b/vcl/source/window/cairo_cairo.cxx deleted file mode 100644 index fd6181e3b589..000000000000 --- a/vcl/source/window/cairo_cairo.cxx +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- 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: */ diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx index ee89b8c6fd73..19cdc7334cbc 100644 --- a/vcl/source/window/mouse.cxx +++ b/vcl/source/window/mouse.cxx @@ -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 ) { diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx index 854f508ecaef..7f92c641127d 100644 --- a/vcl/source/window/syschild.cxx +++ b/vcl/source/window/syschild.cxx @@ -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; diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 4d7795b4fa42..547bc2cdea75 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -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 ); |