xref: /aoo42x/main/shell/inc/internal/propertyhdl.hxx (revision 67e470da)
1*ed2f6d3bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ed2f6d3bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ed2f6d3bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ed2f6d3bSAndrew Rist  * distributed with this work for additional information
6*ed2f6d3bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ed2f6d3bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ed2f6d3bSAndrew Rist  * "License"); you may not use this file except in compliance
9*ed2f6d3bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ed2f6d3bSAndrew Rist  *
11*ed2f6d3bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ed2f6d3bSAndrew Rist  *
13*ed2f6d3bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ed2f6d3bSAndrew Rist  * software distributed under the License is distributed on an
15*ed2f6d3bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ed2f6d3bSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ed2f6d3bSAndrew Rist  * specific language governing permissions and limitations
18*ed2f6d3bSAndrew Rist  * under the License.
19*ed2f6d3bSAndrew Rist  *
20*ed2f6d3bSAndrew Rist  *************************************************************/
21*ed2f6d3bSAndrew Rist 
22*ed2f6d3bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef PROPERTYHDL_HXX_INCLUDED
25cdf0e10cSrcweir #define PROPERTYHDL_HXX_INCLUDED
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #if defined _MSC_VER
28cdf0e10cSrcweir #pragma warning(push, 1)
29cdf0e10cSrcweir #pragma warning(disable:4917)
30cdf0e10cSrcweir #endif
31cdf0e10cSrcweir #include <shlobj.h>
32cdf0e10cSrcweir #if defined _MSC_VER
33cdf0e10cSrcweir #pragma warning(pop)
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir 
36cdf0e10cSrcweir // {AE424E85-F6DF-4910-A6A9-438797986431}
37cdf0e10cSrcweir const CLSID CLSID_PROPERTY_HANDLER =
38cdf0e10cSrcweir { 0xae424e85, 0xf6df, 0x4910, { 0xa6, 0xa9, 0x43, 0x87, 0x97, 0x98, 0x64, 0x31 } };
39cdf0e10cSrcweir 
40cdf0e10cSrcweir class CMetaInfoReader;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir class CPropertyHdl : public IPropertyStore,
43cdf0e10cSrcweir                      public IPropertyStoreCapabilities,
44cdf0e10cSrcweir                      public IInitializeWithStream
45cdf0e10cSrcweir {
46cdf0e10cSrcweir public:
47cdf0e10cSrcweir 	         CPropertyHdl(long RefCnt = 1);
48cdf0e10cSrcweir 	virtual ~CPropertyHdl();
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 	//-----------------------------
51cdf0e10cSrcweir 	// IUnknown methods
52cdf0e10cSrcweir 	//-----------------------------
53cdf0e10cSrcweir 	virtual HRESULT STDMETHODCALLTYPE QueryInterface(
54cdf0e10cSrcweir             REFIID riid,
55cdf0e10cSrcweir             void __RPC_FAR *__RPC_FAR *ppvObject );
56cdf0e10cSrcweir     virtual ULONG STDMETHODCALLTYPE AddRef( void );
57cdf0e10cSrcweir     virtual ULONG STDMETHODCALLTYPE Release( void );
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 	//-----------------------------
60cdf0e10cSrcweir 	// IPropertyStore
61cdf0e10cSrcweir 	//-----------------------------
62cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE GetCount( DWORD *pcProps );
63cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE GetAt( DWORD iProp, PROPERTYKEY *pkey );
64cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE GetValue( REFPROPERTYKEY key, PROPVARIANT *pPropVar );
65cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE SetValue( REFPROPERTYKEY key, REFPROPVARIANT propVar );
66cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE Commit();
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 	//-----------------------------
69cdf0e10cSrcweir 	// IPropertyStoreCapabilities
70cdf0e10cSrcweir 	//-----------------------------
71cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE IsPropertyWritable( REFPROPERTYKEY key );
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 	//-----------------------------
74cdf0e10cSrcweir 	// IInitializeWithStream
75cdf0e10cSrcweir 	//-----------------------------
76cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE Initialize(IStream *pStream, DWORD grfMode);
77cdf0e10cSrcweir 
78cdf0e10cSrcweir private:
79cdf0e10cSrcweir     void        LoadProperties( CMetaInfoReader *pMetaInfoReader );
80cdf0e10cSrcweir     HRESULT     GetItemData( CMetaInfoReader *pMetaInfoReader, UINT nIndex, PROPVARIANT *pVarData );
81cdf0e10cSrcweir 
82cdf0e10cSrcweir private:
83cdf0e10cSrcweir     long m_RefCnt;
84cdf0e10cSrcweir     IPropertyStoreCache* m_pCache;
85cdf0e10cSrcweir };
86cdf0e10cSrcweir 
87cdf0e10cSrcweir class CClassFactory : public IClassFactory
88cdf0e10cSrcweir {
89cdf0e10cSrcweir public:
90cdf0e10cSrcweir     CClassFactory( const CLSID& clsid );
91cdf0e10cSrcweir     virtual ~CClassFactory();
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     //-----------------------------
94cdf0e10cSrcweir     // IUnknown methods
95cdf0e10cSrcweir     //-----------------------------
96cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE QueryInterface(
97cdf0e10cSrcweir             REFIID riid,
98cdf0e10cSrcweir             void __RPC_FAR *__RPC_FAR *ppvObject);
99cdf0e10cSrcweir     virtual ULONG STDMETHODCALLTYPE AddRef( void );
100cdf0e10cSrcweir     virtual ULONG STDMETHODCALLTYPE Release( void );
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 	//-----------------------------
103cdf0e10cSrcweir 	// IClassFactory methods
104cdf0e10cSrcweir 	//-----------------------------
105cdf0e10cSrcweir 	virtual HRESULT STDMETHODCALLTYPE CreateInstance(
106cdf0e10cSrcweir 	        IUnknown __RPC_FAR *pUnkOuter,
107cdf0e10cSrcweir             REFIID riid,
108cdf0e10cSrcweir             void __RPC_FAR *__RPC_FAR *ppvObject);
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE LockServer( BOOL fLock );
111cdf0e10cSrcweir     static bool IsLocked();
112cdf0e10cSrcweir 
113cdf0e10cSrcweir private:
114cdf0e10cSrcweir     long  m_RefCnt;
115cdf0e10cSrcweir     CLSID m_Clsid;
116cdf0e10cSrcweir     static long  s_ServerLocks;
117cdf0e10cSrcweir };
118cdf0e10cSrcweir 
119cdf0e10cSrcweir #endif
120