Stroika Library 3.0d18
 
Loading...
Searching...
No Matches
LedLineItDocument.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef __LedLineItDocument_h__
5#define __LedLineItDocument_h__ 1
6
7#include "Stroika/Frameworks/StroikaPreComp.h"
8
9DISABLE_COMPILER_MSC_WARNING_START (5054)
10#include <afxole.h>
11DISABLE_COMPILER_MSC_WARNING_END (5054)
12
13#include <afxwin.h>
14
16
17#include "Stroika/Frameworks/Led/ChunkedArrayTextStore.h"
18#include "Stroika/Frameworks/Led/Command.h"
19
20#include "LedLineItConfig.h"
21
22using namespace Stroika::Foundation;
23
24using namespace Stroika::Frameworks::Led;
25
27using Stroika::Foundation::Characters::CodePagesInstalled;
28
29const CodePage kDefaultNewDocCodePage =
30 CodePagesInstalled{}.IsCodePageAvailable (Characters::WellKnownCodePages::kUTF8) ? Characters::WellKnownCodePages::kUTF8 : CP_ACP;
31
32const CodePage kAutomaticallyGuessCodePage = static_cast<CodePage> (-2); // I HOPE this # doesn't conflict with any legit ones!!!
33const CodePage kIGNORECodePage = static_cast<CodePage> (-3); // I HOPE this # doesn't conflict with any legit ones!!!
34
35class LedLineItServerItem;
36
37class LedLineItDocument : public COleServerDoc, public MarkerOwner {
38protected: // create from serialization only
39 LedLineItDocument ();
40 DECLARE_DYNCREATE (LedLineItDocument)
41
42public:
43 virtual ~LedLineItDocument ();
44
45public:
46 virtual void DidUpdateText (const UpdateInfo& /*updateInfo*/) noexcept override;
47 virtual TextStore* PeekAtTextStore () const override;
48
49public:
50 nonvirtual LedLineItServerItem* GetEmbeddedItem ();
51
52public:
53 virtual BOOL OnNewDocument () override;
54 virtual BOOL OnOpenDocument (LPCTSTR lpszPathName) override;
55 virtual void Serialize (CArchive& ar) override;
56
57protected:
58 virtual COleServerItem* OnGetEmbeddedItem () override;
59
60public:
61 virtual BOOL DoSave (LPCTSTR lpszPathName, BOOL bReplace) override;
62
63public:
64 static CodePage sHiddenDocOpenArg;
65
66public:
67 afx_msg void OnUpdateFileSave (CCmdUI* pCmdUI);
68 afx_msg void OnFileSaveCopyAs ();
69 virtual void DeleteContents () override;
70
71public:
72 nonvirtual TextStore& GetTextStore ();
73 nonvirtual CommandHandler& GetCommandHandler ();
74
75protected:
76 ChunkedArrayTextStore fTextStore;
77 MultiLevelUndoCommandHandler fCommandHandler;
78
79private:
80 CodePage fCodePage;
81
82 // utilities to pick save/open file names
83public:
84 static bool DoPromptSaveAsFileName (::CString* fileName, CodePage* codePage);
85 static bool DoPromptSaveCopyAsFileName (::CString* fileName, CodePage* codePage);
86 static bool DoPromptOpenFileName (::CString* fileName, CodePage* codePage);
87
88private:
89 static bool DoPromptFileName (::CString* fileName, UINT nIDSTitle, bool isOpenDialogCall, long fileDLogFlags, CodePage* codePage);
90
91#if qStroika_Foundation_Debug_AssertionsChecked
92public:
93 virtual void AssertValid () const override;
94#endif
95
96 // Generated message map functions
97protected:
98 DECLARE_MESSAGE_MAP ()
99
100 DECLARE_DISPATCH_MAP ()
101 DECLARE_INTERFACE_MAP ()
102};
103
104/*
105 ********************************************************************************
106 ***************************** Implementation Details ***************************
107 ********************************************************************************
108 */
109inline LedLineItServerItem* LedLineItDocument::GetEmbeddedItem ()
110{
111 return (LedLineItServerItem*)COleServerDoc::GetEmbeddedItem ();
112}
113inline TextStore& LedLineItDocument::GetTextStore ()
114{
115 return fTextStore;
116}
117inline CommandHandler& LedLineItDocument::GetCommandHandler ()
118{
119 return fCommandHandler;
120}
121
122#endif /*__LedLineItDocument_h__*/