CWStyleManager.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2 
3 /* libmwaw
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33 
34 /*
35  * Class used to read main style by Claris Works parser
36  *
37  */
38 #ifndef CW_STYLE_MANAGER
39 # define CW_STYLE_MANAGER
40 
41 #include <iostream>
42 #include <string>
43 #include <vector>
44 
45 #include "libmwaw_internal.hxx"
46 
47 #include "MWAWDebug.hxx"
48 #include "MWAWGraphicStyle.hxx"
49 #include "MWAWInputStream.hxx"
50 
51 class CWParser;
52 
53 namespace CWStyleManagerInternal
54 {
55 struct State;
56 }
57 
60 {
61 public:
62  struct CellFormat;
63  struct KSEN;
64  struct Style;
65 public:
67  CWStyleManager(CWParser &mainParser);
70 
72  bool readColorList(MWAWEntry const &entry);
74  bool readPatternList(long endPos=-1);
76  bool readGradientList(long endPos=-1);
78  bool readStyles(MWAWEntry const &entry);
80  bool updateGradient(int grad, MWAWGraphicStyle &style) const;
82  bool updateWallPaper(int wall, MWAWGraphicStyle &style) const;
83 
85  int getFontId(int localId) const;
87  bool getColor(int id, MWAWColor &col) const;
89  bool getPattern(int id, MWAWGraphicStyle::Pattern &pattern, float &percent) const;
90 
92  bool get(int styleId, Style &style) const;
94  bool get(int fontId, MWAWFont &font) const;
96  bool get(int formatId, CellFormat &format) const;
98  bool get(int ksenId, KSEN &ksen) const;
100  bool get(int graphId, MWAWGraphicStyle &graph) const;
101 
103  bool readFont(int id, int fontSize, MWAWFont &font);
104 
105 protected:
107  int version() const;
108 
110  bool readGenStyle(int id);
111 
113  bool readStylesDef(int N, int fSz);
115  bool readLookUp(int N, int fSz);
116 
117  /* read the STYL CELL sequence */
118  bool readCellStyles(int N, int fSz);
120  bool readFontNames(int N, int fSz);
122  bool readGraphStyles(int N, int fSz);
124  bool readKSEN(int N, int fSz);
126  bool readStyleNames(int N, int fSz);
128  bool readStyleFonts(int N, int fSz);
129 
130 protected:
136  shared_ptr<CWStyleManagerInternal::State> m_state;
137 
138 private:
139  CWStyleManager(CWStyleManager const &orig);
141 
142 public:
144  struct CellFormat {
147  }
149  friend std::ostream &operator<<(std::ostream &o, CellFormat const &form);
153  int m_format;
161  bool m_wrap;
163  std::string m_extra;
164  };
165 
167  struct KSEN {
169  KSEN() : m_valign(0), m_lineType(MWAWBorder::Simple), m_lineRepeat(MWAWBorder::Single), m_lines(0), m_extra("") {
170  }
172  friend std::ostream &operator<<(std::ostream &o, KSEN const &ksen);
174  int m_valign;
180  int m_lines;
182  std::string m_extra;
183  };
184 
186  struct Style {
189  }
190 
192  friend std::ostream &operator<<(std::ostream &o, Style const &style);
193 
195  int m_fontId;
203  int m_ksenId;
211  std::string m_extra;
212  };
213 };
214 
215 #endif
Style()
constructor
Definition: CWStyleManager.hxx:188
std::string m_extra
extra data
Definition: CWStyleManager.hxx:211
std::string m_extra
extra data
Definition: CWStyleManager.hxx:163
a structure to store the style list and the lookup zone
Definition: CWStyleManager.hxx:59
bool readPatternList(long endPos=-1)
reads a pattern map zone ( v2)
Definition: CWStyleManager.cxx:1694
bool readStylesDef(int N, int fSz)
try to read the style definition zone
Definition: CWStyleManager.cxx:2040
bool m_separateThousand
true if we need to add separator for thousand
Definition: CWStyleManager.hxx:157
CWStyleManager & operator=(CWStyleManager const &orig)
bool readStyles(MWAWEntry const &entry)
try to read the styles definition (in v4-6)
Definition: CWStyleManager.cxx:1889
int getFontId(int localId) const
return a mac font id corresponding to a local id
Definition: CWStyleManager.cxx:1600
CWParser * m_mainParser
the main parser
Definition: CWStyleManager.hxx:134
MWAWParserStatePtr m_parserState
the parser state
Definition: CWStyleManager.hxx:132
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:47
the structure to store the style in a CWStyleManager
Definition: CWStyleManager.hxx:186
the KSEN structure a structure related to paragraph and cell style
Definition: CWStyleManager.hxx:167
int m_graphicId
the graphic (checkme)
Definition: CWStyleManager.hxx:205
int m_localStyleId
a local style id
Definition: CWStyleManager.hxx:207
bool readGradientList(long endPos=-1)
reads a gradient map zone ( v2)
Definition: CWStyleManager.cxx:1753
Type
the line repetition
Definition: libmwaw_internal.hxx:241
the class to store a color
Definition: libmwaw_internal.hxx:166
std::string m_extra
extra data
Definition: CWStyleManager.hxx:182
Style
the line style
Definition: libmwaw_internal.hxx:239
MWAWBorder::Type m_lineRepeat
the line repetition
Definition: CWStyleManager.hxx:178
friend std::ostream & operator<<(std::ostream &o, Style const &style)
operator&lt;&lt;
Definition: CWStyleManager.cxx:1523
int m_justify
the justification: 0:default, 1: left, 2: center, 3: right
Definition: CWStyleManager.hxx:151
a border
Definition: libmwaw_internal.hxx:237
bool readGraphStyles(int N, int fSz)
read a GraphicStyle sequence
Definition: CWStyleManager.cxx:2407
shared_ptr< CWStyleManagerInternal::State > m_state
the state
Definition: CWStyleManager.hxx:136
int m_rulerId
the ruler
Definition: CWStyleManager.hxx:199
bool updateGradient(int grad, MWAWGraphicStyle &style) const
update a style using a gradiant id
Definition: CWStyleManager.cxx:1652
int m_fontId
the char
Definition: CWStyleManager.hxx:195
bool readStyleFonts(int N, int fSz)
read a STYL_CHAR Font sequence
Definition: CWStyleManager.cxx:2276
friend std::ostream & operator<<(std::ostream &o, CellFormat const &form)
operator&lt;&lt;
Definition: CWStyleManager.cxx:2570
bool readStyleNames(int N, int fSz)
read a STYL Name sequence
Definition: CWStyleManager.cxx:2305
int m_rulerHash
the rulerHash id
Definition: CWStyleManager.hxx:201
the CELL structure a structure related to number/date format
Definition: CWStyleManager.hxx:144
the main class to read a Claris Works file
Definition: CWParser.hxx:73
bool readFont(int id, int fontSize, MWAWFont &font)
try to read a named font
Definition: CWStyleManager.cxx:2200
int m_lines
an int used to add some oblique line ( or cross )
Definition: CWStyleManager.hxx:180
MWAWBorder::Style m_lineType
the line type
Definition: CWStyleManager.hxx:176
friend std::ostream & operator<<(std::ostream &o, KSEN const &ksen)
operator&lt;&lt;
Definition: CWStyleManager.cxx:1453
bool readGenStyle(int id)
try to read a STYL_ subzone (in v4-6)
Definition: CWStyleManager.cxx:1937
bool readLookUp(int N, int fSz)
try to read the lookup zone
Definition: CWStyleManager.cxx:2101
~CWStyleManager()
destructor
Definition: CWStyleManager.cxx:1554
bool getColor(int id, MWAWColor &col) const
return the color which corresponds to an id (if possible)
Definition: CWStyleManager.cxx:1574
bool getPattern(int id, MWAWGraphicStyle::Pattern &pattern, float &percent) const
return the pattern which corresponds to an id.
Definition: CWStyleManager.cxx:1587
bool readColorList(MWAWEntry const &entry)
reads a color map zone ( v4-v6)
Definition: CWStyleManager.cxx:1840
bool readCellStyles(int N, int fSz)
Definition: CWStyleManager.cxx:2344
CellFormat()
constructor
Definition: CWStyleManager.hxx:146
int m_styleId
the style id
Definition: CWStyleManager.hxx:209
int m_ksenId
the ksen id
Definition: CWStyleManager.hxx:203
bool readKSEN(int N, int fSz)
read a KSEN sequence
Definition: CWStyleManager.cxx:2500
int m_numDigits
the number of digit after the commat
Definition: CWStyleManager.hxx:155
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:356
int m_format
the field format: number, string, currency, ..
Definition: CWStyleManager.hxx:153
KSEN()
constructor
Definition: CWStyleManager.hxx:169
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
int version() const
return the file version
Definition: CWStyleManager.cxx:1558
bool updateWallPaper(int wall, MWAWGraphicStyle &style) const
update a style using a wall paper id
Definition: CWStyleManager.cxx:1672
bool m_parentheseNegatif
true if negatif number are printed with parentheses
Definition: CWStyleManager.hxx:159
int m_cellFormatId
the formatId
Definition: CWStyleManager.hxx:197
CWStyleManager(CWParser &mainParser)
constructor
Definition: CWStyleManager.cxx:1548
a basic pattern used in a MWAWGraphicStyle:
Definition: MWAWGraphicStyle.hxx:92
bool readFontNames(int N, int fSz)
read the font name style zone
Definition: CWStyleManager.cxx:2138
int m_valign
the vertical alignement
Definition: CWStyleManager.hxx:174
bool m_wrap
true if the cell content is wrapped
Definition: CWStyleManager.hxx:161

Generated on Tue Mar 10 2015 17:32:08 for libmwaw by doxygen 1.8.5