- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

WPSList.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* libwps
3 * Version: MPL 2.0 / LGPLv2.1+
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * Major Contributor(s):
10 * Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
11 * Copyright (C) 2006, 2007 Andrew Ziem
12 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
13 * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
14 * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
15 *
16 * For minor contributions see the git repository.
17 *
18 * Alternatively, the contents of this file may be used under the terms
19 * of the GNU Lesser General Public License Version 2.1 or later
20 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
21 * applicable instead of those above.
22 *
23 * For further information visit http://libwps.sourceforge.net
24 */
25
26 #ifndef WPS_LIST_H
27 # define WPS_LIST_H
28
29 #include <iostream>
30 #include <vector>
31
32 #include <libwpd/libwpd.h>
33 #include "libwps_internal.h"
34
35 class WPXPropertyList;
36 class WPXDocumentInterface;
37
39 class WPSList
40 {
41 public:
43 struct Level
44 {
45
47 Level() : m_labelIndent(0.0), m_labelWidth(0.0), m_startValue(-1), m_type(libwps::NONE),
48 m_prefix(""), m_suffix(""), m_bullet(""), m_sendToInterface(false) { }
49
51 bool isDefault() const
52 {
53 return m_type ==libwps::NONE;
54 }
56 bool isNumeric() const
57 {
58 return m_type !=libwps::NONE && m_type != libwps::BULLET;
59 }
61 void addTo(WPXPropertyList &propList, int startVal) const;
62
64 bool isSendToInterface() const
65 {
66 return m_sendToInterface;
67 }
69 void resetSendToInterface() const
70 {
71 m_sendToInterface = false;
72 }
73
75 int getStartValue() const
76 {
77 return m_startValue <= -1 ? 1 : m_startValue;
78 }
79
81 int cmp(Level const &levl) const;
82
84 int cmpType(Level const &levl) const;
85
87 friend std::ostream &operator<<(std::ostream &o, Level const &ft);
88
89 double m_labelIndent ;
90 double m_labelWidth ;
92 int m_startValue;
94 libwps::NumberingType m_type;
95 WPXString m_prefix ,
96 m_suffix,
97 m_bullet ;
98
99 protected:
101 mutable bool m_sendToInterface;
102 };
103
105 WPSList() : m_levels(), m_actLevel(-1), m_actualIndices(), m_nextIndices(),
106 m_id(-1), m_previousId (-1) {}
107
109 int getId() const
110 {
111 return m_id;
112 }
113
118 int getPreviousId() const
119 {
120 return m_previousId;
121 }
122
124 void setId(int newId);
125
127 int numLevels() const
128 {
129 return int(m_levels.size());
130 }
132 void set(int levl, Level const &level);
133
135 void setLevel(int levl) const;
137 void openElement() const;
139 void closeElement() const {}
140
142 bool isNumeric(int levl) const;
143
145 bool mustSendLevel(int level) const;
146
148 void sendTo(WPXDocumentInterface &docInterface, int level) const;
149
150 protected:
151 std::vector<Level> m_levels;
152
153 mutable int m_actLevel;
154 mutable std::vector<int> m_actualIndices, m_nextIndices;
155 mutable int m_id, m_previousId;
156 };
157
158 #endif
159 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */