WPS8Graph.h Source File documentation

WPS8Graph.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* libwps
3 * Version: MPL 2.0 / LGPLv2.1+
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 * Major Contributor(s):
10 * Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
11 * Copyright (C) 2006, 2007 Andrew Ziem
12 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
13 * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
14 * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
15 *
16 * For minor contributions see the git repository.
17 *
18 * Alternatively, the contents of this file may be used under the terms
19 * of the GNU Lesser General Public License Version 2.1 or later
20 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
21 * applicable instead of those above.
22 *
23 * For further information visit http://libwps.sourceforge.net
24 */
25
26 #ifndef WPS8_GRAPH
27 # define WPS8_GRAPH
28
29 #include <map>
30 #include <vector>
31
32 #include "libwps_internal.h"
33
34 #include "WPSDebug.h"
35
36 class WPS8Parser;
37
38 namespace WPS8GraphInternal
39 {
40 struct State;
41 }
42
53 class WPS8Graph
54 {
55 friend class WPS8Parser;
56 public:
58 explicit WPS8Graph(WPS8Parser &parser);
59
61 ~WPS8Graph();
62
64 void setListener(WPSContentListenerPtr &listen)
65 {
66 m_listener = listen;
67 }
68
73 void computePositions() const;
74
76 int numPages() const;
77
82 bool sendObject(WPSPosition const &pos, int id, bool ole);
83
85 bool sendIBGF(WPSPosition const &pos, int ibgfId);
86
94 void sendObjects(int page, int pageToIgnore=-2);
95
96 protected:
98 int version() const;
99
103 void sendBorder(int borderId);
104
106 void storeObjects(std::map<int,WPSEmbeddedObject> const &objectsMap);
107
109 bool readStructures(RVNGInputStreamPtr const &input);
110
111 // low level
112
116 bool readPICT(RVNGInputStreamPtr const &input, WPSEntry const &entry);
117
122 bool readIBGF(RVNGInputStreamPtr const &input, WPSEntry const &entry);
123
125 bool readBDR(RVNGInputStreamPtr const &input, WPSEntry const &entry);
126
128 libwps::DebugFile &ascii()
129 {
130 return m_asciiFile;
131 }
132 private:
133 WPS8Graph(WPS8Graph const &orig) = delete;
134 WPS8Graph &operator=(WPS8Graph const &orig) = delete;
135
136 protected:
138 WPSContentListenerPtr m_listener;
139
141 WPS8Parser &m_mainParser;
142
144 mutable std::shared_ptr<WPS8GraphInternal::State> m_state;
145
147 libwps::DebugFile &m_asciiFile;
148 };
149
150 #endif
151 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WPSParagraph.h
WPS8GraphInternal::State::m_oleMap
std::map< int, WPSEmbeddedObject > m_oleMap
a map id -> OleData
Definition: WPS8Graph.cpp:101
WPSEntry::hasName
bool hasName(std::string const &nam) const
checks if the entry name is equal to name
Definition: WPSEntry.h:152
WPSOLEObject.h
WPSEntry::setName
void setName(std::string const &nam)
sets the name of the entry
Definition: WPSEntry.h:142
libwps::DebugStream::str
static std::string str()
Definition: WPSDebug.h:200
WPS8Graph.h
libwps::DebugFile::addPos
static void addPos(long)
Definition: WPSDebug.h:220
WPSEntry::end
long end() const
returns the end offset
Definition: WPSEntry.h:78
WPS8Graph
the main class to read/store pictures in a Pc MS Works document v5-8
Definition: WPS8Graph.h:53
WPSContentListenerPtr
std::shared_ptr< WPSContentListener > WPSContentListenerPtr
shared pointer to WPSContentListener
Definition: libwps_internal.h:107
WPS8Graph::numPages
int numPages() const
returns the number page where we find a picture. In practice, 0/1
Definition: WPS8Graph.cpp:130
WPS8Graph::setListener
void setListener(WPSContentListenerPtr &listen)
sets the listener
Definition: WPS8Graph.h:64
WPS8Graph::readBDR
bool readBDR(RVNGInputStreamPtr const &input, WPSEntry const &entry)
parsed BDR/WBDR zone: a complex border formed with 8 pictures
Definition: WPS8Graph.cpp:491
WPSPosition::m_wrapping
Wrapping m_wrapping
Wrapping.
Definition: WPSPosition.h:249
WPS8Graph::sendBorder
void sendBorder(int borderId)
sends the border frames.
Definition: WPS8Graph.cpp:317
WPS8GraphInternal::Border::m_borderSize
int m_borderSize[3]
three value to stored the border's sizes
Definition: WPS8Graph.cpp:71
WPS8Graph::m_mainParser
WPS8Parser & m_mainParser
the main parser
Definition: WPS8Graph.h:141
WPSEntry::extra
const std::string & extra() const
retrieves the extra string
Definition: WPSEntry.h:169
WPS8GraphInternal::State::m_ibgfMap
std::map< int, WPSEntry > m_ibgfMap
a map id -> ibgf entry (background picture entry)
Definition: WPS8Graph.cpp:97
WPS8GraphInternal::State::m_version
int m_version
the version
Definition: WPS8Graph.cpp:91
WPSEntry
basic class to store an entry in a file This contained :
Definition: WPSEntry.h:38
WPS8Graph::sendObjects
void sendObjects(int page, int pageToIgnore=-2)
send all the objects of a given page:
Definition: WPS8Graph.cpp:246
WPSParser::getNameEntryMap
NameMultiMap & getNameEntryMap()
Definition: WPSParser.h:70
WPSEntry::name
const std::string & name() const
name of the entry
Definition: WPSEntry.h:147
WPSPosition::CharBaseLine
@ CharBaseLine
Definition: WPSPosition.h:43
WPS8Graph::~WPS8Graph
~WPS8Graph()
destructor
Definition: WPS8Graph.cpp:117
WPSEntry::type
const std::string & type() const
returns the type of the entry
Definition: WPSEntry.h:131
WPSEntry::setId
void setId(int i)
sets the id
Definition: WPSEntry.h:163
WPSEmbeddedObject::m_size
Vec2f m_size
the picture size in inches(if known)
Definition: libwps_internal.h:1120
Vec2f
Vec2< float > Vec2f
Vec2 of float.
Definition: libwps_internal.h:704
WPSPosition::setRelativePosition
void setRelativePosition(AnchorTo anchor, XPos X=XLeft, YPos Y=YTop)
sets the relative position
Definition: WPSPosition.h:214
WPS8GraphInternal::Border::m_name
std::string m_name
Internal: the border name.
Definition: WPS8Graph.cpp:66
Vec2< float >
WPS_DEBUG_MSG
#define WPS_DEBUG_MSG(M)
Definition: libwps_internal.h:134
libwps::readU32
uint32_t readU32(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:76
WPSParagraph
class to store the paragraph properties
Definition: WPSParagraph.h:57
WPSContentListener.h
WPS8Graph::WPS8Graph
WPS8Graph(WPS8Parser &parser)
constructor
Definition: WPS8Graph.cpp:108
Vec2::x
T x() const
first element
Definition: libwps_internal.h:542
WPSOLEParser.h
WPS8Graph::operator=
WPS8Graph & operator=(WPS8Graph const &orig)=delete
WPS8Graph::readIBGF
bool readIBGF(RVNGInputStreamPtr const &input, WPSEntry const &entry)
reads a IBGF zone: an entry to a background picture
Definition: WPS8Graph.cpp:429
WPSPosition::setNaturalSize
void setNaturalSize(Vec2f const &natSize)
sets the natural size (if known)
Definition: WPSPosition.h:197
WPS8Graph::m_listener
WPSContentListenerPtr m_listener
the listener
Definition: WPS8Graph.h:138
WPS8Graph::ascii
libwps::DebugFile & ascii()
returns the debug file
Definition: WPS8Graph.h:128
Vec2::setY
void setY(T yy)
resets the second element
Definition: libwps_internal.h:576
WPS8GraphInternal::Border::m_pictList
std::vector< WPSEmbeddedObject > m_pictList
the border's pictures: 1 to 8 pictures..
Definition: WPS8Graph.cpp:75
WPSFont.h
WPS8Graph::storeObjects
void storeObjects(std::map< int, WPSEmbeddedObject > const &objectsMap)
adds a list of object
Definition: WPS8Graph.cpp:143
WPS8GraphInternal
Internal: the structures of a WPS8Graph.
Definition: WPS8Graph.cpp:48
WPS8Graph::readPICT
bool readPICT(RVNGInputStreamPtr const &input, WPSEntry const &entry)
reads a PICT/MEF4 entry : reads uncompressed picture of sx*sy of rgb
Definition: WPS8Graph.cpp:360
WPSEntry.h
libwps::DebugFile::addNote
static void addNote(char const *)
Definition: WPSDebug.h:221
WPSEntry::begin
long begin() const
returns the begin offset
Definition: WPSEntry.h:73
WPS8GraphInternal::State
Internal: the state of a WPS8Graph.
Definition: WPS8Graph.cpp:81
libwps::read8
int8_t read8(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:59
WPSOLEObject::readWMF
static bool readWMF(std::shared_ptr< WPSStream > stream, WPSEmbeddedObject &object, long endPos=-1)
try to read a wmf file: 0x0[12]00 0xXX00(with XX>=9)
Definition: WPSOLEObject.cpp:102
WPSEmbeddedObject
small class use to define a embedded object
Definition: libwps_internal.h:1076
WPS8Parser
This class parses Works version 2000 through 8.
Definition: WPS8.h:49
WPSEntry::id
int id() const
returns the entry id
Definition: WPSEntry.h:158
WPSEntry::length
long length() const
returns the length of the zone
Definition: WPSEntry.h:83
libwps::DebugStream
Definition: WPSDebug.h:191
libwps::readU8
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:40
WPSParser::version
int version() const
Definition: WPSParser.h:56
WPS8GraphInternal::Border::Border
Border()
constructor
Definition: WPS8Graph.cpp:56
WPS8Graph::m_asciiFile
libwps::DebugFile & m_asciiFile
the ascii file
Definition: WPS8Graph.h:147
WPS8GraphInternal::State::m_borderMap
std::map< int, Border > m_borderMap
a map id -> border
Definition: WPS8Graph.cpp:95
WPS8Graph::sendObject
bool sendObject(WPSPosition const &pos, int id, bool ole)
sends an object
Definition: WPS8Graph.cpp:191
libwps_tools_win::Language::name
std::string name(long id)
returns the name given Windows© id
Definition: libwps_tools_win.cpp:7332
WPSEntry::hasType
bool hasType(std::string const &tp) const
returns true if the type entry == type
Definition: WPSEntry.h:136
WPS8GraphInternal::State::m_pictMap
std::map< int, WPSEmbeddedObject > m_pictMap
a map id -> pictData
Definition: WPS8Graph.cpp:99
WPSPosition.h
RVNGInputStreamPtr
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
WPS8Graph::readStructures
bool readStructures(RVNGInputStreamPtr const &input)
finds all entries which correspond to some pictures, parses them and stores data
Definition: WPS8Graph.cpp:151
WPSPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: WPSPosition.h:39
WPSPosition::size
const Vec2f & size() const
returns the frame size
Definition: WPSPosition.h:123
WPS8.h
WPSDebug.h
libwps::read16
int16_t read16(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:71
Vec2::set
void set(T xx, T yy)
resets the two elements
Definition: libwps_internal.h:565
WPSFont::getDefault
static WPSFont getDefault()
returns the default font ( Courier 12pt)
Definition: WPSFont.h:53
libwps_internal.h
WPSStream.h
WPS8GraphInternal::State::State
State()
Definition: WPS8Graph.cpp:83
Vec2::setX
void setX(T xx)
resets the first element
Definition: libwps_internal.h:571
WPS8GraphInternal::State::m_numPages
int m_numPages
the number page
Definition: WPS8Graph.cpp:93
WPS8Graph::computePositions
void computePositions() const
computes the final position of all found figures.
Definition: WPS8Graph.cpp:138
WPSEntry::setParsed
void setParsed(bool ok=true) const
sets the flag m_parsed to true or false
Definition: WPSEntry.h:120
WPS8GraphInternal::Border::m_parsed
bool m_parsed
flag to know if the border was sent to the listener
Definition: WPS8Graph.cpp:77
WPSPosition::setSize
void setSize(Vec2f const &sz)
sets the frame size
Definition: WPSPosition.h:192
WPS8Graph::sendIBGF
bool sendIBGF(WPSPosition const &pos, int ibgfId)
sends data corresponding to a ibgf entry on a given pos position
Definition: WPS8Graph.cpp:228
WPS8Graph::version
int version() const
returns the file version
Definition: WPS8Graph.cpp:123
libwps::DebugFile
Definition: WPSDebug.h:207
WPS8Graph::m_state
std::shared_ptr< WPS8GraphInternal::State > m_state
the state
Definition: WPS8Graph.h:144
WPS8GraphInternal::Border
Internal: a complex border picture.
Definition: WPS8Graph.cpp:53
WPS8GraphInternal::Border::m_borderId
int m_borderId[8]
the picture uses to draw TopLeft corner, Top border, TopRight corner, Right border....
Definition: WPS8Graph.cpp:73
Vec2::y
T y() const
second element
Definition: libwps_internal.h:547
WPSPosition::WDynamic
@ WDynamic
Definition: WPSPosition.h:45