PocketWord.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) 2020 Laurent Alonso (alonso.laurent@gmail.com)
11 *
12 * For minor contributions see the git repository.
13 *
14 * Alternatively, the contents of this file may be used under the terms
15 * of the GNU Lesser General Public License Version 2.1 or later
16 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
17 * applicable instead of those above.
18 *
19 * For further information visit http://libwps.sourceforge.net
20 */
21
22#ifndef POCKET_WORD_H
23#define POCKET_WORD_H
24
25#include <memory>
26#include <set>
27#include <vector>
28
29#include <librevenge-stream/librevenge-stream.h>
30#include "libwps_internal.h"
31#include "libwps_tools_win.h"
32
33#include "WPSParser.h"
34
36{
37class Graphic;
38class Shape;
39class SubDocument;
40
41struct State;
42}
43
49{
51
52public:
57 ~PocketWordParser() override;
59 void parse(librevenge::RVNGTextInterface *documentInterface) override;
61 bool checkHeader(WPSHeader *header, bool strict=false);
62
63private:
66
68 std::shared_ptr<WPSContentListener> createListener(librevenge::RVNGTextInterface *interface);
69
70protected:
72 bool createZones();
74 bool readDrawing(WPSEntry const &entry, PocketWordParserInternal::Graphic &graphic);
76 bool readFontNames(WPSEntry const &entry);
78 bool readPageDims(WPSEntry const &entry);
80 bool readParagraphList(WPSEntry const &entry, std::vector<int> &paraId);
82 bool readParagraphDims(WPSEntry const &entry);
84 bool readLocalPicture(WPSEntry const &entry);
86 bool readSound(WPSEntry const &entry, WPSEmbeddedObject &object);
88 bool readSoundData(WPSEntry const &entry, long pictSize, WPSEmbeddedObject &object);
90 bool readShape(WPSEntry const &entry, int type, PocketWordParserInternal::Shape &shape);
92 bool readShape(int shapeId, PocketWordParserInternal::Shape &shape);
94 bool readUnkn8(WPSEntry const &entry);
96 bool readUnkn2021(WPSEntry const &entry, int type);
98 bool checkFilePosition(long pos) const;
100 void checkUnparsed();
101
103 void sendData();
105 bool sendParagraph(size_t paraId);
109 bool sendShape(int shapeId, WPSPosition const &pos, WPSTransformation const &transf, std::set<int> &alreadySend);
110
111 // State
112
114 std::shared_ptr<WPSContentListener> m_listener;
116 std::shared_ptr<PocketWordParserInternal::State> m_state;
117};
118
119#endif /* POCKET_WORD_H */
120/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
a graphic: a list of shape
Definition PocketWord.cpp:52
a shape
Definition PocketWord.cpp:72
void checkUnparsed()
try to parse the unparsed zones
Definition PocketWord.cpp:392
bool readPageDims(WPSEntry const &entry)
try to read the page dimension
Definition PocketWord.cpp:567
bool readUnkn8(WPSEntry const &entry)
try to read the unknown zone 8: one by file, maybe prefs
Definition PocketWord.cpp:1432
~PocketWordParser() override
destructor
Definition PocketWord.cpp:246
bool readLocalPicture(WPSEntry const &entry)
try to read a picture inserted as char: a list of polygons followed by a list of text
Definition PocketWord.cpp:1109
bool readShape(WPSEntry const &entry, int type, PocketWordParserInternal::Shape &shape)
try to read a shape: zone 103-107
Definition PocketWord.cpp:1605
bool readParagraphList(WPSEntry const &entry, std::vector< int > &paraId)
try to read a paragraph list
Definition PocketWord.cpp:1233
PocketWordParser(const PocketWordParser &)=delete
bool readSound(WPSEntry const &entry, WPSEmbeddedObject &object)
try to read a sound definition (maybe a picture)
Definition PocketWord.cpp:1283
void sendData()
try to send all the data
Definition PocketWord.cpp:1860
std::shared_ptr< PocketWordParserInternal::State > m_state
the main state
Definition PocketWord.h:116
bool readDrawing(WPSEntry const &entry, PocketWordParserInternal::Graphic &graphic)
try to read a drawing: a list of shapes: zone 131
Definition PocketWord.cpp:1524
bool sendShape(int shapeId, WPSPosition const &pos, WPSTransformation const &transf, std::set< int > &alreadySend)
try to send a shape
Definition PocketWord.cpp:1027
bool sendParagraph(size_t paraId)
try to read and send a paragraph
Definition PocketWord.cpp:666
void parse(librevenge::RVNGTextInterface *documentInterface) override
called by WPSDocument to parse the file
Definition PocketWord.cpp:295
std::shared_ptr< WPSContentListener > m_listener
the listener (if set)
Definition PocketWord.h:114
std::shared_ptr< WPSContentListener > createListener(librevenge::RVNGTextInterface *interface)
creates the main listener
Definition PocketWord.cpp:264
bool readParagraphDims(WPSEntry const &entry)
try to read a paragraph dimensions' zone which follows the paragraph zone
Definition PocketWord.cpp:1066
friend class PocketWordParserInternal::SubDocument
Definition PocketWord.h:50
bool createZones()
try to read the different zones
Definition PocketWord.cpp:335
bool readFontNames(WPSEntry const &entry)
try to read the font names
Definition PocketWord.cpp:478
bool sendDrawing(PocketWordParserInternal::Graphic const &graphic)
try to send a drawing, a list of shapes
Definition PocketWord.cpp:995
bool readUnkn2021(WPSEntry const &entry, int type)
try to read the unknown zone 20 and 21: one by file, find always no data, maybe style
Definition PocketWord.cpp:1491
PocketWordParser & operator=(const PocketWordParser &)=delete
PocketWordParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header, libwps_tools_win::Font::Type encoding=libwps_tools_win::Font::UNKNOWN)
constructor
Definition PocketWord.cpp:238
bool checkFilePosition(long pos) const
check if the file position is correct or not
Definition PocketWord.cpp:250
bool readSoundData(WPSEntry const &entry, long pictSize, WPSEmbeddedObject &object)
try to read a sound data (maybe a picture)
Definition PocketWord.cpp:1391
bool checkHeader(WPSHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition PocketWord.cpp:1808
basic class to store an entry in a file This contained :
Definition WPSEntry.h:39
Definition WPSHeader.h:32
WPSParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header)
Definition WPSParser.cpp:30
Class to define the position of an object (textbox, picture, ..) in the document.
Definition WPSPosition.h:40
a transformation which stored the first row of a 3x3 perspective matrix
Definition libwps_internal.h:1131
Type
enum Type
Definition libwps_tools_win.h:48
@ UNKNOWN
Definition libwps_tools_win.h:66
std::shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition libwps_internal.h:109
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition libwps_internal.h:87
Definition PocketWord.cpp:49
the state of PocketWord
Definition PocketWord.cpp:165
small class use to define a embedded object
Definition libwps_internal.h:1077

Generated on for libwps by doxygen 1.17.0