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/XServiceInfo.hpp>
28 #include <com/sun/star/lang/XServiceName.hpp>
29 #include <com/sun/star/awt/XWindowListener.hpp>
30 #include <com/sun/star/util/XUpdatable.hpp>
31 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
32 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
33 #include <com/sun/star/rendering/XGraphicDevice.hpp>
34 #include <com/sun/star/rendering/XBufferController.hpp>
35 
36 #include <cppuhelper/compbase.hxx>
37 #include <comphelper/uno3.hxx>
38 
40 #include <base/spritesurface.hxx>
43 
44 #include "spritecanvashelper.hxx"
45 #include "impltools.hxx"
46 #include "spritedevicehelper.hxx"
47 #include "repainttarget.hxx"
48 
49 
50 namespace vclcanvas
51 {
52  typedef ::cppu::WeakComponentImplHelper< css::rendering::XSpriteCanvas,
53  css::rendering::XIntegerBitmap,
54  css::rendering::XGraphicDevice,
55  css::lang::XMultiServiceFactory,
56  css::rendering::XBufferController,
57  css::awt::XWindowListener,
58  css::util::XUpdatable,
59  css::beans::XPropertySet,
60  css::lang::XServiceName,
61  css::lang::XServiceInfo > WindowGraphicDeviceBase_Base;
62  typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >,
66 
84  class SpriteCanvasBaseSpriteSurface_Base : public SpriteCanvasBase_Base,
86  {
87  };
88 
89  typedef ::canvas::SpriteCanvasBase< SpriteCanvasBaseSpriteSurface_Base,
91  tools::LocalGuard,
93 
103  class SpriteCanvas : public SpriteCanvasBaseT,
104  public RepaintTarget
105  {
106  public:
107  SpriteCanvas( const css::uno::Sequence<
108  css::uno::Any >& aArguments,
109  const css::uno::Reference<
110  css::uno::XComponentContext >& rxContext );
111 
112  void initialize();
113 
115  virtual ~SpriteCanvas() override;
116 
118  virtual void disposeThis() override;
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  DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase )
126 
127  // XBufferController (partial)
128  virtual sal_Bool SAL_CALL showBuffer( sal_Bool bUpdateAll ) override;
129  virtual sal_Bool SAL_CALL switchBuffer( sal_Bool bUpdateAll ) override;
130 
131  // XSpriteCanvas (partial)
132  virtual sal_Bool SAL_CALL updateScreen( sal_Bool bUpdateAll ) override;
133 
134  // XServiceName
135  virtual OUString SAL_CALL getServiceName( ) override;
136 
137  // XServiceInfo
138  virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
139  virtual OUString SAL_CALL getImplementationName() override;
140  virtual sal_Bool SAL_CALL supportsService(const OUString&) override;
141 
142  // RepaintTarget
143  virtual bool repaint( const GraphicObjectSharedPtr& rGrf,
144  const css::rendering::ViewState& viewState,
145  const css::rendering::RenderState& renderState,
146  const ::Point& rPt,
147  const ::Size& rSz,
148  const GraphicAttr& rAttr ) const override;
149 
151  OutDevProviderSharedPtr const & getFrontBuffer() const { return maDeviceHelper.getOutDev(); }
153  BackBufferSharedPtr const & getBackBuffer() const { return maDeviceHelper.getBackBuffer(); }
154 
155  private:
156  css::uno::Sequence< css::uno::Any > maArguments;
157  };
158 
159  typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef;
160  typedef ::rtl::Reference< SpriteCanvas > DeviceRef;
161 
162 }
163 
164 #endif
165 
166 /* 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
::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
::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, css::lang::XServiceInfo > WindowGraphicDeviceBase_Base
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 css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
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
virtual OUString SAL_CALL getImplementationName() override
BackBufferSharedPtr const & getBackBuffer() const
Get window for this canvas.
virtual sal_Bool SAL_CALL supportsService(const OUString &) override
::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