starmath/sdi/smslots.sdi                    |   10 ++++++++++
 starmath/source/view.cxx                    |   16 ++++++++++++++++
 starmath/uiconfig/smath/toolbar/toolbar.xml |    3 +++
 3 files changed, 29 insertions(+)

New commits:
commit b6c30b3d35eb01205acf0271d0192921c60eb73b
Author:     Khaled Hosny <kha...@libreoffice.org>
AuthorDate: Wed Aug 16 16:08:49 2023 +0300
Commit:     خالد حسني <kha...@libreoffice.org>
CommitDate: Mon Sep 4 18:17:45 2023 +0200

    tdf#134193: Allow setting math direction
    
    Add LTR/RTL buttons to the toolbar and make them change the
    IsRightToLeft property.
    
    Change-Id: I8ae793a9899c50b6dfaf3563a7c22c1f1eab8c8d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155739
    Tested-by: Jenkins
    Reviewed-by: خالد حسني <kha...@libreoffice.org>

diff --git a/starmath/sdi/smslots.sdi b/starmath/sdi/smslots.sdi
index 47468ce5f11d..3f998e8b182b 100644
--- a/starmath/sdi/smslots.sdi
+++ b/starmath/sdi/smslots.sdi
@@ -282,6 +282,16 @@ interface FormulaView
         ExecMethod = Execute ;
         StateMethod = GetState ;
     ]
+    SID_ATTR_PARA_LEFT_TO_RIGHT
+    [
+        ExecMethod = Execute ;
+        StateMethod = GetState ;
+    ]
+    SID_ATTR_PARA_RIGHT_TO_LEFT
+    [
+        ExecMethod = Execute ;
+        StateMethod = GetState ;
+    ]
 }
 
 shell SmViewShell
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index a71438bc82b5..6505031f13ba 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -2067,6 +2067,15 @@ void SmViewShell::Execute(SfxRequest& rReq)
             aDialog.run();
         }
         break;
+
+        case SID_ATTR_PARA_LEFT_TO_RIGHT:
+        case SID_ATTR_PARA_RIGHT_TO_LEFT:
+        {
+            bool bRTL = rReq.GetSlot() == SID_ATTR_PARA_RIGHT_TO_LEFT;
+            GetDoc()->SetRightToLeft(bRTL);
+            GetViewFrame().GetBindings().Invalidate(bRTL ? 
SID_ATTR_PARA_LEFT_TO_RIGHT : SID_ATTR_PARA_RIGHT_TO_LEFT);
+        }
+        break;
     }
     rReq.Done();
 }
@@ -2155,6 +2164,13 @@ void SmViewShell::GetState(SfxItemSet &rSet)
                 rSet.Put(SfxBoolItem(SID_ELEMENTSDOCKINGWINDOW, bState));
             }
             break;
+        case SID_ATTR_PARA_LEFT_TO_RIGHT:
+            rSet.Put(SfxBoolItem(nWh, !GetDoc()->GetFormat().IsRightToLeft()));
+            break;
+
+        case SID_ATTR_PARA_RIGHT_TO_LEFT:
+            rSet.Put(SfxBoolItem(nWh, GetDoc()->GetFormat().IsRightToLeft()));
+            break;
         }
     }
 }
diff --git a/starmath/uiconfig/smath/toolbar/toolbar.xml 
b/starmath/uiconfig/smath/toolbar/toolbar.xml
index 7501380c4383..2a093f9bb6e0 100644
--- a/starmath/uiconfig/smath/toolbar/toolbar.xml
+++ b/starmath/uiconfig/smath/toolbar/toolbar.xml
@@ -26,4 +26,7 @@
  <toolbar:toolbaritem xlink:href=".uno:Draw"/>
  <toolbar:toolbaritem xlink:href=".uno:FormelCursor"/>
  <toolbar:toolbaritem xlink:href=".uno:SymbolCatalogue"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ParaLeftToRight"/>
+ <toolbar:toolbaritem xlink:href=".uno:ParaRightToLeft"/>
 </toolbar:toolbar>

Reply via email to