blob: 40ddf08c9784f947f036742651e668842fa72ed0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
/* -*- 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>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <comphelper/lok.hxx>
#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.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
}
void SidebarScrollBar::MouseButtonUp(const MouseEvent& /*rMouseEvent*/)
{
EndTracking();
}
void SidebarScrollBar::MouseMove(const MouseEvent& rMouseEvent)
{
TrackingEvent aEvent(rMouseEvent);
Tracking(aEvent);
}
SidebarScrollBar::~SidebarScrollBar()
{
disposeOnce();
}
}
} // end of namespace sw::sidebarwindows
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|