cui/source/inc/numpages.hxx                                 |    2 
 cui/source/tabpages/numpages.cxx                            |   27 ++++++
 cui/uiconfig/ui/numberingoptionspage.ui                     |   47 ++++++++----
 editeng/source/items/numitem.cxx                            |   17 +++-
 include/editeng/numitem.hxx                                 |    7 +
 include/xmloff/xmltoken.hxx                                 |    1 
 offapi/com/sun/star/style/NumberingLevel.idl                |    6 +
 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |   15 +++
 sw/inc/unoprnms.hxx                                         |    1 
 sw/qa/extras/odfexport/data/IsLegal.fodt                    |   28 +++++++
 sw/qa/extras/odfexport/odfexport2.cxx                       |   22 +++++
 sw/qa/extras/ooxmlexport/data/listWithLgl.docx              |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx                  |   20 +++++
 sw/source/core/doc/number.cxx                               |    4 -
 sw/source/core/unocore/unosett.cxx                          |    8 ++
 sw/source/filter/ww8/attributeoutputbase.hxx                |    3 
 sw/source/filter/ww8/docxattributeoutput.cxx                |    7 +
 sw/source/filter/ww8/docxattributeoutput.hxx                |    3 
 sw/source/filter/ww8/rtfattributeoutput.cxx                 |    2 
 sw/source/filter/ww8/rtfattributeoutput.hxx                 |   14 +--
 sw/source/filter/ww8/wrtw8num.cxx                           |    5 -
 sw/source/filter/ww8/ww8attributeoutput.hxx                 |    3 
 writerfilter/source/dmapper/NumberingManager.cxx            |    6 +
 writerfilter/source/dmapper/NumberingManager.hxx            |    1 
 writerfilter/source/dmapper/PropertyIds.cxx                 |    1 
 writerfilter/source/dmapper/PropertyIds.hxx                 |    1 
 xmloff/source/core/xmltoken.cxx                             |    1 
 xmloff/source/style/xmlnume.cxx                             |   10 ++
 xmloff/source/style/xmlnumi.cxx                             |    8 ++
 xmloff/source/token/tokens.txt                              |    1 
 30 files changed, 235 insertions(+), 36 deletions(-)

New commits:
commit 0f9ebefd27eb7fbef951a960d9821ca646af3dda
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Jul 10 22:41:46 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Jul 11 19:07:57 2023 +0200

    tdf#150408: Implement UI for "Legal" numbering
    
    Change-Id: I16849a2d823539040ecb91416b5214d25851950a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154287
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154334
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index 8f554722fa67..f6f01aadbcc3 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -235,6 +235,7 @@ class SvxNumOptionsTabPage : public SfxTabPage
     std::unique_ptr<weld::MetricSpinButton> m_xBulRelSizeMF;
     std::unique_ptr<weld::Label> m_xAllLevelFT;
     std::unique_ptr<weld::SpinButton> m_xAllLevelNF;
+    std::unique_ptr<weld::CheckButton> m_xIsLegalCB;
     std::unique_ptr<weld::Label> m_xStartFT;
     std::unique_ptr<weld::SpinButton> m_xStartED;
     std::unique_ptr<weld::Label> m_xBulletFT;
@@ -273,6 +274,7 @@ class SvxNumOptionsTabPage : public SfxTabPage
     DECL_LINK(EditModifyHdl_Impl, weld::Entry&, void);
     DECL_LINK(SpinModifyHdl_Impl, weld::SpinButton&, void);
     DECL_LINK(AllLevelHdl_Impl, weld::SpinButton&, void);
+    DECL_LINK(IsLegalHdl_Impl, weld::Toggleable&, void);
     DECL_LINK(OrientHdl_Impl, weld::ComboBox&, void);
     DECL_LINK(SameLevelHdl_Impl, weld::Toggleable&, void);
     DECL_LINK(BulColorHdl_Impl, ColorListBox&, void);
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 19a2b37ed82d..9b97d19460b5 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -1037,6 +1037,7 @@ 
SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogC
     , m_xBulRelSizeMF(m_xBuilder->weld_metric_spin_button("relsize", 
FieldUnit::PERCENT))
     , m_xAllLevelFT(m_xBuilder->weld_label("sublevelsft"))
     , m_xAllLevelNF(m_xBuilder->weld_spin_button("sublevels"))
+    , m_xIsLegalCB(m_xBuilder->weld_check_button("islegal"))
     , m_xStartFT(m_xBuilder->weld_label("startatft"))
     , m_xStartED(m_xBuilder->weld_spin_button("startat"))
     , m_xBulletFT(m_xBuilder->weld_label("bulletft"))
@@ -1074,6 +1075,7 @@ 
SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogC
     m_xPrefixED->connect_changed(LINK(this, SvxNumOptionsTabPage, 
EditModifyHdl_Impl));
     m_xSuffixED->connect_changed(LINK(this, SvxNumOptionsTabPage, 
EditModifyHdl_Impl));
     m_xAllLevelNF->connect_value_changed(LINK(this,SvxNumOptionsTabPage, 
AllLevelHdl_Impl));
+    m_xIsLegalCB->connect_toggled(LINK(this, SvxNumOptionsTabPage, 
IsLegalHdl_Impl));
     m_xOrientLB->connect_changed(LINK(this, SvxNumOptionsTabPage, 
OrientHdl_Impl));
     m_xSameLevelCB->connect_toggled(LINK(this, SvxNumOptionsTabPage, 
SameLevelHdl_Impl));
     m_xBulRelSizeMF->connect_value_changed(LINK(this,SvxNumOptionsTabPage, 
BulRelSizeHdl_Impl));
@@ -1271,6 +1273,7 @@ void    SvxNumOptionsTabPage::Reset( const SfxItemSet* 
rSet )
     bool bAllLevel = bContinuous && !bHTMLMode;
     m_xAllLevelFT->set_visible(bAllLevel);
     m_xAllLevelNF->set_visible(bAllLevel);
+    m_xIsLegalCB->set_visible(bAllLevel);
 
     m_xAllLevelsFrame->set_visible(bContinuous);
 
@@ -1334,6 +1337,8 @@ void SvxNumOptionsTabPage::InitControls()
     bool bSameBulColor  = true;
     bool bSameBulRelSize= true;
 
+    TriState isLegal = TRISTATE_INDET;
+
     const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM];
     OUString sFirstCharFmt;
     sal_Int16 eFirstOrient = text::VertOrientation::NONE;
@@ -1358,6 +1363,7 @@ void SvxNumOptionsTabPage::InitControls()
                 eFirstOrient = aNumFmtArr[i]->GetVertOrient();
                 if(bShowBitmap)
                     aFirstSize = aNumFmtArr[i]->GetGraphicSize();
+                isLegal = aNumFmtArr[i]->GetIsLegal() ? TRISTATE_TRUE : 
TRISTATE_FALSE;
             }
             if( i > nLvl)
             {
@@ -1367,6 +1373,8 @@ void SvxNumOptionsTabPage::InitControls()
                 bSamePrefix = aNumFmtArr[i]->GetPrefix() == 
aNumFmtArr[nLvl]->GetPrefix();
                 bSameSuffix = aNumFmtArr[i]->GetSuffix() == 
aNumFmtArr[nLvl]->GetSuffix();
                 bAllLevel &= aNumFmtArr[i]->GetIncludeUpperLevels() == 
aNumFmtArr[nLvl]->GetIncludeUpperLevels();
+                if (aNumFmtArr[i]->GetIsLegal() != 
aNumFmtArr[nLvl]->GetIsLegal())
+                    isLegal = TRISTATE_INDET;
                 bSameCharFmt    &= sFirstCharFmt == 
aNumFmtArr[i]->GetCharFormatName();
                 bSameVOrient    &= eFirstOrient == 
aNumFmtArr[i]->GetVertOrient();
                 if(bShowBitmap && bSameSize)
@@ -1439,6 +1447,9 @@ void SvxNumOptionsTabPage::InitControls()
         m_xAllLevelNF->set_text("");
     }
 
+    m_xIsLegalCB->set_state(isLegal);
+    m_xIsLegalCB->set_sensitive(!m_xSameLevelCB->get_active());
+
     if(bBullRelSize)
     {
         if(bSameBulRelSize)
@@ -1518,6 +1529,7 @@ void SvxNumOptionsTabPage::SwitchNumberType( sal_uInt8 
nType )
     bool bAllLevel = bNumeric && bAllLevelFeature && !bHTMLMode;
     m_xAllLevelFT->set_visible(bAllLevel);
     m_xAllLevelNF->set_visible(bAllLevel);
+    m_xIsLegalCB->set_visible(bAllLevel);
 
     m_xStartFT->set_visible(!(bBullet||bBitmap));
     m_xStartED->set_visible(!(bBullet||bBitmap));
@@ -1627,6 +1639,21 @@ IMPL_LINK(SvxNumOptionsTabPage, AllLevelHdl_Impl, 
weld::SpinButton&, rBox, void)
     SetModified();
 }
 
+IMPL_LINK(SvxNumOptionsTabPage, IsLegalHdl_Impl, weld::Toggleable&, rBox, void)
+{
+    bool bSet = rBox.get_active();
+    for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+    {
+        if (nActNumLvl & (sal_uInt16(1) << i))
+        {
+            SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+            aNumFmt.SetIsLegal(bSet);
+            pActNum->SetLevel(i, aNumFmt);
+        }
+    }
+    SetModified();
+}
+
 IMPL_LINK(SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, weld::ComboBox&, 
rBox, void)
 {
     OUString sSelectStyle;
diff --git a/cui/uiconfig/ui/numberingoptionspage.ui 
b/cui/uiconfig/ui/numberingoptionspage.ui
index adb0ea9cc662..82ea810beef2 100644
--- a/cui/uiconfig/ui/numberingoptionspage.ui
+++ b/cui/uiconfig/ui/numberingoptionspage.ui
@@ -208,6 +208,25 @@
                         <property name="top_attach">7</property>
                       </packing>
                     </child>
+                    <child>
+                      <object class="GtkCheckButton" id="islegal">
+                        <property name="label" translatable="yes" 
context="numberingoptionspage|islegal">All sublevels Arabic</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                        <child internal-child="accessible">
+                          <object class="AtkObject" id="islegal-atkobject">
+                            <property name="AtkObject::accessible-description" 
translatable="yes" context="numberingoptionspage|extended_tip|islegal">Use 
Arabic numerals for all sublevels ("Legal" numbering).</property>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">8</property>
+                      </packing>
+                    </child>
                     <child>
                       <object class="GtkSpinButton" id="startat">
                         <property name="visible">True</property>
@@ -266,7 +285,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">11</property>
+                        <property name="top_attach">12</property>
                       </packing>
                     </child>
                     <child>
@@ -280,7 +299,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">12</property>
+                        <property name="top_attach">13</property>
                       </packing>
                     </child>
                     <child>
@@ -299,7 +318,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">12</property>
+                        <property name="top_attach">13</property>
                       </packing>
                     </child>
                     <child>
@@ -314,7 +333,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">13</property>
+                        <property name="top_attach">14</property>
                       </packing>
                     </child>
                     <child>
@@ -333,7 +352,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">13</property>
+                        <property name="top_attach">14</property>
                       </packing>
                     </child>
                     <child>
@@ -352,7 +371,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">14</property>
+                        <property name="top_attach">15</property>
                       </packing>
                     </child>
                     <child>
@@ -366,7 +385,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">15</property>
+                        <property name="top_attach">16</property>
                       </packing>
                     </child>
                     <child>
@@ -393,7 +412,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">15</property>
+                        <property name="top_attach">16</property>
                       </packing>
                     </child>
                     <child>
@@ -416,7 +435,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">11</property>
+                        <property name="top_attach">12</property>
                       </packing>
                     </child>
                     <child>
@@ -488,7 +507,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">9</property>
+                        <property name="top_attach">10</property>
                       </packing>
                     </child>
                     <child>
@@ -501,7 +520,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">8</property>
+                        <property name="top_attach">9</property>
                       </packing>
                     </child>
                     <child>
@@ -518,7 +537,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">10</property>
+                        <property name="top_attach">11</property>
                       </packing>
                     </child>
                     <child>
@@ -535,7 +554,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">9</property>
+                        <property name="top_attach">10</property>
                       </packing>
                     </child>
                     <child>
@@ -549,7 +568,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">10</property>
+                        <property name="top_attach">11</property>
                       </packing>
                     </child>
                     <child>
commit 778eda80b1c33fdd0a3de7ad356727464c12957e
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Jun 30 18:19:27 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Jul 11 19:07:48 2023 +0200

    tdf#150408: Implement "Legal" numbering (all levels using Arabic numbers)
    
    Enabling this feature on a list level makes all numbered sublevels, that
    constitute the number of this level, to use Arabic numerals. This doesn't
    change the labels of other levels: e.g., if level 1 uses A,B,C; level 2
    uses i,ii,iii; level 3 uses a,b,c, and is "Legal"; and level 4 uses 1,2,3;
    then a list may look like
    
      A. Something
        A.i. Some subitem
        A.ii. Another subitem
          1.2.1. This is a "Legal" sub-subitem
            A.ii.a.1. And its child
    
    This improves interoperability with Word.
    
    This change introduces document model, ODF and OOXML import and export.
    In ODF, a new boolean attribute of 'text:outline-level-style' element,
    'loext:is-legal', is introduced; its default value is "false".
    
    Change-Id: I5ae9f970864854c7e84c4b2f7ce46634b3ef104e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154288
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154332
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index e8c1c4d9a77c..97f857547029 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -113,7 +113,13 @@ OUString SvxNumberType::GetNumStr( sal_Int32 nNo ) const
     return GetNumStr( nNo, aLang.getLocale() );
 }
 
-OUString SvxNumberType::GetNumStr( sal_Int32 nNo, const css::lang::Locale& 
rLocale ) const
+static bool isArabicNumberingType(SvxNumType t)
+{
+    return t == SVX_NUM_ARABIC || t == SVX_NUM_ARABIC_ZERO || t == 
SVX_NUM_ARABIC_ZERO3
+           || t == SVX_NUM_ARABIC_ZERO4 || t == SVX_NUM_ARABIC_ZERO5;
+}
+
+OUString SvxNumberType::GetNumStr( sal_Int32 nNo, const css::lang::Locale& 
rLocale, bool bIsLegal ) const
 {
     lcl_getFormatter(xFormatter);
     if(!xFormatter.is())
@@ -133,11 +139,12 @@ OUString SvxNumberType::GetNumStr( sal_Int32 nNo, const 
css::lang::Locale& rLoca
                         return OUString('0');
                     else
                     {
+                        SvxNumType nActType = !bIsLegal || 
isArabicNumberingType(nNumType) ? nNumType : SVX_NUM_ARABIC;
                         static constexpr OUStringLiteral sNumberingType = 
u"NumberingType";
                         static constexpr OUStringLiteral sValue = u"Value";
                         Sequence< PropertyValue > aProperties
                         {
-                            comphelper::makePropertyValue(sNumberingType, 
static_cast<sal_uInt16>(nNumType)),
+                            comphelper::makePropertyValue(sNumberingType, 
static_cast<sal_uInt16>(nActType)),
                             comphelper::makePropertyValue(sValue, nNo)
                         };
 
@@ -366,6 +373,7 @@ SvxNumberFormat& SvxNumberFormat::operator=( const 
SvxNumberFormat& rFormat )
     pBulletFont.reset();
     if(rFormat.pBulletFont)
         pBulletFont = *rFormat.pBulletFont;
+    mbIsLegal = rFormat.mbIsLegal;
     return *this;
 }
 
@@ -392,7 +400,8 @@ bool  SvxNumberFormat::operator==( const SvxNumberFormat& 
rFormat) const
         nBulletColor        != rFormat.nBulletColor   ||
         nBulletRelSize      != rFormat.nBulletRelSize ||
         IsShowSymbol()      != rFormat.IsShowSymbol() ||
-        sCharStyleName      != rFormat.sCharStyleName
+        sCharStyleName      != rFormat.sCharStyleName ||
+        mbIsLegal           != rFormat.mbIsLegal
         )
         return false;
     if (
@@ -1006,7 +1015,7 @@ OUString SvxNumRule::MakeNumString( const SvxNodeNum& 
rNum ) const
                     if(SVX_NUM_BITMAP != rNFmt.GetNumberingType())
                     {
                         const LanguageTag& rLang = 
Application::GetSettings().GetLanguageTag();
-                        aStr.append(rNFmt.GetNumStr( rNum.GetLevelVal()[ i ], 
rLang.getLocale()  ));
+                        aStr.append(rNFmt.GetNumStr( rNum.GetLevelVal()[ i ], 
rLang.getLocale(), rMyNFmt.GetIsLegal() ));
                     }
                     else
                         bDot = false;
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index aea72d86a7ed..5005a20fa7a1 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -67,7 +67,7 @@ public:
     SvxNumberType & operator =(SvxNumberType const &) = default;
 
     OUString        GetNumStr( sal_Int32 nNo ) const;
-    OUString        GetNumStr( sal_Int32 nNo, const css::lang::Locale& rLocale 
) const;
+    OUString        GetNumStr( sal_Int32 nNo, const css::lang::Locale& 
rLocale, bool bIsLegal = false ) const;
 
     void            SetNumberingType(SvxNumType nSet) {nNumType = nSet;}
     SvxNumType      GetNumberingType() const {return nNumType;}
@@ -152,6 +152,8 @@ private:
 
     OUString            sCharStyleName;     // Character Style
 
+    bool mbIsLegal = false; // "Legal" level numbering = all levels use arabic 
numbering
+
 public:
     explicit SvxNumberFormat( SvxNumType nNumberingType );
     SvxNumberFormat(const SvxNumberFormat& rFormat);
@@ -223,6 +225,9 @@ public:
 
     static Size     GetGraphicSizeMM100(const Graphic* pGraphic);
     static OUString CreateRomanString( sal_Int32 nNo, bool bUpper );
+
+    bool GetIsLegal() const { return mbIsLegal; }
+    void SetIsLegal(bool val) { mbIsLegal = val; }
 };
 
 //Feature-Flags (only sal_uInt16!)
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 294d555c5669..a56731cf1163 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -1123,6 +1123,7 @@ namespace xmloff::token {
         XML_IS_ACTIVE,
         XML_IS_DATA_LAYOUT_FIELD,
         XML_IS_HIDDEN,
+        XML_IS_LEGAL,
         XML_IS_SELECTION,
         XML_ISBN,
         XML_ITALIC,
diff --git a/offapi/com/sun/star/style/NumberingLevel.idl 
b/offapi/com/sun/star/style/NumberingLevel.idl
index dd4959c3de2e..e660e1fa1a65 100644
--- a/offapi/com/sun/star/style/NumberingLevel.idl
+++ b/offapi/com/sun/star/style/NumberingLevel.idl
@@ -98,6 +98,12 @@ published service NumberingLevel
         @since LibreOffice 7.2
      */
     [optional, property] string ListFormat;
+
+    /** Specifies if this level should use Arabic numbers for all levels
+
+        @since LibreOffice 24.2
+     */
+    [optional, property] boolean IsLegal;
 };
 
 
diff --git a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng 
b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
index 8160b6bbd845..84dda4a82155 100644
--- a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
+++ b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
@@ -3148,6 +3148,21 @@ 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
     </rng:optional>
   </rng:define>
 
+  <!-- TODO no proposal -->
+  <rng:define name="text-list-level-style-number-attr" combine="interleave">
+    <rng:ref name="common-level-attlist"/>
+  </rng:define>
+  <rng:define name="text-outline-level-style-attlist" combine="interleave">
+    <rng:ref name="common-level-attlist"/>
+  </rng:define>
+  <rng:define name="common-level-attlist">
+    <rng:optional>
+      <rng:attribute name="loext:is-legal">
+        <rng:ref name="boolean"/>
+      </rng:attribute>
+    </rng:optional>
+  </rng:define>
+
   <!-- TODO no proposal -->
   <rng:define name="paragraph-content" combine="choice"
    
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0">
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index b1a81877799e..8b5328462d7d 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -899,6 +899,7 @@ inline constexpr OUStringLiteral 
UNO_NAME_DOC_INTEROP_GRAB_BAG = u"InteropGrabBa
 inline constexpr OUStringLiteral UNO_NAME_FRAME_INTEROP_GRAB_BAG = 
u"FrameInteropGrabBag";
 inline constexpr OUStringLiteral UNO_NAME_CHAR_HIGHLIGHT = u"CharHighlight";
 inline constexpr OUStringLiteral UNO_NAME_STYLE_INTEROP_GRAB_BAG = 
u"StyleInteropGrabBag";
+inline constexpr OUStringLiteral UNO_NAME_LEVEL_IS_LEGAL = u"IsLegal";
 inline constexpr OUStringLiteral UNO_NAME_CHAR_INTEROP_GRAB_BAG = 
u"CharInteropGrabBag";
 inline constexpr OUStringLiteral UNO_NAME_TEXT_VERT_ADJUST = 
u"TextVerticalAdjust";
 inline constexpr OUStringLiteral UNO_NAME_CELL_INTEROP_GRAB_BAG = 
u"CellInteropGrabBag";
diff --git a/sw/qa/extras/odfexport/data/IsLegal.fodt 
b/sw/qa/extras/odfexport/data/IsLegal.fodt
new file mode 100644
index 000000000000..a4af751fb16a
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/IsLegal.fodt
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/"; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:ooow="http://openoffice.org/200
 4/writer" xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; xmlns
 :css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:officeooo="http://openoffice.org/2009/office"; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:styles>
+  <style:style style:name="Custom1" style:family="paragraph" 
style:default-outline-level="1"/>
+  <style:style style:name="Custom2" style:family="paragraph" 
style:default-outline-level="2"/>
+  <text:outline-style style:name="Outline">
+   <text:outline-level-style text:level="1" loext:num-list-format="CH %1%" 
style:num-prefix="CH " style:num-format="I">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="nothing"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="2" loext:is-legal="true" 
loext:num-list-format="Sect %1%.%2%" style:num-prefix="Sect " 
style:num-format="01, 02, 03, ..." text:display-levels="2">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab" 
text:list-tab-stop-position="3.81cm" fo:text-indent="1.27cm"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+  </text:outline-style>
+ </office:styles>
+ <office:body>
+  <office:text>
+   <text:h text:style-name="Custom1" text:outline-level="1"/>
+   <text:h text:style-name="Custom2" text:outline-level="2">Foo</text:h>
+   <text:h text:style-name="Custom1" text:outline-level="1"/>
+   <text:h text:style-name="Custom2" text:outline-level="2">Bar</text:h>
+  </office:text>
+ </office:body>
+</office:document>
\ No newline at end of file
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx 
b/sw/qa/extras/odfexport/odfexport2.cxx
index 8dff88773630..0dc71704c227 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -843,6 +843,28 @@ CPPUNIT_TEST_FIXTURE(Test, 
testParagraphMarkerMarkupRoundtrip)
     assertXPath(pXmlDoc, 
"/office:document-content/office:automatic-styles/style:style[@style:name='T2']/style:text-properties",
 "color", "#ff0000");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf150408_IsLegal)
