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

Michael Stahl mstahl at redhat.com
Tue Jun 27 14:23:53 UTC 2017


 include/xmloff/xmlnmspe.hxx                |  179 +++++++++++++----------------
 starmath/source/mathmlexport.cxx           |    4 
 xmloff/source/xforms/XFormsBindContext.cxx |    2 
 3 files changed, 88 insertions(+), 97 deletions(-)

New commits:
commit d752e0b9aaa0b08f80b0e903633f80912cd9325f
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jun 27 15:49:40 2017 +0200

    xmloff: remove obnoxious ## usage from XML_NAMESPACE macros
    
    So we can finally grep these things.
    
    Change-Id: I7ab4d0c82d8abf3fad4063321fc73772a7a6cb8d

diff --git a/include/xmloff/xmlnmspe.hxx b/include/xmloff/xmlnmspe.hxx
index d1811e258ab4..a00628b6b999 100644
--- a/include/xmloff/xmlnmspe.hxx
+++ b/include/xmloff/xmlnmspe.hxx
@@ -23,122 +23,120 @@
 #include <sal/types.h>
 
 #define XML_NAMESPACE( prefix, key ) \
-const sal_uInt16 XML_NAMESPACE_##prefix         = key;
-
-#define XML_OLD_NAMESPACE( prefix, index ) \
-const sal_uInt16 XML_OLD_NAMESPACE_##prefix = \
-    (XML_OLD_NAMESPACE_BASE+index);
+const sal_uInt16 prefix = key;
 
 // current namespaces
 // These namespaces have the same index in the namespace table as prefix used.
 // If a namespace is added, XML_OLD_NAMESPACE_BASE has to be adjusted!
