Coverage Report

Created: 2026-09-14 06:37

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.72M
    StarAttributeBool(type, debugName, value)
60
2.72M
  {
61
2.72M
  }
62
  //! create a new attribute
63
  std::shared_ptr<StarAttribute> create() const final
64
41.5k
  {
65
41.5k
    return std::shared_ptr<StarAttribute>(new StarCAttributeBool(*this));
66
41.5k
  }
67
  //! add to a font
68
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
69
70
protected:
71
  //! copy constructor
72
41.5k
  StarCAttributeBool(StarCAttributeBool const &) = default;
73
};
74
75
//! a character color attribute
76
class StarCAttributeColor final : public StarAttributeColor
77
{
78
public:
79
  //! constructor
80
181k
  StarCAttributeColor(Type type, std::string const &debugName, STOFFColor const &value) : StarAttributeColor(type, debugName, value)
81
181k
  {
82
181k
  }
83
  //! create a new attribute
84
  std::shared_ptr<StarAttribute> create() const final
85
16.5k
  {
86
16.5k
    return std::shared_ptr<StarAttribute>(new StarCAttributeColor(*this));
87
16.5k
  }
88
  //! add to a font
89
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
90
protected:
91
  //! copy constructor
92
16.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
181k
    StarAttributeInt(type, debugName, intSize, value)
102
181k
  {
103
181k
  }
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.66k
  {
109
2.66k
    return std::shared_ptr<StarAttribute>(new StarCAttributeInt(*this));
110
2.66k
  }
111
protected:
112
  //! copy constructor
113
2.66k
  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.90M
    StarAttributeUInt(type, debugName, intSize, value)
123
2.90M
  {
124
2.90M
  }
125
  //! create a new attribute
126
  std::shared_ptr<StarAttribute> create() const final
127
182k
  {
128
182k
    return std::shared_ptr<StarAttribute>(new StarCAttributeUInt(*this));
129
182k
  }
130
  //! add to a font
131
  void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final;
132
protected:
133
  //! copy constructor
134
182k
  StarCAttributeUInt(StarCAttributeUInt const &) = default;
135
};
136
137
//! a void attribute
138
class StarCAttributeVoid final : public StarAttributeVoid
139
{
140
public:
141
  //! constructor
142
725k
  StarCAttributeVoid(Type type, std::string const &debugName) : StarAttributeVoid(type, debugName)
143
725k
  {
144
725k
  }
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
3.68k
  {
150
3.68k
    return std::shared_ptr<StarAttribute>(new StarCAttributeVoid(*this));
151
3.68k
  }
152
protected:
153
  //! copy constructor
154
3.68k
  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.72M
{
160
2.72M
  map[type]=std::shared_ptr<StarAttribute>(new StarCAttributeBool(type,debugName, defValue));
161
2.72M
}
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
181k
{
165
181k
  map[type]=std::shared_ptr<StarAttribute>(new StarCAttributeColor(type,debugName, defValue));
166
181k
}
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
181k
{
170
181k
  map[type]=std::shared_ptr<StarAttribute>(new StarCAttributeInt(type,debugName, numBytes, defValue));
171
181k
}
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.90M
{
175
2.90M
  map[type]=std::shared_ptr<StarAttribute>(new StarCAttributeUInt(type,debugName, numBytes, defValue));
176
2.90M
}
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
725k
{
180
725k
  map[type]=std::shared_ptr<StarAttribute>(new StarCAttributeVoid(type,debugName));
181
725k
}
182
183
void StarCAttributeBool::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
184
201k
{
185
201k
  if (m_type==ATTR_CHR_CONTOUR)
186
94.9k
    state.m_font.m_propertyList.insert("style:text-outline", m_value);
187
106k
  else if (m_type==ATTR_CHR_SHADOWED)
188
97.7k
    state.m_font.m_propertyList.insert("fo:text-shadow", m_value ? "1pt 1pt" : "none");
189
8.88k
  else if (m_type==ATTR_CHR_BLINK)
190
0
    state.m_font.m_propertyList.insert("style:text-blinking", m_value);
191
8.88k
  else if (m_type==ATTR_CHR_WORDLINEMODE)  {
192
4.11k
    state.m_font.m_propertyList.insert("style:text-line-through-mode", m_value ? "skip-white-space" : "continuous");
193
4.11k
    state.m_font.m_propertyList.insert("style:text-underline-mode", m_value ? "skip-white-space" : "continuous");
194
4.11k
  }
195
4.77k
  else if (m_type==ATTR_CHR_AUTOKERN)
196
1.72k
    state.m_font.m_propertyList.insert("style:letter-kerning", m_value);
197
3.05k
  else if (m_type==ATTR_SC_HYPHENATE)
198
2.97k
    state.m_font.m_propertyList.insert("fo:hyphenate", m_value);
199
82
  else if (m_type==ATTR_CHR_NOHYPHEN)
200
0
    state.m_font.m_hyphen=!m_value;
201
82
  else if (m_type==ATTR_CHR_NOLINEBREAK)
202
0
    state.m_font.m_lineBreak=!m_value;
203
201k
}
204
205
void StarCAttributeColor::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
206
141k
{
207
141k
  if (m_type==ATTR_CHR_COLOR)
208
141k
    state.m_font.m_propertyList.insert("fo:color", m_value.str().c_str());
209
141k
}
210
211
void StarCAttributeInt::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
212
4.28k
{
213
4.28k
  if (m_type==ATTR_CHR_KERNING)
214
4.28k
    state.m_font.m_propertyList.insert("fo:letter-spacing", m_value, librevenge::RVNG_TWIP);
215
4.28k
}
216
217
void StarCAttributeUInt::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
218
972k
{
219
972k
  if (m_type==ATTR_CHR_CROSSEDOUT) {
220
103k
    switch (m_value) {
221
98.0k
    case 0: // none
222
98.0k
      state.m_font.m_propertyList.insert("style:text-line-through-type", "none");
223
98.0k
      break;
224
1.07k
    case 1: // single
225
1.66k
    case 2: // double
226
1.66k
      state.m_font.m_propertyList.insert("style:text-line-through-type", m_value==1 ? "single" : "double");
227
1.66k
      state.m_font.m_propertyList.insert("style:text-line-through-style", "solid");
228
1.66k
      break;
229
157
    case 3: // dontknow
230
157
      break;
231
175
    case 4: // bold
232
175
      state.m_font.m_propertyList.insert("style:text-line-through-type", "single");
233
175
      state.m_font.m_propertyList.insert("style:text-line-through-style", "solid");
234
175
      state.m_font.m_propertyList.insert("style:text-line-through-width", "thick");
235
175
      break;
236
466
    case 5: // slash
237
644
    case 6: // X
238
644
      state.m_font.m_propertyList.insert("style:text-line-through-type", "single");
239
644
      state.m_font.m_propertyList.insert("style:text-line-through-style", "solid");
240
644
      state.m_font.m_propertyList.insert("style:text-line-through-text", m_value==5 ? "/" : "X");
241
644
      break;
242
3.20k
    default:
243
3.20k
      state.m_font.m_propertyList.insert("style:text-line-through-type", "none");
244
3.20k
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeUInt: find unknown crossedout enum=%d\n", m_value));
245
3.20k
      break;
246
103k
    }
247
103k
  }
248
869k
  else if (m_type==ATTR_CHR_UNDERLINE) {
249
145k
    switch (m_value) {
250
130k
    case 0: // none
251
132k
    case 4: // unknown
252
132k
      state.m_font.m_propertyList.insert("style:text-underline-type", "none");
253
132k
      break;
254
3.31k
    case 1: // single
255
4.12k
    case 2: // double
256
4.12k
      state.m_font.m_propertyList.insert("style:text-underline-type", m_value==1 ? "single" : "double");
257
4.12k
      state.m_font.m_propertyList.insert("style:text-underline-style", "solid");
258
4.12k
      break;
259
138
    case 3: // dot
260
4.86k
    case 5: // dash
261
5.15k
    case 6: // long-dash
262
5.34k
    case 7: // dash-dot
263
5.72k
    case 8: // dash-dot-dot
264
5.72k
      state.m_font.m_propertyList.insert("style:text-underline-type", "single");
265
5.72k
      state.m_font.m_propertyList.insert("style:text-underline-style", m_value==3 ? "dotted" : m_value==5 ? "dash" :
266
5.58k
                                         m_value==6 ? "long-dash" : m_value==7 ? "dot-dash" : "dot-dot-dash");
267
5.72k
      break;
268
112
    case 9: // small wave
269
319
    case 10: // wave
270
415
    case 11: // double wave
271
415
      state.m_font.m_propertyList.insert("style:text-underline-type", m_value==11 ? "single" : "double");
272
415
      state.m_font.m_propertyList.insert("style:text-underline-style", "wave");
273
415
      if (m_value==9)
274
112
        state.m_font.m_propertyList.insert("style:text-underline-width", "thin");
275
415
      break;
276
105
    case 12: // bold
277
212
    case 13: // bold dot
278
331
    case 14: // bold dash
279
446
    case 15: // bold long-dash
280
577
    case 16: // bold dash-dot
281
701
    case 17: // bold dash-dot-dot
282
802
    case 18: { // bold wave
283
802
      char const *wh[]= {"solid", "dotted", "dash", "long-dash", "dot-dash", "dot-dot-dash", "wave"};
284
802
      state.m_font.m_propertyList.insert("style:text-underline-type", "single");
285
802
      state.m_font.m_propertyList.insert("style:text-underline-style", wh[m_value-12]);
286
802
      state.m_font.m_propertyList.insert("style:text-underline-width", "thick");
287
802
      break;
288
701
    }
289
2.44k
    default:
290
2.44k
      state.m_font.m_propertyList.insert("style:text-underline-type", "none");
291
2.44k
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeUInt: find unknown underline enum=%d\n", m_value));
292
2.44k
      break;
293
145k
    }
294
145k
  }
295
723k
  else if (m_type==ATTR_CHR_POSTURE || m_type==ATTR_CHR_CJK_POSTURE || m_type==ATTR_CHR_CTL_POSTURE) {
296
318k
    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
318k
    if (m_value==1)
298
768
      state.m_font.m_propertyList.insert(wh.c_str(), "oblique");
299
317k
    else if (m_value==2)
300
63.9k
      state.m_font.m_propertyList.insert(wh.c_str(), "italic");
301
253k
    else if (m_value) {
302
5.09k
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeUInt: find unknown posture enum=%d\n", m_value));
303
5.09k
    }
304
318k
  }
305
404k
  else if (m_type==ATTR_CHR_RELIEF) {
306
3.09k
    if (m_value==0)
307
2.61k
      state.m_font.m_propertyList.insert("style:font-relief", "none");
308
480
    else if (m_value==1)
309
124
      state.m_font.m_propertyList.insert("style:font-relief", "embossed");
310
356
    else if (m_value==2)
311
131
      state.m_font.m_propertyList.insert("style:font-relief", "engraved");
312
225
    else if (m_value) {
313
225
      state.m_font.m_propertyList.insert("style:font-relief", "none");
314
225
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeUInt: find unknown relief enum=%d\n", m_value));
315
225
    }
316
3.09k
  }
317
401k
  else if (m_type==ATTR_CHR_WEIGHT || m_type==ATTR_CHR_CJK_WEIGHT || m_type==ATTR_CHR_CTL_WEIGHT) {
318
353k
    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
353k
    if (m_value==5)
320
309k
      state.m_font.m_propertyList.insert(wh.c_str(), "normal");
321
43.2k
    else if (m_value==8)
322
36.0k
      state.m_font.m_propertyList.insert(wh.c_str(), "bold");
323
7.25k
    else if (m_value>=1 && m_value<=9)
324
2.39k
      state.m_font.m_propertyList.insert(wh.c_str(), m_value*100, librevenge::RVNG_GENERIC);
325
4.86k
    else // 10: WEIGHT_BLACK
326
4.86k
      state.m_font.m_propertyList.insert(wh.c_str(), "normal");
327
353k
  }
328
48.4k
  else if (m_type==ATTR_CHR_CASEMAP) {
329
0
    if (m_value==0)
330
0
      state.m_font.m_propertyList.insert("fo:text-transform", "none");
331
0
    else if (m_value==1)
332
0
      state.m_font.m_propertyList.insert("fo:text-transform", "uppercase");
333
0
    else if (m_value==2)
334
0
      state.m_font.m_propertyList.insert("fo:text-transform", "lowercase");
335
0
    else if (m_value==3)
336
0
      state.m_font.m_propertyList.insert("fo:text-transform", "capitalize");
337
0
    else if (m_value==4)
338
0
      state.m_font.m_propertyList.insert("fo:font-variant", "small-caps");
339
0
    else if (m_value) {
340
0
      state.m_font.m_propertyList.insert("fo:text-transform", "none");
341
0
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeUInt: find unknown casemap enum=%d\n", m_value));
342
0
    }
343
0
  }
344
48.4k
  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
45.5k
    bool const basic=m_type==ATTR_CHR_LANGUAGE||m_type==ATTR_SC_LANGUAGE_FORMAT;
346
45.5k
    std::string prefix(basic ? "fo:" : "style:");
347
45.5k
    std::string extension(basic ? "" :  m_type==ATTR_CHR_CJK_LANGUAGE ? "-asian" : "-complex");
348
45.5k
    std::string lang, country;
349
45.5k
    if (StarLanguage::getLanguageId(int(m_value), lang, country)) {
350
23.6k
      if (!lang.empty())
351
23.6k
        state.m_font.m_propertyList.insert((prefix + "language" + extension).c_str(), lang.c_str());
352
23.6k
      if (!country.empty())
353
23.2k
        state.m_font.m_propertyList.insert((prefix + "country" + extension).c_str(), country.c_str());
354
23.6k
    }
355
45.5k
  }
356
2.90k
  else if (m_type==ATTR_CHR_PROPORTIONALFONTSIZE && m_value!=100) // checkme: maybe font-size with %
357
0
    state.m_font.m_propertyList.insert("style:text-scale", double(m_value)/100., librevenge::RVNG_PERCENT);
358
2.90k
  else if (m_type==ATTR_CHR_EMPHASIS_MARK) {
359
2.90k
    if (m_value && ((m_value&0xC000)==0 || (m_value&0x3000)==0x3000 || (m_value&0xFFF)>4 || (m_value&0xFFF)==0)) {
360
610
      state.m_font.m_propertyList.insert("style:text-emphasize", "none");
361
610
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeUInt: find unknown emphasis mark=%x\n", unsigned(m_value)));
362
610
    }
363
2.29k
    else if (m_value) {
364
112
      std::string what((m_value&7)== 1 ? "dot" : (m_value&7)== 2 ? "circle" : (m_value&7)== 3 ? "disc" : "accent");
365
112
      state.m_font.m_propertyList.insert("style:text-emphasize", (what+((m_value&0x1000) ? " above" : " below")).c_str());
366
112
    }
367
2.18k
    else
368
2.18k
      state.m_font.m_propertyList.insert("style:text-emphasize", "none");
369
2.90k
  }
370
972k
}
371
372
void StarCAttributeVoid::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
373
9.00k
{
374
9.00k
  if (m_type==ATTR_TXT_SOFTHYPH)
375
0
    state.m_font.m_softHyphen=true;
376
9.00k
  else if (m_type==ATTR_EE_FEATURE_TAB)
377
5.39k
    state.m_font.m_tab=true;
378
3.60k
  else if (m_type==ATTR_EE_FEATURE_LINEBR)
379
3.60k
    state.m_font.m_lineBreak=true;
380
9.00k
}
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
    STOFFSubDocument(nullptr, STOFFInputStreamPtr(), STOFFEntry()), m_content(content), m_state(state) {}
394
395
  //! destructor
396
3
  ~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
{
423
3
  if (!listener.get()) {
424
0
    STOFF_DEBUG_MSG(("StarObjectSpreadsheetInternal::SubDocument::parse: no listener\n"));
425
0
    return;
426
0
  }
427
3
  if (m_content) {
428
3
    StarState state(*m_state);
429
3
    m_content->send(listener, state);
430
3
  }
431
3
}
432
433
//! a escapement attribute
434
class StarCAttributeEscapement final : public StarAttribute
435
{
436
public:
437
  //! constructor
438
181k
  StarCAttributeEscapement(Type type, std::string const &debugName) : StarAttribute(type, debugName), m_delta(0), m_scale(100)
439
181k
  {
440
181k
  }
441
  //! create a new attribute
442
  std::shared_ptr<StarAttribute> create() const final
443
37.1k
  {
444
37.1k
    return std::shared_ptr<StarAttribute>(new StarCAttributeEscapement(*this));
445
37.1k
  }
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
41.6k
  {
453
41.6k
    o << m_debugName << "=[";
454
41.6k
    if (m_delta) o << "decal=" << m_delta << "%,";
455
41.6k
    if (m_scale!=100) o << "scale=" << m_scale << "%,";
456
41.6k
    o << "],";
457
41.6k
  }
458
protected:
459
  //! copy constructor
460
37.1k
  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
544k
    StarAttribute(type, debugName), m_name(""), m_style(""), m_encoding(0), m_family(0), m_pitch(0)
474
544k
  {
475
544k
  }
476
  //! create a new attribute
477
  std::shared_ptr<StarAttribute> create() const final
478
61.7k
  {
479
61.7k
    return std::shared_ptr<StarAttribute>(new StarCAttributeFont(*this));
480
61.7k
  }
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
71.3k
  {
488
71.3k
    o << m_debugName << "=[";
489
71.3k
    if (!m_name.empty()) o << "name=" << m_name.cstr() << ",";
490
71.3k
    if (!m_style.empty()) o << "style=" << m_style.cstr() << ",";
491
71.3k
    if (m_encoding) o << "encoding=" << m_encoding << ",";
492
71.3k
    switch (m_family) {
493
27.0k
    case 0: // dont know
494
27.0k
      break;
495
633
    case 1:
496
633
      o << "decorative,";
497
633
      break;
498
2.34k
    case 2:
499
2.34k
      o << "modern,";
500
2.34k
      break;
501
6.05k
    case 3:
502
6.05k
      o << "roman,";
503
6.05k
      break;
504
130
    case 4:
505
130
      o << "script,";
506
130
      break;
507
13.8k
    case 5:
508
13.8k
      o << "swiss,";
509
13.8k
      break;
510
8.14k
    case 6:
511
8.14k
      o << "modern,";
512
8.14k
      break;
513
13.1k
    default:
514
13.1k
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeFont: find unknown family\n"));
515
13.1k
      o << "#family=" << m_family << ",";
516
13.1k
      break;
517
71.3k
    }
518
71.3k
    switch (m_pitch) {
519
39.4k
    case 0: // dont know
520
39.4k
      break;
521
351
    case 1:
522
351
      o << "pitch[fixed],";
523
351
      break;
524
28.0k
    case 2:
525
28.0k
      o << "pitch[fixed],";
526
28.0k
      break;
527
3.54k
    default:
528
3.54k
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeFont: find unknown pitch\n"));
529
3.54k
      o << "#pitch=" << m_pitch << ",";
530
3.54k
      break;
531
71.3k
    }
532
71.3k
    o << "],";
533
71.3k
  }
534
535
protected:
536
  //! copy constructor
537
61.7k
  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
544k
    StarAttribute(type, debugName), m_size(240), m_proportion(100), m_unit(13)
558
544k
  {
559
544k
  }
560
  //! create a new attribute
561
  std::shared_ptr<StarAttribute> create() const final
562
68.3k
  {
563
68.3k
    return std::shared_ptr<StarAttribute>(new StarCAttributeFontSize(*this));
564
68.3k
  }
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
85.6k
  {
572
85.6k
    o << m_debugName << "=[";
573
85.6k
    if (m_size!=240) o << "sz=" << m_size << ",";
574
85.6k
    if (m_proportion!=100) o << "prop=" << m_proportion << ",";
575
85.6k
    if (m_unit>=0 && m_unit<=14) {
576
82.9k
      char const *wh[]= {"mm/100", "mm/10", "mm", "cm", "in/1000", "in/100", "in/10", "in",
577
82.9k
                         "pt", "twip", "pixel", "sys[font]", "app[font]", "rel", "abs"
578
82.9k
                        };
579
82.9k
      o << wh[m_unit] << ",";
580
82.9k
    }
581
2.70k
    else {
582
2.70k
      STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeFontSize::print: unknown font unit\n"));
583
2.70k
      o << "#unit=" << m_unit << ",";
584
2.70k
    }
585
85.6k
    o << "],";
586
85.6k
  }
587
588
protected:
589
  //! copy constructor
590
68.3k
  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
181k
    : StarAttribute(type, debugName), m_name("")
606
181k
  {
607
181k
  }
608
  //! create a new attribute
609
  std::shared_ptr<StarAttribute> create() const final
610
11.0k
  {
611
11.0k
    return std::shared_ptr<StarAttribute>(new StarCAttributeCharFormat(*this));
612
11.0k
  }
613
  //! debug function to print the data
614
  void printData(libstoff::DebugStream &o) const final
615
10.7k
  {
616
10.7k
    o << m_debugName;
617
10.7k
    if (!m_name.empty()) o << "=" << m_name.cstr();
618
10.7k
    o << ",";
619
10.7k
  }
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
11.0k
  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
181k
    : StarAttribute(type, debugName)
638
181k
    , m_content()
639
181k
  {
640
181k
  }
641
  //! create a new attribute
642
  std::shared_ptr<StarAttribute> create() const final
643
5.03k
  {
644
5.03k
    return std::shared_ptr<StarAttribute>(new StarCAttributeContent(*this));
645
5.03k
  }
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
1.43k
  {
653
1.43k
    o << m_debugName << "=[";
654
1.43k
    if (!m_content) o << "empty,";
655
1.43k
    o << "],";
656
1.43k
  }
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
5.03k
  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
362k
    : StarAttribute(type, debugName)
673
362k
    , m_field()
674
362k
  {
675
362k
  }
676
  //! create a new attribute
677
  std::shared_ptr<StarAttribute> create() const final
678
35.2k
  {
679
35.2k
    return std::shared_ptr<StarAttribute>(new StarCAttributeField(*this));
680
35.2k
  }
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
35.2k
  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
181k
    : StarAttribute(type, debugName)
699
181k
    , m_format()
700
181k
  {
701
181k
  }
702
  //! create a new attribute
703
  std::shared_ptr<StarAttribute> create() const final
704
6.51k
  {
705
6.51k
    return std::shared_ptr<StarAttribute>(new StarCAttributeFlyCnt(*this));
706
6.51k
  }
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
5.68k
  {
714
5.68k
    o << m_debugName << ",";
715
5.68k
  }
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
6.51k
  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
181k
    : StarAttribute(type, debugName)
732
181k
    , m_number(0)
733
181k
    , m_label("")
734
181k
    , m_content()
735
181k
    , m_numSeq(0)
736
181k
    , m_flags(0)
737
181k
  {
738
181k
  }
739
  //! create a new attribute
740
  std::shared_ptr<StarAttribute> create() const final
741
18.8k
  {
742
18.8k
    return std::shared_ptr<StarAttribute>(new StarCAttributeFootnote(*this));
743
18.8k
  }
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
8.24k
  {
751
8.24k
    o << m_debugName << "=[";
752
8.24k
    if (m_number) o << "number=" << m_number << ",";
753
8.24k
    if (!m_label.empty()) o << "label=" << m_label.cstr() << ",";
754
8.24k
    if (!m_content) o << "empty,";
755
8.24k
    if (m_numSeq) o << "numSeq=" << m_numSeq << ",";
756
8.24k
    if (m_flags) o << "flags=" << std::hex << m_flags << std::dec << ",";
757
8.24k
    o << "],";
758
8.24k
  }
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
18.8k
  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
181k
  StarCAttributeHardBlank(Type type, std::string const &debugName) : StarAttribute(type, debugName), m_char(0)
783
181k
  {
784
181k
  }
785
  //! create a new attribute
786
  std::shared_ptr<StarAttribute> create() const final
787
63.3k
  {
788
63.3k
    return std::shared_ptr<StarAttribute>(new StarCAttributeHardBlank(*this));
789
63.3k
  }
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
62.9k
  {
797
62.9k
    o << m_debugName;
798
62.9k
    if (m_char) o << "=" << char(m_char);
799
62.9k
    o << ",";
800
62.9k
  }
801
protected:
802
  //! copy constructor
803
63.3k
  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
181k
    : StarAttribute(type, debugName)
815
181k
    , m_url("")
816
181k
    , m_target("")
817
181k
    , m_name("")
818
181k
    , m_libNames()
819
181k
  {
820
362k
    for (int &indice : m_indices) indice=0xFFFF;
821
181k
  }
822
  //! create a new attribute
823
  std::shared_ptr<StarAttribute> create() const final
824
2.78k
  {
825
2.78k
    return std::shared_ptr<StarAttribute>(new StarCAttributeINetFmt(*this));
826
2.78k
  }
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.27k
  {
834
1.27k
    o << m_debugName << "=[";
835
1.27k
    if (!m_url.empty()) o << "url=" << m_url.cstr() << ",";
836
1.27k
    if (!m_target.empty()) o << "target=" << m_target.cstr() << ",";
837
1.27k
    if (!m_name.empty()) o << "name=" << m_name.cstr() << ",";
838
3.82k
    for (int i=0; i<2; ++i) {
839
2.54k
      if (m_indices[i]!=0xFFFF) o << "index" << i << "=" << m_indices[i] << ",";
840
2.54k
    }
841
1.27k
    if (!m_libNames.empty()) {
842
268
      o << "libNames=[";
843
3.58k
      for (size_t i=0; i+1<m_libNames.size(); i+=2)
844
3.32k
        o << m_libNames[i].cstr() << ":" <<  m_libNames[i+1].cstr() << ",";
845
268
      o << "],";
846
268
    }
847
1.27k
    o << "],";
848
1.27k
  }
849
protected:
850
  //! copy constructor
851
2.78k
  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
181k
    : StarAttribute(type, debugName)
872
181k
    , m_name("")
873
181k
  {
874
181k
  }
875
  //! create a new attribute
876
  std::shared_ptr<StarAttribute> create() const final
877
10.0k
  {
878
10.0k
    return std::shared_ptr<StarAttribute>(new StarCAttributeRefMark(*this));
879
10.0k
  }
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
7.19k
  {
887
7.19k
    o << m_debugName;
888
7.19k
    if (!m_name.empty()) o << "=" << m_name.cstr();
889
7.19k
    o << ",";
890
7.19k
  }
891
protected:
892
  //! copy constructor
893
10.0k
  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
8.60k
{
900
8.60k
  std::stringstream s;
901
8.60k
  s << m_delta << "% " << m_scale << "%";
902
8.60k
  state.m_font.m_propertyList.insert("style:text-position", s.str().c_str());
903
8.60k
}
904
905
void StarCAttributeFont::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
906
387k
{
907
387k
  if (!m_name.empty()) {
908
363k
    if (m_type==ATTR_CHR_FONT)
909
240k
      state.m_font.m_propertyList.insert("style:font-name", m_name);
910
123k
    else if (m_type==ATTR_CHR_CJK_FONT)
911
35.6k
      state.m_font.m_propertyList.insert("style:font-name-asian", m_name);
912
87.3k
    else if (m_type==ATTR_CHR_CTL_FONT)
913
87.3k
      state.m_font.m_propertyList.insert("style:font-name-complex", m_name);
914
363k
  }
915
387k
  if (m_pitch==1 || m_pitch==2) {
916
318k
    if (m_type==ATTR_CHR_FONT)
917
196k
      state.m_font.m_propertyList.insert("style:font-pitch", m_pitch==1 ? "fixed" : "variable");
918
121k
    else if (m_type==ATTR_CHR_CJK_FONT)
919
35.2k
      state.m_font.m_propertyList.insert("style:font-pitch-asian", m_pitch==1 ? "fixed" : "variable");
920
86.2k
    else if (m_type==ATTR_CHR_CTL_FONT)
921
86.2k
      state.m_font.m_propertyList.insert("style:font-pitch-complex", m_pitch==1 ? "fixed" : "variable");
922
318k
  }
923
  // TODO m_style, m_family
924
387k
}
925
926
void StarCAttributeFontSize::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
927
484k
{
928
484k
  std::string wh(m_type==ATTR_CHR_FONTSIZE ? "fo:font-size" :
929
484k
                 m_type==ATTR_CHR_CJK_FONTSIZE ? "style:font-size-asian" :
930
193k
                 m_type==ATTR_CHR_CTL_FONTSIZE ? "style:font-size-complex" :
931
95.7k
                 "");
932
484k
  if (wh.empty())
933
0
    return;
934
  // TODO: use m_proportion?
935
484k
  switch (m_unit) {
936
6.71k
  case 0:
937
6.71k
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)*0.02756, librevenge::RVNG_POINT);
938
6.71k
    break;
939
1.26k
  case 1:
940
1.26k
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)*0.2756, librevenge::RVNG_POINT);
941
1.26k
    break;
942
847
  case 2:
943
847
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)*2.756, librevenge::RVNG_POINT);
944
847
    break;
945
1.38k
  case 3:
946
1.38k
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)*27.56, librevenge::RVNG_POINT);
947
1.38k
    break;
948
1.25k
  case 4:
949
1.25k
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)/1000., librevenge::RVNG_INCH);
950
1.25k
    break;
951
1.76k
  case 5:
952
1.76k
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)/100., librevenge::RVNG_INCH);
953
1.76k
    break;
954
234
  case 6:
955
234
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)/10., librevenge::RVNG_INCH);
956
234
    break;
957
209
  case 7:
958
209
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size), librevenge::RVNG_INCH);
959
209
    break;
960
206
  case 8:
961
206
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size), librevenge::RVNG_POINT);
962
206
    break;
963
283
  case 9: // TWIP
964
283
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)/20., librevenge::RVNG_POINT);
965
283
    break;
966
126
  case 10: // pixel
967
126
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size), librevenge::RVNG_POINT);
968
126
    break;
969
460k
  case 13: // rel, checkme
970
460k
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)*state.m_global->m_relativeUnit, librevenge::RVNG_POINT);
971
460k
    break;
972
9.82k
  default: // checkme
973
9.82k
    state.m_font.m_propertyList.insert(wh.c_str(), double(m_size)/20., librevenge::RVNG_POINT);
974
9.82k
    break;
975
484k
  }
976
484k
}
977
978
void StarCAttributeCharFormat::addTo(StarState &state, std::set<StarAttribute const *> &done) const
979
5
{
980
5
  if (done.find(this) != done.end())
981
0
    return;
982
5
  done.insert(this);
983
5
  if (m_type==ATTR_TXT_CHARFMT) {
984
5
    if (m_name.empty() || !state.m_global->m_pool) return;
985
0
    auto const *style=state.m_global->m_pool->findStyleWithFamily(m_name, StarItemStyle::F_Char);
986
0
    if (style) {
987
0
      state.m_font=STOFFFont();
988
0
      StarItemSet const &itemSet=style->m_itemSet;
989
0
      std::map<int, std::shared_ptr<StarItem> >::const_iterator it;
990
0
      for (it=itemSet.m_whichToItemMap.begin(); it!=itemSet.m_whichToItemMap.end(); ++it) {
991
0
        if (it->second && it->second->m_attribute)
992
0
          it->second->m_attribute->addTo(state, done);
993
0
      }
994
995
0
    }
996
0
  }
997
5
}
998
999
void StarCAttributeContent::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
1000
2.85k
{
1001
2.85k
  state.m_content=true;
1002
2.85k
}
1003
1004
void StarCAttributeField::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
1005
7.60k
{
1006
7.60k
  state.m_field=m_field;
1007
7.60k
}
1008
1009
void StarCAttributeFlyCnt::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
1010
0
{
1011
0
  state.m_flyCnt=true;
1012
0
}
1013
1014
void StarCAttributeFootnote::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
1015
3
{
1016
3
  state.m_footnote=true;
1017
3
}
1018
1019
void StarCAttributeHardBlank::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
1020
0
{
1021
0
  state.m_font.m_hardBlank=true;
1022
0
}
1023
1024
void StarCAttributeINetFmt::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
1025
0
{
1026
0
  if (m_url.empty()) {
1027
0
    STOFF_DEBUG_MSG(("StarCAttributeINetFmt::addTo: can not find the url\n"));
1028
0
    return;
1029
0
  }
1030
0
  state.m_link=m_url;
1031
0
}
1032
1033
void StarCAttributeRefMark::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const
1034
0
{
1035
0
  state.m_refMark=m_name;
1036
0
}
1037
1038
bool StarCAttributeEscapement::read(StarZone &zone, int /*vers*/, long endPos, StarObject &/*object*/)
1039
35.5k
{
1040
35.5k
  STOFFInputStreamPtr input=zone.input();
1041
35.5k
  long pos=input->tell();
1042
35.5k
  libstoff::DebugFile &ascFile=zone.ascii();
1043
35.5k
  libstoff::DebugStream f;
1044
35.5k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1045
35.5k
  m_scale=int(input->readULong(1));
1046
35.5k
  m_delta=int(input->readLong(2));
1047
35.5k
  printData(f);
1048
35.5k
  ascFile.addPos(pos);
1049
35.5k
  ascFile.addNote(f.str().c_str());
1050
35.5k
  return input->tell()<=endPos;
1051
35.5k
}
1052
1053
bool StarCAttributeFont::read(StarZone &zone, int /*vers*/, long endPos, StarObject &/*object*/)
1054
55.5k
{
1055
55.5k
  STOFFInputStreamPtr input=zone.input();
1056
55.5k
  long pos=input->tell();
1057
55.5k
  libstoff::DebugFile &ascFile=zone.ascii();
1058
55.5k
  libstoff::DebugStream f;
1059
55.5k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1060
1061
55.5k
  m_family=int(input->readULong(1));
1062
55.5k
  m_pitch=int(input->readULong(1));
1063
55.5k
  m_encoding=int(input->readULong(1));
1064
55.5k
  std::vector<uint32_t> fName, string;
1065
55.5k
  if (!zone.readString(fName)) {
1066
4.51k
    STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeFont::read: can not find the name\n"));
1067
4.51k
    printData(f);
1068
4.51k
    f << "###aName,";
1069
4.51k
    ascFile.addPos(pos);
1070
4.51k
    ascFile.addNote(f.str().c_str());
1071
4.51k
    return false;
1072
4.51k
  }
1073
51.0k
  m_name=libstoff::getString(fName);
1074
51.0k
  if (!zone.readString(string)) {
1075
11.9k
    STOFF_DEBUG_MSG(("StarCharAttribute::StarCAttributeFont::read: can not find the style\n"));
1076
11.9k
    printData(f);
1077
11.9k
    f << "###aStyle,";
1078
11.9k
    ascFile.addPos(pos);
1079
11.9k
    ascFile.addNote(f.str().c_str());
1080
11.9k
    return false;
1081
11.9k
  }
1082
39.0k
  m_style=libstoff::getString(string).cstr();
1083
39.0k
  if (m_encoding!=10 && libstoff::getString(fName)=="StarBats" && input->tell()<endPos) {
1084
6
    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
6
    else input->seek(-3, librevenge::RVNG_SEEK_CUR);
1108
6
  }
1109
1110
39.0k
  printData(f);
1111
39.0k
  ascFile.addPos(pos);
1112
39.0k
  ascFile.addNote(f.str().c_str());
1113
39.0k
  return input->tell()<=endPos;
1114
39.0k
}
1115
1116
bool StarCAttributeFontSize::read(StarZone &zone, int nVers, long endPos, StarObject &/*object*/)
1117
59.8k
{
1118
59.8k
  STOFFInputStreamPtr input=zone.input();
1119
59.8k
  long pos=input->tell();
1120
59.8k
  libstoff::DebugFile &ascFile=zone.ascii();
1121
59.8k
  libstoff::DebugStream f;
1122
59.8k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1123
59.8k
  m_size=int(input->readULong(2));
1124
59.8k
  m_proportion=int(input->readULong((nVers>=1) ? 2 : 1));
1125
59.8k
  if (nVers>=2) m_unit=int(input->readULong(2));
1126
59.8k
  printData(f);
1127
59.8k
  ascFile.addPos(pos);
1128
59.8k
  ascFile.addNote(f.str().c_str());
1129
59.8k
  return input->tell()<=endPos;
1130
59.8k
}
1131
1132
bool StarCAttributeCharFormat::read(StarZone &zone, int /*nVers*/, long endPos, StarObject &/*object*/)
1133
10.7k
{
1134
10.7k
  STOFFInputStreamPtr input=zone.input();
1135
10.7k
  long pos=input->tell();
1136
10.7k
  libstoff::DebugFile &ascFile=zone.ascii();
1137
10.7k
  libstoff::DebugStream f;
1138
10.7k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1139
  // fmtAttr2: SwFmtCharFmt
1140
10.7k
  auto id=int(input->readULong(2));
1141
10.7k
  if (!zone.getPoolName(id, m_name)) {
1142
10.7k
    STOFF_DEBUG_MSG(("StarCAttributeCharFormat::read: can not find the style name\n"));
1143
10.7k
    f << "###id=" << id << ",";
1144
10.7k
  }
1145
10.7k
  printData(f);
1146
10.7k
  ascFile.addPos(pos);
1147
10.7k
  ascFile.addNote(f.str().c_str());
1148
10.7k
  return input->tell()<=endPos;
1149
10.7k
}
1150
1151
bool StarCAttributeContent::read(StarZone &zone, int /*nVers*/, long endPos, StarObject &object)
1152
4.86k
{
1153
4.86k
  STOFFInputStreamPtr input=zone.input();
1154
4.86k
  long pos=input->tell();
1155
4.86k
  libstoff::DebugFile &ascFile=zone.ascii();
1156
4.86k
  libstoff::DebugStream f;
1157
4.86k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1158
4.86k
  StarObjectText text(object, false); // checkme
1159
4.86k
  if (!text.readSWContent(zone, m_content)) {
1160
3.43k
    STOFF_DEBUG_MSG(("StarCAttributeContent::read: can not find the content\n"));
1161
3.43k
    f << "###aContent,";
1162
3.43k
    ascFile.addPos(pos);
1163
3.43k
    ascFile.addNote(f.str().c_str());
1164
3.43k
    return false;
1165
3.43k
  }
1166
1.43k
  printData(f);
1167
1.43k
  ascFile.addPos(pos);
1168
1.43k
  ascFile.addNote(f.str().c_str());
1169
1.43k
  return input->tell()<=endPos;
1170
4.86k
}
1171
1172
bool StarCAttributeField::read(StarZone &zone, int /*nVers*/, long endPos, StarObject &/*object*/)
1173
33.4k
{
1174
33.4k
  STOFFInputStreamPtr input=zone.input();
1175
33.4k
  long pos=input->tell();
1176
33.4k
  libstoff::DebugFile &ascFile=zone.ascii();
1177
33.4k
  libstoff::DebugStream f;
1178
33.4k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1179
33.4k
  SWFieldManager fieldManager;
1180
33.4k
  if (m_type==StarAttribute::ATTR_TXT_FIELD)
1181
14.9k
    m_field=fieldManager.readField(zone);
1182
18.4k
  else
1183
18.4k
    m_field=fieldManager.readPersistField(zone, endPos);
1184
33.4k
  if (!m_field || input->tell()>endPos) {
1185
15.2k
    STOFF_DEBUG_MSG(("StarCAttributeField::read: can not find the field\n"));
1186
15.2k
    printData(f);
1187
15.2k
    f << "###field,";
1188
15.2k
    ascFile.addPos(pos);
1189
15.2k
    ascFile.addNote(f.str().c_str());
1190
15.2k
    return false;
1191
15.2k
  }
1192
18.1k
  printData(f);
1193
18.1k
  ascFile.addPos(pos);
1194
18.1k
  ascFile.addNote(f.str().c_str());
1195
18.1k
  return m_field && input->tell()<=endPos;
1196
33.4k
}
1197
1198
bool StarCAttributeFlyCnt::read(StarZone &zone, int /*vers*/, long endPos, StarObject &object)
1199
5.68k
{
1200
5.68k
  STOFFInputStreamPtr input=zone.input();
1201
5.68k
  long pos=input->tell();
1202
5.68k
  libstoff::DebugFile &ascFile=zone.ascii();
1203
5.68k
  libstoff::DebugStream f;
1204
5.68k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1205
5.68k
  if (input->peek()=='o')
1206
501
    object.getFormatManager()->readSWFormatDef(zone,'o', m_format, object);
1207
5.18k
  else
1208
5.18k
    object.getFormatManager()->readSWFormatDef(zone,'l', m_format, object);
1209
5.68k
  printData(f);
1210
5.68k
  ascFile.addPos(pos);
1211
5.68k
  ascFile.addNote(f.str().c_str());
1212
5.68k
  return input->tell()<=endPos;
1213
5.68k
}
1214
1215
bool StarCAttributeFootnote::read(StarZone &zone, int nVers, long endPos, StarObject &object)
1216
18.4k
{
1217
18.4k
  STOFFInputStreamPtr input=zone.input();
1218
18.4k
  long pos=input->tell();
1219
18.4k
  libstoff::DebugFile &ascFile=zone.ascii();
1220
18.4k
  libstoff::DebugStream f;
1221
18.4k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1222
  // sw_sw3npool.cxx SwFmtFtn::Create
1223
18.4k
  m_number=int(input->readULong(2));
1224
18.4k
  std::vector<uint32_t> string;
1225
18.4k
  if (!zone.readString(string)) {
1226
5.87k
    STOFF_DEBUG_MSG(("StarCAttributeFootnote::read: can not find the aNumber\n"));
1227
5.87k
    printData(f);
1228
5.87k
    f << "###aNumber,";
1229
5.87k
    ascFile.addPos(pos);
1230
5.87k
    ascFile.addNote(f.str().c_str());
1231
5.87k
    return false;
1232
5.87k
  }
1233
12.6k
  if (!string.empty())
1234
3.47k
    m_label=libstoff::getString(string).cstr();
1235
  // no sure, find this attribute once with a content here, so ...
1236
12.6k
  StarObjectText text(object, false); // checkme
1237
12.6k
  if (!text.readSWContent(zone, m_content)) {
1238
10.2k
    STOFF_DEBUG_MSG(("StarCAttributeFootnote::read: can not find the content\n"));
1239
10.2k
    f << "###aContent,";
1240
10.2k
    ascFile.addPos(pos);
1241
10.2k
    ascFile.addNote(f.str().c_str());
1242
10.2k
    return false;
1243
10.2k
  }
1244
2.36k
  if (nVers>=1)
1245
2.29k
    m_numSeq=int(input->readULong(2));
1246
2.36k
  if (nVers>=2)
1247
2.29k
    m_flags=int(input->readULong(1));
1248
1249
2.36k
  printData(f);
1250
2.36k
  ascFile.addPos(pos);
1251
2.36k
  ascFile.addNote(f.str().c_str());
1252
2.36k
  return input->tell()<=endPos;
1253
12.6k
}
1254
1255
bool StarCAttributeHardBlank::read(StarZone &zone, int nVers, long endPos, StarObject &/*object*/)
1256
62.9k
{
1257
62.9k
  STOFFInputStreamPtr input=zone.input();
1258
62.9k
  long pos=input->tell();
1259
62.9k
  libstoff::DebugFile &ascFile=zone.ascii();
1260
62.9k
  libstoff::DebugStream f;
1261
62.9k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1262
62.9k
  if (nVers>=1)
1263
60.5k
    *input >> m_char;
1264
62.9k
  printData(f);
1265
62.9k
  ascFile.addPos(pos);
1266
62.9k
  ascFile.addNote(f.str().c_str());
1267
62.9k
  return input->tell()<=endPos;
1268
62.9k
}
1269
1270
bool StarCAttributeINetFmt::read(StarZone &zone, int nVers, long endPos, StarObject &/*object*/)
1271
2.33k
{
1272
2.33k
  STOFFInputStreamPtr input=zone.input();
1273
2.33k
  long pos=input->tell();
1274
2.33k
  libstoff::DebugFile &ascFile=zone.ascii();
1275
2.33k
  libstoff::DebugStream f;
1276
2.33k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1277
  // SwFmtINetFmt::Create
1278
2.33k
  std::vector<uint32_t> string;
1279
6.22k
  for (int i=0; i<2; ++i) {
1280
4.40k
    if (!zone.readString(string)) {
1281
511
      STOFF_DEBUG_MSG(("StarCAttributeINetFmt::read: can not find string\n"));
1282
511
      f << "###" << (i==0 ? "url" : "target") << ",";
1283
511
      ascFile.addPos(pos);
1284
511
      ascFile.addNote(f.str().c_str());
1285
511
      return false;
1286
511
    }
1287
3.89k
    if (i==0)
1288
2.06k
      m_url=libstoff::getString(string);
1289
1.82k
    else
1290
1.82k
      m_target=libstoff::getString(string);
1291
3.89k
  }
1292
3.64k
  for (int &indice : m_indices) indice=int(input->readULong(2));
1293
1.82k
  auto nCnt=int(input->readULong(2));
1294
8.66k
  for (int i=0; i<2*nCnt; ++i) {
1295
7.35k
    if (!zone.readString(string) || input->tell()>endPos) {
1296
512
      STOFF_DEBUG_MSG(("StarCAttributeINetFmt::read: can not read a string\n"));
1297
512
      printData(f);
1298
512
      f << "###string,";
1299
512
      ascFile.addPos(pos);
1300
512
      ascFile.addNote(f.str().c_str());
1301
512
      return false;
1302
512
    }
1303
6.84k
    m_libNames.push_back(libstoff::getString(string));
1304
6.84k
  }
1305
1.30k
  if (nVers>=1) {
1306
1.11k
    if (!zone.readString(string)) {
1307
166
      STOFF_DEBUG_MSG(("StarCAttributeINetFmt::read: can not find string\n"));
1308
166
      printData(f);
1309
166
      f << "###aName1,";
1310
166
      ascFile.addPos(pos);
1311
166
      ascFile.addNote(f.str().c_str());
1312
166
      return false;
1313
166
    }
1314
944
    m_name=libstoff::getString(string);
1315
944
  }
1316
1.14k
  if (nVers>=2) {
1317
870
    nCnt=int(input->readULong(2));
1318
870
    f << "libMac2=[";
1319
1.92k
    for (int i=0; i<nCnt; ++i) {
1320
1.59k
      f << "nCurKey=" << input->readULong(2) << ",";
1321
1.59k
      if (!zone.readString(string) || input->tell()>endPos) {
1322
372
        STOFF_DEBUG_MSG(("StarCAttributeINetFmt::read: can not read a string\n"));
1323
372
        f << "###aName1,";
1324
372
        ascFile.addPos(pos);
1325
372
        ascFile.addNote(f.str().c_str());
1326
372
        return false;
1327
372
      }
1328
1.22k
      else if (!string.empty())
1329
288
        f << libstoff::getString(string).cstr() << ":";
1330
1.22k
      if (!zone.readString(string)|| input->tell()>endPos) {
1331
175
        STOFF_DEBUG_MSG(("StarCAttributeINetFmt::read: can not read a string\n"));
1332
175
        f << "###aName1,";
1333
175
        ascFile.addPos(pos);
1334
175
        ascFile.addNote(f.str().c_str());
1335
175
        return false;
1336
175
      }
1337
1.05k
      else if (!string.empty())
1338
228
        f << libstoff::getString(string).cstr();
1339
1.05k
      f << "nScriptType=" << input->readULong(2) << ",";
1340
1.05k
    }
1341
323
    f << "],";
1342
323
  }
1343
596
  printData(f);
1344
596
  ascFile.addPos(pos);
1345
596
  ascFile.addNote(f.str().c_str());
1346
596
  return input->tell()<=endPos;
1347
1.14k
}
1348
1349
bool StarCAttributeRefMark::read(StarZone &zone, int /*nVers*/, long endPos, StarObject &/*object*/)
1350
9.64k
{
1351
9.64k
  STOFFInputStreamPtr input=zone.input();
1352
9.64k
  long pos=input->tell();
1353
9.64k
  libstoff::DebugFile &ascFile=zone.ascii();
1354
9.64k
  libstoff::DebugStream f;
1355
9.64k
  f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:";
1356
9.64k
  std::vector<uint32_t> string;
1357
9.64k
  if (!zone.readString(string)) {
1358
2.45k
    STOFF_DEBUG_MSG(("StarCAttributeRefMark::read: can not find the name\n"));
1359
2.45k
    f << "###name,";
1360
2.45k
    ascFile.addPos(pos);
1361
2.45k
    ascFile.addNote(f.str().c_str());
1362
2.45k
    return false;
1363
2.45k
  }
1364
7.19k
  m_name=libstoff::getString(string);
1365
7.19k
  printData(f);
1366
7.19k
  ascFile.addPos(pos);
1367
7.19k
  ascFile.addNote(f.str().c_str());
1368
7.19k
  return input->tell()<=endPos;
1369
9.64k
}
1370
1371
bool StarCAttributeContent::send(STOFFListenerPtr &listener, StarState &state, std::set<StarAttribute const *> &done) const
1372
1.42k
{
1373
1.42k
  if (done.find(this)!=done.end()) {
1374
0
    STOFF_DEBUG_MSG(("StarCAttributeContent::send: find a loop\n"));
1375
0
    return false;
1376
0
  }
1377
1.42k
  done.insert(this);
1378
1.42k
  if (!listener) {
1379
0
    STOFF_DEBUG_MSG(("StarCAttributeContent::send: can not find the listener\n"));
1380
0
    return false;
1381
0
  }
1382
1.42k
  if (m_content) // checkme zone time, we need probably to create a frame
1383
1.42k
    m_content->send(listener, state, !state.m_headerFooter);
1384
1.42k
  return true;
1385
1.42k
}
1386
1387
bool StarCAttributeFlyCnt::send(STOFFListenerPtr &listener, StarState &state, std::set<StarAttribute const *> &done) const
1388
0
{
1389
0
  if (done.find(this)!=done.end()) {
1390
0
    STOFF_DEBUG_MSG(("StarCAttributeFlyCnt::send: find a loop\n"));
1391
0
    return false;
1392
0
  }
1393
0
  done.insert(this);
1394
0
  if (!listener) {
1395
0
    STOFF_DEBUG_MSG(("StarCAttributeFlyCnt::send: can not find the listener\n"));
1396
0
    return false;
1397
0
  }
1398
0
  if (!m_format) {
1399
0
    STOFF_DEBUG_MSG(("StarCAttributeFlyCnt::send: can not find the format\n"));
1400
0
    return false;
1401
0
  }
1402
0
  return m_format->send(listener, state);
1403
0
}
1404
1405
bool StarCAttributeFootnote::send(STOFFListenerPtr &listener, StarState &state, std::set<StarAttribute const *> &done) const
1406
3
{
1407
3
  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
  done.insert(this);
1412
3
  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
  STOFFSubDocumentPtr subDocument(new SubDocument(m_content, state.m_global));
1417
3
  STOFFNote note(STOFFNote::FootNote);
1418
3
  if (m_label.empty())
1419
3
    note.m_label=m_label;
1420
0
  else
1421
0
    note.m_number=m_number;
1422
3
  listener->insertNote(note, subDocument);
1423
3
  return true;
1424
3
}
1425
1426
}
1427
1428
namespace StarCharAttribute
1429
{
1430
void addInitTo(std::map<int, std::shared_ptr<StarAttribute> > &map)
1431
181k
{
1432
181k
  map[StarAttribute::ATTR_CHR_FONT]=std::shared_ptr<StarAttribute>(new StarCAttributeFont(StarAttribute::ATTR_CHR_FONT,"chrAtrFont"));
1433
181k
  map[StarAttribute::ATTR_CHR_CJK_FONT]=std::shared_ptr<StarAttribute>(new StarCAttributeFont(StarAttribute::ATTR_CHR_CJK_FONT,"chrAtrCJKFont"));
1434
181k
  map[StarAttribute::ATTR_CHR_CTL_FONT]=std::shared_ptr<StarAttribute>(new StarCAttributeFont(StarAttribute::ATTR_CHR_CTL_FONT,"chrAtrCTLFont"));
1435
181k
  map[StarAttribute::ATTR_CHR_FONTSIZE]=std::shared_ptr<StarAttribute>(new StarCAttributeFontSize(StarAttribute::ATTR_CHR_FONTSIZE,"chrAtrFontsize"));
1436
181k
  map[StarAttribute::ATTR_CHR_CJK_FONTSIZE]=std::shared_ptr<StarAttribute>(new StarCAttributeFontSize(StarAttribute::ATTR_CHR_CJK_FONTSIZE,"chrAtrCJKFontsize"));
1437
181k
  map[StarAttribute::ATTR_CHR_CTL_FONTSIZE]=std::shared_ptr<StarAttribute>(new StarCAttributeFontSize(StarAttribute::ATTR_CHR_CTL_FONTSIZE,"chrAtrCTLFontsize"));
1438
181k
  addAttributeColor(map, StarAttribute::ATTR_CHR_COLOR,"char[color]",STOFFColor::black());
1439
  // bold
1440
181k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_WEIGHT,"char[weight]",1,5); // normal
1441
181k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_CJK_WEIGHT,"char[cjk,weight]",1,5); // normal
1442
181k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_CTL_WEIGHT,"char[ctl,weight]",1,5); // normal
1443
  // italic
1444
181k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_POSTURE,"char[posture]",1,0); // none
1445
181k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_CJK_POSTURE,"char[cjk,posture]",1,0); // none
1446
181k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_CTL_POSTURE,"char[ctl,posture]",1,0); // none
1447
1448
181k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_CASEMAP,"char[casemap]",1,0); // no mapped
1449
181k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_CROSSEDOUT,"char[crossedout]",1,0); // none
1450
181k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_UNDERLINE,"char[underline]",1,0); // none
1451
181k
  addAttributeBool(map,StarAttribute::ATTR_CHR_CONTOUR,"char[contour]",false);
1452
181k
  addAttributeBool(map,StarAttribute::ATTR_CHR_SHADOWED,"char[shadowed]",false);
1453
181k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_RELIEF,"char[relief]",2,0); // none
1454
181k
  addAttributeBool(map,StarAttribute::ATTR_CHR_BLINK,"char[blink]",false);
1455
181k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_EMPHASIS_MARK,"char[emphasisMark]",2,0); // none
1456
1457
181k
  addAttributeBool(map,StarAttribute::ATTR_CHR_WORDLINEMODE,"char[word,linemode]",false);
1458
181k
  addAttributeBool(map,StarAttribute::ATTR_CHR_AUTOKERN,"char[autoKern]",false);
1459
181k
  addAttributeInt(map,StarAttribute::ATTR_CHR_KERNING,"char[kerning]",2,0);
1460
181k
  map[StarAttribute::ATTR_CHR_ESCAPEMENT]=std::shared_ptr<StarAttribute>(new StarCAttributeEscapement(StarAttribute::ATTR_CHR_ESCAPEMENT,"chrAtrEscapement"));
1461
181k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_PROPORTIONALFONTSIZE,"char[proportionalfontsize]",2,100); // 100%
1462
1463
181k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_LANGUAGE,"char[language]",2,0x3ff); // unknown
1464
181k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_CJK_LANGUAGE,"char[cjk,language]",2,0x3ff); // unknown
1465
181k
  addAttributeUInt(map,StarAttribute::ATTR_CHR_CTL_LANGUAGE,"char[ctl,language]",2,0x3ff); // unknown
1466
181k
  addAttributeUInt(map,StarAttribute::ATTR_SC_LANGUAGE_FORMAT,"cell[language]",2,0x3ff); // unknown
1467
1468
181k
  addAttributeBool(map,StarAttribute::ATTR_CHR_NOHYPHEN,"char[noHyphen]",true);
1469
181k
  addAttributeVoid(map,StarAttribute::ATTR_TXT_SOFTHYPH,"text[softHyphen]");
1470
181k
  map[StarAttribute::ATTR_TXT_CHARFMT]=std::shared_ptr<StarAttribute>(new StarCAttributeCharFormat(StarAttribute::ATTR_TXT_CHARFMT,"textAtrCharFmt"));
1471
181k
  map[StarAttribute::ATTR_TXT_FTN]=std::shared_ptr<StarAttribute>(new StarCAttributeFootnote(StarAttribute::ATTR_TXT_FTN,"textAtrFtn"));
1472
181k
  map[StarAttribute::ATTR_TXT_FIELD]=std::shared_ptr<StarAttribute>(new StarCAttributeField(StarAttribute::ATTR_TXT_FIELD,"textAtrField"));
1473
181k
  map[StarAttribute::ATTR_TXT_FLYCNT]=std::shared_ptr<StarAttribute>(new StarCAttributeFlyCnt(StarAttribute::ATTR_TXT_FLYCNT,"textAtrTxtFlyCnt"));
1474
181k
  map[StarAttribute::ATTR_TXT_HARDBLANK]=std::shared_ptr<StarAttribute>(new StarCAttributeHardBlank(StarAttribute::ATTR_TXT_HARDBLANK,"textAtrHardBlank"));
1475
181k
  map[StarAttribute::ATTR_TXT_INETFMT]=std::shared_ptr<StarAttribute>(new StarCAttributeINetFmt(StarAttribute::ATTR_TXT_INETFMT,"textAtrInetFmt"));
1476
181k
  map[StarAttribute::ATTR_TXT_REFMARK]=std::shared_ptr<StarAttribute>(new StarCAttributeRefMark(StarAttribute::ATTR_TXT_REFMARK,"textAtrRefMark"));
1477
181k
  addAttributeBool(map,StarAttribute::ATTR_CHR_NOLINEBREAK,"char[nolineBreak]",true);
1478
181k
  addAttributeBool(map,StarAttribute::ATTR_SC_HYPHENATE,"hyphenate", false);
1479
1480
181k
  addAttributeVoid(map, StarAttribute::ATTR_EE_FEATURE_TAB, "feature[tab]");
1481
181k
  addAttributeVoid(map, StarAttribute::ATTR_EE_FEATURE_LINEBR, "feature[linebr]");
1482
181k
  map[StarAttribute::ATTR_EE_FEATURE_FIELD]=std::shared_ptr<StarAttribute>(new StarCAttributeField(StarAttribute::ATTR_EE_FEATURE_FIELD,"eeFeatureField"));
1483
1484
181k
  addAttributeBool(map,StarAttribute::ATTR_CHR_DUMMY1,"char[dummy1]",false);
1485
181k
  addAttributeBool(map,StarAttribute::ATTR_TXT_DUMMY1,"text[dummy1]",false);
1486
181k
  addAttributeBool(map,StarAttribute::ATTR_TXT_DUMMY2,"text[dummy2]",false);
1487
181k
  addAttributeBool(map,StarAttribute::ATTR_TXT_DUMMY4,"text[dummy4]",false);
1488
181k
  addAttributeBool(map,StarAttribute::ATTR_TXT_DUMMY5,"text[dummy5]",false);
1489
181k
  addAttributeBool(map,StarAttribute::ATTR_TXT_DUMMY6,"text[dummy6]",false);
1490
181k
  addAttributeBool(map,StarAttribute::ATTR_TXT_DUMMY7,"text[dummy7]",false);
1491
181k
  addAttributeVoid(map,StarAttribute::ATTR_TXT_UNKNOWN_CONTAINER, "text[unknContainer]"); // XML attrib
1492
1493
181k
  map[StarAttribute::ATTR_FRM_CNTNT]=std::shared_ptr<StarAttribute>(new StarCAttributeContent(StarAttribute::ATTR_FRM_CNTNT,"pageCntnt"));
1494
1495
1496
181k
}
1497
}
1498
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: