Version 4.0.2.1, tag libreoffice-4.0.2.1
[LibreOffice.git] / embedserv / source / embed / iipaobj.cxx
blobbfff766af90e57c56088ebe52c50c1c9b78f605e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "iipaobj.hxx"
21 #include "embeddoc.hxx"
25 CIIAObj::CIIAObj(DocumentHolder* pDocHolder)
26 : m_refCount( 0L ),
27 m_rDocHolder( pDocHolder )
32 CIIAObj::~CIIAObj()
34 return;
37 /* IUnknown methods */
39 STDMETHODIMP CIIAObj::QueryInterface(REFIID riid, LPVOID FAR *ppv)
41 *ppv=NULL;
43 if(IID_IUnknown==riid ||
44 IID_IOleWindow==riid ||
45 IID_IOleInPlaceActiveObject==riid)
46 *ppv=this;
48 //AddRef any interface we'll return.
49 if (NULL!=*ppv)
51 ((LPUNKNOWN)*ppv)->AddRef();
52 return NOERROR;
55 return ResultFromScode(E_NOINTERFACE);
59 STDMETHODIMP_(ULONG) CIIAObj::AddRef(void)
61 return osl_atomic_increment( &m_refCount);
64 STDMETHODIMP_(ULONG) CIIAObj::Release(void)
66 sal_Int32 nCount = osl_atomic_decrement( &m_refCount);
67 if ( nCount == 0 )
68 delete this;
70 return nCount;
73 /* IOleInPlaceActiveObject methods*/
75 STDMETHODIMP CIIAObj::GetWindow(HWND *)
77 return NOERROR;
80 STDMETHODIMP CIIAObj::ContextSensitiveHelp(BOOL)
82 return NOERROR;
85 STDMETHODIMP CIIAObj::TranslateAccelerator(LPMSG)
87 return NOERROR;
90 STDMETHODIMP CIIAObj::OnFrameWindowActivate(BOOL)
92 return NOERROR;
95 STDMETHODIMP CIIAObj::OnDocWindowActivate(BOOL)
97 return NOERROR;
100 STDMETHODIMP CIIAObj::ResizeBorder(
101 LPCRECT pRect,LPOLEINPLACEUIWINDOW,BOOL bFrame)
103 if(!bFrame) return NOERROR;
105 if ( !m_rDocHolder.is() )
106 return E_FAIL;
108 return m_rDocHolder->SetContRects(pRect);
112 STDMETHODIMP CIIAObj::EnableModeless(BOOL)
114 return NOERROR;
117 // Fix strange warnings about some
118 // ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions.
119 // warning C4505: 'xxx' : unreferenced local function has been removed
120 #if defined(_MSC_VER)
121 #pragma warning(disable: 4505)
122 #endif
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */