fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / xmloff / source / forms / valueproperties.cxx
blob1f21541a2e65a919eea67570a027d5d168e70360
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 "valueproperties.hxx"
21 #include "strings.hxx"
22 #include <com/sun/star/form/FormComponentType.hpp>
23 #include <sal/log.hxx>
25 //.........................................................................
26 namespace xmloff
28 //.........................................................................
30 using namespace ::com::sun::star::form;
32 //=====================================================================
33 //= OValuePropertiesMetaData
34 //=====================================================================
35 //---------------------------------------------------------------------
36 void OValuePropertiesMetaData::getValuePropertyNames(
37 OControlElement::ElementType _eType, sal_Int16 _nFormComponentType,
38 sal_Char const * & _rpCurrentValuePropertyName, sal_Char const * & _rpValuePropertyName)
40 // reset the pointers in case we can't determine the property names
41 _rpCurrentValuePropertyName = _rpValuePropertyName = NULL;
42 switch (_nFormComponentType)
44 case FormComponentType::TEXTFIELD:
45 if (OControlElement::FORMATTED_TEXT == _eType)
47 _rpCurrentValuePropertyName = PROPERTY_EFFECTIVE_VALUE;
48 _rpValuePropertyName = PROPERTY_EFFECTIVE_DEFAULT;
50 else
52 if (OControlElement::PASSWORD != _eType)
53 // no CurrentValue" for passwords
54 _rpCurrentValuePropertyName = PROPERTY_TEXT;
55 _rpValuePropertyName = PROPERTY_DEFAULT_TEXT;
57 break;
59 case FormComponentType::NUMERICFIELD:
60 case FormComponentType::CURRENCYFIELD:
61 _rpCurrentValuePropertyName = PROPERTY_VALUE;
62 _rpValuePropertyName = PROPERTY_DEFAULT_VALUE;
63 break;
65 case FormComponentType::PATTERNFIELD:
66 case FormComponentType::FILECONTROL:
67 case FormComponentType::COMBOBOX:
68 _rpValuePropertyName = PROPERTY_DEFAULT_TEXT;
69 // NO BREAK!!
70 case FormComponentType::COMMANDBUTTON:
71 _rpCurrentValuePropertyName = PROPERTY_TEXT;
72 break;
74 case FormComponentType::CHECKBOX:
75 case FormComponentType::RADIOBUTTON:
76 _rpValuePropertyName = PROPERTY_REFVALUE;
77 break;
79 case FormComponentType::HIDDENCONTROL:
80 _rpValuePropertyName = PROPERTY_HIDDEN_VALUE;
81 break;
83 case FormComponentType::SCROLLBAR:
84 _rpCurrentValuePropertyName = PROPERTY_SCROLLVALUE;
85 _rpValuePropertyName = PROPERTY_SCROLLVALUE_DEFAULT;
86 break;
88 case FormComponentType::SPINBUTTON:
89 _rpCurrentValuePropertyName = PROPERTY_SPINVALUE;
90 _rpValuePropertyName = PROPERTY_DEFAULT_SPINVALUE;
91 break;
93 default:
94 SAL_WARN( "xmloff", "OValuePropertiesMetaData::getValuePropertyNames: unsupported component type!" );
95 break;
100 //---------------------------------------------------------------------
101 void OValuePropertiesMetaData::getValueLimitPropertyNames(sal_Int16 _nFormComponentType,
102 sal_Char const * & _rpMinValuePropertyName, sal_Char const * & _rpMaxValuePropertyName)
104 _rpMinValuePropertyName = _rpMaxValuePropertyName = NULL;
105 switch (_nFormComponentType)
107 case FormComponentType::NUMERICFIELD:
108 case FormComponentType::CURRENCYFIELD:
109 _rpMinValuePropertyName = PROPERTY_VALUE_MIN;
110 _rpMaxValuePropertyName = PROPERTY_VALUE_MAX;
111 break;
113 case FormComponentType::TEXTFIELD:
114 _rpMinValuePropertyName = PROPERTY_EFFECTIVE_MIN;
115 _rpMaxValuePropertyName = PROPERTY_EFFECTIVE_MAX;
116 break;
118 case FormComponentType::SCROLLBAR:
119 _rpMinValuePropertyName = PROPERTY_SCROLLVALUE_MIN;
120 _rpMaxValuePropertyName = PROPERTY_SCROLLVALUE_MAX;
121 break;
123 case FormComponentType::SPINBUTTON:
124 _rpMinValuePropertyName = PROPERTY_SPINVALUE_MIN;
125 _rpMaxValuePropertyName = PROPERTY_SPINVALUE_MAX;
126 break;
128 default:
129 SAL_WARN("xmloff", "OValuePropertiesMetaData::getValueLimitPropertyNames: unsupported component type!" );
130 break;
134 //---------------------------------------------------------------------
135 void OValuePropertiesMetaData::getRuntimeValuePropertyNames(
136 OControlElement::ElementType _eType, sal_Int16 _nFormComponentType,
137 sal_Char const * & _rpValuePropertyName, sal_Char const * & _rpDefaultValuePropertyName )
139 // reset the pointers in case we can't determine the property names
140 _rpValuePropertyName = _rpDefaultValuePropertyName = NULL;
141 switch (_nFormComponentType)
143 case FormComponentType::TEXTFIELD:
144 if (OControlElement::FORMATTED_TEXT == _eType)
146 _rpValuePropertyName = PROPERTY_EFFECTIVE_VALUE;
147 _rpDefaultValuePropertyName = PROPERTY_EFFECTIVE_DEFAULT;
149 else
151 _rpValuePropertyName = PROPERTY_TEXT;
152 _rpDefaultValuePropertyName = PROPERTY_DEFAULT_TEXT;
154 break;
156 case FormComponentType::DATEFIELD:
157 _rpValuePropertyName = PROPERTY_DATE;
158 _rpDefaultValuePropertyName = PROPERTY_DEFAULT_DATE;
159 break;
161 case FormComponentType::TIMEFIELD:
162 _rpValuePropertyName = PROPERTY_TIME;
163 _rpDefaultValuePropertyName = PROPERTY_DEFAULT_TIME;
164 break;
166 case FormComponentType::NUMERICFIELD:
167 case FormComponentType::CURRENCYFIELD:
168 case FormComponentType::PATTERNFIELD:
169 case FormComponentType::FILECONTROL:
170 case FormComponentType::COMBOBOX:
171 case FormComponentType::SCROLLBAR:
172 case FormComponentType::SPINBUTTON:
173 // For these types, the runtime properties are the same as the ones which in the XML
174 // stream are named "value properties"
175 getValuePropertyNames( _eType, _nFormComponentType, _rpValuePropertyName, _rpDefaultValuePropertyName );
176 break;
178 case FormComponentType::CHECKBOX:
179 case FormComponentType::RADIOBUTTON:
180 _rpValuePropertyName = PROPERTY_STATE;
181 _rpDefaultValuePropertyName = PROPERTY_DEFAULT_STATE;
182 break;
186 //.........................................................................
187 } // namespace xmloff
188 //.........................................................................
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */