Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef MWAW_LIST_H
00035 # define MWAW_LIST_H
00036
00037 #include <iostream>
00038
00039 #include <vector>
00040
00041 #include <libwpd/libwpd.h>
00042
00043 class WPXPropertyList;
00044
00046 struct MWAWListLevel {
00048 enum Type { DEFAULT, NONE, BULLET, DECIMAL, LOWER_ALPHA, UPPER_ALPHA,
00049 LOWER_ROMAN, UPPER_ROMAN, LABEL
00050 };
00052 enum Alignment { LEFT, RIGHT, CENTER };
00053
00055 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),
00056 m_label(""), m_prefix(""), m_suffix(""), m_bullet(""), m_extra("") {
00057 }
00059 ~MWAWListLevel() {}
00060
00062 bool isDefault() const {
00063 return m_type ==DEFAULT;
00064 }
00066 bool isNumeric() const {
00067 return m_type !=DEFAULT && m_type !=NONE && m_type != BULLET;
00068 }
00070 void addTo(WPXPropertyList &propList) const;
00071
00073 int getStartValue() const {
00074 return m_startValue <= 0 ? 1 : m_startValue;
00075 }
00076
00078 int cmp(MWAWListLevel const &levl) const;
00079
00081 friend std::ostream &operator<<(std::ostream &o, MWAWListLevel const &ft);
00082
00084 Type m_type;
00085 double m_labelBeforeSpace ;
00086 double m_labelWidth ;
00087 double m_labelAfterSpace ;
00089 int m_numBeforeLabels;
00091 Alignment m_alignment;
00093 int m_startValue;
00094 WPXString m_label ,
00095 m_prefix ,
00096 m_suffix,
00097 m_bullet ;
00099 std::string m_extra;
00100 };
00101
00103 class MWAWList
00104 {
00105 public:
00107 MWAWList() : m_levels(), m_actLevel(-1), m_actualIndices(), m_nextIndices(), m_modifyMarker(1) {
00108 m_id[0] = m_id[1] = -1;
00109 }
00110
00112 int getId() const {
00113 return m_id[0];
00114 }
00115
00117 int getMarker() const {
00118 return m_modifyMarker;
00119 }
00121 void resize(int levl);
00123 bool isCompatibleWith(int levl, MWAWListLevel const &level) const;
00125 bool isCompatibleWith(MWAWList const &newList) const;
00127 void updateIndicesFrom(MWAWList const &list);
00128
00133 void swapId() const {
00134 int tmp = m_id[0];
00135 m_id[0] = m_id[1];
00136 m_id[1] = tmp;
00137 }
00138
00140 void setId(int newId) const;
00141
00143 MWAWListLevel getLevel(int levl) const {
00144 if (levl >= 0 && levl < int(m_levels.size()))
00145 return m_levels[size_t(levl)];
00146 MWAW_DEBUG_MSG(("MWAWList::getLevel: can not find level %d\n", levl));
00147 return MWAWListLevel();
00148 }
00150 int numLevels() const {
00151 return int(m_levels.size());
00152 }
00154 void set(int levl, MWAWListLevel const &level);
00155
00157 void setLevel(int levl) const;
00159 void openElement() const;
00161 void closeElement() const {}
00163 int getStartValueForNextElement() const;
00165 void setStartValueForNextElement(int value);
00166
00168 bool isNumeric(int levl) const;
00169
00171 bool addTo(int level, WPXPropertyList &pList) const;
00172
00173 protected:
00175 std::vector<MWAWListLevel> m_levels;
00176
00178 mutable int m_actLevel;
00179 mutable std::vector<int> m_actualIndices, m_nextIndices;
00181 mutable int m_id[2];
00183 mutable int m_modifyMarker;
00184 };
00185
00187 class MWAWListManager
00188 {
00189 public:
00191 MWAWListManager() : m_listList(), m_sendIdMarkerList() { }
00193 ~MWAWListManager() { }
00195 bool needToSend(int index, std::vector<int> &idMarkerList) const;
00197 shared_ptr<MWAWList> getList(int index) const;
00199 shared_ptr<MWAWList> getNewList(shared_ptr<MWAWList> actList, int levl, MWAWListLevel const &level);
00200 protected:
00202 std::vector<MWAWList> m_listList;
00204 mutable std::vector<int> m_sendIdMarkerList;
00205 };
00206 #endif
00207