[Libreoffice-commits] core.git: 2 commits - desktop/source sw/Library_sw.mk sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Nov 24 03:25:27 PST 2015
desktop/source/lib/init.cxx | 26 +++++-----
sw/Library_sw.mk | 1
sw/source/uibase/docvw/SidebarScrollBar.cxx | 72 ++++++++++++++++++++++++++++
sw/source/uibase/docvw/SidebarScrollBar.hxx | 43 ++++++++++++++++
sw/source/uibase/docvw/SidebarWin.cxx | 3 -
5 files changed, 131 insertions(+), 14 deletions(-)
New commits:
commit 55040ea13426e337418143dcfe226dd2a395f041
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.
Change-Id: Ie4ba5d0ec07229b0cfc08532e8e91ae25f7a4c9e
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index c5004cc..b4af6e5 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..909aa76
--- /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 01cb771..a9a97c2 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 fa377a06627bba0c995aae55b346bb9530ecdf7e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Nov 24 11:54:24 2015 +0100
desktop: fix LOK_DEBUG rectangle painting
Change-Id: If023e409fad6fed8c0345a66ea48c1ed9924bff0
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0a1844a..8682ce8 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -921,6 +921,19 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight,
nTilePosX, nTilePosY, nTileWidth, nTileHeight);
+ static bool bDebug = getenv("LOK_DEBUG") != nullptr;
+ if (bDebug)
+ {
+ // Draw a small red rectangle in the top left corner so that it's easy to see where a new tile begins.
+ Rectangle aRect(0, 0, 5, 5);
+ aRect = pDevice->PixelToLogic(aRect);
+ pDevice->Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
+ pDevice->SetFillColor(COL_LIGHTRED);
+ pDevice->SetLineColor();
+ pDevice->DrawRect(aRect);
+ pDevice->Pop();
+ }
+
// Overwrite pBuffer's alpha channel with the separate alpha buffer.
for (int nRow = 0; nRow < nCanvasHeight; ++nRow)
{
@@ -937,19 +950,6 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
#endif
- static bool bDebug = getenv("LOK_DEBUG") != nullptr;
- if (bDebug)
- {
- // Draw a small red rectangle in the top left corner so that it's easy to see where a new tile begins.
- Rectangle aRect(0, 0, 5, 5);
- aRect = pDevice->PixelToLogic(aRect);
- pDevice->Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
- pDevice->SetFillColor(COL_LIGHTRED);
- pDevice->SetLineColor();
- pDevice->DrawRect(aRect);
- pDevice->Pop();
- }
-
#else
(void) pBuffer;
(void) nCanvasWidth;
More information about the Libreoffice-commits
mailing list