valueformatter.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KSPREAD_VALUEFORMATTER
00021 #define KSPREAD_VALUEFORMATTER
00022
00023 #include "kspread_global.h"
00024 #include "kspread_format.h"
00025 #include "kspread_value.h"
00026
00027 #include <qdatetime.h>
00028
00029 class KSpreadCell;
00030
00031 namespace KSpread {
00032
00033 class ValueConverter;
00034
00040 class ValueFormatter {
00041 public:
00043 ValueFormatter (ValueConverter *converter);
00044
00046 QString formatText (KSpreadCell *cell, FormatType fmtType);
00047
00049 QString formatText (const KSpreadValue &value,
00050 FormatType fmtType, int precision = -1,
00051 KSpreadFormat::FloatFormat floatFormat = KSpreadFormat::OnlyNegSigned,
00052 const QString &prefix = QString::null,
00053 const QString &postfix = QString::null);
00054
00056 QString dateFormat (const QDate &_date, FormatType fmtType);
00057
00059 QString timeFormat (const QDateTime &_time, FormatType fmtType);
00060
00061 protected:
00062
00063 ValueConverter* converter;
00064
00067 FormatType determineFormatting (const KSpreadValue &value,
00068 FormatType fmtType);
00069
00071 QString createNumberFormat (double value, int precision, FormatType fmt,
00072 bool alwaysSigned);
00073
00075 QString fractionFormat (double value, FormatType fmtType);
00076
00077 QString errorFormat (KSpreadCell *cell);
00078
00081 void removeTrailingZeros (QString &str, QChar decimal_point);
00082 };
00083
00084
00085 }
00086
00087
00088 #endif //KSPREAD_VALUEFORMATTER
This file is part of the documentation for kspread Library Version 1.4.2.