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 #ifndef WPS_LIST_H
00027 # define WPS_LIST_H
00028
00029 #include <iostream>
00030 #include <vector>
00031
00032 #include <librevenge/librevenge.h>
00033 #include "libwps_internal.h"
00034
00036 class WPSList
00037 {
00038 public:
00040 struct Level
00041 {
00042
00044 Level() : m_labelIndent(0.0), m_labelWidth(0.0), m_startValue(-1), m_type(libwps::NONE),
00045 m_prefix(""), m_suffix(""), m_bullet(""), m_sendToInterface(false) { }
00046
00048 bool isDefault() const
00049 {
00050 return m_type ==libwps::NONE;
00051 }
00053 bool isNumeric() const
00054 {
00055 return m_type !=libwps::NONE && m_type != libwps::BULLET;
00056 }
00058 void addTo(librevenge::RVNGPropertyList &propList, int startVal) const;
00059
00061 bool isSendToInterface() const
00062 {
00063 return m_sendToInterface;
00064 }
00066 void resetSendToInterface() const
00067 {
00068 m_sendToInterface = false;
00069 }
00070
00072 int getStartValue() const
00073 {
00074 return m_startValue <= -1 ? 1 : m_startValue;
00075 }
00076
00078 int cmp(Level const &levl) const;
00079
00081 int cmpType(Level const &levl) const;
00082
00084 friend std::ostream &operator<<(std::ostream &o, Level const &ft);
00085
00086 double m_labelIndent ;
00087 double m_labelWidth ;
00089 int m_startValue;
00091 libwps::NumberingType m_type;
00092 librevenge::RVNGString m_prefix ,
00093 m_suffix,
00094 m_bullet ;
00095
00096 protected:
00098 mutable bool m_sendToInterface;
00099 };
00100
00102 WPSList() : m_levels(), m_actLevel(-1), m_actualIndices(), m_nextIndices(),
00103 m_id(-1), m_previousId(-1) {}
00104
00106 int getId() const
00107 {
00108 return m_id;
00109 }
00110
00115 int getPreviousId() const
00116 {
00117 return m_previousId;
00118 }
00119
00121 void setId(int newId);
00122
00124 int numLevels() const
00125 {
00126 return int(m_levels.size());
00127 }
00129 void set(int levl, Level const &level);
00130
00132 void setLevel(int levl) const;
00134 void openElement() const;
00136 void closeElement() const {}
00137
00139 bool isNumeric(int levl) const;
00140
00142 bool mustSendLevel(int level) const;
00143
00145 void addLevelTo(int level, librevenge::RVNGPropertyList &propList) const;
00146
00147 protected:
00148 std::vector<Level> m_levels;
00149
00150 mutable int m_actLevel;
00151 mutable std::vector<int> m_actualIndices, m_nextIndices;
00152 mutable int m_id, m_previousId;
00153 };
00154
00155 #endif
00156