LibreOffice Module sw (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SwCommentRuler Class Referencefinal

An horizontal ruler with a control for comment panel visibility for Writer. More...

#include <swruler.hxx>

Inheritance diagram for SwCommentRuler:
[legend]
Collaboration diagram for SwCommentRuler:
[legend]

Public Member Functions

 SwCommentRuler (SwViewShell *pViewSh, vcl::Window *pParent, SwEditWin *pWin, SvxRulerSupportFlags nRulerFlags, SfxBindings &rBindings, WinBits nWinStyle)
 
virtual ~SwCommentRuler () override
 
virtual void dispose () override
 
virtual void Paint (vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
 Paint the ruler. More...
 
void CreateJsonNotification (tools::JsonWriter &rJsonWriter)
 
- Public Member Functions inherited from SvxRuler
 SvxRuler (vcl::Window *pParent, vcl::Window *pEditWin, SvxRulerSupportFlags nRulerFlags, SfxBindings &rBindings, WinBits nWinStyle)
 
virtual ~SvxRuler () override
 
virtual void dispose () override
 
void SetDefTabDist (tools::Long)
 
void SetNullOffsetLogic (tools::Long lOff)
 
void SetActive (bool bOn=true)
 
void ForceUpdate ()
 
void SetTabsRelativeToIndent (bool bRel)
 
void SetValues (RulerChangeType type, tools::Long value)
 
tools::Long GetPageWidth () const
 

Private Member Functions

void NotifyKit ()
 
virtual void MouseButtonDown (const MouseEvent &rMEvt) override
 Callback function to handle a mouse button down event. More...
 
virtual void MouseMove (const MouseEvent &rMEvt) override
 Callback function to handle a mouse move event. More...
 
virtual void Command (const CommandEvent &rCEvt) override
 Callback function to handle a context menu call (mouse right button click). More...
 
virtual void Update () override
 Update the view. More...
 
tools::Rectangle GetCommentControlRegion ()
 Get the rectangle area that should be used to draw the comment control. More...
 
void DrawCommentControl (vcl::RenderContext &rRenderContext)
 Paint the comment control on VirtualDevice. More...
 
void UpdateCommentHelpText ()
 Update the tooltip text. More...
 
Color GetFadedColor (const Color &rHighColor, const Color &rLowColor)
 Get the proper color between two options, according to current status. More...
 
 DECL_LINK (FadeHandler, Timer *, void)
 Fade timer callback. More...
 

Private Attributes

SwViewShellmpViewShell
 
VclPtr< SwEditWinmpSwWin
 
bool mbIsHighlighted
 
Timer maFadeTimer
 
int mnFadeRate
 
ScopedVclPtr< VirtualDevicemaVirDev
 

Additional Inherited Members

- Protected Member Functions inherited from SvxRuler
virtual void Command (const CommandEvent &rCEvt) override
 
virtual void Click () override
 
virtual bool StartDrag () override
 
virtual void Drag () override
 
virtual void EndDrag () override
 
virtual void ExtraDown () override
 
virtual void MouseMove (const MouseEvent &rMEvt) override
 
virtual void Notify (SfxBroadcaster &rBC, const SfxHint &rHint) override
 
virtual void Update ()
 
bool IsActLastColumn (bool bForceDontConsiderHidden=false, sal_uInt16 nAct=USHRT_MAX) const
 
bool IsActFirstColumn (bool bForceDontConsiderHidden=false, sal_uInt16 nAct=USHRT_MAX) const
 
sal_uInt16 GetActLeftColumn (bool bForceDontConsiderHidden=false, sal_uInt16 nAct=USHRT_MAX) const
 
sal_uInt16 GetActRightColumn (bool bForceDontConsiderHidden=false, sal_uInt16 nAct=USHRT_MAX) const
 
tools::Long CalcPropMaxRight (sal_uInt16 nCol=USHRT_MAX) const
 

Detailed Description

An horizontal ruler with a control for comment panel visibility for Writer.

The comment control only appears when the document has comments already.

Definition at line 28 of file swruler.hxx.

Constructor & Destructor Documentation

◆ SwCommentRuler()

SwCommentRuler::SwCommentRuler ( SwViewShell pViewSh,
vcl::Window pParent,
SwEditWin pWin,
SvxRulerSupportFlags  nRulerFlags,
SfxBindings rBindings,
WinBits  nWinStyle 
)

◆ ~SwCommentRuler()

SwCommentRuler::~SwCommentRuler ( )
overridevirtual

Definition at line 101 of file swruler.cxx.

Member Function Documentation

◆ Command()

void SwCommentRuler::Command ( const CommandEvent rCEvt)
overrideprivatevirtual

Callback function to handle a context menu call (mouse right button click).

When on comment control, it does not do anything.

Reimplemented from SvxRuler.

Definition at line 191 of file swruler.cxx.

References SvxRuler::Command(), GetCommentControlRegion(), CommandEvent::GetMousePosPixel(), SwViewShell::GetPostItMgr(), SwPostItMgr::HasNotes(), and mpViewShell.

◆ CreateJsonNotification()

void SwCommentRuler::CreateJsonNotification ( tools::JsonWriter rJsonWriter)

◆ DECL_LINK()

SwCommentRuler::DECL_LINK ( FadeHandler  ,
Timer ,
void   
)
private

Fade timer callback.

◆ dispose()

void SwCommentRuler::dispose ( void  )
overridevirtual

Reimplemented from SvxRuler.

Definition at line 103 of file swruler.cxx.

References VclPtr< class reference_type >::clear(), SvxRuler::dispose(), and mpSwWin.

◆ DrawCommentControl()

void SwCommentRuler::DrawCommentControl ( vcl::RenderContext rRenderContext)
private

◆ GetCommentControlRegion()

tools::Rectangle SwCommentRuler::GetCommentControlRegion ( )
private

Get the rectangle area that should be used to draw the comment control.

It is horizontally aligned to the SideBar panel.

Returns
The area where the comment control is.

Definition at line 312 of file swruler.cxx.

References SvxRuler::GetPageWidth(), SwViewShell::GetPostItMgr(), SwPostItMgr::GetSidebarBorderWidth(), SwPostItMgr::GetSidebarWidth(), mpSwWin, and mpViewShell.

Referenced by Command(), DrawCommentControl(), MouseButtonDown(), MouseMove(), and Update().

◆ GetFadedColor()

Color SwCommentRuler::GetFadedColor ( const Color rHighColor,
const Color rLowColor 
)
private

Get the proper color between two options, according to current status.

The return color can be one of the given colors, or a merged one. It depends on highlight fading status.

Parameters
rHighColorcolor used to highlight status
rLowColorcolor used to normal status
Returns
The proper color to used in moment

Definition at line 341 of file swruler.cxx.

References Task::IsActive(), maFadeTimer, mbIsHighlighted, Color::Merge(), and mnFadeRate.

Referenced by DrawCommentControl().

◆ MouseButtonDown()

void SwCommentRuler::MouseButtonDown ( const MouseEvent rMEvt)
overrideprivatevirtual

Callback function to handle a mouse button down event.

When on comment control, it toggles the comment panel visibility.

Definition at line 216 of file swruler.cxx.

References SwView::ExecViewOptions(), GetCommentControlRegion(), MouseEvent::GetPosPixel(), SfxViewShell::GetViewFrame(), MouseEvent::IsLeft(), mpSwWin, and UpdateCommentHelpText().

◆ MouseMove()

void SwCommentRuler::MouseMove ( const MouseEvent rMEvt)
overrideprivatevirtual

Callback function to handle a mouse move event.

When on comment control, it let the control responsive by highlighting.

Reimplemented from SvxRuler.

Definition at line 200 of file swruler.cxx.

References tools::Rectangle::Contains(), GetCommentControlRegion(), MouseEvent::GetPosPixel(), SwViewShell::GetPostItMgr(), SwPostItMgr::HasNotes(), maFadeTimer, mbIsHighlighted, SvxRuler::MouseMove(), mpViewShell, Timer::Start(), and UpdateCommentHelpText().

◆ NotifyKit()

void SwCommentRuler::NotifyKit ( )
private

◆ Paint()

void SwCommentRuler::Paint ( vcl::RenderContext rRenderContext,
const tools::Rectangle rRect 
)
overridevirtual

Paint the ruler.

Parameters
rRectignored

Definition at line 109 of file swruler.cxx.

References DrawCommentControl(), SwViewShell::GetPostItMgr(), SwPostItMgr::HasNotes(), comphelper::LibreOfficeKit::isActive(), and mpViewShell.

◆ Update()

void SwCommentRuler::Update ( )
overrideprivatevirtual

Update the view.

Update the ruler appearance according to the document view and current cursor position.

Reimplemented from SvxRuler.

Definition at line 292 of file swruler.cxx.

References GetCommentControlRegion(), NotifyKit(), and SvxRuler::Update().

◆ UpdateCommentHelpText()

void SwCommentRuler::UpdateCommentHelpText ( )
private

Update the tooltip text.

Definition at line 301 of file swruler.cxx.

References SwViewShell::GetPostItMgr(), mpViewShell, SwPostItMgr::ShowNotes(), and SwResId().

Referenced by MouseButtonDown(), and MouseMove().

Member Data Documentation

◆ maFadeTimer

Timer SwCommentRuler::maFadeTimer
private

Definition at line 52 of file swruler.hxx.

Referenced by GetFadedColor(), MouseMove(), and SwCommentRuler().

◆ maVirDev

ScopedVclPtr<VirtualDevice> SwCommentRuler::maVirDev
private

Definition at line 54 of file swruler.hxx.

Referenced by DrawCommentControl(), and SwCommentRuler().

◆ mbIsHighlighted

bool SwCommentRuler::mbIsHighlighted
private

Definition at line 51 of file swruler.hxx.

Referenced by DrawCommentControl(), GetFadedColor(), and MouseMove().

◆ mnFadeRate

int SwCommentRuler::mnFadeRate
private

Definition at line 53 of file swruler.hxx.

Referenced by GetFadedColor().

◆ mpSwWin

VclPtr<SwEditWin> SwCommentRuler::mpSwWin
private

Definition at line 50 of file swruler.hxx.

Referenced by dispose(), GetCommentControlRegion(), and MouseButtonDown().

◆ mpViewShell

SwViewShell* SwCommentRuler::mpViewShell
private

The documentation for this class was generated from the following files: