KOffice – TDE office suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

798 lines
24KB

  1. /* This file is part of the KDE project
  2. Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
  3. Copyright (C) 2000 - 2003 The KSpread Team
  4. www.koffice.org/kspread
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Library General Public
  7. License as published by the Free Software Foundation; either
  8. version 2 of the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Library General Public License for more details.
  13. You should have received a copy of the GNU Library General Public License
  14. along with this library; see the file COPYING.LIB. If not, write to
  15. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16. * Boston, MA 02110-1301, USA.
  17. */
  18. #ifndef __kspread_format_h__
  19. #define __kspread_format_h__
  20. #include <tqbrush.h>
  21. #include <tqcolor.h>
  22. #include <tqfont.h>
  23. #include <tqpen.h>
  24. #include <koffice_export.h>
  25. #include "kspread_global.h"
  26. class TQDomElement;
  27. class TQDomDocument;
  28. class DCOPObject;
  29. class KLocale;
  30. class KoGenStyle;
  31. class KoGenStyles;
  32. class KoOasisLoadingContext;
  33. class KoOasisStyles;
  34. class KoStyleStack;
  35. namespace KSpread
  36. {
  37. class Canvas;
  38. class Cell;
  39. class Currency;
  40. class Sheet;
  41. class Style;
  42. /**
  43. */
  44. class KSPREAD_EXPORT Format
  45. {
  46. public:
  47. enum Align { Left = 1, Center = 2, Right = 3, Undefined = 4 };
  48. enum AlignY { Top = 1, Middle = 2, Bottom = 3, UndefinedY = 4 };
  49. enum FloatFormat { AlwaysSigned = 1, AlwaysUnsigned = 2, OnlyNegSigned = 3 };
  50. enum FloatColor { NegRed = 1, AllBlack = 2, NegBrackets = 3, NegRedBrackets = 4 };
  51. // TODO Stefan: merge with Style::FlagsSet
  52. enum Properties{ PAlign = 0x01,
  53. PAlignY = 0x02,
  54. //PFactor was here
  55. PPrefix = 0x08,
  56. PPostfix = 0x10,
  57. PLeftBorder = 0x20,
  58. PRightBorder = 0x40,
  59. PTopBorder = 0x80,
  60. PBottomBorder = 0x100,
  61. PFallDiagonal = 0x200,
  62. PGoUpDiagonal = 0x400,
  63. PBackgroundBrush = 0x800,
  64. PFont = 0x1000,
  65. PTextPen = 0x2000,
  66. PBackgroundColor = 0x4000,
  67. PFloatFormat = 0x8000,
  68. PFloatColor = 0x10000,
  69. PMultiRow = 0x20000,
  70. PVerticalText = 0x40000,
  71. PPrecision = 0x80000,
  72. PFormatType = 0x100000,
  73. PAngle = 0x200000,
  74. PComment = 0x400000,
  75. PIndent = 0x800000,
  76. PDontPrintText = 0x1000000,
  77. PCustomFormat = 0x2000000,
  78. PNotProtected = 0x4000000,
  79. PHideAll = 0x8000000,
  80. PHideFormula = 0x10000000 };
  81. struct Currency
  82. {
  83. int type;
  84. TQString symbol;
  85. };
  86. /**
  87. * Constructor.
  88. * @param sheet The sheet this format belongs to.
  89. * @todo The format should not belong to a sheet. The cell belongs to a sheet. Move
  90. * the sheet pointer to Cell.
  91. * @param style The style this format should use.
  92. * You should pass @c 0 in here, only if you copy another Format on
  93. * this directly after.
  94. */
  95. Format( Sheet* sheet, Style* style );
  96. /**
  97. * Destructor.
  98. * The associated style's reference counter is decremented and if it has no further
  99. * references, it is deleted.
  100. */
  101. virtual ~Format();
  102. void copy( const Format& other );
  103. void defaultStyleFormat();
  104. ////////////////////////////////
  105. //
  106. // Loading and saving
  107. //
  108. ////////////////////////////////
  109. bool load( const TQDomElement & f, Paste::Mode pm, bool paste = false );
  110. bool loadFormat( const TQDomElement & f, Paste::Mode pm = Paste::Normal, bool paste = false );
  111. TQDomElement save( TQDomDocument& doc,int _col, int _row,bool force = false, bool copy = false ) const;
  112. TQDomElement saveFormat( TQDomDocument& doc, bool force = false, bool copy = false ) const;
  113. TQDomElement saveFormat( TQDomDocument& doc, int _col, int _row, bool force = false, bool copy = false ) const;
  114. void loadOasisStyle(/* const TQDomElement& element,*/ KoOasisLoadingContext& context );
  115. bool loadOasisStyleProperties(KoStyleStack & styleStack, const KoOasisStyles& oasisStyles );
  116. bool loadFontOasisStyle( KoStyleStack & font );
  117. /**
  118. * @return the OASIS style's name, if it was created. TQString() otherwise.
  119. */
  120. TQString saveOasisCellStyle( KoGenStyle &currentCellStyle, KoGenStyles &mainStyle );
  121. ////////////////////////////////
  122. //
  123. // Properties
  124. //
  125. ////////////////////////////////
  126. uint propertiesMask() { return m_mask; } // For the cell inspector only.
  127. void clearProperties();
  128. void clearProperty( Properties p );
  129. void clearNoFallBackProperties( ) ;
  130. void clearNoFallBackProperties( Properties p ) ;
  131. void setNoFallBackProperties(Properties p);
  132. bool hasNoFallBackProperties( Properties p ) const ;
  133. ///////////////////////////////
  134. //
  135. // Flags
  136. //
  137. ///////////////////////////////
  138. enum FormatFlags{ Flag_MultiRow = 0x00000001,
  139. Flag_VerticalText = 0x00000002,
  140. Flag_DontPrintText = 0x00000004,
  141. Flag_HideAll = 0x00000008,
  142. Flag_HideFormula = 0x00000010,
  143. Flag_NotProtected = 0x00000020
  144. /* reserve the bits 0xFFFF0000 for subclasses to use */
  145. };
  146. void clearFlag( FormatFlags flag );
  147. void setFlag( FormatFlags flag );
  148. bool testFlag( FormatFlags flag ) const;
  149. ////////////////////////////////
  150. //
  151. // Methods for setting format stuff.
  152. //
  153. ////////////////////////////////
  154. static void setGlobalColWidth( double width );
  155. static void setGlobalRowHeight( double height );
  156. static double globalRowHeight();
  157. static double globalColWidth();
  158. void setStyle( Style * style );
  159. void setCell( Cell* cell ) { m_pCell = cell; }
  160. /**
  161. * sets the format of the content, e.g. #.##0.00, dd/mmm/yyyy,...
  162. */
  163. void setFormatString( TQString const & format );
  164. void setAlign( Align _align );
  165. void setAlignY( AlignY _alignY );
  166. void setPrefix( const TQString& _prefix );
  167. void setPostfix( const TQString& _postfix );
  168. void setPrecision( int _p );
  169. virtual void setLeftBorderPen( const TQPen& _p );
  170. void setLeftBorderStyle( Qt::PenStyle s );
  171. void setLeftBorderColor( const TQColor & _c );
  172. void setLeftBorderWidth( int _w );
  173. virtual void setTopBorderPen( const TQPen& _p );
  174. void setTopBorderStyle( Qt::PenStyle s );
  175. void setTopBorderColor( const TQColor & _c );
  176. void setTopBorderWidth( int _w );
  177. virtual void setRightBorderPen( const TQPen& p );
  178. void setRightBorderStyle( Qt::PenStyle _s );
  179. void setRightBorderColor( const TQColor & _c );
  180. void setRightBorderWidth( int _w );
  181. virtual void setBottomBorderPen( const TQPen& p );
  182. void setBottomBorderStyle( Qt::PenStyle _s );
  183. void setBottomBorderColor( const TQColor & _c );
  184. void setBottomBorderWidth( int _w );
  185. void setFallDiagonalPen( const TQPen& _p );
  186. void setFallDiagonalStyle( Qt::PenStyle s );
  187. void setFallDiagonalColor( const TQColor & _c );
  188. void setFallDiagonalWidth( int _w );
  189. void setGoUpDiagonalPen( const TQPen& _p );
  190. void setGoUpDiagonalStyle( Qt::PenStyle s );
  191. void setGoUpDiagonalColor( const TQColor & _c );
  192. void setGoUpDiagonalWidth( int _w );
  193. void setBackGroundBrush( const TQBrush& _p);
  194. void setBackGroundBrushStyle( Qt::BrushStyle s);
  195. void setBackGroundBrushColor( const TQColor & _c);
  196. void setTextFont( const TQFont& _f );
  197. void setTextFontSize( int _s );
  198. void setTextFontFamily( const TQString& _f );
  199. void setTextFontBold( bool _b );
  200. void setTextFontItalic( bool _i );
  201. void setTextFontUnderline( bool _i );
  202. void setTextFontStrike( bool _i );
  203. void setTextPen( const TQPen& _p );
  204. void setTextColor( const TQColor & _c );
  205. void setBgColor( const TQColor & _c );
  206. void setFloatFormat( FloatFormat _f );
  207. void setFloatColor( FloatColor _c );
  208. void setMultiRow( bool _b );
  209. void setVerticalText( bool _b );
  210. void setFormatType(FormatType _format);
  211. void setAngle(int _angle);
  212. void setComment( const TQString& c );
  213. void setIndent( double _indent );
  214. void setDontPrintText( bool _b );
  215. void setNotProtected( bool _b );
  216. void setHideAll( bool _b );
  217. void setHideFormula( bool _b );
  218. void setCurrency( Currency const & c );
  219. void setCurrency( int type, TQString const & symbol );
  220. ////////////////////////////////
  221. //
  222. // Methods for querying format stuff.
  223. //
  224. ////////////////////////////////
  225. TQString const & getFormatString( int col, int row ) const;
  226. virtual const TQPen& leftBorderPen( int col, int row ) const;
  227. int leftBorderWidth( int col, int row ) const;
  228. Qt::PenStyle leftBorderStyle( int col, int row ) const;
  229. const TQColor& leftBorderColor( int col, int row ) const;
  230. virtual const TQPen& topBorderPen( int col, int row ) const;
  231. int topBorderWidth( int col, int row ) const;
  232. Qt::PenStyle topBorderStyle( int col, int row ) const;
  233. const TQColor& topBorderColor( int col, int row ) const;
  234. virtual const TQPen& rightBorderPen( int col, int row ) const;
  235. int rightBorderWidth( int col, int row ) const;
  236. Qt::PenStyle rightBorderStyle( int col, int row ) const;
  237. const TQColor& rightBorderColor( int col, int row ) const;
  238. virtual const TQPen& bottomBorderPen( int col, int row ) const;
  239. int bottomBorderWidth( int col, int row ) const;
  240. Qt::PenStyle bottomBorderStyle( int col, int row ) const;
  241. const TQColor& bottomBorderColor( int col, int row ) const;
  242. const TQPen& fallDiagonalPen( int col, int row ) const;
  243. int fallDiagonalWidth( int col, int row ) const;
  244. Qt::PenStyle fallDiagonalStyle( int col, int row ) const;
  245. const TQColor& fallDiagonalColor( int col, int row ) const;
  246. const TQPen& goUpDiagonalPen( int col, int row ) const;
  247. int goUpDiagonalWidth( int col, int row ) const;
  248. Qt::PenStyle goUpDiagonalStyle( int col, int row ) const;
  249. const TQColor& goUpDiagonalColor( int col, int row ) const;
  250. const TQBrush& backGroundBrush( int col, int row ) const;
  251. Qt::BrushStyle backGroundBrushStyle( int col, int row ) const;
  252. const TQColor& backGroundBrushColor(int col, int row ) const;
  253. uint bottomBorderValue( int col, int row ) const;
  254. uint rightBorderValue( int col, int row ) const;
  255. uint leftBorderValue( int col, int row ) const;
  256. uint topBorderValue( int col, int row ) const;
  257. /**
  258. * @return the precision of the floating point representation.
  259. */
  260. int precision( int col, int row ) const;
  261. /**
  262. * @return the prefix of a numeric value ( for example "$" )
  263. */
  264. TQString prefix( int col, int row ) const;
  265. /**
  266. * @return the postfix of a numeric value ( for example "DM" )
  267. */
  268. TQString postfix( int col, int row ) const;
  269. /**
  270. * @return the way of formatting a floating point value
  271. */
  272. FloatFormat floatFormat( int col, int row ) const;
  273. /**
  274. * @return the color format of a floating point value
  275. */
  276. FloatColor floatColor( int col, int row ) const;
  277. const TQPen& textPen( int col, int row ) const;
  278. /**
  279. * @return the text color.
  280. */
  281. const TQColor& textColor( int col, int row ) const;
  282. /**
  283. * @param _col the column this cell is assumed to be in
  284. * @param _row the row this cell is assumed to be in
  285. *
  286. * @return the background color.
  287. */
  288. const TQColor& bgColor( int col, int row ) const;
  289. const TQFont textFont( int col, int row ) const;
  290. int textFontSize( int col, int row ) const;
  291. TQString const & textFontFamily( int col, int row ) const;
  292. bool textFontBold( int col, int row ) const;
  293. bool textFontItalic( int col, int row ) const;
  294. bool textFontUnderline( int col, int row ) const;
  295. bool textFontStrike( int col, int row ) const;
  296. Align align( int col, int row ) const;
  297. AlignY alignY( int col, int row ) const;
  298. bool multiRow( int col, int row ) const;
  299. bool verticalText( int col, int row ) const;
  300. FormatType getFormatType(int col, int row )const ;
  301. int getAngle(int col, int row) const;
  302. const TQString* comment() const { return m_strComment; };
  303. TQString comment(int col, int row) const;
  304. TQString * commentP( int col, int row ) const;
  305. double getIndent(int col, int row) const;
  306. bool getDontprintText( int col, int row) const;
  307. bool notProtected( int col, int row) const;
  308. bool isHideAll( int col, int row) const;
  309. bool isHideFormula( int col, int row) const;
  310. bool isProtected( int col, int row ) const;
  311. Style* style() const { return m_pStyle; }
  312. Sheet* sheet() { return m_pSheet; }
  313. const Sheet* sheet() const { return m_pSheet; }
  314. bool hasProperty( Properties p, bool withoutParent = false ) const;
  315. /**
  316. * returns false if no currency information is set or
  317. * doesn't apply
  318. */
  319. bool currencyInfo( Currency & currency) const;
  320. TQString getCurrencySymbol() const;
  321. TQFont font() const;
  322. bool operator==( const Format& other ) const;
  323. inline bool operator!=( const Format& other ) const { return !operator==( other ); }
  324. protected:
  325. const TQPen& rightBorderPen() const;
  326. const TQPen& bottomBorderPen() const;
  327. /**
  328. * If a cell is set, marks its Layout and TextFormat as dirty.
  329. */
  330. void formatChanged();
  331. /**
  332. * If a cell is set, it returns the row format of the sheet. Otherwise, it returns 0.
  333. */
  334. virtual Format* fallbackFormat( int col, int row );
  335. /**
  336. * If a cell is set, it returns the row format of the sheet. Otherwise, it returns 0.
  337. */
  338. virtual const Format* fallbackFormat( int col, int row ) const;
  339. /**
  340. * Default implementation returns true.
  341. */
  342. virtual bool isDefault() const;
  343. Sheet * m_pSheet;
  344. Style * m_pStyle;
  345. uint m_mask;
  346. /**
  347. * used m_bNoFallBack when you put default value in a cell and
  348. * not used column/row parameters
  349. */
  350. uint m_bNoFallBack;
  351. TQ_UINT32 m_flagsMask;
  352. /**
  353. * Stores a comment string.
  354. */
  355. TQString * m_strComment;
  356. // default column width and row height
  357. static double s_columnWidth;
  358. static double s_rowHeight;
  359. private:
  360. void setProperty( Properties p );
  361. /**
  362. * Currently just used for better abstraction.
  363. */
  364. const TQPen & leftBorderPen() const;
  365. const TQPen & topBorderPen() const;
  366. const TQPen & fallDiagonalPen() const;
  367. const TQPen & goUpDiagonalPen() const;
  368. const TQBrush & backGroundBrush() const;
  369. const TQFont textFont() const;
  370. const TQPen & textPen() const;
  371. Cell* m_pCell;
  372. };
  373. /**
  374. */
  375. class KSPREAD_EXPORT RowFormat : public Format
  376. {
  377. public:
  378. RowFormat( Sheet * _sheet, int _row );
  379. ~RowFormat();
  380. DCOPObject* dcopObject();
  381. TQDomElement save( TQDomDocument&, int yshift = 0, bool copy = false ) const;
  382. bool load( const TQDomElement& row, int yshift = 0, Paste::Mode sp = Paste::Normal, bool paste = false );
  383. bool loadOasis( const TQDomElement& row, TQDomElement * rowStyle );
  384. /**
  385. * @param _canvas is needed to get information about the zooming factor.
  386. *
  387. * @return the height in zoomed pixels as integer value.
  388. */
  389. int height( const Canvas *_canvas = 0L ) const;
  390. /**
  391. * @param _canvas is needed to get information about the zooming factor.
  392. *
  393. * @return the height in zoomed pixels as double value.
  394. * Use this function, if you want to work with height without having rounding problems.
  395. */
  396. double dblHeight( const Canvas *_canvas = 0L ) const;
  397. /**
  398. * @return the height in millimeters.
  399. */
  400. double mmHeight() const;
  401. /**
  402. * Sets the height to _h zoomed pixels.
  403. *
  404. * @param _h is calculated in display pixels as integer value. The function cares for zooming.
  405. * @param _canvas is needed to get information about the zooming factor.
  406. */
  407. void setHeight( int _h, const Canvas *_canvas = 0L );
  408. /**
  409. * Sets the height to _h zoomed pixels.
  410. *
  411. * @param _h is calculated in display pixels as double value. The function cares for zooming.
  412. * Use this function when setting the height, to not get rounding problems.
  413. * @param _canvas is needed to get information about the zooming factor.
  414. */
  415. void setDblHeight( double _h, const Canvas *_canvas = 0L );
  416. /**
  417. * Sets the height.
  418. *
  419. * @param '_h' is assumed to be a unzoomed millimeter value.
  420. */
  421. void setMMHeight( double _h );
  422. /**
  423. * Use this function to tell this format that it is the default format.
  424. */
  425. void setDefault() { m_bDefault = true; }
  426. /**
  427. * @reimp
  428. */
  429. virtual bool isDefault() const;
  430. /**
  431. * @return the row for this RowFormat. May be 0 if this is the default format.
  432. *
  433. * @see #row
  434. */
  435. int row() const { return m_iRow; }
  436. void setRow( int _r ) { m_iRow = _r; }
  437. void setDisplayDirtyFlag() { m_bDisplayDirtyFlag = true; }
  438. void clearDisplayDirtyFlag() { m_bDisplayDirtyFlag = false; }
  439. RowFormat* next() const { return m_next; }
  440. RowFormat* previous() const { return m_prev; }
  441. void setNext( RowFormat* c ) { m_next = c; }
  442. void setPrevious( RowFormat* c ) { m_prev = c; }
  443. /**
  444. * @reimp
  445. */
  446. const TQPen& bottomBorderPen( int col, int row ) const;
  447. /**
  448. * @reimp
  449. */
  450. void setBottomBorderPen( const TQPen& p );
  451. /**
  452. * @reimp
  453. */
  454. const TQPen& topBorderPen( int col, int row ) const;
  455. /**
  456. * @reimp
  457. */
  458. void setTopBorderPen( const TQPen& p );
  459. /**
  460. * Sets the hide flag
  461. */
  462. void setHide( bool _hide, bool tqrepaint = true );
  463. bool isHide()const { return m_bHide;}
  464. bool operator==( const RowFormat& other ) const;
  465. inline bool operator!=( const RowFormat& other ) const { return !operator==( other ); }
  466. protected:
  467. /**
  468. * @reimp
  469. */
  470. virtual Format* fallbackFormat( int col, int row );
  471. /**
  472. * @reimp
  473. */
  474. virtual const Format* fallbackFormat( int col, int row ) const;
  475. /**
  476. * Width of the cell in unzoomed points.
  477. */
  478. double m_fHeight;
  479. /**
  480. * Flag that indicates whether this is the default format.
  481. *
  482. * @see #isDefault
  483. * @see #setDefault
  484. */
  485. bool m_bDefault;
  486. /**
  487. * This is the row to which this format belongs. If this value is 0, then
  488. * this might be the default format.
  489. *
  490. * @see #row
  491. */
  492. int m_iRow;
  493. bool m_bDisplayDirtyFlag;
  494. bool m_bHide;
  495. RowFormat* m_next;
  496. RowFormat* m_prev;
  497. DCOPObject*m_dcop;
  498. };
  499. /**
  500. */
  501. class KSPREAD_EXPORT ColumnFormat : public Format
  502. {
  503. public:
  504. ColumnFormat( Sheet *_sheet, int _column );
  505. ~ColumnFormat();
  506. TQDomElement save( TQDomDocument&, int xshift = 0, bool copy = false ) const;
  507. bool load( const TQDomElement& row, int xshift = 0,Paste::Mode sp = Paste::Normal, bool paste = false );
  508. DCOPObject* dcopObject();
  509. /**
  510. * @param _canvas is needed to get information about the zooming factor.
  511. *
  512. * @return the width in zoomed pixels as integer.
  513. */
  514. int width( const Canvas *_canvas = 0L ) const;
  515. /**
  516. * @param _canvas is needed to get information about the zooming factor.
  517. *
  518. * @return the width in zoomed pixels as double.
  519. * Use this function, if you want to use the width and later restore it back,
  520. * so you don't get rounding problems
  521. */
  522. double dblWidth( const Canvas *_canvas = 0L ) const;
  523. /**
  524. * @return the width in millimeters.
  525. */
  526. double mmWidth() const;
  527. /**
  528. * Sets the width to _w zoomed pixels.
  529. *
  530. * @param _w is calculated in display pixels. The function cares for
  531. * zooming.
  532. * @param _canvas is needed to get information about the zooming factor.
  533. */
  534. void setWidth( int _w, const Canvas *_canvas = 0L );
  535. /**
  536. * Sets the width to _w zoomed pixels as double value.
  537. * Use this function to set the width without getting rounding problems.
  538. *
  539. * @param _w is calculated in display pixels. The function cares for
  540. * zooming.
  541. * @param _canvas is needed to get information about the zooming factor.
  542. */
  543. void setDblWidth( double _w, const Canvas *_canvas = 0L );
  544. /**
  545. * Sets the width.
  546. *
  547. * @param _w is assumed to be a unzoomed millimeter value.
  548. */
  549. void setMMWidth( double _w );
  550. /**
  551. * Use this function to tell this format that it is the default format.
  552. */
  553. void setDefault() { m_bDefault = true; }
  554. /**
  555. * @reimp
  556. */
  557. virtual bool isDefault() const;
  558. /**
  559. * @return the column of this ColumnFormat. May be 0 if this is the default format.
  560. *
  561. * @see #column
  562. */
  563. int column() const { return m_iColumn; }
  564. void setColumn( int _c ) { m_iColumn = _c; }
  565. void setDisplayDirtyFlag() { m_bDisplayDirtyFlag = true; }
  566. void clearDisplayDirtyFlag() { m_bDisplayDirtyFlag = false; }
  567. ColumnFormat* next() const { return m_next; }
  568. ColumnFormat* previous() const { return m_prev; }
  569. void setNext( ColumnFormat* c ) { m_next = c; }
  570. void setPrevious( ColumnFormat* c ) { m_prev = c; }
  571. /**
  572. * @reimp
  573. */
  574. virtual const TQPen& rightBorderPen( int col, int row ) const;
  575. /**
  576. * @reimp
  577. */
  578. virtual void setRightBorderPen( const TQPen& p );
  579. /**
  580. * @reimp
  581. */
  582. virtual const TQPen& leftBorderPen( int col, int row ) const;
  583. /**
  584. * @reimp
  585. */
  586. virtual void setLeftBorderPen( const TQPen& p );
  587. void setHide( bool _hide );
  588. bool isHide()const { return m_bHide;}
  589. bool operator==( const ColumnFormat& other ) const;
  590. inline bool operator!=( const ColumnFormat& other ) const { return !operator==( other ); }
  591. protected:
  592. /**
  593. * @reimp
  594. */
  595. Format* fallbackFormat( int col, int row );
  596. /**
  597. * @reimp
  598. */
  599. const Format* fallbackFormat( int col, int row ) const;
  600. /**
  601. * Width of the cells in unzoomed pixels.
  602. */
  603. double m_fWidth;
  604. /**
  605. * Flag that indicates whether this is the default format.
  606. *
  607. * @see #isDefault
  608. * @see #setDefault
  609. */
  610. bool m_bDefault;
  611. /**
  612. * This is the column to which this format belongs. If this value is 0, then
  613. * this might be the default format.
  614. *
  615. * @see #column
  616. */
  617. int m_iColumn;
  618. bool m_bDisplayDirtyFlag;
  619. bool m_bHide;
  620. ColumnFormat* m_next;
  621. ColumnFormat* m_prev;
  622. DCOPObject*m_dcop;
  623. };
  624. class KSPREAD_EXPORT Currency
  625. {
  626. public:
  627. enum currencyFormat { Native, Gnumeric, OpenCalc, ApplixSpread,
  628. GobeProductiveSpread, HancomSheet };
  629. Currency();
  630. ~Currency();
  631. Currency(int index);
  632. /**
  633. * If code doesn't fit to index the index gets ignored
  634. */
  635. Currency(int index, TQString const & code);
  636. /**
  637. * code: e.g. EUR, USD,..
  638. * Looks up index, if code found more than once: saved without country info
  639. * currencyFormat: in Gnumeric the code is: [$EUR]
  640. * saves some work in the filter...
  641. */
  642. Currency(TQString const & code, currencyFormat format = Native);
  643. Currency & operator=(int type);
  644. Currency & operator=(char const * code);
  645. bool operator==(Currency const & cur) const;
  646. bool operator==(int type) const;
  647. operator int() const;
  648. TQString getCode() const;
  649. TQString getCountry() const;
  650. TQString getName() const;
  651. TQString getDisplayCode() const;
  652. int getIndex() const;
  653. static TQString getChooseString(int type, bool & ok);
  654. static TQString getDisplaySymbol(int type);
  655. static TQString getCurrencyCode( int type);
  656. /**
  657. * Code for use in Gnumeric export filter
  658. */
  659. TQString getExportCode(currencyFormat format) const;
  660. private:
  661. int m_type;
  662. TQString m_code;
  663. };
  664. } // namespace KSpread
  665. #endif