fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / xmloff / source / forms / formenums.cxx
blob583e1b91878145aed8fd5f24ea06fb83823d6b89
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 #include "formenums.hxx"
21 #include <osl/diagnose.h>
22 #include <com/sun/star/form/FormSubmitEncoding.hpp>
23 #include <com/sun/star/form/FormSubmitMethod.hpp>
24 #include <com/sun/star/sdb/CommandType.hpp>
25 #include <com/sun/star/form/NavigationBarMode.hpp>
26 #include <com/sun/star/form/TabulatorCycle.hpp>
27 #include <com/sun/star/form/FormButtonType.hpp>
28 #include <com/sun/star/form/ListSourceType.hpp>
29 #include <com/sun/star/awt/TextAlign.hpp>
30 #include <com/sun/star/awt/FontWidth.hpp>
31 #include <com/sun/star/awt/FontEmphasisMark.hpp>
32 #include <com/sun/star/awt/FontRelief.hpp>
33 #include <com/sun/star/awt/ScrollBarOrientation.hpp>
34 #include <com/sun/star/awt/VisualEffect.hpp>
35 #include <com/sun/star/awt/ImageScaleMode.hpp>
36 #include <tools/wintypes.hxx> // for check states
37 #include <xmloff/xmltoken.hxx>
39 //.........................................................................
40 namespace xmloff
42 //.........................................................................
44 using namespace ::com::sun::star::form;
45 using namespace ::com::sun::star::sdb;
46 using namespace ::com::sun::star::awt;
47 using namespace ::com::sun::star;
48 using namespace ::xmloff::token;
50 const SvXMLEnumMapEntry* OEnumMapper::s_pEnumMap[OEnumMapper::KNOWN_ENUM_PROPERTIES] =
52 NULL,
53 NULL,
54 NULL,
55 NULL,
56 NULL,
57 NULL,
58 NULL,
59 NULL,
60 NULL,
61 NULL,
62 NULL,
63 NULL,
64 NULL,
65 NULL,
66 NULL
69 //---------------------------------------------------------------------
70 const SvXMLEnumMapEntry* OEnumMapper::getEnumMap(EnumProperties _eProperty)
72 OSL_ENSURE(_eProperty < KNOWN_ENUM_PROPERTIES, "OEnumMapper::getEnumMap: invalid index (this will crash)!");
74 const SvXMLEnumMapEntry*& rReturn = s_pEnumMap[_eProperty];
75 if (!rReturn)
77 // the map for this property is not initialized yet
78 switch (_eProperty)
80 // FormSubmitEncoding
81 case epSubmitEncoding:
83 static SvXMLEnumMapEntry aSubmitEncodingMap[] =
85 { XML_APPLICATION_X_WWW_FORM_URLENCODED, FormSubmitEncoding_URL },
86 { XML_MULTIPART_FORMDATA, FormSubmitEncoding_MULTIPART },
87 { XML_APPLICATION_TEXT, FormSubmitEncoding_TEXT },
88 { XML_TOKEN_INVALID, 0 }
90 rReturn = aSubmitEncodingMap;
92 break;
93 // FormSubmitMethod
94 case epSubmitMethod:
96 static SvXMLEnumMapEntry aSubmitMethodMap[] =
98 { XML_GET, FormSubmitMethod_GET },
99 { XML_POST, FormSubmitMethod_POST },
100 { XML_TOKEN_INVALID, 0 }
102 rReturn = aSubmitMethodMap;
104 break;
105 // CommandType
106 case epCommandType:
108 static SvXMLEnumMapEntry aCommandTypeMap[] =
110 { XML_TABLE, CommandType::TABLE },
111 { XML_QUERY, CommandType::QUERY },
112 { XML_COMMAND, CommandType::COMMAND },
113 { XML_TOKEN_INVALID, 0 }
115 rReturn = aCommandTypeMap;
117 break;
118 // NavigationBarMode
119 case epNavigationType:
121 static SvXMLEnumMapEntry aNavigationTypeMap[] =
123 { XML_NONE, NavigationBarMode_NONE },
124 { XML_CURRENT, NavigationBarMode_CURRENT },
125 { XML_PARENT, NavigationBarMode_PARENT },
126 { XML_TOKEN_INVALID, 0 }
128 rReturn = aNavigationTypeMap;
130 break;
131 // TabulatorCycle
132 case epTabCyle:
134 static SvXMLEnumMapEntry aTabulytorCycleMap[] =
136 { XML_RECORDS, TabulatorCycle_RECORDS },
137 { XML_CURRENT, TabulatorCycle_CURRENT },
138 { XML_PAGE, TabulatorCycle_PAGE },
139 { XML_TOKEN_INVALID, 0 }
141 rReturn = aTabulytorCycleMap;
143 break;
144 // FormButtonType
145 case epButtonType:
147 static SvXMLEnumMapEntry aFormButtonTypeMap[] =
149 { XML_PUSH, FormButtonType_PUSH },
150 { XML_SUBMIT, FormButtonType_SUBMIT },
151 { XML_RESET, FormButtonType_RESET },
152 { XML_URL, FormButtonType_URL },
153 { XML_TOKEN_INVALID, 0 }
155 rReturn = aFormButtonTypeMap;
157 break;
158 // ListSourceType
159 case epListSourceType:
161 static SvXMLEnumMapEntry aListSourceTypeMap[] =
163 { XML_VALUE_LIST, ListSourceType_VALUELIST },
164 { XML_TABLE, ListSourceType_TABLE },
165 { XML_QUERY, ListSourceType_QUERY },
166 { XML_SQL, ListSourceType_SQL },
167 { XML_SQL_PASS_THROUGH, ListSourceType_SQLPASSTHROUGH },
168 { XML_TABLE_FIELDS, ListSourceType_TABLEFIELDS },
169 { XML_TOKEN_INVALID, 0 }
171 rReturn = aListSourceTypeMap;
173 break;
174 // check state of a checkbox
175 case epCheckState:
177 static SvXMLEnumMapEntry aCheckStateMap[] =
179 { XML_UNCHECKED, STATE_NOCHECK },
180 { XML_CHECKED, STATE_CHECK },
181 { XML_UNKNOWN, STATE_DONTKNOW },
182 { XML_TOKEN_INVALID, 0 }
184 rReturn = aCheckStateMap;
186 break;
187 case epTextAlign:
189 static SvXMLEnumMapEntry aTextAlignMap[] =
191 { XML_START, awt::TextAlign::LEFT },
192 { XML_CENTER, awt::TextAlign::CENTER },
193 { XML_END, awt::TextAlign::RIGHT },
194 { XML_JUSTIFY, (sal_uInt16)-1 },
195 { XML_JUSTIFIED, (sal_uInt16)-1 },
196 { XML_TOKEN_INVALID, 0 }
198 rReturn = aTextAlignMap;
200 break;
201 case epBorderWidth:
203 static SvXMLEnumMapEntry aBorderTypeMap[] =
205 { XML_NONE, 0 },
206 { XML_HIDDEN, 0 },
207 { XML_SOLID, 2 },
208 { XML_DOUBLE, 2 },
209 { XML_DOTTED, 2 },
210 { XML_DASHED, 2 },
211 { XML_GROOVE, 1 },
212 { XML_RIDGE, 1 },
213 { XML_INSET, 1 },
214 { XML_OUTSET, 1 },
215 { XML_TOKEN_INVALID, 0 }
217 rReturn = aBorderTypeMap;
219 break;
221 case epFontEmphasis:
223 static SvXMLEnumMapEntry aFontEmphasisMap[] =
225 { XML_NONE, awt::FontEmphasisMark::NONE },
226 { XML_DOT, awt::FontEmphasisMark::DOT },
227 { XML_CIRCLE, awt::FontEmphasisMark::CIRCLE },
228 { XML_DISC, awt::FontEmphasisMark::DISC },
229 { XML_ACCENT, awt::FontEmphasisMark::ACCENT },
230 { XML_TOKEN_INVALID, 0 }
232 rReturn = aFontEmphasisMap;
234 break;
236 case epFontRelief:
238 static SvXMLEnumMapEntry aFontReliefMap[] =
240 { XML_NONE, FontRelief::NONE },
241 { XML_ENGRAVED, FontRelief::ENGRAVED },
242 { XML_EMBOSSED, FontRelief::EMBOSSED },
243 { XML_TOKEN_INVALID, 0 }
245 rReturn = aFontReliefMap;
247 break;
249 case epListLinkageType:
251 static SvXMLEnumMapEntry aListLinkageMap[] =
253 { XML_SELECTION, 0 },
254 { XML_SELECTION_INDEXES, 1 },
255 { XML_TOKEN_INVALID, 0 }
257 rReturn = aListLinkageMap;
259 break;
261 case epOrientation:
263 static SvXMLEnumMapEntry aOrientationMap[] =
265 { XML_HORIZONTAL, ScrollBarOrientation::HORIZONTAL },
266 { XML_VERTICAL, ScrollBarOrientation::VERTICAL },
267 { XML_TOKEN_INVALID, 0 }
269 rReturn = aOrientationMap;
271 break;
273 case epVisualEffect:
275 static SvXMLEnumMapEntry aVisualEffectMap[] =
277 { XML_NONE, VisualEffect::NONE },
278 { XML_3D, VisualEffect::LOOK3D },
279 { XML_FLAT, VisualEffect::FLAT },
280 { XML_TOKEN_INVALID, 0 }
282 rReturn = aVisualEffectMap;
284 break;
286 case epImagePosition:
288 static SvXMLEnumMapEntry aImagePositionMap[] =
290 { XML_START, 0 },
291 { XML_END, 1 },
292 { XML_TOP, 2 },
293 { XML_BOTTOM, 3 },
294 { XML_CENTER, (sal_uInt16)-1 },
295 { XML_TOKEN_INVALID, 0 }
297 rReturn = aImagePositionMap;
299 break;
301 case epImageAlign:
303 static SvXMLEnumMapEntry aImageAlignMap[] =
305 { XML_START, 0 },
306 { XML_CENTER, 1 },
307 { XML_END, 2 },
308 { XML_TOKEN_INVALID, 0 }
310 rReturn = aImageAlignMap;
312 break;
314 case epImageScaleMode:
316 static const SvXMLEnumMapEntry aScaleModeMap[] =
318 { XML_BACKGROUND_NO_REPEAT, ImageScaleMode::None },
319 { XML_REPEAT, ImageScaleMode::None }, // repeating the image is not supported
320 { XML_STRETCH, ImageScaleMode::Anisotropic },
321 { XML_SCALE, ImageScaleMode::Isotropic },
322 { XML_TOKEN_INVALID, ImageScaleMode::None }
324 rReturn = aScaleModeMap;
326 break;
328 case KNOWN_ENUM_PROPERTIES:
329 break;
333 return rReturn;
336 //.........................................................................
337 } // namespace xmloff
338 //.........................................................................
340 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */