[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 14 commits - editeng/source sw/Library_sw.mk sw/source vcl/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Nov 24 07:27:26 PST 2015
editeng/source/editeng/impedit.cxx | 6 +
sw/Library_sw.mk | 1
sw/source/core/layout/pagechg.cxx | 6 -
sw/source/core/view/viewsh.cxx | 11 +++
sw/source/uibase/docvw/SidebarScrollBar.cxx | 82 +++++++++++++++++++++++
sw/source/uibase/docvw/SidebarScrollBar.hxx | 45 ++++++++++++
sw/source/uibase/docvw/SidebarTxtControl.cxx | 34 +++++----
sw/source/uibase/docvw/SidebarWin.cxx | 95 ++++++++++++++++++++-------
vcl/source/control/scrbar.cxx | 40 +++++++++--
9 files changed, 271 insertions(+), 49 deletions(-)
New commits:
commit 7d6fd383f09426e1471aa8a756e3c398c6895471
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
(cherry picked from commit de2a6897876976d769504a36abf54eced626b01c)
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 86d7225..9112bfb 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1891,6 +1891,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 0088ea9850e7f5799e240a7e0b8d62cc45309513
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
(cherry picked from commit 7c654ee9d51a752e02c0a972de27d699ab5b649a)
diff --git a/sw/source/uibase/docvw/SidebarScrollBar.cxx b/sw/source/uibase/docvw/SidebarScrollBar.cxx
index 7a80363..b4d70b4 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 96578c97f7f76cd87a98968a9cceace5c586d6d1
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.
(cherry picked from commit d562df03098ecb91a89e91ccf69dd6a1eeb98c89)
Conflicts:
sw/source/uibase/docvw/SidebarWin.cxx
Change-Id: I2e39e18bf60c42a878bb8bfd808f1d47be27eecb
diff --git a/sw/source/uibase/docvw/SidebarScrollBar.cxx b/sw/source/uibase/docvw/SidebarScrollBar.cxx
index c82dae4..7a80363 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 02fd865..78733b6 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 0e41aa81df67eac71556e1846abd51777e6d344e
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
(cherry picked from commit d7acb44b148893fe0cc48a54c3eb73406c251668)
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 93d7089..7944065 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -1076,7 +1076,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 )
commit 457ecf7eb9c66a8a2c918705b2ed73447b3fd269
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Nov 24 11:58:09 2015 +0100
sw lok comments: fix missing invalidations from the scrollbar
If a comment had a scrollbar, and the user clicked on the down arrow of
it, then the button remained in the "pushed" state, as the scrollbar
invalidations were not routed to the LOK client.
With this, the button gets back to its non-pushed state after the mouse
button is released.
(cherry picked from commit 55040ea13426e337418143dcfe226dd2a395f041)
Change-Id: Ie4ba5d0ec07229b0cfc08532e8e91ae25f7a4c9e
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index ea83687..1297a85 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -600,6 +600,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/uibase/docvw/OverlayRanges \
sw/source/uibase/docvw/PostItMgr \
sw/source/uibase/docvw/ShadowOverlayObject \
+ sw/source/uibase/docvw/SidebarScrollBar \
sw/source/uibase/docvw/SidebarTxtControl \
sw/source/uibase/docvw/SidebarTxtControlAcc \
sw/source/uibase/docvw/SidebarWin \
diff --git a/sw/source/uibase/docvw/SidebarScrollBar.cxx b/sw/source/uibase/docvw/SidebarScrollBar.cxx
new file mode 100644
index 0000000..c82dae4
--- /dev/null
+++ b/sw/source/uibase/docvw/SidebarScrollBar.cxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <SidebarScrollBar.hxx>
+
+#define LOK_USE_UNSTABLE_API
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+
+#include <SidebarWin.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <edtwin.hxx>
+
+namespace sw
+{
+namespace sidebarwindows
+{
+
+SidebarScrollBar::SidebarScrollBar(SwSidebarWin& rSidebarWin, WinBits nStyle, SwView& rView)
+ : ScrollBar(&rSidebarWin, nStyle),
+ m_rSidebarWin(rSidebarWin),
+ m_rView(rView)
+{
+}
+
+void SidebarScrollBar::LogicInvalidate(const Rectangle* pRectangle)
+{
+ Rectangle aRectangle;
+
+ if (!pRectangle)
+ {
+ Push(PushFlags::MAPMODE);
+ EnableMapMode();
+ MapMode aMapMode = GetMapMode();
+ aMapMode.SetMapUnit(MAP_TWIP);
+ SetMapMode(aMapMode);
+ aRectangle = Rectangle(Point(0, 0), PixelToLogic(GetSizePixel()));
+ Pop();
+ }
+ else
+ aRectangle = *pRectangle;
+
+ // Convert from relative twips to absolute ones.
+ vcl::Window& rParent = *m_rSidebarWin.EditWin();
+ Point aOffset(GetOutOffXPixel() - rParent.GetOutOffXPixel(), GetOutOffYPixel() - rParent.GetOutOffYPixel());
+ rParent.Push(PushFlags::MAPMODE);
+ rParent.EnableMapMode();
+ aOffset = rParent.PixelToLogic(aOffset);
+ rParent.Pop();
+ aRectangle.Move(aOffset.getX(), aOffset.getY());
+
+ OString sRectangle = aRectangle.toString();
+ SwWrtShell& rWrtShell = m_rView.GetWrtShell();
+ rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
+}
+
+
+SidebarScrollBar::~SidebarScrollBar()
+{
+ disposeOnce();
+}
+
+}
+} // end of namespace sw::sidebarwindows
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/docvw/SidebarScrollBar.hxx b/sw/source/uibase/docvw/SidebarScrollBar.hxx
new file mode 100644
index 0000000..9543205
--- /dev/null
+++ b/sw/source/uibase/docvw/SidebarScrollBar.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SW_SOURCE_UIBASE_DOCVW_SIDEBARSCROLLBAR_HXX
+#define INCLUDED_SW_SOURCE_UIBASE_DOCVW_SIDEBARSCROLLBAR_HXX
+
+#include <vcl/scrbar.hxx>
+
+class SwView;
+
+namespace sw
+{
+namespace sidebarwindows
+{
+
+class SwSidebarWin;
+
+/// Similar to the VCL scrollbar, but instrumented with Writer-specific details for LOK.
+class SidebarScrollBar : public ScrollBar
+{
+ SwSidebarWin& m_rSidebarWin;
+ SwView& m_rView;
+
+protected:
+ /// @see OutputDevice::LogicInvalidate().
+ void LogicInvalidate(const Rectangle* pRectangle) override;
+public:
+ SidebarScrollBar(SwSidebarWin& rSidebarWin, WinBits nStyle, SwView& rView);
+ virtual ~SidebarScrollBar();
+};
+
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index c028c7b..02fd865 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -26,6 +26,7 @@
#include <PostItMgr.hxx>
#include <SidebarTxtControl.hxx>
+#include <SidebarScrollBar.hxx>
#include <AnchorOverlayObject.hxx>
#include <ShadowOverlayObject.hxx>
#include <OverlayRanges.hxx>
@@ -622,7 +623,7 @@ void SwSidebarWin::InitControls()
}
//create Scrollbars
- mpVScrollbar = VclPtr<ScrollBar>::Create(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
+ mpVScrollbar = VclPtr<SidebarScrollBar>::Create(*this, WB_3DLOOK |WB_VSCROLL|WB_DRAG, mrView);
mpVScrollbar->EnableNativeWidget(false);
mpVScrollbar->EnableRTL( false );
mpVScrollbar->SetScrollHdl(LINK(this, SwSidebarWin, ScrollHdl));
commit cb0c081de4052d2bfbe5f8cd3233c302522c6fd0
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Nov 23 16:21:43 2015 +0100
sw lok comments: handle mouse up/down events on the vertical scrollbar
(cherry picked from commit 527190f0c0284a9a4f5a021d0a9163ef9a63a67f)
Conflicts:
sw/source/uibase/docvw/SidebarWin.cxx
Change-Id: Ib1c334825a6629224fe0c8fba564656d53e67410
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index 955499e..c028c7b 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -92,9 +92,19 @@ void lcl_translateTwips(vcl::Window& rParent, vcl::Window& rChild, MouseEvent* p
{
// Set map mode, so that callback payloads will contain absolute coordinates instead of relative ones.
Point aOffset(rChild.GetOutOffXPixel() - rParent.GetOutOffXPixel(), rChild.GetOutOffYPixel() - rParent.GetOutOffYPixel());
+ if (!rChild.IsMapModeEnabled())
+ {
+ MapMode aMapMode(rChild.GetMapMode());
+ aMapMode.SetMapUnit(MAP_TWIP);
+ aMapMode.SetScaleX(rParent.GetMapMode().GetScaleX());
+ aMapMode.SetScaleY(rParent.GetMapMode().GetScaleY());
+ rChild.SetMapMode(aMapMode);
+ rChild.EnableMapMode();
+ }
aOffset = rChild.PixelToLogic(aOffset);
MapMode aMapMode(rChild.GetMapMode());
aMapMode.SetOrigin(aOffset);
+ aMapMode.SetMapUnit(rParent.GetMapMode().GetMapUnit());
rChild.SetMapMode(aMapMode);
rChild.EnableMapMode(false);
@@ -108,6 +118,31 @@ void lcl_translateTwips(vcl::Window& rParent, vcl::Window& rChild, MouseEvent* p
}
}
+/// Decide which one from the children of rParent should get rMouseEvent.
+vcl::Window* lcl_getHitWindow(sw::sidebarwindows::SwSidebarWin& rParent, const MouseEvent& rMouseEvent)
+{
+ vcl::Window* pRet = 0;
+
+ rParent.EditWin()->Push(PushFlags::MAPMODE);
+ rParent.EditWin()->EnableMapMode();
+ for (sal_Int16 i = rParent.GetChildCount() - 1; i >= 0; --i)
+ {
+ vcl::Window* pChild = rParent.GetChild(i);
+
+ Point aPosition(rParent.GetPosPixel());
+ aPosition.Move(pChild->GetPosPixel().getX(), pChild->GetPosPixel().getY());
+ Size aSize(rParent.GetSizePixel());
+ Rectangle aRectangleLogic(rParent.EditWin()->PixelToLogic(aPosition), rParent.EditWin()->PixelToLogic(aSize));
+ if (aRectangleLogic.IsInside(rMouseEvent.GetPosPixel()))
+ {
+ pRet = pChild;
+ break;
+ }
+ }
+ rParent.EditWin()->Pop();
+ return pRet;
+}
+
}
namespace sw { namespace sidebarwindows {
@@ -441,29 +476,29 @@ void SwSidebarWin::MouseMove(const MouseEvent& rMouseEvent)
void SwSidebarWin::MouseButtonDown(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->MouseButtonDown(aMouseEvent);
+ pHit->MouseButtonDown(aMouseEvent);
- mpSidebarTextControl->Pop();
+ pHit->Pop();
}
}
void SwSidebarWin::MouseButtonUp(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->MouseButtonUp(aMouseEvent);
+ pHit->MouseButtonUp(aMouseEvent);
- mpSidebarTextControl->Pop();
+ pHit->Pop();
}
}
commit 2bfd1c7d4832930d6227bc9891e665df32789f4f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Nov 23 16:07:49 2015 +0100
vcl lok: fix scrollbar to accept mouse events in twips
(cherry picked from commit 439765480695975e10c92f39aa6a4cb6f2ee7646)
Conflicts:
vcl/source/control/scrbar.cxx
Change-Id: Ieaedaa525d613f8ba55f336c613da163a09f7a33
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 4125436..93d7089 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -897,7 +897,19 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
if (rMEvt.IsLeft() || rMEvt.IsMiddle() || rMEvt.IsRight())
{
- const Point& rMousePos = rMEvt.GetPosPixel();
+ Point aPosPixel;
+ if (!IsMapModeEnabled() && GetMapMode().GetMapUnit() == MAP_TWIP)
+ {
+ // rMEvt coordinates are in twips.
+ Push(PushFlags::MAPMODE);
+ EnableMapMode();
+ MapMode aMapMode = GetMapMode();
+ aMapMode.SetOrigin(Point(0, 0));
+ SetMapMode(aMapMode);
+ aPosPixel = LogicToPixel(rMEvt.GetPosPixel());
+ Pop();
+ }
+ const Point& rMousePos = (GetMapMode().GetMapUnit() != MAP_TWIP ? rMEvt.GetPosPixel() : aPosPixel);
sal_uInt16 nTrackFlags = 0;
bool bHorizontal = ( GetStyle() & WB_HORZ ) != 0;
bool bIsInside = false;
commit 90a46a802eb8cd8af96b9d2ea8fda400544cc25c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Nov 23 13:46:59 2015 +0100
sw lok comments: fix vertical scrollbar with custom zoom
With this, if a comment has enough content that it gets a vertical
scrollbar, then tiled rendering output looks OK, even with non-100%
zoom.
Change-Id: I699aadc11b6c34fb0791e70705719fd61169d972
(cherry picked from commit 30b511ae38e2870174db91d12f65a9c3320fc172)
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 23a7b59..86d7225 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1884,6 +1884,15 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
aMapMode.SetScaleY(scaleY);
rDevice.SetMapMode(aMapMode);
+ // Update scaling of SwEditWin and its sub-widgets, needed for comments.
+ if (GetWin() && GetWin()->GetMapMode().GetScaleX() != scaleX)
+ {
+ double fScale = scaleX;
+ SwViewOption aOption(*GetViewOptions());
+ aOption.SetZoom(fScale * 100);
+ ApplyViewOptions(aOption);
+ }
+
Rectangle aOutRect = Rectangle(Point(tilePosX, tilePosY),
rDevice.PixelToLogic(Size(contextWidth, contextHeight)));
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index 5645444..955499e 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -283,8 +283,7 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle
continue;
rRenderContext.Push(PushFlags::MAPMODE);
- const Fraction& rFraction(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
- Point aOffset(PixelToLogic(pChild->GetPosPixel() * rFraction.GetDenominator() / rFraction.GetNumerator()));
+ Point aOffset(PixelToLogic(pChild->GetPosPixel()));
MapMode aMapMode(rRenderContext.GetMapMode());
aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset);
rRenderContext.SetMapMode(aMapMode);
@@ -298,6 +297,8 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle
pChild->EnableMapMode();
aMapMode = pChild->GetMapMode();
aMapMode.SetMapUnit(rRenderContext.GetMapMode().GetMapUnit());
+ aMapMode.SetScaleX(rRenderContext.GetMapMode().GetScaleX());
+ aMapMode.SetScaleY(rRenderContext.GetMapMode().GetScaleY());
pChild->SetMapMode(aMapMode);
}
commit 0050073b3a0e72fe8e23477227705591c48994af
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Nov 20 10:24:29 2015 +0100
sw lok comments: implement painting of the vertical scrollbar
This one is special, as normally its map mode is in pixels, but we need
all sub-widgets to work in twips when tiled rendering.
With this, the scrollbar widget (both the buttons and the
button/background area of the scrollbar itself) is painted at the
correct location when Writer comments have enough content so the
scrollbar is visible.
Change-Id: I4ee9ef8618974b965339078d2262364ec19732ef
(cherry picked from commit f411ef1b8065d3ae03d1a820812e64b250de0932)
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index af531fc..5645444 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -289,8 +289,22 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle
aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset);
rRenderContext.SetMapMode(aMapMode);
+ bool bPopChild = false;
+ if (pChild->GetMapMode().GetMapUnit() != rRenderContext.GetMapMode().GetMapUnit())
+ {
+ // This is needed for the scrollbar that has its map unit in pixels.
+ pChild->Push(PushFlags::MAPMODE);
+ bPopChild = true;
+ pChild->EnableMapMode();
+ aMapMode = pChild->GetMapMode();
+ aMapMode.SetMapUnit(rRenderContext.GetMapMode().GetMapUnit());
+ pChild->SetMapMode(aMapMode);
+ }
+
pChild->Paint(rRenderContext, rRect);
+ if (bPopChild)
+ pChild->Pop();
rRenderContext.Pop();
}
commit 801692645350127349e61d5cc0465dc46f58c549
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Nov 20 09:51:47 2015 +0100
vcl ScrollBar: audit Draw*() calls in ImplDraw()
These member functions take logic units, and the only case when omitting
PixelToLogic() all the time works is when both the widget itself and
render context has a pixel map unit.
Add missing PixelToLogic() calls where the input is in pixels, so in
case the render context has some logic units, the output is still
painted at the correct location.
This is needed for e.g. tiled rendering of the scrollbar of Writer
comment widgets.
Change-Id: Ideb75625b1f6349c5f18342e6f438fd5d7c31dcd
(cherry picked from commit f208103998cfeffef239c66043184654c00dffda)
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index a60595c..4125436 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -655,7 +655,7 @@ void ScrollBar::ImplDraw(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFla
nStyle = DrawButtonFlags::NoLightBorder;
if (mnStateFlags & SCRBAR_STATE_BTN1_DOWN)
nStyle |= DrawButtonFlags::Pressed;
- aTempRect = aDecoView.DrawButton( maBtn1Rect, nStyle );
+ aTempRect = aDecoView.DrawButton( PixelToLogic(maBtn1Rect), nStyle );
ImplCalcSymbolRect( aTempRect );
DrawSymbolFlags nSymbolStyle = DrawSymbolFlags::NONE;
if ((mnStateFlags & SCRBAR_STATE_BTN1_DISABLE) || !bEnabled)
@@ -682,7 +682,7 @@ void ScrollBar::ImplDraw(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFla
nStyle = DrawButtonFlags::NoLightBorder;
if (mnStateFlags & SCRBAR_STATE_BTN2_DOWN)
nStyle |= DrawButtonFlags::Pressed;
- aTempRect = aDecoView.DrawButton(maBtn2Rect, nStyle);
+ aTempRect = aDecoView.DrawButton(PixelToLogic(maBtn2Rect), nStyle);
ImplCalcSymbolRect(aTempRect);
DrawSymbolFlags nSymbolStyle = DrawSymbolFlags::NONE;
if ((mnStateFlags & SCRBAR_STATE_BTN2_DISABLE) || !bEnabled)
@@ -713,12 +713,12 @@ void ScrollBar::ImplDraw(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFla
if (bEnabled)
{
nStyle = DrawButtonFlags::NoLightBorder;
- aTempRect = aDecoView.DrawButton(maThumbRect, nStyle);
+ aTempRect = aDecoView.DrawButton(PixelToLogic(maThumbRect), nStyle);
}
else
{
rRenderContext.SetFillColor(rStyleSettings.GetCheckedColor());
- rRenderContext.DrawRect(maThumbRect);
+ rRenderContext.DrawRect(PixelToLogic(maThumbRect));
}
}
}
@@ -729,7 +729,7 @@ void ScrollBar::ImplDraw(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFla
rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
else
rRenderContext.SetFillColor(rStyleSettings.GetCheckedColor());
- rRenderContext.DrawRect(maPage1Rect);
+ rRenderContext.DrawRect(PixelToLogic(maPage1Rect));
}
if ((nDrawFlags & SCRBAR_DRAW_PAGE2) && (!ImplDrawNative(rRenderContext, SCRBAR_DRAW_PAGE2)))
{
@@ -737,7 +737,7 @@ void ScrollBar::ImplDraw(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFla
rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
else
rRenderContext.SetFillColor(rStyleSettings.GetCheckedColor());
- rRenderContext.DrawRect(maPage2Rect);
+ rRenderContext.DrawRect(PixelToLogic(maPage2Rect));
}
}
commit 70449a45d7a7fc57d1cf7568f7c3a4ecc6f64746
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Nov 20 08:35:33 2015 +0100
SwPageFrm::IsOverHeaderFooterArea: check for IsActive() only later
Checking for a bool is certainly cheaper than a chain of member function
calls.
Change-Id: I9520194e58e75264f3fcbb413a618e3995f59a4e
(cherry picked from commit 5eb7759d445d5ea26f603de03cab3d6bc5b262ee)
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 250a9f6..aa6c799 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -2255,10 +2255,10 @@ bool SwPageFrm::IsOverHeaderFooterArea( const Point& rPt, FrameControlType &rCon
Size( Frm().Width(), nUpperLimit - Frm().Top() ) );
SwViewShell* pViewShell = getRootFrm()->GetCurrShell();
- bool bHideWhitespaceMode = pViewShell->GetViewOptions()->IsHideWhitespaceMode();
+ const bool bHideWhitespaceMode = pViewShell->GetViewOptions()->IsHideWhitespaceMode();
if ( aHeaderArea.IsInside( rPt ) )
{
- if (static_cast<const SwFrameFormat*>(GetRegisteredIn())->GetHeader().IsActive() || !bHideWhitespaceMode)
+ if (!bHideWhitespaceMode || static_cast<const SwFrameFormat*>(GetRegisteredIn())->GetHeader().IsActive())
{
rControl = Header;
return true;
@@ -2270,7 +2270,7 @@ bool SwPageFrm::IsOverHeaderFooterArea( const Point& rPt, FrameControlType &rCon
Size( Frm().Width(), Frm().Bottom() - nLowerLimit ) );
if ( aFooterArea.IsInside( rPt ) &&
- (static_cast<const SwFrameFormat*>(GetRegisteredIn())->GetFooter().IsActive() || !bHideWhitespaceMode) )
+ (!bHideWhitespaceMode || static_cast<const SwFrameFormat*>(GetRegisteredIn())->GetFooter().IsActive()) )
{
rControl = Footer;
return true;
commit 100ac369d88cbc94101269a9f50db3eea6bea628
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Nov 19 16:11:43 2015 +0100
sw lok comments: optimize sidebar text control invalidation
Instead of invalidating the whole area, invalidate the sub-widget when
the whole area of the sub-widget would be invalidated.
With this, a test comment with enough comment to have a scrollbar
results in 3 paintTile() calls instead of 11 ones (70% save).
(cherry picked from commit 9ece5c870a0ce39690109777bb8f76c1463a10c2)
Conflicts:
sw/source/uibase/docvw/SidebarTxtControl.cxx
Change-Id: I2fe317549eefac9a63aaf50f5a9a242e15c4dc86
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 09eca98..8da86c3 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -191,24 +191,28 @@ void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const Rectang
void SidebarTextControl::LogicInvalidate(const Rectangle* pRectangle)
{
- OString sRectangle;
+ Rectangle aRectangle;
+
if (!pRectangle)
- sRectangle = "EMPTY";
- else
{
- // Convert from relative twips to absolute ones.
- Rectangle aRectangle(*pRectangle);
- vcl::Window& rParent = *mrSidebarWin.EditWin();
- Point aOffset(GetOutOffXPixel() - rParent.GetOutOffXPixel(), GetOutOffYPixel() - rParent.GetOutOffYPixel());
- rParent.Push(PushFlags::MAPMODE);
- rParent.EnableMapMode();
- aOffset = rParent.PixelToLogic(aOffset);
- rParent.Pop();
- aRectangle.Move(aOffset.getX(), aOffset.getY());
-
- sRectangle = aRectangle.toString();
+ Push(PushFlags::MAPMODE);
+ EnableMapMode();
+ aRectangle = Rectangle(Point(0, 0), PixelToLogic(GetSizePixel()));
+ Pop();
}
-
+ else
+ aRectangle = *pRectangle;
+
+ // Convert from relative twips to absolute ones.
+ vcl::Window& rParent = *mrSidebarWin.EditWin();
+ Point aOffset(GetOutOffXPixel() - rParent.GetOutOffXPixel(), GetOutOffYPixel() - rParent.GetOutOffYPixel());
+ rParent.Push(PushFlags::MAPMODE);
+ rParent.EnableMapMode();
+ aOffset = rParent.PixelToLogic(aOffset);
+ rParent.Pop();
+ aRectangle.Move(aOffset.getX(), aOffset.getY());
+
+ OString sRectangle = aRectangle.toString();
SwWrtShell& rWrtShell = mrDocView.GetWrtShell();
rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
}
commit 952e9eedfcd01f6a25008459628f14cded4a8f8e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Nov 19 15:09:05 2015 +0100
editeng lok: invalidate on scroll
E.g. when a Witer comment has long enough contents to get scrolled, the
desktop case repaints its contents by vcl::Window::Scroll(), followed by
a vcl::Window::Update(), i.e. vcl::Window::Invalidate() is not called.
The result of this in case of tiled rendering is that no tile is
repainted, so call vcl::Window::Invalidate() after scrolling manually.
A generic VCL-level invalidate-after-scroll is not wanted, as the
scrolling of the document contents and the main document window is not
in sync when tiled rendering.
(cherry picked from commit 162ae47a046b0c501e09d611a9834e875db884b8)
Conflicts:
editeng/source/editeng/impedit.cxx
Change-Id: I74296a0f0e52c92cf3db6aefa73f28bb2b202871
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 8f60669..7ee1a2b 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -47,6 +47,7 @@
#include <sot/formats.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <comphelper/string.hxx>
+#include <comphelper/lok.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -1085,6 +1086,11 @@ Pair ImpEditView::Scroll( long ndX, long ndY, sal_uInt8 nRangeCheck )
aVisDocStartPos = pOutWin->PixelToLogic( aVisDocStartPos );
Rectangle aRect( aOutArea );
pOutWin->Scroll( nRealDiffX, nRealDiffY, aRect, SCROLL_CLIP );
+
+ if (comphelper::LibreOfficeKit::isActive())
+ // Need to invalidate the window, otherwise no tile will be re-painted.
+ pOutWin->Invalidate();
+
pOutWin->Update();
pCrsr->SetPos( pCrsr->GetPos() + Point( nRealDiffX, nRealDiffY ) );
if ( bVisCursor )
commit 9615d10f50331a3d5240bc2bfd25772c7758ab46
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Nov 19 14:57:38 2015 +0100
sw lok comments: don't paint hidden comment sub-widgets
Change-Id: Ia513821b43729951c7b097fea498f0e22b9d10ea
(cherry picked from commit 8a1b9ac592c026de6c764277a6ad1f8db9a4a679)
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index 1281bf8..af531fc 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -275,15 +275,13 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle
{
vcl::Window* pChild = GetChild(i);
- // This would at the moment just draw a gray rectangle at the top right
- // corner, need to sort out later.
- if (pChild == mpVScrollbar.get())
- continue;
-
// No point in showing this button till click on it are not handled.
if (pChild == mpMenuButton.get())
continue;
+ if (!pChild->IsVisible())
+ continue;
+
rRenderContext.Push(PushFlags::MAPMODE);
const Fraction& rFraction(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
Point aOffset(PixelToLogic(pChild->GetPosPixel() * rFraction.GetDenominator() / rFraction.GetNumerator()));
More information about the Libreoffice-commits
mailing list