You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
1.8 KiB
C++
87 lines
1.8 KiB
C++
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
//文件 MTextParse.h
|
|
//主要功能:
|
|
// 多行文本分析器
|
|
//
|
|
//程序编写: 2008-05-07
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
#include ".\pointnamebase.h"
|
|
#include "rect8ex.h"
|
|
|
|
|
|
class CMTextParse
|
|
{
|
|
public:
|
|
CMTextParse(void);
|
|
virtual ~CMTextParse(void);
|
|
|
|
int ParseString(CString txt);
|
|
void Clear(void);
|
|
|
|
class COneText
|
|
{
|
|
public:
|
|
COneText(void);
|
|
void operator =(COneText &ot);
|
|
void CloneFont(COneText& ot);
|
|
|
|
void GetText(void* pText); //CText *pText
|
|
CString GetFormatString(COneText* pPrevText = NULL);
|
|
int GetWordSize(void); //获得字个数,包括汉字
|
|
|
|
LOGFONT m_font;
|
|
CSize8 m_size;
|
|
COLORREF m_color;
|
|
|
|
bool m_bEnter; //回车
|
|
bool m_bSuperscript;//上标
|
|
bool m_bSubscript; //下标
|
|
CString m_strSuperscript;
|
|
CString m_strSubscript;
|
|
|
|
CString m_string;
|
|
};
|
|
|
|
virtual void ScaleProperty(double sx, double sy);
|
|
void operator =(CMTextParse &tp);
|
|
int GetLength(void);
|
|
int GetLineCount(void);
|
|
CString GetFormatString(void);
|
|
|
|
CList<COneText*, COneText*> m_textList;
|
|
|
|
protected:
|
|
int m_nCurIndex;
|
|
CString m_string;
|
|
|
|
int ParseOne(COneText* pText);
|
|
CString GetOneString(bool *pEnter = NULL);
|
|
};
|
|
|
|
class CMText : public CPointNameBase
|
|
{
|
|
public:
|
|
CMText(void);
|
|
virtual ~CMText(void);
|
|
|
|
virtual int Read(CFile& fr, const short& ver);
|
|
virtual void Write(CFile& fw, const short& ver);
|
|
void Serialize(CArchive& ar, const short &ver) override;
|
|
|
|
virtual void Clear(void);
|
|
virtual CString GetName(void);
|
|
virtual int SetName(LPCTSTR lpString);
|
|
virtual void GetRange(CRect8& range);
|
|
virtual int IsInRange(CRect8& range);
|
|
virtual void ScaleProperty(double sx, double sy);
|
|
virtual void Calibrate(int type, void* pValue);
|
|
|
|
void operator=(CMText& mt);
|
|
|
|
DWORD m_nFlags; //仅为了扩展
|
|
CMTextParse m_parse;
|
|
};
|