diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-03-12 11:48:17 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-03-12 16:24:39 +0100 |
commit | 268be3ac88bd9572b2402ecdb7bed04038fe6999 (patch) | |
tree | 5e6ff301b50af52eac62eddd0ccaea143492e86a /include/canvas | |
parent | 781992cebac6415bdd38c78ae48806af156da09f (diff) |
Mark overriding DisambiguationHelper class template mem funs as SAL_OVERRIDE
...which reveals that some uses are not derived from XEventListener, so re-
introduce BaseMutexHelper as an alternative (which originally got superseded by
DisambiguationHelper in 09b546cf9c1d0d9f78066e70a0348c7678cdcb14 "Fix
overloaded-virtual warning in canvas").
Change-Id: I1418370733b72526ec481b70fa69f03e7c28b7ce
Diffstat (limited to 'include/canvas')
-rw-r--r-- | include/canvas/base/basemutexhelper.hxx | 66 | ||||
-rw-r--r-- | include/canvas/base/bufferedgraphicdevicebase.hxx | 4 | ||||
-rw-r--r-- | include/canvas/base/canvasbase.hxx | 2 | ||||
-rw-r--r-- | include/canvas/base/canvascustomspritebase.hxx | 2 | ||||
-rw-r--r-- | include/canvas/base/disambiguationhelper.hxx | 21 | ||||
-rw-r--r-- | include/canvas/base/graphicdevicebase.hxx | 2 | ||||
-rw-r--r-- | include/canvas/base/spritecanvasbase.hxx | 2 |
7 files changed, 82 insertions, 17 deletions
diff --git a/include/canvas/base/basemutexhelper.hxx b/include/canvas/base/basemutexhelper.hxx new file mode 100644 index 000000000000..d780d54a95f0 --- /dev/null +++ b/include/canvas/base/basemutexhelper.hxx @@ -0,0 +1,66 @@ +/* -*- 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_CANVAS_BASE_BASEMUTEXHELPER_HXX +#define INCLUDED_CANVAS_BASE_BASEMUTEXHELPER_HXX + +#include <sal/config.h> + +#include <osl/mutex.hxx> + +/* Definition of the BaseMutexHelper class */ + +namespace canvas +{ + /** Base class, initializing its own baseclass with m_aMutex. + + This is necessary to make the CanvasBase, GraphicDeviceBase, + etc. classes freely combinable - letting them perform this + initialization would prohibit deriving e.g. CanvasBase from + GraphicDeviceBase. + */ + template< class Base > class BaseMutexHelper : public Base + { + protected: + /** Construct BaseMutexHelper + + This method is the whole purpose of this template: + initializing a base class with the provided m_aMutex + member (the WeakComponentImplHelper templates need that, + as they require the lifetime of the mutex to extend + theirs). + */ + BaseMutexHelper() : + Base( m_aMutex ) + { + } + + virtual void disposeThis() {} + + mutable osl::Mutex m_aMutex; + + private: + virtual void SAL_CALL disposing() SAL_OVERRIDE + { disposeThis(); } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/canvas/base/bufferedgraphicdevicebase.hxx b/include/canvas/base/bufferedgraphicdevicebase.hxx index 0eec72a2b2bb..f7ba97c83eca 100644 --- a/include/canvas/base/bufferedgraphicdevicebase.hxx +++ b/include/canvas/base/bufferedgraphicdevicebase.hxx @@ -176,7 +176,7 @@ namespace canvas return ::com::sun::star::uno::makeAny(mxWindow); } - virtual void disposeThis() + virtual void disposeThis() SAL_OVERRIDE { typename BaseType::MutexType aGuard( BaseType::m_aMutex ); @@ -224,7 +224,7 @@ namespace canvas } // XWindowListener - virtual void disposeEventSource( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException) + virtual void disposeEventSource( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE { typename BaseType::MutexType aGuard( BaseType::m_aMutex ); diff --git a/include/canvas/base/canvasbase.hxx b/include/canvas/base/canvasbase.hxx index 64681eb5939c..4a3944b021a6 100644 --- a/include/canvas/base/canvasbase.hxx +++ b/include/canvas/base/canvasbase.hxx @@ -111,7 +111,7 @@ namespace canvas { } - virtual void disposeThis() + virtual void disposeThis() SAL_OVERRIDE { MutexType aGuard( BaseType::m_aMutex ); diff --git a/include/canvas/base/canvascustomspritebase.hxx b/include/canvas/base/canvascustomspritebase.hxx index b244e6424655..8caa2589970f 100644 --- a/include/canvas/base/canvascustomspritebase.hxx +++ b/include/canvas/base/canvascustomspritebase.hxx @@ -94,7 +94,7 @@ namespace canvas @derive when overriding this method in derived classes, <em>always</em> call the base class' method! */ - virtual void disposeThis() + virtual void disposeThis() SAL_OVERRIDE { typename BaseType::MutexType aGuard( BaseType::m_aMutex ); diff --git a/include/canvas/base/disambiguationhelper.hxx b/include/canvas/base/disambiguationhelper.hxx index 2a19db1a9053..9b07498cb754 100644 --- a/include/canvas/base/disambiguationhelper.hxx +++ b/include/canvas/base/disambiguationhelper.hxx @@ -44,9 +44,7 @@ namespace canvas */ template< class Base > class DisambiguationHelper : public Base { - public: - typedef Base BaseType; - + protected: /** Construct DisambiguationHelper This method is the whole purpose of this template: @@ -56,23 +54,24 @@ namespace canvas theirs). */ DisambiguationHelper() : - BaseType( m_aMutex ) + Base( m_aMutex ) { } - virtual void SAL_CALL disposing() - { disposeThis(); } - - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException) - { disposeEventSource(Source); } - virtual void disposeThis() {} virtual void disposeEventSource( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) {} -protected: mutable ::osl::Mutex m_aMutex; + + private: + virtual void SAL_CALL disposing() SAL_OVERRIDE + { disposeThis(); } + + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE + { disposeEventSource(Source); } + }; } diff --git a/include/canvas/base/graphicdevicebase.hxx b/include/canvas/base/graphicdevicebase.hxx index df8551fcdc31..69a4c2fc35bb 100644 --- a/include/canvas/base/graphicdevicebase.hxx +++ b/include/canvas/base/graphicdevicebase.hxx @@ -136,7 +136,7 @@ namespace canvas _1))); } - virtual void disposeThis() + virtual void disposeThis() SAL_OVERRIDE { MutexType aGuard( BaseType::m_aMutex ); diff --git a/include/canvas/base/spritecanvasbase.hxx b/include/canvas/base/spritecanvasbase.hxx index 4bc030e0dab7..c45b34fd4fb5 100644 --- a/include/canvas/base/spritecanvasbase.hxx +++ b/include/canvas/base/spritecanvasbase.hxx @@ -77,7 +77,7 @@ namespace canvas { } - virtual void disposeThis() + virtual void disposeThis() SAL_OVERRIDE { typename BaseType::MutexType aGuard( BaseType::m_aMutex ); |