Loading...
Searching...
No Matches
ContentTree.h
Go to the documentation of this file.
1#ifndef PDFTRON_H_CPPContentTree
2#define PDFTRON_H_CPPContentTree
3
4#include <C/Layout/TRN_ContentElement.h>
5#include <C/Layout/TRN_ContentNode.h>
6#include <C/Layout/TRN_Paragraph.h>
7#include <C/Layout/TRN_Table.h>
8#include <C/Layout/TRN_TableRow.h>
9#include <C/Layout/TRN_TableCell.h>
10#include <C/Layout/TRN_TextRun.h>
11#include <C/Layout/TRN_TextStyledElement.h>
12#include <C/Layout/TRN_List.h>
13#include <C/Layout/TRN_ListItem.h>
14
15#include <Common/BasicTypes.h>
16#include <Common/UString.h>
17
18namespace pdftron { namespace Layout {
19
20class Paragraph;
21class ContentNode;
22class TextRun;
23class Table;
24class TableRow;
25class TableCell;
26class ContentGroup;
27class FlowDocument;
28class List;
29class ListItem;
30
38template <typename T>
39class ElementRef
40{
41 friend class ContentElement;
42
46 template <typename TImpl>
47 ElementRef(TImpl impl);
48
49public:
54
63
69 bool IsValid();
70
74 operator void*();
75
83
91
92private:
93 T m_element;
94};
95
100class TextStyledElement
101{
102 friend class ContentNode;
103 friend class TextRun;
104 friend class List;
105 friend class ContentElement;
106
110 TextStyledElement(TRN_TextStyledElement impl);
111
112public:
113
119 void SetFontFace(const UString& font_name);
120
127
133 void SetFontSize(double font_size);
134
140 double GetFontSize();
141
147 void SetItalic(bool val);
148
154 bool IsItalic();
155
161 void SetBold(bool val);
162
168 bool IsBold();
169
177 void SetTextColor(UInt8 red, UInt8 green, UInt8 blue);
178
186 void SetBackgroundColor(UInt8 red, UInt8 green, UInt8 blue);
187
188#ifndef SWIGHIDDEN
189 TRN_TextStyledElement m_impl;
190#endif
191};
192
201{
202protected:
206 ContentElement(TRN_ContentElement impl);
207
208public:
210 void Destroy();
211
220
229
238
247
256
265
274
283
291
292#ifndef SWIGHIDDEN
293 TRN_ContentElement m_impl;
294#endif
295};
296
301class TextRun : public ContentElement
302{
303 friend class Paragraph;
304 friend class ElementRef<TextRun>;
305
309 TextRun(TRN_TextRun impl);
310
311public:
313 void Destroy();
314
320 void SetText(const UString& text);
321
328};
329
335
341{
342 friend class FlowDocument;
343 friend class ElementRef<TableCell>;
344 friend class ElementRef<ContentNode>;
345
346protected:
350 ContentNode(TRN_ContentNode impl);
351
352public:
354 void Destroy();
355
366};
367
371class Paragraph : public ContentNode
372{
373 friend class FlowDocument;
374 friend class ListItem;
375 friend class ElementRef<Paragraph>;
376 friend class TableCell;
377
378 Paragraph(TRN_Paragraph impl);
379
380public:
400
402 void Destroy();
403
410 TextRun AddText(const UString& text);
411
417 void SetSpaceBefore(double val);
418
425
431 void SetSpaceAfter(double val);
432
439
446
453
459 void SetStartIndent(double val);
460
467
473 void SetEndIndent(double val);
474
480 double GetEndIndent();
481
487 void SetTextIndent(double val);
488
495
504 void SetBorder(double thickness, UInt8 red, UInt8 green, UInt8 blue);
505
512
518 void AddTabStop(double val);
519
526 double GetNextTabStop(double val);
527
533 void SetDefaultTabStop(double val);
534
541
548
555
561 void SetDisplayRtl(bool val);
562
569};
570
571
575class TableCell : public ContentNode
576{
577 friend class Table;
578 friend class TableRow;
579 friend class ElementRef<TableCell>;
580
584 TableCell(TRN_TableCell impl);
585
586public:
602
618
620 void Destroy();
621
628
635
642
648 TableCell MergeCellsRight(UInt32 num);
649
655 TableCell MergeCellsDown(UInt32 num);
656
664 void SetBackgroundColor(UInt8 red, UInt8 green, UInt8 blue);
665
674 void SetBorder(double thickness, UInt8 red, UInt8 green, UInt8 blue);
675
682
689
696
703
710
716 void SetHeight(double val);
717
723 double GetHeight();
724
730 void SetWidth(double val);
731
737 double GetWidth();
738};
739
743class TableRow : public ContentNode
744{
745 friend class Table;
746 friend class ElementRef<TableRow>;
747
751 TableRow(TRN_TableRow impl);
752
753public:
755 void Destroy();
756
763
769 void SetRowHeight(double val);
770
780};
781
785class Table : public ContentNode
786{
787 friend class FlowDocument;
788 friend class ElementRef<Table>;
789 friend class TableCell;
790
794 Table(TRN_Table impl);
795
796public:
798 void Destroy();
799
806
816
822 void SetDefaultColumnWidth(double val);
823
830
836 void SetDefaultRowHeight(double val);
837
846 void SetBorder(double thickness, UInt8 red, UInt8 green, UInt8 blue);
847
854
861
868};
869
873class List : public ContentNode
874{
875 friend class FlowDocument;
876 friend class TableCell;
877 friend class ListItem;
878 friend class ElementRef<List>;
879
880 List(TRN_List impl);
881 void Destroy();
882 void UpdateLastItemRef(TRN_ContentElement last_item);
883
884public:
900
902
908 void SetNumberFormat(const NumberFormat format);
909
917 void SetNumberFormat(const NumberFormat format, const UString& suffix, bool cascade);
918
925
931 void SetStartIndex(int idx);
932
939
952
959
966
967#ifndef SWIGHIDDEN
968 TRN_List m_impl;
969#endif
970};
971
975class ListItem : public ContentNode
976{
977 friend class List;
978 friend class ElementRef<ListItem>;
979
980 ListItem(TRN_ListItem impl);
981 void Destroy();
982 void UpdateLastItemRef(TRN_ContentElement last_item);
983
984public:
986
993
1001
1008
1015
1022
1029
1030#ifndef SWIGHIDDEN
1031 TRN_ListItem m_impl;
1032#endif
1033};
1034
1035#include <Impl/ContentElement.inl>
1036#include <Impl/ContentNode.inl>
1037#include <Impl/ElementRef.inl>
1038#include <Impl/Paragraph.inl>
1039#include <Impl/TextRun.inl>
1040#include <Impl/TextStyledElement.inl>
1041#include <Impl/TableCell.inl>
1042#include <Impl/TableRow.inl>
1043#include <Impl/Table.inl>
1044#include <Impl/ListItem.inl>
1045#include <Impl/List.inl>
1046
1047} //end pdftron
1048} //end Layout
1049
1050#endif // PDFTRON_H_CPPContentTree
ElementRef< Table > AsTable() const
ElementRef< TableRow > AsTableRow() const
TextStyledElement GetTextStyledElement()
ElementRef< ContentNode > AsContentNode() const
ElementRef< ListItem > AsListItem() const
ElementRef< TableCell > AsTableCell() const
ElementRef< List > AsList() const
ElementRef< Paragraph > AsParagraph() const
ElementRef< TextRun > AsTextRun() const
ContentElement(TRN_ContentElement impl)
ContentNodeIterator GetContentNodeIterator()
ContentNode(TRN_ContentNode impl)
void SetNumberFormat(const NumberFormat format, const UString &suffix, bool cascade)
friend class FlowDocument
TextStyledElement GetLabelStyle()
friend class TableCell
friend class ListItem
void SetNumberFormat(const NumberFormat format)
void SetStartIndex(int idx)
Paragraph AddParagraph(const UString &text)
void SetJustificationMode(TextJustification val)
void SetSpaceAfter(double val)
void SetBorder(double thickness, UInt8 red, UInt8 green, UInt8 blue)
void SetSpaceBefore(double val)
void SetEndIndent(double val)
TextJustification GetJustificationMode()
void AddTabStop(double val)
void SetStartIndent(double val)
void SetDisplayRtl(bool val)
void SetTextIndent(double val)
void SetSpacesPerTab(UInt32 val)
void SetDefaultTabStop(double val)
TextRun AddText(const UString &text)
double GetNextTabStop(double val)
void SetBorder(double thickness, UInt8 red, UInt8 green, UInt8 blue)
CellAlignmentVertical GetVerticalAlignment()
TableCell MergeCellsDown(UInt32 num)
CellAlignmentHorizontal GetHorizontalAlignment()
Paragraph AddParagraph(const UString &text)
void SetVerticalAlignment(CellAlignmentVertical val)
void SetBackgroundColor(UInt8 red, UInt8 green, UInt8 blue)
void SetWidth(double val)
void SetHorizontalAlignment(CellAlignmentHorizontal val)
void SetHeight(double val)
TableCell MergeCellsRight(UInt32 num)
friend class FlowDocument
TableCell GetTableCell(UInt32 column, UInt32 row)
void SetDefaultColumnWidth(double val)
void SetDefaultRowHeight(double val)
void SetBorder(double thickness, UInt8 red, UInt8 green, UInt8 blue)
void SetRowHeight(double val)
void SetText(const UString &text)
void SetTextColor(UInt8 red, UInt8 green, UInt8 blue)
void SetFontFace(const UString &font_name)
void SetFontSize(double font_size)
void SetBackgroundColor(UInt8 red, UInt8 green, UInt8 blue)
Common::Iterator< ContentElement > ContentNodeIterator
TRN_UInt32 UInt32
Definition BasicTypes.h:13
TRN_UInt8 UInt8
Definition BasicTypes.h:15