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

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 6 14:26:32 UTC 2019


 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx       |    5 +++++
 writerfilter/source/dmapper/StyleSheetTable.cxx |    5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 9a19a1235c301f2699157ab44049bdfd54955e8a
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Fri Aug 2 17:28:58 2019 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Aug 6 16:25:44 2019 +0200

    tdf#118936 writerfilter: MultiPropertySet exception lost properties
    
    An unsupported character style property was causing the loss of
    some properties - anything with a higher sorting value.
    
    Another way to deal with this could be something similar
    to section properties which retries properties individually
    if multiset fails.
    
    Another option is to add CHAR_SHADING_VALUE to aCharStyleMap
    in unomap1.cxx, since it is already in aAutoCharStyleMap.
    However, this is an area I completely don't understand.
    
    Change-Id: I70676c7a35d0efc95222960609da039e26df8a58
    Reviewed-on: https://gerrit.libreoffice.org/76875
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index fb6836c64f88..ec87951cdeec 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -332,6 +332,11 @@ DECLARE_OOXMLEXPORT_TEST(testTcBorders, "testTcBorders.docx")
     assertXPath(pXmlDocument, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tcPr[1]/w:tcBorders[1]/w:bottom[1][@w:sz = 4]", 1);
     assertXPath(pXmlDocument, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tcPr[1]/w:tcBorders[1]/w:bottom[1][@w:space = 0]", 1);
     assertXPath(pXmlDocument, "/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tcPr[1]/w:tcBorders[1]/w:bottom[1][@w:color = 808080]", 1);
+
+    uno::Reference<beans::XPropertySet> xStyle(
+        getStyles("CharacterStyles")->getByName("Code Featured Element"),
+        uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Bold", float(150), getProperty<float>(xStyle, "CharWeight"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testQuicktables, "quicktables.docx")
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 5b23d9aaedb0..d3630e7a6f97 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -913,6 +913,7 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable )
                 if( pEntry->nStyleTypeCode == STYLE_TYPE_CHAR || pEntry->nStyleTypeCode == STYLE_TYPE_PARA || pEntry->nStyleTypeCode == STYLE_TYPE_LIST )
                 {
                     bool bParaStyle = pEntry->nStyleTypeCode == STYLE_TYPE_PARA;
+                    bool bCharStyle = pEntry->nStyleTypeCode == STYLE_TYPE_CHAR;
                     bool bListStyle = pEntry->nStyleTypeCode == STYLE_TYPE_LIST;
                     bool bInsert = false;
                     uno::Reference< container::XNameContainer > xStyles = bParaStyle ? xParaStyles : (bListStyle ? xNumberingStyles : xCharStyles);
@@ -1098,7 +1099,8 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable )
                             // Don't add the style name properties
                             bool bIsParaStyleName = rValue.Name == "ParaStyleName";
                             bool bIsCharStyleName = rValue.Name == "CharStyleName";
-                            if ( !bIsParaStyleName && !bIsCharStyleName )
+                            bool bDirectFormattingOnly = bCharStyle && rValue.Name == "CharShadingValue";
+                            if ( !bIsParaStyleName && !bIsCharStyleName && !bDirectFormattingOnly )
                             {
                                 aSortedPropVals.Insert(rValue);
                             }
@@ -1133,6 +1135,7 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable )
                                 aMessage += ": " + aUnknownPropertyException.Message;
 
                             SAL_WARN("writerfilter", aMessage);
+                            assert (false && "SERIOUS: remaining alphabetically sorted properties were lost");
 #else
                             (void) rWrapped;
 #endif


More information about the Libreoffice-commits mailing list