Coverage Report

Created: 2026-04-29 07:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libstaroffice/src/lib/StarCharAttribute.cxx
Line
Count
Source
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
#include "StarCharAttribute.hxx"
35
36
#include "STOFFFont.hxx"
37
#include "STOFFListener.hxx"
38
#include "STOFFSubDocument.hxx"
39
40
#include "StarAttribute.hxx"
41
#include "StarFormatManager.hxx"
42
#include "StarItemPool.hxx"
43
#include "StarLanguage.hxx"
44
#include "StarObject.hxx"
45
#include "StarObjectText.hxx"
46
#include "StarState.hxx"
47
#include "StarZone.hxx"
48
49
#include "SWFieldManager.hxx"
50
51
namespace StarCharAttribute
52
{
53
//! a character bool attribute
54
class StarCAttributeBool final : public StarAttributeBool
55
{
56
public:
57
  //! constructor
58
  StarCAttributeBool(Type type, std::string const &debugName, bool value) :
59
2.20M
    StarAttributeBool(type, debugName, value)
60
2.20M
  {
61
2.20M
  }
62
  //! create a new attribute
63
  std::shared_ptr<StarAttribute> create() const final
64
28.8k
  {
65
28.8k
    return std::shared_ptr<StarAttribute>(new StarCAttributeBool(*this));
66
28.8k
  }
67
  //! add to a font
68
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
69
70
protected:
71
  //! copy constructor
72
28.8k
  StarCAttributeBool(StarCAttributeBool const &) = default;
73
};
74
75
//! a character color attribute
76
class StarCAttributeColor final : public StarAttributeColor
77
{
78
public:
79
  //! constructor
80
146k
  StarCAttributeColor(Type type, std::string const &debugName, STOFFColor const &value) : StarAttributeColor(type, debugName, value)
81
146k
  {
82
146k
  }
83
  //! create a new attribute
84
  std::shared_ptr<StarAttribute> create() const final
85
21.5k
  {
86
21.5k
    return std::shared_ptr<StarAttribute>(new StarCAttributeColor(*this));
87
21.5k
  }
88
  //! add to a font
89
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
90
protected:
91
  //! copy constructor
92
21.5k
  StarCAttributeColor(StarCAttributeColor const &) = default;
93
};
94
95
//! a character integer attribute
96
class StarCAttributeInt final : public StarAttributeInt
97
{
98
public:
99
  //! constructor
100
  StarCAttributeInt(Type type, std::string const &debugName, int intSize, int value) :
101
146k
    StarAttributeInt(type, debugName, intSize, value)
102
146k
  {
103
146k
  }
104
  //! add to a font
105
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
106
  //! create a new attribute
107
  std::shared_ptr<StarAttribute> create() const final
108
2.34k
  {
109
2.34k
    return std::shared_ptr<StarAttribute>(new StarCAttributeInt(*this));
110
2.34k
  }
111
protected:
112
  //! copy constructor
113
2.34k
  StarCAttributeInt(StarCAttributeInt const &) = default;
114
};
115
116
//! a character unsigned integer attribute
117
class StarCAttributeUInt final : public StarAttributeUInt
118
{
119
public:
120
  //! constructor
121
  StarCAttributeUInt(Type type, std::string const &debugName, int intSize, unsigned int value) :
122
2.34M
    StarAttributeUInt(type, debugName, intSize, value)
123
2.34M
  {
124
2.34M
  }
125
  //! create a new attribute
126
  std::shared_ptr<StarAttribute> create() const final
127
133k
  {
128
133k
    return std::shared_ptr<StarAttribute>(new StarCAttributeUInt(*this));
129
133k
  }
130
  //! add to a font
131
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
132
protected:
133
  //! copy constructor
134
133k
  StarCAttributeUInt(StarCAttributeUInt const &) = default;
135
};
136
137
//! a void attribute
138
class StarCAttributeVoid final : public StarAttributeVoid
139
{
140
public:
141
  //! constructor
142
586k
  StarCAttributeVoid(Type type, std::string const &debugName) : StarAttributeVoid(type, debugName)
143
586k
  {
144
586k
  }
145
  //! add to a font
146
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
147
  //! create a new attribute
148
  std::shared_ptr<StarAttribute> create() const final
149
8.64k
  {
150
8.64k
    return std::shared_ptr<StarAttribute>(new StarCAttributeVoid(*this));
151
8.64k
  }
152
protected:
153
  //! copy constructor
154
8.64k
  StarCAttributeVoid(StarCAttributeVoid const &) = default;
155
};
156
157
//! add a bool attribute
158
inline void addAttributeBool(std::map<int, std::shared_ptr<StarAttribute> > &map, StarAttribute::Type type, std::string const &debugName, bool defValue)
159
2.20M
{
160
2.20M
  map[type]=std::shared_ptr<StarAttribute>(new StarCAttributeBool(type,debugName, defValue));
161
2.20M
}
162
//! add a color attribute
163
inline void addAttributeColor(std::map<int, std::shared_ptr<StarAttribute> > &map, StarAttribute::Type type, std::string const &debugName, STOFFColor const &defValue)
164
146k
{
165
146k
  map[type]=std::shared_ptr<StarAttribute>(new StarCAttributeColor(type,debugName, defValue));
166
146k
}
167
//! add a int attribute
168
inline void addAttributeInt(std::map<int, std::shared_ptr<StarAttribute> > &map, StarAttribute::Type type, std::string const &debugName, int numBytes, int defValue)
169
146k
{
170
146k
  map[type]=std::shared_ptr<StarAttribute>(new StarCAttributeInt(type,debugName, numBytes, defValue));
171
146k
}
172
//! add a unsigned int attribute
173
inline void addAttributeUInt(std::map<int, std::shared_ptr<StarAttribute> > &map, StarAttribute::Type type, std::string const &debugName, int numBytes, unsigned int defValue)
174
2.34M
{
175
2.34M
  map[type]=std::shared_ptr<StarAttribute>(new StarCAttributeUInt(type,debugName, numBytes, defValue));
176
2.34M
}
177
//! add a void attribute
178
inline void addAttributeVoid(std::map<int, std::shared_ptr<StarAttribute> > &map, StarAttribute::Type type, std::string const &debugName)
179
586k
{
180
586k
  map[type]=std::shared_ptr<StarAttribute>(new StarCAttributeVoid(type,debugName));
181
586k
}
182
183
void StarCAttributeBool::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
184
239k
{
185
239k
  if (m_type==ATTR_CHR_CONTOUR)
186
112k
    state.m_font.m_propertyList.insert("style:text-outline", m_value);
187
126k
  else if (m_type==ATTR_CHR_SHADOWED)
188
112k
    state.m_font.m_propertyList.insert("fo:text-shadow", m_value ? "1pt 1pt" : "none");
189
14.1k
  else if (m_type==ATTR_CHR_BLINK)
190
91
    state.m_font.m_propertyList.insert("style:text-blinking", m_value);
191
14.0k
  else if (m_type==ATTR_CHR_WORDLINEMODE)  {
192
5.37k
    state.m_font.m_propertyList.insert("style:text-line-through-mode", m_value ? "skip-white-space" : "continuous");
193
5.37k
    state.m_font.m_propertyList.insert("style:text-underline-mode", m_value ? "skip-white-space" : "continuous");
194
5.37k
  }
195
8.65k
  else if (m_type==ATTR_CHR_AUTOKERN)
196
2.66k
    state.m_font.m_propertyList.insert("style:letter-kerning", m_value);
197
5.98k
  else if (m_type==ATTR_SC_HYPHENATE)
198
2.84k
    state.m_font.m_propertyList.insert("fo:hyphenate", m_value);
199
3.14k
  else if (m_type==ATTR_CHR_NOHYPHEN)
200
173
    state.m_font.m_hyphen=!m_value;
201
2.96k
  else if (m_type==ATTR_CHR_NOLINEBREAK)
202
83
    state.m_font.m_lineBreak=!m_value;
203
239k
}
204
205
void StarCAttributeColor::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
206
160k
{
207
160k
  if (m_type==ATTR_CHR_COLOR)
208
160k
    state.m_font.m_propertyList.insert("fo:color", m_value.str().c_str());
209
160k
}
210
211
void StarCAttributeInt::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
212
6.24k
{
213
6.24k
  if (m_type==ATTR_CHR_KERNING)
214
6.24k
    state.m_font.m_propertyList.insert("fo:letter-spacing", m_value, librevenge::RVNG_TWIP);
215
6.24k
}
216
217
void StarCAttributeUInt::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
218
1.11M
{
219
1.11M
  if (m_type==ATTR_CHR_CROSSEDOUT) {
220
117k
    switch (m_value) {
221
113k
    case 0: // none
222
113k
      state.m_font.m_propertyList.insert("style:text-line-through-type", "none");
223
113k
      break;
224
1.03k
    case 1: // single
225
1.52k
    case 2: // double
226
1.52k
      state.m_font.m_propertyList.insert("style:text-line-through-type", m_value==1 ? "single" : "double");
227
1.52k
      state.m_font.m_propertyList.insert("style:text-line-through-style", "solid");
228
1.52k
      break;
229
79
    case 3: // dontknow
230
79
      break;
231
203
    case 4: // bold
232
203
      state.m_font.m_propertyList.insert("style:text-line-through-type", "single");
233
203
      state.m_font.m_propertyList.insert("style:text-line-through-style", "solid");
234
203
      state.m_font.m_propertyList.insert("style:text-line-through-width", "thick");
235
203
      break;
236
355
    case 5: // slash
237
504
    case 6: // X
238
504
      state.m_font.m_propertyList.insert("style:text-line-through-type", "single");
239
504
      state.m_font.m_propertyList.insert("style:text-line-through-style", "solid");
240
504
      state.m_font.m_propertyList.insert("style:text-line-through-text", m_value==5 ? "/" : "X");
241
504
      break;
242
1.47k
    default:
243
1.47k
      state.m_font.m_propertyList.insert("style:text-line-through-type", "none");
244
1.47k
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeUInt: find unknown crossedout enum=%d\n", m_value));
245
1.47k
      break;
246
117k
    }
247
117k
  }
248
1.00M
  else if (m_type==ATTR_CHR_UNDERLINE) {
249
156k
    switch (m_value) {
250
145k
    case 0: // none
251
146k
    case 4: // unknown
252
146k
      state.m_font.m_propertyList.insert("style:text-underline-type", "none");
253
146k
      break;
254
1.72k
    case 1: // single
255
2.99k
    case 2: // double
256
2.99k
      state.m_font.m_propertyList.insert("style:text-underline-type", m_value==1 ? "single" : "double");
257
2.99k
      state.m_font.m_propertyList.insert("style:text-underline-style", "solid");
258
2.99k
      break;
259
152
    case 3: // dot
260
2.65k
    case 5: // dash
261
2.95k
    case 6: // long-dash
262
3.01k
    case 7: // dash-dot
263
3.41k
    case 8: // dash-dot-dot
264
3.41k
      state.m_font.m_propertyList.insert("style:text-underline-type", "single");
265
3.41k
      state.m_font.m_propertyList.insert("style:text-underline-style", m_value==3 ? "dotted" : m_value==5 ? "dash" :
266
3.26k
                                         m_value==6 ? "long-dash" : m_value==7 ? "dot-dash" : "dot-dot-dash");
267
3.41k
      break;
268
128
    case 9: // small wave
269
250
    case 10: // wave
270
309
    case 11: // double wave
271
309
      state.m_font.m_propertyList.insert("style:text-underline-type", m_value==11 ? "single" : "double");
272
309
      state.m_font.m_propertyList.insert("style:text-underline-style", "wave");
273
309
      if (m_value==9)
274
128
        state.m_font.m_propertyList.insert("style:text-underline-width", "thin");
275
309
      break;
276
92
    case 12: // bold
277
173
    case 13: // bold dot
278
298
    case 14: // bold dash
279
359
    case 15: // bold long-dash
280
524
    case 16: // bold dash-dot
281
576
    case 17: // bold dash-dot-dot
282
659
    case 18: { // bold wave
283
659
      char const *wh[]= {"solid", "dotted", "dash", "long-dash", "dot-dash", "dot-dot-dash", "wave"};
284
659
      state.m_font.m_propertyList.insert("style:text-underline-type", "single");
285
659
      state.m_font.m_propertyList.insert("style:text-underline-style", wh[m_value-12]);
286
659
      state.m_font.m_propertyList.insert("style:text-underline-width", "thick");
287
659
      break;
288
576
    }
289
2.71k
    default:
290
2.71k
      state.m_font.m_propertyList.insert("style:text-underline-type", "none");
291
2.71k
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeUInt: find unknown underline enum=%d\n", m_value));
292
2.71k
      break;
293
156k
    }
294
156k
  }
295
845k
  else if (m_type==ATTR_CHR_POSTURE || m_type==ATTR_CHR_CJK_POSTURE || m_type==ATTR_CHR_CTL_POSTURE) {
296
365k
    std::string wh(m_type==ATTR_CHR_POSTURE ? "fo:font-style" :  m_type==ATTR_CHR_CJK_POSTURE ? "style:font-style-asian" : "style:font-style-complex");
297
365k
    if (m_value==1)
298
623
      state.m_font.m_propertyList.insert(wh.c_str(), "oblique");
299
364k
    else if (m_value==2)
300
70.1k
      state.m_font.m_propertyList.insert(wh.c_str(), "italic");
301
294k
    else if (m_value) {
302
3.13k
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeUInt: find unknown posture enum=%d\n", m_value));
303
3.13k
    }
304
365k
  }
305
480k
  else if (m_type==ATTR_CHR_RELIEF) {
306
3.47k
    if (m_value==0)
307
3.01k
      state.m_font.m_propertyList.insert("style:font-relief", "none");
308
453
    else if (m_value==1)
309
22
      state.m_font.m_propertyList.insert("style:font-relief", "embossed");
310
431
    else if (m_value==2)
311
105
      state.m_font.m_propertyList.insert("style:font-relief", "engraved");
312
326
    else if (m_value) {
313
326
      state.m_font.m_propertyList.insert("style:font-relief", "none");
314
326
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeUInt: find unknown relief enum=%d\n", m_value));
315
326
    }
316
3.47k
  }
317
477k
  else if (m_type==ATTR_CHR_WEIGHT || m_type==ATTR_CHR_CJK_WEIGHT || m_type==ATTR_CHR_CTL_WEIGHT) {
318
406k
    std::string wh(m_type==ATTR_CHR_WEIGHT ? "fo:font-weight" :  m_type==ATTR_CHR_CJK_WEIGHT ? "style:font-weight-asian" : "style:font-weight-complex");
319
406k
    if (m_value==5)
320
359k
      state.m_font.m_propertyList.insert(wh.c_str(), "normal");
321
46.5k
    else if (m_value==8)
322
41.0k
      state.m_font.m_propertyList.insert(wh.c_str(), "bold");
323
5.45k
    else if (m_value>=1 && m_value<=9)
324
2.05k
      state.m_font.m_propertyList.insert(wh.c_str(), m_value*100, librevenge::RVNG_GENERIC);
325
3.40k
    else // 10: WEIGHT_BLACK
326
3.40k
      state.m_font.m_propertyList.insert(wh.c_str(), "normal");
327
406k
  }
328
70.8k
  else if (m_type==ATTR_CHR_CASEMAP) {
329
937
    if (m_value==0)
330
307
      state.m_font.m_propertyList.insert("fo:text-transform", "none");
331
630
    else if (m_value==1)
332
46
      state.m_font.m_propertyList.insert("fo:text-transform", "uppercase");
333
584
    else if (m_value==2)
334
38
      state.m_font.m_propertyList.insert("fo:text-transform", "lowercase");
335
546
    else if (m_value==3)
336
27
      state.m_font.m_propertyList.insert("fo:text-transform", "capitalize");
337
519
    else if (m_value==4)
338
422
      state.m_font.m_propertyList.insert("fo:font-variant", "small-caps");
339
97
    else if (m_value) {
340
97
      state.m_font.m_propertyList.insert("fo:text-transform", "none");
341
97
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeUInt: find unknown casemap enum=%d\n", m_value));
342
97
    }
343
937
  }
344
69.9k
  else if (m_type==ATTR_CHR_LANGUAGE || m_type==ATTR_CHR_CJK_LANGUAGE || m_type==ATTR_CHR_CTL_LANGUAGE || m_type==ATTR_SC_LANGUAGE_FORMAT) {
345
66.9k
    bool const basic=m_type==ATTR_CHR_LANGUAGE||m_type==ATTR_SC_LANGUAGE_FORMAT;
346
66.9k
    std::string prefix(basic ? "fo:" : "style:");
347
66.9k
    std::string extension(basic ? "" :  m_type==ATTR_CHR_CJK_LANGUAGE ? "-asian" : "-complex");
348
66.9k
    std::string lang, country;
349
66.9k
    if (StarLanguage::getLanguageId(int(m_value), lang, country)) {
350
44.2k
      if (!lang.empty())
351
44.2k
        state.m_font.m_propertyList.insert((prefix + "language" + extension).c_str(), lang.c_str());
352
44.2k
      if (!country.empty())
353
43.3k
        state.m_font.m_propertyList.insert((prefix + "country" + extension).c_str(), country.c_str());
354
44.2k
    }
355
66.9k
  }
356
2.98k
  else if (m_type==ATTR_CHR_PROPORTIONALFONTSIZE && m_value!=100) // checkme: maybe font-size with %
357
90
    state.m_font.m_propertyList.insert("style:text-scale", double(m_value)/100., librevenge::RVNG_PERCENT);
358
2.89k
  else if (m_type==ATTR_CHR_EMPHASIS_MARK) {
359
2.65k
    if (m_value && ((m_value&0xC000)==0 || (m_value&0x3000)==0x3000 || (m_value&0xFFF)>4 || (m_value&0xFFF)==0)) {
360
674
      state.m_font.m_propertyList.insert("style:text-emphasize", "none");
361
674
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeUInt: find unknown emphasis mark=%x\n", unsigned(m_value)));
362
674
    }
363
1.98k
    else if (m_value) {
364
70
      std::string what((m_value&7)== 1 ? "dot" : (m_value&7)== 2 ? "circle" : (m_value&7)== 3 ? "disc" : "accent");
365
70
      state.m_font.m_propertyList.insert("style:text-emphasize", (what+((m_value&0x1000) ? " above" : " below")).c_str());
366
70
    }
367
1.91k
    else
368
1.91k
      state.m_font.m_propertyList.insert("style:text-emphasize", "none");
369
2.65k
  }
370
1.11M
}
371
372
void StarCAttributeVoid::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
373
12.8k
{
374
12.8k
  if (m_type==ATTR_TXT_SOFTHYPH)
375
6.67k
    state.m_font.m_softHyphen=true;
376
6.15k
  else if (m_type==ATTR_EE_FEATURE_TAB)
377
3.55k
    state.m_font.m_tab=true;
378
2.60k
  else if (m_type==ATTR_EE_FEATURE_LINEBR)
379
2.47k
    state.m_font.m_lineBreak=true;
380
12.8k
}
381
382
}
383
384
namespace StarCharAttribute
385
{
386
// ------------------------------------------------------------
387
////////////////////////////////////////
388
//! Internal: the subdocument of a StarObjectSpreadsheet
389
class SubDocument final : public STOFFSubDocument
390
{
391
public:
392
  SubDocument(std::shared_ptr<StarObjectTextInternal::Content> const &content, std::shared_ptr<StarState::GlobalState> const &state) :
393
3.51k
    STOFFSubDocument(nullptr, STOFFInputStreamPtr(), STOFFEntry()), m_content(content), m_state(state) {}
394
395
  //! destructor
396
3.51k
  ~SubDocument() final {}
397
398
  //! operator!=
399
  bool operator!=(STOFFSubDocument const &doc) const final
400
0
  {
401
0
    if (STOFFSubDocument::operator!=(doc)) return true;
402
0
    auto const *sDoc = dynamic_cast<SubDocument const *>(&doc);
403
0
    if (!sDoc) return true;
404
0
    if (m_state.get() != sDoc->m_state.get()) return true;
405
0
    return false;
406
0
  }
407
408
  //! the parser function
409
  void parse(STOFFListenerPtr &listener, libstoff::SubDocumentType type) final;
410
411
protected:
412
  //! the content
413
  std::shared_ptr<StarObjectTextInternal::Content> m_content;
414
  //! the global state
415
  std::shared_ptr<StarState::GlobalState> m_state;
416
private:
417
  SubDocument(SubDocument const &);
418
  SubDocument &operator=(SubDocument const &);
419
};
420
421
void SubDocument::parse(STOFFListenerPtr &listener, libstoff::SubDocumentType /*type*/)
422
3.51k
{
423
3.51k
  if (!listener.get()) {
424
0
    STOFF_DEBUG_MSG(("StarObjectSpreadsheetInternal::SubDocument::parse: no listener\n"));
425
0
    return;
426
0
  }
427
3.51k
  if (m_content) {
428
3.51k
    StarState state(*m_state);
429
3.51k
    m_content->send(listener, state);
430
3.51k
  }
431
3.51k
}
432
433
//! a escapement attribute
434
class StarCAttributeEscapement final : public StarAttribute
435
{
436
public:
437
  //! constructor
438
146k
  StarCAttributeEscapement(Type type, std::string const &debugName) : StarAttribute(type, debugName), m_delta(0), m_scale(100)
439
146k
  {
440
146k
  }
441
  //! create a new attribute
442
  std::shared_ptr<StarAttribute> create() const final
443
3.87k
  {
444
3.87k
    return std::shared_ptr<StarAttribute>(new StarCAttributeEscapement(*this));
445
3.87k
  }
446
  //! read a zone
447
  bool read(StarZone &zone, int vers, long endPos, StarObject &object) final;
448
  //! add to a font
449
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
450
  //! debug function to print the data
451
  void printData(libstoff::DebugStream &o) const final
452
10.3k
  {
453
10.3k
    o << m_debugName << "=[";
454
10.3k
    if (m_delta) o << "decal=" << m_delta << "%,";
455
10.3k
    if (m_scale!=100) o << "scale=" << m_scale << "%,";
456
10.3k
    o << "],";
457
10.3k
  }
458
protected:
459
  //! copy constructor
460
3.87k
  StarCAttributeEscapement(StarCAttributeEscapement const &) = default;
461
  //! the sub/super decal in %
462
  int m_delta;
463
  //! the scaling
464
  int m_scale;
465
};
466
467
//! a font attribute
468
class StarCAttributeFont final : public StarAttribute
469
{
470
public:
471
  //! constructor
472
  StarCAttributeFont(Type type, std::string const &debugName) :
473
440k
    StarAttribute(type, debugName), m_name(""), m_style(""), m_encoding(0), m_family(0), m_pitch(0)
474
440k
  {
475
440k
  }
476
  //! create a new attribute
477
  std::shared_ptr<StarAttribute> create() const final
478
52.4k
  {
479
52.4k
    return std::shared_ptr<StarAttribute>(new StarCAttributeFont(*this));
480
52.4k
  }
481
  //! read a zone
482
  bool read(StarZone &zone, int vers, long endPos, StarObject &object) final;
483
  //! add to a font
484
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
485
  //! debug function to print the data
486
  void printData(libstoff::DebugStream &o) const final
487
65.4k
  {
488
65.4k
    o << m_debugName << "=[";
489
65.4k
    if (!m_name.empty()) o << "name=" << m_name.cstr() << ",";
490
65.4k
    if (!m_style.empty()) o << "style=" << m_style.cstr() << ",";
491
65.4k
    if (m_encoding) o << "encoding=" << m_encoding << ",";
492
65.4k
    switch (m_family) {
493
19.6k
    case 0: // dont know
494
19.6k
      break;
495
307
    case 1:
496
307
      o << "decorative,";
497
307
      break;
498
3.20k
    case 2:
499
3.20k
      o << "modern,";
500
3.20k
      break;
501
13.6k
    case 3:
502
13.6k
      o << "roman,";
503
13.6k
      break;
504
284
    case 4:
505
284
      o << "script,";
506
284
      break;
507
16.5k
    case 5:
508
16.5k
      o << "swiss,";
509
16.5k
      break;
510
9.89k
    case 6:
511
9.89k
      o << "modern,";
512
9.89k
      break;
513
2.01k
    default:
514
2.01k
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeFont: find unknown family\n"));
515
2.01k
      o << "#family=" << m_family << ",";
516
2.01k
      break;
517
65.4k
    }
518
65.4k
    switch (m_pitch) {
519
19.4k
    case 0: // dont know
520
19.4k
      break;
521
1.74k
    case 1:
522
1.74k
      o << "pitch[fixed],";
523
1.74k
      break;
524
41.4k
    case 2:
525
41.4k
      o << "pitch[fixed],";
526
41.4k
      break;
527
2.75k
    default:
528
2.75k
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeFont: find unknown pitch\n"));
529
2.75k
      o << "#pitch=" << m_pitch << ",";
530
2.75k
      break;
531
65.4k
    }
532
65.4k
    o << "],";
533
65.4k
  }
534
535
protected:
536
  //! copy constructor
537
52.4k
  StarCAttributeFont(StarCAttributeFont const &) = default;
538
  //! the font name
539
  librevenge::RVNGString m_name;
540
  //! the style
541
  librevenge::RVNGString m_style;
542
  //! the font encoding
543
  int m_encoding;
544
  //! the font family
545
  int m_family;
546
  //! the font pitch
547
  int m_pitch;
548
};
549
550
551
//! a font size attribute
552
class StarCAttributeFontSize final : public StarAttribute
553
{
554
public:
555
  //! constructor
556
  StarCAttributeFontSize(Type type, std::string const &debugName) :
557
440k
    StarAttribute(type, debugName), m_size(240), m_proportion(100), m_unit(13)
558
440k
  {
559
440k
  }
560
  //! create a new attribute
561
  std::shared_ptr<StarAttribute> create() const final
562
90.9k
  {
563
90.9k
    return std::shared_ptr<StarAttribute>(new StarCAttributeFontSize(*this));
564
90.9k
  }
565
  //! read a zone
566
  bool read(StarZone &zone, int vers, long endPos, StarObject &object) final;
567
  //! add to a font
568
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
569
  //! debug function to print the data
570
  void printData(libstoff::DebugStream &o) const final
571
114k
  {
572
114k
    o << m_debugName << "=[";
573
114k
    if (m_size!=240) o << "sz=" << m_size << ",";
574
114k
    if (m_proportion!=100) o << "prop=" << m_proportion << ",";
575
114k
    if (m_unit>=0 && m_unit<=14) {
576
111k
      char const *wh[]= {"mm/100", "mm/10", "mm", "cm", "in/1000", "in/100", "in/10", "in",
577
111k
                         "pt", "twip", "pixel", "sys[font]", "app[font]", "rel", "abs"
578
111k
                        };
579
111k
      o << wh[m_unit] << ",";
580
111k
    }
581
2.30k
    else {
582
2.30k
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeFontSize::print: unknown font unit\n"));
583
2.30k
      o << "#unit=" << m_unit << ",";
584
2.30k
    }
585
114k
    o << "],";
586
114k
  }
587
588
protected:
589
  //! copy constructor
590
90.9k
  StarCAttributeFontSize(StarCAttributeFontSize const &) = default;
591
  //! the font size
592
  int m_size;
593
  //! the font proportion
594
  int m_proportion;
595
  //! the font unit
596
  int m_unit;
597
};
598
599
//! a charFormat attribute
600
class StarCAttributeCharFormat final : public StarAttribute
601
{
602
public:
603
  //! constructor
604
  StarCAttributeCharFormat(Type type, std::string const &debugName)
605
146k
    : StarAttribute(type, debugName), m_name("")
606
146k
  {
607
146k
  }
608
  //! create a new attribute
609
  std::shared_ptr<StarAttribute> create() const final
610
458
  {
611
458
    return std::shared_ptr<StarAttribute>(new StarCAttributeCharFormat(*this));
612
458
  }
613
  //! debug function to print the data
614
  void printData(libstoff::DebugStream &o) const final
615
276
  {
616
276
    o << m_debugName;
617
276
    if (!m_name.empty()) o << "=" << m_name.cstr();
618
276
    o << ",";
619
276
  }
620
  //! read a zone
621
  bool read(StarZone &zone, int vers, long endPos, StarObject &object) final;
622
  //! add to a font
623
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
624
protected:
625
  //! copy constructor
626
458
  StarCAttributeCharFormat(StarCAttributeCharFormat const &) = default;
627
  //! the charFormat
628
  librevenge::RVNGString m_name;
629
};
630
631
//! a content attribute
632
class StarCAttributeContent final : public StarAttribute
633
{
634
public:
635
  //! constructor
636
  StarCAttributeContent(Type type, std::string const &debugName)
637
146k
    : StarAttribute(type, debugName)
638
146k
    , m_content()
639
146k
  {
640
146k
  }
641
  //! create a new attribute
642
  std::shared_ptr<StarAttribute> create() const final
643
15.1k
  {
644
15.1k
    return std::shared_ptr<StarAttribute>(new StarCAttributeContent(*this));
645
15.1k
  }
646
  //! read a zone
647
  bool read(StarZone &zone, int vers, long endPos, StarObject &object) final;
648
  //! add to a font
649
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
650
  //! debug function to print the data
651
  void printData(libstoff::DebugStream &o) const final
652
4.90k
  {
653
4.90k
    o << m_debugName << "=[";
654
4.90k
    if (!m_content) o << "empty,";
655
4.90k
    o << "],";
656
4.90k
  }
657
  //! add to send the zone data
658
  bool send(STOFFListenerPtr &listener, StarState &state, std::set<StarAttribute const *> &done) const final;
659
protected:
660
  //! copy constructor
661
15.1k
  StarCAttributeContent(StarCAttributeContent const &) = default;
662
  //! the content
663
  std::shared_ptr<StarObjectTextInternal::Content> m_content;
664
};
665
666
//! a field attribute
667
class StarCAttributeField final : public StarAttribute
668
{
669
public:
670
  //! constructor
671
  StarCAttributeField(Type type, std::string const &debugName)
672
293k
    : StarAttribute(type, debugName)
673
293k
    , m_field()
674
293k
  {
675
293k
  }
676
  //! create a new attribute
677
  std::shared_ptr<StarAttribute> create() const final
678
18.8k
  {
679
18.8k
    return std::shared_ptr<StarAttribute>(new StarCAttributeField(*this));
680
18.8k
  }
681
  //! read a zone
682
  bool read(StarZone &zone, int vers, long endPos, StarObject &object) final;
683
  //! add to a font
684
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
685
protected:
686
  //! copy constructor
687
18.8k
  StarCAttributeField(StarCAttributeField const &) = default;
688
  //! the field
689
  std::shared_ptr<SWFieldManagerInternal::Field> m_field;
690
};
691
692
//! a txtFlyCnt attribute
693
class StarCAttributeFlyCnt final : public StarAttribute
694
{
695
public:
696
  //! constructor
697
  StarCAttributeFlyCnt(Type type, std::string const &debugName)
698
146k
    : StarAttribute(type, debugName)
699
146k
    , m_format()
700
146k
  {
701
146k
  }
702
  //! create a new attribute
703
  std::shared_ptr<StarAttribute> create() const final
704
3.56k
  {
705
3.56k
    return std::shared_ptr<StarAttribute>(new StarCAttributeFlyCnt(*this));
706
3.56k
  }
707
  //! add to the state
708
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
709
  //! read a zone
710
  bool read(StarZone &zone, int vers, long endPos, StarObject &object) final;
711
  //! debug function to print the data
712
  void printData(libstoff::DebugStream &o) const final
713
3.29k
  {
714
3.29k
    o << m_debugName << ",";
715
3.29k
  }
716
  //! add to send the zone data
717
  bool send(STOFFListenerPtr &listener, StarState &state, std::set<StarAttribute const *> &done) const final;
718
protected:
719
  //! copy constructor
720
3.56k
  StarCAttributeFlyCnt(StarCAttributeFlyCnt const &) = default;
721
  //! the format
722
  std::shared_ptr<StarFormatManagerInternal::FormatDef> m_format;
723
};
724
725
//! a footnote attribute
726
class StarCAttributeFootnote final : public StarAttribute
727
{
728
public:
729
  //! constructor
730
  StarCAttributeFootnote(Type type, std::string const &debugName)
731
146k
    : StarAttribute(type, debugName)
732
146k
    , m_number(0)
733
146k
    , m_label("")
734
146k
    , m_content()
735
146k
    , m_numSeq(0)
736
146k
    , m_flags(0)
737
146k
  {
738
146k
  }
739
  //! create a new attribute
740
  std::shared_ptr<StarAttribute> create() const final
741
4.91k
  {
742
4.91k
    return std::shared_ptr<StarAttribute>(new StarCAttributeFootnote(*this));
743
4.91k
  }
744
  //! read a zone
745
  bool read(StarZone &zone, int vers, long endPos, StarObject &object) final;
746
  //! add to a font
747
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
748
  //! debug function to print the data
749
  void printData(libstoff::DebugStream &o) const final
750
3.82k
  {
751
3.82k
    o << m_debugName << "=[";
752
3.82k
    if (m_number) o << "number=" << m_number << ",";
753
3.82k
    if (!m_label.empty()) o << "label=" << m_label.cstr() << ",";
754
3.82k
    if (!m_content) o << "empty,";
755
3.82k
    if (m_numSeq) o << "numSeq=" << m_numSeq << ",";
756
3.82k
    if (m_flags) o << "flags=" << std::hex << m_flags << std::dec << ",";
757
3.82k
    o << "],";
758
3.82k
  }
759
  //! add to send the zone data
760
  bool send(STOFFListenerPtr &listener, StarState &state, std::set<StarAttribute const *> &done) const final;
761
protected:
762
  //! copy constructor
763
4.91k
  StarCAttributeFootnote(StarCAttributeFootnote const &) = default;
764
  //! the numbering
765
  int m_number;
766
  //! the label
767
  librevenge::RVNGString m_label;
768
  //! the content
769
  std::shared_ptr<StarObjectTextInternal::Content> m_content;
770
  //! the sequential number
771
  int m_numSeq;
772
  //! the flags
773
  int m_flags;
774
};
775
776
777
//! a hardBlank attribute
778
class StarCAttributeHardBlank final : public StarAttribute
779
{
780
public:
781
  //! constructor
782
146k
  StarCAttributeHardBlank(Type type, std::string const &debugName) : StarAttribute(type, debugName), m_char(0)
783
146k
  {
784
146k
  }
785
  //! create a new attribute
786
  std::shared_ptr<StarAttribute> create() const final
787
612
  {
788
612
    return std::shared_ptr<StarAttribute>(new StarCAttributeHardBlank(*this));
789
612
  }
790
  //! read a zone
791
  bool read(StarZone &zone, int vers, long endPos, StarObject &object) final;
792
  //! add to a font
793
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
794
  //! debug function to print the data
795
  void printData(libstoff::DebugStream &o) const final
796
404
  {
797
404
    o << m_debugName;
798
404
    if (m_char) o << "=" << char(m_char);
799
404
    o << ",";
800
404
  }
801
protected:
802
  //! copy constructor
803
612
  StarCAttributeHardBlank(StarCAttributeHardBlank const &) = default;
804
  //! the character
805
  uint8_t m_char;
806
};
807
808
//! a INetFmt attribute: ie. a link, ...
809
class StarCAttributeINetFmt final : public StarAttribute
810
{
811
public:
812
  //! constructor
813
  StarCAttributeINetFmt(Type type, std::string const &debugName)
814
146k
    : StarAttribute(type, debugName)
815
146k
    , m_url("")
816
146k
    , m_target("")
817
146k
    , m_name("")
818
146k
    , m_libNames()
819
146k
  {
820
293k
    for (int &indice : m_indices) indice=0xFFFF;
821
146k
  }
822
  //! create a new attribute
823
  std::shared_ptr<StarAttribute> create() const final
824
3.04k
  {
825
3.04k
    return std::shared_ptr<StarAttribute>(new StarCAttributeINetFmt(*this));
826
3.04k
  }
827
  //! read a zone
828
  bool read(StarZone &zone, int vers, long endPos, StarObject &object) final;
829
  //! add to a font
830
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
831
  //! debug function to print the data
832
  void printData(libstoff::DebugStream &o) const final
833
1.60k
  {
834
1.60k
    o << m_debugName << "=[";
835
1.60k
    if (!m_url.empty()) o << "url=" << m_url.cstr() << ",";
836
1.60k
    if (!m_target.empty()) o << "target=" << m_target.cstr() << ",";
837
1.60k
    if (!m_name.empty()) o << "name=" << m_name.cstr() << ",";
838
4.82k
    for (int i=0; i<2; ++i) {
839
3.21k
      if (m_indices[i]!=0xFFFF) o << "index" << i << "=" << m_indices[i] << ",";
840
3.21k
    }
841
1.60k
    if (!m_libNames.empty()) {
842
330
      o << "libNames=[";
843
2.27k
      for (size_t i=0; i+1<m_libNames.size(); i+=2)
844
1.94k
        o << m_libNames[i].cstr() << ":" <<  m_libNames[i+1].cstr() << ",";
845
330
      o << "],";
846
330
    }
847
1.60k
    o << "],";
848
1.60k
  }
849
protected:
850
  //! copy constructor
851
3.04k
  StarCAttributeINetFmt(StarCAttributeINetFmt const &) = default;
852
  //! the url
853
  librevenge::RVNGString m_url;
854
  //! the target
855
  librevenge::RVNGString m_target;
856
  //! the name
857
  librevenge::RVNGString m_name;
858
  //! two indices
859
  int m_indices[2];
860
  //! the lib names
861
  std::vector<librevenge::RVNGString> m_libNames;
862
  // also a list of key, name1, name2, scriptType
863
};
864
865
//! a refMark attribute
866
class StarCAttributeRefMark final : public StarAttribute
867
{
868
public:
869
  //! constructor
870
  StarCAttributeRefMark(Type type, std::string const &debugName)
871
146k
    : StarAttribute(type, debugName)
872
146k
    , m_name("")
873
146k
  {
874
146k
  }
875
  //! create a new attribute
876
  std::shared_ptr<StarAttribute> create() const final
877
964
  {
878
964
    return std::shared_ptr<StarAttribute>(new StarCAttributeRefMark(*this));
879
964
  }
880
  //! read a zone
881
  bool read(StarZone &zone, int vers, long endPos, StarObject &object) final;
882
  //! add to a font
883
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
884
  //! debug function to print the data
885
  void printData(libstoff::DebugStream &o) const final
886
360
  {
887
360
    o << m_debugName;
888
360
    if (!m_name.empty()) o << "=" << m_name.cstr();
889
360
    o << ",";
890
360
  }
891
protected:
892
  //! copy constructor
893
964
  StarCAttributeRefMark(StarCAttributeRefMark const &) = default;
894
  //! the name
895
  librevenge::RVNGString m_name;
896
};
897
898
void StarCAttributeEscapement::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
899
10.8k
{
900
10.8k
  std::stringstream s;
901
10.8k
  s << m_delta << "% " << m_scale << "%";
902
10.8k
  state.m_font.m_propertyList.insert("style:text-position", s.str().c_str());
903
10.8k
}
904
905
void StarCAttributeFont::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
906
416k
{
907
416k
  if (!m_name.empty()) {
908
392k
    if (m_type==ATTR_CHR_FONT)
909
244k
      state.m_font.m_propertyList.insert("style:font-name", m_name);
910
147k
    else if (m_type==ATTR_CHR_CJK_FONT)
911
45.3k
      state.m_font.m_propertyList.insert("style:font-name-asian", m_name);
912
102k
    else if (m_type==ATTR_CHR_CTL_FONT)
913
102k
      state.m_font.m_propertyList.insert("style:font-name-complex", m_name);
914
392k
  }
915
416k
  if (m_pitch==1 || m_pitch==2) {
916
345k
    if (m_type==ATTR_CHR_FONT)
917
199k
      state.m_font.m_propertyList.insert("style:font-pitch", m_pitch==1 ? "fixed" : "variable");
918
145k
    else if (m_type==ATTR_CHR_CJK_FONT)
919
45.2k
      state.m_font.m_propertyList.insert("style:font-pitch-asian", m_pitch==1 ? "fixed" : "variable");
920
100k
    else if (m_type==ATTR_CHR_CTL_FONT)
921
100k
      state.m_font.m_propertyList.insert("style:font-pitch-complex", m_pitch==1 ? "fixed" : "variable");
922
345k
  }
923
  // TODO m_style, m_family
924
416k
}
925
926
void StarCAttributeFontSize::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
927
544k
{
928
544k
  std::string wh(m_type==ATTR_CHR_FONTSIZE ? "fo:font-size" :
929
544k
                 m_type==ATTR_CHR_CJK_FONTSIZE ? "style:font-size-asian" :
930
223k
                 m_type==ATTR_CHR_CTL_FONTSIZE ? "style:font-size-complex" :
931
110k
                 "");
932
544k
  if (wh.empty())
933
0
    return;
934
  // TODO: use m_proportion?
935
544k
  switch (m_unit) {
936
5.20k
  case 0:
937
5.20k
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)*0.02756, librevenge::RVNG_POINT);
938
5.20k
    break;
939
271
  case 1:
940
271
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)*0.2756, librevenge::RVNG_POINT);
941
271
    break;
942
1.48k
  case 2:
943
1.48k
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)*2.756, librevenge::RVNG_POINT);
944
1.48k
    break;
945
1.45k
  case 3:
946
1.45k
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)*27.56, librevenge::RVNG_POINT);
947
1.45k
    break;
948
145
  case 4:
949
145
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)/1000., librevenge::RVNG_INCH);
950
145
    break;
951
3.23k
  case 5:
952
3.23k
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)/100., librevenge::RVNG_INCH);
953
3.23k
    break;
954
236
  case 6:
955
236
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)/10., librevenge::RVNG_INCH);
956
236
    break;
957
214
  case 7:
958
214
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size), librevenge::RVNG_INCH);
959
214
    break;
960
108
  case 8:
961
108
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size), librevenge::RVNG_POINT);
962
108
    break;
963
1.53k
  case 9: // TWIP
964
1.53k
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)/20., librevenge::RVNG_POINT);
965
1.53k
    break;
966
61
  case 10: // pixel
967
61
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size), librevenge::RVNG_POINT);
968
61
    break;
969
518k
  case 13: // rel, checkme
970
518k
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)*state.m_global->m_relativeUnit, librevenge::RVNG_POINT);
971
518k
    break;
972
12.4k
  default: // checkme
973
12.4k
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)/20., librevenge::RVNG_POINT);
974
12.4k
    break;
975
544k
  }
976
544k
}
977
978
void StarCAttributeCharFormat::addTo(StarState &state, std::set<StarAttribute const *> &done) const
979
1.37k
{
980
1.37k
  if (done.find(this) != done.end())
981
0
    return;
982
1.37k
  done.insert(this);
983
1.37k
  if (m_type==ATTR_TXT_CHARFMT) {
984
1.37k
    if (m_name.empty() || !state.m_global->m_pool) return;
985
114
    auto const *style=state.m_global->m_pool->findStyleWithFamily(m_name, StarItemStyle::F_Char);
986
114
    if (style) {
987
102
      state.m_font=STOFFFont();
988
102
      StarItemSet const &itemSet=style->m_itemSet;
989
102
      std::map<int, std::shared_ptr<StarItem> >::const_iterator it;
990
1.29k
      for (it=itemSet.m_whichToItemMap.begin(); it!=itemSet.m_whichToItemMap.end(); ++it) {
991
1.19k
        if (it->second && it->second->m_attribute)
992
1.09k
          it->second->m_attribute->addTo(state, done);
993
1.19k
      }
994
995
102
    }
996
114
  }
997
1.37k
}
998
999
void StarCAttributeContent::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
1000
6.29k
{
1001
6.29k
  state.m_content=true;
1002
6.29k
}
1003
1004
void StarCAttributeField::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
1005
6.94k
{
1006
6.94k
  state.m_field=m_field;
1007
6.94k
}
1008
1009
void StarCAttributeFlyCnt::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
1010
4.57k
{
1011
4.57k
  state.m_flyCnt=true;
1012
4.57k
}
1013
1014
void StarCAttributeFootnote::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
1015
4.59k
{
1016
4.59k
  state.m_footnote=true;
1017
4.59k
}
1018
1019
void StarCAttributeHardBlank::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
1020
194
{
1021
194
  state.m_font.m_hardBlank=true;
1022
194
}
1023
1024
void StarCAttributeINetFmt::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
1025
2.18k
{
1026
2.18k
  if (m_url.empty()) {
1027
939
    STOFF_DEBUG_MSG(("StarCAttributeINetFmt::addTo: can not find the url\n"));
1028
939
    return;
1029
939
  }
1030
1.24k
  state.m_link=m_url;
1031
1.24k
}
1032
1033
void StarCAttributeRefMark::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
1034
644
{
1035
644
  state.m_refMark=m_name;
1036
644
}
1037
1038
bool StarCAttributeEscapement::read(StarZone &zone, int /*vers*/, long endPos, StarObject &/*object*/)
1039
2.78k
{
1040
2.78k
  STOFFInputStreamPtr input=zone.input();
1041
2.78k
  long pos=input->tell();
1042
2.78k
  libstoff::DebugFile &ascFile=zone.ascii();
1043
2.78k
  libstoff::DebugStream f;
1044
2.78k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1045
2.78k
  m_scale=int(input->readULong(1));
1046
2.78k
  m_delta=int(input->readLong(2));
1047
2.78k
  printData(f);
1048
2.78k
  ascFile.addPos(pos);
1049
2.78k
  ascFile.addNote(f.str().c_str());
1050
2.78k
  return input->tell()<=endPos;
1051
2.78k
}
1052
1053
bool StarCAttributeFont::read(StarZone &zone, int /*vers*/, long endPos, StarObject &/*object*/)
1054
46.9k
{
1055
46.9k
  STOFFInputStreamPtr input=zone.input();
1056
46.9k
  long pos=input->tell();
1057
46.9k
  libstoff::DebugFile &ascFile=zone.ascii();
1058
46.9k
  libstoff::DebugStream f;
1059
46.9k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1060
1061
46.9k
  m_family=int(input->readULong(1));
1062
46.9k
  m_pitch=int(input->readULong(1));
1063
46.9k
  m_encoding=int(input->readULong(1));
1064
46.9k
  std::vector<uint32_t> fName, string;
1065
46.9k
  if (!zone.readString(fName)) {
1066
1.40k
    STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeFont::read: can not find the name\n"));
1067
1.40k
    printData(f);
1068
1.40k
    f << "###aName,";
1069
1.40k
    ascFile.addPos(pos);
1070
1.40k
    ascFile.addNote(f.str().c_str());
1071
1.40k
    return false;
1072
1.40k
  }
1073
45.5k
  m_name=libstoff::getString(fName);
1074
45.5k
  if (!zone.readString(string)) {
1075
1.55k
    STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeFont::read: can not find the style\n"));
1076
1.55k
    printData(f);
1077
1.55k
    f << "###aStyle,";
1078
1.55k
    ascFile.addPos(pos);
1079
1.55k
    ascFile.addNote(f.str().c_str());
1080
1.55k
    return false;
1081
1.55k
  }
1082
43.9k
  m_style=libstoff::getString(string).cstr();
1083
43.9k
  if (m_encoding!=10 && libstoff::getString(fName)=="StarBats" && input->tell()<endPos) {
1084
29
    if (input->readULong(4)==0xFE331188) {
1085
      // reread data in unicode
1086
0
      if (!zone.readString(fName)) {
1087
0
        STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeFont::read: can not find the name\n"));
1088
0
        printData(f);
1089
0
        f << "###aName,";
1090
0
        ascFile.addPos(pos);
1091
0
        ascFile.addNote(f.str().c_str());
1092
0
        return false;
1093
0
      }
1094
0
      if (!fName.empty())
1095
0
        f << "aNameUni=" << libstoff::getString(fName).cstr() << ",";
1096
0
      if (!zone.readString(string)) {
1097
0
        STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeFont::read: can not find the style\n"));
1098
0
        printData(f);
1099
0
        f << "###aStyle,";
1100
0
        ascFile.addPos(pos);
1101
0
        ascFile.addNote(f.str().c_str());
1102
0
        return false;
1103
0
      }
1104
0
      if (!string.empty())
1105
0
        f << "aStyleUni=" << libstoff::getString(string).cstr() << ",";
1106
0
    }
1107
29
    else input->seek(-3, librevenge::RVNG_SEEK_CUR);
1108
29
  }
1109
1110
43.9k
  printData(f);
1111
43.9k
  ascFile.addPos(pos);
1112
43.9k
  ascFile.addNote(f.str().c_str());
1113
43.9k
  return input->tell()<=endPos;
1114
43.9k
}
1115
1116
bool StarCAttributeFontSize::read(StarZone &zone, int nVers, long endPos, StarObject &/*object*/)
1117
84.2k
{
1118
84.2k
  STOFFInputStreamPtr input=zone.input();
1119
84.2k
  long pos=input->tell();
1120
84.2k
  libstoff::DebugFile &ascFile=zone.ascii();
1121
84.2k
  libstoff::DebugStream f;
1122
84.2k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1123
84.2k
  m_size=int(input->readULong(2));
1124
84.2k
  m_proportion=int(input->readULong((nVers>=1) ? 2 : 1));
1125
84.2k
  if (nVers>=2) m_unit=int(input->readULong(2));
1126
84.2k
  printData(f);
1127
84.2k
  ascFile.addPos(pos);
1128
84.2k
  ascFile.addNote(f.str().c_str());
1129
84.2k
  return input->tell()<=endPos;
1130
84.2k
}
1131
1132
bool StarCAttributeCharFormat::read(StarZone &zone, int /*nVers*/, long endPos, StarObject &/*object*/)
1133
276
{
1134
276
  STOFFInputStreamPtr input=zone.input();
1135
276
  long pos=input->tell();
1136
276
  libstoff::DebugFile &ascFile=zone.ascii();
1137
276
  libstoff::DebugStream f;
1138
276
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1139
  // fmtAttr2: SwFmtCharFmt
1140
276
  auto id=int(input->readULong(2));
1141
276
  if (!zone.getPoolName(id, m_name)) {
1142
228
    STOFF_DEBUG_MSG(("StarCAttributeCharFormat::read: can not find the style name\n"));
1143
228
    f << "###id=" << id << ",";
1144
228
  }
1145
276
  printData(f);
1146
276
  ascFile.addPos(pos);
1147
276
  ascFile.addNote(f.str().c_str());
1148
276
  return input->tell()<=endPos;
1149
276
}
1150
1151
bool StarCAttributeContent::read(StarZone &zone, int /*nVers*/, long endPos, StarObject &object)
1152
15.0k
{
1153
15.0k
  STOFFInputStreamPtr input=zone.input();
1154
15.0k
  long pos=input->tell();
1155
15.0k
  libstoff::DebugFile &ascFile=zone.ascii();
1156
15.0k
  libstoff::DebugStream f;
1157
15.0k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1158
15.0k
  StarObjectText text(object, false); // checkme
1159
15.0k
  if (!text.readSWContent(zone, m_content)) {
1160
10.1k
    STOFF_DEBUG_MSG(("StarCAttributeContent::read: can not find the content\n"));
1161
10.1k
    f << "###aContent,";
1162
10.1k
    ascFile.addPos(pos);
1163
10.1k
    ascFile.addNote(f.str().c_str());
1164
10.1k
    return false;
1165
10.1k
  }
1166
4.90k
  printData(f);
1167
4.90k
  ascFile.addPos(pos);
1168
4.90k
  ascFile.addNote(f.str().c_str());
1169
4.90k
  return input->tell()<=endPos;
1170
15.0k
}
1171
1172
bool StarCAttributeField::read(StarZone &zone, int /*nVers*/, long endPos, StarObject &/*object*/)
1173
17.6k
{
1174
17.6k
  STOFFInputStreamPtr input=zone.input();
1175
17.6k
  long pos=input->tell();
1176
17.6k
  libstoff::DebugFile &ascFile=zone.ascii();
1177
17.6k
  libstoff::DebugStream f;
1178
17.6k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1179
17.6k
  SWFieldManager fieldManager;
1180
17.6k
  if (m_type==StarAttribute::ATTR_TXT_FIELD)
1181
8.93k
    m_field=fieldManager.readField(zone);
1182
8.70k
  else
1183
8.70k
    m_field=fieldManager.readPersistField(zone, endPos);
1184
17.6k
  if (!m_field || input->tell()>endPos) {
1185
5.13k
    STOFF_DEBUG_MSG(("StarCAttributeField::read: can not find the field\n"));
1186
5.13k
    printData(f);
1187
5.13k
    f << "###field,";
1188
5.13k
    ascFile.addPos(pos);
1189
5.13k
    ascFile.addNote(f.str().c_str());
1190
5.13k
    return false;
1191
5.13k
  }
1192
12.5k
  printData(f);
1193
12.5k
  ascFile.addPos(pos);
1194
12.5k
  ascFile.addNote(f.str().c_str());
1195
12.5k
  return m_field && input->tell()<=endPos;
1196
17.6k
}
1197
1198
bool StarCAttributeFlyCnt::read(StarZone &zone, int /*vers*/, long endPos, StarObject &object)
1199
3.29k
{
1200
3.29k
  STOFFInputStreamPtr input=zone.input();
1201
3.29k
  long pos=input->tell();
1202
3.29k
  libstoff::DebugFile &ascFile=zone.ascii();
1203
3.29k
  libstoff::DebugStream f;
1204
3.29k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1205
3.29k
  if (input->peek()=='o')
1206
72
    object.getFormatManager()->readSWFormatDef(zone,'o', m_format, object);
1207
3.22k
  else
1208
3.22k
    object.getFormatManager()->readSWFormatDef(zone,'l', m_format, object);
1209
3.29k
  printData(f);
1210
3.29k
  ascFile.addPos(pos);
1211
3.29k
  ascFile.addNote(f.str().c_str());
1212
3.29k
  return input->tell()<=endPos;
1213
3.29k
}
1214
1215
bool StarCAttributeFootnote::read(StarZone &zone, int nVers, long endPos, StarObject &object)
1216
4.63k
{
1217
4.63k
  STOFFInputStreamPtr input=zone.input();
1218
4.63k
  long pos=input->tell();
1219
4.63k
  libstoff::DebugFile &ascFile=zone.ascii();
1220
4.63k
  libstoff::DebugStream f;
1221
4.63k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1222
  // sw_sw3npool.cxx SwFmtFtn::Create
1223
4.63k
  m_number=int(input->readULong(2));
1224
4.63k
  std::vector<uint32_t> string;
1225
4.63k
  if (!zone.readString(string)) {
1226
97
    STOFF_DEBUG_MSG(("StarCAttributeFootnote::read: can not find the aNumber\n"));
1227
97
    printData(f);
1228
97
    f << "###aNumber,";
1229
97
    ascFile.addPos(pos);
1230
97
    ascFile.addNote(f.str().c_str());
1231
97
    return false;
1232
97
  }
1233
4.53k
  if (!string.empty())
1234
739
    m_label=libstoff::getString(string).cstr();
1235
  // no sure, find this attribute once with a content here, so ...
1236
4.53k
  StarObjectText text(object, false); // checkme
1237
4.53k
  if (!text.readSWContent(zone, m_content)) {
1238
809
    STOFF_DEBUG_MSG(("StarCAttributeFootnote::read: can not find the content\n"));
1239
809
    f << "###aContent,";
1240
809
    ascFile.addPos(pos);
1241
809
    ascFile.addNote(f.str().c_str());
1242
809
    return false;
1243
809
  }
1244
3.72k
  if (nVers>=1)
1245
3.72k
    m_numSeq=int(input->readULong(2));
1246
3.72k
  if (nVers>=2)
1247
216
    m_flags=int(input->readULong(1));
1248
1249
3.72k
  printData(f);
1250
3.72k
  ascFile.addPos(pos);
1251
3.72k
  ascFile.addNote(f.str().c_str());
1252
3.72k
  return input->tell()<=endPos;
1253
4.53k
}
1254
1255
bool StarCAttributeHardBlank::read(StarZone &zone, int nVers, long endPos, StarObject &/*object*/)
1256
404
{
1257
404
  STOFFInputStreamPtr input=zone.input();
1258
404
  long pos=input->tell();
1259
404
  libstoff::DebugFile &ascFile=zone.ascii();
1260
404
  libstoff::DebugStream f;
1261
404
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1262
404
  if (nVers>=1)
1263
137
    *input >> m_char;
1264
404
  printData(f);
1265
404
  ascFile.addPos(pos);
1266
404
  ascFile.addNote(f.str().c_str());
1267
404
  return input->tell()<=endPos;
1268
404
}
1269
1270
bool StarCAttributeINetFmt::read(StarZone &zone, int nVers, long endPos, StarObject &/*object*/)
1271
2.57k
{
1272
2.57k
  STOFFInputStreamPtr input=zone.input();
1273
2.57k
  long pos=input->tell();
1274
2.57k
  libstoff::DebugFile &ascFile=zone.ascii();
1275
2.57k
  libstoff::DebugStream f;
1276
2.57k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1277
  // SwFmtINetFmt::Create
1278
2.57k
  std::vector<uint32_t> string;
1279
6.68k
  for (int i=0; i<2; ++i) {
1280
4.72k
    if (!zone.readString(string)) {
1281
614
      STOFF_DEBUG_MSG(("StarCAttributeINetFmt::read: can not find string\n"));
1282
614
      f << "###" << (i==0 ? "url" : "target") << ",";
1283
614
      ascFile.addPos(pos);
1284
614
      ascFile.addNote(f.str().c_str());
1285
614
      return false;
1286
614
    }
1287
4.10k
    if (i==0)
1288
2.14k
      m_url=libstoff::getString(string);
1289
1.96k
    else
1290
1.96k
      m_target=libstoff::getString(string);
1291
4.10k
  }
1292
3.92k
  for (int &indice : m_indices) indice=int(input->readULong(2));
1293
1.96k
  auto nCnt=int(input->readULong(2));
1294
8.29k
  for (int i=0; i<2*nCnt; ++i) {
1295
6.70k
    if (!zone.readString(string) || input->tell()>endPos) {
1296
370
      STOFF_DEBUG_MSG(("StarCAttributeINetFmt::read: can not read a string\n"));
1297
370
      printData(f);
1298
370
      f << "###string,";
1299
370
      ascFile.addPos(pos);
1300
370
      ascFile.addNote(f.str().c_str());
1301
370
      return false;
1302
370
    }
1303
6.33k
    m_libNames.push_back(libstoff::getString(string));
1304
6.33k
  }
1305
1.59k
  if (nVers>=1) {
1306
1.46k
    if (!zone.readString(string)) {
1307
46
      STOFF_DEBUG_MSG(("StarCAttributeINetFmt::read: can not find string\n"));
1308
46
      printData(f);
1309
46
      f << "###aName1,";
1310
46
      ascFile.addPos(pos);
1311
46
      ascFile.addNote(f.str().c_str());
1312
46
      return false;
1313
46
    }
1314
1.41k
    m_name=libstoff::getString(string);
1315
1.41k
  }
1316
1.54k
  if (nVers>=2) {
1317
1.41k
    nCnt=int(input->readULong(2));
1318
1.41k
    f << "libMac2=[";
1319
2.53k
    for (int i=0; i<nCnt; ++i) {
1320
1.47k
      f << "nCurKey=" << input->readULong(2) << ",";
1321
1.47k
      if (!zone.readString(string) || input->tell()>endPos) {
1322
197
        STOFF_DEBUG_MSG(("StarCAttributeINetFmt::read: can not read a string\n"));
1323
197
        f << "###aName1,";
1324
197
        ascFile.addPos(pos);
1325
197
        ascFile.addNote(f.str().c_str());
1326
197
        return false;
1327
197
      }
1328
1.27k
      else if (!string.empty())
1329
196
        f << libstoff::getString(string).cstr() << ":";
1330
1.27k
      if (!zone.readString(string)|| input->tell()>endPos) {
1331
158
        STOFF_DEBUG_MSG(("StarCAttributeINetFmt::read: can not read a string\n"));
1332
158
        f << "###aName1,";
1333
158
        ascFile.addPos(pos);
1334
158
        ascFile.addNote(f.str().c_str());
1335
158
        return false;
1336
158
      }
1337
1.12k
      else if (!string.empty())
1338
93
        f << libstoff::getString(string).cstr();
1339
1.12k
      f << "nScriptType=" << input->readULong(2) << ",";
1340
1.12k
    }
1341
1.06k
    f << "],";
1342
1.06k
  }
1343
1.19k
  printData(f);
1344
1.19k
  ascFile.addPos(pos);
1345
1.19k
  ascFile.addNote(f.str().c_str());
1346
1.19k
  return input->tell()<=endPos;
1347
1.54k
}
1348
1349
bool StarCAttributeRefMark::read(StarZone &zone, int /*nVers*/, long endPos, StarObject &/*object*/)
1350
583
{
1351
583
  STOFFInputStreamPtr input=zone.input();
1352
583
  long pos=input->tell();
1353
583
  libstoff::DebugFile &ascFile=zone.ascii();
1354
583
  libstoff::DebugStream f;
1355
583
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1356
583
  std::vector<uint32_t> string;
1357
583
  if (!zone.readString(string)) {
1358
223
    STOFF_DEBUG_MSG(("StarCAttributeRefMark::read: can not find the name\n"));
1359
223
    f << "###name,";
1360
223
    ascFile.addPos(pos);
1361
223
    ascFile.addNote(f.str().c_str());
1362
223
    return false;
1363
223
  }
1364
360
  m_name=libstoff::getString(string);
1365
360
  printData(f);
1366
360
  ascFile.addPos(pos);
1367
360
  ascFile.addNote(f.str().c_str());
1368
360
  return input->tell()<=endPos;
1369
583
}
1370
1371
bool StarCAttributeContent::send(STOFFListenerPtr &listener, StarState &state, std::set<StarAttribute const *> &done) const
1372
4.72k
{
1373
4.72k
  if (done.find(this)!=done.end()) {
1374
0
    STOFF_DEBUG_MSG(("StarCAttributeContent::send: find a loop\n"));
1375
0
    return false;
1376
0
  }
1377
4.72k
  done.insert(this);
1378
4.72k
  if (!listener) {
1379
0
    STOFF_DEBUG_MSG(("StarCAttributeContent::send: can not find the listener\n"));
1380
0
    return false;
1381
0
  }
1382
4.72k
  if (m_content) // checkme zone time, we need probably to create a frame
1383
4.72k
    m_content->send(listener, state, !state.m_headerFooter);
1384
4.72k
  return true;
1385
4.72k
}
1386
1387
bool StarCAttributeFlyCnt::send(STOFFListenerPtr &listener, StarState &state, std::set<StarAttribute const *> &done) const
1388
2.95k
{
1389
2.95k
  if (done.find(this)!=done.end()) {
1390
0
    STOFF_DEBUG_MSG(("StarCAttributeFlyCnt::send: find a loop\n"));
1391
0
    return false;
1392
0
  }
1393
2.95k
  done.insert(this);
1394
2.95k
  if (!listener) {
1395
0
    STOFF_DEBUG_MSG(("StarCAttributeFlyCnt::send: can not find the listener\n"));
1396
0
    return false;
1397
0
  }
1398
2.95k
  if (!m_format) {
1399
105
    STOFF_DEBUG_MSG(("StarCAttributeFlyCnt::send: can not find the format\n"));
1400
105
    return false;
1401
105
  }
1402
2.84k
  return m_format->send(listener, state);
1403
2.95k
}
1404
1405
bool StarCAttributeFootnote::send(STOFFListenerPtr &listener, StarState &state, std::set<StarAttribute const *> &done) const
1406
3.51k
{
1407
3.51k
  if (done.find(this)!=done.end()) {
1408
0
    STOFF_DEBUG_MSG(("StarCAttributeFootnote::send: find a loop\n"));
1409
0
    return false;
1410
0
  }
1411
3.51k
  done.insert(this);
1412
3.51k
  if (!listener || !listener->canWriteText()) {
1413
0
    STOFF_DEBUG_MSG(("StarCAttributeFootnote::send: can not find the listener\n"));
1414
0
    return false;
1415
0
  }
1416
3.51k
  STOFFSubDocumentPtr subDocument(new SubDocument(m_content, state.m_global));
1417
3.51k
  STOFFNote note(STOFFNote::FootNote);
1418
3.51k
  if (m_label.empty())
1419
3.51k
    note.m_label=m_label;
1420
0
  else
1421
0
    note.m_number=m_number;
1422
3.51k
  listener->insertNote(note, subDocument);
1423
3.51k
  return true;
1424
3.51k
}
1425
1426
}
1427
1428
namespace StarCharAttribute
1429
{
1430
void addInitTo(std::map<int, std::shared_ptr<StarAttribute> > &map)
1431
146k
{
1432
146k
  map[StarAttribute::ATTR_CHR_FONT]=std::shared_ptr<StarAttribute>(new StarCAttributeFont(StarAttribute::ATTR_CHR_FONT,"chrAtrFont"));
1433
146k
  map[StarAttribute::ATTR_CHR_CJK_FONT]=std::shared_ptr<StarAttribute>(new StarCAttributeFont(StarAttribute::ATTR_CHR_CJK_FONT,"chrAtrCJKFont"));
1434
146k
  map[StarAttribute::ATTR_CHR_CTL_FONT]=std::shared_ptr<StarAttribute>(new StarCAttributeFont(StarAttribute::ATTR_CHR_CTL_FONT,"chrAtrCTLFont"));
1435
146k
  map[StarAttribute::ATTR_CHR_FONTSIZE]=std::shared_ptr<StarAttribute>(new StarCAttributeFontSize(StarAttribute::ATTR_CHR_FONTSIZE,"chrAtrFontsize"));
1436
146k
  map[StarAttribute::ATTR_CHR_CJK_FONTSIZE]=std::shared_ptr<StarAttribute>(new StarCAttributeFontSize(StarAttribute::ATTR_CHR_CJK_FONTSIZE,"chrAtrCJKFontsize"));
1437
146k
  map[StarAttribute::ATTR_CHR_CTL_FONTSIZE]=std::shared_ptr<StarAttribute>(new StarCAttributeFontSize(StarAttribute::ATTR_CHR_CTL_FONTSIZE,"chrAtrCTLFontsize"));
1438
146k
  addAttributeColor(map, StarAttribute::ATTR_CHR_COLOR,"char[color]",STOFFColor::black());
1439
  // bold
1440
146k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_WEIGHT,"char[weight]",1,5); // normal
1441
146k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_CJK_WEIGHT,"char[cjk,weight]",1,5); // normal
1442
146k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_CTL_WEIGHT,"char[ctl,weight]",1,5); // normal
1443
  // italic
