00001 /* AbiWord 00002 * Copyright (C) 2004 Martin Sevior 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 * 02110-1301 USA. 00018 */ 00019 00020 #ifndef AP_DIALOG_FORMATTOC_H 00021 #define AP_DIALOG_FORMATTOC_H 00022 00023 #include "ut_types.h" 00024 #include "xap_Frame.h" 00025 #include "xap_Dialog.h" 00026 #include "xav_View.h" 00027 #include "ut_vector.h" 00028 #include "ut_string_class.h" 00029 00030 class UT_Timer; 00031 class XAP_Frame; 00032 class PD_Document; 00033 class PD_Style; 00034 class PP_AttrProp; 00035 00036 class ABI_EXPORT AP_Dialog_FormatTOC : public XAP_Dialog_Modeless 00037 { 00038 public: 00039 AP_Dialog_FormatTOC(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); 00040 virtual ~AP_Dialog_FormatTOC(void); 00041 00042 virtual void runModeless(XAP_Frame * pFrame) = 0; 00043 00044 void startUpdater(void); 00045 void stopUpdater(void); 00046 void setActiveFrame(XAP_Frame *pFrame); 00047 void event_update(void); 00048 void finalize(void); 00049 void Apply(void); 00050 virtual void setTOCPropsInGUI(void) = 0; 00051 virtual void setSensitivity(bool bSensitive) = 0; 00052 static void autoUpdate(UT_Worker * pTimer); 00053 void updateDialog(void); 00054 UT_UTF8String getNewStyle(UT_UTF8String & sProp); 00055 bool setPropFromDoc(const char * szProp); 00056 void setTOCProperty(UT_UTF8String & sProp, UT_UTF8String & sVal); 00057 void setTOCProperty(const char * szProp, const char * szVal); 00058 void fillTOCPropsFromDoc(void); 00059 void applyTOCPropsToDoc(void); 00060 UT_UTF8String getTOCPropVal(UT_UTF8String & sProp); 00061 UT_UTF8String getTOCPropVal(const char * szProp); 00062 UT_UTF8String getTOCPropVal(const char * szProp,UT_sint32 i); 00063 const UT_GenericVector<const gchar*> * getVecTABLeadersLabel(void) 00064 { return & m_vecTABLeadersLabel;} 00065 const UT_GenericVector<const gchar*> * getVecTABLeadersProp(void) 00066 { return & m_vecTABLeadersProp;} 00067 void incrementStartAt(UT_sint32 iLevel, bool bInc); 00068 double getIncrement(const char * sz); 00069 void incrementIndent(UT_sint32 iLevel, bool bInc); 00070 00071 void setDetailsLevel(UT_sint32 v) 00072 { m_iDetailsLevel = v; } 00073 UT_sint32 getDetailsLevel(void) 00074 { return m_iDetailsLevel;} 00075 void setMainLevel(UT_sint32 v) 00076 { m_iMainLevel = v; } 00077 UT_sint32 getMainLevel(void) 00078 { return m_iMainLevel;} 00079 private: 00080 PD_Document * m_pDoc; 00081 UT_Timer * m_pAutoUpdater; 00082 UT_uint32 m_iTick; 00083 const PP_AttrProp * m_pAP; 00084 bool m_bTOCFilled; 00085 UT_UTF8String m_sTOCProps; 00086 UT_GenericVector<const gchar*> m_vecTABLeadersLabel; 00087 UT_GenericVector<const gchar*> m_vecTABLeadersProp; 00088 UT_sint32 m_iMainLevel; 00089 UT_sint32 m_iDetailsLevel; 00090 }; 00091 00092 #endif /* AP_DIALOG_FORMATTOC_H */