LibreOffice Module canvas (master)  1
spritecanvas.hxx
Go to the documentation of this file.
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 INCLUDED_CANVAS_SOURCE_VCL_SPRITECANVAS_HXX
21 #define INCLUDED_CANVAS_SOURCE_VCL_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/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>
34 
35 #include <cppuhelper/compbase.hxx>
36 #include <comphelper/uno3.hxx>
37 
39 #include <base/spritesurface.hxx>
42 
43 #include "spritecanvashelper.hxx"
44 #include "impltools.hxx"
45 #include "spritedevicehelper.hxx"
46 #include "repainttarget.hxx"
47 
48 
49 #define SPRITECANVAS_SERVICE_NAME "com.sun.star.rendering.SpriteCanvas.VCL"
50 #define SPRITECANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.SpriteCanvas.VCL"
51 
52 namespace vclcanvas
53 {
54  typedef ::cppu::WeakComponentImplHelper< css::rendering::XSpriteCanvas,
55  css::rendering::XIntegerBitmap,
56  css::rendering::XGraphicDevice,
57  css::lang::XMultiServiceFactory,
58  css::rendering::XBufferController,
59  css::awt::XWindowListener,
60  css::util::XUpdatable,
61  css::beans::XPropertySet,
62  css::lang::XServiceName > WindowGraphicDeviceBase_Base;
63  typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >,
67 
85  class SpriteCanvasBaseSpriteSurface_Base : public SpriteCanvasBase_Base,
87  {
88  };
89 
90  typedef ::canvas::SpriteCanvasBase< SpriteCanvasBaseSpriteSurface_Base,
92  tools::LocalGuard,
94 
104  class SpriteCanvas : public SpriteCanvasBaseT,
105  public RepaintTarget
106  {
107  public:
108  SpriteCanvas( const css::uno::Sequence<
109  css::uno::Any >& aArguments,
110  const css::uno::Reference<
111  css::uno::XComponentContext >& rxContext );
112 
113  void initialize();
114 
116  virtual ~SpriteCanvas() override;
117 
119  virtual void disposeThis() override;
120 
121  // Forwarding the XComponent implementation to the
122  // cppu::ImplHelper templated base
123  // Classname Base doing refcounting Base implementing the XComponent interface
124  // | | |
125  // V V V
126  DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase )
127 
128  // XBufferController (partial)
129  virtual sal_Bool SAL_CALL showBuffer( sal_Bool bUpdateAll ) override;
130  virtual sal_Bool SAL_CALL switchBuffer( sal_Bool bUpdateAll ) override;
131 
132  // XSpriteCanvas (partial)
133  virtual sal_Bool SAL_CALL updateScreen( sal_Bool bUpdateAll ) override;
134 
135  // XServiceName
136  virtual OUString SAL_CALL getServiceName( ) override;
137 
138  // RepaintTarget
139  virtual bool repaint( const GraphicObjectSharedPtr& rGrf,
140  const css::rendering::ViewState& viewState,
141  const css::rendering::RenderState& renderState,
142  const ::Point& rPt,
143  const ::Size& rSz,
144  const GraphicAttr& rAttr ) const override;
145 
147  OutDevProviderSharedPtr const & getFrontBuffer() const { return maDeviceHelper.getOutDev(); }
149  BackBufferSharedPtr const & getBackBuffer() const { return maDeviceHelper.getBackBuffer(); }
150 
151  private:
152  css::uno::Sequence< css::uno::Any > maArguments;
153  };
154 
155  typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef;
156  typedef ::rtl::Reference< SpriteCanvas > DeviceRef;
157 
158 }
159 
160 #endif
161 
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< OutDevProvider > OutDevProviderSharedPtr
Canvas surface containing sprites.
virtual void disposeThis() override
Dispose all internal references.
virtual sal_Bool SAL_CALL updateScreen(sal_Bool bUpdateAll) override
::cppu::WeakComponentImplHelper< css::rendering::XSpriteCanvas, css::rendering::XIntegerBitmap, css::rendering::XGraphicDevice, css::lang::XMultiServiceFactory, css::rendering::XBufferController, css::awt::XWindowListener, css::util::XUpdatable, css::beans::XPropertySet, css::lang::XServiceName > WindowGraphicDeviceBase_Base
::rtl::Reference< SpriteCanvas > DeviceRef
#define DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS(classname, baseclass, implhelper)
OutDevProviderSharedPtr const & getFrontBuffer() const
Get backbuffer for this canvas.
Sequence< PropertyValue > aArguments
::rtl::Reference< SpriteCanvas > SpriteCanvasRef
::canvas::SpriteCanvasBase< SpriteCanvasBaseSpriteSurface_Base, SpriteCanvasHelper, tools::LocalGuard,::cppu::OWeakObject > SpriteCanvasBaseT
std::shared_ptr< GraphicObject > GraphicObjectSharedPtr
Product of this component's factory.
css::uno::Sequence< css::uno::Any > maArguments
Target interface for XCachedPrimitive implementations.
virtual sal_Bool SAL_CALL switchBuffer(sal_Bool bUpdateAll) override
std::shared_ptr< BackBuffer > BackBufferSharedPtr
Definition: backbuffer.hxx:55
unsigned char sal_Bool
virtual ~SpriteCanvas() override
For resource tracking.
virtual OUString SAL_CALL getServiceName() override
SpriteCanvas(const css::uno::Sequence< css::uno::Any > &aArguments, const css::uno::Reference< css::uno::XComponentContext > &rxContext)
virtual sal_Bool SAL_CALL showBuffer(sal_Bool bUpdateAll) override
BackBufferSharedPtr const & getBackBuffer() const
Get window for this canvas.
::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >, SpriteDeviceHelper, tools::LocalGuard,::cppu::OWeakObject > SpriteCanvasBase_Base
virtual bool repaint(const GraphicObjectSharedPtr &rGrf, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState, const ::Point &rPt, const ::Size &rSz, const GraphicAttr &rAttr) const override