Main Page
Namespaces
Classes
Files
File List
File Members
MSWTextStyles.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 to read/store the text font and paragraph styles
36
*/
37
38
#ifndef MSW_TEXT_STYLES
39
# define MSW_TEXT_STYLES
40
41
#include <iostream>
42
#include <string>
43
44
#include "
libmwaw_internal.hxx
"
45
46
#include "
MWAWEntry.hxx
"
47
#include "
MWAWParagraph.hxx
"
48
49
class
MSWParser
;
50
class
MSWText
;
51
52
namespace
MSWStruct
53
{
54
struct
Font;
55
struct
Paragraph;
56
struct
Section;
57
}
58
59
namespace
MSWTextStylesInternal
60
{
61
struct
State;
62
}
63
65
class
MSWTextStyles
66
{
67
friend
class
MSWText
;
68
public
:
69
enum
ZoneType
{
TextZone
,
TextStructZone
,
StyleZone
,
InParagraphDefinition
};
71
MSWTextStyles
(
MSWText
&textParser);
73
virtual
~MSWTextStyles
();
74
76
int
version
()
const
;
77
78
protected
:
79
// font:
81
MWAWFont
const
&
getDefaultFont
()
const
;
83
bool
getFont
(
ZoneType
type,
int
id
,
MSWStruct::Font
&actFont);
84
/* try to send a font. If so, update the font */
85
bool
sendFont
(
ZoneType
type,
int
id
,
MSWStruct::Font
&actFont);
86
87
/* send a font */
88
void
setProperty
(
MSWStruct::Font
const
&font);
92
bool
readFont
(
MSWStruct::Font
&font,
ZoneType
type);
93
94
// pararagraph:
96
bool
getParagraph
(
ZoneType
type,
int
id
,
MSWStruct::Paragraph
¶);
98
bool
readParagraph
(
MSWStruct::Paragraph
¶,
int
dataSz=-1);
100
void
sendDefaultParagraph
();
101
103
void
setProperty
(
MSWStruct::Paragraph
const
¶,
bool
recursifCall=
false
);
104
106
bool
readPLCList
(
MSWEntry
&entry);
108
bool
readTextStructList
(
MSWEntry
&entry);
111
int
readPropertyModifier
(
bool
&complex, std::string &extra);
113
bool
readPLC
(
MSWEntry
&entry,
int
type,
Vec2<long>
const
&fileLimit);
114
115
// section:
117
bool
getSection
(
ZoneType
type,
int
id
,
MSWStruct::Section
§ion);
119
bool
getSectionParagraph
(
ZoneType
type,
int
id
,
MSWStruct::Paragraph
¶);
121
bool
getSectionFont
(
ZoneType
type,
int
id
,
MSWStruct::Font
&font);
123
bool
readSection
(
MSWEntry
&entry);
125
bool
sendSection
(
int
id
);
126
128
bool
readSection
(
MSWStruct::Section
§ion,
long
pos);
130
void
setProperty
(
MSWStruct::Section
const
&sec);
131
133
bool
readStyles
(
MSWEntry
&entry);
135
bool
readStylesHierarchy
(
MSWEntry
&entry,
int
N, std::vector<int> &previous);
137
bool
readStylesNames
(
MSWEntry
const
&zone,
int
N,
int
&Nnamed);
139
bool
readStylesFont
(
MSWEntry
&zone,
int
N, std::vector<int>
const
&previous,
140
std::vector<int>
const
&order);
142
bool
readStylesParagraph
(
MSWEntry
&zone,
int
N, std::vector<int>
const
&previous,
143
std::vector<int>
const
&order);
145
static
std::vector<int>
orderStyles
(std::vector<int>
const
&previous);
146
147
private
:
148
MSWTextStyles
(
MSWTextStyles
const
&orig);
149
MSWTextStyles
&
operator=
(
MSWTextStyles
const
&orig);
150
151
protected
:
152
//
153
// data
154
//
156
MWAWParserStatePtr
m_parserState
;
157
159
shared_ptr<MSWTextStylesInternal::State>
m_state
;
160
162
MSWParser
*
m_mainParser
;
163
165
MSWText
*
m_textParser
;
166
};
167
#endif
168
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Generated on Wed Jul 10 2013 18:15:30 for libmwaw by
doxygen
1.8.4