editeng/source/editeng/impedit.cxx |    5 +++--
 sc/source/ui/view/viewdata.cxx     |    4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit c318f7bf20f21ea0e61b7069e4879868265b70c7
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Wed Apr 19 09:50:56 2023 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Tue Jun 20 18:50:12 2023 +0200

    lok: sc: fix layout RTL
    
    The function "IsRightToLeft" fails in Hebrew language
    when Calc has a layout RTL, add additional condition
    to check the layout.
    
    Signed-off-by: Henry Castro <hcas...@collabora.com>
    Change-Id: If3972b80770a7aa6073881487e411a34cc6871d1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150758
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151973
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153350
    Tested-by: Jenkins

diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index 98ac03aceab6..ae98b778f4da 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -524,7 +524,8 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, 
vcl::Region* pRegion,
 
     bool bStartHandleVisible = false;
     bool bEndHandleVisible = false;
-    bool bLOKCalcRTL = mpLOKSpecialPositioning && 
pEditEngine->IsRightToLeft(nStartPara);
+    bool bLOKCalcRTL = mpLOKSpecialPositioning &&
+        (mpLOKSpecialPositioning->IsLayoutRTL() || 
pEditEngine->IsRightToLeft(nStartPara));
 
     auto DrawHighlight = [&, nStartLine = sal_Int32(0), nEndLine = 
sal_Int32(0)](
                              const ImpEditEngine::LineAreaInfo& rInfo) mutable 
{
@@ -1355,7 +1356,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor )
                 Point aRefPointLogical = GetOutputArea().TopLeft();
                 // Get the relative coordinates w.r.t refpoint in display hmm.
                 aCursorRectPureLogical.Move(-aRefPointLogical.X(), 
-aRefPointLogical.Y());
-                if (pEditEngine->IsRightToLeft(nPara))
+                if (pEditEngine->IsRightToLeft(nPara) || 
mpLOKSpecialPositioning->IsLayoutRTL())
                 {
                     tools::Long nMirrorW = GetOutputArea().GetWidth();
                     tools::Long nLeft = aCursorRectPureLogical.Left(), nRight 
= aCursorRectPureLogical.Right();
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index f9ad7cae805c..db90c7f207a6 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1527,6 +1527,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
     bool bLOKActive = comphelper::LibreOfficeKit::isActive();
     bool bLOKPrintTwips = bLOKActive && 
comphelper::LibreOfficeKit::isCompatFlagSet(
             comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs);
+    bool bLOKLayoutRTL = bLOKActive && bLayoutRTL;
 
     bool bWasThere = false;
     if (pEditView[eWhich])
@@ -1625,6 +1626,9 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
             pEditView[eWhich]->SetLOKSpecialOutputArea(aPTwipsRect);
     }
 
+    if (bLOKLayoutRTL)
+        pEditView[eWhich]->SetLOKSpecialFlags(LOKSpecialFlags::LayoutRTL);
+
     tools::Rectangle aOutputArea = pWin->PixelToLogic( aPixRect, 
GetLogicMode() );
     pEditView[eWhich]->SetOutputArea( aOutputArea );
 

Reply via email to