tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / include / toolkit / helper / vclunohelper.hxx
blob4c364963b36bead1bb533abba86fa8ff0d5bc2a3
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>
27 #include <com/sun/star/awt/Rectangle.hpp>
29 #include <vcl/bitmapex.hxx>
30 #include <vcl/font.hxx>
31 #include <vcl/region.hxx>
32 #include <tools/mapunit.hxx>
33 #include <tools/fldunit.hxx>
34 #include <tools/poly.hxx>
37 namespace com::sun::star::uno { template <typename > class Sequence; }
39 namespace com::sun::star::uno {
40 class XInterface;
43 namespace com::sun::star::awt {
44 class XBitmap;
45 class XWindow;
46 class XWindow2;
47 class XWindowPeer;
48 class XGraphics;
49 class XRegion;
50 class XDevice;
51 class XToolkit;
52 class XFont;
53 class XControlContainer;
54 struct Size;
55 struct Point;
56 struct SimpleFontMetric;
57 struct FontDescriptor;
58 struct Rectangle;
59 struct KeyEvent;
63 enum class PointerStyle;
65 class FontMetric;
66 class OutputDevice;
67 class MouseEvent;
68 class KeyEvent;
70 class TOOLKIT_DLLPUBLIC VCLUnoHelper
72 public:
73 // Toolkit
74 static css::uno::Reference< css::awt::XToolkit> CreateToolkit();
76 // Bitmap
77 static BitmapEx GetBitmap( const css::uno::Reference< css::awt::XBitmap>& rxBitmap );
78 static css::uno::Reference< css::awt::XBitmap> CreateBitmap( const BitmapEx& rBitmap );
80 // Window
81 static vcl::Window* GetWindow( const css::uno::Reference< css::awt::XWindow>& rxWindow );
82 static vcl::Window* GetWindow( const css::uno::Reference< css::awt::XWindow2>& rxWindow2 );
83 static vcl::Window* GetWindow( const css::uno::Reference< css::awt::XWindowPeer>& rxWindowPeer );
84 static css::uno::Reference< css::awt::XWindow> GetInterface( vcl::Window* pWindow );
86 // OutputDevice
87 static OutputDevice* GetOutputDevice( const css::uno::Reference< css::awt::XDevice>& rxDevice );
88 static OutputDevice* GetOutputDevice( const css::uno::Reference< css::awt::XGraphics>& rxGraphics );
90 // Region
91 static vcl::Region GetRegion( const css::uno::Reference< css::awt::XRegion >& rxRegion );
93 // Polygon
94 static tools::Polygon CreatePolygon( const css::uno::Sequence< sal_Int32 >& DataX, const css::uno::Sequence< sal_Int32 >& DataY );
96 /** convert Font to css::awt::FontDescriptor
97 @param rFont Font to be converted
98 @return the new FontDescriptor
100 static css::awt::FontDescriptor CreateFontDescriptor( const vcl::Font& rFont );
101 static vcl::Font CreateFont( const css::awt::FontDescriptor& rDescr, const vcl::Font& rInitFont );
102 static vcl::Font CreateFont( const css::uno::Reference< css::awt::XFont >& rxFont );
103 static css::awt::SimpleFontMetric CreateFontMetric( const FontMetric& rFontMetric );
105 // Rectangle
106 static bool IsZero(const css::awt::Rectangle& rRect);
108 static css::uno::Reference< css::awt::XControlContainer> CreateControlContainer( vcl::Window* pWindow );
110 // MapUnits
111 static MapUnit UnoEmbed2VCLMapUnit( sal_Int32 nUnoEmbedMapUnit );
112 static sal_Int32 VCL2UnoEmbedMapUnit( MapUnit nVCLMapUnit );
115 //= MeasurementUnitConversion
117 /** small helper to convert between MeasurementUnit and
118 FieldUnit
120 static sal_Int16 ConvertToMeasurementUnit( FieldUnit _nFieldUnit, sal_Int16 _rFieldToUNOValueFactor );
121 static FieldUnit ConvertToFieldUnit( sal_Int16 _nMeasurementUnit, sal_Int16& _rFieldToUNOValueFactor );
123 /// @throws css::lang::IllegalArgumentException
124 static MapUnit /* MapModeUnit */ ConvertToMapModeUnit(sal_Int16 /* com.sun.star.util.MeasureUnit.* */ _nMeasureUnit);
126 static css::awt::MouseEvent
127 createMouseEvent(
128 const ::MouseEvent& _rVclEvent,
129 const css::uno::Reference< css::uno::XInterface >& _rxContext
132 static ::MouseEvent createVCLMouseEvent( const css::awt::MouseEvent& _rAwtEvent );
134 static css::awt::KeyEvent
135 createKeyEvent(
136 const ::KeyEvent& _rVclEvent,
137 const css::uno::Reference< css::uno::XInterface >& _rxContext
140 static ::KeyEvent createVCLKeyEvent( const css::awt::KeyEvent& _rAwtEvent );
142 static ::PointerStyle getMousePointer(const css::uno::Reference<css::awt::XWindowPeer>& rWindowPeer);
143 static void setMousePointer(const css::uno::Reference<css::awt::XWindowPeer>& rWindowPeer, ::PointerStyle mousepointer);
146 #endif // INCLUDED_TOOLKIT_HELPER_VCLUNOHELPER_HXX
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */