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 #ifndef WPS_LIST_H
00031 # define WPS_LIST_H
00032
00033 #include <iostream>
00034 #include <vector>
00035
00036 #include <libwpd/WPXString.h>
00037 #include <libwps_internal.h>
00038
00039 class WPXPropertyList;
00040 class WPXDocumentInterface;
00041
00043 class WPSList
00044 {
00045 public:
00047 struct Level
00048 {
00049
00051 Level() : m_labelIndent(0.0), m_labelWidth(0.0), m_startValue(0), m_type(libwps::NONE),
00052 m_prefix(""), m_suffix(""), m_bullet(""), m_sendToInterface(false) { }
00053
00055 bool isDefault() const
00056 {
00057 return m_type ==libwps::NONE;
00058 }
00060 bool isNumeric() const
00061 {
00062 return m_type !=libwps::NONE && m_type != libwps::BULLET;
00063 }
00065 void addTo(WPXPropertyList &propList, int startVal) const;
00066
00068 bool isSendToInterface() const
00069 {
00070 return m_sendToInterface;
00071 }
00073 void resetSendToInterface() const
00074 {
00075 m_sendToInterface = false;
00076 }
00077
00079 int getStartValue() const
00080 {
00081 return m_startValue <= 0 ? 1 : m_startValue;
00082 }
00083
00085 int cmp(Level const &levl) const;
00086
00088 friend std::ostream &operator<<(std::ostream &o, Level const &ft);
00089
00090 double m_labelIndent ;
00091 double m_labelWidth ;
00093 int m_startValue;
00095 libwps::NumberingType m_type;
00096 WPXString m_prefix ,
00097 m_suffix,
00098 m_bullet ;
00099
00100 protected:
00102 mutable bool m_sendToInterface;
00103 };
00104
00106 WPSList() : m_levels(), m_actLevel(-1), m_actualIndices(), m_nextIndices(),
00107 m_id(-1), m_previousId (-1) {}
00108
00110 int getId() const
00111 {
00112 return m_id;
00113 }
00114
00119 int getPreviousId() const
00120 {
00121 return m_previousId;
00122 }
00123
00125 void setId(int newId);
00126
00128 int numLevels() const
00129 {
00130 return m_levels.size();
00131 }
00133 void set(int levl, Level const &level);
00134
00136 void setLevel(int levl) const;
00138 void openElement() const;
00140 void closeElement() const {}
00141
00143 bool isNumeric(int levl) const;
00144
00146 bool mustSendLevel(int level) const;
00147
00149 void sendTo(WPXDocumentInterface &docInterface, int level) const;
00150
00151 protected:
00152 std::vector<Level> m_levels;
00153
00154 mutable int m_actLevel;
00155 mutable std::vector<int> m_actualIndices, m_nextIndices;
00156 mutable int m_id, m_previousId;
00157 };
00158
00159 #endif
00160