GME
13
|
00001 #ifndef PartBrowserOLEData_h 00002 #define PartBrowserOLEData_h 00003 00004 #include <afxole.h> 00005 #include "mfcdual.h" 00006 #include "PartBrowseridl.h" 00007 00008 class CPartBrowserDataDescriptor 00009 { 00010 public: 00011 CPartBrowserDataDescriptor(): pFile(0) {} 00012 CPartBrowserDataDescriptor(CTypedPtrList<CPtrList, CRect*> &list, 00013 CTypedPtrList<CPtrList, CRect*> &annList, 00014 CPoint dragPt, CPoint offs); 00015 ~CPartBrowserDataDescriptor() { Reset(); } 00016 public: 00017 CTypedPtrList<CPtrList, CRect*> rects; 00018 CTypedPtrList<CPtrList, CRect*> annRects; 00019 CPoint offset; 00020 CFile* pFile; 00021 public: 00022 void SimpleDraw(CDC* pDC,CPoint& pt); 00023 void GetBoundingRect(CRect& rBoundingRect); 00024 void Reset(); 00025 void Draw(CDC* pDC,CPoint &pt); 00026 void Serialize(CArchive& ar); 00027 bool Load(COleDataObject* pDataObject); 00028 void Clean(); 00029 int GetCount(); 00030 public: 00031 // called externally (from GMEView.cpp and ActiveBrowserPropertyPage.cpp) 00032 // to destruct certain lists 00033 static void destructList(CTypedPtrList<CPtrList, CRect*>& pList);//it is a CRectList 00034 }; 00035 00036 struct IMgaProject; 00037 00038 class CPartBrowserDataSource : public COleDataSource 00039 { 00040 public: 00041 CPartBrowserDataSource(IMgaProject *p) 00042 { 00043 EnableAutomation(); 00044 ASSERT(p != NULL ); 00045 project = p; 00046 myData++; 00047 } 00048 00049 ~CPartBrowserDataSource() { myData--; } 00050 00051 protected: 00052 CComPtr<IMgaProject> project; 00053 CComPtr<IUnknown> data; 00054 CComPtr<IUnknown> folders; // by Zolmol 00055 CComPtr<IUnknown> regdata; 00056 00057 public: 00058 static CLIPFORMAT cfGMEDesc; 00059 static int myData; 00060 00061 public: 00062 void SetNodes(IMgaFCOs* fcos) { data = fcos; } 00063 void SetFolders(IMgaFolders* objs) { folders = objs; } // by Zolmol 00064 void SetMetaRole(IMgaMetaRole* metaRole) { data = metaRole; } 00065 void SetAnnotations(IMgaRegNodes* regs) { regdata = regs; } 00066 00067 void CacheDescriptor(CPartBrowserDataDescriptor* desc); 00068 void DelayXMLDump(); 00069 00070 static bool IsGmeNativeDataAvailable(COleDataObject* pDataObject, IMgaProject* project); 00071 static bool IsXMLDataAvailable(COleDataObject* pDataObject); 00072 static bool ParseXMLData(COleDataObject* pDataObject, IMgaObject* target, bool merge); 00073 static CComPtr<IGMEOLEApp> get_GME(CComObjPtr<IMgaProject> project); 00074 00075 protected: 00076 HGLOBAL CreateDescriptor(CPartBrowserDataDescriptor* desc); 00077 virtual BOOL OnRenderFileData(LPFORMATETC lpFormatEtc, CFile* pFile); 00078 00079 // Interface Maps 00080 protected: 00081 DECLARE_MESSAGE_MAP() 00082 // OLE dispatch map functions 00083 afx_msg LPDISPATCH DispGetData(); 00084 afx_msg void DispSetData(LPDISPATCH newValue); 00085 afx_msg LPDISPATCH DispGetFolders(); 00086 afx_msg void DispSetFolders(LPDISPATCH newValue); 00087 afx_msg LPDISPATCH DispGetRegistryData(); 00088 afx_msg void DispSetRegistryData(LPDISPATCH newValue); 00089 afx_msg LPDISPATCH DispGetProject(); 00090 afx_msg void DispSetProject(LPDISPATCH newValue); 00091 00092 DECLARE_DISPATCH_MAP() 00093 DECLARE_INTERFACE_MAP() 00094 00095 BEGIN_DUAL_INTERFACE_PART(PartBrowserDataSource, IPartBrowserDataSource) 00096 STDMETHOD(get_Data)(IUnknown **p); 00097 STDMETHOD(get_Folders)(IUnknown **p); 00098 STDMETHOD(get_RegistryData)(IUnknown **p); 00099 STDMETHOD(get_Project)(IUnknown **p); 00100 END_DUAL_INTERFACE_PART(PartBrowserDataSource) 00101 00102 // add declaration of ISupportErrorInfo implementation 00103 // to indicate we support the OLE Automation error object 00104 DECLARE_DUAL_ERRORINFO() 00105 }; 00106 00107 00108 class CPartBrowserClosureDataSource : public CPartBrowserDataSource // by Zolmol 00109 { 00110 public: 00111 CPartBrowserClosureDataSource(IMgaProject* p) : CPartBrowserDataSource(p) {} 00112 00113 ~CPartBrowserClosureDataSource() {} 00114 00115 protected: 00116 CComPtr<IUnknown> m_topFcos; 00117 CComPtr<IUnknown> m_topFolders; 00118 long m_options; 00119 CComBstrObj m_absPathPart; 00120 CComBstrObj m_acceptingKinds; 00121 00122 public: 00123 void SetTopNodes(IMgaFCOs* objs) { m_topFcos = objs; } 00124 void SetTopNodes(IMgaFolders* objs) { m_topFolders = objs; } 00125 void SetOptions(long l) { m_options = l; } 00126 void SetAbsPathPart(const CComBstrObj& path) { m_absPathPart = path; } 00127 void SetAcceptingKinds(const CComBstrObj& acceptingkinds) { m_acceptingKinds = acceptingkinds; } 00128 00129 protected: 00130 virtual BOOL OnRenderFileData(LPFORMATETC lpFormatEtc, CFile* pFile); 00131 }; 00132 00133 00134 #endif // whole file