[Libreoffice-commits] core.git: 4 commits - sw/source vcl/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Nov 24 06:55:12 PST 2015
sw/source/core/view/viewsh.cxx | 2 ++
sw/source/uibase/docvw/SidebarScrollBar.cxx | 10 ++++++++++
sw/source/uibase/docvw/SidebarScrollBar.hxx | 2 ++
sw/source/uibase/docvw/SidebarWin.cxx | 10 +++++-----
vcl/source/control/scrbar.cxx | 14 +++++++++++++-
5 files changed, 32 insertions(+), 6 deletions(-)
New commits:
commit de2a6897876976d769504a36abf54eced626b01c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Nov 24 15:37:29 2015 +0100
sw lok comments: fix map mode state after changing zoom levels
Zoom level of SwEditWin is kept in sync with the client, so that the
pixel-based comment widgets can be positioned correctly. But that does
not mean in general the SwEditWin map mode should not be disabled: so
that we don't have to tweak the map mode for each and every
postMouseEvent() call and still be able to send them using logic
coordinates.
Change-Id: I6f686b93d2509d52fdd34e84a502cf04e1ce6e59
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index c45fd29..229b7a5 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1888,6 +1888,8 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
SwViewOption aOption(*GetViewOptions());
aOption.SetZoom(fScale * 100);
ApplyViewOptions(aOption);
+ // Make sure the map mode (disabled in SwXTextDocument::initializeForTiledRendering()) is still disabled.
+ GetWin()->EnableMapMode(false);
}
Rectangle aOutRect = Rectangle(Point(tilePosX, tilePosY),
commit 7c654ee9d51a752e02c0a972de27d699ab5b649a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Nov 24 15:20:22 2015 +0100
sw lok comments: avoid crash an exit after clicking the scrollbar
Without this, vcl::Window::ImplTrackTimerHdl() will be called on a
deleted vcl::Window.
Can be reproduced with a comment having a scrollbar in a LOK client,
then clicking on the down button of the scrollbar a number of times ->
crash on exit.
Change-Id: I5d67f96e8baa199f65ec5cf39cb5d39c8162ff33
diff --git a/sw/source/uibase/docvw/SidebarScrollBar.cxx b/sw/source/uibase/docvw/SidebarScrollBar.cxx
index ede4610..9e2c299 100644
--- a/sw/source/uibase/docvw/SidebarScrollBar.cxx
+++ b/sw/source/uibase/docvw/SidebarScrollBar.cxx
@@ -60,6 +60,11 @@ void SidebarScrollBar::LogicInvalidate(const Rectangle* pRectangle)
rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
}
+void SidebarScrollBar::MouseButtonUp(const MouseEvent& /*rMouseEvent*/)
+{
+ EndTracking();
+}
+
void SidebarScrollBar::MouseMove(const MouseEvent& rMouseEvent)
{
TrackingEvent aEvent(rMouseEvent);
diff --git a/sw/source/uibase/docvw/SidebarScrollBar.hxx b/sw/source/uibase/docvw/SidebarScrollBar.hxx
index ea5639e..0de225b 100644
--- a/sw/source/uibase/docvw/SidebarScrollBar.hxx
+++ b/sw/source/uibase/docvw/SidebarScrollBar.hxx
@@ -31,6 +31,7 @@ protected:
/// @see OutputDevice::LogicInvalidate().
void LogicInvalidate(const Rectangle* pRectangle) override;
void MouseMove(const MouseEvent& rMouseEvent) override;
+ void MouseButtonUp(const MouseEvent& rMouseEvent) override;
public:
SidebarScrollBar(SwSidebarWin& rSidebarWin, WinBits nStyle, SwView& rView);
virtual ~SidebarScrollBar();
commit d562df03098ecb91a89e91ccf69dd6a1eeb98c89
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Nov 24 15:04:33 2015 +0100
sw lok comments: implement drag of the scrollbar
With this, if a comment has a vertical scrollbar, then not only the
buttons of the scrollbar can be clicked on, but also the slider of the
scrollbar can be dragged.
Change-Id: I2e39e18bf60c42a878bb8bfd808f1d47be27eecb
diff --git a/sw/source/uibase/docvw/SidebarScrollBar.cxx b/sw/source/uibase/docvw/SidebarScrollBar.cxx
index 909aa76..ede4610 100644
--- a/sw/source/uibase/docvw/SidebarScrollBar.cxx
+++ b/sw/source/uibase/docvw/SidebarScrollBar.cxx
@@ -60,6 +60,11 @@ void SidebarScrollBar::LogicInvalidate(const Rectangle* pRectangle)
rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
}
+void SidebarScrollBar::MouseMove(const MouseEvent& rMouseEvent)
+{
+ TrackingEvent aEvent(rMouseEvent);
+ Tracking(aEvent);
+}
SidebarScrollBar::~SidebarScrollBar()
{
diff --git a/sw/source/uibase/docvw/SidebarScrollBar.hxx b/sw/source/uibase/docvw/SidebarScrollBar.hxx
index 9543205..ea5639e 100644
--- a/sw/source/uibase/docvw/SidebarScrollBar.hxx
+++ b/sw/source/uibase/docvw/SidebarScrollBar.hxx
@@ -30,6 +30,7 @@ class SidebarScrollBar : public ScrollBar
protected:
/// @see OutputDevice::LogicInvalidate().
void LogicInvalidate(const Rectangle* pRectangle) override;
+ void MouseMove(const MouseEvent& rMouseEvent) override;
public:
SidebarScrollBar(SwSidebarWin& rSidebarWin, WinBits nStyle, SwView& rView);
virtual ~SidebarScrollBar();
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index a9a97c2..fc4c790 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -463,15 +463,15 @@ void SwSidebarWin::KeyInput(const KeyEvent& rKeyEvent)
void SwSidebarWin::MouseMove(const MouseEvent& rMouseEvent)
{
- if (mpSidebarTextControl)
+ if (vcl::Window* pHit = lcl_getHitWindow(*this, rMouseEvent))
{
- mpSidebarTextControl->Push(PushFlags::MAPMODE);
+ pHit->Push(PushFlags::MAPMODE);
MouseEvent aMouseEvent(rMouseEvent);
- lcl_translateTwips(EditWin(), *mpSidebarTextControl, &aMouseEvent);
+ lcl_translateTwips(EditWin(), *pHit, &aMouseEvent);
- mpSidebarTextControl->MouseMove(aMouseEvent);
+ pHit->MouseMove(aMouseEvent);
- mpSidebarTextControl->Pop();
+ pHit->Pop();
}
}
commit d7acb44b148893fe0cc48a54c3eb73406c251668
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Nov 24 15:01:01 2015 +0100
vcl lok: handle tracking coordinates which are in twips
This is similar to the mouse button down handling. When the map mode is
disabled and the map mode is in twips, then in general it's possible to
send mouse coordinates in twips. The scrollbar is usually in pixels, so
add extra code to still make this possible.
Change-Id: I0c7e404ecd7ac839e000266e396683bb7d15c505
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 4ed1983..5d44cd7 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -1058,7 +1058,19 @@ void ScrollBar::Tracking( const TrackingEvent& rTEvt )
}
else
{
- const Point rMousePos = rTEvt.GetMouseEvent().GetPosPixel();
+ Point aPosPixel;
+ if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MAP_TWIP)
+ {
+ // rTEvt coordinates are in twips.
+ Push(PushFlags::MAPMODE);
+ EnableMapMode();
+ MapMode aMapMode = GetMapMode();
+ aMapMode.SetOrigin(Point(0, 0));
+ SetMapMode(aMapMode);
+ aPosPixel = LogicToPixel(rTEvt.GetMouseEvent().GetPosPixel());
+ Pop();
+ }
+ const Point rMousePos = (GetMapMode().GetMapUnit() != MAP_TWIP ? rTEvt.GetMouseEvent().GetPosPixel() : aPosPixel);
// Dragging is treated in a special way
if ( meScrollType == SCROLL_DRAG )
More information about the Libreoffice-commits
mailing list