writerfilter/source/dmapper/DomainMapper.cxx      |    3 ---
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    7 ++++++-
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit f73fd9918b0002128e209b0e5ba7593a05d05c88
Author:     Justin Luth <justin_l...@sil.org>
AuthorDate: Tue Aug 31 11:16:17 2021 +0200
Commit:     Justin Luth <justin_l...@sil.org>
CommitDate: Wed Sep 1 18:37:51 2021 +0200

    tdf#137363 DOCX filter: outlineLvl not associated with iLvl
    
    Lets make sure no one gets the wrong impression that
    these are somehow connected together. They aren't at all.
    
    In order to make that work, the newly added para style
    ability to carry PROP_NUMBERING_LEVEL should not be trusted
    as an inheritance, since it can drift out of sync when
    ValidateListlevel changes the value to body level.
    
    Lets just ignore the drift for now.
    
    Unfortunately, I don't see any way in UNO to setPropertyToDefault
    or Erase or ClearProperty.
    
    Keeping PROP_NUMBERING_LEVEL in sync with 9 isn't great
    because 9 has a totally different meaning in LO UI.
    There it means the highest level 10. This can be seen when enabling
    numbering on these paragraphs - they jump to level 10 right away
    since they already have the property set to 9, the highest value.
    
    The other option would be setting to 0 (the default value).
    But that still doesn't solve the out-of-sync/inheritance problem.
    
    Thus I just ignore the problem for now, waiting for
    -PROP_NUMBERING_LEVEL to gain a NO_LEVEL value
    -uno gaining an erase ability
    -a real problem that forces some kind of solution.
    
    Change-Id: Ie6d098fa60a18ac2e3e7d1e33276ca923bfbfaa5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121368
    Tested-by: Justin Luth <justin_l...@sil.org>
    Reviewed-by: Justin Luth <justin_l...@sil.org>

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index c994d7b6df0b..6b940f02e577 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1563,9 +1563,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
                 StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< 
StyleSheetPropertyMap* >( rContext.get() );
                 if (pStyleSheetPropertyMap)
                     pStyleSheetPropertyMap->SetOutlineLevel(nIntValue);
-
-                // Prefer outline levels over numbering levels.
-                rContext->Erase(PROP_NUMBERING_LEVEL);
             }
             else
             {
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index c5f4b9a51968..44c9115a51e2 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1457,7 +1457,11 @@ sal_Int16 DomainMapper_Impl::GetListLevel(const 
StyleSheetEntryPtr& pEntry,
     sal_Int16 nListLevel = -1;
     if (pParaContext)
     {
-        GetAnyProperty(PROP_NUMBERING_LEVEL, pParaContext) >>= nListLevel;
+        // Deliberately ignore inherited PROP_NUMBERING_LEVEL. Only trust 
StyleSheetEntry for that.
+        std::optional<PropertyMap::Property> aLvl = 
pParaContext->getProperty(PROP_NUMBERING_LEVEL);
+        if (aLvl)
+            aLvl->second >>= nListLevel;
+
         if (nListLevel != -1)
             return nListLevel;
     }
@@ -1521,6 +1525,7 @@ void DomainMapper_Impl::ValidateListLevel(const OUString& 
sStyleIdentifierD)
         // This level is already used by another style, so prevent numbering 
via this style
         // by setting to body level (9).
         pMyStyle->pProperties->SetListLevel(WW_OUTLINE_MAX);
+        // WARNING: PROP_NUMBERING_LEVEL is now out of sync with GetListLevel()
     }
 }
 

Reply via email to