starmath/IwyuFilter_starmath.yaml  |    3 
 starmath/Library_sm.mk             |    1 
 starmath/inc/mathml/attribute.hxx  |   16 ----
 starmath/source/mathml/def.cxx     |  124 ---------------------------------
 starmath/source/mathml/element.cxx |  138 +++++++++++++++++++++++++++++++------
 5 files changed, 117 insertions(+), 165 deletions(-)

New commits:
commit fe012b3571e214a37fc0b952295a2235f1296591
Author:     Arnaud VERSINI <arnaud.vers...@pm.me>
AuthorDate: Thu Feb 1 16:09:57 2024 +0100
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Feb 7 09:00:43 2024 +0100

    starmath : move static data to usage location
    
    Change-Id: Id6e500f84ee6d121bdd67e78a8eccfbc10b6ef27
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162884
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/starmath/IwyuFilter_starmath.yaml 
b/starmath/IwyuFilter_starmath.yaml
index 72047b7c8ecc..3da2213e83fa 100644
--- a/starmath/IwyuFilter_starmath.yaml
+++ b/starmath/IwyuFilter_starmath.yaml
@@ -46,9 +46,6 @@ excludelist:
     - register.hxx
     # Needed for template
     - com/sun/star/frame/XModel.hpp
-    starmath/source/mathml/def.cxx:
-    # Needed for extern
-    - mathml/attribute.hxx
     starmath/source/mathml/mathmlexport.cxx:
     # Needed for rtl::math::round
     - rtl/math.hxx
diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk
index b50cef47e3dd..9791ffdd5b97 100644
--- a/starmath/Library_sm.mk
+++ b/starmath/Library_sm.mk
@@ -110,7 +110,6 @@ $(eval $(call gb_Library_add_exception_objects,sm,\
         starmath/source/mathml/iterator \
         starmath/source/mathml/attribute \
         starmath/source/mathml/element \
-        starmath/source/mathml/def \
         starmath/source/mathml/starmathdatabase \
 ))
 
diff --git a/starmath/inc/mathml/attribute.hxx 
b/starmath/inc/mathml/attribute.hxx
index 946e9f463e9c..6d991c50c853 100644
--- a/starmath/inc/mathml/attribute.hxx
+++ b/starmath/inc/mathml/attribute.hxx
@@ -184,20 +184,4 @@ public:
     void setMlSymmetric(const SmMlSymmetric* aSymmetric);
 };
 
