diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-09 09:04:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-13 09:02:22 +0000 |
commit | 7e9857c2935bb2533806db4e71c6cd1e171c3478 (patch) | |
tree | d9f8a6d4f94e19f349b67141359cc7c49130b5fc /xmloff/source/style/xmlnumfi.cxx | |
parent | 7c0e3d0b37131b12262d0f610505b3384923c4a1 (diff) |
templatize SvXMLEnumMapEntry
in preparation for "scoped UNO enums".
This is a little hacky: In order to limit the scope of this change,
the templated SvXMLEnumMapEntry struct actually has a fixed size field,
and we cast it to SvXMLEnumMapEntry<sal_uInt16>* in various
places, to avoid carrying the type param around.
Change-Id: Idfbc5561303c557598dd5564b7a7259ae5261d83
Reviewed-on: https://gerrit.libreoffice.org/34987
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source/style/xmlnumfi.cxx')
-rw-r--r-- | xmloff/source/style/xmlnumfi.cxx | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index b48dfc6cb2d3..9194ba6ca8f6 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -303,18 +303,18 @@ static const ColorData aNumFmtStdColors[XML_NUMF_COLORCOUNT] = // maps for SvXMLUnitConverter::convertEnum -static const SvXMLEnumMapEntry aStyleValueMap[] = +static const SvXMLEnumMapEntry<bool> aStyleValueMap[] = { - { XML_SHORT, sal_uInt16(false) }, - { XML_LONG, sal_uInt16(true) }, - { XML_TOKEN_INVALID, 0 } + { XML_SHORT, false }, + { XML_LONG, true }, + { XML_TOKEN_INVALID, false } }; -static const SvXMLEnumMapEntry aFormatSourceMap[] = +static const SvXMLEnumMapEntry<bool> aFormatSourceMap[] = { - { XML_FIXED, sal_uInt16(false) }, - { XML_LANGUAGE, sal_uInt16(true) }, - { XML_TOKEN_INVALID, 0 } + { XML_FIXED, false }, + { XML_LANGUAGE, true }, + { XML_TOKEN_INVALID, false } }; struct SvXMLDefaultDateFormat @@ -902,7 +902,6 @@ SvXMLNumFmtElementContext::SvXMLNumFmtElementContext( SvXMLImport& rImport, bool bAttrBool(false); bool bVarDecimals = false; bool bIsMaxDenominator = false; - sal_uInt16 nAttrEnum; double fAttrDouble; sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; @@ -1012,8 +1011,7 @@ SvXMLNumFmtElementContext::SvXMLNumFmtElementContext( SvXMLImport& rImport, aLanguageTagODF.maCountry = sValue; break; case XML_TOK_ELEM_ATTR_STYLE: - if ( SvXMLUnitConverter::convertEnum( nAttrEnum, sValue, aStyleValueMap ) ) - bLong = (bool) nAttrEnum; + SvXMLUnitConverter::convertEnum( bLong, sValue, aStyleValueMap ); break; case XML_TOK_ELEM_ATTR_TEXTUAL: if (::sax::Converter::convertBool( bAttrBool, sValue )) @@ -1398,7 +1396,6 @@ SvXMLNumFormatContext::SvXMLNumFormatContext( SvXMLImport& rImport, OUString sNatNumAttrScript, sNatNumAttrRfcLanguageTag; css::i18n::NativeNumberXmlAttributes aNatNumAttr; bool bAttrBool(false); - sal_uInt16 nAttrEnum; sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; for( sal_Int16 i=0; i < nAttrCount; i++ ) @@ -1434,8 +1431,7 @@ SvXMLNumFormatContext::SvXMLNumFormatContext( SvXMLImport& rImport, bAutoOrder = bAttrBool; break; case XML_TOK_STYLE_ATTR_FORMAT_SOURCE: - if ( SvXMLUnitConverter::convertEnum( nAttrEnum, sValue, aFormatSourceMap ) ) - bFromSystem = (bool) nAttrEnum; + SvXMLUnitConverter::convertEnum( bFromSystem, sValue, aFormatSourceMap ); break; case XML_TOK_STYLE_ATTR_TRUNCATE_ON_OVERFLOW: if (::sax::Converter::convertBool( bAttrBool, sValue )) |