-XML_NAMESPACE( OFFICE,          0U )
-XML_NAMESPACE( STYLE,           1U )
-XML_NAMESPACE( TEXT ,           2U )
-XML_NAMESPACE( TABLE,           3U )
-XML_NAMESPACE( DRAW ,           4U )
-XML_NAMESPACE( FO   ,           5U )
-XML_NAMESPACE( XLINK,           6U )
-XML_NAMESPACE( DC   ,           7U )
-XML_NAMESPACE( META ,           8U )
-XML_NAMESPACE( NUMBER,          9U )
-XML_NAMESPACE( PRESENTATION,    10U )
-XML_NAMESPACE( SVG,             11U )
-XML_NAMESPACE( CHART,           12U )
-XML_NAMESPACE( DR3D,            13U )
-XML_NAMESPACE( MATH,            14U )
-XML_NAMESPACE( FORM,            15U )
-XML_NAMESPACE( SCRIPT,          16U )
-XML_NAMESPACE( BLOCKLIST,       17U )
-XML_NAMESPACE( FRAMEWORK,       18U )
-XML_NAMESPACE( CONFIG,          19U )
-XML_NAMESPACE( OOO,             20U )
-XML_NAMESPACE( OOOW,            21U )
-XML_NAMESPACE( OOOC,            22U )
-XML_NAMESPACE( DOM,             23U )
-XML_NAMESPACE( TCD,             24U )       // text conversion dictionary
-XML_NAMESPACE( DB,              25U )
-XML_NAMESPACE( DLG,             26U )
-XML_NAMESPACE( XFORMS,          27U )
-XML_NAMESPACE( XSD,             28U )
-XML_NAMESPACE( XSI,             29U )
-XML_NAMESPACE( SMIL,            30U )
-XML_NAMESPACE( ANIMATION,       31U )
-XML_NAMESPACE( XML,             32U )
-XML_NAMESPACE( REPORT,          33U )
-XML_NAMESPACE( OF,              34U )       // OpenFormula aka ODFF
-XML_NAMESPACE( XHTML,           35U )
-XML_NAMESPACE( GRDDL,           36U )
-XML_NAMESPACE( VERSIONS_LIST,   37U )
+XML_NAMESPACE( XML_NAMESPACE_OFFICE,          0U )
+XML_NAMESPACE( XML_NAMESPACE_STYLE,           1U )
+XML_NAMESPACE( XML_NAMESPACE_TEXT ,           2U )
+XML_NAMESPACE( XML_NAMESPACE_TABLE,           3U )
+XML_NAMESPACE( XML_NAMESPACE_DRAW ,           4U )
+XML_NAMESPACE( XML_NAMESPACE_FO   ,           5U )
+XML_NAMESPACE( XML_NAMESPACE_XLINK,           6U )
+XML_NAMESPACE( XML_NAMESPACE_DC   ,           7U )
+XML_NAMESPACE( XML_NAMESPACE_META ,           8U )
+XML_NAMESPACE( XML_NAMESPACE_NUMBER,          9U )
+XML_NAMESPACE( XML_NAMESPACE_PRESENTATION,    10U )
+XML_NAMESPACE( XML_NAMESPACE_SVG,             11U )
+XML_NAMESPACE( XML_NAMESPACE_CHART,           12U )
+XML_NAMESPACE( XML_NAMESPACE_DR3D,            13U )
+XML_NAMESPACE( XML_NAMESPACE_MATH,            14U )
+XML_NAMESPACE( XML_NAMESPACE_FORM,            15U )
+XML_NAMESPACE( XML_NAMESPACE_SCRIPT,          16U )
+XML_NAMESPACE( XML_NAMESPACE_BLOCKLIST,       17U )
+XML_NAMESPACE( XML_NAMESPACE_FRAMEWORK,       18U )
+XML_NAMESPACE( XML_NAMESPACE_CONFIG,          19U )
+XML_NAMESPACE( XML_NAMESPACE_OOO,             20U )
+XML_NAMESPACE( XML_NAMESPACE_OOOW,            21U )
+XML_NAMESPACE( XML_NAMESPACE_OOOC,            22U )
+XML_NAMESPACE( XML_NAMESPACE_DOM,             23U )
+XML_NAMESPACE( XML_NAMESPACE_TCD,             24U )   // text conversion dictionary
+XML_NAMESPACE( XML_NAMESPACE_DB,              25U )
+XML_NAMESPACE( XML_NAMESPACE_DLG,             26U )
+XML_NAMESPACE( XML_NAMESPACE_XFORMS,          27U )
+XML_NAMESPACE( XML_NAMESPACE_XSD,             28U )
+XML_NAMESPACE( XML_NAMESPACE_XSI,             29U )
+XML_NAMESPACE( XML_NAMESPACE_SMIL,            30U )
+XML_NAMESPACE( XML_NAMESPACE_ANIMATION,       31U )
+XML_NAMESPACE( XML_NAMESPACE_XML,             32U )
+XML_NAMESPACE( XML_NAMESPACE_REPORT,          33U )
+XML_NAMESPACE( XML_NAMESPACE_OF,              34U )   // OpenFormula aka ODFF
+XML_NAMESPACE( XML_NAMESPACE_XHTML,           35U )
+XML_NAMESPACE( XML_NAMESPACE_GRDDL,           36U )
+XML_NAMESPACE( XML_NAMESPACE_VERSIONS_LIST,   37U )
 
 // namespaces for odf extended formats
 
 #define XML_NAMESPACE_EXT_BASE 38U
 #define XML_NAMESPACE_EXT( prefix, index ) \
-const sal_uInt16 XML_NAMESPACE_##prefix##_EXT       = (XML_NAMESPACE_EXT_BASE+index);
+const sal_uInt16 prefix = (XML_NAMESPACE_EXT_BASE+index);
 
-XML_NAMESPACE_EXT( OFFICE,       0U )
-XML_NAMESPACE_EXT( TABLE,        1U )
-XML_NAMESPACE_EXT( CHART,        2U )
-XML_NAMESPACE_EXT( DRAW,         3U )
-XML_NAMESPACE_EXT( CALC,         4U )
-XML_NAMESPACE_EXT( LO,           5U )
+XML_NAMESPACE_EXT( XML_NAMESPACE_OFFICE_EXT,       0U )
+XML_NAMESPACE_EXT( XML_NAMESPACE_TABLE_EXT,        1U )
+XML_NAMESPACE_EXT( XML_NAMESPACE_CHART_EXT,        2U )
+XML_NAMESPACE_EXT( XML_NAMESPACE_DRAW_EXT,         3U )
+XML_NAMESPACE_EXT( XML_NAMESPACE_CALC_EXT,         4U )
+XML_NAMESPACE_EXT( XML_NAMESPACE_LO_EXT,           5U )
 
 // namespaces for OOo formats
 
 #define XML_NAMESPACE_OOO_BASE 44U
 #define XML_NAMESPACE_OOO( prefix, index ) \
-const sal_uInt16 XML_NAMESPACE_##prefix##_OOO       = (XML_NAMESPACE_OOO_BASE+index);
-
-XML_NAMESPACE_OOO( OFFICE,         0U )
-XML_NAMESPACE_OOO( META,           1U )
-XML_NAMESPACE_OOO( STYLE,          2U )
-XML_NAMESPACE_OOO( NUMBER,         3U )
-XML_NAMESPACE_OOO( TEXT,           4U )
-XML_NAMESPACE_OOO( TABLE,          5U )
-XML_NAMESPACE_OOO( DRAW,           6U )
-XML_NAMESPACE_OOO( DR3D,           7U )
-XML_NAMESPACE_OOO( PRESENTATION,   8U )
-XML_NAMESPACE_OOO( CHART,          9U )
-XML_NAMESPACE_OOO( CONFIG,        10U )
-XML_NAMESPACE_OOO( FORM,          11U )
-XML_NAMESPACE_OOO( SCRIPT,        12U )
+const sal_uInt16 prefix = (XML_NAMESPACE_OOO_BASE+index);
+
+XML_NAMESPACE_OOO( XML_NAMESPACE_OFFICE_OOO,         0U )
+XML_NAMESPACE_OOO( XML_NAMESPACE_META_OOO,           1U )
+XML_NAMESPACE_OOO( XML_NAMESPACE_STYLE_OOO,          2U )
+XML_NAMESPACE_OOO( XML_NAMESPACE_NUMBER_OOO,         3U )
+XML_NAMESPACE_OOO( XML_NAMESPACE_TEXT_OOO,           4U )
+XML_NAMESPACE_OOO( XML_NAMESPACE_TABLE_OOO,          5U )
+XML_NAMESPACE_OOO( XML_NAMESPACE_DRAW_OOO,           6U )
+XML_NAMESPACE_OOO( XML_NAMESPACE_DR3D_OOO,           7U )
+XML_NAMESPACE_OOO( XML_NAMESPACE_PRESENTATION_OOO,   8U )
+XML_NAMESPACE_OOO( XML_NAMESPACE_CHART_OOO,          9U )
+XML_NAMESPACE_OOO( XML_NAMESPACE_CONFIG_OOO,        10U )
+XML_NAMESPACE_OOO( XML_NAMESPACE_FORM_OOO,          11U )
+XML_NAMESPACE_OOO( XML_NAMESPACE_SCRIPT_OOO,        12U )
 
 #define XML_NAMESPACE_COMPAT_BASE 57U
 #define XML_NAMESPACE_COMPAT( prefix, index ) \
-const sal_uInt16 XML_NAMESPACE_##prefix##_COMPAT       = (XML_NAMESPACE_COMPAT_BASE+index);
+const sal_uInt16 prefix = (XML_NAMESPACE_COMPAT_BASE+index);
 
-XML_NAMESPACE_COMPAT( SVG,         0U )
-XML_NAMESPACE_COMPAT( FO,          1U )
-XML_NAMESPACE_COMPAT( SMIL,        2U )
+XML_NAMESPACE_COMPAT( XML_NAMESPACE_SVG_COMPAT,      0U )
+XML_NAMESPACE_COMPAT( XML_NAMESPACE_FO_COMPAT,       1U )
+XML_NAMESPACE_COMPAT( XML_NAMESPACE_SMIL_COMPAT,     2U )
 
 #define XML_NAMESPACE_OASIS_BASE 60U
 #define XML_NAMESPACE_OASIS( prefix, index ) \
-const sal_uInt16 XML_NAMESPACE_##prefix##_OASIS       = (XML_NAMESPACE_OASIS_BASE+index);
+const sal_uInt16 prefix = (XML_NAMESPACE_OASIS_BASE+index);
 
-XML_NAMESPACE_OASIS( DB,           0U )
-XML_NAMESPACE_OASIS( REPORT,       1U )
+XML_NAMESPACE_OASIS( XML_NAMESPACE_DB_OASIS,         0U )
+XML_NAMESPACE_OASIS( XML_NAMESPACE_REPORT_OASIS,     1U )
 
 #define XML_OLD_NAMESPACE_BASE 62U
+#define XML_OLD_NAMESPACE( prefix, index ) \
+const sal_uInt16 prefix = (XML_OLD_NAMESPACE_BASE+index);
 
 // namespaces used in the technical preview (SO 5.2)
