_edit.h

来自「Windows CE 6.0 Word Application 源码」· C头文件 代码 · 共 1,115 行 · 第 1/3 页

H
1,115
字号
	void CheckRemoveContinuousScroll ();

	// Scrolling
	HRESULT	TxHScroll(WORD wCode, int xPos);
	LRESULT	TxVScroll(WORD wCode, int yPos);
	HRESULT	TxLineScroll(LONG cli, LONG cch);
	
	// Paint, size message
	LRESULT OnSize(HWND hwnd, WORD fwSizeType, int nWidth, int nHeight);

	// Selection commands
	LONG	OnGetSelText(TCHAR *psz);
	LRESULT OnGetSel(LONG *pcpMin, LONG *pcpMost) const;
	void	OnSetSel(LONG cpMin, LONG cpMost);
	void	OnExGetSel(CHARRANGE *pcr) const;
	
	// Editing commands
	void	OnClear(IUndoBuilder *publdr);
	LONG	OnReplaceSel(LONG cchNew, const TCHAR *pch, IUndoBuilder *publdr);
	
	// Format range related commands
	LONG	OnFormatRange(
				FORMATRANGE *pfr, 
				SPrintControl prtcon,
				HDC hdcMeasure = NULL,
				LONG xMeasurePerInch = 0,
				LONG yMeasurePerInch = 0);
	
public:
	BOOL	OnDisplayBand(const RECT *prc, BOOL fPrintFromDraw);

private:
	// Scrolling commands
	void	OnScrollCaret();

	// Focus messages
	LRESULT OnSetFocus();
	LRESULT OnKillFocus();

	// System notifications
	HRESULT	OnContextMenu(LPARAM lparam);

	// Get/Set other properties commands
	LRESULT OnFindText(UINT msg, DWORD flags, FINDTEXTEX *pftex);
	LRESULT OnGetWordBreakProc();
	LRESULT OnSetWordBreakProc();

	// Richedit stuff
	LRESULT	OnGetCharFormat(CCharFormat *pcf, DWORD flags);
	LRESULT	OnGetParaFormat(CParaFormat *ppf);
	LONG 	OnSetCharFormat(WPARAM wparam, CCharFormat *pCF, IUndoBuilder *publdr);
	LONG 	OnSetParaFormat(WPARAM wparam, CParaFormat *pPF, IUndoBuilder *publdr);
	LONG 	OnSetFont(HFONT hfont);

	LRESULT	OnDropFiles(HANDLE hDropFiles);

	// Other services
	HRESULT TxPosFromChar(LONG cp, LPPOINT ppt);
	HRESULT TxGetLineCount(LONG *pcli);
	HRESULT	TxLineFromCp(LONG cp, LONG *pli);
	HRESULT	TxLineLength(LONG cp, LONG *pcch);
	HRESULT	TxLineIndex(LONG ili, LONG *pcp);
	HRESULT TxFindText(DWORD flags, LONG cpMin, LONG cpMost, TCHAR *pch, LONG *pcp);
	HRESULT TxFindWordBreak(INT nFunction, LONG cp, LONG *plRet);

	HRESULT SetText(LPCWSTR pwszText, SetTextFlags flags);


	// Other miscelleneous 
#ifdef DEBUG
	void	OnDumpPed();
#endif

#ifdef PENWIN20
	void	OnFeedbackCursor(HCURSOR hcur);
	LONG	OnHitTest(POINT pt);
	void	OnCorrectText(LPRC prc);
#endif // PENWIN20

	HRESULT OnInsertDIB(LPARAM lparam, IUndoBuilder *publdr);

	COleObject * ObjectFromIOB(LONG iob);

	// Only when the selection is going away should this value be NULLed. We 
	// use SelectionNull function rather than CTxtSelection::~CTxtSelection 
	// to avoid circular dependencies.
	friend void SelectionNull(CTxtEdit *ped);
	void	SetSelectionToNull() { _psel = NULL; }

	// Helper for converting a rich text object to plain text.
	void HandleRichToPlainConversion();

	// Helper for when plain text IME composition needs to clean up.
	void HandleIMEToPlain();

	// Helper for clearing the undo buffers.
	void ClearUndo(IUndoBuilder *publdr);

	// Helper for setting the automatic EOP
	void SetRichDocEndEOP(LONG cchToReplace);

