xref: /AOO41X/main/sot/source/sdstor/stgio.hxx (revision bbfc4cc7abdab5a8f4a1ef75ba4f9b278c9ffcde)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _STGIO_HXX
25 #define _STGIO_HXX
26 
27 #include <stgcache.hxx>
28 #include <stgelem.hxx>
29 #include <tools/string.hxx>
30 
31 class StgFATStrm;
32 class StgDataStrm;
33 class StgDirStrm;
34 class String;
35 
36 enum FAT_ERROR
37 {
38     FAT_OK,
39     FAT_WRONGLENGTH,
40     FAT_UNREFCHAIN,
41     FAT_OVERWRITE,
42     FAT_OUTOFBOUNDS,
43 
44     FAT_INMEMORYERROR,
45     FAT_ONFILEERROR,
46     FAT_BOTHERROR
47 };
48 
49 struct StgLinkArg
50 {
51     String aFile;
52     sal_uLong nErr;
53 };
54 
55 class StgIo : public StgCache {
56     void SetupStreams();            // load all internal streams
57     sal_Bool         bCopied;
58 public:
59     StgIo();
60    ~StgIo();
61     StgHeader    aHdr;              // storage file header
62     StgFATStrm*  pFAT;              // FAT stream
63     StgDirStrm*  pTOC;              // TOC stream
64     StgDataStrm* pDataFAT;          // small data FAT stream
65     StgDataStrm* pDataStrm;         // small data stream
66     short        GetDataPageSize(); // get the logical data page size
67     sal_Bool Load();                    // load a storage file
68     sal_Bool Init();                    // set up an empty file
69     sal_Bool CommitAll();               // commit everything (root commit)
70 
71     static void SetErrorLink( const Link& );
72     static const Link& GetErrorLink();
73     sal_uLong ValidateFATs( );
74 };
75 
76 #endif
77