Kaydet (Commit) 55040ea1 authored tarafından Miklos Vajna's avatar Miklos Vajna

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
üst fa377a06
......@@ -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 \
......
/* -*- 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: */
/* -*- 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: */
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment