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 #ifndef IE_IMP_WP_H
00030 #define IE_IMP_WP_H
00031
00032 #include <stdio.h>
00033 #include <libwpd/libwpd.h>
00034 #include "ie_imp.h"
00035 #include "ut_string.h"
00036 #include "ut_string_class.h"
00037 #include "ut_growbuf.h"
00038 #include "ut_mbtowc.h"
00039 #include "pd_Document.h"
00040 #include "fl_AutoNum.h"
00041 #include "fl_TableLayout.h"
00042 #include "fp_types.h"
00043
00044 using namespace std;
00045
00046 #define WP6_NUM_LIST_LEVELS 8 // see WP6FileStructure.h
00047
00048
00049 class ABI_ListDefinition
00050 {
00051 public:
00052 ABI_ListDefinition(int iOutlineHash);
00053 void setListID(const int iLevel, const UT_uint32 iID) { m_iListIDs[iLevel-1] = iID; }
00054 UT_uint32 getListID(const int iLevel) const { return m_iListIDs[iLevel-1]; }
00055 FL_ListType getListType(const int iLevel) const { return m_listTypes[iLevel-1]; }
00056 void setListType(const int iLevel, const char type);
00057 void incrementLevelNumber(const int iLevel) { m_iListNumbers[iLevel - 1]++; }
00058 void setLevelNumber(const int iLevel, const int iNumber) { m_iListNumbers[iLevel - 1] = iNumber; }
00059 void setListLeftOffset(const int iLevel, const float listLeftOffset) { m_listLeftOffset[iLevel - 1] = listLeftOffset; }
00060 void setListMinLabelWidth(const int iLevel, const float listMinLabelWidth) { m_listMinLabelWidth[iLevel - 1] = listMinLabelWidth; }
00061 int getLevelNumber(const int iLevel) const { return m_iListNumbers[iLevel - 1]; }
00062 float getListLeftOffset(const int iLevel) const { return m_listLeftOffset[iLevel - 1]; }
00063 float getListMinLabelWidth(const int iLevel) const { return m_listMinLabelWidth[iLevel - 1]; }
00064 int getOutlineHash() const { return m_iOutlineHash; }
00065
00066 private:
00067
00068 UT_uint32 m_iListIDs[WP6_NUM_LIST_LEVELS];
00069 int m_iListNumbers[WP6_NUM_LIST_LEVELS];
00070 FL_ListType m_listTypes[WP6_NUM_LIST_LEVELS];
00071 float m_listLeftOffset[WP6_NUM_LIST_LEVELS];
00072 float m_listMinLabelWidth[WP6_NUM_LIST_LEVELS];
00073 int m_iOutlineHash;
00074 };
00075
00076 class IE_Imp_WordPerfect_Sniffer : public IE_ImpSniffer
00077 {
00078 friend class IE_Imp;
00079 friend class IE_Imp_WordPerfect;
00080
00081 public:
00082 IE_Imp_WordPerfect_Sniffer();
00083 virtual ~IE_Imp_WordPerfect_Sniffer();
00084
00085 virtual const IE_SuffixConfidence * getSuffixConfidence ();
00086 virtual UT_Confidence_t recognizeContents (GsfInput * input);
00087 virtual const IE_MimeConfidence * getMimeConfidence () { return NULL; }
00088 virtual bool getDlgLabels (const char ** szDesc,
00089 const char ** szSuffixList,
00090 IEFileType * ft);
00091 virtual UT_Error constructImporter (PD_Document * pDocument,
00092 IE_Imp ** ppie);
00093 };
00094
00095 class IE_Imp_WordPerfect : public IE_Imp, public WPXDocumentInterface
00096 {
00097 public:
00098 IE_Imp_WordPerfect(PD_Document * pDocument);
00099 virtual ~IE_Imp_WordPerfect();
00100
00101 virtual void pasteFromBuffer(PD_DocumentRange * pDocRange,
00102 UT_uint8 * pData, UT_uint32 lenData, const char * szEncoding = 0);
00103
00104 virtual void setDocumentMetaData(const WPXPropertyList &propList);
00105
00106 virtual void startDocument();
00107 virtual void endDocument();
00108
00109 virtual void openPageSpan(const WPXPropertyList &propList);
00110 virtual void closePageSpan() {}
00111 virtual void openHeader(const WPXPropertyList &propList);
00112 virtual void closeHeader();
00113 virtual void openFooter(const WPXPropertyList &propList);
00114 virtual void closeFooter();
00115
00116 virtual void openParagraph(const WPXPropertyList &propList, const WPXPropertyListVector &tabStops);
00117 virtual void closeParagraph() {}
00118
00119 virtual void openSpan(const WPXPropertyList &propList);
00120 virtual void closeSpan() {}
00121
00122 virtual void openSection(const WPXPropertyList &propList, const WPXPropertyListVector &columns);
00123 virtual void closeSection() {}
00124
00125 virtual void insertTab();
00126 virtual void insertText(const WPXString &text);
00127 virtual void insertLineBreak();
00128
00129 virtual void defineOrderedListLevel(const WPXPropertyList &propList);
00130 virtual void defineUnorderedListLevel(const WPXPropertyList &propList);
00131 virtual void openOrderedListLevel(const WPXPropertyList &propList);
00132 virtual void openUnorderedListLevel(const WPXPropertyList &propList);
00133 virtual void closeOrderedListLevel();
00134 virtual void closeUnorderedListLevel();
00135 virtual void openListElement(const WPXPropertyList &propList, const WPXPropertyListVector &tabStops);
00136 virtual void closeListElement() {}
00137
00138 virtual void openFootnote(const WPXPropertyList &propList);
00139 virtual void closeFootnote();
00140 virtual void openEndnote(const WPXPropertyList &propList);
00141 virtual void closeEndnote();
00142
00143 virtual void openTable(const WPXPropertyList &propList, const WPXPropertyListVector &columns);
00144 virtual void openTableRow(const WPXPropertyList &propList);
00145 virtual void closeTableRow() {}
00146 virtual void openTableCell(const WPXPropertyList &propList);
00147 virtual void closeTableCell() {}
00148 virtual void insertCoveredTableCell(const WPXPropertyList & ) {}
00149 virtual void closeTable();
00150
00151 virtual void definePageStyle(const WPXPropertyList&) {}
00152 virtual void defineParagraphStyle(const WPXPropertyList&, const WPXPropertyListVector&) {}
00153 virtual void defineCharacterStyle(const WPXPropertyList&) {}
00154 virtual void defineSectionStyle(const WPXPropertyList&, const WPXPropertyListVector&) {}
00155 virtual void insertSpace() {}
00156 virtual void insertField(const WPXString&, const WPXPropertyList&) {}
00157 virtual void openComment(const WPXPropertyList&) {}
00158 virtual void closeComment() {}
00159 virtual void openTextBox(const WPXPropertyList&) {}
00160 virtual void closeTextBox() {}
00161 virtual void openFrame(const WPXPropertyList&) {}
00162 virtual void closeFrame() {}
00163 virtual void insertBinaryObject(const WPXPropertyList&, const WPXBinaryData&) {}
00164 virtual void insertEquation(const WPXPropertyList&, const WPXString&) {}
00165
00166
00167 protected:
00168 virtual UT_Error _loadFile(GsfInput * input);
00169 UT_Error _appendSection(int numColumns, const float, const float);
00170
00171 UT_Error _appendListSpan(UT_uint32 listTag);
00172
00173
00174 UT_Error _updateDocumentOrderedListDefinition(ABI_ListDefinition *pListDefinition,
00175 int iLevel, const char listType,
00176 const UT_UTF8String &sTextBeforeNumber,
00177 const UT_UTF8String &sTextAfterNumber,
00178 int iStartingNumber);
00179 UT_Error _updateDocumentUnorderedListDefinition(ABI_ListDefinition *pListDefinition,
00180 int level);
00181 private:
00182
00183 float m_leftPageMargin;
00184 float m_rightPageMargin;
00185 float m_leftSectionMargin;
00186 float m_rightSectionMargin;
00187 int m_sectionColumnsCount;
00188 UT_sint8 m_headerId;
00189 UT_sint8 m_footerId;
00190 UT_uint32 m_nextFreeId;
00191
00192
00193 float m_topMargin;
00194 float m_bottomMargin;
00195 float m_leftMarginOffset;
00196 float m_rightMarginOffset;
00197 float m_textIndent;
00198
00199
00200
00201 ABI_ListDefinition * m_pCurrentListDefinition;
00202 bool m_bParagraphChanged;
00203 bool m_bParagraphInSection;
00204 bool m_bInSection;
00205 bool m_bSectionChanged;
00206 bool m_bRequireBlock;
00207
00208 int m_iCurrentListLevel;
00209 bool m_bInCell;
00210
00211
00212 int m_bHdrFtrOpenCount;
00213 };
00214
00215 #ifdef HAVE_LIBWPS
00216
00217 class IE_Imp_MSWorks_Sniffer : public IE_ImpSniffer
00218 {
00219 friend class IE_Imp;
00220 friend class IE_Imp_MSWorks;
00221
00222 public:
00223 IE_Imp_MSWorks_Sniffer();
00224 virtual ~IE_Imp_MSWorks_Sniffer();
00225
00226 virtual const IE_SuffixConfidence * getSuffixConfidence ();
00227 virtual UT_Confidence_t recognizeContents (GsfInput * input);
00228 virtual const IE_MimeConfidence * getMimeConfidence () { return NULL; }
00229 virtual bool getDlgLabels (const char ** szDesc,
00230 const char ** szSuffixList,
00231 IEFileType * ft);
00232 virtual UT_Error constructImporter (PD_Document * pDocument,
00233 IE_Imp ** ppie);
00234 };
00235
00236 #endif
00237
00238 #endif