LibreOffice Module vcl (master) 1
WidgetDefinition.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 */
10
11#ifndef INCLUDED_VCL_INC_WIDGETDEFINITION_HXX
12#define INCLUDED_VCL_INC_WIDGETDEFINITION_HXX
13
14#include <vcl/dllapi.h>
15#include <memory>
16#include <rtl/ustring.hxx>
17#include <tools/color.hxx>
18#include <unordered_map>
19#include <vector>
20#include <cstddef>
21#include <o3tl/hash_combine.hxx>
23
24namespace vcl
25{
27{
29 LINE,
30 IMAGE,
32};
33
35{
36public:
38 : maType(aType)
39 {
40 }
41
43};
44
46{
47public:
49 : WidgetDrawAction(aType)
50 , mnStrokeWidth(-1)
51 {
52 }
53
56 sal_Int32 mnStrokeWidth;
57};
58
60{
61public:
62 sal_Int32 mnRx;
63 sal_Int32 mnRy;
64
65 float mfX1;
66 float mfY1;
67 float mfX2;
68 float mfY2;
69
72 , mnRx(0)
73 , mnRy(0)
74 , mfX1(0.0f)
75 , mfY1(0.0f)
76 , mfX2(1.0f)
77 , mfY2(1.0f)
78 {
79 }
80};
81
83{
84public:
85 float mfX1;
86 float mfY1;
87 float mfX2;
88 float mfY2;
89
92 , mfX1(0.0)
93 , mfY1(0.0)
94 , mfX2(0.0)
95 , mfY2(0.0)
96 {
97 }
98};
99
101{
102public:
103 OUString msSource;
104
107 {
108 }
109};
110
112{
113public:
114 OUString msSource;
115
118 {
119 }
120};
121
123{
126
128 : meType(eType)
129 , mePart(ePart)
130 {
131 }
132
133 bool operator==(ControlTypeAndPart const& aOther) const
134 {
135 return meType == aOther.meType && mePart == aOther.mePart;
136 }
137};
138
139} // end vcl namespace
140
141namespace std
142{
143template <> struct VCL_DLLPUBLIC hash<vcl::ControlTypeAndPart>
144{
145 std::size_t operator()(vcl::ControlTypeAndPart const& rControlTypeAndPart) const noexcept
146 {
147 std::size_t seed = 0;
148 o3tl::hash_combine(seed, rControlTypeAndPart.meType);
149 o3tl::hash_combine(seed, rControlTypeAndPart.mePart);
150 return seed;
151 }
152};
153
154} // end std namespace
155
156namespace vcl
157{
159{
160public:
161 OString msEnabled;
162 OString msFocused;
163 OString msPressed;
164 OString msRollover;
165 OString msDefault;
166 OString msSelected;
168 OString msExtra;
169
170 WidgetDefinitionState(OString sEnabled, OString sFocused, OString sPressed, OString sRollover,
171 OString sDefault, OString sSelected, OString sButtonValue,
172 OString sExtra);
173
174 std::vector<std::shared_ptr<WidgetDrawAction>> mpWidgetDrawActions;
175
176 void addDrawRectangle(Color aStrokeColor, sal_Int32 nStrokeWidth, Color aFillColor, float fX1,
177 float fY1, float fX2, float fY2, sal_Int32 nRx, sal_Int32 nRy);
178
179 void addDrawLine(Color aStrokeColor, sal_Int32 nStrokeWidth, float fX1, float fY1, float fX2,
180 float fY2);
181
182 void addDrawImage(OUString const& sSource);
183 void addDrawExternal(OUString const& sSource);
184};
185
187{
188public:
189 sal_Int32 mnWidth;
190 sal_Int32 mnHeight;
191 sal_Int32 mnMarginWidth;
192 sal_Int32 mnMarginHeight;
194
195 std::vector<std::shared_ptr<WidgetDefinitionState>> getStates(ControlType eType,
196 ControlPart ePart,
197 ControlState eState,
198 ImplControlValue const& rValue);
199
200 std::vector<std::shared_ptr<WidgetDefinitionState>> maStates;
201};
202
204{
205public:
214};
215
217{
218public:
282};
283
285{
286public:
287 std::shared_ptr<WidgetDefinitionStyle> mpStyle;
288 std::shared_ptr<WidgetDefinitionSettings> mpSettings;
289 std::unordered_map<ControlTypeAndPart, std::shared_ptr<WidgetDefinitionPart>> maDefinitions;
290 std::shared_ptr<WidgetDefinitionPart> getDefinition(ControlType eType, ControlPart ePart);
291};
292
293} // end vcl namespace
294
295#endif // INCLUDED_VCL_INC_WIDGETDEFINITION_HXX
296
297/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ControlType
These types are all based on the supported variants vcl/salnativewidgets.hxx and must be kept in-sync...
std::vector< std::shared_ptr< WidgetDefinitionState > > maStates
std::vector< std::shared_ptr< WidgetDrawAction > > mpWidgetDrawActions
WidgetDefinitionState(OString sEnabled, OString sFocused, OString sPressed, OString sRollover, OString sDefault, OString sSelected, OString sButtonValue, OString sExtra)
void addDrawRectangle(Color aStrokeColor, sal_Int32 nStrokeWidth, Color aFillColor, float fX1, float fY1, float fX2, float fY2, sal_Int32 nRx, sal_Int32 nRy)
void addDrawExternal(OUString const &sSource)
void addDrawImage(OUString const &sSource)
void addDrawLine(Color aStrokeColor, sal_Int32 nStrokeWidth, float fX1, float fY1, float fX2, float fY2)
std::unordered_map< ControlTypeAndPart, std::shared_ptr< WidgetDefinitionPart > > maDefinitions
std::shared_ptr< WidgetDefinitionStyle > mpStyle
std::shared_ptr< WidgetDefinitionSettings > mpSettings
WidgetDrawActionShape(WidgetDrawActionType aType)
WidgetDrawAction(WidgetDrawActionType aType)
WidgetDrawActionType maType
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
DocumentType eType
std::enable_if_t<(sizeof(N)==4)> hash_combine(N &nSeed, T const *pValue, size_t nCount)
WidgetDrawActionType
std::size_t operator()(vcl::ControlTypeAndPart const &rControlTypeAndPart) const noexcept
bool operator==(ControlTypeAndPart const &aOther) const
ControlTypeAndPart(ControlType eType, ControlPart ePart)
LINE
OUString maType
RedlineType meType