Update ooo320-m1
[ooovba.git] / embedserv / source / embed / ed_iinplace.cxx
blobd05981118bf0839094980223f9c57683a23a9ee3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ed_iinplace.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "embeddoc.hxx"
32 #include <osl/diagnose.h>
35 STDMETHODIMP EmbedDocument_Impl::GetWindow(HWND *hWnd)
37 OSL_ENSURE(m_pDocHolder,"no document for inplace activation");
39 *hWnd = m_pDocHolder->GetTopMostWinHandle();
40 if(*hWnd != NULL)
41 return NOERROR;
42 else
43 return ERROR;
46 STDMETHODIMP EmbedDocument_Impl::ContextSensitiveHelp(BOOL)
48 return NOERROR;
51 STDMETHODIMP EmbedDocument_Impl::InPlaceDeactivate(void)
53 // no locking is used since the OLE must use the same thread always
54 if ( m_bIsInVerbHandling )
55 return E_UNEXPECTED;
57 BooleanGuard_Impl aGuard( m_bIsInVerbHandling );
59 m_pDocHolder->InPlaceDeactivate();
61 // the inplace object needs the notification after the storing ( on deactivating )
62 // if it happens before the storing the replacement might not be updated
63 notify();
65 return NOERROR;
68 STDMETHODIMP EmbedDocument_Impl::UIDeactivate(void)
70 // no locking is used since the OLE must use the same thread always
71 if ( m_bIsInVerbHandling )
72 return E_UNEXPECTED;
74 BooleanGuard_Impl aGuard( m_bIsInVerbHandling );
77 m_pDocHolder->UIDeactivate();
79 // the inplace object needs the notification after the storing ( on deactivating )
80 // if it happens before the storing the replacement might not be updated
81 notify();
83 return NOERROR;
86 STDMETHODIMP EmbedDocument_Impl::SetObjectRects(LPCRECT aRect, LPCRECT aClip)
88 OSL_ENSURE(m_pDocHolder,"no document for inplace activation");
90 return m_pDocHolder->SetObjectRects(aRect,aClip);
93 STDMETHODIMP EmbedDocument_Impl::ReactivateAndUndo(void)
95 return E_NOTIMPL;
98 // Fix strange warnings about some
99 // ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions.
100 // warning C4505: 'xxx' : unreferenced local function has been removed
101 #if defined(_MSC_VER)
102 #pragma warning(disable: 4505)
103 #endif