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 
17 class SwViewShell;
18 class View;
19 namespace vcl { class Window; }
20 class SwEditWin;
21 namespace tools { class JsonWriter; }
22 
28 class SwCommentRuler final : public SvxRuler
29 {
30 public:
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;
46  void CreateJsonNotification(tools::JsonWriter& rJsonWriter);
47 
48 private:
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 
99  void UpdateCommentHelpText();
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: */
SvxRulerSupportFlags
void UpdateCommentHelpText()
Update the tooltip text.
Definition: swruler.cxx:301
Timer maFadeTimer
Definition: swruler.hxx:52
virtual ~SwCommentRuler() override
Definition: swruler.cxx:102
SwViewShell * mpViewShell
Definition: swruler.hxx:49
ScopedVclPtr< VirtualDevice > maVirDev
Definition: swruler.hxx:54
sal_Int64 WinBits
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Callback function to handle a mouse button down event.
Definition: swruler.cxx:217
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:58
void NotifyKit()
Definition: swruler.cxx:281
void CreateJsonNotification(tools::JsonWriter &rJsonWriter)
Definition: swruler.cxx:237
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Paint the ruler.
Definition: swruler.cxx:110
virtual void dispose() override
Definition: swruler.cxx:104
DECL_LINK(FadeHandler, Timer *, void)
Fade timer callback.
Color GetFadedColor(const Color &rHighColor, const Color &rLowColor)
Get the proper color between two options, according to current status.
Definition: swruler.cxx:341
virtual void MouseMove(const MouseEvent &rMEvt) override
Callback function to handle a mouse move event.
Definition: swruler.cxx:201
virtual void Update() override
Update the view.
Definition: swruler.cxx:292
virtual void Command(const CommandEvent &rCEvt) override
Callback function to handle a context menu call (mouse right button click).
Definition: swruler.cxx:192
SwCommentRuler(SwViewShell *pViewSh, vcl::Window *pParent, SwEditWin *pWin, SvxRulerSupportFlags nRulerFlags, SfxBindings &rBindings, WinBits nWinStyle)
Definition: swruler.cxx:81
An horizontal ruler with a control for comment panel visibility for Writer.
Definition: swruler.hxx:28
tools::Rectangle GetCommentControlRegion()
Get the rectangle area that should be used to draw the comment control.
Definition: swruler.cxx:312
void DrawCommentControl(vcl::RenderContext &rRenderContext)
Paint the comment control on VirtualDevice.
Definition: swruler.cxx:122
VclPtr< SwEditWin > mpSwWin
Definition: swruler.hxx:50
bool mbIsHighlighted
Definition: swruler.hxx:51