diff options
author | Abdulaziz A Alayed <aalayed@kacst.edu.sa> | 2013-03-09 15:35:45 +0300 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2013-03-11 10:33:32 +0100 |
commit | b977c27383b36f511bcedc8cd48c160a1c0be514 (patch) | |
tree | a54969ae76cd880350fe46b2aa6985ab9eaf388b /sdext/source | |
parent | Documentation to avoid a real use-after-free bug (diff) | |
download | core-b977c27383b36f511bcedc8cd48c160a1c0be514.tar.gz core-b977c27383b36f511bcedc8cd48c160a1c0be514.zip |
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
Diffstat (limited to 'sdext/source')
-rw-r--r-- | sdext/source/presenter/PresenterNotesView.cxx | 134 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterSlideSorter.cxx | 108 |
2 files changed, 144 insertions, 98 deletions
diff --git a/sdext/source/presenter/PresenterNotesView.cxx b/sdext/source/presenter/PresenterNotesView.cxx index deb248f6485f..2ffb8ceb7b59 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 bdffca4327bc..a49ba0aeeab0 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) |