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_TOOLKIT_AWT_VCLXDEVICE_HXX
21 : #define INCLUDED_TOOLKIT_AWT_VCLXDEVICE_HXX
22 :
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 <cppuhelper/weak.hxx>
28 : #include <osl/mutex.hxx>
29 : #include <vcl/virdev.hxx>
30 : #include <vcl/vclptr.hxx>
31 :
32 : #include <com/sun/star/awt/XUnitConversion.hpp>
33 :
34 : class OutputDevice;
35 : class VirtualDevice;
36 :
37 : // For using nDummy, no incompatible update, add a sal_Bool bCreatedWithToolkitMember later...
38 : #define FLAGS_CREATEDWITHTOOLKIT 0x00000001
39 :
40 : /// An UNO wrapper for the VCL OutputDevice
41 : class TOOLKIT_DLLPUBLIC VCLXDevice :
42 : public ::com::sun::star::awt::XDevice,
43 : public ::com::sun::star::lang::XTypeProvider,
44 : public ::com::sun::star::lang::XUnoTunnel,
45 : public ::com::sun::star::awt::XUnitConversion,
46 : public ::cppu::OWeakObject
47 : {
48 : friend class VCLXGraphics;
49 : friend class VCLXVirtualDevice;
50 :
51 : private:
52 : VclPtr<OutputDevice> mpOutputDevice;
53 :
54 : public:
55 : void* pDummy;
56 : sal_uInt32 nFlags;
57 :
58 : public:
59 : VCLXDevice();
60 : virtual ~VCLXDevice();
61 :
62 286541 : void SetOutputDevice( const VclPtr<OutputDevice> &pOutDev ) { mpOutputDevice = pOutDev; }
63 2865051 : VclPtr<OutputDevice> GetOutputDevice() const { return mpOutputDevice; }
64 :
65 : void SetCreatedWithToolkit( bool bCreatedWithToolkit );
66 :
67 : // ::com::sun::star::uno::XInterface
68 : ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
69 4508703 : void SAL_CALL acquire() throw() SAL_OVERRIDE { OWeakObject::acquire(); }
70 4481863 : void SAL_CALL release() throw() SAL_OVERRIDE { OWeakObject::release(); }
71 :
72 : // ::com::sun::star::lang::XUnoTunnel
73 : static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
74 : static VCLXDevice* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace );
75 : sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
76 :
77 : // ::com::sun::star::lang::XTypeProvider
78 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
79 : ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
80 :
81 : // ::com::sun::star::awt::XDevice,
82 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > SAL_CALL createGraphics( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
83 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createDevice( sal_Int32 nWidth, sal_Int32 nHeight ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 : ::com::sun::star::awt::DeviceInfo SAL_CALL getInfo() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 : ::com::sun::star::uno::Sequence< ::com::sun::star::awt::FontDescriptor > SAL_CALL getFontDescriptors( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( const ::com::sun::star::awt::FontDescriptor& aDescriptor ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
87 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > SAL_CALL createBitmap( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
88 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap > SAL_CALL createDisplayBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >& Bitmap ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 :
90 : // ::com::sun::star::awt::XUnitConversion
91 : ::com::sun::star::awt::Point SAL_CALL convertPointToLogic( const ::com::sun::star::awt::Point& aPoint, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
92 : ::com::sun::star::awt::Point SAL_CALL convertPointToPixel( const ::com::sun::star::awt::Point& aPoint, ::sal_Int16 SourceUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 : ::com::sun::star::awt::Size SAL_CALL convertSizeToLogic( const ::com::sun::star::awt::Size& aSize, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 : ::com::sun::star::awt::Size SAL_CALL convertSizeToPixel( const ::com::sun::star::awt::Size& aSize, ::sal_Int16 SourceUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 :
96 :
97 : };
98 :
99 :
100 : // class VCLXVirtualDevice
101 :
102 :
103 34 : class VCLXVirtualDevice : public VCLXDevice
104 : {
105 : public:
106 : virtual ~VCLXVirtualDevice();
107 :
108 34 : void SetVirtualDevice( VirtualDevice* pVDev ) { SetOutputDevice( pVDev ); }
109 : };
110 :
111 :
112 :
113 :
114 : #endif // INCLUDED_TOOLKIT_AWT_VCLXDEVICE_HXX
115 :
116 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|