LibreOffice Module sw (master)  1
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
8  */
13 #include <svx/ruler.hxx>
14 #include <vcl/timer.hxx>
15 #include <vcl/virdev.hxx>
17 class SwViewShell;
18 class View;
19 namespace vcl { class Window; }
20 class SwEditWin;
21 namespace tools { class JsonWriter; }
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;
45  virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
46  void CreateJsonNotification(tools::JsonWriter& rJsonWriter);
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.
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;
94  void DrawCommentControl(vcl::RenderContext& rRenderContext);
99  void UpdateCommentHelpText();
111  Color GetFadedColor(const Color &rHighColor, const Color &rLowColor);
114  DECL_LINK(FadeHandler, Timer *, void);
115 };
117 #endif
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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