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 
27 class SwCommentRuler final : public SvxRuler
28 {
29 public:
31  SwViewShell* pViewSh,
32  vcl::Window* pParent,
33  SwEditWin* pWin,
34  SvxRulerSupportFlags nRulerFlags,
35  SfxBindings& rBindings,
36  WinBits nWinStyle);
37  virtual ~SwCommentRuler () override;
38  virtual void dispose() override;
39 
44  virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
45  const std::string CreateJsonNotification();
46 
47 private:
48  SwViewShell * mpViewShell; //< Shell to check if there is any comments on doc and their visibility
49  VclPtr<SwEditWin> mpSwWin; //< Used to get SwView to change the SideBar visibility
50  bool mbIsHighlighted; //< If comment control is highlighted (mouse is over it)
51  Timer maFadeTimer; //< Timer for high/'low'light fading
52  int mnFadeRate; //< From 0 to 100. 0 means not highlighted.
53  ScopedVclPtr<VirtualDevice> maVirDev; //< VirtualDevice of this window. Just for convenience.
54 
55  void NotifyKit();
61  virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
67  virtual void MouseMove(const MouseEvent& rMEvt) override;
73  virtual void Command( const CommandEvent& rCEvt ) override;
80  virtual void Update() override;
81 
89 
93  void DrawCommentControl(vcl::RenderContext& rRenderContext);
94 
98  void UpdateCommentHelpText();
99 
110  Color GetFadedColor(const Color &rHighColor, const Color &rLowColor);
111 
113  DECL_LINK(FadeHandler, Timer *, void);
114 };
115 
116 #endif
117 
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvxRulerSupportFlags
void UpdateCommentHelpText()
Update the tooltip text.
Definition: swruler.cxx:293
Timer maFadeTimer
Definition: swruler.hxx:51
virtual ~SwCommentRuler() override
Definition: swruler.cxx:89
SwViewShell * mpViewShell
Definition: swruler.hxx:48
ScopedVclPtr< VirtualDevice > maVirDev
Definition: swruler.hxx:53
sal_Int64 WinBits
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Callback function to handle a mouse button down event.
Definition: swruler.cxx:236
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:275
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Paint the ruler.
Definition: swruler.cxx:100
virtual void dispose() override
Definition: swruler.cxx:94
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:330
const std::string CreateJsonNotification()
Definition: swruler.cxx:256
virtual void MouseMove(const MouseEvent &rMEvt) override
Callback function to handle a mouse move event.
Definition: swruler.cxx:208
virtual void Update() override
Update the view.
Definition: swruler.cxx:284
virtual void Command(const CommandEvent &rCEvt) override
Callback function to handle a context menu call (mouse right button click).
Definition: swruler.cxx:198
SwCommentRuler(SwViewShell *pViewSh, vcl::Window *pParent, SwEditWin *pWin, SvxRulerSupportFlags nRulerFlags, SfxBindings &rBindings, WinBits nWinStyle)
Definition: swruler.cxx:74
An horizontal ruler with a control for comment panel visibility for Writer.
Definition: swruler.hxx:27
tools::Rectangle GetCommentControlRegion()
Get the rectangle area that should be used to draw the comment control.
Definition: swruler.cxx:304
void DrawCommentControl(vcl::RenderContext &rRenderContext)
Paint the comment control on VirtualDevice.
Definition: swruler.cxx:112
VclPtr< SwEditWin > mpSwWin
Definition: swruler.hxx:49
bool mbIsHighlighted
Definition: swruler.hxx:50