[Libreoffice-commits] core.git: writerfilter/source

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 2 07:08:36 UTC 2021


 writerfilter/source/dmapper/DomainMapper.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit b87c7eb674dfc4ee76fa48af67da6cb13a8d6aa6
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Wed Sep 1 14:12:51 2021 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Sep 2 09:08:01 2021 +0200

    tdf#137363 DOCX filter: no NUMBERING_LEVEL 9(no-level) in styles
    
    The only real (initial) reason for setting PROP_NUMBERING_LEVEL
    in the style was to round-trip it so it didn't get lost.
    It does kinda give a nice side benefit in UI, where the style
    can now set the listLevel at the same time as turning numbering on
    (at least on the second try.)
    
    However, 9 ends up meaning LEVEL 10 in LO UI, instead of NO LEVEL.
    So eliminate that value from round-trippability,
    since LO has no correlating NO LEVEL value possible for that PROP.
    
    The UI is too broken and inconsistent for any attempt
    at a unit test.
    
    Change-Id: Ibd9cea2ec10e85651f9f6643ad1b49ebf9babe12
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121448
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 6b940f02e577..913730f79bee 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1316,7 +1316,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
         rContext->Insert(PROP_BREAK_TYPE, uno::makeAny(nIntValue ? style::BreakType_PAGE_BEFORE : style::BreakType_NONE), /*bOverwrite=*/bool(nIntValue));
     break;
     case NS_ooxml::LN_CT_NumPr_ilvl:
-            if (nIntValue < 0 || 10 <= nIntValue) // Writer can't do everything
+            if (nIntValue < 0 || 10 <= nIntValue)
             {
                 SAL_INFO("writerfilter",
                         "unsupported numbering level " << nIntValue);
@@ -1329,7 +1329,13 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
                 if (pStyleSheetPropertyMap)
                     pStyleSheetPropertyMap->SetListLevel( static_cast<sal_Int16>(nIntValue) );
             }
-            rContext->Insert(PROP_NUMBERING_LEVEL, uno::makeAny(static_cast<sal_Int16>(nIntValue)));
+            // 0-8 are the 9 levels that Microsoft supports. (LO supports 10 levels).
+            // 9 indicates "no numbering", for which LO has no corresponding concept,
+            // and so it will be treated as the 10th level.
+            // finishParagraph() will convert the 9 into "no numbering" for direct formating.
+            // (Styles only use this PROP for round-tripping and UI, but cannot trust it for import)
+            if (!IsStyleSheetImport() || nIntValue != 9)
+                rContext->Insert(PROP_NUMBERING_LEVEL, uno::makeAny(static_cast<sal_Int16>(nIntValue)));
         break;
     case NS_ooxml::LN_CT_NumPr_numId:
         {


More information about the Libreoffice-commits mailing list