[Libreoffice-commits] core.git: include/xmloff sc/source xmloff/source

Mohammed Abdul Azeem azeemmysore at gmail.com
Tue Jun 27 15:51:56 UTC 2017


 include/xmloff/xmlimp.hxx                  |    1 
 sc/source/filter/xml/xmlbodyi.cxx          |    8 +----
 sc/source/filter/xml/xmlcelli.cxx          |   36 ++++++++++-------------
 sc/source/filter/xml/xmlexternaltabi.cxx   |    8 ++---
 sc/source/filter/xml/xmlimprt.cxx          |   15 ++++-----
 sc/source/filter/xml/xmlrowi.cxx           |   35 ++++++++++------------
 sc/source/filter/xml/xmltabi.cxx           |   45 ++++++++++++++---------------
 xmloff/source/core/xmlimp.cxx              |    4 +-
 xmloff/source/style/GradientStyle.cxx      |    2 -
 xmloff/source/style/HatchStyle.cxx         |    2 -
 xmloff/source/style/TransGradientStyle.cxx |    2 -
 11 files changed, 75 insertions(+), 83 deletions(-)

New commits:
commit c44d9f9e627eb074367cc47ae4742aedea44c370
Author: Mohammed Abdul Azeem <azeemmysore at gmail.com>
Date:   Tue Jun 27 00:46:25 2017 +0530

    Using fast tokens directly:
    
    Replacing integer-to-integer mapped tokens with
    fast Tokens direcly for branching.
    Adding a macro XML_ELEMENT that combines namespace
    and element tokens.
    
    Change-Id: I8701c8af9607392843460fe726bffb6556cf9b33
    Reviewed-on: https://gerrit.libreoffice.org/39275
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 8ac87d820c88..1521dd93b0cd 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -64,6 +64,7 @@
 #include <memory>
 
 #define NAMESPACE_TOKEN( prefixToken ) ( ( sal_Int32( prefixToken + 1 ) ) << NMSP_SHIFT )
+#define XML_ELEMENT( prefix, name ) ( NAMESPACE_TOKEN( XML_NAMESPACE_##prefix ) | name )
 
 const size_t NMSP_SHIFT = 16;
 const sal_Int32 TOKEN_MASK = 0xffff;
diff --git a/sc/source/filter/xml/xmlbodyi.cxx b/sc/source/filter/xml/xmlbodyi.cxx
index d55049298f9d..2a21d52899f9 100644
--- a/sc/source/filter/xml/xmlbodyi.cxx
+++ b/sc/source/filter/xml/xmlbodyi.cxx
@@ -111,8 +111,7 @@ ScXMLBodyContext::ScXMLBodyContext( ScXMLImport& rImport,
             else if (  nLocalToken == XML_PROTECTION_KEY_DIGEST_ALGORITHM_2 )
                 meHash2 = ScPassHashHelper::getHashTypeFromURI( it.toString() );
         }
-        else if ( nToken == ( NAMESPACE_TOKEN( XML_NAMESPACE_LO_EXT ) |
-                                        XML_PROTECTION_KEY_DIGEST_ALGORITHM_2 ) )
+        else if ( nToken == XML_ELEMENT( LO_EXT, XML_PROTECTION_KEY_DIGEST_ALGORITHM_2 ) )
         {
             meHash2 = ScPassHashHelper::getHashTypeFromURI( it.toString() );
         }
@@ -205,10 +204,9 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
 
     SvXMLImportContext *pContext = nullptr;
 
