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 <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
MWAWEntry
;
53
class
MWAWParserState
;
54
typedef
shared_ptr<MWAWParserState>
MWAWParserStatePtr
;
55
56
class
CWParser
;
57
58
namespace
CWStyleManagerInternal
59
{
60
struct
State;
61
}
62
64
class
CWStyleManager
65
{
66
public
:
67
struct
Graphic
;
68
struct
KSEN
;
69
struct
Style
;
70
public
:
72
CWStyleManager
(
CWParser
&mainParser);
74
~CWStyleManager
();
75
76
/* try to read the styles definition (in v4-6) */
77
bool
readStyles
(
MWAWEntry
const
&entry);
78
80
int
getFontId
(
int
localId)
const
;
81
83
bool
get
(
int
styleId,
Style
&style)
const
;
85
bool
get
(
int
ksenId,
KSEN
&ksen)
const
;
87
bool
get
(
int
graphId,
Graphic
&graph)
const
;
88
89
protected
:
91
int
version
()
const
;
92
94
bool
readGenStyle
(
int
id
);
95
97
bool
readStylesDef
(
int
N,
int
fSz);
99
bool
readLookUp
(
int
N,
int
fSz);
100
101
/* read the STYL CELL sequence */
102
bool
readCellStyles
(
int
N,
int
fSz);
104
bool
readFontNames
(
int
N,
int
fSz);
106
bool
readGraphStyles
(
int
N,
int
fSz);
108
bool
readKSEN
(
int
N,
int
fSz);
110
bool
readStyleNames
(
int
N,
int
fSz);
111
112
protected
:
114
MWAWParserStatePtr
m_parserState
;
116
CWParser
*
m_mainParser
;
118
shared_ptr<CWStyleManagerInternal::State>
m_state
;
119
120
private
:
121
CWStyleManager
(
CWStyleManager
const
&orig);
122
CWStyleManager
&
operator=
(
CWStyleManager
const
&orig);
123
124
public
:
126
struct
Graphic
{
128
Graphic
() :
m_lineWidth
(1),
m_extra
(
""
) {
129
for
(
int
i = 0; i < 2; i++) {
130
m_pattern
[i] = -1;
131
m_patternPercent
[i] = 1;
132
}
133
m_color
[0] =
MWAWColor::black
();
134
m_color
[1] =
MWAWColor::white
();
135
}
137
MWAWColor
getLineColor
()
const
;
139
MWAWColor
getSurfaceColor
()
const
;
141
friend
std::ostream &
operator<<
(std::ostream &o,
Graphic
const
&graph);
143
int
m_lineWidth
;
145
MWAWColor
m_color
[2];
147
int
m_pattern
[2];
149
float
m_patternPercent
[2];
151
std::string
m_extra
;
152
};
153
155
struct
KSEN
{
157
KSEN
() :
m_valign
(0),
m_lineType
(
MWAWBorder
::Simple),
m_lineRepeat
(
MWAWBorder
::Single),
m_lines
(0),
m_extra
(
""
) {
158
}
160
friend
std::ostream &
operator<<
(std::ostream &o,
KSEN
const
&ksen);
162
int
m_valign
;
164
MWAWBorder::Style
m_lineType
;
166
MWAWBorder::Type
m_lineRepeat
;
168
int
m_lines
;
170
std::string
m_extra
;
171
};
172
174
struct
Style
{
176
Style
() :
m_fontId
(-1),
m_fontHash
(-1),
m_rulerId
(-1),
m_rulerHash
(-1),
m_ksenId
(-1),
m_graphicId
(-1),
m_localStyleId
(-1),
m_styleId
(-1),
m_extra
(
""
) {
177
}
178
180
friend
std::ostream &
operator<<
(std::ostream &o,
Style
const
&style);
181
183
int
m_fontId
;
185
int
m_fontHash
;
187
int
m_rulerId
;
189
int
m_rulerHash
;
191
int
m_ksenId
;
193
int
m_graphicId
;
195
int
m_localStyleId
;
197
int
m_styleId
;
199
std::string
m_extra
;
200
};
201
};
202
203
#endif
Generated on Sat May 4 2013 11:47:10 for libmwaw by
doxygen
1.8.3.1