update dev300-m58
[ooovba.git] / embedserv / source / inprocserv / advisesink.hxx
blobae3e77e7ba427fddd494093c4064b5fcb823ca7d
1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
5 * $RCSfile: advisesink.hxx,v $
7 * $Revision: 1.1.8.2 $
9 * last change: $Author: mav $ $Date: 2008/10/30 11:59:06 $
11 * The Contents of this file are made available subject to
12 * the terms of GNU Lesser General Public License Version 2.1.
15 * GNU Lesser General Public License Version 2.1
16 * =============================================
17 * Copyright 2005 by Sun Microsystems, Inc.
18 * 901 San Antonio Road, Palo Alto, CA 94303, USA
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License version 2.1, as published by the Free Software Foundation.
24 * This library is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Lesser General Public License for more details.
29 * You should have received a copy of the GNU Lesser General Public
30 * License along with this library; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32 * MA 02111-1307 USA
34 ************************************************************************/
36 #include <windows.h>
37 #include "smartpointer.hxx"
39 namespace inprocserv {
41 class OleWrapperAdviseSink : public IAdviseSink
43 protected:
44 ULONG m_nRefCount;
46 ComSmart< IAdviseSink > m_pListener;
47 DWORD m_nListenerID;
49 FORMATETC* m_pFormatEtc;
50 DWORD m_nAspect;
52 DWORD m_nRegID;
53 DWORD m_bObjectAdvise;
54 DWORD m_nDataRegFlag;
55 DWORD m_nViewRegFlag;
57 BOOL m_bHandleClosed;
58 BOOL m_bClosed;
60 public:
61 // an AdviseSink for own needs, should be created always
62 OleWrapperAdviseSink();
64 // an AdviseSink for IOleObject interface
65 OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener );
67 // an AdviseSink for IDataObject interface
68 OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, FORMATETC* pFormatEtc, DWORD nDataRegFlag );
70 // an AdviseSink for IViewObject interface
71 OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, DWORD nAspect, DWORD nViewRegFlag );
73 virtual ~OleWrapperAdviseSink();
75 void SetRegID( DWORD nRegID ) { m_nRegID = nRegID; }
76 DWORD GetRegID() { return m_nRegID; }
78 BOOL IsOleAdvise() { return m_bObjectAdvise; }
79 DWORD GetDataAdviseFlag() { return m_nDataRegFlag; }
80 DWORD GetViewAdviseFlag() { return m_nViewRegFlag; }
82 FORMATETC* GetFormatEtc() { return m_pFormatEtc; }
83 DWORD GetAspect() { return m_nAspect; }
84 ComSmart< IAdviseSink >& GetOrigAdvise() { return m_pListener; }
85 void DisconnectOrigAdvise() { m_pListener = NULL; }
87 void SetClosed() { m_bClosed = TRUE; }
88 void UnsetClosed() { m_bClosed = FALSE; }
89 BOOL IsClosed() { return m_bClosed; }
91 STDMETHODIMP QueryInterface(REFIID, void**);
92 STDMETHODIMP_(ULONG) AddRef(void);
93 STDMETHODIMP_(ULONG) Release(void);
95 STDMETHODIMP_(void) OnDataChange(LPFORMATETC, LPSTGMEDIUM);
96 STDMETHODIMP_(void) OnViewChange(DWORD, LONG);
97 STDMETHODIMP_(void) OnRename(LPMONIKER);
98 STDMETHODIMP_(void) OnSave(void);
99 STDMETHODIMP_(void) OnClose(void);
102 }; // namespace advisesink