build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / include / toolkit / helper / vclunohelper.hxx
blobc9b062e2d4f028a4be1a50d307d12c7bac52d36a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_HELPER_VCLUNOHELPER_HXX
21 #define INCLUDED_TOOLKIT_HELPER_VCLUNOHELPER_HXX
23 #include <toolkit/dllapi.h>
24 #include <com/sun/star/uno/Reference.h>
25 #include <com/sun/star/uno/Sequence.h>
27 #include <com/sun/star/lang/IllegalArgumentException.hpp>
28 #include <com/sun/star/awt/FontSlant.hpp>
29 #include <com/sun/star/awt/MouseEvent.hpp>
31 #include <vcl/bitmapex.hxx>
32 #include <vcl/region.hxx>
33 #include <vcl/metric.hxx>
34 #include <vcl/vclptr.hxx>
35 #include <vcl/window.hxx>
36 #include <tools/mapunit.hxx>
37 #include <tools/fldunit.hxx>
38 #include <tools/poly.hxx>
41 namespace com { namespace sun { namespace star { namespace uno {
42 class XInterface;
43 }}}}
45 namespace com { namespace sun { namespace star { namespace awt {
46 class XBitmap;
47 class XWindow;
48 class XWindow2;
49 class XWindowPeer;
50 class XGraphics;
51 class XRegion;
52 class XDevice;
53 class XPointer;
54 class XToolkit;
55 class XFont;
56 class XControlContainer;
57 struct Size;
58 struct Point;
59 struct SimpleFontMetric;
60 struct FontDescriptor;
61 struct Rectangle;
62 struct KeyEvent;
63 }}}}
66 class OutputDevice;
67 class MouseEvent;
68 class KeyEvent;
71 // class VclUnoHelper
73 class TOOLKIT_DLLPUBLIC VCLUnoHelper
75 public:
76 // Toolkit
77 static css::uno::Reference< css::awt::XToolkit> CreateToolkit();
79 // Bitmap
80 static BitmapEx GetBitmap( const css::uno::Reference< css::awt::XBitmap>& rxBitmap );
81 static css::uno::Reference< css::awt::XBitmap> CreateBitmap( const BitmapEx& rBitmap );
83 // Window
84 static VclPtr< vcl::Window > GetWindow( const css::uno::Reference< css::awt::XWindow>& rxWindow );
85 static VclPtr< vcl::Window > GetWindow( const css::uno::Reference< css::awt::XWindow2>& rxWindow2 );
86 static VclPtr< vcl::Window > GetWindow( const css::uno::Reference< css::awt::XWindowPeer>& rxWindowPeer );
87 static css::uno::Reference< css::awt::XWindow> GetInterface( vcl::Window* pWindow );
89 // OutputDevice
90 static OutputDevice* GetOutputDevice( const css::uno::Reference< css::awt::XDevice>& rxDevice );
91 static OutputDevice* GetOutputDevice( const css::uno::Reference< css::awt::XGraphics>& rxGraphics );
93 // Region
94 static vcl::Region GetRegion( const css::uno::Reference< css::awt::XRegion >& rxRegion );
96 // Polygon
97 static tools::Polygon CreatePolygon( const css::uno::Sequence< sal_Int32 >& DataX, const css::uno::Sequence< sal_Int32 >& DataY );
99 /** convert Font to css::awt::FontDescriptor
100 @param rFont Font to be converted
101 @return the new FontDescriptor
103 static css::awt::FontDescriptor CreateFontDescriptor( const vcl::Font& rFont );
104 static vcl::Font CreateFont( const css::awt::FontDescriptor& rDescr, const vcl::Font& rInitFont );
105 static vcl::Font CreateFont( const css::uno::Reference< css::awt::XFont >& rxFont );
106 static css::awt::SimpleFontMetric CreateFontMetric( const FontMetric& rFontMetric );
107 static float ConvertFontWidth( FontWidth eWidth );
108 static FontWidth ConvertFontWidth( float f );
109 static float ConvertFontWeight( FontWeight eWeight );
110 static FontWeight ConvertFontWeight( float f );
111 static css::awt::FontSlant ConvertFontSlant( FontItalic eWeight );
112 static FontItalic ConvertFontSlant( css::awt::FontSlant );
114 // Rectangle
115 static bool IsZero(const css::awt::Rectangle& rRect);
117 static css::uno::Reference< css::awt::XControlContainer> CreateControlContainer( vcl::Window* pWindow );
119 // MapUnits
120 static MapUnit UnoEmbed2VCLMapUnit( sal_Int32 nUnoEmbedMapUnit );
121 static sal_Int32 VCL2UnoEmbedMapUnit( MapUnit nVCLMapUnit );
124 //= MeasurementUnitConversion
126 /** small helper to convert between MeasurementUnit and
127 FieldUnit
129 static sal_Int16 ConvertToMeasurementUnit( FieldUnit _nFieldUnit, sal_Int16 _rFieldToUNOValueFactor );
130 static FieldUnit ConvertToFieldUnit( sal_Int16 _nMeasurementUnit, sal_Int16& _rFieldToUNOValueFactor );
132 static MapUnit /* MapModeUnit */ ConvertToMapModeUnit(sal_Int16 /* com.sun.star.util.MeasureUnit.* */ _nMeasureUnit) throw (css::lang::IllegalArgumentException);
134 static ::Size /* VCLSize */ ConvertToVCLSize(css::awt::Size const& _aSize);
135 static css::awt::Size ConvertToAWTSize(::Size /* VCLSize */ const& _aSize);
137 static ::Point /* VCLPoint */ ConvertToVCLPoint(css::awt::Point const& _aPoint);
138 static css::awt::Point ConvertToAWTPoint(::Point /* VCLPoint */ const& _aPoint);
140 static ::Rectangle ConvertToVCLRect( css::awt::Rectangle const & _rRect );
141 static css::awt::Rectangle ConvertToAWTRect( ::Rectangle const & _rRect );
143 static css::awt::MouseEvent
144 createMouseEvent(
145 const ::MouseEvent& _rVclEvent,
146 const css::uno::Reference< css::uno::XInterface >& _rxContext
149 static ::MouseEvent createVCLMouseEvent( const css::awt::MouseEvent& _rAwtEvent );
151 static css::awt::KeyEvent
152 createKeyEvent(
153 const ::KeyEvent& _rVclEvent,
154 const css::uno::Reference< css::uno::XInterface >& _rxContext
157 static ::KeyEvent createVCLKeyEvent( const css::awt::KeyEvent& _rAwtEvent );
161 #endif // INCLUDED_TOOLKIT_HELPER_VCLUNOHELPER_HXX
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */