merge the formfield patch from ooo-build
[ooovba.git] / store / source / storpage.hxx
blob4ebf05b0490b4b10c91dd746985c22fedcd928b3
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: storpage.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_STORPAGE_HXX_
32 #define _STORE_STORPAGE_HXX_ "$Revision: 1.6.8.2 $"
34 #include "sal/types.h"
36 #include "object.hxx"
37 #include "lockbyte.hxx"
39 #include "storbase.hxx"
40 #include "storbios.hxx"
41 #include "stortree.hxx"
43 namespace store
46 struct OStoreDirectoryPageData;
47 class OStoreDirectoryPageObject;
49 /*========================================================================
51 * OStorePageManager interface.
53 *======================================================================*/
54 class OStorePageManager : public store::OStorePageBIOS
56 public:
57 /** Construction.
59 OStorePageManager (void);
61 /** Initialization (two-phase construction).
63 virtual storeError initialize (
64 ILockBytes * pLockBytes,
65 storeAccessMode eAccessMode,
66 sal_uInt16 & rnPageSize);
68 /** isValid.
69 * @return sal_True upon successful initialization,
70 * sal_False otherwise.
72 inline sal_Bool isValid (void) const;
74 /** DirectoryPage I/O (managed).
76 static storeError namei (
77 const rtl_String *pPath,
78 const rtl_String *pName,
79 OStorePageKey &rKey);
81 storeError iget (
82 OStoreDirectoryPageObject & rPage, // [out]
83 sal_uInt32 nAttrib,
84 const rtl_String * pPath,
85 const rtl_String * pName,
86 storeAccessMode eMode);
88 storeError iterate (
89 OStorePageKey & rKey,
90 OStorePageLink & rLink,
91 sal_uInt32 & rAttrib);
93 /** attrib [nAttrib = ((nAttrib & ~nMask1) | nMask2)].
94 * @see store_attrib()
96 storeError attrib (
97 const OStorePageKey &rKey,
98 sal_uInt32 nMask1,
99 sal_uInt32 nMask2,
100 sal_uInt32 &rAttrib);
102 /** link (insert Source Key as hardlink to Destination).
103 * @see store_link()
105 storeError link (
106 const OStorePageKey &rSrcKey,
107 const OStorePageKey &rDstKey);
109 /** symlink (insert Source DirectoryPage as symlink to Destination).
110 * @see store_symlink()
112 storeError symlink (
113 const rtl_String *pSrcPath,
114 const rtl_String *pSrcName,
115 const OStorePageKey &rDstKey);
117 /** rename.
118 * @see store_rename()
120 storeError rename (
121 const OStorePageKey &rSrcKey,
122 const rtl_String *pDstPath,
123 const rtl_String *pDstName);
125 /** remove.
126 * @see store_remove()
128 storeError remove (
129 const OStorePageKey &rKey);
131 /** rebuild (combines recover and compact from 'Src' to 'Dst').
132 * @param pSrcLB [in] accessed readonly.
133 * @param pDstLB [in] truncated and accessed readwrite (as initialize()).
134 * @return store_E_None upon success.
136 * @see store_rebuildFile()
138 storeError rebuild (
139 ILockBytes *pSrcLB,
140 ILockBytes *pDstLB);
142 /** IStoreHandle.
144 virtual sal_Bool SAL_CALL isKindOf (sal_uInt32 nTypeId);
146 protected:
147 /** Destruction.
149 virtual ~OStorePageManager (void);
151 private:
152 /** Implementation.
154 typedef OStorePageBIOS base;
155 typedef OStorePageManager self;
157 typedef OStoreBTreeEntry entry;
158 typedef OStoreBTreeNodeData page;
159 typedef OStoreBTreeNodeObject node;
161 typedef OStoreDirectoryPageData inode;
162 typedef PageHolderObject< inode > inode_holder_type;
164 /** IStoreHandle TypeId.
166 static const sal_uInt32 m_nTypeId;
168 /** IStoreHandle query() template function specialization.
170 friend OStorePageManager*
171 SAL_CALL query<> (IStoreHandle *pHandle, OStorePageManager*);
173 /** Representation.
175 OStoreBTreeRootObject m_aRoot;
177 /** DirectoryPage I/O (managed).
179 storeError load_dirpage_Impl ( // @@@ => private: iget() @@@
180 const OStorePageKey &rKey,
181 OStoreDirectoryPageObject &rPage);
183 storeError save_dirpage_Impl ( // @@@ => private: iget(), rebuild() @@@
184 const OStorePageKey &rKey,
185 OStoreDirectoryPageObject &rPage);
187 /** find_lookup (node page and index, w/o split).
189 storeError find_lookup (
190 OStoreBTreeNodeObject & rNode,
191 sal_uInt16 & rIndex,
192 OStorePageKey const & rKey);
194 /** remove (possibly down from root).
196 storeError remove_Impl (entry & rEntry);
198 /** Not implemented.
200 OStorePageManager (const OStorePageManager&);
201 OStorePageManager& operator= (const OStorePageManager&);
204 inline sal_Bool OStorePageManager::isValid (void) const
206 return (base::isValid() /* @@@ NYI && (m_aRoot.is()) */);
209 template<> inline OStorePageManager*
210 SAL_CALL query (IStoreHandle *pHandle, OStorePageManager*)
212 if (pHandle && pHandle->isKindOf (OStorePageManager::m_nTypeId))
214 // Handle is kind of OStorePageManager.
215 return static_cast<OStorePageManager*>(pHandle);
217 return 0;
220 /*========================================================================
222 * The End.
224 *======================================================================*/
226 } // namespace store
228 #endif /* !_STORE_STORPAGE_HXX_ */