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 #pragma once
21 
22 #include <rtl/ref.hxx>
23 
24 #include <com/sun/star/uno/XComponentContext.hpp>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/lang/XServiceInfo.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 namespace vclcanvas
50 {
51  typedef ::cppu::WeakComponentImplHelper< css::rendering::XSpriteCanvas,
52  css::rendering::XIntegerBitmap,
53  css::rendering::XGraphicDevice,
54  css::lang::XMultiServiceFactory,
55  css::rendering::XBufferController,
56  css::awt::XWindowListener,
57  css::util::XUpdatable,
58  css::beans::XPropertySet,
59  css::lang::XServiceName,
60  css::lang::XServiceInfo > WindowGraphicDeviceBase_Base;
61  typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >,
65 
83  class SpriteCanvasBaseSpriteSurface_Base : public SpriteCanvasBase_Base,
85  {
86  };
87 
88  typedef ::canvas::SpriteCanvasBase< SpriteCanvasBaseSpriteSurface_Base,
90  tools::LocalGuard,
92 
102  class SpriteCanvas : public SpriteCanvasBaseT,
103  public RepaintTarget
104  {
105  public:
106  SpriteCanvas( const css::uno::Sequence<
107  css::uno::Any >& aArguments,
108  const css::uno::Reference<
109  css::uno::XComponentContext >& rxContext );
110 
111  void initialize();
112 
114  virtual ~SpriteCanvas() override;
115 
117  virtual void disposeThis() override;
118 
119  // Forwarding the XComponent implementation to the
120  // cppu::ImplHelper templated base
121  // Classname Base doing refcounting Base implementing the XComponent interface
122  // | | |
123  // V V V
124  DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase )
125 
126  // XBufferController (partial)
127  virtual sal_Bool SAL_CALL showBuffer( sal_Bool bUpdateAll ) override;
128  virtual sal_Bool SAL_CALL switchBuffer( sal_Bool bUpdateAll ) override;
129 
130  // XSpriteCanvas (partial)
131  virtual sal_Bool SAL_CALL updateScreen( sal_Bool bUpdateAll ) override;
132 
133  // XServiceName
134  virtual OUString SAL_CALL getServiceName( ) override;
135 
136  // XServiceInfo
137  virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
138  virtual OUString SAL_CALL getImplementationName() override;
139  virtual sal_Bool SAL_CALL supportsService(const OUString&) override;
140 
141  // RepaintTarget
142  virtual bool repaint( const GraphicObjectSharedPtr& rGrf,
143  const css::rendering::ViewState& viewState,
144  const css::rendering::RenderState& renderState,
145  const ::Point& rPt,
146  const ::Size& rSz,
147  const GraphicAttr& rAttr ) const override;
148 
150  OutDevProviderSharedPtr const & getFrontBuffer() const { return maDeviceHelper.getOutDev(); }
152  BackBufferSharedPtr const & getBackBuffer() const { return maDeviceHelper.getBackBuffer(); }
153 
154  private:
155  css::uno::Sequence< css::uno::Any > maArguments;
156  };
157 
158  typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef;
159  typedef ::rtl::Reference< SpriteCanvas > DeviceRef;
160 
161 }
162 
163 /* 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:54
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