StarItemPool.hxx Source File documentation

StarItemPool.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3 /* libstaroffice
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33
34 /*
35 * StarPool to read/parse some StarOffice pools
36 *
37 */
38 #ifndef STAR_ITEM_POOL_HXX
39 # define STAR_ITEM_POOL_HXX
40
41 #include <map>
42 #include <set>
43 #include <vector>
44
45 #include <libstaroffice/STOFFDocument.hxx>
46
47 #include "STOFFDebug.hxx"
48 #include "STOFFEntry.hxx"
49 #include "STOFFInputStream.hxx"
50
51 class StarAttribute;
52 class StarItem;
53 class StarItemSet;
54 class StarItemStyle;
55
56 namespace StarItemPoolInternal
57 {
58 struct State;
59 }
60
61 class StarAttribute;
62 class StarObject;
63 class StarZone;
64
70 class StarItemPool
71 {
72 public:
73 friend struct StarItemPoolInternal::State;
75 enum Type { T_ChartPool, T_EditEnginePool, T_SpreadsheetPool, T_VCControlPool, T_WriterPool, T_XOutdevPool, T_Unknown };
77 StarItemPool(StarObject &document, Type type);
79 virtual ~StarItemPool();
80
82 void clean();
84 void addSecondaryPool(std::shared_ptr<StarItemPool> secondary);
86 bool isSecondaryPool() const;
88 bool read(StarZone &zone);
90 int getVersion() const;
92 Type getType() const;
94 bool isInside() const
95 {
96 return m_isInside;
97 }
99 bool readStyles(StarZone &zone, StarObject &doc);
103 void updateStyles();
105 void updateUsingStyles(StarItemSet &itemSet) const;
107 void defineGraphicStyle(STOFFListenerPtr listener, librevenge::RVNGString const &styleName, StarObject &object) const
108 {
109 std::set<librevenge::RVNGString> done;
110 defineGraphicStyle(listener, styleName, object, done);
111 }
113 void defineParagraphStyle(STOFFListenerPtr listener, librevenge::RVNGString const &styleName, StarObject &object) const
114 {
115 std::set<librevenge::RVNGString> done;
116 defineParagraphStyle(listener, styleName, object, done);
117 }
119 StarItemStyle const *findStyleWithFamily(librevenge::RVNGString const &style, int family) const;
121 std::shared_ptr<StarAttribute> readAttribute(StarZone &zone, int which, int vers, long endPos);
123 std::shared_ptr<StarItem> readItem(StarZone &zone, bool isDirect, long endPos);
125 std::shared_ptr<StarItem> loadSurrogate(StarZone &zone, uint16_t &nWhich, bool localId, libstoff::DebugStream &f);
127 bool loadSurrogate(StarItem &item);
128
129 protected:
131 void defineGraphicStyle(STOFFListenerPtr listener, librevenge::RVNGString const &styleName, StarObject &object, std::set<librevenge::RVNGString> &done) const;
133 void defineParagraphStyle(STOFFListenerPtr listener, librevenge::RVNGString const &styleName, StarObject &object, std::set<librevenge::RVNGString> &done) const;
135 bool readV1(StarZone &zone, StarItemPool *master);
137 bool readV2(StarZone &zone, StarItemPool *master);
138
140 std::shared_ptr<StarItem> createItem(int which, int surrogateId, bool localId);
141
142 //
143 // data
144 //
145 private:
147 bool m_isInside;
149 std::shared_ptr<StarItemPoolInternal::State> m_state;
150 };
151 #endif
152 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
StarItem
class to store an item: ie.
Definition: StarItem.hxx:53
StarItemPool::defineGraphicStyle
void defineGraphicStyle(STOFFListenerPtr listener, librevenge::RVNGString const &styleName, StarObject &object) const
define a graphic style
Definition: StarItemPool.hxx:107
StarItemPool::loadSurrogate
std::shared_ptr< StarItem > loadSurrogate(StarZone &zone, uint16_t &nWhich, bool localId, libstoff::DebugStream &f)
try to load a surrogate
Definition: StarItemPool.cxx:1147
StarItemPool::T_XOutdevPool
Definition: StarItemPool.hxx:75
StarItemPool::Type
Type
the known item pool
Definition: StarItemPool.hxx:75
StarItemPool::readV2
bool readV2(StarZone &zone, StarItemPool *master)
try to read a "ItemPool" zone (version 2)
Definition: StarItemPool.cxx:1196
STOFFDebug.hxx
StarItemPool::m_state
std::shared_ptr< StarItemPoolInternal::State > m_state
the state
Definition: StarItemPool.hxx:149
StarItemPool::T_VCControlPool
Definition: StarItemPool.hxx:75
StarItemPool::T_EditEnginePool
Definition: StarItemPool.hxx:75
StarItemPool::~StarItemPool
virtual ~StarItemPool()
destructor
Definition: StarItemPool.cxx:905
StarItemPool::T_ChartPool
Definition: StarItemPool.hxx:75
StarItemPool::m_isInside
bool m_isInside
true if the pool is open
Definition: StarItemPool.hxx:147
StarItemPool::T_WriterPool
Definition: StarItemPool.hxx:75
StarItemPool::readV1
bool readV1(StarZone &zone, StarItemPool *master)
try to read a "ItemPool" zone (version 1)
Definition: StarItemPool.cxx:1453
StarItemPool::addSecondaryPool
void addSecondaryPool(std::shared_ptr< StarItemPool > secondary)
add a secondary pool
Definition: StarItemPool.cxx:919
StarItemPool::readStyles
bool readStyles(StarZone &zone, StarObject &doc)
try to read the styles, ie a "StyleItemPool" zone
Definition: StarItemPool.cxx:1780
StarItemPool::readAttribute
std::shared_ptr< StarAttribute > readAttribute(StarZone &zone, int which, int vers, long endPos)
try to read an attribute
Definition: StarItemPool.cxx:951
StarItemPool::findStyleWithFamily
StarItemStyle const * findStyleWithFamily(librevenge::RVNGString const &style, int family) const
try to find a style with a name and a family style
Definition: StarItemPool.cxx:2126
StarItemPool::read
bool read(StarZone &zone)
try to read a "ItemPool" zone
Definition: StarItemPool.cxx:977
StarItemPool::createItem
std::shared_ptr< StarItem > createItem(int which, int surrogateId, bool localId)
create an item for futher reading
Definition: StarItemPool.cxx:942
StarAttribute
virtual class used to store the different attribute
Definition: StarAttribute.hxx:62
StarItemPool::readItem
std::shared_ptr< StarItem > readItem(StarZone &zone, bool isDirect, long endPos)
read a item
Definition: StarItemPool.cxx:1026
STOFFEntry.hxx
StarItemPool::updateStyles
void updateStyles()
try to update the style
Definition: StarItemPool.cxx:2054
StarItemPool::getVersion
int getVersion() const
returns the pool version
Definition: StarItemPool.cxx:932
STOFFInputStream.hxx
StarItemSet
class to store a list of item
Definition: StarItem.hxx:87
StarItemPool::clean
void clean()
clean the pool&#39;s list of attributes, ...
Definition: StarItemPool.cxx:909
StarItemStyle
brief class used to stored the style
Definition: StarItem.hxx:115
StarItemPool::getType
Type getType() const
returns the pool type
Definition: StarItemPool.cxx:937
StarItemPool::isInside
bool isInside() const
returns true if we are reading the pool
Definition: StarItemPool.hxx:94
StarItemPool::updateUsingStyles
void updateUsingStyles(StarItemSet &itemSet) const
update a itemset by adding attribute corresponding to its styles
Definition: StarItemPool.cxx:2224
StarItemPoolInternal
Internal: the structures of a StarItemPool.
Definition: StarItemPool.cxx:56
StarItemPool
the main class to read/.
Definition: StarItemPool.hxx:70
STOFFDocument.hxx
libstoff::DebugStream
Definition: STOFFDebug.hxx:194
StarItemPool::StarItemPool
StarItemPool(StarObject &document, Type type)
constructor
Definition: StarItemPool.cxx:899
STOFFListenerPtr
std::shared_ptr< STOFFListener > STOFFListenerPtr
a smart pointer of STOFFListener
Definition: libstaroffice_internal.hxx:486
StarItemPool::isSecondaryPool
bool isSecondaryPool() const
returns true if a pool is a secondary pool
Definition: StarItemPool.cxx:914
StarItemPool::defineParagraphStyle
void defineParagraphStyle(STOFFListenerPtr listener, librevenge::RVNGString const &styleName, StarObject &object) const
define a paragraph style
Definition: StarItemPool.hxx:113
StarObject
an object corresponding to an OLE directory
Definition: StarObject.hxx:64
StarZone
a zone in a StarOffice file
Definition: StarZone.hxx:56
StarItemPool::T_Unknown
Definition: StarItemPool.hxx:75
StarItemPool::T_SpreadsheetPool
Definition: StarItemPool.hxx:75
StarItemPoolInternal::State
Internal: the state of a StarItemPool.
Definition: StarItemPool.cxx:353