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

Justin Luth justin_luth at sil.org
Sat Aug 26 01:18:14 UTC 2017


 sw/source/filter/ww8/wrtww8.cxx |   22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

New commits:
commit fde332fc9d59102749dbeb20f4e78e2233152e1b
Author: Justin Luth <justin_luth at sil.org>
Date:   Fri Aug 25 17:53:58 2017 -0400

    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 at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

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;


More information about the Libreoffice-commits mailing list