fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / embedserv / source / inprocserv / advisesink.cxx
blob6d44b9f3caf2d4b0758c6770bb86c6501adab174
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 #if defined _MSC_VER
21 #pragma warning(disable : 4668)
22 #endif
24 #include <advisesink.hxx>
26 namespace inprocserv
29 OleWrapperAdviseSink::OleWrapperAdviseSink()
30 : m_nRefCount( 0 )
31 , m_pFormatEtc( NULL )
32 , m_nAspect( DVASPECT_CONTENT )
33 , m_nRegID( 0 )
34 , m_bObjectAdvise( TRUE )
35 , m_nDataRegFlag( 0 )
36 , m_nViewRegFlag( 0 )
37 , m_bHandleClosed( TRUE )
38 , m_bClosed( FALSE )
42 OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener )
43 : m_nRefCount( 0 )
44 , m_pListener( pListener )
45 , m_pFormatEtc( NULL )
46 , m_nAspect( DVASPECT_CONTENT )
47 , m_nRegID( 0 )
48 , m_bObjectAdvise( TRUE )
49 , m_nDataRegFlag( 0 )
50 , m_nViewRegFlag( 0 )
51 , m_bHandleClosed( FALSE )
52 , m_bClosed( FALSE )
56 OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, FORMATETC* pFormatEtc, DWORD nDataRegFlag )
57 : m_nRefCount( 0 )
58 , m_pListener( pListener )
59 , m_pFormatEtc( NULL )
60 , m_nAspect( DVASPECT_CONTENT )
61 , m_nRegID( 0 )
62 , m_bObjectAdvise( FALSE )
63 , m_nDataRegFlag( nDataRegFlag )
64 , m_nViewRegFlag( 0 )
65 , m_bHandleClosed( FALSE )
66 , m_bClosed( FALSE )
68 if ( pFormatEtc )
70 m_pFormatEtc = new FORMATETC;
71 m_pFormatEtc->cfFormat = pFormatEtc->cfFormat;
72 m_pFormatEtc->ptd = NULL;
73 m_pFormatEtc->dwAspect = pFormatEtc->dwAspect;
74 m_pFormatEtc->lindex = pFormatEtc->lindex;
75 m_pFormatEtc->tymed = pFormatEtc->tymed;
79 OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, DWORD nAspect, DWORD nViewRegFlag )
80 : m_nRefCount( 0 )
81 , m_pListener( pListener )
82 , m_pFormatEtc( NULL )
83 , m_nAspect( nAspect )
84 , m_nRegID( 0 )
85 , m_bObjectAdvise( TRUE )
86 , m_nDataRegFlag( 0 )
87 , m_nViewRegFlag( nViewRegFlag )
88 , m_bHandleClosed( FALSE )
89 , m_bClosed( FALSE )
93 OleWrapperAdviseSink::~OleWrapperAdviseSink()
95 if ( m_pFormatEtc )
96 delete m_pFormatEtc;
99 STDMETHODIMP OleWrapperAdviseSink::QueryInterface( REFIID riid , void** ppv )
101 *ppv=NULL;
103 if ( riid == IID_IUnknown )
104 *ppv = (IUnknown*)this;
106 if ( riid == IID_IAdviseSink )
107 *ppv = (IAdviseSink*)this;
109 if ( *ppv != NULL )
111 ((IUnknown*)*ppv)->AddRef();
112 return S_OK;
115 return E_NOINTERFACE;
118 STDMETHODIMP_(ULONG) OleWrapperAdviseSink::AddRef()
120 return ++m_nRefCount;
123 STDMETHODIMP_(ULONG) OleWrapperAdviseSink::Release()
125 ULONG nReturn = --m_nRefCount;
126 if ( m_nRefCount == 0 )
127 delete this;
129 return nReturn;
132 STDMETHODIMP_(void) OleWrapperAdviseSink::OnDataChange( LPFORMATETC pFetc, LPSTGMEDIUM pMedium )
134 if ( m_pListener )
136 m_pListener->OnDataChange( pFetc, pMedium );
140 STDMETHODIMP_(void) OleWrapperAdviseSink::OnViewChange( DWORD dwAspect, LONG lindex )
142 if ( m_pListener )
144 m_pListener->OnViewChange( dwAspect, lindex );
148 STDMETHODIMP_(void) OleWrapperAdviseSink::OnRename( LPMONIKER pMoniker )
150 if ( m_pListener )
152 m_pListener->OnRename( pMoniker );
156 STDMETHODIMP_(void) OleWrapperAdviseSink::OnSave()
158 if ( m_pListener )
160 m_pListener->OnSave();
164 STDMETHODIMP_(void) OleWrapperAdviseSink::OnClose()
166 if ( m_pListener )
168 m_pListener->OnClose();
171 if ( m_bHandleClosed )
172 m_bClosed = TRUE;
175 } // namespace inprocserv
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */