StarItemPool.hxx
Go to the documentation of this file.
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
/* libstaroffice
* Version: MPL 2.0 / LGPLv2+
*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
*
*
* All Rights Reserved.
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
* in which case the provisions of the LGPLv2+ are applicable
* instead of those above.
*/
/*
* StarPool to read/parse some StarOffice pools
*
*/
#ifndef STAR_ITEM_POOL_HXX
# define STAR_ITEM_POOL_HXX
#include <map>
#include <set>
#include <vector>
#include <libstaroffice/STOFFDocument.hxx>
#include "STOFFDebug.hxx"
#include "STOFFEntry.hxx"
#include "STOFFInputStream.hxx"
class StarAttribute;
class StarItem;
class StarItemSet;
class StarItemStyle;
namespace StarItemPoolInternal
{
struct State;
}
class StarAttribute;
class StarObject;
class StarZone;
class StarItemPool
{
public:
friend struct StarItemPoolInternal::State;
enum Type { T_ChartPool, T_EditEnginePool, T_SpreadsheetPool, T_VCControlPool, T_WriterPool, T_XOutdevPool, T_Unknown };
StarItemPool(StarObject &document, Type type);
virtual ~StarItemPool();
void clean();
void addSecondaryPool(std::shared_ptr<StarItemPool> secondary);
bool isSecondaryPool() const;
bool read(StarZone &zone);
int getVersion() const;
Type getType() const;
bool isInside() const
{
return m_isInside;
}
bool readStyles(StarZone &zone, StarObject &doc);
void updateStyles();
void updateUsingStyles(StarItemSet &itemSet) const;
void defineGraphicStyle(STOFFListenerPtr &listener, librevenge::RVNGString const &styleName, StarObject &object) const
{
std::set<librevenge::RVNGString> done;
defineGraphicStyle(listener, styleName, object, done);
}
void defineParagraphStyle(STOFFListenerPtr &listener, librevenge::RVNGString const &styleName, StarObject &object) const
{
std::set<librevenge::RVNGString> done;
defineParagraphStyle(listener, styleName, object, done);
}
StarItemStyle const *findStyleWithFamily(librevenge::RVNGString const &style, int family) const;
std::shared_ptr<StarAttribute> readAttribute(StarZone &zone, int which, int vers, long endPos);
std::shared_ptr<StarItem> readItem(StarZone &zone, bool isDirect, long endPos);
std::shared_ptr<StarItem> loadSurrogate(StarZone &zone, uint16_t &nWhich, bool localId, libstoff::DebugStream &f);
bool loadSurrogate(StarItem &item);
void setRelativeUnit(double relUnit);
double getRelativeUnit() const;
protected:
void defineGraphicStyle(STOFFListenerPtr listener, librevenge::RVNGString const &styleName, StarObject &object, std::set<librevenge::RVNGString> &done) const;
void defineParagraphStyle(STOFFListenerPtr listener, librevenge::RVNGString const &styleName, StarObject &object, std::set<librevenge::RVNGString> &done) const;
bool readV1(StarZone &zone, StarItemPool *master);
bool readV2(StarZone &zone, StarItemPool *master);
std::shared_ptr<StarItem> createItem(int which, int surrogateId, bool localId);
//
// data
//
private:
bool m_isInside;
std::shared_ptr<StarItemPoolInternal::State> m_state;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
STOFFDebug.hxx
STOFFDocument.hxx
STOFFEntry.hxx
STOFFInputStream.hxx
StarAttribute
virtual class used to store the different attribute
Definition StarAttribute.hxx:63
StarItemPool
the main class to read/.
Definition StarItemPool.hxx:71
StarItemPool::updateStyles
void updateStyles()
try to update the style
Definition StarItemPool.cxx:2069
StarItemPool::addSecondaryPool
void addSecondaryPool(std::shared_ptr< StarItemPool > secondary)
add a secondary pool
Definition StarItemPool.cxx:934
StarItemPool::setRelativeUnit
void setRelativeUnit(double relUnit)
set the item pool relative unit (if this is different to the default one)
Definition StarItemPool.cxx:913
StarItemPool::m_state
std::shared_ptr< StarItemPoolInternal::State > m_state
the state
Definition StarItemPool.hxx:152
StarItemPool::updateUsingStyles
void updateUsingStyles(StarItemSet &itemSet) const
update a itemset by adding attribute corresponding to its styles
Definition StarItemPool.cxx:2239
StarItemPool::createItem
std::shared_ptr< StarItem > createItem(int which, int surrogateId, bool localId)
create an item for futher reading
Definition StarItemPool.cxx:957
StarItemPool::readItem
std::shared_ptr< StarItem > readItem(StarZone &zone, bool isDirect, long endPos)
read a item
Definition StarItemPool.cxx:1041
StarItemPool::getType
Type getType() const
returns the pool type
Definition StarItemPool.cxx:952
StarItemPool::clean
void clean()
clean the pool's list of attributes, ...
Definition StarItemPool.cxx:924
StarItemPool::~StarItemPool
virtual ~StarItemPool()
destructor
Definition StarItemPool.cxx:909
StarItemPool::getRelativeUnit
double getRelativeUnit() const
returns the set relative unit if this is set, or the default unit corresponding to this pool
Definition StarItemPool.cxx:918
StarItemPool::Type
Type
the known item pool
Definition StarItemPool.hxx:75
StarItemPool::T_WriterPool
@ T_WriterPool
Definition StarItemPool.hxx:75
StarItemPool::T_XOutdevPool
@ T_XOutdevPool
Definition StarItemPool.hxx:75
StarItemPool::T_VCControlPool
@ T_VCControlPool
Definition StarItemPool.hxx:75
StarItemPool::T_SpreadsheetPool
@ T_SpreadsheetPool
Definition StarItemPool.hxx:75
StarItemPool::T_EditEnginePool
@ T_EditEnginePool
Definition StarItemPool.hxx:75
StarItemPool::T_ChartPool
@ T_ChartPool
Definition StarItemPool.hxx:75
StarItemPool::T_Unknown
@ T_Unknown
Definition StarItemPool.hxx:75
StarItemPool::isInside
bool isInside() const
returns true if we are reading the pool
Definition StarItemPool.hxx:94
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:2141
StarItemPool::getVersion
int getVersion() const
returns the pool version
Definition StarItemPool.cxx:947
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:1162
StarItemPool::defineParagraphStyle
void defineParagraphStyle(STOFFListenerPtr &listener, librevenge::RVNGString const &styleName, StarObject &object) const
define a paragraph style
Definition StarItemPool.hxx:113
StarItemPool::m_isInside
bool m_isInside
true if the pool is open
Definition StarItemPool.hxx:150
StarItemPool::readV1
bool readV1(StarZone &zone, StarItemPool *master)
try to read a "ItemPool" zone (version 1)
Definition StarItemPool.cxx:1468
StarItemPool::read
bool read(StarZone &zone)
try to read a "ItemPool" zone
Definition StarItemPool.cxx:992
StarItemPool::StarItemPool
StarItemPool(StarObject &document, Type type)
constructor
Definition StarItemPool.cxx:903
StarItemPool::readAttribute
std::shared_ptr< StarAttribute > readAttribute(StarZone &zone, int which, int vers, long endPos)
try to read an attribute
Definition StarItemPool.cxx:966
StarItemPool::isSecondaryPool
bool isSecondaryPool() const
returns true if a pool is a secondary pool
Definition StarItemPool.cxx:929
StarItemPool::readStyles
bool readStyles(StarZone &zone, StarObject &doc)
try to read the styles, ie a "StyleItemPool" zone
Definition StarItemPool.cxx:1795
StarItemPool::readV2
bool readV2(StarZone &zone, StarItemPool *master)
try to read a "ItemPool" zone (version 2)
Definition StarItemPool.cxx:1211
StarItemPool::defineGraphicStyle
void defineGraphicStyle(STOFFListenerPtr &listener, librevenge::RVNGString const &styleName, StarObject &object) const
define a graphic style
Definition StarItemPool.hxx:107
StarItemSet
class to store a list of item
Definition StarItem.hxx:88
StarItemStyle
brief class used to stored the style
Definition StarItem.hxx:116
StarItem
class to store an item: ie.
Definition StarItem.hxx:54
StarObject
an object corresponding to an OLE directory
Definition StarObject.hxx:65
StarZone
a zone in a StarOffice file
Definition StarZone.hxx:57
libstoff::DebugStream
Definition STOFFDebug.hxx:195
STOFFListenerPtr
std::shared_ptr< STOFFListener > STOFFListenerPtr
a smart pointer of STOFFListener
Definition libstaroffice_internal.hxx:491
StarItemPoolInternal
Internal: the structures of a StarItemPool.
Definition StarItemPool.cxx:57
StarItemPoolInternal::State
Internal: the state of a StarItemPool.
Definition StarItemPool.cxx:354