1444
146k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_POSTURE,"char[posture]",1,0); // none
1445
146k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_CJK_POSTURE,"char[cjk,posture]",1,0); // none
1446
146k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_CTL_POSTURE,"char[ctl,posture]",1,0); // none
1447
1448
146k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_CASEMAP,"char[casemap]",1,0); // no mapped
1449
146k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_CROSSEDOUT,"char[crossedout]",1,0); // none
1450
146k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_UNDERLINE,"char[underline]",1,0); // none
1451
146k
  addAttributeBool(map,StarAttribute::ATTR_CHR_CONTOUR,"char[contour]",false);
1452
146k
  addAttributeBool(map,StarAttribute::ATTR_CHR_SHADOWED,"char[shadowed]",false);
1453
146k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_RELIEF,"char[relief]",2,0); // none
1454
146k
  addAttributeBool(map,StarAttribute::ATTR_CHR_BLINK,"char[blink]",false);
1455
146k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_EMPHASIS_MARK,"char[emphasisMark]",2,0); // none
1456
1457
146k
  addAttributeBool(map,StarAttribute::ATTR_CHR_WORDLINEMODE,"char[word,linemode]",false);
1458
146k
  addAttributeBool(map,StarAttribute::ATTR_CHR_AUTOKERN,"char[autoKern]",false);
