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 _TOOLKIT_AWT_VCLXDEVICE_HXX_
21 #define _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 <cppuhelper/weak.hxx>
28 #include <osl/mutex.hxx>
30 #include <com/sun/star/awt/XUnitConversion.hpp>
35 // ----------------------------------------------------
37 // ----------------------------------------------------
39 // For using nDummy, no incompatible update, add a sal_Bool bCreatedWithToolkitMember later...
40 #define FLAGS_CREATEDWITHTOOLKIT 0x00000001
42 class TOOLKIT_DLLPUBLIC VCLXDevice
: 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
48 friend class VCLXGraphics
;
51 OutputDevice
* mpOutputDevice
;
58 void DestroyOutputDevice();
64 void SetOutputDevice( OutputDevice
* pOutDev
) { mpOutputDevice
= pOutDev
; }
65 OutputDevice
* GetOutputDevice() const { return mpOutputDevice
; }
67 void SetCreatedWithToolkit( sal_Bool bCreatedWithToolkit
);
69 // ::com::sun::star::uno::XInterface
70 ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
);
71 void SAL_CALL
acquire() throw() { OWeakObject::acquire(); }
72 void SAL_CALL
release() throw() { OWeakObject::release(); }
74 // ::com::sun::star::lang::XUnoTunnel
75 static const ::com::sun::star::uno::Sequence
< sal_Int8
>& GetUnoTunnelId() throw();
76 static VCLXDevice
* GetImplementation( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& rxIFace
);
77 sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& rIdentifier
) throw(::com::sun::star::uno::RuntimeException
);
79 // ::com::sun::star::lang::XTypeProvider
80 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes() throw(::com::sun::star::uno::RuntimeException
);
81 ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() throw(::com::sun::star::uno::RuntimeException
);
83 // ::com::sun::star::awt::XDevice,
84 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
> SAL_CALL
createGraphics( ) throw(::com::sun::star::uno::RuntimeException
);
85 ::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
);
86 ::com::sun::star::awt::DeviceInfo SAL_CALL
getInfo() throw(::com::sun::star::uno::RuntimeException
);
87 ::com::sun::star::uno::Sequence
< ::com::sun::star::awt::FontDescriptor
> SAL_CALL
getFontDescriptors( ) throw(::com::sun::star::uno::RuntimeException
);
88 ::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
);
89 ::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
);
90 ::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
);
92 // ::com::sun::star::awt::XUnitConversion
93 ::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
);
94 ::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
);
95 ::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
);
96 ::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
);
101 // ----------------------------------------------------
102 // class VCLXVirtualDevice
103 // ----------------------------------------------------
105 class VCLXVirtualDevice
: public VCLXDevice
108 ~VCLXVirtualDevice();
110 void SetVirtualDevice( VirtualDevice
* pVDev
) { SetOutputDevice( (OutputDevice
*)pVDev
); }
116 #endif // _TOOLKIT_AWT_VCLXDEVICE_HXX_
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */