VwTextStore

From LSDevLinux
Jump to: navigation, search
VwTextStore

Interface:
ITextStoreACP ITfContextOwnerCompositionSink ITfMouseTrackerACP
Implementation:
VwTextStore

VwTextStore is the point of interaction between Fieldworks and Text Services. VwTxtSrc designates VwTextStore as a friend class.

Events:

Amongst other things, it receives messages from Text Services, listens for mouse events, manipulates the document and responds to internal Fieldworks events, such as document changes and lazy box changes.

The messages from text services arrive through the interface methods provided by ITfContextOwnerCompositionSink and ITextStoreACP.

Storage:

What kind of changes can happen to the document that do not come from text services is not known (clipboard, formatting etc. possibly)

The section of the document which is being edited is stored as a DocMgr. This interface looks pretty simple. It is not clear how much of the document is stored at one time (assumedly the amount which is seen on the screen, which would be dictated by the lazy box mechanism).

Porting:

This class will be replaced in Linux Fieldworks by VwTextInputManager.

Public Methods

ITextStoreACP methods.

  • STDMETHOD AdviseSink (REFIID riid, IUnknown * punk, DWORD dwMask);
  • STDMETHOD UnadviseSink (IUnknown * punk);
  • STDMETHOD RequestLock (DWORD dwLockFlags, HRESULT * phrSession);
  • STDMETHOD GetStatus (TS_STATUS * pdcs);
  • STDMETHOD QueryInsert (LONG acpTestStart, LONG acpTestEnd, ULONG cch, LONG * pacpResultStart, LONG * pacpResultEnd);
  • STDMETHOD GetSelection (ULONG ulIndex, ULONG ulCount, TS_SELECTION_ACP * pSelection, ULONG * pcFetched);
  • STDMETHOD SetSelection (ULONG ulCount, const TS_SELECTION_ACP * pSelection);
  • STDMETHOD GetText (LONG acpStart, LONG acpEnd, WCHAR * pchPlain, ULONG cchPlainReq, ULONG * pcchPlainOut, TS_RUNINFO * prgRunInfo, ULONG ulRunInfoReq, ULONG * pulRunInfoOut, LONG * pacpNext);
  • STDMETHOD SetText (DWORD dwFlags, LONG acpStart, LONG acpEnd, const WCHAR * pchText, ULONG cch, TS_TEXTCHANGE * pChange);

These look fairly GtkIM like.

  • STDMETHOD GetFormattedText (LONG acpStart, LONG acpEnd, IDataObject ** ppDataObject);

Embedding not supported

  • STDMETHOD GetEmbedded (LONG acpPos, REFGUID rguidService, REFIID riid, IUnknown ** ppunk);
  • STDMETHOD QueryInsertEmbedded (const GUID * pguidService, const FORMATETC * pFormatEtc, BOOL * pfInsertable);
  • STDMETHOD InsertEmbedded (DWORD dwFlags, LONG acpStart, LONG acpEnd, IDataObject * pDataObject, TS_TEXTCHANGE * pChange);
  • STDMETHOD RequestSupportedAttrs (DWORD dwFlags, ULONG cFilterAttrs, const TS_ATTRID * paFilterAttrs);
  • STDMETHOD RequestAttrsAtPosition (LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID * paFilterAttrs, DWORD dwFlags);
  • STDMETHOD RequestAttrsTransitioningAtPosition (LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID * paFilterAttrs, DWORD dwFlags);
  • STDMETHOD FindNextAttrTransition (LONG acpStart, LONG acpHalt, ULONG cFilterAttrs, const TS_ATTRID * paFilterAttrs, DWORD dwFlags, LONG * pacpNext, BOOL * pfFound, LONG * plFoundOffset);
  • STDMETHOD RetrieveRequestedAttrs (ULONG ulCount, TS_ATTRVAL * paAttrVals, ULONG * pcFetched);
  • STDMETHOD GetEndACP (LONG * pacp);
  • STDMETHOD GetActiveView (TsViewCookie * pvcView);
  • STDMETHOD GetACPFromPoint (TsViewCookie vcView, const POINT * pt, DWORD dwFlags, LONG * pacp);
  • STDMETHOD GetTextExt (TsViewCookie vcView, LONG acpStart, LONG acpEnd, RECT * prc, BOOL * pfClipped);
  • STDMETHOD GetScreenExt (TsViewCookie vcView, RECT * prc);
  • STDMETHOD GetWnd (TsViewCookie vcView, HWND * phwnd);
  • STDMETHOD InsertTextAtSelection (DWORD dwFlags, const WCHAR * pchText, ULONG cch, LONG * pacpStart, LONG * pacpEnd, TS_TEXTCHANGE * pChange);

Equivalent to IM commit callback and keyboard event handler?

  • STDMETHOD InsertEmbeddedAtSelection (DWORD dwFlags, IDataObject * pDataObject, LONG * pacpStart, LONG * pacpEnd, TS_TEXTCHANGE * pChange);

ITfContextOwnerCompositionSink methods

These methods appear to have a close correlation with the GtkIMContext signals.

  • STDMETHOD OnStartComposition ITfCompositionView *pComposition, BOOL *pfOk);
    • Eqivalent to preedit-start
  • STDMETHOD OnUpdateComposition ITfCompositionView *pComposition, ITfRange *pRangeNew);
    • Eqivalent to preedit-changed
  • STDMETHOD OnEndComposition ITfCompositionView *pComposition);
    • Eqivalent to preedit-end

ITfMouseTrackerACP

  • STDMETHOD AdviseMouseSink (ITfRangeACP * range, ITfMouseSink* pSink, DWORD* pdwCookie);
    • Asks to receive mouse events affecting a particular range.
    • Probably causes MouseEvent() to be called
    • Does not handle multiple paragraphs
  • STDMETHOD UnadviseMouseSink (DWORD dwCookie);
    • Asks to stop receiving mouse events as asked for by AdviseMouseSink()

Other Public Methods.

  • void OnDocChange ();
    • Mainly just talks to Windows
    • Also calls OnLayoutChange ()
  • void OnSelChange (int nHow);
    • Seems to just call methods of AdviseSink
  • void OnLayoutChange ();
    • Mainly calls AdviseSink methods
    • Also calls DoDisplayAttrs ()
  • void SetFocus ();
  • void Init ();
  • void Close ();
    • Just clears memory
  • void AddToKeepList (LazinessIncreaser *pli);
    • Calls one method on pli using what looks like FW classes
  • bool MouseEvent (int xd, int yd, RECT rcSrc1, RECT rcDst1, VwMouseEvent me);
    • Long method (>100 lines) which seems to be interested in finding where a click landed in a root box
    • Most execution paths just end the composition (Reset the input method in GTK speak)
    • Some windows, some FW

(There are also several public methods which are only used internally)