summaryrefslogtreecommitdiffstats
path: root/private/oleutest/simpsvr/obj.h
blob: e7258802fa3094b07297dbda95bc524ad2b5f02f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//**********************************************************************
// File name: obj.h
//
//      Definition of CSimpSvrObj
//
// Copyright (c) 1993 Microsoft Corporation. All rights reserved.
//**********************************************************************

#if !defined( _OBJ_H_)
#define _OBJ_H_

#include "ioipao.h"
#include "ioipo.h"
#include "ioo.h"
#include "ips.h"
#include "ido.h"
#include "iec.h"

class CSimpSvrDoc;
interface COleObject;
interface CPersistStorage;
interface CDataObject;
interface COleInPlaceActiveObject;
interface COleInPlaceObject;
interface CExternalConnection;

class CSimpSvrObj : public IUnknown
{
private:
    CSimpSvrDoc FAR * m_lpDoc;      // Back pointer
    int m_nCount;                   // reference count
    BOOL m_fInPlaceActive;          // Used during InPlace Negotiation
    BOOL m_fInPlaceVisible;         // "  "  "  "   "   "   "   "   "
    BOOL m_fUIActive;               // "  "  "  "   "   "   "   "   "
    HMENU m_hmenuShared;            // "  "  "  "   "   "   "   "   "
    HOLEMENU m_hOleMenu;            // "  "  "  "   "   "   "   "   "
    RECT m_posRect;                 // "  "  "  "   "   "   "   "   "
    OLEINPLACEFRAMEINFO m_FrameInfo;
    BOOL m_fSaveWithSameAsLoad;
    BOOL m_fNoScribbleMode;

    DWORD m_dwRegister;             // Registered in ROT

    int m_red, m_green, m_blue;     // current color
    POINT m_size;                   // current size
    int m_xOffset;
    int m_yOffset;
    float m_scale;

    HWND m_hWndParent;              // parent window handle

    // interfaces used
    LPSTORAGE m_lpStorage;
    LPSTREAM m_lpColorStm, m_lpSizeStm;
    LPOLECLIENTSITE m_lpOleClientSite;          // IOleClientSite
    LPOLEADVISEHOLDER m_lpOleAdviseHolder;      // IOleAdviseHolder
    LPDATAADVISEHOLDER m_lpDataAdviseHolder;    // IDataAdviseHolder
    LPOLEINPLACEFRAME m_lpFrame;                // IOleInPlaceFrame
    LPOLEINPLACEUIWINDOW m_lpCntrDoc;           // IOleInPlaceUIWindow
    LPOLEINPLACESITE m_lpIPSite;                // IOleInPlaceSite

    // interface implemented
    COleObject m_OleObject;                             // IOleObject
    CPersistStorage m_PersistStorage;                   // IPersistStorage
    CDataObject m_DataObject;                           // IDataObject
    COleInPlaceActiveObject m_OleInPlaceActiveObject;   // IOleInPlaceActiveObject
    COleInPlaceObject m_OleInPlaceObject;               // IOleInPlaceObject
    CExternalConnection m_ExternalConnection;

public:
    STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj);
    STDMETHODIMP_(ULONG) AddRef ();
    STDMETHODIMP_(ULONG) Release ();

// construction/destruction
    CSimpSvrObj(CSimpSvrDoc FAR * lpSimpSvrDoc);
    ~CSimpSvrObj();

// utility functions
    void Draw(HDC hDC, BOOL fMetaDC = TRUE);
    void PaintObj(HDC hDC);
    void lButtonDown(WPARAM wParam,LPARAM lParam);
    HANDLE GetMetaFilePict();
    void SaveToStorage (LPSTORAGE lpStg, BOOL fSameAsLoad);
    void LoadFromStorage ();

// visual editing helper functions
    BOOL DoInPlaceActivate (LONG lVerb);
    void AssembleMenus();
    void AddFrameLevelUI();
    void DoInPlaceHide();
    void DisassembleMenus();
    void SendOnDataChange();
    void DeactivateUI();

// member variable access
    inline BOOL IsInPlaceActive() { return m_fInPlaceActive; };
    inline BOOL IsInPlaceVisible() { return m_fInPlaceVisible; };
    inline BOOL IsUIActive() { return m_fUIActive; };
    inline HWND GetParent() { return m_hWndParent; };
    inline LPSTORAGE GetStorage() { return m_lpStorage; };
    inline LPOLECLIENTSITE GetOleClientSite() { return m_lpOleClientSite; };
    inline LPDATAADVISEHOLDER GetDataAdviseHolder() { return m_lpDataAdviseHolder; };
    inline LPOLEADVISEHOLDER GetOleAdviseHolder() { return m_lpOleAdviseHolder; };
    inline LPOLEINPLACEFRAME GetInPlaceFrame() { return m_lpFrame; };
    inline LPOLEINPLACEUIWINDOW GetUIWindow() { return m_lpCntrDoc; };
    inline LPOLEINPLACESITE GetInPlaceSite() { return m_lpIPSite; };
    inline COleObject FAR * GetOleObject() { return &m_OleObject; };
    inline CPersistStorage FAR * GetPersistStorage() { return &m_PersistStorage; };
    inline CDataObject FAR * GetDataObject() { return &m_DataObject; };
    inline COleInPlaceActiveObject FAR * GetOleInPlaceActiveObject() { return &m_OleInPlaceActiveObject; };
    inline COleInPlaceObject FAR * GetOleInPlaceObject() { return &m_OleInPlaceObject; };
    inline void ClearOleClientSite() { m_lpOleClientSite = NULL; };
    inline void ClearDataAdviseHolder() { m_lpDataAdviseHolder = NULL; };
    inline void ClearOleAdviseHolder() { m_lpOleAdviseHolder = NULL; };
    inline LPRECT GetPosRect() { return &m_posRect; };
    inline LPPOINT GetSize() { return &m_size; };
    inline LPOLEINPLACEFRAMEINFO GetFrameInfo() {return &m_FrameInfo;};
    inline DWORD GetRotRegister() { return m_dwRegister; };
    inline void ClearDoc() { m_lpDoc = NULL; };

    // member manipulation
    inline void SetColor (int nRed, int nGreen, int nBlue)
        { m_red = nRed; m_green = nGreen; m_blue = nBlue; };

    inline void RotateColor()
        { m_red+=10; m_green+=10; m_blue+=10;};


// all of the interface implementations should be friends of this
// class
friend interface COleObject;
friend interface CPersistStorage;
friend interface CDataObject;
friend interface COleInPlaceActiveObject;
friend interface COleInPlaceObject;
friend interface CExternalConnection;

};
#endif