-    const SvXMLTokenMap& rTokenMap = GetScImport().GetBodyElemTokenMap();
-    switch( rTokenMap.Get( nElement ) )
+    switch( nElement )
     {
-    case XML_TOK_BODY_TABLE:
+    case XML_ELEMENT( TABLE, XML_TABLE ):
         if (GetScImport().GetTables().GetCurrentSheet() >= MAXTAB)
         {
             GetScImport().SetRangeOverflowType(SCWARN_IMPORT_SHEET_OVERFLOW);
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 56cbe3ba9462..e6224c11f842 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -158,7 +158,6 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
 
     std::unique_ptr<OUString> xStyleName;
     std::unique_ptr<OUString> xCurrencySymbol;
-    const SvXMLTokenMap& rTokenMap = rImport.GetTableRowCellAttrTokenMap();
     if( xAttrList.is() )
     {
         sax_fastparser::FastAttributeList *pAttribList;
@@ -167,43 +166,42 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
 
         for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
         {
-            sal_uInt16 nToken = rTokenMap.Get( it.getToken() );
-            switch ( nToken )
+            switch ( it.getToken() )
             {
-                case XML_TOK_TABLE_ROW_CELL_ATTR_STYLE_NAME:
+                case XML_ELEMENT( TABLE, XML_STYLE_NAME ):
                     xStyleName.reset( new OUString( it.toString() ) );
                     mbHasStyle = true;
                 break;
-                case XML_TOK_TABLE_ROW_CELL_ATTR_CONTENT_VALIDATION_NAME:
+                case XML_ELEMENT( TABLE, XML_CONTENT_VALIDATION_NAME ):
                     OSL_ENSURE(!maContentValidationName, "here should be only one Validation Name");
                     if (!it.isEmpty())
                         maContentValidationName.reset(it.toString());
                 break;
-                case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_ROWS:
+                case XML_ELEMENT( TABLE, XML_NUMBER_ROWS_SPANNED ):
                     bIsMerged = true;
                     nMergedRows = static_cast<SCROW>(it.toInt32());
                 break;
-                case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_COLS:
+                case XML_ELEMENT( TABLE, XML_NUMBER_COLUMNS_SPANNED ):
                     bIsMerged = true;
                     nMergedCols = static_cast<SCCOL>(it.toInt32());
                 break;
-                case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_COLS:
+                case XML_ELEMENT( TABLE, XML_NUMBER_MATRIX_COLUMNS_SPANNED ):
                     bIsMatrix = true;
                     nMatrixCols = static_cast<SCCOL>(it.toInt32());
                 break;
-                case XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_ROWS:
+                case XML_ELEMENT( TABLE, XML_NUMBER_MATRIX_ROWS_SPANNED ):
                     bIsMatrix = true;
                     nMatrixRows = static_cast<SCROW>(it.toInt32());
                 break;
-                case XML_TOK_TABLE_ROW_CELL_ATTR_REPEATED:
+                case XML_ELEMENT( TABLE, XML_NUMBER_COLUMNS_REPEATED ):
                     nColsRepeated = static_cast<SCCOL>(std::min<sal_Int32>( MAXCOLCOUNT,
                                 std::max( it.toInt32(), static_cast<sal_Int32>(1) ) ));
                 break;
-                case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE_TYPE:
+                case XML_ELEMENT( OFFICE, XML_VALUE_TYPE ):
                     nCellType = GetScImport().GetCellType(it.toString());
                     bIsEmpty = false;
                 break;
-                case XML_TOK_TABLE_ROW_CELL_ATTR_NEW_VALUE_TYPE:
+                case XML_ELEMENT( CALC_EXT, XML_VALUE_TYPE ):
                     if(it.isString( "error" ) )
                         mbErrorValue = true;
                     else
@@ -211,7 +209,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
                     bIsEmpty = false;
                     mbNewValueType = true;
                 break;
-                case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE:
+                case XML_ELEMENT( OFFICE, XML_VALUE ):
                 {
                     if (!it.isEmpty())
                     {
@@ -226,7 +224,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
                     }
                 }
                 break;
-                case XML_TOK_TABLE_ROW_CELL_ATTR_DATE_VALUE:
+                case XML_ELEMENT( OFFICE, XML_DATE_VALUE ):
                 {
                     if (!it.isEmpty() && rXMLImport.SetNullDateOnUnitConverter())
                     {
@@ -235,7 +233,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
                     }
                 }
                 break;
-                case XML_TOK_TABLE_ROW_CELL_ATTR_TIME_VALUE:
+                case XML_ELEMENT( OFFICE, XML_TIME_VALUE ):
                 {
                     if (!it.isEmpty())
                     {
@@ -244,7 +242,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
                     }
                 }
                 break;
-                case XML_TOK_TABLE_ROW_CELL_ATTR_STRING_VALUE:
+                case XML_ELEMENT( OFFICE, XML_STRING_VALUE ):
                 {
                     if (!it.isEmpty())
                     {
@@ -254,7 +252,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
                     }
                 }
                 break;
-                case XML_TOK_TABLE_ROW_CELL_ATTR_BOOLEAN_VALUE:
+                case XML_ELEMENT( OFFICE , XML_BOOLEAN_VALUE ):
                 {
                     if (!it.isEmpty())
                     {
@@ -268,7 +266,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
                     }
                 }
                 break;
-                case XML_TOK_TABLE_ROW_CELL_ATTR_FORMULA:
+                case XML_ELEMENT( TABLE, XML_FORMULA ):
                 {
                     if (!it.isEmpty())
                     {
@@ -279,7 +277,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
                     }
                 }
                 break;
-                case XML_TOK_TABLE_ROW_CELL_ATTR_CURRENCY:
+                case XML_ELEMENT( OFFICE, XML_CURRENCY ):
                     xCurrencySymbol.reset( new OUString( it.toString() ) );
                 break;
                 default:
diff --git a/sc/source/filter/xml/xmlexternaltabi.cxx b/sc/source/filter/xml/xmlexternaltabi.cxx
index 964b13a4410d..e8c0ef5db247 100644
--- a/sc/source/filter/xml/xmlexternaltabi.cxx
+++ b/sc/source/filter/xml/xmlexternaltabi.cxx
@@ -57,13 +57,13 @@ ScXMLExternalRefTabSourceContext::ScXMLExternalRefTabSourceContext(
         for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
         {
             sal_Int32 nAttrToken = it.getToken();
-            if ( nAttrToken == ( NAMESPACE_TOKEN( XML_NAMESPACE_XLINK ) | XML_HREF ) )
+            if ( nAttrToken == XML_ELEMENT( XLINK, XML_HREF ) )
                 maRelativeUrl = it.toString();
-            else if ( nAttrToken == ( NAMESPACE_TOKEN( XML_NAMESPACE_TABLE ) | XML_TABLE_NAME ) )
+            else if ( nAttrToken == XML_ELEMENT( TABLE, XML_TABLE_NAME ) )
                 maTableName = it.toString();
-            else if ( nAttrToken == ( NAMESPACE_TOKEN( XML_NAMESPACE_TABLE ) | XML_FILTER_NAME ) )
+            else if ( nAttrToken == XML_ELEMENT( TABLE, XML_FILTER_NAME ) )
                 maFilterName = it.toString();
-            else if ( nAttrToken == ( NAMESPACE_TOKEN( XML_NAMESPACE_TABLE ) | XML_FILTER_OPTIONS ) )
+            else if ( nAttrToken == XML_ELEMENT( TABLE, XML_FILTER_OPTIONS ) )
                 maFilterOptions = it.toString();
         }
     }
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index c777658a65cf..badfa59d22ad 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -332,7 +332,7 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
     ScXMLFlatDocContext_Impl::createFastChildContext( sal_Int32 nElement,
     const uno::Reference< xml::sax::XFastAttributeList > & xAttrList )
 {
-    if ( nElement != ( NAMESPACE_TOKEN( XML_NAMESPACE_OFFICE ) | XML_META ) )
+    if ( nElement != XML_ELEMENT( OFFICE, XML_META ) )
         return ScXMLDocContext_Impl::createFastChildContext( nElement, xAttrList );
     else
         return new SvXMLImportContext( GetImport() );
@@ -422,10 +422,9 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
 {
     SvXMLImportContext *pContext(nullptr);
 
-    const SvXMLTokenMap& rTokenMap(GetScImport().GetDocElemTokenMap());
-    switch( rTokenMap.Get( nElement ) )
+    switch( nElement )
     {
-        case XML_TOK_DOC_BODY:
+        case XML_ELEMENT( OFFICE, XML_BODY ):
         if (GetScImport().getImportFlags() & SvXMLImportFlags::CONTENT)
             pContext = new ScXMLBodyContext_Impl( GetScImport() );
         break;
@@ -2046,13 +2045,13 @@ SvXMLImportContext *ScXMLImport::CreateFastContext( sal_Int32 nElement,
 
     switch( nElement )
     {
-    case ( NAMESPACE_TOKEN( XML_NAMESPACE_OFFICE ) | XML_DOCUMENT_STYLES ):
-    case ( NAMESPACE_TOKEN( XML_NAMESPACE_OFFICE ) | XML_DOCUMENT_CONTENT ):
-    case ( NAMESPACE_TOKEN( XML_NAMESPACE_OFFICE ) | XML_DOCUMENT_SETTINGS ):
+    case XML_ELEMENT( OFFICE, XML_DOCUMENT_STYLES ):
+    case XML_ELEMENT( OFFICE, XML_DOCUMENT_CONTENT ):
+    case XML_ELEMENT( OFFICE, XML_DOCUMENT_SETTINGS ):
         pContext = new ScXMLDocContext_Impl( *this );
         break;
 
-    case ( NAMESPACE_TOKEN( XML_NAMESPACE_OFFICE ) | XML_DOCUMENT ):
+    case XML_ELEMENT( OFFICE, XML_DOCUMENT ):
     {
         uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
             GetModel(), uno::UNO_QUERY_THROW);
diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx
index f6eb8c28c3e8..d2ce385edaf9 100644
--- a/sc/source/filter/xml/xmlrowi.cxx
+++ b/sc/source/filter/xml/xmlrowi.cxx
@@ -51,7 +51,6 @@ ScXMLTableRowContext::ScXMLTableRowContext( ScXMLImport& rImport,
     bHasCell(false)
 {
     OUString sCellStyleName;
-    const SvXMLTokenMap& rAttrTokenMap(GetScImport().GetTableRowAttrTokenMap());
     if ( xAttrList.is() )
     {
         sax_fastparser::FastAttributeList *pAttribList;
@@ -60,30 +59,30 @@ ScXMLTableRowContext::ScXMLTableRowContext( ScXMLImport& rImport,
 
         for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
         {
-            switch( rAttrTokenMap.Get( it.getToken() ) )
+            switch( it.getToken() )
             {
-                case XML_TOK_TABLE_ROW_ATTR_STYLE_NAME:
+                case XML_ELEMENT( TABLE, XML_STYLE_NAME ):
                 {
                     sStyleName = it.toString();
                 }
                 break;
-                case XML_TOK_TABLE_ROW_ATTR_VISIBILITY:
+                case XML_ELEMENT( TABLE, XML_VISIBILITY ):
                 {
                     sVisibility = it.toString();
                 }
                 break;
-                case XML_TOK_TABLE_ROW_ATTR_REPEATED:
+                case XML_ELEMENT( TABLE, XML_NUMBER_ROWS_REPEATED ):
                 {
                     nRepeatedRows = std::max( it.toInt32(), (sal_Int32) 1 );
                     nRepeatedRows = std::min( nRepeatedRows, MAXROWCOUNT );
                 }
                 break;
-                case XML_TOK_TABLE_ROW_ATTR_DEFAULT_CELL_STYLE_NAME:
+                case XML_ELEMENT( TABLE, XML_DEFAULT_CELL_STYLE_NAME ):
                 {
                     sCellStyleName = it.toString();
                 }
                 break;
-                /*case XML_TOK_TABLE_ROW_ATTR_USE_OPTIMAL_HEIGHT:
+                /*case XML_ELEMENT( TABLE, XML_USE_OPTIMAL_HEIGHT ):
                 {
                     sOptimalHeight = it.toString();
                 }
@@ -106,10 +105,9 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
 {
     SvXMLImportContext *pContext(nullptr);
 
-    const SvXMLTokenMap& rTokenMap(GetScImport().GetTableRowElemTokenMap());
-    switch( rTokenMap.Get( nElement ) )
+    switch( nElement )
     {
-    case XML_TOK_TABLE_ROW_CELL:
+    case XML_ELEMENT( TABLE, XML_TABLE_CELL ):
 //      if( IsInsertCellPossible() )
         {
             bHasCell = true;
@@ -119,7 +117,7 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
                                                       );
         }
         break;
-    case XML_TOK_TABLE_ROW_COVERED_CELL:
+    case XML_ELEMENT( TABLE, XML_COVERED_TABLE_CELL ):
 //      if( IsInsertCellPossible() )
         {
             bHasCell = true;
@@ -231,10 +229,10 @@ ScXMLTableRowsContext::ScXMLTableRowsContext( ScXMLImport& rImport,
         nGroupStartRow = rImport.GetTables().GetCurrentRow();
         ++nGroupStartRow;
         if ( xAttrList.is() &&
-            xAttrList->hasAttribute( NAMESPACE_TOKEN( XML_NAMESPACE_TABLE ) | XML_DISPLAY ) )
+            xAttrList->hasAttribute( XML_ELEMENT( TABLE, XML_DISPLAY ) ) )
         {
             bGroupDisplay = IsXMLToken( xAttrList->getValue(
-                                NAMESPACE_TOKEN( XML_NAMESPACE_TABLE ) | XML_DISPLAY ), XML_TRUE );
+                                XML_ELEMENT( TABLE, XML_DISPLAY ) ), XML_TRUE );
         }
     }
 }
@@ -249,22 +247,21 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
 {
     SvXMLImportContext *pContext(nullptr);
 
-    const SvXMLTokenMap& rTokenMap(GetScImport().GetTableRowsElemTokenMap());
-    switch( rTokenMap.Get( nElement ) )
+    switch( nElement )
     {
-    case XML_TOK_TABLE_ROWS_ROW_GROUP:
+    case XML_ELEMENT( TABLE, XML_TABLE_ROW_GROUP ):
         pContext = new ScXMLTableRowsContext( GetScImport(), xAttrList,
                                                    false, true );
         break;
-    case XML_TOK_TABLE_ROWS_HEADER_ROWS:
+    case XML_ELEMENT( TABLE, XML_TABLE_HEADER_ROWS ):
         pContext = new ScXMLTableRowsContext( GetScImport(), xAttrList,
                                                    true, false );
         break;
-    case XML_TOK_TABLE_ROWS_ROWS:
+    case XML_ELEMENT( TABLE, XML_TABLE_ROWS ):
         pContext = new ScXMLTableRowsContext( GetScImport(), xAttrList,
                                                    false, false );
         break;
-    case XML_TOK_TABLE_ROWS_ROW:
+    case XML_ELEMENT( TABLE, XML_TABLE_ROW ):
         pContext = new ScXMLTableRowContext( GetScImport(), xAttrList );
         break;
     }
diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx
index 84caa9b81a5f..6958a6a6c4c9 100644
--- a/sc/source/filter/xml/xmltabi.cxx
+++ b/sc/source/filter/xml/xmltabi.cxx
@@ -39,6 +39,7 @@
 #include <xmloff/xmltkmap.hxx>
 #include <xmloff/nmspmap.hxx>
 #include <xmloff/xmltoken.hxx>
+#include <xmloff/xmlnmspe.hxx>
 #include <xmloff/XMLEventsImportContext.hxx>
 
 #include <tools/urlobj.hxx>
@@ -149,33 +150,33 @@ ScXMLTableContext::ScXMLTableContext( ScXMLImport& rImport,
         assert( dynamic_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() ) != nullptr );
         pAttribList = static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
 
-        const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetTableAttrTokenMap();
         for ( auto it = pAttribList->begin(); it != pAttribList->end(); ++it)
         {
-            switch( rAttrTokenMap.Get( it.getToken() ) )
+            switch( it.getToken() )
             {
-                case XML_TOK_TABLE_NAME:
+                case XML_ELEMENT( TABLE, XML_NAME ):
                         sName = it.toString();
                     break;
-                case XML_TOK_TABLE_STYLE_NAME:
+                case XML_ELEMENT( TABLE, XML_STYLE_NAME ):
                         sStyleName = it.toString();
                     break;
-                case XML_TOK_TABLE_PROTECTED:
+                case XML_ELEMENT( TABLE, XML_PROTECTED ):
                     aProtectData.mbProtected = IsXMLToken( it.toCString(), XML_TRUE );
                 break;
-                case XML_TOK_TABLE_PRINT_RANGES:
+                case XML_ELEMENT( TABLE, XML_PRINT_RANGES ):
                         sPrintRanges = it.toString();
                     break;
-                case XML_TOK_TABLE_PASSWORD:
+                case XML_ELEMENT( TABLE, XML_PROTECTION_KEY ):
                     aProtectData.maPassword = it.toString();
                 break;
-                case XML_TOK_TABLE_PASSHASH:
+                case XML_ELEMENT( TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM ):
                     aProtectData.meHash1 = ScPassHashHelper::getHashTypeFromURI( it.toString() );
                 break;
-                case XML_TOK_TABLE_PASSHASH_2:
+                case XML_ELEMENT( TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM_2 ):
+                case XML_ELEMENT( LO_EXT, XML_PROTECTION_KEY_DIGEST_ALGORITHM_2 ):
                     aProtectData.meHash2 = ScPassHashHelper::getHashTypeFromURI( it.toString() );
                 break;
-                case XML_TOK_TABLE_PRINT:
+                case XML_ELEMENT( TABLE, XML_PRINT ):
                     {
                         if (IsXMLToken( it.toCString(), XML_FALSE) )
                             bPrintEntireSheet = false;
@@ -300,24 +301,22 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
         ScXMLTableContext::createFastChildContext( sal_Int32 nElement,
         const uno::Reference< xml::sax::XFastAttributeList > & xAttrList )
 {
-    const SvXMLTokenMap& rTokenMap(GetScImport().GetTableElemTokenMap());
-    sal_uInt16 nToken = rTokenMap.Get( nElement );
     if (pExternalRefInfo.get())
     {
         // We only care about the table-row and table-source elements for
         // external cache data.
-        switch (nToken)
+        switch ( nElement )
         {
-            case XML_TOK_TABLE_ROW_GROUP:
-            case XML_TOK_TABLE_HEADER_ROWS:
-            case XML_TOK_TABLE_ROWS:
+            case XML_ELEMENT( TABLE, XML_TABLE_ROW_GROUP ):
+            case XML_ELEMENT( TABLE, XML_TABLE_HEADER_ROWS ):
+            case XML_ELEMENT( TABLE, XML_TABLE_ROWS ):
                 // #i101319# don't discard rows in groups or header (repeat range)
                 return new ScXMLExternalRefRowsContext(
                     GetScImport(), nElement, xAttrList, *pExternalRefInfo);
-            case XML_TOK_TABLE_ROW:
+            case XML_ELEMENT( TABLE, XML_TABLE_ROW ):
                 return new ScXMLExternalRefRowContext(
                     GetScImport(), nElement, xAttrList, *pExternalRefInfo);
-            case XML_TOK_TABLE_SOURCE:
+            case XML_ELEMENT( TABLE, XML_TABLE_SOURCE ):
                 return new ScXMLExternalRefTabSourceContext(
                     GetScImport(), nElement, xAttrList, *pExternalRefInfo);
             default:
@@ -328,21 +327,21 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
 
     SvXMLImportContext *pContext(nullptr);
 
-    switch (nToken)
+    switch ( nElement )
     {
-    case XML_TOK_TABLE_ROW_GROUP:
+    case XML_ELEMENT( TABLE, XML_TABLE_ROW_GROUP ):
         pContext = new ScXMLTableRowsContext( GetScImport(), xAttrList,
                                                    false, true );
         break;
-    case XML_TOK_TABLE_HEADER_ROWS:
+    case XML_ELEMENT( TABLE, XML_TABLE_HEADER_ROWS ):
         pContext = new ScXMLTableRowsContext( GetScImport(), xAttrList,
                                                    true, false );
         break;
-    case XML_TOK_TABLE_ROWS:
+    case XML_ELEMENT( TABLE, XML_TABLE_ROWS ):
         pContext = new ScXMLTableRowsContext( GetScImport(), xAttrList,
                                                    false, false );
         break;
-    case XML_TOK_TABLE_ROW:
+    case XML_ELEMENT( TABLE, XML_TABLE_ROW ):
             pContext = new ScXMLTableRowContext( GetScImport(),xAttrList );
         break;
     default:
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index efaa9bb3e5a8..b4e5698832ad 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -789,9 +789,9 @@ void SAL_CALL SvXMLImport::setDocumentLocator( const uno::Reference< xml::sax::X
 void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element,
     const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
 {
-    if ( Attribs.is() && Attribs->hasAttribute( NAMESPACE_TOKEN( XML_NAMESPACE_OFFICE ) | XML_VERSION ) )
+    if ( Attribs.is() && Attribs->hasAttribute( XML_ELEMENT( OFFICE, XML_VERSION ) ) )
     {
-        mpImpl->aODFVersion = Attribs->getValue( NAMESPACE_TOKEN( XML_NAMESPACE_OFFICE ) | XML_VERSION );
+        mpImpl->aODFVersion = Attribs->getValue( XML_ELEMENT( OFFICE, XML_VERSION ) );
 
         // the ODF version in content.xml and manifest.xml must be the same starting from ODF1.2
         if ( mpImpl->mStreamName == "content.xml" && !IsODFVersionConsistent( mpImpl->aODFVersion ) )
diff --git a/xmloff/source/style/GradientStyle.cxx b/xmloff/source/style/GradientStyle.cxx
index e11c4b1c6112..53ec6158763c 100644
--- a/xmloff/source/style/GradientStyle.cxx
+++ b/xmloff/source/style/GradientStyle.cxx
@@ -94,7 +94,7 @@ void XMLGradientStyleImport::importXML(
         { 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,
-            NAMESPACE_TOKEN( XML_NAMESPACE_DRAW ) | XML_BORDER },
+            XML_ELEMENT( DRAW, XML_BORDER ) },
         //  XML_GRADIENT_BORDER is a duplicate of XML_BORDER
         XML_TOKEN_MAP_END
     };
diff --git a/xmloff/source/style/HatchStyle.cxx b/xmloff/source/style/HatchStyle.cxx
index 1c8915eacff9..99111dcdd359 100644
--- a/xmloff/source/style/HatchStyle.cxx
+++ b/xmloff/source/style/HatchStyle.cxx
@@ -79,7 +79,7 @@ void XMLHatchStyleImport::importXML(
         { 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,
-            NAMESPACE_TOKEN( XML_NAMESPACE_DRAW ) | XML_DISTANCE },
+            XML_ELEMENT( DRAW, XML_DISTANCE ) },
         //  XML_HATCH_DISTANCE is a duplicate of XML_DISTANCE
         { XML_NAMESPACE_DRAW, XML_ROTATION, XML_TOK_HATCH_ROTATION },
         XML_TOKEN_MAP_END
diff --git a/xmloff/source/style/TransGradientStyle.cxx b/xmloff/source/style/TransGradientStyle.cxx
index 5d574d98c8d7..3c222d8f2a85 100644
--- a/xmloff/source/style/TransGradientStyle.cxx
+++ b/xmloff/source/style/TransGradientStyle.cxx
@@ -99,7 +99,7 @@ void XMLTransGradientStyleImport::importXML(
         { 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,
-            NAMESPACE_TOKEN( XML_NAMESPACE_DRAW ) | XML_BORDER },
+            XML_ELEMENT( DRAW, XML_BORDER ) },
         //  XML_GRADIENT_BORDER is a duplicate of XML_BORDER
         XML_TOKEN_MAP_END
     };


More information about the Libreoffice-commits mailing list