Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <canvas/debug.hxx>
31 : : #include <tools/diagnose_ex.h>
32 : : #include <canvas/verbosetrace.hxx>
33 : :
34 : : #include <rtl/logfile.hxx>
35 : : #include <rtl/math.hxx>
36 : :
37 : : #include <canvas/canvastools.hxx>
38 : :
39 : : #include <basegfx/matrix/b2dhommatrix.hxx>
40 : : #include <basegfx/point/b2dpoint.hxx>
41 : :
42 : : #include "null_canvascustomsprite.hxx"
43 : : #include "null_spritecanvas.hxx"
44 : :
45 : :
46 : : using namespace ::com::sun::star;
47 : :
48 : : namespace nullcanvas
49 : : {
50 : 0 : CanvasCustomSprite::CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
51 : : const SpriteCanvasRef& rRefDevice ) :
52 : 0 : mpSpriteCanvas( rRefDevice )
53 : : {
54 : 0 : ENSURE_OR_THROW( rRefDevice.get(),
55 : : "CanvasCustomSprite::CanvasCustomSprite(): Invalid sprite canvas" );
56 : :
57 : : maCanvasHelper.init( ::basegfx::B2ISize(
58 : : ::canvas::tools::roundUp( rSpriteSize.Width ),
59 : : ::canvas::tools::roundUp( rSpriteSize.Height ) ),
60 : 0 : *rRefDevice.get(),
61 : 0 : true );
62 : :
63 : : maSpriteHelper.init( rSpriteSize,
64 : 0 : rRefDevice );
65 : 0 : }
66 : :
67 : 0 : void CanvasCustomSprite::disposeThis()
68 : : {
69 : 0 : ::osl::MutexGuard aGuard( m_aMutex );
70 : :
71 : 0 : mpSpriteCanvas.clear();
72 : :
73 : : // forward to parent
74 : 0 : CanvasCustomSpriteBaseT::disposeThis();
75 : 0 : }
76 : :
77 : 0 : void CanvasCustomSprite::redraw() const
78 : : {
79 : 0 : ::osl::MutexGuard aGuard( m_aMutex );
80 : :
81 : 0 : maSpriteHelper.redraw( mbSurfaceDirty );
82 : 0 : }
83 : :
84 : : #define IMPLEMENTATION_NAME "NullCanvas.CanvasCustomSprite"
85 : : #define SERVICE_NAME "com.sun.star.rendering.CanvasCustomSprite"
86 : :
87 : 0 : ::rtl::OUString SAL_CALL CanvasCustomSprite::getImplementationName() throw( uno::RuntimeException )
88 : : {
89 : 0 : return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) );
90 : : }
91 : :
92 : 0 : sal_Bool SAL_CALL CanvasCustomSprite::supportsService( const ::rtl::OUString& ServiceName ) throw( uno::RuntimeException )
93 : : {
94 : 0 : return ServiceName == SERVICE_NAME;
95 : : }
96 : :
97 : 0 : uno::Sequence< ::rtl::OUString > SAL_CALL CanvasCustomSprite::getSupportedServiceNames() throw( uno::RuntimeException )
98 : : {
99 : 0 : uno::Sequence< ::rtl::OUString > aRet(1);
100 : 0 : aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
101 : :
102 : 0 : return aRet;
103 : : }
104 : 0 : }
105 : :
106 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|