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

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Fri Dec 6 12:03:35 UTC 2019


 sw/qa/extras/ooxmlexport/ooxmlexport.cxx          |   18 ++++++++++++++++--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    3 +++
 2 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 6ed12ab2d0742f86ce25defec3c776562dbfad9a
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Fri Nov 1 10:39:47 2019 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Dec 6 13:02:00 2019 +0100

    tdf#120546 fix DOCX overriding numrule format
    
    ... at least in the view.
    
    This "fixes" the import side of the exported OOXML document with
    multiple overridden numrule character format. This prevents the
    change of the shared numrule, which results in all bullets being
    formatted like the last overridden numrule.
    
    What is missing is a consistent way to edit the override, as the
    override is currently just stored in an internal attribute, the
    "ListAutoFormat" property.
    
    Fixing editing for good will be a larger work, as "ListAutoFormat"
    must be reflected in the GUI and must have a higher priority then
    the numrule format. Currently positioning the curser in front of
    the number or bullet entry lets one change the numrule format,
    which is applied to all bullets of the same rule.
    
    This special DOCX override mode is enabled by the import filter
    setting DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING
    to true. This should also change the edit mode, so that a change
    of the entry doesn't modify the rule, but the override and this
    must also be reflected in the GUI character settings.
    
    Change-Id: I057f7a354bc3c413b114eec772e06c7063029699
    Reviewed-on: https://gerrit.libreoffice.org/81878
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 75e890338e62..7fd3c61d207c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -357,9 +357,23 @@ DECLARE_OOXMLEXPORT_TEST(testPositionAndRotation, "position-and-rotation.docx")
 
 DECLARE_OOXMLEXPORT_TEST(testNumberingFont, "numbering-font.docx")
 {
+    // check that the original numrule font name is still Calibri
     uno::Reference<beans::XPropertySet> xStyle(getStyles("CharacterStyles")->getByName("ListLabel 1"), uno::UNO_QUERY);
-    // This was Calibri, i.e. custom font of the numbering itself ("1.\t") was lost on import.
-    CPPUNIT_ASSERT_EQUAL(OUString("Verdana"), getProperty<OUString>(xStyle, "CharFontName"));
+    CPPUNIT_ASSERT_EQUAL(OUString("Calibri"), getProperty<OUString>(xStyle, "CharFontName"));
+
+    uno::Reference<text::XTextRange> xPara = getParagraph(2);
+    uno::Reference<beans::XPropertySet> properties(xPara, uno::UNO_QUERY);
+    uno::Any aValue = properties->getPropertyValue("ListAutoFormat");
+    CPPUNIT_ASSERT(aValue.hasValue());
+    uno::Sequence<beans::NamedValue> aListAutoFormat;
+    CPPUNIT_ASSERT(aValue >>= aListAutoFormat);
+    auto it = std::find_if(std::cbegin(aListAutoFormat), std::cend(aListAutoFormat),
+        [](const css::beans::NamedValue& val) { return val.Name == "CharFontName"; });
+    CPPUNIT_ASSERT(it != std::cend(aListAutoFormat));
+    OUString sOverrideFontName;
+    CPPUNIT_ASSERT(it->Value >>= sOverrideFontName);
+    // but the overridden font name is Verdana
+    CPPUNIT_ASSERT_EQUAL(OUString("Verdana"), sOverrideFontName);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf106541_noinheritChapterNumbering, "tdf106541_noinheritChapterNumbering.odt")
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 2238984124b1..41a44ce10715 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -6493,6 +6493,9 @@ uno::Reference<beans::XPropertySet> DomainMapper_Impl::GetCurrentNumberingCharSt
             xLevels = GetCurrentNumberingRules(&nListLevel);
         if (!xLevels.is())
         {
+            if (IsOOXMLImport())
+                return xRet;
+
             PropertyMapPtr pContext = m_pTopContext;
             if (IsRTFImport() && !IsOpenField())
             {


More information about the Libreoffice-commits mailing list