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

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // (C) Copyright 1994 by Borland International, All Rights Reserved
  4. //
  5. //----------------------------------------------------------------------------
  6. #if !defined(OWL_OLEWINDO_H)
  7. #define OWL_OLEWINDO_H
  8.  
  9. #if !defined(OWL_WINDOW_H)
  10. # include <owl/window.h>
  11. #endif
  12. #if !defined(OWL_OCFEVENT_H)
  13. # include <owl/ocfevent.h>
  14. #endif
  15. #if !defined(OCF_OCREMVIE_H)
  16. # include <ocf/ocremvie.h>
  17. #endif
  18. #if !defined(OCF_OCPART_H)
  19. # include <ocf/ocpart.h>
  20. #endif
  21. #if !defined(OWL_UIHANDLE_H)
  22. # include <owl/uihandle.h>
  23. #endif
  24. #if !defined(OCF_OCLINK_H)
  25. # include <ocf/oclink.h>
  26. #endif
  27.  
  28. //
  29. // class TOleWindow
  30. // ----- ----------
  31. //
  32. // The generic ole 2 window. Use as a client of a frame window.
  33. //
  34. class _USERCLASS TOleWindow : public TWindow {
  35.   public:
  36.     TOleWindow(TWindow* parent = 0, TModule* module = 0);
  37.    ~TOleWindow();
  38.  
  39.     // Accessors
  40.     //
  41.     TOcDocument* GetOcDoc() {return OcDoc;}
  42.     TOcView*     GetOcView() {return OcView;}
  43.     TOcRemView*  GetOcRemView() {return TYPESAFE_DOWNCAST(OcView, TOcRemView);}
  44.     TOcApp*      GetOcApp() {return OcApp;}
  45.     bool         HasActivePart();
  46.     bool         SelectEmbedded() {return DragPart != 0;}
  47.  
  48.     bool IsOpenEditing() const;
  49.     bool IsRemote() const {return Remote;}
  50.  
  51.     virtual bool OleShutDown();
  52.     virtual void SetupDC(TDC& dc, bool scale = true);
  53.     virtual TOcView* CreateOcView(TRegLink* link, bool isRemote, IUnknown* outer);
  54.  
  55.   protected:
  56.     // Overridables
  57.     //
  58.     virtual void GetInsertPosition(TRect& rect);
  59.     virtual void InvalidatePart(TOcInvalidate invalid); // server only
  60.     virtual bool Deactivate();
  61.     virtual bool Select(uint modKeys, TPoint& point);
  62.     virtual bool PaintSelection(TDC& dc, bool erase, TRect& rect,
  63.                                 void* userData = 0){return false;}
  64.     virtual bool PaintParts(TDC& dc, bool erase, TRect& rect, bool metafile);
  65.     virtual bool PaintLink(TDC& dc, bool erase, TRect& rect,
  66.                            TString& moniker) {return false;}
  67.     virtual void GetLogPerUnit(TSize& logPerUnit);
  68.     virtual void SetScale(uint16 percent);
  69.     virtual void SetSelection(TOcPart* part);
  70.     virtual bool ShowCursor(HWND wnd, uint hitTest, uint mouseMsg);
  71.  
  72.   protected:
  73.     void SetupWindow();
  74.     void CleanupWindow();
  75.     bool IdleAction(long idleCount);
  76.  
  77.     LRESULT EvCommand(uint id, HWND hWndCtl, uint notifyCode);
  78.     void    EvCommandEnable(TCommandEnabler& commandEnabler);
  79.     bool    CanClose();
  80.     bool InClient(TDC& dc, TPoint& point);
  81.  
  82.     void EvPaint();
  83.     void EvSize(uint sizeType, TSize& size);
  84.     void EvMDIActivate(HWND hWndActivated, HWND hWndDeactivated);
  85.     uint EvMouseActivate(HWND topParent, uint hitCode, uint msg);
  86.     void EvSetFocus(HWND hWndLostFocus);
  87.  
  88.     virtual bool EvOcViewPartInvalid(TOcPartChangeInfo& changeInfo);
  89.  
  90.     void CeFileClose(TCommandEnabler& ce);
  91.  
  92.     void CmEditDelete();
  93.     void CmEditCut();
  94.     void CmEditCopy();
  95.     void CmEditPaste();
  96.     void CmEditPasteSpecial();
  97.     void CmEditPasteLink();
  98.     void CmEditLinks();
  99.     void CmEditConvert();
  100.     void CmEditInsertObject();
  101.     void CmEditShowObjects();
  102.  
  103.     void CeEditDelete(TCommandEnabler& ce);
  104.     void CeEditCut(TCommandEnabler& ce);
  105.     void CeEditCopy(TCommandEnabler& ce);
  106.     void CeEditPaste(TCommandEnabler& ce);
  107.     void CeEditPasteSpecial(TCommandEnabler& ce);
  108.     void CeEditPasteLink(TCommandEnabler& ce);
  109.     void CeEditLinks(TCommandEnabler& ce);
  110.     void CeEditObject(TCommandEnabler& ce);
  111.     void CeEditConvert(TCommandEnabler& ce);
  112.     void CeEditVerbs(TCommandEnabler& ce);
  113.     void CeEditInsertObject(TCommandEnabler& ce);
  114.     void CeEditShowObjects(TCommandEnabler& ce);
  115.  
  116.     void EvMouseMove(uint modKeys, TPoint& point);
  117.     void EvRButtonDown(uint modKeys, TPoint& point);
  118.     void EvLButtonUp(uint modKeys, TPoint& point);
  119.     void EvLButtonDown(uint modKeys, TPoint& point);
  120.     void EvLButtonDblClk(uint modKeys, TPoint& point);
  121.     bool EvSetCursor(HWND hWndCursor, uint hitTest, uint mouseMsg);
  122.     void EvDropFiles(TDropInfo dropInfo);
  123.     void EvHScroll(uint scrollCode, uint thumbPos, HWND hWndCtl);
  124.     void EvVScroll(uint scrollCode, uint thumbPos, HWND hWndCtl);
  125.     void EvMenuSelect(uint menuItemId, uint flags, HMENU hMenu);
  126.  
  127.     LRESULT EvOcEvent(WPARAM wParam, LPARAM lParam);
  128. //    uint32 EvOcViewDiscardUndo(void far* undo);
  129.  
  130.     // Container specific messages
  131.     //
  132.     const char far* EvOcViewTitle();
  133.     void   EvOcViewSetTitle(const char far* title);
  134.  
  135.     bool   EvOcViewBorderSpaceReq(TRect far* rect);
  136.     bool   EvOcViewBorderSpaceSet(TRect far* rect);
  137.     bool   EvOcViewDrop(TOcDragDrop far& ddInfo);
  138.     bool   EvOcViewDrag(TOcDragDrop far& ddInfo);
  139.     bool   EvOcViewScroll(TOcScrollDir scrollDir);
  140.     bool   EvOcViewGetScale(TOcScaleFactor& scaleFactor);
  141.     bool   EvOcViewGetSiteRect(TRect far* rect);
  142.     bool   EvOcViewSetSiteRect(TRect far* rect);
  143.     bool   EvOcViewPartActivate(TOcPart& ocPart);
  144.     bool   EvOcViewPasteObject(TOcInitInfo& init);
  145.  
  146.     // Server specific messages
  147.     //
  148.     bool   EvOcPartInvalid(TOcPart far& /*part*/) {return false;}
  149.     bool   EvOcViewSavePart(TOcSaveLoad far& ocSave);
  150.     bool   EvOcViewLoadPart(TOcSaveLoad far& ocLoad);
  151.     bool   EvOcViewPaint(TOcViewPaint far& vp);
  152.     bool   EvOcViewInsMenus(TOcMenuDescr far& sharedMenu);
  153.     bool   EvOcViewShowTools(TOcToolBarInfo far& tbi);
  154.     bool   EvOcViewGetPalette(LOGPALETTE far* far* palette);
  155.     bool   EvOcViewClipData(TOcFormatData far& format);
  156.     bool   EvOcViewSetData(TOcFormatData far& format);
  157.     bool   EvOcViewClose();
  158.     bool   EvOcViewPartSize(TOcPartSize far& size);
  159.     bool   EvOcViewOpenDoc(const char far* path);
  160.     bool   EvOcViewAttachWindow(bool attach);
  161.     bool   EvOcViewSetScale(TOcScaleFactor& scaleFactor);
  162.     bool   EvOcViewGetItemName(TOcItemName& item);
  163.     bool   EvOcViewSetLink(TOcLinkView& view);
  164.     bool   EvOcViewBreakLink(TOcLinkView& view);
  165.     bool   EvOcViewDoVerb(uint verb);
  166.  
  167.     TPopupMenu* CreateVerbPopup(const TOcVerb& ocVerb);
  168.     void EvDoVerb(uint whichVerb);
  169.     void Init();
  170.  
  171.   protected:
  172.     TOcPart*          DragPart;
  173.     TUIHandle::TWhere DragHit;
  174.     TDC*              DragDC;
  175.     TPoint            DragPt;
  176.     TRect             DragRect;
  177.     TPoint            DragStart;
  178.     TOcScaleFactor    Scale;              // current scaling factor
  179.     TRect             Pos;                // current position
  180.  
  181.     TOcDocument*      OcDoc;              // associated OCF document partner
  182.     TOcView*          OcView;             // associated OCF view partner
  183.     TOcApp*           OcApp;              // associated OCF app partner
  184.     string            ContainerName;      // Name for this container
  185.  
  186.     bool              Remote;             // Using a remote OC view?
  187.     bool              ShowObjects;        // Show embedded part frames?
  188.  
  189.     int               MinWidth;           // minimum width of part
  190.     int               MinHeight;          // minimum height of part
  191.  
  192.   DECLARE_RESPONSE_TABLE(TOleWindow);
  193. };
  194.  
  195.  
  196. //
  197. // class TOleClientDC
  198. // ----- ------------
  199. //
  200. // The TOleClientDC is a client dc with window origin, ext, and viewport
  201. // origin, ext set up to reflect the current scrolling and scaling information.
  202. //
  203. class TOleClientDC : public TClientDC {
  204.   public:
  205.     TOleClientDC(TOleWindow& win, bool scale = true);
  206. };
  207.  
  208.  
  209. #endif
  210.