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