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 .
22 #include <rtl/ref.hxx>
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/util/XUpdatable.hpp>
28 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
29 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
30 #include <com/sun/star/rendering/XGraphicDevice.hpp>
31 #include <com/sun/star/rendering/XBufferController.hpp>
33 #include <cppuhelper/compbase.hxx>
34 #include <comphelper/uno3.hxx>
36 #include <base/integerbitmapbase.hxx>
37 #include <base/basemutexhelper.hxx>
38 #include <base/graphicdevicebase.hxx>
39 #include <base/canvasbase.hxx>
40 #include <base/bitmapcanvasbase.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::WeakComponentImplHelper
< css::rendering::XCanvas
,
52 css::rendering::XGraphicDevice
,
53 css::lang::XMultiServiceFactory
,
54 css::util::XUpdatable
,
55 css::beans::XPropertySet
,
56 css::lang::XServiceName
,
57 css::lang::XServiceInfo
> GraphicDeviceBase1_Base
;
58 typedef ::canvas::GraphicDeviceBase
< ::canvas::BaseMutexHelper
< GraphicDeviceBase1_Base
>,
61 ::cppu::OWeakObject
> CanvasBase1_Base
;
62 typedef ::canvas::CanvasBase
< CanvasBase1_Base
,
65 ::cppu::OWeakObject
> CanvasBaseT
;
67 /** Product of this component's factory.
69 The Canvas object combines the actual Window canvas with
70 the XGraphicDevice interface. This is because there's a
71 one-to-one relation between them, anyway, since each window
72 can have exactly one canvas and one associated
73 XGraphicDevice. And to avoid messing around with circular
74 references, this is implemented as one single object.
76 class Canvas
: public CanvasBaseT
79 Canvas( const css::uno::Sequence
<
80 css::uno::Any
>& aArguments
,
81 const css::uno::Reference
<
82 css::uno::XComponentContext
>& rxContext
);
86 /// Dispose all internal references
87 virtual void disposeThis() override
;
89 // Forwarding the XComponent implementation to the
90 // cppu::ImplHelper templated base
91 // Classname Base doing refcounting Base implementing the XComponent interface
94 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( Canvas
, GraphicDeviceBase1_Base
, ::cppu::WeakComponentImplHelperBase
)
97 virtual OUString SAL_CALL
getServiceName( ) override
;
100 virtual css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
101 virtual OUString SAL_CALL
getImplementationName( ) override
;
102 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ) override
;
105 css::uno::Sequence
< css::uno::Any
> maArguments
;
106 css::uno::Reference
< css::uno::XComponentContext
> mxComponentContext
;
109 typedef ::cppu::WeakComponentImplHelper
< css::rendering::XBitmapCanvas
,
110 css::rendering::XIntegerBitmap
,
111 css::rendering::XGraphicDevice
,
112 css::lang::XMultiServiceFactory
,
113 css::util::XUpdatable
,
114 css::beans::XPropertySet
,
115 css::lang::XServiceName
,
116 css::lang::XServiceInfo
> GraphicDeviceBase2_Base
;
117 typedef ::canvas::GraphicDeviceBase
< ::canvas::BaseMutexHelper
< GraphicDeviceBase2_Base
>,
120 ::cppu::OWeakObject
> CanvasBase2_Base
;
121 typedef ::canvas::IntegerBitmapBase
<
122 canvas::BitmapCanvasBase2
<
126 ::cppu::OWeakObject
> > BitmapCanvasBaseT
;
128 /** Product of this component's factory.
130 The Canvas object combines the actual Window canvas with
131 the XGraphicDevice interface. This is because there's a
132 one-to-one relation between them, anyway, since each window
133 can have exactly one canvas and one associated
134 XGraphicDevice. And to avoid messing around with circular
135 references, this is implemented as one single object.
137 class BitmapCanvas
: public BitmapCanvasBaseT
, public BitmapProvider
140 BitmapCanvas( const css::uno::Sequence
< css::uno::Any
>& aArguments
,
141 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
145 /// Dispose all internal references
146 virtual void disposeThis() override
;
148 // Forwarding the XComponent implementation to the
149 // cppu::ImplHelper templated base
150 // Classname Base doing refcounting Base implementing the XComponent interface
153 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( BitmapCanvas
, GraphicDeviceBase2_Base
, ::cppu::WeakComponentImplHelperBase
)
156 virtual OUString SAL_CALL
getServiceName( ) override
;
159 virtual css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
160 virtual OUString SAL_CALL
getImplementationName( ) override
;
161 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ) override
;
164 virtual IBitmapSharedPtr
getBitmap() const override
;
167 css::uno::Sequence
< css::uno::Any
> maArguments
;
168 css::uno::Reference
< css::uno::XComponentContext
> mxComponentContext
;
169 IBitmapSharedPtr mpTarget
;
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */