diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-02-27 13:59:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-02-27 18:54:30 +0100 |
commit | 913ed8398667dfd0d6f03923507e14c8e2642c90 (patch) | |
tree | fca4fbdecd19516e3a417e97b671e49126ae00ae /xmloff/source | |
parent | 53a8e2f75da778c953b509efadca890ff0936c2f (diff) |
remove duplicate tokens from xmloff
Which causes trouble when converting stuff to use FastParser APIs.
I see we used to use dummy entries to avoid perfhash complaining, which
is fine for exporting, but doesn't work when we use these constants for
fast-parser importing, because the imported element/attribute ends up
mapped to what looks like the "wrong" constant.
So let's just make the constants match their textual representation.
Change-Id: I173d4b1e5fedede18375a6f7c15b1f36a48e4063
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89627
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source')
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 63 | ||||
-rw-r--r-- | xmloff/source/draw/sdpropls.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/draw/shapeexport.cxx | 20 | ||||
-rw-r--r-- | xmloff/source/draw/ximpshap.cxx | 28 | ||||
-rw-r--r-- | xmloff/source/style/GradientStyle.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/style/HatchStyle.cxx | 10 | ||||
-rw-r--r-- | xmloff/source/style/TransGradientStyle.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/style/XMLBackgroundImageContext.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/style/XMLBackgroundImageExport.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/style/csmaphdl.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/style/kernihdl.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/style/lspachdl.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/style/opaquhdl.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/style/postuhdl.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/style/weighhdl.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/token/tokens.txt | 39 | ||||
-rw-r--r-- | xmloff/source/transform/StyleOASISTContext.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/transform/TransformerBase.cxx | 2 |
18 files changed, 88 insertions, 136 deletions
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 9be73cdae89f..8efa01a7b02d 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -20,6 +20,9 @@ #include <sal/macros.h> #include <xmloff/xmltoken.hxx> #include <rtl/ustring.hxx> +#include <rtl/string.hxx> +#include <sal/log.hxx> +#include <set> namespace xmloff::token { @@ -159,16 +162,15 @@ namespace xmloff::token { TOKEN( "loext", XML_NP_LO_EXT ), TOKEN( "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0", XML_N_LO_EXT ), + TOKEN( "urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0", XML_N_FIELD ), + TOKEN( "field", XML_NP_FIELD ), + // units - TOKEN( "mm", XML_UNIT_MM ), TOKEN( "m", XML_UNIT_M ), - TOKEN( "km", XML_UNIT_KM ), TOKEN( "cm", XML_UNIT_CM ), TOKEN( "pt", XML_UNIT_PT ), TOKEN( "pc", XML_UNIT_PC ), TOKEN( "ft", XML_UNIT_FOOT ), - TOKEN( "mi", XML_UNIT_MILES ), - TOKEN( "in", XML_UNIT_INCH ), // any other TOKEN( "1", XML_1 ), @@ -294,8 +296,6 @@ namespace xmloff::token { TOKEN( "background-color", XML_BACKGROUND_COLOR ), TOKEN( "background-image", XML_BACKGROUND_IMAGE ), TOKEN( "no-repeat", XML_BACKGROUND_NO_REPEAT ), - TOKEN( "repeat", XML_BACKGROUND_REPEAT ), - TOKEN( "stretch", XML_BACKGROUND_STRETCH ), TOKEN( "bar", XML_BAR ), TOKEN( "base64Binary", XML_BASE64BINARY ), TOKEN( "base-cell-address", XML_BASE_CELL_ADDRESS ), @@ -380,7 +380,6 @@ namespace xmloff::token { TOKEN( "case-sensitive", XML_CASE_SENSITIVE ), TOKEN( "capitalize", XML_CASEMAP_CAPITALIZE ), TOKEN( "lowercase", XML_CASEMAP_LOWERCASE ), - TOKEN( "normal", XML_CASEMAP_NORMAL ), TOKEN( "small-caps", XML_CASEMAP_SMALL_CAPS ), TOKEN( "uppercase", XML_CASEMAP_UPPERCASE ), TOKEN( "categories", XML_CATEGORIES ), @@ -427,7 +426,6 @@ namespace xmloff::token { TOKEN( "close", XML_CLOSE ), TOKEN( "close-horizontal", XML_CLOSE_HORIZONTAL ), TOKEN( "close-vertical", XML_CLOSE_VERTICAL ), - TOKEN( "cm", XML_CM ), TOKEN( "cn", XML_CN ), TOKEN( "code", XML_CODE ), TOKEN( "codebase", XML_CODEBASE ), @@ -446,7 +444,6 @@ namespace xmloff::token { TOKEN( "column-width", XML_COLUMN_WIDTH ), TOKEN( "columnalign", XML_COLUMNALIGN ), TOKEN( "columns", XML_COLUMNS ), - TOKEN( "auto", XML_COLUMNSPLIT_AUTO ), TOKEN( "avoid", XML_COLUMNSPLIT_AVOID ), TOKEN( "combine-entries", XML_COMBINE_ENTRIES ), TOKEN( "combine-entries-with-dash", XML_COMBINE_ENTRIES_WITH_DASH ), @@ -934,13 +931,11 @@ namespace xmloff::token { TOKEN( "gouraud", XML_GOURAUD ), TOKEN( "gradient", XML_GRADIENT ), TOKEN( "angle", XML_GRADIENT_ANGLE ), - TOKEN( "border", XML_GRADIENT_BORDER ), TOKEN( "gradient-step-count", XML_GRADIENT_STEP_COUNT ), TOKEN( "gradient-style", XML_GRADIENT_STYLE ), TOKEN( "gradient-table", XML_GRADIENT_TABLE ), TOKEN( "axial", XML_GRADIENTSTYLE_AXIAL ), TOKEN( "ellipsoid", XML_GRADIENTSTYLE_ELLIPSOID ), - TOKEN( "linear", XML_GRADIENTSTYLE_LINEAR ), TOKEN( "radial", XML_GRADIENTSTYLE_RADIAL ), TOKEN( "rectangular", XML_GRADIENTSTYLE_RECTANGULAR ), TOKEN( "square", XML_GRADIENTSTYLE_SQUARE ), @@ -962,11 +957,7 @@ namespace xmloff::token { TOKEN( "hanging", XML_HANGING ), TOKEN( "has-persistent-data", XML_HAS_PERSISTENT_DATA ), TOKEN( "hatch", XML_HATCH ), - TOKEN( "distance", XML_HATCH_DISTANCE ), - TOKEN( "style", XML_HATCH_STYLE ), TOKEN( "hatch-table", XML_HATCH_TABLE ), - TOKEN( "double", XML_HATCHSTYLE_DOUBLE ), - TOKEN( "single", XML_HATCHSTYLE_SINGLE ), TOKEN( "triple", XML_HATCHSTYLE_TRIPLE ), TOKEN( "header", XML_HEADER ), TOKEN( "header-first", XML_HEADER_FIRST ), @@ -1091,7 +1082,6 @@ namespace xmloff::token { TOKEN( "justify", XML_JUSTIFY ), TOKEN( "justify-single-word", XML_JUSTIFY_SINGLE_WORD ), TOKEN( "keep-with-next", XML_KEEP_WITH_NEXT ), - TOKEN( "normal", XML_KERNING_NORMAL ), TOKEN( "key", XML_KEY ), TOKEN( "key1", XML_KEY1 ), TOKEN( "key2", XML_KEY2 ), @@ -1375,8 +1365,6 @@ namespace xmloff::token { TOKEN( "on-update-keep-styles", XML_ON_UPDATE_KEEP_STYLES ), TOKEN( "online", XML_ONLINE ), TOKEN( "online-text", XML_ONLINE_TEXT ), - TOKEN( "background", XML_OPAQUE_BACKGROUND ), - TOKEN( "foreground", XML_OPAQUE_FOREGROUND ), TOKEN( "open", XML_OPEN ), TOKEN( "open-horizontal", XML_OPEN_HORIZONTAL ), TOKEN( "open-vertical", XML_OPEN_VERTICAL ), @@ -1473,25 +1461,15 @@ namespace xmloff::token { TOKEN( "position-right", XML_POSITION_RIGHT ), TOKEN( "position-top", XML_POSITION_TOP ), TOKEN( "positive-color", XML_POSITIVE_COLOR ), - TOKEN( "italic", XML_POSTURE_ITALIC ), - TOKEN( "normal", XML_POSTURE_NORMAL ), TOKEN( "oblique", XML_POSTURE_OBLIQUE ), TOKEN( "power", XML_POWER ), TOKEN( "precision-as-shown", XML_PRECISION_AS_SHOWN ), TOKEN( "prefix", XML_PREFIX ), TOKEN( "presentation", XML_PRESENTATION ), - TOKEN( "chart", XML_PRESENTATION_CHART ), - TOKEN( "graphic", XML_PRESENTATION_GRAPHIC ), - TOKEN( "notes", XML_PRESENTATION_NOTES ), - TOKEN( "object", XML_PRESENTATION_OBJECT ), TOKEN( "orgchart", XML_PRESENTATION_ORGCHART ), TOKEN( "outline", XML_PRESENTATION_OUTLINE ), - TOKEN( "page", XML_PRESENTATION_PAGE ), TOKEN( "presentation-page-layout", XML_PRESENTATION_PAGE_LAYOUT ), - TOKEN( "presentation-page-layout-name", XML_PRESENTATION_PAGE_LAYOUT_NAME ), - TOKEN( "subtitle", XML_PRESENTATION_SUBTITLE ), - TOKEN( "table", XML_PRESENTATION_TABLE ), - TOKEN( "title", XML_PRESENTATION_TITLE ), + TOKEN( "presentation-page-layout-name", XML_PRESENTATION_PAGE_LAYOUT_NAME ), TOKEN( "previous", XML_PREVIOUS ), TOKEN( "previous-page", XML_PREVIOUS_PAGE ), TOKEN( "print", XML_PRINT ), @@ -1509,9 +1487,6 @@ namespace xmloff::token { TOKEN( "projection", XML_PROJECTION ), TOKEN( "properties", XML_PROPERTIES ), TOKEN( "protect", XML_PROTECT ), - TOKEN( "content", XML_PROTECT_CONTENT ), - TOKEN( "position", XML_PROTECT_POSITION ), - TOKEN( "size", XML_PROTECT_SIZE ), TOKEN( "protected", XML_PROTECTED ), TOKEN( "protection-key", XML_PROTECTION_KEY ), TOKEN( "protection-key-digest-algorithm", XML_PROTECTION_KEY_DIGEST_ALGORITHM ), @@ -2073,8 +2048,6 @@ namespace xmloff::token { TOKEN( "wavyline-from-right", XML_WAVYLINE_FROM_RIGHT ), TOKEN( "wavyline-from-top", XML_WAVYLINE_FROM_TOP ), TOKEN( "week-of-year", XML_WEEK_OF_YEAR ), - TOKEN( "bold", XML_WEIGHT_BOLD ), - TOKEN( "normal", XML_WEIGHT_NORMAL ), TOKEN( "white", XML_WHITE ), TOKEN( "whole-page", XML_WHOLE_PAGE ), TOKEN( "widows", XML_WIDOWS ), @@ -3232,8 +3205,6 @@ namespace xmloff::token { TOKEN( "fieldmark", XML_FIELDMARK ), TOKEN( "fieldmark-start", XML_FIELDMARK_START ), TOKEN( "fieldmark-end", XML_FIELDMARK_END ), - TOKEN( "urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0", XML_N_FIELD ), - TOKEN( "field", XML_NP_FIELD ), TOKEN( "image-scale", XML_IMAGE_SCALE ), TOKEN( "isotropic", XML_ISOTROPIC ), @@ -3386,18 +3357,38 @@ namespace xmloff::token { // check the consistency of the token list. Below, we use the // ordinal value of the token as index into the token list, so we // should make sure that every entry is at the proper position + std::set<OString> tokenSet; + bool foundDuplicate = false; const XMLTokenEntry* pEntry = aTokenList; const XMLTokenEntry* pEntryEnd = pEntry + SAL_N_ELEMENTS(aTokenList); sal_uInt16 nPos = 0; while (pEntry < pEntryEnd) { + SAL_WARN_IF(nPos != static_cast<sal_uInt16>(pEntry->eToken), "xmloff", + "inconsistency at pos " << nPos << " for token " + << OUString( pEntry->pChar, pEntry->nLength, RTL_TEXTENCODING_ASCII_US )); assert(nPos == static_cast<sal_uInt16>(pEntry->eToken)); // Inconsistency in the token list! // The positions in xmltoken.hxx and xmltoken.cxx need to match. + + // verify that we have no duplicates, which can mess us up when doing fast-parser import + if (pEntry->nLength && nPos >= XML_MM) + // ignoring the zero-length fake entries and the namespace prefix entrie + { + auto pair = tokenSet.insert(OString(pEntry->pChar, pEntry->nLength)); + if (!pair.second) + { + SAL_WARN("xmloff", "duplicate token string " + << OUString( pEntry->pChar, pEntry->nLength, RTL_TEXTENCODING_ASCII_US )); + foundDuplicate = true; + } + } ++pEntry; ++nPos; } + assert(!foundDuplicate && "duplicate token string"); + s_bChecked = true; // it's all static, checking once is enough } #endif diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx index aeeb4f788edb..19b325f8e1c5 100644 --- a/xmloff/source/draw/sdpropls.cxx +++ b/xmloff/source/draw/sdpropls.cxx @@ -660,15 +660,15 @@ static SvXMLEnumMapEntry<drawing::TextFitToSizeType> const pXML_ShrinkToFit_Enum static SvXMLEnumMapEntry<sal_Int32> const pXML_MeasureUnit_Enum[] = { { XML_AUTOMATIC, 0 }, - { XML_UNIT_MM, 1 }, + { XML_MM, 1 }, { XML_UNIT_CM, 2 }, { XML_UNIT_M, 3 }, - { XML_UNIT_KM, 4 }, + { XML_KM, 4 }, { XML_UNIT_PT, 6 }, { XML_UNIT_PC, 7 }, - { XML_UNIT_INCH, 8 }, + { XML_IN, 8 }, { XML_UNIT_FOOT, 9 }, - { XML_UNIT_MILES, 10 }, + { XML_MI, 10 }, { XML_TOKEN_INVALID,0 } }; diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 5eac15c7cbf7..41f9595f9716 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -1924,13 +1924,13 @@ void XMLShapeExport::ImpExportTextBoxShape( { case XmlShapeTypePresSubtitleShape: { - aStr = GetXMLToken(XML_PRESENTATION_SUBTITLE); + aStr = GetXMLToken(XML_SUBTITLE); bIsPresShape = true; break; } case XmlShapeTypePresTitleTextShape: { - aStr = GetXMLToken(XML_PRESENTATION_TITLE); + aStr = GetXMLToken(XML_TITLE); bIsPresShape = true; break; } @@ -1942,7 +1942,7 @@ void XMLShapeExport::ImpExportTextBoxShape( } case XmlShapeTypePresNotesShape: { - aStr = GetXMLToken(XML_PRESENTATION_NOTES); + aStr = GetXMLToken(XML_NOTES); bIsPresShape = true; break; } @@ -2345,7 +2345,7 @@ void XMLShapeExport::ImpExportGraphicObjectShape( ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); if(eShapeType == XmlShapeTypePresGraphicObjectShape) - bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_GRAPHIC) ); + bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_GRAPHIC) ); bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210# SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, @@ -2844,11 +2844,11 @@ void XMLShapeExport::ImpExportOLE2Shape( // presentation settings if(eShapeType == XmlShapeTypePresOLE2Shape) - bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) ); + bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_OBJECT) ); else if(eShapeType == XmlShapeTypePresChartShape) - bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_CHART) ); + bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_CHART) ); else if(eShapeType == XmlShapeTypePresSheetShape) - bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_TABLE) ); + bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_TABLE) ); bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210# bool bExportEmbedded(mrExport.getExportFlags() & SvXMLExportFlags::EMBEDDED); @@ -3006,7 +3006,7 @@ void XMLShapeExport::ImpExportPageShape( if(eShapeType == XmlShapeTypePresPageShape) { mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_CLASS, - XML_PRESENTATION_PAGE); + XML_PAGE); } // write Page shape @@ -3283,7 +3283,7 @@ void XMLShapeExport::ImpExportMediaShape( if(eShapeType == XmlShapeTypePresMediaShape) { - (void)ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) ); + (void)ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_OBJECT) ); } bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); // #86116#/#92210# SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, @@ -4827,7 +4827,7 @@ void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape // presentation settings if(eShapeType == XmlShapeTypePresTableShape) - bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_TABLE) ); + bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_TABLE) ); const bool bCreateNewline( (nFeatures & XMLShapeExportFlags::NO_WS) == XMLShapeExportFlags::NONE ); const bool bExportEmbedded(mrExport.getExportFlags() & SvXMLExportFlags::EMBEDDED); diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index f0a8a169842a..99a5d313f1b5 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -1557,7 +1557,7 @@ void SdXMLTextBoxShapeContext::StartElement(const uno::Reference< xml::sax::XAtt // check if the current document supports presentation shapes if( GetImport().GetShapeImport()->IsPresentationShapesSupported() ) { - if( IsXMLToken( maPresentationClass, XML_PRESENTATION_SUBTITLE )) + if( IsXMLToken( maPresentationClass, XML_SUBTITLE )) { // XmlShapeTypePresSubtitleShape service = "com.sun.star.presentation.SubtitleShape"; @@ -1567,7 +1567,7 @@ void SdXMLTextBoxShapeContext::StartElement(const uno::Reference< xml::sax::XAtt // XmlShapeTypePresOutlinerShape service = "com.sun.star.presentation.OutlinerShape"; } - else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_NOTES ) ) + else if( IsXMLToken( maPresentationClass, XML_NOTES ) ) { // XmlShapeTypePresNotesShape service = "com.sun.star.presentation.NotesShape"; @@ -1596,7 +1596,7 @@ void SdXMLTextBoxShapeContext::StartElement(const uno::Reference< xml::sax::XAtt service = "com.sun.star.presentation.DateTimeShape"; bClearText = true; } - else // IsXMLToken( maPresentationClass, XML_PRESENTATION_TITLE ) ) + else // IsXMLToken( maPresentationClass, XML_TITLE ) ) { // XmlShapeTypePresTitleTextShape service = "com.sun.star.presentation.TitleTextShape"; @@ -2206,7 +2206,7 @@ void SdXMLPageShapeContext::StartElement(const uno::Reference< xml::sax::XAttrib // add, set style and properties from base shape // #86163# take into account which type of PageShape needs to - // be constructed. It's a pres shape if presentation:XML_CLASS == XML_PRESENTATION_PAGE. + // be constructed. It's a pres shape if presentation:XML_CLASS == XML_PAGE. bool bIsPresentation = !maPresentationClass.isEmpty() && GetImport().GetShapeImport()->IsPresentationShapesSupported(); @@ -2219,7 +2219,7 @@ void SdXMLPageShapeContext::StartElement(const uno::Reference< xml::sax::XAttrib } else { - if(bIsPresentation && !IsXMLToken( maPresentationClass, XML_PRESENTATION_PAGE ) ) + if(bIsPresentation && !IsXMLToken( maPresentationClass, XML_PAGE ) ) { bIsPresentation = false; } @@ -2638,15 +2638,15 @@ void SdXMLObjectShapeContext::StartElement( const css::uno::Reference< css::xml: if( bIsPresShape ) { - if( IsXMLToken( maPresentationClass, XML_PRESENTATION_CHART ) ) + if( IsXMLToken( maPresentationClass, XML_CHART ) ) { service = "com.sun.star.presentation.ChartShape"; } - else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) ) + else if( IsXMLToken( maPresentationClass, XML_TABLE ) ) { service = "com.sun.star.presentation.CalcShape"; } - else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) ) + else if( IsXMLToken( maPresentationClass, XML_OBJECT ) ) { service = "com.sun.star.presentation.OLE2Shape"; } @@ -3007,7 +3007,7 @@ void SdXMLPluginShapeContext::StartElement( const css::uno::Reference< css::xml: bIsPresShape = !maPresentationClass.isEmpty() && GetImport().GetShapeImport()->IsPresentationShapesSupported(); if( bIsPresShape ) { - if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) ) + if( IsXMLToken( maPresentationClass, XML_OBJECT ) ) { service = "com.sun.star.presentation.MediaShape"; } @@ -3612,13 +3612,13 @@ void SdXMLFrameShapeContext::EndElement() eToken = XML_IMAGE; } - else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_PAGE ) ) + else if( IsXMLToken( maPresentationClass, XML_PAGE ) ) { eToken = XML_PAGE_THUMBNAIL; } - else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_CHART ) || - IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) || - IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) ) + else if( IsXMLToken( maPresentationClass, XML_CHART ) || + IsXMLToken( maPresentationClass, XML_TABLE ) || + IsXMLToken( maPresentationClass, XML_OBJECT ) ) { eToken = XML_OBJECT; } @@ -3916,7 +3916,7 @@ void SdXMLTableShapeContext::StartElement( const css::uno::Reference< css::xml:: bool bIsPresShape = !maPresentationClass.isEmpty() && GetImport().GetShapeImport()->IsPresentationShapesSupported(); if( bIsPresShape ) { - if( IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) ) + if( IsXMLToken( maPresentationClass, XML_TABLE ) ) { service = "com.sun.star.presentation.TableShape"; } diff --git a/xmloff/source/style/GradientStyle.cxx b/xmloff/source/style/GradientStyle.cxx index 9d5316e5de91..97721db74ea3 100644 --- a/xmloff/source/style/GradientStyle.cxx +++ b/xmloff/source/style/GradientStyle.cxx @@ -61,7 +61,7 @@ enum SvXMLTokenMapAttrs SvXMLEnumMapEntry<awt::GradientStyle> const pXML_GradientStyle_Enum[] = { - { XML_GRADIENTSTYLE_LINEAR, awt::GradientStyle_LINEAR }, + { XML_LINEAR, awt::GradientStyle_LINEAR }, { XML_GRADIENTSTYLE_AXIAL, awt::GradientStyle_AXIAL }, { XML_GRADIENTSTYLE_RADIAL, awt::GradientStyle_RADIAL }, { XML_GRADIENTSTYLE_ELLIPSOID, awt::GradientStyle_ELLIPTICAL }, @@ -98,9 +98,7 @@ void XMLGradientStyleImport::importXML( { XML_NAMESPACE_DRAW, XML_START_INTENSITY, XML_TOK_GRADIENT_STARTINT }, { XML_NAMESPACE_DRAW, XML_END_INTENSITY, XML_TOK_GRADIENT_ENDINT }, { XML_NAMESPACE_DRAW, XML_GRADIENT_ANGLE, XML_TOK_GRADIENT_ANGLE }, - { XML_NAMESPACE_DRAW, XML_GRADIENT_BORDER, XML_TOK_GRADIENT_BORDER, - XML_ELEMENT( DRAW, XML_BORDER ) }, - // XML_GRADIENT_BORDER is a duplicate of XML_BORDER + { XML_NAMESPACE_DRAW, XML_BORDER, XML_TOK_GRADIENT_BORDER, }, XML_TOKEN_MAP_END }; @@ -270,7 +268,7 @@ void XMLGradientStyleExport::exportXML( // Border ::sax::Converter::convertPercent( aOut, aGradient.Border ); aStrValue = aOut.makeStringAndClear(); - rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GRADIENT_BORDER, aStrValue ); + rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_BORDER, aStrValue ); // Do Write SvXMLElementExport aElem( rExport, XML_NAMESPACE_DRAW, XML_GRADIENT, diff --git a/xmloff/source/style/HatchStyle.cxx b/xmloff/source/style/HatchStyle.cxx index a4f393adf7e2..1e0bd56d59e0 100644 --- a/xmloff/source/style/HatchStyle.cxx +++ b/xmloff/source/style/HatchStyle.cxx @@ -56,8 +56,8 @@ enum SvXMLTokenMapAttrs SvXMLEnumMapEntry<drawing::HatchStyle> const pXML_HatchStyle_Enum[] = { - { XML_HATCHSTYLE_SINGLE, drawing::HatchStyle_SINGLE }, - { XML_HATCHSTYLE_DOUBLE, drawing::HatchStyle_DOUBLE }, + { XML_SINGLE, drawing::HatchStyle_SINGLE }, + { XML_DOUBLE, drawing::HatchStyle_DOUBLE }, { XML_HATCHSTYLE_TRIPLE, drawing::HatchStyle_TRIPLE }, { XML_TOKEN_INVALID, drawing::HatchStyle(0) } }; @@ -84,9 +84,7 @@ void XMLHatchStyleImport::importXML( { XML_NAMESPACE_DRAW, XML_DISPLAY_NAME, XML_TOK_HATCH_DISPLAY_NAME }, { XML_NAMESPACE_DRAW, XML_STYLE, XML_TOK_HATCH_STYLE }, { XML_NAMESPACE_DRAW, XML_COLOR, XML_TOK_HATCH_COLOR }, - { XML_NAMESPACE_DRAW, XML_HATCH_DISTANCE, XML_TOK_HATCH_DISTANCE, - XML_ELEMENT( DRAW, XML_DISTANCE ) }, - // XML_HATCH_DISTANCE is a duplicate of XML_DISTANCE + { XML_NAMESPACE_DRAW, XML_DISTANCE, XML_TOK_HATCH_DISTANCE }, { XML_NAMESPACE_DRAW, XML_ROTATION, XML_TOK_HATCH_ROTATION }, XML_TOKEN_MAP_END }; @@ -200,7 +198,7 @@ void XMLHatchStyleExport::exportXML( // Distance rUnitConverter.convertMeasureToXML( aOut, aHatch.Distance ); aStrValue = aOut.makeStringAndClear(); - rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HATCH_DISTANCE, aStrValue ); + rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DISTANCE, aStrValue ); // Angle rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ROTATION, OUString::number(aHatch.Angle) ); diff --git a/xmloff/source/style/TransGradientStyle.cxx b/xmloff/source/style/TransGradientStyle.cxx index fd20d3fc938f..0dce37fcae3e 100644 --- a/xmloff/source/style/TransGradientStyle.cxx +++ b/xmloff/source/style/TransGradientStyle.cxx @@ -58,7 +58,7 @@ enum SvXMLTokenMapAttrs SvXMLEnumMapEntry<awt::GradientStyle> const pXML_GradientStyle_Enum[] = { - { XML_GRADIENTSTYLE_LINEAR, awt::GradientStyle_LINEAR }, + { XML_LINEAR, awt::GradientStyle_LINEAR }, { XML_GRADIENTSTYLE_AXIAL, awt::GradientStyle_AXIAL }, { XML_GRADIENTSTYLE_RADIAL, awt::GradientStyle_RADIAL }, { XML_GRADIENTSTYLE_ELLIPSOID, awt::GradientStyle_ELLIPTICAL }, @@ -103,9 +103,7 @@ void XMLTransGradientStyleImport::importXML( { XML_NAMESPACE_DRAW, XML_START, XML_TOK_GRADIENT_START }, { XML_NAMESPACE_DRAW, XML_END, XML_TOK_GRADIENT_END }, { XML_NAMESPACE_DRAW, XML_GRADIENT_ANGLE, XML_TOK_GRADIENT_ANGLE }, - { XML_NAMESPACE_DRAW, XML_GRADIENT_BORDER, XML_TOK_GRADIENT_BORDER, - XML_ELEMENT( DRAW, XML_BORDER ) }, - // XML_GRADIENT_BORDER is a duplicate of XML_BORDER + { XML_NAMESPACE_DRAW, XML_BORDER, XML_TOK_GRADIENT_BORDER, }, XML_TOKEN_MAP_END }; @@ -275,7 +273,7 @@ void XMLTransGradientStyleExport::exportXML( // Border ::sax::Converter::convertPercent( aOut, aGradient.Border ); aStrValue = aOut.makeStringAndClear(); - rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GRADIENT_BORDER, aStrValue ); + rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_BORDER, aStrValue ); // Do Write SvXMLElementExport rElem( rExport, diff --git a/xmloff/source/style/XMLBackgroundImageContext.cxx b/xmloff/source/style/XMLBackgroundImageContext.cxx index a2c48e00a5b8..95772ae0e42f 100644 --- a/xmloff/source/style/XMLBackgroundImageContext.cxx +++ b/xmloff/source/style/XMLBackgroundImageContext.cxx @@ -288,9 +288,9 @@ void XMLBackgroundImageContext::ProcessAttrs( GraphicLocation nPos = GraphicLocation_NONE; static const SvXMLEnumMapEntry<GraphicLocation> psXML_BrushRepeat[] = { - { XML_BACKGROUND_REPEAT, GraphicLocation_TILED }, + { XML_REPEAT, GraphicLocation_TILED }, { XML_BACKGROUND_NO_REPEAT, GraphicLocation_MIDDLE_MIDDLE }, - { XML_BACKGROUND_STRETCH, GraphicLocation_AREA }, + { XML_STRETCH, GraphicLocation_AREA }, { XML_TOKEN_INVALID, GraphicLocation(0) } }; if( SvXMLUnitConverter::convertEnum( nPos, rValue, diff --git a/xmloff/source/style/XMLBackgroundImageExport.cxx b/xmloff/source/style/XMLBackgroundImageExport.cxx index 6550943bc011..88fd2e620d0d 100644 --- a/xmloff/source/style/XMLBackgroundImageExport.cxx +++ b/xmloff/source/style/XMLBackgroundImageExport.cxx @@ -124,7 +124,7 @@ void XMLBackgroundImageExport::exportXML( const Any& rGraphicAny, if( GraphicLocation_AREA == ePos ) { - aOut.append( GetXMLToken(XML_BACKGROUND_STRETCH) ); + aOut.append( GetXMLToken(XML_STRETCH) ); } else if( GraphicLocation_NONE != ePos && GraphicLocation_TILED != ePos ) { diff --git a/xmloff/source/style/csmaphdl.cxx b/xmloff/source/style/csmaphdl.cxx index 7c90b9f0a946..f113e00a716f 100644 --- a/xmloff/source/style/csmaphdl.cxx +++ b/xmloff/source/style/csmaphdl.cxx @@ -86,7 +86,7 @@ bool XMLCaseMapVariantHdl::importXML( const OUString& rStrImpValue, uno::Any& rV rValue <<= sal_Int16(style::CaseMap::SMALLCAPS); bRet = true; } - else if( IsXMLToken( rStrImpValue, XML_CASEMAP_NORMAL ) ) + else if( IsXMLToken( rStrImpValue, XML_NORMAL ) ) { rValue <<= sal_Int16(style::CaseMap::NONE); bRet = true; @@ -105,7 +105,7 @@ bool XMLCaseMapVariantHdl::exportXML( OUString& rStrExpValue, const uno::Any& rV switch( nValue ) { case style::CaseMap::NONE: - aOut.append( GetXMLToken(XML_CASEMAP_NORMAL) ); + aOut.append( GetXMLToken(XML_NORMAL) ); break; case style::CaseMap::SMALLCAPS: aOut.append( GetXMLToken(XML_CASEMAP_SMALL_CAPS) ); diff --git a/xmloff/source/style/kernihdl.cxx b/xmloff/source/style/kernihdl.cxx index ddf79150cdf5..cee24fe20e06 100644 --- a/xmloff/source/style/kernihdl.cxx +++ b/xmloff/source/style/kernihdl.cxx @@ -41,7 +41,7 @@ bool XMLKerningPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, co bool bRet = true; sal_Int32 nKerning = 0; - if( ! IsXMLToken( rStrImpValue, XML_KERNING_NORMAL ) ) + if( ! IsXMLToken( rStrImpValue, XML_NORMAL ) ) { bRet = rUnitConverter.convertMeasureToCore( nKerning, rStrImpValue ); } @@ -61,7 +61,7 @@ bool XMLKerningPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, co OUStringBuffer aOut; if( nValue == 0 ) - aOut.append( GetXMLToken(XML_KERNING_NORMAL) ); + aOut.append( GetXMLToken(XML_NORMAL) ); else { rUnitConverter.convertMeasureToXML( aOut, nValue ); diff --git a/xmloff/source/style/lspachdl.cxx b/xmloff/source/style/lspachdl.cxx index 29ad95b81d75..21a3e7dac810 100644 --- a/xmloff/source/style/lspachdl.cxx +++ b/xmloff/source/style/lspachdl.cxx @@ -28,7 +28,7 @@ using namespace ::com::sun::star; using ::xmloff::token::IsXMLToken; -using ::xmloff::token::XML_CASEMAP_NORMAL; +using ::xmloff::token::XML_NORMAL; @@ -50,7 +50,7 @@ bool XMLLineHeightHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue return false; aLSp.Height = sal::static_int_cast< sal_Int16 >(nTemp); } - else if( IsXMLToken( rStrImpValue, XML_CASEMAP_NORMAL) ) + else if( IsXMLToken( rStrImpValue, XML_NORMAL) ) { aLSp.Mode = style::LineSpacingMode::PROP; aLSp.Height = 100; diff --git a/xmloff/source/style/opaquhdl.cxx b/xmloff/source/style/opaquhdl.cxx index f662794b4c49..c710d67c674e 100644 --- a/xmloff/source/style/opaquhdl.cxx +++ b/xmloff/source/style/opaquhdl.cxx @@ -34,7 +34,7 @@ XMLOpaquePropHdl::~XMLOpaquePropHdl() bool XMLOpaquePropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const { - bool bValue = IsXMLToken( rStrImpValue, XML_OPAQUE_FOREGROUND ); + bool bValue = IsXMLToken( rStrImpValue, XML_FOREGROUND ); rValue <<= bValue; return true; @@ -48,9 +48,9 @@ bool XMLOpaquePropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, con if (rValue >>= bValue) { if( bValue ) - rStrExpValue = GetXMLToken( XML_OPAQUE_FOREGROUND ); + rStrExpValue = GetXMLToken( XML_FOREGROUND ); else - rStrExpValue = GetXMLToken( XML_OPAQUE_BACKGROUND ); + rStrExpValue = GetXMLToken( XML_BACKGROUND ); bRet = true; } diff --git a/xmloff/source/style/postuhdl.cxx b/xmloff/source/style/postuhdl.cxx index ed4bec56aec4..5e0d5bfbc631 100644 --- a/xmloff/source/style/postuhdl.cxx +++ b/xmloff/source/style/postuhdl.cxx @@ -32,8 +32,8 @@ using namespace ::xmloff::token; SvXMLEnumMapEntry<FontItalic> const aPostureGenericMapping[] = { - { XML_POSTURE_NORMAL, ITALIC_NONE }, - { XML_POSTURE_ITALIC, ITALIC_NORMAL }, + { XML_NORMAL, ITALIC_NONE }, + { XML_ITALIC, ITALIC_NORMAL }, { XML_POSTURE_OBLIQUE, ITALIC_OBLIQUE }, { XML_TOKEN_INVALID, FontItalic(0) } }; diff --git a/xmloff/source/style/weighhdl.cxx b/xmloff/source/style/weighhdl.cxx index bc81d3ca3522..31ca901d8379 100644 --- a/xmloff/source/style/weighhdl.cxx +++ b/xmloff/source/style/weighhdl.cxx @@ -68,12 +68,12 @@ bool XMLFontWeightPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, bool bRet = false; sal_uInt16 nWeight = 0; - if( IsXMLToken( rStrImpValue, XML_WEIGHT_NORMAL ) ) + if( IsXMLToken( rStrImpValue, XML_NORMAL ) ) { nWeight = 400; bRet = true; } - else if( IsXMLToken( rStrImpValue, XML_WEIGHT_BOLD ) ) + else if( IsXMLToken( rStrImpValue, XML_BOLD ) ) { nWeight = 700; bRet = true; @@ -141,9 +141,9 @@ bool XMLFontWeightPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, } if( 400 == nWeight ) - rStrExpValue = GetXMLToken(XML_WEIGHT_NORMAL); + rStrExpValue = GetXMLToken(XML_NORMAL); else if( 700 == nWeight ) - rStrExpValue = GetXMLToken(XML_WEIGHT_BOLD); + rStrExpValue = GetXMLToken(XML_BOLD); else rStrExpValue = OUString::number( nWeight ); } diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt index 78a0adbf9d85..f9411a191330 100644 --- a/xmloff/source/token/tokens.txt +++ b/xmloff/source/token/tokens.txt @@ -86,15 +86,13 @@ calcext N_CALC_EXT_DUMMY loext N_LO_EXT_DUMMY -UNIT_MM_DUMMY +N_FIELD_DUMMY +NP_FIELD_DUMMY m -UNIT_KM_DUMMY -UNIT_CM_DUMMY +cm pt pc ft -UNIT_MILES_DUMMY -UNIT_INCH_DUMMY 1 10 2 @@ -217,8 +215,6 @@ background background-color background-image no-repeat -BACKGROUND_REPEAT_DUMMY -BACKGROUND_STRETCH_DUMMY bar base64Binary base-cell-address @@ -303,7 +299,6 @@ caption-sequence-name case-sensitive capitalize lowercase -CASEMAP_NORMAL_DUMMY small-caps uppercase categories @@ -350,7 +345,6 @@ clockwise close close-horizontal close-vertical -cm cn code codebase @@ -369,7 +363,6 @@ column-sep column-width columnalign columns -COLUMNSPLIT_AUTO_DUMMY avoid combine-entries combine-entries-with-dash @@ -857,13 +850,11 @@ geq gouraud gradient angle -GRADIENT_BORDER_DUMMY gradient-step-count gradient-style gradient-table axial ellipsoid -GRADIENTSTYLE_LINEAR_DUMMY radial rectangular square @@ -885,11 +876,7 @@ h hanging has-persistent-data hatch -HATCH_DISTANCE_DUMMY -HATCH_STYLE_DUMMY hatch-table -HATCHSTYLE_DOUBLE_DUMMY -HATCHSTYLE_SINGLE_DUMMY triple header header-first @@ -1009,7 +996,6 @@ justified justify justify-single-word keep-with-next -KERNING_NORMAL_DUMMY key key1 key2 @@ -1293,8 +1279,6 @@ on-update-keep-size on-update-keep-styles online online-text -OPAQUE_BACKGROUND_DUMMY -OPAQUE_FOREGROUND_DUMMY open open-horizontal open-vertical @@ -1391,25 +1375,15 @@ position-left position-right position-top positive-color -POSTURE_ITALIC_DUMMY -POSTURE_NORMAL_DUMMY oblique power precision-as-shown prefix presentation -PRESENTATION_CHART_DUMMY -PRESENTATION_GRAPHIC_DUMMY -PRESENTATION_NOTES_DUMMY -PRESENTATION_OBJECT_DUMMY orgchart outline -PRESENTATION_PAGE_DUMMY presentation-page-layout presentation-page-layout-name -PRESENTATION_SUBTITLE_DUMMY -PRESENTATION_TABLE_DUMMY -PRESENTATION_TITLE_DUMMY previous previous-page print @@ -1427,9 +1401,6 @@ product projection properties protect -PROTECT_CONTENT_DUMMY -PROTECT_POSITION_DUMMY -PROTECT_SIZE_DUMMY protected protection-key protection-key-digest-algorithm @@ -1991,8 +1962,6 @@ wavyline-from-left wavyline-from-right wavyline-from-top week-of-year -WEIGHT_BOLD_DUMMY -WEIGHT_NORMAL_DUMMY white whole-page widows @@ -3025,8 +2994,6 @@ ignore fieldmark fieldmark-start fieldmark-end -N_FIELD_DUMMY -NP_FIELD_DUMMY image-scale isotropic anisotropic diff --git a/xmloff/source/transform/StyleOASISTContext.cxx b/xmloff/source/transform/StyleOASISTContext.cxx index e158c6c1e0d3..d376f226ebd7 100644 --- a/xmloff/source/transform/StyleOASISTContext.cxx +++ b/xmloff/source/transform/StyleOASISTContext.cxx @@ -401,7 +401,7 @@ void XMLPropertiesTContext_Impl::StartElement( GetXMLToken( IsXMLToken( rAttrValue, XML_ALWAYS ) ? XML_COLUMNSPLIT_AVOID - : XML_COLUMNSPLIT_AUTO ) ); + : XML_AUTO ) ); break; case XML_OPTACTION_CONTROL_TEXT_ALIGN: diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx index 40de2304f94c..2114b3420be0 100644 --- a/xmloff/source/transform/TransformerBase.cxx +++ b/xmloff/source/transform/TransformerBase.cxx @@ -906,7 +906,7 @@ bool XMLTransformerBase::ReplaceInchWithIn( OUString& rValue ) if( 'h'==c || 'H'==c ) { rValue = rValue.replaceAt( nPos, - 4, GetXMLToken(XML_UNIT_INCH) ); + 4, GetXMLToken(XML_IN) ); nPos += 2; bRet = true; continue; |