[PATCH] fdo#57422 fixing scroll bar and slides position

Abdulaziz A Alayed (via Code Review) gerrit at gerrit.libreoffice.org
Sat Mar 9 04:30:15 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2614

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/14/2614/1

fdo#57422 fixing scroll bar and slides position

fixing scroll bar position and  slides sorter of  note view and slides if
the interface language is RTL .

Change-Id: Ibc7c8992b8f177742dc52df2615a2d32a2a22713
---
M sdext/source/presenter/PresenterNotesView.cxx
M sdext/source/presenter/PresenterSlideSorter.cxx
2 files changed, 101 insertions(+), 48 deletions(-)



diff --git a/sdext/source/presenter/PresenterNotesView.cxx b/sdext/source/presenter/PresenterNotesView.cxx
index f3dbdbe..703f773 100644
--- a/sdext/source/presenter/PresenterNotesView.cxx
+++ b/sdext/source/presenter/PresenterNotesView.cxx
@@ -16,7 +16,7 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-
+#include "vcl/svapp.hxx"
 #include "PresenterNotesView.hxx"
 #include "PresenterButton.hxx"
 #include "PresenterCanvasHelper.hxx"
@@ -468,7 +468,10 @@
             if (nHeight > nTextBoxHeight)
             {
                 bShowVerticalScrollbar = true;
+                if(!Application::GetSettings().GetLayoutRTL())
                 aNewTextBoundingBox.X2 -= mpScrollBar->GetSize();
+                else
+                aNewTextBoundingBox.X1 += mpScrollBar->GetSize();
             }
             mpScrollBar->SetTotalSize(nHeight);
         }
@@ -477,19 +480,33 @@
             OSL_ASSERT(false);
         }
 
-        mpScrollBar->SetVisible(bShowVerticalScrollbar);
-        mpScrollBar->SetPosSize(
-            geometry::RealRectangle2D(
-                aNewTextBoundingBox.X2,
-                aNewTextBoundingBox.X1,
-                aNewTextBoundingBox.X2 + mpScrollBar->GetSize(),
-                aNewTextBoundingBox.Y2));
-        if ( ! bShowVerticalScrollbar)
-            mpScrollBar->SetThumbPosition(0, false);
-
-        UpdateScrollBar();
+        if(Application::GetSettings().GetLayoutRTL())
+            {
+                mpScrollBar->SetVisible(bShowVerticalScrollbar);
+                mpScrollBar->SetPosSize(
+                                        geometry::RealRectangle2D(
+                                                                  aNewTextBoundingBox.X1 - mpScrollBar->GetSize(),
+                                                                  aNewTextBoundingBox.Y1,
+                                                                  aNewTextBoundingBox.X1,
+                                                                  aNewTextBoundingBox.Y2));
+                if( ! bShowVerticalScrollbar)
+                    mpScrollBar->SetThumbPosition(0, false);
+                UpdateScrollBar();
+            }
+        else
+            {
+                mpScrollBar->SetVisible(bShowVerticalScrollbar);
+                mpScrollBar->SetPosSize(
+                                        geometry::RealRectangle2D(
+                                                                  aWindowBox.Width - mpScrollBar->GetSize(),
+                                                                  aNewTextBoundingBox.Y1,
+                                                                  aNewTextBoundingBox.X2 + mpScrollBar->GetSize(),
+                                                                  aNewTextBoundingBox.Y2));
+                if( ! bShowVerticalScrollbar)
+                    mpScrollBar->SetThumbPosition(0, false);
+                UpdateScrollBar();
+            }
     }
-
     // Has the text area has changed it position or size?
     if (aNewTextBoundingBox.X1 != maTextBoundingBox.X1
         || aNewTextBoundingBox.Y1 != maTextBoundingBox.Y1
diff --git a/sdext/source/presenter/PresenterSlideSorter.cxx b/sdext/source/presenter/PresenterSlideSorter.cxx
index eb0ce72..8509371 100644
--- a/sdext/source/presenter/PresenterSlideSorter.cxx
+++ b/sdext/source/presenter/PresenterSlideSorter.cxx
@@ -756,31 +756,47 @@
     Reference<container::XIndexAccess> xSlides (mxSlideShowController, UNO_QUERY_THROW);
     if (xSlides.is())
         bIsScrollBarNeeded = mpLayout->IsScrollBarNeeded(xSlides->getCount());
-
     if (mpVerticalScrollBar.get() != NULL)
-    {
-        if (bIsScrollBarNeeded)
         {
-            // Place vertical scroll bar at right border.
-            mpVerticalScrollBar->SetPosSize(geometry::RealRectangle2D(
-                rUpperBox.X2 - mpVerticalScrollBar->GetSize(),
-                rUpperBox.Y1,
-                rUpperBox.X2,
-                rUpperBox.Y2));
-            mpVerticalScrollBar->SetVisible(true);
-
-            // Reduce area covered by the scroll bar from the available
-            // space.
-            return geometry::RealRectangle2D(
-                rUpperBox.X1,
-                rUpperBox.Y1,
-                rUpperBox.X2 - mpVerticalScrollBar->GetSize() - gnHorizontalGap,
-                rUpperBox.Y2);
+            if (bIsScrollBarNeeded)
+                {
+                    if(Application::GetSettings().GetLayoutRTL())
+                        {
+                            mpVerticalScrollBar->SetPosSize(geometry::RealRectangle2D(
+                                                                                      rUpperBox.X1,
+                                                                                      rUpperBox.Y1,
+                                                                                      rUpperBox.X1 +  mpVerticalScrollBar->GetSize(),
+                                                                                      rUpperBox.Y2));
+                            mpVerticalScrollBar->SetVisible(true);
+                            // Reduce area covered by the scroll bar from the available
+                            // space.
+                            return geometry::RealRectangle2D(
+                                                             rUpperBox.X1 + gnHorizontalGap + mpVerticalScrollBar->GetSize(),
+                                                             rUpperBox.Y1,
+                                                             rUpperBox.X2,
+                                                             rUpperBox.Y2);
+                        }
+                    else
+                        {
+                            // if its not RTL place vertical scroll bar at right border.
+                            mpVerticalScrollBar->SetPosSize(geometry::RealRectangle2D(
+                                                                                      rUpperBox.X2 - mpVerticalScrollBar->GetSize(),
+                                                                                      rUpperBox.Y1,
+                                                                                      rUpperBox.X2,
+                                                                                      rUpperBox.Y2));
+                            mpVerticalScrollBar->SetVisible(true);
+                            // Reduce area covered by the scroll bar from the available
+                            // space.
+                            return geometry::RealRectangle2D(
+                                                             rUpperBox.X1,
+                                                             rUpperBox.Y1,
+                                                             rUpperBox.X2 - mpVerticalScrollBar->GetSize() - gnHorizontalGap,
+                                                             rUpperBox.Y2);
+                        }
+                }
+            else
+                mpVerticalScrollBar->SetVisible(false);
         }
-        else
-            mpVerticalScrollBar->SetVisible(false);
-    }
-
     return rUpperBox;
 }
 
