⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 docdecoder.h

📁 此文件为Word 格式文件.DOC转换为TXT文件的源代码。
💻 H
📖 第 1 页 / 共 2 页
字号:
	int		iColour;
	unsigned char	ucFontstyle;
	draw_fontref	tFontRef;
	unsigned char	ucFontsize;
	struct output_tag	*pPrev;
	struct output_tag	*pNext;
} output_type;

/* Property Set Storage */
typedef struct pps_tag {
	int	iSb;
	int	iSize;
} pps_type;

typedef struct pps_info_tag {
	pps_type	tWordDocument;
	pps_type	t0Table;
	pps_type	t1Table;
} pps_info_type;

/* Record of text block information */
typedef struct text_block_tag {
	int	iFileOffset;
	int	iTextOffset;
	int	iLength;
	bool	bUsesUnicode;	/* Uses 16 bits per character */
} text_block_type;

/* Record of table-row block information */
typedef struct row_block_tag {
	int	iOffsetStart;
	int	iOffsetEnd;
	int	iColumnWidthSum;			/* In twips */
	short	asColumnWidth[TABLE_COLUMN_MAX+1];	/* In twips */
	unsigned char	ucNumberOfColumns;
} row_block_type;

/* Linked list of style description information */
typedef struct style_block_tag {
	int	iOffset;
	bool	bInList;
	bool	bUnmarked;
	short	sLeftIndent;	/* Left indentation in twips */
	short	sRightIndent;	/* Right indentation in twips */
	unsigned char	ucStyle;
	unsigned char	ucAlignment;
	unsigned char	ucListType;
	unsigned char	ucListLevel;
	unsigned char	ucListCharacter;
} style_block_type;
typedef struct style_desc_tag {
	style_block_type	tInfo;
	struct style_desc_tag	*pNext;
} style_desc_type;

typedef struct font_block_tag {
	int	iOffset;
	unsigned char	ucFontnumber;
	unsigned char	ucFontsize;
	unsigned char	ucFontcolour;
	unsigned char	ucFontstyle;
} font_block_type;
typedef struct font_desc_tag {
	font_block_type	tInfo;
	struct font_desc_tag	*pNext;
} font_desc_type;

typedef enum text_info_tag {
	text_success,
	text_failure,
	text_no_information
} text_info_enum;

typedef enum list_id_tag {
	text_list,
	footnote_list,
	endnote_list,
	end_of_lists
} list_id_enum;

typedef enum notetype_tag {
	notetype_is_footnote,
	notetype_is_endnote,
	notetype_is_unknown
} notetype_enum;


typedef struct list_mem_tag {
	text_block_type		tInfo;
	struct list_mem_tag	*pNext;
} list_mem_type;

typedef enum row_info_tag {
	found_nothing,
	found_a_cell,
	found_end_of_row
} row_info_enum;

typedef struct row_unique_tag {
	int	iOffsetStart;
	int	iOffsetEnd;
} row_unique_type;
typedef struct row_common_tag {
	int	iColumnWidthSum;			/* In twips */
	short	asColumnWidth[TABLE_COLUMN_MAX+1];	/* In twips */
	unsigned char	ucNumberOfColumns;
} row_common_type;
typedef struct row_desc_tag {
	row_unique_type		tUnique;
	row_common_type		*pCommon;
	struct row_desc_tag	*pNext;
} row_desc_type;

typedef struct pps_entry_tag {
	char	szName[32];
	int	iType;
	int	iNext;
	int	iPrev;
	int	iDir;
	int	iSb;
	int	iSize;
	int	iLevel;
} pps_entry_type;


//Doc解码器类
class CDocDecoder :
	public CDecoderBase
{
public:
	CDocDecoder(CPublicResource *ps=NULL);
	~CDocDecoder(void);
public:
	unsigned short	*outbuf;
	int				outbuflen;
	list_mem_type	*pTextAnchor;
	list_mem_type	*pFootAnchor;
	list_mem_type	*pUnused1Anchor;
	list_mem_type	*pEndAnchor;
	list_mem_type	*pUnused2Anchor;
	list_mem_type	*pBlockLast;
	list_mem_type	*pTextBlockCurrent;
	list_mem_type	*pFootBlockCurrent;
	list_mem_type	*pEndBlockCurrent;
	unsigned char	aucBlock[BIG_BLOCK_SIZE];
	int				*aiSmallBlockList;
	int				iSmallBlockListLen;
	int				iPageHeight;
	style_desc_type	*pStyleCurrent;
	int				*aiFootnoteList;
	int				iFootnoteListLength;
	int				*aiEndnoteList;
	int				iEndnoteListLength;
	int				aiHdrCounter[9];
	row_desc_type	*pAnchorow;
	row_desc_type	*pRowLast;
	row_desc_type	*pRowCurrent;
	style_desc_type	*pAnchor;
	style_desc_type	*pStyleLast;
	int				iDefaultTabWidth;	/* In millipoints */
	unsigned int	uiDocumentLength;
	bool			bMacFile;
	row_block_type	tRowInfo;
	bool			bRowInfo;
	bool			bEndRow;
	const			style_block_type	*pStyleInfo;
	bool			bStartStyle;
	const			font_block_type	*pFontInfo;

public:
	void			vDestroyTextBlockList(void);
	void			vSplitBlockList(int, int, int, int, int, bool);
	void			vMove2NextLine(diagram_type *, draw_fontref, int);
	void			vSubstring2Diagram(diagram_type *,
						unsigned short *, int, int, int, unsigned char,
						draw_fontref, int, int);
	void			vSetLeftIndentation(diagram_type *, int);
	void			vEndOfParagraph2Diagram(diagram_type *, draw_fontref, int);
	void			vEmptyLine2Diagram(diagram_type *, draw_fontref, int);
	void			vEndOfPage2Diagram(diagram_type *, draw_fontref, int);
	void			vDestroyDiagram(diagram_type *);
	void			vDestroySmallBlockList(void);
	void			vDestroyNotesInfoLists(void);
	void			vGet6FootnotesInfo(unsigned char *, int ,const int *, int ,const unsigned char *);
	void			vGet6EndnotesInfo(unsigned char *, int ,const int *, int ,const unsigned char *);
	void			vGet6NotesInfo(unsigned char *, int ,const int *, int ,const unsigned char *);
	void			vGet8FootnotesInfo(unsigned char *, const pps_info_type *,
						const int *, int , const int *, int ,
						const unsigned char *);
	void			vGet8EndnotesInfo(unsigned char *, const pps_info_type *,
						const int *, int , const int *, int ,
						const unsigned char *);
	void			vGet8NotesInfo(unsigned char *, const pps_info_type *,
						const int *, int , const int *, int ,
						const unsigned char *);
	void			vGetNotesInfo(unsigned char *, const pps_info_type *,
						const int *, int, const int *, int,
						const unsigned char *, int);
	void			vString2Diagram(diagram_type *, output_type *);
	void			vResetStyles(void);
	void			vGet6ParInfo(unsigned char *, int ,const int *, int ,const unsigned char *);
	void			vGetParagraphInfo(unsigned char *, const pps_info_type *,
						const int *, int, const int *, int,
						const unsigned char *, int);
	void			vDestroyRowInfoList(void);
	void			vAdd2RowInfoList(const row_block_type *);
	void			vDestroyStyleInfoList(void);
	void			vAdd2StyleInfoList(const style_block_type *);
	void			vSet6DefaultTabWidth(unsigned char *, int ,
						const int *, int ,
						const unsigned char *);
	void			vSet8DefaultTabWidth(unsigned char *, const pps_info_type *,
						const int *, int , const int *, int ,
						const unsigned char *);
	void			vSetDefaultTabWidth(unsigned char *, const pps_info_type *,
						const int *, int, const int *, int,
						const unsigned char *, int);
	void			vStoreCharacter(int , output_type *);
	void			vStoreString(const unsigned short *,
						int , output_type *);
	void			vStoreIntegerAsDecimal(int , output_type *);
	void			vStoreIntegerAsRoman(int , output_type *);
	void			vStoreStyle(const style_block_type *, output_type *);
	void			vPutIndentation(diagram_type *, output_type *, bool ,
						int , unsigned char , char ,
						int );
	void			vName2String(char *, const unsigned char *, int );
	void			vComputePPSlevels(pps_entry_type *, pps_entry_type *,
						int , int );
	void			vCloseDocument(void);
	void 			*xmalloc(size_t);
	void 			*xrealloc(void *, size_t);
	void 			*xfree(void *);
	void			vGet8ParInfo(unsigned char *, const pps_info_type *,
						const int *, int , const int *, int ,
						const unsigned char *);
	int				iNextTextByte(unsigned char *, int *);
	int				iNextFootByte(unsigned char *, int *);
	int				iNextEndByte(unsigned char *, int *);
	int				iNextTextChar(unsigned char *, int *);
	int				iNextFootChar(unsigned char *, int *);
	int				iNextEndChar(unsigned char *, int *);
	int				iNextChar(unsigned char *, list_id_enum, int *);
	int				iTextOffset2FileOffset(int);
	int				iTranslateCharacters(int, int, bool);
	int				iToUpper(int);
	int				iDepotOffset(int, int);
	int				iFindSplit(const unsigned short  *, int);
	int				iInteger2Roman(int, bool, unsigned short *);
	int				iInteger2Alpha(int, bool, unsigned short *);
	int				iStyle2Window(unsigned short *, const style_block_type *);
	int				shortlen(unsigned short*);
	int				shortncpy(unsigned short*,unsigned short*,int);
	int				toUnicodeStr(unsigned short*,unsigned char*);
	int				iGet8InfoLength(int , const unsigned char *);
	int				iGetDefaultTabWidth(void);
	int				iTotalStringWidth(output_type *);
	int				iGetChar(unsigned char *, list_id_enum );
	int				iReadBlockIndices(unsigned char *, int *, int , int );
	int				iGet6InfoLength(int , const unsigned char *);
	unsigned int	uiGetDocumentLength(void);
	unsigned char	ucChooseListCharacter(unsigned char , unsigned char );
	unsigned long	ulReadLong(unsigned char *, long );
	unsigned short* shortrchr(unsigned short*,unsigned short);
	unsigned short* shortchr(unsigned short*,unsigned short);
	bool			testspace(unsigned short c);
	bool			vWord2Text(diagram_type *, unsigned char *,int);
	bool			bCreateSmallBlockList(int, const int *, int);
	bool			bAdd2TextBlockList(text_block_type *);
	bool			bAddBlocks(int , int, bool, int, const int *, int);
	bool			bReadBytes(unsigned char *, size_t, long, unsigned char *);
	bool			bReadBuffer(unsigned char *, int, const int *, int, int,
						unsigned char *, int, int);
	bool			bGet6StyleInfo(int , const unsigned char *,style_block_type *);
	bool			bGet8StyleInfo(int , const unsigned char *,style_block_type *);
	bool			bGetNextRowInfoListItem(row_block_type *);
	bool			bOutputContainsText(output_type *);
	bool			bGetBBD(unsigned char *, const int *, int ,
						int *, int );
	bool			bGetSBD(unsigned char *, const int *, int ,
						int *, int );
	bool			bGetPPS(unsigned char *,const int *, int ,pps_info_type *);
	bool			bGetDocumentText(unsigned char *, const pps_info_type *,
						const int *, int ,
						const int *, int ,
						const unsigned char *, int );
	bool			bInitDoc(unsigned char *,int );
	bool			vProcessFile(unsigned char *,int);
	text_info_enum	eGet6DocumentText(unsigned char *, bool, int,
						const int *, int, const unsigned char *);
	text_info_enum	eGet8DocumentText(unsigned char *, const pps_info_type *,
						const int *, int, const int *, int,
						const unsigned char *);
	font_block_type	*pGetNextFontInfoListItem(
						const font_block_type *);
	style_block_type	*pGetNextStyleInfoListItem(void);
	diagram_type	*pCreateDiagram(void);
	output_type		*pSplitList(output_type *);
	notetype_enum	eGetNotetype(int);
	row_info_enum	eGet6RowInfo(int , const unsigned char *, row_block_type *);
	row_info_enum	eGet8RowInfo(int , const unsigned char *, row_block_type *);
	output_type 	*pStartNextOutput(output_type *);
	output_type 	*pStartNewOutput(output_type *, output_type *);

public:
	bool			reset();
	int				is_me(u_char *buf,int len);
	bool			decode(u_char *inbuf,int insize,u_char *outbuf,int outbufsize);
	u_char*			get_result(int &retsize,int &type);
	bool			continue_decode();
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -