~ubuntu-branches/ubuntu/breezy/koffice/breezy

« back to all changes in this revision

Viewing changes to filters/kspread/opencalc/opencalcstyleexport.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2003 Norbert Andres <nandres@web.de>
 
3
 
 
4
   This library is free software; you can redistribute it and/or
 
5
   modify it under the terms of the GNU Library General Public
 
6
   License as published by the Free Software Foundation; either
 
7
   version 2 of the License, or (at your option) any later version.
 
8
 
 
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
 
 
14
   You should have received a copy of the GNU Library General Public License
 
15
   along with this library; see the file COPYING.LIB.  If not, write to
 
16
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
17
   Boston, MA 02111-1307, USA.
 
18
*/
 
19
 
 
20
 
 
21
#ifndef OPENCALCSTYLEEXPORT_H
 
22
#define OPENCALCSTYLEEXPORT_H
 
23
 
 
24
#include "kspread_format.h"
 
25
 
 
26
#include <qcolor.h>
 
27
#include <qfont.h>
 
28
#include <qptrlist.h>
 
29
#include <qstring.h>
 
30
 
 
31
class KSpreadCell;
 
32
 
 
33
class QDomDocument;
 
34
class QDomElement;
 
35
 
 
36
typedef enum T1 { Boolean, Date, Number, Percentage, Time } NumberType;
 
37
 
 
38
class Style
 
39
{
 
40
 public:
 
41
  enum breakBefore { none, automatic, page };
 
42
 
 
43
  Style() : breakB( none ), size( 0.0 ) {}
 
44
 
 
45
  QString name;
 
46
  uint    breakB;
 
47
  double  size;
 
48
};
 
49
 
 
50
class SheetStyle
 
51
{
 
52
 public:
 
53
  SheetStyle() : visible( true ) {}
 
54
 
 
55
  void copyData( SheetStyle const & ts ) { visible = ts.visible; }
 
56
  static bool isEqual( SheetStyle const * const t1, SheetStyle const & t2 );
 
57
 
 
58
  QString     name;
 
59
  bool        visible;
 
60
};
 
61
 
 
62
class NumberStyle
 
63
{
 
64
 public:
 
65
  NumberStyle() {}
 
66
 
 
67
  void copyData( NumberStyle const & ts ) { type = ts.type; }
 
68
  static bool isEqual( NumberStyle const * const t1, NumberStyle const & t2 );
 
69
 
 
70
  QString     name;
 
71
 
 
72
  NumberType  type;
 
73
  QString     pattern;
 
74
};
 
75
 
 
76
class CellStyle
 
77
{
 
78
 public:
 
79
  CellStyle();
 
80
 
 
81
  void copyData( CellStyle const & ts );
 
82
  static bool isEqual( CellStyle const * const t1, CellStyle const & t2 );
 
83
 
 
84
  // all except the number style
 
85
  static void loadData( CellStyle & cs, KSpreadCell const * const cell );
 
86
 
 
87
  QString     name;
 
88
 
 
89
  QFont       font;
 
90
  QString     numberStyle;
 
91
  QColor      color;
 
92
  QColor      bgColor;
 
93
  double      indent;
 
94
  bool        wrap;
 
95
  bool        vertical;
 
96
  int         angle;
 
97
  bool        print;
 
98
  QPen        left;
 
99
  QPen        right;
 
100
  QPen        top;
 
101
  QPen        bottom;
 
102
  bool        hideAll;
 
103
  bool        hideFormula;
 
104
  bool        notProtected;
 
105
 
 
106
  KSpreadFormat::Align  alignX;
 
107
  KSpreadFormat::AlignY alignY;
 
108
};
 
109
 
 
110
class ColumnStyle : public Style 
 
111
{
 
112
 public:
 
113
  ColumnStyle() : Style() {}
 
114
 
 
115
  void copyData( ColumnStyle const & cs );
 
116
  static bool isEqual( ColumnStyle const * const c1, ColumnStyle const & c2 );
 
117
};
 
118
 
 
119
class RowStyle : public Style 
 
120
{
 
121
 public:
 
122
  RowStyle() : Style() {}
 
123
 
 
124
  void copyData( RowStyle const & cs );
 
125
  static bool isEqual( RowStyle const * const c1, RowStyle const & c2 );
 
126
};
 
127
 
 
128
class OpenCalcStyles
 
129
{
 
130
 public:
 
131
  OpenCalcStyles();
 
132
  ~OpenCalcStyles();
 
133
 
 
134
  void    writeStyles  ( QDomDocument & doc, QDomElement & autoStyles );
 
135
  void    writeFontDecl( QDomDocument & doc, QDomElement & content );
 
136
 
 
137
  void    addFont( QFont const & font, bool def = false );
 
138
 
 
139
  QString cellStyle( CellStyle const & cs );
 
140
  QString columnStyle( ColumnStyle const & cs );
 
141
  QString numberStyle( NumberStyle const & ns );
 
142
  QString rowStyle( RowStyle const & rs );
 
143
  QString sheetStyle( SheetStyle const & ts );
 
144
 
 
145
 private:
 
146
  QPtrList<CellStyle>   m_cellStyles;
 
147
  QPtrList<ColumnStyle> m_columnStyles;
 
148
  QPtrList<NumberStyle> m_numberStyles;
 
149
  QPtrList<RowStyle>    m_rowStyles;
 
150
  QPtrList<SheetStyle>  m_sheetStyles;
 
151
  QPtrList<QFont>       m_fontList;
 
152
 
 
153
  QFont                 m_defaultFont;
 
154
 
 
155
  void addCellStyles( QDomDocument & doc, QDomElement & autoStyles );
 
156
  void addColumnStyles( QDomDocument & doc, QDomElement & autoStyles );
 
157
  void addNumberStyles( QDomDocument & doc, QDomElement & autoStyles );
 
158
  void addRowStyles( QDomDocument & doc, QDomElement & autoStyles );
 
159
  void addSheetStyles( QDomDocument & doc, QDomElement & autoStyles );
 
160
};
 
161
 
 
162
#endif