summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-11-24 11:58:09 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-11-24 12:22:49 +0100
commit55040ea13426e337418143dcfe226dd2a395f041 (patch)
tree04f74e81e2c503b68c1b3c1a1c272de46a8f43e3
parentfa377a06627bba0c995aae55b346bb9530ecdf7e (diff)
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. Change-Id: Ie4ba5d0ec07229b0cfc08532e8e91ae25f7a4c9e
-rw-r--r--sw/Library_sw.mk1
-rw-r--r--sw/source/uibase/docvw/SidebarScrollBar.cxx72
-rw-r--r--sw/source/uibase/docvw/SidebarScrollBar.hxx43
-rw-r--r--sw/source/uibase/docvw/SidebarWin.cxx3
4 files changed, 118 insertions, 1 deletions
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index c5004cc2bf9f..b4af6e57c547 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 000000000000..909aa763dba1
--- /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 000000000000..9543205387df
--- /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 01cb771db50c..a9a97c244b0f 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));