Line data Source code
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_CANVAS_HXX
21 : #define INCLUDED_CANVAS_SOURCE_VCL_CANVAS_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/util/XUpdatable.hpp>
29 : #include <com/sun/star/rendering/XBitmapCanvas.hpp>
30 : #include <com/sun/star/rendering/XIntegerBitmap.hpp>
31 : #include <com/sun/star/rendering/XGraphicDevice.hpp>
32 : #include <com/sun/star/rendering/XBufferController.hpp>
33 :
34 : #include <cppuhelper/compbase7.hxx>
35 : #include <comphelper/uno3.hxx>
36 :
37 : #include <canvas/base/basemutexhelper.hxx>
38 : #include <canvas/base/integerbitmapbase.hxx>
39 : #include <canvas/base/graphicdevicebase.hxx>
40 :
41 : #include "canvashelper.hxx"
42 : #include "impltools.hxx"
43 : #include "devicehelper.hxx"
44 : #include "repainttarget.hxx"
45 :
46 : #define CANVAS_SERVICE_NAME "com.sun.star.rendering.Canvas.VCL"
47 : #define CANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.Canvas.VCL"
48 :
49 : namespace vclcanvas
50 : {
51 : typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::rendering::XBitmapCanvas,
52 : ::com::sun::star::rendering::XIntegerBitmap,
53 : ::com::sun::star::rendering::XGraphicDevice,
54 : ::com::sun::star::lang::XMultiServiceFactory,
55 : ::com::sun::star::util::XUpdatable,
56 : ::com::sun::star::beans::XPropertySet,
57 : ::com::sun::star::lang::XServiceName > GraphicDeviceBase_Base;
58 : typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase_Base >,
59 : DeviceHelper,
60 : tools::LocalGuard,
61 : ::cppu::OWeakObject > CanvasBase_Base;
62 : typedef ::canvas::IntegerBitmapBase<
63 : canvas::BitmapCanvasBase2<
64 : CanvasBase_Base,
65 : CanvasHelper,
66 : tools::LocalGuard,
67 : ::cppu::OWeakObject> > CanvasBaseT;
68 :
69 : /** Product of this component's factory.
70 :
71 : The Canvas object combines the actual Window canvas with
72 : the XGraphicDevice interface. This is because there's a
73 : one-to-one relation between them, anyway, since each window
74 : can have exactly one canvas and one associated
75 : XGraphicDevice. And to avoid messing around with circular
76 : references, this is implemented as one single object.
77 : */
78 : class Canvas : public CanvasBaseT,
79 : public RepaintTarget
80 : {
81 : public:
82 : Canvas( const ::com::sun::star::uno::Sequence<
83 : ::com::sun::star::uno::Any >& aArguments,
84 : const ::com::sun::star::uno::Reference<
85 : ::com::sun::star::uno::XComponentContext >& rxContext );
86 :
87 : void initialize();
88 :
89 : /// For resource tracking
90 : virtual ~Canvas();
91 :
92 : /// Dispose all internal references
93 : virtual void disposeThis() SAL_OVERRIDE;
94 :
95 : // Forwarding the XComponent implementation to the
96 : // cppu::ImplHelper templated base
97 : // Classname Base doing refcounting Base implementing the XComponent interface
98 : // | | |
99 : // V V V
100 0 : DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( Canvas, GraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase )
101 :
102 : // XServiceName
103 : virtual OUString SAL_CALL getServiceName( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 :
105 : // RepaintTarget
106 : virtual bool repaint( const GraphicObjectSharedPtr& rGrf,
107 : const com::sun::star::rendering::ViewState& viewState,
108 : const com::sun::star::rendering::RenderState& renderState,
109 : const ::Point& rPt,
110 : const ::Size& rSz,
111 : const GraphicAttr& rAttr ) const SAL_OVERRIDE;
112 :
113 : private:
114 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > maArguments;
115 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
116 : };
117 :
118 : typedef ::rtl::Reference< Canvas > CanvasRef;
119 : }
120 :
121 : #endif
122 :
123 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|