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/.
12 #include <rtl/ref.hxx>
14 #include <com/sun/star/uno/XComponentContext.hpp>
15 #include <com/sun/star/beans/XPropertySet.hpp>
16 #include <com/sun/star/lang/XServiceName.hpp>
17 #include <com/sun/star/awt/XWindowListener.hpp>
18 #include <com/sun/star/util/XUpdatable.hpp>
19 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
20 #include <com/sun/star/rendering/XGraphicDevice.hpp>
21 #include <com/sun/star/rendering/XBufferController.hpp>
23 #include <cppuhelper/compbase.hxx>
24 #include <comphelper/uno3.hxx>
26 #include <base/canvasbase.hxx>
27 #include <base/disambiguationhelper.hxx>
28 #include <base/bufferedgraphicdevicebase.hxx>
30 #include "ogl_spritedevicehelper.hxx"
31 #include "ogl_canvashelper.hxx"
36 class CanvasCustomSprite
;
38 typedef ::cppu::WeakComponentImplHelper
< css::rendering::XSpriteCanvas
,
39 css::rendering::XGraphicDevice
,
40 css::lang::XMultiServiceFactory
,
41 css::rendering::XBufferController
,
42 css::awt::XWindowListener
,
43 css::util::XUpdatable
,
44 css::beans::XPropertySet
,
45 css::lang::XServiceName
> WindowGraphicDeviceBase_Base
;
46 typedef ::canvas::BufferedGraphicDeviceBase
<
47 ::canvas::DisambiguationHelper
< WindowGraphicDeviceBase_Base
>,
50 ::cppu::OWeakObject
> SpriteCanvasDeviceBaseT
;
52 typedef ::canvas::CanvasBase
< SpriteCanvasDeviceBaseT
,
55 ::cppu::OWeakObject
> SpriteCanvasBaseT
;
57 /** Product of this component's factory.
59 The SpriteCanvas object combines the actual Window canvas with
60 the XGraphicDevice interface. This is because there's a
61 one-to-one relation between them, anyway, since each window
62 can have exactly one canvas and one associated
63 XGraphicDevice. And to avoid messing around with circular
64 references, this is implemented as one single object.
66 class SpriteCanvas
: public SpriteCanvasBaseT
69 SpriteCanvas( const css::uno::Sequence
<
70 css::uno::Any
>& aArguments
,
71 const css::uno::Reference
<
72 css::uno::XComponentContext
>& rxContext
);
76 /// Dispose all internal references
77 virtual void disposeThis() override
;
79 // Forwarding the XComponent implementation to the
80 // cppu::ImplHelper templated base
81 // Classname Base doing refcounting Base implementing the XComponent interface
84 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas
, WindowGraphicDeviceBase_Base
, ::cppu::WeakComponentImplHelperBase
)
86 // XBufferController (partial)
87 virtual sal_Bool SAL_CALL
showBuffer( sal_Bool bUpdateAll
) override
;
88 virtual sal_Bool SAL_CALL
switchBuffer( sal_Bool bUpdateAll
) override
;
91 virtual css::uno::Reference
< css::rendering::XAnimatedSprite
> SAL_CALL
createSpriteFromAnimation( const css::uno::Reference
< css::rendering::XAnimation
>& animation
) override
;
92 virtual css::uno::Reference
< css::rendering::XAnimatedSprite
> SAL_CALL
createSpriteFromBitmaps( const css::uno::Sequence
< css::uno::Reference
< css::rendering::XBitmap
> >& animationBitmaps
, ::sal_Int8 interpolationMode
) override
;
93 virtual css::uno::Reference
< css::rendering::XCustomSprite
> SAL_CALL
createCustomSprite( const css::geometry::RealSize2D
& spriteSize
) override
;
94 virtual css::uno::Reference
< css::rendering::XSprite
> SAL_CALL
createClonedSprite( const css::uno::Reference
< css::rendering::XSprite
>& original
) override
;
95 virtual sal_Bool SAL_CALL
updateScreen( sal_Bool bUpdateAll
) override
;
98 virtual OUString SAL_CALL
getServiceName( ) override
;
100 void show( const ::rtl::Reference
< CanvasCustomSprite
>& );
101 void hide( const ::rtl::Reference
< CanvasCustomSprite
>& );
103 /** Write out recorded actions
105 void renderRecordedActions() const;
108 css::uno::Sequence
< css::uno::Any
> maArguments
;
111 typedef ::rtl::Reference
< SpriteCanvas
> SpriteCanvasRef
;
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */