summaryrefslogtreecommitdiff
path: root/shell/inc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-05-15 09:41:45 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2019-05-15 11:19:54 +0200
commitefca409b9917f290102bc0134f09fd037f705d2f (patch)
tree0ed758a76526045131f1d2ea095fac7d3b8e1c39 /shell/inc
parent20e6c5bf3ba067598d00bc0310f478b60958bc6b (diff)
Reimplement IObjectSafety from aggregate object into ancestor
Also simplify it, don't issue warnings for now, until we understand clearly what each its option implies. Change-Id: I0d74a42b878991ad84c5c3bba36c8978d920b9be Reviewed-on: https://gerrit.libreoffice.org/72337 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'shell/inc')
-rw-r--r--shell/inc/spsupp/COMOpenDocuments.hpp65
-rw-r--r--shell/inc/spsupp/COMRefCounted.hpp4
2 files changed, 17 insertions, 52 deletions
diff --git a/shell/inc/spsupp/COMOpenDocuments.hpp b/shell/inc/spsupp/COMOpenDocuments.hpp
index f4543c948587..21b378d895e6 100644
--- a/shell/inc/spsupp/COMOpenDocuments.hpp
+++ b/shell/inc/spsupp/COMOpenDocuments.hpp
@@ -22,7 +22,7 @@
#include <Objsafe.h>
#include <assert.h>
-class COMOpenDocuments : public COMRefCounted<IOWSNewDocument3>
+class COMOpenDocuments : public COMRefCounted<IOWSNewDocument3, IObjectSafety>
{
public:
@@ -158,62 +158,27 @@ public:
BSTR bstrBlogUrl,
BSTR bstrBlogName) override;
- // Non-COM methods
-
- static long GetObjectCount();
-
-private:
- //Aggregated object
- class COMObjectSafety : public IObjectSafety
- {
- public:
- COMObjectSafety(IUnknown* pOwner) : m_pOwner(pOwner) { assert(m_pOwner); }
- virtual ~COMObjectSafety() {}
-
- // IUnknown members delegate to the outer unknown
- // IUnknown members do not control lifetime of object
-
- HRESULT STDMETHODCALLTYPE QueryInterface(
- REFIID riid,
- void **ppvObject) override
- {
- return m_pOwner->QueryInterface(riid, ppvObject);
- }
-
- ULONG STDMETHODCALLTYPE AddRef() override { return m_pOwner->AddRef(); }
-
- ULONG STDMETHODCALLTYPE Release() override { return m_pOwner->Release(); }
+ // IObjectSafety methods
- // IObjectSafety methods
-
- HRESULT STDMETHODCALLTYPE GetInterfaceSafetyOptions(
- REFIID riid,
- DWORD *pdwSupportedOptions,
- DWORD *pdwEnabledOptions) override;
-
- HRESULT STDMETHODCALLTYPE SetInterfaceSafetyOptions(
- REFIID riid,
- DWORD dwOptionSetMask,
- DWORD dwEnabledOptions) override;
-
- // Non-COM methods
+ HRESULT STDMETHODCALLTYPE GetInterfaceSafetyOptions(
+ REFIID riid,
+ DWORD *pdwSupportedOptions,
+ DWORD *pdwEnabledOptions) override;
- bool GetSafe_forUntrustedCaller() { return (m_iEnabledOptions & INTERFACESAFE_FOR_UNTRUSTED_CALLER) != 0; }
- bool GetSafe_forUntrustedData() { return (m_iEnabledOptions & INTERFACESAFE_FOR_UNTRUSTED_DATA) != 0; }
+ HRESULT STDMETHODCALLTYPE SetInterfaceSafetyOptions(
+ REFIID riid,
+ DWORD dwOptionSetMask,
+ DWORD dwEnabledOptions) override;
- private:
- IUnknown* m_pOwner;
- DWORD m_iEnabledOptions = 0;
- enum : DWORD { iSupportedOptionsMask = INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA };
+ // Non-COM methods
- void SetMaskedOptions(DWORD iMask, DWORD iOptions);
- void SetSafe_forUntrustedCaller(bool bSafe);
- void SetSafe_forUntrustedData(bool bSafe);
- };
+ static long GetObjectCount();
+private:
static long m_nObjCount;
static ITypeInfo* m_pTypeInfo;
- COMObjectSafety m_aObjectSafety;
+ static constexpr DWORD iSupportedOptionsMask = INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA;
+ DWORD m_iEnabledOptions = 0;
};
#endif
diff --git a/shell/inc/spsupp/COMRefCounted.hpp b/shell/inc/spsupp/COMRefCounted.hpp
index 5673b66517ae..0c2460ba2bf8 100644
--- a/shell/inc/spsupp/COMRefCounted.hpp
+++ b/shell/inc/spsupp/COMRefCounted.hpp
@@ -13,8 +13,8 @@
#include <objbase.h>
#include <assert.h>
-template <class Interface>
-class COMRefCounted : public Interface
+template <class... Interfaces>
+class COMRefCounted : public Interfaces...
{
public:
COMRefCounted() {}