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

New commits:
commit f96819f1358fb55b6e19ddc864f0376693e9feba
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Wed Oct 11 08:59:59 2023 -0400
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Fri Oct 13 11:27:59 2023 +0200

    sc: ui: fix cell bidi layout strings
    
    The default constructor OutputDevice can set the
    layout text to "vcl::text::ComplexTextLayoutFlags::BiDiRtl"
    for all strings if the UI locale is a RTL locale, however
    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/+/157880
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 20956ccad844..0cb886a87dc6 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1482,14 +1482,22 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic)
 {
     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