diff options
author | Justin Luth <justin_luth@sil.org> | 2017-08-25 17:53:58 -0400 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2017-08-26 03:14:54 +0200 |
commit | fde332fc9d59102749dbeb20f4e78e2233152e1b (patch) | |
tree | da97ad99edb4478a8697896db32ee0cc4db64ae2 | |
parent | c420f36d9a19bb0b9da5cefa0c1b54b60ccb41a8 (diff) |
tdf#32991 DOCexport: MSO-compatible table justification
Although LO could round-trip the files, MSO didn't open
them properly, indicating both import and export differences.
There are two table justification codes: sprmTJc and sprmTJc90.
LO appears to treat sprmTJc90 as the WW8 version, but actually
both are valid. TJc is the LOGICAL justification - meaning that
it is affected by RTL/LTR settings. TJc90 is the PHYSICAL
justification, regardless of BiDi.
https://msdn.microsoft.com/en-us/library/dd951612(v=office.12).aspx
Based on testing results, it appears that MSO REQUIRES TJc codes.
If it isn't defined, MSO uses the default value of TJc:LEFT, and
ignores TJc90 code. It appears that MSO always writes out
both codes if they aren't the default values.
This patch only deals with the export difference.
Change-Id: Id722261acab7ae6c0b7d808be75fc3452c2255d8
Reviewed-on: https://gerrit.libreoffice.org/41584
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 942d6b047487..6beaeaefe3fe 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2218,13 +2218,31 @@ void WW8AttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t text::RelOrientation::FRAME == rVert.GetRelationOrient()) ) { + const bool bIsRTL = m_rWW8Export.TrueFrameDirection(*pFormat) == SvxFrameDirection::Horizontal_RL_TB; sal_Int16 eHOri = rHori.GetHoriOrient(); switch (eHOri) { case text::HoriOrientation::CENTER: + m_rWW8Export.InsUInt16( NS_sprm::sprmTJc ); //logical orientation required for MSO + m_rWW8Export.InsUInt16( 1 ); + m_rWW8Export.InsUInt16( NS_sprm::sprmTJc90 ); //physical orientation required for LO + m_rWW8Export.InsUInt16( 1 ); + break; case text::HoriOrientation::RIGHT: - m_rWW8Export.InsUInt16( NS_sprm::sprmTJc90 ); - m_rWW8Export.InsUInt16( text::HoriOrientation::RIGHT == eHOri ? 2 : 1 ); + m_rWW8Export.InsUInt16( NS_sprm::sprmTJc90 ); //required for LO + m_rWW8Export.InsUInt16( 2 ); + if ( !bIsRTL ) + { + m_rWW8Export.InsUInt16( NS_sprm::sprmTJc ); //required for MSO + m_rWW8Export.InsUInt16( 2 ); + } + break; + case text::HoriOrientation::LEFT: + if ( bIsRTL ) + { + m_rWW8Export.InsUInt16( NS_sprm::sprmTJc ); //required for MSO + m_rWW8Export.InsUInt16( 2 ); + } break; default: break; |