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  * Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
4  * Copyright (C) 2006, 2007 Andrew Ziem
5  * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
6  * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
7  * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  *
23  * For further information visit http://libwps.sourceforge.net
24  */
25 
26 /* "This product is not manufactured, approved, or supported by
27  * Corel Corporation or Corel Corporation Limited."
28  */
29 
30 #ifndef WPS_LIST_H
31 # define WPS_LIST_H
32 
33 #include <iostream>
34 #include <vector>
35 
36 #include <libwpd/WPXString.h>
37 #include <libwps_internal.h>
38 
39 class WPXPropertyList;
40 class WPXDocumentInterface;
41 
43 class WPSList
44 {
45 public:
47  struct Level
48  {
49 
51  Level() : m_labelIndent(0.0), m_labelWidth(0.0), m_startValue(0), m_type(libwps::NONE),
52  m_prefix(""), m_suffix(""), m_bullet(""), m_sendToInterface(false) { }
53 
55  bool isDefault() const
56  {
57  return m_type ==libwps::NONE;
58  }
60  bool isNumeric() const
61  {
63  }
65  void addTo(WPXPropertyList &propList, int startVal) const;
66 
68  bool isSendToInterface() const
69  {
70  return m_sendToInterface;
71  }
73  void resetSendToInterface() const
74  {
75  m_sendToInterface = false;
76  }
77 
79  int getStartValue() const
80  {
81  return m_startValue <= 0 ? 1 : m_startValue;
82  }
83 
85  int cmp(Level const &levl) const;
86 
88  friend std::ostream &operator<<(std::ostream &o, Level const &ft);
89 
90  double m_labelIndent ;
91  double m_labelWidth ;
96  WPXString m_prefix ,
97  m_suffix,
98  m_bullet ;
99 
100  protected:
102  mutable bool m_sendToInterface;
103  };
104 
107  m_id(-1), m_previousId (-1) {}
108 
110  int getId() const
111  {
112  return m_id;
113  }
114 
119  int getPreviousId() const
120  {
121  return m_previousId;
122  }
123 
125  void setId(int newId);
126 
128  int numLevels() const
129  {
130  return m_levels.size();
131  }
133  void set(int levl, Level const &level);
134 
136  void setLevel(int levl) const;
138  void openElement() const;
140  void closeElement() const {}
141 
143  bool isNumeric(int levl) const;
144 
146  bool mustSendLevel(int level) const;
147 
149  void sendTo(WPXDocumentInterface &docInterface, int level) const;
150 
151 protected:
152  std::vector<Level> m_levels;
153 
154  mutable int m_actLevel;
155  mutable std::vector<int> m_actualIndices, m_nextIndices;
156  mutable int m_id, m_previousId;
157 };
158 
159 #endif
160 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */

Generated on Wed Aug 8 2012 16:07:57 for libwps by doxygen 1.8.1.2