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