1459
146k
  addAttributeInt(map,StarAttribute::ATTR_CHR_KERNING,"char[kerning]",2,0);
1460
146k
  map[StarAttribute::ATTR_CHR_ESCAPEMENT]=std::shared_ptr<StarAttribute>(new StarCAttributeEscapement(StarAttribute::ATTR_CHR_ESCAPEMENT,"chrAtrEscapement"));
1461
146k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_PROPORTIONALFONTSIZE,"char[proportionalfontsize]",2,100); // 100%
1462
1463
146k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_LANGUAGE,"char[language]",2,0x3ff); // unknown
1464
146k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_CJK_LANGUAGE,"char[cjk,language]",2,0x3ff); // unknown
1465
146k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_CTL_LANGUAGE,"char[ctl,language]",2,0x3ff); // unknown
1466
146k
  addAttributeUInt(map,StarAttribute::ATTR_SC_LANGUAGE_FORMAT,"cell[language]",2,0x3ff); // unknown
1467
1468
146k
  addAttributeBool(map,StarAttribute::ATTR_CHR_NOHYPHEN,"char[noHyphen]",true);
1469
146k
  addAttributeVoid(map,StarAttribute::ATTR_TXT_SOFTHYPH,"text[softHyphen]");
1470
146k
  map[StarAttribute::ATTR_TXT_CHARFMT]=std::shared_ptr<StarAttribute>(new StarCAttributeCharFormat(StarAttribute::ATTR_TXT_CHARFMT,"textAtrCharFmt"));
