From b9337e22ce1dbf2eba0e8c8db294ae99f4111f91 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Thu, 18 Apr 2013 18:26:28 +0200 Subject: execute move of global headers see https://gerrit.libreoffice.org/#/c/3367/ and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a --- canvas/Module_canvas.mk | 1 - canvas/Package_inc.mk | 60 -- canvas/inc/canvas/base/bitmapcanvasbase.hxx | 128 ---- .../inc/canvas/base/bufferedgraphicdevicebase.hxx | 276 --------- canvas/inc/canvas/base/cachedprimitivebase.hxx | 117 ---- canvas/inc/canvas/base/canvasbase.hxx | 474 --------------- canvas/inc/canvas/base/canvascustomspritebase.hxx | 271 --------- .../inc/canvas/base/canvascustomspritehelper.hxx | 287 --------- canvas/inc/canvas/base/disambiguationhelper.hxx | 81 --- canvas/inc/canvas/base/graphicdevicebase.hxx | 382 ------------ canvas/inc/canvas/base/integerbitmapbase.hxx | 145 ----- canvas/inc/canvas/base/sprite.hxx | 116 ---- canvas/inc/canvas/base/spritecanvasbase.hxx | 193 ------ canvas/inc/canvas/base/spritesurface.hxx | 70 --- canvas/inc/canvas/canvastools.hxx | 587 ------------------ canvas/inc/canvas/canvastoolsdllapi.h | 35 -- canvas/inc/canvas/debug.hxx | 59 -- canvas/inc/canvas/elapsedtime.hxx | 173 ------ canvas/inc/canvas/parametricpolypolygon.hxx | 161 ----- canvas/inc/canvas/propertysethelper.hxx | 152 ----- canvas/inc/canvas/rendering/bitmap.hxx | 314 ---------- canvas/inc/canvas/rendering/icachedprimitive.hxx | 60 -- canvas/inc/canvas/rendering/icolorbuffer.hxx | 88 --- canvas/inc/canvas/rendering/irendermodule.hxx | 143 ----- canvas/inc/canvas/rendering/isurface.hxx | 82 --- canvas/inc/canvas/rendering/isurfaceproxy.hxx | 107 ---- .../inc/canvas/rendering/isurfaceproxymanager.hxx | 74 --- canvas/inc/canvas/spriteredrawmanager.hxx | 429 ------------- canvas/inc/canvas/vclwrapper.hxx | 141 ----- canvas/inc/canvas/verbosetrace.hxx | 32 - canvas/inc/canvas/verifyinput.hxx | 667 --------------------- 31 files changed, 5905 deletions(-) delete mode 100644 canvas/Package_inc.mk delete mode 100644 canvas/inc/canvas/base/bitmapcanvasbase.hxx delete mode 100644 canvas/inc/canvas/base/bufferedgraphicdevicebase.hxx delete mode 100644 canvas/inc/canvas/base/cachedprimitivebase.hxx delete mode 100644 canvas/inc/canvas/base/canvasbase.hxx delete mode 100644 canvas/inc/canvas/base/canvascustomspritebase.hxx delete mode 100644 canvas/inc/canvas/base/canvascustomspritehelper.hxx delete mode 100644 canvas/inc/canvas/base/disambiguationhelper.hxx delete mode 100644 canvas/inc/canvas/base/graphicdevicebase.hxx delete mode 100644 canvas/inc/canvas/base/integerbitmapbase.hxx delete mode 100644 canvas/inc/canvas/base/sprite.hxx delete mode 100644 canvas/inc/canvas/base/spritecanvasbase.hxx delete mode 100644 canvas/inc/canvas/base/spritesurface.hxx delete mode 100644 canvas/inc/canvas/canvastools.hxx delete mode 100644 canvas/inc/canvas/canvastoolsdllapi.h delete mode 100644 canvas/inc/canvas/debug.hxx delete mode 100644 canvas/inc/canvas/elapsedtime.hxx delete mode 100644 canvas/inc/canvas/parametricpolypolygon.hxx delete mode 100644 canvas/inc/canvas/propertysethelper.hxx delete mode 100644 canvas/inc/canvas/rendering/bitmap.hxx delete mode 100644 canvas/inc/canvas/rendering/icachedprimitive.hxx delete mode 100644 canvas/inc/canvas/rendering/icolorbuffer.hxx delete mode 100644 canvas/inc/canvas/rendering/irendermodule.hxx delete mode 100644 canvas/inc/canvas/rendering/isurface.hxx delete mode 100644 canvas/inc/canvas/rendering/isurfaceproxy.hxx delete mode 100644 canvas/inc/canvas/rendering/isurfaceproxymanager.hxx delete mode 100644 canvas/inc/canvas/spriteredrawmanager.hxx delete mode 100644 canvas/inc/canvas/vclwrapper.hxx delete mode 100644 canvas/inc/canvas/verbosetrace.hxx delete mode 100644 canvas/inc/canvas/verifyinput.hxx (limited to 'canvas') diff --git a/canvas/Module_canvas.mk b/canvas/Module_canvas.mk index 39ffd5b7a09b..a678fafa5f0a 100644 --- a/canvas/Module_canvas.mk +++ b/canvas/Module_canvas.mk @@ -34,7 +34,6 @@ $(eval $(call gb_Module_add_targets,canvas,\ Library_nullcanvas \ Library_simplecanvas \ Library_vclcanvas \ - Package_inc \ )) ifeq ($(ENABLE_CAIRO_CANVAS),TRUE) diff --git a/canvas/Package_inc.mk b/canvas/Package_inc.mk deleted file mode 100644 index f5fa6b5c2b3d..000000000000 --- a/canvas/Package_inc.mk +++ /dev/null @@ -1,60 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2011 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -$(eval $(call gb_Package_Package,canvas_inc,$(SRCDIR)/canvas/inc)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/base/bitmapcanvasbase.hxx,canvas/base/bitmapcanvasbase.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/base/bufferedgraphicdevicebase.hxx,canvas/base/bufferedgraphicdevicebase.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/base/cachedprimitivebase.hxx,canvas/base/cachedprimitivebase.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/base/canvasbase.hxx,canvas/base/canvasbase.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/base/canvascustomspritebase.hxx,canvas/base/canvascustomspritebase.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/base/canvascustomspritehelper.hxx,canvas/base/canvascustomspritehelper.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/base/graphicdevicebase.hxx,canvas/base/graphicdevicebase.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/base/integerbitmapbase.hxx,canvas/base/integerbitmapbase.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/base/sprite.hxx,canvas/base/sprite.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/base/spritecanvasbase.hxx,canvas/base/spritecanvasbase.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/base/spritesurface.hxx,canvas/base/spritesurface.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/canvastools.hxx,canvas/canvastools.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/canvastoolsdllapi.h,canvas/canvastoolsdllapi.h)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/debug.hxx,canvas/debug.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/elapsedtime.hxx,canvas/elapsedtime.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/parametricpolypolygon.hxx,canvas/parametricpolypolygon.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/propertysethelper.hxx,canvas/propertysethelper.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/rendering/bitmap.hxx,canvas/rendering/bitmap.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/rendering/icachedprimitive.hxx,canvas/rendering/icachedprimitive.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/rendering/icolorbuffer.hxx,canvas/rendering/icolorbuffer.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/rendering/irendermodule.hxx,canvas/rendering/irendermodule.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/rendering/isurface.hxx,canvas/rendering/isurface.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/rendering/isurfaceproxy.hxx,canvas/rendering/isurfaceproxy.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/rendering/isurfaceproxymanager.hxx,canvas/rendering/isurfaceproxymanager.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/spriteredrawmanager.hxx,canvas/spriteredrawmanager.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/vclwrapper.hxx,canvas/vclwrapper.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/verbosetrace.hxx,canvas/verbosetrace.hxx)) -$(eval $(call gb_Package_add_file,canvas_inc,inc/canvas/verifyinput.hxx,canvas/verifyinput.hxx)) - - -# vim: set noet sw=4 ts=4: diff --git a/canvas/inc/canvas/base/bitmapcanvasbase.hxx b/canvas/inc/canvas/base/bitmapcanvasbase.hxx deleted file mode 100644 index 5c1376b0632b..000000000000 --- a/canvas/inc/canvas/base/bitmapcanvasbase.hxx +++ /dev/null @@ -1,128 +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_CANVAS_BITMAPCANVASBASE_HXX -#define INCLUDED_CANVAS_BITMAPCANVASBASE_HXX - -#include -#include - -namespace canvas -{ - /** Helper template to handle XBitmapCanvas method forwarding to - BitmapCanvasHelper - - Use this helper to handle the XBitmapCanvas part of your - implementation. - - @tpl Base - Base class to use, most probably one of the - WeakComponentImplHelperN templates with the appropriate - interfaces. At least XBitmapCanvas should be among them (why - else would you use this template, then?). Base class must have - an Base( const Mutex& ) constructor (like the - WeakComponentImplHelperN templates have). - - @tpl CanvasHelper - Canvas helper implementation for the backend in question - - @tpl Mutex - Lock strategy to use. Defaults to using the - OBaseMutex-provided lock. Everytime one of the methods is - entered, an object of type Mutex is created with m_aMutex as - the sole parameter, and destroyed again when the method scope - is left. - - @tpl UnambiguousBase - Optional unambiguous base class for XInterface of Base. It's - sometimes necessary to specify this parameter, e.g. if Base - derives from multiple UNO interface (were each provides its - own version of XInterface, making the conversion ambiguous) - - @see CanvasBase for further contractual requirements towards - the CanvasHelper type, and some examples. - */ - template< class Base, - class CanvasHelper, - class Mutex=::osl::MutexGuard, - class UnambiguousBase=::com::sun::star::uno::XInterface > class BitmapCanvasBase : - public CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > - { - public: - typedef CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType; - - // XBitmapCanvas - virtual void SAL_CALL copyRect( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas >& sourceCanvas, - const ::com::sun::star::geometry::RealRectangle2D& sourceRect, - const ::com::sun::star::rendering::ViewState& sourceViewState, - const ::com::sun::star::rendering::RenderState& sourceRenderState, - const ::com::sun::star::geometry::RealRectangle2D& destRect, - const ::com::sun::star::rendering::ViewState& destViewState, - const ::com::sun::star::rendering::RenderState& destRenderState ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(sourceCanvas, sourceRect, sourceViewState, sourceRenderState, - destRect, destViewState, destRenderState, - BOOST_CURRENT_FUNCTION, - static_cast< typename BaseType::UnambiguousBaseType* >(this)); - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - BaseType::mbSurfaceDirty = true; - BaseType::maCanvasHelper.modifying(); - - BaseType::maCanvasHelper.copyRect( this, - sourceCanvas, - sourceRect, - sourceViewState, - sourceRenderState, - destRect, - destViewState, - destRenderState ); - } - - // XBitmap - virtual ::com::sun::star::geometry::IntegerSize2D SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException) - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return BaseType::maCanvasHelper.getSize(); - } - - virtual ::sal_Bool SAL_CALL hasAlpha( ) throw (::com::sun::star::uno::RuntimeException) - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return BaseType::maCanvasHelper.hasAlpha(); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > SAL_CALL getScaledBitmap( const ::com::sun::star::geometry::RealSize2D& newSize, - sal_Bool beFast ) throw (::com::sun::star::uno::RuntimeException) - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return BaseType::maCanvasHelper.getScaledBitmap( newSize, beFast ); - } - - }; -} - -#endif /* INCLUDED_CANVAS_BITMAPCANVASBASE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/base/bufferedgraphicdevicebase.hxx b/canvas/inc/canvas/base/bufferedgraphicdevicebase.hxx deleted file mode 100644 index 2713e0ea11bb..000000000000 --- a/canvas/inc/canvas/base/bufferedgraphicdevicebase.hxx +++ /dev/null @@ -1,276 +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_CANVAS_BUFFEREDGRAPHICDEVICEBASE_HXX -#define INCLUDED_CANVAS_BUFFEREDGRAPHICDEVICEBASE_HXX - -#include -#include -#include - -#include -#include - - -/* Definition of BufferedGraphicDeviceBase class */ - -namespace canvas -{ - /** Helper template base class for XGraphicDevice implementations - on windows. - - Use this base class if your target device is a - window. Additionally to GraphicDeviceBase, this template - provides an implementation of the awt::XWindowListener - interface, to receive notifications about state changes of the - associated window. - - @tpl Base - Base class to use, most probably one of the - WeakComponentImplHelperN templates with the appropriate - interfaces. At least XGraphicDevice should be among them (why else - would you use this template, then?). Base class must have an - Base( const Mutex& ) constructor (like the - WeakComponentImplHelperN templates have). As the very least, - the base class must be derived from uno::XInterface, as some - error reporting mechanisms rely on that. - - @tpl DeviceHelper - Device helper implementation for the backend in question. This - object will be held as a member of this template class, and - basically gets forwarded all XGraphicDevice API calls that - could not be handled generically. - - @tpl Mutex - Lock strategy to use. Defaults to using the - OBaseMutex-provided lock. Everytime one of the methods is - entered, an object of type Mutex is created with m_aMutex as - the sole parameter, and destroyed again when the method scope - is left. - - @tpl UnambiguousBase - Optional unambiguous base class for XInterface of Base. It's - sometimes necessary to specify this parameter, e.g. if Base - derives from multiple UNO interface (were each provides its - own version of XInterface, making the conversion ambiguous) - */ - template< class Base, - class DeviceHelper, - class Mutex=::osl::MutexGuard, - class UnambiguousBase=::com::sun::star::uno::XInterface > class BufferedGraphicDeviceBase : - public GraphicDeviceBase< Base, DeviceHelper, Mutex, UnambiguousBase > - { - public: - typedef GraphicDeviceBase< Base, DeviceHelper, Mutex, UnambiguousBase > BaseType; - typedef BufferedGraphicDeviceBase OurType; - typedef Mutex MutexType; - - BufferedGraphicDeviceBase() : - mxWindow(), - maBounds(), - mbIsVisible( false ), - mbIsTopLevel( false ) - { - BaseType::maPropHelper.addProperties( PropertySetHelper::MakeMap - ("Window", - boost::bind(&OurType::getXWindow, - this))); - } - - // XGraphicDevice - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBufferController > SAL_CALL getBufferController( ) throw (::com::sun::star::uno::RuntimeException) - { - return this; - } - - // XBufferController - virtual ::sal_Int32 SAL_CALL createBuffers( ::sal_Int32 nBuffers ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyRange( nBuffers, (sal_Int32)1 ); - - MutexType aGuard( BaseType::m_aMutex ); - - return BaseType::maDeviceHelper.createBuffers( nBuffers ); - } - - virtual void SAL_CALL destroyBuffers( ) throw (::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - - BaseType::maDeviceHelper.destroyBuffers(); - } - - virtual ::sal_Bool SAL_CALL showBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - - return BaseType::maDeviceHelper.showBuffer( mbIsVisible, bUpdateAll ); - } - - virtual ::sal_Bool SAL_CALL switchBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - - return BaseType::maDeviceHelper.switchBuffer( mbIsVisible, bUpdateAll ); - } - - - /** Set corresponding canvas window - - Use this method to set the window this canvas displays - on. Comes in handy when the canvas needs to adapt size or - output position to the changing window. - - Whenever the bounds of the window change, void - notifySizeUpdate( const awt::Rectangle& rBounds ) - is called, with rBounds the window bound rect relative to - the frame window. - */ - void setWindow( const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XWindow2 >& rWindow ) - { - if( mxWindow.is() ) - mxWindow->removeWindowListener( this ); - - mxWindow = rWindow; - - if( mxWindow.is() ) - { - mbIsVisible = mxWindow->isVisible(); - mbIsTopLevel = - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow >( - mxWindow, - ::com::sun::star::uno::UNO_QUERY ).is(); - - maBounds = transformBounds( mxWindow->getPosSize() ); - mxWindow->addWindowListener( this ); - } - } - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2 > getWindow() const - { - return mxWindow; - } - - ::com::sun::star::uno::Any getXWindow() const - { - return ::com::sun::star::uno::makeAny(mxWindow); - } - - virtual void disposeThis() - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - if( mxWindow.is() ) - { - mxWindow->removeWindowListener(this); - mxWindow.clear(); - } - - // pass on to base class - BaseType::disposeThis(); - } - - ::com::sun::star::awt::Rectangle transformBounds( const ::com::sun::star::awt::Rectangle& rBounds ) - { - // notifySizeUpdate's bounds are relative to the toplevel - // window - if( !mbIsTopLevel ) - return tools::getAbsoluteWindowRect( - rBounds, - mxWindow ); - else - return ::com::sun::star::awt::Rectangle( 0,0,rBounds.Width,rBounds.Height ); - } - - void boundsChanged( const ::com::sun::star::awt::WindowEvent& e ) - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - const ::com::sun::star::awt::Rectangle& rNewBounds( - transformBounds( - ::com::sun::star::awt::Rectangle( e.X, - e.Y, - e.Width, - e.Height ))); - - if( rNewBounds.X != maBounds.X || - rNewBounds.Y != maBounds.Y || - rNewBounds.Width != maBounds.Width || - rNewBounds.Height != maBounds.Height ) - { - maBounds = rNewBounds; - BaseType::maDeviceHelper.notifySizeUpdate( maBounds ); - } - } - - // XWindowListener - virtual void disposeEventSource( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException) - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - if( Source.Source == mxWindow ) - mxWindow.clear(); - - BaseType::disposeEventSource(Source); - } - - virtual void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException) - { - boundsChanged( e ); - } - - virtual void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException) - { - boundsChanged( e ); - } - - virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - mbIsVisible = true; - } - - virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - mbIsVisible = false; - } - - protected: - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2 > mxWindow; - - /// Current bounds of the owning Window - ::com::sun::star::awt::Rectangle maBounds; - - /// True, if the window this canvas is contained in, is visible - bool mbIsVisible; - - private: - /// True, if the window this canvas is contained in, is a toplevel window - bool mbIsTopLevel; - }; -} - -#endif /* INCLUDED_CANVAS_BUFFEREDGRAPHICDEVICEBASE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/base/cachedprimitivebase.hxx b/canvas/inc/canvas/base/cachedprimitivebase.hxx deleted file mode 100644 index 8c7e1579f1e2..000000000000 --- a/canvas/inc/canvas/base/cachedprimitivebase.hxx +++ /dev/null @@ -1,117 +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_CANVAS_CACHEDPRIMITIVEBASE_HXX -#define INCLUDED_CANVAS_CACHEDPRIMITIVEBASE_HXX - -#include -#include -#include -#include -#include -#include -#include - -#include - -/* Definition of CachedPrimitiveBase class */ - -namespace canvas -{ - typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XCachedPrimitive, - ::com::sun::star::lang::XServiceInfo > CachedPrimitiveBase_Base; - - /** Base class, providing common functionality for implementers of - the XCachedPrimitive interface. - */ - class CANVASTOOLS_DLLPUBLIC CachedPrimitiveBase : public CachedPrimitiveBase_Base, - public ::comphelper::OBaseMutex - { - public: - - /** Create an XCachedPrimitive for given target canvas - - @param rUsedViewState - The viewstate the original object was rendered with - - @param rTarget - The target canvas the repaint should happen on. - - @param bFailForChangedViewTransform - When true, derived classes will never receive doRedraw() - calls with dissimilar view transformations and - bSameViewTransform set to false. This is useful for cached - objects where re-transforming the generated output is not - desirable, e.g. for hinted font output. - */ - CachedPrimitiveBase( const ::com::sun::star::rendering::ViewState& rUsedViewState, - const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XCanvas >& rTarget, - bool bFailForChangedViewTransform ); - - /// Dispose all internal references - virtual void SAL_CALL disposing(); - - // XCachedPrimitive - virtual ::sal_Int8 SAL_CALL redraw( const ::com::sun::star::rendering::ViewState& aState ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); - - protected: - ~CachedPrimitiveBase(); // we're a ref-counted UNO class. _We_ destroy ourselves. - - private: - CachedPrimitiveBase( const CachedPrimitiveBase& ); - CachedPrimitiveBase& operator=( const CachedPrimitiveBase& ); - - /** Actually perform the requested redraw. - - Clients must override this method, instead of the public - redraw() one. - - @param rNewState - The viewstate to redraw with - - @param rOldState - The viewstate this cache object was created with. - - @param rTargetCanvas - Target canvas to render to. - - @param bSameViewTransform - When true, rNewState and rOldState have the same transformation. - */ - virtual ::sal_Int8 doRedraw( const ::com::sun::star::rendering::ViewState& rNewState, - const ::com::sun::star::rendering::ViewState& rOldState, - const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XCanvas >& rTargetCanvas, - bool bSameViewTransform ) = 0; - - ::com::sun::star::rendering::ViewState maUsedViewState; - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas > mxTarget; - const bool mbFailForChangedViewTransform; - }; -} - -#endif /* INCLUDED_CANVAS_CACHEDPRIMITIVEBASE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/base/canvasbase.hxx b/canvas/inc/canvas/base/canvasbase.hxx deleted file mode 100644 index f7844fd219de..000000000000 --- a/canvas/inc/canvas/base/canvasbase.hxx +++ /dev/null @@ -1,474 +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_CANVAS_CANVASBASE_HXX -#define INCLUDED_CANVAS_CANVASBASE_HXX - -#include -#include -#include -#include -#include - - -namespace canvas -{ - /** Helper template to handle XCanvas method forwarding to CanvasHelper - - Use this helper to handle the XCanvas part of your - implementation. In theory, we could have provided CanvasHelper - and CanvasBase as a single template, but that would duplicate - a lot of code now residing in CanvasHelper only. - - This template basically interposes itself between the full - interface you implement (i.e. not restricted to XCanvas. The - problem with UNO partial interface implementation actually is, - that you cannot do it the plain way, since deriving from a - common base subclass always introduces the whole set of pure - virtuals, that your baseclass helper just overrided) and your - implementation class. You then only have to implement the - functionality besides XCanvas. - -
-        Example:
-        typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XSpriteCanvas,
-                                                   ::com::sun::star::lang::XInitialization,
-                                                  ::com::sun::star::lang::XServiceInfo,
-                                                  ::com::sun::star::lang::XServiceName > CanvasBase_Base;
-        typedef ::canvas::internal::CanvasBase< CanvasBase_Base, CanvasHelper > ExampleCanvas_Base;
-
-        class ExampleCanvas : public ExampleCanvas_Base,
-                              public SpriteSurface,
-                               public RepaintTarget
-        {
-        };
-        
- - @tpl Base - Base class to use, most probably one of the - WeakComponentImplHelperN templates with the appropriate - interfaces. At least XCanvas should be among them (why else - would you use this template, then?). Base class must have an - Base( const Mutex& ) constructor (like the - WeakComponentImplHelperN templates have). As the very least, - the base class must be derived from uno::XInterface, as some - error reporting mechanisms rely on that. - - @tpl CanvasHelper - Canvas helper implementation for the backend in question. This - object will be held as a member of this template class, and - basically gets forwarded all XCanvas API calls. Furthermore, - everytime the canvas API semantically changes the content of - the canvas, CanvasHelper::modifying() will get called - (before the actual modification takes place). - - @tpl Mutex - Lock strategy to use. Defaults to using the - OBaseMutex-provided lock. Everytime one of the methods is - entered, an object of type Mutex is created with m_aMutex as - the sole parameter, and destroyed again when the method scope - is left. - - @tpl UnambiguousBase - Optional unambiguous base class for XInterface of Base. It's - sometimes necessary to specify this parameter, e.g. if Base - derives from multiple UNO interface (were each provides its - own version of XInterface, making the conversion ambiguous) - */ - template< class Base, - class CanvasHelper, - class Mutex=::osl::MutexGuard, - class UnambiguousBase=::com::sun::star::uno::XInterface > class CanvasBase : - public Base - { - public: - typedef Base BaseType; - typedef CanvasHelper HelperType; - typedef Mutex MutexType; - typedef UnambiguousBase UnambiguousBaseType; - - /** Create CanvasBase - */ - CanvasBase() : - maCanvasHelper(), - mbSurfaceDirty( true ) - { - } - - virtual void disposeThis() - { - MutexType aGuard( BaseType::m_aMutex ); - - maCanvasHelper.disposing(); - - // pass on to base class - BaseType::disposeThis(); - } - - // XCanvas - virtual void SAL_CALL clear() throw (::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - - mbSurfaceDirty = true; - maCanvasHelper.modifying(); - - maCanvasHelper.clear(); - } - - virtual void SAL_CALL drawPoint( const ::com::sun::star::geometry::RealPoint2D& aPoint, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(aPoint, viewState, renderState, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - mbSurfaceDirty = true; - maCanvasHelper.modifying(); - - maCanvasHelper.drawPoint( this, aPoint, viewState, renderState ); - } - - virtual void SAL_CALL drawLine( const ::com::sun::star::geometry::RealPoint2D& aStartPoint, - const ::com::sun::star::geometry::RealPoint2D& aEndPoint, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(aStartPoint, aEndPoint, viewState, renderState, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - mbSurfaceDirty = true; - maCanvasHelper.modifying(); - - maCanvasHelper.drawLine( this, aStartPoint, aEndPoint, viewState, renderState ); - } - - virtual void SAL_CALL drawBezier( const ::com::sun::star::geometry::RealBezierSegment2D& aBezierSegment, - const ::com::sun::star::geometry::RealPoint2D& aEndPoint, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(aBezierSegment, aEndPoint, viewState, renderState, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - mbSurfaceDirty = true; - maCanvasHelper.modifying(); - - maCanvasHelper.drawBezier( this, aBezierSegment, aEndPoint, viewState, renderState ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL - drawPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(xPolyPolygon, viewState, renderState, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - mbSurfaceDirty = true; - maCanvasHelper.modifying(); - - return maCanvasHelper.drawPolyPolygon( this, xPolyPolygon, viewState, renderState ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL - strokePolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, - const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(xPolyPolygon, viewState, renderState, strokeAttributes, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - mbSurfaceDirty = true; - maCanvasHelper.modifying(); - - return maCanvasHelper.strokePolyPolygon( this, xPolyPolygon, viewState, renderState, strokeAttributes ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL - strokeTexturedPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, - const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >& textures, - const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(xPolyPolygon, viewState, renderState, strokeAttributes, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - mbSurfaceDirty = true; - maCanvasHelper.modifying(); - - return maCanvasHelper.strokeTexturedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures, strokeAttributes ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL - strokeTextureMappedPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, - const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >& textures, - const ::com::sun::star::uno::Reference< ::com::sun::star::geometry::XMapping2D >& xMapping, - const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(xPolyPolygon, viewState, renderState, textures, xMapping, strokeAttributes, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - mbSurfaceDirty = true; - maCanvasHelper.modifying(); - - return maCanvasHelper.strokeTextureMappedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures, xMapping, strokeAttributes ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > SAL_CALL - queryStrokeShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, - const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(xPolyPolygon, viewState, renderState, strokeAttributes, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - mbSurfaceDirty = true; - maCanvasHelper.modifying(); - - return maCanvasHelper.queryStrokeShapes( this, xPolyPolygon, viewState, renderState, strokeAttributes ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL - fillPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(xPolyPolygon, viewState, renderState, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - mbSurfaceDirty = true; - maCanvasHelper.modifying(); - - return maCanvasHelper.fillPolyPolygon( this, xPolyPolygon, viewState, renderState ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL - fillTexturedPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, - const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >& textures ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(xPolyPolygon, viewState, renderState, textures, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - mbSurfaceDirty = true; - maCanvasHelper.modifying(); - - return maCanvasHelper.fillTexturedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL - fillTextureMappedPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, - const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >& textures, - const ::com::sun::star::uno::Reference< ::com::sun::star::geometry::XMapping2D >& xMapping ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(xPolyPolygon, viewState, renderState, textures, xMapping, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - mbSurfaceDirty = true; - maCanvasHelper.modifying(); - - return maCanvasHelper.fillTextureMappedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures, xMapping ); - } - - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont > SAL_CALL - createFont( const ::com::sun::star::rendering::FontRequest& fontRequest, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& extraFontProperties, - const ::com::sun::star::geometry::Matrix2D& fontMatrix ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(fontRequest, - // dummy, to keep argPos in sync - fontRequest, - fontMatrix, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - return maCanvasHelper.createFont( this, fontRequest, extraFontProperties, fontMatrix ); - } - - - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::FontInfo > SAL_CALL - queryAvailableFonts( const ::com::sun::star::rendering::FontInfo& aFilter, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aFontProperties ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(aFilter, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - return maCanvasHelper.queryAvailableFonts( this, aFilter, aFontProperties ); - } - - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL - drawText( const ::com::sun::star::rendering::StringContext& text, - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont >& xFont, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, - sal_Int8 textDirection ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(xFont, viewState, renderState, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - tools::verifyRange( textDirection, - ::com::sun::star::rendering::TextDirection::WEAK_LEFT_TO_RIGHT, - ::com::sun::star::rendering::TextDirection::STRONG_RIGHT_TO_LEFT ); - - MutexType aGuard( BaseType::m_aMutex ); - - mbSurfaceDirty = true; - maCanvasHelper.modifying(); - - return maCanvasHelper.drawText( this, text, xFont, viewState, renderState, textDirection ); - } - - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL - drawTextLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XTextLayout >& layoutetText, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(layoutetText, viewState, renderState, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - mbSurfaceDirty = true; - maCanvasHelper.modifying(); - - return maCanvasHelper.drawTextLayout( this, layoutetText, viewState, renderState ); - } - - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL - drawBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >& xBitmap, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(xBitmap, viewState, renderState, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - mbSurfaceDirty = true; - maCanvasHelper.modifying(); - - return maCanvasHelper.drawBitmap( this, xBitmap, viewState, renderState ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL - drawBitmapModulated( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >& xBitmap, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(xBitmap, viewState, renderState, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - mbSurfaceDirty = true; - maCanvasHelper.modifying(); - - return maCanvasHelper.drawBitmapModulated( this, xBitmap, viewState, renderState ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice > SAL_CALL - getDevice() throw (::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - - return maCanvasHelper.getDevice(); - } - - protected: - ~CanvasBase() {} // we're a ref-counted UNO class. _We_ destroy ourselves. - - HelperType maCanvasHelper; - mutable bool mbSurfaceDirty; - - private: - CanvasBase( const CanvasBase& ); - CanvasBase& operator=( const CanvasBase& ); - }; -} - -#endif /* INCLUDED_CANVAS_CANVASBASE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/base/canvascustomspritebase.hxx b/canvas/inc/canvas/base/canvascustomspritebase.hxx deleted file mode 100644 index 7c1b5508bb4e..000000000000 --- a/canvas/inc/canvas/base/canvascustomspritebase.hxx +++ /dev/null @@ -1,271 +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_CANVAS_CANVASCUSTOMSPRITEBASE_HXX -#define INCLUDED_CANVAS_CANVASCUSTOMSPRITEBASE_HXX - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - - -namespace canvas -{ - /** Helper template to handle XCustomSprite method forwarding to - CanvasCustomSpriteHelper - - Use this helper to handle the XCustomSprite part of your - implementation. - - @tpl Base - Base class to use, most probably one of the - WeakComponentImplHelperN templates with the appropriate - interfaces. At least XCustomSprite and Sprite should be among - them (why else would you use this template, then?). Base class - must have an Base( const Mutex& ) constructor (like the - WeakComponentImplHelperN templates have). - - @tpl SpriteHelper - Sprite helper implementation for the backend in question - - @tpl CanvasHelper - Canvas helper implementation for the backend in question - - @tpl Mutex - Lock strategy to use. Defaults to using the - OBaseMutex-provided lock. Everytime one of the methods is - entered, an object of type Mutex is created with m_aMutex as - the sole parameter, and destroyed again when the method scope - is left. - - @tpl UnambiguousBase - Optional unambiguous base class for XInterface of Base. It's - sometimes necessary to specify this parameter, e.g. if Base - derives from multiple UNO interface (were each provides its - own version of XInterface, making the conversion ambiguous) - - @see CanvasCustomSpriteHelper for further contractual - requirements towards the SpriteHelper type, and some examples. - */ - template< class Base, - class SpriteHelper, - class CanvasHelper, - class Mutex=::osl::MutexGuard, - class UnambiguousBase=::com::sun::star::uno::XInterface > class CanvasCustomSpriteBase : - public IntegerBitmapBase< Base, CanvasHelper, Mutex, UnambiguousBase > - { - public: - typedef IntegerBitmapBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType; - typedef SpriteHelper SpriteHelperType; - - CanvasCustomSpriteBase() : - maSpriteHelper() - { - } - - /** Object is being disposed. - - Called from the cppu helper base, to notify disposal of - this object. Already releases all internal references. - - @derive when overriding this method in derived classes, - always call the base class' method! - */ - virtual void disposeThis() - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - maSpriteHelper.disposing(); - - // pass on to base class - BaseType::disposeThis(); - } - - // XCanvas: selectively override base's methods here, for opacity tracking - virtual void SAL_CALL clear() throw (::com::sun::star::uno::RuntimeException) - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - maSpriteHelper.clearingContent( this ); - - // and forward to base class, which handles the actual rendering - return BaseType::clear(); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL - drawBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >& xBitmap, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(xBitmap, viewState, renderState, - BOOST_CURRENT_FUNCTION, - static_cast< typename BaseType::UnambiguousBaseType* >(this)); - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - maSpriteHelper.checkDrawBitmap( this, xBitmap, viewState, renderState ); - - // and forward to base class, which handles the actual rendering - return BaseType::drawBitmap( xBitmap, - viewState, - renderState ); - } - - // TODO(F3): If somebody uses the XIntegerBitmap methods to - // clear pixel (setting alpha != 1.0 there), or a compositing - // mode results in similar alpha, maSpriteHelper might - // errorneously report fully opaque sprites. Effectively, all - // render methods must be overridden here; or better, - // functionality provided at the baseclass. - - // XSprite - virtual void SAL_CALL setAlpha( double alpha ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyRange( alpha, 0.0, 1.0 ); - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - maSpriteHelper.setAlpha( this, alpha ); - } - - virtual void SAL_CALL move( const ::com::sun::star::geometry::RealPoint2D& aNewPos, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(aNewPos, viewState, renderState, - BOOST_CURRENT_FUNCTION, - static_cast< typename BaseType::UnambiguousBaseType* >(this)); - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - maSpriteHelper.move( this, aNewPos, viewState, renderState ); - } - - virtual void SAL_CALL transform( const ::com::sun::star::geometry::AffineMatrix2D& aTransformation ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(aTransformation, - BOOST_CURRENT_FUNCTION, - static_cast< typename BaseType::UnambiguousBaseType* >(this)); - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - maSpriteHelper.transform( this, aTransformation ); - } - - virtual void SAL_CALL clip( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& aClip ) throw (::com::sun::star::uno::RuntimeException) - { - // NULL xClip explicitly allowed here (to clear clipping) - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - maSpriteHelper.clip( this, aClip ); - } - - virtual void SAL_CALL setPriority( double nPriority ) throw (::com::sun::star::uno::RuntimeException) - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - maSpriteHelper.setPriority( this, nPriority ); - } - - virtual void SAL_CALL show() throw (::com::sun::star::uno::RuntimeException) - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - maSpriteHelper.show( this ); - } - - virtual void SAL_CALL hide() throw (::com::sun::star::uno::RuntimeException) - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - maSpriteHelper.hide( this ); - } - - // XCustomSprite - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas > SAL_CALL - getContentCanvas() throw (::com::sun::star::uno::RuntimeException) - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return this; - } - - // Sprite - virtual bool isAreaUpdateOpaque( const ::basegfx::B2DRange& rUpdateArea ) const - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return maSpriteHelper.isAreaUpdateOpaque( rUpdateArea ); - } - - virtual bool isContentChanged() const - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return BaseType::mbSurfaceDirty; - } - - virtual ::basegfx::B2DPoint getPosPixel() const - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return maSpriteHelper.getPosPixel(); - } - - virtual ::basegfx::B2DVector getSizePixel() const - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return maSpriteHelper.getSizePixel(); - } - - virtual ::basegfx::B2DRange getUpdateArea() const - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return maSpriteHelper.getUpdateArea(); - } - - virtual double getPriority() const - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return maSpriteHelper.getPriority(); - } - - protected: - SpriteHelperType maSpriteHelper; - }; -} - -#endif /* INCLUDED_CANVAS_CANVASCUSTOMSPRITEBASE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/base/canvascustomspritehelper.hxx b/canvas/inc/canvas/base/canvascustomspritehelper.hxx deleted file mode 100644 index 2b2fd2d774d8..000000000000 --- a/canvas/inc/canvas/base/canvascustomspritehelper.hxx +++ /dev/null @@ -1,287 +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_CANVAS_CANVASCUSTOMSPRITEHELPER_HXX -#define INCLUDED_CANVAS_CANVASCUSTOMSPRITEHELPER_HXX - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace canvas -{ - /* Definition of CanvasCustomSpriteHelper class */ - - /** Base class for an XSprite helper implementation - to be used - in concert with CanvasCustomSpriteBase - */ - class CANVASTOOLS_DLLPUBLIC CanvasCustomSpriteHelper - { - public: - CanvasCustomSpriteHelper(); - virtual ~CanvasCustomSpriteHelper() {} - - /** Init helper - - @param rSpriteSize - Requested size of the sprite, as passed to the - XSpriteCanvas::createCustomSprite() method - - @param rOwningSpriteCanvas - The XSpriteCanvas this sprite is displayed on - */ - void init( const ::com::sun::star::geometry::RealSize2D& rSpriteSize, - const SpriteSurface::Reference& rOwningSpriteCanvas ); - - /** Object is being disposed, release all internal references - - @derive when overriding this method in derived classes, - always call the base class' method! - */ - void disposing(); - - // XCanvas - /// need to call this method for XCanvas::clear(), for opacity tracking - void clearingContent( const Sprite::Reference& rSprite ); - - /// need to call this method for XCanvas::drawBitmap(), for opacity tracking - void checkDrawBitmap( const Sprite::Reference& rSprite, - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >& xBitmap, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); - - // XSprite - void setAlpha( const Sprite::Reference& rSprite, - double alpha ); - void move( const Sprite::Reference& rSprite, - const ::com::sun::star::geometry::RealPoint2D& aNewPos, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); - void transform( const Sprite::Reference& rSprite, - const ::com::sun::star::geometry::AffineMatrix2D& aTransformation ); - void clip( const Sprite::Reference& rSprite, - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& aClip ); - void setPriority( const Sprite::Reference& rSprite, - double nPriority ); - void show( const Sprite::Reference& rSprite ); - void hide( const Sprite::Reference& rSprite ); - - // Sprite - bool isAreaUpdateOpaque( const ::basegfx::B2DRange& rUpdateArea ) const; - ::basegfx::B2DPoint getPosPixel() const; - ::basegfx::B2DVector getSizePixel() const; - ::basegfx::B2DRange getUpdateArea() const; - double getPriority() const; - - // redraw must be implemented by derived - non sensible default implementation - // void redraw( const Sprite::Reference& rSprite, - // const ::basegfx::B2DPoint& rPos ) const; - - - // Helper methods for derived classes - // ---------------------------------- - - /// Calc sprite update area from given raw sprite bounds - ::basegfx::B2DRange getUpdateArea( const ::basegfx::B2DRange& rUntransformedSpriteBounds ) const; - - /// Calc update area for unclipped sprite content - ::basegfx::B2DRange getFullSpriteRect() const; - - /** Returns true, if sprite content bitmap is fully opaque. - - This does not take clipping or transformation into - account, but only denotes that the sprite bitmap's alpha - channel is all 1.0 - */ - bool isContentFullyOpaque() const { return mbIsContentFullyOpaque; } - - /// Returns true, if transformation has changed since last transformUpdated() call - bool hasAlphaChanged() const { return mbAlphaDirty; } - - /// Returns true, if transformation has changed since last transformUpdated() call - bool hasPositionChanged() const { return mbPositionDirty; } - - /// Returns true, if transformation has changed since last transformUpdated() call - bool hasTransformChanged() const { return mbTransformDirty; } - - /// Returns true, if transformation has changed since last transformUpdated() call - bool hasClipChanged() const { return mbClipDirty; } - - /// Returns true, if transformation has changed since last transformUpdated() call - bool hasPrioChanged() const { return mbPrioDirty; } - - /// Returns true, if transformation has changed since last transformUpdated() call - bool hasVisibilityChanged() const { return mbVisibilityDirty; } - - /// Retrieve current alpha value - double getAlpha() const { return mfAlpha; } - - /// Retrieve current clip - const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& getClip() const { return mxClipPoly; } - - const ::basegfx::B2DHomMatrix& getTransformation() const { return maTransform; } - - /// Retrieve current activation state - bool isActive() const { return mbActive; } - - protected: - /** Notifies that caller is again in sync with current alph - - const, but modifies state visible to derived - classes. beware of passing this information to the - outside! - */ - void alphaUpdated() const { mbAlphaDirty=false; } - - /** Notifies that caller is again in sync with current position - - const, but modifies state visible to derived - classes. beware of passing this information to the - outside! - */ - void positionUpdated() const { mbPositionDirty=false; } - - /** Notifies that caller is again in sync with current transformation - - const, but modifies state visible to derived - classes. beware of passing this information to the - outside! - */ - void transformUpdated() const { mbTransformDirty=false; } - - /** Notifies that caller is again in sync with current clip - - const, but modifies state visible to derived - classes. beware of passing this information to the - outside! - */ - void clipUpdated() const { mbClipDirty=false; } - - /** Notifies that caller is again in sync with current priority - - const, but modifies state visible to derived - classes. beware of passing this information to the - outside! - */ - void prioUpdated() const { mbPrioDirty=false; } - - /** Notifies that caller is again in sync with current visibility - - const, but modifies state visible to derived - classes. beware of passing this information to the - outside! - */ - void visibilityUpdated() const { mbVisibilityDirty=false; } - - private: - CanvasCustomSpriteHelper( const CanvasCustomSpriteHelper& ); - CanvasCustomSpriteHelper& operator=( const CanvasCustomSpriteHelper& ); - - /** Called to convert an API polygon to a basegfx polygon - - @derive Needs to be provided by backend-specific code - */ - virtual ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D( - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPoly ) const = 0; - - /** Update clip information from current state - - This method recomputes the maCurrClipBounds and - mbIsCurrClipRectangle members from the current clip and - transformation. IFF the clip changed from rectangular to - rectangular again, this method issues a sequence of - optimized SpriteSurface::updateSprite() calls. - - @return true, if SpriteSurface::updateSprite() was already - called within this method. - */ - bool updateClipState( const Sprite::Reference& rSprite ); - - // -------------------------------------------------------------------- - - /// Owning sprite canvas - SpriteSurface::Reference mpSpriteCanvas; - - /** Currently active clip area. - - This member is either empty, denoting that the current - clip shows the full sprite content, or contains a - rectangular subarea of the sprite, outside of which - the sprite content is fully clipped. - - @see mbIsCurrClipRectangle - */ - ::basegfx::B2DRange maCurrClipBounds; - - // sprite state - ::basegfx::B2DPoint maPosition; - ::basegfx::B2DVector maSize; - ::basegfx::B2DHomMatrix maTransform; - ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D > mxClipPoly; - double mfPriority; - double mfAlpha; - bool mbActive; // true, if not hidden - - /** If true, denotes that the current sprite clip is a true - rectangle, i.e. maCurrClipBounds exactly - describes the visible area of the sprite. - - @see maCurrClipBounds - */ - bool mbIsCurrClipRectangle; - - /** Redraw speedup. - - When true, this flag denotes that the current sprite - content is fully opaque, thus, that blits to the screen do - neither have to take alpha into account, nor prepare any - background for the sprite area. - */ - mutable bool mbIsContentFullyOpaque; - - /// True, iff mfAlpha has changed - mutable bool mbAlphaDirty; - - /// True, iff maPosition has changed - mutable bool mbPositionDirty; - - /// True, iff maTransform has changed - mutable bool mbTransformDirty; - - /// True, iff mxClipPoly has changed - mutable bool mbClipDirty; - - /// True, iff mnPriority has changed - mutable bool mbPrioDirty; - - /// True, iff mbActive has changed - mutable bool mbVisibilityDirty; - }; -} - -#endif /* INCLUDED_CANVAS_CANVASCUSTOMSPRITEHELPER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/base/disambiguationhelper.hxx b/canvas/inc/canvas/base/disambiguationhelper.hxx deleted file mode 100644 index f12a61472cd4..000000000000 --- a/canvas/inc/canvas/base/disambiguationhelper.hxx +++ /dev/null @@ -1,81 +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_CANVAS_DISAMBIGUATIONHELPER_HXX -#define INCLUDED_CANVAS_DISAMBIGUATIONHELPER_HXX - -#include - - -/* Definition of the DisambiguationHelper 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. - - On top of that, disambiguates XEventListener::disposing and - WeakComponentImplHelper::disposing. - - Having two virtual methods with the same name, and not - overriding them in every derived class, will hide one of - them. Later trying to override the same method, will generate - a new vtable slot, and lead to very hard to spot errors. - */ - template< class Base > class DisambiguationHelper : public Base - { - public: - typedef Base BaseType; - - /** Construct DisambiguationHelper - - 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). - */ - DisambiguationHelper() : - BaseType( 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; - }; -} - -#endif /* INCLUDED_CANVAS_DISAMBIGUATIONHELPER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/base/graphicdevicebase.hxx b/canvas/inc/canvas/base/graphicdevicebase.hxx deleted file mode 100644 index 5c3372e3f76a..000000000000 --- a/canvas/inc/canvas/base/graphicdevicebase.hxx +++ /dev/null @@ -1,382 +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_CANVAS_GRAPHICDEVICEBASE_HXX -#define INCLUDED_CANVAS_GRAPHICDEVICEBASE_HXX - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - - -/* Definition of GraphicDeviceBase class */ - -namespace canvas -{ - /** Helper template base class for XGraphicDevice implementations. - - This base class provides partial implementations of the - XGraphicDevice-related interface, such as XColorSpace. - - This template basically interposes itself between the full - interface you implement (i.e. not restricted to XGraphicDevice - etc.). The problem with UNO partial interface implementation - actually is, that you cannot do it the plain way, since - deriving from a common base subclass always introduces the - whole set of pure virtuals, that your baseclass helper just - overrided) and your implementation class. You then only have - to implement the functionality besides - XGraphicDevice. If you want to support the optional debug - XUpdatable interface, also add that to the base classes - (client code will call the corresponding update() method, - whenever a burst of animations is over). - -
-        Example:
-        typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::rendering::XGraphicDevice,
-                                                  ::com::sun::star::rendering::XColorSpace,
-                                                  ::com::sun::star::rendering::XPropertySet,
-                                                  ::com::sun::star::lang::XServiceInfo,
-                                                  ::com::sun::star::lang::XServiceName > GraphicDeviceBase_Base;
-        typedef ::canvas::internal::GraphicDeviceBase< GraphicDeviceBase, DeviceHelper > ExampleDevice_Base;
-
-        class ExampleDevice : public ExampleDevice_Base
-        {
-        };
-        
- - @tpl Base - Base class to use, most probably one of the - WeakComponentImplHelperN templates with the appropriate - interfaces. At least XGraphicDevice should be among them (why else - would you use this template, then?). Base class must have an - Base( const Mutex& ) constructor (like the - WeakComponentImplHelperN templates have). As the very least, - the base class must be derived from uno::XInterface, as some - error reporting mechanisms rely on that. - - @tpl DeviceHelper - Device helper implementation for the backend in question. This - object will be held as a member of this template class, and - basically gets forwarded all XGraphicDevice API calls that - could not be handled generically. - - @tpl Mutex - Lock strategy to use. Defaults to using the - DisambiguationHelper-provided lock. Everytime one of the methods is - entered, an object of type Mutex is created with m_aMutex as - the sole parameter, and destroyed again when the method scope - is left. - - @tpl UnambiguousBase - Optional unambiguous base class for XInterface of Base. It's - sometimes necessary to specify this parameter, e.g. if Base - derives from multiple UNO interface (were each provides its - own version of XInterface, making the conversion ambiguous) - */ - template< class Base, - class DeviceHelper, - class Mutex=::osl::MutexGuard, - class UnambiguousBase=::com::sun::star::uno::XInterface > class GraphicDeviceBase : - public Base - { - public: - typedef Base BaseType; - typedef DeviceHelper DeviceHelperType; - typedef Mutex MutexType; - typedef UnambiguousBase UnambiguousBaseType; - typedef GraphicDeviceBase ThisType; - - typedef ::rtl::Reference< GraphicDeviceBase > Reference; - - GraphicDeviceBase() : - maDeviceHelper(), - maPropHelper(), - mbDumpScreenContent(false) - { - maPropHelper.initProperties( PropertySetHelper::MakeMap - ("HardwareAcceleration", - boost::bind(&DeviceHelper::isAccelerated, - boost::ref(maDeviceHelper))) - ("DeviceHandle", - boost::bind(&DeviceHelper::getDeviceHandle, - boost::ref(maDeviceHelper))) - ("SurfaceHandle", - boost::bind(&DeviceHelper::getSurfaceHandle, - boost::ref(maDeviceHelper))) - ("DumpScreenContent", - boost::bind(&ThisType::getDumpScreenContent, - this), - boost::bind(&ThisType::setDumpScreenContent, - this, - _1))); - } - - virtual void disposeThis() - { - MutexType aGuard( BaseType::m_aMutex ); - - maDeviceHelper.disposing(); - - // pass on to base class - BaseType::disposeThis(); - } - - // XGraphicDevice - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBufferController > SAL_CALL getBufferController( ) throw (::com::sun::star::uno::RuntimeException) - { - return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBufferController >(); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XColorSpace > SAL_CALL getDeviceColorSpace( ) throw (::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - - return maDeviceHelper.getColorSpace(); - } - - virtual ::com::sun::star::geometry::RealSize2D SAL_CALL getPhysicalResolution( ) throw (::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - - return maDeviceHelper.getPhysicalResolution(); - } - - virtual ::com::sun::star::geometry::RealSize2D SAL_CALL getPhysicalSize( ) throw (::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - - return maDeviceHelper.getPhysicalSize(); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XLinePolyPolygon2D > SAL_CALL createCompatibleLinePolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& points ) throw (::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - - return maDeviceHelper.createCompatibleLinePolyPolygon( this, points ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBezierPolyPolygon2D > SAL_CALL createCompatibleBezierPolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& points ) throw (::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - - return maDeviceHelper.createCompatibleBezierPolyPolygon( this, points ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > SAL_CALL createCompatibleBitmap( const ::com::sun::star::geometry::IntegerSize2D& size ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyBitmapSize(size, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - return maDeviceHelper.createCompatibleBitmap( this, size ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > SAL_CALL createVolatileBitmap( const ::com::sun::star::geometry::IntegerSize2D& size ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyBitmapSize(size, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - return maDeviceHelper.createVolatileBitmap( this, size ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > SAL_CALL createCompatibleAlphaBitmap( const ::com::sun::star::geometry::IntegerSize2D& size ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyBitmapSize(size, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - return maDeviceHelper.createCompatibleAlphaBitmap( this, size ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > SAL_CALL createVolatileAlphaBitmap( const ::com::sun::star::geometry::IntegerSize2D& size ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyBitmapSize(size, - BOOST_CURRENT_FUNCTION, - static_cast< UnambiguousBaseType* >(this)); - - MutexType aGuard( BaseType::m_aMutex ); - - return maDeviceHelper.createVolatileAlphaBitmap( this, size ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SAL_CALL getParametricPolyPolygonFactory( ) throw (::com::sun::star::uno::RuntimeException) - { - return this; - } - - virtual ::sal_Bool SAL_CALL hasFullScreenMode( ) throw (::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - - return maDeviceHelper.hasFullScreenMode(); - } - - virtual ::sal_Bool SAL_CALL enterFullScreenMode( ::sal_Bool bEnter ) throw (::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - - return maDeviceHelper.enterFullScreenMode( bEnter ); - } - - // XMultiServiceFactory - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const OUString& aServiceSpecifier ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) - { - return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >( - ParametricPolyPolygon::create(this, - aServiceSpecifier, - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >())); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const OUString& aServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) - { - return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >( - ParametricPolyPolygon::create(this, - aServiceSpecifier, - Arguments)); - } - - virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames( ) throw (::com::sun::star::uno::RuntimeException) - { - return ParametricPolyPolygon::getAvailableServiceNames(); - } - - - // XUpdatable - virtual void SAL_CALL update() throw (com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - - if( mbDumpScreenContent ) - maDeviceHelper.dumpScreenContent(); - } - - - // XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - return maPropHelper.getPropertySetInfo(); - } - - virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, - const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::beans::PropertyVetoException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - maPropHelper.setPropertyValue( aPropertyName, aValue ); - } - - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - return maPropHelper.getPropertyValue( aPropertyName ); - } - - virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - maPropHelper.addPropertyChangeListener( aPropertyName, - xListener ); - } - - virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - maPropHelper.removePropertyChangeListener( aPropertyName, - xListener ); - } - - virtual void SAL_CALL addVetoableChangeListener( const OUString& aPropertyName, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - maPropHelper.addVetoableChangeListener( aPropertyName, - xListener ); - } - - virtual void SAL_CALL removeVetoableChangeListener( const OUString& aPropertyName, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException) - { - MutexType aGuard( BaseType::m_aMutex ); - maPropHelper.removeVetoableChangeListener( aPropertyName, - xListener ); - } - - protected: - ~GraphicDeviceBase() {} // we're a ref-counted UNO class. _We_ destroy ourselves. - - ::com::sun::star::uno::Any getDumpScreenContent() const - { - return ::com::sun::star::uno::makeAny( mbDumpScreenContent ); - } - - void setDumpScreenContent( const ::com::sun::star::uno::Any& rAny ) - { - // TODO(Q1): this was mbDumpScreenContent = - // rAny.get(), only that gcc3.3 wouldn't eat it - rAny >>= mbDumpScreenContent; - } - - DeviceHelperType maDeviceHelper; - PropertySetHelper maPropHelper; - bool mbDumpScreenContent; - - private: - GraphicDeviceBase( const GraphicDeviceBase& ); - GraphicDeviceBase& operator=( const GraphicDeviceBase& ); - }; -} - -#endif /* INCLUDED_CANVAS_GRAPHICDEVICEBASE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/base/integerbitmapbase.hxx b/canvas/inc/canvas/base/integerbitmapbase.hxx deleted file mode 100644 index 602e18a09eb0..000000000000 --- a/canvas/inc/canvas/base/integerbitmapbase.hxx +++ /dev/null @@ -1,145 +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_CANVAS_INTEGERBITMAPBASE_HXX -#define INCLUDED_CANVAS_INTEGERBITMAPBASE_HXX - -#include -#include - - -namespace canvas -{ - /** Helper template to handle XIntegerBitmap method forwarding to - BitmapCanvasHelper - - Use this helper to handle the XIntegerBitmap part of your - implementation. - - @tpl Base - Base class to use, most probably one of the - WeakComponentImplHelperN templates with the appropriate - interfaces. At least XIntegerBitmap should be among them (why - else would you use this template, then?). Base class must have - an Base( const Mutex& ) constructor (like the - WeakComponentImplHelperN templates have). - - @tpl CanvasHelper - Canvas helper implementation for the backend in question - - @tpl Mutex - Lock strategy to use. Defaults to using the - OBaseMutex-provided lock. Everytime one of the methods is - entered, an object of type Mutex is created with m_aMutex as - the sole parameter, and destroyed again when the method scope - is left. - - @tpl UnambiguousBase - Optional unambiguous base class for XInterface of Base. It's - sometimes necessary to specify this parameter, e.g. if Base - derives from multiple UNO interface (were each provides its - own version of XInterface, making the conversion ambiguous) - - @see CanvasBase for further contractual requirements towards - the CanvasHelper type, and some examples. - */ - template< class Base, - class CanvasHelper, - class Mutex=::osl::MutexGuard, - class UnambiguousBase=::com::sun::star::uno::XInterface > class IntegerBitmapBase : - public BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > - { - public: - typedef BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType; - - // XIntegerBitmap - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getData( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerRectangle2D& rect ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::rendering::VolatileContentDestroyedException, ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(rect, - BOOST_CURRENT_FUNCTION, - static_cast< typename BaseType::UnambiguousBaseType* >(this)); - tools::verifyIndexRange(rect, BaseType::getSize() ); - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return BaseType::maCanvasHelper.getData( bitmapLayout, - rect ); - } - - virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< sal_Int8 >& data, - const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerRectangle2D& rect ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(bitmapLayout, rect, - BOOST_CURRENT_FUNCTION, - static_cast< typename BaseType::UnambiguousBaseType* >(this)); - tools::verifyIndexRange(rect, BaseType::getSize() ); - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - BaseType::mbSurfaceDirty = true; - BaseType::maCanvasHelper.modifying(); - - BaseType::maCanvasHelper.setData( data, bitmapLayout, rect ); - } - - virtual void SAL_CALL setPixel( const ::com::sun::star::uno::Sequence< sal_Int8 >& color, - const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerPoint2D& pos ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(bitmapLayout, pos, - BOOST_CURRENT_FUNCTION, - static_cast< typename BaseType::UnambiguousBaseType* >(this)); - tools::verifyIndexRange(pos, BaseType::getSize() ); - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - BaseType::mbSurfaceDirty = true; - BaseType::maCanvasHelper.modifying(); - - BaseType::maCanvasHelper.setPixel( color, bitmapLayout, pos ); - } - - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getPixel( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerPoint2D& pos ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::rendering::VolatileContentDestroyedException, ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(pos, - BOOST_CURRENT_FUNCTION, - static_cast< typename BaseType::UnambiguousBaseType* >(this)); - tools::verifyIndexRange(pos, BaseType::getSize() ); - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return BaseType::maCanvasHelper.getPixel( bitmapLayout, - pos ); - } - - virtual ::com::sun::star::rendering::IntegerBitmapLayout SAL_CALL getMemoryLayout( ) throw (::com::sun::star::uno::RuntimeException) - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return BaseType::maCanvasHelper.getMemoryLayout(); - } - }; -} - -#endif /* INCLUDED_CANVAS_INTEGERBITMAPBASE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/base/sprite.hxx b/canvas/inc/canvas/base/sprite.hxx deleted file mode 100644 index 4ebafd57f998..000000000000 --- a/canvas/inc/canvas/base/sprite.hxx +++ /dev/null @@ -1,116 +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_CANVAS_SPRITE_HXX -#define INCLUDED_CANVAS_SPRITE_HXX - -#include -#include -#include -#include -#include - -namespace basegfx -{ - class B2DPoint; - class B2DVector; - class B2DRange; -} - -namespace canvas -{ - /* Definition of Sprite interface (as we mix with UNO here, has to - be XInterface - reference holders to a Sprite must be able to - control lifetime of reference target) - */ - - /** Helper interface to connect SpriteCanvas with various - sprite implementations. - - This interface should be implemented from every sprite class, - as it provides essential repaint and update area facilitates. - - @derive typically, each canvas implementation will derive - another interface from this one, that adds rendering - functionality (which, of course, is impossible here in a - generic way) - */ - class Sprite : public ::com::sun::star::lang::XComponent - { - public: - typedef ::rtl::Reference< Sprite > Reference; - - /** Query whether sprite update will fully cover the given area. - - Use this method to determine whether any background - content (regardless of static or sprite) needs an update - before rendering this sprite. - - @return true, if sprite redraw will fully overwrite given - area (and thus, the background need not be redrawn - beforehand). - */ - virtual bool isAreaUpdateOpaque( const ::basegfx::B2DRange& rUpdateArea ) const = 0; - - /** Query whether content has changed - */ - virtual bool isContentChanged() const = 0; - - /** Query position of the left, top pixel of the sprite - */ - virtual ::basegfx::B2DPoint getPosPixel() const = 0; - - /** Query size of the sprite in pixel. - */ - virtual ::basegfx::B2DVector getSizePixel() const = 0; - - /** Get area that is currently covered by the sprite - - This area is already adapted to clipping, alpha and - transformation state of this sprite. - */ - virtual ::basegfx::B2DRange getUpdateArea() const = 0; - - /** Query sprite priority - */ - virtual double getPriority() const = 0; - - protected: - ~Sprite() {} - }; - - /** Functor providing a StrictWeakOrdering for sprite references - */ - struct SpriteWeakOrder - { - bool operator()( const Sprite::Reference& rLHS, - const Sprite::Reference& rRHS ) - { - const double nPrioL( rLHS->getPriority() ); - const double nPrioR( rRHS->getPriority() ); - - // if prios are equal, tie-break on ptr value - return nPrioL == nPrioR ? rLHS.get() < rRHS.get() : nPrioL < nPrioR; - } - }; -} - -#endif /* INCLUDED_CANVAS_SPRITE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/base/spritecanvasbase.hxx b/canvas/inc/canvas/base/spritecanvasbase.hxx deleted file mode 100644 index f892bf4170a7..000000000000 --- a/canvas/inc/canvas/base/spritecanvasbase.hxx +++ /dev/null @@ -1,193 +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_CANVAS_SPRITECANVASBASE_HXX -#define INCLUDED_CANVAS_SPRITECANVASBASE_HXX - -#include -#include -#include -#include -#include - - -namespace canvas -{ - /** Helper template to handle XIntegerBitmap method forwarding to - BitmapCanvasHelper - - Use this helper to handle the XIntegerBitmap part of your - implementation. - - @tpl Base - Base class to use, most probably one of the - WeakComponentImplHelperN templates with the appropriate - interfaces. At least XSpriteCanvas and SpriteSurface should be - among them (why else would you use this template, then?). Base - class must have an Base( const Mutex& ) constructor (like the - WeakComponentImplHelperN templates have). - - @tpl CanvasHelper - Canvas helper implementation for the backend in question - - @tpl Mutex - Lock strategy to use. Defaults to using the - OBaseMutex-provided lock. Everytime one of the methods is - entered, an object of type Mutex is created with m_aMutex as - the sole parameter, and destroyed again when the method scope - is left. - - @tpl UnambiguousBase - Optional unambiguous base class for XInterface of Base. It's - sometimes necessary to specify this parameter, e.g. if Base - derives from multiple UNO interface (were each provides its - own version of XInterface, making the conversion ambiguous) - - @see CanvasBase for further contractual requirements towards - the CanvasHelper type, and some examples. - */ - template< class Base, - class CanvasHelper, - class Mutex=::osl::MutexGuard, - class UnambiguousBase=::com::sun::star::uno::XInterface > class SpriteCanvasBase : - public IntegerBitmapBase< Base, CanvasHelper, Mutex, UnambiguousBase > - { - public: - typedef IntegerBitmapBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType; - typedef ::rtl::Reference< SpriteCanvasBase > Reference; - - SpriteCanvasBase() : - maRedrawManager() - { - } - - virtual void disposeThis() - { - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - maRedrawManager.disposing(); - - // pass on to base class - BaseType::disposeThis(); - } - - // XSpriteCanvas - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimatedSprite > SAL_CALL createSpriteFromAnimation( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimation >& animation ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(animation, - BOOST_CURRENT_FUNCTION, - static_cast< typename BaseType::UnambiguousBaseType* >(this)); - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return BaseType::maCanvasHelper.createSpriteFromAnimation(animation); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimatedSprite > SAL_CALL createSpriteFromBitmaps( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > >& animationBitmaps, - sal_Int8 interpolationMode ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::rendering::VolatileContentDestroyedException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(animationBitmaps, - BOOST_CURRENT_FUNCTION, - static_cast< typename BaseType::UnambiguousBaseType* >(this)); - tools::verifyRange( interpolationMode, - ::com::sun::star::rendering::InterpolationMode::NEAREST_NEIGHBOR, - ::com::sun::star::rendering::InterpolationMode::BEZIERSPLINE4 ); - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return BaseType::maCanvasHelper.createSpriteFromBitmaps(animationBitmaps, interpolationMode); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCustomSprite > SAL_CALL createCustomSprite( const ::com::sun::star::geometry::RealSize2D& spriteSize ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifySpriteSize(spriteSize, - BOOST_CURRENT_FUNCTION, - static_cast< typename BaseType::UnambiguousBaseType* >(this)); - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return BaseType::maCanvasHelper.createCustomSprite(spriteSize); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite > SAL_CALL createClonedSprite( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite >& original ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - tools::verifyArgs(original, - BOOST_CURRENT_FUNCTION, - static_cast< typename BaseType::UnambiguousBaseType* >(this)); - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - return BaseType::maCanvasHelper.createClonedSprite(original); - } - - // SpriteSurface - virtual void showSprite( const Sprite::Reference& rSprite ) - { - OSL_ASSERT( rSprite.is() ); - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - maRedrawManager.showSprite( rSprite ); - } - - virtual void hideSprite( const Sprite::Reference& rSprite ) - { - OSL_ASSERT( rSprite.is() ); - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - maRedrawManager.hideSprite( rSprite ); - } - - virtual void moveSprite( const Sprite::Reference& rSprite, - const ::basegfx::B2DPoint& rOldPos, - const ::basegfx::B2DPoint& rNewPos, - const ::basegfx::B2DVector& rSpriteSize ) - { - OSL_ASSERT( rSprite.is() ); - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - maRedrawManager.moveSprite( rSprite, rOldPos, rNewPos, rSpriteSize ); - } - - virtual void updateSprite( const Sprite::Reference& rSprite, - const ::basegfx::B2DPoint& rPos, - const ::basegfx::B2DRange& rUpdateArea ) - { - OSL_ASSERT( rSprite.is() ); - - typename BaseType::MutexType aGuard( BaseType::m_aMutex ); - - maRedrawManager.updateSprite( rSprite, rPos, rUpdateArea ); - } - - protected: - SpriteRedrawManager maRedrawManager; - }; -} - -#endif /* INCLUDED_CANVAS_SPRITECANVASBASE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/base/spritesurface.hxx b/canvas/inc/canvas/base/spritesurface.hxx deleted file mode 100644 index 47a0fb24a67d..000000000000 --- a/canvas/inc/canvas/base/spritesurface.hxx +++ /dev/null @@ -1,70 +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_CANVAS_SPRITESURFACE_HXX -#define INCLUDED_CANVAS_SPRITESURFACE_HXX - -#include - -namespace canvas -{ - /* Definition of the SpriteSurface interface */ - - /** Canvas surface containing sprites - - Every canvas surface that contains sprites must implement this - interface, when employing the canvas base framework. The - methods provided here are used from the individual sprites to - notify the canvas about necessary screen updates. - */ - class SpriteSurface : public ::com::sun::star::uno::XInterface - { - public: - typedef ::rtl::Reference< SpriteSurface > Reference; - - /// Sprites should call this from XSprite::show() - virtual void showSprite( const Sprite::Reference& rSprite ) = 0; - - /// Sprites should call this from XSprite::hide() - virtual void hideSprite( const Sprite::Reference& rSprite ) = 0; - - /// Sprites should call this from XSprite::move() - virtual void moveSprite( const Sprite::Reference& rSprite, - const ::basegfx::B2DPoint& rOldPos, - const ::basegfx::B2DPoint& rNewPos, - const ::basegfx::B2DVector& rSpriteSize ) = 0; - - /** Sprites should call this when some part of the content has - changed. - - That includes show/hide, i.e. for show, both showSprite() - and updateSprite() must be called. - */ - virtual void updateSprite( const Sprite::Reference& rSprite, - const ::basegfx::B2DPoint& rPos, - const ::basegfx::B2DRange& rUpdateArea ) = 0; - - protected: - ~SpriteSurface() {} - }; -} - -#endif /* INCLUDED_CANVAS_SPRITESURFACE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/canvastools.hxx b/canvas/inc/canvas/canvastools.hxx deleted file mode 100644 index fd6dadd0a791..000000000000 --- a/canvas/inc/canvas/canvastools.hxx +++ /dev/null @@ -1,587 +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_CANVAS_CANVASTOOLS_HXX -#define INCLUDED_CANVAS_CANVASTOOLS_HXX - -#include -#include -#include -#include -#include -#include -#include -#include - -#include // for strcmp -#include -#include -#include - -#include - -namespace basegfx -{ - class B2DHomMatrix; - class B2DRange; - class B2IRange; - class B2IPoint; - class B2DPolyPolygon; -} - -namespace com { namespace sun { namespace star { namespace geometry -{ - struct RealSize2D; - struct IntegerSize2D; - struct AffineMatrix2D; - struct Matrix2D; -} } } } - -namespace com { namespace sun { namespace star { namespace rendering -{ - struct RenderState; - struct ViewState; - struct IntegerBitmapLayout; - class XCanvas; - struct Texture; - class XIntegerBitmapColorSpace; - class XPolyPolygon2D; - - bool operator==( const RenderState& rLHS, - const RenderState& rRHS ); - - bool operator==( const ViewState& rLHS, - const ViewState& rRHS ); -} } } } - -namespace com { namespace sun { namespace star { namespace awt -{ - struct Rectangle; - class XWindow2; -} } } } - -class Color; - -namespace canvas -{ - namespace tools - { - /** Compute the next highest power of 2 of a 32-bit value - - Code devised by Sean Anderson, in good ole HAKMEM - tradition. - - @return 1 << (lg(x - 1) + 1) - */ - inline sal_uInt32 nextPow2( sal_uInt32 x ) - { - --x; - x |= x >> 1; - x |= x >> 2; - x |= x >> 4; - x |= x >> 8; - x |= x >> 16; - - return ++x; - } - - /** - * - * Count the number of 1-bits of an n-bit value - * - */ - - // mickey's math tricks... - inline unsigned int pow2( unsigned int c ) { return 0x1 << c; } - inline unsigned int mask( unsigned int c ) { return ((unsigned int)(-1)) / (pow2(pow2(c)) + 1); } - inline unsigned int count( unsigned int x, unsigned int c ) { return ((x) & mask(c)) + (((x) >> (pow2(c))) & mask(c)); } - template - inline unsigned int bitcount( T c ) { - unsigned int nByteIndex = 0; - unsigned int nNumBytes = sizeof(T)<<2; - do { - c=count(c,nByteIndex++); - nNumBytes >>= 1; - } while(nNumBytes); - return c; - } - inline sal_uInt32 bitcount32( sal_uInt32 c ) { - c=count(c,0); - c=count(c,1); - c=count(c,2); - c=count(c,3); - c=count(c,4); - return c; - } - - /** Round given floating point value down to next integer - */ - inline sal_Int32 roundDown( const double& rVal ) - { - return static_cast< sal_Int32 >( floor( rVal ) ); - } - - /** Round given floating point value up to next integer - */ - inline sal_Int32 roundUp( const double& rVal ) - { - return static_cast< sal_Int32 >( ceil( rVal ) ); - } - - /** Create a RealSize2D with both coordinate values set to +infinity - */ - CANVASTOOLS_DLLPUBLIC ::com::sun::star::geometry::RealSize2D createInfiniteSize2D(); - - - // View- and RenderState utilities - // =================================================================== - - CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::RenderState& - initRenderState( ::com::sun::star::rendering::RenderState& renderState ); - - CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::ViewState& - initViewState( ::com::sun::star::rendering::ViewState& viewState ); - - CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix& - getViewStateTransform( ::basegfx::B2DHomMatrix& transform, - const ::com::sun::star::rendering::ViewState& viewState ); - - CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::ViewState& - setViewStateTransform( ::com::sun::star::rendering::ViewState& viewState, - const ::basegfx::B2DHomMatrix& transform ); - - CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix& - getRenderStateTransform( ::basegfx::B2DHomMatrix& transform, - const ::com::sun::star::rendering::RenderState& renderState ); - - CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::RenderState& - setRenderStateTransform( ::com::sun::star::rendering::RenderState& renderState, - const ::basegfx::B2DHomMatrix& transform ); - - CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::RenderState& - appendToRenderState( ::com::sun::star::rendering::RenderState& renderState, - const ::basegfx::B2DHomMatrix& transform ); - - CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::RenderState& - prependToRenderState( ::com::sun::star::rendering::RenderState& renderState, - const ::basegfx::B2DHomMatrix& transform ); - - CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix& - mergeViewAndRenderTransform( ::basegfx::B2DHomMatrix& transform, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); - - - // Matrix utilities - // =================================================================== - - CANVASTOOLS_DLLPUBLIC ::com::sun::star::geometry::AffineMatrix2D& - setIdentityAffineMatrix2D( ::com::sun::star::geometry::AffineMatrix2D& matrix ); - - CANVASTOOLS_DLLPUBLIC ::com::sun::star::geometry::Matrix2D& - setIdentityMatrix2D( ::com::sun::star::geometry::Matrix2D& matrix ); - - - // Special utilities - // =================================================================== - - /** Calc the bounding rectangle of a transformed rectangle. - - The method applies the given transformation to the - specified input rectangle, and returns the bounding box of - the resulting output area. - - @param o_Rect - Output rectangle - - @param i_Rect - Input rectangle - - @param i_Transformation - Transformation to apply to the input rectangle - - @return a reference to the resulting rectangle - */ - CANVASTOOLS_DLLPUBLIC ::basegfx::B2DRange& calcTransformedRectBounds( ::basegfx::B2DRange& o_Rect, - const ::basegfx::B2DRange& i_Rect, - const ::basegfx::B2DHomMatrix& i_Transformation ); - - /** Calc a transform that maps the upper, left corner of a - rectangle to the origin. - - The method is a specialized version of - calcRectToRectTransform() (Removed now), mapping the input rectangle's - the upper, left corner to the origin, and leaving the size - untouched. - - @param o_transform - Output parameter, to receive the resulting transformation - matrix. - - @param i_srcRect - Input parameter, specifies the original source - rectangle. The resulting transformation will exactly map - the source rectangle's upper, left corner to the origin. - - @param i_transformation - The original transformation matrix. This is changed with - translations (if necessary), to exactly map the source - rectangle to the origin. - - @return a reference to the resulting transformation matrix - - @see calcRectToRectTransform() - @see calcTransformedRectBounds() - */ - CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix& calcRectToOriginTransform( ::basegfx::B2DHomMatrix& o_transform, - const ::basegfx::B2DRange& i_srcRect, - const ::basegfx::B2DHomMatrix& i_transformation ); - - /** Check whether a given rectangle is within another - transformed rectangle. - - This method checks for polygonal containedness, i.e. the - transformed rectangle is not represented as an axis-alignd - rectangle anymore (like calcTransformedRectBounds()), but - polygonal. Thus, the insideness test is based on tight - bounds. - - @param rContainedRect - This rectangle is checked, whether it is fully within the - transformed rTransformRect. - - @param rTransformRect - This rectangle is transformed, and then checked whether it - fully contains rContainedRect. - - @param rTransformation - This transformation is applied to rTransformRect - */ - CANVASTOOLS_DLLPUBLIC bool isInside( const ::basegfx::B2DRange& rContainedRect, - const ::basegfx::B2DRange& rTransformRect, - const ::basegfx::B2DHomMatrix& rTransformation ); - - /** Clip a scroll to the given bound rect - - @param io_rSourceArea - Source area to scroll. The resulting clipped source area - is returned therein. - - @param io_rDestPoint - Destination point of the scroll (upper, left corner of - rSourceArea after the scroll). The new, resulting - destination point is returned therein.q - - @param o_ClippedAreas - Vector of rectangles in the destination area - coordinate system, which are clipped away from the source - area, and thus need extra updates (i.e. they are not - correctly copy from the scroll operation, since there was - no information about them in the source). - - @param rBounds - Bounds to clip against. - - @return false, if the resulting scroll area is empty - */ - CANVASTOOLS_DLLPUBLIC bool clipScrollArea( ::basegfx::B2IRange& io_rSourceArea, - ::basegfx::B2IPoint& io_rDestPoint, - ::std::vector< ::basegfx::B2IRange >& o_ClippedAreas, - const ::basegfx::B2IRange& rBounds ); - - /** Clip a blit between two differently surfaces. - - This method clips source and dest rect for a clip between - two differently clipped surfaces, such that the resulting - blit rects are fully within both clip areas. - - @param io_rSourceArea - Source area of the blit. Returned therein is the computed - clipped source area. - - @param io_rDestPoint - Dest area of the blit. Returned therein is the computed - clipped dest area. - - @param rSourceBounds - Clip bounds of the source surface - - @param rDestBounds - Clip bounds of the dest surface - - @return false, if the resulting blit is empty, i.e. fully - clipped away. - */ - CANVASTOOLS_DLLPUBLIC ::basegfx::B2IRange spritePixelAreaFromB2DRange( const ::basegfx::B2DRange& rRange ); - - /** Retrieve various internal properties of the actual canvas implementation. - - This method retrieves a bunch of internal, implementation- - and platform-dependent values from the canvas - implementation. Among them are for example operating - system window handles. The actual layout and content of - the returned sequence is dependent on the component - implementation, undocumented and subject to change. - - @param i_rxCanvas - Input parameter, the canvas representation for which the device information - is to be retrieveds - - @param o_rxParams - Output parameter, the sequence of Anys that hold the device parameters. Layout is as described above - - @return A reference to the resulting sequence of parameters - */ - CANVASTOOLS_DLLPUBLIC ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& getDeviceInfo( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas >& i_rxCanvas, - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& o_rxParams ); - - /** Return a color space for a default RGBA integer format - - Use this method for dead-simple bitmap implementations, - that map all their formats to 8888 RGBA color. - */ - CANVASTOOLS_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XIntegerBitmapColorSpace> getStdColorSpace(); - - /** Return a color space for a default RGB integer format - - Use this method for dead-simple bitmap implementations, - that map all their formats to 8888 RGB color (the last byte - is unused). - */ - CANVASTOOLS_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XIntegerBitmapColorSpace> getStdColorSpaceWithoutAlpha(); - - /** Return a memory layout for a default RGBA integer format - - Use this method for dead-simple bitmap implementations, - that map all their formats to 8888 RGBA color. - */ - CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::IntegerBitmapLayout getStdMemoryLayout( - const ::com::sun::star::geometry::IntegerSize2D& rBitmapSize ); - - /// Convert standard 8888 RGBA color to vcl color - CANVASTOOLS_DLLPUBLIC ::Color stdIntSequenceToColor( const ::com::sun::star::uno::Sequence& rColor ); - - /// Convert standard 8888 RGBA color to vcl color - CANVASTOOLS_DLLPUBLIC ::com::sun::star::uno::Sequence colorToStdIntSequence( const ::Color& rColor ); - - // Modeled closely after boost::numeric_cast, only that we - // issue some trace output here and throw a RuntimeException - - /** Cast numeric value into another (numeric) data type - - Apart from converting the numeric value, this template - also checks if any overflow, underflow, or sign - information is lost (if yes, it throws an - uno::RuntimeException. - */ - template< typename Target, typename Source > inline Target numeric_cast( Source arg ) - { - // typedefs abbreviating respective trait classes - typedef ::std::numeric_limits< Source > SourceLimits; - typedef ::std::numeric_limits< Target > TargetLimits; - -#undef min -#undef max - - if( ( arg<0 && !TargetLimits::is_signed) || // loosing the sign here - ( SourceLimits::is_signed && argTargetLimits::max() ) ) // overflow will happen - { -# if OSL_DEBUG_LEVEL > 2 - OSL_TRACE("numeric_cast detected data loss"); -#endif - throw ::com::sun::star::uno::RuntimeException( - "numeric_cast detected data loss", - NULL ); - } - - return static_cast(arg); - } - - CANVASTOOLS_DLLPUBLIC ::com::sun::star::awt::Rectangle getAbsoluteWindowRect( - const ::com::sun::star::awt::Rectangle& rRect, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2 >& xWin ); - - /** Retrieve for small bound marks around each corner of the given rectangle - */ - CANVASTOOLS_DLLPUBLIC ::basegfx::B2DPolyPolygon getBoundMarksPolyPolygon( const ::basegfx::B2DRange& rRange ); - - /** Calculate number of gradient "strips" to generate (takes - into account device resolution) - - @param nColorSteps - Maximal integer difference between all color stops, needed - for smooth gradient color differences - */ - CANVASTOOLS_DLLPUBLIC int calcGradientStepCount( ::basegfx::B2DHomMatrix& rTotalTransform, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, - const ::com::sun::star::rendering::Texture& texture, - int nColorSteps ); - - /** A very simplistic map for ASCII strings and arbitrary value - types. - - This class internally references a constant, static array of - sorted MapEntries, and performs a binary search to look up - values for a given query string. Note that this map is static, - i.e. not meant to be extented at runtime. - - @tpl ValueType - The value type this map should store, associated with an ASCII - string. - */ - template< typename ValueType > class ValueMap - { - public: - struct MapEntry - { - const char* maKey; - ValueType maValue; - }; - - /** Create a ValueMap for the given array of MapEntries. - - @param pMap - Pointer to a static array of MapEntries. Must - live longer than this object! Make absolutely sure that - the string entries passed via pMap are ASCII-only - - everything else might not yield correct string - comparisons, and thus will result in undefined behaviour. - - @param nEntries - Number of entries for pMap - - @param bCaseSensitive - Whether the map query should be performed case sensitive - or not. When bCaseSensitive is false, all MapEntry strings - must be lowercase! - */ - ValueMap( const MapEntry* pMap, - ::std::size_t nEntries, - bool bCaseSensitive ) : - mpMap( pMap ), - mnEntries( nEntries ), - mbCaseSensitive( bCaseSensitive ) - { -#ifdef DBG_UTIL - // Ensure that map entries are sorted (and all lowercase, if this - // map is case insensitive) - const OString aStr( pMap->maKey ); - if( !mbCaseSensitive && - aStr != aStr.toAsciiLowerCase() ) - { - OSL_TRACE("ValueMap::ValueMap(): Key %s is not lowercase", - pMap->maKey); - OSL_FAIL( "ValueMap::ValueMap(): Key is not lowercase" ); - } - - if( mnEntries > 1 ) - { - for( ::std::size_t i=0; imaKey, aSearchKey.maKey ) == 0 ) - { - // yep, correct entry found - o_rResult = pRes->maValue; - return true; - } - } - - // not found - return false; - } - - private: - static bool mapComparator( const MapEntry& rLHS, - const MapEntry& rRHS ) - { - return strcmp( rLHS.maKey, - rRHS.maKey ) < 0; - } - - const MapEntry* mpMap; - ::std::size_t mnEntries; - bool mbCaseSensitive; - }; - } -} - -#endif /* INCLUDED_CANVAS_CANVASTOOLS_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/canvastoolsdllapi.h b/canvas/inc/canvas/canvastoolsdllapi.h deleted file mode 100644 index ad96dec3ea7c..000000000000 --- a/canvas/inc/canvas/canvastoolsdllapi.h +++ /dev/null @@ -1,35 +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 _CANVAS_DLLAPI_H -#define _CANVAS_DLLAPI_H - -#include "sal/config.h" -#include "sal/types.h" - -#if defined(CANVASTOOLS_DLLIMPLEMENTATION) -#define CANVASTOOLS_DLLPUBLIC SAL_DLLPUBLIC_EXPORT -#else -#define CANVASTOOLS_DLLPUBLIC SAL_DLLPUBLIC_IMPORT -#endif -#define CANVASTOOLS_DLLPRIVATE SAL_DLLPRIVATE - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/debug.hxx b/canvas/inc/canvas/debug.hxx deleted file mode 100644 index 9fc5ad31711f..000000000000 --- a/canvas/inc/canvas/debug.hxx +++ /dev/null @@ -1,59 +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_CANVAS_DEBUG_HXX -#define INCLUDED_CANVAS_DEBUG_HXX - -// shared_ptr debugging -// -------------------- - -#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS - -# include -# include - -::std::size_t find_unreachable_objects( bool ); - -# if OSL_DEBUG_LEVEL > 2 -# include -# define SHARED_PTR_LEFTOVERS(a) OSL_TRACE("%s\n%s: Unreachable objects still use %d bytes\n", \ - BOOST_CURRENT_FUNCTION, a, \ - find_unreachable_objects(true) ) -# else -/** This macro shows how much memory is still used by shared_ptrs - - Use this macro at places in the code where normally all shared_ptr - objects should have been deleted. You'll get the number of bytes - still contained in those objects, which quite possibly are prevented - from deletion by circular references. - */ -# define SHARED_PTR_LEFTOVERS(a) OSL_TRACE("%s\n%s: Unreachable objects still use %d bytes\n", \ - BOOST_CURRENT_FUNCTION, a, \ - find_unreachable_objects(false) ) -# endif - -#else - -# define SHARED_PTR_LEFTOVERS(a) ((void)0) - -#endif - -#endif // ! defined(INCLUDED_CANVAS_DEBUG_HXX) - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/elapsedtime.hxx b/canvas/inc/canvas/elapsedtime.hxx deleted file mode 100644 index 8248e3408785..000000000000 --- a/canvas/inc/canvas/elapsedtime.hxx +++ /dev/null @@ -1,173 +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_CANVAS_ELAPSEDTIME_HXX -#define INCLUDED_CANVAS_ELAPSEDTIME_HXX - -#include - -#include "boost/shared_ptr.hpp" -#include - -namespace canvas -{ - namespace tools - { - /** Calculate elapsed time. - - This class provides several time-measurement and - -management functions. In its simplest use-case, it - measures the time from its creation. - */ - class CANVASTOOLS_DLLPUBLIC ElapsedTime - { - public: - /** Create a new ElapsedTime object - - The moment of construction starts the time - measurement. That means, a subsequent getElapsedTime() - call will return the time difference between object - creation and getElapsedTime() call. - */ - ElapsedTime(); - - /** Creates a new ElapsedTime object based on another - timer. - - The moment of construction starts the time - measurement. That means, a subsequent getElapsedTime() - call will return the time difference between object - creation and getElapsedTime() call. All time values - are not taken from the system's time base, but from - the provided timer. - */ - ElapsedTime( ::boost::shared_ptr const & pTimeBase ); - - /** Reset the time - - The instance of the reset() call starts the time - measurement from scratch. That means, a subsequent - getElapsedTime() call will return the time difference - between reset() and getElapsedTime() call. - */ - void reset(); - - /** Query the elapsed time - - This method returns the elapsed time in seconds - between either the construction of this object, or the - last reset() call, if any (but see the time modulation - methods below, for means to modify the otherwise - continuous flow of time). - - @return the elapsed time in seconds. - */ - double getElapsedTime() const; - - /** Pauses the running timer. - - This method stops the time, as returned by this - object, until continueTimer() is called. During this - period, getElapsedTime() will always return the same - time value (i.e. the instant when pauseTimer() was - called). - */ - void pauseTimer(); - - /** Continues the paused timer. - - This method re-enables the time flow, that is, time - starts running again for clients calling - getElapsedTime(). The (subtle) difference to the - holdTimer/releaseTimer() methods below is, that there - is no perceived time 'jump' between the pauseTimer() - call and the continueTimer() call, i.e. the time - starts over with the same value it has stopped on - pauseTimer(). - */ - void continueTimer(); - - /** Adjusts the timer, hold and pause times. - - This method modifies the time as returned by this - object by the specified amount. This affects the time - as returned by getElapsedTime(), regardless of the - mode (e.g. paused, or on hold). - - @param fOffset - This value will be added to the current time, i.e. the - next call to getElapsedTime() (when performed - immediately) will be adjusted by fOffset. - - @param bLimitToLastQueriedTime - Limits the given offset to the time that has been - taken via getElapsedTime() - */ - void adjustTimer( double fOffset, - bool bLimitToLastQueriedTime = true ); - - /** Holds the current time. - - This call makes the timer hold the current time - (e.g. getElapsedTime() will return the time when - holdTimer() was called), while the underlying time is - running on. When releaseTimer() is called, the time - will 'jump' to the then-current, underlying time. This - is equivalent to pressing the "interim time" button on - a stop watch, which shows this stopped time, while the - clock keeps running internally. - */ - void holdTimer(); - - /** Releases a held timer. - - After this call, the timer again returns the running - time on getElapsedTime(). - */ - void releaseTimer(); - - private: - static double getSystemTime(); - double getCurrentTime() const; - double getElapsedTimeImpl() const; // does not set m_fLastQueriedTime - - const ::boost::shared_ptr m_pTimeBase; - - /// To validate adjustTimer() calls with bLimitToLastQueriedTime=true - mutable double m_fLastQueriedTime; - - /// Start time, from which the difference to the time base is returned - double m_fStartTime; - - /// Instant, when last pause or hold started, relative to m_fStartTime - double m_fFrozenTime; - - /// True, when in pause mode - bool m_bInPauseMode; - - /// True, when in hold mode - bool m_bInHoldMode; - }; - - } -} - -#endif /* INCLUDED_CANVAS_ELAPSEDTIME_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/parametricpolypolygon.hxx b/canvas/inc/canvas/parametricpolypolygon.hxx deleted file mode 100644 index 2e8cb7af45fb..000000000000 --- a/canvas/inc/canvas/parametricpolypolygon.hxx +++ /dev/null @@ -1,161 +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_CANVAS_PARAMETRICPOLYPOLYGON_HXX -#define INCLUDED_CANVAS_PARAMETRICPOLYPOLYGON_HXX - -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace basegfx -{ - class B2DPolygon; - class B2DHomMatrix; -} - - -/* Definition of ParametricPolyPolygon class */ - -namespace canvas -{ - typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XParametricPolyPolygon2D, - ::com::sun::star::lang::XServiceInfo > ParametricPolyPolygon_Base; - - class CANVASTOOLS_DLLPUBLIC ParametricPolyPolygon : public ::comphelper::OBaseMutex, - public ParametricPolyPolygon_Base, - private ::boost::noncopyable - { - public: - enum GradientType - { - GRADIENT_LINEAR, - GRADIENT_ELLIPTICAL, - GRADIENT_RECTANGULAR - }; - - /** Structure of defining values for the ParametricPolyPolygon - - This is used to copy the state of the - ParametricPolyPolygon atomically. - */ - struct Values - { - Values( const ::basegfx::B2DPolygon& rGradientPoly, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& rColors, - const ::com::sun::star::uno::Sequence< double >& rStops, - double nAspectRatio, - GradientType eType ) : - maGradientPoly( rGradientPoly ), - mnAspectRatio( nAspectRatio ), - maColors( rColors ), - maStops( rStops ), - meType( eType ) - { - } - - /// Polygonal gradient shape (ignored for linear and axial gradient) - const ::basegfx::B2DPolygon maGradientPoly; - - /// Aspect ratio of gradient, affects scaling of innermost gradient polygon - const double mnAspectRatio; - - /// Gradient colors - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > > maColors; - - /// Gradient color stops - const ::com::sun::star::uno::Sequence< double > maStops; - - /// Type of gradient to render (as e.g. linear grads are not represented by maGradientPoly) - const GradientType meType; - }; - - static ::com::sun::star::uno::Sequence< OUString > getAvailableServiceNames(); - static ParametricPolyPolygon* create( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const OUString& rServiceName, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArgs ); - - /// Dispose all internal references - virtual void SAL_CALL disposing(); - - // XParametricPolyPolygon2D - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > SAL_CALL getOutline( double t ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getColor( double t ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getPointColor( const ::com::sun::star::geometry::RealPoint2D& point ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XColorSpace > SAL_CALL getColorSpace() throw (::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); - - /// Query all defining values of this object atomically - Values getValues() const; - - protected: - ~ParametricPolyPolygon(); // we're a ref-counted UNO class. _We_ destroy ourselves. - - private: - static ParametricPolyPolygon* createLinearHorizontalGradient( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, - const ::com::sun::star::uno::Sequence< double >& stops ); - static ParametricPolyPolygon* createEllipticalGradient( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, - const ::com::sun::star::uno::Sequence< double >& stops, - double fAspect ); - static ParametricPolyPolygon* createRectangularGradient( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, - const ::com::sun::star::uno::Sequence< double >& stops, - double fAspect ); - - /// Private, because objects can only be created from the static factories - ParametricPolyPolygon( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::basegfx::B2DPolygon& rGradientPoly, - GradientType eType, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, - const ::com::sun::star::uno::Sequence< double >& stops, - double nAspectRatio ); - ParametricPolyPolygon( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XGraphicDevice >& rDevice, - GradientType eType, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, - const ::com::sun::star::uno::Sequence< double >& stops ); - - ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XGraphicDevice > mxDevice; - - /// All defining values of this object - const Values maValues; - }; -} - -#endif /* INCLUDED_CANVAS_PARAMETRICPOLYPOLYGON_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/propertysethelper.hxx b/canvas/inc/canvas/propertysethelper.hxx deleted file mode 100644 index b90d9ef344e5..000000000000 --- a/canvas/inc/canvas/propertysethelper.hxx +++ /dev/null @@ -1,152 +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_CANVAS_PROPERTYSETHELPER_HXX -#define INCLUDED_CANVAS_PROPERTYSETHELPER_HXX - -#include -#include -#include - -#include -#include -#include - -#include - -namespace canvas -{ - /** Really simplistic XPropertySet helper for properties. - - This class provides easy access to properties, referenced via - ASCII strings. The name/property modification callbacks pairs - are passed into this class via a vector. Each time a property - is set or queried, the corresponding getter or setter callback - is called. - - Use this class as a delegate for the corresponding - XPropertySet methods, and take care of UNO XInterface and lock - handling by yourself. - - The core responsibility of this this class is the name/value - mapping for property sets. - */ - class CANVASTOOLS_DLLPUBLIC PropertySetHelper - { - public: - typedef boost::function0< ::com::sun::star::uno::Any > GetterType; - typedef boost::function1 SetterType; - struct Callbacks - { - GetterType getter; - SetterType setter; - }; - typedef tools::ValueMap< Callbacks > MapType; - typedef std::vector< MapType::MapEntry > InputMap; - - class MakeMap : public InputMap - { - public: - MakeMap(const char* name, - const GetterType& getter, - const SetterType& setter) - { - MapType::MapEntry aEntry={name, {getter, setter}}; - this->push_back(aEntry); - } - MakeMap(const char* name, - const GetterType& getter) - { - MapType::MapEntry aEntry={name, {getter, SetterType()}}; - this->push_back(aEntry); - } - MakeMap& operator()(const char* name, - const GetterType& getter, - const SetterType& setter) - { - MapType::MapEntry aEntry={name, {getter, setter}}; - this->push_back(aEntry); - return *this; - } - MakeMap& operator()(const char* name, - const GetterType& getter) - { - MapType::MapEntry aEntry={name, {getter, SetterType()}}; - this->push_back(aEntry); - return *this; - } - }; - - /** Create helper with zero properties - */ - PropertySetHelper(); - - /** Init helper with new name/value map - - @param rMap - Vector of name/function pointers. Each name is offered as - a property, and reading/writing to this property is passed - on to the given function pointer. - */ - void initProperties( const InputMap& rMap ); - - /** Add given properties to helper - - @param rMap - Vector of name/function pointers. Each name is offered as - a property, and reading/writing to this property is passed - on to the given function pointer. These name/function - pairs are added to the already existing ones. - */ - void addProperties( const InputMap& rMap ); - - /** Checks whether the given string corresponds to a valid - property name. - - @return true, if the given name maps to a known property. - */ - bool isPropertyName( const OUString& aPropertyName ) const; - - /** Request the currently active map - */ - const InputMap& getPropertyMap() const { return maMapEntries; } - - // XPropertySet implementation - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > getPropertySetInfo() const; - void setPropertyValue( const OUString& aPropertyName, - const ::com::sun::star::uno::Any& aValue ); - ::com::sun::star::uno::Any getPropertyValue( const OUString& PropertyName ) const; - void addPropertyChangeListener( const OUString& aPropertyName, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ); - void removePropertyChangeListener( const OUString& aPropertyName, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ); - void addVetoableChangeListener( const OUString& aPropertyName, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& xListener ); - void removeVetoableChangeListener( const OUString& aPropertyName, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& xListener ); - - private: - std::auto_ptr mpMap; - InputMap maMapEntries; - }; -} - -#endif /* INCLUDED_CANVAS_PROPERTYSETHELPER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/rendering/bitmap.hxx b/canvas/inc/canvas/rendering/bitmap.hxx deleted file mode 100644 index 295057bd832b..000000000000 --- a/canvas/inc/canvas/rendering/bitmap.hxx +++ /dev/null @@ -1,314 +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_CANVAS_BITMAP_HXX -#define INCLUDED_CANVAS_BITMAP_HXX - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace basegfx -{ - class B2IVector; - class B2DPoint; - class B2DHomMatrix; - class B2DPolyPolygon; -} - -namespace canvas -{ - class ImplBitmap; - - /** Bitmap class, with XCanvas-like render interface. - - This class provides a bitmap, that can be rendered into, - with an interface compatible to XCanvas. Furthermore, the - bitmaps held here can optionally be backed by (possibly - hw-accelerated) textures. - */ - class Bitmap - { - public: - /** Create bitmap with given size - - @param rSize - Size of the bitmap, in pixel - - @param rMgr - SurfaceProxyManager, to use for HW acceleration - - @param bWithAlpha - When true, the created bitmap will have an alpha channel, - false otherwise - */ - Bitmap( const ::basegfx::B2IVector& rSize, - const ISurfaceProxyManagerSharedPtr& rMgr, - bool bWithAlpha ); - ~Bitmap(); - - /// Query whether this bitmap contains alpha channel information - bool hasAlpha() const; - - /// Query size of the bitmap in pixel - ::basegfx::B2IVector getSize() const; - - ::com::sun::star::uno::Sequence< sal_Int8 > getData( - ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerRectangle2D& rect ); - - void setData( - const ::com::sun::star::uno::Sequence< sal_Int8 >& data, - const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerRectangle2D& rect ); - - void setPixel( - const ::com::sun::star::uno::Sequence< sal_Int8 >& color, - const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerPoint2D& pos ); - - ::com::sun::star::uno::Sequence< sal_Int8 > getPixel( - ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerPoint2D& pos ); - - /** Render the bitmap content to associated - SurfaceProxyManager's screen. - - @param fAlpha - Overall alpha for content - - @param rPos - Output position - - @param rTransform - Output transformation (does not affect output position) - */ - bool draw( double fAlpha, - const ::basegfx::B2DPoint& rPos, - const ::basegfx::B2DHomMatrix& rTransform ); - - /** Render the bitmap content to associated - SurfaceProxyManager's screen. - - @param fAlpha - Overall alpha for content - - @param rPos - Output position - - @param rArea - Subset of the surface to render. Coordinate system are - surface area pixel, given area will be clipped to the - surface bounds. - - @param rTransform - Output transformation (does not affect output position) - */ - bool draw( double fAlpha, - const ::basegfx::B2DPoint& rPos, - const ::basegfx::B2DRange& rArea, - const ::basegfx::B2DHomMatrix& rTransform ); - - /** Render the bitmap content to associated - SurfaceProxyManager's screen. - - @param fAlpha - Overall alpha for content - - @param rPos - Output position - - @param rClipPoly - Clip polygon for the surface. The clip polygon is also - subject to the output transformation. - - @param rTransform - Output transformation (does not affect output position) - */ - bool draw( double fAlpha, - const ::basegfx::B2DPoint& rPos, - const ::basegfx::B2DPolyPolygon& rClipPoly, - const ::basegfx::B2DHomMatrix& rTransform ); - - /** Clear whole bitmap with given color. - - This method sets every single pixel of the bitmap to the - specified color value. - */ - void clear( const ::com::sun::star::uno::Sequence< double >& color ); - - void fillB2DPolyPolygon( - const ::basegfx::B2DPolyPolygon& rPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); - - - // High-level drawing operations (from the XCanvas interface) - // ========================================================== - - /// See XCanvas interface - void drawPoint( const ::com::sun::star::geometry::RealPoint2D& aPoint, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); - /// See XCanvas interface - void drawLine( const ::com::sun::star::geometry::RealPoint2D& aStartPoint, - const ::com::sun::star::geometry::RealPoint2D& aEndPoint, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); - /// See XCanvas interface - void drawBezier( const ::com::sun::star::geometry::RealBezierSegment2D& aBezierSegment, - const ::com::sun::star::geometry::RealPoint2D& aEndPoint, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); - /// See XCanvas interface - ICachedPrimitiveSharedPtr drawPolyPolygon( - const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); - - /// See XCanvas interface - ICachedPrimitiveSharedPtr strokePolyPolygon( - const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, - const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ); - /** See XCanvas interface - - @param textureAnnotations - Vector of shared pointers to bitmap textures, - corresponding in indices to the textures - sequence. This is to decouple this interface from the - client's XBitmap-implementation class. - */ - ICachedPrimitiveSharedPtr strokeTexturedPolyPolygon( - const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, - const ::com::sun::star::uno::Sequence< - ::com::sun::star::rendering::Texture >& textures, - const ::std::vector< ::boost::shared_ptr >& textureAnnotations, - const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ); - /** See XCanvas interface - - @param textureAnnotations - Vector of shared pointers to bitmap textures, - corresponding in indices to the textures - sequence. This is to decouple this interface from the - client's XBitmap-implementation class. - */ - ICachedPrimitiveSharedPtr strokeTextureMappedPolyPolygon( - const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, - const ::com::sun::star::uno::Sequence< - ::com::sun::star::rendering::Texture >& textures, - const ::std::vector< ::boost::shared_ptr >& textureAnnotations, - const ::com::sun::star::uno::Reference< - ::com::sun::star::geometry::XMapping2D >& xMapping, - const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ); - /// See XCanvas interface - ICachedPrimitiveSharedPtr fillPolyPolygon( - const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); - /** See XCanvas interface - - @param textureAnnotations - Vector of shared pointers to bitmap textures, - corresponding in indices to the textures - sequence. This is to decouple this interface from the - client's XBitmap-implementation class. - */ - ICachedPrimitiveSharedPtr fillTexturedPolyPolygon( - const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, - const ::com::sun::star::uno::Sequence< - ::com::sun::star::rendering::Texture >& textures, - const ::std::vector< ::boost::shared_ptr >& textureAnnotations ); - /** See XCanvas interface - - @param textureAnnotations - Vector of shared pointers to bitmap textures, - corresponding in indices to the textures - sequence. This is to decouple this interface from the - client's XBitmap-implementation class. - */ - ICachedPrimitiveSharedPtr fillTextureMappedPolyPolygon( - const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, - const ::com::sun::star::uno::Sequence< - ::com::sun::star::rendering::Texture >& textures, - const ::std::vector< ::boost::shared_ptr >& textureAnnotations, - const ::com::sun::star::uno::Reference< - ::com::sun::star::geometry::XMapping2D >& xMapping ); - - /// See XCanvas interface - ICachedPrimitiveSharedPtr drawBitmap( - const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XBitmap >& xBitmap, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); - /// See XCanvas interface - ICachedPrimitiveSharedPtr drawBitmap( - const ::boost::shared_ptr& rImage, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); - - /// See XCanvas interface - ICachedPrimitiveSharedPtr drawBitmapModulated( - const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XBitmap >& xBitmap, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); - /// See XCanvas interface - ICachedPrimitiveSharedPtr drawBitmapModulated( - const ::boost::shared_ptr& rImage, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); - - private: - friend class ImplBitmap; - - const ::boost::scoped_ptr< ImplBitmap > mpImpl; - }; - - typedef ::boost::shared_ptr< Bitmap > BitmapSharedPtr; -} - -#endif /* INCLUDED_CANVAS_BITMAP_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/rendering/icachedprimitive.hxx b/canvas/inc/canvas/rendering/icachedprimitive.hxx deleted file mode 100644 index f15fed3e72e8..000000000000 --- a/canvas/inc/canvas/rendering/icachedprimitive.hxx +++ /dev/null @@ -1,60 +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_CANVAS_ICACHEDPRIMITIVE_HXX -#define INCLUDED_CANVAS_ICACHEDPRIMITIVE_HXX - -#include - -#include - - -namespace basegfx -{ - class B2IRange; - class B2IPoint; -} - -namespace canvas -{ - /** Objects with this interface are returned from every Bitmap - render operation. - - These objects can be used to implement the - rendering::XCachedPrimitive interface, which in turn caches - render state and objects to facilitate quick redraws. - */ - struct ICachedPrimitive - { - virtual ~ICachedPrimitive() {} - - /** Redraw the primitive with the given view state - - Note that the primitive will always be redrawn on - the bitmap it was created from. - */ - virtual sal_Int8 redraw( const ::com::sun::star::rendering::ViewState& aState ) const = 0; - }; - - typedef ::boost::shared_ptr< ICachedPrimitive > ICachedPrimitiveSharedPtr; -} - -#endif /* INCLUDED_CANVAS_ICACHEDPRIMITIVE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/rendering/icolorbuffer.hxx b/canvas/inc/canvas/rendering/icolorbuffer.hxx deleted file mode 100644 index 4226a9a6d759..000000000000 --- a/canvas/inc/canvas/rendering/icolorbuffer.hxx +++ /dev/null @@ -1,88 +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_CANVAS_ICOLORBUFFER_HXX -#define INCLUDED_CANVAS_ICOLORBUFFER_HXX - -#include - -#include - - -namespace canvas -{ - /** Interface for a raw memory pixel container - - Use this interface to represent a surface of raw pixel (e.g. a - bitmap) to the canvas rendering framework. - */ - struct IColorBuffer - { - /// The underlying pixel format for this buffer - enum Format - { - // 24-bit RGB pixel format, 8 bits per channel. - FMT_R8G8B8, - - // 32-bit ARGB pixel format with alpha, 8 bits per channel. - FMT_A8R8G8B8, - - // 32-bit RGB pixel format, 8 bits per channel. - FMT_X8R8G8B8, - - // for enum to 32bit - FMT_UNKNOWN = static_cast(-1) - }; - - virtual ~IColorBuffer() {} - - /** Get a pointer to the raw memory bits of the pixel - */ - virtual sal_uInt8* lock() const = 0; - - /** unlock previous locked buffer - */ - virtual void unlock() const = 0; - - /** Get width in pixel - */ - virtual sal_uInt32 getWidth() const = 0; - - /** Get height in pixel - */ - virtual sal_uInt32 getHeight() const = 0; - - /** Offset, in bytes, between consecutive scan lines of the bitmap. - If the stride is positive, the bitmap is top-down. - If the stride is negative, the bitmap is bottom-up. - The returned value is only valid while the buffer is locked. - */ - virtual sal_uInt32 getStride() const = 0; - - /** Get format of the color buffer - */ - virtual Format getFormat() const = 0; - }; - - typedef ::boost::shared_ptr< IColorBuffer > IColorBufferSharedPtr; -} - -#endif /* INCLUDED_CANVAS_ICOLORBUFFER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/rendering/irendermodule.hxx b/canvas/inc/canvas/rendering/irendermodule.hxx deleted file mode 100644 index 413320eb85e9..000000000000 --- a/canvas/inc/canvas/rendering/irendermodule.hxx +++ /dev/null @@ -1,143 +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_CANVAS_IRENDERMODULE_HXX -#define INCLUDED_CANVAS_IRENDERMODULE_HXX - -#include - -#include -#include - - -namespace basegfx -{ - class B2DRange; - class B2IRange; - class B2IVector; - class B2IPoint; -} - -namespace canvas -{ - struct ISurface; - - struct Vertex - { - float r,g,b,a; - float u,v; - float x,y,z; - }; - - /** Output module interface for backend render implementations. - - Implement this interface for each operating system- or - library-specific rendering backend, which needs coupling with - the canvas rendering framework (which can be shared between - all backend implementations). - */ - struct IRenderModule - { - /** Type of primitive passed to the render module via - pushVertex() - */ - enum PrimitiveType - { - PRIMITIVE_TYPE_UNKNOWN, - PRIMITIVE_TYPE_TRIANGLE, - PRIMITIVE_TYPE_QUAD - }; - - virtual ~IRenderModule() {} - - /// Lock rendermodule against concurrent access - virtual void lock() const = 0; - - /// Unlock rendermodule for concurrent access - virtual void unlock() const = 0; - - /** Maximal size of VRAM pages available - - This is typically the maximum texture size of the - hardware, or some arbitrary limit if the backend is - software. - */ - virtual ::basegfx::B2IVector getPageSize() = 0; - - /** Create a (possibly hardware-accelerated) surface - - @return a pointer to a surface, which is an abstraction of - a piece of (possibly hardware-accelerated) texture memory. - */ - virtual ::boost::shared_ptr createSurface( const ::basegfx::B2IVector& surfaceSize ) = 0; - - /** Begin rendering the given primitive. - - Each beginPrimitive() call must be matched with an - endPrimitive() call. - */ - virtual void beginPrimitive( PrimitiveType eType ) = 0; - - /** Finish rendering a primitive. - - Each beginPrimitive() call must be matched with an - endPrimitive() call. - */ - virtual void endPrimitive() = 0; - - /** Add given vertex to current primitive - - After issuing a beginPrimitive(), each pushVertex() adds a - vertex to the active primitive. - */ - virtual void pushVertex( const Vertex& vertex ) = 0; - - /** Query error status - - @returns true, if an error occurred during primitive - construction. - */ - virtual bool isError() = 0; - }; - - typedef ::boost::shared_ptr< IRenderModule > IRenderModuleSharedPtr; - - /// Little RAII wrapper for guarding access to IRenderModule interface - class RenderModuleGuard : private ::boost::noncopyable - { - public: - explicit RenderModuleGuard( const IRenderModuleSharedPtr& rRenderModule ) : - mpRenderModule( rRenderModule ) - { - mpRenderModule->lock(); - } - - ~RenderModuleGuard() - { - mpRenderModule->unlock(); - } - - private: - const IRenderModuleSharedPtr mpRenderModule; - }; -} - -#endif /* INCLUDED_CANVAS_IRENDERMODULE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/rendering/isurface.hxx b/canvas/inc/canvas/rendering/isurface.hxx deleted file mode 100644 index a79faf96a8c8..000000000000 --- a/canvas/inc/canvas/rendering/isurface.hxx +++ /dev/null @@ -1,82 +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_CANVAS_ISURFACE_HXX -#define INCLUDED_CANVAS_ISURFACE_HXX - -#include - -#include - - -namespace basegfx -{ - class B2IRange; - class B2IPoint; - class B2IVector; -} - -namespace canvas -{ - struct IColorBuffer; - - struct ISurface - { - virtual ~ISurface() {} - - /** Select texture behind this interface to be the current one - for primitive output. - */ - virtual bool selectTexture() = 0; - - /** Tells whether the surface is valid or not - */ - virtual bool isValid() = 0; - - /** Update surface content from given IColorBuffer - - This method updates the given subarea of the surface from - the given color buffer bits. - - @param rDestPos - Position in the surface, where the subset update should - have its left, top edge - - @param rSourceRect - Size and position of the rectangular subset update in the - source color buffer - - @param rSource - Source bits to use for the update - - @return true, if the update was successful - */ - virtual bool update( const ::basegfx::B2IPoint& rDestPos, - const ::basegfx::B2IRange& rSourceRect, - IColorBuffer& rSource ) = 0; - - virtual ::basegfx::B2IVector getSize() = 0; - }; - - typedef ::boost::shared_ptr< ISurface > ISurfaceSharedPtr; -} - -#endif /* INCLUDED_CANVAS_ISURFACE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/rendering/isurfaceproxy.hxx b/canvas/inc/canvas/rendering/isurfaceproxy.hxx deleted file mode 100644 index f8db605a38d3..000000000000 --- a/canvas/inc/canvas/rendering/isurfaceproxy.hxx +++ /dev/null @@ -1,107 +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_CANVAS_ISURFACEPROXY_HXX -#define INCLUDED_CANVAS_ISURFACEPROXY_HXX - -#include - -#include - -namespace basegfx -{ - class B2DRange; - class B2DPoint; - class B2DPolyPolygon; - class B2DHomMatrix; -} - -namespace canvas -{ - struct ISurfaceProxy - { - virtual ~ISurfaceProxy() {} - - /** Notify the proxy that the color buffer has changed - */ - virtual void setColorBufferDirty() = 0; - - /** Render the surface content to screen. - - @param fAlpha - Overall alpha for content - - @param rPos - Output position - - @param rTransform - Output transformation (does not affect output position) - */ - virtual bool draw( double fAlpha, - const ::basegfx::B2DPoint& rPos, - const ::basegfx::B2DHomMatrix& rTransform ) = 0; - - /** Render the surface content to screen. - - @param fAlpha - Overall alpha for content - - @param rPos - Output position - - @param rArea - Subset of the surface to render. Coordinate system are - surface area pixel, given area will be clipped to the - surface bounds. - - @param rTransform - Output transformation (does not affect output position) - */ - virtual bool draw( double fAlpha, - const ::basegfx::B2DPoint& rPos, - const ::basegfx::B2DRange& rArea, - const ::basegfx::B2DHomMatrix& rTransform ) = 0; - - /** Render the surface content to screen. - - @param fAlpha - Overall alpha for content - - @param rPos - Output position - - @param rClipPoly - Clip polygon for the surface. The clip polygon is also - subject to the output transformation. - - @param rTransform - Output transformation (does not affect output position) - */ - virtual bool draw( double fAlpha, - const ::basegfx::B2DPoint& rPos, - const ::basegfx::B2DPolyPolygon& rClipPoly, - const ::basegfx::B2DHomMatrix& rTransform ) = 0; - }; - - typedef ::boost::shared_ptr< ISurfaceProxy > ISurfaceProxySharedPtr; -} - -#endif /* INCLUDED_CANVAS_ISURFACEPROXY_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/rendering/isurfaceproxymanager.hxx b/canvas/inc/canvas/rendering/isurfaceproxymanager.hxx deleted file mode 100644 index 98c7795a293e..000000000000 --- a/canvas/inc/canvas/rendering/isurfaceproxymanager.hxx +++ /dev/null @@ -1,74 +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_CANVAS_ISURFACEPROXYMANAGER_HXX -#define INCLUDED_CANVAS_ISURFACEPROXYMANAGER_HXX - -#include -#include - -#include - -#include - -namespace canvas -{ - struct ISurfaceProxy; - - /** Manager interface, which handles surface proxy objects. - - Typically, each canvas instantiation has one - SurfaceProxyManager object, to handle their surfaces. Surfaces - itself are opaque objects, which encapsulate a framebuffer to - render upon, plus an optional (possibly accelerated) texture. - */ - struct ISurfaceProxyManager - { - virtual ~ISurfaceProxyManager() {} - - /** Create a surface proxy for a color buffer. - - The whole idea is build around the concept that you create - some arbitrary buffer which contains the image data and - tell the texture manager about it. From there on you can - draw into this image using any kind of graphics api you - want. In the technical sense we allocate some space in - local videomemory or AGP memory which will be filled on - demand, which means if there exists any rendering - operation that needs to read from this memory location. - This method creates a logical hardware surface object - which uses the given color buffer as the image source. - Internally this texture may even be distributed to several - real hardware surfaces. - */ - virtual ::boost::shared_ptr< ISurfaceProxy > createSurfaceProxy( - const IColorBufferSharedPtr& pBuffer ) const = 0; - }; - - typedef ::boost::shared_ptr< ISurfaceProxyManager > ISurfaceProxyManagerSharedPtr; - - - /** Create a surface proxy for the given render module. - */ - CANVASTOOLS_DLLPUBLIC ISurfaceProxyManagerSharedPtr createSurfaceProxyManager( const IRenderModuleSharedPtr& rRenderModule ); -} - -#endif /* INCLUDED_CANVAS_ISURFACEPROXYMANAGER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/spriteredrawmanager.hxx b/canvas/inc/canvas/spriteredrawmanager.hxx deleted file mode 100644 index 7609b4f8f4a6..000000000000 --- a/canvas/inc/canvas/spriteredrawmanager.hxx +++ /dev/null @@ -1,429 +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_CANVAS_SPRITEREDRAWMANAGER_HXX -#define INCLUDED_CANVAS_SPRITEREDRAWMANAGER_HXX - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include - -/* Definition of SpriteRedrawManager class */ - -namespace canvas -{ - /** This class manages smooth SpriteCanvas updates - - Use this class to handle the ::canvas::SpriteSurface methods, - that track and process sprite update events. Recorded update - events are later grouped by connected areas (i.e. all sprites - that somehow overlap over a rectangular area are grouped - together); the forEachSpriteArea() method calls the passed - functor for each of those connected areas. - - Note that, although this class generally works with IEEE - doubles, the calculation of connected areas happens in the - integer domain - it is generally expected that repaints can - only be divided at pixel boundaries, without causing visible - artifacts. Therefore, sprites that touch the same pixel (but - don't necessarily have the same floating point coordinates - there) will reside in a common sprite area and handled - together in the forEachSpriteArea functor call. - */ - class CANVASTOOLS_DLLPUBLIC SpriteRedrawManager : private ::boost::noncopyable - { - public: - /** Data container for the connected components list - */ - class SpriteInfo - { - public: - ~SpriteInfo() {} - - /** Create sprite info - - @param rRef - Sprite this info represents (might be the NULL ref) - - @param rTrueUpdateArea - True (un-rounded) update area this sprite has recorded - - @param bNeedsUpdate - When false, this sprite is not a member of the change - record list. Thus, it only needs redraw if within the - update area of other, changed sprites. - - @internal - */ - SpriteInfo( const Sprite::Reference& rRef, - const ::basegfx::B2DRange& rTrueUpdateArea, - bool bNeedsUpdate ) : - mpSprite( rRef ), - maTrueUpdateArea( rTrueUpdateArea ), - mbNeedsUpdate( bNeedsUpdate ), - mbIsPureMove( false ) - { - } - - /** Create sprite info, specify move type - - @param rRef - Sprite this info represents (might be the NULL ref) - - @param rTrueUpdateArea - True (un-rounded) update area this sprite has recorded - - @param bNeedsUpdate - When false, this sprite is not a member of the change - record list. Thus, it only needs redraw if within the - update area of other, changed sprites. - - @param bIsPureMove - When true, this sprite is _only_ moved, no other - changes happened. - - @internal - */ - SpriteInfo( const Sprite::Reference& rRef, - const ::basegfx::B2DRange& rTrueUpdateArea, - bool bNeedsUpdate, - bool bIsPureMove ) : - mpSprite( rRef ), - maTrueUpdateArea( rTrueUpdateArea ), - mbNeedsUpdate( bNeedsUpdate ), - mbIsPureMove( bIsPureMove ) - { - } - - const Sprite::Reference& getSprite() const { return mpSprite; } - - // #i61843# need to return by value here, to be used safely from bind - ::basegfx::B2DRange getUpdateArea() const { return maTrueUpdateArea; } - bool needsUpdate() const { return mbNeedsUpdate; } - bool isPureMove() const { return mbIsPureMove; } - - private: - Sprite::Reference mpSprite; - ::basegfx::B2DRange maTrueUpdateArea; - bool mbNeedsUpdate; - bool mbIsPureMove; - }; - - - /** Helper struct for SpriteTracer template - - This struct stores change information to a sprite's visual - appearance (move, content updated, and the like). - */ - struct SpriteChangeRecord - { - typedef enum{ none=0, move, update } ChangeType; - - SpriteChangeRecord() : - meChangeType( none ), - mpAffectedSprite(), - maOldPos(), - maUpdateArea() - { - } - - SpriteChangeRecord( const Sprite::Reference& rSprite, - const ::basegfx::B2DPoint& rOldPos, - const ::basegfx::B2DPoint& rNewPos, - const ::basegfx::B2DVector& rSpriteSize ) : - meChangeType( move ), - mpAffectedSprite( rSprite ), - maOldPos( rOldPos ), - maUpdateArea( rNewPos.getX(), - rNewPos.getY(), - rNewPos.getX() + rSpriteSize.getX(), - rNewPos.getY() + rSpriteSize.getY() ) - { - } - - SpriteChangeRecord( const Sprite::Reference& rSprite, - const ::basegfx::B2DPoint& rPos, - const ::basegfx::B2DRange& rUpdateArea ) : - meChangeType( update ), - mpAffectedSprite( rSprite ), - maOldPos( rPos ), - maUpdateArea( rUpdateArea ) - { - } - - Sprite::Reference getSprite() const { return mpAffectedSprite; } - - ChangeType meChangeType; - Sprite::Reference mpAffectedSprite; - ::basegfx::B2DPoint maOldPos; - ::basegfx::B2DRange maUpdateArea; - }; - - typedef ::std::vector< SpriteChangeRecord > VectorOfChangeRecords; - typedef ::std::list< Sprite::Reference > ListOfSprites; - typedef ::basegfx::B2DConnectedRanges< SpriteInfo > SpriteConnectedRanges; - typedef SpriteConnectedRanges::ComponentType AreaComponent; - typedef SpriteConnectedRanges::ConnectedComponents UpdateArea; - typedef ::std::vector< Sprite::Reference > VectorOfSprites; - - SpriteRedrawManager(); - - /** Must be called when user of this object gets - disposed. Frees all internal references. - */ - void disposing(); - - /** Functor, to be used from forEachSpriteArea - */ - template< typename Functor > struct AreaUpdateCaller - { - AreaUpdateCaller( Functor& rFunc, - const SpriteRedrawManager& rManager ) : - mrFunc( rFunc ), - mrManager( rManager ) - { - } - - void operator()( const UpdateArea& rUpdateArea ) - { - mrManager.handleArea( mrFunc, rUpdateArea ); - } - - Functor& mrFunc; - const SpriteRedrawManager& mrManager; - }; - - /** Call given functor for each sprite area that needs an - update. - - This method calls the given functor for each update area - (calculated from the sprite change records). - - @tpl Functor - Must provide the following four methods: -
-            void backgroundPaint( ::basegfx::B2DRange aUpdateRect );
-            void scrollUpdate( ::basegfx::B2DRange& o_rMoveStart,
-                               ::basegfx::B2DRange& o_rMoveEnd,
-                               UpdateArea           aUpdateArea );
-            void opaqueUpdate( const ::basegfx::B2DRange&                          rTotalArea,
-                               const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
-            void genericUpdate( const ::basegfx::B2DRange&                          rTotalArea,
-                                const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
-            
- The backgroundPaint() method is called to simply repaint - background content, the scrollUpdate() method is used to - scroll a given area, and paint background in the uncovered - areas, the opaqueUpdate() method is called when a sprite - can be painted in the given area without taking background - content into account, and finally, genericUpdate() is - called for complex updates, where first the background and - then all sprites consecutively have to be repainted. - */ - template< typename Functor > void forEachSpriteArea( Functor& rFunc ) const - { - SpriteConnectedRanges aUpdateAreas; - - setupUpdateAreas( aUpdateAreas ); - - aUpdateAreas.forEachAggregate( - AreaUpdateCaller< Functor >( rFunc, *this ) ); - } - - /** Call given functor for each active sprite. - - This method calls the given functor for each active - sprite, in the order of sprite priority. - - @tpl Functor - Must provide a Functor::operator( Sprite::Reference& ) - method. - */ - template< typename Functor > void forEachSprite( const Functor& rFunc ) const - { - ::std::for_each( maSprites.begin(), - maSprites.end(), - rFunc ); - } - - /// Clear sprite change records (typically directly after a screen update) - void clearChangeRecords(); - - // SpriteSurface interface, is delegated to e.g. from SpriteCanvas - void showSprite( const Sprite::Reference& rSprite ); - void hideSprite( const Sprite::Reference& rSprite ); - void moveSprite( const Sprite::Reference& rSprite, - const ::basegfx::B2DPoint& rOldPos, - const ::basegfx::B2DPoint& rNewPos, - const ::basegfx::B2DVector& rSpriteSize ); - void updateSprite( const Sprite::Reference& rSprite, - const ::basegfx::B2DPoint& rPos, - const ::basegfx::B2DRange& rUpdateArea ); - - /** Internal, handles each distinct component for forEachAggregate() - - The reason why this must be public is that it needs to be - accessible from the AreaUpdateCaller functor. - - @internal - */ - template< typename Functor > void handleArea( Functor& rFunc, - const UpdateArea& rUpdateArea ) const - { - // check whether this area contains changed sprites at all - // (if not, just ignore it) - if( areSpritesChanged( rUpdateArea ) ) - { - // at least one of the sprites actually needs an - // update - process whole area. - - // check whether this area could be handled special - // (background paint, direct update, scroll, etc.) - ::basegfx::B2DRange aMoveStart; - ::basegfx::B2DRange aMoveEnd; - if( rUpdateArea.maComponentList.empty() ) - { - rFunc.backgroundPaint( rUpdateArea.maTotalBounds ); - } - else - { - // cache number of sprites in this area (it's a - // list, and both isAreaUpdateScroll() and - // isAreaUpdateOpaque() need it). - const ::std::size_t nNumSprites( - rUpdateArea.maComponentList.size() ); - - if( isAreaUpdateScroll( aMoveStart, - aMoveEnd, - rUpdateArea, - nNumSprites ) ) - { - rFunc.scrollUpdate( aMoveStart, - aMoveEnd, - rUpdateArea ); - } - else - { - // potentially, more than a single sprite - // involved. Have to sort component lists for - // sprite prio. - VectorOfSprites aSortedUpdateSprites; - SpriteConnectedRanges::ComponentListType::const_iterator aCurr( - rUpdateArea.maComponentList.begin() ); - const SpriteConnectedRanges::ComponentListType::const_iterator aEnd( - rUpdateArea.maComponentList.end() ); - while( aCurr != aEnd ) - { - const Sprite::Reference& rSprite( aCurr->second.getSprite() ); - if( rSprite.is() ) - aSortedUpdateSprites.push_back( rSprite ); - - ++aCurr; - } - - ::std::sort( aSortedUpdateSprites.begin(), - aSortedUpdateSprites.end(), - SpriteWeakOrder() ); - - if( isAreaUpdateOpaque( rUpdateArea, - nNumSprites ) ) - { - rFunc.opaqueUpdate( rUpdateArea.maTotalBounds, - aSortedUpdateSprites ); - } - else - { - rFunc.genericUpdate( rUpdateArea.maTotalBounds, - aSortedUpdateSprites ); - } - } - } - } - } - - private: - /** Central method of this class. Calculates the set of - disjunct components that need an update. - */ - void setupUpdateAreas( SpriteConnectedRanges& rUpdateAreas ) const; - - bool areSpritesChanged( const UpdateArea& rUpdateArea ) const; - - bool isAreaUpdateNotOpaque( const ::basegfx::B2DRange& rUpdateRect, - const AreaComponent& rComponent ) const; - - bool isAreaUpdateOpaque( const UpdateArea& rUpdateArea, - ::std::size_t nNumSprites ) const; - - /** Check whether given update area can be handled by a simple - scroll - - @param o_rMoveStart - Start rect of the move - - @param o_rMoveEnd - End rect of the move. The content must be moved from start - to end rect - - @param rUpdateArea - Area to check for scroll update optimization - */ - bool isAreaUpdateScroll( ::basegfx::B2DRange& o_rMoveStart, - ::basegfx::B2DRange& o_rMoveEnd, - const UpdateArea& rUpdateArea, - ::std::size_t nNumSprites ) const; - - - ListOfSprites maSprites; // list of active - // sprite - // objects. this - // list is only - // used for full - // repaints, - // otherwise, we - // rely on the - // active sprites - // itself to notify - // us. - - VectorOfChangeRecords maChangeRecords; // vector of - // sprites - // changes - // since last - // updateScreen() - // call - }; -} - -#endif /* INCLUDED_CANVAS_SPRITEREDRAWMANAGER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/vclwrapper.hxx b/canvas/inc/canvas/vclwrapper.hxx deleted file mode 100644 index 330e88cb88ad..000000000000 --- a/canvas/inc/canvas/vclwrapper.hxx +++ /dev/null @@ -1,141 +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_CANVAS_VCLWRAPPER_HXX -#define INCLUDED_CANVAS_VCLWRAPPER_HXX - -#include -#include - -namespace canvas -{ - namespace vcltools - { - /** This helper template wraps VCL objects, and protects - object deletion with the Solar mutex. All other operations - are unprotected, this must be handled by client code. - - The reason for this template is the fact that VCL objects - hold by value in uno::Reference-handled classes are - deleted without having the chance to get inbetween and - lock the solar mutex. - - This template handles that problem transparently, the only - inconvenience is the fact that object member access now - has to be performed via operator->, since . is not - overloadable. - - Otherwise, the template preserves the value semantics of - the wrapped object, that is, copy operations are performed - not by copying pointers, but by copying the underlying - object. This includes constness, i.e. on a const - VCLObject, only const methods of the wrapped object can be - called. Simply imagine this to be a value object of type - "template argument", with the only peculiarity that - member/method access is performed by operator-> instead of - the non-existing "operator.". - */ - template< class _Wrappee > class VCLObject - { - public: - typedef _Wrappee Wrappee; - - VCLObject() : - mpWrappee( new Wrappee() ) - { - } - - // no explicit here. VCLObjects should be freely - // constructible with Wrappees, and AFAIK there is no other - // implicit conversion path that could cause harm here - VCLObject( Wrappee* pWrappee ) : - mpWrappee( pWrappee ) - { - } - - // This object has value semantics, thus, forward copy - // to wrappee - VCLObject( const VCLObject& rOrig ) - { - if( rOrig.mpWrappee ) - mpWrappee = new Wrappee( *rOrig.mpWrappee ); - else - mpWrappee = NULL; - } - - // This object has value semantics, thus, forward copy - // to wrappee - VCLObject( const Wrappee& rOrig ) : - mpWrappee( new Wrappee( rOrig ) ) - { - } - - // This object has value semantics, thus, forward - // assignment to wrappee - VCLObject& operator=( const VCLObject& rhs ) - { - if( mpWrappee ) - { - if( rhs.mpWrappee ) - *mpWrappee = *rhs.mpWrappee; - } - else - { - if( rhs.mpWrappee ) - mpWrappee = new Wrappee( *rhs.mpWrappee ); - } - - return *this; - } - - ~VCLObject() - { - // This here is the whole purpose of the template: - // protecting object deletion with the solar mutex - SolarMutexGuard aGuard; - - if( mpWrappee ) - delete mpWrappee; - } - - Wrappee* operator->() { return mpWrappee; } - const Wrappee* operator->() const { return mpWrappee; } - - Wrappee& operator*() { return *mpWrappee; } - const Wrappee& operator*() const { return *mpWrappee; } - - Wrappee& get() { return *mpWrappee; } - const Wrappee& get() const { return *mpWrappee; } - - void swap( VCLObject& rOther ) - { - ::std::swap( mpWrappee, rOther.mpWrappee ); - } - - private: - - Wrappee* mpWrappee; - }; - - } -} - -#endif /* INCLUDED_CANVAS_VCLWRAPPER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/verbosetrace.hxx b/canvas/inc/canvas/verbosetrace.hxx deleted file mode 100644 index d3810c4deaad..000000000000 --- a/canvas/inc/canvas/verbosetrace.hxx +++ /dev/null @@ -1,32 +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_CANVAS_VERBOSETRACE_HXX -#define INCLUDED_CANVAS_VERBOSETRACE_HXX - -#include "sal/config.h" - -#include "sal/detail/log.h" - -#define VERBOSE_TRACE(...) \ - SAL_DETAIL_INFO_IF_FORMAT(true, "canvas.level2", __VA_ARGS__) - -#endif /* INCLUDED_CANVAS_VERBOSETRACE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/inc/canvas/verifyinput.hxx b/canvas/inc/canvas/verifyinput.hxx deleted file mode 100644 index 07d72b32ff6c..000000000000 --- a/canvas/inc/canvas/verifyinput.hxx +++ /dev/null @@ -1,667 +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_CANVAS_VERIFYINPUT_HXX -#define INCLUDED_CANVAS_VERIFYINPUT_HXX - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -namespace com { namespace sun { namespace star { namespace geometry -{ - struct RealPoint2D; - struct RealSize2D; - struct RealBezierSegment2D; - struct RealRectangle2D; - struct AffineMatrix2D; - struct Matrix2D; - struct IntegerPoint2D; - struct IntegerSize2D; - struct IntegerRectangle2D; -} } } } - -namespace com { namespace sun { namespace star { namespace rendering -{ - struct RenderState; - struct StrokeAttributes; - struct Texture; - struct ViewState; - struct IntegerBitmapLayout; - struct FontRequest; - struct FontInfo; - class XCanvas; -} } } } - - -namespace canvas -{ - namespace tools - { - - // Input checking facilities - // =================================================================== - - // This header provides methods to check all common - // css::rendering::* method input parameters against - // compliance to the API specification. - - /** Verify that the given transformation contains valid floating point - values. - - @param rMatrix - Matrix to check - - @param xIf - The interface that should be reported as the one - generating the exception. - - @param nArgPos - Argument position on the call site (i.e. the position of - the argument, checked here, on the UNO interface - method. Counting starts at 0). - - @throws an lang::IllegalArgumentException, if anything is wrong - */ - CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::AffineMatrix2D& rMatrix, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf, - ::sal_Int16 nArgPos ); - - /** Verify that the given transformation contains valid floating point - values. - - @param rMatrix - Matrix to check - - @param xIf - The interface that should be reported as the one - generating the exception. - - @param nArgPos - Argument position on the call site (i.e. the position of - the argument, checked here, on the UNO interface - method. Counting starts at 0). - - @throws an lang::IllegalArgumentException, if anything is wrong - */ - CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::Matrix2D& rMatrix, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf, - ::sal_Int16 nArgPos ); - - /** Verify that the given point contains valid floating point - values. - - @param rPoint - Point to check - - @param xIf - The interface that should be reported as the one - generating the exception. - - @param nArgPos - Argument position on the call site (i.e. the position of - the argument, checked here, on the UNO interface - method. Counting starts at 0). - - @throws an lang::IllegalArgumentException, if anything is wrong - */ - CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::RealPoint2D& rPoint, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf, - ::sal_Int16 nArgPos ); - - /** Verify that the given bezier segment contains valid - floating point values. - - @param rSegment - Segment to check - - @param xIf - The interface that should be reported as the one - generating the exception. - - @param nArgPos - Argument position on the call site (i.e. the position of - the argument, checked here, on the UNO interface - method. Counting starts at 0). - - @throws an lang::IllegalArgumentException, if anything is wrong - */ - CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::RealBezierSegment2D& rSegment, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf, - ::sal_Int16 nArgPos ); - - /** Verify that the given point contains valid floating point - values. - - @param rPoint - Point to check - - @param xIf - The interface that should be reported as the one - generating the exception. - - @param nArgPos - Argument position on the call site (i.e. the position of - the argument, checked here, on the UNO interface - method. Counting starts at 0). - - @throws an lang::IllegalArgumentException, if anything is wrong - */ - CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::RealPoint2D& rPoint, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf, - ::sal_Int16 nArgPos ); - - /** Verify that the given rectangle contains valid floating - point values. - - @param rRect - Rect to check - - @param xIf - The interface that should be reported as the one - generating the exception. - - @param nArgPos - Argument position on the call site (i.e. the position of - the argument, checked here, on the UNO interface - method. Counting starts at 0). - - @throws an lang::IllegalArgumentException, if anything is wrong - */ - CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::RealRectangle2D& rRect, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf, - ::sal_Int16 nArgPos ); - - /** Basic check for view state validity. - - @param viewState - Viewstate to check - - @param xIf - The interface that should be reported as the one - generating the exception. - - @param nArgPos - Argument position on the call site (i.e. the position of - the argument, checked here, on the UNO interface - method. Counting starts at 0). - - @throws an lang::IllegalArgumentException, if anything is wrong - */ - CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::ViewState& viewState, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf, - ::sal_Int16 nArgPos ); - - /** Basic check for render state validity. - - @param renderState - Renderstate to check - - @param xIf - The interface that should be reported as the one - generating the exception. - - @param nArgPos - Argument position on the call site (i.e. the position of - the argument, checked here, on the UNO interface - method. Counting starts at 0). - - @param nMinColorComponents - Minimal number of color components available in - RenderState::DeviceColor - - @throws an lang::IllegalArgumentException, if anything is wrong - */ - CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::RenderState& renderState, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf, - ::sal_Int16 nArgPos, - sal_Int32 nMinColorComponents=0 ); - - /** Basic check for stroke attributes validity. - - @param strokeAttributes - Attributes to check - - @param xIf - The interface that should be reported as the one - generating the exception. - - @param nArgPos - Argument position on the call site (i.e. the position of - the argument, checked here, on the UNO interface - method. Counting starts at 0). - - @throws an lang::IllegalArgumentException, if anything is wrong - */ - CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf, - ::sal_Int16 nArgPos ); - - /** Basic check for texture validity. - - @param texture - Texture to check - - @param xIf - The interface that should be reported as the one - generating the exception. - - @param nArgPos - Argument position on the call site (i.e. the position of - the argument, checked here, on the UNO interface - method. Counting starts at 0). - - @throws an lang::IllegalArgumentException, if anything is wrong - */ - CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::Texture& texture, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf, - ::sal_Int16 nArgPos ); - - /** Basic check for bitmap layout validity. - - @param bitmapLayout - Bitmap layout to check - - @param xIf - The interface that should be reported as the one - generating the exception. - - @param nArgPos - Argument position on the call site (i.e. the position of - the argument, checked here, on the UNO interface - method. Counting starts at 0). - - @throws an lang::IllegalArgumentException, if anything is wrong - */ - CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf, - ::sal_Int16 nArgPos ); - - /** Basic check for font info validity. - - @param fontInfo - Font info to check - - @param xIf - The interface that should be reported as the one - generating the exception. - - @param nArgPos - Argument position on the call site (i.e. the position of - the argument, checked here, on the UNO interface - method. Counting starts at 0). - - @throws an lang::IllegalArgumentException, if anything is wrong - */ - CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::FontInfo& fontInfo, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf, - ::sal_Int16 nArgPos ); - - /** Basic check for font request validity. - - @param fontRequest - Font request to check - - @param xIf - The interface that should be reported as the one - generating the exception. - - @param nArgPos - Argument position on the call site (i.e. the position of - the argument, checked here, on the UNO interface - method. Counting starts at 0). - - @throws an lang::IllegalArgumentException, if anything is wrong - */ - CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::FontRequest& fontRequest, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf, - ::sal_Int16 nArgPos ); - - /** Templatized check for uno::Reference validity. - - @param rRef - Reference to check against non-NILness - - @param xIf - The interface that should be reported as the one - generating the exception. - - @param nArgPos - Argument position on the call site (i.e. the position of - the argument, checked here, on the UNO interface - method. Counting starts at 0). - - @throws an lang::IllegalArgumentException, if anything is wrong - */ - template< class Interface > void verifyInput( - const ::com::sun::star::uno::Reference< Interface >& rRef, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf, - ::sal_Int16 nArgPos ) - { - (void)pStr; (void)xIf; (void)nArgPos; - - if( !rRef.is() ) - { -#if OSL_DEBUG_LEVEL > 0 - throw ::com::sun::star::lang::IllegalArgumentException( - OUString::createFromAscii(pStr) + ": reference is NULL", - xIf, - nArgPos ); -#else - throw ::com::sun::star::lang::IllegalArgumentException(); -#endif - } - } - - /** Templatized check for content-of-sequence validity. - - @param rSequence - Sequence of things to check - - @param xIf - The interface that should be reported as the one - generating the exception. - - @param nArgPos - Argument position on the call site (i.e. the position of - the argument, checked here, on the UNO interface - method. Counting starts at 0). - - @throws an lang::IllegalArgumentException, if anything is wrong - */ - template< typename SequenceContent > void verifyInput( - const ::com::sun::star::uno::Sequence< SequenceContent >& rSequence, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf, - ::sal_Int16 nArgPos ) - { - const SequenceContent* pCurr = rSequence.getConstArray(); - const SequenceContent* pEnd = pCurr + rSequence.getLength(); - while( pCurr != pEnd ) - verifyInput( *pCurr++, pStr, xIf, nArgPos ); - } - - /// Catch-all, to handle cases that DON'T need input checking (i.e. the Integer geometry ones) - template< typename T > void verifyInput( const T& /*rDummy*/, - const char* /*pStr*/, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& /*xIf*/, - ::sal_Int16 /*nArgPos*/ ) - { - } - - // TODO(Q2): Employ some template arglist magic here, to avoid - // this duplication of code... - - template< typename Arg0 > void verifyArgs( const Arg0& rArg0, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf ) - { - verifyInput( rArg0, pStr, xIf, 0 ); - } - - template< typename Arg0, - typename Arg1 > void verifyArgs( const Arg0& rArg0, - const Arg1& rArg1, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf ) - { - verifyInput( rArg0, pStr, xIf, 0 ); - verifyInput( rArg1, pStr, xIf, 1 ); - } - - template< typename Arg0, - typename Arg1, - typename Arg2 > void verifyArgs( const Arg0& rArg0, - const Arg1& rArg1, - const Arg2& rArg2, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf ) - { - verifyInput( rArg0, pStr, xIf, 0 ); - verifyInput( rArg1, pStr, xIf, 1 ); - verifyInput( rArg2, pStr, xIf, 2 ); - } - - template< typename Arg0, - typename Arg1, - typename Arg2, - typename Arg3 > void verifyArgs( const Arg0& rArg0, - const Arg1& rArg1, - const Arg2& rArg2, - const Arg3& rArg3, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf ) - { - verifyInput( rArg0, pStr, xIf, 0 ); - verifyInput( rArg1, pStr, xIf, 1 ); - verifyInput( rArg2, pStr, xIf, 2 ); - verifyInput( rArg3, pStr, xIf, 3 ); - } - - template< typename Arg0, - typename Arg1, - typename Arg2, - typename Arg3, - typename Arg4 > void verifyArgs( const Arg0& rArg0, - const Arg1& rArg1, - const Arg2& rArg2, - const Arg3& rArg3, - const Arg4& rArg4, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf ) - { - verifyInput( rArg0, pStr, xIf, 0 ); - verifyInput( rArg1, pStr, xIf, 1 ); - verifyInput( rArg2, pStr, xIf, 2 ); - verifyInput( rArg3, pStr, xIf, 3 ); - verifyInput( rArg4, pStr, xIf, 4 ); - } - - template< typename Arg0, - typename Arg1, - typename Arg2, - typename Arg3, - typename Arg4, - typename Arg5 > void verifyArgs( const Arg0& rArg0, - const Arg1& rArg1, - const Arg2& rArg2, - const Arg3& rArg3, - const Arg4& rArg4, - const Arg5& rArg5, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf ) - { - verifyInput( rArg0, pStr, xIf, 0 ); - verifyInput( rArg1, pStr, xIf, 1 ); - verifyInput( rArg2, pStr, xIf, 2 ); - verifyInput( rArg3, pStr, xIf, 3 ); - verifyInput( rArg4, pStr, xIf, 4 ); - verifyInput( rArg5, pStr, xIf, 5 ); - } - - template< typename Arg0, - typename Arg1, - typename Arg2, - typename Arg3, - typename Arg4, - typename Arg5, - typename Arg6 > void verifyArgs( const Arg0& rArg0, - const Arg1& rArg1, - const Arg2& rArg2, - const Arg3& rArg3, - const Arg4& rArg4, - const Arg5& rArg5, - const Arg6& rArg6, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf ) - { - verifyInput( rArg0, pStr, xIf, 0 ); - verifyInput( rArg1, pStr, xIf, 1 ); - verifyInput( rArg2, pStr, xIf, 2 ); - verifyInput( rArg3, pStr, xIf, 3 ); - verifyInput( rArg4, pStr, xIf, 4 ); - verifyInput( rArg5, pStr, xIf, 5 ); - verifyInput( rArg6, pStr, xIf, 6 ); - } - - - /** Range checker, which throws ::com::sun::star::lang::IllegalArgument exception, when - range is violated - */ - template< typename NumType > inline void verifyRange( NumType arg, NumType lowerBound, NumType upperBound ) - { - if( arg < lowerBound || - arg > upperBound ) - { - throw ::com::sun::star::lang::IllegalArgumentException(); - } - } - - /** Range checker, which throws ::com::sun::star::lang::IllegalArgument exception, when - range is violated - - The checked range is half open, i.e. only bound by the specified value. - - @param arg - Arg to check - - @param bound - Bound to check against - - @param bLowerBound - When true, given bound is the lower bound. When false, - given bound is the upper bound. - */ - template< typename NumType > inline void verifyRange( NumType arg, NumType bound, bool bLowerBound=true ) - { - if( (bLowerBound && arg < bound) || - (!bLowerBound && arg > bound) ) - { - throw ::com::sun::star::lang::IllegalArgumentException(); - } - } - - /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when - index range is violated - */ - template< typename NumType > inline void verifyIndexRange( NumType arg, NumType lowerBound, NumType upperBound ) - { - if( arg < lowerBound || - arg > upperBound ) - { - throw ::com::sun::star::lang::IndexOutOfBoundsException(); - } - } - - /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when - index range is violated - - @param rect - Rect to verify - - @param size - Given rectangle must be within ((0,0), (size.Width, size.Height)) - */ - CANVASTOOLS_DLLPUBLIC void verifyIndexRange( const ::com::sun::star::geometry::IntegerRectangle2D& rect, - const ::com::sun::star::geometry::IntegerSize2D& size ); - - /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when - index range is violated - - @param pos - Position to verify - - @param size - Given position must be within ((0,0), (size.Width, size.Height)) - */ - CANVASTOOLS_DLLPUBLIC void verifyIndexRange( const ::com::sun::star::geometry::IntegerPoint2D& pos, - const ::com::sun::star::geometry::IntegerSize2D& size ); - - /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when - the size is negative or null - - @param size - Size to verify - */ - CANVASTOOLS_DLLPUBLIC void verifyBitmapSize( const ::com::sun::star::geometry::IntegerSize2D& size, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf ); - - /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when - the size is negative or null - - @param size - Size to verify - */ - CANVASTOOLS_DLLPUBLIC void verifySpriteSize( const ::com::sun::star::geometry::RealSize2D& size, - const char* pStr, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XInterface >& xIf ); - } -} - -#endif /* INCLUDED_CANVAS_VERIFYINPUT_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit