sd/source/console/PresenterToolBar.cxx       |   56 ++++++---------------------
 sd/source/console/PresenterWindowManager.cxx |   18 ++++----
 sd/source/console/PresenterWindowManager.hxx |    2 
 3 files changed, 23 insertions(+), 53 deletions(-)

New commits:
commit 55b13d5faf3ad9e716c196a263cb86c5408b9284
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri May 16 13:38:10 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri May 16 20:18:32 2025 +0200

    tdf#160094 sd presenter: Simplify RTL-specific handling
    
    Simplify the RTL-specific handling in PresenterToolBar::LayoutPart.
    
    If RTL is enabled, elements arranged horizontally should be
    in reverse order to non-RTL mode, but elements in a vertical
    container don't change their order within the container.
    
    Implement the logic to be like this.
    
    So far, there was a (non-obvious) implementation
    achieving the same by using implementation details
    of the (default) toolbar configuration in
    officecfg/registry/data/org/openoffice/Office/PresenterScreen.xcu:
    
    Processing starts with horizontal orientation. The only
    vertical elements are those 3 elements between the
    two "ChangeOrientation" nodes in the xcu file
    (s. below for reference):
    
    * a "CurrentTimeLAbel"
    * a "HorizontalSeparator"
    * a "PresentationTimeLabel"
    
    The special
    
        // reverse presentation time with current time
    
    handling in the RTL code path in PresenterToolBar::LayoutPart
    was handling those elements special by relying
    on their exact index within the vertical
    container. That does work for the default configuration,
    but is not very straightfoward, and would break if
    the config were ever changed.
    
    Instead, just don't revert the order for vertical
    containers at all.
    
    Relevant part from the .xcu file for the three
    elements:
    
              <node oor:name="f" oor:op="replace">
                <prop oor:name="Type">
                  <value>ChangeOrientation</value>
                </prop>
              </node>
              <node oor:name="g" oor:op="replace">
                <prop oor:name="Type">
                  <value>CurrentTimeLabel</value>
                </prop>
                <node oor:name="Normal">
                  <node oor:name="Font">
                    <prop oor:name="Size">
                      <value>18</value>
                    </prop>
                    <prop oor:name="Style">
                      <value>Bold</value>
                    </prop>
                    <prop oor:name="Color">
                      <value>ffffff</value>
                    </prop>
                    <prop oor:name="Anchor">
                      <value>Center</value>
                    </prop>
                  </node>
                </node>
              </node>
              <node oor:name="h" oor:op="replace">
                <prop oor:name="Type">
                  <value>HorizontalSeparator</value>
                </prop>
                <node oor:name="Normal">
                  <node oor:name="Font">
                    <prop oor:name="Color">
                      <value>71767a</value>
                    </prop>
                  </node>
                </node>
              </node>
              <node oor:name="i" oor:op="replace">
                <prop oor:name="Type">
                  <value>PresentationTimeLabel</value>
                </prop>
                <node oor:name="Normal">
                  <node oor:name="Font">
                    <prop oor:name="Size">
                      <value>26</value>
                    </prop>
                    <prop oor:name="Style">
                      <value>Bold</value>
                    </prop>
                    <prop oor:name="Color">
                      <value>ffe969</value>
                    </prop>
                    <prop oor:name="Anchor">
                      <value>Center</value>
                    </prop>
                  </node>
                </node>
              </node>
              <node oor:name="j" oor:op="replace">
                <prop oor:name="Type">
                  <value>ChangeOrientation</value>
                </prop>
              </node>
    
    (`git show --ignore-space-change` helps see the
    "actual change" more clearly.)
    
    Change-Id: I121e5b346f750016cab0769a21aa01f3684a5800
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185407
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sd/source/console/PresenterToolBar.cxx 
b/sd/source/console/PresenterToolBar.cxx
index 45b4cd19366d..0c11030815fb 100644
--- a/sd/source/console/PresenterToolBar.cxx
+++ b/sd/source/console/PresenterToolBar.cxx
@@ -790,7 +790,7 @@ void PresenterToolBar::LayoutPart(
     double nY (rBoundingBox.Y1);
 
     /// check whether RTL interface or not
-    if(!AllSettings::GetLayoutRTL()){
+    if (!AllSettings::GetLayoutRTL() || !bIsHorizontal){
         for (auto& rxElement : *rpPart)
         {
             if (!rxElement)
@@ -823,54 +823,24 @@ void PresenterToolBar::LayoutPart(
             }
         }
     }
-    else {
+    else
+    {
         ElementContainerPart::const_reverse_iterator iElement;
-        ElementContainerPart::const_reverse_iterator iFirst = rpPart->rend() - 
1;
-
         for (iElement= rpPart->rbegin(); iElement!= rpPart->rend(); ++iElement)
         {
             if (iElement->get() == nullptr)
                 continue;
 
-            if (bIsHorizontal)
+            const awt::Size aElementSize 
((*iElement)->GetBoundingSize(mxCanvas));
+            if ((*iElement)->IsFilling())
             {
-                const awt::Size aElementSize 
((*iElement)->GetBoundingSize(mxCanvas));
-                if ((*iElement)->IsFilling())
-                {
-                    nY = rBoundingBox.Y1;
-                    
(*iElement)->SetSize(geometry::RealSize2D(aElementSize.Width, rBoundingBox.Y2 - 
rBoundingBox.Y1));
-                }
-                else
-                    nY = rBoundingBox.Y1 + (rBoundingBox.Y2-rBoundingBox.Y1 - 
aElementSize.Height) / 2;
-                (*iElement)->SetLocation(awt::Point(sal_Int32(0.5 + nX), 
sal_Int32(0.5 + nY)));
-                nX += aElementSize.Width + nGap;
+                nY = rBoundingBox.Y1;
+                (*iElement)->SetSize(geometry::RealSize2D(aElementSize.Width, 
rBoundingBox.Y2 - rBoundingBox.Y1));
             }
             else
-            {
-                // reverse presentation time with current time
-                if (iElement == iFirst){
-                    iElement = iFirst - 2;
-                }
-                else if (iElement == iFirst - 2){
-                    iElement = iFirst;
-                }
-                const awt::Size aElementSize 
((*iElement)->GetBoundingSize(mxCanvas));
-                if ((*iElement)->IsFilling())
-                {
-                    nX = rBoundingBox.X1;
-                    (*iElement)->SetSize(geometry::RealSize2D(rBoundingBox.X2 
- rBoundingBox.X1, aElementSize.Height));
-                }
-                else
-                    nX = rBoundingBox.X1 + (rBoundingBox.X2-rBoundingBox.X1 - 
aElementSize.Width) / 2;
-                (*iElement)->SetLocation(awt::Point(sal_Int32(0.5 + nX), 
sal_Int32(0.5 + nY)));
-                nY += aElementSize.Height + nGap;
-
-                // return the index as it was before the reversing
-                if (iElement == iFirst)
-                    iElement = iFirst - 2;
-                else if (iElement == iFirst - 2)
-                    iElement = iFirst;
-            }
+                nY = rBoundingBox.Y1 + (rBoundingBox.Y2-rBoundingBox.Y1 - 
aElementSize.Height) / 2;
+            (*iElement)->SetLocation(awt::Point(sal_Int32(0.5 + nX), 
sal_Int32(0.5 + nY)));
+            nX += aElementSize.Width + nGap;
         }
     }
 }
commit 265a0ef3c5560476a88818f4f226521a4a8e04a3
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri May 16 12:33:51 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri May 16 20:18:25 2025 +0200

    sd presenter: Make LayoutMode an enum class
    
    Change-Id: Idced9fc9b093aba95e8171b1308f9a39a5213c8c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185403
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/sd/source/console/PresenterWindowManager.cxx 
b/sd/source/console/PresenterWindowManager.cxx
index 6b6b07e4ffe0..99674378a34e 100644
--- a/sd/source/console/PresenterWindowManager.cxx
+++ b/sd/source/console/PresenterWindowManager.cxx
@@ -57,7 +57,7 @@ PresenterWindowManager::PresenterWindowManager (
       mpPaneContainer(std::move(pPaneContainer)),
       mbIsLayoutPending(true),
       mbIsLayouting(false),
-      meLayoutMode(LM_Generic),
+      meLayoutMode(LayoutMode::Generic),
       mbIsSlideSorterActive(false),
       mbIsHelpViewActive(false),
       mbisPaused(false),
@@ -363,7 +363,7 @@ void PresenterWindowManager::SetLayoutMode (const 
LayoutMode eMode)
 
     mpPresenterController->RequestViews(
         mbIsSlideSorterActive,
-        meLayoutMode==LM_Notes,
+        meLayoutMode == LayoutMode::Notes,
         mbIsHelpViewActive);
     Layout();
     NotifyLayoutModeChange();
@@ -381,7 +381,7 @@ void PresenterWindowManager::SetSlideSorterState (bool 
bIsActive)
 
     mpPresenterController->RequestViews(
         mbIsSlideSorterActive,
-        meLayoutMode==LM_Notes,
+        meLayoutMode == LayoutMode::Notes,
         mbIsHelpViewActive);
     Layout();
     NotifyLayoutModeChange();
@@ -399,7 +399,7 @@ void PresenterWindowManager::SetHelpViewState (bool 
bIsActive)
 
     mpPresenterController->RequestViews(
         mbIsSlideSorterActive,
-        meLayoutMode==LM_Notes,
+        meLayoutMode == LayoutMode::Notes,
         mbIsHelpViewActive);
     Layout();
     NotifyLayoutModeChange();
@@ -422,13 +422,13 @@ void PresenterWindowManager::SetViewMode (const ViewMode 
eMode)
         case VM_Standard:
             SetSlideSorterState(false);
             SetHelpViewState(false);
-            SetLayoutMode(LM_Standard);
+            SetLayoutMode(LayoutMode::Standard);
             break;
 
         case VM_Notes:
             SetSlideSorterState(false);
             SetHelpViewState(false);
-            SetLayoutMode(LM_Notes);
+            SetLayoutMode(LayoutMode::Notes);
             break;
 
         case VM_SlideOverview:
@@ -451,7 +451,7 @@ PresenterWindowManager::ViewMode 
PresenterWindowManager::GetViewMode() const
         return VM_Help;
     else if (mbIsSlideSorterActive)
         return VM_SlideOverview;
-    else if (meLayoutMode == LM_Notes)
+    else if (meLayoutMode == LayoutMode::Notes)
         return VM_Notes;
     else
         return VM_Standard;
@@ -550,12 +550,12 @@ void PresenterWindowManager::Layout()
         else
             switch (meLayoutMode)
             {
-                case LM_Standard:
+                case LayoutMode::Standard:
                 default:
                     LayoutStandardMode();
                     break;
 
-                case LM_Notes:
+                case LayoutMode::Notes:
                     LayoutNotesMode();
                     break;
             }
diff --git a/sd/source/console/PresenterWindowManager.hxx 
b/sd/source/console/PresenterWindowManager.hxx
index 04d164e35f8a..3d227f8afe48 100644
--- a/sd/source/console/PresenterWindowManager.hxx
+++ b/sd/source/console/PresenterWindowManager.hxx
@@ -85,7 +85,7 @@ public:
     void SetHelpViewState (bool bIsActive);
     void SetPauseState (bool bIsPaused);
 
-    enum LayoutMode { LM_Standard, LM_Notes, LM_Generic };
+    enum class LayoutMode { Standard, Notes, Generic };
 private:
     void SetLayoutMode (const LayoutMode eMode);
 
commit b246b1c16c10824dd783aca4c7247f390fc24c32
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri May 16 12:18:58 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri May 16 20:18:18 2025 +0200

    sd presenter: Mark PresentationTimeLabel methods final
    
    Mark implementations of the IPresentationTime base class
    methods as final, which silences the following clang-analyzer
    warning shown in Qt Creator:
    
        .../libreoffice/sd/source/console/PresenterToolBar.cxx:1734:5: Call to 
virtual method 'PresentationTimeLabel::restart' during construction bypasses 
virtual dispatch [clang-analyzer-optin.cplusplus.VirtualCall]
    
    Change-Id: If06a0ba8e5f01f27ac1119c71ae596db2e74c8b7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185401
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sd/source/console/PresenterToolBar.cxx 
b/sd/source/console/PresenterToolBar.cxx
index 8e7784f4c7a0..45b4cd19366d 100644
--- a/sd/source/console/PresenterToolBar.cxx
+++ b/sd/source/console/PresenterToolBar.cxx
@@ -285,9 +285,9 @@ public:
         const SharedElementMode& rpSelectedMode,
         const SharedElementMode& rpDisabledMode,
         const SharedElementMode& rpMouseOverSelectedMode) override;
-    virtual void restart() override;
-    virtual bool isPaused() override;
-    virtual void setPauseStatus(const bool pauseStatus) override;
+    virtual void restart() override final;
+    virtual bool isPaused() override final;
+    virtual void setPauseStatus(const bool pauseStatus) override final;
     const TimeValue& getPauseTimeValue() const;
     void setPauseTimeValue(const TimeValue pauseTime);
 private:

Reply via email to