LibreOffice Module sw (master) 1
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
SwWrongList Class Reference

#include <wrong.hxx>

Inheritance diagram for SwWrongList:
[legend]

Public Types

enum class  FreshState {
  FRESH ,
  CURSOR ,
  NOTHING
}
 

Public Member Functions

 SwWrongList (WrongListType eType)
 
virtual ~SwWrongList ()
 
virtual SwWrongListClone ()
 
virtual void CopyFrom (const SwWrongList &rCopy)
 
WrongListType GetWrongListType () const
 
sal_Int32 GetBeginInv () const
 
sal_Int32 GetEndInv () const
 
void SetInvalid (sal_Int32 nBegin, sal_Int32 nEnd)
 
void Validate ()
 
void Invalidate (sal_Int32 nBegin, sal_Int32 nEnd)
 
bool InvalidateWrong ()
 
FreshState Fresh (sal_Int32 &rStart, sal_Int32 &rEnd, sal_Int32 nPos, sal_Int32 nLen, sal_uInt16 nIndex, sal_Int32 nCursorPos)
 Remove given range of entries. More...
 
sal_uInt16 GetWrongPos (sal_Int32 nValue) const
 Find the first position that is greater or equal to the given value. More...
 
bool Check (sal_Int32 &rChk, sal_Int32 &rLn) const
 Calculate first incorrectly selected area. More...
 
bool InWrongWord (sal_Int32 &rChk, sal_Int32 &rLn) const
 If a word is incorrectly selected, this method returns begin and length of it. More...
 
sal_Int32 NextWrong (sal_Int32 nChk) const
 Find next incorrectly selected position. More...
 
void Move (sal_Int32 nPos, sal_Int32 nDiff)
 Change all values after the given position. More...
 
void ClearList ()
 
std::unique_ptr< SwWrongListSplitList (sal_Int32 nSplitPos)
 
void JoinList (SwWrongList *pNext, sal_Int32 nInsertPos)
 
sal_Int32 Len (sal_uInt16 nIdx) const
 
sal_Int32 Pos (sal_uInt16 nIdx) const
 
sal_uInt16 Count () const
 
void Insert (const OUString &rType, css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag, sal_Int32 nNewPos, sal_Int32 nNewLen, sal_uInt16 nWhere)
 
void Insert (const OUString &rType, css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag, sal_Int32 nNewPos, sal_Int32 nNewLen)
 
SwWrongListSubList (sal_uInt16 nIdx) const
 
void InsertSubList (sal_Int32 nNewPos, sal_Int32 nNewLen, sal_uInt16 nWhere, SwWrongList *pSubList)
 
const SwWrongAreaGetElement (sal_uInt16 nIdx) const
 
void RemoveEntry (sal_Int32 nBegin, sal_Int32 nEnd)
 
bool LookForEntry (sal_Int32 nBegin, sal_Int32 nEnd)
 

Private Member Functions

void Invalidate_ (sal_Int32 nBegin, sal_Int32 nEnd)
 
void Insert (sal_uInt16 nWhere, std::vector< SwWrongArea >::iterator startPos, std::vector< SwWrongArea >::iterator const &endPos)
 
void Remove (sal_uInt16 nIdx, sal_uInt16 nLen)
 
SwWrongListoperator= (const SwWrongList &)=delete
 
 SwWrongList (const SwWrongList &rCpy)=delete
 

Static Private Member Functions

static void ShiftLeft (sal_Int32 &rPos, sal_Int32 nStart, sal_Int32 nEnd)
 

Private Attributes

std::vector< SwWrongAreamaList
 
WrongListType meType
 
sal_Int32 mnBeginInvalid
 
sal_Int32 mnEndInvalid
 

Detailed Description

Definition at line 262 of file wrong.hxx.

Member Enumeration Documentation

◆ FreshState

enum class SwWrongList::FreshState
strong
Enumerator
FRESH 
CURSOR 
NOTHING 

