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

This class is responsible for the delayed display of grammar checks when a paragraph is edited It's a client of the paragraph the cursor points to. More...

#include <GrammarContact.hxx>

Inheritance diagram for sw::GrammarContact:
[legend]
Collaboration diagram for sw::GrammarContact:
[legend]

Public Member Functions

 GrammarContact ()
 
 ~GrammarContact ()
 
void updateCursorPosition (const SwPosition &rNewPos)
 Update cursor position reacts to a change of the current input cursor As long as the cursor in inside a paragraph, the grammar checking does not show new grammar faults. More...
 
SwGrammarMarkUpgetGrammarCheck (SwTextNode &rTextNode, bool bCreate)
 getGrammarCheck checks if the given text node is blocked by the current cursor if not, the normal markup list is returned if blocked, it will return a markup list "proxy" More...
 
void finishGrammarCheck (SwTextNode &rTextNode)
 finishGrammarCheck() has to be called if a grammar checking has been completed for a text node. More...
 
void CheckBroadcaster ()
 
- Public Member Functions inherited from SvtListener
 SvtListener ()=default
 
 SvtListener (const SvtListener &r)=default
 
virtual ~SvtListener () COVERITY_NOEXCEPT_FALSE
 
bool StartListening (SvtBroadcaster &rBroadcaster)
 
void EndListening (SvtBroadcaster &rBroadcaster)
 
void EndListeningAll ()
 
void CopyAllBroadcasters (const SvtListener &r)
 
bool HasBroadcaster () const
 
virtual void Notify (const SfxHint &rHint)
 
virtual void Query (QueryBase &rQuery) const
 

Private Member Functions

 DECL_LINK (TimerRepaint, Timer *, void)
 

Private Attributes

Timer m_aTimer
 
std::unique_ptr< SwGrammarMarkUpm_pProxyList
 
bool m_isFinished
 
SwTextNodem_pTextNode
 

Detailed Description

This class is responsible for the delayed display of grammar checks when a paragraph is edited It's a client of the paragraph the cursor points to.

If the cursor position changes, updateCursorPosition has to be called If the grammar checker wants to set a grammar marker at a paragraph, he has to request the grammar list from this class. If the requested paragraph is not edited, it returns the normal grammar list. But if the paragraph is the active one, a proxy list will be returned and all changes are set in this proxy list. If the cursor leaves the paragraph the proxy list will replace the old list. If the grammar checker has completed the paragraph ('setChecked') then a timer is setup which replaces the old list as well.

Definition at line 42 of file GrammarContact.hxx.

Constructor & Destructor Documentation

◆ GrammarContact()

sw::GrammarContact::GrammarContact ( )

Definition at line 29 of file GrammarContact.cxx.

References LINK, m_aTimer, Timer::SetInvokeHandler(), and Timer::SetTimeout().

◆ ~GrammarContact()

sw::GrammarContact::~GrammarContact ( )
inline

Definition at line 52 of file GrammarContact.hxx.

References m_aTimer, and Task::Stop().

Member Function Documentation

◆ CheckBroadcaster()

void sw::GrammarContact::CheckBroadcaster ( )

◆ DECL_LINK()

sw::GrammarContact::DECL_LINK ( TimerRepaint  ,
Timer ,
void   
)
private

◆ finishGrammarCheck()

void sw::GrammarContact::finishGrammarCheck ( SwTextNode rTextNode)

finishGrammarCheck() has to be called if a grammar checking has been completed for a text node.

If this text node has not been hidden by the current proxy list it will be repainted. Otherwise the proxy list replaces the old list and the repaint will be triggered by a timer

Returns
void

Definition at line 127 of file GrammarContact.cxx.

References CheckBroadcaster(), SwTextNode::ClearGrammarCheck(), SwTextNode::GetGrammarCheck(), m_aTimer, m_isFinished, m_pProxyList, m_pTextNode, SwTextFrame::repaintTextFrames(), and Timer::Start().

Referenced by sw::finishGrammarCheckFor().

◆ getGrammarCheck()

SwGrammarMarkUp * sw::GrammarContact::getGrammarCheck ( SwTextNode rTextNode,
bool  bCreate 
)

getGrammarCheck checks if the given text node is blocked by the current cursor if not, the normal markup list is returned if blocked, it will return a markup list "proxy"

Returns
a markup list (grammar) for the given SwTextNode

Definition at line 87 of file GrammarContact.cxx.

References CheckBroadcaster(), SwGrammarMarkUp::Clone(), COMPLETE_STRING, SwTextNode::GetGrammarCheck(), m_isFinished, m_pProxyList, m_pTextNode, SwTextNode::SetGrammarCheck(), SwTextNode::SetGrammarCheckDirty(), and SwWrongList::SetInvalid().

Referenced by SwXTextMarkup::commitMultiTextMarkup(), SwXTextMarkup::commitStringMarkup(), and lcl_SetWrong().

◆ updateCursorPosition()

void sw::GrammarContact::updateCursorPosition ( const SwPosition rNewPos)

Update cursor position reacts to a change of the current input cursor As long as the cursor in inside a paragraph, the grammar checking does not show new grammar faults.

When the cursor leaves the paragraph, these faults are shown.

Returns
void

Definition at line 61 of file GrammarContact.cxx.

References CheckBroadcaster(), SvtListener::EndListeningAll(), SwPosition::GetNode(), SwNode::GetTextNode(), m_aTimer, m_pProxyList, m_pTextNode, SwTextFrame::repaintTextFrames(), SwTextNode::SetGrammarCheck(), SvtListener::StartListening(), and Task::Stop().

Member Data Documentation

◆ m_aTimer

Timer sw::GrammarContact::m_aTimer
private

◆ m_isFinished

bool sw::GrammarContact::m_isFinished
private

Definition at line 46 of file GrammarContact.hxx.

Referenced by finishGrammarCheck(), and getGrammarCheck().

◆ m_pProxyList

std::unique_ptr<SwGrammarMarkUp> sw::GrammarContact::m_pProxyList
private

◆ m_pTextNode

SwTextNode* sw::GrammarContact::m_pTextNode
private

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