update dev300-m57
[ooovba.git] / embedserv / source / embed / iipaobj.cxx
blobaefd60448421282f4a67e3b512d53d335961b2bb
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: iipaobj.cxx,v $
10 * $Revision: 1.5 $
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 "iipaobj.hxx"
32 #include "embeddoc.hxx"
36 CIIAObj::CIIAObj(DocumentHolder* pDocHolder)
37 : m_refCount( 0L ),
38 m_rDocHolder( pDocHolder )
43 CIIAObj::~CIIAObj()
45 return;
48 /* IUnknown methods */
50 STDMETHODIMP CIIAObj::QueryInterface(REFIID riid, LPVOID FAR *ppv)
52 *ppv=NULL;
54 if(IID_IUnknown==riid ||
55 IID_IOleWindow==riid ||
56 IID_IOleInPlaceActiveObject==riid)
57 *ppv=this;
59 //AddRef any interface we'll return.
60 if (NULL!=*ppv)
62 ((LPUNKNOWN)*ppv)->AddRef();
63 return NOERROR;
66 return ResultFromScode(E_NOINTERFACE);
70 STDMETHODIMP_(ULONG) CIIAObj::AddRef(void)
72 return osl_incrementInterlockedCount( &m_refCount);
75 STDMETHODIMP_(ULONG) CIIAObj::Release(void)
77 sal_Int32 nCount = osl_decrementInterlockedCount( &m_refCount);
78 if ( nCount == 0 )
79 delete this;
81 return nCount;
84 /* IOleInPlaceActiveObject methods*/
86 STDMETHODIMP CIIAObj::GetWindow(HWND *)
88 return NOERROR;
91 STDMETHODIMP CIIAObj::ContextSensitiveHelp(BOOL)
93 return NOERROR;
96 STDMETHODIMP CIIAObj::TranslateAccelerator(LPMSG)
98 return NOERROR;
101 STDMETHODIMP CIIAObj::OnFrameWindowActivate(BOOL)
103 return NOERROR;
106 STDMETHODIMP CIIAObj::OnDocWindowActivate(BOOL)
108 return NOERROR;
111 STDMETHODIMP CIIAObj::ResizeBorder(
112 LPCRECT pRect,LPOLEINPLACEUIWINDOW,BOOL bFrame)
114 if(!bFrame) return NOERROR;
116 if ( !m_rDocHolder.is() )
117 return E_FAIL;
119 return m_rDocHolder->SetContRects(pRect);
123 STDMETHODIMP CIIAObj::EnableModeless(BOOL)
125 return NOERROR;
128 // Fix strange warnings about some
129 // ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions.
130 // warning C4505: 'xxx' : unreferenced local function has been removed
131 #if defined(_MSC_VER)
132 #pragma warning(disable: 4505)
133 #endif