#ifndef MACPORT
	// Helper for OnDropFiles.  Not present on the Macintosh
	LRESULT CTxtEdit::InsertFromFile ( LPCTSTR lpFile );
#endif
//
//	Data Members
//

public:	
	static DWORD 		_dwTickDblClick;	// time of last double-click
	static POINT 		_ptDblClick;		// position of last double-click

	static HCURSOR 		_hcurArrow;
//	static HCURSOR 		_hcurCross;			// OutlineSymbol drag not impl
	static HCURSOR 		_hcurHand;
	static HCURSOR 		_hcurIBeam;
	static HCURSOR 		_hcurItalic;
	static HCURSOR 		_hcurSelBar;

	typedef HRESULT (CTxtEdit::*FNPPROPCHG)(BOOL fPropFlag);

	static FNPPROPCHG 	_fnpPropChg[MAX_PROPERTY_BITS];

	// Only wrapper functions should use this member...
	ITextHost*			_phost;		// host 

	// word break procedure
	EDITWORDBREAKPROC 	_pfnWB;		// word break procedure

	// display subsystem
	CDisplay *			_pdp;		// display
	CDisplayPrinter *	_pdpPrinter;// display for printer

	// undo
	IUndoMgr *			_pundo;		// the undo stack
	IUndoMgr *			_predo;		// the redo stack

	// data transfer
	CLightDTEngine 		_ldte;		// the data transfer engine

	CNotifyMgr 			_nm;		// the notification manager (for floating

	// OLE support
	CObjectMgr *		_pobjmgr;	// handles most high-level OLE stuff

	// Re-entrancy && Notification Management
	CCallMgr *			_pcallmgr;

	// URL detection
	CDetectURL *		_pdetecturl;// manages auto-detection of URL strings
	
	// IME support
	class CIme	*_ime;				// non-NULL when IME level 2 or 3 composition active
	CDocInfo *	_pDocInfo;			// Document info (name, flags, code page)

	// BiDi support
	CBiDiEngine *		_pBiDiEngine;	// handles various bidi text functions.

	union
	{
	  DWORD _dwFlags;				// All together now
	  struct
	  {

#define TXTBITS (TXTBIT_RICHTEXT	  | \
				 TXTBIT_READONLY	  | \
				 TXTBIT_USEPASSWORD   | \
				 TXTBIT_HIDESELECTION | \
				 TXTBIT_VERTICAL	  | \
				 TXTBIT_ALLOWBEEP	 | \
				 TXTBIT_DISABLEDRAG   )

		//	State information. Flags in TXTBITS must appear in same bit
		//	positions as the following (saves code in Init())

		//	TXTBIT_RICHTEXT			0	_fRich
		//	TXTBIT_MULTILINE		1
		//	TXTBIT_READONLY			2	_fReadOnly
		//	TXTBIT_SHOWACCELERATOR	3
		//	TXTBIT_USEPASSWORD		4	_fUsePassword
		//	TXTBIT_HIDESELECTION	5	_fHideSelection
		//	TXTBIT_SAVESELECTION	6
		//	TXTBIT_AUTOWORDSEL		7		
		//	TXTBIT_VERTICAL			8	
		//	TXTBIT_SELECTIONBAR		9
		//	TXTBIT_WORDWRAP  		10
		//	TXTBIT_ALLOWBEEP		11	_fAllowBeep
		//  TXTBIT_DISABLEDRAG	  12	_fDisableDrag
		//  TXTBIT_VIEWINSETCHANGE	13
		//  TXTBIT_BACKSTYLECHANGE	14
		//  TXTBIT_MAXLENGTHCHANGE	15
		//  TXTBIT_SCROLLBARCHANGE	16
		//  TXTBIT_CHARFORMATCHANGE 17
		//  TXTBIT_PARAFORMATCHANGE	18
		//  TXTBIT_EXTENTCHANGE		19
		//  TXTBIT_CLIENTRECTCHANGE	20

#ifdef MACPORT 
//NOTE: Different BIT ordering on the MAC requires that we flip the following bit fields.
//		This is because they are unioned with _dwFlags which is bit compared using the
//		TXTBIT_xxx flags
//		IMPORTANT: For Mac, all 32 bits must be filled out, else they'll be shifted.
	
		DWORD	_fUpdateSelection	:1;	// 31: If true, update sel at level 0
		DWORD	_fDragged			:1;	// 30: Was the selection actually dragged?
		DWORD	_fKANAMode			:1;	// 29: Japanese KANA input mode	
		DWORD	_fIMECancelComplete	:1;	// 28: If aborting IME, cancel the comp string, else complete.
		DWORD	_fInOurHost			:1; // 27: Whether we are in our host
		DWORD	_fSaved				:1;	// 26: ITextDocument Saved property
		DWORD	_fFiller			:1;	// 25: UNUSED!!!.
		DWORD	_fMButtonCapture	:1;	// 24: captured mButton down.
 		DWORD	_fContinuousScroll	:1;	// 23: We have a timer running to support scrolling.

		DWORD	_fAutoKeyboard		:1;	// 22: auto switching keyboard
		
		// Miscellaneous bits used by IME
		DWORD	_fAutoFont			:1;	// 21: auto switching font

		// Miscellaneous bits
		DWORD 	_fUseUndo			:1;	// 20: Only set to zero if undo limit is 0
		DWORD	_f10Mode			:1;	// 19: Use Richedit10 behavior

		DWORD	_fRichPrevAccel		:1; // 18: Rich state previous to accelerator
		DWORD	_fWantDrag			:1;	// 17: Want to initiate drag & drop
		DWORD	_fStreaming			:1;	// 16: Currently streaming text in or out
		DWORD	_fScrollCaretOnFocus:1;	// 15: Scroll caret into view on set focus
		DWORD	_fModified			:1;	// 14: Control text has been modified
		DWORD	_fIconic			:1;	// 13: Control/parent window is iconized
		DWORD   _fDisableDrag		:1;	// 12: Disable Drag
		DWORD	_fAllowBeep			:1; // 11: Allow beep at doc boundaries
		DWORD	_fTransparent		:1;	// 10: Background transparency
		DWORD	_fMouseDown			:1;	// 9: One mouse button is current down
		DWORD	_fEatLeftDown		:1;	// 8: Eat the next left down?
		DWORD	_fFocus				:1;	// 7: Control has keyboard focus
		DWORD	_fOverstrike		:1;	// 6: Overstrike mode vs insert mode
		DWORD	_fHideSelection		:1; // 5: Hide selection when inactive
		DWORD	_fUsePassword		:1; // 4: Whether to use password char
		DWORD 	_fInPlaceActive		:1;	// 3: Control is in place active
		DWORD	_fReadOnly			:1;	// 2: Control is read only
		DWORD	_fCapture			:1;	// 1: Control has mouse capture
		DWORD	_fRich				:1;	// 0: Use rich-text formatting

#else

		DWORD	_fRich				:1;	// 0: Use rich-text formatting
		DWORD	_fCapture			:1;	// 1: Control has mouse capture
		DWORD	_fReadOnly			:1;	// 2: Control is read only
		DWORD 	_fInPlaceActive		:1;	// 3: Control is in place active
		DWORD	_fUsePassword		:1; // 4: Whether to use password char
		DWORD	_fHideSelection		:1; // 5: Hide selection when inactive
		DWORD	_fOverstrike		:1;	// 6: Overstrike mode vs insert mode
		DWORD	_fFocus				:1;	// 7: Control has keyboard focus
		DWORD	_fEatLeftDown		:1;	// 8: Eat the next left down?
		DWORD	_fMouseDown			:1;	// 9: One mouse button is current down
		DWORD	_fTransparent		:1;	// 10: Background transparency
		DWORD	_fAllowBeep			:1; // 11: Allow beep at doc boundaries
		DWORD   _fDisableDrag		:1;	// 12: Disable Drag

		DWORD	_fIconic			:1;	// 13: Control/parent window is iconized
		DWORD	_fModified			:1;	// 14: Control text has been modified
		DWORD	_fScrollCaretOnFocus:1;	// 15: Scroll caret into view on set focus
		DWORD	_fStreaming			:1;	// 16: Currently streaming text in or out
		DWORD	_fWantDrag			:1;	// 17: Want to initiate drag & drop
		DWORD	_fRichPrevAccel		:1; // 18: Rich state previous to accelerator
	
		// Miscellaneous bits
		DWORD	_f10Mode			:1;	// 19: Use Richedit10 behavior
		DWORD 	_fUseUndo			:1;	// 20: Only set to zero if undo limit is 0
	

		// Miscellaneous bits used by IME
		DWORD	_fAutoFont			:1;	// 21: auto switching font
		DWORD	_fAutoKeyboard		:1;	// 22: auto switching keyboard

		DWORD	_fContinuousScroll	:1;	// 23: Timer runs to support scrolling
		DWORD	_fMButtonCapture	:1;	// 24: captured mButton down
		DWORD	_fFiller			:1;	// 25: UNUSED!!!
		DWORD	_fSaved				:1;	// 26: ITextDocument Saved property
		DWORD	_fInOurHost			:1; // 27: Whether we are in our host
		DWORD	_fIMECancelComplete	:1; // 28: If aborting IME, cancel comp string, else complete
		DWORD	_fKANAMode			:1;	// 29: Japanese KANA input mode

		// Drag/Drop UI refinement.
		DWORD	_fDragged			:1;	// 30: Was the selection actually dragged?
		DWORD	_fUpdateSelection	:1;	// 31: If true, update sel at level 0
#endif
	  };
	};

#define	CD_LTR	2
#define	CD_RTL	3

	WORD		_nContextDir		:2;	// 0: no context; else CD_LTR or CD_RTL
	WORD		_fSelfDestruct		:1;	// This CTxtEdit is selfdestructing
	WORD		_fIMEAlwaysNotify	:1;	// Send Notification during IME undetermined string

	WORD		_cActiveObjPosTries :2; // this little counter protects us from an infinite 
										// loop of repaints when trying to put a dragged-away 
										// in-place active object to where it belongs
	WORD		_fSingleCodePage	:1;	// If TRUE, only allow single code page
										// for editing

	// Miscellaneous bits used for BiDi input
	WORD		_fControl			:1;	// Control key is held down
	WORD		_fLShift			:1;	// Left shift key is held down
	WORD		_fRShift			:1;	// Right shift key is held down
	WORD		_fHbrCaps			:1;	// Intialization of state of hebrew and caps lock status
 
	WORD		_fActivateKbdOnFocus:1;	// Activate new keyboard layout on WM_SETFOCUS
	WORD		_fOutlineView		:1;	// Outline mode is active
	BYTE		_bDeadKey;				// Dead key (`'^~:) to apply to next char

	BYTE		_DeleteBeforeConvert;	// Fix for WinCEOS RAID #12736

 	DWORD		_dwEventMask;			// Event mask
	DWORD		_cBiDiTxtLength;

	// GuyBark JupiterJ IME: Freeze the display while we walk the caret.
	BOOL		_fDisplayFrozen;

private:
	HKL			_ActiveKbdLayer;
	SHORT		_cpAccelerator;			// Range for accelerator
	SHORT		_iCF;					// Default CCharFormat index
	SHORT		_iPF;					// Default CParaFormat index
	WORD		_wZoomNumerator;
	WORD		_wZoomDenominator;

	POINT		_mousePt;				// Last known mouse position.

	// We need to have at least some of the following members on a per-instance
	// basis to handle simultaneous scrolling of two or more controls.
	// NOTE: the int's can be switched to SHORTs, since pixels are used and
	// 32768 pixels is a mighty big screen! 
	DWORD		_dwFkeys;				// State of function keys

	LONG		_cchTextMost;			// Maximum allowed text


	friend class CRchTxtPtr;

	IUnknown *	_punk;					// IUnknown to use

	class CUnknown : public IUnknown
	{
		friend class CCallMgr;
	private:

		DWORD	_cRefs;					// Reference count

	public:

		void	Init() {_cRefs = 1; }

		HRESULT WINAPI QueryInterface(REFIID riid, void **ppvObj);
		ULONG WINAPI	AddRef();
		ULONG WINAPI Release();
	};

	friend class CUnknown;

	CUnknown 	_unk;					// Object that implements IUnknown	
	CTxtStory _story;
	CTxtSelection *_psel;				// Selection object

};

#endif

⌨️ 快捷键说明

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