xref: /AOO41X/main/toolkit/inc/toolkit/awt/vclxdevice.hxx (revision 50e6b0721ed882c1c74690abd9bee6b3a8da8cfd)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _TOOLKIT_AWT_VCLXDEVICE_HXX_
25 #define _TOOLKIT_AWT_VCLXDEVICE_HXX_
26 
27 #include <toolkit/dllapi.h>
28 #include <com/sun/star/awt/XDevice.hpp>
29 #include <com/sun/star/lang/XTypeProvider.hpp>
30 #include <com/sun/star/lang/XUnoTunnel.hpp>
31 #include <cppuhelper/weak.hxx>
32 #include <vos/mutex.hxx>
33 
34 // #include <com/sun/star/awt/XTextConstraints.hpp>
35 #include <com/sun/star/awt/XUnitConversion.hpp>
36 
37 class OutputDevice;
38 class VirtualDevice;
39 
40 //  ----------------------------------------------------
41 //  class VCLXDevice
42 //  ----------------------------------------------------
43 
44 // For using nDummy, no incompatible update, add a sal_Bool bCreatedWithToolkitMember later...
45 #define FLAGS_CREATEDWITHTOOLKIT    0x00000001
46 
47 class TOOLKIT_DLLPUBLIC VCLXDevice :    public ::com::sun::star::awt::XDevice,
48                     public ::com::sun::star::lang::XTypeProvider,
49                     public ::com::sun::star::lang::XUnoTunnel,
50 /* public ::com::sun::star::awt::XTextConstraints,*/
51                     public ::com::sun::star::awt::XUnitConversion,
52                     public ::cppu::OWeakObject
53 {
54     friend class VCLXGraphics;
55 
56 private:
57     vos::IMutex&    mrMutex;    // Reference to SolarMutex
58     OutputDevice*           mpOutputDevice;
59 
60 public:
61     void*                   pDummy;
62     sal_uInt32              nFlags;
63 
64 protected:
GetMutex()65     vos::IMutex&    GetMutex() { return mrMutex; }
66     void                    DestroyOutputDevice();
67 
68 public:
69                             VCLXDevice();
70                             ~VCLXDevice();
71 
SetOutputDevice(OutputDevice * pOutDev)72     void                    SetOutputDevice( OutputDevice* pOutDev ) { mpOutputDevice = pOutDev; }
GetOutputDevice() const73     OutputDevice*           GetOutputDevice() const { return mpOutputDevice; }
74 
75     void                    SetCreatedWithToolkit( sal_Bool bCreatedWithToolkit );
76     sal_Bool                IsCreatedWithToolkit() const;
77 
78     // ::com::sun::star::uno::XInterface
79     ::com::sun::star::uno::Any                  SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
acquire()80     void                                        SAL_CALL acquire() throw()  { OWeakObject::acquire(); }
release()81     void                                        SAL_CALL release() throw()  { OWeakObject::release(); }
82 
83     // ::com::sun::star::lang::XUnoTunnel
84     static const ::com::sun::star::uno::Sequence< sal_Int8 >&   GetUnoTunnelId() throw();
85     static VCLXDevice*                                          GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
86     sal_Int64                                                   SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
87 
88     // ::com::sun::star::lang::XTypeProvider
89     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >  SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
90     ::com::sun::star::uno::Sequence< sal_Int8 >                     SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
91 
92     // ::com::sun::star::awt::XDevice,
93     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >    SAL_CALL createGraphics(  ) throw(::com::sun::star::uno::RuntimeException);
94     ::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);
95     ::com::sun::star::awt::DeviceInfo                                       SAL_CALL getInfo() throw(::com::sun::star::uno::RuntimeException);
96     ::com::sun::star::uno::Sequence< ::com::sun::star::awt::FontDescriptor > SAL_CALL getFontDescriptors(  ) throw(::com::sun::star::uno::RuntimeException);
97     ::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);
98     ::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);
99     ::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);
100 
101     // ::com::sun::star::awt::XTextConstraints
102     // ::sal_Int32 SAL_CALL getTextWidth( const ::rtl::OUString& Text ) throw (::com::sun::star::uno::RuntimeException);
103     // ::sal_Int32 SAL_CALL getTextHeight(  ) throw (::com::sun::star::uno::RuntimeException);
104 
105     // ::com::sun::star::awt::XUnitConversion
106     ::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);
107     ::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);
108     ::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);
109     ::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);
110 
111 
112 };
113 
114 //  ----------------------------------------------------
115 //  class VCLXVirtualDevice
116 //  ----------------------------------------------------
117 
118 class VCLXVirtualDevice : public VCLXDevice
119 {
120 private:
121     VirtualDevice*  mpVDev;
122 
123 public:
124                     ~VCLXVirtualDevice();
125 
SetVirtualDevice(VirtualDevice * pVDev)126     void            SetVirtualDevice( VirtualDevice* pVDev ) { SetOutputDevice( (OutputDevice*)pVDev ); }
127 };
128 
129 
130 
131 
132 #endif // _TOOLKIT_AWT_VCLXDEVICE_HXX_
133 
134