1471
146k
  map[StarAttribute::ATTR_TXT_FTN]=std::shared_ptr<StarAttribute>(new StarCAttributeFootnote(StarAttribute::ATTR_TXT_FTN,"textAtrFtn"));
1472
146k
  map[StarAttribute::ATTR_TXT_FIELD]=std::shared_ptr<StarAttribute>(new StarCAttributeField(StarAttribute::ATTR_TXT_FIELD,"textAtrField"));
1473
146k
  map[StarAttribute::ATTR_TXT_FLYCNT]=std::shared_ptr<StarAttribute>(new StarCAttributeFlyCnt(StarAttribute::ATTR_TXT_FLYCNT,"textAtrTxtFlyCnt"));
1474
146k
  map[StarAttribute::ATTR_TXT_HARDBLANK]=std::shared_ptr<StarAttribute>(new StarCAttributeHardBlank(StarAttribute::ATTR_TXT_HARDBLANK,"textAtrHardBlank"));
1475
146k
  map[StarAttribute::ATTR_TXT_INETFMT]=std::shared_ptr<StarAttribute>(new StarCAttributeINetFmt(StarAttribute::ATTR_TXT_INETFMT,"textAtrInetFmt"));
1476
146k
  map[StarAttribute::ATTR_TXT_REFMARK]=std::shared_ptr<StarAttribute>(new StarCAttributeRefMark(StarAttribute::ATTR_TXT_REFMARK,"textAtrRefMark"));
