kspread Library API Documentation

KSpread::ValueFormatter Class Reference

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

#include <valueformatter.h>

Collaboration diagram for KSpread::ValueFormatter:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ValueFormatter (ValueConverter *converter)
QString formatText (KSpreadCell *cell, FormatType fmtType)
QString formatText (const KSpreadValue &value, FormatType fmtType, int precision=-1, KSpreadFormat::FloatFormat floatFormat=KSpreadFormat::OnlyNegSigned, const QString &prefix=QString::null, const QString &postfix=QString::null)
QString dateFormat (const QDate &_date, FormatType fmtType)
QString timeFormat (const QDateTime &_time, FormatType fmtType)

Protected Member Functions

FormatType determineFormatting (const KSpreadValue &value, FormatType fmtType)
QString createNumberFormat (double value, int precision, FormatType fmt, bool alwaysSigned)
QString fractionFormat (double value, FormatType fmtType)
QString errorFormat (KSpreadCell *cell)
void removeTrailingZeros (QString &str, QChar decimal_point)

Protected Attributes

ValueConverterconverter

Detailed Description

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

Definition at line 40 of file valueformatter.h.


Constructor & Destructor Documentation

ValueFormatter::ValueFormatter ValueConverter converter  ) 
 

copnstructor

Definition at line 37 of file valueformatter.cc.


Member Function Documentation

QString ValueFormatter::formatText KSpreadCell cell,
FormatType  fmtType
 

create a text representation of data in this cell

Definition at line 41 of file valueformatter.cc.

References KSpreadCell::column(), KSpreadCell::hasError(), KSpreadCell::row(), and KSpreadCell::value().

Referenced by formatText().

QString ValueFormatter::formatText const KSpreadValue value,
FormatType  fmtType,
int  precision = -1,
KSpreadFormat::FloatFormat  floatFormat = KSpreadFormat::OnlyNegSigned,
const QString prefix = QString::null,
const QString postfix = QString::null
 

create a text representation of data in this KSpreadValue

Definition at line 58 of file valueformatter.cc.

References KSpreadValue::asDate(), KSpreadValue::asDateTime(), KSpread::ValueConverter::asFloat(), KSpreadValue::asFloat(), KSpread::ValueConverter::asString(), createNumberFormat(), dateFormat(), determineFormatting(), KSpreadValue::element(), formatText(), fractionFormat(), KSpreadValue::isArray(), KSpread::ValueConverter::locale(), removeTrailingZeros(), and timeFormat().

QString ValueFormatter::dateFormat const QDate _date,
FormatType  fmtType
 

create a date format

Definition at line 486 of file valueformatter.cc.

References KSpread::ValueConverter::locale().

Referenced by formatText().

QString ValueFormatter::timeFormat const QDateTime _time,
FormatType  fmtType
 

create a time format

Definition at line 412 of file valueformatter.cc.

References KSpread::ValueConverter::locale().

Referenced by formatText().

FormatType ValueFormatter::determineFormatting const KSpreadValue 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 128 of file valueformatter.cc.

References KSpreadValue::asFloat(), KSpreadValue::format(), KSpreadValue::isBoolean(), and KSpreadValue::isString().

Referenced by formatText().

QString ValueFormatter::createNumberFormat double  value,
int  precision,
FormatType  fmt,
bool  alwaysSigned
[protected]
 

create a number format

Definition at line 231 of file valueformatter.cc.

References KSpread::ValueConverter::locale().

Referenced by formatText().

QString ValueFormatter::fractionFormat double  value,
FormatType  fmtType
[protected]
 

create a fraction format

Definition at line 291 of file valueformatter.cc.

Referenced by formatText().

void ValueFormatter::removeTrailingZeros QString str,
QChar  decimal_point
[protected]
 

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

Definition at line 197 of file valueformatter.cc.

References KSpread::ValueConverter::locale().

Referenced by formatText().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kspread Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:43:51 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003