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