LibreOffice Module sc (master) 1
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ScCsvSplits Class Reference

A vector of column splits that supports inserting, removing and moving splits. More...

#include <csvsplits.hxx>

Public Member Functions

bool Insert (sal_Int32 nPos)
 The split container. More...
 
bool Remove (sal_Int32 nPos)
 Removes a split by position. More...
 
void RemoveRange (sal_Int32 nPosStart, sal_Int32 nPosEnd)
 Removes a range of splits in the given position range. More...
 
void Clear ()
 Removes all elements from the vector. More...
 
bool HasSplit (sal_Int32 nPos) const
 Returns true if at position nPos is a split. More...
 
sal_uInt32 GetIndex (sal_Int32 nPos) const
 Searches for a split at position nPos. More...
 
sal_uInt32 LowerBound (sal_Int32 nPos) const
 Returns index of the first split greater than or equal to nPos. More...
 
sal_uInt32 UpperBound (sal_Int32 nPos) const
 Returns index of the last split less than or equal to nPos. More...
 
sal_uInt32 Count () const
 Returns the number of splits. More...
 
sal_Int32 GetPos (sal_uInt32 nIndex) const
 Returns the position of the specified split. More...
 
sal_Int32 operator[] (sal_uInt32 nIndex) const
 Returns the position of the specified split. More...
 

Private Types

typedef ::std::vector< sal_Int32 > ScSplitVector
 
typedef ScSplitVector::const_iterator const_iterator
 

Private Member Functions

sal_uInt32 GetIterIndex (const_iterator const &aIter) const
 Returns the vector index of an iterator. More...
 

Private Attributes

ScSplitVector maVec
 

Detailed Description

A vector of column splits that supports inserting, removing and moving splits.

Definition at line 32 of file csvsplits.hxx.

Member Typedef Documentation

◆ const_iterator

typedef ScSplitVector::const_iterator ScCsvSplits::const_iterator
private

Definition at line 36 of file csvsplits.hxx.

◆ ScSplitVector

typedef ::std::vector< sal_Int32 > ScCsvSplits::ScSplitVector
private

Definition at line 35 of file csvsplits.hxx.

Member Function Documentation

◆ Clear()

void ScCsvSplits::Clear ( )

Removes all elements from the vector.

Definition at line 61 of file csvsplits.cxx.

References maVec.

Referenced by ScCsvGrid::ImplClearSplits(), load_FixedWidthList(), and ScCsvRuler::RemoveAllSplits().

◆ Count()

sal_uInt32 ScCsvSplits::Count ( ) const
inline

◆ GetIndex()

sal_uInt32 ScCsvSplits::GetIndex ( sal_Int32  nPos) const

Searches for a split at position nPos.

Returns
the vector index of the split.

Definition at line 71 of file csvsplits.cxx.

References GetIterIndex(), maVec, and nPos.

Referenced by HasSplit(), and Remove().

◆ GetIterIndex()

sal_uInt32 ScCsvSplits::GetIterIndex ( const_iterator const &  aIter) const
private

Returns the vector index of an iterator.

Definition at line 97 of file csvsplits.cxx.

References CSV_VEC_NOTFOUND, and maVec.

Referenced by GetIndex(), and LowerBound().

◆ GetPos()

sal_Int32 ScCsvSplits::GetPos ( sal_uInt32  nIndex) const

Returns the position of the specified split.

Definition at line 92 of file csvsplits.cxx.

References Count(), CSV_POS_INVALID, maVec, and nIndex.

Referenced by operator[](), and UpperBound().

◆ HasSplit()

bool ScCsvSplits::HasSplit ( sal_Int32  nPos) const

Returns true if at position nPos is a split.

Definition at line 66 of file csvsplits.cxx.

References CSV_VEC_NOTFOUND, GetIndex(), and nPos.

Referenced by ScCsvRuler::EndMouseTracking(), ScCsvRuler::HasSplit(), and ScCsvRuler::MoveMouseTracking().

◆ Insert()

bool ScCsvSplits::Insert ( sal_Int32  nPos)

The split container.

Inserts a new split at position nPos into the vector.

Returns
true = split inserted (nPos was valid and empty).

Definition at line 26 of file csvsplits.cxx.

References maVec, nPos, SAL_MAX_UINT32, and SAL_WARN_IF.

Referenced by ScCsvGrid::ApplyLayout(), ScCsvGrid::ImplClearSplits(), ScCsvGrid::ImplInsertSplit(), ScCsvGrid::ImplSetTextLineSep(), ScCsvRuler::InsertSplit(), load_FixedWidthList(), ScCsvGrid::MoveSplit(), ScCsvRuler::MoveSplit(), and ScCsvGrid::SetSplits().

◆ LowerBound()

sal_uInt32 ScCsvSplits::LowerBound ( sal_Int32  nPos) const

Returns index of the first split greater than or equal to nPos.

Definition at line 77 of file csvsplits.cxx.

References GetIterIndex(), maVec, and nPos.

Referenced by ScCsvRuler::ImplDrawRulerDev(), ScCsvRuler::MoveCursorToSplit(), RemoveRange(), and UpperBound().

◆ operator[]()

sal_Int32 ScCsvSplits::operator[] ( sal_uInt32  nIndex) const
inline

Returns the position of the specified split.

Definition at line 73 of file csvsplits.hxx.

References GetPos(), and nIndex.

◆ Remove()

bool ScCsvSplits::Remove ( sal_Int32  nPos)

Removes a split by position.

Returns
true = split found and removed.

Definition at line 43 of file csvsplits.cxx.

References CSV_VEC_NOTFOUND, GetIndex(), maVec, nIndex, and nPos.

Referenced by ScCsvGrid::ApplyLayout(), ScCsvGrid::ImplRemoveSplit(), ScCsvGrid::ImplSetTextLineSep(), ScCsvGrid::MoveSplit(), ScCsvRuler::MoveSplit(), and ScCsvRuler::RemoveSplit().

◆ RemoveRange()

void ScCsvSplits::RemoveRange ( sal_Int32  nPosStart,
sal_Int32  nPosEnd 
)

Removes a range of splits in the given position range.

Definition at line 53 of file csvsplits.cxx.

References CSV_VEC_NOTFOUND, LowerBound(), maVec, and UpperBound().

Referenced by ScCsvGrid::ApplyLayout().

◆ UpperBound()

sal_uInt32 ScCsvSplits::UpperBound ( sal_Int32  nPos) const

Returns index of the last split less than or equal to nPos.

Definition at line 82 of file csvsplits.cxx.

References Count(), CSV_VEC_NOTFOUND, GetPos(), LowerBound(), nIndex, and nPos.

Referenced by ScCsvGrid::GetColumnFromPos(), ScCsvRuler::ImplDrawRulerDev(), ScCsvRuler::MoveCursorToSplit(), and RemoveRange().

Member Data Documentation

◆ maVec

ScSplitVector ScCsvSplits::maVec
private

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