_edit.h

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

H
1,115
字号
	BOOL		TxClientToScreen (LPPOINT lppt)	{return _phost->TxClientToScreen(lppt); }
	BOOL		TxScreenToClient (LPPOINT lppt)	{return _phost->TxScreenToClient(lppt); }


	//	ITextServices 2 wrappers				
	BOOL		TxIsDoubleClickPending();
	HRESULT		TxGetWindow(HWND *phwnd);
	HRESULT		TxSetForegroundWindow();
	HPALETTE	TxGetPalette();

	// Host service API
	// Called by Text Services component 
	
	HRESULT	 TxActivate( LONG * pOldState ) { return _phost->TxActivate( pOldState ); }
	HRESULT	 TxDeactivate( LONG NewState ) { return _phost->TxDeactivate( NewState ); }
	
	
	// Allowed only when in in-place 
	// The host will fail if not in-place
	
	HDC 		TxGetDC()				
										{return _phost->TxGetDC();}
	INT			TxReleaseDC(HDC hdc)	
										{return _phost->TxReleaseDC(hdc);}
	
	// Helper functions for metafile support
	INT			TxReleaseMeasureDC( HDC hMeasureDC );

	void 		TxUpdateWindow()								
				{
					_phost->TxViewChange(_fInPlaceActive ? TRUE : FALSE);
				}
	void		TxScrollWindowEx (INT dx, INT dy, LPCRECT lprcScroll, LPCRECT lprcClip,
								HRGN hrgnUpdate, LPRECT lprcUpdate, UINT fuScroll);

	void		TxSetCapture(BOOL fCapture)
										{_phost->TxSetCapture(fCapture);}
	void		TxSetFocus()			
										{_phost->TxSetFocus();}

	// Allowed any-time
	
	BOOL 		TxShowScrollBar(INT fnBar, BOOL fShow)		
										{return _phost->TxShowScrollBar(fnBar, fShow);}
	BOOL 		TxEnableScrollBar (INT fuSBFlags, INT fuArrowFlags)	
										{return _phost->TxEnableScrollBar(fuSBFlags, fuArrowFlags);}
	BOOL 		TxSetScrollRange(INT fnBar, LONG nMinPos, INT nMaxPos, BOOL fRedraw)
										{return _phost->TxSetScrollRange(fnBar, nMinPos, nMaxPos, fRedraw);}
	BOOL 		TxSetScrollPos (INT fnBar, INT nPos, BOOL fRedraw)
										{return _phost->TxSetScrollPos(fnBar, nPos, fRedraw);}
	void		TxInvalidateRect(const LPRECT prc, BOOL fMode)
										{_phost->TxInvalidateRect(prc, fMode);}
	BOOL		TxCreateCaret(HBITMAP hbmp, INT xWidth, INT yHeight)
										{return _phost->TxCreateCaret(hbmp, xWidth, yHeight);}
	BOOL		TxShowCaret(BOOL fShow)			
										{return _phost->TxShowCaret(fShow);}
	BOOL		TxSetCaretPos(INT x, INT y)			
										{return _phost->TxSetCaretPos(x, y);}
	BOOL 		TxSetTimer(UINT idTimer, UINT uTimeout)
										{return _phost->TxSetTimer(idTimer, uTimeout);}
	void 		TxKillTimer(UINT idTimer)
										{_phost->TxKillTimer(idTimer);}
	COLORREF	TxGetSysColor(int nIndex){ return _phost->TxGetSysColor(nIndex);}

	// IME
	HIMC		TxImmGetContext()		{return _phost->TxImmGetContext();}
	void		TxImmReleaseContext(HIMC himc)
										{_phost->TxImmReleaseContext( himc );}
	BOOL		IsIMEComposition()		{return (_ime != NULL);};
	BOOL		IsAutoFont()			{return _fAutoFont;};
	BOOL		IsAutoKeyboard()		{return _fAutoKeyboard;};

	// Selection access
	CTxtSelection *GetSel();
	CTxtSelection *GetSelNC() { return _psel; }
	LONG 	GetSelMin() const;
	LONG 	GetSelMost() const;
	void 	GetSelRangeForRender(LONG *pcpSelMin, LONG *pcpSelMost);
	void	DiscardSelection();


	// Property Change Helpers
	HRESULT OnRichEditChange(BOOL fFlag);
	HRESULT	OnTxMultiLineChange(BOOL fMultiLine);
	HRESULT	OnTxReadOnlyChange(BOOL fReadOnly);
	HRESULT	OnShowAccelerator(BOOL fPropertyFlag);
	HRESULT	OnUsePassword(BOOL fPropertyFlag);
	HRESULT	OnTxHideSelectionChange(BOOL fHideSelection);
	HRESULT	OnSaveSelection(BOOL fPropertyFlag);
	HRESULT	OnAutoWordSel(BOOL fPropertyFlag);
	HRESULT	OnTxVerticalChange(BOOL fVertical);
	HRESULT	NeedViewUpdate(BOOL fPropertyFlag);
	HRESULT	OnWordWrapChange(BOOL fPropertyFlag);
	HRESULT	OnAllowBeep(BOOL fPropertyFlag);
	HRESULT OnDisableDrag(BOOL fPropertyFlag);
	HRESULT	OnTxBackStyleChange(BOOL fPropertyFlag);
	HRESULT	OnMaxLengthChange(BOOL fPropertyFlag);
	HRESULT OnCharFormatChange(BOOL fPropertyFlag);
	HRESULT OnParaFormatChange(BOOL fPropertyFlag);
	HRESULT	OnClientRectChange(BOOL fPropertyFlag);
	HRESULT OnScrollChange(BOOL fProperyFlag);
	
	// Helpers
	HRESULT	TxCharFromPos(LPPOINT ppt, LONG *pcp);
	HRESULT	OnTxUsePasswordChange(BOOL fUsePassword);
	HRESULT FormatAndPrint(
				HDC hdcDraw,		
				HDC hicTargetDev,	
				DVTARGETDEVICE *ptd,
				RECT *lprcBounds,
				RECT *lprcWBounds);

	HRESULT RectChangeHelper(
				CDrawInfo *pdi,
				DWORD dwDrawAspect,
				LONG  lindex,
				void *pvAspect,
				DVTARGETDEVICE *ptd,
				HDC hdcDraw,
				HDC hicTargetDev,
				const RECT *lprcClient, 
				RECT *prcLocal);

	//
	// PUBLIC INTERFACE METHODS
	//

	// -----------------------------
	//	IUnknown interface
	// -----------------------------

	virtual HRESULT 	WINAPI QueryInterface(REFIID riid, void **ppvObject);
	virtual ULONG 		WINAPI AddRef(void);
	virtual ULONG 		WINAPI Release(void);

	//--------------------------------------------------------------
	// ITextServices methods
	//--------------------------------------------------------------
	//@cmember Generic Send Message interface
	virtual HRESULT 	TxSendMessage(
							UINT msg, 
							WPARAM wparam, 
							LPARAM lparam,
							LRESULT *plresult);
	
	//@cmember Rendering
	virtual HRESULT		TxDraw(	
							DWORD dwDrawAspect,		// draw aspect
							LONG  lindex,			// currently unused
							void * pvAspect,		// info for drawing 
													// optimizations (OCX 96)
							DVTARGETDEVICE * ptd,	// information on target 
													// device								'
							HDC hdcDraw,			// rendering device context
							HDC hicTargetDev,		// target information 
													// context
							LPCRECTL lprcBounds,	// bounding (client) 
													// rectangle
							LPCRECTL lprcWBounds,	// clipping rect for 
													// metafiles
			   				LPRECT lprcUpdate,		// dirty rectange insde 
			   										// lprcBounds
							BOOL (CALLBACK * pfnContinue) (DWORD), // for 
													// interupting 
							DWORD dwContinue,		// long displays (currently 
													// unused) 
							LONG lViewID);			// Specifies view to redraw

	//@cmember Horizontal scrollbar support
	virtual HRESULT		TxGetHScroll(
							LONG *plMin, 
							LONG *plMax, 
							LONG *plPos, 
							LONG *plPage,
							BOOL * pfEnabled );

   	//@cmember Horizontal scrollbar support
	virtual HRESULT		TxGetVScroll(
							LONG *plMin, 
							LONG *plMax, 
							LONG *plPos, 
							LONG *plPage, 
							BOOL * pfEnabled );

	//@cmember Setcursor
	virtual HRESULT 	OnTxSetCursor(
							DWORD dwDrawAspect,		// draw aspect
							LONG  lindex,			// currently unused
							void * pvAspect,		// info for drawing 
													// optimizations (OCX 96)
							DVTARGETDEVICE * ptd,	// information on target 
													// device								'
							HDC hdcDraw,			// rendering device context
							HDC hicTargetDev,		// target information 
													// context
							LPCRECT lprcClient, 
							INT x, 
							INT y);

	//@cmember Hit-test
	virtual HRESULT 	TxQueryHitPoint(
							DWORD dwDrawAspect,		// draw aspect
							LONG  lindex,			// currently unused
							void * pvAspect,		// info for drawing 
													// optimizations (OCX 96)
							DVTARGETDEVICE * ptd,	// information on target 
													// device								'
							HDC hdcDraw,			// rendering device context
							HDC hicTargetDev,		// target information 
													// context
							LPCRECT lprcClient, 
							INT x, 
							INT y, 
							DWORD * pHitResult);

	//@member Inplace activate notification
	virtual HRESULT		OnTxInPlaceActivate(const RECT *prcClient);

	//@member Inplace deactivate notification
	virtual HRESULT		OnTxInPlaceDeactivate();

	//@member UI activate notification
	virtual HRESULT		OnTxUIActivate();

	//@member UI deactivate notification
	virtual HRESULT		OnTxUIDeactivate();

	//@member Get text in control
	virtual HRESULT		TxGetText(BSTR *pbstrText);

	//@member Set text in control
	virtual HRESULT		TxSetText(LPCTSTR pszText);
	
	//@member Get x position of 
	virtual HRESULT		TxGetCurTargetX(LONG *);
	//@member Get baseline position
	virtual HRESULT		TxGetBaseLinePos(LONG *);

	//@member Get Size to fit / Natural size
	virtual HRESULT		TxGetNaturalSize(
							DWORD dwAspect,
							HDC hdcDraw,
							HDC hicTargetDev,
							DVTARGETDEVICE *ptd,
							DWORD dwMode, 
							const SIZEL *psizelExtent,
							LONG *pwidth, 
							LONG *pheight);

	//@member Drag & drop
	virtual HRESULT		TxGetDropTarget( IDropTarget **ppDropTarget );

	//@member Bulk bit property change notifications
	virtual HRESULT		OnTxPropertyBitsChange(DWORD dwMask, DWORD dwBits);

	//@cmember Fetch the cached drawing size 
	virtual	HRESULT		TxGetCachedSize(DWORD *pdwWidth, DWORD *pdwHeight);
	
	//	IDispatch methods

   	STDMETHOD(GetTypeInfoCount)( UINT * pctinfo);

	STDMETHOD(GetTypeInfo)(
	  
	  UINT itinfo,
	  LCID lcid,
	  ITypeInfo **pptinfo);

	STDMETHOD(GetIDsOfNames)(
	  
	  REFIID riid,
	  OLECHAR **rgszNames,
	  UINT cNames,
	  LCID lcid,
	  DISPID * rgdispid);

	STDMETHOD(Invoke)(
	  
	  DISPID dispidMember,
	  REFIID riid,
	  LCID lcid,
	  WORD wFlags,
	  DISPPARAMS * pdispparams,
	  VARIANT * pvarResult,
	  EXCEPINFO * pexcepinfo,
	  UINT * puArgErr);


	// ITextDocument methods
	STDMETHOD(GetName)(BSTR *pName);
	STDMETHOD(GetSelection)(ITextSelection **ppSel);
	STDMETHOD(GetStoryCount)(long *pCount);
	STDMETHOD(GetStoryRanges)(ITextStoryRanges **ppStories);
	STDMETHOD(GetSaved)(long *pValue);
	STDMETHOD(SetSaved)(long Value);
	STDMETHOD(GetDefaultTabStop)(float *pValue);
	STDMETHOD(SetDefaultTabStop)(float Value);
	STDMETHOD(New)();
	STDMETHOD(Open)(VARIANT *pVar, long Flags, long CodePage);
	STDMETHOD(Save)(VARIANT *pVar, long Flags, long CodePage);
	STDMETHOD(Freeze)(long *pCount);
	STDMETHOD(Unfreeze)(long *pCount);
	STDMETHOD(BeginEditCollection)();
	STDMETHOD(EndEditCollection)();
	STDMETHOD(Undo)(long Count, long *prop);
	STDMETHOD(Redo)(long Count, long *prop);
	STDMETHOD(Range)(long cpFirst, long cpLim, ITextRange ** ppRange);
	STDMETHOD(RangeFromPoint)(long x, long y, ITextRange **ppRange);

	// IRichEditOle methods
	STDMETHOD(GetClientSite) ( LPOLECLIENTSITE  *lplpolesite);
	STDMETHOD_(LONG,GetObjectCount) (THIS);
	STDMETHOD_(LONG,GetLinkCount) (THIS);
	STDMETHOD(GetObject) ( LONG iob, REOBJECT  *lpreobject,
						  DWORD dwFlags);
	STDMETHOD(InsertObject) ( REOBJECT  *lpreobject);
	STDMETHOD(ConvertObject) ( LONG iob, REFCLSID rclsidNew,
							  LPCSTR lpstrUserTypeNew);
	STDMETHOD(ActivateAs) ( REFCLSID rclsid, REFCLSID rclsidAs);
	STDMETHOD(SetHostNames) ( LPCSTR lpstrContainerApp, 
							 LPCSTR lpstrContainerObj);
	STDMETHOD(SetLinkAvailable) ( LONG iob, BOOL fAvailable);
	STDMETHOD(SetDvaspect) ( LONG iob, DWORD dvaspect);
	STDMETHOD(HandsOffStorage) ( LONG iob);
	STDMETHOD(SaveCompleted) ( LONG iob, LPSTORAGE lpstg);
	STDMETHOD(InPlaceDeactivate) (THIS);
	STDMETHOD(ContextSensitiveHelp) ( BOOL fEnterMode);
	STDMETHOD(GetClipboardData) ( CHARRANGE  *lpchrg, DWORD reco,
									LPDATAOBJECT  *lplpdataobj);
	STDMETHOD(ImportDataObject) ( LPDATAOBJECT lpdataobj,
									CLIPFORMAT cf, HGLOBAL hMetaPict);


private:

	// Get text helper
	LONG	GetTextRange(LONG cpFirst, LONG cch, TCHAR *pch);
	LONG	GetTextEx(GETTEXTEX *pgt, TCHAR *pch);
	LONG	GetTextLengthEx(GETTEXTLENGTHEX *pgtl);

	//--------------------------------------------------------------
	// WinProc dispatch methods
	// Internally called by the WinProc
	//--------------------------------------------------------------

	// Keyboard
	HRESULT	OnTxKeyDown(WORD vkey, DWORD dwFlags, IUndoBuilder *publdr);
	HRESULT	OnTxChar(WORD vkey, DWORD dwFlags, IUndoBuilder *publdr);
	HRESULT	OnTxSysKeyDown(WORD vkey, DWORD dwFlags, IUndoBuilder *publdr);
	HRESULT	OnTxSpecialKeyDown(
		WORD vkey,
		DWORD dwFlags,
		IUndoBuilder *publdr
	);

	// Mouse 
#ifdef PWD_JUPITER // GuyBark 81387: Allow undo of expand/collapse operation
	HRESULT	OnTxLButtonDblClk(INT x, INT y, DWORD dwFlags, IUndoBuilder *publdr);
#else
	HRESULT	OnTxLButtonDblClk(INT x, INT y, DWORD dwFlags);
#endif // PWD_JUPITER
	HRESULT	OnTxLButtonDown(INT x, INT y, DWORD dwFlags);
	HRESULT	OnTxLButtonUp(INT x, INT y, DWORD dwFlags, BOOL fReleaseCapture);
	HRESULT	OnTxRButtonDown(INT x, INT y, DWORD dwFlags);
	HRESULT	OnTxRButtonUp(INT x, INT y, DWORD dwFlags);
	HRESULT	OnTxMouseMove(INT x, INT y, DWORD dwFlags, IUndoBuilder *publdr);
	HRESULT OnTxMButtonDown (INT x, INT y, DWORD dwFlags);
	HRESULT OnTxMButtonUp (INT x, INT y, DWORD dwFlags);
	
	// Timer
	HRESULT	OnTxTimer(UINT idTimer);
	void CheckInstallContinuousScroll ();

⌨️ 快捷键说明

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