00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "plugin.h"
00024 #include "oleinplaceobject.h"
00025
00026 #include <docobj.h>
00027
00028 using namespace std;
00029
00030 STDMETHODIMP VLCOleInPlaceObject::GetWindow(HWND *pHwnd)
00031 {
00032 if( NULL == pHwnd )
00033 return E_POINTER;
00034
00035 *pHwnd = NULL;
00036 if( _p_instance->isInPlaceActive() )
00037 {
00038 if( NULL != (*pHwnd = _p_instance->getInPlaceWindow()) )
00039 return S_OK;
00040 }
00041 return E_FAIL;
00042 };
00043
00044 STDMETHODIMP VLCOleInPlaceObject::ContextSensitiveHelp(BOOL fEnterMode)
00045 {
00046 return E_NOTIMPL;
00047 };
00048
00049 STDMETHODIMP VLCOleInPlaceObject::InPlaceDeactivate(void)
00050 {
00051 if( _p_instance->isInPlaceActive() )
00052 {
00053 UIDeactivate();
00054
00055 _p_instance->onInPlaceDeactivate();
00056
00057 LPOLEOBJECT p_oleObject;
00058 if( SUCCEEDED(QueryInterface(IID_IOleObject, (void**)&p_oleObject)) )
00059 {
00060 LPOLECLIENTSITE p_clientSite;
00061 if( SUCCEEDED(p_oleObject->GetClientSite(&p_clientSite)) )
00062 {
00063 LPOLEINPLACESITE p_inPlaceSite;
00064
00065 if( SUCCEEDED(p_clientSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
00066 {
00067 p_inPlaceSite->OnInPlaceDeactivate();
00068 p_inPlaceSite->Release();
00069 }
00070 p_clientSite->Release();
00071 }
00072 p_oleObject->Release();
00073 }
00074 return S_OK;
00075 }
00076 return E_UNEXPECTED;
00077 };
00078
00079 STDMETHODIMP VLCOleInPlaceObject::UIDeactivate(void)
00080 {
00081 if( _p_instance->isInPlaceActive() )
00082 {
00083 if( _p_instance->hasFocus() )
00084 {
00085 _p_instance->setFocus(FALSE);
00086 }
00087
00088 LPOLEOBJECT p_oleObject;
00089 if( SUCCEEDED(QueryInterface(IID_IOleObject, (void**)&p_oleObject)) )
00090 {
00091 LPOLECLIENTSITE p_clientSite;
00092 if( SUCCEEDED(p_oleObject->GetClientSite(&p_clientSite)) )
00093 {
00094 LPOLEINPLACESITE p_inPlaceSite;
00095
00096 if( SUCCEEDED(p_clientSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
00097 {
00098 p_inPlaceSite->OnUIDeactivate(FALSE);
00099 p_inPlaceSite->Release();
00100 }
00101 p_clientSite->Release();
00102 }
00103 p_oleObject->Release();
00104 }
00105 return S_OK;
00106 }
00107 return E_UNEXPECTED;
00108 };
00109
00110 STDMETHODIMP VLCOleInPlaceObject::SetObjectRects(LPCRECT lprcPosRect, LPCRECT lprcClipRect)
00111 {
00112 if( _p_instance->isInPlaceActive() )
00113 {
00114 _p_instance->onPositionChange(lprcPosRect, lprcClipRect);
00115 return S_OK;
00116 }
00117 return E_UNEXPECTED;
00118 };
00119
00120 STDMETHODIMP VLCOleInPlaceObject::ReactivateAndUndo(void)
00121 {
00122 return INPLACE_E_NOTUNDOABLE;
00123 };
00124