-XML_OLD_NAMESPACE( FO,             0U )
-XML_OLD_NAMESPACE( XLINK,          1U )
-XML_OLD_NAMESPACE( OFFICE,         2U )
-XML_OLD_NAMESPACE( STYLE,          3U )
-XML_OLD_NAMESPACE( TEXT,           4U )
-XML_OLD_NAMESPACE( TABLE,          5U )
-XML_OLD_NAMESPACE( META,           6U )
-XML_OLD_NAMESPACE( DRAW,           7U )
-XML_OLD_NAMESPACE( NUMBER,         8U )
-XML_OLD_NAMESPACE( PRESENTATION,   9U )
-XML_OLD_NAMESPACE( CHART,         10U )
-XML_OLD_NAMESPACE( SMIL,          11U )
+XML_OLD_NAMESPACE( XML_OLD_NAMESPACE_FO,             0U )
+XML_OLD_NAMESPACE( XML_OLD_NAMESPACE_XLINK,          1U )
+XML_OLD_NAMESPACE( XML_OLD_NAMESPACE_OFFICE,         2U )
+XML_OLD_NAMESPACE( XML_OLD_NAMESPACE_STYLE,          3U )
+XML_OLD_NAMESPACE( XML_OLD_NAMESPACE_TEXT,           4U )
+XML_OLD_NAMESPACE( XML_OLD_NAMESPACE_TABLE,          5U )
+XML_OLD_NAMESPACE( XML_OLD_NAMESPACE_META,           6U )
+XML_OLD_NAMESPACE( XML_OLD_NAMESPACE_DRAW,           7U )
+XML_OLD_NAMESPACE( XML_OLD_NAMESPACE_NUMBER,         8U )
+XML_OLD_NAMESPACE( XML_OLD_NAMESPACE_PRESENTATION,   9U )
+XML_OLD_NAMESPACE( XML_OLD_NAMESPACE_CHART,         10U )
+XML_OLD_NAMESPACE( XML_OLD_NAMESPACE_SMIL,          11U )
 
 // experimental namespaces
-XML_NAMESPACE( FIELD,           100U )
-XML_NAMESPACE( CSS3TEXT,        103U )      // CSS Text Level 3
-XML_NAMESPACE( FORMX,           101U )      // form interop extensions
+XML_NAMESPACE( XML_NAMESPACE_FIELD,           100U )
+XML_NAMESPACE( XML_NAMESPACE_CSS3TEXT,        103U )  // CSS Text Level 3
+XML_NAMESPACE( XML_NAMESPACE_FORMX,           101U )  // form interop extensions
 
 
 #endif // INCLUDED_XMLOFF_XMLNMSPE_HXX
commit 6e427e0bd194ae74e704e2cdbe6fe183eafbf4c5
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jun 27 15:25:53 2017 +0200

    xmloff: remove duplicate XML_NAMESPACE_##prefix##_IDX macros
    
    Why do we need 2 identical constants?
    
    Change-Id: Ib969f9b9583261f26fe65e04f183bdfabcb9eefe

diff --git a/include/xmloff/xmlnmspe.hxx b/include/xmloff/xmlnmspe.hxx
index 3153ad0f83fd..d1811e258ab4 100644
--- a/include/xmloff/xmlnmspe.hxx
+++ b/include/xmloff/xmlnmspe.hxx
@@ -23,13 +23,10 @@
 #include <sal/types.h>
 
 #define XML_NAMESPACE( prefix, key ) \
-const sal_uInt16 XML_NAMESPACE_##prefix         = key; \
-const sal_uInt16 XML_NAMESPACE_##prefix##_IDX   = key;
+const sal_uInt16 XML_NAMESPACE_##prefix         = key;
 
 #define XML_OLD_NAMESPACE( prefix, index ) \
 const sal_uInt16 XML_OLD_NAMESPACE_##prefix = \
-    (XML_OLD_NAMESPACE_BASE+index); \
-const sal_uInt16 XML_OLD_NAMESPACE_##prefix##_IDX = \
     (XML_OLD_NAMESPACE_BASE+index);
 
 // current namespaces
@@ -78,8 +75,7 @@ XML_NAMESPACE( VERSIONS_LIST,   37U )
 
 #define XML_NAMESPACE_EXT_BASE 38U
 #define XML_NAMESPACE_EXT( prefix, index ) \
-const sal_uInt16 XML_NAMESPACE_##prefix##_EXT       = (XML_NAMESPACE_EXT_BASE+index); \
-const sal_uInt16 XML_NAMESPACE_##prefix##_EXT_IDX   = (XML_NAMESPACE_EXT_BASE+index);
+const sal_uInt16 XML_NAMESPACE_##prefix##_EXT       = (XML_NAMESPACE_EXT_BASE+index);
 
 XML_NAMESPACE_EXT( OFFICE,       0U )
 XML_NAMESPACE_EXT( TABLE,        1U )
@@ -92,8 +88,7 @@ XML_NAMESPACE_EXT( LO,           5U )
 
 #define XML_NAMESPACE_OOO_BASE 44U
 #define XML_NAMESPACE_OOO( prefix, index ) \
-const sal_uInt16 XML_NAMESPACE_##prefix##_OOO       = (XML_NAMESPACE_OOO_BASE+index); \
-const sal_uInt16 XML_NAMESPACE_##prefix##_OOO_IDX   = (XML_NAMESPACE_OOO_BASE+index);
+const sal_uInt16 XML_NAMESPACE_##prefix##_OOO       = (XML_NAMESPACE_OOO_BASE+index);
 
 XML_NAMESPACE_OOO( OFFICE,         0U )
 XML_NAMESPACE_OOO( META,           1U )
@@ -111,8 +106,7 @@ XML_NAMESPACE_OOO( SCRIPT,        12U )
 
 #define XML_NAMESPACE_COMPAT_BASE 57U
 #define XML_NAMESPACE_COMPAT( prefix, index ) \
-const sal_uInt16 XML_NAMESPACE_##prefix##_COMPAT       = (XML_NAMESPACE_COMPAT_BASE+index); \
-const sal_uInt16 XML_NAMESPACE_##prefix##_COMPAT_IDX   = (XML_NAMESPACE_COMPAT_BASE+index);
+const sal_uInt16 XML_NAMESPACE_##prefix##_COMPAT       = (XML_NAMESPACE_COMPAT_BASE+index);
 
 XML_NAMESPACE_COMPAT( SVG,         0U )
 XML_NAMESPACE_COMPAT( FO,          1U )
@@ -120,8 +114,7 @@ XML_NAMESPACE_COMPAT( SMIL,        2U )
 
 #define XML_NAMESPACE_OASIS_BASE 60U
 #define XML_NAMESPACE_OASIS( prefix, index ) \
-const sal_uInt16 XML_NAMESPACE_##prefix##_OASIS       = (XML_NAMESPACE_OASIS_BASE+index); \
-const sal_uInt16 XML_NAMESPACE_##prefix##_OASIS_IDX   = (XML_NAMESPACE_OASIS_BASE+index);
+const sal_uInt16 XML_NAMESPACE_##prefix##_OASIS       = (XML_NAMESPACE_OASIS_BASE+index);
 
 XML_NAMESPACE_OASIS( DB,           0U )
 XML_NAMESPACE_OASIS( REPORT,       1U )
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index c7824d81b23b..e737b848c08e 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -447,8 +447,8 @@ ErrCode SmXMLExport::exportDoc(enum XMLTokenEnum eClass)
         ResetNamespaceMap();    // Math doesn't need namespaces from xmloff, since it now uses default namespaces (because that is common with current MathML usage in the web)
         GetNamespaceMap_().Add( OUString(), GetXMLToken(XML_N_MATH), XML_NAMESPACE_MATH );
 
-        rList.AddAttribute(GetNamespaceMap().GetAttrNameByKey(XML_NAMESPACE_MATH_IDX),
-                GetNamespaceMap().GetNameByKey( XML_NAMESPACE_MATH_IDX));
+        rList.AddAttribute(GetNamespaceMap().GetAttrNameByKey(XML_NAMESPACE_MATH),
+                GetNamespaceMap().GetNameByKey( XML_NAMESPACE_MATH));
 
         //I think we need something like ImplExportEntities();
         ExportContent_();
diff --git a/xmloff/source/xforms/XFormsBindContext.cxx b/xmloff/source/xforms/XFormsBindContext.cxx
index 8a54e3ad9c41..9cb04313ac17 100644
--- a/xmloff/source/xforms/XFormsBindContext.cxx
+++ b/xmloff/source/xforms/XFormsBindContext.cxx
@@ -155,7 +155,7 @@ static void lcl_fillNamespaceContainer(
         // as a hack, we will ignore our own 'default' namespaces
         SAL_WARN_IF( sPrefix.isEmpty(), "xmloff", "no prefix?" );
         if( !sPrefix.startsWith("_") &&
-            nKeyIter >= XML_OLD_NAMESPACE_META_IDX )
+            nKeyIter >= XML_OLD_NAMESPACE_META)
         {
             // insert prefix (use replace if already known)
             if( xContainer->hasByName( sPrefix ) )


More information about the Libreoffice-commits mailing list