home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / OWLINC.PAK / OLEVIEW.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  4KB  |  125 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // (C) Copyright 1994 by Borland International, All Rights Reserved
  4. //
  5. //----------------------------------------------------------------------------
  6. #if !defined(OWL_OLEVIEW_H)
  7. #define OWL_OLEVIEW_H
  8.  
  9. #if !defined(OWL_OLEWINDO_H)
  10. # include <owl/olewindo.h>
  11. #endif
  12. #if !defined(OWL_DOCVIEW_H)
  13. # include <owl/docview.h>
  14. #endif
  15.  
  16. //---------------------  Additional notification messages ---------------------
  17. //
  18. const int vnInvalidate  = 9;   // a rect in view needs repaint
  19. const int vnLinkView    = 10;  // find view with matched TOcLinkView
  20. const int vnLinkMoniker = 11;  // find view with matched moniker
  21.  
  22. NOTIFY_SIG(vnInvalidate, TRect&)
  23. NOTIFY_SIG(vnLinkView, TOcLinkView&)
  24. NOTIFY_SIG(vnLinkMoniker, TString&)
  25.  
  26. #define EV_VN_INVALIDATE  VN_DEFINE(vnInvalidate,  VnInvalidate,  long)
  27. #define EV_VN_LINKVIEW    VN_DEFINE(vnLinkView,    VnLinkView,    long)
  28. #define EV_VN_LINKMONIKER VN_DEFINE(vnLinkMoniker, VnLinkMoniker, long)
  29.  
  30. //
  31. // class TOleView
  32. // ----- --------
  33. //
  34. // The ole 2 window view class. Used as a view in doc/view model
  35. //
  36. class _USERCLASS TOleView : public TOleWindow, public TView {
  37.   public:
  38.     TOleView(TDocument& doc, TWindow* parent = 0);
  39.    ~TOleView();
  40.  
  41.     static const char far* StaticName() {return "Ole View";}
  42.  
  43.     // Inherited virtuals from TView
  44.     //
  45.     const char far* GetViewName() {return StaticName();}
  46.     TWindow* GetWindow() {return (TWindow*)this;}
  47.     bool     SetDocTitle(const char far* docname, int index)
  48.                {return TWindow::SetDocTitle(docname, index);}
  49.     bool     OleShutDown();
  50.  
  51.   protected:
  52.     bool CanClose();
  53.     TOcView* CreateOcView(TRegLink* link, bool isEmbedded, IUnknown* outer);
  54.     void CleanupWindow();
  55.     bool OtherViewExists();
  56.  
  57.     // View notifications
  58.     //
  59.     bool VnInvalidate(TRect& rect);
  60.     bool VnDocOpened(int omode);
  61.     bool VnDocClosed(int omode);
  62.  
  63.     TMenuDescr* GetViewMenu();
  64.  
  65.     bool EvOcViewPartInvalid(TOcPartChangeInfo& changeInfo);
  66. //    uint32 EvOcViewDiscardUndo(void far* undo);
  67.  
  68.     // Container specific messages
  69.     //
  70. //    bool   EvOcAppInsMenus(TOcMenuDescr far&);
  71.  
  72.     // Server specific messages
  73.     //
  74.     bool   EvOcViewClose();
  75.     bool   EvOcViewSavePart(TOcSaveLoad far& ocSave);
  76.     bool   EvOcViewLoadPart(TOcSaveLoad far& ocLoad);
  77.     bool   EvOcViewOpenDoc(const char far* path);
  78.     bool   EvOcViewInsMenus(TOcMenuDescr far& sharedMenu);
  79.     bool   EvOcViewAttachWindow(bool attach);
  80.     bool   EvOcViewSetLink(TOcLinkView& view);
  81.     bool   EvOcViewBreakLink(TOcLinkView& view);
  82.     bool   EvOcViewGetItemName(TOcItemName& item);
  83.  
  84.   private:
  85.     bool   Destroying;
  86.  
  87.     // event handlers
  88.     //
  89.     bool     VnIsWindow(HWND hWnd);
  90.  
  91.   DECLARE_RESPONSE_TABLE(TOleView);
  92.   DECLARE_STREAMABLE(_OWLCLASS, TOleView,1);
  93. };
  94.  
  95.  
  96. //=====================  TOleLinkView  =======================================
  97.  
  98. class _DOCVIEWCLASS TOleLinkView : public TView {
  99.   public:
  100.     TOleLinkView(TDocument& doc, TOcLinkView& view);
  101.    ~TOleLinkView();
  102.  
  103.     virtual bool VnLinkView(TOcLinkView& view);
  104.     virtual bool VnLinkMoniker(TString& moniker);
  105.     virtual bool UpdateLinks();
  106.     TString& GetMoniker();
  107.  
  108.     static const char far* StaticName()
  109.     {
  110.       return "Link View";
  111.     }
  112.  
  113.     const char far* GetViewName()
  114.     {
  115.       return StaticName();
  116.     }
  117.  
  118.   protected:
  119.     TOcLinkView&  OcLinkView;     // TOcLinkView partner for this view
  120.  
  121.   DECLARE_RESPONSE_TABLE(TOleLinkView);
  122. };
  123.  
  124. #endif  // OWL_OLEVIEW_H
  125.