merge the formfield patch from ooo-build
[ooovba.git] / store / source / storlckb.hxx
blob217e8d14836c9b272f4efd7dcfed514c13536f0c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: storlckb.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _STORE_STORLCKB_HXX_
32 #define _STORE_STORLCKB_HXX_ "$Revision: 1.6.8.1 $"
34 #include "sal/types.h"
36 #include "rtl/ustring.h"
37 #include "rtl/ref.hxx"
39 #include "object.hxx"
40 #include "storbase.hxx"
41 #include "storpage.hxx"
43 namespace store
46 struct OStoreDataPageData;
47 struct OStoreDirectoryPageData;
49 /*========================================================================
51 * OStoreLockBytes interface.
53 *======================================================================*/
54 class OStoreLockBytes : public store::OStoreObject
56 public:
57 /** Construction.
59 OStoreLockBytes (void);
61 /** create (two-phase construction).
62 * @param pManager [in]
63 * @param pPath [in]
64 * @param pName [in]
65 * @param eMode [in]
66 * @return store_E_None upon success
68 storeError create (
69 OStorePageManager *pManager,
70 rtl_String *pPath,
71 rtl_String *pName,
72 storeAccessMode eAccessMode);
74 /** Read at Offset into Buffer.
75 * @param nOffset [in]
76 * @param pBuffer [out]
77 * @param nBytes [in]
78 * @param rnDone [out]
79 * @return store_E_None upon success
81 storeError readAt (
82 sal_uInt32 nOffset,
83 void *pBuffer,
84 sal_uInt32 nBytes,
85 sal_uInt32 &rnDone);
87 /** Write at Offset from Buffer.
88 * @param nOffset [in]
89 * @param pBuffer [in]
90 * @param nBytes [in]
91 * @param rnDone [out]
92 * @return store_E_None upon success
94 storeError writeAt (
95 sal_uInt32 nOffset,
96 const void *pBuffer,
97 sal_uInt32 nBytes,
98 sal_uInt32 &rnDone);
100 /** flush.
101 * @return store_E_None upon success
103 storeError flush (void);
105 /** setSize.
106 * @param nSize [in]
107 * @return store_E_None upon success
109 storeError setSize (sal_uInt32 nSize);
111 /** stat.
112 * @paran rnSize [out]
113 * @return store_E_None upon success
115 storeError stat (sal_uInt32 &rnSize);
117 /** IStoreHandle.
119 virtual sal_Bool SAL_CALL isKindOf (sal_uInt32 nMagic);
121 protected:
122 /** Destruction (OReference).
124 virtual ~OStoreLockBytes (void);
126 private:
127 /** IStoreHandle TypeId.
129 static const sal_uInt32 m_nTypeId;
131 /** IStoreHandle query() template specialization.
133 friend OStoreLockBytes*
134 SAL_CALL query<> (IStoreHandle *pHandle, OStoreLockBytes*);
136 /** Representation.
138 rtl::Reference<OStorePageManager> m_xManager;
140 typedef OStoreDataPageData data;
141 typedef OStoreDirectoryPageData inode;
143 typedef PageHolderObject< inode > inode_holder_type;
144 inode_holder_type m_xNode;
146 bool m_bWriteable;
148 /** Not implemented.
150 OStoreLockBytes (const OStoreLockBytes&);
151 OStoreLockBytes& operator= (const OStoreLockBytes&);
154 template<> inline OStoreLockBytes*
155 SAL_CALL query (IStoreHandle *pHandle, OStoreLockBytes*)
157 if (pHandle && pHandle->isKindOf (OStoreLockBytes::m_nTypeId))
159 // Handle is kind of OStoreLockBytes.
160 return static_cast<OStoreLockBytes*>(pHandle);
162 return 0;
165 /*========================================================================
167 * The End.
169 *======================================================================*/
171 } // namespace store
173 #endif /* !_STORE_STORLCKB_HXX_ */