diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-12 13:53:29 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-05-12 13:54:00 +0200 |
commit | e82fe5f00afe0364fbcbfea3e91e10b85faae34c (patch) | |
tree | 4b1beaea02d57118dd84c58331173815eec7c80d /xmloff | |
parent | 8bcacdc832058a7728ab5e8260a2266033033a07 (diff) |
Convert BOOL_ATTR to scoped enum
Change-Id: I7991c6d05503dcbc1e5fd45d07227b766c409f65
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/forms/elementexport.cxx | 14 | ||||
-rw-r--r-- | xmloff/source/forms/propertyexport.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/forms/propertyexport.hxx | 19 |
3 files changed, 23 insertions, 18 deletions
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx index f7bc4ee74ebf..b799182bd3c8 100644 --- a/xmloff/source/forms/elementexport.cxx +++ b/xmloff/source/forms/elementexport.cxx @@ -579,9 +579,9 @@ namespace xmloff PROPERTY_READONLY, PROPERTY_DEFAULT_STATE, PROPERTY_TABSTOP, PROPERTY_ENABLEVISIBLE }; - static const sal_Int8 nBooleanPropertyAttrFlags[] = + static const BoolAttrFlags nBooleanPropertyAttrFlags[] = { // attribute defaults - BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE | BOOLATTR_INVERSE_SEMANTICS, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_VOID, BOOLATTR_DEFAULT_FALSE + BoolAttrFlags::DefaultFalse, BoolAttrFlags::DefaultFalse | BoolAttrFlags::InverseSemantics, BoolAttrFlags::DefaultFalse, BoolAttrFlags::DefaultTrue, BoolAttrFlags::DefaultFalse, BoolAttrFlags::DefaultFalse, BoolAttrFlags::DefaultVoid, BoolAttrFlags::DefaultFalse }; #if OSL_DEBUG_LEVEL > 0 static const sal_Int32 nIdCount = SAL_N_ELEMENTS(nBooleanPropertyAttributeIds); @@ -843,7 +843,7 @@ namespace xmloff OAttributeMetaData::getDatabaseAttributeNamespace( DA_INPUT_REQUIRED ), OAttributeMetaData::getDatabaseAttributeName( DA_INPUT_REQUIRED ), PROPERTY_INPUT_REQUIRED, - BOOLATTR_DEFAULT_TRUE + BoolAttrFlags::DefaultTrue ); RESET_BIT( nIncludeDatabase, DA_INPUT_REQUIRED ); } @@ -867,7 +867,7 @@ namespace xmloff OAttributeMetaData::getDatabaseAttributeNamespace(DA_CONVERT_EMPTY), OAttributeMetaData::getDatabaseAttributeName(DA_CONVERT_EMPTY), PROPERTY_EMPTY_IS_NULL, - BOOLATTR_DEFAULT_FALSE + BoolAttrFlags::DefaultFalse ); RESET_BIT( nIncludeDatabase, DA_CONVERT_EMPTY ); } @@ -992,7 +992,7 @@ namespace xmloff OAttributeMetaData::getSpecialAttributeNamespace( *pAttributeId ), OAttributeMetaData::getSpecialAttributeName( *pAttributeId ), OUString::createFromAscii(pBooleanPropertyNames[i]), - ( *pAttributeId == SCA_FOCUS_ON_CLICK ) ? BOOLATTR_DEFAULT_TRUE : BOOLATTR_DEFAULT_FALSE + ( *pAttributeId == SCA_FOCUS_ON_CLICK ) ? BoolAttrFlags::DefaultTrue : BoolAttrFlags::DefaultFalse ); #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking @@ -2142,9 +2142,9 @@ namespace xmloff PROPERTY_ESCAPEPROCESSING, PROPERTY_IGNORERESULT }; - static const sal_Int8 nBooleanPropertyAttrFlags[] = + static const BoolAttrFlags nBooleanPropertyAttrFlags[] = { - BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE + BoolAttrFlags::DefaultTrue, BoolAttrFlags::DefaultTrue, BoolAttrFlags::DefaultTrue, BoolAttrFlags::DefaultFalse, BoolAttrFlags::DefaultTrue, BoolAttrFlags::DefaultFalse }; static const sal_Int32 nIdCount = SAL_N_ELEMENTS(eBooleanPropertyIds); #if OSL_DEBUG_LEVEL > 0 diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx index f230863a88ea..e1b450b506a9 100644 --- a/xmloff/source/forms/propertyexport.cxx +++ b/xmloff/source/forms/propertyexport.cxx @@ -268,14 +268,14 @@ namespace xmloff } void OPropertyExport::exportBooleanPropertyAttribute(const sal_uInt16 _nNamespaceKey, const sal_Char* _pAttributeName, - const OUString& _rPropertyName, const sal_Int8 _nBooleanAttributeFlags) + const OUString& _rPropertyName, const BoolAttrFlags _nBooleanAttributeFlags) { DBG_CHECK_PROPERTY_NO_TYPE( _rPropertyName ); // no check of the property value type: this method is allowed to be called with any integer properties // (e.g. sal_Int32, sal_uInt16 etc) - bool bDefault = (BOOLATTR_DEFAULT_TRUE == (BOOLATTR_DEFAULT_MASK & _nBooleanAttributeFlags)); - bool bDefaultVoid = (BOOLATTR_DEFAULT_VOID == (BOOLATTR_DEFAULT_MASK & _nBooleanAttributeFlags)); + bool bDefault = (BoolAttrFlags::DefaultTrue == (BoolAttrFlags::DefaultMask & _nBooleanAttributeFlags)); + bool bDefaultVoid = (BoolAttrFlags::DefaultVoid == (BoolAttrFlags::DefaultMask & _nBooleanAttributeFlags)); // get the value bool bCurrentValue = bDefault; @@ -285,7 +285,7 @@ namespace xmloff bCurrentValue = ::cppu::any2bool(aCurrentValue); // this will extract a boolean value even if the Any contains a int or short or something like that ... - if (_nBooleanAttributeFlags & BOOLATTR_INVERSE_SEMANTICS) + if (_nBooleanAttributeFlags & BoolAttrFlags::InverseSemantics) bCurrentValue = !bCurrentValue; // we have a non-void current value diff --git a/xmloff/source/forms/propertyexport.hxx b/xmloff/source/forms/propertyexport.hxx index 7db076e5e299..982c638f8d9b 100644 --- a/xmloff/source/forms/propertyexport.hxx +++ b/xmloff/source/forms/propertyexport.hxx @@ -31,15 +31,20 @@ #include "callbacks.hxx" #include "strings.hxx" +enum class BoolAttrFlags { + DefaultFalse = 0x00, + DefaultTrue = 0x01, + DefaultVoid = 0x02, + DefaultMask = 0x03, + InverseSemantics = 0x04, +}; +namespace o3tl { + template<> struct typed_flags<BoolAttrFlags> : is_typed_flags<BoolAttrFlags, 0x0a> {}; +} + namespace xmloff { -#define BOOLATTR_DEFAULT_FALSE 0x00 -#define BOOLATTR_DEFAULT_TRUE 0x01 -#define BOOLATTR_DEFAULT_VOID 0x02 -#define BOOLATTR_DEFAULT_MASK 0x03 - -#define BOOLATTR_INVERSE_SEMANTICS 0x04 // if sal_True, indicates that the semantic of the property referred by <arg>_pPropertyName</arg> // is inverse to the semantic of the XML attribute.<br/> // I.e. if the property value is <TRUE/>, <FALSE/> has to be written and vice versa. @@ -146,7 +151,7 @@ namespace xmloff const sal_uInt16 _nNamespaceKey, const sal_Char* _pAttributeName, const OUString& _rPropertyName, - const sal_Int8 _nBooleanAttributeFlags); + const BoolAttrFlags _nBooleanAttributeFlags); /** add an attribute which is represented by a sal_Int16 property to the export context |