sw/qa/extras/ww8export/ww8export.cxx |    3 ++-
 sw/source/filter/ww8/wrtww8.cxx      |    4 ++--
 sw/source/filter/ww8/wrtww8.hxx      |    2 +-
 sw/source/filter/ww8/ww8atr.cxx      |    2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 091aedc63de2f6c8f0f4c60dd1fa93fe4c6ddde4
Author:     Justin Luth <justin_l...@sil.org>
AuthorDate: Sat Aug 4 13:55:47 2018 +0300
Commit:     Justin Luth <justin_l...@sil.org>
CommitDate: Mon Aug 13 06:07:35 2018 +0200

    tdf#117994 ww8export: extend Chp over CR
    
    Plan to revert this within a month - just a test and see.
    
    MS Word has a placeholder that can receive chacter formatting
    for the carriage return, but LO doesn't really. So normally
    when LO exports, the CR is "unformated", which really
    can affect things like paragraph size, or numbering.
    So, extend the current character formatting to cover
    the CR, so that what we see in Writer is what we get in Word.
    
    This will cause regressions as Writer round-trips documents
    that it incorrectly reads. (In other words, even though they
    don't look right in Writer, they still used toround-tripped
    OK, but now they will be saved with LO's distortions.)
    Since normally if we *save* in writer, that implies that
    changes have been made, and theoretically the document
    looks the way the user wants to re-preserve it, it
    is better to now have the document look as Writer
    sees it than to preserve some prior formatting.
    
    This really breaks unit test tdf102334.doc, but that
    round-tripped document is already *really* broken in Word.
    With this patch, it looks like the original again.
    (tdf102334.doc looks bad in LO no matter what, it just looks
    worse in this case.)
    
    Change-Id: I04d3fdc7dbc66f8732456d7ac5b309c454992d8b
    Reviewed-on: https://gerrit.libreoffice.org/58594
    Tested-by: Justin Luth <justin_l...@sil.org>
    Reviewed-by: Justin Luth <justin_l...@sil.org>

diff --git a/sw/qa/extras/ww8export/ww8export.cxx 
b/sw/qa/extras/ww8export/ww8export.cxx
index a53525a5ece7..25af135a35f7 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -675,7 +675,8 @@ DECLARE_WW8EXPORT_TEST(testTdf59896, "tdf59896.doc")
 DECLARE_WW8EXPORT_TEST(testTdf102334, "tdf102334.doc")
 {
     // This was false, i.e. the first run wasn't hidden, when it should have 
been
-    CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(getRun(getParagraph(7), 1), 
"CharHidden"));
+    // But this looks different (less hidden) in MSWord
+    // CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(getRun(getParagraph(7), 
1), "CharHidden"));
 }
 
 DECLARE_WW8EXPORT_TEST(testTdf38778, 
"tdf38778_properties_in_run_for_field.doc")
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 10f53ab15b05..6274a3acfca9 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -995,7 +995,7 @@ sal_uInt8 *WW8_WrPlcPn::CopyLastSprms(sal_uInt8 &rLen)
     return rF.CopyLastSprms(rLen);
 }
 
-void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* 
pSprms)
+void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* 
pSprms, const bool bExpandEmpty)
 {
     WW8_WrFkp* pF = m_Fkps.back().get();
 
@@ -1024,7 +1024,7 @@ void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short 
nVarLen,const sal_uInt8* pS
         pF->MergeToNew( nVarLen, pNewSprms );
     // has the prev EndFC an empty sprm and the current is empty too, then
     // expand only the old EndFc to the new EndFc
-    else if( !nVarLen && pF->IsEmptySprm() )
+    else if( !nVarLen && (bExpandEmpty || pF->IsEmptySprm()) )
     {
         pF->SetNewEnd( nEndFc );
         return ;
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index dde8717443c6..d7854815bae9 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -1287,7 +1287,7 @@ private:
 public:
     WW8_WrPlcPn( WW8Export& rWrt, ePLCFT ePl, WW8_FC nStartFc );
     ~WW8_WrPlcPn();
-    void AppendFkpEntry(WW8_FC nEndFc,short nVarLen = 0,const sal_uInt8* 
pSprms = nullptr);
+    void AppendFkpEntry(WW8_FC nEndFc,short nVarLen = 0,const sal_uInt8* 
pSprms = nullptr, const bool bExpandEmpty=false);
     void WriteFkps();
     void WritePlc();
     sal_uInt8 *CopyLastSprms(sal_uInt8 &rLen);
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 3f82fa3963dc..774684ee91b6 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -1070,7 +1070,7 @@ void WW8AttributeOutput::OutputFKP(bool bForce)
     if (!m_rWW8Export.pO->empty() || bForce)
     {
         m_rWW8Export.m_pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(),
-                m_rWW8Export.pO->size(), m_rWW8Export.pO->data() );
+                m_rWW8Export.pO->size(), m_rWW8Export.pO->data(), 
m_rWW8Export.pO->empty() );
         m_rWW8Export.pO->clear();
     }
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to