1477
146k
  addAttributeBool(map,StarAttribute::ATTR_CHR_NOLINEBREAK,"char[nolineBreak]",true);
1478
146k
  addAttributeBool(map,StarAttribute::ATTR_SC_HYPHENATE,"hyphenate", false);
1479
1480
146k
  addAttributeVoid(map, StarAttribute::ATTR_EE_FEATURE_TAB, "feature[tab]");
1481
146k
  addAttributeVoid(map, StarAttribute::ATTR_EE_FEATURE_LINEBR, "feature[linebr]");
1482
146k
  map[StarAttribute::ATTR_EE_FEATURE_FIELD]=std::shared_ptr<StarAttribute>(new StarCAttributeField(StarAttribute::ATTR_EE_FEATURE_FIELD,"eeFeatureField"));
1483
1484
146k
  addAttributeBool(map,StarAttribute::ATTR_CHR_DUMMY1,"char[dummy1]",false);
1485
146k
  addAttributeBool(map,StarAttribute::ATTR_TXT_DUMMY1,"text[dummy1]",false);
1486
146k
  addAttributeBool(map,StarAttribute::ATTR_TXT_DUMMY2,"text[dummy2]",false);
1487
146k
  addAttributeBool(map,StarAttribute::ATTR_TXT_DUMMY4,"text[dummy4]",false);
1488
146k
  addAttributeBool(map,StarAttribute::ATTR_TXT_DUMMY5,"text[dummy5]",false);
1489
146k
  addAttributeBool(map,StarAttribute::ATTR_TXT_DUMMY6,"text[dummy6]",false);
1490
146k
  addAttributeBool(map,StarAttribute::ATTR_TXT_DUMMY7,"text[dummy7]",false);
1491
146k
  addAttributeVoid(map,StarAttribute::ATTR_TXT_UNKNOWN_CONTAINER, "text[unknContainer]"); // XML attrib
1492
1493
146k
  map[StarAttribute::ATTR_FRM_CNTNT]=std::shared_ptr<StarAttribute>(new StarCAttributeContent(StarAttribute::ATTR_FRM_CNTNT,"pageCntnt"));
1494
1495
1496
146k
}
1497
}
1498
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: