bump product version to 7.6.3.2-android
[LibreOffice.git] / include / toolkit / helper / vclunohelper.hxx
blob07d4aeff10477ce2757842ad23f4170b124696a1
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>
26 #include <com/sun/star/awt/MouseEvent.hpp>
28 #include <vcl/bitmapex.hxx>
29 #include <vcl/font.hxx>
30 #include <vcl/region.hxx>
31 #include <tools/mapunit.hxx>
32 #include <tools/fldunit.hxx>
33 #include <tools/poly.hxx>
36 namespace com::sun::star::uno { template <typename > class Sequence; }
38 namespace com::sun::star::uno {
39 class XInterface;
42 namespace com::sun::star::awt {
43 class XBitmap;
44 class XWindow;
45 class XWindow2;
46 class XWindowPeer;
47 class XGraphics;
48 class XRegion;
49 class XDevice;
50 class XToolkit;
51 class XFont;
52 class XControlContainer;
53 struct Size;
54 struct Point;
55 struct SimpleFontMetric;
56 struct FontDescriptor;
57 struct Rectangle;
58 struct KeyEvent;
62 enum class PointerStyle;
64 class FontMetric;
65 class OutputDevice;
66 class MouseEvent;
67 class KeyEvent;
69 class TOOLKIT_DLLPUBLIC VCLUnoHelper
71 public:
72 // Toolkit
73 static css::uno::Reference< css::awt::XToolkit> CreateToolkit();
75 // Bitmap
76 static BitmapEx GetBitmap( const css::uno::Reference< css::awt::XBitmap>& rxBitmap );
77 static css::uno::Reference< css::awt::XBitmap> CreateBitmap( const BitmapEx& rBitmap );
79 // Window
80 static vcl::Window* GetWindow( const css::uno::Reference< css::awt::XWindow>& rxWindow );
81 static vcl::Window* GetWindow( const css::uno::Reference< css::awt::XWindow2>& rxWindow2 );
82 static vcl::Window* GetWindow( const css::uno::Reference< css::awt::XWindowPeer>& rxWindowPeer );
83 static css::uno::Reference< css::awt::XWindow> GetInterface( vcl::Window* pWindow );
85 // OutputDevice
86 static OutputDevice* GetOutputDevice( const css::uno::Reference< css::awt::XDevice>& rxDevice );
87 static OutputDevice* GetOutputDevice( const css::uno::Reference< css::awt::XGraphics>& rxGraphics );
89 // Region
90 static vcl::Region GetRegion( const css::uno::Reference< css::awt::XRegion >& rxRegion );
92 // Polygon
93 static tools::Polygon CreatePolygon( const css::uno::Sequence< sal_Int32 >& DataX, const css::uno::Sequence< sal_Int32 >& DataY );
95 /** convert Font to css::awt::FontDescriptor
96 @param rFont Font to be converted
97 @return the new FontDescriptor
99 static css::awt::FontDescriptor CreateFontDescriptor( const vcl::Font& rFont );
100 static vcl::Font CreateFont( const css::awt::FontDescriptor& rDescr, const vcl::Font& rInitFont );
101 static vcl::Font CreateFont( const css::uno::Reference< css::awt::XFont >& rxFont );
102 static css::awt::SimpleFontMetric CreateFontMetric( const FontMetric& rFontMetric );
104 // Rectangle
105 static bool IsZero(const css::awt::Rectangle& rRect);
107 static css::uno::Reference< css::awt::XControlContainer> CreateControlContainer( vcl::Window* pWindow );
109 // MapUnits
110 static MapUnit UnoEmbed2VCLMapUnit( sal_Int32 nUnoEmbedMapUnit );
111 static sal_Int32 VCL2UnoEmbedMapUnit( MapUnit nVCLMapUnit );
114 //= MeasurementUnitConversion
116 /** small helper to convert between MeasurementUnit and
117 FieldUnit
119 static sal_Int16 ConvertToMeasurementUnit( FieldUnit _nFieldUnit, sal_Int16 _rFieldToUNOValueFactor );
120 static FieldUnit ConvertToFieldUnit( sal_Int16 _nMeasurementUnit, sal_Int16& _rFieldToUNOValueFactor );
122 /// @throws css::lang::IllegalArgumentException
123 static MapUnit /* MapModeUnit */ ConvertToMapModeUnit(sal_Int16 /* com.sun.star.util.MeasureUnit.* */ _nMeasureUnit);
125 static ::Size /* VCLSize */ ConvertToVCLSize(css::awt::Size const& _aSize);
126 static css::awt::Size ConvertToAWTSize(::Size /* VCLSize */ const& _aSize);
128 static ::Point /* VCLPoint */ ConvertToVCLPoint(css::awt::Point const& _aPoint);
129 static css::awt::Point ConvertToAWTPoint(::Point /* VCLPoint */ const& _aPoint);
131 static ::tools::Rectangle ConvertToVCLRect( css::awt::Rectangle const & _rRect );
132 static css::awt::Rectangle ConvertToAWTRect( ::tools::Rectangle const & _rRect );
134 static css::awt::MouseEvent
135 createMouseEvent(
136 const ::MouseEvent& _rVclEvent,
137 const css::uno::Reference< css::uno::XInterface >& _rxContext
140 static ::MouseEvent createVCLMouseEvent( const css::awt::MouseEvent& _rAwtEvent );
142 static css::awt::KeyEvent
143 createKeyEvent(
144 const ::KeyEvent& _rVclEvent,
145 const css::uno::Reference< css::uno::XInterface >& _rxContext
148 static ::KeyEvent createVCLKeyEvent( const css::awt::KeyEvent& _rAwtEvent );
150 static ::PointerStyle getMousePointer(const css::uno::Reference<css::awt::XWindowPeer>& rWindowPeer);
151 static void setMousePointer(const css::uno::Reference<css::awt::XWindowPeer>& rWindowPeer, ::PointerStyle mousepointer);
154 #endif // INCLUDED_TOOLKIT_HELPER_VCLUNOHELPER_HXX
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */