xref: /aoo41x/main/shell/inc/internal/propertyhdl.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2008 by Sun Microsystems, Inc.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * $RCSfile: PropertyHdl.hxx,v $
10*cdf0e10cSrcweir  * $Revision: 1.5 $
11*cdf0e10cSrcweir  *
12*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
13*cdf0e10cSrcweir  *
14*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
15*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
16*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
17*cdf0e10cSrcweir  *
18*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
19*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
22*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
23*cdf0e10cSrcweir  *
24*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
25*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
26*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
27*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
28*cdf0e10cSrcweir  *
29*cdf0e10cSrcweir  ************************************************************************/
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #ifndef PROPERTYHDL_HXX_INCLUDED
32*cdf0e10cSrcweir #define PROPERTYHDL_HXX_INCLUDED
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #if defined _MSC_VER
35*cdf0e10cSrcweir #pragma warning(push, 1)
36*cdf0e10cSrcweir #pragma warning(disable:4917)
37*cdf0e10cSrcweir #endif
38*cdf0e10cSrcweir #include <shlobj.h>
39*cdf0e10cSrcweir #if defined _MSC_VER
40*cdf0e10cSrcweir #pragma warning(pop)
41*cdf0e10cSrcweir #endif
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir // {AE424E85-F6DF-4910-A6A9-438797986431}
44*cdf0e10cSrcweir const CLSID CLSID_PROPERTY_HANDLER =
45*cdf0e10cSrcweir { 0xae424e85, 0xf6df, 0x4910, { 0xa6, 0xa9, 0x43, 0x87, 0x97, 0x98, 0x64, 0x31 } };
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir class CMetaInfoReader;
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir class CPropertyHdl : public IPropertyStore,
50*cdf0e10cSrcweir                      public IPropertyStoreCapabilities,
51*cdf0e10cSrcweir                      public IInitializeWithStream
52*cdf0e10cSrcweir {
53*cdf0e10cSrcweir public:
54*cdf0e10cSrcweir 	         CPropertyHdl(long RefCnt = 1);
55*cdf0e10cSrcweir 	virtual ~CPropertyHdl();
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir 	//-----------------------------
58*cdf0e10cSrcweir 	// IUnknown methods
59*cdf0e10cSrcweir 	//-----------------------------
60*cdf0e10cSrcweir 	virtual HRESULT STDMETHODCALLTYPE QueryInterface(
61*cdf0e10cSrcweir             REFIID riid,
62*cdf0e10cSrcweir             void __RPC_FAR *__RPC_FAR *ppvObject );
63*cdf0e10cSrcweir     virtual ULONG STDMETHODCALLTYPE AddRef( void );
64*cdf0e10cSrcweir     virtual ULONG STDMETHODCALLTYPE Release( void );
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir 	//-----------------------------
67*cdf0e10cSrcweir 	// IPropertyStore
68*cdf0e10cSrcweir 	//-----------------------------
69*cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE GetCount( DWORD *pcProps );
70*cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE GetAt( DWORD iProp, PROPERTYKEY *pkey );
71*cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE GetValue( REFPROPERTYKEY key, PROPVARIANT *pPropVar );
72*cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE SetValue( REFPROPERTYKEY key, REFPROPVARIANT propVar );
73*cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE Commit();
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir 	//-----------------------------
76*cdf0e10cSrcweir 	// IPropertyStoreCapabilities
77*cdf0e10cSrcweir 	//-----------------------------
78*cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE IsPropertyWritable( REFPROPERTYKEY key );
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir 	//-----------------------------
81*cdf0e10cSrcweir 	// IInitializeWithStream
82*cdf0e10cSrcweir 	//-----------------------------
83*cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE Initialize(IStream *pStream, DWORD grfMode);
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir private:
86*cdf0e10cSrcweir     void        LoadProperties( CMetaInfoReader *pMetaInfoReader );
87*cdf0e10cSrcweir     HRESULT     GetItemData( CMetaInfoReader *pMetaInfoReader, UINT nIndex, PROPVARIANT *pVarData );
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir private:
90*cdf0e10cSrcweir     long m_RefCnt;
91*cdf0e10cSrcweir     IPropertyStoreCache* m_pCache;
92*cdf0e10cSrcweir };
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir class CClassFactory : public IClassFactory
95*cdf0e10cSrcweir {
96*cdf0e10cSrcweir public:
97*cdf0e10cSrcweir     CClassFactory( const CLSID& clsid );
98*cdf0e10cSrcweir     virtual ~CClassFactory();
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir     //-----------------------------
101*cdf0e10cSrcweir     // IUnknown methods
102*cdf0e10cSrcweir     //-----------------------------
103*cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE QueryInterface(
104*cdf0e10cSrcweir             REFIID riid,
105*cdf0e10cSrcweir             void __RPC_FAR *__RPC_FAR *ppvObject);
106*cdf0e10cSrcweir     virtual ULONG STDMETHODCALLTYPE AddRef( void );
107*cdf0e10cSrcweir     virtual ULONG STDMETHODCALLTYPE Release( void );
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 	//-----------------------------
110*cdf0e10cSrcweir 	// IClassFactory methods
111*cdf0e10cSrcweir 	//-----------------------------
112*cdf0e10cSrcweir 	virtual HRESULT STDMETHODCALLTYPE CreateInstance(
113*cdf0e10cSrcweir 	        IUnknown __RPC_FAR *pUnkOuter,
114*cdf0e10cSrcweir             REFIID riid,
115*cdf0e10cSrcweir             void __RPC_FAR *__RPC_FAR *ppvObject);
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir     virtual HRESULT STDMETHODCALLTYPE LockServer( BOOL fLock );
118*cdf0e10cSrcweir     static bool IsLocked();
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir private:
121*cdf0e10cSrcweir     long  m_RefCnt;
122*cdf0e10cSrcweir     CLSID m_Clsid;
123*cdf0e10cSrcweir     static long  s_ServerLocks;
124*cdf0e10cSrcweir };
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir #endif
127