1*63bba73cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*63bba73cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*63bba73cSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*63bba73cSAndrew Rist * distributed with this work for additional information 6*63bba73cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*63bba73cSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*63bba73cSAndrew Rist * "License"); you may not use this file except in compliance 9*63bba73cSAndrew Rist * with the License. You may obtain a copy of the License at 10*63bba73cSAndrew Rist * 11*63bba73cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*63bba73cSAndrew Rist * 13*63bba73cSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*63bba73cSAndrew Rist * software distributed under the License is distributed on an 15*63bba73cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*63bba73cSAndrew Rist * KIND, either express or implied. See the License for the 17*63bba73cSAndrew Rist * specific language governing permissions and limitations 18*63bba73cSAndrew Rist * under the License. 19*63bba73cSAndrew Rist * 20*63bba73cSAndrew Rist *************************************************************/ 21*63bba73cSAndrew Rist 22*63bba73cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_xmloff.hxx" 26cdf0e10cSrcweir #include "valueproperties.hxx" 27cdf0e10cSrcweir #include "strings.hxx" 28cdf0e10cSrcweir #include <com/sun/star/form/FormComponentType.hpp> 29cdf0e10cSrcweir 30cdf0e10cSrcweir //......................................................................... 31cdf0e10cSrcweir namespace xmloff 32cdf0e10cSrcweir { 33cdf0e10cSrcweir //......................................................................... 34cdf0e10cSrcweir 35cdf0e10cSrcweir using namespace ::com::sun::star::form; 36cdf0e10cSrcweir 37cdf0e10cSrcweir //===================================================================== 38cdf0e10cSrcweir //= OValuePropertiesMetaData 39cdf0e10cSrcweir //===================================================================== 40cdf0e10cSrcweir //--------------------------------------------------------------------- getValuePropertyNames(OControlElement::ElementType _eType,sal_Int16 _nFormComponentType,sal_Char const * & _rpCurrentValuePropertyName,sal_Char const * & _rpValuePropertyName)41cdf0e10cSrcweir void OValuePropertiesMetaData::getValuePropertyNames( 42cdf0e10cSrcweir OControlElement::ElementType _eType, sal_Int16 _nFormComponentType, 43cdf0e10cSrcweir sal_Char const * & _rpCurrentValuePropertyName, sal_Char const * & _rpValuePropertyName) 44cdf0e10cSrcweir { 45cdf0e10cSrcweir // reset the pointers in case we can't determine the property names 46cdf0e10cSrcweir _rpCurrentValuePropertyName = _rpValuePropertyName = NULL; 47cdf0e10cSrcweir switch (_nFormComponentType) 48cdf0e10cSrcweir { 49cdf0e10cSrcweir case FormComponentType::TEXTFIELD: 50cdf0e10cSrcweir if (OControlElement::FORMATTED_TEXT == _eType) 51cdf0e10cSrcweir { 52cdf0e10cSrcweir _rpCurrentValuePropertyName = PROPERTY_EFFECTIVE_VALUE; 53cdf0e10cSrcweir _rpValuePropertyName = PROPERTY_EFFECTIVE_DEFAULT; 54cdf0e10cSrcweir } 55cdf0e10cSrcweir else 56cdf0e10cSrcweir { 57cdf0e10cSrcweir if (OControlElement::PASSWORD != _eType) 58cdf0e10cSrcweir // no CurrentValue" for passwords 59cdf0e10cSrcweir _rpCurrentValuePropertyName = PROPERTY_TEXT; 60cdf0e10cSrcweir _rpValuePropertyName = PROPERTY_DEFAULT_TEXT; 61cdf0e10cSrcweir } 62cdf0e10cSrcweir break; 63cdf0e10cSrcweir 64cdf0e10cSrcweir case FormComponentType::NUMERICFIELD: 65cdf0e10cSrcweir case FormComponentType::CURRENCYFIELD: 66cdf0e10cSrcweir _rpCurrentValuePropertyName = PROPERTY_VALUE; 67cdf0e10cSrcweir _rpValuePropertyName = PROPERTY_DEFAULT_VALUE; 68cdf0e10cSrcweir break; 69cdf0e10cSrcweir 70cdf0e10cSrcweir case FormComponentType::PATTERNFIELD: 71cdf0e10cSrcweir case FormComponentType::FILECONTROL: 72cdf0e10cSrcweir case FormComponentType::COMBOBOX: 73cdf0e10cSrcweir _rpValuePropertyName = PROPERTY_DEFAULT_TEXT; 74cdf0e10cSrcweir // NO BREAK!! 75cdf0e10cSrcweir case FormComponentType::COMMANDBUTTON: 76cdf0e10cSrcweir _rpCurrentValuePropertyName = PROPERTY_TEXT; 77cdf0e10cSrcweir break; 78cdf0e10cSrcweir 79cdf0e10cSrcweir case FormComponentType::CHECKBOX: 80cdf0e10cSrcweir case FormComponentType::RADIOBUTTON: 81cdf0e10cSrcweir _rpValuePropertyName = PROPERTY_REFVALUE; 82cdf0e10cSrcweir break; 83cdf0e10cSrcweir 84cdf0e10cSrcweir case FormComponentType::HIDDENCONTROL: 85cdf0e10cSrcweir _rpValuePropertyName = PROPERTY_HIDDEN_VALUE; 86cdf0e10cSrcweir break; 87cdf0e10cSrcweir 88cdf0e10cSrcweir case FormComponentType::SCROLLBAR: 89cdf0e10cSrcweir _rpCurrentValuePropertyName = PROPERTY_SCROLLVALUE; 90cdf0e10cSrcweir _rpValuePropertyName = PROPERTY_SCROLLVALUE_DEFAULT; 91cdf0e10cSrcweir break; 92cdf0e10cSrcweir 93cdf0e10cSrcweir case FormComponentType::SPINBUTTON: 94cdf0e10cSrcweir _rpCurrentValuePropertyName = PROPERTY_SPINVALUE; 95cdf0e10cSrcweir _rpValuePropertyName = PROPERTY_DEFAULT_SPINVALUE; 96cdf0e10cSrcweir break; 97cdf0e10cSrcweir 98cdf0e10cSrcweir default: 99cdf0e10cSrcweir OSL_ENSURE( false, "OValuePropertiesMetaData::getValuePropertyNames: unsupported component type!" ); 100cdf0e10cSrcweir break; 101cdf0e10cSrcweir } 102cdf0e10cSrcweir } 103cdf0e10cSrcweir 104cdf0e10cSrcweir 105cdf0e10cSrcweir //--------------------------------------------------------------------- getValueLimitPropertyNames(sal_Int16 _nFormComponentType,sal_Char const * & _rpMinValuePropertyName,sal_Char const * & _rpMaxValuePropertyName)106cdf0e10cSrcweir void OValuePropertiesMetaData::getValueLimitPropertyNames(sal_Int16 _nFormComponentType, 107cdf0e10cSrcweir sal_Char const * & _rpMinValuePropertyName, sal_Char const * & _rpMaxValuePropertyName) 108cdf0e10cSrcweir { 109cdf0e10cSrcweir _rpMinValuePropertyName = _rpMaxValuePropertyName = NULL; 110cdf0e10cSrcweir switch (_nFormComponentType) 111cdf0e10cSrcweir { 112cdf0e10cSrcweir case FormComponentType::NUMERICFIELD: 113cdf0e10cSrcweir case FormComponentType::CURRENCYFIELD: 114cdf0e10cSrcweir _rpMinValuePropertyName = PROPERTY_VALUE_MIN; 115cdf0e10cSrcweir _rpMaxValuePropertyName = PROPERTY_VALUE_MAX; 116cdf0e10cSrcweir break; 117cdf0e10cSrcweir 118cdf0e10cSrcweir case FormComponentType::TEXTFIELD: 119cdf0e10cSrcweir _rpMinValuePropertyName = PROPERTY_EFFECTIVE_MIN; 120cdf0e10cSrcweir _rpMaxValuePropertyName = PROPERTY_EFFECTIVE_MAX; 121cdf0e10cSrcweir break; 122cdf0e10cSrcweir 123cdf0e10cSrcweir case FormComponentType::SCROLLBAR: 124cdf0e10cSrcweir _rpMinValuePropertyName = PROPERTY_SCROLLVALUE_MIN; 125cdf0e10cSrcweir _rpMaxValuePropertyName = PROPERTY_SCROLLVALUE_MAX; 126cdf0e10cSrcweir break; 127cdf0e10cSrcweir 128cdf0e10cSrcweir case FormComponentType::SPINBUTTON: 129cdf0e10cSrcweir _rpMinValuePropertyName = PROPERTY_SPINVALUE_MIN; 130cdf0e10cSrcweir _rpMaxValuePropertyName = PROPERTY_SPINVALUE_MAX; 131cdf0e10cSrcweir break; 132cdf0e10cSrcweir 133cdf0e10cSrcweir default: 134cdf0e10cSrcweir OSL_ENSURE( false, "OValuePropertiesMetaData::getValueLimitPropertyNames: unsupported component type!" ); 135cdf0e10cSrcweir break; 136cdf0e10cSrcweir } 137cdf0e10cSrcweir } 138cdf0e10cSrcweir 139cdf0e10cSrcweir //--------------------------------------------------------------------- getRuntimeValuePropertyNames(OControlElement::ElementType _eType,sal_Int16 _nFormComponentType,sal_Char const * & _rpValuePropertyName,sal_Char const * & _rpDefaultValuePropertyName)140cdf0e10cSrcweir void OValuePropertiesMetaData::getRuntimeValuePropertyNames( 141cdf0e10cSrcweir OControlElement::ElementType _eType, sal_Int16 _nFormComponentType, 142cdf0e10cSrcweir sal_Char const * & _rpValuePropertyName, sal_Char const * & _rpDefaultValuePropertyName ) 143cdf0e10cSrcweir { 144cdf0e10cSrcweir // reset the pointers in case we can't determine the property names 145cdf0e10cSrcweir _rpValuePropertyName = _rpDefaultValuePropertyName = NULL; 146cdf0e10cSrcweir switch (_nFormComponentType) 147cdf0e10cSrcweir { 148cdf0e10cSrcweir case FormComponentType::TEXTFIELD: 149cdf0e10cSrcweir if (OControlElement::FORMATTED_TEXT == _eType) 150cdf0e10cSrcweir { 151cdf0e10cSrcweir _rpValuePropertyName = PROPERTY_EFFECTIVE_VALUE; 152cdf0e10cSrcweir _rpDefaultValuePropertyName = PROPERTY_EFFECTIVE_DEFAULT; 153cdf0e10cSrcweir } 154cdf0e10cSrcweir else 155cdf0e10cSrcweir { 156cdf0e10cSrcweir _rpValuePropertyName = PROPERTY_TEXT; 157cdf0e10cSrcweir _rpDefaultValuePropertyName = PROPERTY_DEFAULT_TEXT; 158cdf0e10cSrcweir } 159cdf0e10cSrcweir break; 160cdf0e10cSrcweir 161cdf0e10cSrcweir case FormComponentType::DATEFIELD: 162cdf0e10cSrcweir _rpValuePropertyName = PROPERTY_DATE; 163cdf0e10cSrcweir _rpDefaultValuePropertyName = PROPERTY_DEFAULT_DATE; 164cdf0e10cSrcweir break; 165cdf0e10cSrcweir 166cdf0e10cSrcweir case FormComponentType::TIMEFIELD: 167cdf0e10cSrcweir _rpValuePropertyName = PROPERTY_TIME; 168cdf0e10cSrcweir _rpDefaultValuePropertyName = PROPERTY_DEFAULT_TIME; 169cdf0e10cSrcweir break; 170cdf0e10cSrcweir 171cdf0e10cSrcweir case FormComponentType::NUMERICFIELD: 172cdf0e10cSrcweir case FormComponentType::CURRENCYFIELD: 173cdf0e10cSrcweir case FormComponentType::PATTERNFIELD: 174cdf0e10cSrcweir case FormComponentType::FILECONTROL: 175cdf0e10cSrcweir case FormComponentType::COMBOBOX: 176cdf0e10cSrcweir case FormComponentType::SCROLLBAR: 177cdf0e10cSrcweir case FormComponentType::SPINBUTTON: 178cdf0e10cSrcweir // For these types, the runtime properties are the same as the ones which in the XML 179cdf0e10cSrcweir // stream are named "value properties" 180cdf0e10cSrcweir getValuePropertyNames( _eType, _nFormComponentType, _rpValuePropertyName, _rpDefaultValuePropertyName ); 181cdf0e10cSrcweir break; 182cdf0e10cSrcweir 183cdf0e10cSrcweir case FormComponentType::CHECKBOX: 184cdf0e10cSrcweir case FormComponentType::RADIOBUTTON: 185cdf0e10cSrcweir _rpValuePropertyName = PROPERTY_STATE; 186cdf0e10cSrcweir _rpDefaultValuePropertyName = PROPERTY_DEFAULT_STATE; 187cdf0e10cSrcweir break; 188cdf0e10cSrcweir } 189cdf0e10cSrcweir } 190cdf0e10cSrcweir 191cdf0e10cSrcweir //......................................................................... 192cdf0e10cSrcweir } // namespace xmloff 193cdf0e10cSrcweir //......................................................................... 194cdf0e10cSrcweir 195cdf0e10cSrcweir 196