Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _NULLCANVAS_SPRITECANVAS_HXX_
21 : #define _NULLCANVAS_SPRITECANVAS_HXX_
22 :
23 : #include <rtl/ref.hxx>
24 :
25 : #include <com/sun/star/uno/XComponentContext.hpp>
26 : #include <com/sun/star/beans/XPropertySet.hpp>
27 : #include <com/sun/star/lang/XServiceName.hpp>
28 : #include <com/sun/star/awt/XWindowListener.hpp>
29 : #include <com/sun/star/rendering/XSpriteCanvas.hpp>
30 : #include <com/sun/star/rendering/XIntegerBitmap.hpp>
31 : #include <com/sun/star/rendering/XGraphicDevice.hpp>
32 : #include <com/sun/star/rendering/XBufferController.hpp>
33 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 :
35 : #include <cppuhelper/compbase8.hxx>
36 : #include <comphelper/uno3.hxx>
37 :
38 : #include <canvas/base/spritecanvasbase.hxx>
39 : #include <canvas/base/disambiguationhelper.hxx>
40 : #include <canvas/base/bufferedgraphicdevicebase.hxx>
41 :
42 : #include "null_spritecanvashelper.hxx"
43 : #include "null_devicehelper.hxx"
44 : #include "null_usagecounter.hxx"
45 :
46 :
47 : namespace nullcanvas
48 : {
49 : typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::rendering::XSpriteCanvas,
50 : ::com::sun::star::rendering::XIntegerBitmap,
51 : ::com::sun::star::rendering::XGraphicDevice,
52 : ::com::sun::star::lang::XMultiServiceFactory,
53 : ::com::sun::star::rendering::XBufferController,
54 : ::com::sun::star::awt::XWindowListener,
55 : ::com::sun::star::beans::XPropertySet,
56 : ::com::sun::star::lang::XServiceName > WindowGraphicDeviceBase_Base;
57 : typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >,
58 : DeviceHelper,
59 : ::osl::MutexGuard,
60 : ::cppu::OWeakObject > SpriteCanvasBase_Base;
61 : /** Mixin SpriteSurface
62 :
63 : Have to mixin the SpriteSurface before deriving from
64 : ::canvas::SpriteCanvasBase, as this template should already
65 : implement some of those interface methods.
66 :
67 : The reason why this appears kinda convoluted is the fact that
68 : we cannot specify non-IDL types as WeakComponentImplHelperN
69 : template args, and furthermore, don't want to derive
70 : ::canvas::SpriteCanvasBase directly from
71 : ::canvas::SpriteSurface (because derivees of
72 : ::canvas::SpriteCanvasBase have to explicitly forward the
73 : XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS)
74 : anyway). Basically, ::canvas::CanvasCustomSpriteBase should
75 : remain a base class that provides implementation, not to
76 : enforce any specific interface on its derivees.
77 : */
78 0 : class SpriteCanvasBaseSpriteSurface_Base : public SpriteCanvasBase_Base,
79 : public ::canvas::SpriteSurface
80 : {
81 : };
82 :
83 : typedef ::canvas::SpriteCanvasBase< SpriteCanvasBaseSpriteSurface_Base,
84 : SpriteCanvasHelper,
85 : ::osl::MutexGuard,
86 : ::cppu::OWeakObject > SpriteCanvasBaseT;
87 :
88 : /** Product of this component's factory.
89 :
90 : The SpriteCanvas object combines the actual Window canvas with
91 : the XGraphicDevice interface. This is because there's a
92 : one-to-one relation between them, anyway, since each window
93 : can have exactly one canvas and one associated
94 : XGraphicDevice. And to avoid messing around with circular
95 : references, this is implemented as one single object.
96 : */
97 0 : class SpriteCanvas : public SpriteCanvasBaseT,
98 : private UsageCounter< SpriteCanvas >
99 : {
100 : public:
101 : SpriteCanvas( const ::com::sun::star::uno::Sequence<
102 : ::com::sun::star::uno::Any >& aArguments,
103 : const ::com::sun::star::uno::Reference<
104 : ::com::sun::star::uno::XComponentContext >& rxContext );
105 :
106 : void initialize();
107 :
108 : /// Dispose all internal references
109 : virtual void disposeThis();
110 :
111 : // Forwarding the XComponent implementation to the
112 : // cppu::ImplHelper templated base
113 : // Classname Base doing refcounting Base implementing the XComponent interface
114 : // | | |
115 : // V V V
116 0 : DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase );
117 :
118 : // XBufferController (partial)
119 : virtual ::sal_Bool SAL_CALL showBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException);
120 : virtual ::sal_Bool SAL_CALL switchBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException);
121 :
122 : // XSpriteCanvas (partial)
123 : virtual sal_Bool SAL_CALL updateScreen( sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException);
124 :
125 : // XServiceName
126 : virtual ::rtl::OUString SAL_CALL getServiceName( ) throw (::com::sun::star::uno::RuntimeException);
127 :
128 : private:
129 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > maArguments;
130 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
131 : };
132 :
133 : typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef;
134 : typedef ::rtl::Reference< SpriteCanvas > DeviceRef;
135 : }
136 :
137 : #endif
138 :
139 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|