diff options
author | Noel Grandin <noel@peralex.com> | 2016-07-04 10:41:44 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-07-04 12:21:58 +0000 |
commit | c752aad43352478ef7065ca7ab844650811e6745 (patch) | |
tree | b532c9f6f38634733f48753fa75b12f37c132e79 | |
parent | 3459ab4a5de1af443a85f66cecc0eeeb6d46df3f (diff) |
merge vcl::DisplayConnectionDispatch with vcl::DisplayConnection
Change-Id: I0eb83905896e1d7549a5bd4adde45e9d69209401
Reviewed-on: https://gerrit.libreoffice.org/26888
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | compilerplugins/clang/mergeclasses.results | 1 | ||||
-rw-r--r-- | vcl/Library_vcl.mk | 2 | ||||
-rw-r--r-- | vcl/inc/displayconnectiondispatch.hxx | 32 | ||||
-rw-r--r-- | vcl/inc/salinst.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/svdata.hxx | 6 | ||||
-rw-r--r-- | vcl/inc/xconnection.hxx | 64 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 5 | ||||
-rw-r--r-- | vcl/source/app/svapp.cxx | 4 | ||||
-rw-r--r-- | vcl/source/app/svmain.cxx | 2 | ||||
-rw-r--r-- | vcl/source/helper/displayconnectiondispatch.cxx (renamed from vcl/source/helper/xconnection.cxx) | 22 |
10 files changed, 51 insertions, 90 deletions
diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results index aa8ff7d639f3..1785f4cecf3f 100644 --- a/compilerplugins/clang/mergeclasses.results +++ b/compilerplugins/clang/mergeclasses.results @@ -390,7 +390,6 @@ merge tdoc_ucp::OfficeDocumentsEventListener with tdoc_ucp::ContentProvider merge toolkit::ScrollableInterface with toolkit::ScrollableWrapper merge unographic::GraphicTransformer with unographic::Graphic merge vcl::DeletionNotifier with SalFrame -merge vcl::DisplayConnectionDispatch with vcl::DisplayConnection merge vcl::ExtOutDevData with vcl::PDFExtOutDevData merge vcl::SolarThreadExecutor with vcl::solarthread::detail::GenericSolarThreadExecutor merge vclcanvas::DeviceHelper with vclcanvas::SpriteDeviceHelper diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 8068cffdc6e0..307c371e5092 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -320,11 +320,11 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/helper/canvasbitmap \ vcl/source/helper/canvastools \ vcl/source/helper/commandinfoprovider \ + vcl/source/helper/displayconnectiondispatch \ vcl/source/helper/evntpost \ vcl/source/helper/lazydelete \ vcl/source/helper/strhelper \ vcl/source/helper/threadex \ - vcl/source/helper/xconnection \ vcl/source/app/brand \ vcl/source/app/dbggui \ vcl/source/app/dndhelp \ diff --git a/vcl/inc/displayconnectiondispatch.hxx b/vcl/inc/displayconnectiondispatch.hxx index da90d29a8da0..72d6279d79f0 100644 --- a/vcl/inc/displayconnectiondispatch.hxx +++ b/vcl/inc/displayconnectiondispatch.hxx @@ -21,24 +21,46 @@ #define INCLUDED_VCL_INC_DISPLAYCONNECTIONDISPATCH_HXX #include <sal/config.h> - #include <com/sun/star/awt/XDisplayConnection.hpp> #include <cppuhelper/implbase.hxx> +#include <osl/mutex.hxx> +#include <rtl/ref.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <list> namespace vcl { -class DisplayConnectionDispatch: +class DisplayConnectionDispatch : public cppu::WeakImplHelper< css::awt::XDisplayConnection > { + ::osl::Mutex m_aMutex; + ::std::list< css::uno::Reference< css::awt::XEventHandler > > + m_aHandlers; + ::std::list< css::uno::Reference< css::awt::XEventHandler > > + m_aErrorHandlers; + css::uno::Any m_aAny; public: - virtual bool dispatchEvent(void * pData, int nBytes) = 0; + DisplayConnectionDispatch(); + ~DisplayConnectionDispatch() override; + + void start(); + void terminate(); + + bool dispatchEvent( void* pData, int nBytes ); + + // XDisplayConnection + virtual void SAL_CALL addEventHandler( const css::uno::Any& window, const css::uno::Reference< css::awt::XEventHandler >& handler, sal_Int32 eventMask ) throw(std::exception) override; + virtual void SAL_CALL removeEventHandler( const css::uno::Any& window, const css::uno::Reference< css::awt::XEventHandler >& handler ) throw(std::exception) override; + virtual void SAL_CALL addErrorHandler( const css::uno::Reference< css::awt::XEventHandler >& handler ) throw(std::exception) override; + virtual void SAL_CALL removeErrorHandler( const css::uno::Reference< css::awt::XEventHandler >& handler ) throw(std::exception) override; + virtual css::uno::Any SAL_CALL getIdentifier() throw(std::exception) override; -protected: - virtual ~DisplayConnectionDispatch() {} }; } + + #endif // INCLUDED_VCL_INC_DISPLAYCONNECTIONDISPATCH_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx index c86d1f31c1a5..b6a93fc6b12e 100644 --- a/vcl/inc/salinst.hxx +++ b/vcl/inc/salinst.hxx @@ -153,8 +153,7 @@ public: void SetEventCallback( rtl::Reference< vcl::DisplayConnectionDispatch > const & pInstance ) { m_pEventInst = pInstance; } - bool CallEventCallback( void* pEvent, int nBytes ) - { return m_pEventInst.is() && m_pEventInst->dispatchEvent( pEvent, nBytes ); } + bool CallEventCallback( void* pEvent, int nBytes ); enum ConnectionIdentifierType { AsciiCString, Blob }; virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes ) = 0; diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 67d422a8558a..dc25cc655473 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -32,7 +32,7 @@ #include "vcleventlisteners.hxx" #include "impfontcache.hxx" #include "salwtype.hxx" -#include "xconnection.hxx" +#include "displayconnectiondispatch.hxx" #include <unordered_map> #include <boost/functional/hash.hpp> @@ -87,7 +87,7 @@ class VclEventListeners2; class SalData; class OpenGLContext; -namespace vcl { class DisplayConnection; class SettingsConfigItem; class DeleteOnDeinitBase; } +namespace vcl { class DisplayConnectionDispatch; class SettingsConfigItem; class DeleteOnDeinitBase; } class LocaleConfigurationListener : public utl::ConfigurationListener { @@ -334,7 +334,7 @@ struct ImplSVData vcl::CommandInfoProvider* mpCommandInfoProvider; oslThreadIdentifier mnMainThreadId; - rtl::Reference< vcl::DisplayConnection > mxDisplayConnection; + rtl::Reference< vcl::DisplayConnectionDispatch > mxDisplayConnection; css::uno::Reference< css::lang::XComponent > mxAccessBridge; vcl::SettingsConfigItem* mpSettingsConfigItem; diff --git a/vcl/inc/xconnection.hxx b/vcl/inc/xconnection.hxx deleted file mode 100644 index e771081d9772..000000000000 --- a/vcl/inc/xconnection.hxx +++ /dev/null @@ -1,64 +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 . - */ - -#ifndef INCLUDED_VCL_INC_XCONNECTION_HXX -#define INCLUDED_VCL_INC_XCONNECTION_HXX - -#include <osl/mutex.hxx> -#include <rtl/ref.hxx> -#include <com/sun/star/uno/Reference.hxx> - -#include "displayconnectiondispatch.hxx" - -#include <list> - -namespace vcl { - - class DisplayConnection : - public DisplayConnectionDispatch - { - ::osl::Mutex m_aMutex; - ::std::list< css::uno::Reference< css::awt::XEventHandler > > - m_aHandlers; - ::std::list< css::uno::Reference< css::awt::XEventHandler > > - m_aErrorHandlers; - css::uno::Any m_aAny; - public: - DisplayConnection(); - virtual ~DisplayConnection(); - - void start(); - void terminate(); - - virtual bool dispatchEvent( void* pData, int nBytes ) override; - - // XDisplayConnection - virtual void SAL_CALL addEventHandler( const css::uno::Any& window, const css::uno::Reference< css::awt::XEventHandler >& handler, sal_Int32 eventMask ) throw(std::exception) override; - virtual void SAL_CALL removeEventHandler( const css::uno::Any& window, const css::uno::Reference< css::awt::XEventHandler >& handler ) throw(std::exception) override; - virtual void SAL_CALL addErrorHandler( const css::uno::Reference< css::awt::XEventHandler >& handler ) throw(std::exception) override; - virtual void SAL_CALL removeErrorHandler( const css::uno::Reference< css::awt::XEventHandler >& handler ) throw(std::exception) override; - virtual css::uno::Any SAL_CALL getIdentifier() throw(std::exception) override; - - }; - -} - -#endif // INCLUDED_VCL_INC_XCONNECTION_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index c135cdf42294..15ba4dc2cf49 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -88,6 +88,11 @@ void SalInstance::DestroyMenuItem( SalMenuItem* pItem ) OSL_ENSURE( pItem == nullptr, "DestroyMenu called with non-native menus" ); } +bool SalInstance::CallEventCallback( void* pEvent, int nBytes ) +{ + return m_pEventInst.is() && m_pEventInst->dispatchEvent( pEvent, nBytes ); +} + SalTimer::~SalTimer() { } diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 494e5415bf26..45f2b65b5e5f 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -60,7 +60,7 @@ #include "salsys.hxx" #include "svdata.hxx" #include "salimestatus.hxx" -#include "xconnection.hxx" +#include "displayconnectiondispatch.hxx" #include "window.h" #include "accmgr.hxx" #include "idlemgr.hxx" @@ -1573,7 +1573,7 @@ css::uno::Reference< css::awt::XDisplayConnection > Application::GetDisplayConne if( !pSVData->mxDisplayConnection.is() ) { - pSVData->mxDisplayConnection.set( new vcl::DisplayConnection ); + pSVData->mxDisplayConnection.set( new vcl::DisplayConnectionDispatch ); pSVData->mxDisplayConnection->start(); } diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index 8ed72ec884ff..10b7f91e8fcd 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -70,7 +70,7 @@ #include "salsys.hxx" #include "saltimer.hxx" #include "salimestatus.hxx" -#include "xconnection.hxx" +#include "displayconnectiondispatch.hxx" #include <config_features.h> #if HAVE_FEATURE_OPENGL diff --git a/vcl/source/helper/xconnection.cxx b/vcl/source/helper/displayconnectiondispatch.cxx index 45e5008ffe02..77c9dab8d3b1 100644 --- a/vcl/source/helper/xconnection.cxx +++ b/vcl/source/helper/displayconnectiondispatch.cxx @@ -19,7 +19,7 @@ #include <vcl/svapp.hxx> -#include "xconnection.hxx" +#include "displayconnectiondispatch.hxx" #include "svdata.hxx" #include "salinst.hxx" @@ -28,7 +28,7 @@ using namespace vcl; using namespace com::sun::star::uno; using namespace com::sun::star::awt; -DisplayConnection::DisplayConnection() +DisplayConnectionDispatch::DisplayConnectionDispatch() { SalInstance::ConnectionIdentifierType eType; int nBytes; @@ -44,17 +44,17 @@ DisplayConnection::DisplayConnection() } } -DisplayConnection::~DisplayConnection() +DisplayConnectionDispatch::~DisplayConnectionDispatch() {} -void DisplayConnection::start() +void DisplayConnectionDispatch::start() { DBG_TESTSOLARMUTEX(); ImplSVData* pSVData = ImplGetSVData(); pSVData->mpDefInst->SetEventCallback( this ); } -void DisplayConnection::terminate() +void DisplayConnectionDispatch::terminate() { DBG_TESTSOLARMUTEX(); ImplSVData* pSVData = ImplGetSVData(); @@ -73,40 +73,40 @@ void DisplayConnection::terminate() (*it)->handleEvent( aEvent ); } -void SAL_CALL DisplayConnection::addEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler, sal_Int32 /*eventMask*/ ) throw(std::exception) +void SAL_CALL DisplayConnectionDispatch::addEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler, sal_Int32 /*eventMask*/ ) throw(std::exception) { MutexGuard aGuard( m_aMutex ); m_aHandlers.push_back( handler ); } -void SAL_CALL DisplayConnection::removeEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler ) throw(std::exception) +void SAL_CALL DisplayConnectionDispatch::removeEventHandler( const Any& /*window*/, const css::uno::Reference< XEventHandler >& handler ) throw(std::exception) { MutexGuard aGuard( m_aMutex ); m_aHandlers.remove( handler ); } -void SAL_CALL DisplayConnection::addErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw(std::exception) +void SAL_CALL DisplayConnectionDispatch::addErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw(std::exception) { MutexGuard aGuard( m_aMutex ); m_aErrorHandlers.push_back( handler ); } -void SAL_CALL DisplayConnection::removeErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw(std::exception) +void SAL_CALL DisplayConnectionDispatch::removeErrorHandler( const css::uno::Reference< XEventHandler >& handler ) throw(std::exception) { MutexGuard aGuard( m_aMutex ); m_aErrorHandlers.remove( handler ); } -Any SAL_CALL DisplayConnection::getIdentifier() throw(std::exception) +Any SAL_CALL DisplayConnectionDispatch::getIdentifier() throw(std::exception) { return m_aAny; } -bool DisplayConnection::dispatchEvent( void* pData, int nBytes ) +bool DisplayConnectionDispatch::dispatchEvent( void* pData, int nBytes ) { SolarMutexReleaser aRel; |