Separatista
separatistadocument.h
1 /***************************************************************************
2 * Copyright (C) 2013 by Okkel Klaver *
3 * info@vanhetland.nl *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20 
21 #include <vector>
22 #include <windows.h>
23 #include <separatista/separatista.h>
24 #include "separatista/separatistadocument.h"
25 #include "separatista/debug/debug.h"
26 
27 #include "dispatch.h"
28 #include "element.h"
29 
30 #ifndef SEPARATISTA_CONTROL_SEPARATISTADOCUMENT_H
31 #define SEPARATISTA_CONTROL_SEPARATISTADOCUMENT_H
32 
33 // {4B8AC337-5E17-454D-A7EC-8955B07B99CC}
34 DEFINE_GUID(IID_SEPARATISTADOCUMENT ,
35  0x4b8ac337, 0x5e17, 0x454d, 0xa7, 0xec, 0x89, 0x55, 0xb0, 0x7b, 0x99, 0xcc);
36 
37 // {A3142FEC-FB2E-4715-B5DF-C4F7844D2956}
38 DEFINE_GUID(CLSID_SEPARATISTADOCUMENT,
39  0xa3142fec, 0xfb2e, 0x4715, 0xb5, 0xdf, 0xc4, 0xf7, 0x84, 0x4d, 0x29, 0x56);
40 
41 struct ISeparatistaDocument : public IDispatch
42 {
43  typedef enum
44  {
45  INVALID = -1,
46  CAMT_053_001_02,
47  PAIN_001_001_03,
48  PAIN_008_001_02,
49  MAX
50  } DocumentNamespace;
51 
52  // IDispatch
53  STDMETHOD_(ULONG, AddRef)() PURE;
54  STDMETHOD_(ULONG, Release)() PURE;
55  STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject) PURE;
56  STDMETHOD(GetTypeInfoCount)(UINT* pctinfo) PURE;
57  STDMETHOD(GetTypeInfo)(UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) PURE;
58  STDMETHOD(GetIDsOfNames)(REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId) PURE;
59  STDMETHOD(Invoke)(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult, EXCEPINFO FAR* pExcepInfo, unsigned int FAR* puArgErr) PURE;
60 
61  // ISeparatistaDocument
62  STDMETHOD(GetNamespaceText)(BSTR *pNamespaceText) PURE;
63  STDMETHOD(GetNamespace)(DocumentNamespace *pNamespace) PURE;
64  STDMETHOD(SetNamespace)(DocumentNamespace NameSpace) PURE;
65  STDMETHOD(GetEnableAutoMagic)(VARIANT_BOOL *pEnableAutoMagic) PURE;
66  STDMETHOD(SetEnableAutoMagic)(VARIANT_BOOL EnableAutoMagic) PURE;
67  STDMETHOD(GetRootElement)(IElement **ppElement) PURE;
68  STDMETHOD(Save)(LONG hWnd, Separatista::IOErrorCode *pErrorCode) PURE;
69  STDMETHOD(SaveAs)(BSTR Path, Separatista::IOErrorCode *pErrorCode) PURE;
70  STDMETHOD(Open)(LONG hWnd, Separatista::IOErrorCode *pErrorCode) PURE;
71  STDMETHOD(OpenFrom)(BSTR Path, Separatista::IOErrorCode *pErrorCode) PURE;
72 
73 };
74 
75 struct __declspec(uuid("{4B8AC337-5E17-454D-A7EC-8955B07B99CC}")) ISeparatistaDocument;
76 
80 class SeparatistaDocument : public SepaControlDispatch<ISeparatistaDocument>
81 {
82 public:
86  SeparatistaDocument();
87 
88  static const wchar_t *m_pNamespaceTable[];
89 
90  // COM methods
91  // Subclass for ISupportErrorInfo
92  STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject);
93 
94  STDMETHOD(GetNamespaceText)(BSTR *pNamespaceText);
95  STDMETHOD(GetNamespace)(DocumentNamespace *pNamespace);
96  STDMETHOD(SetNamespace)(DocumentNamespace NameSpace);
97  STDMETHOD(GetEnableAutoMagic)(VARIANT_BOOL *pEnableAutoMagic);
98  STDMETHOD(SetEnableAutoMagic)(VARIANT_BOOL EnableAutoMagic);
99  STDMETHOD(GetRootElement)(IElement **ppElement);
100  STDMETHOD(Save)(LONG hWnd, Separatista::IOErrorCode *pErrorCode);
101  STDMETHOD(SaveAs)(BSTR Path, Separatista::IOErrorCode *pErrorCode);
102  STDMETHOD(Open)(LONG hWnd, Separatista::IOErrorCode *pErrorCode);
103  STDMETHOD(OpenFrom)(BSTR Path, Separatista::IOErrorCode *pErrorCode);
104 
105 protected:
109  ~SeparatistaDocument();
110 
111 private:
112  HRESULT CreateDocument(DocumentNamespace documentNamespace);
113 
114  Separatista::SeparatistaDocument *m_pSeparatistaDocument;
115  DocumentNamespace m_nDocumentNamespace;
116  bool m_bEnableAutoMagic;
117 };
118 
119 class __declspec(uuid("{A3142FEC-FB2E-4715-B5DF-C4F7844D2956}")) SeparatistaDocument;
120 
121 #endif // #define SEPARATISTA_CONTROL_SEPARATISTADOCUMENT_H
Definition: separatistadocument.h:41
Definition: element.h:40