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...
 
std::string CreateJsonNotification ()
 
- Public Member Functions inherited from SvxRuler
 SvxRuler (vcl::Window *pParent, vcl::Window *pEditWin, SvxRulerSupportFlags nRulerFlags, SfxBindings &rBindings, WinBits nWinStyle)
 
virtual ~SvxRuler () override
 
void SetDefTabDist (long)
 
void SetNullOffsetLogic (long lOff)
 
void SetActive (bool bOn=true)
 
void ForceUpdate ()
 
void SetTabsRelativeToIndent (bool bRel)
 
void SetValues (RulerChangeType type, long value)
 
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 Click () override
 
virtual bool StartDrag () override
 
virtual void Drag () override
 
virtual void EndDrag () override
 
virtual void ExtraDown () override
 
virtual void Notify (SfxBroadcaster &rBC, const SfxHint &rHint) override
 
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
 
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 27 of file swruler.hxx.

Constructor & Destructor Documentation

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

Definition at line 89 of file swruler.cxx.

Member Function Documentation

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 198 of file swruler.cxx.

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

std::string SwCommentRuler::CreateJsonNotification ( )

Definition at line 256 of file swruler.cxx.

References RulerUnitData::aUnitStr, convertTwipToMm100(), and SvxRuler::GetPageWidth().

Referenced by NotifyKit().

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

Fade timer callback.

void SwCommentRuler::dispose ( void  )
overridevirtual

Reimplemented from SvxRuler.

Definition at line 94 of file swruler.cxx.

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

void SwCommentRuler::DrawCommentControl ( vcl::RenderContext rRenderContext)
private
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 303 of file swruler.cxx.

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

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

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 329 of file swruler.cxx.

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

Referenced by DrawCommentControl().

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 236 of file swruler.cxx.

References SwView::ExecViewOptions(), GetCommentControlRegion(), MouseEvent::GetPosPixel(), SwEditWin::GetView(), SfxViewShell::GetViewFrame(), tools::Rectangle::IsInside(), MouseEvent::IsLeft(), mpSwWin, and UpdateCommentHelpText().

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 208 of file swruler.cxx.

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

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

Paint the ruler.

Parameters
rRectignored

Definition at line 100 of file swruler.cxx.

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

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 283 of file swruler.cxx.

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

void SwCommentRuler::UpdateCommentHelpText ( )
private

Update the tooltip text.

Definition at line 292 of file swruler.cxx.

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

Referenced by MouseButtonDown(), and MouseMove().

Member Data Documentation

Timer SwCommentRuler::maFadeTimer
private

Definition at line 51 of file swruler.hxx.

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

ScopedVclPtr<VirtualDevice> SwCommentRuler::maVirDev
private

Definition at line 53 of file swruler.hxx.

Referenced by DrawCommentControl().

bool SwCommentRuler::mbIsHighlighted
private

Definition at line 50 of file swruler.hxx.

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

int SwCommentRuler::mnFadeRate
private

Definition at line 52 of file swruler.hxx.

Referenced by GetFadedColor().

VclPtr<SwEditWin> SwCommentRuler::mpSwWin
private

Definition at line 49 of file swruler.hxx.

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

SwViewShell* SwCommentRuler::mpViewShell
private

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