expose the SvXMLEnumMapEntry arrays in OEnumMapper

preparatory change to making SvXMLEnumMapEntry a template class for the
"UNO scoped enum" change.

But I think its an improvement by itself, there is no need to initialise
these arrays on-demand, the compiler will do that at link time.

Change-Id: I842c16b3ef44b9f5e1f0325b637d3f55f8bb5ebc
Reviewed-on: https://gerrit.libreoffice.org/34721
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2017-02-28 15:07:59 +02:00
parent 38f13e4dca
commit dd4ed25aae
6 changed files with 107 additions and 255 deletions

View File

@@ -60,7 +60,7 @@ namespace xmloff
{ {
case XML_TYPE_TEXT_ALIGN: case XML_TYPE_TEXT_ALIGN:
if (!m_pTextAlignHandler) if (!m_pTextAlignHandler)
m_pTextAlignHandler = o3tl::make_unique<XMLConstantsPropertyHandler>(OEnumMapper::getEnumMap(OEnumMapper::epTextAlign), XML_TOKEN_INVALID ); m_pTextAlignHandler = o3tl::make_unique<XMLConstantsPropertyHandler>(aTextAlignMap, XML_TOKEN_INVALID );
pHandler = m_pTextAlignHandler.get(); pHandler = m_pTextAlignHandler.get();
break; break;
@@ -90,13 +90,13 @@ namespace xmloff
case XML_TYPE_CONTROL_TEXT_EMPHASIZE: case XML_TYPE_CONTROL_TEXT_EMPHASIZE:
if (!m_pFontEmphasisHandler) if (!m_pFontEmphasisHandler)
m_pFontEmphasisHandler = o3tl::make_unique<XMLConstantsPropertyHandler>( OEnumMapper::getEnumMap(OEnumMapper::epFontEmphasis), XML_NONE ); m_pFontEmphasisHandler = o3tl::make_unique<XMLConstantsPropertyHandler>( aFontEmphasisMap, XML_NONE );
pHandler = m_pFontEmphasisHandler.get(); pHandler = m_pFontEmphasisHandler.get();
break; break;
case XML_TYPE_TEXT_FONT_RELIEF: case XML_TYPE_TEXT_FONT_RELIEF:
if (!m_pFontReliefHandler) if (!m_pFontReliefHandler)
m_pFontReliefHandler = o3tl::make_unique<XMLConstantsPropertyHandler>( OEnumMapper::getEnumMap(OEnumMapper::epFontRelief), XML_NONE ); m_pFontReliefHandler = o3tl::make_unique<XMLConstantsPropertyHandler>( aFontReliefMap, XML_NONE );
pHandler = m_pFontReliefHandler.get(); pHandler = m_pFontReliefHandler.get();
break; break;
case XML_TYPE_TEXT_LINE_MODE: case XML_TYPE_TEXT_LINE_MODE:
@@ -129,7 +129,7 @@ namespace xmloff
bool bBelow = 0 != (nFontEmphasis & awt::FontEmphasisMark::BELOW); bool bBelow = 0 != (nFontEmphasis & awt::FontEmphasisMark::BELOW);
// convert // convert
bSuccess = SvXMLUnitConverter::convertEnum(aReturn, nType, OEnumMapper::getEnumMap(OEnumMapper::epFontEmphasis), XML_NONE); bSuccess = SvXMLUnitConverter::convertEnum(aReturn, nType, aFontEmphasisMap, XML_NONE);
if (bSuccess) if (bSuccess)
{ {
aReturn.append( ' ' ); aReturn.append( ' ' );
@@ -169,7 +169,7 @@ namespace xmloff
} }
if (!bHasType) if (!bHasType)
{ {
if (SvXMLUnitConverter::convertEnum(nEmphasis, sToken, OEnumMapper::getEnumMap(OEnumMapper::epFontEmphasis))) if (SvXMLUnitConverter::convertEnum(nEmphasis, sToken, aFontEmphasisMap))
{ {
bHasType = true; bHasType = true;
} }
@@ -211,7 +211,7 @@ namespace xmloff
if ( m_eFacet == STYLE ) if ( m_eFacet == STYLE )
{ {
// is it a valid enum value? // is it a valid enum value?
if ( SvXMLUnitConverter::convertEnum( nStyle, sToken, OEnumMapper::getEnumMap( OEnumMapper::epBorderWidth ) ) ) if ( SvXMLUnitConverter::convertEnum( nStyle, sToken, aBorderTypeMap ) )
{ {
_rValue <<= nStyle; _rValue <<= nStyle;
return true; return true;
@@ -244,7 +244,7 @@ namespace xmloff
{ {
sal_Int16 nBorder = 0; sal_Int16 nBorder = 0;
bSuccess = (_rValue >>= nBorder) bSuccess = (_rValue >>= nBorder)
&& SvXMLUnitConverter::convertEnum( aOut, nBorder, OEnumMapper::getEnumMap( OEnumMapper::epBorderWidth ) ); && SvXMLUnitConverter::convertEnum( aOut, nBorder, aBorderTypeMap );
} }
break; break;
case COLOR: case COLOR:
@@ -335,7 +335,7 @@ namespace xmloff
//= ImageScaleModeHandler //= ImageScaleModeHandler
ImageScaleModeHandler::ImageScaleModeHandler() ImageScaleModeHandler::ImageScaleModeHandler()
:XMLConstantsPropertyHandler( OEnumMapper::getEnumMap( OEnumMapper::epImageScaleMode ), XML_STRETCH ) :XMLConstantsPropertyHandler( aScaleModeMap, XML_STRETCH )
{ {
} }

View File

@@ -649,7 +649,7 @@ namespace xmloff
OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::ButtonType), OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::ButtonType),
OAttributeMetaData::getCommonControlAttributeName(CCAFlags::ButtonType), OAttributeMetaData::getCommonControlAttributeName(CCAFlags::ButtonType),
PROPERTY_BUTTONTYPE, PROPERTY_BUTTONTYPE,
OEnumMapper::getEnumMap(OEnumMapper::epButtonType), aFormButtonTypeMap,
FormButtonType_PUSH); FormButtonType_PUSH);
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
// reset the bit for later checking // reset the bit for later checking
@@ -662,7 +662,7 @@ namespace xmloff
OAttributeMetaData::getCommonControlAttributeNamespace( CCAFlags::Orientation ), OAttributeMetaData::getCommonControlAttributeNamespace( CCAFlags::Orientation ),
OAttributeMetaData::getCommonControlAttributeName( CCAFlags::Orientation ), OAttributeMetaData::getCommonControlAttributeName( CCAFlags::Orientation ),
PROPERTY_ORIENTATION, PROPERTY_ORIENTATION,
OEnumMapper::getEnumMap( OEnumMapper::epOrientation ), aOrientationMap,
ScrollBarOrientation::HORIZONTAL ScrollBarOrientation::HORIZONTAL
); );
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
@@ -677,7 +677,7 @@ namespace xmloff
OAttributeMetaData::getCommonControlAttributeNamespace( CCAFlags::VisualEffect ), OAttributeMetaData::getCommonControlAttributeNamespace( CCAFlags::VisualEffect ),
OAttributeMetaData::getCommonControlAttributeName( CCAFlags::VisualEffect ), OAttributeMetaData::getCommonControlAttributeName( CCAFlags::VisualEffect ),
PROPERTY_VISUAL_EFFECT, PROPERTY_VISUAL_EFFECT,
OEnumMapper::getEnumMap( OEnumMapper::epVisualEffect ), aVisualEffectMap,
VisualEffect::LOOK3D VisualEffect::LOOK3D
); );
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
@@ -876,7 +876,7 @@ namespace xmloff
OAttributeMetaData::getDatabaseAttributeNamespace(DAFlags::ListSource_TYPE), OAttributeMetaData::getDatabaseAttributeNamespace(DAFlags::ListSource_TYPE),
OAttributeMetaData::getDatabaseAttributeName(DAFlags::ListSource_TYPE), OAttributeMetaData::getDatabaseAttributeName(DAFlags::ListSource_TYPE),
PROPERTY_LISTSOURCETYPE, PROPERTY_LISTSOURCETYPE,
OEnumMapper::getEnumMap(OEnumMapper::epListSourceType), aListSourceTypeMap,
ListSourceType_VALUELIST ListSourceType_VALUELIST
); );
RESET_BIT( nIncludeDatabase, DAFlags::ListSource_TYPE ); RESET_BIT( nIncludeDatabase, DAFlags::ListSource_TYPE );
@@ -1072,7 +1072,7 @@ namespace xmloff
OAttributeMetaData::getSpecialAttributeNamespace(SCAFlags::State), OAttributeMetaData::getSpecialAttributeNamespace(SCAFlags::State),
OAttributeMetaData::getSpecialAttributeName(SCAFlags::State), OAttributeMetaData::getSpecialAttributeName(SCAFlags::State),
PROPERTY_DEFAULT_STATE, PROPERTY_DEFAULT_STATE,
OEnumMapper::getEnumMap(OEnumMapper::epCheckState), aCheckStateMap,
TRISTATE_FALSE); TRISTATE_FALSE);
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
// reset the bit for later checking // reset the bit for later checking
@@ -1086,7 +1086,7 @@ namespace xmloff
OAttributeMetaData::getSpecialAttributeNamespace(SCAFlags::CurrentState), OAttributeMetaData::getSpecialAttributeNamespace(SCAFlags::CurrentState),
OAttributeMetaData::getSpecialAttributeName(SCAFlags::CurrentState), OAttributeMetaData::getSpecialAttributeName(SCAFlags::CurrentState),
PROPERTY_STATE, PROPERTY_STATE,
OEnumMapper::getEnumMap(OEnumMapper::epCheckState), aCheckStateMap,
TRISTATE_FALSE); TRISTATE_FALSE);
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
// reset the bit for later checking // reset the bit for later checking
@@ -1785,7 +1785,7 @@ namespace xmloff
SvXMLUnitConverter::convertEnum( SvXMLUnitConverter::convertEnum(
sBuffer, sBuffer,
(sal_uInt16)nLinkageType, (sal_uInt16)nLinkageType,
OEnumMapper::getEnumMap( OEnumMapper::epListLinkageType ) aListLinkageMap
); );
AddAttribute( AddAttribute(
@@ -2158,44 +2158,46 @@ namespace xmloff
// the enum properties // the enum properties
{ {
static const FormAttributes eEnumPropertyIds[] = exportEnumPropertyAttribute(
{ OAttributeMetaData::getFormAttributeNamespace(faEnctype),
faEnctype, faMethod, faCommandType, faNavigationMode, faTabbingCycle OAttributeMetaData::getFormAttributeName(faEnctype),
}; PROPERTY_SUBMIT_ENCODING,
static const char * pEnumPropertyNames[] = aSubmitEncodingMap,
{ FormSubmitEncoding_URL,
PROPERTY_SUBMIT_ENCODING, PROPERTY_SUBMIT_METHOD, PROPERTY_COMMAND_TYPE, PROPERTY_NAVIGATION, PROPERTY_CYCLE false
}; );
static const OEnumMapper::EnumProperties eEnumPropertyMaps[] = exportEnumPropertyAttribute(
{ OAttributeMetaData::getFormAttributeNamespace(faMethod),
OEnumMapper::epSubmitEncoding, OEnumMapper::epSubmitMethod, OEnumMapper::epCommandType, OEnumMapper::epNavigationType, OEnumMapper::epTabCyle OAttributeMetaData::getFormAttributeName(faMethod),
}; PROPERTY_SUBMIT_METHOD,
static const sal_Int32 nEnumPropertyAttrDefaults[] = aSubmitMethodMap,
{ FormSubmitMethod_GET,
FormSubmitEncoding_URL, FormSubmitMethod_GET, CommandType::COMMAND, NavigationBarMode_CURRENT, TabulatorCycle_RECORDS false
}; );
static const bool nEnumPropertyAttrDefaultFlags[] = exportEnumPropertyAttribute(
{ OAttributeMetaData::getFormAttributeNamespace(faCommandType),
false, false, false, false, true OAttributeMetaData::getFormAttributeName(faCommandType),
}; PROPERTY_COMMAND_TYPE,
static const sal_Int32 nIdCount = SAL_N_ELEMENTS(eEnumPropertyIds); aCommandTypeMap,
#if OSL_DEBUG_LEVEL > 0 CommandType::COMMAND,
static const sal_Int32 nNameCount = SAL_N_ELEMENTS(pEnumPropertyNames); false
static const sal_Int32 nDefaultCount = SAL_N_ELEMENTS(nEnumPropertyAttrDefaults); );
static const sal_Int32 nDefaultFlagCount = SAL_N_ELEMENTS(nEnumPropertyAttrDefaultFlags); exportEnumPropertyAttribute(
static const sal_Int32 nMapCount = SAL_N_ELEMENTS(eEnumPropertyMaps); OAttributeMetaData::getFormAttributeNamespace(faNavigationMode),
OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount) && (nDefaultCount == nDefaultFlagCount) && (nDefaultFlagCount == nMapCount), OAttributeMetaData::getFormAttributeName(faNavigationMode),
"OFormExport::exportAttributes: somebody tampered with the maps (3)!"); PROPERTY_NAVIGATION,
#endif aNavigationTypeMap,
for (i=0; i<nIdCount; ++i) NavigationBarMode_CURRENT,
exportEnumPropertyAttribute( false
OAttributeMetaData::getFormAttributeNamespace(eEnumPropertyIds[i]), );
OAttributeMetaData::getFormAttributeName(eEnumPropertyIds[i]), exportEnumPropertyAttribute(
OUString::createFromAscii(pEnumPropertyNames[i]), OAttributeMetaData::getFormAttributeNamespace(faTabbingCycle),
OEnumMapper::getEnumMap(eEnumPropertyMaps[i]), OAttributeMetaData::getFormAttributeName(faTabbingCycle),
nEnumPropertyAttrDefaults[i], PROPERTY_CYCLE,
nEnumPropertyAttrDefaultFlags[i] aTabulatorCycleMap,
); TabulatorCycle_RECORDS,
true
);
} }
// the service name // the service name

View File

@@ -1133,7 +1133,7 @@ namespace xmloff
{ {
OSL_VERIFY( PropertyConversion::convertString( OSL_VERIFY( PropertyConversion::convertString(
cppu::UnoType<decltype(m_nImagePosition)>::get(), cppu::UnoType<decltype(m_nImagePosition)>::get(),
_rValue, OEnumMapper::getEnumMap( OEnumMapper::epImagePosition ) _rValue, aImagePositionMap
) >>= m_nImagePosition ); ) >>= m_nImagePosition );
m_bHaveImagePosition = true; m_bHaveImagePosition = true;
return true; return true;
@@ -1143,7 +1143,7 @@ namespace xmloff
{ {
OSL_VERIFY( PropertyConversion::convertString( OSL_VERIFY( PropertyConversion::convertString(
cppu::UnoType<decltype(m_nImageAlign)>::get(), cppu::UnoType<decltype(m_nImageAlign)>::get(),
_rValue, OEnumMapper::getEnumMap( OEnumMapper::epImageAlign ) _rValue, aImageAlignMap
) >>= m_nImageAlign ); ) >>= m_nImageAlign );
return true; return true;
} }
@@ -1679,7 +1679,7 @@ namespace xmloff
PropertyConversion::convertString( PropertyConversion::convertString(
::cppu::UnoType<sal_Int16>::get(), ::cppu::UnoType<sal_Int16>::get(),
_rValue, _rValue,
OEnumMapper::getEnumMap( OEnumMapper::epListLinkageType ) aListLinkageMap
) >>= nLinkageType; ) >>= nLinkageType;
m_bLinkWithIndexes = ( nLinkageType != 0 ); m_bLinkWithIndexes = ( nLinkageType != 0 );

View File

@@ -45,103 +45,48 @@ namespace xmloff
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::xmloff::token; using namespace ::xmloff::token;
const SvXMLEnumMapEntry* OEnumMapper::s_pEnumMap[OEnumMapper::KNOWN_ENUM_PROPERTIES] =
{
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr
};
const SvXMLEnumMapEntry* OEnumMapper::getEnumMap(EnumProperties _eProperty)
{
OSL_ENSURE(_eProperty < KNOWN_ENUM_PROPERTIES, "OEnumMapper::getEnumMap: invalid index (this will crash)!");
const SvXMLEnumMapEntry*& rReturn = s_pEnumMap[_eProperty];
if (!rReturn)
{
// the map for this property is not initialized yet
switch (_eProperty)
{
// FormSubmitEncoding // FormSubmitEncoding
case epSubmitEncoding: const SvXMLEnumMapEntry aSubmitEncodingMap[] =
{
static const SvXMLEnumMapEntry aSubmitEncodingMap[] =
{ {
{ XML_APPLICATION_X_WWW_FORM_URLENCODED, FormSubmitEncoding_URL }, { XML_APPLICATION_X_WWW_FORM_URLENCODED, FormSubmitEncoding_URL },
{ XML_MULTIPART_FORMDATA, FormSubmitEncoding_MULTIPART }, { XML_MULTIPART_FORMDATA, FormSubmitEncoding_MULTIPART },
{ XML_APPLICATION_TEXT, FormSubmitEncoding_TEXT }, { XML_APPLICATION_TEXT, FormSubmitEncoding_TEXT },
{ XML_TOKEN_INVALID, 0 } { XML_TOKEN_INVALID, 0 }
}; };
rReturn = aSubmitEncodingMap; // FormSubmitMethod
} const SvXMLEnumMapEntry aSubmitMethodMap[] =
break;
// FormSubmitMethod
case epSubmitMethod:
{
static const SvXMLEnumMapEntry aSubmitMethodMap[] =
{ {
{ XML_GET, FormSubmitMethod_GET }, { XML_GET, FormSubmitMethod_GET },
{ XML_POST, FormSubmitMethod_POST }, { XML_POST, FormSubmitMethod_POST },
{ XML_TOKEN_INVALID, 0 } { XML_TOKEN_INVALID, 0 }
}; };
rReturn = aSubmitMethodMap;
}
break;
// CommandType // CommandType
case epCommandType: const SvXMLEnumMapEntry aCommandTypeMap[] =
{
static const SvXMLEnumMapEntry aCommandTypeMap[] =
{ {
{ XML_TABLE, CommandType::TABLE }, { XML_TABLE, CommandType::TABLE },
{ XML_QUERY, CommandType::QUERY }, { XML_QUERY, CommandType::QUERY },
{ XML_COMMAND, CommandType::COMMAND }, { XML_COMMAND, CommandType::COMMAND },
{ XML_TOKEN_INVALID, 0 } { XML_TOKEN_INVALID, 0 }
}; };
rReturn = aCommandTypeMap;
}
break;
// NavigationBarMode // NavigationBarMode
case epNavigationType: const SvXMLEnumMapEntry aNavigationTypeMap[] =
{
static const SvXMLEnumMapEntry aNavigationTypeMap[] =
{ {
{ XML_NONE, NavigationBarMode_NONE }, { XML_NONE, NavigationBarMode_NONE },
{ XML_CURRENT, NavigationBarMode_CURRENT }, { XML_CURRENT, NavigationBarMode_CURRENT },
{ XML_PARENT, NavigationBarMode_PARENT }, { XML_PARENT, NavigationBarMode_PARENT },
{ XML_TOKEN_INVALID, 0 } { XML_TOKEN_INVALID, 0 }
}; };
rReturn = aNavigationTypeMap;
};
break;
// TabulatorCycle // TabulatorCycle
case epTabCyle: const SvXMLEnumMapEntry aTabulatorCycleMap[] =
{
static const SvXMLEnumMapEntry aTabulytorCycleMap[] =
{ {
{ XML_RECORDS, TabulatorCycle_RECORDS }, { XML_RECORDS, TabulatorCycle_RECORDS },
{ XML_CURRENT, TabulatorCycle_CURRENT }, { XML_CURRENT, TabulatorCycle_CURRENT },
{ XML_PAGE, TabulatorCycle_PAGE }, { XML_PAGE, TabulatorCycle_PAGE },
{ XML_TOKEN_INVALID, 0 } { XML_TOKEN_INVALID, 0 }
}; };
rReturn = aTabulytorCycleMap;
};
break;
// FormButtonType // FormButtonType
case epButtonType: const SvXMLEnumMapEntry aFormButtonTypeMap[] =
{
static const SvXMLEnumMapEntry aFormButtonTypeMap[] =
{ {
{ XML_PUSH, FormButtonType_PUSH }, { XML_PUSH, FormButtonType_PUSH },
{ XML_SUBMIT, FormButtonType_SUBMIT }, { XML_SUBMIT, FormButtonType_SUBMIT },
@@ -149,13 +94,8 @@ namespace xmloff
{ XML_URL, FormButtonType_URL }, { XML_URL, FormButtonType_URL },
{ XML_TOKEN_INVALID, 0 } { XML_TOKEN_INVALID, 0 }
}; };
rReturn = aFormButtonTypeMap;
};
break;
// ListSourceType // ListSourceType
case epListSourceType: const SvXMLEnumMapEntry aListSourceTypeMap[] =
{
static const SvXMLEnumMapEntry aListSourceTypeMap[] =
{ {
{ XML_VALUE_LIST, ListSourceType_VALUELIST }, { XML_VALUE_LIST, ListSourceType_VALUELIST },
{ XML_TABLE, ListSourceType_TABLE }, { XML_TABLE, ListSourceType_TABLE },
@@ -165,25 +105,15 @@ namespace xmloff
{ XML_TABLE_FIELDS, ListSourceType_TABLEFIELDS }, { XML_TABLE_FIELDS, ListSourceType_TABLEFIELDS },
{ XML_TOKEN_INVALID, 0 } { XML_TOKEN_INVALID, 0 }
}; };
rReturn = aListSourceTypeMap;
};
break;
// check state of a checkbox // check state of a checkbox
case epCheckState: const SvXMLEnumMapEntry aCheckStateMap[] =
{
static const SvXMLEnumMapEntry aCheckStateMap[] =
{ {
{ XML_UNCHECKED, TRISTATE_FALSE }, { XML_UNCHECKED, TRISTATE_FALSE },
{ XML_CHECKED, TRISTATE_TRUE }, { XML_CHECKED, TRISTATE_TRUE },
{ XML_UNKNOWN, TRISTATE_INDET }, { XML_UNKNOWN, TRISTATE_INDET },
{ XML_TOKEN_INVALID, 0 } { XML_TOKEN_INVALID, 0 }
}; };
rReturn = aCheckStateMap; const SvXMLEnumMapEntry aTextAlignMap[] =
};
break;
case epTextAlign:
{
static const SvXMLEnumMapEntry aTextAlignMap[] =
{ {
{ XML_START, awt::TextAlign::LEFT }, { XML_START, awt::TextAlign::LEFT },
{ XML_CENTER, awt::TextAlign::CENTER }, { XML_CENTER, awt::TextAlign::CENTER },
@@ -192,12 +122,7 @@ namespace xmloff
{ XML_JUSTIFIED, (sal_uInt16)-1 }, { XML_JUSTIFIED, (sal_uInt16)-1 },
{ XML_TOKEN_INVALID, 0 } { XML_TOKEN_INVALID, 0 }
}; };
rReturn = aTextAlignMap; const SvXMLEnumMapEntry aBorderTypeMap[] =
};
break;
case epBorderWidth:
{
static const SvXMLEnumMapEntry aBorderTypeMap[] =
{ {
{ XML_NONE, 0 }, { XML_NONE, 0 },
{ XML_HIDDEN, 0 }, { XML_HIDDEN, 0 },
@@ -211,13 +136,7 @@ namespace xmloff
{ XML_OUTSET, 1 }, { XML_OUTSET, 1 },
{ XML_TOKEN_INVALID, 0 } { XML_TOKEN_INVALID, 0 }
}; };
rReturn = aBorderTypeMap; const SvXMLEnumMapEntry aFontEmphasisMap[] =
};
break;
case epFontEmphasis:
{
static const SvXMLEnumMapEntry aFontEmphasisMap[] =
{ {
{ XML_NONE, awt::FontEmphasisMark::NONE }, { XML_NONE, awt::FontEmphasisMark::NONE },
{ XML_DOT, awt::FontEmphasisMark::DOT }, { XML_DOT, awt::FontEmphasisMark::DOT },
@@ -226,63 +145,33 @@ namespace xmloff
{ XML_ACCENT, awt::FontEmphasisMark::ACCENT }, { XML_ACCENT, awt::FontEmphasisMark::ACCENT },
{ XML_TOKEN_INVALID, 0 } { XML_TOKEN_INVALID, 0 }
}; };
rReturn = aFontEmphasisMap; const SvXMLEnumMapEntry aFontReliefMap[] =
}
break;
case epFontRelief:
{
static const SvXMLEnumMapEntry aFontReliefMap[] =
{ {
{ XML_NONE, FontRelief::NONE }, { XML_NONE, FontRelief::NONE },
{ XML_ENGRAVED, FontRelief::ENGRAVED }, { XML_ENGRAVED, FontRelief::ENGRAVED },
{ XML_EMBOSSED, FontRelief::EMBOSSED }, { XML_EMBOSSED, FontRelief::EMBOSSED },
{ XML_TOKEN_INVALID, 0 } { XML_TOKEN_INVALID, 0 }
}; };
rReturn = aFontReliefMap; const SvXMLEnumMapEntry aListLinkageMap[] =
}
break;
case epListLinkageType:
{
static const SvXMLEnumMapEntry aListLinkageMap[] =
{ {
{ XML_SELECTION, 0 }, { XML_SELECTION, 0 },
{ XML_SELECTION_INDEXES, 1 }, { XML_SELECTION_INDEXES, 1 },
{ XML_TOKEN_INVALID, 0 } { XML_TOKEN_INVALID, 0 }
}; };
rReturn = aListLinkageMap; const SvXMLEnumMapEntry aOrientationMap[] =
}
break;
case epOrientation:
{
static const SvXMLEnumMapEntry aOrientationMap[] =
{ {
{ XML_HORIZONTAL, ScrollBarOrientation::HORIZONTAL }, { XML_HORIZONTAL, ScrollBarOrientation::HORIZONTAL },
{ XML_VERTICAL, ScrollBarOrientation::VERTICAL }, { XML_VERTICAL, ScrollBarOrientation::VERTICAL },
{ XML_TOKEN_INVALID, 0 } { XML_TOKEN_INVALID, 0 }
}; };
rReturn = aOrientationMap; const SvXMLEnumMapEntry aVisualEffectMap[] =
}
break;
case epVisualEffect:
{
static const SvXMLEnumMapEntry aVisualEffectMap[] =
{ {
{ XML_NONE, VisualEffect::NONE }, { XML_NONE, VisualEffect::NONE },
{ XML_3D, VisualEffect::LOOK3D }, { XML_3D, VisualEffect::LOOK3D },
{ XML_FLAT, VisualEffect::FLAT }, { XML_FLAT, VisualEffect::FLAT },
{ XML_TOKEN_INVALID, 0 } { XML_TOKEN_INVALID, 0 }
}; };
rReturn = aVisualEffectMap; const SvXMLEnumMapEntry aImagePositionMap[] =
}
break;
case epImagePosition:
{
static const SvXMLEnumMapEntry aImagePositionMap[] =
{ {
{ XML_START, 0 }, { XML_START, 0 },
{ XML_END, 1 }, { XML_END, 1 },
@@ -291,26 +180,14 @@ namespace xmloff
{ XML_CENTER, (sal_uInt16)-1 }, { XML_CENTER, (sal_uInt16)-1 },
{ XML_TOKEN_INVALID, 0 } { XML_TOKEN_INVALID, 0 }
}; };
rReturn = aImagePositionMap; const SvXMLEnumMapEntry aImageAlignMap[] =
}
break;
case epImageAlign:
{
static const SvXMLEnumMapEntry aImageAlignMap[] =
{ {
{ XML_START, 0 }, { XML_START, 0 },
{ XML_CENTER, 1 }, { XML_CENTER, 1 },
{ XML_END, 2 }, { XML_END, 2 },
{ XML_TOKEN_INVALID, 0 } { XML_TOKEN_INVALID, 0 }
}; };
rReturn = aImageAlignMap; const SvXMLEnumMapEntry aScaleModeMap[] =
}
break;
case epImageScaleMode:
{
static const SvXMLEnumMapEntry aScaleModeMap[] =
{ {
{ XML_BACKGROUND_NO_REPEAT, ImageScaleMode::NONE }, { XML_BACKGROUND_NO_REPEAT, ImageScaleMode::NONE },
{ XML_REPEAT, ImageScaleMode::NONE }, // repeating the image is not supported { XML_REPEAT, ImageScaleMode::NONE }, // repeating the image is not supported
@@ -318,17 +195,6 @@ namespace xmloff
{ XML_SCALE, ImageScaleMode::ISOTROPIC }, { XML_SCALE, ImageScaleMode::ISOTROPIC },
{ XML_TOKEN_INVALID, ImageScaleMode::NONE } { XML_TOKEN_INVALID, ImageScaleMode::NONE }
}; };
rReturn = aScaleModeMap;
}
break;
case KNOWN_ENUM_PROPERTIES:
break;
}
}
return rReturn;
}
} // namespace xmloff } // namespace xmloff

View File

@@ -25,40 +25,24 @@
namespace xmloff namespace xmloff
{ {
//= OEnumMapper extern const SvXMLEnumMapEntry aSubmitEncodingMap[];
class OEnumMapper extern const SvXMLEnumMapEntry aSubmitMethodMap[];
{ extern const SvXMLEnumMapEntry aCommandTypeMap[];
public: extern const SvXMLEnumMapEntry aNavigationTypeMap[];
enum EnumProperties extern const SvXMLEnumMapEntry aTabulatorCycleMap[];
{ extern const SvXMLEnumMapEntry aFormButtonTypeMap[];
epSubmitEncoding = 0, extern const SvXMLEnumMapEntry aListSourceTypeMap[];
epSubmitMethod, extern const SvXMLEnumMapEntry aCheckStateMap[];
epCommandType, extern const SvXMLEnumMapEntry aTextAlignMap[];
epNavigationType, extern const SvXMLEnumMapEntry aBorderTypeMap[];
epTabCyle, extern const SvXMLEnumMapEntry aFontEmphasisMap[];
epButtonType, extern const SvXMLEnumMapEntry aFontReliefMap[];
epListSourceType, extern const SvXMLEnumMapEntry aListLinkageMap[];
epCheckState, extern const SvXMLEnumMapEntry aOrientationMap[];
epTextAlign, extern const SvXMLEnumMapEntry aVisualEffectMap[];
epBorderWidth, extern const SvXMLEnumMapEntry aImagePositionMap[];
epFontEmphasis, extern const SvXMLEnumMapEntry aImageAlignMap[];
epFontRelief, extern const SvXMLEnumMapEntry aScaleModeMap[];
epListLinkageType,
epOrientation,
epVisualEffect,
epImagePosition,
epImageAlign,
epImageScaleMode,
KNOWN_ENUM_PROPERTIES
};
private:
static const SvXMLEnumMapEntry* s_pEnumMap[KNOWN_ENUM_PROPERTIES];
public:
static const SvXMLEnumMapEntry* getEnumMap(EnumProperties _eProperty);
};
} // namespace xmloff } // namespace xmloff

View File

@@ -179,46 +179,46 @@ OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl(SvXMLImport& _rImporter)
// the enum attributes // the enum attributes
m_aAttributeMetaData.addEnumProperty( m_aAttributeMetaData.addEnumProperty(
OAttributeMetaData::getCommonControlAttributeName( CCAFlags::VisualEffect ), PROPERTY_VISUAL_EFFECT, OAttributeMetaData::getCommonControlAttributeName( CCAFlags::VisualEffect ), PROPERTY_VISUAL_EFFECT,
VisualEffect::LOOK3D, OEnumMapper::getEnumMap( OEnumMapper::epVisualEffect ), VisualEffect::LOOK3D, aVisualEffectMap,
&::cppu::UnoType<sal_Int16>::get() ); &::cppu::UnoType<sal_Int16>::get() );
m_aAttributeMetaData.addEnumProperty( m_aAttributeMetaData.addEnumProperty(
OAttributeMetaData::getCommonControlAttributeName( CCAFlags::Orientation ), PROPERTY_ORIENTATION, OAttributeMetaData::getCommonControlAttributeName( CCAFlags::Orientation ), PROPERTY_ORIENTATION,
ScrollBarOrientation::HORIZONTAL, OEnumMapper::getEnumMap( OEnumMapper::epOrientation ), ScrollBarOrientation::HORIZONTAL, aOrientationMap,
&::cppu::UnoType<sal_Int32>::get() ); &::cppu::UnoType<sal_Int32>::get() );
m_aAttributeMetaData.addEnumProperty( m_aAttributeMetaData.addEnumProperty(
OAttributeMetaData::getCommonControlAttributeName(CCAFlags::ButtonType), PROPERTY_BUTTONTYPE, OAttributeMetaData::getCommonControlAttributeName(CCAFlags::ButtonType), PROPERTY_BUTTONTYPE,
FormButtonType_PUSH, OEnumMapper::getEnumMap(OEnumMapper::epButtonType), FormButtonType_PUSH, aFormButtonTypeMap,
&::cppu::UnoType<FormButtonType>::get()); &::cppu::UnoType<FormButtonType>::get());
m_aAttributeMetaData.addEnumProperty( m_aAttributeMetaData.addEnumProperty(
OAttributeMetaData::getDatabaseAttributeName(DAFlags::ListSource_TYPE), PROPERTY_LISTSOURCETYPE, OAttributeMetaData::getDatabaseAttributeName(DAFlags::ListSource_TYPE), PROPERTY_LISTSOURCETYPE,
ListSourceType_VALUELIST, OEnumMapper::getEnumMap(OEnumMapper::epListSourceType), ListSourceType_VALUELIST, aListSourceTypeMap,
&::cppu::UnoType<ListSourceType>::get()); &::cppu::UnoType<ListSourceType>::get());
m_aAttributeMetaData.addEnumProperty( m_aAttributeMetaData.addEnumProperty(
OAttributeMetaData::getSpecialAttributeName(SCAFlags::State), PROPERTY_DEFAULT_STATE, TRISTATE_FALSE, OAttributeMetaData::getSpecialAttributeName(SCAFlags::State), PROPERTY_DEFAULT_STATE, TRISTATE_FALSE,
OEnumMapper::getEnumMap(OEnumMapper::epCheckState), aCheckStateMap,
&::cppu::UnoType<sal_Int16>::get()); &::cppu::UnoType<sal_Int16>::get());
m_aAttributeMetaData.addEnumProperty( m_aAttributeMetaData.addEnumProperty(
OAttributeMetaData::getSpecialAttributeName(SCAFlags::CurrentState), PROPERTY_STATE, TRISTATE_FALSE, OAttributeMetaData::getSpecialAttributeName(SCAFlags::CurrentState), PROPERTY_STATE, TRISTATE_FALSE,
OEnumMapper::getEnumMap(OEnumMapper::epCheckState), aCheckStateMap,
&::cppu::UnoType<sal_Int16>::get()); &::cppu::UnoType<sal_Int16>::get());
m_aAttributeMetaData.addEnumProperty( m_aAttributeMetaData.addEnumProperty(
OAttributeMetaData::getFormAttributeName(faEnctype), PROPERTY_SUBMIT_ENCODING, OAttributeMetaData::getFormAttributeName(faEnctype), PROPERTY_SUBMIT_ENCODING,
FormSubmitEncoding_URL, OEnumMapper::getEnumMap(OEnumMapper::epSubmitEncoding), FormSubmitEncoding_URL, aSubmitEncodingMap,
&::cppu::UnoType<FormSubmitEncoding>::get()); &::cppu::UnoType<FormSubmitEncoding>::get());
m_aAttributeMetaData.addEnumProperty( m_aAttributeMetaData.addEnumProperty(
OAttributeMetaData::getFormAttributeName(faMethod), PROPERTY_SUBMIT_METHOD, OAttributeMetaData::getFormAttributeName(faMethod), PROPERTY_SUBMIT_METHOD,
FormSubmitMethod_GET, OEnumMapper::getEnumMap(OEnumMapper::epSubmitMethod), FormSubmitMethod_GET, aSubmitMethodMap,
&::cppu::UnoType<FormSubmitMethod>::get()); &::cppu::UnoType<FormSubmitMethod>::get());
m_aAttributeMetaData.addEnumProperty( m_aAttributeMetaData.addEnumProperty(
OAttributeMetaData::getFormAttributeName(faCommandType), PROPERTY_COMMAND_TYPE, OAttributeMetaData::getFormAttributeName(faCommandType), PROPERTY_COMMAND_TYPE,
CommandType::COMMAND, OEnumMapper::getEnumMap(OEnumMapper::epCommandType)); CommandType::COMMAND, aCommandTypeMap);
m_aAttributeMetaData.addEnumProperty( m_aAttributeMetaData.addEnumProperty(
OAttributeMetaData::getFormAttributeName(faNavigationMode), PROPERTY_NAVIGATION, OAttributeMetaData::getFormAttributeName(faNavigationMode), PROPERTY_NAVIGATION,
NavigationBarMode_NONE, OEnumMapper::getEnumMap(OEnumMapper::epNavigationType), NavigationBarMode_NONE, aNavigationTypeMap,
&::cppu::UnoType<NavigationBarMode>::get()); &::cppu::UnoType<NavigationBarMode>::get());
m_aAttributeMetaData.addEnumProperty( m_aAttributeMetaData.addEnumProperty(
OAttributeMetaData::getFormAttributeName(faTabbingCycle), PROPERTY_CYCLE, OAttributeMetaData::getFormAttributeName(faTabbingCycle), PROPERTY_CYCLE,
TabulatorCycle_RECORDS, OEnumMapper::getEnumMap(OEnumMapper::epTabCyle), TabulatorCycle_RECORDS, aTabulatorCycleMap,
&::cppu::UnoType<TabulatorCycle>::get()); &::cppu::UnoType<TabulatorCycle>::get());
// 'initialize' // 'initialize'