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 <map>
43 #include <set>
44 #include <string>
45 #include <vector>
46 
47 #include "libmwaw_internal.hxx"
48 
49 #include "MWAWDebug.hxx"
50 #include "MWAWInputStream.hxx"
51 
52 class CWParser;
53 
54 namespace CWStyleManagerInternal
55 {
56 struct State;
57 }
58 
61 {
62 public:
63  struct Graphic;
64  struct KSEN;
65  struct Style;
66 public:
68  CWStyleManager(CWParser &mainParser);
71 
72  /* try to read the styles definition (in v4-6) */
73  bool readStyles(MWAWEntry const &entry);
74 
76  int getFontId(int localId) const;
77 
79  bool get(int styleId, Style &style) const;
81  bool get(int ksenId, KSEN &ksen) const;
83  bool get(int graphId, Graphic &graph) const;
84 
85 protected:
87  int version() const;
88 
90  bool readGenStyle(int id);
91 
93  bool readStylesDef(int N, int fSz);
95  bool readLookUp(int N, int fSz);
96 
97  /* read the STYL CELL sequence */
98  bool readCellStyles(int N, int fSz);
100  bool readFontNames(int N, int fSz);
102  bool readGraphStyles(int N, int fSz);
104  bool readKSEN(int N, int fSz);
106  bool readStyleNames(int N, int fSz);
107 
108 protected:
114  shared_ptr<CWStyleManagerInternal::State> m_state;
115 
116 private:
117  CWStyleManager(CWStyleManager const &orig);
119 
120 public:
122  struct Graphic {
125  for (int i = 0; i < 2; i++) {
126  m_pattern[i] = -1;
127  m_patternPercent[i] = 1;
128  }
129  m_color[0] = MWAWColor::black();
130  m_color[1] = MWAWColor::white();
131  }
133  MWAWColor getLineColor() const;
135  MWAWColor getSurfaceColor() const;
137  friend std::ostream &operator<<(std::ostream &o, Graphic const &graph);
143  int m_pattern[2];
147  std::string m_extra;
148  };
149 
151  struct KSEN {
153  KSEN() : m_valign(0), m_lineType(MWAWBorder::Simple), m_lineRepeat(MWAWBorder::Single), m_lines(0), m_extra("") {
154  }
156  friend std::ostream &operator<<(std::ostream &o, KSEN const &ksen);
158  int m_valign;
164  int m_lines;
166  std::string m_extra;
167  };
168 
170  struct Style {
173  }
174 
176  friend std::ostream &operator<<(std::ostream &o, Style const &style);
177 
179  int m_fontId;
187  int m_ksenId;
195  std::string m_extra;
196  };
197 };
198 
199 #endif
Style()
constructor
Definition: CWStyleManager.hxx:172
std::string m_extra
extra data
Definition: CWStyleManager.hxx:195
int m_fontHash
the fontHash id
Definition: CWStyleManager.hxx:181
a structure to store the style list and the lookup zone
Definition: CWStyleManager.hxx:60
bool readStylesDef(int N, int fSz)
try to read the style definition zone
Definition: CWStyleManager.cxx:402
static MWAWColor white()
return the white color
Definition: libmwaw_internal.hxx:179
int m_pattern[2]
the line an surface pattern id
Definition: CWStyleManager.hxx:143
CWStyleManager & operator=(CWStyleManager const &orig)
bool readStyles(MWAWEntry const &entry)
Definition: CWStyleManager.cxx:269
int getFontId(int localId) const
return a mac font id corresponding to a local id
Definition: CWStyleManager.cxx:225
CWParser * m_mainParser
the main parser
Definition: CWStyleManager.hxx:112
MWAWParserStatePtr m_parserState
the parser state
Definition: CWStyleManager.hxx:110
static MWAWColor black()
return the back color
Definition: libmwaw_internal.hxx:175
MWAWColor m_color[2]
the line and surface color
Definition: CWStyleManager.hxx:141
the structure to store the style in a CWStyleManager
Definition: CWStyleManager.hxx:170
the KSEN structure a structure related to paragraph and cell style
Definition: CWStyleManager.hxx:151
std::string m_extra
extra data
Definition: CWStyleManager.hxx:147
int m_graphicId
the graphic (checkme)
Definition: CWStyleManager.hxx:189
int m_localStyleId
a local style id
Definition: CWStyleManager.hxx:191
Type
the line repetition
Definition: libmwaw_internal.hxx:236
the Graphic structure in a CWStyleManager
Definition: CWStyleManager.hxx:122
the class to store a color
Definition: libmwaw_internal.hxx:161
std::string m_extra
extra data
Definition: CWStyleManager.hxx:166
Style
the line style
Definition: libmwaw_internal.hxx:234
MWAWBorder::Type m_lineRepeat
the line repetition
Definition: CWStyleManager.hxx:162
friend std::ostream & operator<<(std::ostream &o, Style const &style)
operator&lt;&lt;
Definition: CWStyleManager.cxx:185
a border
Definition: libmwaw_internal.hxx:232
bool readGraphStyles(int N, int fSz)
read a Graphic sequence
Definition: CWStyleManager.cxx:649
shared_ptr< CWStyleManagerInternal::State > m_state
the state
Definition: CWStyleManager.hxx:114
friend std::ostream & operator<<(std::ostream &o, Graphic const &graph)
operator&lt;&lt;
Definition: CWStyleManager.cxx:82
int m_rulerId
the ruler
Definition: CWStyleManager.hxx:183
int m_fontId
the char
Definition: CWStyleManager.hxx:179
MWAWColor getLineColor() const
returns the line color
Definition: CWStyleManager.cxx:98
bool readStyleNames(int N, int fSz)
read a STYL Name sequence
Definition: CWStyleManager.cxx:562
Graphic()
constructor
Definition: CWStyleManager.hxx:124
MWAWColor getSurfaceColor() const
returns the surface color
Definition: CWStyleManager.cxx:105
int m_rulerHash
the rulerHash id
Definition: CWStyleManager.hxx:185
int m_lineWidth
the line width
Definition: CWStyleManager.hxx:139
the main class to read a Claris Works file
Definition: CWParser.hxx:73
int m_lines
an int used to add some oblique line ( or cross )
Definition: CWStyleManager.hxx:164
MWAWBorder::Style m_lineType
the line type
Definition: CWStyleManager.hxx:160
friend std::ostream & operator<<(std::ostream &o, KSEN const &ksen)
operator&lt;&lt;
Definition: CWStyleManager.cxx:115
bool readGenStyle(int id)
try to read a STYL_ subzone (in v4-6)
Definition: CWStyleManager.cxx:316
bool readLookUp(int N, int fSz)
try to read the lookup zone
Definition: CWStyleManager.cxx:463
~CWStyleManager()
destructor
Definition: CWStyleManager.cxx:214
bool readCellStyles(int N, int fSz)
Definition: CWStyleManager.cxx:601
int m_styleId
the style id
Definition: CWStyleManager.hxx:193
int m_ksenId
the ksen id
Definition: CWStyleManager.hxx:187
bool readKSEN(int N, int fSz)
read a KSEN sequence
Definition: CWStyleManager.cxx:731
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:342
KSEN()
constructor
Definition: CWStyleManager.hxx:153
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:218
CWStyleManager(CWParser &mainParser)
constructor
Definition: CWStyleManager.cxx:208
bool readFontNames(int N, int fSz)
read the font name style zone
Definition: CWStyleManager.cxx:500
int m_valign
the vertical alignement
Definition: CWStyleManager.hxx:158
float m_patternPercent[2]
the line an surface pattern percent
Definition: CWStyleManager.hxx:145

Generated on Fri May 2 2014 17:42:20 for libmwaw by doxygen 1.8.5