Bug:
https://bugs.freedesktop.org/show_bug.cgi?id=43398

Cause:
dmapper used to treat the presence of a w:BiDi element in a paragraph's
properties as an indicator of RTL directionality, which is incorrect. A
w:BiDi element may have a value of 0, indicating LTR.

Fix: Inspect the integral value of w:BiDi elements before switching to RTL.
Only switch if it's non-zero.

Regards,
--Muhammad
From ed209e3a36f74f7826616deb24e7000b6216af32 Mon Sep 17 00:00:00 2001
From: Muhammad Haggag <[email protected]>
Date: Wed, 1 Feb 2012 20:56:12 +0200
Subject: [PATCH] dmapper: Switch paragraphs to RTL based on the value of
 w:BiDi.

This is a fix for 43398: FORMATTING: Documents opened in LibreOffice Writer incorrectly appear as right justified.

Cause: dmapper used to treat the presence of a w:BiDi element in a paragraph's properties as an indicator of RTL directionality, which is incorrect. A w:BiDi  element may have a value of 0, indicating LTR.

Fix: Inspect the integral value of w:BiDi elements before switching to RTL.
---
 writerfilter/source/dmapper/DomainMapper.cxx |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 851ded2..34c23f7 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1812,8 +1812,13 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
         }
         break;  // sprmPOutLvl
     case NS_sprm::LN_PFBiDi:
-            rContext->Insert(PROP_WRITING_MODE, false, uno::makeAny( text::WritingMode2::RL_TB ));
-            rContext->Insert(PROP_PARA_ADJUST, false, uno::makeAny( style::ParagraphAdjust_RIGHT ));
+        {
+            if (nIntValue != 0)
+            {
+                rContext->Insert(PROP_WRITING_MODE, false, uno::makeAny( text::WritingMode2::RL_TB ));
+                rContext->Insert(PROP_PARA_ADJUST, false, uno::makeAny( style::ParagraphAdjust_RIGHT ));
+            }
+        }
 
         break;  // sprmPFBiDi
     case NS_ooxml::LN_EG_SectPrContents_bidi:
-- 
1.7.5.4

_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to