merge the formfield patch from ooo-build
[ooovba.git] / canvas / source / null / null_canvascustomsprite.cxx
blobd24ebb8928889570b56b9774d71caa7e35a3dbdf
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: null_canvascustomsprite.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_canvas.hxx"
34 #include <canvas/debug.hxx>
35 #include <tools/diagnose_ex.h>
36 #include <canvas/verbosetrace.hxx>
38 #include <rtl/logfile.hxx>
39 #include <rtl/math.hxx>
41 #include <canvas/canvastools.hxx>
43 #include <basegfx/matrix/b2dhommatrix.hxx>
44 #include <basegfx/point/b2dpoint.hxx>
46 #include "null_canvascustomsprite.hxx"
47 #include "null_spritecanvas.hxx"
50 using namespace ::com::sun::star;
52 namespace nullcanvas
54 CanvasCustomSprite::CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
55 const SpriteCanvasRef& rRefDevice ) :
56 mpSpriteCanvas( rRefDevice )
58 ENSURE_OR_THROW( rRefDevice.get(),
59 "CanvasCustomSprite::CanvasCustomSprite(): Invalid sprite canvas" );
61 maCanvasHelper.init( ::basegfx::B2ISize(
62 ::canvas::tools::roundUp( rSpriteSize.Width ),
63 ::canvas::tools::roundUp( rSpriteSize.Height ) ),
64 *rRefDevice.get(),
65 true );
67 maSpriteHelper.init( rSpriteSize,
68 rRefDevice );
71 void SAL_CALL CanvasCustomSprite::disposing()
73 ::osl::MutexGuard aGuard( m_aMutex );
75 mpSpriteCanvas.clear();
77 // forward to parent
78 CanvasCustomSpriteBaseT::disposing();
81 void CanvasCustomSprite::redraw() const
83 ::osl::MutexGuard aGuard( m_aMutex );
85 maSpriteHelper.redraw( mbSurfaceDirty );
88 #define IMPLEMENTATION_NAME "NullCanvas.CanvasCustomSprite"
89 #define SERVICE_NAME "com.sun.star.rendering.CanvasCustomSprite"
91 ::rtl::OUString SAL_CALL CanvasCustomSprite::getImplementationName() throw( uno::RuntimeException )
93 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) );
96 sal_Bool SAL_CALL CanvasCustomSprite::supportsService( const ::rtl::OUString& ServiceName ) throw( uno::RuntimeException )
98 return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
101 uno::Sequence< ::rtl::OUString > SAL_CALL CanvasCustomSprite::getSupportedServiceNames() throw( uno::RuntimeException )
103 uno::Sequence< ::rtl::OUString > aRet(1);
104 aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
106 return aRet;