LibreOffice Module sw (master) 1
swruler.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SWRULER_HXX
11#define INCLUDED_SW_SOURCE_UIBASE_INC_SWRULER_HXX
12
13#include <svx/ruler.hxx>
14#include <vcl/timer.hxx>
15#include <vcl/virdev.hxx>
16
17class SwViewShell;
18class View;
19namespace vcl { class Window; }
20class SwEditWin;
21namespace tools { class JsonWriter; }
22
28class SwCommentRuler final : public SvxRuler
29{
30public:
32 SwViewShell* pViewSh,
33 vcl::Window* pParent,
34 SwEditWin* pWin,
35 SvxRulerSupportFlags nRulerFlags,
36 SfxBindings& rBindings,
37 WinBits nWinStyle);
38 virtual ~SwCommentRuler () override;
39 virtual void dispose() override;
40
45 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
47
48private:
49 SwViewShell * mpViewShell; //< Shell to check if there is any comments on doc and their visibility
50 VclPtr<SwEditWin> mpSwWin; //< Used to get SwView to change the SideBar visibility
51 bool mbIsHighlighted; //< If comment control is highlighted (mouse is over it)
52 Timer maFadeTimer; //< Timer for high/'low'light fading
53 int mnFadeRate; //< From 0 to 100. 0 means not highlighted.
54 ScopedVclPtr<VirtualDevice> maVirDev; //< VirtualDevice of this window. Just for convenience.
55
56 void NotifyKit();
62 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
68 virtual void MouseMove(const MouseEvent& rMEvt) override;
74 virtual void Command( const CommandEvent& rCEvt ) override;
81 virtual void Update() override;
82
90
94 void DrawCommentControl(vcl::RenderContext& rRenderContext);
95
100
111 Color GetFadedColor(const Color &rHighColor, const Color &rLowColor);
112
114 DECL_LINK(FadeHandler, Timer *, void);
115};
116
117#endif
118
119/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
An horizontal ruler with a control for comment panel visibility for Writer.
Definition: swruler.hxx:29
void UpdateCommentHelpText()
Update the tooltip text.
Definition: swruler.cxx:301
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Callback function to handle a mouse button down event.
Definition: swruler.cxx:216
virtual void Update() override
Update the view.
Definition: swruler.cxx:292
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Paint the ruler.
Definition: swruler.cxx:109
SwViewShell * mpViewShell
Definition: swruler.hxx:49
DECL_LINK(FadeHandler, Timer *, void)
Fade timer callback.
virtual void MouseMove(const MouseEvent &rMEvt) override
Callback function to handle a mouse move event.
Definition: swruler.cxx:200
virtual void Command(const CommandEvent &rCEvt) override
Callback function to handle a context menu call (mouse right button click).
Definition: swruler.cxx:191
bool mbIsHighlighted
Definition: swruler.hxx:51
VclPtr< SwEditWin > mpSwWin
Definition: swruler.hxx:50
void CreateJsonNotification(tools::JsonWriter &rJsonWriter)
Definition: swruler.cxx:236
void DrawCommentControl(vcl::RenderContext &rRenderContext)
Paint the comment control on VirtualDevice.
Definition: swruler.cxx:121
Timer maFadeTimer
Definition: swruler.hxx:52
ScopedVclPtr< VirtualDevice > maVirDev
Definition: swruler.hxx:54
void NotifyKit()
Definition: swruler.cxx:280
virtual ~SwCommentRuler() override
Definition: swruler.cxx:101
virtual void dispose() override
Definition: swruler.cxx:103
tools::Rectangle GetCommentControlRegion()
Get the rectangle area that should be used to draw the comment control.
Definition: swruler.cxx:312
Color GetFadedColor(const Color &rHighColor, const Color &rLowColor)
Get the proper color between two options, according to current status.
Definition: swruler.cxx:341
SwCommentRuler(SwViewShell *pViewSh, vcl::Window *pParent, SwEditWin *pWin, SvxRulerSupportFlags nRulerFlags, SfxBindings &rBindings, WinBits nWinStyle)
Definition: swruler.cxx:80
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:61
SvxRulerSupportFlags
sal_Int64 WinBits