Main Page
Namespaces
Classes
Files
File List
File Members
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
59
class
CWStyleManager
60
{
61
public
:
62
struct
CellFormat
;
63
struct
KSEN
;
64
struct
Style
;
65
public
:
67
CWStyleManager
(
CWParser
&mainParser);
69
~CWStyleManager
();
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
:
132
MWAWParserStatePtr
m_parserState
;
134
CWParser
*
m_mainParser
;
136
shared_ptr<CWStyleManagerInternal::State>
m_state
;
137
138
private
:
139
CWStyleManager
(
CWStyleManager
const
&orig);
140
CWStyleManager
&
operator=
(
CWStyleManager
const
&orig);
141
142
public
:
144
struct
CellFormat
{
146
CellFormat
() :
m_justify
(0),
m_format
(-1),
m_numDigits
(2),
m_separateThousand
(false),
m_parentheseNegatif
(false),
m_wrap
(false),
m_extra
(
""
) {
147
}
149
friend
std::ostream &
operator<<
(std::ostream &o,
CellFormat
const
&form);
151
int
m_justify
;
153
int
m_format
;
155
int
m_numDigits
;
157
bool
m_separateThousand
;
159
bool
m_parentheseNegatif
;
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
;
176
MWAWBorder::Style
m_lineType
;
178
MWAWBorder::Type
m_lineRepeat
;
180
int
m_lines
;
182
std::string
m_extra
;
183
};
184
186
struct
Style
{
188
Style
() :
m_fontId
(-1),
m_cellFormatId
(-1),
m_rulerId
(-1),
m_rulerHash
(-1),
m_ksenId
(-1),
m_graphicId
(-1),
m_localStyleId
(-1),
m_styleId
(-1),
m_extra
(
""
) {
189
}
190
192
friend
std::ostream &
operator<<
(std::ostream &o,
Style
const
&style);
193
195
int
m_fontId
;
197
int
m_cellFormatId
;
199
int
m_rulerId
;
201
int
m_rulerHash
;
203
int
m_ksenId
;
205
int
m_graphicId
;
207
int
m_localStyleId
;
209
int
m_styleId
;
211
std::string
m_extra
;
212
};
213
};
214
215
#endif
Generated on Wed May 7 2014 00:30:15 for libmwaw by
doxygen
1.8.3.1