PowerPoint7Text.hxx Source File documentation

PowerPoint7Text.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 PowerPoint 95 document ( text part )
36 *
37 */
38 #ifndef POWER_POINT7_TEXT
39 # define POWER_POINT7_TEXT
40
41 #include <set>
42 #include <string>
43 #include <vector>
44
45 #include <librevenge/librevenge.h>
46
47 #include "libmwaw_internal.hxx"
48
49 #include "MWAWDebug.hxx"
50 #include "MWAWInputStream.hxx"
51
52 namespace PowerPoint7TextInternal
53 {
54 struct Ruler;
55 struct TextZone;
56
57 struct State;
58 }
59
60 class PowerPoint7Parser;
61
67 class PowerPoint7Text
68 {
69 friend class PowerPoint7Parser;
70
71 public:
73 explicit PowerPoint7Text(PowerPoint7Parser &parser);
75 virtual ~PowerPoint7Text();
76
78 int version() const;
80 void setFontFamily(std::string const &family);
82 bool sendText(int textId);
83
84 protected:
86 bool readFontCollection(int level, long endPos);
88 bool readFieldList(int level, long endPos);
90 bool readTextZoneContainer(int level, long endPos, PowerPoint7TextInternal::TextZone &zone);
92 bool readTextZone(int level, long endPos, PowerPoint7TextInternal::TextZone &zone);
93
95 bool readTextMasterProp(int level, long endPos, int &textId);
97 bool readTextMasterPropAtom(int level, long endPos);
99 bool readRulerList(int level, long endPos);
101 bool readRuler(int level, long endPos, PowerPoint7TextInternal::Ruler &ruler);
103 bool readRulerSetId(int level, long endPos, int &id);
105 bool readFontContainer(int level, long endPos, std::string &fName);
107 bool readFont(int level, long endPos, std::string &fName);
109 bool readFontEmbedded(int level, long endPos);
111 bool readExternalHyperlinkAtom(int level, long endPos);
113 bool readExternalHyperlinkData(int level, long endPos);
115 bool readFieldDef(int level, long endPos, int &format);
117 bool readZone4064(int level, long endPos,int rId,int &textId);
119 bool readZone4066(int level, long endPos);
121 bool readZone4067(int level, long endPos);
123 bool readExternalHyperlink9(int level, long endPos, int &tId);
125 bool readRulerContainer(int level, long endPos, PowerPoint7TextInternal::Ruler &ruler);
127 bool readRulerTabs(int level, long endPos, PowerPoint7TextInternal::Ruler &ruler);
128
129 //
130 // Intermediate level
131 //
132
133 //
134 // low level
135 //
136
137 private:
138 PowerPoint7Text(PowerPoint7Text const &orig) = delete;
139 PowerPoint7Text &operator=(PowerPoint7Text const &orig) = delete;
140
141 protected:
142 //
143 // data
144 //
146 MWAWParserStatePtr m_parserState;
147
149 std::shared_ptr<PowerPoint7TextInternal::State> m_state;
150
152 PowerPoint7Parser *m_mainParser;
153 };
154 #endif
155 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:47
MWAWField::Time
@ Time
Definition: libmwaw_internal.hxx:401
MWAWParagraph::m_justify
MWAWVariable< Justification > m_justify
the justification
Definition: MWAWParagraph.hxx:167
PowerPoint7TextInternal::TextZone
Internal: a text zone of a PowerPoint7Text.
Definition: PowerPoint7Text.cxx:84
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
MWAWFont::set
void set(Script const &newscript)
sets the script position
Definition: MWAWFont.hxx:314
PowerPoint7TextInternal::Ruler::Ruler
Ruler()
constructor
Definition: PowerPoint7Text.cxx:61
PowerPoint7Text::readZone4064
bool readZone4064(int level, long endPos, int rId, int &textId)
try to read the zone 4064: child of MasterTextPropAtom,ExternalHyperlink9
Definition: PowerPoint7Text.cxx:985
MWAWListLevel::m_spanId
int m_spanId
the style span id
Definition: MWAWList.hxx:116
PowerPoint7Text::readTextZoneContainer
bool readTextZoneContainer(int level, long endPos, PowerPoint7TextInternal::TextZone &zone)
try to read a text zone container, zone 2028
Definition: PowerPoint7Text.cxx:235
MWAW_DEBUG_MSG
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:129
PowerPoint7Text::readTextMasterProp
bool readTextMasterProp(int level, long endPos, int &textId)
try to read the master text prop atom zone 4002
Definition: PowerPoint7Text.cxx:650
libmwaw::DebugFile::addDelimiter
void addDelimiter(long pos, char c)
adds a not breaking delimiter in position pos
Definition: MWAWDebug.cxx:73
PowerPoint7Text::readZone4066
bool readZone4066(int level, long endPos)
try to read the zone 4066: child of 4064
Definition: PowerPoint7Text.cxx:1051
PowerPoint7Text::readRuler
bool readRuler(int level, long endPos, PowerPoint7TextInternal::Ruler &ruler)
try to read the ruler margins zone 4019
Definition: PowerPoint7Text.cxx:1265
MWAWParagraph::m_tabs
MWAWVariable< std::vector< MWAWTabStop > > m_tabs
the tabulations
Definition: MWAWParagraph.hxx:162
PowerPoint7Text::readRulerContainer
bool readRulerContainer(int level, long endPos, PowerPoint7TextInternal::Ruler &ruler)
try to read the ruler container zone: 4069
Definition: PowerPoint7Text.cxx:1311
MWAWField::m_DTFormat
std::string m_DTFormat
the date/time format using strftime format if defined
Definition: libmwaw_internal.hxx:424
MWAWFont::id
int id() const
returns the font id
Definition: MWAWFont.hxx:259
MWAWFont::boldBit
@ boldBit
Definition: MWAWFont.hxx:190
MWAWParagraph::m_listLevelIndex
MWAWVariable< int > m_listLevelIndex
the actual level index
Definition: MWAWParagraph.hxx:174
MWAWFont::setColor
void setColor(MWAWColor color)
sets the font color
Definition: MWAWFont.hxx:341
MWAWTabStop::CENTER
@ CENTER
Definition: MWAWParagraph.hxx:48
PowerPoint7Text.hxx
MWAWParagraph::setInterline
void setInterline(double value, librevenge::RVNGUnit unit, LineSpacingType type=Fixed)
set the interline
Definition: MWAWParagraph.hxx:129
PowerPoint7TextInternal::Ruler
Internal: a ruler of a PowerPoint7Text.
Definition: PowerPoint7Text.cxx:59
PowerPoint7Text::readFieldList
bool readFieldList(int level, long endPos)
try to read the field definition list zone 2027
Definition: PowerPoint7Text.cxx:1418
PowerPoint7Struct::Zone::m_type
int m_type
the type
Definition: PowerPoint7Struct.hxx:131
PowerPoint7TextInternal::TextZone::m_posToRulerMap
std::map< long, Ruler > m_posToRulerMap
a map position to ruler
Definition: PowerPoint7Text.cxx:106
MWAWFontConverter.hxx
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:192
libmwaw::appendUnicode
void appendUnicode(uint32_t val, librevenge::RVNGString &buffer)
adds an unicode character to a string
Definition: libmwaw_internal.cxx:63
PowerPoint7TextInternal::Ruler::updateParagraph
void updateParagraph(int level)
returns a paragraph corresponding to a level
Definition: PowerPoint7Text.cxx:67
PowerPoint7Text::PowerPoint7Text
PowerPoint7Text(PowerPoint7Parser &parser)
constructor
Definition: PowerPoint7Text.cxx:138
MWAWParagraph::m_spacings
MWAWVariable< double > m_spacings[3]
the line spacing
Definition: MWAWParagraph.hxx:156
PowerPoint7Text::~PowerPoint7Text
virtual ~PowerPoint7Text()
destructor
Definition: PowerPoint7Text.cxx:145
PowerPoint7TextInternal::TextZone::m_textEntry
MWAWEntry m_textEntry
the list of text zone
Definition: PowerPoint7Text.cxx:100
PowerPoint7Text::readTextZone
bool readTextZone(int level, long endPos, PowerPoint7TextInternal::TextZone &zone)
try to read a text zone 2030
Definition: PowerPoint7Text.cxx:280
MWAWParagraph
class to store the paragraph properties
Definition: MWAWParagraph.hxx:85
MWAWParagraph::m_listLevel
MWAWVariable< MWAWListLevel > m_listLevel
the actual level
Definition: MWAWParagraph.hxx:180
MWAWFont::Line::Simple
@ Simple
Definition: MWAWFont.hxx:49
PowerPoint7Text::readFontEmbedded
bool readFontEmbedded(int level, long endPos)
try to read an embedded font container zone 4024
Definition: PowerPoint7Text.cxx:892
PowerPoint7Text::PowerPoint7Text
PowerPoint7Text(PowerPoint7Text const &orig)=delete
libmwaw::DebugFile::addNote
void addNote(char const *note)
adds a note in the file, in actual position
Definition: MWAWDebug.cxx:59
PowerPoint7TextInternal::State::m_fieldIdToFormatIdMap
std::map< int, int > m_fieldIdToFormatIdMap
a field id to format id map
Definition: PowerPoint7Text.cxx:129
PowerPoint7TextInternal::TextZone::isEmpty
bool isEmpty() const
returns true if the zone contain no text
Definition: PowerPoint7Text.cxx:95
MWAWParagraph::m_margins
MWAWVariable< double > m_margins[3]
the margins
Definition: MWAWParagraph.hxx:148
PowerPoint7TextInternal::State
Internal: the state of a PowerPoint7Text.
Definition: PowerPoint7Text.cxx:113
MWAWTabStop::DECIMAL
@ DECIMAL
Definition: MWAWParagraph.hxx:48
PowerPoint7TextInternal::TextZone::m_posToFontMap
std::map< long, MWAWFont > m_posToFontMap
a map position to font
Definition: PowerPoint7Text.cxx:104
MWAWFont::embossBit
@ embossBit
Definition: MWAWFont.hxx:190
PowerPoint7Text::readExternalHyperlinkData
bool readExternalHyperlinkData(int level, long endPos)
try to read the external hyper link atom zone: 4055
Definition: PowerPoint7Text.cxx:952
MWAWField::Date
@ Date
Definition: libmwaw_internal.hxx:401
MWAWPresentationListener.hxx
PowerPoint7TextInternal::State::m_fileIdFontIdMap
std::map< int, int > m_fileIdFontIdMap
a local id to final id font map
Definition: PowerPoint7Text.cxx:125
PowerPoint7TextInternal::TextZone::m_rulerId
int m_rulerId
the ruler identifier
Definition: PowerPoint7Text.cxx:102
PowerPoint7TextInternal::State::m_idToRulerMap
std::map< int, Ruler > m_idToRulerMap
a local id to ruler id map
Definition: PowerPoint7Text.cxx:127
MWAWTabStop
class to store a tab use by MWAWParagraph
Definition: MWAWParagraph.hxx:46
PowerPoint7Parser::readZone
bool readZone(int level, long endPos)
try to read a zone
Definition: PowerPoint7Parser.cxx:2710
PowerPoint7Text::readRulerTabs
bool readRulerTabs(int level, long endPos, PowerPoint7TextInternal::Ruler &ruler)
try to read the tab list zone: 4070
Definition: PowerPoint7Text.cxx:1360
PowerPoint7Parser
the main class to read a Microsoft PowerPoint 95 files (Windows)
Definition: PowerPoint7Parser.hxx:62
PowerPoint7Struct::Zone
a zone header of a PowerPoint7Parser
Definition: PowerPoint7Struct.hxx:107
MWAWParagraph::JustificationCenter
@ JustificationCenter
Definition: MWAWParagraph.hxx:90
MWAWFont::shadowBit
@ shadowBit
Definition: MWAWFont.hxx:191
MWAWParagraph.hxx
libmwaw_internal.hxx
MWAWPosition.hxx
PowerPoint7Text
the main class to read the text part of a PowerPoint 95 file
Definition: PowerPoint7Text.hxx:68
PowerPoint7Text::setFontFamily
void setFontFamily(std::string const &family)
sets the default font family
Definition: PowerPoint7Text.cxx:153
PowerPoint7Text::readExternalHyperlink9
bool readExternalHyperlink9(int level, long endPos, int &tId)
try to read the external hyper link zone: 4068
Definition: PowerPoint7Text.cxx:1142
PowerPoint7Parser.hxx
MWAWEntry::setBegin
void setBegin(long off)
sets the begin offset
Definition: MWAWEntry.hxx:67
MWAWColor::isBlack
bool isBlack() const
return true if the color is black
Definition: libmwaw_internal.hxx:284
PowerPoint7Text::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: PowerPoint7Text.hxx:146
PowerPoint7Text::version
int version() const
returns the file version
Definition: PowerPoint7Text.cxx:148
MWAWTabStop::m_alignment
Alignment m_alignment
the alignment ( left, center, ...)
Definition: MWAWParagraph.hxx:76
PowerPoint7Text::readFontCollection
bool readFontCollection(int level, long endPos)
try to read the font collection zone 2005
Definition: PowerPoint7Text.cxx:163
MWAWDebug.hxx
MWAWFont::getDebugString
std::string getDebugString(std::shared_ptr< MWAWFontConverter > &converter) const
returns a string which can be used for debugging
Definition: MWAWFont.cxx:181
PowerPoint7Text::m_state
std::shared_ptr< PowerPoint7TextInternal::State > m_state
the state
Definition: PowerPoint7Text.hxx:149
MWAWEntry::begin
long begin() const
returns the begin offset
Definition: MWAWEntry.hxx:83
MWAWEntry::setLength
void setLength(long l)
sets the zone size
Definition: MWAWEntry.hxx:72
MWAWColor::black
static MWAWColor black()
return the back color
Definition: libmwaw_internal.hxx:245
PowerPoint7Text::readFont
bool readFont(int level, long endPos, std::string &fName)
try to read the font entity atom zone 4023
Definition: PowerPoint7Text.cxx:850
MWAWTabStop::m_position
double m_position
the tab position
Definition: MWAWParagraph.hxx:74
MWAWFont::setId
void setId(int newId)
sets the font id
Definition: MWAWFont.hxx:264
PowerPoint7Struct::Zone::read
bool read(MWAWInputStreamPtr stream, long endPos=-1)
try to read a zone header
Definition: PowerPoint7Struct.cxx:38
PowerPoint7Text::readFieldDef
bool readFieldDef(int level, long endPos, int &format)
try to read the field definition zone 4056
Definition: PowerPoint7Text.cxx:1482
PowerPoint7Struct.hxx
MWAWField
a field
Definition: libmwaw_internal.hxx:399
MWAWField::PageNumber
@ PageNumber
Definition: libmwaw_internal.hxx:401
PowerPoint7Parser::getColor
bool getColor(int cId, MWAWColor &col) const
returns the color corresponding to an id
Definition: PowerPoint7Parser.cxx:194
PowerPoint7Text::sendText
bool sendText(int textId)
try to send the text content
Definition: PowerPoint7Text.cxx:1526
PowerPoint7TextInternal::TextZone::TextZone
TextZone()
constructor
Definition: PowerPoint7Text.cxx:86
MWAWEntry::end
long end() const
returns the end offset
Definition: MWAWEntry.hxx:88
MWAWFont::setSize
void setSize(float sz, bool isRelative=false)
sets the font size
Definition: MWAWFont.hxx:275
MWAWListLevel::m_bullet
librevenge::RVNGString m_bullet
the bullet if we have an bullet level
Definition: MWAWList.hxx:114
MWAWBox2i
MWAWBox2< int > MWAWBox2i
MWAWBox2 of int.
Definition: libmwaw_internal.hxx:1191
PowerPoint7Text::readExternalHyperlinkAtom
bool readExternalHyperlinkAtom(int level, long endPos)
try to read the external hyper link atom zone: 4051
Definition: PowerPoint7Text.cxx:919
MWAWFont::italicBit
@ italicBit
Definition: MWAWFont.hxx:190
MWAWParagraph::m_marginsUnit
MWAWVariable< librevenge::RVNGUnit > m_marginsUnit
the margins INCH, ...
Definition: MWAWParagraph.hxx:150
MWAWListLevel::BULLET
@ BULLET
Definition: MWAWList.hxx:46
PowerPoint7Parser::readZoneNoData
bool readZoneNoData(int level, long endPos, std::string const &name, std::string const &wh="")
try to read a zone with no data
Definition: PowerPoint7Parser.cxx:2682
MWAWParagraph::JustificationFull
@ JustificationFull
Definition: MWAWParagraph.hxx:90
MWAWParagraph::JustificationRight
@ JustificationRight
Definition: MWAWParagraph.hxx:91
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
PowerPoint7Text::readRulerSetId
bool readRulerSetId(int level, long endPos, int &id)
try to read the ruler set id zone 4021
Definition: PowerPoint7Text.cxx:767
MWAWListLevel
small structure to keep information about a list level
Definition: MWAWList.hxx:44
libmwaw::DebugFile::addPos
void addPos(long pos)
adds a new position in the file
Definition: MWAWDebug.cxx:53
MWAWListLevel::m_type
Type m_type
the type of the level
Definition: MWAWList.hxx:101
MWAWEntry::valid
bool valid() const
returns true if the zone length is positive
Definition: MWAWEntry.hxx:99
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:66
PowerPoint7Text::readTextMasterPropAtom
bool readTextMasterPropAtom(int level, long endPos)
try to read the text master prop atom zone 4003
Definition: PowerPoint7Text.cxx:716
PowerPoint7TextInternal::TextZone::m_posToFieldFormatMap
std::map< long, int > m_posToFieldFormatMap
a map position to format
Definition: PowerPoint7Text.cxx:108
MWAWFont::Script
a small struct to define the script position in MWAWFont
Definition: MWAWFont.hxx:106
MWAWInputStream.hxx
PowerPoint7Text::operator=
PowerPoint7Text & operator=(PowerPoint7Text const &orig)=delete
MWAWListenerPtr
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:553
MWAWFont.hxx
PowerPoint7Text::readFontContainer
bool readFontContainer(int level, long endPos, std::string &fName)
try to read the font container zone 4022
Definition: PowerPoint7Text.cxx:798
PowerPoint7TextInternal::Ruler::m_margins
int m_margins[10]
the left/first margins * 5 (0: normal, 1-4: level)
Definition: PowerPoint7Text.cxx:80
MWAWTabStop::RIGHT
@ RIGHT
Definition: MWAWParagraph.hxx:48
MWAWFont
Class to store font.
Definition: MWAWFont.hxx:44
PowerPoint7TextInternal::State::m_textZoneList
std::vector< std::shared_ptr< TextZone > > m_textZoneList
the list of text zone
Definition: PowerPoint7Text.cxx:131
PowerPoint7Parser::readIdentifier
bool readIdentifier(int level, long endPos, int &id, std::string const &wh)
try to read an identifier zone 2017
Definition: PowerPoint7Parser.cxx:1633
PowerPoint7TextInternal
Internal: the structures of a PowerPoint7Text.
Definition: PowerPoint7Text.cxx:57
PowerPoint7TextInternal::State::m_fontFamily
std::string m_fontFamily
the basic pc font family if known
Definition: PowerPoint7Text.cxx:123
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition: libmwaw_internal.hxx:838
libmwaw::DebugStream
std::stringstream DebugStream
a basic stream (if debug_with_files is not defined, does nothing)
Definition: MWAWDebug.hxx:61
MWAWParser.hxx
PowerPoint7Struct::Zone::m_dataSize
long m_dataSize
the data size
Definition: PowerPoint7Struct.hxx:133
PowerPoint7Text::m_mainParser
PowerPoint7Parser * m_mainParser
the main parser;
Definition: PowerPoint7Text.hxx:152
MWAWFont::setUnderlineStyle
void setUnderlineStyle(Line::Style style=Line::None, bool doReset=true)
sets the underline style ( by default, we also reset the style)
Definition: MWAWFont.hxx:466
PowerPoint7TextInternal::State::State
State()
constructor
Definition: PowerPoint7Text.cxx:115
PowerPoint7TextInternal::Ruler::m_paragraph
MWAWParagraph m_paragraph
the paragraph
Definition: PowerPoint7Text.cxx:78
MWAWFont::setFlags
void setFlags(uint32_t fl)
sets the font attributes bold, ...
Definition: MWAWFont.hxx:325
PowerPoint7Text::readRulerList
bool readRulerList(int level, long endPos)
try to read the list of rulers zone 4016
Definition: PowerPoint7Text.cxx:1201
PowerPoint7Text::readZone4067
bool readZone4067(int level, long endPos)
try to read the zone 4067: child of 4064
Definition: PowerPoint7Text.cxx:1095