5#define __LedItView_h__ 1
7#include "Stroika/Foundation/StroikaPreComp.h"
9DISABLE_COMPILER_MSC_WARNING_START (5054)
11DISABLE_COMPILER_MSC_WARNING_END (5054)
15#include "Stroika/Frameworks/Led/ChunkedArrayTextStore.h"
16#include "Stroika/Frameworks/Led/Platform/MFC_WordProcessor.h"
17#include "Stroika/Frameworks/Led/WordProcessor.h"
19#include "ActiveLedItConfig.h"
23using namespace Stroika::Frameworks::Led;
24using namespace Stroika::Frameworks::Led::Platform;
26class LedItViewController {
28 LedItViewController ();
29 virtual ~LedItViewController () =
default;
32 virtual void OnBrowseHelpCommand () = 0;
33 virtual void OnAboutBoxCommand () = 0;
34 virtual void ForceUIActive () = 0;
35 virtual void FireOLEEvent (DISPID eventID) = 0;
36 virtual void FireOLEEvent (DISPID dispid, BYTE* pbParams, ...) = 0;
37#if qFunnyDisplayInDesignMode
38 virtual bool IsInDesignMode ()
const = 0;
39 virtual bool DrawExtraDesignModeBorder ()
const = 0;
41 virtual HMENU GenerateContextMenu () = 0;
44 nonvirtual
void FireKeyDown (USHORT* pnChar,
short nShiftState);
45 nonvirtual
void FireKeyUp (USHORT* pnChar,
short nShiftState);
46 nonvirtual
void FireKeyPress (USHORT* pnChar);
47 nonvirtual
void FireMouseDown (
short nButton,
short nShiftState, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y);
48 nonvirtual
void FireMouseUp (
short nButton,
short nShiftState, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y);
49 nonvirtual
void FireMouseMove (
short nButton,
short nShiftState, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y);
50 nonvirtual
void FireClick ();
51 nonvirtual
void FireDblClick ();
52 virtual void FireUpdateUserCommand (
const wstring& internalCmdName, VARIANT_BOOL* enabled, VARIANT_BOOL* checked, wstring* name) = 0;
53 virtual void FireUserCommand (
const wstring& internalCmdName) = 0;
56 ChunkedArrayTextStore fTextStore;
57 MultiLevelUndoCommandHandler fCommandHandler;
58 shared_ptr<HidableTextMarkerOwner> fHidableTextDatabase;
61using LedItViewAlmostBASE = Led_MFC_ExceptionHandlerHelper<Led_MFC_X<WordProcessor>>;
63DISABLE_COMPILER_MSC_WARNING_START (4250)
65class LedItView : public WordProcessorCommonCommandHelper_MFC<LedItViewAlmostBASE> {
67 using inherited = WordProcessorCommonCommandHelper_MFC<LedItViewAlmostBASE>;
73 nonvirtual
void SetController (LedItViewController* controller);
76 LedItViewController* fController;
79 virtual ~LedItView ();
82 nonvirtual
bool GetSupportContextMenu ()
const;
83 nonvirtual
void SetSupportContextMenu (
bool allowContextMenu);
86 bool fSupportContextMenu;
89 nonvirtual
bool GetHideDisabledContextMenuItems ()
const;
90 nonvirtual
void SetHideDisabledContextMenuItems (
bool hideDisabledContextMenuItems);
93 bool fHideDisabledContextMenuItems;
96 nonvirtual
bool GetWrapToWindow ()
const;
97 nonvirtual
void SetWrapToWindow (
bool wrapToWindow);
103 nonvirtual
long GetMaxLength ()
const;
104 nonvirtual
void SetMaxLength (
long maxLength);
110 virtual void GetLayoutMargins (RowReference row, CoordinateType* lhs, CoordinateType* rhs)
const override;
111 virtual void SetWindowRect (
const Led_Rect& windowRect)
override;
114 nonvirtual DistanceType CalculateFarthestRightMarginInWindow ()
const;
117 afx_msg
int OnMouseActivate (CWnd* pDesktopWnd, UINT nHitTest, UINT message);
120 virtual void PostNcDestroy ()
override;
121 afx_msg
void OnInitMenuPopup (CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
122 afx_msg
void OnContextMenu (CWnd* , CPoint );
127 afx_msg
void OnSysKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags);
128 afx_msg
void OnSysKeyUp (UINT nChar, UINT nRepCnt, UINT nFlags);
129 afx_msg
void OnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags);
130 afx_msg
void OnKeyUp (UINT nChar, UINT nRepCnt, UINT nFlags);
131 virtual void OnTypedNormalCharacter (Led_tChar theChar,
bool optionPressed,
bool shiftPressed,
bool commandPressed,
bool controlPressed,
132 bool altKeyPressed)
override;
133 afx_msg
void OnLButtonDown (UINT nFlags, CPoint oPoint);
134 afx_msg
void OnLButtonUp (UINT nFlags, CPoint oPoint);
135 afx_msg
void OnLButtonDblClk (UINT nFlags, CPoint oPoint);
136 afx_msg
void OnRButtonDown (UINT nFlags, CPoint oPoint);
137 afx_msg
void OnRButtonUp (UINT nFlags, CPoint oPoint);
138 afx_msg
void OnMouseMove (UINT nFlags, CPoint oPoint);
141 afx_msg
void OnPasteAsTextCommand ();
142 afx_msg
void OnUpdatePasteAsTextCommand (CCmdUI* pCmdUI);
145 afx_msg
void OnOLEUserCommand (UINT nID);
146 afx_msg
void OnUpdateOLEUserCommand (CCmdUI* pCmdUI);
149 virtual SearchParameters GetSearchParameters ()
const override;
150 virtual void SetSearchParameters (
const SearchParameters& sp)
override;
153 virtual void SetSelection (
size_t start,
size_t end)
override;
154 using TextInteractor::SetSelection;
157 virtual void AboutToUpdateText (
const UpdateInfo& updateInfo)
override;
160 virtual void EraseBackground (Tablet* tablet,
const Led_Rect& subsetToDraw,
bool printing)
override;
163 bool fEnableAutoChangesBackgroundColor;
166 nonvirtual
long OLE_FindReplace (
long searchFrom,
const Led_tString& findText,
const Led_tString& replaceText, BOOL wrapSearch,
167 BOOL wholeWordSearch, BOOL caseSensativeSearch);
170 bool fInDrawMetaFileMode;
173 nonvirtual
void UpdateScrollBars ();
176 afx_msg
void OnBrowseHelpCommand ();
177 afx_msg
void OnCheckForUpdatesWebPageCommand ();
178 afx_msg
void OnAboutBoxCommand ();
181 afx_msg
void OnFilePrintOnce ();
182 afx_msg
void OnFilePrint ();
183 afx_msg
void OnFilePrintSetup ();
186 nonvirtual
void DoPrintHelper (
bool showPrintDlg);
188 DECLARE_MESSAGE_MAP ()
192 virtual void AssertValid ()
const override;
193 virtual void Dump (CDumpContext& dc)
const override;
196DISABLE_COMPILER_MSC_WARNING_END (4250)
205inline
void LedItViewController::FireKeyDown (USHORT* pnChar,
short nShiftState)
207 FireOLEEvent (DISPID_KEYDOWN, EVENT_PARAM (VTS_PI2 VTS_I2), pnChar, nShiftState);
209inline void LedItViewController::FireKeyUp (USHORT* pnChar,
short nShiftState)
211 FireOLEEvent (DISPID_KEYUP, EVENT_PARAM (VTS_PI2 VTS_I2), pnChar, nShiftState);
213inline void LedItViewController::FireKeyPress (USHORT* pnChar)
215 FireOLEEvent (DISPID_KEYPRESS, EVENT_PARAM (VTS_PI2), pnChar);
217inline void LedItViewController::FireMouseDown (
short nButton,
short nShiftState, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y)
219 FireOLEEvent (DISPID_MOUSEDOWN, EVENT_PARAM (VTS_I2 VTS_I2 VTS_XPOS_PIXELS VTS_YPOS_PIXELS), nButton, nShiftState, x, y);
221inline void LedItViewController::FireMouseUp (
short nButton,
short nShiftState, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y)
223 FireOLEEvent (DISPID_MOUSEUP, EVENT_PARAM (VTS_I2 VTS_I2 VTS_XPOS_PIXELS VTS_YPOS_PIXELS), nButton, nShiftState, x, y);
225inline void LedItViewController::FireMouseMove (
short nButton,
short nShiftState, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y)
227 FireOLEEvent (DISPID_MOUSEMOVE, EVENT_PARAM (VTS_I2 VTS_I2 VTS_XPOS_PIXELS VTS_YPOS_PIXELS), nButton, nShiftState, x, y);
229inline void LedItViewController::FireClick ()
231 FireOLEEvent (DISPID_CLICK, EVENT_PARAM (VTS_NONE));
233inline void LedItViewController::FireDblClick ()
235 FireOLEEvent (DISPID_DBLCLICK, EVENT_PARAM (VTS_NONE));
239inline bool LedItView::GetWrapToWindow ()
const
241 return fWrapToWindow;
243inline bool LedItView::GetSupportContextMenu ()
const
245 return fSupportContextMenu;
247inline bool LedItView::GetHideDisabledContextMenuItems ()
const
249 return fHideDisabledContextMenuItems;
251inline long LedItView::GetMaxLength ()
const