+{
+    loadAndReload("IsLegal.fodt");
+
+    // Second level's numbering should use Arabic numbers for first level 
reference
+    auto xPara = getParagraph(1);
+    CPPUNIT_ASSERT_EQUAL(OUString("CH I"), getProperty<OUString>(xPara, 
"ListLabelString"));
+    xPara = getParagraph(2);
+    CPPUNIT_ASSERT_EQUAL(OUString("Sect 1.01"), getProperty<OUString>(xPara, 
"ListLabelString"));
+    xPara = getParagraph(3);
+    CPPUNIT_ASSERT_EQUAL(OUString("CH II"), getProperty<OUString>(xPara, 
"ListLabelString"));
+    xPara = getParagraph(4);
+    CPPUNIT_ASSERT_EQUAL(OUString("Sect 2.01"), getProperty<OUString>(xPara, 
"ListLabelString"));
+
+    // Test that the markup stays at save-and-reload
+    xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
+    assertXPath(
+        pXmlDoc,
+        
"/office:document-styles/office:styles/text:outline-style/text:outline-level-style[2]",
+        "is-legal", "true");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/data/listWithLgl.docx 
b/sw/qa/extras/ooxmlexport/data/listWithLgl.docx
new file mode 100644
index 000000000000..3bc5c32d2d14
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/listWithLgl.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index b2a4fdafeec3..1a3a551ffcfc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -609,6 +609,26 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf133560)
     CPPUNIT_ASSERT_EQUAL(12.0f, getProperty<float>(getParagraph(4), 
"CharHeight"));
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf150408_isLvl_RoundTrip)
+{
+    loadAndSave("listWithLgl.docx");
+
+    // Second level's numbering should use Arabic numbers for first level 
reference
+    auto xPara = getParagraph(1);
+    CPPUNIT_ASSERT_EQUAL(OUString("CH I"), getProperty<OUString>(xPara, 
"ListLabelString"));
+    xPara = getParagraph(2);
+    CPPUNIT_ASSERT_EQUAL(OUString("Sect 1.01"), getProperty<OUString>(xPara, 
"ListLabelString"));
+    xPara = getParagraph(3);
+    CPPUNIT_ASSERT_EQUAL(OUString("CH II"), getProperty<OUString>(xPara, 
"ListLabelString"));
+    xPara = getParagraph(4);
+    CPPUNIT_ASSERT_EQUAL(OUString("Sect 2.01"), getProperty<OUString>(xPara, 
"ListLabelString"));
+
+    xmlDocUniquePtr pXml = parseExport("word/numbering.xml");
+    assertXPath(pXml, "/w:numbering/w:abstractNum"); // Only one list
+    // The second list level must keep the isLgl element
+    assertXPath(pXml, "/w:numbering/w:abstractNum/w:lvl[2]/w:isLgl");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index f953a93dbde4..3ab36c63c160 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -711,7 +711,7 @@ OUString SwNumRule::MakeNumString( const 
SwNumberTree::tNumberVector & rNumVecto
                 }
             }
             else if (rNumVector[i])
-                sReplacement = Get(i).GetNumStr(rNumVector[i], aLocale);
+                sReplacement = Get(i).GetNumStr(rNumVector[i], aLocale, 
rMyNFormat.GetIsLegal());
             else
                 sReplacement = "0";        // all 0 level are a 0
 
@@ -756,7 +756,7 @@ OUString SwNumRule::MakeNumString( const 
SwNumberTree::tNumberVector & rNumVecto
             }
 
             if (rNumVector[i])
-                aStr.append(rNFormat.GetNumStr(rNumVector[i], aLocale));
+                aStr.append(rNFormat.GetNumStr(rNumVector[i], aLocale, 
rMyNFormat.GetIsLegal()));
             else
                 aStr.append("0");        // all 0 level are a 0
             if (i != nLevel && !aStr.isEmpty())
diff --git a/sw/source/core/unocore/unosett.cxx 
b/sw/source/core/unocore/unosett.cxx
index de51da9b3e9d..33481147c39f 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -1313,6 +1313,9 @@ uno::Sequence<beans::PropertyValue> 
SwXNumberingRules::GetPropertiesForNumFormat
         aPropertyValues.push_back(comphelper::makePropertyValue("ListFormat", 
rFormat.GetListFormat()));
     }
 
+    if (rFormat.GetIsLegal())
+        
aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_LEVEL_IS_LEGAL,
 true));
+
     //char style name
     aUString.clear();
     SwStyleNameMapper::FillProgName( rCharFormatName, aUString, 
SwGetPoolIdFromName::ChrFmt);
@@ -1891,6 +1894,11 @@ void SwXNumberingRules::SetPropertiesToNumFormat(
             rProp.Value >>= uTmp;
             aFormat.SetListFormat(uTmp);
         }
+        else if (rProp.Name == UNO_NAME_LEVEL_IS_LEGAL)
+        {
+            if (bool bVal; rProp.Value >>= bVal)
+                aFormat.SetIsLegal(bVal);
+        }
         else
         {
             // Invalid property name
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx 
b/sw/source/filter/ww8/attributeoutputbase.hxx
index 99cae10812cc..f9c23fe892ac 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -368,7 +368,8 @@ public:
         sal_Int16 nFirstLineIndex,
         sal_Int16 nListTabPos,
         const OUString &rNumberingString,
-        const SvxBrushItem* pBrush) = 0; // #i120928 export graphic of bullet
+        const SvxBrushItem* pBrush, // #i120928 export graphic of bullet
+        bool isLegal) = 0;
 
 protected:
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index cb97a6aa0e6f..93d61c157b06 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7483,7 +7483,8 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 
nLevel,
         sal_Int16 nFirstLineIndex,
         sal_Int16 nListTabPos,
         const OUString &rNumberingString,
-        const SvxBrushItem* pBrush)
+        const SvxBrushItem* pBrush,
+        bool isLegal)
 {
     m_pSerializer->startElementNS(XML_w, XML_lvl, FSNS(XML_w, XML_ilvl), 
OString::number(nLevel));
 
@@ -7503,6 +7504,10 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 
nLevel,
             m_pSerializer->singleElementNS( XML_w, XML_pStyle ,
                 FSNS( XML_w, XML_val ), m_rExport.m_pStyles->GetStyleId(nId) );
     }
+
+    if (isLegal)
+        m_pSerializer->singleElementNS(XML_w, XML_isLgl);
+
     // format
     OString aCustomFormat;
     OString aFormat(lcl_ConvertNumberingType(nNumberingType, pOutSet, 
aCustomFormat, "decimal"));
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx 
b/sw/source/filter/ww8/docxattributeoutput.hxx
index 7ebff035995e..aaff43fc0683 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -416,7 +416,8 @@ public:
         sal_Int16 nFirstLineIndex,
         sal_Int16 nListTabPos,
         const OUString &rNumberingString,
-        const SvxBrushItem* pBrush ) override;
+        const SvxBrushItem* pBrush,
+        bool isLegal ) override;
 
     void WriteField_Impl(const SwField* pField, ww::eField eType,
             const OUString& rFieldCmd, FieldFlags nMode,
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 03c7c0a0ae0b..5f5de3af8694 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1624,7 +1624,7 @@ void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, 
sal_uInt16 nStart,
                                         const wwFont* pFont, const SfxItemSet* 
pOutSet,
                                         sal_Int16 nIndentAt, sal_Int16 
nFirstLineIndex,
                                         sal_Int16 /*nListTabPos*/, const 
OUString& rNumberingString,
-                                        const SvxBrushItem* pBrush)
+                                        const SvxBrushItem* pBrush, bool 
/*isLegal*/)
 {
     m_rExport.Strm().WriteCharPtr(SAL_NEWLINE_STRING);
     if (nLevel > 8) // RTF knows only 9 levels
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx 
b/sw/source/filter/ww8/rtfattributeoutput.hxx
index 8ce5fcd3ca28..bbcbd862a808 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -219,13 +219,13 @@ public:
     void EndAbstractNumbering() override;
 
     /// All the numbering level information.
-    void
-    NumberingLevel(sal_uInt8 nLevel, sal_uInt16 nStart, sal_uInt16 
nNumberingType,
-                   SvxAdjust eAdjust, const sal_uInt8* pNumLvlPos, sal_uInt8 
nFollow,
-                   const wwFont* pFont, const SfxItemSet* pOutSet, sal_Int16 
nIndentAt,
-                   sal_Int16 nFirstLineIndex, sal_Int16 nListTabPos,
-                   const OUString& rNumberingString,
-                   const SvxBrushItem* pBrush) override; //For i120928,to 
export graphic of bullet
+    void NumberingLevel(sal_uInt8 nLevel, sal_uInt16 nStart, sal_uInt16 
nNumberingType,
+                        SvxAdjust eAdjust, const sal_uInt8* pNumLvlPos, 
sal_uInt8 nFollow,
+                        const wwFont* pFont, const SfxItemSet* pOutSet, 
sal_Int16 nIndentAt,
+                        sal_Int16 nFirstLineIndex, sal_Int16 nListTabPos,
+                        const OUString& rNumberingString,
+                        const SvxBrushItem* pBrush, //For i120928,to export 
graphic of bullet
+                        bool isLegal) override;
 
     void WriteField_Impl(const SwField* pField, ww::eField eType, const 
OUString& rFieldCmd,
                          FieldFlags nMode);
diff --git a/sw/source/filter/ww8/wrtw8num.cxx 
b/sw/source/filter/ww8/wrtw8num.cxx
index 29e93c1b956c..8d59434db652 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -278,7 +278,8 @@ void WW8AttributeOutput::NumberingLevel( sal_uInt8 
/*nLevel*/,
         sal_Int16 nFirstLineIndex,
         sal_Int16 nListTabPos,
         const OUString &rNumberingString,
-        const SvxBrushItem* pBrush //For i120928,to transfer graphic of bullet
+        const SvxBrushItem* pBrush, //For i120928,to transfer graphic of bullet
+        bool /*isLegal*/
     )
 {
     // Start value
@@ -566,7 +567,7 @@ void MSWordExportBase::NumberingLevel(
             pPseudoFont.get(), pOutSet,
             nIndentAt, nFirstLineIndex, nListTabPos,
             sNumStr,
-            rFormat.GetNumberingType()==SVX_NUM_BITMAP ? rFormat.GetBrush() : 
nullptr);
+            rFormat.GetNumberingType()==SVX_NUM_BITMAP ? rFormat.GetBrush() : 
nullptr, rFormat.GetIsLegal());
 }
 
 void WW8Export::OutOverrideListTab()
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx 
b/sw/source/filter/ww8/ww8attributeoutput.hxx
index b983f49e9570..8abe00e796d3 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -202,7 +202,8 @@ public:
         sal_Int16 nFirstLineIndex,
         sal_Int16 nListTabPos,
         const OUString &rNumberingString,
-        const SvxBrushItem* pBrush) override; //For i120928,transfer graphic 
of bullet
+        const SvxBrushItem* pBrush, //For i120928,transfer graphic of bullet
+        bool isLegal) override;
 
 protected:
     /// Output frames - the implementation.
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index 047e775d726f..67e651df3a29 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -55,7 +55,7 @@ namespace writerfilter::dmapper {
 template <typename T>
 static beans::PropertyValue lcl_makePropVal(PropertyIds nNameID, T const & 
aValue)
 {
-    return {getPropertyName(nNameID), 0, uno::Any(aValue), 
beans::PropertyState_DIRECT_VALUE};
+    return comphelper::makePropertyValue(getPropertyName(nNameID), aValue);
 }
 
 static sal_Int32 lcl_findProperty( const uno::Sequence< beans::PropertyValue 
>& aProps, std::u16string_view sName )
@@ -111,6 +111,7 @@ void ListLevel::SetValue( Id nId, sal_Int32 nValue )
             m_nNFC = nValue;
         break;
         case NS_ooxml::LN_CT_Lvl_isLgl:
+            m_bIsLegal = true;
         break;
         case NS_ooxml::LN_CT_Lvl_legacy:
         break;
@@ -268,6 +269,9 @@ uno::Sequence<beans::PropertyValue> 
ListLevel::GetLevelProperties(bool bDefaults
     if (aPropFont)
         aNumberingProperties.emplace_back( 
getPropertyName(PROP_BULLET_FONT_NAME), 0, aPropFont->second, 
beans::PropertyState_DIRECT_VALUE );
 
+    if (m_bIsLegal)
+        aNumberingProperties.push_back(lcl_makePropVal(PROP_LEVEL_IS_LEGAL, 
true));
+
     return comphelper::containerToSequence(aNumberingProperties);
 }
 
diff --git a/writerfilter/source/dmapper/NumberingManager.hxx 
b/writerfilter/source/dmapper/NumberingManager.hxx
index 4bae58b8e51c..fc3c2f05b72f 100644
--- a/writerfilter/source/dmapper/NumberingManager.hxx
+++ b/writerfilter/source/dmapper/NumberingManager.hxx
@@ -52,6 +52,7 @@ class ListLevel : public PropertyMap
     std::optional<sal_Int32>               m_nTabstop;
     tools::SvRef< StyleSheetEntry >          m_pParaStyle;
     bool m_bHasValues = false;
+    bool m_bIsLegal = false;
 
 public:
 
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx 
b/writerfilter/source/dmapper/PropertyIds.cxx
index b77991581ae9..551de3b27676 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -220,6 +220,7 @@ const OUString & getPropertyName( PropertyIds eId )
         { PROP_LEVEL_FOLLOW, u"LabelFollowedBy"},
         { PROP_LEVEL_PARAGRAPH_STYLES, u"LevelParagraphStyles"},
         { PROP_LEVEL_FORMAT, u"LevelFormat"},
+        { PROP_LEVEL_IS_LEGAL, u"IsLegal"},
         { PROP_LIST_FORMAT, u"ListFormat"},
         { PROP_TOKEN_TYPE, u"TokenType"},
         { PROP_TOKEN_HYPERLINK_START, u"TokenHyperlinkStart"},
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx 
b/writerfilter/source/dmapper/PropertyIds.hxx
index 3f272743db7b..c35975cfcc6c 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -219,6 +219,7 @@ enum PropertyIds
         ,PROP_LEVEL_FOLLOW
         ,PROP_LEVEL_FORMAT
         ,PROP_LEVEL_PARAGRAPH_STYLES
+        ,PROP_LEVEL_IS_LEGAL
         ,PROP_LISTTAB_STOP_POSITION
         ,PROP_LIST_FORMAT
         ,PROP_MACRO_NAME
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 5032751de123..3f338eed9821 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1136,6 +1136,7 @@ namespace xmloff::token {
         TOKEN( "is-active",                       XML_IS_ACTIVE ),
         TOKEN( "is-data-layout-field",            XML_IS_DATA_LAYOUT_FIELD ),
         TOKEN( "is-hidden",                       XML_IS_HIDDEN ),
+        TOKEN( "is-legal",                        XML_IS_LEGAL ),
         TOKEN( "is-selection",                    XML_IS_SELECTION ),
         TOKEN( "isbn",                            XML_ISBN ),
         TOKEN( "italic",                          XML_ITALIC ),
diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx
index 9ec9350374db..233086fed29f 100644
--- a/xmloff/source/style/xmlnume.cxx
+++ b/xmloff/source/style/xmlnume.cxx
@@ -84,6 +84,7 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel,
     sal_Int16 eAdjust = HoriOrientation::LEFT;
     OUString sPrefix, sSuffix, sListFormat;
     OUString sTextStyleName;
+    bool bIsLegal = false;
     bool bHasColor = false;
     sal_Int32 nColor = 0;
     sal_Int32 nSpaceBefore = 0, nMinLabelWidth = 0, nMinLabelDist = 0;
@@ -125,6 +126,10 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 
nLevel,
         {
             rProp.Value >>= sListFormat;
         }
+        else if (rProp.Name == "IsLegal")
+        {
+            rProp.Value >>= bIsLegal;
+        }
         else if (rProp.Name == "BulletChar")
         {
             OUString sValue;
@@ -256,6 +261,11 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 
nLevel,
             GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
                     GetExport().EncodeStyleName( sTextStyleName ) );
         }
+        if (bIsLegal)
+        {
+            if (GetExport().getSaneDefaultVersion() & 
SvtSaveOptions::ODFSVER_EXTENDED)
+                GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_IS_LEGAL, 
"true");
+        }
         if (!sListFormat.isEmpty())
         {
             if (GetExport().getSaneDefaultVersion() & 
SvtSaveOptions::ODFSVER_EXTENDED)
diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx
index f75a325ba0de..de90c19f010c 100644
--- a/xmloff/source/style/xmlnumi.cxx
+++ b/xmloff/source/style/xmlnumi.cxx
@@ -157,6 +157,8 @@ class SvxXMLListLevelStyleContext_Impl : public 
SvXMLImportContext
     bool            bNum : 1;
     bool            bHasColor : 1;
 
+    bool            m_bIsLegal = false;
+
     void SetRelSize( sal_Int16 nRel ) { nRelSize = nRel; }
     void SetColor( Color nColor )
         { m_nColor = nColor; bHasColor = true; }
@@ -305,6 +307,9 @@ 
SvxXMLListLevelStyleContext_Impl::SvxXMLListLevelStyleContext_Impl(
         case XML_ELEMENT(LO_EXT, XML_NUM_LIST_FORMAT):
             sListFormat = std::make_optional(aIter.toString());
             break;
+        case XML_ELEMENT(LO_EXT, XML_IS_LEGAL):
+            m_bIsLegal = aIter.toBoolean();
+            break;
         case XML_ELEMENT(STYLE, XML_NUM_LETTER_SYNC):
             if( bNum )
                 sNumLetterSync = aIter.toString();
@@ -522,6 +527,9 @@ Sequence<beans::PropertyValue> 
SvxXMLListLevelStyleContext_Impl::GetProperties()
 
     aProperties.push_back(comphelper::makePropertyValue("ListFormat", 
*sListFormat));
 
+    if (m_bIsLegal)
+        aProperties.push_back(comphelper::makePropertyValue("IsLegal", true));
+
     return comphelper::containerToSequence(aProperties);
 }
 
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index 304289112990..97ec4af19cfc 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -1036,6 +1036,7 @@ inverse
 is-active
 is-data-layout-field
 is-hidden
+is-legal
 is-selection
 isbn
 italic

Reply via email to