@@ -884,10 +900,11 @@
     }
 
     Reference<rendering::XBitmap> xPreview (GetPreview(nSlideIndex));
+    bool isRTL = Application::GetSettings().GetLayoutRTL();
 
     const geometry::RealPoint2D aTopLeft (
         mpLayout->GetWindowPosition(
-            mpLayout->GetPoint(nSlideIndex, -1, -1)));
+            mpLayout->GetPoint(nSlideIndex, isRTL?1:-1, -1)));
 
     // Create clip rectangle as intersection of the current update area and
     // the bounding box of all previews.
@@ -1216,17 +1233,35 @@
 geometry::RealPoint2D PresenterSlideSorter::Layout::GetLocalPosition(
     const geometry::RealPoint2D& rWindowPoint) const
 {
-    return css::geometry::RealPoint2D(
-        rWindowPoint.X - maBoundingBox.X1 + mnHorizontalOffset,
-        rWindowPoint.Y - maBoundingBox.Y1 + mnVerticalOffset);
+    if(Application::GetSettings().GetLayoutRTL())
+        {
+            return css::geometry::RealPoint2D(
+                                              -rWindowPoint.X  + maBoundingBox.X2 + mnHorizontalOffset,
+                                              rWindowPoint.Y - maBoundingBox.Y1 + mnVerticalOffset);
+        }
+    else
+        {
+            return css::geometry::RealPoint2D(
+                                              rWindowPoint.X - maBoundingBox.X1 + mnHorizontalOffset,
+                                              rWindowPoint.Y - maBoundingBox.Y1 + mnVerticalOffset);
+        }
 }
 
 geometry::RealPoint2D PresenterSlideSorter::Layout::GetWindowPosition(
     const geometry::RealPoint2D& rLocalPoint) const
 {
-    return css::geometry::RealPoint2D(
-        rLocalPoint.X - mnHorizontalOffset + maBoundingBox.X1,
-        rLocalPoint.Y - mnVerticalOffset + maBoundingBox.Y1);
+    if(Application::GetSettings().GetLayoutRTL())
+        {
+            return css::geometry::RealPoint2D(
+                                              -rLocalPoint.X + mnHorizontalOffset + maBoundingBox.X2,
+                                              rLocalPoint.Y - mnVerticalOffset + maBoundingBox.Y1);
+        }
+    else
+        {
+            return css::geometry::RealPoint2D(
+                                              rLocalPoint.X - mnHorizontalOffset + maBoundingBox.X1,
+                                              rLocalPoint.Y - mnVerticalOffset + maBoundingBox.Y1);
+        }
 }
 
 sal_Int32 PresenterSlideSorter::Layout::GetColumn (
@@ -1313,13 +1348,14 @@
 
 awt::Rectangle PresenterSlideSorter::Layout::GetBoundingBox (const sal_Int32 nSlideIndex) const
 {
-    const geometry::RealPoint2D aWindowPosition(GetWindowPosition(GetPoint(nSlideIndex, -1, -1)));
+    bool isRTL = Application::GetSettings().GetLayoutRTL();
+    const geometry::RealPoint2D aWindowPosition(GetWindowPosition(GetPoint(nSlideIndex, isRTL?1:-1, -1)));
     return PresenterGeometryHelper::ConvertRectangle(
-        geometry::RealRectangle2D(
-            aWindowPosition.X,
-            aWindowPosition.Y,
-            aWindowPosition.X + maPreviewSize.Width,
-            aWindowPosition.Y + maPreviewSize.Height));
+                                                     geometry::RealRectangle2D(
+                                                                               aWindowPosition.X,
+                                                                               aWindowPosition.Y,
+                                                                               aWindowPosition.X + maPreviewSize.Width,
+                                                                               aWindowPosition.Y + maPreviewSize.Height));
 }
 
 void PresenterSlideSorter::Layout::ForAllVisibleSlides (const ::boost::function<void(sal_Int32)>& rAction)

-- 
To view, visit https://gerrit.libreoffice.org/2614
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibc7c8992b8f177742dc52df2615a2d32a2a22713
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Abdulaziz A Alayed <aalayed at kacst.edu.sa>



More information about the LibreOffice mailing list