xlsxformat.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. // xlsxformat.h
  2. #ifndef QXLSX_FORMAT_H
  3. #define QXLSX_FORMAT_H
  4. #include <QFont>
  5. #include <QColor>
  6. #include <QByteArray>
  7. #include <QList>
  8. #include <QExplicitlySharedDataPointer>
  9. #include <QVariant>
  10. #include "xlsxglobal.h"
  11. class FormatTest;
  12. QT_BEGIN_NAMESPACE_XLSX
  13. class Styles;
  14. class Worksheet;
  15. class WorksheetPrivate;
  16. class RichStringPrivate;
  17. class SharedStrings;
  18. class FormatPrivate;
  19. class Format
  20. {
  21. public:
  22. enum FontScript
  23. {
  24. FontScriptNormal,
  25. FontScriptSuper,
  26. FontScriptSub
  27. };
  28. enum FontUnderline
  29. {
  30. FontUnderlineNone,
  31. FontUnderlineSingle,
  32. FontUnderlineDouble,
  33. FontUnderlineSingleAccounting,
  34. FontUnderlineDoubleAccounting
  35. };
  36. enum HorizontalAlignment
  37. {
  38. AlignHGeneral,
  39. AlignLeft,
  40. AlignHCenter,
  41. AlignRight,
  42. AlignHFill,
  43. AlignHJustify,
  44. AlignHMerge,
  45. AlignHDistributed
  46. };
  47. enum VerticalAlignment
  48. {
  49. AlignTop,
  50. AlignVCenter,
  51. AlignBottom,
  52. AlignVJustify,
  53. AlignVDistributed
  54. };
  55. enum BorderStyle
  56. {
  57. BorderNone,
  58. BorderThin,
  59. BorderMedium,
  60. BorderDashed,
  61. BorderDotted,
  62. BorderThick,
  63. BorderDouble,
  64. BorderHair,
  65. BorderMediumDashed,
  66. BorderDashDot,
  67. BorderMediumDashDot,
  68. BorderDashDotDot,
  69. BorderMediumDashDotDot,
  70. BorderSlantDashDot
  71. };
  72. enum DiagonalBorderType
  73. {
  74. DiagonalBorderNone,
  75. DiagonalBorderDown,
  76. DiagonalBorderUp,
  77. DiagnoalBorderBoth
  78. };
  79. enum FillPattern
  80. {
  81. PatternNone,
  82. PatternSolid,
  83. PatternMediumGray,
  84. PatternDarkGray,
  85. PatternLightGray,
  86. PatternDarkHorizontal,
  87. PatternDarkVertical,
  88. PatternDarkDown,
  89. PatternDarkUp,
  90. PatternDarkGrid,
  91. PatternDarkTrellis,
  92. PatternLightHorizontal,
  93. PatternLightVertical,
  94. PatternLightDown,
  95. PatternLightUp,
  96. PatternLightTrellis,
  97. PatternGray125,
  98. PatternGray0625,
  99. PatternLightGrid
  100. };
  101. Format();
  102. Format(const Format &other);
  103. Format &operator=(const Format &rhs);
  104. ~Format();
  105. int numberFormatIndex() const;
  106. void setNumberFormatIndex(int format);
  107. QString numberFormat() const;
  108. void setNumberFormat(const QString &format);
  109. void setNumberFormat(int id, const QString &format);
  110. bool isDateTimeFormat() const;
  111. int fontSize() const;
  112. void setFontSize(int size);
  113. bool fontItalic() const;
  114. void setFontItalic(bool italic);
  115. bool fontStrikeOut() const;
  116. void setFontStrikeOut(bool);
  117. QColor fontColor() const;
  118. void setFontColor(const QColor &);
  119. bool fontBold() const;
  120. void setFontBold(bool bold);
  121. FontScript fontScript() const;
  122. void setFontScript(FontScript);
  123. FontUnderline fontUnderline() const;
  124. void setFontUnderline(FontUnderline);
  125. bool fontOutline() const;
  126. void setFontOutline(bool outline);
  127. QString fontName() const;
  128. void setFontName(const QString &);
  129. QFont font() const;
  130. void setFont(const QFont &font);
  131. HorizontalAlignment horizontalAlignment() const;
  132. void setHorizontalAlignment(HorizontalAlignment align);
  133. VerticalAlignment verticalAlignment() const;
  134. void setVerticalAlignment(VerticalAlignment align);
  135. bool textWrap() const;
  136. void setTextWrap(bool textWrap);
  137. int rotation() const;
  138. void setRotation(int rotation);
  139. int indent() const;
  140. void setIndent(int indent);
  141. bool shrinkToFit() const;
  142. void setShrinkToFit(bool shink);
  143. void setBorderStyle(BorderStyle style);
  144. void setBorderColor(const QColor &color);
  145. BorderStyle leftBorderStyle() const;
  146. void setLeftBorderStyle(BorderStyle style);
  147. QColor leftBorderColor() const;
  148. void setLeftBorderColor(const QColor &color);
  149. BorderStyle rightBorderStyle() const;
  150. void setRightBorderStyle(BorderStyle style);
  151. QColor rightBorderColor() const;
  152. void setRightBorderColor(const QColor &color);
  153. BorderStyle topBorderStyle() const;
  154. void setTopBorderStyle(BorderStyle style);
  155. QColor topBorderColor() const;
  156. void setTopBorderColor(const QColor &color);
  157. BorderStyle bottomBorderStyle() const;
  158. void setBottomBorderStyle(BorderStyle style);
  159. QColor bottomBorderColor() const;
  160. void setBottomBorderColor(const QColor &color);
  161. BorderStyle diagonalBorderStyle() const;
  162. void setDiagonalBorderStyle(BorderStyle style);
  163. DiagonalBorderType diagonalBorderType() const;
  164. void setDiagonalBorderType(DiagonalBorderType style);
  165. QColor diagonalBorderColor() const;
  166. void setDiagonalBorderColor(const QColor &color);
  167. FillPattern fillPattern() const;
  168. void setFillPattern(FillPattern pattern);
  169. QColor patternForegroundColor() const;
  170. void setPatternForegroundColor(const QColor &color);
  171. QColor patternBackgroundColor() const;
  172. void setPatternBackgroundColor(const QColor &color);
  173. bool locked() const;
  174. void setLocked(bool locked);
  175. bool hidden() const;
  176. void setHidden(bool hidden);
  177. void mergeFormat(const Format &modifier);
  178. bool isValid() const;
  179. bool isEmpty() const;
  180. bool operator == (const Format &format) const;
  181. bool operator != (const Format &format) const;
  182. QVariant property(int propertyId, const QVariant &defaultValue=QVariant()) const;
  183. void setProperty(int propertyId, const QVariant &value, const QVariant &clearValue=QVariant(), bool detach=true);
  184. void clearProperty(int propertyId);
  185. bool hasProperty(int propertyId) const;
  186. bool boolProperty(int propertyId, bool defaultValue=false) const;
  187. int intProperty(int propertyId, int defaultValue=0) const;
  188. double doubleProperty(int propertyId, double defaultValue = 0.0) const;
  189. QString stringProperty(int propertyId, const QString &defaultValue = QString()) const;
  190. QColor colorProperty(int propertyId, const QColor &defaultValue = QColor()) const;
  191. bool hasNumFmtData() const;
  192. bool hasFontData() const;
  193. bool hasFillData() const;
  194. bool hasBorderData() const;
  195. bool hasAlignmentData() const;
  196. bool hasProtectionData() const;
  197. bool fontIndexValid() const;
  198. int fontIndex() const;
  199. QByteArray fontKey() const;
  200. bool borderIndexValid() const;
  201. QByteArray borderKey() const;
  202. int borderIndex() const;
  203. bool fillIndexValid() const;
  204. QByteArray fillKey() const;
  205. int fillIndex() const;
  206. QByteArray formatKey() const;
  207. bool xfIndexValid() const;
  208. int xfIndex() const;
  209. bool dxfIndexValid() const;
  210. int dxfIndex() const;
  211. void fixNumberFormat(int id, const QString &format);
  212. void setFontIndex(int index);
  213. void setBorderIndex(int index);
  214. void setFillIndex(int index);
  215. void setXfIndex(int index);
  216. void setDxfIndex(int index);
  217. private:
  218. friend class Styles;
  219. friend class ::FormatTest;
  220. friend QDebug operator<<(QDebug, const Format &f);
  221. int theme() const;
  222. QExplicitlySharedDataPointer<FormatPrivate> d;
  223. };
  224. #ifndef QT_NO_DEBUG_STREAM
  225. QDebug operator<<(QDebug dbg, const Format &f);
  226. #endif
  227. QT_END_NAMESPACE_XLSX
  228. #endif // QXLSX_FORMAT_H