Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

oleinplaceobject.cpp

00001 /*****************************************************************************
00002  * oleinplaceobject.cpp: ActiveX control for VLC
00003  *****************************************************************************
00004  * Copyright (C) 2005 the VideoLAN team
00005  *
00006  * Authors: Damien Fouilleul <[email protected]>
00007  *
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
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 

Generated on Tue Dec 20 10:14:18 2005 for vlc-0.8.4a by  doxygen 1.4.2