Main Page
Namespaces
Classes
Files
File List
File Members
MWAWList.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
#ifndef MWAW_LIST_H
35
# define MWAW_LIST_H
36
37
#include <iostream>
38
39
#include <vector>
40
41
#include <librevenge/librevenge.h>
42
44
struct
MWAWListLevel
{
46
enum
Type
{
DEFAULT
,
NONE
,
BULLET
,
DECIMAL
,
LOWER_ALPHA
,
UPPER_ALPHA
,
47
LOWER_ROMAN
,
UPPER_ROMAN
,
LABEL
48
};
50
enum
Alignment
{
LEFT
,
RIGHT
,
CENTER
};
51
53
MWAWListLevel
() :
m_type
(
NONE
),
m_labelBeforeSpace
(0.0),
m_labelWidth
(0.1),
m_labelAfterSpace
(0.0),
m_numBeforeLabels
(0),
m_alignment
(
LEFT
),
m_startValue
(0),
54
m_label
(
""
),
m_prefix
(
""
),
m_suffix
(
""
),
m_bullet
(
""
),
m_extra
(
""
)
55
{
56
}
58
~MWAWListLevel
() {}
59
61
bool
isDefault
()
const
62
{
63
return
m_type
==
DEFAULT
;
64
}
66
bool
isNumeric
()
const
67
{
68
return
m_type
!=
DEFAULT
&&
m_type
!=
NONE
&&
m_type
!=
BULLET
;
69
}
71
void
addTo
(librevenge::RVNGPropertyList &propList)
const
;
72
74
int
getStartValue
()
const
75
{
76
return
m_startValue
<= 0 ? 1 :
m_startValue
;
77
}
78
80
int
cmp
(
MWAWListLevel
const
&levl)
const
;
81
83
friend
std::ostream &
operator<<
(std::ostream &o,
MWAWListLevel
const
&ft);
84
86
Type
m_type
;
87
double
m_labelBeforeSpace
;
88
double
m_labelWidth
;
89
double
m_labelAfterSpace
;
91
int
m_numBeforeLabels
;
93
Alignment
m_alignment
;
95
int
m_startValue
;
96
librevenge::RVNGString
m_label
,
97
m_prefix
,
98
m_suffix
,
99
m_bullet
;
101
std::string
m_extra
;
102
};
103
105
class
MWAWList
106
{
107
public
:
109
MWAWList
() :
m_levels
(),
m_actLevel
(-1),
m_actualIndices
(),
m_nextIndices
(),
m_modifyMarker
(1)
110
{
111
m_id
[0] =
m_id
[1] = -1;
112
}
113
115
int
getId
()
const
116
{
117
return
m_id
[0];
118
}
119
121
int
getMarker
()
const
122
{
123
return
m_modifyMarker
;
124
}
126
void
resize
(
int
levl);
128
bool
isCompatibleWith
(
int
levl,
MWAWListLevel
const
&level)
const
;
130
bool
isCompatibleWith
(
MWAWList
const
&newList)
const
;
132
void
updateIndicesFrom
(
MWAWList
const
&list);
133
138
void
swapId
()
const
139
{
140
int
tmp =
m_id
[0];
141
m_id
[0] =
m_id
[1];
142
m_id
[1] = tmp;
143
}
144
146
void
setId
(
int
newId)
const
;
147
149
MWAWListLevel
getLevel
(
int
levl)
const
150
{
151
if
(levl >= 0 && levl <
int
(
m_levels
.size()))
152
return
m_levels
[size_t(levl)];
153
MWAW_DEBUG_MSG
((
"MWAWList::getLevel: can not find level %d\n"
, levl));
154
return
MWAWListLevel
();
155
}
157
int
numLevels
()
const
158
{
159
return
int(
m_levels
.size());
160
}
162
void
set
(
int
levl,
MWAWListLevel
const
&level);
163
165
void
setLevel
(
int
levl)
const
;
167
void
openElement
()
const
;
169
void
closeElement
()
const
{}
171
int
getStartValueForNextElement
()
const
;
173
void
setStartValueForNextElement
(
int
value);
174
176
bool
isNumeric
(
int
levl)
const
;
177
179
bool
addTo
(
int
level, librevenge::RVNGPropertyList &pList)
const
;
180
181
protected
:
183
std::vector<MWAWListLevel>
m_levels
;
184
186
mutable
int
m_actLevel
;
187
mutable
std::vector<int>
m_actualIndices
,
m_nextIndices
;
189
mutable
int
m_id
[2];
191
mutable
int
m_modifyMarker
;
192
};
193
195
class
MWAWListManager
196
{
197
public
:
199
MWAWListManager
() :
m_listList
(),
m_sendIdMarkerList
() { }
201
~MWAWListManager
() { }
203
bool
needToSend
(
int
index, std::vector<int> &idMarkerList)
const
;
205
shared_ptr<MWAWList>
getList
(
int
index)
const
;
207
shared_ptr<MWAWList>
getNewList
(shared_ptr<MWAWList> actList,
int
levl,
MWAWListLevel
const
&level);
208
protected
:
210
std::vector<MWAWList>
m_listList
;
212
mutable
std::vector<int>
m_sendIdMarkerList
;
213
};
214
#endif
215
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Generated on Tue Mar 1 2016 23:42:50 for libmwaw by
doxygen
1.8.4