starmath : move static data to usage location

Change-Id: Id6e500f84ee6d121bdd67e78a8eccfbc10b6ef27
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162884
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Arnaud VERSINI 2024-02-01 16:09:57 +01:00 committed by Noel Grandin
parent 398996d877
commit fe012b3571
5 changed files with 117 additions and 165 deletions

View file

@ -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

View file

@ -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 \
))

View file

@ -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: */

View file

@ -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: */

View file

@ -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;