27 #include <com/sun/star/awt/PosSize.hpp>
28 #include <com/sun/star/awt/XWindowPeer.hpp>
29 #include <com/sun/star/rendering/CompositeOperation.hpp>
30 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
46 :
public std::enable_shared_from_this<MousePressRepeater>
70 const Reference<awt::XWindow>& rxParentWindow,
71 const std::shared_ptr<PresenterPaintManager>& rpPaintManager,
72 const ::std::function<
void (
double)>& rThumbMotionListener)
78 mpPaintManager(rpPaintManager),
84 maThumbMotionListener(rThumbMotionListener),
85 meButtonDownArea(
None),
86 meMouseMoveArea(
None),
87 mbIsNotificationActive(false),
89 mpPrevButtonDescriptor(),
90 mpNextButtonDescriptor(),
91 mpPagerStartDescriptor(),
92 mpPagerCenterDescriptor(),
93 mpPagerEndDescriptor(),
94 mpThumbStartDescriptor(),
95 mpThumbCenterDescriptor(),
96 mpThumbEndDescriptor(),
103 Reference<lang::XMultiComponentFactory>
xFactory (rxComponentContext->getServiceManager());
108 xFactory->createInstanceWithContext(
109 "com.sun.star.comp.Draw.PresenterHelper",
121 Reference<awt::XWindowPeer> xPeer (
mxWindow, UNO_QUERY_THROW);
122 xPeer->setBackground(0xff000000);
128 mxWindow->addMouseMotionListener(
this);
145 mxWindow->removeWindowListener(
this);
146 mxWindow->removePaintListener(
this);
147 mxWindow->removeMouseListener(
this);
148 mxWindow->removeMouseMotionListener(
this);
153 xComponent->dispose();
170 sal_Int32(floor(rBox.X1)),
171 sal_Int32(ceil(rBox.Y1)),
172 sal_Int32(ceil(rBox.X2-rBox.X1)),
173 sal_Int32(floor(rBox.Y2-rBox.Y1)),
174 awt::PosSize::POSSIZE);
181 const bool bAsynchronousUpdate)
217 OSL_ASSERT(nThumbSize>=0);
249 mpBitmaps = std::make_shared<PresenterBitmapContainer>(
250 "PresenterScreenSettings/ScrollBar/Bitmaps",
251 std::shared_ptr<PresenterBitmapContainer>(),
288 const awt::Rectangle& rUpdateBox)
310 Reference<rendering::XSpriteCanvas> xSpriteCanvas (
mxCanvas, UNO_QUERY);
311 if (xSpriteCanvas.is())
312 xSpriteCanvas->updateScreen(
false);
331 awt::Rectangle aRepaintBox (rEvent.UpdateRect);
332 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
333 aRepaintBox.X += aWindowBox.X;
334 aRepaintBox.Y += aWindowBox.Y;
337 Reference<rendering::XSpriteCanvas> xSpriteCanvas (
mxCanvas, UNO_QUERY);
338 if (xSpriteCanvas.is())
339 xSpriteCanvas->updateScreen(
false);
387 if (eOldMouseMoveArea !=
None)
407 if (nDragDistance != 0)
430 const geometry::RealRectangle2D& rBox,
431 const bool bAsynchronousUpdate)
437 bAsynchronousUpdate);
441 const css::awt::Rectangle& rUpdateBox)
446 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
456 const css::awt::Rectangle& rUpdateBox,
460 const geometry::RealRectangle2D aLocalBox (
GetRectangle(eArea));
461 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
462 geometry::RealRectangle2D aBox (aLocalBox);
463 aBox.X1 += aWindowBox.X;
464 aBox.Y1 += aWindowBox.Y;
465 aBox.X2 += aWindowBox.X;
466 aBox.Y2 += aWindowBox.Y;
468 Reference<rendering::XBitmap> xBitmap (
GetBitmap(eArea,rpBitmaps));
473 Reference<rendering::XPolyPolygon2D> xClipPolygon (
479 const rendering::ViewState aViewState (
480 geometry::AffineMatrix2D(1,0,0, 0,1,0),
483 const geometry::IntegerSize2D aBitmapSize (xBitmap->getSize());
484 rendering::RenderState aRenderState (
485 geometry::AffineMatrix2D(
486 1,0,aBox.X1 + (aBox.X2-aBox.X1 - aBitmapSize.Width)/2,
487 0,1,aBox.Y1 + (aBox.Y2-aBox.Y1 - aBitmapSize.Height)/2),
490 rendering::CompositeOperation::SOURCE);
500 const geometry::RealPoint2D aPoint(nX, nY);
525 Reference<rendering::XBitmap> xBitmap (rpDescriptor->GetNormalBitmap());
528 const geometry::IntegerSize2D aBitmapSize (xBitmap->getSize());
529 const sal_Int32 nBitmapSize =
static_cast<sal_Int32
>(
GetMinor(aBitmapSize.Width, aBitmapSize.Height));
530 if (nBitmapSize > rSize)
547 const Area eArea)
const
568 const Reference<awt::XWindow>& rxParentWindow,
569 const std::shared_ptr<PresenterPaintManager>& rpPaintManager,
570 const ::std::function<
void (
double)>& rThumbMotionListener)
571 :
PresenterScrollBar(rxComponentContext, rxParentWindow, rpPaintManager, rThumbMotionListener),
587 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
588 const double nBarWidth (aWindowBox.Width);
589 const double nPagerHeight (aWindowBox.Height - 2*nBarWidth);
590 const double nDragDistance (
mnTotalSize / nPagerHeight * nDistance);
596 return nDragDistance;
602 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
603 const double nBarWidth (aWindowBox.Width);
604 const double nPagerHeight (aWindowBox.Height - 2*nBarWidth);
620 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
621 double nBottom = aWindowBox.Height;
628 geometry::IntegerSize2D aSize (xBitmap->getSize());
630 0, nBottom - aSize.Height, aWindowBox.Width, nBottom);
639 geometry::IntegerSize2D aSize (xBitmap->getSize());
641 0, nBottom - aSize.Height, aWindowBox.Width, nBottom);
645 const double nPagerHeight (nBottom);
647 0,0, aWindowBox.Width, nBottom);
666 (nThumbPosition+nThumbSize) /
mnTotalSize * nPagerHeight);
712 const css::awt::Rectangle& rUpdateBox,
718 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
720 aBox.X1 += aWindowBox.X;
721 aBox.Y1 += aWindowBox.Y;
722 aBox.X2 += aWindowBox.X;
723 aBox.Y2 += aWindowBox.Y;
741 const ::rtl::Reference<PresenterScrollBar>& rpScrollBar)
743 mpScrollBar(rpScrollBar),
751 mpScrollBar =
nullptr;
756 meMouseArea = reArea;
764 auto pThis(shared_from_this());
766 mpScrollBar->GetComponentContext(),
767 [pThis] (TimeValue
const&) {
return pThis->Callback(); },
781 const sal_Int32 nTaskId (mnMousePressRepeaterTaskId);
789 if (meMouseArea != reArea)
811 const double nThumbPosition (mpScrollBar->GetThumbPosition());
815 mpScrollBar->SetThumbPosition(nThumbPosition - mpScrollBar->GetLineHeight(),
true);
819 mpScrollBar->SetThumbPosition(nThumbPosition + mpScrollBar->GetLineHeight(),
true);
823 mpScrollBar->SetThumbPosition(nThumbPosition - mpScrollBar->GetThumbSize()*0.8,
true);
827 mpScrollBar->SetThumbPosition(nThumbPosition + mpScrollBar->GetThumbSize()*0.8,
true);
Reference< rendering::XCanvas > mxCanvas
static sal_Int32 ScheduleRepeatedTask(const css::uno::Reference< css::uno::XComponentContext > &xContext, const Task &rTask, const sal_Int64 nFirst, const sal_Int64 nInterval)
Schedule a task to be executed repeatedly.
static bool AreRectanglesDisjoint(const css::awt::Rectangle &rBox1, const css::awt::Rectangle &rBox2)
std::shared_ptr< T > make_shared(Args &&...args)
static css::geometry::RealRectangle2D Union(const css::geometry::RealRectangle2D &rBox1, const css::geometry::RealRectangle2D &rBox2)
std::shared_ptr< PresenterBitmapContainer::BitmapDescriptor > SharedBitmapDescriptor
Reference< drawing::XPresenterHelper > mxPresenterHelper
std::shared_ptr< PresenterBitmapContainer > mpBitmaps
Collection of functions to ease the life of a canvas user.
static void CancelTask(const sal_Int32 nTaskId)
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
static void PaintVerticalBitmapComposite(const css::uno::Reference< css::rendering::XCanvas > &rxCanvas, const css::awt::Rectangle &rRepaintBox, const css::awt::Rectangle &rBoundingBox, const css::uno::Reference< css::rendering::XBitmap > &rxTopBitmap, const css::uno::Reference< css::rendering::XBitmap > &rxRepeatableCenterBitmap, const css::uno::Reference< css::rendering::XBitmap > &rxBottomBitmap)
static css::awt::Rectangle ConvertRectangleWithConstantSize(const css::geometry::RealRectangle2D &rBox)
Convert the given rectangle to integer coordinates so that width and height remain constant when only...
static css::awt::Rectangle ConvertRectangle(const css::geometry::RealRectangle2D &rBox)
Return the bounding box with integer coordinates of the given rectangle.
static css::uno::Reference< css::rendering::XPolyPolygon2D > CreatePolygon(const css::awt::Rectangle &rBox, const css::uno::Reference< css::rendering::XGraphicDevice > &rxDevice)
static css::awt::Rectangle Intersection(const css::awt::Rectangle &rBox1, const css::awt::Rectangle &rBox2)
static const sal_Int32 NotAValidTaskId
Reference< XSingleServiceFactory > xFactory
static bool IsInside(const css::geometry::RealRectangle2D &rBox, const css::geometry::RealPoint2D &rPoint)
The timer allows tasks to be scheduled for execution at a specified time in the future.
::cppu::WeakComponentImplHelper< css::awt::XWindowListener, css::awt::XPaintListener, css::awt::XMouseListener, css::awt::XMouseMotionListener > PresenterScrollBarInterfaceBase