00001 /* AbiSource Program Utilities 00002 * 00003 * Copyright (C) 2005 Daniel d'Andrada T. de Carvalho 00004 * <daniel.carvalho@indt.org.br> 00005 * Copyright (C) 2009 Hubert Figuiere 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00020 * 02111-1307, USA. 00021 */ 00022 00023 #ifndef _ODI_STYLE_LIST_H_ 00024 #define _ODI_STYLE_LIST_H_ 00025 00026 #include <string> 00027 #include <vector> 00028 00029 // Internal includes 00030 #include "ODi_ListenerState.h" 00031 00032 // Internal classes 00033 class ODi_ListLevelStyle; 00034 00035 // AbiWord classes 00036 class PD_Document; 00037 00038 00042 class ODi_Style_List 00043 : public ODi_ListenerState { 00044 00045 public: 00046 00047 ODi_Style_List(ODi_ElementStack& rElementStack) : 00048 ODi_ListenerState("StyleList", rElementStack), 00049 m_bListStyle(false) 00050 { 00051 } 00052 00053 virtual ~ODi_Style_List(); 00054 00055 void startElement (const gchar* pName, const gchar** ppAtts, 00056 ODi_ListenerStateAction& rAction); 00057 00058 void endElement (const gchar* pName, 00059 ODi_ListenerStateAction& rAction); 00060 00061 void charData (const gchar* /*pBuffer*/, int /*length*/) { }; 00062 00063 void defineAbiList(PD_Document* pDocument); 00064 void redefine(PD_Document* pDocument, UT_uint32 iLevel); 00065 00066 ODi_ListLevelStyle* getLevelStyle(UT_uint32 level) const 00067 { 00068 UT_return_val_if_fail(level > 0, NULL); 00069 UT_return_val_if_fail(!m_levelStyles.empty(), NULL); 00070 00071 // Levels starts from 1, but our vector starts from 0 (zero). 00072 return m_levelStyles[level-1]; 00073 } 00074 00075 UT_sint32 getLevelCount() const 00076 { 00077 return m_levelStyles.size(); 00078 } 00079 00080 void buildAbiPropertiesString() const; 00081 00082 private: 00083 // style:name attribute 00084 std::string m_name; 00085 00086 // style:display-name attribute 00087 std::string m_displayName; 00088 00089 // text:consecutive-numbering attribute 00090 bool m_bConsecutiveNumbering; 00091 00092 std::vector<ODi_ListLevelStyle*> m_levelStyles; 00093 bool m_bListStyle; 00094 }; 00095 00096 #endif //_ODI_STYLE_LIST_H_
1.7.1