LibreOffice Module embedserv (master) 1
advisesink.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <sal/config.h>
23
24#include <memory>
25
26#if !defined WIN32_LEAN_AND_MEAN
27#define WIN32_LEAN_AND_MEAN
28#endif
29#include <windows.h>
30#include <objidl.h>
31#include <systools/win32/comtools.hxx>
32
33namespace inprocserv
34{
35class OleWrapperAdviseSink : public IAdviseSink
36{
37protected:
39
40 sal::systools::COMReference<IAdviseSink> m_pListener;
42
43 std::unique_ptr<FORMATETC> m_pFormatEtc;
44 DWORD m_nAspect;
45
46 DWORD m_nRegID;
50
53
54public:
55 // an AdviseSink for own needs, should be created always
57
58 // an AdviseSink for IOleObject interface
59 explicit OleWrapperAdviseSink(const sal::systools::COMReference<IAdviseSink>& pListener);
60
61 // an AdviseSink for IDataObject interface
62 OleWrapperAdviseSink(const sal::systools::COMReference<IAdviseSink>& pListener,
63 FORMATETC* pFormatEtc, DWORD nDataRegFlag);
64
65 // an AdviseSink for IViewObject interface
66 OleWrapperAdviseSink(const sal::systools::COMReference<IAdviseSink>& pListener, DWORD nAspect,
67 DWORD nViewRegFlag);
68
69 virtual ~OleWrapperAdviseSink();
70
71 void SetRegID(DWORD nRegID) { m_nRegID = nRegID; }
72 DWORD GetRegID() { return m_nRegID; }
73
74 bool IsOleAdvise() { return m_bObjectAdvise; }
77
78 FORMATETC* GetFormatEtc() { return m_pFormatEtc.get(); }
79 DWORD GetAspect() { return m_nAspect; }
80 sal::systools::COMReference<IAdviseSink>& GetOrigAdvise() { return m_pListener; }
81 void DisconnectOrigAdvise() { m_pListener = nullptr; }
82
83 void SetClosed() { m_bClosed = TRUE; }
85 BOOL IsClosed() { return m_bClosed; }
86
87 STDMETHODIMP QueryInterface(REFIID, void**) override;
88 STDMETHODIMP_(ULONG) AddRef() override;
89 STDMETHODIMP_(ULONG) Release() override;
90
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;
96};
97
98}; // namespace advisesink
99
100/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
STDMETHODIMP_(void) OnSave() override
sal::systools::COMReference< IAdviseSink > & GetOrigAdvise()
Definition: advisesink.hxx:80
STDMETHODIMP_(void) OnRename(IMoniker *) override
STDMETHODIMP_(void) OnDataChange(FORMATETC *
STDMETHODIMP QueryInterface(REFIID, void **) override
Definition: advisesink.cxx:90
sal::systools::COMReference< IAdviseSink > m_pListener
Definition: advisesink.hxx:40
std::unique_ptr< FORMATETC > m_pFormatEtc
Definition: advisesink.hxx:43
STDMETHODIMP_(ULONG) AddRef() override
STDMETHODIMP_(void) OnClose() override
STDMETHODIMP_(ULONG) Release() override
#define TRUE
#define FALSE
const wchar_t *typedef BOOL