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_TOOLKIT_AWT_VCLXDEVICE_HXX
21 #define INCLUDED_TOOLKIT_AWT_VCLXDEVICE_HXX
23 #include <toolkit/dllapi.h>
24 #include <com/sun/star/awt/XDevice.hpp>
25 #include <com/sun/star/lang/XTypeProvider.hpp>
26 #include <com/sun/star/lang/XUnoTunnel.hpp>
27 #include <comphelper/servicehelper.hxx>
28 #include <cppuhelper/implbase.hxx>
29 #include <vcl/virdev.hxx>
30 #include <vcl/vclptr.hxx>
32 #include <com/sun/star/awt/XUnitConversion.hpp>
34 /// A UNO wrapper for the VCL OutputDevice
35 class TOOLKIT_DLLPUBLIC VCLXDevice
:
36 public cppu::WeakImplHelper
<
38 css::lang::XUnoTunnel
,
39 css::awt::XUnitConversion
>
41 friend class VCLXGraphics
;
42 friend class VCLXVirtualDevice
;
45 VclPtr
<OutputDevice
> mpOutputDevice
;
49 virtual ~VCLXDevice() override
;
51 void SetOutputDevice( const VclPtr
<OutputDevice
> &pOutDev
) { mpOutputDevice
= pOutDev
; }
52 const VclPtr
<OutputDevice
>& GetOutputDevice() const { return mpOutputDevice
; }
54 // css::lang::XUnoTunnel
55 UNO3_GETIMPLEMENTATION_DECL(VCLXDevice
)
58 css::uno::Reference
< css::awt::XGraphics
> SAL_CALL
createGraphics( ) override
;
59 css::uno::Reference
< css::awt::XDevice
> SAL_CALL
createDevice( sal_Int32 nWidth
, sal_Int32 nHeight
) override
;
60 css::awt::DeviceInfo SAL_CALL
getInfo() override
;
61 css::uno::Sequence
< css::awt::FontDescriptor
> SAL_CALL
getFontDescriptors( ) override
;
62 css::uno::Reference
< css::awt::XFont
> SAL_CALL
getFont( const css::awt::FontDescriptor
& aDescriptor
) override
;
63 css::uno::Reference
< css::awt::XBitmap
> SAL_CALL
createBitmap( sal_Int32 nX
, sal_Int32 nY
, sal_Int32 nWidth
, sal_Int32 nHeight
) override
;
64 css::uno::Reference
< css::awt::XDisplayBitmap
> SAL_CALL
createDisplayBitmap( const css::uno::Reference
< css::awt::XBitmap
>& Bitmap
) override
;
66 // css::awt::XUnitConversion
67 css::awt::Point SAL_CALL
convertPointToLogic( const css::awt::Point
& aPoint
, ::sal_Int16 TargetUnit
) override
;
68 css::awt::Point SAL_CALL
convertPointToPixel( const css::awt::Point
& aPoint
, ::sal_Int16 SourceUnit
) override
;
69 css::awt::Size SAL_CALL
convertSizeToLogic( const css::awt::Size
& aSize
, ::sal_Int16 TargetUnit
) override
;
70 css::awt::Size SAL_CALL
convertSizeToPixel( const css::awt::Size
& aSize
, ::sal_Int16 SourceUnit
) override
;
76 // class VCLXVirtualDevice
79 class VCLXVirtualDevice
: public VCLXDevice
82 virtual ~VCLXVirtualDevice() override
;
84 void SetVirtualDevice( VirtualDevice
* pVDev
) { SetOutputDevice( pVDev
); }
88 #endif // INCLUDED_TOOLKIT_AWT_VCLXDEVICE_HXX
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */