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 STOFF_LIST_H
00035 # define STOFF_LIST_H
00036
00037 #include <iostream>
00038
00039 #include <vector>
00040
00041 #include <librevenge/librevenge.h>
00042
00043 #include "libstaroffice_internal.hxx"
00044
00045 class STOFFFont;
00046
00048 struct STOFFListLevel {
00050 enum Type { DEFAULT, NONE, BULLET, NUMBER };
00051
00053 STOFFListLevel() : m_type(NONE), m_propertyList(), m_font(),
00054 m_startValue(0)
00055 {
00056 }
00058 ~STOFFListLevel();
00059
00061 bool isDefault() const
00062 {
00063 return m_type ==DEFAULT;
00064 }
00066 bool isNumeric() const
00067 {
00068 return m_type==NUMBER;
00069 }
00071 bool operator==(STOFFListLevel const &levl) const
00072 {
00073 return cmp(levl)==0;
00074 }
00076 bool operator!=(STOFFListLevel const &levl) const
00077 {
00078 return !operator==(levl);
00079 }
00081 void addTo(librevenge::RVNGPropertyList &propList) const;
00082
00084 int getStartValue() const
00085 {
00086 return m_startValue <= 0 ? 1 : m_startValue;
00087 }
00088
00090 int cmp(STOFFListLevel const &levl) const;
00092 Type m_type;
00094 librevenge::RVNGPropertyList m_propertyList;
00096 shared_ptr<STOFFFont> m_font;
00098 int m_startValue;
00099 };
00100
00102 class STOFFList
00103 {
00104 public:
00106 explicit STOFFList(bool outline) : m_outline(outline), m_name(""), m_levels(), m_actLevel(-1), m_actualIndices(), m_nextIndices(), m_modifyMarker(1)
00107 {
00108 m_id[0] = m_id[1] = -1;
00109 }
00110
00112 int getId() const
00113 {
00114 return m_id[0];
00115 }
00116
00118 int getMarker() const
00119 {
00120 return m_modifyMarker;
00121 }
00123 void resize(int levl);
00125 bool isCompatibleWith(int levl, STOFFListLevel const &level) const;
00127 bool isCompatibleWith(STOFFList const &newList) const;
00129 void updateIndicesFrom(STOFFList const &list);
00130
00135 void swapId() const
00136 {
00137 int tmp = m_id[0];
00138 m_id[0] = m_id[1];
00139 m_id[1] = tmp;
00140 }
00141
00143 void setId(int newId) const;
00144
00146 STOFFListLevel getLevel(int levl) const
00147 {
00148 if (levl >= 0 && levl < int(m_levels.size()))
00149 return m_levels[size_t(levl)];
00150 STOFF_DEBUG_MSG(("STOFFList::getLevel: can not find level %d\n", levl));
00151 return STOFFListLevel();
00152 }
00154 int numLevels() const
00155 {
00156 return int(m_levels.size());
00157 }
00159 void set(int levl, STOFFListLevel const &level);
00160
00162 void setLevel(int levl) const;
00164 void openElement() const;
00166 void closeElement() const {}
00168 int getStartValueForNextElement() const;
00170 void setStartValueForNextElement(int value);
00171
00173 bool isNumeric(int levl) const;
00174
00176 bool addTo(int level, librevenge::RVNGPropertyList &pList) const;
00177
00179 bool m_outline;
00181 librevenge::RVNGString m_name;
00182 protected:
00184 std::vector<STOFFListLevel> m_levels;
00185
00187 mutable int m_actLevel;
00188 mutable std::vector<int> m_actualIndices, m_nextIndices;
00190 mutable int m_id[2];
00192 mutable int m_modifyMarker;
00193 };
00194
00196 class STOFFListManager
00197 {
00198 public:
00200 STOFFListManager() : m_listList(), m_sendIdMarkerList() { }
00202 ~STOFFListManager() { }
00204 bool needToSend(int index, std::vector<int> &idMarkerList) const;
00206 shared_ptr<STOFFList> getList(int index) const;
00208 shared_ptr<STOFFList> getNewList(shared_ptr<STOFFList> actList, int levl, STOFFListLevel const &level);
00210 shared_ptr<STOFFList> addList(shared_ptr<STOFFList> actList);
00211 protected:
00213 std::vector<STOFFList> m_listList;
00215 mutable std::vector<int> m_sendIdMarkerList;
00216 };
00217 #endif
00218