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 <librevenge/librevenge.h>
00042
00044 struct MWAWListLevel {
00046 enum Type { DEFAULT, NONE, BULLET, DECIMAL, LOWER_ALPHA, UPPER_ALPHA,
00047 LOWER_ROMAN, UPPER_ROMAN, LABEL
00048 };
00050 enum Alignment { LEFT, RIGHT, CENTER };
00051
00053 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),
00054 m_label(""), m_prefix(""), m_suffix(""), m_bullet(""), m_extra("")
00055 {
00056 }
00058 ~MWAWListLevel() {}
00059
00061 bool isDefault() const
00062 {
00063 return m_type ==DEFAULT;
00064 }
00066 bool isNumeric() const
00067 {
00068 return m_type !=DEFAULT && m_type !=NONE && m_type != BULLET;
00069 }
00071 void addTo(librevenge::RVNGPropertyList &propList) const;
00072
00074 int getStartValue() const
00075 {
00076 return m_startValue <= 0 ? 1 : m_startValue;
00077 }
00078
00080 int cmp(MWAWListLevel const &levl) const;
00081
00083 friend std::ostream &operator<<(std::ostream &o, MWAWListLevel const &ft);
00084
00086 Type m_type;
00087 double m_labelBeforeSpace ;
00088 double m_labelWidth ;
00089 double m_labelAfterSpace ;
00091 int m_numBeforeLabels;
00093 Alignment m_alignment;
00095 int m_startValue;
00096 librevenge::RVNGString m_label ,
00097 m_prefix ,
00098 m_suffix,
00099 m_bullet ;
00101 std::string m_extra;
00102 };
00103
00105 class MWAWList
00106 {
00107 public:
00109 MWAWList() : m_levels(), m_actLevel(-1), m_actualIndices(), m_nextIndices(), m_modifyMarker(1)
00110 {
00111 m_id[0] = m_id[1] = -1;
00112 }
00113
00115 int getId() const
00116 {
00117 return m_id[0];
00118 }
00119
00121 int getMarker() const
00122 {
00123 return m_modifyMarker;
00124 }
00126 void resize(int levl);
00128 bool isCompatibleWith(int levl, MWAWListLevel const &level) const;
00130 bool isCompatibleWith(MWAWList const &newList) const;
00132 void updateIndicesFrom(MWAWList const &list);
00133
00138 void swapId() const
00139 {
00140 int tmp = m_id[0];
00141 m_id[0] = m_id[1];
00142 m_id[1] = tmp;
00143 }
00144
00146 void setId(int newId) const;
00147
00149 MWAWListLevel getLevel(int levl) const
00150 {
00151 if (levl >= 0 && levl < int(m_levels.size()))
00152 return m_levels[size_t(levl)];
00153 MWAW_DEBUG_MSG(("MWAWList::getLevel: can not find level %d\n", levl));
00154 return MWAWListLevel();
00155 }
00157 int numLevels() const
00158 {
00159 return int(m_levels.size());
00160 }
00162 void set(int levl, MWAWListLevel const &level);
00163
00165 void setLevel(int levl) const;
00167 void openElement() const;
00169 void closeElement() const {}
00171 int getStartValueForNextElement() const;
00173 void setStartValueForNextElement(int value);
00174
00176 bool isNumeric(int levl) const;
00177
00179 bool addTo(int level, librevenge::RVNGPropertyList &pList) const;
00180
00181 protected:
00183 std::vector<MWAWListLevel> m_levels;
00184
00186 mutable int m_actLevel;
00187 mutable std::vector<int> m_actualIndices, m_nextIndices;
00189 mutable int m_id[2];
00191 mutable int m_modifyMarker;
00192 };
00193
00195 class MWAWListManager
00196 {
00197 public:
00199 MWAWListManager() : m_listList(), m_sendIdMarkerList() { }
00201 ~MWAWListManager() { }
00203 bool needToSend(int index, std::vector<int> &idMarkerList) const;
00205 shared_ptr<MWAWList> getList(int index) const;
00207 shared_ptr<MWAWList> getNewList(shared_ptr<MWAWList> actList, int levl, MWAWListLevel const &level);
00208 protected:
00210 std::vector<MWAWList> m_listList;
00212 mutable std::vector<int> m_sendIdMarkerList;
00213 };
00214 #endif
00215