1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
24 #include "smartpointer.hxx"
26 namespace inprocserv
{
28 class OleWrapperAdviseSink
: public IAdviseSink
33 ComSmart
< IAdviseSink
> m_pListener
;
36 FORMATETC
* m_pFormatEtc
;
40 DWORD m_bObjectAdvise
;
48 // an AdviseSink for own needs, should be created always
49 OleWrapperAdviseSink();
51 // an AdviseSink for IOleObject interface
52 explicit OleWrapperAdviseSink( const ComSmart
< IAdviseSink
>& pListener
);
54 // an AdviseSink for IDataObject interface
55 OleWrapperAdviseSink( const ComSmart
< IAdviseSink
>& pListener
, FORMATETC
* pFormatEtc
, DWORD nDataRegFlag
);
57 // an AdviseSink for IViewObject interface
58 OleWrapperAdviseSink( const ComSmart
< IAdviseSink
>& pListener
, DWORD nAspect
, DWORD nViewRegFlag
);
60 virtual ~OleWrapperAdviseSink();
62 void SetRegID( DWORD nRegID
) { m_nRegID
= nRegID
; }
63 DWORD
GetRegID() { return m_nRegID
; }
65 BOOL
IsOleAdvise() { return m_bObjectAdvise
; }
66 DWORD
GetDataAdviseFlag() { return m_nDataRegFlag
; }
67 DWORD
GetViewAdviseFlag() { return m_nViewRegFlag
; }
69 FORMATETC
* GetFormatEtc() { return m_pFormatEtc
; }
70 DWORD
GetAspect() { return m_nAspect
; }
71 ComSmart
< IAdviseSink
>& GetOrigAdvise() { return m_pListener
; }
72 void DisconnectOrigAdvise() { m_pListener
= NULL
; }
74 void SetClosed() { m_bClosed
= TRUE
; }
75 void UnsetClosed() { m_bClosed
= FALSE
; }
76 BOOL
IsClosed() { return m_bClosed
; }
78 STDMETHODIMP
QueryInterface(REFIID
, void**);
79 STDMETHODIMP_(ULONG
) AddRef();
80 STDMETHODIMP_(ULONG
) Release();
82 STDMETHODIMP_(void) OnDataChange(LPFORMATETC
, LPSTGMEDIUM
);
83 STDMETHODIMP_(void) OnViewChange(DWORD
, LONG
);
84 STDMETHODIMP_(void) OnRename(LPMONIKER
);
85 STDMETHODIMP_(void) OnSave();
86 STDMETHODIMP_(void) OnClose();
89 }; // namespace advisesink
91 #endif // INCLUDED_EMBEDSERV_SOURCE_INPROCSERV_ADVISESINK_HXX
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */