xref: /trunk/main/sot/source/sdstor/stgio.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _STGIO_HXX
29 #define _STGIO_HXX
30 
31 #include <stgcache.hxx>
32 #include <stgelem.hxx>
33 #include <tools/string.hxx>
34 
35 class StgFATStrm;
36 class StgDataStrm;
37 class StgDirStrm;
38 class String;
39 
40 enum FAT_ERROR
41 {
42 	FAT_OK,
43 	FAT_WRONGLENGTH,
44 	FAT_UNREFCHAIN,
45 	FAT_OVERWRITE,
46 	FAT_OUTOFBOUNDS,
47 
48 	FAT_INMEMORYERROR,
49 	FAT_ONFILEERROR,
50 	FAT_BOTHERROR
51 };
52 
53 struct StgLinkArg
54 {
55 	String aFile;
56 	sal_uLong nErr;
57 };
58 
59 class StgIo : public StgCache {
60 	void SetupStreams();			// load all internal streams
61 	sal_Bool         bCopied;
62 public:
63 	StgIo();
64    ~StgIo();
65 	StgHeader    aHdr;				// storage file header
66 	StgFATStrm*  pFAT;				// FAT stream
67 	StgDirStrm*  pTOC;				// TOC stream
68 	StgDataStrm* pDataFAT;			// small data FAT stream
69 	StgDataStrm* pDataStrm;			// small data stream
70 	short	  	 GetDataPageSize();	// get the logical data page size
71 	sal_Bool Load();					// load a storage file
72 	sal_Bool Init();					// set up an empty file
73 	sal_Bool CommitAll();				// commit everything (root commit)
74 
75 	static void SetErrorLink( const Link& );
76 	static const Link& GetErrorLink();
77 	sal_uLong ValidateFATs( );
78 };
79 
80 #endif
81