1 /*****************************************************************************
2 * oleinplaceobject.cpp: ActiveX control for VLC
3 *****************************************************************************
4 * Copyright (C) 2005 the VideoLAN team
6 * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
21 *****************************************************************************/
24 #include "oleinplaceobject.h"
30 STDMETHODIMP VLCOleInPlaceObject::GetWindow(HWND *pHwnd)
36 if( _p_instance->isInPlaceActive() )
38 if( NULL != (*pHwnd = _p_instance->getInPlaceWindow()) )
44 STDMETHODIMP VLCOleInPlaceObject::ContextSensitiveHelp(BOOL fEnterMode)
49 STDMETHODIMP VLCOleInPlaceObject::InPlaceDeactivate(void)
51 if( _p_instance->isInPlaceActive() )
55 _p_instance->onInPlaceDeactivate();
57 LPOLEOBJECT p_oleObject;
58 if( SUCCEEDED(QueryInterface(IID_IOleObject, (void**)&p_oleObject)) )
60 LPOLECLIENTSITE p_clientSite;
61 if( SUCCEEDED(p_oleObject->GetClientSite(&p_clientSite)) )
63 LPOLEINPLACESITE p_inPlaceSite;
65 if( SUCCEEDED(p_clientSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
67 p_inPlaceSite->OnInPlaceDeactivate();
68 p_inPlaceSite->Release();
70 p_clientSite->Release();
72 p_oleObject->Release();
79 STDMETHODIMP VLCOleInPlaceObject::UIDeactivate(void)
81 if( _p_instance->isInPlaceActive() )
83 if( _p_instance->hasFocus() )
85 _p_instance->setFocus(FALSE);
88 LPOLEOBJECT p_oleObject;
89 if( SUCCEEDED(QueryInterface(IID_IOleObject, (void**)&p_oleObject)) )
91 LPOLECLIENTSITE p_clientSite;
92 if( SUCCEEDED(p_oleObject->GetClientSite(&p_clientSite)) )
94 LPOLEINPLACESITE p_inPlaceSite;
96 if( SUCCEEDED(p_clientSite->QueryInterface(IID_IOleInPlaceSite, (void**)&p_inPlaceSite)) )
98 p_inPlaceSite->OnUIDeactivate(FALSE);
99 p_inPlaceSite->Release();
101 p_clientSite->Release();
103 p_oleObject->Release();
110 STDMETHODIMP VLCOleInPlaceObject::SetObjectRects(LPCRECT lprcPosRect, LPCRECT lprcClipRect)
112 if( _p_instance->isInPlaceActive() )
114 _p_instance->onPositionChange(lprcPosRect, lprcClipRect);
120 STDMETHODIMP VLCOleInPlaceObject::ReactivateAndUndo(void)
122 return INPLACE_E_NOTUNDOABLE;