Avoid potential negative array index access to cached text.
[LibreOffice.git] / shell / inc / propertyhdl.hxx
blob44c848e403cc76b0ca62c07de78d50171232200a
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_SHELL_INC_INTERNAL_PROPERTYHDL_HXX
21 #define INCLUDED_SHELL_INC_INTERNAL_PROPERTYHDL_HXX
23 #include <shlobj.h>
25 // {AE424E85-F6DF-4910-A6A9-438797986431}
26 const CLSID CLSID_PROPERTY_HANDLER =
27 { 0xae424e85, 0xf6df, 0x4910, { 0xa6, 0xa9, 0x43, 0x87, 0x97, 0x98, 0x64, 0x31 } };
29 class CMetaInfoReader;
31 class CPropertyHdl : public IPropertyStore,
32 public IPropertyStoreCapabilities,
33 public IInitializeWithStream
35 public:
36 CPropertyHdl(LONG RefCnt = 1);
37 virtual ~CPropertyHdl();
40 // IUnknown methods
42 virtual HRESULT STDMETHODCALLTYPE QueryInterface(
43 REFIID riid,
44 void __RPC_FAR *__RPC_FAR *ppvObject ) override;
45 virtual ULONG STDMETHODCALLTYPE AddRef() override;
46 virtual ULONG STDMETHODCALLTYPE Release() override;
49 // IPropertyStore
51 virtual HRESULT STDMETHODCALLTYPE GetCount( DWORD *pcProps ) override;
52 virtual HRESULT STDMETHODCALLTYPE GetAt( DWORD iProp, PROPERTYKEY *pkey ) override;
53 virtual HRESULT STDMETHODCALLTYPE GetValue( REFPROPERTYKEY key, PROPVARIANT *pPropVar ) override;
54 virtual HRESULT STDMETHODCALLTYPE SetValue( REFPROPERTYKEY key, REFPROPVARIANT propVar ) override;
55 virtual HRESULT STDMETHODCALLTYPE Commit() override;
58 // IPropertyStoreCapabilities
60 virtual HRESULT STDMETHODCALLTYPE IsPropertyWritable( REFPROPERTYKEY key ) override;
63 // IInitializeWithStream
65 virtual HRESULT STDMETHODCALLTYPE Initialize(IStream *pStream, DWORD grfMode) override;
67 private:
68 void LoadProperties( CMetaInfoReader *pMetaInfoReader );
70 private:
71 LONG m_RefCnt;
72 IPropertyStoreCache* m_pCache;
75 class CClassFactory : public IClassFactory
77 public:
78 CClassFactory( const CLSID& clsid );
79 virtual ~CClassFactory();
82 // IUnknown methods
84 virtual HRESULT STDMETHODCALLTYPE QueryInterface(
85 REFIID riid,
86 void __RPC_FAR *__RPC_FAR *ppvObject) override;
87 virtual ULONG STDMETHODCALLTYPE AddRef() override;
88 virtual ULONG STDMETHODCALLTYPE Release() override;
91 // IClassFactory methods
93 virtual HRESULT STDMETHODCALLTYPE CreateInstance(
94 IUnknown __RPC_FAR *pUnkOuter,
95 REFIID riid,
96 void __RPC_FAR *__RPC_FAR *ppvObject) override;
98 virtual HRESULT STDMETHODCALLTYPE LockServer( BOOL fLock ) override;
99 static bool IsLocked();
101 private:
102 LONG m_RefCnt;
103 CLSID m_Clsid;
104 static LONG s_ServerLocks;
107 #endif
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */