1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: null_spritecanvas.hxx,v $
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 #ifndef _NULLCANVAS_SPRITECANVAS_HXX_
32 #define _NULLCANVAS_SPRITECANVAS_HXX_
34 #include <rtl/ref.hxx>
36 #include <com/sun/star/uno/XComponentContext.hpp>
37 #include <com/sun/star/beans/XPropertySet.hpp>
38 #include <com/sun/star/lang/XServiceName.hpp>
39 #include <com/sun/star/awt/XWindowListener.hpp>
40 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
41 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
42 #include <com/sun/star/rendering/XGraphicDevice.hpp>
43 #include <com/sun/star/rendering/XBufferController.hpp>
44 #include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
46 #include <cppuhelper/compbase8.hxx>
47 #include <comphelper/uno3.hxx>
49 #include <canvas/base/spritecanvasbase.hxx>
50 #include <canvas/base/basemutexhelper.hxx>
51 #include <canvas/base/bufferedgraphicdevicebase.hxx>
53 #include "null_spritecanvashelper.hxx"
54 #include "null_devicehelper.hxx"
55 #include "null_usagecounter.hxx"
60 typedef ::cppu::WeakComponentImplHelper8
< ::com::sun::star::rendering::XSpriteCanvas
,
61 ::com::sun::star::rendering::XIntegerBitmap
,
62 ::com::sun::star::rendering::XGraphicDevice
,
63 ::com::sun::star::rendering::XParametricPolyPolygon2DFactory
,
64 ::com::sun::star::rendering::XBufferController
,
65 ::com::sun::star::awt::XWindowListener
,
66 ::com::sun::star::beans::XPropertySet
,
67 ::com::sun::star::lang::XServiceName
> WindowGraphicDeviceBase_Base
;
68 typedef ::canvas::BufferedGraphicDeviceBase
< ::canvas::BaseMutexHelper
< WindowGraphicDeviceBase_Base
>,
71 ::cppu::OWeakObject
> SpriteCanvasBase_Base
;
72 /** Mixin SpriteSurface
74 Have to mixin the SpriteSurface before deriving from
75 ::canvas::SpriteCanvasBase, as this template should already
76 implement some of those interface methods.
78 The reason why this appears kinda convoluted is the fact that
79 we cannot specify non-IDL types as WeakComponentImplHelperN
80 template args, and furthermore, don't want to derive
81 ::canvas::SpriteCanvasBase directly from
82 ::canvas::SpriteSurface (because derivees of
83 ::canvas::SpriteCanvasBase have to explicitely forward the
84 XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS)
85 anyway). Basically, ::canvas::CanvasCustomSpriteBase should
86 remain a base class that provides implementation, not to
87 enforce any specific interface on its derivees.
89 class SpriteCanvasBaseSpriteSurface_Base
: public SpriteCanvasBase_Base
,
90 public ::canvas::SpriteSurface
94 typedef ::canvas::SpriteCanvasBase
< SpriteCanvasBaseSpriteSurface_Base
,
97 ::cppu::OWeakObject
> SpriteCanvasBaseT
;
99 /** Product of this component's factory.
101 The SpriteCanvas object combines the actual Window canvas with
102 the XGraphicDevice interface. This is because there's a
103 one-to-one relation between them, anyway, since each window
104 can have exactly one canvas and one associated
105 XGraphicDevice. And to avoid messing around with circular
106 references, this is implemented as one single object.
108 class SpriteCanvas
: public SpriteCanvasBaseT
,
109 private UsageCounter
< SpriteCanvas
>
112 SpriteCanvas( const ::com::sun::star::uno::Sequence
<
113 ::com::sun::star::uno::Any
>& aArguments
,
114 const ::com::sun::star::uno::Reference
<
115 ::com::sun::star::uno::XComponentContext
>& rxContext
);
119 #if defined __SUNPRO_CC
120 using SpriteCanvasBaseT::disposing
;
123 /// Dispose all internal references
124 virtual void SAL_CALL
disposing();
126 // Forwarding the XComponent implementation to the
127 // cppu::ImplHelper templated base
128 // Classname Base doing refcounting Base implementing the XComponent interface
131 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas
, WindowGraphicDeviceBase_Base
, ::cppu::WeakComponentImplHelperBase
);
133 // XBufferController (partial)
134 virtual ::sal_Bool SAL_CALL
showBuffer( ::sal_Bool bUpdateAll
) throw (::com::sun::star::uno::RuntimeException
);
135 virtual ::sal_Bool SAL_CALL
switchBuffer( ::sal_Bool bUpdateAll
) throw (::com::sun::star::uno::RuntimeException
);
137 // XSpriteCanvas (partial)
138 virtual sal_Bool SAL_CALL
updateScreen( sal_Bool bUpdateAll
) throw (::com::sun::star::uno::RuntimeException
);
141 virtual ::rtl::OUString SAL_CALL
getServiceName( ) throw (::com::sun::star::uno::RuntimeException
);
144 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> maArguments
;
145 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> mxComponentContext
;
148 typedef ::rtl::Reference
< SpriteCanvas
> SpriteCanvasRef
;
149 typedef ::rtl::Reference
< SpriteCanvas
> DeviceRef
;