sc/source/ui/view/output2.cxx |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit c9319cdfa269ff3e043f012731406bf3fd4e1810
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Wed Oct 11 08:59:59 2023 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Wed Oct 18 18:17:51 2023 +0200

    sc: ui: fix cell bidi layout strings
    
    The default constructor OutputDevice set the
    layout text to "vcl::text::ComplexTextLayoutFlags::BiDiRtl"
    for all strings, however the each cell string can be
    mixed LTR and RTL.
    
    Set the defaults to auto detect the correct text layout mode.
    .
    
    Signed-off-by: Henry Castro <hcas...@collabora.com>
    Change-Id: I0c451e8014fd13490db4213adca3d83ea4572819
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157831
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit f63e02b99691a0d8c8addba2518ecdf6b4319c52)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157952

diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 302f2db07a01..e944eb0e0a08 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1521,14 +1521,22 @@ tools::Rectangle ScOutputData::LayoutStrings(bool 
bPixelToLogic, bool bPaint, co
 {
     bool bOrigIsInLayoutStrings = mpDoc->IsInLayoutStrings();
     mpDoc->SetLayoutStrings(true);
-    comphelper::ScopeGuard g([this, bOrigIsInLayoutStrings] {
-        mpDoc->SetLayoutStrings(bOrigIsInLayoutStrings);
-    });
 
     OSL_ENSURE( mpDev == mpRefDevice ||
                 mpDev->GetMapMode().GetMapUnit() == 
mpRefDevice->GetMapMode().GetMapUnit(),
                 "LayoutStrings: different MapUnits ?!?!" );
 
+    vcl::text::ComplexTextLayoutFlags eTextLayout = mpDev->GetLayoutMode();
+    comphelper::ScopeGuard g([this, bOrigIsInLayoutStrings, eTextLayout] {
+        mpDoc->SetLayoutStrings(bOrigIsInLayoutStrings);
+
+        if (mpDev->GetLayoutMode() != eTextLayout)
+            mpDev->SetLayoutMode(eTextLayout);
+    });
+
+    if (mpDev->GetLayoutMode() != vcl::text::ComplexTextLayoutFlags::Default)
+        mpDev->SetLayoutMode(vcl::text::ComplexTextLayoutFlags::Default);
+
     sc::IdleSwitch aIdleSwitch(*mpDoc, false);
 
     // Try to limit interpreting to only visible cells. Calling e.g. IsValue()

Reply via email to