00001 #ifndef IE_TOC_H 00002 #define IE_TOC_H 00003 00004 #include "ut_string_class.h" 00005 #include "ut_vector.h" 00006 #include "pt_Types.h" 00007 00008 class PD_Document; 00009 00010 class ABI_EXPORT IE_TOCHelper 00011 { 00012 friend class TOC_Listener; 00013 00014 public: 00015 00016 IE_TOCHelper(PD_Document * doc); 00017 ~IE_TOCHelper(); 00018 00019 bool hasTOC() const; // true if there are any "headings" in the document 00020 bool docHasTOC() const; // true if the doc has 1 or more tables of contents 00021 00022 bool isTOCStyle(const UT_UTF8String & styleName, int * out_level = NULL) const; 00023 bool isTOCStyle(const char * styleName, int * out_level = NULL) const; 00024 00025 int getNumTOCEntries() const; 00026 00027 UT_UTF8String getNthTOCEntry(int nth, int * out_level = NULL) const; 00028 bool getNthTOCEntryPos(int nth, PT_DocPosition &pos) const; 00029 00030 private: 00031 00032 bool _tocNameLevelHelper(const UT_UTF8String & styleName, 00033 const char * sLStyle) const; 00034 00035 void _defineTOC(const UT_UTF8String & toc_text, int level, PT_DocPosition pos); 00036 00037 // undefined 00038 IE_TOCHelper(); 00039 IE_TOCHelper(const IE_TOCHelper & rhs); 00040 IE_TOCHelper& operator=(const IE_TOCHelper & rhs); 00041 00042 // storage 00043 UT_GenericVector<UT_UTF8String *> mTOCStrings; 00044 UT_GenericVector<int> mTOCLevels; 00045 // By adding this vector we making it possible to get ranges of every 00046 // section of a document by using TOCHelper 00047 UT_GenericVector<PT_DocPosition> mTOCPositions; 00048 00049 bool mHasTOC; 00050 bool mDocHasTOC; 00051 PD_Document *mDoc; 00052 }; 00053 00054 #endif