[Libreoffice-commits] core.git: sdext/source

Abdulaziz A Alayed aalayed at kacst.edu.sa
Mon Mar 11 02:36:37 PDT 2013


 sdext/source/presenter/PresenterNotesView.cxx   |  134 ++++++++++++------------
 sdext/source/presenter/PresenterSlideSorter.cxx |  108 ++++++++++++-------
 2 files changed, 144 insertions(+), 98 deletions(-)

New commits:
commit b977c27383b36f511bcedc8cd48c160a1c0be514
Author: Abdulaziz A Alayed <aalayed at kacst.edu.sa>
Date:   Sat Mar 9 15:35:45 2013 +0300

    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: I80b55dff621d6b994095ad7a4979bcca63371edf

diff --git a/sdext/source/presenter/PresenterNotesView.cxx b/sdext/source/presenter/PresenterNotesView.cxx
index deb248f..2ffb8ce 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"
@@ -431,80 +431,90 @@ void PresenterNotesView::Layout (void)
 {
     if ( ! mxParentWindow.is())
         return;
-
     awt::Rectangle aWindowBox (mxParentWindow->getPosSize());
     geometry::RealRectangle2D aNewTextBoundingBox (0,0,aWindowBox.Width, aWindowBox.Height);
-
     // Size the tool bar and the horizontal separator above it.
     if (mxToolBarWindow.is())
-    {
-        const geometry::RealSize2D aToolBarSize (mpToolBar->GetMinimalSize());
-        const sal_Int32 nToolBarHeight = sal_Int32(aToolBarSize.Height + 0.5);
-        mxToolBarWindow->setPosSize(0, aWindowBox.Height - nToolBarHeight,
-            sal_Int32(aToolBarSize.Width + 0.5), nToolBarHeight,
-            awt::PosSize::POSSIZE);
-        aNewTextBoundingBox.Y2 -= nToolBarHeight;
-
-        mnSeparatorYLocation = aWindowBox.Height - nToolBarHeight - gnSpaceBelowSeparator;
-        aNewTextBoundingBox.Y2 = mnSeparatorYLocation - gnSpaceAboveSeparator;
-
-        // Place the close button.
-        if (mpCloseButton.get() != NULL)
-            mpCloseButton->SetCenter(geometry::RealPoint2D(
-                (aWindowBox.Width +  aToolBarSize.Width) / 2,
-                aWindowBox.Height - aToolBarSize.Height/2));
-    }
-
-    // Check whether the vertical scroll bar is necessary.
-    if (mpScrollBar.get() != NULL)
-    {
-        bool bShowVerticalScrollbar (false);
-        try
         {
-            const double nTextBoxHeight (aNewTextBoundingBox.Y2 - aNewTextBoundingBox.Y1);
-            const double nHeight (mpTextView->GetTotalTextHeight());
-            if (nHeight > nTextBoxHeight)
-            {
-                bShowVerticalScrollbar = true;
-                aNewTextBoundingBox.X2 -= mpScrollBar->GetSize();
-            }
-            mpScrollBar->SetTotalSize(nHeight);
+            const geometry::RealSize2D aToolBarSize (mpToolBar->GetMinimalSize());
+            const sal_Int32 nToolBarHeight = sal_Int32(aToolBarSize.Height + 0.5);
+            mxToolBarWindow->setPosSize(0, aWindowBox.Height - nToolBarHeight,
+                                        sal_Int32(aToolBarSize.Width + 0.5), nToolBarHeight,
+                                        awt::PosSize::POSSIZE);
+            aNewTextBoundingBox.Y2 -= nToolBarHeight;
+            mnSeparatorYLocation = aWindowBox.Height - nToolBarHeight - gnSpaceBelowSeparator;
+            aNewTextBoundingBox.Y2 = mnSeparatorYLocation - gnSpaceAboveSeparator;
+            // Place the close button.
+            if (mpCloseButton.get() != NULL)
+                mpCloseButton->SetCenter(geometry::RealPoint2D(
+                                                               (aWindowBox.Width +  aToolBarSize.Width) / 2,
+                                                               aWindowBox.Height - aToolBarSize.Height/2));
         }
-        catch(beans::UnknownPropertyException&)
+    // Check whether the vertical scroll bar is necessary.
+    if (mpScrollBar.get() != NULL)
         {
-            OSL_ASSERT(false);
+            bool bShowVerticalScrollbar (false);
+            try
+                {
+                    const double nTextBoxHeight (aNewTextBoundingBox.Y2 - aNewTextBoundingBox.Y1);
+                    const double nHeight (mpTextView->GetTotalTextHeight());
+                    if (nHeight > nTextBoxHeight)
+                        {
+                            bShowVerticalScrollbar = true;
+                            if(!Application::GetSettings().GetLayoutRTL())
+                                aNewTextBoundingBox.X2 -= mpScrollBar->GetSize();
+                            else
+                                aNewTextBoundingBox.X1 += mpScrollBar->GetSize();
+                        }
+                    mpScrollBar->SetTotalSize(nHeight);
+                }
+            catch(beans::UnknownPropertyException&)
+                {
+                    OSL_ASSERT(false);
+                }
+            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();
+                }
         }
-
-        mpScrollBar->SetVisible(bShowVerticalScrollbar);
-        mpScrollBar->SetPosSize(
-            geometry::RealRectangle2D(
-                aNewTextBoundingBox.X2,
-                aNewTextBoundingBox.X1,
-                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
         || aNewTextBoundingBox.X2 != maTextBoundingBox.X2
         || aNewTextBoundingBox.Y2 != maTextBoundingBox.Y2)
-    {
-        maTextBoundingBox = aNewTextBoundingBox;
-
-        mpTextView->SetLocation(
-            geometry::RealPoint2D(
-                aNewTextBoundingBox.X1,
-                aNewTextBoundingBox.Y1));
-        mpTextView->SetSize(
-            geometry::RealSize2D(
-                aNewTextBoundingBox.X2 - aNewTextBoundingBox.X1,
-                aNewTextBoundingBox.Y2 - aNewTextBoundingBox.Y1));
-    }
+        {
+            maTextBoundingBox = aNewTextBoundingBox;
+            mpTextView->SetLocation(
+                                    geometry::RealPoint2D(
+                                                          aNewTextBoundingBox.X1,
+                                                          aNewTextBoundingBox.Y1));
+            mpTextView->SetSize(
+                                geometry::RealSize2D(
+                                                     aNewTextBoundingBox.X2 - aNewTextBoundingBox.X1,
+                                                     aNewTextBoundingBox.Y2 - aNewTextBoundingBox.Y1));
+        }
 }
 
 void PresenterNotesView::Paint (const awt::Rectangle& rUpdateBox)
diff --git a/sdext/source/presenter/PresenterSlideSorter.cxx b/sdext/source/presenter/PresenterSlideSorter.cxx
index bdffca4..a49ba0a 100644
--- a/sdext/source/presenter/PresenterSlideSorter.cxx
+++ b/sdext/source/presenter/PresenterSlideSorter.cxx
@@ -754,31 +754,47 @@ geometry::RealRectangle2D PresenterSlideSorter::PlaceScrollBars (
     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;
 }
 
@@ -882,10 +898,11 @@ void PresenterSlideSorter::PaintPreview (
     }
 
     Reference<rendering::XBitmap> xPreview (GetPreview(nSlideIndex));
+    bool isRTL = Application::GetSettings().GetLayoutRTL();
 
     const geometry::RealPoint2D aTopLeft (
-        mpLayout->GetWindowPosition(
-            mpLayout->GetPoint(nSlideIndex, -1, -1)));
+                                          mpLayout->GetWindowPosition(
+                                                                      mpLayout->GetPoint(nSlideIndex, isRTL?1:-1, -1)));
 
     // Create clip rectangle as intersection of the current update area and
     // the bounding box of all previews.
@@ -1214,17 +1231,35 @@ bool PresenterSlideSorter::Layout::IsScrollBarNeeded (const sal_Int32 nSlideCoun
 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 (
@@ -1311,13 +1346,14 @@ geometry::RealPoint2D PresenterSlideSorter::Layout::GetPoint (
 
 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)


More information about the Libreoffice-commits mailing list