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 : : #ifndef _NULLCANVAS_SPRITECANVAS_HXX_
30 : : #define _NULLCANVAS_SPRITECANVAS_HXX_
31 : :
32 : : #include <rtl/ref.hxx>
33 : :
34 : : #include <com/sun/star/uno/XComponentContext.hpp>
35 : : #include <com/sun/star/beans/XPropertySet.hpp>
36 : : #include <com/sun/star/lang/XServiceName.hpp>
37 : : #include <com/sun/star/awt/XWindowListener.hpp>
38 : : #include <com/sun/star/rendering/XSpriteCanvas.hpp>
39 : : #include <com/sun/star/rendering/XIntegerBitmap.hpp>
40 : : #include <com/sun/star/rendering/XGraphicDevice.hpp>
41 : : #include <com/sun/star/rendering/XBufferController.hpp>
42 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
43 : :
44 : : #include <cppuhelper/compbase8.hxx>
45 : : #include <comphelper/uno3.hxx>
46 : :
47 : : #include <canvas/base/spritecanvasbase.hxx>
48 : : #include <canvas/base/disambiguationhelper.hxx>
49 : : #include <canvas/base/bufferedgraphicdevicebase.hxx>
50 : :
51 : : #include "null_spritecanvashelper.hxx"
52 : : #include "null_devicehelper.hxx"
53 : : #include "null_usagecounter.hxx"
54 : :
55 : :
56 : : namespace nullcanvas
57 : : {
58 : : typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::rendering::XSpriteCanvas,
59 : : ::com::sun::star::rendering::XIntegerBitmap,
60 : : ::com::sun::star::rendering::XGraphicDevice,
61 : : ::com::sun::star::lang::XMultiServiceFactory,
62 : : ::com::sun::star::rendering::XBufferController,
63 : : ::com::sun::star::awt::XWindowListener,
64 : : ::com::sun::star::beans::XPropertySet,
65 : : ::com::sun::star::lang::XServiceName > WindowGraphicDeviceBase_Base;
66 : : typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >,
67 : : DeviceHelper,
68 : : ::osl::MutexGuard,
69 : : ::cppu::OWeakObject > SpriteCanvasBase_Base;
70 : : /** Mixin SpriteSurface
71 : :
72 : : Have to mixin the SpriteSurface before deriving from
73 : : ::canvas::SpriteCanvasBase, as this template should already
74 : : implement some of those interface methods.
75 : :
76 : : The reason why this appears kinda convoluted is the fact that
77 : : we cannot specify non-IDL types as WeakComponentImplHelperN
78 : : template args, and furthermore, don't want to derive
79 : : ::canvas::SpriteCanvasBase directly from
80 : : ::canvas::SpriteSurface (because derivees of
81 : : ::canvas::SpriteCanvasBase have to explicitly forward the
82 : : XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS)
83 : : anyway). Basically, ::canvas::CanvasCustomSpriteBase should
84 : : remain a base class that provides implementation, not to
85 : : enforce any specific interface on its derivees.
86 : : */
87 : 0 : class SpriteCanvasBaseSpriteSurface_Base : public SpriteCanvasBase_Base,
88 : : public ::canvas::SpriteSurface
89 : : {
90 : : };
91 : :
92 : : typedef ::canvas::SpriteCanvasBase< SpriteCanvasBaseSpriteSurface_Base,
93 : : SpriteCanvasHelper,
94 : : ::osl::MutexGuard,
95 : : ::cppu::OWeakObject > SpriteCanvasBaseT;
96 : :
97 : : /** Product of this component's factory.
98 : :
99 : : The SpriteCanvas object combines the actual Window canvas with
100 : : the XGraphicDevice interface. This is because there's a
101 : : one-to-one relation between them, anyway, since each window
102 : : can have exactly one canvas and one associated
103 : : XGraphicDevice. And to avoid messing around with circular
104 : : references, this is implemented as one single object.
105 : : */
106 : 0 : class SpriteCanvas : public SpriteCanvasBaseT,
107 : : private UsageCounter< SpriteCanvas >
108 : : {
109 : : public:
110 : : SpriteCanvas( const ::com::sun::star::uno::Sequence<
111 : : ::com::sun::star::uno::Any >& aArguments,
112 : : const ::com::sun::star::uno::Reference<
113 : : ::com::sun::star::uno::XComponentContext >& rxContext );
114 : :
115 : : void initialize();
116 : :
117 : : /// Dispose all internal references
118 : : virtual void disposeThis();
119 : :
120 : : // Forwarding the XComponent implementation to the
121 : : // cppu::ImplHelper templated base
122 : : // Classname Base doing refcounting Base implementing the XComponent interface
123 : : // | | |
124 : : // V V V
125 : 0 : DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase );
126 : :
127 : : // XBufferController (partial)
128 : : virtual ::sal_Bool SAL_CALL showBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException);
129 : : virtual ::sal_Bool SAL_CALL switchBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException);
130 : :
131 : : // XSpriteCanvas (partial)
132 : : virtual sal_Bool SAL_CALL updateScreen( sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException);
133 : :
134 : : // XServiceName
135 : : virtual ::rtl::OUString SAL_CALL getServiceName( ) throw (::com::sun::star::uno::RuntimeException);
136 : :
137 : : private:
138 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > maArguments;
139 : : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
140 : : };
141 : :
142 : : typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef;
143 : : typedef ::rtl::Reference< SpriteCanvas > DeviceRef;
144 : : }
145 : :
146 : : #endif
147 : :
148 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|