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 33 of file csvsplits.hxx.

Member Typedef Documentation

typedef ScSplitVector::const_iterator ScCsvSplits::const_iterator
private

Definition at line 37 of file csvsplits.hxx.

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

Definition at line 36 of file csvsplits.hxx.

Member Function Documentation

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().

sal_uInt32 ScCsvSplits::Count ( ) const
inline
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(), and maVec.

Referenced by HasSplit(), and Remove().

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().

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, and maVec.

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

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, and GetIndex().

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

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, SAL_MAX_UINT32, and SAL_WARN_IF.

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

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(), and maVec.

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

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

Returns the position of the specified split.

Definition at line 74 of file csvsplits.hxx.

References GetPos().

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, and nIndex.

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

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().

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(), and nIndex.

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

Member Data Documentation

ScSplitVector ScCsvSplits::maVec
private

Definition at line 39 of file csvsplits.hxx.

Referenced by Clear(), GetIndex(), GetIterIndex(), GetPos(), Insert(), LowerBound(), Remove(), and RemoveRange().


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