-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathLibMgrDocPlugin.h
125 lines (98 loc) · 3.97 KB
/
LibMgrDocPlugin.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
///////////////////////////////////////////////////////////////////////
// LibraryMgrPluginExample
// Copyright © 1999-2025 Washington State Department of Transportation
// Bridge and Structures Office
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the Alternate Route Open Source License as
// published by the Washington State Department of Transportation,
// Bridge and Structures Office.
//
// This program is distributed in the hope that it will be useful, but
// distribution is AS IS, WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the Alternate Route Open Source License for more details.
//
// You should have received a copy of the Alternate Route Open Source
// License along with this program; if not, write to the Washington
// State Department of Transportation, Bridge and Structures Office,
// P.O. Box 47340, Olympia, WA 98503, USA or e-mail
///////////////////////////////////////////////////////////////////////
// LibMgrDocPlugin.h : Declaration of the CLibMgrDocPlugin
#pragma once
#include "resource.h" // main symbols
#include "LibraryMgrPluginExample_i.h"
#include <EAF\EAFDocumentPlugin.h>
#include <EAF\EAFUIintegration.h>
#include <EAF\EAFPluginPersist.h>
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif
class CLibMgrDocPlugin;
class CMyCmdTarget : public CCmdTarget
{
public:
CMyCmdTarget() {};
void OnMyCommand();
void OnUpdateMyCommand(CCmdUI* pCmdUI);
void OnCreateView();
CLibMgrDocPlugin* m_pMyDocPlugin;
DECLARE_MESSAGE_MAP()
};
// CLibMgrDocPlugin
class ATL_NO_VTABLE CLibMgrDocPlugin :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CLibMgrDocPlugin, &CLSID_LibMgrDocPlugin>,
public IEAFDocumentPlugin,
public IEAFCommandCallback,
public IEAFPluginPersist
{
public:
CLibMgrDocPlugin()
{
m_MyCommandTarget.m_pMyDocPlugin = this;
}
DECLARE_REGISTRY_RESOURCEID(IDR_LIBMGRDOCPLUGIN)
BEGIN_COM_MAP(CLibMgrDocPlugin)
COM_INTERFACE_ENTRY(IEAFDocumentPlugin)
COM_INTERFACE_ENTRY(IEAFCommandCallback)
COM_INTERFACE_ENTRY(IEAFPluginPersist)
END_COM_MAP()
CEAFDocument* m_pDoc;
CMyCmdTarget m_MyCommandTarget;
CBitmap m_bmpMenuItem;
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
void CreateMenus();
void RemoveMenus();
CEAFMenu* m_pPluginMenu;
void RegisterViews();
void UnregisterViews();
void CreateView();
long m_MyViewKey;
// IEAFDocumentPlugin
public:
virtual BOOL Init(CEAFDocument* pParent) override;
virtual BOOL IntagrateWithUI(BOOL bIntegrate) override;
virtual void Terminate() override;
virtual CString GetName() override;
virtual CString GetDocumentationSetName() override;
virtual eafTypes::HelpResult GetDocumentLocation(LPCTSTR lpszDocSetName,UINT nHID,CString& strURL) override;
// IEAFCommandCallback
public:
BOOL OnCommandMessage(UINT nID,int nCode,void* pExtra,AFX_CMDHANDLERINFO* pHandlerInfo) override;
BOOL GetStatusBarMessageString(UINT nID, CString& rMessage) const override;
BOOL GetToolTipMessageString(UINT nID, CString& rMessage) const override;
// IEAFPluginPersist
public:
virtual HRESULT Save(IStructuredSave* pStrSave) override;
virtual HRESULT Load(IStructuredLoad* pStrLoad) override;
};
OBJECT_ENTRY_AUTO(__uuidof(LibMgrDocPlugin), CLibMgrDocPlugin)