LibreOffice Module toolkit (master) 1
vclunohelper.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_TOOLKIT_HELPER_VCLUNOHELPER_HXX
21#define INCLUDED_TOOLKIT_HELPER_VCLUNOHELPER_HXX
22
23#include <toolkit/dllapi.h>
24#include <com/sun/star/uno/Reference.h>
25
26#include <com/sun/star/awt/MouseEvent.hpp>
27
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>
34
35
36namespace com::sun::star::uno { template <typename > class Sequence; }
37
38namespace com::sun::star::uno {
39 class XInterface;
40}
41
42namespace 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;
59}
60
61
62enum class PointerStyle;
63
64class FontMetric;
65class OutputDevice;
66class MouseEvent;
67class KeyEvent;
68
70{
71public:
72 // Toolkit
73 static css::uno::Reference< css::awt::XToolkit> CreateToolkit();
74
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 );
78
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 );
84
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 );
88
89 // Region
90 static vcl::Region GetRegion( const css::uno::Reference< css::awt::XRegion >& rxRegion );
91
92 // Polygon
93 static tools::Polygon CreatePolygon( const css::uno::Sequence< sal_Int32 >& DataX, const css::uno::Sequence< sal_Int32 >& DataY );
94
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 );
103
104 // Rectangle
105 static bool IsZero(const css::awt::Rectangle& rRect);
106
107 static css::uno::Reference< css::awt::XControlContainer> CreateControlContainer( vcl::Window* pWindow );
108
109 // MapUnits
110 static MapUnit UnoEmbed2VCLMapUnit( sal_Int32 nUnoEmbedMapUnit );
111 static sal_Int32 VCL2UnoEmbedMapUnit( MapUnit nVCLMapUnit );
112
113
114 //= MeasurementUnitConversion
115
119 static sal_Int16 ConvertToMeasurementUnit( FieldUnit _nFieldUnit, sal_Int16 _rFieldToUNOValueFactor );
120 static FieldUnit ConvertToFieldUnit( sal_Int16 _nMeasurementUnit, sal_Int16& _rFieldToUNOValueFactor );
121
123 static MapUnit /* MapModeUnit */ ConvertToMapModeUnit(sal_Int16 /* com.sun.star.util.MeasureUnit.* */ _nMeasureUnit);
124
125 static ::Size /* VCLSize */ ConvertToVCLSize(css::awt::Size const& _aSize);
126 static css::awt::Size ConvertToAWTSize(::Size /* VCLSize */ const& _aSize);
127
128 static ::Point /* VCLPoint */ ConvertToVCLPoint(css::awt::Point const& _aPoint);
129 static css::awt::Point ConvertToAWTPoint(::Point /* VCLPoint */ const& _aPoint);
130
131 static ::tools::Rectangle ConvertToVCLRect( css::awt::Rectangle const & _rRect );
132 static css::awt::Rectangle ConvertToAWTRect( ::tools::Rectangle const & _rRect );
133
134 static css::awt::MouseEvent
135 createMouseEvent(
136 const ::MouseEvent& _rVclEvent,
137 const css::uno::Reference< css::uno::XInterface >& _rxContext
138 );
139
140 static ::MouseEvent createVCLMouseEvent( const css::awt::MouseEvent& _rAwtEvent );
141
142 static css::awt::KeyEvent
143 createKeyEvent(
144 const ::KeyEvent& _rVclEvent,
145 const css::uno::Reference< css::uno::XInterface >& _rxContext
146 );
147
148 static ::KeyEvent createVCLKeyEvent( const css::awt::KeyEvent& _rAwtEvent );
149
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);
152};
153
154#endif // INCLUDED_TOOLKIT_HELPER_VCLUNOHELPER_HXX
155
156/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define TOOLKIT_DLLPUBLIC
Definition: dllapi.h:29
void CreateFont(SvxFont &rFont, const SfxItemSet &rSet, bool bSearchInParent=true, SvtScriptType nScriptType=SvtScriptType::NONE)
FieldUnit
MapUnit
PointerStyle