1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_CANVAS_SOURCE_DIRECTX_DX_SPRITECANVAS_HXX
21 #define INCLUDED_CANVAS_SOURCE_DIRECTX_DX_SPRITECANVAS_HXX
23 #include <rtl/ref.hxx>
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/util/XUpdatable.hpp>
30 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
31 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
32 #include <com/sun/star/rendering/XGraphicDevice.hpp>
33 #include <com/sun/star/rendering/XBufferController.hpp>
35 #include <cppuhelper/compbase9.hxx>
36 #include <comphelper/uno3.hxx>
38 #include <canvas/base/spritecanvasbase.hxx>
39 #include <canvas/base/disambiguationhelper.hxx>
40 #include <canvas/base/bufferedgraphicdevicebase.hxx>
42 #include "dx_bitmapprovider.hxx"
43 #include "dx_spritecanvashelper.hxx"
44 #include "dx_surfacebitmap.hxx"
45 #include "dx_impltools.hxx"
46 #include "dx_spritedevicehelper.hxx"
51 typedef ::cppu::WeakComponentImplHelper9
< ::com::sun::star::rendering::XSpriteCanvas
,
52 ::com::sun::star::rendering::XIntegerBitmap
,
53 ::com::sun::star::rendering::XGraphicDevice
,
54 ::com::sun::star::lang::XMultiServiceFactory
,
55 ::com::sun::star::rendering::XBufferController
,
56 ::com::sun::star::awt::XWindowListener
,
57 ::com::sun::star::util::XUpdatable
,
58 ::com::sun::star::beans::XPropertySet
,
59 ::com::sun::star::lang::XServiceName
> WindowGraphicDeviceBase_Base
;
60 typedef ::canvas::BufferedGraphicDeviceBase
< ::canvas::DisambiguationHelper
< WindowGraphicDeviceBase_Base
>,
63 ::cppu::OWeakObject
> SpriteCanvasBase_Base
;
64 /** Mixin SpriteSurface
66 Have to mixin the SpriteSurface before deriving from
67 ::canvas::SpriteCanvasBase, as this template should already
68 implement some of those interface methods.
70 The reason why this appears kinda convoluted is the fact that
71 we cannot specify non-IDL types as WeakComponentImplHelperN
72 template args, and furthermore, don't want to derive
73 ::canvas::SpriteCanvasBase directly from
74 ::canvas::SpriteSurface (because derivees of
75 ::canvas::SpriteCanvasBase have to explicitly forward the
76 XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS)
77 anyway). Basically, ::canvas::CanvasCustomSpriteBase should
78 remain a base class that provides implementation, not to
79 enforce any specific interface on its derivees.
81 class SpriteCanvasBaseSpriteSurface_Base
: public SpriteCanvasBase_Base
,
82 public ::canvas::SpriteSurface
86 typedef ::canvas::SpriteCanvasBase
< SpriteCanvasBaseSpriteSurface_Base
,
89 ::cppu::OWeakObject
> SpriteCanvasBaseT
;
91 /** Product of this component's factory.
93 The SpriteCanvas object combines the actual Window canvas with
94 the XGraphicDevice interface. This is because there's a
95 one-to-one relation between them, anyway, since each window
96 can have exactly one canvas and one associated
97 XGraphicDevice. And to avoid messing around with circular
98 references, this is implemented as one single object.
100 class SpriteCanvas
: public SpriteCanvasBaseT
, public BitmapProvider
103 SpriteCanvas( const ::com::sun::star::uno::Sequence
<
104 ::com::sun::star::uno::Any
>& aArguments
,
105 const ::com::sun::star::uno::Reference
<
106 ::com::sun::star::uno::XComponentContext
>& rxContext
);
110 /// Dispose all internal references
111 virtual void disposeThis() SAL_OVERRIDE
;
113 // Forwarding the XComponent implementation to the
114 // cppu::ImplHelper templated base
115 // Classname Base doing refcounting Base implementing the XComponent interface
118 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas
, WindowGraphicDeviceBase_Base
, ::cppu::WeakComponentImplHelperBase
)
120 // XBufferController (partial)
121 virtual sal_Bool SAL_CALL
showBuffer( sal_Bool bUpdateAll
) throw (::com::sun::star::uno::RuntimeException
);
122 virtual sal_Bool SAL_CALL
switchBuffer( sal_Bool bUpdateAll
) throw (::com::sun::star::uno::RuntimeException
);
124 // XSpriteCanvas (partial)
125 virtual sal_Bool SAL_CALL
updateScreen( sal_Bool bUpdateAll
) throw (::com::sun::star::uno::RuntimeException
);
128 virtual OUString SAL_CALL
getServiceName( ) throw (::com::sun::star::uno::RuntimeException
);
130 /// Retrieve rendermodule object for this Canvas
131 const IDXRenderModuleSharedPtr
& getRenderModule() const;
133 /// Get backbuffer for this canvas
134 const DXSurfaceBitmapSharedPtr
& getBackBuffer() const;
137 virtual IBitmapSharedPtr
getBitmap() const;
140 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> maArguments
;
141 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> mxComponentContext
;
144 typedef ::rtl::Reference
< SpriteCanvas
> SpriteCanvasRef
;
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */