1*f78e906fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f78e906fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f78e906fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f78e906fSAndrew Rist * distributed with this work for additional information 6*f78e906fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f78e906fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f78e906fSAndrew Rist * "License"); you may not use this file except in compliance 9*f78e906fSAndrew Rist * with the License. You may obtain a copy of the License at 10*f78e906fSAndrew Rist * 11*f78e906fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*f78e906fSAndrew Rist * 13*f78e906fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f78e906fSAndrew Rist * software distributed under the License is distributed on an 15*f78e906fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f78e906fSAndrew Rist * KIND, either express or implied. See the License for the 17*f78e906fSAndrew Rist * specific language governing permissions and limitations 18*f78e906fSAndrew Rist * under the License. 19*f78e906fSAndrew Rist * 20*f78e906fSAndrew Rist *************************************************************/ 21*f78e906fSAndrew Rist 22*f78e906fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #include "embeddoc.hxx" 25cdf0e10cSrcweir #include <osl/diagnose.h> 26cdf0e10cSrcweir 27cdf0e10cSrcweir GetWindow(HWND * hWnd)28cdf0e10cSrcweirSTDMETHODIMP EmbedDocument_Impl::GetWindow(HWND *hWnd) 29cdf0e10cSrcweir { 30cdf0e10cSrcweir OSL_ENSURE(m_pDocHolder,"no document for inplace activation"); 31cdf0e10cSrcweir 32cdf0e10cSrcweir *hWnd = m_pDocHolder->GetTopMostWinHandle(); 33cdf0e10cSrcweir if(*hWnd != NULL) 34cdf0e10cSrcweir return NOERROR; 35cdf0e10cSrcweir else 36cdf0e10cSrcweir return ERROR; 37cdf0e10cSrcweir } 38cdf0e10cSrcweir ContextSensitiveHelp(BOOL)39cdf0e10cSrcweirSTDMETHODIMP EmbedDocument_Impl::ContextSensitiveHelp(BOOL) 40cdf0e10cSrcweir { 41cdf0e10cSrcweir return NOERROR; 42cdf0e10cSrcweir } 43cdf0e10cSrcweir InPlaceDeactivate(void)44cdf0e10cSrcweirSTDMETHODIMP EmbedDocument_Impl::InPlaceDeactivate(void) 45cdf0e10cSrcweir { 46cdf0e10cSrcweir // no locking is used since the OLE must use the same thread always 47cdf0e10cSrcweir if ( m_bIsInVerbHandling ) 48cdf0e10cSrcweir return E_UNEXPECTED; 49cdf0e10cSrcweir 50cdf0e10cSrcweir BooleanGuard_Impl aGuard( m_bIsInVerbHandling ); 51cdf0e10cSrcweir 52cdf0e10cSrcweir m_pDocHolder->InPlaceDeactivate(); 53cdf0e10cSrcweir 54cdf0e10cSrcweir // the inplace object needs the notification after the storing ( on deactivating ) 55cdf0e10cSrcweir // if it happens before the storing the replacement might not be updated 56cdf0e10cSrcweir notify(); 57cdf0e10cSrcweir 58cdf0e10cSrcweir return NOERROR; 59cdf0e10cSrcweir } 60cdf0e10cSrcweir UIDeactivate(void)61cdf0e10cSrcweirSTDMETHODIMP EmbedDocument_Impl::UIDeactivate(void) 62cdf0e10cSrcweir { 63cdf0e10cSrcweir // no locking is used since the OLE must use the same thread always 64cdf0e10cSrcweir if ( m_bIsInVerbHandling ) 65cdf0e10cSrcweir return E_UNEXPECTED; 66cdf0e10cSrcweir 67cdf0e10cSrcweir BooleanGuard_Impl aGuard( m_bIsInVerbHandling ); 68cdf0e10cSrcweir 69cdf0e10cSrcweir 70cdf0e10cSrcweir m_pDocHolder->UIDeactivate(); 71cdf0e10cSrcweir 72cdf0e10cSrcweir // the inplace object needs the notification after the storing ( on deactivating ) 73cdf0e10cSrcweir // if it happens before the storing the replacement might not be updated 74cdf0e10cSrcweir notify(); 75cdf0e10cSrcweir 76cdf0e10cSrcweir return NOERROR; 77cdf0e10cSrcweir } 78cdf0e10cSrcweir SetObjectRects(LPCRECT aRect,LPCRECT aClip)79cdf0e10cSrcweirSTDMETHODIMP EmbedDocument_Impl::SetObjectRects(LPCRECT aRect, LPCRECT aClip) 80cdf0e10cSrcweir { 81cdf0e10cSrcweir OSL_ENSURE(m_pDocHolder,"no document for inplace activation"); 82cdf0e10cSrcweir 83cdf0e10cSrcweir return m_pDocHolder->SetObjectRects(aRect,aClip); 84cdf0e10cSrcweir } 85cdf0e10cSrcweir ReactivateAndUndo(void)86cdf0e10cSrcweirSTDMETHODIMP EmbedDocument_Impl::ReactivateAndUndo(void) 87cdf0e10cSrcweir { 88cdf0e10cSrcweir return E_NOTIMPL; 89cdf0e10cSrcweir } 90cdf0e10cSrcweir 91cdf0e10cSrcweir // Fix strange warnings about some 92cdf0e10cSrcweir // ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions. 93cdf0e10cSrcweir // warning C4505: 'xxx' : unreferenced local function has been removed 94cdf0e10cSrcweir #if defined(_MSC_VER) 95cdf0e10cSrcweir #pragma warning(disable: 4505) 96cdf0e10cSrcweir #endif 97