Use o3tl::convert in Math
[LibreOffice.git] / embedserv / source / inprocserv / advisesink.hxx
blob1a89e38b4c3b12d30313a9dcf127de9e932367f1
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 #ifndef INCLUDED_EMBEDSERV_SOURCE_INPROCSERV_ADVISESINK_HXX
21 #define INCLUDED_EMBEDSERV_SOURCE_INPROCSERV_ADVISESINK_HXX
23 #include <sal/config.h>
25 #include <memory>
27 #if !defined WIN32_LEAN_AND_MEAN
28 #define WIN32_LEAN_AND_MEAN
29 #endif
30 #include <windows.h>
31 #include <objidl.h>
32 #include "smartpointer.hxx"
34 namespace inprocserv
36 class OleWrapperAdviseSink : public IAdviseSink
38 protected:
39 ULONG m_nRefCount;
41 ComSmart<IAdviseSink> m_pListener;
42 DWORD m_nListenerID;
44 std::unique_ptr<FORMATETC> m_pFormatEtc;
45 DWORD m_nAspect;
47 DWORD m_nRegID;
48 DWORD m_bObjectAdvise;
49 DWORD m_nDataRegFlag;
50 DWORD m_nViewRegFlag;
52 BOOL m_bHandleClosed;
53 BOOL m_bClosed;
55 public:
56 // an AdviseSink for own needs, should be created always
57 OleWrapperAdviseSink();
59 // an AdviseSink for IOleObject interface
60 explicit OleWrapperAdviseSink(const ComSmart<IAdviseSink>& pListener);
62 // an AdviseSink for IDataObject interface
63 OleWrapperAdviseSink(const ComSmart<IAdviseSink>& pListener, FORMATETC* pFormatEtc,
64 DWORD nDataRegFlag);
66 // an AdviseSink for IViewObject interface
67 OleWrapperAdviseSink(const ComSmart<IAdviseSink>& pListener, DWORD nAspect, DWORD nViewRegFlag);
69 virtual ~OleWrapperAdviseSink();
71 void SetRegID(DWORD nRegID) { m_nRegID = nRegID; }
72 DWORD GetRegID() { return m_nRegID; }
74 bool IsOleAdvise() { return m_bObjectAdvise; }
75 DWORD GetDataAdviseFlag() { return m_nDataRegFlag; }
76 DWORD GetViewAdviseFlag() { return m_nViewRegFlag; }
78 FORMATETC* GetFormatEtc() { return m_pFormatEtc.get(); }
79 DWORD GetAspect() { return m_nAspect; }
80 ComSmart<IAdviseSink>& GetOrigAdvise() { return m_pListener; }
81 void DisconnectOrigAdvise() { m_pListener = nullptr; }
83 void SetClosed() { m_bClosed = TRUE; }
84 void UnsetClosed() { m_bClosed = FALSE; }
85 BOOL IsClosed() { return m_bClosed; }
87 STDMETHODIMP QueryInterface(REFIID, void**) override;
88 STDMETHODIMP_(ULONG) AddRef() override;
89 STDMETHODIMP_(ULONG) Release() override;
91 STDMETHODIMP_(void) OnDataChange(FORMATETC*, STGMEDIUM*) override;
92 STDMETHODIMP_(void) OnViewChange(DWORD, LONG) override;
93 STDMETHODIMP_(void) OnRename(IMoniker*) override;
94 STDMETHODIMP_(void) OnSave() override;
95 STDMETHODIMP_(void) OnClose() override;
98 }; // namespace advisesink
100 #endif // INCLUDED_EMBEDSERV_SOURCE_INPROCSERV_ADVISESINK_HXX
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */