4#ifndef __ActiveLedItControl_h__
5#define __ActiveLedItControl_h__ 1
11#include "Stroika/Foundation/StroikaPreComp.h"
17#include "Stroika/Frameworks/Led/SpellCheckEngine.h"
18#include "Stroika/Frameworks/Led/StyledTextIO/StyledTextIO_HTML.h"
19#include "Stroika/Frameworks/Led/StyledTextIO/StyledTextIO_RTF.h"
21#include "ActiveLedItConfig.h"
24#include "ActiveLedIt_h.h"
32 eDefaultFormat = eRTFFormat,
35class COMBased_SpellCheckEngine :
public SpellCheckEngine,
private SpellCheckEngine::UDInterface,
private TextBreaks {
37 using inherited = SpellCheckEngine;
40 COMBased_SpellCheckEngine (IDispatch* engine);
43 CComPtr<IDispatch> fEngine;
46 virtual bool ScanForUndefinedWord (
const Led_tChar* startBuf,
const Led_tChar* endBuf,
const Led_tChar** cursor,
47 const Led_tChar** wordStartResult,
const Led_tChar** wordEndResult)
override;
50 virtual bool LookupWord_ (
const Led_tString& checkWord, Led_tString* matchedWordResult)
override;
53 virtual vector<Led_tString> GenerateSuggestions (
const Led_tString& misspelledWord)
override;
56 virtual TextBreaks* PeekAtTextBreaksUsed ()
override;
60 virtual void FindWordBreaks (
const Led_tChar* startOfText,
size_t lengthOfText,
size_t textOffsetToStartLookingForWord,
61 size_t* wordStartResult,
size_t* wordEndResult,
bool* wordReal)
const override;
62 virtual void FindLineBreaks (
const Led_tChar* startOfText,
size_t lengthOfText,
size_t textOffsetToStartLookingForWord,
63 size_t* wordEndResult,
bool* wordReal)
const override;
66 virtual UDInterface* GetUDInterface ()
override;
70 virtual bool AddWordToUserDictionarySupported ()
const override;
71 virtual void AddWordToUserDictionary (
const Led_tString& word)
override;
74DISABLE_COMPILER_MSC_WARNING_START (4250)
76class ActiveLedItControl : public COleControl, public
MarkerOwner, public LedItViewController {
78 DECLARE_DYNCREATE (ActiveLedItControl)
81 ActiveLedItControl ();
84 ~ActiveLedItControl ();
86#if qKeepListOfALInstancesForSPR_1599BWA
88 static const set<ActiveLedItControl*>& GetAll ();
91 static set<ActiveLedItControl*> sAll;
95 virtual void DidUpdateText (
const UpdateInfo& )
noexcept override;
96 virtual TextStore* PeekAtTextStore ()
const override;
99 virtual void OnDraw (CDC* pdc,
const CRect& rcBounds,
const CRect& rcInvalid)
override;
100 virtual void OnDrawMetafile (CDC* pDC,
const CRect& rcBounds)
override;
101 afx_msg BOOL OnEraseBkgnd (CDC* pDC);
102 virtual void DoPropExchange (CPropExchange* pPX)
override;
103 virtual void OnResetState ()
override;
104 virtual DWORD GetControlFlags ()
override;
105 virtual void OnGetControlInfo (LPCONTROLINFO pControlInfo)
override;
106 virtual BOOL PreTranslateMessage (MSG* pMsg)
override;
107 virtual void AddFrameLevelUI ()
override;
108 virtual void RemoveFrameLevelUI ()
override;
109 virtual BOOL OnSetObjectRects (LPCRECT lprcPosRect, LPCRECT lprcClipRect)
override;
110 virtual BOOL OnGetNaturalExtent (DWORD , LONG , DVTARGETDEVICE* , HDC ,
111 DVEXTENTINFO* , LPSIZEL
115 struct OnCreateExtras {
120 unique_ptr<OnCreateExtras> fOnCreateExtras;
123 nonvirtual
void ExchangeTextAsRTFBlob (CPropExchange* pPX);
126 DECLARE_INTERFACE_MAP ()
128 BEGIN_INTERFACE_PART (ObjSafe, IObjectSafety)
129 STDMETHOD_ (HRESULT, GetInterfaceSafetyOptions)
132 DWORD __RPC_FAR* pdwSupportedOptions,
133 DWORD __RPC_FAR* pdwEnabledOptions);
135 STDMETHOD_ (HRESULT, SetInterfaceSafetyOptions)
138 DWORD dwOptionSetMask,
139 DWORD dwEnabledOptions);
140 END_INTERFACE_PART (ObjSafe);
143 DECLARE_OLECREATE_EX (ActiveLedItControl)
144 DECLARE_OLETYPELIB (ActiveLedItControl)
145 DECLARE_PROPPAGEIDS (ActiveLedItControl)
146 DECLARE_OLECTLTYPE (ActiveLedItControl)
150 afx_msg
int OnCreate (LPCREATESTRUCT lpCreateStruct);
151 afx_msg
void OnWindowPosChanged (WINDOWPOS* lpwndpos);
152 afx_msg
void OnSetFocus (CWnd* pOldWnd);
155 nonvirtual
void Layout ();
158 afx_msg
void OLE_InvalidateLayout ();
160#if qDontUIActivateOnOpen
162 virtual HRESULT OnOpen (BOOL bTryInPlace, LPMSG pMsg)
override;
166 virtual void OnBackColorChanged ()
override;
167#if qFunnyDisplayInDesignMode
168 virtual void OnAmbientPropertyChange (DISPID dispid)
override;
172 afx_msg UINT OLE_VersionNumber ();
173 afx_msg BSTR OLE_ShortVersionString ();
174 afx_msg BOOL OLE_GetReadOnly ();
175 afx_msg
void OLE_SetReadOnly (BOOL bNewValue);
176 afx_msg BOOL OLE_GetEnabled ();
177 afx_msg
void OLE_SetEnabled (BOOL bNewValue);
178 afx_msg BOOL OLE_GetEnableAutoChangesBackgroundColor ();
179 afx_msg
void OLE_SetEnableAutoChangesBackgroundColor (BOOL bNewValue);
180 afx_msg
int OLE_GetWindowMarginTop ();
181 afx_msg
void OLE_SetWindowMarginTop (
int windowMarginTop);
182 afx_msg
int OLE_GetWindowMarginLeft ();
183 afx_msg
void OLE_SetWindowMarginLeft (
int windowMarginLeft);
184 afx_msg
int OLE_GetWindowMarginBottom ();
185 afx_msg
void OLE_SetWindowMarginBottom (
int windowMarginBottom);
186 afx_msg
int OLE_GetWindowMarginRight ();
187 afx_msg
void OLE_SetWindowMarginRight (
int windowMarginRight);
188 afx_msg
int OLE_GetPrintMarginTop ();
189 afx_msg
void OLE_SetPrintMarginTop (
int printMarginTop);
190 afx_msg
int OLE_GetPrintMarginLeft ();
191 afx_msg
void OLE_SetPrintMarginLeft (
int printMarginLeft);
192 afx_msg
int OLE_GetPrintMarginBottom ();
193 afx_msg
void OLE_SetPrintMarginBottom (
int printMarginBottom);
194 afx_msg
int OLE_GetPrintMarginRight ();
195 afx_msg
void OLE_SetPrintMarginRight (
int printMarginRight);
196 afx_msg UINT GetHasVerticalScrollBar ();
197 afx_msg
void SetHasVerticalScrollBar (UINT bNewValue);
198 afx_msg UINT GetHasHorizontalScrollBar ();
199 afx_msg
void SetHasHorizontalScrollBar (UINT bNewValue);
200 afx_msg BSTR GetBufferText ();
201 afx_msg
void SetBufferText (LPCTSTR text);
202 afx_msg BSTR GetBufferTextCRLF ();
203 afx_msg
void SetBufferTextCRLF (LPCTSTR text);
204 afx_msg BSTR GetBufferTextAsRTF ();
205 afx_msg
string GetBufferTextAsRTF_ ();
206 afx_msg
void SetBufferTextAsRTF (LPCTSTR text);
207 afx_msg BSTR GetBufferTextAsHTML ();
208 afx_msg
void SetBufferTextAsHTML (LPCTSTR text);
209 afx_msg VARIANT GetBufferTextAsDIB ();
210 afx_msg
long GetBufferLength ();
211 afx_msg
long GetMaxLength ();
212 afx_msg
void SetMaxLength (
long maxLength);
213 afx_msg BOOL GetSupportContextMenu ();
214 afx_msg
void SetSupportContextMenu (BOOL bNewValue);
215 afx_msg BOOL OLE_GetHideDisabledContextMenuItems ();
216 afx_msg
void OLE_SetHideDisabledContextMenuItems (BOOL bNewValue);
217 afx_msg BOOL GetSmartCutAndPaste ();
218 afx_msg
void SetSmartCutAndPaste (BOOL bNewValue);
219 afx_msg BOOL OLE_GetSmartQuoteMode ();
220 afx_msg
void OLE_SetSmartQuoteMode (BOOL bNewValue);
221 afx_msg BOOL GetWrapToWindow ();
222 afx_msg
void SetWrapToWindow (BOOL bNewValue);
223 afx_msg BOOL GetShowParagraphGlyphs ();
224 afx_msg
void SetShowParagraphGlyphs (BOOL bNewValue);
225 afx_msg BOOL GetShowTabGlyphs ();
226 afx_msg
void SetShowTabGlyphs (BOOL bNewValue);
227 afx_msg BOOL GetShowSpaceGlyphs ();
228 afx_msg
void SetShowSpaceGlyphs (BOOL bNewValue);
229 afx_msg BOOL OLE_GetUseSelectEOLBOLRowHilightStyle ();
230 afx_msg
void OLE_SetUseSelectEOLBOLRowHilightStyle (BOOL bNewValue);
231 afx_msg BOOL OLE_GetShowSecondaryHilight ();
232 afx_msg
void OLE_SetShowSecondaryHilight (BOOL bNewValue);
236 afx_msg BOOL OLE_GetShowHidableText ();
237 afx_msg
void OLE_SetShowHidableText (BOOL bNewValue);
238 afx_msg OLE_COLOR OLE_GetHidableTextColor ();
239 afx_msg
void OLE_SetHidableTextColor (OLE_COLOR color);
240 afx_msg BOOL OLE_GetHidableTextColored ();
241 afx_msg
void OLE_SetHidableTextColored (BOOL bNewValue);
245 afx_msg VARIANT OLE_GetSpellChecker ();
246 afx_msg
void OLE_SetSpellChecker (VARIANT& newValue);
249 IDispatch* fSpellChecker;
250 COMBased_SpellCheckEngine fLedSpellCheckWrapper;
253 nonvirtual
void ChangedSpellCheckerCOMObject ();
257 CComPtr<IDispatch> fConextMenu;
258 CComPtr<IDispatch> fToolbarList;
259 CComPtr<IDispatch> fBuiltinCommands;
260 CComPtr<IDispatch> fPredefinedMenus;
261 CComPtr<IDispatch> fAcceleratorTable;
264 afx_msg VARIANT OLE_GetContextMenu ();
265 afx_msg
void OLE_SetContextMenu (VARIANT& newValue);
266 afx_msg VARIANT OLE_GetToolbarList ();
267 afx_msg
void OLE_SetToolbarList (VARIANT& newValue);
268 afx_msg VARIANT OLE_GetBuiltinCommands ();
269 afx_msg VARIANT OLE_GetPredefinedMenus ();
270 afx_msg IDispatch* OLE_GetDefaultContextMenu ();
271 afx_msg IDispatch* OLE_GetDefaultAcceleratorTable ();
272 afx_msg IDispatch* OLE_MakeNewPopupMenuItem ();
273 afx_msg IDispatch* OLE_MakeNewUserMenuItem ();
274 afx_msg IDispatch* OLE_MakeNewAcceleratorElement ();
275 afx_msg
void OLE_InvokeCommand (
const VARIANT& command);
276 afx_msg BOOL OLE_CommandEnabled (
const VARIANT& command);
277 afx_msg BOOL OLE_CommandChecked (
const VARIANT& command);
278 afx_msg IDispatch* OLE_MakeNewToolbarList ();
279 nonvirtual CComPtr<IDispatch> MakeNewToolbar ();
280 afx_msg IDispatch* OLE_MakeNewToolbar ();
281 afx_msg IDispatch* OLE_MakeIconButtonToolbarItem ();
282 nonvirtual CComPtr<IDispatch> MakeSeparatorToolbarItem ();
283 afx_msg IDispatch* OLE_MakeSeparatorToolbarItem ();
284 nonvirtual CComPtr<IDispatch> MakeBuiltinToolbar (LPCOLESTR builtinToolbarName);
285 afx_msg IDispatch* OLE_MakeBuiltinToolbar (LPCOLESTR builtinToolbarName);
286 nonvirtual CComPtr<IDispatch> MakeBuiltinToolbarItem (LPCOLESTR builtinToolbarItemName);
287 afx_msg IDispatch* OLE_MakeBuiltinToolbarItem (LPCOLESTR builtinToolbarItemName);
288 afx_msg VARIANT OLE_GetAcceleratorTable ();
289 afx_msg
void OLE_SetAcceleratorTable (VARIANT& newValue);
292 struct ToolBarIconSpec {
293 const TCHAR* fIconName;
295 const TCHAR* fCmdName;
296 IconButtonStyle fButtonStyle;
298 nonvirtual CComPtr<IDispatch> mkIconElement (
int iconResID);
299 nonvirtual CComPtr<IDispatch> mkIconElement (
const ToolBarIconSpec& s);
300 nonvirtual CComPtr<IDispatch> mkIconElement (
int iconResID, CComPtr<IDispatch> cmdList);
301 nonvirtual CComPtr<IDispatch> MakeBuiltinComboBoxToolbarItem (CComPtr<IDispatch> cmdList);
304 nonvirtual HACCEL GetCurrentWin32AccelTable ();
307 HACCEL fWin32AccelTable;
311 afx_msg VARIANT OLE_GetCurrentEventArguments ();
314 CComPtr<IDispatch> fCurrentEventArguments;
318 afx_msg
long GetSelStart ();
319 afx_msg
void SetSelStart (
long start);
320 afx_msg
long GetSelLength ();
321 afx_msg
void SetSelLength (
long length);
322 afx_msg BSTR GetSelText ();
323 afx_msg
void SetSelText (LPCTSTR text);
324 afx_msg BSTR GetSelTextAsRTF ();
325 afx_msg
void SetSelTextAsRTF (LPCTSTR text);
326 afx_msg BSTR GetSelTextAsHTML ();
327 afx_msg
void SetSelTextAsHTML (LPCTSTR text);
328 afx_msg OLE_COLOR GetSelColor ();
329 afx_msg
void SetSelColor (OLE_COLOR color);
330 afx_msg BSTR GetSelFontFace ();
331 afx_msg
void SetSelFontFace (LPCTSTR fontFace);
332 afx_msg
long GetSelFontSize ();
333 afx_msg
void SetSelFontSize (
long size);
334 afx_msg
long GetSelBold ();
335 afx_msg
void SetSelBold (
long bold);
336 afx_msg
long GetSelItalic ();
337 afx_msg
void SetSelItalic (
long italic);
338 afx_msg
long GetSelStrikeThru ();
339 afx_msg
void SetSelStrikeThru (
long strikeThru);
340 afx_msg
long GetSelUnderline ();
341 afx_msg
void SetSelUnderline (
long underline);
342 afx_msg UINT OLE_GetSelJustification ();
343 afx_msg
void OLE_SetSelJustification (UINT justification);
344 afx_msg UINT OLE_GetSelListStyle ();
345 afx_msg
void OLE_SetSelListStyle (UINT listStyle);
346 afx_msg UINT OLE_GetSelHidable ();
347 afx_msg
void OLE_SetSelHidable (UINT hidable);
349 afx_msg
void AboutBox ();
350 afx_msg
void LoadFile (LPCTSTR filename);
351 afx_msg
void SaveFile (LPCTSTR filename);
352 afx_msg
void SaveFileCRLF (LPCTSTR filename);
353 afx_msg
void SaveFileRTF (LPCTSTR filename);
354 afx_msg
void SaveFileHTML (LPCTSTR filename);
355 afx_msg
void Refresh ();
356 afx_msg
void ScrollToSelection ();
360 afx_msg
long OLE_GetMaxUndoLevel ();
361 afx_msg
void OLE_SetMaxUndoLevel (
long maxUndoLevel);
362 afx_msg BOOL OLE_GetCanUndo ();
363 afx_msg BOOL OLE_GetCanRedo ();
364 afx_msg
void OLE_Undo ();
365 afx_msg
void OLE_Redo ();
366 afx_msg
void OLE_CommitUndo ();
369 afx_msg
void OLE_LaunchFontSettingsDialog ();
370 afx_msg
void OLE_LaunchParagraphSettingsDialog ();
374 afx_msg
void OLE_LaunchFindDialog ();
375 afx_msg
long OLE_Find (
long searchFrom,
const VARIANT& findText, BOOL wrapSearch, BOOL wholeWordSearch, BOOL caseSensativeSearch);
379 afx_msg
void OLE_LaunchReplaceDialog ();
380 afx_msg
long OLE_FindReplace (
long searchFrom,
const VARIANT& findText,
const VARIANT& replaceText, BOOL wrapSearch,
381 BOOL wholeWordSearch, BOOL caseSensativeSearch);
385 afx_msg
void OLE_PrinterSetupDialog ();
386 afx_msg
void OLE_PrintDialog ();
387 afx_msg
void OLE_PrintOnce ();
391 afx_msg
long OLE_GetHeight (
long from,
long to);
394 afx_msg BOOL OLE_GetDirty ();
395 afx_msg
void OLE_SetDirty (BOOL dirty);
402 virtual void OnBrowseHelpCommand ()
override;
403 virtual void OnAboutBoxCommand ()
override;
404 virtual void ForceUIActive ()
override;
405 virtual void FireOLEEvent (DISPID eventID)
override;
406 virtual void FireOLEEvent (DISPID dispid, BYTE* pbParams, ...)
override;
407 virtual void FireUpdateUserCommand (
const wstring& internalCmdName, VARIANT_BOOL* enabled, VARIANT_BOOL* checked, wstring* name)
override;
408 virtual void FireUserCommand (
const wstring& internalCmdName)
override;
409#if qFunnyDisplayInDesignMode
410 virtual bool IsInDesignMode ()
const override;
411 virtual bool DrawExtraDesignModeBorder ()
const override;
413 virtual HMENU GenerateContextMenu ()
override;
416 DECLARE_DISPATCH_MAP ()
417 DECLARE_MESSAGE_MAP ()
421 nonvirtual Led_FileFormat GuessFormatFromName (LPCTSTR name);
422 nonvirtual
void DoReadFile (LPCTSTR filename, Memory::StackBuffer<
char>* buffer,
size_t* size);
423 nonvirtual
void WriteBytesToFile (LPCTSTR filename, const
void* buffer,
size_t size);
428 StyledTextIO::HTMLInfo fHTMLInfo;
431DISABLE_COMPILER_MSC_WARNING_END (4250)
439inline ActiveLedItControl::OnCreateExtras::OnCreateExtras ()
time_point< RealtimeClock, DurationSeconds > TimePointSeconds
TimePointSeconds is a simpler approach to chrono::time_point, which doesn't require using templates e...