1 /* 2 * This file is part of the KDE project 3 * 4 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 5 * 6 * Contact: Amit Aggarwal <amit.5.aggarwal@nokia.com> 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public License 10 * version 2.1 or (at your option) any later version as published by 11 * the Free Software Foundation. 12 * 13 * This library is distributed in the hope that it will be useful, but 14 * WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 21 * 02110-1301 USA 22 * 23 */ 24 25 #ifndef DATE_TIME_FORMAT_H 26 #define DATE_TIME_FORMAT_H 27 28 #include <QString> 29 30 class KoXmlWriter; 31 class KoGenStyles; 32 33 class DateTimeFormat 34 { 35 public: 36 /** 37 * @brief Constructor 38 * @param Slide* master- Master Slide 39 */ 40 explicit DateTimeFormat(int dateTimeFormatId = 0); 41 42 /** 43 * @brief Destructor 44 */ 45 ~DateTimeFormat(); 46 47 /** 48 * @brief addMasterDateTimeSection(KoXmlWriter& xmlWriter) - Add DateTime section Master styles in styles.xml 49 * @param KoXmlWriter - Content Writer 50 */ 51 void addMasterDateTimeSection(KoXmlWriter& xmlWriter, const QString &tStyle); 52 53 /** 54 * @brief addDateTimeAutoStyles - Add DateTime styles in styles.xml 55 * @param KoGenStyles - Styles generator handle 56 */ 57 void addDateTimeAutoStyles(KoGenStyles& styles, 58 bool hasTodayDate, 59 bool hasUserDate); 60 61 /** 62 * @brief eHeaderFooterAtom - HeaderFooter enum as per spec of formatId 63 */ 64 enum { 65 fHasDate = 0x01, //(1 bit): A bit that specifies whether the date is displayed in the footer. 66 fHasTodayDate = 0x02, //(1 bit): A bit that specifies whether the current datetime is used for displaying the datetime. 67 fHasUserDate = 0x04, //(1 bit): A bit that specifies whether the date specified in UserDateAtom 68 fHasSlideNumber = 0x08, //(1 bit): A bit that specifies whether the slide number is displayed in the footer. 69 fHasHeader = 0x10, //(1 bit): A bit that specifies whether the header text specified by HeaderAtom record is displayed. 70 fHasFooter = 0x20, //(1 bit): A bit that specifies whether the footer text specified by FooterAtom 71 }eHeaderFooterAtom; 72 73 private: 74 75 /** 76 * @brief addDateStyle - Add DateTime styles in as per the formatId in styles.xml. 77 * @param KoGenStyles - Styles generator handle. 78 * @param bool dayofweek - Long format is dayof week is true in formatId. 79 * @param bool longMonth - Long Month as per the formatId spec. 80 * @param bool textualmonth - Month in textual format also. 81 * @param bool longyear - Long year format 82 * @param QString separator="/" - Separator b/w date. 83 */ 84 void addDateStyle(KoGenStyles& styles, 85 bool dayofweek, bool longMonth, bool textualmonth, bool longyear, 86 const QString &separator = QLatin1String("/")); 87 88 /** 89 * @brief addTimeStyle - Add Time styles in as per the formatId in styles.xml. 90 * @param KoGenStyles - Styles generator handle. 91 * @param bool hr12Format - Time in 12 hr format. 92 * @param bool second - Second is required in time or not. 93 * @param QString separator=":" - Separator b/w time. 94 */ 95 void addTimeStyle(KoGenStyles& styles, bool hr12Format, bool second, const QString &separator = QLatin1String(":")); 96 97 /** 98 * @brief setDateStyleName - set the date style name for further usage. 99 * @param name name of the style 100 */ 101 void setDateStyleName(const QString &name); 102 103 /** 104 * @brief dateStyleName - Retrun the date style name . 105 * @param name name of the style 106 */ 107 QString getDateStyleName() const; 108 109 /** 110 * @brief setTimeStyleName - set the time style name for further usage. 111 * @param name name of the style 112 */ 113 void setTimeStyleName(const QString &name); 114 115 /** 116 * @brief timeStyleName - Return the time style name. 117 * @param name name of the style 118 */ 119 QString getTimeStyleName() const; 120 121 /** 122 * @brief eDateTimeFormat - DateTime different format enum 123 */ 124 enum { 125 ShortDate, //0 126 LongDate, //1 127 LongDateWithoutWeekday, //2 128 AltShortDate, //3 129 ShortDateWithAbbrMonth, //4 130 ShortDateWithSlashes, //5 131 DateAnd12HrTime, //6 132 Hr24Time, //7 133 Hr24TimeWithSec, //8 134 Hr12Time, //9 135 Hr12TimeWithSec, //10 136 XMLSchemaDate, //11 137 XMLSchemaDateTime, //12 138 FixedUserDateFormat, //13 139 }eDateTimeFormat; 140 141 //Slide *master; 142 /** 143 * @brief formatId - Date representation format 144 */ 145 int formatId; 146 QString dateStyleName; 147 QString timeStyleName; 148 }; 149 150 #endif //datetimeformat.h 151