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>
47 :
public std::enable_shared_from_this<MousePressRepeater>
70 const Reference<XComponentContext>& rxComponentContext,
71 const Reference<awt::XWindow>& rxParentWindow,
72 std::shared_ptr<PresenterPaintManager> xPaintManager,
73 ::std::function<
void (
double)> aThumbMotionListener)
76 mpPaintManager(
std::move(xPaintManager)),
82 maThumbMotionListener(
std::move(aThumbMotionListener)),
83 meButtonDownArea(
None),
84 meMouseMoveArea(
None),
85 mbIsNotificationActive(false),
91 Reference<lang::XMultiComponentFactory>
xFactory (rxComponentContext->getServiceManager());
97 "com.sun.star.comp.Draw.PresenterHelper",
109 Reference<awt::XWindowPeer> xPeer (
mxWindow, UNO_QUERY_THROW);
110 xPeer->setBackground(0xff000000);
116 mxWindow->addMouseMotionListener(
this);
133 mxWindow->removeWindowListener(
this);
134 mxWindow->removePaintListener(
this);
135 mxWindow->removeMouseListener(
this);
136 mxWindow->removeMouseMotionListener(
this);
138 Reference<lang::XComponent> xComponent =
mxWindow;
141 xComponent->dispose();
158 sal_Int32(floor(rBox.X1)),
159 sal_Int32(ceil(rBox.Y1)),
160 sal_Int32(ceil(rBox.X2-rBox.X1)),
161 sal_Int32(floor(rBox.Y2-rBox.Y1)),
162 awt::PosSize::POSSIZE);
169 const bool bAsynchronousUpdate)
205 OSL_ASSERT(nThumbSize>=0);
237 mpBitmaps = std::make_shared<PresenterBitmapContainer>(
238 "PresenterScreenSettings/ScrollBar/Bitmaps",
239 std::shared_ptr<PresenterBitmapContainer>(),
276 const awt::Rectangle& rUpdateBox)
298 Reference<rendering::XSpriteCanvas> xSpriteCanvas (
mxCanvas, UNO_QUERY);
299 if (xSpriteCanvas.is())
300 xSpriteCanvas->updateScreen(
false);
319 awt::Rectangle aRepaintBox (rEvent.UpdateRect);
320 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
321 aRepaintBox.X += aWindowBox.X;
322 aRepaintBox.Y += aWindowBox.Y;
325 Reference<rendering::XSpriteCanvas> xSpriteCanvas (
mxCanvas, UNO_QUERY);
326 if (xSpriteCanvas.is())
327 xSpriteCanvas->updateScreen(
false);
375 if (eOldMouseMoveArea !=
None)
395 if (nDragDistance != 0)
418 const geometry::RealRectangle2D& rBox,
419 const bool bAsynchronousUpdate)
425 bAsynchronousUpdate);
429 const css::awt::Rectangle& rUpdateBox)
434 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
444 const css::awt::Rectangle& rUpdateBox,
448 const geometry::RealRectangle2D aLocalBox (
GetRectangle(eArea));
449 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
450 geometry::RealRectangle2D aBox (aLocalBox);
451 aBox.X1 += aWindowBox.X;
452 aBox.Y1 += aWindowBox.Y;
453 aBox.X2 += aWindowBox.X;
454 aBox.Y2 += aWindowBox.Y;
456 Reference<rendering::XBitmap> xBitmap (
GetBitmap(eArea,rpBitmaps));
461 Reference<rendering::XPolyPolygon2D> xClipPolygon (
467 const rendering::ViewState aViewState (
468 geometry::AffineMatrix2D(1,0,0, 0,1,0),
471 const geometry::IntegerSize2D aBitmapSize (xBitmap->getSize());
472 rendering::RenderState aRenderState (
473 geometry::AffineMatrix2D(
474 1,0,aBox.X1 + (aBox.X2-aBox.X1 - aBitmapSize.Width)/2,
475 0,1,aBox.Y1 + (aBox.Y2-aBox.Y1 - aBitmapSize.Height)/2),
478 rendering::CompositeOperation::SOURCE);
488 const geometry::RealPoint2D aPoint(nX, nY);
513 Reference<rendering::XBitmap> xBitmap (rpDescriptor->GetNormalBitmap());
516 const geometry::IntegerSize2D aBitmapSize (xBitmap->getSize());
517 const sal_Int32 nBitmapSize =
static_cast<sal_Int32
>(
GetMinor(aBitmapSize.Width, aBitmapSize.Height));
518 if (nBitmapSize > rSize)
535 const Area eArea)
const
555 const Reference<XComponentContext>& rxComponentContext,
556 const Reference<awt::XWindow>& rxParentWindow,
557 const std::shared_ptr<PresenterPaintManager>& rpPaintManager,
558 const ::std::function<
void (
double)>& rThumbMotionListener)
559 :
PresenterScrollBar(rxComponentContext, rxParentWindow, rpPaintManager, rThumbMotionListener),
575 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
576 const double nBarWidth (aWindowBox.Width);
577 const double nPagerHeight (aWindowBox.Height - 2*nBarWidth);
578 const double nDragDistance (
mnTotalSize / nPagerHeight * nDistance);
584 return nDragDistance;
590 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
591 const double nBarWidth (aWindowBox.Width);
592 const double nPagerHeight (aWindowBox.Height - 2*nBarWidth);
608 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
609 double nBottom = aWindowBox.Height;
616 geometry::IntegerSize2D aSize (xBitmap->getSize());
618 0, nBottom - aSize.Height, aWindowBox.Width, nBottom);
627 geometry::IntegerSize2D aSize (xBitmap->getSize());
629 0, nBottom - aSize.Height, aWindowBox.Width, nBottom);
633 const double nPagerHeight (nBottom);
635 0,0, aWindowBox.Width, nBottom);
654 (nThumbPosition+nThumbSize) /
mnTotalSize * nPagerHeight);
700 const css::awt::Rectangle& rUpdateBox,
706 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
708 aBox.X1 += aWindowBox.X;
709 aBox.Y1 += aWindowBox.Y;
710 aBox.X2 += aWindowBox.X;
711 aBox.Y2 += aWindowBox.Y;
731 mpScrollBar(
std::move(xScrollBar)),
739 mpScrollBar =
nullptr;
744 meMouseArea = reArea;
752 auto pThis(shared_from_this());
754 mpScrollBar->GetComponentContext(),
755 [pThis] (TimeValue
const&) { return pThis->Callback(); },
769 const sal_Int32 nTaskId (mnMousePressRepeaterTaskId);
777 if (meMouseArea != reArea)
799 const double nThumbPosition (mpScrollBar->GetThumbPosition());
803 mpScrollBar->SetThumbPosition(nThumbPosition - mpScrollBar->GetLineHeight(),
true);
807 mpScrollBar->SetThumbPosition(nThumbPosition + mpScrollBar->GetLineHeight(),
true);
811 mpScrollBar->SetThumbPosition(nThumbPosition - mpScrollBar->GetThumbSize()*0.8,
true);
815 mpScrollBar->SetThumbPosition(nThumbPosition + mpScrollBar->GetThumbSize()*0.8,
true);
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
Collection of functions to ease the life of a canvas user.
static css::geometry::RealRectangle2D Union(const css::geometry::RealRectangle2D &rBox1, const css::geometry::RealRectangle2D &rBox2)
static bool AreRectanglesDisjoint(const css::awt::Rectangle &rBox1, const css::awt::Rectangle &rBox2)
static bool IsInside(const css::geometry::RealRectangle2D &rBox, const css::geometry::RealPoint2D &rPoint)
static css::awt::Rectangle Intersection(const css::awt::Rectangle &rBox1, const css::awt::Rectangle &rBox2)
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::uno::Reference< css::rendering::XPolyPolygon2D > CreatePolygon(const css::awt::Rectangle &rBox, const css::uno::Reference< css::rendering::XGraphicDevice > &rxDevice)
static css::awt::Rectangle ConvertRectangle(const css::geometry::RealRectangle2D &rBox)
Return the bounding box with integer coordinates of the given rectangle.
The timer allows tasks to be scheduled for execution at a specified time in the future.
static void CancelTask(const sal_Int32 nTaskId)
static const sal_Int32 NotAValidTaskId
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 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)
Reference< XSingleServiceFactory > xFactory
std::shared_ptr< T > make_shared(Args &&... args)
::cppu::WeakComponentImplHelper< css::awt::XWindowListener, css::awt::XPaintListener, css::awt::XMouseListener, css::awt::XMouseMotionListener > PresenterScrollBarInterfaceBase
std::shared_ptr< PresenterBitmapContainer::BitmapDescriptor > SharedBitmapDescriptor