LibreOffice Module sw (master)  1
ww8glsy.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_SW_SOURCE_FILTER_WW8_WW8GLSY_HXX
21 #define INCLUDED_SW_SOURCE_FILTER_WW8_WW8GLSY_HXX
22 
23 #include <memory>
24 #include <sot/storage.hxx>
25 #include "ww8scan.hxx"
26 
27 class SwTextBlocks;
28 class SwNodeIndex;
29 
30 /*
31  * GlossaryFib takes the document fib and finds the glossary fib which may
32  * not exist. The glossary fib has the offsets into the autotext subdocument
33  * which is at the end of template .dot's
34  */
35 class WW8GlossaryFib : public WW8Fib
36 {
37 public:
38  WW8GlossaryFib( SvStream& rStrm, sal_uInt8 nWantedVersion, const WW8Fib &rFib)
39  : WW8Fib(rStrm, nWantedVersion, FindGlossaryFibOffset(rFib)) {}
40  // fGlsy will indicate whether this has AutoText or not
41  bool IsGlossaryFib() {
42  return m_fGlsy;
43  }
44 private:
45  static sal_uInt32 FindGlossaryFibOffset(const WW8Fib &rFib);
46 };
47 
48 /*
49  * Imports glossaries from word, given the document it gets the usual word
50  * doc information, then the glossary fib and uses the usual reader class to
51  * wrap the autotext into a star doc. Afterwards taking each section entry and
52  * making it a single star autotext entry.
53  *
54  * ToDo currently all autotext entries become resource hungry star autotext
55  * formatted text, need to use a flag in the ww8reader class to determine if
56  * an entry is formatted or not.
57  */
59 {
60 public:
62  bool Load( SwTextBlocks &rBlocks, bool bSaveRelFile );
63  std::shared_ptr<WW8GlossaryFib>& GetFib()
64  {
65  return xGlossary;
66  }
67  sal_uInt16 GetNoStrings() const
68  {
69  return nStrings;
70  }
71 
72 private:
73  std::shared_ptr<WW8GlossaryFib> xGlossary;
77  sal_uInt16 nStrings;
78 
79  static bool MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks, bool bSaveRelFile,
80  const std::vector<OUString>& rStrings,
81  const std::vector<ww::bytes>& rExtra);
82  static bool HasBareGraphicEnd(SwDoc *pD,SwNodeIndex const &rIdx);
83 
84  WW8Glossary(const WW8Glossary&) = delete;
85  WW8Glossary& operator=(const WW8Glossary&) = delete;
86 };
87 #endif
88 
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< WW8GlossaryFib > xGlossary
Definition: ww8glsy.hxx:73
static bool HasBareGraphicEnd(SwDoc *pD, SwNodeIndex const &rIdx)
Definition: ww8glsy.cxx:59
Definition: doc.hxx:185
WW8Glossary & operator=(const WW8Glossary &)=delete
WW8Glossary(tools::SvRef< SotStorageStream > &refStrm, sal_uInt8 nVersion, SotStorage *pStg)
Definition: ww8glsy.cxx:38
bool Load(SwTextBlocks &rBlocks, bool bSaveRelFile)
Definition: ww8glsy.cxx:190
tools::SvRef< SotStorageStream > xTableStream
Definition: ww8glsy.hxx:74
sal_uInt16 GetNoStrings() const
Definition: ww8glsy.hxx:67
bool IsGlossaryFib()
Definition: ww8glsy.hxx:41
std::shared_ptr< WW8GlossaryFib > & GetFib()
Definition: ww8glsy.hxx:63
static bool MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks, bool bSaveRelFile, const std::vector< OUString > &rStrings, const std::vector< ww::bytes > &rExtra)
Definition: ww8glsy.cxx:82
bool m_fGlsy
Definition: ww8scan.hxx:1150
Marks a node in the document model.
Definition: ndindex.hxx:31
sal_uInt16 nStrings
Definition: ww8glsy.hxx:77
unsigned char sal_uInt8
static sal_uInt32 FindGlossaryFibOffset(const WW8Fib &rFib)
Definition: ww8glsy.cxx:237
FIB - the File Information Block.
Definition: ww8scan.hxx:1106
WW8GlossaryFib(SvStream &rStrm, sal_uInt8 nWantedVersion, const WW8Fib &rFib)
Definition: ww8glsy.hxx:38
tools::SvRef< SotStorageStream > & rStrm
Definition: ww8glsy.hxx:75
tools::SvRef< SotStorage > const xStg
Definition: ww8glsy.hxx:76