-/* element's attributes */
-/*************************************************************************************************/
-
-namespace starmathdatabase
-{
-extern SmMlAttributePos MlAttributeListEmpty[1];
-extern SmMlAttributePos MlAttributeListMath[1];
-extern SmMlAttributePos MlAttributeListMi[7];
-extern SmMlAttributePos MlAttributeListMerror[4];
-extern SmMlAttributePos MlAttributeListMn[7];
-extern SmMlAttributePos MlAttributeListMo[18];
-extern SmMlAttributePos MlAttributeListMrow[4];
-extern SmMlAttributePos MlAttributeListMtext[7];
-extern SmMlAttributePos MlAttributeListMstyle[18];
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/starmath/source/mathml/def.cxx b/starmath/source/mathml/def.cxx
deleted file mode 100644
index 484dcd665393..000000000000
--- a/starmath/source/mathml/def.cxx
+++ /dev/null
@@ -1,124 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <mathml/attribute.hxx>
-
-SmMlAttributePos starmathdatabase::MlAttributeListEmpty[] = {
-    // clang-format off
-    { SmMlAttributeValueType::NMlEmpty, 0 }
-    // clang-format on
-};
-
-SmMlAttributePos starmathdatabase::MlAttributeListMath[] = {
-    // clang-format off
-    { SmMlAttributeValueType::NMlEmpty, 0 }
-    // clang-format on
-};
-
-SmMlAttributePos starmathdatabase::MlAttributeListMi[] = {
-    // clang-format off
-    { SmMlAttributeValueType::MlHref, 0 },
-    { SmMlAttributeValueType::MlDir, 1 },
-    { SmMlAttributeValueType::MlMathbackground, 2 },
-    { SmMlAttributeValueType::MlMathcolor, 3 },
-    { SmMlAttributeValueType::MlDisplaystyle, 4 },
-    { SmMlAttributeValueType::MlMathsize, 5 },
-    { SmMlAttributeValueType::MlMathvariant, 6 }
-    // clang-format on
-};
-
-SmMlAttributePos starmathdatabase::MlAttributeListMerror[] = {
-    // clang-format off
-    { SmMlAttributeValueType::MlHref, 0 },
-    { SmMlAttributeValueType::MlMathbackground, 1 },
-    { SmMlAttributeValueType::MlMathcolor, 2 },
-    { SmMlAttributeValueType::MlDisplaystyle, 3 }
-    // clang-format on
-};
-
-SmMlAttributePos starmathdatabase::MlAttributeListMn[] = {
-    // clang-format off
-    { SmMlAttributeValueType::MlHref, 0 },
-    { SmMlAttributeValueType::MlDir, 1 },
-    { SmMlAttributeValueType::MlMathbackground, 2 },
-    { SmMlAttributeValueType::MlMathcolor, 3 },
-    { SmMlAttributeValueType::MlDisplaystyle, 4 },
-    { SmMlAttributeValueType::MlMathsize, 5 },
-    { SmMlAttributeValueType::MlMathvariant, 6 }
-    // clang-format on
-};
-
-SmMlAttributePos starmathdatabase::MlAttributeListMo[] = {
-    // clang-format off
-    { SmMlAttributeValueType::MlHref, 0 },
-    { SmMlAttributeValueType::MlDir, 1 },
-    { SmMlAttributeValueType::MlMathbackground, 2 },
-    { SmMlAttributeValueType::MlMathcolor, 3 },
-    { SmMlAttributeValueType::MlDisplaystyle, 4 },
-    { SmMlAttributeValueType::MlMathsize, 5 },
-    { SmMlAttributeValueType::MlMathvariant, 6 },
-    { SmMlAttributeValueType::MlFence, 7 },
-    { SmMlAttributeValueType::MlForm, 8 },
-    { SmMlAttributeValueType::MlMaxsize, 9 },
-    { SmMlAttributeValueType::MlMinsize, 10 },
-    { SmMlAttributeValueType::MlMovablelimits, 11 },
-    { SmMlAttributeValueType::MlLspace, 12 },
-    { SmMlAttributeValueType::MlRspace, 13 },
-    { SmMlAttributeValueType::MlAccent, 14 },
-    { SmMlAttributeValueType::MlStretchy, 15 },
-    { SmMlAttributeValueType::MlSeparator, 16 },
-    { SmMlAttributeValueType::MlSymmetric, 17 }
-    // clang-format on
-};
-
-SmMlAttributePos starmathdatabase::MlAttributeListMrow[] = {
-    // clang-format off
-    { SmMlAttributeValueType::MlHref, 0 },
-    { SmMlAttributeValueType::MlDir, 1 },
-    { SmMlAttributeValueType::MlMathbackground, 2 },
-    { SmMlAttributeValueType::MlMathcolor, 3 }
-    // clang-format on
-};
-
-SmMlAttributePos starmathdatabase::MlAttributeListMtext[] = {
-    // clang-format off
-    { SmMlAttributeValueType::MlHref, 0 },
-    { SmMlAttributeValueType::MlDir, 1 },
-    { SmMlAttributeValueType::MlMathbackground, 2 },
-    { SmMlAttributeValueType::MlMathcolor, 3 },
-    { SmMlAttributeValueType::MlDisplaystyle, 4 },
-    { SmMlAttributeValueType::MlMathsize, 5 },
-    { SmMlAttributeValueType::MlMathvariant, 6 }
-    // clang-format on
-};
-
-SmMlAttributePos starmathdatabase::MlAttributeListMstyle[] = {
-    // clang-format off
-    { SmMlAttributeValueType::MlHref, 0 },
-    { SmMlAttributeValueType::MlDir, 1 },
-    { SmMlAttributeValueType::MlMathbackground, 2 },
-    { SmMlAttributeValueType::MlMathcolor, 3 },
-    { SmMlAttributeValueType::MlDisplaystyle, 4 },
-    { SmMlAttributeValueType::MlMathsize, 5 },
-    { SmMlAttributeValueType::MlMathvariant, 6 },
-    { SmMlAttributeValueType::MlFence, 7 },
-    { SmMlAttributeValueType::MlForm, 8 },
-    { SmMlAttributeValueType::MlMaxsize, 9 },
-    { SmMlAttributeValueType::MlMinsize, 10 },
-    { SmMlAttributeValueType::MlMovablelimits, 11 },
-    { SmMlAttributeValueType::MlLspace, 12 },
-    { SmMlAttributeValueType::MlRspace, 13 },
-    { SmMlAttributeValueType::MlAccent, 14 },
-    { SmMlAttributeValueType::MlStretchy, 15 },
-    { SmMlAttributeValueType::MlSeparator, 16 },
-    { SmMlAttributeValueType::MlSymmetric, 17 }
-    // clang-format on
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/starmath/source/mathml/element.cxx 
b/starmath/source/mathml/element.cxx
index 4f8f2a64ff95..424d94ccaddf 100644
--- a/starmath/source/mathml/element.cxx
+++ b/starmath/source/mathml/element.cxx
@@ -9,6 +9,109 @@
 
 #include <mathml/element.hxx>
 
+namespace
+{
+constexpr SmMlAttributePos MlAttributeListMi[] = {
+    // clang-format off
+    { SmMlAttributeValueType::MlHref, 0 },
+    { SmMlAttributeValueType::MlDir, 1 },
+    { SmMlAttributeValueType::MlMathbackground, 2 },
+    { SmMlAttributeValueType::MlMathcolor, 3 },
+    { SmMlAttributeValueType::MlDisplaystyle, 4 },
+    { SmMlAttributeValueType::MlMathsize, 5 },
+    { SmMlAttributeValueType::MlMathvariant, 6 }
+    // clang-format on
+};
+
+constexpr SmMlAttributePos MlAttributeListMerror[] = {
+    // clang-format off
+    { SmMlAttributeValueType::MlHref, 0 },
+    { SmMlAttributeValueType::MlMathbackground, 1 },
+    { SmMlAttributeValueType::MlMathcolor, 2 },
+    { SmMlAttributeValueType::MlDisplaystyle, 3 }
+    // clang-format on
+};
+
+constexpr SmMlAttributePos MlAttributeListMn[] = {
+    // clang-format off
+    { SmMlAttributeValueType::MlHref, 0 },
+    { SmMlAttributeValueType::MlDir, 1 },
+    { SmMlAttributeValueType::MlMathbackground, 2 },
+    { SmMlAttributeValueType::MlMathcolor, 3 },
+    { SmMlAttributeValueType::MlDisplaystyle, 4 },
+    { SmMlAttributeValueType::MlMathsize, 5 },
+    { SmMlAttributeValueType::MlMathvariant, 6 }
+    // clang-format on
+};
+
+constexpr SmMlAttributePos MlAttributeListMo[] = {
+    // clang-format off
+    { SmMlAttributeValueType::MlHref, 0 },
+    { SmMlAttributeValueType::MlDir, 1 },
+    { SmMlAttributeValueType::MlMathbackground, 2 },
+    { SmMlAttributeValueType::MlMathcolor, 3 },
+    { SmMlAttributeValueType::MlDisplaystyle, 4 },
+    { SmMlAttributeValueType::MlMathsize, 5 },
+    { SmMlAttributeValueType::MlMathvariant, 6 },
+    { SmMlAttributeValueType::MlFence, 7 },
+    { SmMlAttributeValueType::MlForm, 8 },
+    { SmMlAttributeValueType::MlMaxsize, 9 },
+    { SmMlAttributeValueType::MlMinsize, 10 },
+    { SmMlAttributeValueType::MlMovablelimits, 11 },
+    { SmMlAttributeValueType::MlLspace, 12 },
+    { SmMlAttributeValueType::MlRspace, 13 },
+    { SmMlAttributeValueType::MlAccent, 14 },
+    { SmMlAttributeValueType::MlStretchy, 15 },
+    { SmMlAttributeValueType::MlSeparator, 16 },
+    { SmMlAttributeValueType::MlSymmetric, 17 }
+    // clang-format on
+};
+
+constexpr SmMlAttributePos MlAttributeListMrow[] = {
+    // clang-format off
+    { SmMlAttributeValueType::MlHref, 0 },
+    { SmMlAttributeValueType::MlDir, 1 },
+    { SmMlAttributeValueType::MlMathbackground, 2 },
+    { SmMlAttributeValueType::MlMathcolor, 3 }
+    // clang-format on
+};
+
+constexpr SmMlAttributePos MlAttributeListMtext[] = {
+    // clang-format off
+    { SmMlAttributeValueType::MlHref, 0 },
+    { SmMlAttributeValueType::MlDir, 1 },
+    { SmMlAttributeValueType::MlMathbackground, 2 },
+    { SmMlAttributeValueType::MlMathcolor, 3 },
+    { SmMlAttributeValueType::MlDisplaystyle, 4 },
+    { SmMlAttributeValueType::MlMathsize, 5 },
+    { SmMlAttributeValueType::MlMathvariant, 6 }
+    // clang-format on
+};
+
+constexpr SmMlAttributePos MlAttributeListMstyle[] = {
+    // clang-format off
+    { SmMlAttributeValueType::MlHref, 0 },
+    { SmMlAttributeValueType::MlDir, 1 },
+    { SmMlAttributeValueType::MlMathbackground, 2 },
+    { SmMlAttributeValueType::MlMathcolor, 3 },
+    { SmMlAttributeValueType::MlDisplaystyle, 4 },
+    { SmMlAttributeValueType::MlMathsize, 5 },
+    { SmMlAttributeValueType::MlMathvariant, 6 },
+    { SmMlAttributeValueType::MlFence, 7 },
+    { SmMlAttributeValueType::MlForm, 8 },
+    { SmMlAttributeValueType::MlMaxsize, 9 },
+    { SmMlAttributeValueType::MlMinsize, 10 },
+    { SmMlAttributeValueType::MlMovablelimits, 11 },
+    { SmMlAttributeValueType::MlLspace, 12 },
+    { SmMlAttributeValueType::MlRspace, 13 },
+    { SmMlAttributeValueType::MlAccent, 14 },
+    { SmMlAttributeValueType::MlStretchy, 15 },
+    { SmMlAttributeValueType::MlSeparator, 16 },
+    { SmMlAttributeValueType::MlSymmetric, 17 }
+    // clang-format on
+};
+}
+
 void SmMlElement::SmImplAttributeType()
 {
     switch (m_aElementType)
@@ -27,39 +130,32 @@ void SmMlElement::SmImplAttributeType()
             //m_aAttributePosList = 
std::vector<SmMlAttributePos>(std::begin(starmathdatabase::MlAttributeListMath),
 std::end(starmathdatabase::MlAttributeListMath));
             break;
         case SmMlElementType::MlMi:
-            m_aAttributePosList
-                = 
std::vector<SmMlAttributePos>(std::begin(starmathdatabase::MlAttributeListMi),
-                                                
std::end(starmathdatabase::MlAttributeListMi));
+            m_aAttributePosList = 
std::vector<SmMlAttributePos>(std::begin(MlAttributeListMi),
+                                                                
std::end(MlAttributeListMi));
             break;
         case SmMlElementType::MlMerror:
-            m_aAttributePosList
-                = 
std::vector<SmMlAttributePos>(std::begin(starmathdatabase::MlAttributeListMerror),
-                                                
std::end(starmathdatabase::MlAttributeListMerror));
+            m_aAttributePosList = 
std::vector<SmMlAttributePos>(std::begin(MlAttributeListMerror),
+                                                                
std::end(MlAttributeListMerror));
             break;
         case SmMlElementType::MlMn:
-            m_aAttributePosList
-                = 
std::vector<SmMlAttributePos>(std::begin(starmathdatabase::MlAttributeListMn),
-                                                
std::end(starmathdatabase::MlAttributeListMn));
+            m_aAttributePosList = 
std::vector<SmMlAttributePos>(std::begin(MlAttributeListMn),
+                                                                
std::end(MlAttributeListMn));
             break;
         case SmMlElementType::MlMo:
-            m_aAttributePosList
-                = 
std::vector<SmMlAttributePos>(std::begin(starmathdatabase::MlAttributeListMo),
-                                                
std::end(starmathdatabase::MlAttributeListMo));
+            m_aAttributePosList = 
std::vector<SmMlAttributePos>(std::begin(MlAttributeListMo),
+                                                                
std::end(MlAttributeListMo));
             break;
         case SmMlElementType::MlMrow:
-            m_aAttributePosList
-                = 
std::vector<SmMlAttributePos>(std::begin(starmathdatabase::MlAttributeListMrow),
-                                                
std::end(starmathdatabase::MlAttributeListMrow));
+            m_aAttributePosList = 
std::vector<SmMlAttributePos>(std::begin(MlAttributeListMrow),
+                                                                
std::end(MlAttributeListMrow));
             break;
         case SmMlElementType::MlMtext:
-            m_aAttributePosList
-                = 
std::vector<SmMlAttributePos>(std::begin(starmathdatabase::MlAttributeListMtext),
-                                                
std::end(starmathdatabase::MlAttributeListMtext));
+            m_aAttributePosList = 
std::vector<SmMlAttributePos>(std::begin(MlAttributeListMtext),
+                                                                
std::end(MlAttributeListMtext));
             break;
         case SmMlElementType::MlMstyle:
-            m_aAttributePosList
-                = 
std::vector<SmMlAttributePos>(std::begin(starmathdatabase::MlAttributeListMstyle),
-                                                
std::end(starmathdatabase::MlAttributeListMstyle));
+            m_aAttributePosList = 
std::vector<SmMlAttributePos>(std::begin(MlAttributeListMstyle),
+                                                                
std::end(MlAttributeListMstyle));
             break;
         default:
             break;

Reply via email to