1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_CANVAS_SOURCE_DIRECTX_DX_CANVAS_HXX
21 #define INCLUDED_CANVAS_SOURCE_DIRECTX_DX_CANVAS_HXX
23 #include <rtl/ref.hxx>
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>
34 #include <cppuhelper/compbase7.hxx>
35 #include <cppuhelper/compbase6.hxx>
36 #include <comphelper/uno3.hxx>
38 #include <canvas/base/integerbitmapbase.hxx>
39 #include <canvas/base/basemutexhelper.hxx>
40 #include <canvas/base/graphicdevicebase.hxx>
42 #include "dx_bitmapprovider.hxx"
43 #include "dx_canvashelper.hxx"
44 #include "dx_bitmapcanvashelper.hxx"
45 #include "dx_impltools.hxx"
46 #include "dx_devicehelper.hxx"
51 typedef ::cppu::WeakComponentImplHelper6
< ::com::sun::star::rendering::XCanvas
,
52 ::com::sun::star::rendering::XGraphicDevice
,
53 ::com::sun::star::lang::XMultiServiceFactory
,
54 ::com::sun::star::util::XUpdatable
,
55 ::com::sun::star::beans::XPropertySet
,
56 ::com::sun::star::lang::XServiceName
> GraphicDeviceBase1_Base
;
57 typedef ::canvas::GraphicDeviceBase
< ::canvas::BaseMutexHelper
< GraphicDeviceBase1_Base
>,
60 ::cppu::OWeakObject
> CanvasBase1_Base
;
61 typedef ::canvas::CanvasBase
< CanvasBase1_Base
,
64 ::cppu::OWeakObject
> CanvasBaseT
;
66 /** Product of this component's factory.
68 The Canvas object combines the actual Window canvas with
69 the XGraphicDevice interface. This is because there's a
70 one-to-one relation between them, anyway, since each window
71 can have exactly one canvas and one associated
72 XGraphicDevice. And to avoid messing around with circular
73 references, this is implemented as one single object.
75 class Canvas
: public CanvasBaseT
78 Canvas( const ::com::sun::star::uno::Sequence
<
79 ::com::sun::star::uno::Any
>& aArguments
,
80 const ::com::sun::star::uno::Reference
<
81 ::com::sun::star::uno::XComponentContext
>& rxContext
);
85 /// Dispose all internal references
86 virtual void disposeThis() SAL_OVERRIDE
;
88 // Forwarding the XComponent implementation to the
89 // cppu::ImplHelper templated base
90 // Classname Base doing refcounting Base implementing the XComponent interface
93 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( Canvas
, GraphicDeviceBase1_Base
, ::cppu::WeakComponentImplHelperBase
)
96 virtual OUString SAL_CALL
getServiceName( ) throw (::com::sun::star::uno::RuntimeException
);
99 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> maArguments
;
100 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> mxComponentContext
;
103 typedef ::rtl::Reference
< Canvas
> CanvasRef
;
107 typedef ::cppu::WeakComponentImplHelper7
< ::com::sun::star::rendering::XBitmapCanvas
,
108 ::com::sun::star::rendering::XIntegerBitmap
,
109 ::com::sun::star::rendering::XGraphicDevice
,
110 ::com::sun::star::lang::XMultiServiceFactory
,
111 ::com::sun::star::util::XUpdatable
,
112 ::com::sun::star::beans::XPropertySet
,
113 ::com::sun::star::lang::XServiceName
> GraphicDeviceBase2_Base
;
114 typedef ::canvas::GraphicDeviceBase
< ::canvas::BaseMutexHelper
< GraphicDeviceBase2_Base
>,
117 ::cppu::OWeakObject
> CanvasBase2_Base
;
118 typedef ::canvas::IntegerBitmapBase
<
119 canvas::BitmapCanvasBase2
<
123 ::cppu::OWeakObject
> > BitmapCanvasBaseT
;
125 /** Product of this component's factory.
127 The Canvas object combines the actual Window canvas with
128 the XGraphicDevice interface. This is because there's a
129 one-to-one relation between them, anyway, since each window
130 can have exactly one canvas and one associated
131 XGraphicDevice. And to avoid messing around with circular
132 references, this is implemented as one single object.
134 class BitmapCanvas
: public BitmapCanvasBaseT
, public BitmapProvider
137 BitmapCanvas( const ::com::sun::star::uno::Sequence
<
138 ::com::sun::star::uno::Any
>& aArguments
,
139 const ::com::sun::star::uno::Reference
<
140 ::com::sun::star::uno::XComponentContext
>& rxContext
);
144 /// Dispose all internal references
145 virtual void disposeThis() SAL_OVERRIDE
;
147 // Forwarding the XComponent implementation to the
148 // cppu::ImplHelper templated base
149 // Classname Base doing refcounting Base implementing the XComponent interface
152 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( BitmapCanvas
, GraphicDeviceBase2_Base
, ::cppu::WeakComponentImplHelperBase
)
155 virtual OUString SAL_CALL
getServiceName( ) throw (::com::sun::star::uno::RuntimeException
);
158 virtual IBitmapSharedPtr
getBitmap() const;
161 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> maArguments
;
162 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> mxComponentContext
;
163 IBitmapSharedPtr mpTarget
;
166 typedef ::rtl::Reference
< BitmapCanvas
> BitmapCanvasRef
;
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */