2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-12-13 09:36:36 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 21:12:23 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-12-13 09:36:36 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-12-13 09:36:36 +00:00
|
|
|
*
|
2008-04-10 21:12:23 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-12-13 09:36:36 +00:00
|
|
|
*
|
2008-04-10 21:12:23 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-12-13 09:36:36 +00:00
|
|
|
*
|
2008-04-10 21:12:23 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-12-13 09:36:36 +00:00
|
|
|
*
|
2008-04-10 21:12:23 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-12-13 09:36:36 +00:00
|
|
|
*
|
2008-04-10 21:12:23 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-12-13 09:36:36 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include "valueproperties.hxx"
|
|
|
|
#include "strings.hxx"
|
|
|
|
#include <com/sun/star/form/FormComponentType.hpp>
|
|
|
|
|
|
|
|
//.........................................................................
|
|
|
|
namespace xmloff
|
|
|
|
{
|
|
|
|
//.........................................................................
|
|
|
|
|
|
|
|
using namespace ::com::sun::star::form;
|
|
|
|
|
|
|
|
//=====================================================================
|
|
|
|
//= OValuePropertiesMetaData
|
|
|
|
//=====================================================================
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
void OValuePropertiesMetaData::getValuePropertyNames(
|
|
|
|
OControlElement::ElementType _eType, sal_Int16 _nFormComponentType,
|
|
|
|
sal_Char const * & _rpCurrentValuePropertyName, sal_Char const * & _rpValuePropertyName)
|
|
|
|
{
|
|
|
|
// reset the pointers in case we can't determine the property names
|
|
|
|
_rpCurrentValuePropertyName = _rpValuePropertyName = NULL;
|
|
|
|
switch (_nFormComponentType)
|
|
|
|
{
|
|
|
|
case FormComponentType::TEXTFIELD:
|
|
|
|
if (OControlElement::FORMATTED_TEXT == _eType)
|
|
|
|
{
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpCurrentValuePropertyName = PROPERTY_EFFECTIVE_VALUE.ascii;
|
|
|
|
_rpValuePropertyName = PROPERTY_EFFECTIVE_DEFAULT.ascii;
|
2000-12-13 09:36:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-02-13 08:07:25 +00:00
|
|
|
if (OControlElement::PASSWORD != _eType)
|
|
|
|
// no CurrentValue" for passwords
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpCurrentValuePropertyName = PROPERTY_TEXT.ascii;
|
|
|
|
_rpValuePropertyName = PROPERTY_DEFAULT_TEXT.ascii;
|
2000-12-13 09:36:36 +00:00
|
|
|
}
|
|
|
|
break;
|
2003-12-11 11:11:44 +00:00
|
|
|
|
2000-12-13 09:36:36 +00:00
|
|
|
case FormComponentType::NUMERICFIELD:
|
|
|
|
case FormComponentType::CURRENCYFIELD:
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpCurrentValuePropertyName = PROPERTY_VALUE.ascii;
|
|
|
|
_rpValuePropertyName = PROPERTY_DEFAULT_VALUE.ascii;
|
2000-12-13 09:36:36 +00:00
|
|
|
break;
|
2003-12-11 11:11:44 +00:00
|
|
|
|
2000-12-13 09:36:36 +00:00
|
|
|
case FormComponentType::PATTERNFIELD:
|
|
|
|
case FormComponentType::FILECONTROL:
|
|
|
|
case FormComponentType::COMBOBOX:
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpValuePropertyName = PROPERTY_DEFAULT_TEXT.ascii;
|
2000-12-13 09:36:36 +00:00
|
|
|
// NO BREAK!!
|
|
|
|
case FormComponentType::COMMANDBUTTON:
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpCurrentValuePropertyName = PROPERTY_TEXT.ascii;
|
2000-12-13 09:36:36 +00:00
|
|
|
break;
|
2003-12-11 11:11:44 +00:00
|
|
|
|
2000-12-13 09:36:36 +00:00
|
|
|
case FormComponentType::CHECKBOX:
|
|
|
|
case FormComponentType::RADIOBUTTON:
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpValuePropertyName = PROPERTY_REFVALUE.ascii;
|
2000-12-13 09:36:36 +00:00
|
|
|
break;
|
2003-12-11 11:11:44 +00:00
|
|
|
|
2000-12-13 09:36:36 +00:00
|
|
|
case FormComponentType::HIDDENCONTROL:
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpValuePropertyName = PROPERTY_HIDDEN_VALUE.ascii;
|
2000-12-13 09:36:36 +00:00
|
|
|
break;
|
2003-12-11 11:11:44 +00:00
|
|
|
|
|
|
|
case FormComponentType::SCROLLBAR:
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpCurrentValuePropertyName = PROPERTY_SCROLLVALUE.ascii;
|
|
|
|
_rpValuePropertyName = PROPERTY_SCROLLVALUE_DEFAULT.ascii;
|
2003-12-11 11:11:44 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FormComponentType::SPINBUTTON:
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpCurrentValuePropertyName = PROPERTY_SPINVALUE.ascii;
|
|
|
|
_rpValuePropertyName = PROPERTY_DEFAULT_SPINVALUE.ascii;
|
2003-12-11 11:11:44 +00:00
|
|
|
break;
|
2010-09-15 13:55:34 +02:00
|
|
|
|
|
|
|
default:
|
|
|
|
OSL_ENSURE( false, "OValuePropertiesMetaData::getValuePropertyNames: unsupported component type!" );
|
|
|
|
break;
|
2000-12-13 09:36:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------
|
|
|
|
void OValuePropertiesMetaData::getValueLimitPropertyNames(sal_Int16 _nFormComponentType,
|
|
|
|
sal_Char const * & _rpMinValuePropertyName, sal_Char const * & _rpMaxValuePropertyName)
|
|
|
|
{
|
2010-05-10 18:54:44 +02:00
|
|
|
_rpMinValuePropertyName = _rpMaxValuePropertyName = NULL;
|
2000-12-13 09:36:36 +00:00
|
|
|
switch (_nFormComponentType)
|
|
|
|
{
|
|
|
|
case FormComponentType::NUMERICFIELD:
|
|
|
|
case FormComponentType::CURRENCYFIELD:
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpMinValuePropertyName = PROPERTY_VALUE_MIN.ascii;
|
|
|
|
_rpMaxValuePropertyName = PROPERTY_VALUE_MAX.ascii;
|
2000-12-13 09:36:36 +00:00
|
|
|
break;
|
2003-12-11 11:11:44 +00:00
|
|
|
|
2000-12-13 09:36:36 +00:00
|
|
|
case FormComponentType::TEXTFIELD:
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpMinValuePropertyName = PROPERTY_EFFECTIVE_MIN.ascii;
|
|
|
|
_rpMaxValuePropertyName = PROPERTY_EFFECTIVE_MAX.ascii;
|
2000-12-13 09:36:36 +00:00
|
|
|
break;
|
2003-12-11 11:11:44 +00:00
|
|
|
|
|
|
|
case FormComponentType::SCROLLBAR:
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpMinValuePropertyName = PROPERTY_SCROLLVALUE_MIN.ascii;
|
|
|
|
_rpMaxValuePropertyName = PROPERTY_SCROLLVALUE_MAX.ascii;
|
2003-12-11 11:11:44 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FormComponentType::SPINBUTTON:
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpMinValuePropertyName = PROPERTY_SPINVALUE_MIN.ascii;
|
|
|
|
_rpMaxValuePropertyName = PROPERTY_SPINVALUE_MAX.ascii;
|
2003-12-11 11:11:44 +00:00
|
|
|
break;
|
2010-09-15 13:55:34 +02:00
|
|
|
|
|
|
|
default:
|
|
|
|
OSL_ENSURE( false, "OValuePropertiesMetaData::getValueLimitPropertyNames: unsupported component type!" );
|
|
|
|
break;
|
2000-12-13 09:36:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-09-09 12:53:59 +00:00
|
|
|
//---------------------------------------------------------------------
|
|
|
|
void OValuePropertiesMetaData::getRuntimeValuePropertyNames(
|
|
|
|
OControlElement::ElementType _eType, sal_Int16 _nFormComponentType,
|
|
|
|
sal_Char const * & _rpValuePropertyName, sal_Char const * & _rpDefaultValuePropertyName )
|
|
|
|
{
|
|
|
|
// reset the pointers in case we can't determine the property names
|
|
|
|
_rpValuePropertyName = _rpDefaultValuePropertyName = NULL;
|
|
|
|
switch (_nFormComponentType)
|
|
|
|
{
|
|
|
|
case FormComponentType::TEXTFIELD:
|
|
|
|
if (OControlElement::FORMATTED_TEXT == _eType)
|
|
|
|
{
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpValuePropertyName = PROPERTY_EFFECTIVE_VALUE.ascii;
|
|
|
|
_rpDefaultValuePropertyName = PROPERTY_EFFECTIVE_DEFAULT.ascii;
|
2002-09-09 12:53:59 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpValuePropertyName = PROPERTY_TEXT.ascii;
|
|
|
|
_rpDefaultValuePropertyName = PROPERTY_DEFAULT_TEXT.ascii;
|
2002-09-09 12:53:59 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FormComponentType::DATEFIELD:
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpValuePropertyName = PROPERTY_DATE.ascii;
|
|
|
|
_rpDefaultValuePropertyName = PROPERTY_DEFAULT_DATE.ascii;
|
2010-09-15 13:55:34 +02:00
|
|
|
break;
|
|
|
|
|
2002-09-09 12:53:59 +00:00
|
|
|
case FormComponentType::TIMEFIELD:
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpValuePropertyName = PROPERTY_TIME.ascii;
|
|
|
|
_rpDefaultValuePropertyName = PROPERTY_DEFAULT_TIME.ascii;
|
2010-09-15 13:55:34 +02:00
|
|
|
break;
|
|
|
|
|
2002-09-09 12:53:59 +00:00
|
|
|
case FormComponentType::NUMERICFIELD:
|
|
|
|
case FormComponentType::CURRENCYFIELD:
|
|
|
|
case FormComponentType::PATTERNFIELD:
|
|
|
|
case FormComponentType::FILECONTROL:
|
|
|
|
case FormComponentType::COMBOBOX:
|
2003-12-11 11:11:44 +00:00
|
|
|
case FormComponentType::SCROLLBAR:
|
|
|
|
case FormComponentType::SPINBUTTON:
|
2002-09-09 12:53:59 +00:00
|
|
|
// For these types, the runtime properties are the same as the ones which in the XML
|
|
|
|
// stream are named "value properties"
|
|
|
|
getValuePropertyNames( _eType, _nFormComponentType, _rpValuePropertyName, _rpDefaultValuePropertyName );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FormComponentType::CHECKBOX:
|
|
|
|
case FormComponentType::RADIOBUTTON:
|
2012-05-17 14:00:15 +01:00
|
|
|
_rpValuePropertyName = PROPERTY_STATE.ascii;
|
|
|
|
_rpDefaultValuePropertyName = PROPERTY_DEFAULT_STATE.ascii;
|
2002-09-09 12:53:59 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-12-13 09:36:36 +00:00
|
|
|
//.........................................................................
|
|
|
|
} // namespace xmloff
|
|
|
|
//.........................................................................
|
|
|
|
|
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|