Convert BOOL_ATTR to scoped enum
Change-Id: I7991c6d05503dcbc1e5fd45d07227b766c409f65
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user