Definition at line 294 of file wrong.hxx.

Constructor & Destructor Documentation

◆ SwWrongList() [1/2]

SwWrongList::SwWrongList ( const SwWrongList rCpy)
privatedelete

References Clone().

Referenced by Clone(), and SplitList().

◆ SwWrongList() [2/2]

SwWrongList::SwWrongList ( WrongListType  eType)

Definition at line 53 of file wrong.cxx.

References eType, and maList.

◆ ~SwWrongList()

SwWrongList::~SwWrongList ( )
virtual

Definition at line 61 of file wrong.cxx.

References ClearList().

Member Function Documentation

◆ Check()

bool SwWrongList::Check ( sal_Int32 &  rChk,
sal_Int32 &  rLn 
) const

Calculate first incorrectly selected area.

Parameters
[in,out]rChkstarting position of the word to check
[in,out]rLnlength of the word
Returns
<true> if incorrectly selected area was found, <false> otherwise

Definition at line 127 of file wrong.cxx.

References Count(), GetWrongPos(), Len(), nPos, and Pos().

Referenced by sw::WrongListIterator::Check().

◆ ClearList()

void SwWrongList::ClearList ( )

Definition at line 86 of file wrong.cxx.

References i, and maList.

Referenced by SwGrammarMarkUp::ClearGrammarList(), and ~SwWrongList().

◆ Clone()

SwWrongList * SwWrongList::Clone ( )
virtual

Reimplemented in SwGrammarMarkUp.

Definition at line 66 of file wrong.cxx.

References CopyFrom(), meType, and SwWrongList().

◆ CopyFrom()

void SwWrongList::CopyFrom ( const SwWrongList rCopy)
virtual

Reimplemented in SwGrammarMarkUp.

Definition at line 73 of file wrong.cxx.

References i, maList, meType, mnBeginInvalid, and mnEndInvalid.

Referenced by Clone(), SwGrammarMarkUp::Clone(), and SwGrammarMarkUp::CopyFrom().

◆ Count()

sal_uInt16 SwWrongList::Count ( ) const
inline

◆ Fresh()

auto SwWrongList::Fresh ( sal_Int32 &  rStart,
sal_Int32 &  rEnd,
sal_Int32  nPos,
sal_Int32  nLen,
sal_uInt16  nIndex,
sal_Int32  nCursorPos 
)

Remove given range of entries.

For a given range [nPos, nPos + nLen[ and an index nIndex, this function basically counts the number of SwWrongArea entries starting with nIndex up to nPos + nLen. All these entries are removed.

Parameters
rStart???
rEnd???
nPosstarting position of the range
nLenlength of the range
nIndexindex to start lookup at
nCursorPos???
Returns
<true> if ???

Definition at line 356 of file wrong.cxx.

References Count, nIndex, nPos, Pos, and Remove.

Referenced by SwTextFrame::AutoSpell_(), and SwTextFrame::SmartTagScan().

◆ GetBeginInv()

sal_Int32 SwWrongList::GetBeginInv ( ) const
inline

◆ GetElement()

const SwWrongArea * SwWrongList::GetElement ( sal_uInt16  nIdx) const
inline

◆ GetEndInv()

sal_Int32 SwWrongList::GetEndInv ( ) const
inline

◆ GetWrongListType()

WrongListType SwWrongList::GetWrongListType ( ) const
inline

◆ GetWrongPos()

sal_uInt16 SwWrongList::GetWrongPos ( sal_Int32  nValue) const

Find the first position that is greater or equal to the given value.

Note
Resulting position might be behind the last element of the array.
Parameters
[in]nValuevalue for comparison
Returns
first position that is greater or equal to the given value

Definition at line 191 of file wrong.cxx.

References Count(), Len(), maList, maType, nValue, and Pos().

Referenced by SwTextFrame::AutoSpell_(), Check(), SwXTextMarkup::commitStringMarkup(), SwCursorShell::GetContentAtPos(), SwCursorShell::GetSmartTagTerm(), sw::WrongListIterator::GetWrongElement(), InWrongWord(), lcl_commitGrammarMarkUp(), Move(), NextWrong(), SwTextFrame::SmartTagScan(), and SwTextSlot::SwTextSlot().

◆ Insert() [1/3]

void SwWrongList::Insert ( const OUString &  rType,
css::uno::Reference< css::container::XStringKeyMap > const &  xPropertyBag,
sal_Int32  nNewPos,
sal_Int32  nNewLen 
)

Definition at line 622 of file wrong.cxx.

References maList, and meType.

◆ Insert() [2/3]

void SwWrongList::Insert ( const OUString &  rType,
css::uno::Reference< css::container::XStringKeyMap > const &  xPropertyBag,
sal_Int32  nNewPos,
sal_Int32  nNewLen,
sal_uInt16  nWhere 
)
inline

Definition at line 325 of file wrong.hxx.

References i, and meType.

◆ Insert() [3/3]

void SwWrongList::Insert ( sal_uInt16  nWhere,
std::vector< SwWrongArea >::iterator  startPos,
std::vector< SwWrongArea >::iterator const &  endPos 
)
private

Definition at line 538 of file wrong.cxx.

References i, and maList.

Referenced by SwTextFrame::AutoSpell_(), SwXTextMarkup::commitStringMarkup(), JoinList(), and lcl_commitGrammarMarkUp().

◆ InsertSubList()

void SwWrongList::InsertSubList ( sal_Int32  nNewPos,
sal_Int32  nNewLen,
sal_uInt16  nWhere,
SwWrongList pSubList 
)

Definition at line 523 of file wrong.cxx.

References GetWrongListType(), i, and maList.

Referenced by SwXTextMarkup::commitStringMarkup(), and lcl_commitGrammarMarkUp().

◆ Invalidate()

void SwWrongList::Invalidate ( sal_Int32  nBegin,
sal_Int32  nEnd 
)

Definition at line 426 of file wrong.cxx.

References COMPLETE_STRING, GetBeginInv(), Invalidate_(), and SetInvalid().

Referenced by InvalidateWrong(), JoinList(), lcl_SetWrong(), and Move().

◆ Invalidate_()

void SwWrongList::Invalidate_ ( sal_Int32  nBegin,
sal_Int32  nEnd 
)
private

Definition at line 246 of file wrong.cxx.

References COMPLETE_STRING, GetBeginInv(), GetEndInv(), mnBeginInvalid, and mnEndInvalid.

Referenced by Invalidate(), Move(), and SplitList().

◆ InvalidateWrong()

bool SwWrongList::InvalidateWrong ( )

Definition at line 434 of file wrong.cxx.

References Count(), Invalidate(), Len(), and Pos().

Referenced by lcl_SpellAndGrammarAgain().

◆ InWrongWord()

bool SwWrongList::InWrongWord ( sal_Int32 &  rChk,
sal_Int32 &  rLn 
) const

If a word is incorrectly selected, this method returns begin and length of it.

Parameters
[in,out]rChkstarting position of the word to check
[out]rLnlength of the word
Returns
<true> if incorrectly selected, <false> otherwise

Definition at line 103 of file wrong.cxx.

References Count(), GetWrongPos(), Len(), nPos, and Pos().

Referenced by SwAccessibleParagraph::_correctValues(), SwTextFrame::AutoSpell_(), SwCursorShell::GetContentAtPos(), SwEditShell::GetCorrection(), SwEditShell::GetGrammarCorrection(), SwVisibleCursor::getLOKPayload(), SwCursorShell::GetSmartTagRect(), and SwCursorShell::GetSmartTagTerm().

◆ JoinList()

void SwWrongList::JoinList ( SwWrongList pNext,
sal_Int32  nInsertPos 
)

◆ Len()

sal_Int32 SwWrongList::Len ( sal_uInt16  nIdx) const
inline

◆ LookForEntry()

bool SwWrongList::LookForEntry ( sal_Int32  nBegin,
sal_Int32  nEnd 
)

Definition at line 614 of file wrong.cxx.

References maList.

Referenced by lcl_syncGrammarError().

◆ Move()

void SwWrongList::Move ( sal_Int32  nPos,
sal_Int32  nDiff 
)

Change all values after the given position.

Needed after insert/deletion of characters.

Parameters
nPosposition after that everything should be changed
nDiffamount how much the positions should be moved

Definition at line 267 of file wrong.cxx.

References COMPLETE_STRING, Count(), GetBeginInv(), GetWrongPos(), i, Invalidate(), Invalidate_(), Len(), maList, mnBeginInvalid, mnEndInvalid, nPos, Pos(), Remove(), SetInvalid(), and ShiftLeft().

Referenced by JoinList(), lcl_SetWrong(), and SwGrammarMarkUp::MoveGrammar().

◆ NextWrong()

sal_Int32 SwWrongList::NextWrong ( sal_Int32  nChk) const

Find next incorrectly selected position.

Parameters
[in]rChkstarting position of the word to check
Returns
starting position of incorrectly selected area, <COMPLETE_STRING> otherwise

Definition at line 164 of file wrong.cxx.

References COMPLETE_STRING, Count(), GetBeginInv(), GetEndInv(), GetWrongPos(), Len(), nPos, and Pos().

Referenced by SwTextNode::Spell().

◆ operator=()

SwWrongList & SwWrongList::operator= ( const SwWrongList )
privatedelete

◆ Pos()

sal_Int32 SwWrongList::Pos ( sal_uInt16  nIdx) const
inline

◆ Remove()

void SwWrongList::Remove ( sal_uInt16  nIdx,
sal_uInt16  nLen 
)
private

Definition at line 556 of file wrong.cxx.

References Count(), and maList.

Referenced by JoinList(), Move(), RemoveEntry(), and SplitList().

◆ RemoveEntry()

void SwWrongList::RemoveEntry ( sal_Int32  nBegin,
sal_Int32  nEnd 
)

◆ SetInvalid()

void SwWrongList::SetInvalid ( sal_Int32  nBegin,
sal_Int32  nEnd 
)

◆ ShiftLeft()

static void SwWrongList::ShiftLeft ( sal_Int32 &  rPos,
sal_Int32  nStart,
sal_Int32  nEnd 
)
inlinestaticprivate

Definition at line 270 of file wrong.hxx.

Referenced by Move(), and SplitList().

◆ SplitList()

std::unique_ptr< SwWrongList > SwWrongList::SplitList ( sal_Int32  nSplitPos)

◆ SubList()

SwWrongList * SwWrongList::SubList ( sal_uInt16  nIdx) const
inline

◆ Validate()

void SwWrongList::Validate ( )
inline

Definition at line 291 of file wrong.hxx.

References COMPLETE_STRING.

Referenced by SwGrammarMarkUp::ClearGrammarList().

Member Data Documentation

◆ maList

std::vector<SwWrongArea> SwWrongList::maList
private

◆ meType

WrongListType SwWrongList::meType
private

Definition at line 265 of file wrong.hxx.

Referenced by Clone(), CopyFrom(), and Insert().

◆ mnBeginInvalid

sal_Int32 SwWrongList::mnBeginInvalid
private

Definition at line 267 of file wrong.hxx.

Referenced by CopyFrom(), Invalidate_(), Move(), SetInvalid(), and SplitList().

◆ mnEndInvalid

sal_Int32 SwWrongList::mnEndInvalid
private

Definition at line 268 of file wrong.hxx.

Referenced by CopyFrom(), Invalidate_(), Move(), SetInvalid(), and SplitList().


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