xref: /aoo4110/main/sw/source/filter/ww8/ww8glsy.hxx (revision b1cdbd2c)
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 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
24 
25 #ifndef _WW8GLSY_HXX
26 #define _WW8GLSY_HXX
27 
28 #include <sot/storage.hxx>
29 #include "ww8scan.hxx"
30 
31 class SwTextBlocks;
32 class SwNodeIndex;
33 
34 /*
35  * GlossaryFib takes the document fib and finds the glossary fib which may
36  * not exist. The glossary fib has the offsets into the autotext subdocument
37  * which is at the end of template .dot's
38  */
39 class WW8GlossaryFib : public WW8Fib
40 {
41 public:
WW8GlossaryFib(SvStream & rStrm,sal_uInt8 nWantedVersion,SvStream & rTableStrm,const WW8Fib & rFib)42     WW8GlossaryFib( SvStream& rStrm, sal_uInt8 nWantedVersion ,
43         SvStream& rTableStrm, const WW8Fib &rFib) : WW8Fib(rStrm,
44         nWantedVersion,FindGlossaryFibOffset(rTableStrm,rStrm,rFib)) {}
45     bool IsGlossaryFib();
46 private:
47     sal_uInt32 FindGlossaryFibOffset(SvStream &rTableStrm,SvStream &rStrm,
48         const WW8Fib &rFib);
49 };
50 
51 /*
52  * Imports glossaries from word, given the document it gets the usual word
53  * doc information, then the glossary fib and uses the usual reader class to
54  * wrap the autotext into a star doc. Afterwards taking each section entry and
55  * making it a single star autotext entry.
56  *
57  * ToDo currently all autotext entries become resource hungry star autotext
58  * formatted text, need to use a flag in the ww8reader class to determine if
59  * an entry is formatted or not.
60  */
61 class WW8Glossary
62 {
63 public:
64     WW8Glossary( SvStorageStreamRef &refStrm, sal_uInt8 nVersion, SvStorage *pStg=0);
65     bool Load( SwTextBlocks &rBlocks, bool bSaveRelFile );
~WW8Glossary()66     ~WW8Glossary()                  { delete pGlossary; }
GetFib()67     WW8GlossaryFib *GetFib()        { return pGlossary; }
GetNoStrings() const68     sal_uInt16 GetNoStrings() const     { return nStrings; }
69 
70 private:
71     WW8GlossaryFib *pGlossary;
72     SvStorageStreamRef xTableStream;
73     SvStorageStreamRef &rStrm;
74     SvStorageRef xStg;
75     sal_uInt16 nStrings;
76 
77     bool MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks, bool bSaveRelFile,
78         const ::std::vector<String>& rStrings,
79         const ::std::vector<ww::bytes>& rExtra);
80     bool HasBareGraphicEnd(SwDoc *pD,SwNodeIndex &rIdx);
81 
82     //No copying
83     WW8Glossary(const WW8Glossary&);
84     WW8Glossary& operator=(const WW8Glossary&);
85 };
86 #endif
87 
88 /* vi:set tabstop=4 shiftwidth=4 expandtab: */
89