#include <valueformatter.h>

Public Member Functions

 ValueFormatter (ValueConverter *converter)
 
TQString formatText (Cell *cell, FormatType fmtType)
 
TQString formatText (const Value &value, FormatType fmtType, int precision=-1, Format::FloatFormat floatFormat=Format::OnlyNegSigned, const TQString &prefix=TQString(), const TQString &postfix=TQString(), const TQString &currencySymbol=TQString())
 
TQString dateFormat (const TQDate &_date, FormatType fmtType)
 
TQString timeFormat (const TQDateTime &_time, FormatType fmtType)
 

Protected Member Functions

FormatType determineFormatting (const Value &value, FormatType fmtType)
 
TQString createNumberFormat (double value, int precision, FormatType fmt, bool alwaysSigned, const TQString &currencySymbol)
 
TQString fractionFormat (double value, FormatType fmtType)
 
TQString errorFormat (Cell *cell)
 
void removeTrailingZeros (TQString &str, TQChar decimal_point)
 

Protected Attributes

ValueConverter * converter
 

Detailed Description

The ValueFormatter class generates a textual representation of data stored in a Value, with a given formatting.

Definition at line 38 of file valueformatter.h.

Constructor & Destructor Documentation

◆ ValueFormatter()

ValueFormatter::ValueFormatter ( ValueConverter *  converter)

copnstructor

Definition at line 37 of file valueformatter.cpp.

Member Function Documentation

◆ createNumberFormat()

TQString ValueFormatter::createNumberFormat ( double  value,
int  precision,
FormatType  fmt,
bool  alwaysSigned,
const TQString &  currencySymbol 
)
protected

create a number format

Definition at line 236 of file valueformatter.cpp.

◆ dateFormat()

TQString ValueFormatter::dateFormat ( const TQDate &  _date,
FormatType  fmtType 
)

create a date format

Definition at line 493 of file valueformatter.cpp.

◆ determineFormatting()

FormatType ValueFormatter::determineFormatting ( const Value &  value,
FormatType  fmtType 
)
protected

determine the formatting type that should be used to format this value in a cell with a given format type

Definition at line 133 of file valueformatter.cpp.

◆ errorFormat()

TQString ValueFormatter::errorFormat ( Cell *  cell)
protected

Definition at line 633 of file valueformatter.cpp.

◆ formatText() [1/2]

TQString ValueFormatter::formatText ( Cell *  cell,
FormatType  fmtType 
)

create a text representation of data in this cell

Definition at line 41 of file valueformatter.cpp.

◆ formatText() [2/2]

TQString ValueFormatter::formatText ( const Value &  value,
FormatType  fmtType,
int  precision = -1,
Format::FloatFormat  floatFormat = Format::OnlyNegSigned,
const TQString &  prefix = TQString(),
const TQString &  postfix = TQString(),
const TQString &  currencySymbol = TQString() 
)

create a text representation of data in this Value

Definition at line 61 of file valueformatter.cpp.

◆ fractionFormat()

TQString ValueFormatter::fractionFormat ( double  value,
FormatType  fmtType 
)
protected

create a fraction format

Definition at line 298 of file valueformatter.cpp.

◆ removeTrailingZeros()

void ValueFormatter::removeTrailingZeros ( TQString &  str,
TQChar  decimal_point 
)
protected

Remove trailing zeros and the decimal point if necessary unless the number has no decimal point.

Definition at line 202 of file valueformatter.cpp.

◆ timeFormat()

TQString ValueFormatter::timeFormat ( const TQDateTime &  _time,
FormatType  fmtType 
)

create a time format

Definition at line 419 of file valueformatter.cpp.

Member Data Documentation

◆ converter

ValueConverter* KSpread::ValueFormatter::converter
protected

Definition at line 62 of file valueformatter.h.


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