LibreOffice Module canvas (master)  1
dx_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/XServiceName.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/awt/XWindowListener.hpp>
29 #include <com/sun/star/awt/XTopWindow.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 "dx_bitmapprovider.hxx"
46 #include "dx_surfacebitmap.hxx"
47 #include "dx_impltools.hxx"
49 
50 
51 namespace dxcanvas
52 {
53  typedef ::cppu::WeakComponentImplHelper< css::rendering::XSpriteCanvas,
54  css::rendering::XIntegerBitmap,
55  css::rendering::XGraphicDevice,
56  css::lang::XMultiServiceFactory,
57  css::rendering::XBufferController,
58  css::awt::XWindowListener,
59  css::util::XUpdatable,
60  css::beans::XPropertySet,
61  css::lang::XServiceName,
62  css::lang::XServiceInfo> WindowGraphicDeviceBase_Base;
63  typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >,
65  ::osl::MutexGuard,
84  class SpriteCanvasBaseSpriteSurface_Base : public SpriteCanvasBase_Base,
86  {
87  };
88 
89  typedef ::canvas::SpriteCanvasBase< SpriteCanvasBaseSpriteSurface_Base,
91  ::osl::MutexGuard,
93 
103  class SpriteCanvas : public SpriteCanvasBaseT, public BitmapProvider
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 void disposeThis() override;
115 
116  // Forwarding the XComponent implementation to the
117  // cppu::ImplHelper templated base
118  // Classname Base doing refcounting Base implementing the XComponent interface
119  // | | |
120  // V V V
121  DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase )
122 
123  // XBufferController (partial)
124  virtual sal_Bool SAL_CALL showBuffer( sal_Bool bUpdateAll ) override;
125  virtual sal_Bool SAL_CALL switchBuffer( sal_Bool bUpdateAll ) override;
126 
127  // XSpriteCanvas (partial)
128  virtual sal_Bool SAL_CALL updateScreen( sal_Bool bUpdateAll ) override;
129 
130  // XServiceName
131  virtual OUString SAL_CALL getServiceName( ) override;
132 
133  // XServiceInfo
134  virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames( ) override;
135  virtual OUString SAL_CALL getImplementationName( ) override;
136  virtual sal_Bool SAL_CALL supportsService( const OUString& ) override;
137 
140 
143 
144  // BitmapProvider
145  virtual IBitmapSharedPtr getBitmap() const override;
146 
147  private:
148  css::uno::Sequence< css::uno::Any > maArguments;
149  css::uno::Reference< css::uno::XComponentContext > mxComponentContext;
150  };
151 
152  typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef;
153 }
154 
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Canvas surface containing sprites.
css::uno::Sequence< css::uno::Any > maArguments
std::shared_ptr< IBitmap > IBitmapSharedPtr
Definition: dx_ibitmap.hxx:58
std::shared_ptr< IDXRenderModule > IDXRenderModuleSharedPtr
virtual sal_Bool SAL_CALL updateScreen(sal_Bool bUpdateAll) override
virtual void disposeThis() override
Dispose all internal references.
#define DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS(classname, baseclass, implhelper)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
::rtl::Reference< SpriteCanvas > SpriteCanvasRef
Sequence< PropertyValue > aArguments
virtual sal_Bool SAL_CALL supportsService(const OUString &) override
unsigned char sal_Bool
const IDXRenderModuleSharedPtr & getRenderModule() const
Retrieve rendermodule object for this Canvas.
virtual sal_Bool SAL_CALL switchBuffer(sal_Bool bUpdateAll) override
virtual sal_Bool SAL_CALL showBuffer(sal_Bool bUpdateAll) override
virtual OUString SAL_CALL getImplementationName() override
::canvas::SpriteCanvasBase< SpriteCanvasBaseSpriteSurface_Base, SpriteCanvasHelper,::osl::MutexGuard,::cppu::OWeakObject > SpriteCanvasBaseT
std::shared_ptr< DXSurfaceBitmap > DXSurfaceBitmapSharedPtr
::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
virtual IBitmapSharedPtr getBitmap() const override
SpriteCanvas(const css::uno::Sequence< css::uno::Any > &aArguments, const css::uno::Reference< css::uno::XComponentContext > &rxContext)
const DXSurfaceBitmapSharedPtr & getBackBuffer() const
Get backbuffer for this canvas.
virtual OUString SAL_CALL getServiceName() override
Product of this component's factory.
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >, SpriteDeviceHelper,::osl::MutexGuard,::cppu::OWeakObject > SpriteCanvasBase_Base