Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
CControlSite Class Reference

#include <ControlSite.h>

Inheritance diagram for CControlSite:
Inheritance graph
[legend]
Collaboration diagram for CControlSite:
Collaboration graph
[legend]

List of all members.

Public Types

typedef HRESULT(_stdcall * OleCommandProc )(CControlSite *pT, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)

Public Member Functions

 CControlSite ()
virtual ~CControlSite ()
HWND GetCommandTargetWindow ()
virtual HRESULT Create (REFCLSID clsid, PropertyList &pl=PropertyList(), LPCWSTR szCodebase=NULL, IBindCtx *pBindContext=NULL)
virtual HRESULT Attach (HWND hwndParent, const RECT &rcPos, IUnknown *pInitStream=NULL)
virtual HRESULT Detach ()
virtual HRESULT GetControlUnknown (IUnknown **ppObject)
virtual HRESULT SetPosition (const RECT &rcPos)
virtual HRESULT Draw (HDC hdc)
virtual HRESULT DoVerb (LONG nVerb, LPMSG lpMsg=NULL)
virtual HRESULT Advise (IUnknown *pIUnkSink, const IID &iid, DWORD *pdwCookie)
virtual HRESULT Unadvise (const IID &iid, DWORD dwCookie)
virtual void SetServiceProvider (IServiceProvider *pSP)
virtual void SetContainer (IOleContainer *pContainer)
virtual void SetSecurityPolicy (CControlSiteSecurityPolicy *pSecurityPolicy)
virtual
CControlSiteSecurityPolicy
GetSecurityPolicy () const
virtual void SetAmbientUserMode (BOOL bUser)
virtual const CLSID & GetObjectCLSID () const
virtual BOOL IsObjectValid () const
virtual HWND GetParentWindow () const
virtual BOOL IsInPlaceActive () const
virtual BOOL IsClassSafeToHost (const CLSID &clsid)
virtual BOOL IsClassMarkedSafeForScripting (const CLSID &clsid, BOOL &bClassExists)
virtual BOOL IsObjectSafeForScripting (IUnknown *pObject, const IID &iid)
virtual BOOL IsObjectSafeForScripting (const IID &iid)
virtual HRESULT STDMETHODCALLTYPE QueryService (REFGUID guidService, REFIID riid, void **ppv)
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount (UINT __RPC_FAR *pctinfo)
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo (UINT iTInfo, LCID lcid, ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo)
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames (REFIID riid, LPOLESTR __RPC_FAR *rgszNames, UINT cNames, LCID lcid, DISPID __RPC_FAR *rgDispId)
virtual HRESULT STDMETHODCALLTYPE Invoke (DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS __RPC_FAR *pDispParams, VARIANT __RPC_FAR *pVarResult, EXCEPINFO __RPC_FAR *pExcepInfo, UINT __RPC_FAR *puArgErr)
virtual void STDMETHODCALLTYPE OnDataChange (FORMATETC __RPC_FAR *pFormatetc, STGMEDIUM __RPC_FAR *pStgmed)
virtual void STDMETHODCALLTYPE OnViewChange (DWORD dwAspect, LONG lindex)
virtual void STDMETHODCALLTYPE OnRename (IMoniker __RPC_FAR *pmk)
virtual void STDMETHODCALLTYPE OnSave (void)
virtual void STDMETHODCALLTYPE OnClose (void)
virtual void STDMETHODCALLTYPE OnLinkSrcChange (IMoniker __RPC_FAR *pmk)
virtual void STDMETHODCALLTYPE OnViewStatusChange (DWORD dwViewStatus)
virtual HRESULT STDMETHODCALLTYPE GetWindow (HWND __RPC_FAR *phwnd)
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp (BOOL fEnterMode)
virtual HRESULT STDMETHODCALLTYPE SaveObject (void)
virtual HRESULT STDMETHODCALLTYPE GetMoniker (DWORD dwAssign, DWORD dwWhichMoniker, IMoniker __RPC_FAR *__RPC_FAR *ppmk)
virtual HRESULT STDMETHODCALLTYPE GetContainer (IOleContainer __RPC_FAR *__RPC_FAR *ppContainer)
virtual HRESULT STDMETHODCALLTYPE ShowObject (void)
virtual HRESULT STDMETHODCALLTYPE OnShowWindow (BOOL fShow)
virtual HRESULT STDMETHODCALLTYPE RequestNewObjectLayout (void)
virtual HRESULT STDMETHODCALLTYPE CanInPlaceActivate (void)
virtual HRESULT STDMETHODCALLTYPE OnInPlaceActivate (void)
virtual HRESULT STDMETHODCALLTYPE OnUIActivate (void)
virtual HRESULT STDMETHODCALLTYPE GetWindowContext (IOleInPlaceFrame __RPC_FAR *__RPC_FAR *ppFrame, IOleInPlaceUIWindow __RPC_FAR *__RPC_FAR *ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
virtual HRESULT STDMETHODCALLTYPE Scroll (SIZE scrollExtant)
virtual HRESULT STDMETHODCALLTYPE OnUIDeactivate (BOOL fUndoable)
virtual HRESULT STDMETHODCALLTYPE OnInPlaceDeactivate (void)
virtual HRESULT STDMETHODCALLTYPE DiscardUndoState (void)
virtual HRESULT STDMETHODCALLTYPE DeactivateAndUndo (void)
virtual HRESULT STDMETHODCALLTYPE OnPosRectChange (LPCRECT lprcPosRect)
virtual HRESULT STDMETHODCALLTYPE OnInPlaceActivateEx (BOOL __RPC_FAR *pfNoRedraw, DWORD dwFlags)
virtual HRESULT STDMETHODCALLTYPE OnInPlaceDeactivateEx (BOOL fNoRedraw)
virtual HRESULT STDMETHODCALLTYPE RequestUIActivate (void)
virtual HRESULT STDMETHODCALLTYPE CanWindowlessActivate (void)
virtual HRESULT STDMETHODCALLTYPE GetCapture (void)
virtual HRESULT STDMETHODCALLTYPE SetCapture (BOOL fCapture)
virtual HRESULT STDMETHODCALLTYPE GetFocus (void)
virtual HRESULT STDMETHODCALLTYPE SetFocus (BOOL fFocus)
virtual HRESULT STDMETHODCALLTYPE GetDC (LPCRECT pRect, DWORD grfFlags, HDC __RPC_FAR *phDC)
virtual HRESULT STDMETHODCALLTYPE ReleaseDC (HDC hDC)
virtual HRESULT STDMETHODCALLTYPE InvalidateRect (LPCRECT pRect, BOOL fErase)
virtual HRESULT STDMETHODCALLTYPE InvalidateRgn (HRGN hRGN, BOOL fErase)
virtual HRESULT STDMETHODCALLTYPE ScrollRect (INT dx, INT dy, LPCRECT pRectScroll, LPCRECT pRectClip)
virtual HRESULT STDMETHODCALLTYPE AdjustRect (LPRECT prc)
virtual HRESULT STDMETHODCALLTYPE OnDefWindowMessage (UINT msg, WPARAM wParam, LPARAM lParam, LRESULT __RPC_FAR *plResult)
virtual HRESULT STDMETHODCALLTYPE OnControlInfoChanged (void)
virtual HRESULT STDMETHODCALLTYPE LockInPlaceActive (BOOL fLock)
virtual HRESULT STDMETHODCALLTYPE GetExtendedControl (IDispatch __RPC_FAR *__RPC_FAR *ppDisp)
virtual HRESULT STDMETHODCALLTYPE TransformCoords (POINTL __RPC_FAR *pPtlHimetric, POINTF __RPC_FAR *pPtfContainer, DWORD dwFlags)
virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator (MSG __RPC_FAR *pMsg, DWORD grfModifiers)
virtual HRESULT STDMETHODCALLTYPE OnFocus (BOOL fGotFocus)
virtual HRESULT STDMETHODCALLTYPE ShowPropertyFrame (void)
virtual HRESULT STDMETHODCALLTYPE OnStartBinding (DWORD dwReserved, IBinding __RPC_FAR *pib)
virtual HRESULT STDMETHODCALLTYPE GetPriority (LONG __RPC_FAR *pnPriority)
virtual HRESULT STDMETHODCALLTYPE OnLowResource (DWORD reserved)
virtual HRESULT STDMETHODCALLTYPE OnProgress (ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
virtual HRESULT STDMETHODCALLTYPE OnStopBinding (HRESULT hresult, LPCWSTR szError)
virtual HRESULT STDMETHODCALLTYPE GetBindInfo (DWORD __RPC_FAR *grfBINDF, BINDINFO __RPC_FAR *pbindinfo)
virtual HRESULT STDMETHODCALLTYPE OnDataAvailable (DWORD grfBSCF, DWORD dwSize, FORMATETC __RPC_FAR *pformatetc, STGMEDIUM __RPC_FAR *pstgmed)
virtual HRESULT STDMETHODCALLTYPE OnObjectAvailable (REFIID riid, IUnknown __RPC_FAR *punk)
virtual HRESULT STDMETHODCALLTYPE GetWindow (REFGUID rguidReason, HWND *phwnd)
virtual HRESULT STDMETHODCALLTYPE QueryStatus (const GUID __RPC_FAR *pguidCmdGroup, ULONG cCmds, OLECMD __RPC_FAR prgCmds[], OLECMDTEXT __RPC_FAR *pCmdText)
virtual HRESULT STDMETHODCALLTYPE Exec (const GUID __RPC_FAR *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT __RPC_FAR *pvaIn, VARIANT __RPC_FAR *pvaOut)

Static Public Member Functions

static CControlSiteSecurityPolicyGetDefaultControlSecurityPolicy ()

Public Attributes

HWND m_hWndParent
RECT m_rcObjectPos
unsigned m_bSetClientSiteFirst:1
unsigned m_bVisibleAtRuntime:1
unsigned m_bInPlaceActive:1
unsigned m_bUIActive:1
unsigned m_bInPlaceLocked:1
unsigned m_bSupportWindowlessActivation:1
unsigned m_bWindowless:1
unsigned m_bSafeForScriptingObjectsOnly:1
CComPtr< IServiceProvider > m_spServiceProvider
CComPtr< IOleContainer > m_spContainer

Protected Member Functions

virtual void FireAmbientPropertyChange (DISPID id)

Protected Attributes

CComPtr< IUnknownm_spObject
CComQIPtr< IViewObject,&IID_IViewObject > m_spIViewObject
CComQIPtr< IOleObject,&IID_IOleObject > m_spIOleObject
CComQIPtr< IOleInPlaceObject,&IID_IOleInPlaceObject > m_spIOleInPlaceObject
CComQIPtr
< IOleInPlaceObjectWindowless,&IID_IOleInPlaceObjectWindowless > 
m_spIOleInPlaceObjectWindowless
CLSID m_CLSID
PropertyList m_ParameterList
CControlSiteSecurityPolicym_pSecurityPolicy
unsigned m_bBindingInProgress
HRESULT m_hrBindResult
RECT m_rcBuffer
HBITMAP m_hBMBuffer
HBITMAP m_hBMBufferOld
HDC m_hDCBuffer
HRGN m_hRgnBuffer
DWORD m_dwBufferFlags
LCID m_nAmbientLocale
COLORREF m_clrAmbientForeColor
COLORREF m_clrAmbientBackColor
bool m_bAmbientShowHatching:1
bool m_bAmbientShowGrabHandles:1
bool m_bAmbientUserMode:1
bool m_bAmbientAppearance:1

Detailed Description

Definition at line 106 of file ControlSite.h.


Member Typedef Documentation

typedef HRESULT(_stdcall * IOleCommandTargetImpl< CControlSite >::OleCommandProc)(CControlSite *pT, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) [inherited]

Definition at line 99 of file IOleCommandTargetImpl.h.


Constructor & Destructor Documentation

Definition at line 218 of file ControlSite.cpp.

Here is the call graph for this function:


Member Function Documentation

HRESULT STDMETHODCALLTYPE CControlSite::AdjustRect ( LPRECT  prc) [virtual]

Definition at line 1208 of file ControlSite.cpp.

{
    if (prc == NULL)
    {
        return E_INVALIDARG;
    }

    // Clip the rectangle against the object position
    RECT rcI = { 0, 0, 0, 0 };
    IntersectRect(&rcI, &m_rcObjectPos, prc);
    *prc = rcI;
    return S_OK;
}
HRESULT CControlSite::Advise ( IUnknown pIUnkSink,
const IID &  iid,
DWORD pdwCookie 
) [virtual]

Definition at line 542 of file ControlSite.cpp.

{
    if (m_spObject == NULL)
    {
        return E_UNEXPECTED;
    }

    if (pIUnkSink == NULL || pdwCookie == NULL)
    {
        return E_INVALIDARG;
    }

    return AtlAdvise(m_spObject, pIUnkSink, iid, pdwCookie);
}
HRESULT CControlSite::Attach ( HWND  hwndParent,
const RECT &  rcPos,
IUnknown pInitStream = NULL 
) [virtual]

Definition at line 389 of file ControlSite.cpp.

{
    TRACE_METHOD(CControlSite::Attach);

    if (hwndParent == NULL)
    {
        NS_ASSERTION(0, "No parent hwnd");
        return E_INVALIDARG;
    }

    m_hWndParent = hwndParent;
    m_rcObjectPos = rcPos;

    // Object must have been created
    if (m_spObject == NULL)
    {
        return E_UNEXPECTED;
    }

    m_spIViewObject = m_spObject;
    m_spIOleObject = m_spObject;
    
    if (m_spIOleObject == NULL)
    {
        return E_FAIL;
    }
    
    DWORD dwMiscStatus;
    m_spIOleObject->GetMiscStatus(DVASPECT_CONTENT, &dwMiscStatus);

    if (dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST)
    {
        m_bSetClientSiteFirst = TRUE;
    }
    if (dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME)
    {
        m_bVisibleAtRuntime = FALSE;
    }

    // Some objects like to have the client site as the first thing
    // to be initialised (for ambient properties and so forth)
    if (m_bSetClientSiteFirst)
    {
        m_spIOleObject->SetClientSite(this);
    }

    // If there is a parameter list for the object and no init stream then
    // create one here.
    CPropertyBagInstance *pPropertyBag = NULL;
    if (pInitStream == NULL && m_ParameterList.GetSize() > 0)
    {
        CPropertyBagInstance::CreateInstance(&pPropertyBag);
        pPropertyBag->AddRef();
        for (unsigned long i = 0; i < m_ParameterList.GetSize(); i++)
        {
            pPropertyBag->Write(m_ParameterList.GetNameOf(i),
                const_cast<VARIANT *>(m_ParameterList.GetValueOf(i)));
        }
        pInitStream = (IPersistPropertyBag *) pPropertyBag;
    }

    // Initialise the control from store if one is provided
    if (pInitStream)
    {
        CComQIPtr<IPropertyBag, &IID_IPropertyBag> spPropertyBag = pInitStream;
        CComQIPtr<IStream, &IID_IStream> spStream = pInitStream;
        CComQIPtr<IPersistStream, &IID_IPersistStream> spIPersistStream = m_spIOleObject;
        CComQIPtr<IPersistPropertyBag, &IID_IPersistPropertyBag> spIPersistPropertyBag = m_spIOleObject;

        if (spIPersistPropertyBag && spPropertyBag)
        {
            spIPersistPropertyBag->Load(spPropertyBag, NULL);
        }
        else if (spIPersistStream && spStream)
        {
            spIPersistStream->Load(spStream);
        }
    }
    else
    {
        // Initialise the object if possible
        CComQIPtr<IPersistStreamInit, &IID_IPersistStreamInit> spIPersistStreamInit = m_spIOleObject;
        if (spIPersistStreamInit)
        {
            spIPersistStreamInit->InitNew();
        }
    }

    m_spIOleInPlaceObject = m_spObject;
    m_spIOleInPlaceObjectWindowless = m_spObject;

    m_spIOleInPlaceObject->SetObjectRects(&m_rcObjectPos, &m_rcObjectPos);

    // In-place activate the object
    if (m_bVisibleAtRuntime)
    {
        DoVerb(OLEIVERB_INPLACEACTIVATE);
    }

    // For those objects which haven't had their client site set yet,
    // it's done here.
    if (!m_bSetClientSiteFirst)
    {
        m_spIOleObject->SetClientSite(this);
    }

    return S_OK;
}

Here is the call graph for this function:

HRESULT STDMETHODCALLTYPE CControlSite::CanInPlaceActivate ( void  ) [virtual]

Definition at line 880 of file ControlSite.cpp.

{
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::CanWindowlessActivate ( void  ) [virtual]

Definition at line 1005 of file ControlSite.cpp.

{
    // Allow windowless activation?
    return (m_bSupportWindowlessActivation) ? S_OK : S_FALSE;
}
HRESULT STDMETHODCALLTYPE CControlSite::ContextSensitiveHelp ( BOOL  fEnterMode) [virtual]

Definition at line 824 of file ControlSite.cpp.

{
    return S_OK;
}
HRESULT CControlSite::Create ( REFCLSID  clsid,
PropertyList pl = PropertyList(),
LPCWSTR  szCodebase = NULL,
IBindCtx *  pBindContext = NULL 
) [virtual]

Definition at line 226 of file ControlSite.cpp.

{
    TRACE_METHOD(CControlSite::Create);

    m_CLSID = clsid;
    m_ParameterList = pl;

    // See if security policy will allow the control to be hosted
    if (m_pSecurityPolicy && !m_pSecurityPolicy->IsClassSafeToHost(clsid))
    {
        return E_FAIL;
    }

    // See if object is script safe
    BOOL checkForObjectSafety = FALSE;
    if (m_pSecurityPolicy && m_bSafeForScriptingObjectsOnly)
    {
        BOOL bClassExists = FALSE;
        BOOL bIsSafe = m_pSecurityPolicy->IsClassMarkedSafeForScripting(clsid, bClassExists);
        if (!bClassExists && szCodebase)
        {
            // Class doesn't exist, so allow code below to fetch it
        }
        else if (!bIsSafe)
        {
            // The class is not flagged as safe for scripting, so
            // we'll have to create it to ask it if its safe.
            checkForObjectSafety = TRUE;
        }
    }

    // Create the object
    CComPtr<IUnknown> spObject;
    HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL, IID_IUnknown, (void **) &spObject);
    if (SUCCEEDED(hr) && checkForObjectSafety)
    {
        // Assume scripting via IDispatch
        if (!m_pSecurityPolicy->IsObjectSafeForScripting(spObject, __uuidof(IDispatch)))
        {
            return E_FAIL;
        }
        // Drop through, success!
    }

    // Do we need to download the control?
    if (FAILED(hr) && szCodebase)
    {
        wchar_t *szURL = NULL;

        // Test if the code base ends in #version=a,b,c,d
        DWORD dwFileVersionMS = 0xffffffff;
        DWORD dwFileVersionLS = 0xffffffff;
        const wchar_t *szHash = wcsrchr(szCodebase, wchar_t('#'));
        if (szHash)
        {
            if (wcsnicmp(szHash, L"#version=", 9) == 0)
            {
                int a, b, c, d;
                if (swscanf(szHash + 9, L"%d,%d,%d,%d", &a, &b, &c, &d) == 4)
                {
                    dwFileVersionMS = MAKELONG(b,a);
                    dwFileVersionLS = MAKELONG(d,c);
                }
            }
            szURL = _wcsdup(szCodebase);
            // Terminate at the hash mark
            if (szURL)
                szURL[szHash - szCodebase] = wchar_t('\0');
        }
        else
        {
            szURL = _wcsdup(szCodebase);
        }
        if (!szURL)
            return E_OUTOFMEMORY;

        CComPtr<IBindCtx> spBindContext; 
        CComPtr<IBindStatusCallback> spBindStatusCallback;
        CComPtr<IBindStatusCallback> spOldBSC;

        // Create our own bind context or use the one provided?
        BOOL useInternalBSC = FALSE;
        if (!pBindContext)
        {
            useInternalBSC = TRUE;
            hr = CreateBindCtx(0, &spBindContext);
            if (FAILED(hr))
            {
                free(szURL);
                return hr;
            }
            spBindStatusCallback = dynamic_cast<IBindStatusCallback *>(this);
            hr = RegisterBindStatusCallback(spBindContext, spBindStatusCallback, &spOldBSC, 0);
            if (FAILED(hr))
            {
                free(szURL);
                return hr;
            }
        }
        else
        {
            spBindContext = pBindContext;
        }

        hr = CoGetClassObjectFromURL(clsid, szURL, dwFileVersionMS, dwFileVersionLS,
            NULL, spBindContext, CLSCTX_ALL, NULL, IID_IUnknown, (void **) &m_spObject);
        
        free(szURL);
        
        // Handle the internal binding synchronously so the object exists
        // or an error code is available when the method returns.
        if (useInternalBSC)
        {
            if (MK_S_ASYNCHRONOUS == hr)
            {
                m_bBindingInProgress = TRUE;
                m_hrBindResult = E_FAIL;

                // Spin around waiting for binding to complete
                HANDLE hFakeEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL);
                while (m_bBindingInProgress)
                {
                    MSG msg;
                    // Process pending messages
                    while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
                    {
                        if (!::GetMessage(&msg, NULL, 0, 0))
                        {
                            m_bBindingInProgress = FALSE;
                            break;
                        }
                        ::TranslateMessage(&msg);
                        ::DispatchMessage(&msg);
                    }
                    if (!m_bBindingInProgress)
                        break;
                    // Sleep for a bit or the next msg to appear
                    ::MsgWaitForMultipleObjects(1, &hFakeEvent, FALSE, 500, QS_ALLEVENTS);
                }
                ::CloseHandle(hFakeEvent);

                // Set the result
                hr = m_hrBindResult;
            }

            // Destroy the bind status callback & context
            if (spBindStatusCallback)
            {
                RevokeBindStatusCallback(spBindContext, spBindStatusCallback);
                spBindContext.Release();
            }
        }
    }

    if (spObject)
        m_spObject = spObject;

    return hr;
}

Here is the call graph for this function:

HRESULT STDMETHODCALLTYPE CControlSite::DeactivateAndUndo ( void  ) [virtual]

Definition at line 947 of file ControlSite.cpp.

{
    return S_OK;
}

Definition at line 500 of file ControlSite.cpp.

{
    TRACE_METHOD(CControlSite::Detach);

    if (m_spIOleInPlaceObjectWindowless)
    {
        m_spIOleInPlaceObjectWindowless.Release();
    }

    if (m_spIOleInPlaceObject)
    {
        m_spIOleInPlaceObject->InPlaceDeactivate();
        m_spIOleInPlaceObject.Release();
    }

    if (m_spIOleObject)
    {
        m_spIOleObject->Close(OLECLOSE_NOSAVE);
        m_spIOleObject->SetClientSite(NULL);
        m_spIOleObject.Release();
    }

    m_spIViewObject.Release();
    m_spObject.Release();
    
    return S_OK;
}

Here is the caller graph for this function:

HRESULT STDMETHODCALLTYPE CControlSite::DiscardUndoState ( void  ) [virtual]

Definition at line 941 of file ControlSite.cpp.

{
    return S_OK;
}
HRESULT CControlSite::DoVerb ( LONG  nVerb,
LPMSG  lpMsg = NULL 
) [virtual]

Definition at line 597 of file ControlSite.cpp.

{
    TRACE_METHOD(CControlSite::DoVerb);

    if (m_spIOleObject == NULL)
    {
        return E_FAIL;
    }

    return m_spIOleObject->DoVerb(nVerb, lpMsg, this, 0, m_hWndParent, &m_rcObjectPos);
}

Here is the caller graph for this function:

HRESULT CControlSite::Draw ( HDC  hdc) [virtual]

Definition at line 571 of file ControlSite.cpp.

{
    TRACE_METHOD(CControlSite::Draw);

    // Draw only when control is windowless or deactivated
    if (m_spIViewObject)
    {
        if (m_bWindowless || !m_bInPlaceActive)
        {
            RECTL *prcBounds = (m_bWindowless) ? NULL : (RECTL *) &m_rcObjectPos;
            m_spIViewObject->Draw(DVASPECT_CONTENT, -1, NULL, NULL, NULL, hdc, prcBounds, NULL, NULL, 0);
        }
    }
    else
    {
        // Draw something to indicate no control is there
        HBRUSH hbr = CreateSolidBrush(RGB(200,200,200));
        FillRect(hdc, &m_rcObjectPos, hbr);
        DeleteObject(hbr);
    }

    return S_OK;
}
virtual HRESULT STDMETHODCALLTYPE IOleCommandTargetImpl< CControlSite >::Exec ( const GUID __RPC_FAR *  pguidCmdGroup,
DWORD  nCmdID,
DWORD  nCmdexecopt,
VARIANT __RPC_FAR *  pvaIn,
VARIANT __RPC_FAR *  pvaOut 
) [inline, virtual, inherited]

Definition at line 203 of file IOleCommandTargetImpl.h.

    {
        T* pT = static_cast<T*>(this);
        BOOL bCmdGroupFound = FALSE;

        OleCommandInfo *pCommands = pT->GetCommandTable();
        ATLASSERT(pCommands);

        // Search the support command list
        for (int nSupported = 0; pCommands[nSupported].pCmdGUID != &GUID_NULL; nSupported++)
        {
            OleCommandInfo *pCI = &pCommands[nSupported];

            if (pguidCmdGroup && pCI->pCmdGUID && memcmp(pguidCmdGroup, pCI->pCmdGUID, sizeof(GUID)) == 0)
            {
                continue;
            }
            bCmdGroupFound = TRUE;

            if (pCI->nCmdID != nCmdID)
            {
                continue;
            }

            // Send ourselves a WM_COMMAND windows message with the associated
            // identifier and exec data
            OleExecData cData;
            cData.pguidCmdGroup = pguidCmdGroup;
            cData.nCmdID = nCmdID;
            cData.nCmdexecopt = nCmdexecopt;
            cData.pvaIn = pvaIn;
            cData.pvaOut = pvaOut;

            if (pCI->pfnCommandProc)
            {
                pCI->pfnCommandProc(pT, pCI->pCmdGUID, pCI->nCmdID, nCmdexecopt, pvaIn, pvaOut);
            }
            else if (pCI->nWindowsCmdID != 0 && nCmdexecopt != OLECMDEXECOPT_SHOWHELP)
            {
                HWND hwndTarget = pT->GetCommandTargetWindow();
                if (hwndTarget)
                {
                    ::SendMessage(hwndTarget, WM_COMMAND, LOWORD(pCI->nWindowsCmdID), (LPARAM) &cData);
                }
            }
            else
            {
                // Command supported but not implemented
                continue;
            }

            return S_OK;
        }

        // Was the command group found?
        if (!bCmdGroupFound)
        {
            OLECMDERR_E_UNKNOWNGROUP;
        }

        return OLECMDERR_E_NOTSUPPORTED;
    }
void CControlSite::FireAmbientPropertyChange ( DISPID  id) [protected, virtual]

Definition at line 623 of file ControlSite.cpp.

{
    if (m_spObject)
    {
        CComQIPtr<IOleControl> spControl = m_spObject;
        if (spControl)
        {
            spControl->OnAmbientPropertyChange(id);
        }
    }
}

Here is the caller graph for this function:

HRESULT STDMETHODCALLTYPE CControlSite::GetBindInfo ( DWORD __RPC_FAR *  grfBINDF,
BINDINFO __RPC_FAR *  pbindinfo 
) [virtual]

Reimplemented in ATL_NO_VTABLE.

Definition at line 1383 of file ControlSite.cpp.

{
    *pgrfBINDF = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE |
                 BINDF_GETNEWESTVERSION | BINDF_NOWRITECACHE;
    pbindInfo->cbSize = sizeof(BINDINFO);
    pbindInfo->szExtraInfo = NULL;
    memset(&pbindInfo->stgmedData, 0, sizeof(STGMEDIUM));
    pbindInfo->grfBindInfoF = 0;
    pbindInfo->dwBindVerb = 0;
    pbindInfo->szCustomVerb = NULL;
    return S_OK;
}

Here is the call graph for this function:

HRESULT STDMETHODCALLTYPE CControlSite::GetCapture ( void  ) [virtual]

Definition at line 1012 of file ControlSite.cpp.

{
    // TODO capture the mouse for the object
    return S_FALSE;
}

Definition at line 221 of file ControlSite.h.

    {
        return NULL; // TODO
    }
HRESULT STDMETHODCALLTYPE CControlSite::GetContainer ( IOleContainer __RPC_FAR *__RPC_FAR *  ppContainer) [virtual]

Definition at line 846 of file ControlSite.cpp.

{
    if (!ppContainer) return E_INVALIDARG;
    *ppContainer = m_spContainer;
    if (*ppContainer)
    {
        (*ppContainer)->AddRef();
    }
    return (*ppContainer) ? S_OK : E_NOINTERFACE;
}
HRESULT CControlSite::GetControlUnknown ( IUnknown **  ppObject) [virtual]

Definition at line 530 of file ControlSite.cpp.

{
    *ppObject = NULL;
    if (m_spObject)
    {
        m_spObject->QueryInterface(IID_IUnknown, (void **) ppObject);
    }
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::GetDC ( LPCRECT  pRect,
DWORD  grfFlags,
HDC __RPC_FAR *  phDC 
) [virtual]

Definition at line 1038 of file ControlSite.cpp.

{
    if (phDC == NULL)
    {
        return E_INVALIDARG;
    }

    // Can't do nested painting
    if (m_hDCBuffer != NULL)
    {
        return E_UNEXPECTED;
    }

    m_rcBuffer = m_rcObjectPos;
    if (pRect != NULL)
    {
        m_rcBuffer = *pRect;
    }

    m_hBMBuffer = NULL;
    m_dwBufferFlags = grfFlags;

    // See if the control wants a DC that is onscreen or offscreen
    if (m_dwBufferFlags & OLEDC_OFFSCREEN)
    {
        m_hDCBuffer = CreateCompatibleDC(NULL);
        if (m_hDCBuffer == NULL)
        {
            // Error
            return E_OUTOFMEMORY;
        }

        long cx = m_rcBuffer.right - m_rcBuffer.left;
        long cy = m_rcBuffer.bottom - m_rcBuffer.top;

        m_hBMBuffer = CreateCompatibleBitmap(m_hDCBuffer, cx, cy);
        m_hBMBufferOld = (HBITMAP) SelectObject(m_hDCBuffer, m_hBMBuffer);
        SetViewportOrgEx(m_hDCBuffer, m_rcBuffer.left, m_rcBuffer.top, NULL);

        // TODO When OLEDC_PAINTBKGND we must draw every site behind this one
    }
    else
    {
        // TODO When OLEDC_PAINTBKGND we must draw every site behind this one

        // Get the window DC
        m_hDCBuffer = GetWindowDC(m_hWndParent);
        if (m_hDCBuffer == NULL)
        {
            // Error
            return E_OUTOFMEMORY;
        }

        // Clip the control so it can't trash anywhere it isn't allowed to draw
        if (!(m_dwBufferFlags & OLEDC_NODRAW))
        {
            m_hRgnBuffer = CreateRectRgnIndirect(&m_rcBuffer);

            // TODO Clip out opaque areas of sites behind this one

            SelectClipRgn(m_hDCBuffer, m_hRgnBuffer);
        }
    }

    *phDC = m_hDCBuffer;

    return S_OK;
}

Here is the caller graph for this function:

Definition at line 649 of file ControlSite.cpp.

{
    static CDefaultControlSiteSecurityPolicy defaultControlSecurityPolicy;
    return &defaultControlSecurityPolicy;
}

Here is the caller graph for this function:

HRESULT STDMETHODCALLTYPE CControlSite::GetExtendedControl ( IDispatch __RPC_FAR *__RPC_FAR *  ppDisp) [virtual]

Definition at line 1256 of file ControlSite.cpp.

{
    return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CControlSite::GetFocus ( void  ) [virtual]

Definition at line 1026 of file ControlSite.cpp.

{
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::GetIDsOfNames ( REFIID  riid,
LPOLESTR __RPC_FAR *  rgszNames,
UINT  cNames,
LCID  lcid,
DISPID __RPC_FAR *  rgDispId 
) [virtual]

Reimplemented in ATL_NO_VTABLE.

Definition at line 711 of file ControlSite.cpp.

{
    return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CControlSite::GetMoniker ( DWORD  dwAssign,
DWORD  dwWhichMoniker,
IMoniker __RPC_FAR *__RPC_FAR *  ppmk 
) [virtual]

Definition at line 840 of file ControlSite.cpp.

{
    return E_NOTIMPL;
}
virtual const CLSID& CControlSite::GetObjectCLSID ( ) const [inline, virtual]

Definition at line 271 of file ControlSite.h.

    {
        return m_CLSID;
    }
virtual HWND CControlSite::GetParentWindow ( ) const [inline, virtual]

Definition at line 281 of file ControlSite.h.

    {
        return m_hWndParent;
    }
HRESULT STDMETHODCALLTYPE CControlSite::GetPriority ( LONG __RPC_FAR *  pnPriority) [virtual]

Reimplemented in ATL_NO_VTABLE.

Definition at line 1358 of file ControlSite.cpp.

{
    return S_OK;
}
virtual CControlSiteSecurityPolicy* CControlSite::GetSecurityPolicy ( ) const [inline, virtual]

Definition at line 261 of file ControlSite.h.

    {
        return m_pSecurityPolicy;
    }
HRESULT STDMETHODCALLTYPE CControlSite::GetTypeInfo ( UINT  iTInfo,
LCID  lcid,
ITypeInfo __RPC_FAR *__RPC_FAR *  ppTInfo 
) [virtual]

Reimplemented in ATL_NO_VTABLE.

Definition at line 705 of file ControlSite.cpp.

{
    return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CControlSite::GetTypeInfoCount ( UINT __RPC_FAR *  pctinfo) [virtual]

Reimplemented in ATL_NO_VTABLE.

Definition at line 699 of file ControlSite.cpp.

{
    return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CControlSite::GetWindow ( HWND __RPC_FAR *  phwnd) [virtual]

Definition at line 817 of file ControlSite.cpp.

{
    *phwnd = m_hWndParent;
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::GetWindow ( REFGUID  rguidReason,
HWND phwnd 
) [virtual]

Definition at line 1412 of file ControlSite.cpp.

{
    *phwnd = NULL;
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::GetWindowContext ( IOleInPlaceFrame __RPC_FAR *__RPC_FAR *  ppFrame,
IOleInPlaceUIWindow __RPC_FAR *__RPC_FAR *  ppDoc,
LPRECT  lprcPosRect,
LPRECT  lprcClipRect,
LPOLEINPLACEFRAMEINFO  lpFrameInfo 
) [virtual]

Definition at line 900 of file ControlSite.cpp.

{
    *lprcPosRect = m_rcObjectPos;
    *lprcClipRect = m_rcObjectPos;

    CControlSiteIPFrameInstance *pIPFrame = NULL;
    CControlSiteIPFrameInstance::CreateInstance(&pIPFrame);
    pIPFrame->AddRef();

    *ppFrame = (IOleInPlaceFrame *) pIPFrame;
    *ppDoc = NULL;

    lpFrameInfo->fMDIApp = FALSE;
    lpFrameInfo->hwndFrame = NULL;
    lpFrameInfo->haccel = NULL;
    lpFrameInfo->cAccelEntries = 0;

    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::InvalidateRect ( LPCRECT  pRect,
BOOL  fErase 
) [virtual]

Definition at line 1166 of file ControlSite.cpp.

{
    // Clip the rectangle against the object's size and invalidate it
    RECT rcI = { 0, 0, 0, 0 };
    if (pRect == NULL)
    {
        rcI = m_rcObjectPos;
    }
    else
    {
        IntersectRect(&rcI, &m_rcObjectPos, pRect);
    }
    ::InvalidateRect(m_hWndParent, &rcI, fErase);

    return S_OK;
}

Here is the caller graph for this function:

HRESULT STDMETHODCALLTYPE CControlSite::InvalidateRgn ( HRGN  hRGN,
BOOL  fErase 
) [virtual]

Definition at line 1183 of file ControlSite.cpp.

{
    if (hRGN == NULL)
    {
        ::InvalidateRect(m_hWndParent, &m_rcObjectPos, fErase);
    }
    else
    {
        // Clip the region with the object's bounding area
        HRGN hrgnClip = CreateRectRgnIndirect(&m_rcObjectPos);
        if (CombineRgn(hrgnClip, hrgnClip, hRGN, RGN_AND) != ERROR)
        {
            ::InvalidateRgn(m_hWndParent, hrgnClip, fErase);
        }
        DeleteObject(hrgnClip);
    }

    return S_OK;
}

Here is the call graph for this function:

HRESULT STDMETHODCALLTYPE CControlSite::Invoke ( DISPID  dispIdMember,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS __RPC_FAR *  pDispParams,
VARIANT __RPC_FAR *  pVarResult,
EXCEPINFO __RPC_FAR *  pExcepInfo,
UINT __RPC_FAR *  puArgErr 
) [virtual]

Reimplemented in ATL_NO_VTABLE.

Definition at line 717 of file ControlSite.cpp.

{
    if (wFlags & DISPATCH_PROPERTYGET)
    {
        CComVariant vResult;

        switch (dispIdMember)
        {
        case DISPID_AMBIENT_APPEARANCE:
            vResult = CComVariant(m_bAmbientAppearance);
            break;

        case DISPID_AMBIENT_FORECOLOR:
            vResult = CComVariant((long) m_clrAmbientForeColor);
            break;

        case DISPID_AMBIENT_BACKCOLOR:
            vResult = CComVariant((long) m_clrAmbientBackColor);
            break;

        case DISPID_AMBIENT_LOCALEID:
            vResult = CComVariant((long) m_nAmbientLocale);
            break;

        case DISPID_AMBIENT_USERMODE:
            vResult = CComVariant(m_bAmbientUserMode);
            break;
        
        case DISPID_AMBIENT_SHOWGRABHANDLES:
            vResult = CComVariant(m_bAmbientShowGrabHandles);
            break;
        
        case DISPID_AMBIENT_SHOWHATCHING:
            vResult = CComVariant(m_bAmbientShowHatching);
            break;

        default:
            return DISP_E_MEMBERNOTFOUND;
        }

        VariantCopy(pVarResult, &vResult);
        return S_OK;
    }

    return E_FAIL;
}
BOOL CControlSite::IsClassMarkedSafeForScripting ( const CLSID &  clsid,
BOOL bClassExists 
) [virtual]

Implements CControlSiteSecurityPolicy.

Definition at line 664 of file ControlSite.cpp.

{
    if (m_pSecurityPolicy)
        return m_pSecurityPolicy->IsClassMarkedSafeForScripting(clsid, bClassExists);
    return TRUE;
}

Here is the call graph for this function:

BOOL CControlSite::IsClassSafeToHost ( const CLSID &  clsid) [virtual]

Implements CControlSiteSecurityPolicy.

Definition at line 656 of file ControlSite.cpp.

{
    if (m_pSecurityPolicy)
        return m_pSecurityPolicy->IsClassSafeToHost(clsid);
    return TRUE;
}

Here is the call graph for this function:

virtual BOOL CControlSite::IsInPlaceActive ( ) const [inline, virtual]

Definition at line 286 of file ControlSite.h.

    {
        return m_bInPlaceActive;
    }
BOOL CControlSite::IsObjectSafeForScripting ( IUnknown pObject,
const IID &  iid 
) [virtual]

Implements CControlSiteSecurityPolicy.

Definition at line 672 of file ControlSite.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 679 of file ControlSite.cpp.

Here is the call graph for this function:

virtual BOOL CControlSite::IsObjectValid ( ) const [inline, virtual]

Definition at line 276 of file ControlSite.h.

    {
        return (m_spObject) ? TRUE : FALSE;
    }
HRESULT STDMETHODCALLTYPE CControlSite::LockInPlaceActive ( BOOL  fLock) [virtual]

Definition at line 1249 of file ControlSite.cpp.

{
    m_bInPlaceLocked = fLock;
    return S_OK;
}
void STDMETHODCALLTYPE CControlSite::OnClose ( void  ) [virtual]

Definition at line 791 of file ControlSite.cpp.

{
}
HRESULT STDMETHODCALLTYPE CControlSite::OnControlInfoChanged ( void  ) [virtual]

Definition at line 1243 of file ControlSite.cpp.

{
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::OnDataAvailable ( DWORD  grfBSCF,
DWORD  dwSize,
FORMATETC __RPC_FAR *  pformatetc,
STGMEDIUM __RPC_FAR *  pstgmed 
) [virtual]

Reimplemented in ATL_NO_VTABLE.

Definition at line 1397 of file ControlSite.cpp.

{
    return E_NOTIMPL;
}
void STDMETHODCALLTYPE CControlSite::OnDataChange ( FORMATETC __RPC_FAR *  pFormatetc,
STGMEDIUM __RPC_FAR *  pStgmed 
) [virtual]

Definition at line 769 of file ControlSite.cpp.

{
}
HRESULT STDMETHODCALLTYPE CControlSite::OnDefWindowMessage ( UINT  msg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT __RPC_FAR *  plResult 
) [virtual]

Definition at line 1222 of file ControlSite.cpp.

{
    if (plResult == NULL)
    {
        return E_INVALIDARG;
    }
    
    // Pass the message to the windowless control
    if (m_bWindowless && m_spIOleInPlaceObjectWindowless)
    {
        return m_spIOleInPlaceObjectWindowless->OnWindowMessage(msg, wParam, lParam, plResult);
    }

    return S_FALSE;
}
HRESULT STDMETHODCALLTYPE CControlSite::OnFocus ( BOOL  fGotFocus) [virtual]

Definition at line 1338 of file ControlSite.cpp.

{
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::OnInPlaceActivate ( void  ) [virtual]

Definition at line 886 of file ControlSite.cpp.

{
    m_bInPlaceActive = TRUE;
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::OnInPlaceActivateEx ( BOOL __RPC_FAR *  pfNoRedraw,
DWORD  dwFlags 
) [virtual]

Definition at line 968 of file ControlSite.cpp.

{
    m_bInPlaceActive = TRUE;

    if (pfNoRedraw)
    {
        *pfNoRedraw = FALSE;
    }
    if (dwFlags & ACTIVATE_WINDOWLESS)
    {
        if (!m_bSupportWindowlessActivation)
        {
            return E_INVALIDARG;
        }
        m_bWindowless = TRUE;
    }
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::OnInPlaceDeactivate ( void  ) [virtual]

Definition at line 934 of file ControlSite.cpp.

{
    m_bInPlaceActive = FALSE;
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::OnInPlaceDeactivateEx ( BOOL  fNoRedraw) [virtual]

Definition at line 988 of file ControlSite.cpp.

{
    m_bInPlaceActive = FALSE;
    return S_OK;
}
void STDMETHODCALLTYPE CControlSite::OnLinkSrcChange ( IMoniker __RPC_FAR *  pmk) [virtual]

Definition at line 800 of file ControlSite.cpp.

{
}
HRESULT STDMETHODCALLTYPE CControlSite::OnLowResource ( DWORD  reserved) [virtual]

Reimplemented in ATL_NO_VTABLE.

Definition at line 1363 of file ControlSite.cpp.

{
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::OnObjectAvailable ( REFIID  riid,
IUnknown __RPC_FAR *  punk 
) [virtual]

Reimplemented in ATL_NO_VTABLE.

Definition at line 1405 of file ControlSite.cpp.

{
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::OnPosRectChange ( LPCRECT  lprcPosRect) [virtual]

Definition at line 953 of file ControlSite.cpp.

{
    if (lprcPosRect == NULL)
    {
        return E_INVALIDARG;
    }
    SetPosition(m_rcObjectPos);
    return S_OK;
}

Here is the call graph for this function:

HRESULT STDMETHODCALLTYPE CControlSite::OnProgress ( ULONG  ulProgress,
ULONG  ulProgressMax,
ULONG  ulStatusCode,
LPCWSTR  szStatusText 
) [virtual]

Reimplemented in ATL_NO_VTABLE.

Definition at line 1368 of file ControlSite.cpp.

{
    return S_OK;
}
void STDMETHODCALLTYPE CControlSite::OnRename ( IMoniker __RPC_FAR *  pmk) [virtual]

Definition at line 781 of file ControlSite.cpp.

{
}
void STDMETHODCALLTYPE CControlSite::OnSave ( void  ) [virtual]

Definition at line 786 of file ControlSite.cpp.

{
}
HRESULT STDMETHODCALLTYPE CControlSite::OnShowWindow ( BOOL  fShow) [virtual]

Definition at line 864 of file ControlSite.cpp.

{
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::OnStartBinding ( DWORD  dwReserved,
IBinding __RPC_FAR *  pib 
) [virtual]

Reimplemented in ATL_NO_VTABLE.

Definition at line 1352 of file ControlSite.cpp.

{
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::OnStopBinding ( HRESULT  hresult,
LPCWSTR  szError 
) [virtual]

Reimplemented in ATL_NO_VTABLE.

Definition at line 1376 of file ControlSite.cpp.

{
    m_bBindingInProgress = FALSE;
    m_hrBindResult = hresult;
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::OnUIActivate ( void  ) [virtual]

Definition at line 893 of file ControlSite.cpp.

{
    m_bUIActive = TRUE;
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::OnUIDeactivate ( BOOL  fUndoable) [virtual]

Definition at line 927 of file ControlSite.cpp.

{
    m_bUIActive = FALSE;
    return S_OK;
}
void STDMETHODCALLTYPE CControlSite::OnViewChange ( DWORD  dwAspect,
LONG  lindex 
) [virtual]

Definition at line 774 of file ControlSite.cpp.

{
    // Redraw the control
    InvalidateRect(NULL, FALSE);
}

Here is the call graph for this function:

void STDMETHODCALLTYPE CControlSite::OnViewStatusChange ( DWORD  dwViewStatus) [virtual]

Definition at line 809 of file ControlSite.cpp.

{
}
HRESULT STDMETHODCALLTYPE CControlSite::QueryService ( REFGUID  guidService,
REFIID  riid,
void **  ppv 
) [virtual]

Definition at line 687 of file ControlSite.cpp.

{
    if (m_spServiceProvider)
        return m_spServiceProvider->QueryService(guidService, riid, ppv);
    return E_NOINTERFACE;
}
virtual HRESULT STDMETHODCALLTYPE IOleCommandTargetImpl< CControlSite >::QueryStatus ( const GUID __RPC_FAR *  pguidCmdGroup,
ULONG  cCmds,
OLECMD __RPC_FAR  prgCmds[],
OLECMDTEXT __RPC_FAR *  pCmdText 
) [inline, virtual, inherited]

Definition at line 112 of file IOleCommandTargetImpl.h.

    {
        T* pT = static_cast<T*>(this);
        
        if (prgCmds == NULL)
        {
            return E_INVALIDARG;
        }

        OleCommandInfo *pCommands = pT->GetCommandTable();
        ATLASSERT(pCommands);

        BOOL bCmdGroupFound = FALSE;
        BOOL bTextSet = FALSE;

        // Iterate through list of commands and flag them as supported/unsupported
        for (ULONG nCmd = 0; nCmd < cCmds; nCmd++)
        {
            // Unsupported by default
            prgCmds[nCmd].cmdf = 0;

            // Search the support command list
            for (int nSupported = 0; pCommands[nSupported].pCmdGUID != &GUID_NULL; nSupported++)
            {
                OleCommandInfo *pCI = &pCommands[nSupported];

                if (pguidCmdGroup && pCI->pCmdGUID && memcmp(pguidCmdGroup, pCI->pCmdGUID, sizeof(GUID)) == 0)
                {
                    continue;
                }
                bCmdGroupFound = TRUE;

                if (pCI->nCmdID != prgCmds[nCmd].cmdID)
                {
                    continue;
                }

                // Command is supported so flag it and possibly enable it
                prgCmds[nCmd].cmdf = OLECMDF_SUPPORTED;
                if (pCI->nWindowsCmdID != 0)
                {
                    prgCmds[nCmd].cmdf |= OLECMDF_ENABLED;
                }

                // Copy the status/verb text for the first supported command only
                if (!bTextSet && pCmdText)
                {
                    // See what text the caller wants
                    wchar_t *pszTextToCopy = NULL;
                    if (pCmdText->cmdtextf & OLECMDTEXTF_NAME)
                    {
                        pszTextToCopy = pCI->szVerbText;
                    }
                    else if (pCmdText->cmdtextf & OLECMDTEXTF_STATUS)
                    {
                        pszTextToCopy = pCI->szStatusText;
                    }
                    
                    // Copy the text
                    pCmdText->cwActual = 0;
                    memset(pCmdText->rgwz, 0, pCmdText->cwBuf * sizeof(wchar_t));
                    if (pszTextToCopy)
                    {
                        // Don't exceed the provided buffer size
                        size_t nTextLen = wcslen(pszTextToCopy);
                        if (nTextLen > pCmdText->cwBuf)
                        {
                            nTextLen = pCmdText->cwBuf;
                        }

                        wcsncpy(pCmdText->rgwz, pszTextToCopy, nTextLen);
                        pCmdText->cwActual = nTextLen;
                    }
                    
                    bTextSet = TRUE;
                }
                break;
            }
        }
        
        // Was the command group found?
        if (!bCmdGroupFound)
        {
            OLECMDERR_E_UNKNOWNGROUP;
        }

        return S_OK;
    }
HRESULT STDMETHODCALLTYPE CControlSite::ReleaseDC ( HDC  hDC) [virtual]

Definition at line 1108 of file ControlSite.cpp.

{
    // Release the DC
    if (hDC == NULL || hDC != m_hDCBuffer)
    {
        return E_INVALIDARG;
    }

    // Test if the DC was offscreen or onscreen
    if ((m_dwBufferFlags & OLEDC_OFFSCREEN) &&
        !(m_dwBufferFlags & OLEDC_NODRAW))
    {
        // BitBlt the buffer into the control's object
        SetViewportOrgEx(m_hDCBuffer, 0, 0, NULL);
        HDC hdc = GetWindowDC(m_hWndParent);

        long cx = m_rcBuffer.right - m_rcBuffer.left;
        long cy = m_rcBuffer.bottom - m_rcBuffer.top;

        BitBlt(hdc, m_rcBuffer.left, m_rcBuffer.top, cx, cy, m_hDCBuffer, 0, 0, SRCCOPY);
        
        ::ReleaseDC(m_hWndParent, hdc);
    }
    else
    {
        // TODO If OLEDC_PAINTBKGND is set draw the DVASPECT_CONTENT of every object above this one
    }

    // Clean up settings ready for next drawing
    if (m_hRgnBuffer)
    {
        SelectClipRgn(m_hDCBuffer, NULL);
        DeleteObject(m_hRgnBuffer);
        m_hRgnBuffer = NULL;
    }
    
    SelectObject(m_hDCBuffer, m_hBMBufferOld);
    if (m_hBMBuffer)
    {
        DeleteObject(m_hBMBuffer);
        m_hBMBuffer = NULL;
    }

    // Delete the DC
    if (m_dwBufferFlags & OLEDC_OFFSCREEN)
    {
        ::DeleteDC(m_hDCBuffer);
    }
    else
    {
        ::ReleaseDC(m_hWndParent, m_hDCBuffer);
    }
    m_hDCBuffer = NULL;

    return S_OK;
}

Here is the caller graph for this function:

HRESULT STDMETHODCALLTYPE CControlSite::RequestNewObjectLayout ( void  ) [virtual]

Definition at line 870 of file ControlSite.cpp.

{
    return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CControlSite::RequestUIActivate ( void  ) [virtual]

Definition at line 995 of file ControlSite.cpp.

{
    return S_FALSE;
}
HRESULT STDMETHODCALLTYPE CControlSite::SaveObject ( void  ) [virtual]

Definition at line 834 of file ControlSite.cpp.

{
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::Scroll ( SIZE  scrollExtant) [virtual]

Definition at line 921 of file ControlSite.cpp.

{
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::ScrollRect ( INT  dx,
INT  dy,
LPCRECT  pRectScroll,
LPCRECT  pRectClip 
) [virtual]

Definition at line 1203 of file ControlSite.cpp.

{
    return S_OK;
}

Definition at line 636 of file ControlSite.cpp.

{
    bool bNewMode = bUserMode ? true : false;
    if (m_bAmbientUserMode != bNewMode)
    {
        m_bAmbientUserMode = bNewMode;
        FireAmbientPropertyChange(DISPID_AMBIENT_USERMODE);
    }
}

Here is the call graph for this function:

HRESULT STDMETHODCALLTYPE CControlSite::SetCapture ( BOOL  fCapture) [virtual]

Definition at line 1019 of file ControlSite.cpp.

{
    // TODO capture the mouse for the object
    return S_FALSE;
}
virtual void CControlSite::SetContainer ( IOleContainer *  pContainer) [inline, virtual]

Definition at line 251 of file ControlSite.h.

    {
        m_spContainer = pContainer;
    }
HRESULT STDMETHODCALLTYPE CControlSite::SetFocus ( BOOL  fFocus) [virtual]

Definition at line 1032 of file ControlSite.cpp.

{
    return S_OK;
}
HRESULT CControlSite::SetPosition ( const RECT &  rcPos) [virtual]

Definition at line 611 of file ControlSite.cpp.

Here is the caller graph for this function:

virtual void CControlSite::SetSecurityPolicy ( CControlSiteSecurityPolicy pSecurityPolicy) [inline, virtual]

Definition at line 257 of file ControlSite.h.

    {
        m_pSecurityPolicy = pSecurityPolicy;
    }
virtual void CControlSite::SetServiceProvider ( IServiceProvider *  pSP) [inline, virtual]

Definition at line 247 of file ControlSite.h.

    {
        m_spServiceProvider = pSP;
    }
HRESULT STDMETHODCALLTYPE CControlSite::ShowObject ( void  ) [virtual]

Definition at line 858 of file ControlSite.cpp.

{
    return S_OK;
}
HRESULT STDMETHODCALLTYPE CControlSite::ShowPropertyFrame ( void  ) [virtual]

Definition at line 1344 of file ControlSite.cpp.

{
    return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CControlSite::TransformCoords ( POINTL __RPC_FAR *  pPtlHimetric,
POINTF __RPC_FAR *  pPtfContainer,
DWORD  dwFlags 
) [virtual]

Definition at line 1262 of file ControlSite.cpp.

{
    HRESULT hr = S_OK;

    if (pPtlHimetric == NULL)
    {
        return E_INVALIDARG;
    }
    if (pPtfContainer == NULL)
    {
        return E_INVALIDARG;
    }

    HDC hdc = ::GetDC(m_hWndParent);
    ::SetMapMode(hdc, MM_HIMETRIC);
    POINT rgptConvert[2];
    rgptConvert[0].x = 0;
    rgptConvert[0].y = 0;

    if (dwFlags & XFORMCOORDS_HIMETRICTOCONTAINER)
    {
        rgptConvert[1].x = pPtlHimetric->x;
        rgptConvert[1].y = pPtlHimetric->y;
        ::LPtoDP(hdc, rgptConvert, 2);
        if (dwFlags & XFORMCOORDS_SIZE)
        {
            pPtfContainer->x = (float)(rgptConvert[1].x - rgptConvert[0].x);
            pPtfContainer->y = (float)(rgptConvert[0].y - rgptConvert[1].y);
        }
        else if (dwFlags & XFORMCOORDS_POSITION)
        {
            pPtfContainer->x = (float)rgptConvert[1].x;
            pPtfContainer->y = (float)rgptConvert[1].y;
        }
        else
        {
            hr = E_INVALIDARG;
        }
    }
    else if (dwFlags & XFORMCOORDS_CONTAINERTOHIMETRIC)
    {
        rgptConvert[1].x = (int)(pPtfContainer->x);
        rgptConvert[1].y = (int)(pPtfContainer->y);
        ::DPtoLP(hdc, rgptConvert, 2);
        if (dwFlags & XFORMCOORDS_SIZE)
        {
            pPtlHimetric->x = rgptConvert[1].x - rgptConvert[0].x;
            pPtlHimetric->y = rgptConvert[0].y - rgptConvert[1].y;
        }
        else if (dwFlags & XFORMCOORDS_POSITION)
        {
            pPtlHimetric->x = rgptConvert[1].x;
            pPtlHimetric->y = rgptConvert[1].y;
        }
        else
        {
            hr = E_INVALIDARG;
        }
    }
    else
    {
        hr = E_INVALIDARG;
    }

    ::ReleaseDC(m_hWndParent, hdc);

    return hr;
}

Here is the call graph for this function:

HRESULT STDMETHODCALLTYPE CControlSite::TranslateAccelerator ( MSG __RPC_FAR *  pMsg,
DWORD  grfModifiers 
) [virtual]

Definition at line 1332 of file ControlSite.cpp.

{
    return E_NOTIMPL;
}
HRESULT CControlSite::Unadvise ( const IID &  iid,
DWORD  dwCookie 
) [virtual]

Definition at line 559 of file ControlSite.cpp.

{
    if (m_spObject == NULL)
    {
        return E_UNEXPECTED;
    }

    return AtlUnadvise(m_spObject, iid, dwCookie);
}

Member Data Documentation

Definition at line 200 of file ControlSite.h.

Definition at line 196 of file ControlSite.h.

Definition at line 194 of file ControlSite.h.

Definition at line 198 of file ControlSite.h.

unsigned CControlSite::m_bBindingInProgress [protected]

Definition at line 168 of file ControlSite.h.

Definition at line 129 of file ControlSite.h.

Definition at line 133 of file ControlSite.h.

Definition at line 139 of file ControlSite.h.

Definition at line 125 of file ControlSite.h.

Definition at line 135 of file ControlSite.h.

Definition at line 131 of file ControlSite.h.

Definition at line 127 of file ControlSite.h.

Definition at line 137 of file ControlSite.h.

Definition at line 192 of file ControlSite.h.

Definition at line 190 of file ControlSite.h.

CLSID CControlSite::m_CLSID [protected]

Definition at line 160 of file ControlSite.h.

Definition at line 184 of file ControlSite.h.

HBITMAP CControlSite::m_hBMBuffer [protected]

Definition at line 176 of file ControlSite.h.

HBITMAP CControlSite::m_hBMBufferOld [protected]

Definition at line 178 of file ControlSite.h.

HDC CControlSite::m_hDCBuffer [protected]

Definition at line 180 of file ControlSite.h.

Definition at line 170 of file ControlSite.h.

HRGN CControlSite::m_hRgnBuffer [protected]

Definition at line 182 of file ControlSite.h.

Definition at line 121 of file ControlSite.h.

Definition at line 188 of file ControlSite.h.

Definition at line 162 of file ControlSite.h.

Definition at line 164 of file ControlSite.h.

RECT CControlSite::m_rcBuffer [protected]

Definition at line 174 of file ControlSite.h.

Definition at line 123 of file ControlSite.h.

CComPtr<IOleContainer> CControlSite::m_spContainer

Definition at line 143 of file ControlSite.h.

CComQIPtr<IOleInPlaceObject, &IID_IOleInPlaceObject> CControlSite::m_spIOleInPlaceObject [protected]

Definition at line 156 of file ControlSite.h.

CComQIPtr<IOleInPlaceObjectWindowless, &IID_IOleInPlaceObjectWindowless> CControlSite::m_spIOleInPlaceObjectWindowless [protected]

Definition at line 158 of file ControlSite.h.

CComQIPtr<IOleObject, &IID_IOleObject> CControlSite::m_spIOleObject [protected]

Definition at line 154 of file ControlSite.h.

CComQIPtr<IViewObject, &IID_IViewObject> CControlSite::m_spIViewObject [protected]

Definition at line 152 of file ControlSite.h.

CComPtr<IUnknown> CControlSite::m_spObject [protected]

Definition at line 150 of file ControlSite.h.

CComPtr<IServiceProvider> CControlSite::m_spServiceProvider

Definition at line 141 of file ControlSite.h.


The documentation for this class was generated from the following files: