StarWriterStruct.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 /* libstaroffice
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  * StarWriterStruct to read/parse some basic writer structure in StarOffice documents
36  *
37  */
38 #ifndef STAR_WRITER_STRUCT
39 # define STAR_WRITER_STRUCT
40 
41 #include <ostream>
42 #include <vector>
43 
45 
46 #include "STOFFDebug.hxx"
47 
49 {
50 struct FormatDef;
51 }
52 class StarAttribute;
53 class StarObject;
54 class StarZone;
55 
57 namespace StarWriterStruct
58 {
61 struct Attribute {
62 public:
65  : m_attribute()
66  , m_position(-1,-1)
67  {
68  }
70  ~Attribute();
72  friend std::ostream &operator<<(std::ostream &o, Attribute const &attribute);
74  bool read(StarZone &zone, StarObject &object);
76  static bool readList(StarZone &zone, std::vector<Attribute> &attributeList, StarObject &object);
78  std::shared_ptr<StarAttribute> m_attribute;
81 };
82 
85 class Bookmark
86 {
87 public:
90  : m_shortName("")
91  , m_name("")
92  , m_offset(0)
93  , m_key(0)
94  , m_modifier(0)
95  {
96  }
98  friend std::ostream &operator<<(std::ostream &o, Bookmark const &mark);
100  bool read(StarZone &zone);
102  static bool readList(StarZone &zone, std::vector<Bookmark> &markList);
104  librevenge::RVNGString m_shortName;
106  librevenge::RVNGString m_name;
108  int m_offset;
110  int m_key;
114  librevenge::RVNGString m_macroNames[4];
115 };
116 
119 struct DatabaseName {
120 public:
123  : m_sql("")
124  , m_dataList()
125  {
126  }
128  friend std::ostream &operator<<(std::ostream &o, DatabaseName const &databaseName);
130  bool read(StarZone &zone);
132  struct Data {
135  : m_name("")
136  , m_selection(0,0)
137  {
138  }
140  friend std::ostream &operator<<(std::ostream &o, Data const &data)
141  {
142  o << data.m_name.cstr() << ",";
143  if (data.m_selection!=STOFFVec2i(0,0)) o << "select=" << STOFFVec2i(0,0) << ",";
144  return o;
145  }
147  librevenge::RVNGString m_name;
150  };
152  librevenge::RVNGString m_names[2];
154  librevenge::RVNGString m_sql;
156  std::vector<Data> m_dataList;
157 };
158 
161 struct Dictionary {
162 public:
165  : m_dataList()
166  {
167  }
169  friend std::ostream &operator<<(std::ostream &o, Dictionary const &dictionary);
171  bool read(StarZone &zone);
173  struct Data {
176  : m_name("")
177  , m_language(0)
178  , m_id(0)
179  , m_spellWrong(true)
180  {
181  }
183  friend std::ostream &operator<<(std::ostream &o, Data const &data)
184  {
185  o << data.m_name.cstr() << ",";
186  if (data.m_language) o << "language=" << data.m_language << ",";
187  if (data.m_id) o << "id=" << data.m_id << ",";
188  if (data.m_spellWrong) o << "spellWrong,";
189  return o;
190  }
192  librevenge::RVNGString m_name;
196  int m_id;
199  };
201  std::vector<Data> m_dataList;
202 };
203 
206 struct DocStats {
207 public:
210  : m_isModified(false)
211  {
212  for (long &number : m_numbers) number=0;
213  }
215  friend std::ostream &operator<<(std::ostream &o, DocStats const &docStats);
217  bool read(StarZone &zone);
219  long m_numbers[7];
222 };
223 
226 struct Macro {
227 public:
230  : m_key(0)
231  , m_scriptType(0)
232  {
233  }
235  friend std::ostream &operator<<(std::ostream &o, Macro const &macro);
237  bool read(StarZone &zone);
239  static bool readList(StarZone &zone, std::vector<Macro> &macroLis);
241  int m_key;
243  librevenge::RVNGString m_names[2];
246 };
247 
250 struct Mark {
251 public:
254  : m_type(-1)
255  , m_id(-1)
256  , m_offset(-1)
257  {
258  }
260  friend std::ostream &operator<<(std::ostream &o, Mark const &mark);
262  bool read(StarZone &zone);
264  int m_type;
266  int m_id;
268  int m_offset;
269 };
270 
273 struct NodeRedline {
274 public:
277  : m_id(-1)
278  , m_offset(-1)
279  , m_flags(0)
280  {
281  }
283  friend std::ostream &operator<<(std::ostream &o, NodeRedline const &nodeRedline);
285  bool read(StarZone &zone);
287  int m_id;
289  int m_offset;
291  int m_flags;
292 };
293 
296 struct NoteInfo {
297 public:
299  explicit NoteInfo(bool isFootnote)
300  : m_isFootnote(isFootnote)
301  , m_type(0)
302  , m_ftnOffset(0)
303  , m_posType(0)
304  , m_numType(0)
305  {
306  for (int &i : m_idx) i=0xFFFF;
307  }
309  friend std::ostream &operator<<(std::ostream &o, NoteInfo const &noteInfo);
311  bool read(StarZone &zone);
315  int m_type;
317  int m_idx[4];
321  librevenge::RVNGString m_strings[4];
326 };
327 
330 struct PrintData {
331 public:
334  : m_flags(0)
335  , m_colRow(1,1)
336  {
337  for (int &spacing : m_spacings) spacing=0;
338  }
340  friend std::ostream &operator<<(std::ostream &o, PrintData const &printData);
342  bool read(StarZone &zone);
344  int m_flags;
348  int m_spacings[6];
349 };
350 
353 struct Redline {
354 public:
357  : m_type(0)
358  , m_stringId(0)
359  , m_date(0)
360  , m_time(0)
361  , m_comment()
362  {
363  }
365  friend std::ostream &operator<<(std::ostream &o, Redline const &redline);
367  bool read(StarZone &zone);
369  static bool readList(StarZone &zone, std::vector<Redline> &redlineList);
371  static bool readListList(StarZone &zone, std::vector<std::vector<Redline> > &redlineListList);
373  int m_type;
377  long m_date;
379  long m_time;
381  librevenge::RVNGString m_comment;
382 };
383 
386 struct TOX {
387 public:
389  TOX()
390  : m_type(0)
391  , m_createType(0)
392  , m_captionDisplay(0)
393  , m_styleId(0xFFFF)
394  , m_data(0)
395  , m_formFlags(0)
396  , m_title("")
397  , m_name("")
398  , m_OLEOptions(0)
399  , m_stringIdList()
400  , m_styleList()
401  , m_titleLength()
402  , m_formatList()
403  {
404  for (int &stringId : m_stringIds) stringId=0xFFFF;
405  }
407  ~TOX();
409  friend std::ostream &operator<<(std::ostream &o, TOX const &tox);
411  bool read(StarZone &zone, StarObject &object);
413  static bool readList(StarZone &zone, std::vector<TOX> &toxList, StarObject &object);
414 
416  struct Style {
419  : m_level(0)
420  , m_names()
421  {
422  }
424  friend std::ostream &operator<<(std::ostream &o, Style const &style)
425  {
426  o << "level=" << style.m_level << ",";
427  if (!style.m_names.empty()) {
428  o << "names=[";
429  for (auto const &name : style.m_names) o << name.cstr() << ",";
430  o << "],";
431  }
432  return o;
433  }
435  int m_level;
437  std::vector<librevenge::RVNGString> m_names;
438  };
440  int m_type;
446  int m_stringIds[3];
450  int m_data;
454  librevenge::RVNGString m_title;
456  librevenge::RVNGString m_name;
460  std::vector<int> m_stringIdList;
462  std::vector<Style> m_styleList;
466  std::vector<std::shared_ptr<StarFormatManagerInternal::FormatDef> > m_formatList;
467 };
468 
471 struct TOX51 {
472 public:
475  : m_typeName("")
476  , m_type(0)
477  , m_createType(0)
478  , m_firstTabPos(0)
479  , m_title("")
480  , m_patternList()
481  , m_stringIdList()
482  , m_infLevel(0)
483  {
484  }
486  ~TOX51();
488  friend std::ostream &operator<<(std::ostream &o, TOX51 const &tox);
490  bool read(StarZone &zone, StarObject &object);
492  static bool readList(StarZone &zone, std::vector<TOX51> &toxList, StarObject &object);
493 
495  librevenge::RVNGString m_typeName;
497  int m_type;
503  librevenge::RVNGString m_title;
505  std::vector<librevenge::RVNGString> m_patternList;
507  std::vector<int> m_stringIdList;
510 };
511 
512 }
513 #endif
514 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
bool read(StarZone &zone)
try to read a docStats: &#39;d&#39;
Definition: StarWriterStruct.cxx:415
std::vector< std::shared_ptr< StarFormatManagerInternal::FormatDef > > m_formatList
the format
Definition: StarWriterStruct.hxx:466
long m_date
the date
Definition: StarWriterStruct.hxx:377
bool read(StarZone &zone)
try to read a macro: &#39;m&#39;
Definition: StarWriterStruct.cxx:460
int m_id
the id
Definition: StarWriterStruct.hxx:287
librevenge::RVNGString m_name
the name
Definition: StarWriterStruct.hxx:456
static bool readListList(StarZone &zone, std::vector< std::vector< Redline > > &redlineListList)
try to read a list of list of redline : V
Definition: StarWriterStruct.cxx:829
the doc statistic
Definition: StarWriterStruct.hxx:330
struct use an attribute and a position
Definition: StarWriterStruct.hxx:61
TOX51()
constructor
Definition: StarWriterStruct.hxx:474
static bool readList(StarZone &zone, std::vector< TOX51 > &toxList, StarObject &object)
try to read a list of TOX51
Definition: StarWriterStruct.cxx:1160
bool read(StarZone &zone, StarObject &object)
try to read a TOX
Definition: StarWriterStruct.cxx:878
int m_captionDisplay
the captionDisplay
Definition: StarWriterStruct.hxx:444
int m_type
the type: 2: bookmark-start, 3:bookmark-end
Definition: StarWriterStruct.hxx:264
librevenge::RVNGString m_names[2]
the names
Definition: StarWriterStruct.hxx:243
int m_styleId
the style id
Definition: StarWriterStruct.hxx:448
friend std::ostream & operator<<(std::ostream &o, Attribute const &attribute)
operator<<
Definition: StarWriterStruct.cxx:137
structure to store a TOX in a text zone
Definition: StarWriterStruct.hxx:386
friend std::ostream & operator<<(std::ostream &o, Mark const &mark)
operator<<
Definition: StarWriterStruct.cxx:564
~TOX51()
destructor
Definition: StarWriterStruct.cxx:1079
the doc statistic
Definition: StarWriterStruct.hxx:206
int m_infLevel
the inf level
Definition: StarWriterStruct.hxx:509
int m_key
the key
Definition: StarWriterStruct.hxx:110
bool read(StarZone &zone)
try to read a noteInfo
Definition: StarWriterStruct.cxx:612
static bool readList(StarZone &zone, std::vector< Macro > &macroLis)
try to read a list of macro: &#39;M&#39;
Definition: StarWriterStruct.cxx:495
NoteInfo(bool isFootnote)
constructor
Definition: StarWriterStruct.hxx:299
bool m_isFootnote
a flag to know if this corresponds to a footnote or a endnote
Definition: StarWriterStruct.hxx:313
int m_data
the number of data?
Definition: StarWriterStruct.hxx:450
bool m_isModified
modified flags
Definition: StarWriterStruct.hxx:221
DatabaseName()
constructor
Definition: StarWriterStruct.hxx:122
bool read(StarZone &zone, StarObject &object)
try to read a attribute: &#39;A&#39;
Definition: StarWriterStruct.cxx:57
structure to store a bookmark
Definition: StarWriterStruct.hxx:85
static bool readList(StarZone &zone, std::vector< Redline > &redlineList)
try to read a list of redline : R
Definition: StarWriterStruct.cxx:794
int m_scriptType
the scriptType
Definition: StarWriterStruct.hxx:245
int m_offset
the offset
Definition: StarWriterStruct.hxx:268
structure to store a TOX51 in a text zone
Definition: StarWriterStruct.hxx:471
static bool readList(StarZone &zone, std::vector< Attribute > &attributeList, StarObject &object)
try to read a list of attribute: &#39;S&#39;
Definition: StarWriterStruct.cxx:107
librevenge::RVNGString m_names[2]
the names: database, table
Definition: StarWriterStruct.hxx:152
friend std::ostream & operator<<(std::ostream &o, TOX const &tox)
operator<<
Definition: StarWriterStruct.cxx:1039
structure to store a macro in a text zone
Definition: StarWriterStruct.hxx:226
bool read(StarZone &zone)
try to read a databaseName: &#39;D&#39;
Definition: StarWriterStruct.cxx:255
librevenge::RVNGString m_title
the title
Definition: StarWriterStruct.hxx:454
std::vector< Data > m_dataList
the list of data
Definition: StarWriterStruct.hxx:156
PrintData()
constructor
Definition: StarWriterStruct.hxx:333
long m_titleLength
the title length
Definition: StarWriterStruct.hxx:464
librevenge::RVNGString m_shortName
the shortname
Definition: StarWriterStruct.hxx:104
structure to store a redline in a text zone
Definition: StarWriterStruct.hxx:353
friend std::ostream & operator<<(std::ostream &o, DatabaseName const &databaseName)
operator<<
Definition: StarWriterStruct.cxx:343
std::vector< librevenge::RVNGString > m_names
the list of names
Definition: StarWriterStruct.hxx:437
long m_numbers[7]
the list of number: tbl, graf, ole, page, para, word, char
Definition: StarWriterStruct.hxx:219
friend std::ostream & operator<<(std::ostream &o, Dictionary const &dictionary)
operator<<
Definition: StarWriterStruct.cxx:401
Internal: the structures of a StarFormatManager.
Definition: StarFormatManager.cxx:58
Style()
constructor
Definition: StarWriterStruct.hxx:418
int m_language
the language
Definition: StarWriterStruct.hxx:194
Attribute()
constructor
Definition: StarWriterStruct.hxx:64
structure to store a nodeRedline in a text zone
Definition: StarWriterStruct.hxx:273
STOFFVec2i m_colRow
the row, col dim
Definition: StarWriterStruct.hxx:346
Mark()
constructor
Definition: StarWriterStruct.hxx:253
bool read(StarZone &zone)
try to read a printData: &#39;8&#39;
Definition: StarWriterStruct.cxx:719
Macro()
constructor
Definition: StarWriterStruct.hxx:229
friend std::ostream & operator<<(std::ostream &o, Data const &data)
operator<<
Definition: StarWriterStruct.hxx:183
int m_type
the type
Definition: StarWriterStruct.hxx:440
friend std::ostream & operator<<(std::ostream &o, Bookmark const &mark)
operator<<
Definition: StarWriterStruct.cxx:238
std::vector< librevenge::RVNGString > m_patternList
the pattern list
Definition: StarWriterStruct.hxx:505
friend std::ostream & operator<<(std::ostream &o, Redline const &redline)
operator<<
Definition: StarWriterStruct.cxx:861
int m_formFlags
the format flags?
Definition: StarWriterStruct.hxx:452
librevenge::RVNGString m_sql
the SQL string
Definition: StarWriterStruct.hxx:154
int m_OLEOptions
the ole options
Definition: StarWriterStruct.hxx:458
int m_id
the id
Definition: StarWriterStruct.hxx:196
friend std::ostream & operator<<(std::ostream &o, PrintData const &printData)
operator<<
Definition: StarWriterStruct.cxx:745
std::vector< int > m_stringIdList
a list of template string ids
Definition: StarWriterStruct.hxx:507
friend std::ostream & operator<<(std::ostream &o, DocStats const &docStats)
operator<<
Definition: StarWriterStruct.cxx:447
namespace use to keep basic writer structure
Definition: StarWriterStruct.cxx:48
librevenge::RVNGString m_typeName
the typeName
Definition: StarWriterStruct.hxx:495
librevenge::RVNGString m_name
the name
Definition: StarWriterStruct.hxx:192
int m_createType
the createType
Definition: StarWriterStruct.hxx:499
int m_id
the id
Definition: StarWriterStruct.hxx:266
int m_stringIds[3]
the string id, the seq string id, the sect string id
Definition: StarWriterStruct.hxx:446
static bool readList(StarZone &zone, std::vector< Bookmark > &markList)
try to read a list of bookmark
Definition: StarWriterStruct.cxx:207
bool read(StarZone &zone)
try to read a mark
Definition: StarWriterStruct.cxx:153
virtual class used to store the different attribute
Definition: StarAttribute.hxx:62
bool m_spellWrong
a flag to know if we do spell or not
Definition: StarWriterStruct.hxx:198
Bookmark()
the constructor
Definition: StarWriterStruct.hxx:89
friend std::ostream & operator<<(std::ostream &o, Macro const &macro)
operator<<
Definition: StarWriterStruct.cxx:526
DocStats()
constructor
Definition: StarWriterStruct.hxx:209
STOFFVec2i m_selection
the start/end position
Definition: StarWriterStruct.hxx:149
bool read(StarZone &zone)
try to read a nodeRedline
Definition: StarWriterStruct.cxx:575
std::shared_ptr< StarAttribute > m_attribute
the attribute
Definition: StarWriterStruct.hxx:78
a data of a DatabaseName
Definition: StarWriterStruct.hxx:132
TOX()
constructor
Definition: StarWriterStruct.hxx:389
std::vector< Style > m_styleList
a list of style names?
Definition: StarWriterStruct.hxx:462
~Attribute()
destructor
Definition: StarWriterStruct.cxx:53
int m_type
the type
Definition: StarWriterStruct.hxx:497
Data()
constructor
Definition: StarWriterStruct.hxx:134
int m_key
the key
Definition: StarWriterStruct.hxx:241
int m_posType
the posType
Definition: StarWriterStruct.hxx:323
bool read(StarZone &zone)
try to read a dictionary: &#39;j&#39;
Definition: StarWriterStruct.cxx:363
friend std::ostream & operator<<(std::ostream &o, Style const &style)
operator<<
Definition: StarWriterStruct.hxx:424
static bool readList(StarZone &zone, std::vector< TOX > &toxList, StarObject &object)
try to read a list of TOX
Definition: StarWriterStruct.cxx:1008
Redline()
constructor
Definition: StarWriterStruct.hxx:356
a style
Definition: StarWriterStruct.hxx:416
long m_time
the time
Definition: StarWriterStruct.hxx:379
friend std::ostream & operator<<(std::ostream &o, TOX51 const &tox)
operator<<
Definition: StarWriterStruct.cxx:1191
STOFFVec2< int > STOFFVec2i
STOFFVec2 of int.
Definition: libstaroffice_internal.hxx:763
int m_stringId
the stringId
Definition: StarWriterStruct.hxx:375
bool read(StarZone &zone)
try to read a mark
Definition: StarWriterStruct.cxx:540
int m_numType
the numType
Definition: StarWriterStruct.hxx:325
int m_createType
the createType
Definition: StarWriterStruct.hxx:442
Data()
constructor
Definition: StarWriterStruct.hxx:175
int m_flags
the flags
Definition: StarWriterStruct.hxx:344
a data of a Dictionary
Definition: StarWriterStruct.hxx:173
int m_offset
the offset
Definition: StarWriterStruct.hxx:108
friend std::ostream & operator<<(std::ostream &o, NodeRedline const &nodeRedline)
operator<<
Definition: StarWriterStruct.cxx:600
bool read(StarZone &zone, StarObject &object)
try to read a TOX51
Definition: StarWriterStruct.cxx:1083
librevenge::RVNGString m_comment
the comment
Definition: StarWriterStruct.hxx:381
int m_idx[4]
the list of idx: the page, the coll, the char and the anchorChar
Definition: StarWriterStruct.hxx:317
NodeRedline()
constructor
Definition: StarWriterStruct.hxx:276
librevenge::RVNGString m_name
the name
Definition: StarWriterStruct.hxx:147
std::vector< int > m_stringIdList
a list of template string ids
Definition: StarWriterStruct.hxx:460
int m_spacings[6]
the spaces: left, right, top, bottom, horizontal, verticals
Definition: StarWriterStruct.hxx:348
int m_offset
the offset
Definition: StarWriterStruct.hxx:289
int m_type
the type
Definition: StarWriterStruct.hxx:315
structure to store a dictionary in a text zone
Definition: StarWriterStruct.hxx:161
bool read(StarZone &zone)
try to read a redline : D
Definition: StarWriterStruct.cxx:760
librevenge::RVNGString m_macroNames[4]
the macros names
Definition: StarWriterStruct.hxx:114
friend std::ostream & operator<<(std::ostream &o, NoteInfo const &noteInfo)
operator<<
Definition: StarWriterStruct.cxx:696
librevenge::RVNGString m_title
the title
Definition: StarWriterStruct.hxx:503
structure to store a endnoteInfo or a footnoteInfo in a text zone
Definition: StarWriterStruct.hxx:296
librevenge::RVNGString m_strings[4]
the strings: prefix, suffix, quoValis, ergoSum
Definition: StarWriterStruct.hxx:321
int m_level
the level
Definition: StarWriterStruct.hxx:435
friend std::ostream & operator<<(std::ostream &o, Data const &data)
operator<<
Definition: StarWriterStruct.hxx:140
Dictionary()
constructor
Definition: StarWriterStruct.hxx:164
an object corresponding to an OLE directory
Definition: StarObject.hxx:64
librevenge::RVNGString m_name
the name
Definition: StarWriterStruct.hxx:106
a zone in a StarOffice file
Definition: StarZone.hxx:56
structure to store a mark in a text zone
Definition: StarWriterStruct.hxx:250
int m_type
the type
Definition: StarWriterStruct.hxx:373
int m_modifier
the modifier
Definition: StarWriterStruct.hxx:112
~TOX()
destructor
Definition: StarWriterStruct.cxx:874
std::vector< Data > m_dataList
the list of data
Definition: StarWriterStruct.hxx:201
int m_firstTabPos
the firstTabPos
Definition: StarWriterStruct.hxx:501
int m_ftnOffset
the ftnOffset
Definition: StarWriterStruct.hxx:319
STOFFVec2i m_position
the begin/end position
Definition: StarWriterStruct.hxx:80
int m_flags
the flags
Definition: StarWriterStruct.hxx:291
structure to store a databaseName in a text zone
Definition: StarWriterStruct.hxx:119

Generated on Sat May 29 2021 22:54:03 for libstaroffice by doxygen 1.8.14