1 /* AbiWord 2 * Copyright (C) 2004 Martin Sevior 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 * 02110-1301 USA. 18 */ 19 20 #ifndef AP_DIALOG_FORMATTOC_H 21 #define AP_DIALOG_FORMATTOC_H 22 23 #include "ut_types.h" 24 #include "xap_Frame.h" 25 #include "xap_Dialog.h" 26 #include "xav_View.h" 27 #include "ut_vector.h" 28 #include "ut_string_class.h" 29 30 class UT_Timer; 31 class XAP_Frame; 32 class PD_Document; 33 class PD_Style; 34 class PP_AttrProp; 35 36 class ABI_EXPORT AP_Dialog_FormatTOC : public XAP_Dialog_Modeless 37 { 38 public: 39 AP_Dialog_FormatTOC(XAP_DialogFactory * pDlgFactory, XAP_Dialog_Id id); 40 virtual ~AP_Dialog_FormatTOC(void); 41 42 virtual void runModeless(XAP_Frame * pFrame) = 0; 43 44 void startUpdater(void); 45 void stopUpdater(void); 46 void setActiveFrame(XAP_Frame *pFrame); 47 void event_update(void); 48 void finalize(void); 49 void Apply(void); 50 virtual void setTOCPropsInGUI(void) = 0; 51 virtual void setSensitivity(bool bSensitive) = 0; 52 static void autoUpdate(UT_Worker * pTimer); 53 void updateDialog(void); 54 UT_UTF8String getNewStyle(UT_UTF8String & sProp); 55 bool setPropFromDoc(const char * szProp); 56 void setTOCProperty(UT_UTF8String & sProp, UT_UTF8String & sVal); 57 void setTOCProperty(const char * szProp, const char * szVal); 58 void fillTOCPropsFromDoc(void); 59 void applyTOCPropsToDoc(void); 60 UT_UTF8String getTOCPropVal(UT_UTF8String & sProp); 61 UT_UTF8String getTOCPropVal(const char * szProp); 62 UT_UTF8String getTOCPropVal(const char * szProp,UT_sint32 i); getVecTABLeadersLabel(void)63 const UT_GenericVector<const gchar*> * getVecTABLeadersLabel(void) 64 { return & m_vecTABLeadersLabel;} getVecTABLeadersProp(void)65 const UT_GenericVector<const gchar*> * getVecTABLeadersProp(void) 66 { return & m_vecTABLeadersProp;} 67 void incrementStartAt(UT_sint32 iLevel, bool bInc); 68 double getIncrement(const char * sz); 69 void incrementIndent(UT_sint32 iLevel, bool bInc); 70 setDetailsLevel(UT_sint32 v)71 void setDetailsLevel(UT_sint32 v) 72 { m_iDetailsLevel = v; } getDetailsLevel(void)73 UT_sint32 getDetailsLevel(void) 74 { return m_iDetailsLevel;} setMainLevel(UT_sint32 v)75 void setMainLevel(UT_sint32 v) 76 { m_iMainLevel = v; } getMainLevel(void)77 UT_sint32 getMainLevel(void) 78 { return m_iMainLevel;} 79 private: 80 PD_Document * m_pDoc; 81 UT_Timer * m_pAutoUpdater; 82 UT_uint32 m_iTick; 83 const PP_AttrProp * m_pAP; 84 bool m_bTOCFilled; 85 UT_UTF8String m_sTOCProps; 86 UT_GenericVector<const gchar*> m_vecTABLeadersLabel; 87 UT_GenericVector<const gchar*> m_vecTABLeadersProp; 88 UT_sint32 m_iMainLevel; 89 UT_sint32 m_iDetailsLevel; 90 }; 91 92 #endif /* AP_DIALOG_FORMATTOC_H */ 93