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#pragma once
12
13#include <vcl/dllapi.h>
14#include <memory>
15#include <rtl/ustring.hxx>
16#include <tools/color.hxx>
17#include <unordered_map>
18#include <vector>
19#include <cstddef>
20#include <o3tl/hash_combine.hxx>
22
23namespace vcl
24{
26{
28 LINE,
29 IMAGE,
31};
32
34{
35public:
37 : maType(aType)
38 {
39 }
40
42};
43
45{
46public:
48 : WidgetDrawAction(aType)
49 , mnStrokeWidth(-1)
50 {
51 }
52
55 sal_Int32 mnStrokeWidth;
56};
57
59{
60public:
61 sal_Int32 mnRx;
62 sal_Int32 mnRy;
63
64 float mfX1;
65 float mfY1;
66 float mfX2;
67 float mfY2;
68
71 , mnRx(0)
72 , mnRy(0)
73 , mfX1(0.0f)
74 , mfY1(0.0f)
75 , mfX2(1.0f)
76 , mfY2(1.0f)
77 {
78 }
79};
80
82{
83public:
84 float mfX1;
85 float mfY1;
86 float mfX2;
87 float mfY2;
88
91 , mfX1(0.0)
92 , mfY1(0.0)
93 , mfX2(0.0)
94 , mfY2(0.0)
95 {
96 }
97};
98
100{
101public:
102 OUString msSource;
103
106 {
107 }
108};
109
111{
112public:
113 OUString msSource;
114
117 {
118 }
119};
120
122{
125
127 : meType(eType)
128 , mePart(ePart)
129 {
130 }
131
132 bool operator==(ControlTypeAndPart const& aOther) const
133 {
134 return meType == aOther.meType && mePart == aOther.mePart;
135 }
136};
137
138} // end vcl namespace
139
140namespace std
141{
142template <> struct VCL_DLLPUBLIC hash<vcl::ControlTypeAndPart>
143{
144 std::size_t operator()(vcl::ControlTypeAndPart const& rControlTypeAndPart) const noexcept
145 {
146 std::size_t seed = 0;
147 o3tl::hash_combine(seed, rControlTypeAndPart.meType);
148 o3tl::hash_combine(seed, rControlTypeAndPart.mePart);
149 return seed;
150 }
151};
152
153} // end std namespace
154
155namespace vcl
156{
158{
159public:
160 OString msEnabled;
161 OString msFocused;
162 OString msPressed;
163 OString msRollover;
164 OString msDefault;
165 OString msSelected;
167 OString msExtra;
168
169 WidgetDefinitionState(OString sEnabled, OString sFocused, OString sPressed, OString sRollover,
170 OString sDefault, OString sSelected, OString sButtonValue,
171 OString sExtra);
172
173 std::vector<std::shared_ptr<WidgetDrawAction>> mpWidgetDrawActions;
174
175 void addDrawRectangle(Color aStrokeColor, sal_Int32 nStrokeWidth, Color aFillColor, float fX1,
176 float fY1, float fX2, float fY2, sal_Int32 nRx, sal_Int32 nRy);
177
178 void addDrawLine(Color aStrokeColor, sal_Int32 nStrokeWidth, float fX1, float fY1, float fX2,
179 float fY2);
180
181 void addDrawImage(OUString const& sSource);
182 void addDrawExternal(OUString const& sSource);
183};
184
186{
187public:
188 sal_Int32 mnWidth;
189 sal_Int32 mnHeight;
190 sal_Int32 mnMarginWidth;
191 sal_Int32 mnMarginHeight;
193
194 std::vector<std::shared_ptr<WidgetDefinitionState>> getStates(ControlType eType,
195 ControlPart ePart,
196 ControlState eState,
197 ImplControlValue const& rValue);
198
199 std::vector<std::shared_ptr<WidgetDefinitionState>> maStates;
200};
201
203{
204public:
213};
214
216{
217public:
280};
281
283{
284public:
285 std::shared_ptr<WidgetDefinitionStyle> mpStyle;
286 std::shared_ptr<WidgetDefinitionSettings> mpSettings;
287 std::unordered_map<ControlTypeAndPart, std::shared_ptr<WidgetDefinitionPart>> maDefinitions;
288 std::shared_ptr<WidgetDefinitionPart> getDefinition(ControlType eType, ControlPart ePart);
289};
290
291} // end vcl namespace
292
293/* 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