Kaydet (Commit) 091aedc6 authored tarafından Justin Luth's avatar Justin Luth

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/58594Tested-by: 's avatarJustin Luth <justin_luth@sil.org>
Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
üst fe9f10a9
......@@ -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")
......@@ -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 ;
......@@ -1287,7 +1287,7 @@ private:
WW8_WrPlcPn( WW8Export& rWrt, ePLCFT ePl, WW8_FC nStartFc );
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);
......@@ -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() );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment