GME  13
ActiveBrowserPropertyPage.h
Go to the documentation of this file.
00001 // ActiveBrowserPropertyPage.h : header file
00002 //
00003 
00004 #ifndef __ACTIVEBROWSERPROPERTYPAGE_H__
00005 #define __ACTIVEBROWSERPROPERTYPAGE_H__
00006 
00008 // CAggregatePropertyPage dialog
00009 
00010 #include "MgaMappedTreeCtrl.h"
00011 #include "MetaTreeCtrl.h"
00012 #include "AggregateTreeCtrl.h"
00013 #include "InheritanceTreeCtrl.h"
00014 #include "AggregateOptions.h"
00015 #include "AutoComboBox.h"
00016 #include "ComboEdit.h"  // Added by ClassView
00017 #include "MetaConnectionDlg.h"
00018 
00019 class CActiveBrowserPropertySheet;
00020 
00021 
00022 class CAggregatePropertyPage : public CPropertyPage
00023 {
00024         DECLARE_DYNCREATE(CAggregatePropertyPage)
00025 
00026         friend class CAggregateContextMenu;
00027 // Construction
00028 public:
00029         void RefreshLibrary();
00030         void AttachLibrary();
00031         void LibraryDependencies();
00032         void LibraryAmbiguityChk();
00033         void ProjectSourceControlUpdate( CComBSTR p_id);
00034         void SourceControlObjectOwner( CComBSTR p_id);
00035         void SourceControlActiveUsers();
00036         bool askUserAndDeleteLibrary( CComPtr<IMgaFolder> p_ccpFolder);
00037 
00038         void PrepareStateImageList();
00039         void DoDrag(CPoint ptDrag);
00040         void DoCopy();
00041         void DoCopyClosure();
00042         void DoCopySmart( int k = 0);
00043         bool askUserAndDetach( CComPtr<IMgaObject> obj); // called when archetype is deleted
00044         void accessRights( bool pbProtectIt);
00045         void HighlightItem(IMgaObject* pUnk, int highlight);
00046 
00047         
00048         CComboEdit m_ComboEditCtrl;
00049 
00050         int GetSourceControlStateOffset(IMgaObject * obj, int * latent);
00051 
00052         BOOL HasDisplayedChild(HTREEITEM hItem);
00053 
00054         CAggregateOptions m_Options;
00055 
00056         void GotoIUnk(BSTR Id);
00057         void GotoIUnkPtr( IMgaObject * p_obj);
00058         void Refresh();
00059         void OnMgaEvent(CComPtr<IMgaObject> ccpMgaObject, unsigned long lEventMask);
00060 
00061         // Called on opening the project
00062         void OpenProject();
00063         void SetFocus2();
00064         // Called on closing the project
00065         void CloseProject();
00066 
00067         BOOL reqHasDisplayedChild(IMgaObject* pIMgaObject, int nDepthLevel=-1);
00068         
00069         CActiveBrowserPropertySheet* m_parent;
00070                    
00071         CAggregatePropertyPage();
00072         ~CAggregatePropertyPage();
00073 
00074 // Dialog Data
00075         //{{AFX_DATA(CAggregatePropertyPage)
00076         enum { IDD = IDD_PROPPAGE_AGGREGATE };
00077         CAutoComboBox   m_ComboSearchCtrl;
00078         CButton m_SearchButtonCtrl;
00079         CAggregateTreeCtrl      m_TreeAggregate;
00080         //}}AFX_DATA
00081 
00082 
00083 // Overrides
00084         // ClassWizard generate virtual function overrides
00085         //{{AFX_VIRTUAL(CAggregatePropertyPage)
00086         public:
00087         virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
00088         virtual BOOL OnSetActive();
00089         protected:
00090         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00091         //}}AFX_VIRTUAL
00092 
00093 // Implementation
00094 protected:
00095         afx_msg void OnContextMenu(CWnd*, CPoint point);
00096         // Generated message map functions
00097         //{{AFX_MSG(CAggregatePropertyPage)
00098         afx_msg void OnSize(UINT nType, int cx, int cy);
00099         virtual BOOL OnInitDialog();
00100         afx_msg void OnItemExpandingTreeAggregate(NMHDR* pNMHDR, LRESULT* pResult);
00101         afx_msg void OnClickTreeAggregate(NMHDR* pNMHDR, LRESULT* pResult);
00102         afx_msg void OnSelChangedTreeAggregate(NMHDR* pNMHDR, LRESULT* pResult);
00103         afx_msg void OnDblclkTreeAggregate(NMHDR* pNMHDR, LRESULT* pResult);
00104         afx_msg void OnEndLabelEditTreeAggregate(NMHDR* pNMHDR, LRESULT* pResult);
00105         afx_msg void OnKeyDownTreeAggregate(NMHDR* pNMHDR, LRESULT* pResult);
00106         afx_msg void OnGetDispInfoTreeAggregate(NMHDR* pNMHDR, LRESULT* pResult);
00107         afx_msg void OnItemExpandedTreeAggregate(NMHDR* pNMHDR, LRESULT* pResult);
00108         afx_msg void OnSearch();
00109         afx_msg void OnBeginDragTreeAggregate(NMHDR* pNMHDR, LRESULT* pResult);
00110         afx_msg void OnKillFocus(CWnd* pNewWnd);
00111         //}}AFX_MSG
00112         DECLARE_MESSAGE_MAP()
00113         CImageList m_ImageList;
00114         CImageList m_StateImageList;
00115         CImageList* m_pDragImageList;
00116         void OnSetFocus( CWnd* pOldWnd );
00117 
00118 
00119 private:
00120 
00121         BOOL m_bProjectOpen;
00122         BOOL m_bIsBrowserCreatedNewObject;
00123         CString m_strProjectName;
00124         HBITMAP m_SearchButtonCtrlBitmap;
00125 
00126         // Creates the tree             
00127         void SetupTree();
00128 
00129     
00130         // Gets the Name property of an MgaObject
00131         CString GetDisplayedName(IMgaObject *pIMgaObject);
00132         // Recursively build up the tree traversing the meta hierarchy
00133         void reqBuildAggregateTree(HTREEITEM hParent,IMgaObject* pIMgaObject, int nDepthLevel, int nCounter=0, bool bWithUpdate=false);
00134 
00135         static void composeInfo( CString p_msgText, CComPtr<IMgaFolders>& coll, CString& p_msg);
00136 
00137 };
00138 
00139 
00141 // CInheritancePropertyPage dialog
00142 
00143 class CInheritancePropertyPage : public CPropertyPage
00144 {
00145         DECLARE_DYNCREATE(CInheritancePropertyPage)
00146 
00147 // Construction
00148 public:
00149 
00150         CComboEdit m_ComboEditCtrl;
00151 
00152         // Called on opening the project
00153         void OpenProject();
00154         // Called on closing the project
00155         void CloseProject();
00156         CInheritancePropertyPage();
00157         ~CInheritancePropertyPage();
00158         
00159         // Resets the last root object, used by the CAggregatePropertyPage also
00160         void ResetRoot();
00161         void Refresh();
00162         void OnMgaEvent(CComPtr<IMgaObject> ccpMgaObject, unsigned long lEventMask);
00163         void PrepareStateImageList();
00164 
00165         CActiveBrowserPropertySheet* m_parent;
00166 
00167 // Dialog Data
00168         //{{AFX_DATA(CInheritancePropertyPage)
00169         enum { IDD = IDD_PROPPAGE_INHERITANCE };
00170         CAutoComboBox   m_ComboSearchCtrl;
00171         CInheritanceTreeCtrl    m_TreeInheritance;
00172         //}}AFX_DATA
00173 
00174 
00175 // Overrides
00176         // ClassWizard generate virtual function overrides
00177         //{{AFX_VIRTUAL(CInheritancePropertyPage)
00178         public:
00179         virtual BOOL OnSetActive();
00180         protected:
00181         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00182         //}}AFX_VIRTUAL
00183 
00184 // Implementation
00185 protected:
00186         // Generated message map functions
00187         //{{AFX_MSG(CInheritancePropertyPage)
00188         afx_msg void OnSize(UINT nType, int cx, int cy);
00189         virtual BOOL OnInitDialog();
00190         afx_msg void OnSelChangedTreeInheritance(NMHDR* pNMHDR, LRESULT* pResult);
00191         afx_msg void OnDblclkTreeInheritance(NMHDR* pNMHDR, LRESULT* pResult);
00192         afx_msg void OnItemExpandingTreeInheritance(NMHDR* pNMHDR, LRESULT* pResult);
00193         afx_msg void OnKeyDownTreeInheritance(NMHDR* pNMHDR, LRESULT* pResult);
00194         //}}AFX_MSG
00195         DECLARE_MESSAGE_MAP()
00196         CImageList m_ImageList;
00197         CImageList m_StateImageList;
00198 
00199 private:
00200         // Remembering the current root object (in the inheritance tree)
00201         CComPtr<IMgaFCO> m_theCurrentRootFCO;
00202         // Remembering the previously selected item in the aggregation window
00203         LPUNKNOWN m_pPrevSelectedItem; 
00204         // Gets the Name property of an MgaObject
00205         CString GetDisplayedName(IMgaObject *pIMgaObject);
00206         // Creates the tree
00207         void SetupTree();
00208         // Creates the tree using the m_theCurrentRootFCO var as root / used for refresh
00209         void SetupTree2();
00210         // Recursively build up the tree traversing the inheritance hierarchy
00211         void reqBuildInheritanceTree(HTREEITEM hParent, IMgaFCO* pIMgaFCO, int nDepthLevel);
00212         // Finds the root of the inheritance hierarchy
00213         void reqFindInheritanceRoot(CComPtr<IMgaFCO>&ccpMgaFCO);
00214 
00215 };
00216 
00217 
00219 // CMetaPropertyPage dialog
00220 
00221 typedef CComPtr<IMgaMetaBase>MetaObjectPtr;
00222 #define ADAPT_META_OBJECT(x) CAdapt<MetaObjectPtr>(x)
00223 typedef CList<CAdapt<MetaObjectPtr>,CAdapt<MetaObjectPtr>&>CMetaObjectList;
00224 
00225 
00226 class CMetaPropertyPage : public CPropertyPage
00227 {
00228         DECLARE_DYNCREATE(CMetaPropertyPage)
00229 
00230 // Construction
00231 public:
00232 
00233         CComboEdit m_ComboEditCtrl;
00234 
00235         // Called on opening the project
00236         void OpenProject();
00237         // Called on closing the project
00238         void CloseProject();
00239         CMetaPropertyPage();
00240         ~CMetaPropertyPage();
00241 
00242         CActiveBrowserPropertySheet* m_parent;
00243 
00244 // Dialog Data
00245         //{{AFX_DATA(CMetaPropertyPage)
00246         enum { IDD = IDD_PROPPAGE_META };
00247         CAutoComboBox   m_ComboSearchCtrl;
00248         CMetaTreeCtrl   m_TreeMeta;
00249         //}}AFX_DATA
00250 
00251 
00252 // Overrides
00253         // ClassWizard generate virtual function overrides
00254         //{{AFX_VIRTUAL(CMetaPropertyPage)
00255         virtual BOOL OnSetActive();
00256         protected:
00257         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00258         //}}AFX_VIRTUAL
00259 
00260 // Implementation
00261 protected:
00262         // Generated message map functions
00263         //{{AFX_MSG(CMetaPropertyPage)
00264         afx_msg void OnSize(UINT nType, int cx, int cy);
00265         virtual BOOL OnInitDialog();
00266         afx_msg void OnDblclkTreeMeta(NMHDR* pNMHDR, LRESULT* pResult);
00267         afx_msg void OnSelChangedTreeMeta(NMHDR* pNMHDR, LRESULT* pResult);
00268         afx_msg void OnItemExpandingTreeMeta(NMHDR* pNMHDR, LRESULT* pResult);
00269         afx_msg void OnKeyDownTreeMeta(NMHDR* pNMHDR, LRESULT* pResult);
00270         //}}AFX_MSG
00271         DECLARE_MESSAGE_MAP()
00272         CImageList m_ImageList;
00273         
00274         private:
00275         // Strores project name to replace the label of the root folder
00276         CString m_strProjectName;
00277         // Processes the data structure of the Attribute data type
00278         void ProcessAttributes(HTREEITEM hParent, IMgaMetaFCO* pIMgaMetaFCO);
00279         // Processes the complex data structure of the Connection data type
00280         void ProcessConnection(CString &strConnectionToolTip, IMgaMetaConnection *pIMetaConnection);
00281         
00282         // Gets the DisplayedName property of a MetaBase        
00283         CString GetDisplayedName(IMgaMetaBase* pIMgaMetaBase);
00284         // Creates the tree             
00285         void SetupTree();
00286 
00287         HTREEITEM InsertIntoMetaTree(HTREEITEM hParent,IMgaMetaBase* IMetaObject, CString strRoleName);
00288         int InsertChildren(CComPtr<IMgaMetaBase>& ccpMetaObject,CMetaObjectList& MetaObjectList);
00289 
00290 
00291 };
00292 
00293 
00294 
00295 #endif // __ACTIVEBROWSERPROPERTYPAGE_H__