|
|
#pragma once
|
|
|
#include "InTrackDepthSegment.h"
|
|
|
//文本类
|
|
|
class AFX_EXT_CLASS CInTrackTextBase : public CInTrackDepthSegment
|
|
|
{
|
|
|
protected:
|
|
|
|
|
|
|
|
|
protected:
|
|
|
DWORD m_nTrackContentStyle;//大块内容式样
|
|
|
enum TrackContentStyle
|
|
|
{
|
|
|
///大块绘制式样
|
|
|
TrackContentStyleNormal = 0x0001, //默认
|
|
|
TrackContentStyleLeft = 0x0002, //左边界指示厚度
|
|
|
TrackContentStyleRight = 0x0004, //右边界指示厚度
|
|
|
};
|
|
|
|
|
|
public:
|
|
|
CInTrackTextBase();
|
|
|
CInTrackTextBase(const CRect8& position);
|
|
|
virtual ~CInTrackTextBase();
|
|
|
public:
|
|
|
int m_nPartNum; //道内分栏序号
|
|
|
int m_selStartX, m_selEndX; //文本中被选中的文本串的起始字符所在列,结束字符所在列
|
|
|
int m_selStartY, m_selEndY; //文本中被选中的文本串的起始字符所在行,结束字符所在行
|
|
|
//m_UpLowIdArr用来标识文本上下标的数组,数组中每三个元素为一组,
|
|
|
//第一个是上下标或普通字符的标识,C,普通字符,U上标,L下标
|
|
|
//第二个是当前标识的起始位置,第三个是当前标识的结束位置。
|
|
|
//CArray<int,int> m_UpLowIdArr;
|
|
|
CText m_Text;
|
|
|
//COLORREF m_Color;
|
|
|
double m_TopContentExtend; //顶部移动数值
|
|
|
double m_BotContentExtend; //底部移动数值
|
|
|
|
|
|
public:
|
|
|
///开关变量
|
|
|
virtual void SetTrackContentStyle(DWORD flags);
|
|
|
virtual void SetContentStyleNormal(BOOL bFlag);
|
|
|
virtual void SetContentStyleLeft(BOOL bFlag);
|
|
|
virtual void SetContentStyleRight(BOOL bFlag);
|
|
|
|
|
|
virtual DWORD GetTrackContentStyle();
|
|
|
virtual BOOL GetContentStyleNormal();
|
|
|
virtual BOOL GetContentStyleLeft();
|
|
|
virtual BOOL GetContentStyleRight();
|
|
|
|
|
|
virtual void Draw(CXyDC* pDC);
|
|
|
//virtual BOOL Intersects(const CRect8& rect, double dHandleSize);
|
|
|
virtual void MoveTo(CRect8& position);
|
|
|
virtual void MoveHandleTo(int nHandle, CPoint2D point);
|
|
|
|
|
|
virtual void operator=(CInTrackTextBase& object);
|
|
|
|
|
|
virtual void Serialize(CArchive& ar, const short &ver);
|
|
|
|
|
|
//重设矩形范围
|
|
|
virtual void ReSetPosition(CRect8 rect);
|
|
|
|
|
|
//标准化文字操作
|
|
|
virtual void NormalText();
|
|
|
|
|
|
//当输出文本需要旋转时,SetWorldRotate用来将DC的坐标系旋转。
|
|
|
static void SetWorldRotate(CDC *pDC, int nAngle, CPoint centerPt, int &oldMode);
|
|
|
//当输出文本旋转结束时,ResetWorldRotate用来将DC的坐标系设置为正常
|
|
|
static void ResetWorldRotate(CDC *pDC, int nAngle, int oldMode);
|
|
|
|
|
|
|
|
|
BOOL CanShowSelText();//判断是文本中是否被选中了部分文字
|
|
|
void SetHideSel();//取消文本中被选中的部分文字的选中状态
|
|
|
//得到文本的大小,cnum是正常的文字数字,lunum是上下标的文字个数
|
|
|
CSize GetTextSize(CDC *pDC, int& cnum, int& lunum);
|
|
|
|
|
|
//创建上下标文本所用的字体,只有普通文本字体的一半高度
|
|
|
void CreateUpLowFont(CFont &font, CSize size, LOGFONT& logfont);
|
|
|
|
|
|
//删除当前选中的字符串
|
|
|
void DelSubStr(int &CaretX, int &CaretY);
|
|
|
//设置当前选中的字符为上下标。
|
|
|
void SetUpOrLowId(int id);
|
|
|
|
|
|
void SetUpOrLow(int type, int index);
|
|
|
|
|
|
// 自动设置上下标
|
|
|
void SetUpOrLowAuto();
|
|
|
|
|
|
//设置字符串中选中的部分的位置。
|
|
|
void SetSelectChar(CPoint2D downPt, CPoint2D localPt);
|
|
|
//当点Pt在文本区域内部时使用GetCaretXYPos1,得到点Pt所在文本串中的行、列字符位置。
|
|
|
void GetCaretXYPos1(CDC *pDC, CPoint2D pt, int& CaretX, int& CaretY);
|
|
|
//点Pt在文本区域附近,如上部,右侧时用GetCaretXYPos2得到点Pt所在文本串中的行、列字符位置
|
|
|
//只有当选择字符串时移动鼠标并松开时的点,才会用到GetCaretXYPos2
|
|
|
void GetCaretXYPos2(CDC *pDC, CPoint2D pt, int& CaretX, int& CaretY);
|
|
|
//得到行、列CaretX,CaretY在字符串总长度中的位置CaretArrPos
|
|
|
void GetCaretArrPos(int& CaretArrPos, int CaretX, int CaretY);
|
|
|
void GetStrFmt(CStringArray* pstrArr, CString str, int& maxcol, int&rownum);
|
|
|
//得到行列
|
|
|
void GetStrRowColumn(int &rows, CString str, CUIntArray &startArr, CUIntArray &endArr);
|
|
|
|
|
|
virtual BOOL IsDerivedTextBase() { return TRUE; }
|
|
|
//为了斜井文字绘制
|
|
|
public:
|
|
|
//画文本内容(换行处理) 2015-11-3
|
|
|
virtual void DrawInclinedTextContent(CXyDC* pDC, CString text, GDFLOGFONT *plogFont, int nHor = 1, int nVer = 1);
|
|
|
//画多边形中的文本内容,多边形左右边界已指定 2015-11-3
|
|
|
virtual void DrawInclinedTextContent(CCurveEx& leftBorder, CCurveEx& rightBorder, CXyDC* pDC, CString text, GDFLOGFONT *plogFont, int nHor = 1, int nVer = 1);
|
|
|
|
|
|
// 绘制斜井文本框的包络线
|
|
|
virtual void DrawInclinedOutline(CXyDC* pDC);
|
|
|
|
|
|
|
|
|
};
|