diff options
Diffstat (limited to 'sdext/source/presenter/PresenterScrollBar.cxx')
-rw-r--r-- | sdext/source/presenter/PresenterScrollBar.cxx | 185 |
1 files changed, 0 insertions, 185 deletions
diff --git a/sdext/source/presenter/PresenterScrollBar.cxx b/sdext/source/presenter/PresenterScrollBar.cxx index d7ebbad7ec51..da5dfc69503b 100644 --- a/sdext/source/presenter/PresenterScrollBar.cxx +++ b/sdext/source/presenter/PresenterScrollBar.cxx @@ -838,191 +838,6 @@ void PresenterVerticalScrollBar::PaintComposite( GetBitmap(eArea, rpEndBitmaps)); } -//===== PresenterHorizontalScrollBar ============================================ - -PresenterHorizontalScrollBar::PresenterHorizontalScrollBar ( - const Reference<XComponentContext>& rxComponentContext, - const Reference<awt::XWindow>& rxParentWindow, - const ::boost::shared_ptr<PresenterPaintManager>& rpPaintManager, - const ::boost::function<void(double)>& rThumbMotionListener) - : PresenterScrollBar(rxComponentContext, rxParentWindow, rpPaintManager, rThumbMotionListener), - mnScrollBarHeight(0) -{ -} - -PresenterHorizontalScrollBar::~PresenterHorizontalScrollBar (void) -{ -} - -double PresenterHorizontalScrollBar::GetDragDistance (const sal_Int32 nX, const sal_Int32 nY) const -{ - (void)nY; - const double nDistance (nX - maDragAnchor.X); - if (nDistance == 0) - return 0; - else - { - const awt::Rectangle aWindowBox (mxWindow->getPosSize()); - const double nBarHeight (aWindowBox.Height); - const double nPagerWidth (aWindowBox.Width - 2*nBarHeight); - const double nDragDistance (mnTotalSize / nPagerWidth * nDistance); - if (nDragDistance + mnThumbPosition < 0) - return -mnThumbPosition; - else if (mnThumbPosition + nDragDistance > mnTotalSize-mnThumbSize) - return mnTotalSize-mnThumbSize-mnThumbPosition; - else - return nDragDistance; - } -} - -void PresenterHorizontalScrollBar::UpdateDragAnchor (const double nDragDistance) -{ - const awt::Rectangle aWindowBox (mxWindow->getPosSize()); - const double nBarHeight (aWindowBox.Height); - const double nPagerWidth (aWindowBox.Width - 2*nBarHeight); - maDragAnchor.X += nDragDistance * nPagerWidth / mnTotalSize; -} - -sal_Int32 PresenterHorizontalScrollBar::GetSize (void) const -{ - return mnScrollBarHeight; -} - -geometry::RealPoint2D PresenterHorizontalScrollBar::GetPoint ( - const double nMajor, const double nMinor) const -{ - return geometry::RealPoint2D(nMajor, nMinor); -} - -double PresenterHorizontalScrollBar::GetMajor (const double nX, const double nY) const -{ - (void)nY; - return nX; -} - -double PresenterHorizontalScrollBar::GetMinor (const double nX, const double nY) const -{ - (void)nX; - return nY; -} - -void PresenterHorizontalScrollBar::UpdateBorders (void) -{ - const awt::Rectangle aWindowBox (mxWindow->getPosSize()); - double nRight = aWindowBox.Width; - const double nGap (2); - - if (mpNextButtonDescriptor.get() != NULL) - { - Reference<rendering::XBitmap> xBitmap (mpNextButtonDescriptor->GetNormalBitmap()); - if (xBitmap.is()) - { - geometry::IntegerSize2D aSize (xBitmap->getSize()); - maBox[NextButton] = geometry::RealRectangle2D( - nRight - aSize.Width,0, nRight, aWindowBox.Height); - nRight -= aSize.Width + nGap; - } - } - if (mpPrevButtonDescriptor.get() != NULL) - { - Reference<rendering::XBitmap> xBitmap (mpPrevButtonDescriptor->GetNormalBitmap()); - if (xBitmap.is()) - { - geometry::IntegerSize2D aSize (xBitmap->getSize()); - maBox[PrevButton] = geometry::RealRectangle2D( - nRight - aSize.Width,0, nRight, aWindowBox.Height); - nRight -= aSize.Width + nGap; - } - } - - const double nPagerWidth (nRight); - maBox[Pager] = geometry::RealRectangle2D( - 0,0, nRight, aWindowBox.Height); - if (mnTotalSize == 0) - { - maBox[Thumb] = maBox[Pager]; - - // Set up the enabled/disabled states. - maEnabledState[PrevButton] = false; - maEnabledState[PagerUp] = false; - maEnabledState[NextButton] = false; - maEnabledState[PagerDown] = false; - maEnabledState[Thumb] = false; - } - else - { - const double nThumbSize = ::std::min(mnThumbSize,mnTotalSize); - const double nThumbPosition = ::std::min(::std::max(0.0,mnThumbPosition), mnTotalSize - nThumbSize); - maBox[Thumb] = geometry::RealRectangle2D( - (nThumbPosition) / mnTotalSize * nPagerWidth, 0, - (nThumbPosition+nThumbSize) / mnTotalSize * nPagerWidth, aWindowBox.Height); - - // Set up the enabled/disabled states. - maEnabledState[PrevButton] = nThumbPosition>0; - maEnabledState[PagerUp] = nThumbPosition>0; - maEnabledState[NextButton] = nThumbPosition+nThumbSize < mnTotalSize; - maEnabledState[PagerDown] = nThumbPosition+nThumbSize < mnTotalSize; - maEnabledState[Thumb] = nThumbSize < mnTotalSize; - } - maBox[PagerUp] = geometry::RealRectangle2D( - maBox[Pager].X1, maBox[Pager].Y1, maBox[Thumb].X1-1, maBox[Pager].Y2); - maBox[PagerDown] = geometry::RealRectangle2D( - maBox[Thumb].X2+1, maBox[Pager].Y1, maBox[Pager].X2, maBox[Pager].Y2); - maBox[Total] = PresenterGeometryHelper::Union( - PresenterGeometryHelper::Union(maBox[PrevButton], maBox[NextButton]), - maBox[Pager]); -} - -void PresenterHorizontalScrollBar::UpdateBitmaps (void) -{ - if (mpBitmaps.get() != NULL) - { - mpPrevButtonDescriptor = mpBitmaps->GetBitmap(A2S("Left")); - mpNextButtonDescriptor = mpBitmaps->GetBitmap(A2S("Right")); - mpPagerStartDescriptor = mpBitmaps->GetBitmap(A2S("PagerLeft")); - mpPagerCenterDescriptor = mpBitmaps->GetBitmap(A2S("PagerHorizontal")); - mpPagerEndDescriptor = mpBitmaps->GetBitmap(A2S("PagerRight")); - mpThumbStartDescriptor = mpBitmaps->GetBitmap(A2S("ThumbLeft")); - mpThumbCenterDescriptor = mpBitmaps->GetBitmap(A2S("ThumbHorizontal")); - mpThumbEndDescriptor = mpBitmaps->GetBitmap(A2S("ThumbRight")); - - mnScrollBarHeight = 0; - UpdateWidthOrHeight(mnScrollBarHeight, mpPrevButtonDescriptor); - UpdateWidthOrHeight(mnScrollBarHeight, mpNextButtonDescriptor); - UpdateWidthOrHeight(mnScrollBarHeight, mpPagerStartDescriptor); - UpdateWidthOrHeight(mnScrollBarHeight, mpPagerCenterDescriptor); - UpdateWidthOrHeight(mnScrollBarHeight, mpPagerEndDescriptor); - UpdateWidthOrHeight(mnScrollBarHeight, mpThumbStartDescriptor); - UpdateWidthOrHeight(mnScrollBarHeight, mpThumbCenterDescriptor); - UpdateWidthOrHeight(mnScrollBarHeight, mpThumbEndDescriptor); - if (mnScrollBarHeight == 0) - mnScrollBarHeight = 20; - } -} - -void PresenterHorizontalScrollBar::PaintComposite( - const css::awt::Rectangle& rUpdateBox, - const Area eArea, - const SharedBitmapDescriptor& rpStartBitmaps, - const SharedBitmapDescriptor& rpCenterBitmaps, - const SharedBitmapDescriptor& rpEndBitmaps) -{ - const awt::Rectangle aWindowBox (mxWindow->getPosSize()); - geometry::RealRectangle2D aBox (GetRectangle(eArea)); - aBox.X1 += aWindowBox.X; - aBox.Y1 += aWindowBox.Y; - aBox.X2 += aWindowBox.X; - aBox.Y2 += aWindowBox.Y; - - PresenterUIPainter::PaintHorizontalBitmapComposite( - mxCanvas, - rUpdateBox, - PresenterGeometryHelper::ConvertRectangle(aBox), - GetBitmap(eArea, rpStartBitmaps), - GetBitmap(eArea, rpCenterBitmaps), - GetBitmap(eArea, rpEndBitmaps)); -} - //===== PresenterScrollBar::MousePressRepeater ================================ PresenterScrollBar::MousePressRepeater::MousePressRepeater ( |