FullWrtGraph.hxx Source File documentation

FullWrtGraph.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 /* libmwaw
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 * Parser to FullWrite Text document ( graphic part )
36 *
37 */
38 #ifndef FULL_WRT_GRAPH
39 # define FULL_WRT_GRAPH
40
41 #include <string>
42 #include <vector>
43
44 #include <librevenge/librevenge.h>
45
46 #include "libmwaw_internal.hxx"
47
48 #include "MWAWDebug.hxx"
49 #include "MWAWInputStream.hxx"
50
51 #include "FullWrtStruct.hxx"
52
53 namespace FullWrtGraphInternal
54 {
55 struct SideBar;
56 struct State;
57 class SubDocument;
58 }
59
60 class FullWrtParser;
61
67 class FullWrtGraph
68 {
69 friend class FullWrtParser;
70 friend class FullWrtGraphInternal::SubDocument;
71
72 public:
74 explicit FullWrtGraph(FullWrtParser &parser);
76 virtual ~FullWrtGraph();
77
79 int version() const;
80
82 int numPages() const;
83
84 protected:
86 void flushExtra();
87
89 bool sendPageGraphics();
90
92 bool getBorder(int bId, FullWrtStruct::Border &border) const;
93
94 //
95 // Intermediate level
96 //
97
98 // interface with main parser
99
101 bool send(int fileId, MWAWColor const &fontColor);
102
103 //
104 // low level
105 //
106
108 bool readBorderDocInfo(FullWrtStruct::EntryPtr zone);
109
111 std::shared_ptr<FullWrtStruct::ZoneHeader> readSideBar
112 (FullWrtStruct::EntryPtr zone, FullWrtStruct::ZoneHeader const &doc);
114 bool readSideBarPosition(FullWrtStruct::EntryPtr zone, FullWrtGraphInternal::SideBar &frame);
116 bool readSideBarFormat(FullWrtStruct::EntryPtr zone, FullWrtGraphInternal::SideBar &frame);
118 bool readSideBarUnknown(FullWrtStruct::EntryPtr zone, FullWrtGraphInternal::SideBar &frame);
120 bool sendSideBar(FullWrtGraphInternal::SideBar const &frame);
122 bool readGraphic(FullWrtStruct::EntryPtr zone);
124 bool sendGraphic(int fId);
126 bool sendGraphic(FullWrtStruct::EntryPtr zone);
127
129 std::shared_ptr<FullWrtStruct::ZoneHeader> readGraphicData
130 (FullWrtStruct::EntryPtr zone, FullWrtStruct::ZoneHeader &doc);
131 private:
132 FullWrtGraph(FullWrtGraph const &orig) = delete;
133 FullWrtGraph &operator=(FullWrtGraph const &orig) = delete;
134
135 protected:
136 //
137 // data
138 //
140 MWAWParserStatePtr m_parserState;
141
143 std::shared_ptr<FullWrtGraphInternal::State> m_state;
144
146 FullWrtParser *m_mainParser;
147 };
148 #endif
149 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWTextListenerPtr
std::shared_ptr< MWAWTextListener > MWAWTextListenerPtr
a smart pointer of MWAWTextListener
Definition: libmwaw_internal.hxx:567
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
FullWrtGraphInternal::SideBar::m_box
MWAWBox2f m_box
the position (in point)
Definition: FullWrtGraph.cxx:66
MWAW_DEBUG_MSG
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:129
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:842
FullWrtGraphInternal::SideBar::m_page
int m_page
the page
Definition: FullWrtGraph.cxx:68
libmwaw::DebugFile::addDelimiter
void addDelimiter(long pos, char c)
adds a not breaking delimiter in position pos
Definition: MWAWDebug.cxx:73
FullWrtStruct
a namespace use to define common structure in a FullWrite file
Definition: FullWrtStruct.cxx:43
FullWrtGraph::~FullWrtGraph
virtual ~FullWrtGraph()
destructor
Definition: FullWrtGraph.cxx:170
FullWrtStruct::ZoneHeader::m_type
int m_type
the zone type
Definition: FullWrtStruct.hxx:172
MWAWPosition::setRelativePosition
void setRelativePosition(AnchorTo anchor, XPos X=XLeft, YPos Y=YTop)
sets the relative position
Definition: MWAWPosition.hxx:237
MWAWPosition::setPage
void setPage(int pg) const
sets the page
Definition: MWAWPosition.hxx:205
FullWrtGraph::readSideBar
std::shared_ptr< FullWrtStruct::ZoneHeader > readSideBar(FullWrtStruct::EntryPtr zone, FullWrtStruct::ZoneHeader const &doc)
try to read a sidebar data (zone 13 or zone 14)
Definition: FullWrtGraph.cxx:275
MWAWPosition::WBackground
@ WBackground
Definition: MWAWPosition.hxx:53
FullWrtStruct::ZoneHeader::m_fileId
int m_fileId
the file id
Definition: FullWrtStruct.hxx:176
FullWrtGraphInternal::SubDocument::m_id
int m_id
the zone file id
Definition: FullWrtGraph.cxx:126
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:192
MWAWEmbeddedObject
small class use to define a embedded object
Definition: libmwaw_internal.hxx:467
FullWrtStruct::ZoneHeader::ZoneHeader
ZoneHeader()
constructor
Definition: FullWrtStruct.hxx:158
MWAWSubDocumentPtr
std::shared_ptr< MWAWSubDocument > MWAWSubDocumentPtr
a smart pointer of MWAWSubDocument
Definition: libmwaw_internal.hxx:565
FullWrtStruct::Border
Internal: class to store a border which appear in docInfo.
Definition: FullWrtStruct.hxx:60
FullWrtGraph::sendGraphic
bool sendGraphic(int fId)
send a graphic knowing the graphic fileId
Definition: FullWrtGraph.cxx:694
MWAWPosition::WDynamic
@ WDynamic
Definition: MWAWPosition.hxx:53
FullWrtGraphInternal::SubDocument::SubDocument
SubDocument(FullWrtGraph &pars, int id, MWAWColor fontColor)
constructor
Definition: FullWrtGraph.cxx:107
MWAWPictData::get
static MWAWPictData * get(MWAWInputStreamPtr const &input, int size)
checks if the data pointed by input is known
Definition: MWAWPictData.hxx:108
FullWrtGraph::readSideBarUnknown
bool readSideBarUnknown(FullWrtStruct::EntryPtr zone, FullWrtGraphInternal::SideBar &frame)
try to read the sidebar third zone
Definition: FullWrtGraph.cxx:483
libmwaw::DebugFile::addNote
void addNote(char const *note)
adds a note in the file, in actual position
Definition: MWAWDebug.cxx:59
MWAWSubDocument
abstract class used to store a subdocument (with a comparison function)
Definition: MWAWSubDocument.hxx:41
FullWrtGraphInternal::SubDocument
Internal: the subdocument of a FullWrtGraph.
Definition: FullWrtGraph.cxx:103
MWAWGraphicStyle
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:47
FullWrtGraph::readSideBarPosition
bool readSideBarPosition(FullWrtStruct::EntryPtr zone, FullWrtGraphInternal::SideBar &frame)
try to read the sidebar position zone
Definition: FullWrtGraph.cxx:356
FullWrtGraphInternal
Internal: the structures of a FullWrtGraph.
Definition: FullWrtGraph.cxx:54
MWAWPosition::setNaturalSize
void setNaturalSize(MWAWVec2f const &naturalSz)
sets the natural size (if known)
Definition: MWAWPosition.hxx:220
FullWrtGraphInternal::SideBar
Internal: the sidebar of a FullWrtGraph.
Definition: FullWrtGraph.cxx:58
MWAWSubDocument.hxx
FullWrtGraph::sendSideBar
bool sendSideBar(FullWrtGraphInternal::SideBar const &frame)
try to send a sidebar
Definition: FullWrtGraph.cxx:530
FullWrtParser::getDocumentTypeName
std::string getDocumentTypeName(int zId) const
returns a the type of a document zone ( mainly used for debugging)
Definition: FullWrtParser.cxx:366
libmwaw::SubDocumentType
SubDocumentType
Definition: libmwaw_internal.hxx:188
libmwaw::DebugFile::reset
void reset()
writes the current file and reset to zero
Definition: MWAWDebug.hxx:93
FullWrtGraphInternal::SubDocument::parse
void parse(MWAWListenerPtr &listener, libmwaw::SubDocumentType type) final
the parser function
Definition: FullWrtGraph.cxx:135
FullWrtParser
the main class to read a FullWrite file
Definition: FullWrtParser.hxx:66
libmwaw::DebugFile::skipZone
void skipZone(long beginPos, long endPos)
skips the file zone defined by beginPos-endPos
Definition: MWAWDebug.hxx:113
MWAWVec2::y
T y() const
second element
Definition: libmwaw_internal.hxx:673
libmwaw::Debug::dumpFile
bool dumpFile(librevenge::RVNGBinaryData &data, char const *fileName)
a debug function to store in a datafile in the current directory WARNING: this function erase the fil...
Definition: MWAWDebug.cxx:193
libmwaw_internal.hxx
MWAWPosition.hxx
MWAWVec2::x
T x() const
first element
Definition: libmwaw_internal.hxx:668
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: MWAWPosition.hxx:47
FullWrtParser.hxx
MWAWPosition::m_wrapping
Wrapping m_wrapping
Wrapping.
Definition: MWAWPosition.hxx:278
FullWrtGraphInternal::SubDocument::~SubDocument
~SubDocument() final
destructor
Definition: FullWrtGraph.cxx:114
MWAWPictData.hxx
MWAWPict::MWAW_R_BAD
@ MWAW_R_BAD
Definition: MWAWPict.hxx:73
MWAWVec2< float >
MWAWDebug.hxx
MWAWBox2f
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition: libmwaw_internal.hxx:1193
FullWrtGraphInternal::State::m_sidebarList
std::vector< std::shared_ptr< SideBar > > m_sidebarList
the sidebar list
Definition: FullWrtGraph.cxx:93
FullWrtStruct::ZoneHeader
a structure used to store the data of a zone header in a FullWrite file
Definition: FullWrtStruct.hxx:156
FullWrtGraph::readGraphic
bool readGraphic(FullWrtStruct::EntryPtr zone)
check if a zone is a graphic zone
Definition: FullWrtGraph.cxx:635
FullWrtGraphInternal::State
Internal: the state of a FullWrtGraph.
Definition: FullWrtGraph.cxx:81
MWAWPosition::Char
@ Char
Definition: MWAWPosition.hxx:51
FullWrtGraphInternal::SideBar::m_parsed
bool m_parsed
a flag to know if the sidebar is send to the listener
Definition: FullWrtGraph.cxx:72
FullWrtGraphInternal::SideBar::SideBar
SideBar(FullWrtStruct::ZoneHeader const &header)
constructor
Definition: FullWrtGraph.cxx:60
MWAWPictData::check
static ReadResult check(MWAWInputStreamPtr const &input, int size, MWAWBox2f &box)
checks if the data pointed by input is known
Definition: MWAWPictData.hxx:100
FullWrtGraph::readSideBarFormat
bool readSideBarFormat(FullWrtStruct::EntryPtr zone, FullWrtGraphInternal::SideBar &frame)
try to read the sidebar second zone
Definition: FullWrtGraph.cxx:423
FullWrtGraph::m_mainParser
FullWrtParser * m_mainParser
the main parser;
Definition: FullWrtGraph.hxx:146
FullWrtStruct::Border::m_frontColor
MWAWColor m_frontColor
the front color (used for layout )
Definition: FullWrtStruct.hxx:95
FullWrtGraphInternal::State::m_graphicMap
std::multimap< int, FullWrtStruct::EntryPtr > m_graphicMap
zoneId -> graphic entry
Definition: FullWrtGraph.cxx:95
FullWrtParser::getPageLeftTop
MWAWVec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition: FullWrtParser.cxx:350
FullWrtStruct::Border::addTo
void addTo(MWAWGraphicStyle &style) const
add to frame properties
Definition: FullWrtStruct.cxx:127
FullWrtGraph::readGraphicData
std::shared_ptr< FullWrtStruct::ZoneHeader > readGraphicData(FullWrtStruct::EntryPtr zone, FullWrtStruct::ZoneHeader &doc)
try to read the graphic data
Definition: FullWrtGraph.cxx:556
FullWrtGraph::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: FullWrtGraph.cxx:785
MWAWTextListener.hxx
FullWrtGraph::send
bool send(int fileId, MWAWColor const &fontColor)
try to send the child of a zone
Definition: FullWrtGraph.cxx:206
FullWrtGraph.hxx
FullWrtGraphInternal::SubDocument::m_graphParser
FullWrtGraph * m_graphParser
the graph parser
Definition: FullWrtGraph.cxx:124
FullWrtGraphInternal::State::State
State()
constructor
Definition: FullWrtGraph.cxx:83
MWAWPosition::Page
@ Page
Definition: MWAWPosition.hxx:51
FullWrtStruct::Border::read
bool read(std::shared_ptr< FullWrtStruct::Entry > zone, int fSz)
try to read a border definiton
Definition: FullWrtStruct.cxx:142
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
FullWrtStruct::ZoneHeader::m_wrapping
int m_wrapping
the wrapping type
Definition: FullWrtStruct.hxx:178
FullWrtGraphInternal::SideBar::~SideBar
~SideBar() final
destructor
Definition: FullWrtGraph.cxx:75
libmwaw::DebugFile::addPos
void addPos(long pos)
adds a new position in the file
Definition: MWAWDebug.cxx:53
FullWrtStruct::ZoneHeader::read
bool read(std::shared_ptr< FullWrtStruct::Entry > zone)
try to read the data header of a classical zone
Definition: FullWrtStruct.cxx:419
FullWrtGraph::readBorderDocInfo
bool readBorderDocInfo(FullWrtStruct::EntryPtr zone)
try to read the border definiton (at the end of doc info)
Definition: FullWrtGraph.cxx:223
FullWrtGraphInternal::State::m_borderList
std::vector< FullWrtStruct::Border > m_borderList
a list of border
Definition: FullWrtGraph.cxx:97
MWAWBox2::size
MWAWVec2< T > size() const
the box size
Definition: libmwaw_internal.hxx:1067
FullWrtGraph::FullWrtGraph
FullWrtGraph(FullWrtParser &parser)
constructor
Definition: FullWrtGraph.cxx:163
libmwaw::DebugFile
an interface used to insert comment in a binary file, written in ascii form (if debug_with_files is n...
Definition: MWAWDebug.hxx:65
FullWrtGraph::numPages
int numPages() const
returns the number of pages
Definition: FullWrtGraph.cxx:181
FullWrtGraphInternal::State::m_version
int m_version
the file version
Definition: FullWrtGraph.cxx:91
MWAWInputStream.hxx
FullWrtGraph::operator=
FullWrtGraph & operator=(FullWrtGraph const &orig)=delete
FullWrtGraphInternal::SubDocument::operator!=
bool operator!=(MWAWSubDocument const &doc) const final
operator!=
Definition: FullWrtGraph.cxx:148
MWAWListenerPtr
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:553
FullWrtStruct.hxx
FullWrtGraphInternal::SubDocument::m_fontColor
MWAWColor m_fontColor
the default font color
Definition: FullWrtGraph.cxx:128
FullWrtGraph::m_state
std::shared_ptr< FullWrtGraphInternal::State > m_state
the state
Definition: FullWrtGraph.hxx:143
MWAWBox2< float >
FullWrtGraphInternal::SideBar::m_borderId
int m_borderId
the border id
Definition: FullWrtGraph.cxx:70
FullWrtGraph::sendPageGraphics
bool sendPageGraphics()
try to send the page graphic
Definition: FullWrtGraph.cxx:774
libmwaw::DebugStream
std::stringstream DebugStream
a basic stream (if debug_with_files is not defined, does nothing)
Definition: MWAWDebug.hxx:61
FullWrtGraph::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: FullWrtGraph.hxx:140
FullWrtGraph::getBorder
bool getBorder(int bId, FullWrtStruct::Border &border) const
try to return a border corresponding to an id
Definition: FullWrtGraph.cxx:195
FullWrtGraph::version
int version() const
returns the file version
Definition: FullWrtGraph.cxx:174
FullWrtGraph
the main class to read the graphic part of a FullWrite Text file
Definition: FullWrtGraph.hxx:67
FullWrtStruct::EntryPtr
std::shared_ptr< Entry > EntryPtr
Definition: FullWrtStruct.hxx:153
FullWrtParser::send
bool send(int fileId, MWAWColor fontColor=MWAWColor::black())
ask the text parser to send a zone
Definition: FullWrtParser.cxx:387