diff options
24 files changed, 0 insertions, 2718 deletions
diff --git a/Repository.mk b/Repository.mk index 60c0170de6b8..296ffc8aa96f 100644 --- a/Repository.mk +++ b/Repository.mk @@ -642,10 +642,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,UNOLIBS_OOO,OOO, \ localebe1 \ ucpexpand1 \ )) -$(eval $(call gb_Helper_register_libraries,UNOLIBS_OOO, \ - directx5canvas \ - nullcanvas \ -)) $(eval $(call gb_Helper_register_libraries,UNOLIBS_URE, \ testtools_cppobj \ diff --git a/canvas/Library_nullcanvas.mk b/canvas/Library_nullcanvas.mk deleted file mode 100644 index 863696fdcc9d..000000000000 --- a/canvas/Library_nullcanvas.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 -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -$(eval $(call gb_Library_Library,nullcanvas)) - -$(eval $(call gb_Library_set_componentfile,nullcanvas,canvas/source/null/nullcanvas)) - -$(eval $(call gb_Library_use_external,nullcanvas,boost_headers)) - -$(eval $(call gb_Library_use_sdk_api,nullcanvas)) - -$(eval $(call gb_Library_use_libraries,nullcanvas,\ - basegfx \ - canvastools \ - comphelper \ - cppu \ - cppuhelper \ - sal \ - vcl \ - $(gb_UWINAPI) \ -)) - -$(eval $(call gb_Library_add_exception_objects,nullcanvas,\ - canvas/source/null/null_canvasbitmap \ - canvas/source/null/null_canvascustomsprite \ - canvas/source/null/null_canvasfont \ - canvas/source/null/null_canvashelper \ - canvas/source/null/null_devicehelper \ - canvas/source/null/null_spritecanvas \ - canvas/source/null/null_spritecanvashelper \ - canvas/source/null/null_spritehelper \ - canvas/source/null/null_textlayout \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/canvas/Module_canvas.mk b/canvas/Module_canvas.mk index a678fafa5f0a..59acf9699d06 100644 --- a/canvas/Module_canvas.mk +++ b/canvas/Module_canvas.mk @@ -31,7 +31,6 @@ $(eval $(call gb_Module_Module,canvas)) $(eval $(call gb_Module_add_targets,canvas,\ Library_canvasfactory \ Library_canvastools \ - Library_nullcanvas \ Library_simplecanvas \ Library_vclcanvas \ )) diff --git a/canvas/source/null/null_canvasbitmap.cxx b/canvas/source/null/null_canvasbitmap.cxx deleted file mode 100644 index 296a63745d34..000000000000 --- a/canvas/source/null/null_canvasbitmap.cxx +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <canvas/debug.hxx> -#include <tools/diagnose_ex.h> -#include <canvas/canvastools.hxx> - -#include "null_canvasbitmap.hxx" - - -using namespace ::com::sun::star; - -namespace nullcanvas -{ - CanvasBitmap::CanvasBitmap( const ::basegfx::B2ISize& rSize, - const DeviceRef& rDevice, - bool bHasAlpha ) : - mpDevice( rDevice ) - { - ENSURE_OR_THROW( mpDevice.is(), - "CanvasBitmap::CanvasBitmap(): Invalid surface or device" ); - - maCanvasHelper.init( rSize, - *mpDevice.get(), - bHasAlpha ); - } - - void CanvasBitmap::disposeThis() - { - mpDevice.clear(); - - // forward to parent - CanvasBitmap_Base::disposeThis(); - } - -#define IMPLEMENTATION_NAME "NullCanvas.CanvasBitmap" -#define SERVICE_NAME "com.sun.star.rendering.CanvasBitmap" - - OUString SAL_CALL CanvasBitmap::getImplementationName( ) throw (uno::RuntimeException) - { - return OUString( IMPLEMENTATION_NAME ); - } - - sal_Bool SAL_CALL CanvasBitmap::supportsService( const OUString& ServiceName ) throw (uno::RuntimeException) - { - return ServiceName == SERVICE_NAME; - } - - uno::Sequence< OUString > SAL_CALL CanvasBitmap::getSupportedServiceNames( ) throw (uno::RuntimeException) - { - uno::Sequence< OUString > aRet(1); - aRet[0] = SERVICE_NAME; - - return aRet; - } - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_canvasbitmap.hxx b/canvas/source/null/null_canvasbitmap.hxx deleted file mode 100644 index 22ca05daf8da..000000000000 --- a/canvas/source/null/null_canvasbitmap.hxx +++ /dev/null @@ -1,87 +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 _NULLCANVAS_CANVASBITMAP_HXX -#define _NULLCANVAS_CANVASBITMAP_HXX - -#include <cppuhelper/compbase3.hxx> - -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/rendering/XBitmapCanvas.hpp> -#include <com/sun/star/rendering/XIntegerBitmap.hpp> - -#include <basegfx/vector/b2isize.hxx> - -#include <boost/shared_ptr.hpp> - -#include <canvas/base/integerbitmapbase.hxx> -#include <canvas/base/disambiguationhelper.hxx> - -#include "null_canvashelper.hxx" -#include "null_spritecanvas.hxx" -#include "null_usagecounter.hxx" - - -/* Definition of CanvasBitmap class */ - -namespace nullcanvas -{ - typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::rendering::XBitmapCanvas, - ::com::sun::star::rendering::XIntegerBitmap, - ::com::sun::star::lang::XServiceInfo > CanvasBitmapBase_Base; - typedef ::canvas::IntegerBitmapBase< ::canvas::DisambiguationHelper< CanvasBitmapBase_Base >, - CanvasHelper, - ::osl::MutexGuard, - ::cppu::OWeakObject > CanvasBitmap_Base; - - class CanvasBitmap : public CanvasBitmap_Base, - private UsageCounter< CanvasBitmap > - { - public: - /** Create a canvas bitmap for the given surface - - @param rSize - Size of the bitmap - - @param rDevice - Reference device, with which bitmap should be compatible - */ - CanvasBitmap( const ::basegfx::B2ISize& rSize, - const DeviceRef& rDevice, - bool bHasAlpha ); - - /// Dispose all internal references - virtual void disposeThis(); - - // 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); - - private: - /** MUST hold here, too, since CanvasHelper only contains a - raw pointer (without refcounting) - */ - DeviceRef mpDevice; - }; -} - -#endif /* _NULLCANVAS_CANVASBITMAP_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_canvascustomsprite.cxx b/canvas/source/null/null_canvascustomsprite.cxx deleted file mode 100644 index ae305482e3e5..000000000000 --- a/canvas/source/null/null_canvascustomsprite.cxx +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <canvas/debug.hxx> -#include <tools/diagnose_ex.h> -#include <canvas/verbosetrace.hxx> - -#include <rtl/logfile.hxx> -#include <rtl/math.hxx> - -#include <canvas/canvastools.hxx> - -#include <basegfx/matrix/b2dhommatrix.hxx> -#include <basegfx/point/b2dpoint.hxx> - -#include "null_canvascustomsprite.hxx" -#include "null_spritecanvas.hxx" - - -using namespace ::com::sun::star; - -namespace nullcanvas -{ - CanvasCustomSprite::CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize, - const SpriteCanvasRef& rRefDevice ) : - mpSpriteCanvas( rRefDevice ) - { - ENSURE_OR_THROW( rRefDevice.get(), - "CanvasCustomSprite::CanvasCustomSprite(): Invalid sprite canvas" ); - - maCanvasHelper.init( ::basegfx::B2ISize( - ::canvas::tools::roundUp( rSpriteSize.Width ), - ::canvas::tools::roundUp( rSpriteSize.Height ) ), - *rRefDevice.get(), - true ); - - maSpriteHelper.init( rSpriteSize, - rRefDevice ); - } - - void CanvasCustomSprite::disposeThis() - { - ::osl::MutexGuard aGuard( m_aMutex ); - - mpSpriteCanvas.clear(); - - // forward to parent - CanvasCustomSpriteBaseT::disposeThis(); - } - - void CanvasCustomSprite::redraw() const - { - ::osl::MutexGuard aGuard( m_aMutex ); - - maSpriteHelper.redraw( mbSurfaceDirty ); - } - -#define IMPLEMENTATION_NAME "NullCanvas.CanvasCustomSprite" -#define SERVICE_NAME "com.sun.star.rendering.CanvasCustomSprite" - - OUString SAL_CALL CanvasCustomSprite::getImplementationName() throw( uno::RuntimeException ) - { - return OUString( IMPLEMENTATION_NAME ); - } - - sal_Bool SAL_CALL CanvasCustomSprite::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException ) - { - return ServiceName == SERVICE_NAME; - } - - uno::Sequence< OUString > SAL_CALL CanvasCustomSprite::getSupportedServiceNames() throw( uno::RuntimeException ) - { - uno::Sequence< OUString > aRet(1); - aRet[0] = SERVICE_NAME; - - return aRet; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_canvascustomsprite.hxx b/canvas/source/null/null_canvascustomsprite.hxx deleted file mode 100644 index 38b2985b4688..000000000000 --- a/canvas/source/null/null_canvascustomsprite.hxx +++ /dev/null @@ -1,130 +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 _NULLCANVAS_CANVASCUSTOMSPRITE_HXX -#define _NULLCANVAS_CANVASCUSTOMSPRITE_HXX - -#include <cppuhelper/compbase4.hxx> -#include <comphelper/uno3.hxx> - -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/rendering/XCustomSprite.hpp> -#include <com/sun/star/rendering/XIntegerBitmap.hpp> -#include <com/sun/star/rendering/XPolyPolygon2D.hpp> - -#include <basegfx/point/b2dpoint.hxx> -#include <basegfx/vector/b2isize.hxx> -#include <basegfx/matrix/b2dhommatrix.hxx> - -#include <canvas/base/disambiguationhelper.hxx> -#include <canvas/base/canvascustomspritebase.hxx> - -#include "sprite.hxx" -#include "null_canvashelper.hxx" -#include "null_spritehelper.hxx" -#include "null_spritecanvas.hxx" -#include "null_usagecounter.hxx" - - -namespace nullcanvas -{ - typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XCustomSprite, - ::com::sun::star::rendering::XBitmapCanvas, - ::com::sun::star::rendering::XIntegerBitmap, - ::com::sun::star::lang::XServiceInfo > CanvasCustomSpriteBase_Base; - /** Mixin Sprite - - Have to mixin the Sprite interface before deriving from - ::canvas::CanvasCustomSpriteBase, as this template should - already implement some of those interface methods. - - The reason why this appears kinda convoluted is the fact that - we cannot specify non-IDL types as WeakComponentImplHelperN - template args, and furthermore, don't want to derive - ::canvas::CanvasCustomSpriteBase directly from - ::canvas::Sprite (because derivees of - ::canvas::CanvasCustomSpriteBase have to explicitly forward - the XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS) - anyway). Basically, ::canvas::CanvasCustomSpriteBase should - remain a base class that provides implementation, not to - enforce any specific interface on its derivees. - */ - class CanvasCustomSpriteSpriteBase_Base : public ::canvas::DisambiguationHelper< CanvasCustomSpriteBase_Base >, - public Sprite - { - }; - - typedef ::canvas::CanvasCustomSpriteBase< CanvasCustomSpriteSpriteBase_Base, - SpriteHelper, - CanvasHelper, - ::osl::MutexGuard, - ::cppu::OWeakObject > CanvasCustomSpriteBaseT; - - /* Definition of CanvasCustomSprite class */ - - class CanvasCustomSprite : public CanvasCustomSpriteBaseT, - private UsageCounter< CanvasCustomSprite > - { - public: - /** Create a custom sprite - - @param rSpriteSize - Size of the sprite in pixel - - @param rRefDevice - Associated output device - - @param rSpriteCanvas - Target canvas - - @param rDevice - Target DX device - */ - CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize, - const SpriteCanvasRef& rRefDevice ); - - virtual void disposeThis(); - - // Forwarding the XComponent implementation to the - // cppu::ImplHelper templated base - // Classname Base doing refcount Base implementing the XComponent interface - // | | | - // V V V - DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( CanvasCustomSprite, CanvasCustomSpriteBase_Base, ::cppu::WeakComponentImplHelperBase ); - - // 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 ); - - // Sprite - virtual void redraw() const; - - private: - /** MUST hold here, too, since CanvasHelper only contains a - raw pointer (without refcounting) - */ - SpriteCanvasRef mpSpriteCanvas; - }; -} - -#endif /* _NULLCANVAS_CANVASCUSTOMSPRITE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_canvasfont.cxx b/canvas/source/null/null_canvasfont.cxx deleted file mode 100644 index 985d4b90f58e..000000000000 --- a/canvas/source/null/null_canvasfont.cxx +++ /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 . - */ - -#include "null_canvasfont.hxx" -#include "null_textlayout.hxx" -#include "null_spritecanvas.hxx" - -#include <com/sun/star/rendering/XSpriteCanvas.hpp> -#include <com/sun/star/rendering/PanoseWeight.hpp> - -using namespace ::com::sun::star; - -namespace nullcanvas -{ - CanvasFont::CanvasFont( const rendering::FontRequest& rFontRequest, - const uno::Sequence< beans::PropertyValue >& /*extraFontProperties*/, - const geometry::Matrix2D& fontMatrix ) : - CanvasFont_Base( m_aMutex ), - maFontRequest( rFontRequest ), - maFontMatrix( fontMatrix ) - { - } - - void SAL_CALL CanvasFont::disposing() - { - ::osl::MutexGuard aGuard( m_aMutex ); - } - - uno::Reference< rendering::XTextLayout > SAL_CALL CanvasFont::createTextLayout( const rendering::StringContext& aText, - sal_Int8 nDirection, - sal_Int64 nRandomSeed ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - return new TextLayout( aText, nDirection, nRandomSeed, ImplRef( this ) ); - } - - uno::Sequence< double > SAL_CALL CanvasFont::getAvailableSizes( ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // TODO - return uno::Sequence< double >(); - } - - uno::Sequence< beans::PropertyValue > SAL_CALL CanvasFont::getExtraFontProperties( ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // TODO - return uno::Sequence< beans::PropertyValue >(); - } - - rendering::FontRequest SAL_CALL CanvasFont::getFontRequest( ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - return maFontRequest; - } - - rendering::FontMetrics SAL_CALL CanvasFont::getFontMetrics( ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // TODO - return rendering::FontMetrics(); - } - -#define SERVICE_NAME "com.sun.star.rendering.CanvasFont" -#define IMPLEMENTATION_NAME "NullCanvas::CanvasFont" - - OUString SAL_CALL CanvasFont::getImplementationName() throw( uno::RuntimeException ) - { - return OUString( IMPLEMENTATION_NAME ); - } - - sal_Bool SAL_CALL CanvasFont::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException ) - { - return ServiceName == SERVICE_NAME; - } - - uno::Sequence< OUString > SAL_CALL CanvasFont::getSupportedServiceNames() throw( uno::RuntimeException ) - { - uno::Sequence< OUString > aRet(1); - aRet[0] = SERVICE_NAME; - - return aRet; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_canvasfont.hxx b/canvas/source/null/null_canvasfont.hxx deleted file mode 100644 index 271713b29972..000000000000 --- a/canvas/source/null/null_canvasfont.hxx +++ /dev/null @@ -1,85 +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 _NULLCANVAS_CANVASFONT_HXX -#define _NULLCANVAS_CANVASFONT_HXX - -#include <comphelper/implementationreference.hxx> - -#include <cppuhelper/compbase2.hxx> -#include <comphelper/broadcasthelper.hxx> - -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/rendering/XCanvas.hpp> -#include <com/sun/star/rendering/XCanvasFont.hpp> - -#include <rtl/ref.hxx> - -#include <boost/shared_ptr.hpp> -#include <boost/utility.hpp> - -#include "null_usagecounter.hxx" - - -/* Definition of CanvasFont class */ - -namespace nullcanvas -{ - typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XCanvasFont, - ::com::sun::star::lang::XServiceInfo > CanvasFont_Base; - - class CanvasFont : public ::comphelper::OBaseMutex, - public CanvasFont_Base, - private UsageCounter< CanvasFont >, - private ::boost::noncopyable - { - public: - typedef ::comphelper::ImplementationReference< - CanvasFont, - ::com::sun::star::rendering::XCanvasFont > ImplRef; - - CanvasFont( 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 ); - - /// Dispose all internal references - virtual void SAL_CALL disposing(); - - // XCanvasFont - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XTextLayout > SAL_CALL createTextLayout( const ::com::sun::star::rendering::StringContext& aText, sal_Int8 nDirection, sal_Int64 nRandomSeed ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::rendering::FontRequest SAL_CALL getFontRequest( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::rendering::FontMetrics SAL_CALL getFontMetrics( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getAvailableSizes( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getExtraFontProperties( ) 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 ); - - private: - ::com::sun::star::rendering::FontRequest maFontRequest; - ::com::sun::star::geometry::Matrix2D maFontMatrix; - }; - -} - -#endif /* _NULLCANVAS_CANVASFONT_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_canvashelper.cxx b/canvas/source/null/null_canvashelper.cxx deleted file mode 100644 index cad406d09517..000000000000 --- a/canvas/source/null/null_canvashelper.cxx +++ /dev/null @@ -1,318 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <canvas/debug.hxx> -#include <tools/diagnose_ex.h> - -#include <rtl/logfile.hxx> -#include <rtl/math.hxx> - -#include <com/sun/star/util/Endianness.hpp> -#include <com/sun/star/rendering/TexturingMode.hpp> -#include <com/sun/star/rendering/CompositeOperation.hpp> -#include <com/sun/star/rendering/RepaintResult.hpp> -#include <com/sun/star/rendering/PathCapType.hpp> -#include <com/sun/star/rendering/PathJoinType.hpp> - -#include <basegfx/matrix/b2dhommatrix.hxx> -#include <basegfx/point/b2dpoint.hxx> -#include <basegfx/tools/canvastools.hxx> - -#include <comphelper/sequence.hxx> -#include <canvas/canvastools.hxx> - -#include "null_spritecanvas.hxx" -#include "null_canvasfont.hxx" -#include "null_textlayout.hxx" -#include "null_canvashelper.hxx" - -#include <algorithm> - - -using namespace ::com::sun::star; - -namespace nullcanvas -{ - CanvasHelper::CanvasHelper() : - mpDevice( NULL ), - maSize(), - mbHaveAlpha() - { - } - - void CanvasHelper::disposing() - { - mpDevice = NULL; - } - - void CanvasHelper::init( const ::basegfx::B2ISize& rSize, - SpriteCanvas& rDevice, - bool bHasAlpha ) - { - mpDevice = &rDevice; - maSize = rSize; - mbHaveAlpha = bHasAlpha; - } - - void CanvasHelper::clear() - { - } - - void CanvasHelper::drawPoint( const rendering::XCanvas* /*pCanvas*/, - const geometry::RealPoint2D& /*aPoint*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/ ) - { - } - - void CanvasHelper::drawLine( const rendering::XCanvas* /*pCanvas*/, - const geometry::RealPoint2D& /*aPoint1*/, - const geometry::RealPoint2D& /*aPoint2*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/ ) - { - } - - void CanvasHelper::drawBezier( const rendering::XCanvas* /*pCanvas*/, - const geometry::RealBezierSegment2D& /*aBezierSegment*/, - const geometry::RealPoint2D& /*aEndPoint*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/ ) - { - } - - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawPolyPolygon( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/ ) - { - // TODO(P1): Provide caching here. - return uno::Reference< rendering::XCachedPrimitive >(NULL); - } - - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokePolyPolygon( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/, - const rendering::StrokeAttributes& /*strokeAttributes*/ ) - { - // TODO(P1): Provide caching here. - return uno::Reference< rendering::XCachedPrimitive >(NULL); - } - - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokeTexturedPolyPolygon( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/, - const uno::Sequence< rendering::Texture >& /*textures*/, - const rendering::StrokeAttributes& /*strokeAttributes*/ ) - { - // TODO - return uno::Reference< rendering::XCachedPrimitive >(NULL); - } - - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokeTextureMappedPolyPolygon( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/, - const uno::Sequence< rendering::Texture >& /*textures*/, - const uno::Reference< geometry::XMapping2D >& /*xMapping*/, - const rendering::StrokeAttributes& /*strokeAttributes*/ ) - { - // TODO - return uno::Reference< rendering::XCachedPrimitive >(NULL); - } - - uno::Reference< rendering::XPolyPolygon2D > CanvasHelper::queryStrokeShapes( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/, - const rendering::StrokeAttributes& /*strokeAttributes*/ ) - { - // TODO - return uno::Reference< rendering::XPolyPolygon2D >(NULL); - } - - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillPolyPolygon( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/ ) - { - // TODO(P1): Provide caching here. - return uno::Reference< rendering::XCachedPrimitive >(NULL); - } - - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillTexturedPolyPolygon( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/, - const uno::Sequence< rendering::Texture >& /*textures*/ ) - { - // TODO(P1): Provide caching here. - return uno::Reference< rendering::XCachedPrimitive >(NULL); - } - - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillTextureMappedPolyPolygon( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/, - const uno::Sequence< rendering::Texture >& /*textures*/, - const uno::Reference< geometry::XMapping2D >& /*xMapping*/ ) - { - // TODO - return uno::Reference< rendering::XCachedPrimitive >(NULL); - } - - uno::Reference< rendering::XCanvasFont > CanvasHelper::createFont( const rendering::XCanvas* /*pCanvas*/, - const rendering::FontRequest& fontRequest, - const uno::Sequence< beans::PropertyValue >& extraFontProperties, - const geometry::Matrix2D& fontMatrix ) - { - return uno::Reference< rendering::XCanvasFont >( - new CanvasFont(fontRequest, extraFontProperties, fontMatrix ) ); - } - - uno::Sequence< rendering::FontInfo > CanvasHelper::queryAvailableFonts( const rendering::XCanvas* /*pCanvas*/, - const rendering::FontInfo& /*aFilter*/, - const uno::Sequence< beans::PropertyValue >& /*aFontProperties*/ ) - { - // TODO - return uno::Sequence< rendering::FontInfo >(); - } - - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawText( const rendering::XCanvas* /*pCanvas*/, - const rendering::StringContext& /*text*/, - const uno::Reference< rendering::XCanvasFont >& /*xFont*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/, - sal_Int8 /*textDirection*/ ) - { - return uno::Reference< rendering::XCachedPrimitive >(NULL); - } - - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawTextLayout( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XTextLayout >& xLayoutetText, - const rendering::ViewState& viewState, - const rendering::RenderState& renderState ) - { - ENSURE_OR_THROW( xLayoutetText.is(), - "CanvasHelper::drawTextLayout: layout is NULL"); - - TextLayout* pTextLayout = - dynamic_cast< TextLayout* >( xLayoutetText.get() ); - - ENSURE_OR_THROW( pTextLayout, - "CanvasHelper::drawTextLayout(): TextLayout not compatible with this canvas" ); - - pTextLayout->draw( viewState, - renderState, - mpDevice ); - - return uno::Reference< rendering::XCachedPrimitive >(NULL); - } - - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmap( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XBitmap >& /*xBitmap*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/ ) - { - // TODO(P1): Provide caching here. - return uno::Reference< rendering::XCachedPrimitive >(NULL); - } - - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmapModulated( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XBitmap >& /*xBitmap*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/ ) - { - // TODO(P1): Provide caching here. - return uno::Reference< rendering::XCachedPrimitive >(NULL); - } - - uno::Reference< rendering::XGraphicDevice > CanvasHelper::getDevice() - { - return uno::Reference< rendering::XGraphicDevice >(mpDevice); - } - - void CanvasHelper::copyRect( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XBitmapCanvas >& /*sourceCanvas*/, - const geometry::RealRectangle2D& /*sourceRect*/, - const rendering::ViewState& /*sourceViewState*/, - const rendering::RenderState& /*sourceRenderState*/, - const geometry::RealRectangle2D& /*destRect*/, - const rendering::ViewState& /*destViewState*/, - const rendering::RenderState& /*destRenderState*/ ) - { - // TODO(F2): copyRect NYI - } - - geometry::IntegerSize2D CanvasHelper::getSize() - { - if( !mpDevice ) - geometry::IntegerSize2D(1, 1); // we're disposed - - return ::basegfx::unotools::integerSize2DFromB2ISize( maSize ); - } - - uno::Reference< rendering::XBitmap > CanvasHelper::getScaledBitmap( const geometry::RealSize2D& /*newSize*/, - sal_Bool /*beFast*/ ) - { - // TODO(F1): - return uno::Reference< rendering::XBitmap >(); - } - - uno::Sequence< sal_Int8 > CanvasHelper::getData( rendering::IntegerBitmapLayout& /*bitmapLayout*/, - const geometry::IntegerRectangle2D& /*rect*/ ) - { - // TODO - return uno::Sequence< sal_Int8 >(); - } - - void CanvasHelper::setData( const uno::Sequence< sal_Int8 >& /*data*/, - const rendering::IntegerBitmapLayout& /*bitmapLayout*/, - const geometry::IntegerRectangle2D& /*rect*/ ) - { - } - - void CanvasHelper::setPixel( const uno::Sequence< sal_Int8 >& /*color*/, - const rendering::IntegerBitmapLayout& /*bitmapLayout*/, - const geometry::IntegerPoint2D& /*pos*/ ) - { - } - - uno::Sequence< sal_Int8 > CanvasHelper::getPixel( rendering::IntegerBitmapLayout& /*bitmapLayout*/, - const geometry::IntegerPoint2D& /*pos*/ ) - { - return uno::Sequence< sal_Int8 >(); - } - - rendering::IntegerBitmapLayout CanvasHelper::getMemoryLayout() - { - return ::canvas::tools::getStdMemoryLayout(getSize()); - } - - bool CanvasHelper::hasAlpha() const - { - return mbHaveAlpha; - } - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_canvashelper.hxx b/canvas/source/null/null_canvashelper.hxx deleted file mode 100644 index 556cd7f51ea1..000000000000 --- a/canvas/source/null/null_canvashelper.hxx +++ /dev/null @@ -1,262 +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 _NULLCANVAS_CANVASHELPER_HXX_ -#define _NULLCANVAS_CANVASHELPER_HXX_ - -#include <com/sun/star/rendering/XCanvas.hpp> -#include <com/sun/star/rendering/XIntegerBitmap.hpp> - -#include <basegfx/vector/b2isize.hxx> -#include <basegfx/vector/b2dsize.hxx> - -#include <boost/utility.hpp> - - -namespace nullcanvas -{ - class SpriteCanvas; - - /** Helper class for basic canvas functionality. Also offers - optional backbuffer painting, when providing it with a second - HDC to render into. - */ - class CanvasHelper : private ::boost::noncopyable - { - public: - CanvasHelper(); - - /// Release all references - void disposing(); - - /** Initialize canvas helper - - This method late-initializes the canvas helper, providing - it with the necessary device and size. Note that the - CanvasHelper does <em>not</em> take ownership of the - passed rDevice reference, nor does it perform any - reference counting. Thus, to prevent the reference counted - SpriteCanvas object from deletion, the user of this class - is responsible for holding ref-counted references itself! - - @param rSizePixel - Size of the output surface in pixel. - - @param rDevice - Reference device this canvas is associated with - - */ - void init( const ::basegfx::B2ISize& rSizePixel, - SpriteCanvas& rDevice, - bool bHasAlpha ); - - - // CanvasHelper functionality - // ========================== - - // XCanvas (only providing, not implementing the - // interface. Also note subtle method parameter differences) - void clear(); - void drawPoint( const ::com::sun::star::rendering::XCanvas* pCanvas, - const ::com::sun::star::geometry::RealPoint2D& aPoint, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); - void drawLine( const ::com::sun::star::rendering::XCanvas* pCanvas, - 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 ); - void drawBezier( const ::com::sun::star::rendering::XCanvas* pCanvas, - 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 ); - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - drawPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, - 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 ); - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - strokePolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, - 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 ); - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - strokeTexturedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, - 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 ); - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - strokeTextureMappedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, - 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 ); - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > - queryStrokeShapes( const ::com::sun::star::rendering::XCanvas* pCanvas, - 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 ); - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - fillPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, - 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 ); - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - fillTexturedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, - 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 ); - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - fillTextureMappedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, - 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 ); - - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont > SAL_CALL - createFont( const ::com::sun::star::rendering::XCanvas* pCanvas, - 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 ); - - ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::FontInfo > - queryAvailableFonts( const ::com::sun::star::rendering::XCanvas* pCanvas, - const ::com::sun::star::rendering::FontInfo& aFilter, - const ::com::sun::star::uno::Sequence< - ::com::sun::star::beans::PropertyValue >& aFontProperties ); - - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - drawText( const ::com::sun::star::rendering::XCanvas* pCanvas, - 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 ); - - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - drawTextLayout( const ::com::sun::star::rendering::XCanvas* pCanvas, - 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 ); - - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - drawBitmap( const ::com::sun::star::rendering::XCanvas* pCanvas, - 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 ); - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - drawBitmapModulated( const ::com::sun::star::rendering::XCanvas* pCanvas, - 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 ); - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice > - getDevice(); - - // BitmapCanvasHelper functionality - // ================================ - - void copyRect( const ::com::sun::star::rendering::XCanvas* pCanvas, - 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 ); - - ::com::sun::star::geometry::IntegerSize2D getSize(); - - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > - getScaledBitmap( const ::com::sun::star::geometry::RealSize2D& newSize, - sal_Bool beFast ); - - ::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 ); - - ::com::sun::star::rendering::IntegerBitmapLayout getMemoryLayout(); - - /** Called from XCanvas base classes, to notify that content - is _about_ to change - */ - void modifying() {} - - bool hasAlpha() const; - - protected: - /** Phyical output device - - Deliberately not a refcounted reference, because of - potential circular references for spritecanvas. - */ - SpriteCanvas* mpDevice; - - private: - /// Current size of the output surface in pixel - ::basegfx::B2ISize maSize; - - /// When true, content is able to represent alpha - bool mbHaveAlpha; - }; -} - -#endif /* _NULLCANVAS_CANVASHELPER_HXX_ */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_devicehelper.cxx b/canvas/source/null/null_devicehelper.cxx deleted file mode 100644 index d9e20469efe6..000000000000 --- a/canvas/source/null/null_devicehelper.cxx +++ /dev/null @@ -1,231 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <canvas/debug.hxx> -#include <canvas/verbosetrace.hxx> -#include <canvas/canvastools.hxx> - -#include <osl/mutex.hxx> -#include <rtl/instance.hxx> -#include <cppuhelper/compbase1.hxx> - -#include <com/sun/star/lang/NoSupportException.hpp> - -#include <basegfx/tools/canvastools.hxx> -#include <basegfx/tools/unopolypolygon.hxx> -#include <vcl/canvastools.hxx> - -#include "null_spritecanvas.hxx" -#include "null_canvasbitmap.hxx" -#include "null_devicehelper.hxx" - - -using namespace ::com::sun::star; - -namespace nullcanvas -{ - DeviceHelper::DeviceHelper() : - mpSpriteCanvas( NULL ), - maSize(), - mbFullScreen(false) - { - } - - void DeviceHelper::init( SpriteCanvas& rSpriteCanvas, - const ::basegfx::B2ISize& rSize, - bool bFullscreen ) - { - mpSpriteCanvas = &rSpriteCanvas; - maSize = rSize; - mbFullScreen = bFullscreen; - } - - void DeviceHelper::disposing() - { - // release all references - mpSpriteCanvas = NULL; - } - - geometry::RealSize2D DeviceHelper::getPhysicalResolution() - { - return geometry::RealSize2D( 75, 75 ); - } - - geometry::RealSize2D DeviceHelper::getPhysicalSize() - { - return geometry::RealSize2D( 210, 280 ); - } - - uno::Reference< rendering::XLinePolyPolygon2D > DeviceHelper::createCompatibleLinePolyPolygon( - const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, - const uno::Sequence< uno::Sequence< geometry::RealPoint2D > >& points ) - { - // disposed? - if( !mpSpriteCanvas ) - return uno::Reference< rendering::XLinePolyPolygon2D >(); // we're disposed - - return uno::Reference< rendering::XLinePolyPolygon2D >( - new ::basegfx::unotools::UnoPolyPolygon( - ::basegfx::unotools::polyPolygonFromPoint2DSequenceSequence( points ))); - } - - uno::Reference< rendering::XBezierPolyPolygon2D > DeviceHelper::createCompatibleBezierPolyPolygon( - const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, - const uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > >& points ) - { - // disposed? - if( !mpSpriteCanvas ) - return uno::Reference< rendering::XBezierPolyPolygon2D >(); // we're disposed - - return uno::Reference< rendering::XBezierPolyPolygon2D >( - new ::basegfx::unotools::UnoPolyPolygon( - ::basegfx::unotools::polyPolygonFromBezier2DSequenceSequence( points ) ) ); - } - - uno::Reference< rendering::XBitmap > DeviceHelper::createCompatibleBitmap( - const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, - const geometry::IntegerSize2D& size ) - { - // disposed? - if( !mpSpriteCanvas ) - return uno::Reference< rendering::XBitmap >(); // we're disposed - - return uno::Reference< rendering::XBitmap >( - new CanvasBitmap( - ::basegfx::unotools::b2ISizeFromIntegerSize2D( size ), - mpSpriteCanvas, - false )); - } - - uno::Reference< rendering::XVolatileBitmap > DeviceHelper::createVolatileBitmap( - const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, - const geometry::IntegerSize2D& /*size*/ ) - { - return uno::Reference< rendering::XVolatileBitmap >(); - } - - uno::Reference< rendering::XBitmap > DeviceHelper::createCompatibleAlphaBitmap( - const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, - const geometry::IntegerSize2D& size ) - { - // disposed? - if( !mpSpriteCanvas ) - return uno::Reference< rendering::XBitmap >(); // we're disposed - - return uno::Reference< rendering::XBitmap >( - new CanvasBitmap( - ::basegfx::unotools::b2ISizeFromIntegerSize2D( size ), - mpSpriteCanvas, - true )); - } - - uno::Reference< rendering::XVolatileBitmap > DeviceHelper::createVolatileAlphaBitmap( - const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, - const geometry::IntegerSize2D& /*size*/ ) - { - return uno::Reference< rendering::XVolatileBitmap >(); - } - - sal_Bool DeviceHelper::hasFullScreenMode() - { - // TODO(F3): offer fullscreen mode the XCanvas way - return false; - } - - sal_Bool DeviceHelper::enterFullScreenMode( sal_Bool /*bEnter*/ ) - { - // TODO(F3): offer fullscreen mode the XCanvas way - return false; - } - - ::sal_Int32 DeviceHelper::createBuffers( ::sal_Int32 /*nBuffers*/ ) - { - // TODO(F3): implement XBufferStrategy interface. For now, we - // _always_ will have exactly one backbuffer - return 1; - } - - void DeviceHelper::destroyBuffers() - { - // TODO(F3): implement XBufferStrategy interface. For now, we - // _always_ will have exactly one backbuffer - } - - ::sal_Bool DeviceHelper::showBuffer( bool bIsVisible, ::sal_Bool bUpdateAll ) - { - // forward to sprite canvas helper - if( !bIsVisible || !mpSpriteCanvas ) - return false; - - return mpSpriteCanvas->updateScreen( bUpdateAll ); - } - - ::sal_Bool DeviceHelper::switchBuffer( bool bIsVisible, ::sal_Bool bUpdateAll ) - { - // no difference for VCL canvas - return showBuffer( bIsVisible, bUpdateAll ); - } - - uno::Any DeviceHelper::isAccelerated() const - { - return ::com::sun::star::uno::makeAny(false); - } - - uno::Any DeviceHelper::getDeviceHandle() const - { - return uno::Any(); - } - - uno::Any DeviceHelper::getSurfaceHandle() const - { - return uno::Any(); - } - - namespace - { - struct DeviceColorSpace: public rtl::StaticWithInit<uno::Reference<rendering::XColorSpace>, - DeviceColorSpace> - { - uno::Reference<rendering::XColorSpace> operator()() - { - return vcl::unotools::createStandardColorSpace(); - } - }; - } - - uno::Reference<rendering::XColorSpace> DeviceHelper::getColorSpace() const - { - // always the same - return DeviceColorSpace::get(); - } - - void DeviceHelper::notifySizeUpdate( const awt::Rectangle& /*rBounds*/ ) - { - // TODO - } - - void DeviceHelper::dumpScreenContent() const - { - OSL_TRACE( "%s\n", - BOOST_CURRENT_FUNCTION ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_devicehelper.hxx b/canvas/source/null/null_devicehelper.hxx deleted file mode 100644 index 173985433f78..000000000000 --- a/canvas/source/null/null_devicehelper.hxx +++ /dev/null @@ -1,100 +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 _NULLCANVAS_DEVICEHELPER_HXX -#define _NULLCANVAS_DEVICEHELPER_HXX - -#include <com/sun/star/awt/Rectangle.hpp> -#include <com/sun/star/rendering/XGraphicDevice.hpp> -#include <com/sun/star/rendering/XBufferController.hpp> - -#include <boost/utility.hpp> - - -/* Definition of DeviceHelper class */ - -namespace nullcanvas -{ - class SpriteCanvas; - - class DeviceHelper : private ::boost::noncopyable - { - public: - DeviceHelper(); - - void init( SpriteCanvas& rSpriteCanvas, - const ::basegfx::B2ISize& rSize, - bool bFullscreen ); - - /// Dispose all internal references - void disposing(); - - // XWindowGraphicDevice - ::com::sun::star::geometry::RealSize2D getPhysicalResolution(); - ::com::sun::star::geometry::RealSize2D getPhysicalSize(); - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XLinePolyPolygon2D > createCompatibleLinePolyPolygon( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& points ); - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBezierPolyPolygon2D > createCompatibleBezierPolyPolygon( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& points ); - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleBitmap( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::geometry::IntegerSize2D& size ); - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileBitmap( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::geometry::IntegerSize2D& size ); - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleAlphaBitmap( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::geometry::IntegerSize2D& size ); - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileAlphaBitmap( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::geometry::IntegerSize2D& size ); - sal_Bool hasFullScreenMode( ); - sal_Bool enterFullScreenMode( sal_Bool bEnter ); - - ::sal_Int32 createBuffers( ::sal_Int32 nBuffers ); - void destroyBuffers( ); - ::sal_Bool showBuffer( bool bIsVisible, ::sal_Bool bUpdateAll ); - ::sal_Bool switchBuffer( bool bIsVisible, ::sal_Bool bUpdateAll ); - - ::com::sun::star::uno::Any isAccelerated() const; - ::com::sun::star::uno::Any getDeviceHandle() const; - ::com::sun::star::uno::Any getSurfaceHandle() const; - ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XColorSpace> getColorSpace() const; - - void notifySizeUpdate( const ::com::sun::star::awt::Rectangle& rBounds ); - - /** called when DumpScreenContent property is enabled on - XGraphicDevice, and writes out bitmaps of current screen. - */ - void dumpScreenContent() const; - - private: - /// Pointer to sprite canvas (owner of this helper), needed to create bitmaps - SpriteCanvas* mpSpriteCanvas; - ::basegfx::B2ISize maSize; - bool mbFullScreen; - }; -} - -#endif /* _NULLCANVAS_WINDOWGRAPHICDEVICE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_spritecanvas.cxx b/canvas/source/null/null_spritecanvas.cxx deleted file mode 100644 index d545d76b3573..000000000000 --- a/canvas/source/null/null_spritecanvas.cxx +++ /dev/null @@ -1,158 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <canvas/debug.hxx> -#include <tools/diagnose_ex.h> -#include <canvas/verbosetrace.hxx> -#include <canvas/canvastools.hxx> - -#include <osl/mutex.hxx> - -#include <com/sun/star/registry/XRegistryKey.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> - -#include <cppuhelper/factory.hxx> -#include <cppuhelper/implementationentry.hxx> -#include <comphelper/servicedecl.hxx> - -#include <basegfx/matrix/b2dhommatrix.hxx> -#include <basegfx/point/b2dpoint.hxx> -#include <basegfx/tools/canvastools.hxx> -#include <basegfx/numeric/ftools.hxx> - -#include "null_spritecanvas.hxx" - - -using namespace ::com::sun::star; - -#define SERVICE_NAME "com.sun.star.rendering.NullCanvas" - -namespace nullcanvas -{ - SpriteCanvas::SpriteCanvas( const uno::Sequence< uno::Any >& aArguments, - const uno::Reference< uno::XComponentContext >& rxContext ) : - maArguments(aArguments), - mxComponentContext( rxContext ) - { - } - - void SpriteCanvas::initialize() - { - // #i64742# Only call initialize when not in probe mode - if( maArguments.getLength() == 0 ) - return; - - VERBOSE_TRACE( "SpriteCanvas::initialize called" ); - - // At index 1, we expect a system window handle here, - // containing a pointer to a valid window, on which to output - // At index 2, we expect the current window bound rect - ENSURE_ARG_OR_THROW( maArguments.getLength() >= 4 && - maArguments[1].getValueTypeClass() == uno::TypeClass_LONG, - "SpriteCanvas::initialize: wrong number of arguments, or wrong types" ); - - awt::Rectangle aRect; - maArguments[2] >>= aRect; - const ::basegfx::B2ISize aSize(aRect.Width, - aRect.Height); - - sal_Bool bIsFullscreen( sal_False ); - maArguments[3] >>= bIsFullscreen; - - // setup helper - maDeviceHelper.init( *this, - aSize, - bIsFullscreen ); - maCanvasHelper.init( maRedrawManager, - *this, - aSize, - false ); - - maArguments.realloc(0); - } - - void SpriteCanvas::disposeThis() - { - ::osl::MutexGuard aGuard( m_aMutex ); - - mxComponentContext.clear(); - - // forward to parent - SpriteCanvasBaseT::disposeThis(); - } - - ::sal_Bool SAL_CALL SpriteCanvas::showBuffer( ::sal_Bool bUpdateAll ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // avoid repaints on hidden window (hidden: not mapped to - // screen). Return failure, since the screen really has _not_ - // been updated (caller should try again later) - return !mbIsVisible ? false : SpriteCanvasBaseT::showBuffer( bUpdateAll ); - } - - ::sal_Bool SAL_CALL SpriteCanvas::switchBuffer( ::sal_Bool bUpdateAll ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // avoid repaints on hidden window (hidden: not mapped to - // screen). Return failure, since the screen really has _not_ - // been updated (caller should try again later) - return !mbIsVisible ? false : SpriteCanvasBaseT::switchBuffer( bUpdateAll ); - } - - sal_Bool SAL_CALL SpriteCanvas::updateScreen( sal_Bool bUpdateAll ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // avoid repaints on hidden window (hidden: not mapped to - // screen). Return failure, since the screen really has _not_ - // been updated (caller should try again later) - return !mbIsVisible ? false : maCanvasHelper.updateScreen( - ::basegfx::unotools::b2IRectangleFromAwtRectangle(maBounds), - bUpdateAll, - mbSurfaceDirty ); - } - - OUString SAL_CALL SpriteCanvas::getServiceName( ) throw (uno::RuntimeException) - { - return OUString( SERVICE_NAME ); - } - - static uno::Reference<uno::XInterface> initCanvas( SpriteCanvas* pCanvas ) - { - uno::Reference<uno::XInterface> xRet(static_cast<cppu::OWeakObject*>(pCanvas)); - pCanvas->initialize(); - return xRet; - } - - namespace sdecl = comphelper::service_decl; - sdecl::class_<SpriteCanvas, sdecl::with_args<true> > serviceImpl(&initCanvas); - const sdecl::ServiceDecl nullCanvasDecl( - serviceImpl, - "com.sun.star.comp.rendering.NullCanvas", - SERVICE_NAME ); -} - -// The C shared lib entry points -COMPHELPER_SERVICEDECL_EXPORTS1(nullcanvas, nullcanvas::nullCanvasDecl) - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_spritecanvas.hxx b/canvas/source/null/null_spritecanvas.hxx deleted file mode 100644 index 7e7815922599..000000000000 --- a/canvas/source/null/null_spritecanvas.hxx +++ /dev/null @@ -1,139 +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 _NULLCANVAS_SPRITECANVAS_HXX_ -#define _NULLCANVAS_SPRITECANVAS_HXX_ - -#include <rtl/ref.hxx> - -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/lang/XServiceName.hpp> -#include <com/sun/star/awt/XWindowListener.hpp> -#include <com/sun/star/rendering/XSpriteCanvas.hpp> -#include <com/sun/star/rendering/XIntegerBitmap.hpp> -#include <com/sun/star/rendering/XGraphicDevice.hpp> -#include <com/sun/star/rendering/XBufferController.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - -#include <cppuhelper/compbase8.hxx> -#include <comphelper/uno3.hxx> - -#include <canvas/base/spritecanvasbase.hxx> -#include <canvas/base/disambiguationhelper.hxx> -#include <canvas/base/bufferedgraphicdevicebase.hxx> - -#include "null_spritecanvashelper.hxx" -#include "null_devicehelper.hxx" -#include "null_usagecounter.hxx" - - -namespace nullcanvas -{ - typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::rendering::XSpriteCanvas, - ::com::sun::star::rendering::XIntegerBitmap, - ::com::sun::star::rendering::XGraphicDevice, - ::com::sun::star::lang::XMultiServiceFactory, - ::com::sun::star::rendering::XBufferController, - ::com::sun::star::awt::XWindowListener, - ::com::sun::star::beans::XPropertySet, - ::com::sun::star::lang::XServiceName > WindowGraphicDeviceBase_Base; - typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >, - DeviceHelper, - ::osl::MutexGuard, - ::cppu::OWeakObject > SpriteCanvasBase_Base; - /** Mixin SpriteSurface - - Have to mixin the SpriteSurface before deriving from - ::canvas::SpriteCanvasBase, as this template should already - implement some of those interface methods. - - The reason why this appears kinda convoluted is the fact that - we cannot specify non-IDL types as WeakComponentImplHelperN - template args, and furthermore, don't want to derive - ::canvas::SpriteCanvasBase directly from - ::canvas::SpriteSurface (because derivees of - ::canvas::SpriteCanvasBase have to explicitly forward the - XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS) - anyway). Basically, ::canvas::CanvasCustomSpriteBase should - remain a base class that provides implementation, not to - enforce any specific interface on its derivees. - */ - class SpriteCanvasBaseSpriteSurface_Base : public SpriteCanvasBase_Base, - public ::canvas::SpriteSurface - { - }; - - typedef ::canvas::SpriteCanvasBase< SpriteCanvasBaseSpriteSurface_Base, - SpriteCanvasHelper, - ::osl::MutexGuard, - ::cppu::OWeakObject > SpriteCanvasBaseT; - - /** Product of this component's factory. - - The SpriteCanvas object combines the actual Window canvas with - the XGraphicDevice interface. This is because there's a - one-to-one relation between them, anyway, since each window - can have exactly one canvas and one associated - XGraphicDevice. And to avoid messing around with circular - references, this is implemented as one single object. - */ - class SpriteCanvas : public SpriteCanvasBaseT, - private UsageCounter< SpriteCanvas > - { - public: - SpriteCanvas( const ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Any >& aArguments, - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext >& rxContext ); - - void initialize(); - - /// Dispose all internal references - virtual void disposeThis(); - - // Forwarding the XComponent implementation to the - // cppu::ImplHelper templated base - // Classname Base doing refcounting Base implementing the XComponent interface - // | | | - // V V V - DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase ); - - // XBufferController (partial) - virtual ::sal_Bool SAL_CALL showBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL switchBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException); - - // XSpriteCanvas (partial) - virtual sal_Bool SAL_CALL updateScreen( sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException); - - // XServiceName - virtual OUString SAL_CALL getServiceName( ) throw (::com::sun::star::uno::RuntimeException); - - private: - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > maArguments; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext; - }; - - typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef; - typedef ::rtl::Reference< SpriteCanvas > DeviceRef; -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_spritecanvashelper.cxx b/canvas/source/null/null_spritecanvashelper.cxx deleted file mode 100644 index 80ef73aed6e4..000000000000 --- a/canvas/source/null/null_spritecanvashelper.cxx +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <canvas/debug.hxx> -#include <canvas/verbosetrace.hxx> -#include <canvas/canvastools.hxx> - -#include <comphelper/scopeguard.hxx> - -#include <basegfx/range/b2drectangle.hxx> -#include <basegfx/tools/canvastools.hxx> - -#include <boost/cast.hpp> - -#include "null_spritecanvashelper.hxx" -#include "null_canvascustomsprite.hxx" - - -using namespace ::com::sun::star; - -namespace nullcanvas -{ - SpriteCanvasHelper::SpriteCanvasHelper() : - mpRedrawManager( NULL ) - { - } - - void SpriteCanvasHelper::init( ::canvas::SpriteRedrawManager& rManager, - SpriteCanvas& rDevice, - const ::basegfx::B2ISize& rSize, - bool bHasAlpha ) - { - mpRedrawManager = &rManager; - - CanvasHelper::init( rSize, rDevice, bHasAlpha ); - } - - void SpriteCanvasHelper::disposing() - { - mpRedrawManager = NULL; - - // forward to base - CanvasHelper::disposing(); - } - - uno::Reference< rendering::XAnimatedSprite > SpriteCanvasHelper::createSpriteFromAnimation( - const uno::Reference< rendering::XAnimation >& /*animation*/ ) - { - return uno::Reference< rendering::XAnimatedSprite >(); - } - - uno::Reference< rendering::XAnimatedSprite > SpriteCanvasHelper::createSpriteFromBitmaps( - const uno::Sequence< uno::Reference< rendering::XBitmap > >& /*animationBitmaps*/, - sal_Int8 /*interpolationMode*/ ) - { - return uno::Reference< rendering::XAnimatedSprite >(); - } - - uno::Reference< rendering::XCustomSprite > SpriteCanvasHelper::createCustomSprite( const geometry::RealSize2D& spriteSize ) - { - if( !mpRedrawManager ) - return uno::Reference< rendering::XCustomSprite >(); // we're disposed - - return uno::Reference< rendering::XCustomSprite >( - new CanvasCustomSprite( spriteSize, - mpDevice ) ); - } - - uno::Reference< rendering::XSprite > SpriteCanvasHelper::createClonedSprite( const uno::Reference< rendering::XSprite >& /*original*/ ) - { - return uno::Reference< rendering::XSprite >(); - } - - sal_Bool SpriteCanvasHelper::updateScreen( const ::basegfx::B2IRange& /*rCurrArea*/, - sal_Bool /*bUpdateAll*/, - bool& /*io_bSurfaceDirty*/ ) - { - // TODO - return sal_True; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_spritecanvashelper.hxx b/canvas/source/null/null_spritecanvashelper.hxx deleted file mode 100644 index 59db03e79fb1..000000000000 --- a/canvas/source/null/null_spritecanvashelper.hxx +++ /dev/null @@ -1,97 +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 _NULLCANVAS_SPRITECANVASHELPER_HXX_ -#define _NULLCANVAS_SPRITECANVASHELPER_HXX_ - -#include <com/sun/star/rendering/XSpriteCanvas.hpp> -#include <com/sun/star/rendering/XIntegerBitmap.hpp> - -#include <canvas/spriteredrawmanager.hxx> - -#include "null_canvashelper.hxx" - -namespace basegfx -{ - class B2IRange; -} - -namespace nullcanvas -{ - class SpriteCanvas; - - class SpriteCanvasHelper : public CanvasHelper - { - public: - SpriteCanvasHelper(); - - void init( ::canvas::SpriteRedrawManager& rManager, - SpriteCanvas& rDevice, - const ::basegfx::B2ISize& rSize, - bool bHasAlpha ); - - /// Dispose all internal references - void disposing(); - - // XSpriteCanvas - ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XAnimatedSprite > createSpriteFromAnimation( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimation >& animation ); - - ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XAnimatedSprite > createSpriteFromBitmaps( - const ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XBitmap > >& animationBitmaps, - sal_Int8 interpolationMode ); - - ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XCustomSprite > createCustomSprite( - const ::com::sun::star::geometry::RealSize2D& spriteSize ); - - ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XSprite > createClonedSprite( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite >& original ); - - /** Actually perform the screen update - - @param rCurrArea - Current window area in absolute screen coordinates - - @param bUpdateAll - sal_True, if everything must be updated, not only changed - sprites - - @param io_bSurfaceDirty - In/out parameter, whether backbuffer surface is dirty (if - yes, we're performing a full update, anyway) - */ - sal_Bool updateScreen( const ::basegfx::B2IRange& rCurrArea, - sal_Bool bUpdateAll, - bool& io_bSurfaceDirty ); - - private: - /// Set from the SpriteCanvas: instance coordinating sprite redraw - ::canvas::SpriteRedrawManager* mpRedrawManager; - }; -} - -#endif /* _NULLCANVAS_SPRITECANVASHELPER_HXX_ */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_spritehelper.cxx b/canvas/source/null/null_spritehelper.cxx deleted file mode 100644 index be83826ee4f1..000000000000 --- a/canvas/source/null/null_spritehelper.cxx +++ /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 . - */ - - -#include <canvas/debug.hxx> -#include <tools/diagnose_ex.h> -#include <canvas/verbosetrace.hxx> - -#include <rtl/logfile.hxx> -#include <rtl/math.hxx> - -#include <canvas/canvastools.hxx> - -#include <basegfx/matrix/b2dhommatrix.hxx> -#include <basegfx/point/b2dpoint.hxx> -#include <basegfx/tools/canvastools.hxx> -#include <basegfx/numeric/ftools.hxx> -#include <basegfx/polygon/b2dpolypolygontools.hxx> -#include <basegfx/polygon/b2dpolygontools.hxx> -#include <basegfx/polygon/b2dpolygontriangulator.hxx> -#include <basegfx/polygon/b2dpolygoncutandtouch.hxx> - -#include "null_canvascustomsprite.hxx" -#include "null_spritehelper.hxx" - -#include <memory> - - -using namespace ::com::sun::star; - -namespace nullcanvas -{ - SpriteHelper::SpriteHelper() : - mpSpriteCanvas(), - mbTextureDirty( true ) - { - } - - void SpriteHelper::init( const geometry::RealSize2D& rSpriteSize, - const SpriteCanvasRef& rSpriteCanvas ) - { - ENSURE_OR_THROW( rSpriteCanvas.get(), - "SpriteHelper::init(): Invalid device, sprite canvas or surface" ); - - mpSpriteCanvas = rSpriteCanvas; - mbTextureDirty = true; - - // also init base class - CanvasCustomSpriteHelper::init( rSpriteSize, - rSpriteCanvas.get() ); - } - - void SpriteHelper::disposing() - { - mpSpriteCanvas.clear(); - - // forward to parent - CanvasCustomSpriteHelper::disposing(); - } - - void SpriteHelper::redraw( bool& /*io_bSurfaceDirty*/ ) const - { - // TODO - } - - ::basegfx::B2DPolyPolygon SpriteHelper::polyPolygonFromXPolyPolygon2D( uno::Reference< rendering::XPolyPolygon2D >& xPoly ) const - { - return ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D( xPoly ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_spritehelper.hxx b/canvas/source/null/null_spritehelper.hxx deleted file mode 100644 index 9ef1bee728dd..000000000000 --- a/canvas/source/null/null_spritehelper.hxx +++ /dev/null @@ -1,99 +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 _NULLCANVAS_SPRITEHELPER_HXX -#define _NULLCANVAS_SPRITEHELPER_HXX - -#include <com/sun/star/rendering/XCustomSprite.hpp> - -#include <canvas/base/canvascustomspritehelper.hxx> - -#include <basegfx/point/b2dpoint.hxx> -#include <basegfx/vector/b2isize.hxx> -#include <basegfx/matrix/b2dhommatrix.hxx> - -#include "null_spritecanvas.hxx" - - -namespace nullcanvas -{ - /* Definition of SpriteHelper class */ - - /** Helper class for canvas sprites. - - This class implements all sprite-related functionality, like - that available on the XSprite interface. - */ - class SpriteHelper : public ::canvas::CanvasCustomSpriteHelper - { - public: - /** Create sprite helper - */ - SpriteHelper(); - - // make CanvasCustomSpriteHelper::init visible for name lookup - using ::canvas::CanvasCustomSpriteHelper::init; - - /** Late-init the sprite helper - - @param rSpriteSize - Size of the sprite - - @param rSpriteCanvas - Sprite canvas this sprite is part of. Object stores - ref-counted reference to it, thus, don't forget to pass on - disposing()! - - @param rDevice - DX device to use - - @param rSpriteSurface - The surface of the sprite (not the DX texture, but the - persistent target of content rendering) - - @param bShowSpriteBounds - When true, little debug bound rects for sprites are shown - */ - void init( const ::com::sun::star::geometry::RealSize2D& rSpriteSize, - const SpriteCanvasRef& rSpriteCanvas ); - - void disposing(); - - /** Repaint sprite content via hardware to associated sprite - canvas - - @param io_bSurfaceDirty - Input/output parameter, whether the sprite content is - dirty or not. If texture was updated, set to false - */ - void redraw( bool& io_bSurfaceDirty ) const; - - private: - virtual ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D( - ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPoly ) const; - - - SpriteCanvasRef mpSpriteCanvas; - mutable bool mbTextureDirty; // when true, texture needs update - }; -} - -#endif /* _NULLCANVAS_SPRITEHELPER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_textlayout.cxx b/canvas/source/null/null_textlayout.cxx deleted file mode 100644 index f0c789ba3369..000000000000 --- a/canvas/source/null/null_textlayout.cxx +++ /dev/null @@ -1,253 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <canvas/debug.hxx> -#include <tools/diagnose_ex.h> -#include <canvas/verbosetrace.hxx> - -#include <basegfx/matrix/b2dhommatrix.hxx> -#include <basegfx/numeric/ftools.hxx> - -#include "null_textlayout.hxx" -#include "null_spritecanvas.hxx" - - -using namespace ::com::sun::star; - -namespace nullcanvas -{ - TextLayout::TextLayout( const rendering::StringContext& aText, - sal_Int8 nDirection, - sal_Int64 /*nRandomSeed*/, - const CanvasFont::ImplRef& rFont ) : - TextLayout_Base( m_aMutex ), - maText( aText ), - maLogicalAdvancements(), - mpFont( rFont ), - mnTextDirection( nDirection ) - { - } - - TextLayout::~TextLayout() - { - } - - void SAL_CALL TextLayout::disposing() - { - mpFont.reset(); - } - - // XTextLayout - uno::Sequence< uno::Reference< rendering::XPolyPolygon2D > > SAL_CALL TextLayout::queryTextShapes( ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // TODO - return uno::Sequence< uno::Reference< rendering::XPolyPolygon2D > >(); - } - - uno::Sequence< geometry::RealRectangle2D > SAL_CALL TextLayout::queryInkMeasures( ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // TODO - return uno::Sequence< geometry::RealRectangle2D >(); - } - - uno::Sequence< geometry::RealRectangle2D > SAL_CALL TextLayout::queryMeasures( ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // TODO - return uno::Sequence< geometry::RealRectangle2D >(); - } - - uno::Sequence< double > SAL_CALL TextLayout::queryLogicalAdvancements( ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - return maLogicalAdvancements; - } - - void SAL_CALL TextLayout::applyLogicalAdvancements( const uno::Sequence< double >& aAdvancements ) throw (lang::IllegalArgumentException, uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - if( aAdvancements.getLength() != maText.Length ) - { - OSL_TRACE( "TextLayout::applyLogicalAdvancements(): mismatching number of advancements" ); - throw lang::IllegalArgumentException(); - } - - maLogicalAdvancements = aAdvancements; - } - - geometry::RealRectangle2D SAL_CALL TextLayout::queryTextBounds( ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - ENSURE_OR_THROW( mpFont.get(), - "TextLayout::queryTextBounds(): invalid font" ); - - // fake text bounds by either taking the advancement values, - // or assuming square glyph boxes (width similar to height) - const rendering::FontRequest& rFontRequest( mpFont->getFontRequest() ); - const double nFontSize( ::std::max( rFontRequest.CellSize, - rFontRequest.ReferenceAdvancement ) ); - if( maLogicalAdvancements.getLength() ) - { - return geometry::RealRectangle2D( 0, -nFontSize/2, - maLogicalAdvancements[ maLogicalAdvancements.getLength()-1 ], - nFontSize/2 ); - } - else - { - return geometry::RealRectangle2D( 0, -nFontSize/2, - nFontSize * maText.Length, - nFontSize/2 ); - } - } - - double SAL_CALL TextLayout::justify( double /*nSize*/ ) throw (lang::IllegalArgumentException, uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // TODO - return 0.0; - } - - double SAL_CALL TextLayout::combinedJustify( const uno::Sequence< uno::Reference< rendering::XTextLayout > >& /*aNextLayouts*/, - double /*nSize*/ ) throw (lang::IllegalArgumentException, uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // TODO - return 0.0; - } - - rendering::TextHit SAL_CALL TextLayout::getTextHit( const geometry::RealPoint2D& /*aHitPoint*/ ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // TODO - return rendering::TextHit(); - } - - rendering::Caret SAL_CALL TextLayout::getCaret( sal_Int32 /*nInsertionIndex*/, - sal_Bool /*bExcludeLigatures*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // TODO - return rendering::Caret(); - } - - sal_Int32 SAL_CALL TextLayout::getNextInsertionIndex( sal_Int32 /*nStartIndex*/, - sal_Int32 /*nCaretAdvancement*/, - sal_Bool /*bExcludeLigatures*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // TODO - return 0; - } - - uno::Reference< rendering::XPolyPolygon2D > SAL_CALL TextLayout::queryVisualHighlighting( sal_Int32 /*nStartIndex*/, - sal_Int32 /*nEndIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // TODO - return uno::Reference< rendering::XPolyPolygon2D >(); - } - - uno::Reference< rendering::XPolyPolygon2D > SAL_CALL TextLayout::queryLogicalHighlighting( sal_Int32 /*nStartIndex*/, - sal_Int32 /*nEndIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // TODO - return uno::Reference< rendering::XPolyPolygon2D >(); - } - - double SAL_CALL TextLayout::getBaselineOffset( ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // TODO - return 0.0; - } - - sal_Int8 SAL_CALL TextLayout::getMainTextDirection( ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - return mnTextDirection; - } - - uno::Reference< rendering::XCanvasFont > SAL_CALL TextLayout::getFont( ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - return mpFont.getRef(); - } - - rendering::StringContext SAL_CALL TextLayout::getText( ) throw (uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - return maText; - } - - bool TextLayout::draw( const rendering::ViewState& /*rViewState*/, - const rendering::RenderState& /*rRenderState*/, - const uno::Reference< rendering::XGraphicDevice >& /*xGraphicDevice*/ ) const - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // TODO - - return true; - } - - -#define SERVICE_NAME "com.sun.star.rendering.TextLayout" -#define IMPLEMENTATION_NAME "NullCanvas::TextLayout" - - OUString SAL_CALL TextLayout::getImplementationName() throw( uno::RuntimeException ) - { - return OUString( IMPLEMENTATION_NAME ); - } - - sal_Bool SAL_CALL TextLayout::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException ) - { - return ServiceName == SERVICE_NAME; - } - - uno::Sequence< OUString > SAL_CALL TextLayout::getSupportedServiceNames() throw( uno::RuntimeException ) - { - uno::Sequence< OUString > aRet(1); - aRet[0] = SERVICE_NAME; - - return aRet; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_textlayout.hxx b/canvas/source/null/null_textlayout.hxx deleted file mode 100644 index 8e2a375dd2e6..000000000000 --- a/canvas/source/null/null_textlayout.hxx +++ /dev/null @@ -1,101 +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 _NULLCANVAS_TEXTLAYOUT_HXX -#define _NULLCANVAS_TEXTLAYOUT_HXX - -#include <cppuhelper/compbase2.hxx> -#include <comphelper/broadcasthelper.hxx> - -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/rendering/XTextLayout.hpp> - -#include <basegfx/vector/b2isize.hxx> - -#include <boost/utility.hpp> - -#include "null_canvasfont.hxx" -#include "null_usagecounter.hxx" - - -/* Definition of TextLayout class */ - -namespace nullcanvas -{ - typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XTextLayout, - ::com::sun::star::lang::XServiceInfo > TextLayout_Base; - - class TextLayout : public ::comphelper::OBaseMutex, - public TextLayout_Base, - private UsageCounter< TextLayout >, - private ::boost::noncopyable - { - public: - TextLayout( const ::com::sun::star::rendering::StringContext& aText, - sal_Int8 nDirection, - sal_Int64 nRandomSeed, - const CanvasFont::ImplRef& rFont ); - - /// Dispose all internal references - virtual void SAL_CALL disposing(); - - // XTextLayout - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > > SAL_CALL queryTextShapes( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealRectangle2D > SAL_CALL queryInkMeasures( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealRectangle2D > SAL_CALL queryMeasures( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< double > SAL_CALL queryLogicalAdvancements( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL applyLogicalAdvancements( const ::com::sun::star::uno::Sequence< double >& aAdvancements ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::geometry::RealRectangle2D SAL_CALL queryTextBounds( ) throw (::com::sun::star::uno::RuntimeException); - virtual double SAL_CALL justify( double nSize ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual double SAL_CALL combinedJustify( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XTextLayout > >& aNextLayouts, double nSize ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::rendering::TextHit SAL_CALL getTextHit( const ::com::sun::star::geometry::RealPoint2D& aHitPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::rendering::Caret SAL_CALL getCaret( sal_Int32 nInsertionIndex, sal_Bool bExcludeLigatures ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getNextInsertionIndex( sal_Int32 nStartIndex, sal_Int32 nCaretAdvancement, sal_Bool bExcludeLigatures ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > SAL_CALL queryVisualHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > SAL_CALL queryLogicalHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual double SAL_CALL getBaselineOffset( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int8 SAL_CALL getMainTextDirection( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::rendering::StringContext SAL_CALL getText( ) 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 ); - - bool draw( const ::com::sun::star::rendering::ViewState& rViewState, - const ::com::sun::star::rendering::RenderState& rRenderState, - const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice ) const; - - protected: - ~TextLayout(); // we're a ref-counted UNO class. _We_ destroy ourselves. - - private: - ::com::sun::star::rendering::StringContext maText; - ::com::sun::star::uno::Sequence< double > maLogicalAdvancements; - CanvasFont::ImplRef mpFont; - sal_Int8 mnTextDirection; - }; - -} - -#endif /* _NULLCANVAS_TEXTLAYOUT_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/null_usagecounter.hxx b/canvas/source/null/null_usagecounter.hxx deleted file mode 100644 index 482f2207dcf9..000000000000 --- a/canvas/source/null/null_usagecounter.hxx +++ /dev/null @@ -1,66 +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 _NULLCANVAS_USAGECOUNTER_HXX -#define _NULLCANVAS_USAGECOUNTER_HXX - -#include <osl/interlck.h> -#include <boost/current_function.hpp> -#include "sal/log.hxx" - -namespace nullcanvas -{ - /** Little resource tracking counter. - - When using this object, a global use counter, specific to the - given type is incremented on object construction, and - decremented on object destruction. - */ - template< class Type > class UsageCounter - { - public: - UsageCounter() - { - SAL_INFO("canvas.null","" << BOOST_CURRENT_FUNCTION << ", " << osl_atomic_increment( &s_nCount ) << " objects currently in use.\n"); - } - - ~UsageCounter() - { - const sal_Int32 nCount( osl_atomic_decrement( &s_nCount ) ); - - if( !nCount ) - { - SAL_INFO("canvas.null", "" << BOOST_CURRENT_FUNCTION << ", last instance deleted.\n"); - } - else - { - SAL_INFO("canvas.null", "" << BOOST_CURRENT_FUNCTION << ", " << nCount << " instances left.\n"); - } - } - - private: - static oslInterlockedCount s_nCount; - }; - - template< class Type > oslInterlockedCount UsageCounter<Type>::s_nCount = 0; -} - -#endif /* _NULLCANVAS_USAGECOUNTER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/null/nullcanvas.component b/canvas/source/null/nullcanvas.component deleted file mode 100644 index e185802e3d44..000000000000 --- a/canvas/source/null/nullcanvas.component +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * 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/. - --> - -<component loader="com.sun.star.loader.SharedLibrary" prefix="nullcanvas" - xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.rendering.NullCanvas"> - <service name="com.sun.star.rendering.NullCanvas"/> - </implementation> -</component> diff --git a/canvas/source/null/sprite.hxx b/canvas/source/null/sprite.hxx deleted file mode 100644 index 94db485f9987..000000000000 --- a/canvas/source/null/sprite.hxx +++ /dev/null @@ -1,44 +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_NULLCANVAS_SPRITE_HXX -#define INCLUDED_NULLCANVAS_SPRITE_HXX - -#include <canvas/base/sprite.hxx> - -namespace nullcanvas -{ - /** Specialization of ::canvas::Sprite interface, to also provide - redraw methods. - */ - class Sprite : public ::canvas::Sprite - { - public: - /** Redraw sprite - */ - virtual void redraw() const = 0; - - protected: - ~Sprite() {} - }; -} - -#endif /* INCLUDED_NULLCANVAS_SPRITE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |