Stop leaking all ScPostIt instances.
[LibreOffice.git] / embedserv / source / inprocserv / advisesink.hxx
blob5e3d67055a47ea955de1c1df777edcc76b36b0c9
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 <windows.h>
21 #include "smartpointer.hxx"
23 namespace inprocserv {
25 class OleWrapperAdviseSink : public IAdviseSink
27 protected:
28 ULONG m_nRefCount;
30 ComSmart< IAdviseSink > m_pListener;
31 DWORD m_nListenerID;
33 FORMATETC* m_pFormatEtc;
34 DWORD m_nAspect;
36 DWORD m_nRegID;
37 DWORD m_bObjectAdvise;
38 DWORD m_nDataRegFlag;
39 DWORD m_nViewRegFlag;
41 BOOL m_bHandleClosed;
42 BOOL m_bClosed;
44 public:
45 // an AdviseSink for own needs, should be created always
46 OleWrapperAdviseSink();
48 // an AdviseSink for IOleObject interface
49 OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener );
51 // an AdviseSink for IDataObject interface
52 OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, FORMATETC* pFormatEtc, DWORD nDataRegFlag );
54 // an AdviseSink for IViewObject interface
55 OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, DWORD nAspect, DWORD nViewRegFlag );
57 virtual ~OleWrapperAdviseSink();
59 void SetRegID( DWORD nRegID ) { m_nRegID = nRegID; }
60 DWORD GetRegID() { return m_nRegID; }
62 BOOL IsOleAdvise() { return m_bObjectAdvise; }
63 DWORD GetDataAdviseFlag() { return m_nDataRegFlag; }
64 DWORD GetViewAdviseFlag() { return m_nViewRegFlag; }
66 FORMATETC* GetFormatEtc() { return m_pFormatEtc; }
67 DWORD GetAspect() { return m_nAspect; }
68 ComSmart< IAdviseSink >& GetOrigAdvise() { return m_pListener; }
69 void DisconnectOrigAdvise() { m_pListener = NULL; }
71 void SetClosed() { m_bClosed = TRUE; }
72 void UnsetClosed() { m_bClosed = FALSE; }
73 BOOL IsClosed() { return m_bClosed; }
75 STDMETHODIMP QueryInterface(REFIID, void**);
76 STDMETHODIMP_(ULONG) AddRef(void);
77 STDMETHODIMP_(ULONG) Release(void);
79 STDMETHODIMP_(void) OnDataChange(LPFORMATETC, LPSTGMEDIUM);
80 STDMETHODIMP_(void) OnViewChange(DWORD, LONG);
81 STDMETHODIMP_(void) OnRename(LPMONIKER);
82 STDMETHODIMP_(void) OnSave(void);
83 STDMETHODIMP_(void) OnClose(void);
86 }; // namespace advisesink
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */