summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-12 14:32:30 +0200
committerNoel Grandin <noel@peralex.com>2016-05-12 14:33:35 +0200
commit0c2d51e0daf2ce5e18af915ec40ec3196db8ab88 (patch)
tree720d61287f718a66747e31a156b0c98eb2d3e24e /xmloff
parentaba06d6f8d69632559ca9a74320fcd048855a3a3 (diff)
Convert SCA flags to scoped enum
Change-Id: I761022dd78f6c1d19cf4f2650a5ac7b2212c11c3
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/forms/elementexport.cxx120
-rw-r--r--xmloff/source/forms/elementexport.hxx2
-rw-r--r--xmloff/source/forms/elementimport.cxx12
-rw-r--r--xmloff/source/forms/formattributes.cxx43
-rw-r--r--xmloff/source/forms/formattributes.hxx53
-rw-r--r--xmloff/source/forms/layerimport.cxx24
6 files changed, 131 insertions, 123 deletions
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
index abd6e50da8b5..b80d7b0bb2c6 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -236,7 +236,7 @@ namespace xmloff
,m_eType( UNKNOWN )
,m_nIncludeCommon(CCAFlags::NONE)
,m_nIncludeDatabase(DAFlags::NONE)
- ,m_nIncludeSpecial(0)
+ ,m_nIncludeSpecial(SCAFlags::NONE)
,m_nIncludeEvents(EAFlags::NONE)
,m_nIncludeBindings(BAFlags::NONE)
,m_pOuterElement(nullptr)
@@ -964,10 +964,10 @@ namespace xmloff
// the boolean properties
{
- static const sal_Int32 nBooleanPropertyAttributeIds[] =
+ static const SCAFlags nBooleanPropertyAttributeIds[] =
{ // attribute flags
- SCA_VALIDATION, SCA_MULTI_LINE, SCA_AUTOMATIC_COMPLETION, SCA_MULTIPLE, SCA_DEFAULT_BUTTON, SCA_IS_TRISTATE,
- SCA_TOGGLE, SCA_FOCUS_ON_CLICK
+ SCAFlags::Validation, SCAFlags::MultiLine, SCAFlags::AutoCompletion, SCAFlags::Multiple, SCAFlags::DefaultButton, SCAFlags::IsTristate,
+ SCAFlags::Toggle, SCAFlags::FocusOnClick
};
static const char * pBooleanPropertyNames[] =
{ // property names
@@ -983,7 +983,7 @@ namespace xmloff
OSL_ENSURE((nIdCount == nNameCount),
"OControlExport::exportSpecialAttributes: somebody tampered with the maps (1)!");
#endif
- const sal_Int32* pAttributeId = nBooleanPropertyAttributeIds;
+ const SCAFlags* pAttributeId = nBooleanPropertyAttributeIds;
for ( i = 0; i < nIdCount; ++i, ++pAttributeId )
{
if ( *pAttributeId & m_nIncludeSpecial)
@@ -992,7 +992,7 @@ namespace xmloff
OAttributeMetaData::getSpecialAttributeNamespace( *pAttributeId ),
OAttributeMetaData::getSpecialAttributeName( *pAttributeId ),
OUString::createFromAscii(pBooleanPropertyNames[i]),
- ( *pAttributeId == SCA_FOCUS_ON_CLICK ) ? BoolAttrFlags::DefaultTrue : BoolAttrFlags::DefaultFalse
+ ( *pAttributeId == SCAFlags::FocusOnClick ) ? BoolAttrFlags::DefaultTrue : BoolAttrFlags::DefaultFalse
);
#if OSL_DEBUG_LEVEL > 0
// reset the bit for later checking
@@ -1004,9 +1004,9 @@ namespace xmloff
// the integer properties
{
- static sal_Int32 nIntegerPropertyAttributeIds[] =
+ static SCAFlags nIntegerPropertyAttributeIds[] =
{ // attribute flags
- SCA_PAGE_STEP_SIZE
+ SCAFlags::PageStepSize
};
static const char * pIntegerPropertyNames[] =
{ // property names
@@ -1041,7 +1041,7 @@ namespace xmloff
#endif
}
- if ( SCA_STEP_SIZE & m_nIncludeSpecial )
+ if ( SCAFlags::StepSize & m_nIncludeSpecial )
{
OUString sPropertyName;
if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_LINE_INCREMENT ) )
@@ -1053,15 +1053,15 @@ namespace xmloff
if ( !sPropertyName.isEmpty() )
exportInt32PropertyAttribute(
- OAttributeMetaData::getSpecialAttributeNamespace( SCA_STEP_SIZE ),
- OAttributeMetaData::getSpecialAttributeName( SCA_STEP_SIZE ),
+ OAttributeMetaData::getSpecialAttributeNamespace( SCAFlags::StepSize ),
+ OAttributeMetaData::getSpecialAttributeName( SCAFlags::StepSize ),
sPropertyName,
1
);
#if OSL_DEBUG_LEVEL > 0
// reset the bit for later checking
- m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_STEP_SIZE;
+ m_nIncludeSpecial = m_nIncludeSpecial & ~SCAFlags::StepSize;
#endif
}
@@ -1069,31 +1069,31 @@ namespace xmloff
// the enum properties
{
- if (SCA_STATE & m_nIncludeSpecial)
+ if (SCAFlags::State & m_nIncludeSpecial)
{
exportEnumPropertyAttribute(
- OAttributeMetaData::getSpecialAttributeNamespace(SCA_STATE),
- OAttributeMetaData::getSpecialAttributeName(SCA_STATE),
+ OAttributeMetaData::getSpecialAttributeNamespace(SCAFlags::State),
+ OAttributeMetaData::getSpecialAttributeName(SCAFlags::State),
PROPERTY_DEFAULT_STATE,
OEnumMapper::getEnumMap(OEnumMapper::epCheckState),
TRISTATE_FALSE);
#if OSL_DEBUG_LEVEL > 0
// reset the bit for later checking
- m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_STATE;
+ m_nIncludeSpecial = m_nIncludeSpecial & ~SCAFlags::State;
#endif
}
- if (SCA_CURRENT_STATE & m_nIncludeSpecial)
+ if (SCAFlags::CurrentState & m_nIncludeSpecial)
{
exportEnumPropertyAttribute(
- OAttributeMetaData::getSpecialAttributeNamespace(SCA_CURRENT_STATE),
- OAttributeMetaData::getSpecialAttributeName(SCA_CURRENT_STATE),
+ OAttributeMetaData::getSpecialAttributeNamespace(SCAFlags::CurrentState),
+ OAttributeMetaData::getSpecialAttributeName(SCAFlags::CurrentState),
PROPERTY_STATE,
OEnumMapper::getEnumMap(OEnumMapper::epCheckState),
TRISTATE_FALSE);
#if OSL_DEBUG_LEVEL > 0
// reset the bit for later checking
- m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_CURRENT_STATE;
+ m_nIncludeSpecial = m_nIncludeSpecial & ~SCAFlags::CurrentState;
#endif
}
}
@@ -1101,7 +1101,7 @@ namespace xmloff
// some properties which require a special handling
// the repeat delay
{
- if ( m_nIncludeSpecial & SCA_REPEAT_DELAY )
+ if ( m_nIncludeSpecial & SCAFlags::RepeatDelay )
{
DBG_CHECK_PROPERTY( PROPERTY_REPEAT_DELAY, sal_Int32 );
@@ -1117,22 +1117,22 @@ namespace xmloff
OUStringBuffer buf;
::sax::Converter::convertDuration(buf, aDuration);
- AddAttribute(OAttributeMetaData::getSpecialAttributeNamespace( SCA_REPEAT_DELAY )
- ,OAttributeMetaData::getSpecialAttributeName( SCA_REPEAT_DELAY )
+ AddAttribute(OAttributeMetaData::getSpecialAttributeNamespace( SCAFlags::RepeatDelay )
+ ,OAttributeMetaData::getSpecialAttributeName( SCAFlags::RepeatDelay )
,buf.makeStringAndClear());
exportedProperty( PROPERTY_REPEAT_DELAY );
#if OSL_DEBUG_LEVEL > 0
// reset the bit for later checking
- m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_REPEAT_DELAY;
+ m_nIncludeSpecial = m_nIncludeSpecial & ~SCAFlags::RepeatDelay;
#endif
}
}
// the EchoChar property needs special handling, cause it's a Int16, but must be stored as one-character-string
{
- if (SCA_ECHO_CHAR & m_nIncludeSpecial)
+ if (SCAFlags::EchoChar & m_nIncludeSpecial)
{
DBG_CHECK_PROPERTY( PROPERTY_ECHO_CHAR, sal_Int16 );
sal_Int16 nValue(0);
@@ -1141,23 +1141,23 @@ namespace xmloff
{
OUString sCharacter(reinterpret_cast<const sal_Unicode*>(&nValue), 1);
AddAttribute(
- OAttributeMetaData::getSpecialAttributeNamespace(SCA_ECHO_CHAR),
- OAttributeMetaData::getSpecialAttributeName(SCA_ECHO_CHAR),
+ OAttributeMetaData::getSpecialAttributeNamespace(SCAFlags::EchoChar),
+ OAttributeMetaData::getSpecialAttributeName(SCAFlags::EchoChar),
sCharacter);
}
exportedProperty(PROPERTY_ECHO_CHAR);
#if OSL_DEBUG_LEVEL > 0
// reset the bit for later checking
- m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_ECHO_CHAR;
+ m_nIncludeSpecial = m_nIncludeSpecial & ~SCAFlags::EchoChar;
#endif
}
}
// the string properties
{
- static const sal_Int32 nStringPropertyAttributeIds[] =
+ static const SCAFlags nStringPropertyAttributeIds[] =
{ // attribute flags
- SCA_GROUP_NAME
+ SCAFlags::GroupName
};
static const OUString pStringPropertyNames[] =
{ // property names
@@ -1185,7 +1185,7 @@ namespace xmloff
}
}
- if ((SCA_MIN_VALUE | SCA_MAX_VALUE) & m_nIncludeSpecial)
+ if ((SCAFlags::MinValue | SCAFlags::MaxValue) & m_nIncludeSpecial)
{
// need to export the min value and the max value as attributes
// It depends on the real type (FormComponentType) of the control, which properties hold these
@@ -1194,41 +1194,41 @@ namespace xmloff
const sal_Char* pMaxValuePropertyName = nullptr;
getValueLimitPropertyNames(m_nClassId, pMinValuePropertyName, pMaxValuePropertyName);
- OSL_ENSURE((nullptr == pMinValuePropertyName) == (0 == (SCA_MIN_VALUE & m_nIncludeSpecial)),
+ OSL_ENSURE((nullptr == pMinValuePropertyName) == (SCAFlags::NONE == (SCAFlags::MinValue & m_nIncludeSpecial)),
"OControlExport::exportCommonControlAttributes: no property found for the min value attribute!");
- OSL_ENSURE((nullptr == pMaxValuePropertyName) == (0 == (SCA_MAX_VALUE & m_nIncludeSpecial)),
+ OSL_ENSURE((nullptr == pMaxValuePropertyName) == (SCAFlags::NONE == (SCAFlags::MaxValue & m_nIncludeSpecial)),
"OControlExport::exportCommonControlAttributes: no property found for the max value attribute!");
// add the two attributes
- static const sal_Char* pMinValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCA_MIN_VALUE);
- static const sal_Char* pMaxValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCA_MAX_VALUE);
- static const sal_uInt16 nMinValueNamespaceKey = OAttributeMetaData::getSpecialAttributeNamespace(SCA_MIN_VALUE);
- static const sal_uInt16 nMaxValueNamespaceKey = OAttributeMetaData::getSpecialAttributeNamespace(SCA_MAX_VALUE);
+ static const sal_Char* pMinValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCAFlags::MinValue);
+ static const sal_Char* pMaxValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCAFlags::MaxValue);
+ static const sal_uInt16 nMinValueNamespaceKey = OAttributeMetaData::getSpecialAttributeNamespace(SCAFlags::MinValue);
+ static const sal_uInt16 nMaxValueNamespaceKey = OAttributeMetaData::getSpecialAttributeNamespace(SCAFlags::MaxValue);
- if (pMinValuePropertyName && (SCA_MIN_VALUE & m_nIncludeSpecial))
+ if (pMinValuePropertyName && (SCAFlags::MinValue & m_nIncludeSpecial))
exportGenericPropertyAttribute(
nMinValueNamespaceKey,
pMinValueAttributeName,
pMinValuePropertyName);
- if (pMaxValuePropertyName && (SCA_MAX_VALUE & m_nIncludeSpecial))
+ if (pMaxValuePropertyName && (SCAFlags::MaxValue & m_nIncludeSpecial))
exportGenericPropertyAttribute(
nMaxValueNamespaceKey,
pMaxValueAttributeName,
pMaxValuePropertyName);
#if OSL_DEBUG_LEVEL > 0
// reset the bit for later checking
- m_nIncludeSpecial = m_nIncludeSpecial & ~(SCA_MIN_VALUE | SCA_MAX_VALUE);
+ m_nIncludeSpecial = m_nIncludeSpecial & ~SCAFlags(SCAFlags::MinValue | SCAFlags::MaxValue);
#endif
}
- if ( SCA_IMAGE_POSITION & m_nIncludeSpecial )
+ if ( SCAFlags::ImagePosition & m_nIncludeSpecial )
{
exportImagePositionAttributes();
- RESET_BIT( m_nIncludeSpecial, SCA_IMAGE_POSITION );
+ RESET_BIT( m_nIncludeSpecial, SCAFlags::ImagePosition );
}
- OSL_ENSURE(0 == m_nIncludeSpecial,
+ OSL_ENSURE(SCAFlags::NONE == m_nIncludeSpecial,
"OControlExport::exportSpecialAttributes: forgot some flags!");
// in the dbg_util version, we should have removed every bit we handled from the mask, so it should
// be 0 now ...
@@ -1440,7 +1440,7 @@ namespace xmloff
void OControlExport::examine()
{
- OSL_ENSURE( ( m_nIncludeCommon == CCAFlags::NONE ) && ( m_nIncludeSpecial == 0 ) && ( m_nIncludeDatabase == DAFlags::NONE )
+ OSL_ENSURE( ( m_nIncludeCommon == CCAFlags::NONE ) && ( m_nIncludeSpecial == SCAFlags::NONE ) && ( m_nIncludeDatabase == DAFlags::NONE )
&& ( m_nIncludeEvents == EAFlags::NONE ) && ( m_nIncludeBindings == BAFlags::NONE),
"OControlExport::examine: called me twice? Not initialized?" );
@@ -1461,7 +1461,7 @@ namespace xmloff
m_eType = TIME;
knownType = true;
}
- m_nIncludeSpecial |= SCA_VALIDATION;
+ m_nIncludeSpecial |= SCAFlags::Validation;
SAL_FALLTHROUGH;
case FormComponentType::NUMERICFIELD:
case FormComponentType::CURRENCYFIELD:
@@ -1495,7 +1495,7 @@ namespace xmloff
if (nEchoChar)
{
m_eType = PASSWORD;
- m_nIncludeSpecial |= SCA_ECHO_CHAR;
+ m_nIncludeSpecial |= SCAFlags::EchoChar;
}
else
{
@@ -1550,11 +1550,11 @@ namespace xmloff
if (FORMATTED_TEXT == m_eType)
{ // in general all controls represented as formatted-text have these props
if ( FormComponentType::PATTERNFIELD != m_nClassId ) // except the PatternField
- m_nIncludeSpecial |= SCA_MAX_VALUE | SCA_MIN_VALUE;
+ m_nIncludeSpecial |= SCAFlags::MaxValue | SCAFlags::MinValue;
if (FormComponentType::TEXTFIELD != m_nClassId)
// and the FormattedField does not have a validation flag
- m_nIncludeSpecial |= SCA_VALIDATION;
+ m_nIncludeSpecial |= SCAFlags::Validation;
}
// if it's not a password field or rich text control, the CurrentValue needs to be stored, too
@@ -1582,7 +1582,7 @@ namespace xmloff
m_nIncludeCommon =
CCAFlags::Name | CCAFlags::ServiceName | CCAFlags::Disabled | CCAFlags::Label |
CCAFlags::Printable | CCAFlags::Title | CCAFlags::For;
- m_nIncludeSpecial = SCA_MULTI_LINE;
+ m_nIncludeSpecial = SCAFlags::MultiLine;
m_nIncludeEvents = EAFlags::ControlEvents;
break;
@@ -1592,7 +1592,7 @@ namespace xmloff
CCAFlags::Name | CCAFlags::ServiceName | CCAFlags::CurrentValue |
CCAFlags::Disabled | CCAFlags::Dropdown | CCAFlags::MaxLength | CCAFlags::Printable | CCAFlags::ReadOnly | CCAFlags::Size |
CCAFlags::TabIndex | CCAFlags::TabStop | CCAFlags::Title | CCAFlags::Value;
- m_nIncludeSpecial = SCA_AUTOMATIC_COMPLETION;
+ m_nIncludeSpecial = SCAFlags::AutoCompletion;
m_nIncludeDatabase = DAFlags::ConvertEmpty | DAFlags::DataField | DAFlags::InputRequired | DAFlags::ListSource | DAFlags::ListSource_TYPE;
m_nIncludeEvents = EAFlags::ControlEvents | EAFlags::OnChange | EAFlags::OnSelect;
break;
@@ -1602,7 +1602,7 @@ namespace xmloff
m_nIncludeCommon =
CCAFlags::Name | CCAFlags::ServiceName | CCAFlags::Disabled | CCAFlags::Dropdown |
CCAFlags::Printable | CCAFlags::Size | CCAFlags::TabIndex | CCAFlags::TabStop | CCAFlags::Title;
- m_nIncludeSpecial = SCA_MULTIPLE;
+ m_nIncludeSpecial = SCAFlags::Multiple;
m_nIncludeDatabase = DAFlags::BoundColumn | DAFlags::DataField | DAFlags::InputRequired | DAFlags::ListSource_TYPE;
m_nIncludeEvents = EAFlags::ControlEvents | EAFlags::OnChange | EAFlags::OnClick | EAFlags::OnDoubleClick;
// check if we need to export the ListSource as attribute
@@ -1624,7 +1624,7 @@ namespace xmloff
case FormComponentType::COMMANDBUTTON:
m_eType = BUTTON;
m_nIncludeCommon |= CCAFlags::TabStop | CCAFlags::Label;
- m_nIncludeSpecial = SCA_DEFAULT_BUTTON | SCA_TOGGLE | SCA_FOCUS_ON_CLICK | SCA_IMAGE_POSITION | SCA_REPEAT_DELAY;
+ m_nIncludeSpecial = SCAFlags::DefaultButton | SCAFlags::Toggle | SCAFlags::FocusOnClick | SCAFlags::ImagePosition | SCAFlags::RepeatDelay;
SAL_FALLTHROUGH;
case FormComponentType::IMAGEBUTTON:
if (BUTTON != m_eType)
@@ -1641,7 +1641,7 @@ namespace xmloff
case FormComponentType::CHECKBOX:
m_eType = CHECKBOX;
- m_nIncludeSpecial = SCA_CURRENT_STATE | SCA_IS_TRISTATE | SCA_STATE;
+ m_nIncludeSpecial = SCAFlags::CurrentState | SCAFlags::IsTristate | SCAFlags::State;
SAL_FALLTHROUGH;
case FormComponentType::RADIOBUTTON:
m_nIncludeCommon =
@@ -1653,9 +1653,9 @@ namespace xmloff
m_nIncludeCommon |= CCAFlags::CurrentSelected | CCAFlags::Selected;
}
if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_IMAGE_POSITION ) )
- m_nIncludeSpecial |= SCA_IMAGE_POSITION;
+ m_nIncludeSpecial |= SCAFlags::ImagePosition;
if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_GROUP_NAME ) )
- m_nIncludeSpecial |= SCA_GROUP_NAME;
+ m_nIncludeSpecial |= SCAFlags::GroupName;
m_nIncludeDatabase = DAFlags::DataField | DAFlags::InputRequired;
m_nIncludeEvents = EAFlags::ControlEvents | EAFlags::OnChange;
break;
@@ -1697,10 +1697,10 @@ namespace xmloff
m_nIncludeCommon =
CCAFlags::Name | CCAFlags::ServiceName | CCAFlags::Disabled | CCAFlags::Printable |
CCAFlags::Title | CCAFlags::CurrentValue | CCAFlags::Value | CCAFlags::Orientation;
- m_nIncludeSpecial = SCA_MAX_VALUE | SCA_STEP_SIZE | SCA_MIN_VALUE | SCA_REPEAT_DELAY;
+ m_nIncludeSpecial = SCAFlags::MaxValue | SCAFlags::StepSize | SCAFlags::MinValue | SCAFlags::RepeatDelay;
if ( m_nClassId == FormComponentType::SCROLLBAR )
- m_nIncludeSpecial |= SCA_PAGE_STEP_SIZE ;
+ m_nIncludeSpecial |= SCAFlags::PageStepSize ;
m_nIncludeEvents = EAFlags::ControlEvents;
break;
@@ -2015,8 +2015,8 @@ namespace xmloff
if ( !sStyleName.isEmpty() )
{
AddAttribute(
- OAttributeMetaData::getSpecialAttributeNamespace( SCA_COLUMN_STYLE_NAME ),
- OAttributeMetaData::getSpecialAttributeName( SCA_COLUMN_STYLE_NAME ),
+ OAttributeMetaData::getSpecialAttributeNamespace( SCAFlags::ColumnStyleName ),
+ OAttributeMetaData::getSpecialAttributeName( SCAFlags::ColumnStyleName ),
sStyleName
);
}
@@ -2028,7 +2028,7 @@ namespace xmloff
// grid columns miss some properties of the controls they're representing
m_nIncludeCommon &= ~CCAFlags(CCAFlags::For | CCAFlags::Printable | CCAFlags::TabIndex | CCAFlags::TabStop | CCAFlags::Label);
- m_nIncludeSpecial &= ~(SCA_ECHO_CHAR | SCA_AUTOMATIC_COMPLETION | SCA_MULTIPLE | SCA_MULTI_LINE);
+ m_nIncludeSpecial &= ~SCAFlags(SCAFlags::EchoChar | SCAFlags::AutoCompletion | SCAFlags::Multiple | SCAFlags::MultiLine);
if (FormComponentType::DATEFIELD != m_nClassId)
// except date fields, no column has the DropDown property
diff --git a/xmloff/source/forms/elementexport.hxx b/xmloff/source/forms/elementexport.hxx
index da7123d3f8c4..f3b2f0ac03a4 100644
--- a/xmloff/source/forms/elementexport.hxx
+++ b/xmloff/source/forms/elementexport.hxx
@@ -96,7 +96,7 @@ namespace xmloff
ElementType m_eType; // (XML) type of the control we're representing
CCAFlags m_nIncludeCommon; // common control attributes to include
DAFlags m_nIncludeDatabase; // common database attributes to include
- sal_Int32 m_nIncludeSpecial; // special attributes to include
+ SCAFlags m_nIncludeSpecial; // special attributes to include
EAFlags m_nIncludeEvents; // events to include
BAFlags m_nIncludeBindings; // binding attributes to include
diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index 32cd55a1c91d..b39b7314898e 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -754,9 +754,9 @@ namespace xmloff
static const sal_Char* pValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Value);
static const sal_Char* pCurrentValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCAFlags::CurrentValue);
- static const sal_Char* pMinValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCA_MIN_VALUE);
- static const sal_Char* pMaxValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCA_MAX_VALUE);
- static const sal_Char* pRepeatDelayAttributeName = OAttributeMetaData::getSpecialAttributeName( SCA_REPEAT_DELAY );
+ static const sal_Char* pMinValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCAFlags::MinValue);
+ static const sal_Char* pMaxValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCAFlags::MaxValue);
+ static const sal_Char* pRepeatDelayAttributeName = OAttributeMetaData::getSpecialAttributeName( SCAFlags::RepeatDelay );
sal_Int32 nHandle = -1;
if ( _rLocalName.equalsAscii( pValueAttributeName ) )
@@ -1211,7 +1211,7 @@ namespace xmloff
bool OPasswordImport::handleAttribute(sal_uInt16 _nNamespaceKey, const OUString& _rLocalName, const OUString& _rValue)
{
- static const char * s_sEchoCharAttributeName = OAttributeMetaData::getSpecialAttributeName(SCA_ECHO_CHAR);
+ static const char * s_sEchoCharAttributeName = OAttributeMetaData::getSpecialAttributeName(SCAFlags::EchoChar);
if (_rLocalName.equalsAscii(s_sEchoCharAttributeName))
{
// need a special handling for the EchoChar property
@@ -1333,7 +1333,7 @@ namespace xmloff
bool OValueRangeImport::handleAttribute( sal_uInt16 _nNamespaceKey, const OUString& _rLocalName, const OUString& _rValue )
{
- if ( _rLocalName.equalsAscii( OAttributeMetaData::getSpecialAttributeName( SCA_STEP_SIZE ) ) )
+ if ( _rLocalName.equalsAscii( OAttributeMetaData::getSpecialAttributeName( SCAFlags::StepSize ) ) )
{
::sax::Converter::convertNumber( m_nStepSizeValue, _rValue );
return true;
@@ -1577,7 +1577,7 @@ namespace xmloff
// for the auto-completion
// the attribute default does not equal the property default, so in case we did not read this attribute,
// we have to simulate it
- simulateDefaultedAttribute( OAttributeMetaData::getSpecialAttributeName( SCA_AUTOMATIC_COMPLETION ), PROPERTY_AUTOCOMPLETE, "false");
+ simulateDefaultedAttribute( OAttributeMetaData::getSpecialAttributeName( SCAFlags::AutoCompletion ), PROPERTY_AUTOCOMPLETE, "false");
// same for the convert-empty-to-null attribute, which's default is different from the property default
simulateDefaultedAttribute( OAttributeMetaData::getDatabaseAttributeName( DAFlags::ConvertEmpty ), PROPERTY_EMPTY_IS_NULL, "false");
diff --git a/xmloff/source/forms/formattributes.cxx b/xmloff/source/forms/formattributes.cxx
index 4788a3b1e3aa..aeed736998c2 100644
--- a/xmloff/source/forms/formattributes.cxx
+++ b/xmloff/source/forms/formattributes.cxx
@@ -153,39 +153,40 @@ namespace xmloff
return "";
}
- const sal_Char* OAttributeMetaData::getSpecialAttributeName(sal_Int32 _nId)
+ const sal_Char* OAttributeMetaData::getSpecialAttributeName(SCAFlags _nId)
{
switch (_nId)
{
- case SCA_ECHO_CHAR: return "echo-char";
- case SCA_MAX_VALUE: return "max-value";
- case SCA_MIN_VALUE: return "min-value";
- case SCA_VALIDATION: return "validation";
- case SCA_GROUP_NAME: return "group-name";
- case SCA_MULTI_LINE: return "multi-line";
- case SCA_AUTOMATIC_COMPLETION: return "auto-complete";
- case SCA_MULTIPLE: return "multiple";
- case SCA_DEFAULT_BUTTON: return "default-button";
- case SCA_CURRENT_STATE: return "current-state";
- case SCA_IS_TRISTATE: return "is-tristate";
- case SCA_STATE: return "state";
- case SCA_COLUMN_STYLE_NAME: return "text-style-name";
- case SCA_STEP_SIZE: return "step-size";
- case SCA_PAGE_STEP_SIZE: return "page-step-size";
- case SCA_REPEAT_DELAY: return "delay-for-repeat";
- case SCA_TOGGLE: return "toggle";
- case SCA_FOCUS_ON_CLICK: return "focus-on-click";
+ case SCAFlags::EchoChar: return "echo-char";
+ case SCAFlags::MaxValue: return "max-value";
+ case SCAFlags::MinValue: return "min-value";
+ case SCAFlags::Validation: return "validation";
+ case SCAFlags::GroupName: return "group-name";
+ case SCAFlags::MultiLine: return "multi-line";
+ case SCAFlags::AutoCompletion: return "auto-complete";
+ case SCAFlags::Multiple: return "multiple";
+ case SCAFlags::DefaultButton: return "default-button";
+ case SCAFlags::CurrentState: return "current-state";
+ case SCAFlags::IsTristate: return "is-tristate";
+ case SCAFlags::State: return "state";
+ case SCAFlags::ColumnStyleName: return "text-style-name";
+ case SCAFlags::StepSize: return "step-size";
+ case SCAFlags::PageStepSize: return "page-step-size";
+ case SCAFlags::RepeatDelay: return "delay-for-repeat";
+ case SCAFlags::Toggle: return "toggle";
+ case SCAFlags::FocusOnClick: return "focus-on-click";
default:
OSL_FAIL("OAttributeMetaData::getSpecialAttributeName: invalid id (maybe you or-ed two flags?)!");
}
return "";
}
- sal_uInt16 OAttributeMetaData::getSpecialAttributeNamespace(sal_Int32 _nId)
+ sal_uInt16 OAttributeMetaData::getSpecialAttributeNamespace(SCAFlags _nId)
{
switch( _nId )
{
- case SCA_GROUP_NAME: return XML_NAMESPACE_FORMX;
+ case SCAFlags::GroupName: return XML_NAMESPACE_FORMX;
+ default: break;
}
return XML_NAMESPACE_FORM;
}
diff --git a/xmloff/source/forms/formattributes.hxx b/xmloff/source/forms/formattributes.hxx
index 68048ba8bb2b..d0a2405ce605 100644
--- a/xmloff/source/forms/formattributes.hxx
+++ b/xmloff/source/forms/formattributes.hxx
@@ -106,6 +106,34 @@ namespace o3tl {
template<> struct typed_flags<EAFlags> : is_typed_flags<EAFlags, 0x001f> {};
}
+ // any other attributes, which are special to some control types
+enum class SCAFlags {
+ NONE = 0x000000,
+ EchoChar = 0x000001,
+ MaxValue = 0x000002,
+ MinValue = 0x000004,
+ Validation = 0x000008,
+ GroupName = 0x000010,
+ MultiLine = 0x000020,
+ AutoCompletion = 0x000080,
+ Multiple = 0x000100,
+ DefaultButton = 0x000200,
+ CurrentState = 0x000400,
+ IsTristate = 0x000800,
+ State = 0x001000,
+ ColumnStyleName = 0x002000,
+ StepSize = 0x004000,
+ PageStepSize = 0x008000,
+ RepeatDelay = 0x010000,
+ Toggle = 0x020000,
+ FocusOnClick = 0x040000,
+ ImagePosition = 0x080000
+};
+namespace o3tl {
+ template<> struct typed_flags<SCAFlags> : is_typed_flags<SCAFlags, 0x0fffff> {};
+}
+
+
namespace xmloff
{
@@ -136,27 +164,6 @@ namespace xmloff
faTabbingCycle
};
- // any other attributes, which are special to some control types
- #define SCA_ECHO_CHAR 0x00000001
- #define SCA_MAX_VALUE 0x00000002
- #define SCA_MIN_VALUE 0x00000004
- #define SCA_VALIDATION 0x00000008
- #define SCA_GROUP_NAME 0x00000010
- #define SCA_MULTI_LINE 0x00000020
- #define SCA_AUTOMATIC_COMPLETION 0x00000080
- #define SCA_MULTIPLE 0x00000100
- #define SCA_DEFAULT_BUTTON 0x00000200
- #define SCA_CURRENT_STATE 0x00000400
- #define SCA_IS_TRISTATE 0x00000800
- #define SCA_STATE 0x00001000
- #define SCA_COLUMN_STYLE_NAME 0x00002000
- #define SCA_STEP_SIZE 0x00004000
- #define SCA_PAGE_STEP_SIZE 0x00008000
- #define SCA_REPEAT_DELAY 0x00010000
- #define SCA_TOGGLE 0x00020000
- #define SCA_FOCUS_ON_CLICK 0x00040000
- #define SCA_IMAGE_POSITION 0x00080000
-
// attributes of the office:forms element
enum OfficeFormsAttributes
{
@@ -217,7 +224,7 @@ namespace xmloff
@param _nId
the id of the attribute. Has to be one of the SCA_* constants.
*/
- static const sal_Char* getSpecialAttributeName(sal_Int32 _nId);
+ static const sal_Char* getSpecialAttributeName(SCAFlags _nId);
/** calculates the xml attribute representation of a binding attribute.
@param _nId
@@ -239,7 +246,7 @@ namespace xmloff
@param _nId
the id of the attribute. Has to be one of the SCA_* constants.
*/
- static sal_uInt16 getSpecialAttributeNamespace(sal_Int32 _nId);
+ static sal_uInt16 getSpecialAttributeNamespace(SCAFlags _nId);
/** calculates the xml attribute representation of a attribute of the office:forms element
@param _nId
diff --git a/xmloff/source/forms/layerimport.cxx b/xmloff/source/forms/layerimport.cxx
index afbd759e4e8f..c25565ea43d6 100644
--- a/xmloff/source/forms/layerimport.cxx
+++ b/xmloff/source/forms/layerimport.cxx
@@ -78,7 +78,7 @@ OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl(SvXMLImport& _rImporter)
m_aAttributeMetaData.addStringProperty(
OAttributeMetaData::getCommonControlAttributeName(CCAFlags::Name), PROPERTY_NAME);
m_aAttributeMetaData.addStringProperty(
- OAttributeMetaData::getSpecialAttributeName(SCA_GROUP_NAME), PROPERTY_GROUP_NAME);
+ OAttributeMetaData::getSpecialAttributeName(SCAFlags::GroupName), PROPERTY_GROUP_NAME);
m_aAttributeMetaData.addStringProperty(
OAttributeMetaData::getCommonControlAttributeName(CCAFlags::ImageData), PROPERTY_IMAGEURL);
m_aAttributeMetaData.addStringProperty(
@@ -133,17 +133,17 @@ OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl(SvXMLImport& _rImporter)
m_aAttributeMetaData.addBooleanProperty(
OAttributeMetaData::getDatabaseAttributeName(DAFlags::ConvertEmpty), PROPERTY_EMPTY_IS_NULL, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getSpecialAttributeName(SCA_VALIDATION), PROPERTY_STRICTFORMAT, false);
+ OAttributeMetaData::getSpecialAttributeName(SCAFlags::Validation), PROPERTY_STRICTFORMAT, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getSpecialAttributeName(SCA_MULTI_LINE), PROPERTY_MULTILINE, false);
+ OAttributeMetaData::getSpecialAttributeName(SCAFlags::MultiLine), PROPERTY_MULTILINE, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getSpecialAttributeName(SCA_AUTOMATIC_COMPLETION), PROPERTY_AUTOCOMPLETE, false);
+ OAttributeMetaData::getSpecialAttributeName(SCAFlags::AutoCompletion), PROPERTY_AUTOCOMPLETE, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getSpecialAttributeName(SCA_MULTIPLE), PROPERTY_MULTISELECTION, false);
+ OAttributeMetaData::getSpecialAttributeName(SCAFlags::Multiple), PROPERTY_MULTISELECTION, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getSpecialAttributeName(SCA_DEFAULT_BUTTON), PROPERTY_DEFAULTBUTTON, false);
+ OAttributeMetaData::getSpecialAttributeName(SCAFlags::DefaultButton), PROPERTY_DEFAULTBUTTON, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getSpecialAttributeName(SCA_IS_TRISTATE), PROPERTY_TRISTATE, false);
+ OAttributeMetaData::getSpecialAttributeName(SCAFlags::IsTristate), PROPERTY_TRISTATE, false);
m_aAttributeMetaData.addBooleanProperty(
OAttributeMetaData::getFormAttributeName(faAllowDeletes), PROPERTY_ALLOWDELETES, true);
m_aAttributeMetaData.addBooleanProperty(
@@ -157,9 +157,9 @@ OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl(SvXMLImport& _rImporter)
m_aAttributeMetaData.addBooleanProperty(
OAttributeMetaData::getFormAttributeName(faIgnoreResult), PROPERTY_IGNORERESULT, false);
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getSpecialAttributeName( SCA_TOGGLE ), PROPERTY_TOGGLE, false );
+ OAttributeMetaData::getSpecialAttributeName( SCAFlags::Toggle ), PROPERTY_TOGGLE, false );
m_aAttributeMetaData.addBooleanProperty(
- OAttributeMetaData::getSpecialAttributeName( SCA_FOCUS_ON_CLICK ), PROPERTY_FOCUS_ON_CLICK, true );
+ OAttributeMetaData::getSpecialAttributeName( SCAFlags::FocusOnClick ), PROPERTY_FOCUS_ON_CLICK, true );
m_aAttributeMetaData.addBooleanProperty(
OAttributeMetaData::getDatabaseAttributeName( DAFlags::InputRequired ), PROPERTY_INPUT_REQUIRED, false );
@@ -175,7 +175,7 @@ OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl(SvXMLImport& _rImporter)
// the int32 attributes
m_aAttributeMetaData.addInt32Property(
- OAttributeMetaData::getSpecialAttributeName( SCA_PAGE_STEP_SIZE ), PROPERTY_BLOCK_INCREMENT, 10 );
+ OAttributeMetaData::getSpecialAttributeName( SCAFlags::PageStepSize ), PROPERTY_BLOCK_INCREMENT, 10 );
// the enum attributes
m_aAttributeMetaData.addEnumProperty(
@@ -195,11 +195,11 @@ OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl(SvXMLImport& _rImporter)
ListSourceType_VALUELIST, OEnumMapper::getEnumMap(OEnumMapper::epListSourceType),
&::cppu::UnoType<ListSourceType>::get());
m_aAttributeMetaData.addEnumProperty(
- OAttributeMetaData::getSpecialAttributeName(SCA_STATE), PROPERTY_DEFAULT_STATE, TRISTATE_FALSE,
+ OAttributeMetaData::getSpecialAttributeName(SCAFlags::State), PROPERTY_DEFAULT_STATE, TRISTATE_FALSE,
OEnumMapper::getEnumMap(OEnumMapper::epCheckState),
&::cppu::UnoType<sal_Int16>::get());
m_aAttributeMetaData.addEnumProperty(
- OAttributeMetaData::getSpecialAttributeName(SCA_CURRENT_STATE), PROPERTY_STATE, TRISTATE_FALSE,
+ OAttributeMetaData::getSpecialAttributeName(SCAFlags::CurrentState), PROPERTY_STATE, TRISTATE_FALSE,
OEnumMapper::getEnumMap(OEnumMapper::epCheckState),
&::cppu::UnoType<sal_Int16>::get());
m_aAttributeMetaData.addEnumProperty(