Kaydet (Commit) 4cbbaf57 authored tarafından Miklos Vajna's avatar Miklos Vajna

sw lok comments: emit invalidation events in SidebarTextControl

With this, newly typed characters show up instantly in comments, not
only after changing the zoom level.

Change-Id: I1470db1ec03cc415917375f1f95434cf0944e559
üst ca80f73c
......@@ -25,6 +25,7 @@
#include <SidebarWin.hxx>
#include <PostItMgr.hxx>
#include <edtwin.hxx>
#include <cmdid.h>
#include <docvw.hrc>
......@@ -48,6 +49,7 @@
#include <editeng/editeng.hxx>
#include <editeng/editview.hxx>
#include <editeng/flditem.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <uitool.hxx>
#include <view.hxx>
......@@ -187,6 +189,30 @@ void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const Rectang
}
}
void SidebarTextControl::LogicInvalidate(const Rectangle* pRectangle)
{
OString sRectangle;
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();
}
SwWrtShell& rWrtShell = mrDocView.GetWrtShell();
rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
}
void SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt )
{
if (getenv("SW_DEBUG") && rKeyEvt.GetKeyCode().GetCode() == KEY_F12)
......
......@@ -40,6 +40,8 @@ class SidebarTextControl : public Control
protected:
virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect) override;
/// @see OutputDevice::LogicInvalidate().
void LogicInvalidate(const Rectangle* pRectangle) override;
virtual void MouseMove( const MouseEvent& rMEvt ) override;
virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
virtual void Command( const CommandEvent& rCEvt ) override;
......
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