WPS4Graph.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 WPS4_GRAPH
27 # define WPS4_GRAPH
28 
29 #include <map>
30 #include <vector>
31 
32 #include "libwps_internal.h"
33 
34 #include "WPSDebug.h"
35 
36 class WPS4Parser;
37 
38 namespace WPS4GraphInternal
39 {
40 struct State;
41 }
42 
44 //
45 // class to parse the object
46 //
48 
56 class WPS4Graph
57 {
58  friend class WPS4Parser;
59 public:
61  explicit WPS4Graph(WPS4Parser &parser);
62 
64  ~WPS4Graph();
65 
68  {
69  m_listener = listen;
70  }
71 
78  void computePositions() const;
79 
81  int numPages() const;
82 
83 protected:
85  int version() const;
86 
88  void storeObjects(std::map<int,WPSEmbeddedObject> const &objectsMap);
89 
95  int readObject(RVNGInputStreamPtr input, WPSEntry const &entry);
96 
98  void sendObject(WPSPosition const &position, int id);
99 
106  void sendObjects(int page);
107 
110  {
111  return m_asciiFile;
112  }
113 
114 private:
115  WPS4Graph(WPS4Graph const &orig) = delete;
116  WPS4Graph &operator=(WPS4Graph const &orig) = delete;
117 protected:
120 
123 
125  mutable std::shared_ptr<WPS4GraphInternal::State> m_state;
126 
129 };
130 
131 #endif
132 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
133 
WPS4Graph::m_state
std::shared_ptr< WPS4GraphInternal::State > m_state
the state
Definition: WPS4Graph.h:125
WPS4Graph::operator=
WPS4Graph & operator=(WPS4Graph const &orig)=delete
WPS4Graph::sendObjects
void sendObjects(int page)
send all the objects of a given page:
Definition: WPS4Graph.cpp:129
WPSParagraph.h
WPSOLEObject.h
libwps::DebugStream::str
static std::string str()
Definition: WPSDebug.h:200
WPS4Graph.h
libwps::DebugFile::addPos
static void addPos(long)
Definition: WPSDebug.h:220
WPSEntry::end
long end() const
returns the end offset
Definition: WPSEntry.h:76
WPS4GraphInternal::State::State
State()
Definition: WPS4Graph.cpp:51
WPS4Graph::m_asciiFile
libwps::DebugFile & m_asciiFile
the ascii file
Definition: WPS4Graph.h:128
WPS4Graph::computePositions
void computePositions() const
computes the position of all found figures.
Definition: WPS4Graph.cpp:92
WPSContentListenerPtr
std::shared_ptr< WPSContentListener > WPSContentListenerPtr
shared pointer to WPSContentListener
Definition: libwps_internal.h:107
WPS4GraphInternal::State::m_numPages
int m_numPages
the number page
Definition: WPS4Graph.cpp:59
WPS4GraphInternal::State::m_version
int m_version
the version
Definition: WPS4Graph.cpp:57
WPS4GraphInternal::State
Internal: the state of a WPS4Graph.
Definition: WPS4Graph.cpp:49
WPSPosition::m_wrapping
Wrapping m_wrapping
Wrapping.
Definition: WPSPosition.h:247
WPSEntry::valid
bool valid(bool checkId=false) const
returns true if the zone length is positive
Definition: WPSEntry.h:87
WPS4GraphInternal
Internal: the structures of a WPS4Graph.
Definition: WPS4Graph.cpp:46
WPS4Graph::WPS4Graph
WPS4Graph(WPS4Parser &parser)
constructor given the main parser of the MN0 zone
Definition: WPS4Graph.cpp:67
WPSEntry
basic class to store an entry in a file This contained :
Definition: WPSEntry.h:38
WPS4Graph::readObject
int readObject(RVNGInputStreamPtr input, WPSEntry const &entry)
tries to find a picture in the zone pointed by entry
Definition: WPS4Graph.cpp:170
WPSPosition::CharBaseLine
Definition: WPSPosition.h:43
WPS4Graph::numPages
int numPages() const
returns the number page where we find a picture. In practice, 0/1
Definition: WPS4Graph.cpp:87
WPS4Graph
the main class to read/store picture in a Pc MS Works document v1-4
Definition: WPS4Graph.h:56
WPSOLEObject::readMetafile
static bool readMetafile(std::shared_ptr< WPSStream > stream, WPSEmbeddedObject &object, long endPos=-1, bool strict=false)
try to read a metafile data
Definition: WPSOLEObject.cpp:43
WPS4Graph::m_listener
WPSContentListenerPtr m_listener
the listener
Definition: WPS4Graph.h:119
WPS4Graph::m_mainParser
WPS4Parser & m_mainParser
the main parser
Definition: WPS4Graph.h:122
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:212
Vec2< float >
WPS_DEBUG_MSG
#define WPS_DEBUG_MSG(M)
Definition: libwps_internal.h:134
WPS4Graph::storeObjects
void storeObjects(std::map< int, WPSEmbeddedObject > const &objectsMap)
store a list of object
Definition: WPS4Graph.cpp:97
WPSParagraph
class to store the paragraph properties
Definition: WPSParagraph.h:57
WPSContentListener.h
WPSOLEParser.h
WPSOLEObject::readOLE
static bool readOLE(std::shared_ptr< WPSStream > stream, WPSEmbeddedObject &object, long endPos=-1)
try to read a OLE: 0x0105 ...
Definition: WPSOLEObject.cpp:139
WPSPosition::setNaturalSize
void setNaturalSize(Vec2f const &natSize)
sets the natural size (if known)
Definition: WPSPosition.h:195
WPSFont.h
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:71
WPSEmbeddedObject
small class use to define a embedded object
Definition: libwps_internal.h:1076
WPSEntry::id
int id() const
returns the entry id
Definition: WPSEntry.h:156
WPSEntry::length
long length() const
returns the length of the zone
Definition: WPSEntry.h:81
libwps::DebugStream
Definition: WPSDebug.h:191
WPSParser::version
int version() const
Definition: WPSParser.h:56
WPS4.h
WPS4Graph::version
int version() const
returns the file version
Definition: WPS4Graph.cpp:80
libwps::readU16
uint16_t readU16(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:64
WPS4Graph::setListener
void setListener(WPSContentListenerPtr &listen)
sets the listener
Definition: WPS4Graph.h:67
WPS4Parser
This class parses Works version 2 through 4.
Definition: WPS4.h:48
WPSPosition.h
RVNGInputStreamPtr
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
WPSPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: WPSPosition.h:39
WPSDebug.h
libwps::read16
int16_t read16(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:71
WPSFont::getDefault
static WPSFont getDefault()
returns the default font ( Courier 12pt)
Definition: WPSFont.h:51
libwps_internal.h
WPS4Graph::ascii
libwps::DebugFile & ascii()
returns the debug file
Definition: WPS4Graph.h:109
WPS4Graph::sendObject
void sendObject(WPSPosition const &position, int id)
sends an object with identificator id as a character to a given pposition
Definition: WPS4Graph.cpp:108
WPS4GraphInternal::State::m_idToObjectMap
std::map< int, WPSEmbeddedObject > m_idToObjectMap
the map id to objects
Definition: WPS4Graph.cpp:62
WPSStream.h
libwps::DebugFile
Definition: WPSDebug.h:207
WPS4Graph::~WPS4Graph
~WPS4Graph()
destructor
Definition: WPS4Graph.cpp:75
WPSPosition::WDynamic
Definition: WPSPosition.h:45

Generated on Mon Jan 20 2020 20:05:54 for libwps by doxygen 1.8.16