Debian Codegraph @

src/lib/ABWOutputElements.cpp

raw
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libabw project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10 #include "ABWOutputElements.h"
11
12 namespace
13 {
14
15 typedef libabw::ABWOutputElements::OutputElements_t OutputElements_t;
16 typedef libabw::ABWOutputElements::OutputElementsMap_t OutputElementsMap_t;
17
18 template<typename T, typename... Args>
19 std::unique_ptr<T> make_unique(Args &&... args)
20 {
21 return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
22 }
23
24 }
25
26 namespace libabw
27 {
28
29 class ABWOutputElement
30 {
31 public:
32 ABWOutputElement() {}
33 virtual ~ABWOutputElement() {}
34 virtual void write(librevenge::RVNGTextInterface *iface,
35 const OutputElementsMap_t *footers,
36 const OutputElementsMap_t *headers) const = 0;
37 };
38
39 class ABWCloseEndnoteElement : public ABWOutputElement
40 {
41 public:
42 ABWCloseEndnoteElement() {}
43 ~ABWCloseEndnoteElement() override {}
44 void write(librevenge::RVNGTextInterface *iface,
45 const OutputElementsMap_t *footers,
46 const OutputElementsMap_t *headers) const override;
47 };
48
49 class ABWCloseFooterElement : public ABWOutputElement
50 {
51 public:
52 ABWCloseFooterElement() {}
53 ~ABWCloseFooterElement() override {}
54 void write(librevenge::RVNGTextInterface *iface,
55 const OutputElementsMap_t *footers,
56 const OutputElementsMap_t *headers) const override;
57 };
58
59 class ABWCloseFootnoteElement : public ABWOutputElement
60 {
61 public:
62 ABWCloseFootnoteElement() {}
63 ~ABWCloseFootnoteElement() override {}
64 void write(librevenge::RVNGTextInterface *iface,
65 const OutputElementsMap_t *footers,
66 const OutputElementsMap_t *headers) const override;
67 };
68
69 class ABWCloseFrameElement : public ABWOutputElement
70 {
71 public:
72 ABWCloseFrameElement() {}
73 ~ABWCloseFrameElement() override {}
74 void write(librevenge::RVNGTextInterface *iface,
75 const OutputElementsMap_t *footers,
76 const OutputElementsMap_t *headers) const override;
77 };
78
79 class ABWCloseHeaderElement : public ABWOutputElement
80 {
81 public:
82 ABWCloseHeaderElement() {}
83 ~ABWCloseHeaderElement() override {}
84 void write(librevenge::RVNGTextInterface *iface,
85 const OutputElementsMap_t *footers,
86 const OutputElementsMap_t *headers) const override;
87 };
88
89 class ABWCloseLinkElement : public ABWOutputElement
90 {
91 public:
92 ABWCloseLinkElement() {}
93 ~ABWCloseLinkElement() override {}
94 void write(librevenge::RVNGTextInterface *iface,
95 const OutputElementsMap_t *footers,
96 const OutputElementsMap_t *headers) const override;
97 };
98
99 class ABWCloseListElementElement : public ABWOutputElement
100 {
101 public:
102 ABWCloseListElementElement() {}
103 ~ABWCloseListElementElement() override {}
104 void write(librevenge::RVNGTextInterface *iface,
105 const OutputElementsMap_t *footers,
106 const OutputElementsMap_t *headers) const override;
107 };
108
109 class ABWCloseOrderedListLevelElement : public ABWOutputElement
110 {
111 public:
112 ABWCloseOrderedListLevelElement() {}
113 ~ABWCloseOrderedListLevelElement() override {}
114 void write(librevenge::RVNGTextInterface *iface,
115 const OutputElementsMap_t *footers,
116 const OutputElementsMap_t *headers) const override;
117 };
118
119 class ABWClosePageSpanElement : public ABWOutputElement
120 {
121 public:
122 ABWClosePageSpanElement() {}
123 ~ABWClosePageSpanElement() override {}
124 void write(librevenge::RVNGTextInterface *iface,
125 const OutputElementsMap_t *footers,
126 const OutputElementsMap_t *headers) const override;
127 };
128
129 class ABWCloseParagraphElement : public ABWOutputElement
130 {
131 public:
132 ABWCloseParagraphElement() {}
133 ~ABWCloseParagraphElement() override {}
134 void write(librevenge::RVNGTextInterface *iface,
135 const OutputElementsMap_t *footers,
136 const OutputElementsMap_t *headers) const override;
137 };
138
139 class ABWCloseSectionElement : public ABWOutputElement
140 {
141 public:
142 ABWCloseSectionElement() {}
143 ~ABWCloseSectionElement() override {}
144 void write(librevenge::RVNGTextInterface *iface,
145 const OutputElementsMap_t *footers,
146 const OutputElementsMap_t *headers) const override;
147 };
148
149 class ABWCloseSpanElement : public ABWOutputElement
150 {
151 public:
152 ABWCloseSpanElement() {}
153 ~ABWCloseSpanElement() override {}
154 void write(librevenge::RVNGTextInterface *iface,
155 const OutputElementsMap_t *footers,
156 const OutputElementsMap_t *headers) const override;
157 };
158
159 class ABWCloseTableElement : public ABWOutputElement
160 {
161 public:
162 ABWCloseTableElement() {}
163 ~ABWCloseTableElement() override {}
164 void write(librevenge::RVNGTextInterface *iface,
165 const OutputElementsMap_t *footers,
166 const OutputElementsMap_t *headers) const override;
167 };
168
169 class ABWCloseTableCellElement : public ABWOutputElement
170 {
171 public:
172 ABWCloseTableCellElement() {}
173 ~ABWCloseTableCellElement() override {}
174 void write(librevenge::RVNGTextInterface *iface,
175 const OutputElementsMap_t *footers,
176 const OutputElementsMap_t *headers) const override;
177 };
178
179 class ABWCloseTableRowElement : public ABWOutputElement
180 {
181 public:
182 ABWCloseTableRowElement() {}
183 ~ABWCloseTableRowElement() override {}
184 void write(librevenge::RVNGTextInterface *iface,
185 const OutputElementsMap_t *footers,
186 const OutputElementsMap_t *headers) const override;
187 };
188
189 class ABWCloseTextBoxElement : public ABWOutputElement
190 {
191 public:
192 ABWCloseTextBoxElement() {}
193 ~ABWCloseTextBoxElement() override {}
194 void write(librevenge::RVNGTextInterface *iface,
195 const OutputElementsMap_t *footers,
196 const OutputElementsMap_t *headers) const override;
197 };
198
199 class ABWCloseUnorderedListLevelElement : public ABWOutputElement
200 {
201 public:
202 ABWCloseUnorderedListLevelElement() {}
203 ~ABWCloseUnorderedListLevelElement() override {}
204 void write(librevenge::RVNGTextInterface *iface,
205 const OutputElementsMap_t *footers,
206 const OutputElementsMap_t *headers) const override;
207 };
208
209 class ABWInsertBinaryObjectElement : public ABWOutputElement
210 {
211 public:
212 ABWInsertBinaryObjectElement(const librevenge::RVNGPropertyList &propList) :
213 m_propList(propList) {}
214 ~ABWInsertBinaryObjectElement() override {}
215 void write(librevenge::RVNGTextInterface *iface,
216 const OutputElementsMap_t *footers,
217 const OutputElementsMap_t *headers) const override;
218 private:
219 librevenge::RVNGPropertyList m_propList;
220 };
221
222 class ABWInsertFieldElement : public ABWOutputElement
223 {
224 public:
225 ABWInsertFieldElement(const librevenge::RVNGPropertyList &propList) :
226 m_propList(propList) {}
227 ~ABWInsertFieldElement() override {}
228 void write(librevenge::RVNGTextInterface *iface,
229 const OutputElementsMap_t *footers,
230 const OutputElementsMap_t *headers) const override;
231 private:
232 librevenge::RVNGPropertyList m_propList;
233 };
234
235 class ABWInsertCoveredTableCellElement : public ABWOutputElement
236 {
237 public:
238 ABWInsertCoveredTableCellElement(const librevenge::RVNGPropertyList &propList) :
239 m_propList(propList) {}
240 ~ABWInsertCoveredTableCellElement() override {}
241 void write(librevenge::RVNGTextInterface *iface,
242 const OutputElementsMap_t *footers,
243 const OutputElementsMap_t *headers) const override;
244 private:
245 librevenge::RVNGPropertyList m_propList;
246 };
247
248 class ABWInsertLineBreakElement : public ABWOutputElement
249 {
250 public:
251 ABWInsertLineBreakElement() {}
252 ~ABWInsertLineBreakElement() override {}
253 void write(librevenge::RVNGTextInterface *iface,
254 const OutputElementsMap_t *footers,
255 const OutputElementsMap_t *headers) const override;
256 };
257
258 class ABWInsertSpaceElement : public ABWOutputElement
259 {
260 public:
261 ABWInsertSpaceElement() {}
262 ~ABWInsertSpaceElement() override {}
263 void write(librevenge::RVNGTextInterface *iface,
264 const OutputElementsMap_t *footers,
265 const OutputElementsMap_t *headers) const override;
266 };
267
268 class ABWInsertTabElement : public ABWOutputElement
269 {
270 public:
271 ABWInsertTabElement() {}
272 ~ABWInsertTabElement() override {}
273 void write(librevenge::RVNGTextInterface *iface,
274 const OutputElementsMap_t *footers,
275 const OutputElementsMap_t *headers) const override;
276 };
277
278 class ABWInsertTextElement : public ABWOutputElement
279 {
280 public:
281 ABWInsertTextElement(const librevenge::RVNGString &text) :
282 m_text(text) {}
283 ~ABWInsertTextElement() override {}
284 void write(librevenge::RVNGTextInterface *iface,
285 const OutputElementsMap_t *footers,
286 const OutputElementsMap_t *headers) const override;
287 private:
288 librevenge::RVNGString m_text;
289 };
290
291 class ABWOpenEndnoteElement : public ABWOutputElement
292 {
293 public:
294 ABWOpenEndnoteElement(const librevenge::RVNGPropertyList &propList) :
295 m_propList(propList) {}
296 ~ABWOpenEndnoteElement() override {}
297 void write(librevenge::RVNGTextInterface *iface,
298 const OutputElementsMap_t *footers,
299 const OutputElementsMap_t *headers) const override;
300 private:
301 librevenge::RVNGPropertyList m_propList;
302 };
303
304 class ABWOpenFooterElement : public ABWOutputElement
305 {
306 public:
307 ABWOpenFooterElement(const librevenge::RVNGPropertyList &propList) :
308 m_propList(propList) {}
309 ~ABWOpenFooterElement() override {}
310 void write(librevenge::RVNGTextInterface *iface,
311 const OutputElementsMap_t *footers,
312 const OutputElementsMap_t *headers) const override;
313 private:
314 librevenge::RVNGPropertyList m_propList;
315 };
316
317 class ABWOpenFootnoteElement : public ABWOutputElement
318 {
319 public:
320 ABWOpenFootnoteElement(const librevenge::RVNGPropertyList &propList) :
321 m_propList(propList) {}
322 ~ABWOpenFootnoteElement() override {}
323 void write(librevenge::RVNGTextInterface *iface,
324 const OutputElementsMap_t *footers,
325 const OutputElementsMap_t *headers) const override;
326 private:
327 librevenge::RVNGPropertyList m_propList;
328 };
329
330 class ABWOpenFrameElement : public ABWOutputElement
331 {
332 public:
333 ABWOpenFrameElement(const librevenge::RVNGPropertyList &propList) :
334 m_propList(propList) {}
335 ~ABWOpenFrameElement() override {}
336 void write(librevenge::RVNGTextInterface *iface,
337 const OutputElementsMap_t *footers,
338 const OutputElementsMap_t *headers) const override;
339 private:
340 librevenge::RVNGPropertyList m_propList;
341 };
342
343 class ABWOpenHeaderElement : public ABWOutputElement
344 {
345 public:
346 ABWOpenHeaderElement(const librevenge::RVNGPropertyList &propList) :
347 m_propList(propList) {}
348 ~ABWOpenHeaderElement() override {}
349 void write(librevenge::RVNGTextInterface *iface,
350 const OutputElementsMap_t *footers,
351 const OutputElementsMap_t *headers) const override;
352 private:
353 librevenge::RVNGPropertyList m_propList;
354 };
355
356 class ABWOpenLinkElement : public ABWOutputElement
357 {
358 public:
359 ABWOpenLinkElement(const librevenge::RVNGPropertyList &propList) :
360 m_propList(propList) {}
361 ~ABWOpenLinkElement() override {}
362 void write(librevenge::RVNGTextInterface *iface,
363 const OutputElementsMap_t *footers,
364 const OutputElementsMap_t *headers) const override;
365 private:
366 librevenge::RVNGPropertyList m_propList;
367 };
368
369 class ABWOpenListElementElement : public ABWOutputElement
370 {
371 public:
372 ABWOpenListElementElement(const librevenge::RVNGPropertyList &propList) :
373 m_propList(propList) {}
374 ~ABWOpenListElementElement() override {}
375 void write(librevenge::RVNGTextInterface *iface,
376 const OutputElementsMap_t *footers,
377 const OutputElementsMap_t *headers) const override;
378 private:
379 librevenge::RVNGPropertyList m_propList;
380 };
381
382 class ABWOpenOrderedListLevelElement : public ABWOutputElement
383 {
384 public:
385 ABWOpenOrderedListLevelElement(const librevenge::RVNGPropertyList &propList) :
386 m_propList(propList) {}
387 ~ABWOpenOrderedListLevelElement() override {}
388 void write(librevenge::RVNGTextInterface *iface,
389 const OutputElementsMap_t *footers,
390 const OutputElementsMap_t *headers) const override;
391 private:
392 librevenge::RVNGPropertyList m_propList;
393 };
394
395 class ABWOpenPageSpanElement : public ABWOutputElement
396 {
397 public:
398 ABWOpenPageSpanElement(const librevenge::RVNGPropertyList &propList,
399 int footer, int footerLeft, int footerFirst, int footerLast,
400 int header, int headerLeft, int headerFirst, int headerLast) :
401 m_propList(propList),
402 m_footer(footer),
403 m_footerLeft(footerLeft),
404 m_footerFirst(footerFirst),
405 m_footerLast(footerLast),
406 m_header(header),
407 m_headerLeft(headerLeft),
408 m_headerFirst(headerFirst),
409 m_headerLast(headerLast) {}
410 ~ABWOpenPageSpanElement() override {}
411 void write(librevenge::RVNGTextInterface *iface,
412 const OutputElementsMap_t *footers,
413 const OutputElementsMap_t *headers) const override;
414 private:
415 void _writeElements(librevenge::RVNGTextInterface *iface, int id,
416 const OutputElementsMap_t *elements) const;
417 librevenge::RVNGPropertyList m_propList;
418 int m_footer;
419 int m_footerLeft;
420 int m_footerFirst;
421 int m_footerLast;
422 int m_header;
423 int m_headerLeft;
424 int m_headerFirst;
425 int m_headerLast;
426 };
427
428 class ABWOpenParagraphElement : public ABWOutputElement
429 {
430 public:
431 ABWOpenParagraphElement(const librevenge::RVNGPropertyList &propList) :
432 m_propList(propList) {}
433 ~ABWOpenParagraphElement() override {}
434 void write(librevenge::RVNGTextInterface *iface,
435 const OutputElementsMap_t *footers,
436 const OutputElementsMap_t *headers) const override;
437 private:
438 librevenge::RVNGPropertyList m_propList;
439 };
440
441 class ABWOpenSectionElement : public ABWOutputElement
442 {
443 public:
444 ABWOpenSectionElement(const librevenge::RVNGPropertyList &propList) :
445 m_propList(propList) {}
446 ~ABWOpenSectionElement() override {}
447 void write(librevenge::RVNGTextInterface *iface,
448 const OutputElementsMap_t *footers,
449 const OutputElementsMap_t *headers) const override;
450 private:
451 librevenge::RVNGPropertyList m_propList;
452 };
453
454 class ABWOpenSpanElement : public ABWOutputElement
455 {
456 public:
457 ABWOpenSpanElement(const librevenge::RVNGPropertyList &propList) :
458 m_propList(propList) {}
459 ~ABWOpenSpanElement() override {}
460 void write(librevenge::RVNGTextInterface *iface,
461 const OutputElementsMap_t *footers,
462 const OutputElementsMap_t *headers) const override;
463 private:
464 librevenge::RVNGPropertyList m_propList;
465 };
466
467 class ABWOpenTableElement : public ABWOutputElement
468 {
469 public:
470 ABWOpenTableElement(const librevenge::RVNGPropertyList &propList) :
471 m_propList(propList) {}
472 ~ABWOpenTableElement() override {}
473 void write(librevenge::RVNGTextInterface *iface,
474 const OutputElementsMap_t *footers,
475 const OutputElementsMap_t *headers) const override;
476 private:
477 librevenge::RVNGPropertyList m_propList;
478 };
479
480 class ABWOpenTableCellElement : public ABWOutputElement
481 {
482 public:
483 ABWOpenTableCellElement(const librevenge::RVNGPropertyList &propList) :
484 m_propList(propList) {}
485 ~ABWOpenTableCellElement() override {}
486 void write(librevenge::RVNGTextInterface *iface,
487 const OutputElementsMap_t *footers,
488 const OutputElementsMap_t *headers) const override;
489 private:
490 librevenge::RVNGPropertyList m_propList;
491 };
492
493 class ABWOpenTableRowElement : public ABWOutputElement
494 {
495 public:
496 ABWOpenTableRowElement(const librevenge::RVNGPropertyList &propList) :
497 m_propList(propList) {}
498 ~ABWOpenTableRowElement() override {}
499 void write(librevenge::RVNGTextInterface *iface,
500 const OutputElementsMap_t *footers,
501 const OutputElementsMap_t *headers) const override;
502 private:
503 librevenge::RVNGPropertyList m_propList;
504 };
505
506 class ABWOpenTextBoxElement : public ABWOutputElement
507 {
508 public:
509 ABWOpenTextBoxElement(const librevenge::RVNGPropertyList &propList) :
510 m_propList(propList) {}
511 ~ABWOpenTextBoxElement() override {}
512 void write(librevenge::RVNGTextInterface *iface,
513 const OutputElementsMap_t *footers,
514 const OutputElementsMap_t *headers) const override;
515 private:
516 librevenge::RVNGPropertyList m_propList;
517 };
518
519 class ABWOpenUnorderedListLevelElement : public ABWOutputElement
520 {
521 public:
522 ABWOpenUnorderedListLevelElement(const librevenge::RVNGPropertyList &propList) :
523 m_propList(propList) {}
524 ~ABWOpenUnorderedListLevelElement() override {}
525 void write(librevenge::RVNGTextInterface *iface,
526 const OutputElementsMap_t *footers,
527 const OutputElementsMap_t *headers) const override;
528 private:
529 librevenge::RVNGPropertyList m_propList;
530 };
531
532 } // namespace libabw
533
534 void libabw::ABWCloseEndnoteElement::write(librevenge::RVNGTextInterface *iface,
535 const OutputElementsMap_t *,
536 const OutputElementsMap_t *) const
537 {
538 if (iface)
539 iface->closeEndnote();
540 }
541
542 void libabw::ABWCloseFooterElement::write(librevenge::RVNGTextInterface *iface,
543 const OutputElementsMap_t *,
544 const OutputElementsMap_t *) const
545 {
546 if (iface)
547 iface->closeFooter();
548 }
549
550 void libabw::ABWCloseFootnoteElement::write(librevenge::RVNGTextInterface *iface,
551 const OutputElementsMap_t *,
552 const OutputElementsMap_t *) const
553 {
554 if (iface)
555 iface->closeFootnote();
556 }
557
558 void libabw::ABWCloseFrameElement::write(librevenge::RVNGTextInterface *iface,
559 const OutputElementsMap_t *,
560 const OutputElementsMap_t *) const
561 {
562 if (iface)
563 iface->closeFrame();
564 }
565
566 void libabw::ABWCloseHeaderElement::write(librevenge::RVNGTextInterface *iface,
567 const OutputElementsMap_t *,
568 const OutputElementsMap_t *) const
569 {
570 if (iface)
571 iface->closeHeader();
572 }
573
574 void libabw::ABWCloseLinkElement::write(librevenge::RVNGTextInterface *iface,
575 const OutputElementsMap_t *,
576 const OutputElementsMap_t *) const
577 {
578 if (iface)
579 iface->closeLink();
580 }
581
582 void libabw::ABWCloseListElementElement::write(librevenge::RVNGTextInterface *iface,
583 const OutputElementsMap_t *,
584 const OutputElementsMap_t *) const
585 {
586 if (iface)
587 iface->closeListElement();
588 }
589
590 void libabw::ABWCloseOrderedListLevelElement::write(librevenge::RVNGTextInterface *iface,
591 const OutputElementsMap_t *,
592 const OutputElementsMap_t *) const
593 {
594 if (iface)
595 iface->closeOrderedListLevel();
596 }
597
598 void libabw::ABWClosePageSpanElement::write(librevenge::RVNGTextInterface *iface,
599 const OutputElementsMap_t *,
600 const OutputElementsMap_t *) const
601 {
602 if (iface)
603 iface->closePageSpan();
604 }
605
606 void libabw::ABWCloseParagraphElement::write(librevenge::RVNGTextInterface *iface,
607 const OutputElementsMap_t *,
608 const OutputElementsMap_t *) const
609 {
610 if (iface)
611 iface->closeParagraph();
612 }
613
614 void libabw::ABWCloseSectionElement::write(librevenge::RVNGTextInterface *iface,
615 const OutputElementsMap_t *,
616 const OutputElementsMap_t *) const
617 {
618 if (iface)
619 iface->closeSection();
620 }
621
622 void libabw::ABWCloseSpanElement::write(librevenge::RVNGTextInterface *iface,
623 const OutputElementsMap_t *,
624 const OutputElementsMap_t *) const
625 {
626 if (iface)
627 iface->closeSpan();
628 }
629
630 void libabw::ABWCloseTableElement::write(librevenge::RVNGTextInterface *iface,
631 const OutputElementsMap_t *,
632 const OutputElementsMap_t *) const
633 {
634 if (iface)
635 iface->closeTable();
636 }
637
638 void libabw::ABWCloseTableCellElement::write(librevenge::RVNGTextInterface *iface,
639 const OutputElementsMap_t *,
640 const OutputElementsMap_t *) const
641 {
642 if (iface)
643 iface->closeTableCell();
644 }
645
646 void libabw::ABWCloseTableRowElement::write(librevenge::RVNGTextInterface *iface,
647 const OutputElementsMap_t *,
648 const OutputElementsMap_t *) const
649 {
650 if (iface)
651 iface->closeTableRow();
652 }
653
654 void libabw::ABWCloseTextBoxElement::write(librevenge::RVNGTextInterface *iface,
655 const OutputElementsMap_t *,
656 const OutputElementsMap_t *) const
657 {
658 if (iface)
659 iface->closeTextBox();
660 }
661
662 void libabw::ABWCloseUnorderedListLevelElement::write(librevenge::RVNGTextInterface *iface,
663 const OutputElementsMap_t *,
664 const OutputElementsMap_t *) const
665 {
666 if (iface)
667 iface->closeUnorderedListLevel();
668 }
669
670 void libabw::ABWInsertBinaryObjectElement::write(librevenge::RVNGTextInterface *iface,
671 const OutputElementsMap_t *,
672 const OutputElementsMap_t *) const
673 {
674 if (iface)
675 iface->insertBinaryObject(m_propList);
676 }
677
678 void libabw::ABWInsertFieldElement::write(librevenge::RVNGTextInterface *iface,
679 const OutputElementsMap_t *,
680 const OutputElementsMap_t *) const
681 {
682 if (iface)
683 iface->insertField(m_propList);
684 }
685
686 void libabw::ABWInsertCoveredTableCellElement::write(librevenge::RVNGTextInterface *iface,
687 const OutputElementsMap_t *,
688 const OutputElementsMap_t *) const
689 {
690 if (iface)
691 iface->insertCoveredTableCell(m_propList);
692 }
693
694 void libabw::ABWInsertLineBreakElement::write(librevenge::RVNGTextInterface *iface,
695 const OutputElementsMap_t *,
696 const OutputElementsMap_t *) const
697 {
698 if (iface)
699 iface->insertLineBreak();
700 }
701
702 void libabw::ABWInsertSpaceElement::write(librevenge::RVNGTextInterface *iface,
703 const OutputElementsMap_t *,
704 const OutputElementsMap_t *) const
705 {
706 if (iface)
707 iface->insertSpace();
708 }
709
710 void libabw::ABWInsertTabElement::write(librevenge::RVNGTextInterface *iface,
711 const OutputElementsMap_t *,
712 const OutputElementsMap_t *) const
713 {
714 if (iface)
715 iface->insertTab();
716 }
717
718 void libabw::ABWInsertTextElement::write(librevenge::RVNGTextInterface *iface,
719 const OutputElementsMap_t *,
720 const OutputElementsMap_t *) const
721 {
722 if (iface)
723 iface->insertText(m_text);
724 }
725
726 void libabw::ABWOpenEndnoteElement::write(librevenge::RVNGTextInterface *iface,
727 const OutputElementsMap_t *,
728 const OutputElementsMap_t *) const
729 {
730 if (iface)
731 iface->openEndnote(m_propList);
732 }
733
734 void libabw::ABWOpenFooterElement::write(librevenge::RVNGTextInterface *iface,
735 const OutputElementsMap_t *,
736 const OutputElementsMap_t *) const
737 {
738 if (iface)
739 iface->openFooter(m_propList);
740 }
741
742 void libabw::ABWOpenFootnoteElement::write(librevenge::RVNGTextInterface *iface,
743 const OutputElementsMap_t *,
744 const OutputElementsMap_t *) const
745 {
746 if (iface)
747 iface->openFootnote(m_propList);
748 }
749
750 void libabw::ABWOpenFrameElement::write(librevenge::RVNGTextInterface *iface,
751 const OutputElementsMap_t *,
752 const OutputElementsMap_t *) const
753 {
754 if (iface)
755 iface->openFrame(m_propList);
756 }
757
758 void libabw::ABWOpenHeaderElement::write(librevenge::RVNGTextInterface *iface,
759 const OutputElementsMap_t *,
760 const OutputElementsMap_t *) const
761 {
762 if (iface)
763 iface->openHeader(m_propList);
764 }
765
766 void libabw::ABWOpenListElementElement::write(librevenge::RVNGTextInterface *iface,
767 const OutputElementsMap_t *,
768 const OutputElementsMap_t *) const
769 {
770 if (iface)
771 iface->openListElement(m_propList);
772 }
773
774 void libabw::ABWOpenLinkElement::write(librevenge::RVNGTextInterface *iface,
775 const OutputElementsMap_t *,
776 const OutputElementsMap_t *) const
777 {
778 if (iface)
779 iface->openLink(m_propList);
780 }
781
782 void libabw::ABWOpenOrderedListLevelElement::write(librevenge::RVNGTextInterface *iface,
783 const OutputElementsMap_t *,
784 const OutputElementsMap_t *) const
785 {
786 if (iface)
787 iface->openOrderedListLevel(m_propList);
788 }
789
790 void libabw::ABWOpenPageSpanElement::write(librevenge::RVNGTextInterface *iface,
791 const OutputElementsMap_t *footers,
792 const OutputElementsMap_t *headers) const
793 {
794 if (iface)
795 {
796 // open the page span
797 iface->openPageSpan(m_propList);
798 // write out the footers
799 _writeElements(iface, m_footer, footers);
800 _writeElements(iface, m_footerLeft, footers);
801 _writeElements(iface, m_footerFirst, footers);
802 _writeElements(iface, m_footerLast, footers);
803 // write out the headers
804 _writeElements(iface, m_header, headers);
805 _writeElements(iface, m_headerLeft, headers);
806 _writeElements(iface, m_headerFirst, headers);
807 _writeElements(iface, m_headerLast, headers);
808 // and continue with writing out the other stuff
809 }
810
811 }
812
813 void libabw::ABWOpenPageSpanElement::_writeElements(librevenge::RVNGTextInterface *iface, int id,
814 const OutputElementsMap_t *elements) const
815 {
816 if (!elements || id < 0 || !iface)
817 return;
818
819 auto iterMap = elements->find(id);
820 if (iterMap == elements->end() || iterMap->second.empty())
821 return;
822
823 for (const auto &iterVec : iterMap->second)
824 iterVec->write(iface, nullptr, nullptr);
825 }
826
827 void libabw::ABWOpenParagraphElement::write(librevenge::RVNGTextInterface *iface,
828 const OutputElementsMap_t *,
829 const OutputElementsMap_t *) const
830 {
831 if (iface)
832 iface->openParagraph(m_propList);
833 }
834
835 void libabw::ABWOpenSectionElement::write(librevenge::RVNGTextInterface *iface,
836 const OutputElementsMap_t *,
837 const OutputElementsMap_t *) const
838 {
839 if (iface)
840 iface->openSection(m_propList);
841 }
842
843 void libabw::ABWOpenSpanElement::write(librevenge::RVNGTextInterface *iface,
844 const OutputElementsMap_t *,
845 const OutputElementsMap_t *) const
846 {
847 if (iface)
848 iface->openSpan(m_propList);
849 }
850
851 void libabw::ABWOpenTableElement::write(librevenge::RVNGTextInterface *iface,
852 const OutputElementsMap_t *,
853 const OutputElementsMap_t *) const
854 {
855 if (iface)
856 iface->openTable(m_propList);
857 }
858
859 void libabw::ABWOpenTableCellElement::write(librevenge::RVNGTextInterface *iface,
860 const OutputElementsMap_t *,
861 const OutputElementsMap_t *) const
862 {
863 if (iface)
864 iface->openTableCell(m_propList);
865 }
866
867 void libabw::ABWOpenTableRowElement::write(librevenge::RVNGTextInterface *iface,
868 const OutputElementsMap_t *,
869 const OutputElementsMap_t *) const
870 {
871 if (iface)
872 iface->openTableRow(m_propList);
873 }
874
875 void libabw::ABWOpenTextBoxElement::write(librevenge::RVNGTextInterface *iface,
876 const OutputElementsMap_t *,
877 const OutputElementsMap_t *) const
878 {
879 if (iface)
880 iface->openTextBox(m_propList);
881 }
882
883 void libabw::ABWOpenUnorderedListLevelElement::write(librevenge::RVNGTextInterface *iface,
884 const OutputElementsMap_t *,
885 const OutputElementsMap_t *) const
886 {
887 if (iface)
888 iface->openUnorderedListLevel(m_propList);
889 }
890
891 // ABWOutputElements
892
893 libabw::ABWOutputElements::ABWOutputElements()
894 : m_bodyElements(), m_headerElements(), m_footerElements(), m_elements(nullptr)
895 {
896 m_elements = &m_bodyElements;
897 }
898
899 libabw::ABWOutputElements::~ABWOutputElements()
900 {
901 }
902
903 void libabw::ABWOutputElements::splice(ABWOutputElements &elements)
904 {
905 m_bodyElements.splice(m_bodyElements.end(), elements.m_bodyElements);
906 }
907
908 void libabw::ABWOutputElements::write(librevenge::RVNGTextInterface *iface) const
909 {
910 OutputElements_t::const_iterator iter;
911 for (iter = m_bodyElements.begin(); iter != m_bodyElements.end(); ++iter)
912 (*iter)->write(iface, &m_footerElements, &m_headerElements);
913 }
914
915 void libabw::ABWOutputElements::addCloseEndnote()
916 {
917 if (m_elements)
918 m_elements->push_back(make_unique<ABWCloseEndnoteElement>());
919 }
920
921 void libabw::ABWOutputElements::addCloseFooter()
922 {
923 if (m_elements)
924 m_elements->push_back(make_unique<ABWCloseFooterElement>());
925 m_elements = &m_bodyElements;
926 }
927
928 void libabw::ABWOutputElements::addCloseFootnote()
929 {
930 if (m_elements)
931 m_elements->push_back(make_unique<ABWCloseFootnoteElement>());
932 }
933
934 void libabw::ABWOutputElements::addCloseFrame()
935 {
936 if (m_elements)
937 m_elements->push_back(make_unique<ABWCloseFrameElement>());
938 }
939
940 void libabw::ABWOutputElements::addCloseHeader()
941 {
942 if (m_elements)
943 m_elements->push_back(make_unique<ABWCloseHeaderElement>());
944 m_elements = &m_bodyElements;
945 }
946
947 void libabw::ABWOutputElements::addCloseLink()
948 {
949 if (m_elements)
950 m_elements->push_back(make_unique<ABWCloseLinkElement>());
951 }
952
953 void libabw::ABWOutputElements::addCloseListElement()
954 {
955 if (m_elements)
956 m_elements->push_back(make_unique<ABWCloseListElementElement>());
957 }
958
959 void libabw::ABWOutputElements::addCloseOrderedListLevel()
960 {
961 if (m_elements)
962 m_elements->push_back(make_unique<ABWCloseOrderedListLevelElement>());
963 }
964
965 void libabw::ABWOutputElements::addClosePageSpan()
966 {
967 if (m_elements)
968 m_elements->push_back(make_unique<ABWClosePageSpanElement>());
969 }
970
971 void libabw::ABWOutputElements::addCloseParagraph()
972 {
973 if (m_elements)
974 m_elements->push_back(make_unique<ABWCloseParagraphElement>());
975 }
976
977 void libabw::ABWOutputElements::addCloseSection()
978 {
979 if (m_elements)
980 m_elements->push_back(make_unique<ABWCloseSectionElement>());
981 }
982
983 void libabw::ABWOutputElements::addCloseSpan()
984 {
985 if (m_elements)
986 m_elements->push_back(make_unique<ABWCloseSpanElement>());
987 }
988
989 void libabw::ABWOutputElements::addCloseTable()
990 {
991 if (m_elements)
992 m_elements->push_back(make_unique<ABWCloseTableElement>());
993 }
994
995 void libabw::ABWOutputElements::addCloseTableCell()
996 {
997 if (m_elements)
998 m_elements->push_back(make_unique<ABWCloseTableCellElement>());
999 }
1000
1001 void libabw::ABWOutputElements::addCloseTableRow()
1002 {
1003 if (m_elements)
1004 m_elements->push_back(make_unique<ABWCloseTableRowElement>());
1005 }
1006
1007 void libabw::ABWOutputElements::addCloseTextBox()
1008 {
1009 if (m_elements)
1010 m_elements->push_back(make_unique<ABWCloseTextBoxElement>());
1011 }
1012
1013 void libabw::ABWOutputElements::addCloseUnorderedListLevel()
1014 {
1015 if (m_elements)
1016 m_elements->push_back(make_unique<ABWCloseUnorderedListLevelElement>());
1017 }
1018
1019 void libabw::ABWOutputElements::addInsertBinaryObject(const librevenge::RVNGPropertyList &propList)
1020 {
1021 if (m_elements)
1022 m_elements->push_back(make_unique<ABWInsertBinaryObjectElement>(propList));
1023 }
1024
1025 void libabw::ABWOutputElements::addInsertField(const librevenge::RVNGPropertyList &propList)
1026 {
1027 if (m_elements)
1028 m_elements->push_back(make_unique<ABWInsertFieldElement>(propList));
1029 }
1030
1031 void libabw::ABWOutputElements::addInsertCoveredTableCell(const librevenge::RVNGPropertyList &propList)
1032 {
1033 if (m_elements)
1034 m_elements->push_back(make_unique<ABWInsertCoveredTableCellElement>(propList));
1035 }
1036
1037 void libabw::ABWOutputElements::addInsertLineBreak()
1038 {
1039 if (m_elements)
1040 m_elements->push_back(make_unique<ABWInsertLineBreakElement>());
1041 }
1042
1043 void libabw::ABWOutputElements::addInsertSpace()
1044 {
1045 if (m_elements)
1046 m_elements->push_back(make_unique<ABWInsertSpaceElement>());
1047 }
1048
1049 void libabw::ABWOutputElements::addInsertTab()
1050 {
1051 if (m_elements)
1052 m_elements->push_back(make_unique<ABWInsertTabElement>());
1053 }
1054
1055 void libabw::ABWOutputElements::addInsertText(const librevenge::RVNGString &text)
1056 {
1057 if (m_elements)
1058 m_elements->push_back(make_unique<ABWInsertTextElement>(text));
1059 }
1060
1061 void libabw::ABWOutputElements::addOpenEndnote(const librevenge::RVNGPropertyList &propList)
1062 {
1063 if (m_elements)
1064 m_elements->push_back(make_unique<ABWOpenEndnoteElement>(propList));
1065 }
1066
1067 void libabw::ABWOutputElements::addOpenFooter(const librevenge::RVNGPropertyList &propList, int id)
1068 {
1069 // if the corresponding element of the map does not exist, this will default-construct it.
1070 // In that case we will get an empty list to fill with the footer content. If the element
1071 // already exists, this might be a footer with different occurrence and we will add it to
1072 // the existing one.
1073 m_elements = &m_footerElements[id];
1074 if (m_elements)
1075 m_elements->push_back(make_unique<ABWOpenFooterElement>(propList));
1076 }
1077
1078 void libabw::ABWOutputElements::addOpenFootnote(const librevenge::RVNGPropertyList &propList)
1079 {
1080 if (m_elements)
1081 m_elements->push_back(make_unique<ABWOpenFootnoteElement>(propList));
1082 }
1083
1084 void libabw::ABWOutputElements::addOpenFrame(const librevenge::RVNGPropertyList &propList)
1085 {
1086 if (m_elements)
1087 m_elements->push_back(make_unique<ABWOpenFrameElement>(propList));
1088 }
1089
1090 void libabw::ABWOutputElements::addOpenHeader(const librevenge::RVNGPropertyList &propList, int id)
1091 {
1092 // Check the comment in addOpenFooter to see what happens here
1093 m_elements = &m_headerElements[id];
1094 if (m_elements)
1095 m_elements->push_back(make_unique<ABWOpenHeaderElement>(propList));
1096 }
1097
1098 void libabw::ABWOutputElements::addOpenListElement(const librevenge::RVNGPropertyList &propList)
1099 {
1100 if (m_elements)
1101 m_elements->push_back(make_unique<ABWOpenListElementElement>(propList));
1102 }
1103
1104 void libabw::ABWOutputElements::addOpenLink(const librevenge::RVNGPropertyList &propList)
1105 {
1106 if (m_elements)
1107 m_elements->push_back(make_unique<ABWOpenLinkElement>(propList));
1108 }
1109
1110 void libabw::ABWOutputElements::addOpenOrderedListLevel(const librevenge::RVNGPropertyList &propList)
1111 {
1112 if (m_elements)
1113 m_elements->push_back(make_unique<ABWOpenOrderedListLevelElement>(propList));
1114 }
1115
1116 void libabw::ABWOutputElements::addOpenPageSpan(const librevenge::RVNGPropertyList &propList,
1117 int footer, int footerLeft, int footerFirst, int footerLast,
1118 int header, int headerLeft, int headerFirst, int headerLast)
1119 {
1120 if (m_elements)
1121 m_elements->push_back(make_unique<ABWOpenPageSpanElement>(propList, footer, footerLeft, footerFirst, footerLast,
1122 header, headerLeft, headerFirst, headerLast));
1123 }
1124
1125 void libabw::ABWOutputElements::addOpenParagraph(const librevenge::RVNGPropertyList &propList)
1126 {
1127 if (m_elements)
1128 m_elements->push_back(make_unique<ABWOpenParagraphElement>(propList));
1129 }
1130
1131 void libabw::ABWOutputElements::addOpenSection(const librevenge::RVNGPropertyList &propList)
1132 {
1133 if (m_elements)
1134 m_elements->push_back(make_unique<ABWOpenSectionElement>(propList));
1135 }
1136
1137 void libabw::ABWOutputElements::addOpenSpan(const librevenge::RVNGPropertyList &propList)
1138 {
1139 if (m_elements)
1140 m_elements->push_back(make_unique<ABWOpenSpanElement>(propList));
1141 }
1142
1143 void libabw::ABWOutputElements::addOpenTable(const librevenge::RVNGPropertyList &propList)
1144 {
1145 if (m_elements)
1146 m_elements->push_back(make_unique<ABWOpenTableElement>(propList));
1147 }
1148
1149 void libabw::ABWOutputElements::addOpenTableCell(const librevenge::RVNGPropertyList &propList)
1150 {
1151 if (m_elements)
1152 m_elements->push_back(make_unique<ABWOpenTableCellElement>(propList));
1153 }
1154
1155 void libabw::ABWOutputElements::addOpenTableRow(const librevenge::RVNGPropertyList &propList)
1156 {
1157 if (m_elements)
1158 m_elements->push_back(make_unique<ABWOpenTableRowElement>(propList));
1159 }
1160
1161 void libabw::ABWOutputElements::addOpenTextBox(const librevenge::RVNGPropertyList &propList)
1162 {
1163 if (m_elements)
1164 m_elements->push_back(make_unique<ABWOpenTextBoxElement>(propList));
1165 }
1166
1167 void libabw::ABWOutputElements::addOpenUnorderedListLevel(const librevenge::RVNGPropertyList &propList)
1168 {
1169 if (m_elements)
1170 m_elements->push_back(make_unique<ABWOpenUnorderedListLevelElement>(propList));
1171 }
1172
1173 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */