- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
18 namespace pdftron { namespace Layout {
19
20 class Paragraph;
21 class ContentNode;
22 class TextRun;
23 class Table;
24 class TableRow;
25 class TableCell;
26 class ContentGroup;
27 class FlowDocument;
28 class List;
29 class ListItem;
30
38 template <typename T>
39 class ElementRef
40 {
41 friend class ContentElement;
42
46 template <typename TImpl>
47 ElementRef(TImpl impl);
48
49 public:
53 ElementRef();
54
62 T& GetElement();
63
69 bool IsValid();
70
74 operator void*();
75
82 T* operator->();
83
90 T& operator*();
91
92 private:
93 T m_element;
94 };
95
100 class 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
112 public:
113
119 void SetFontFace(const UString& font_name);
120
126 UString GetFontFace();
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
200 class ContentElement
201 {
202 protected:
206 ContentElement(TRN_ContentElement impl);
207
208 public:
209 ~ContentElement();
210 void Destroy();
211
219 ElementRef<List> AsList() const;
220
228 ElementRef<ListItem> AsListItem() const;
229
237 ElementRef<ContentNode> AsContentNode() const;
238
246 ElementRef<TextRun> AsTextRun() const;
247
255 ElementRef<Paragraph> AsParagraph() const;
256
264 ElementRef<Table> AsTable() const;
265
273 ElementRef<TableRow> AsTableRow() const;
274
282 ElementRef<TableCell> AsTableCell() const;
283
290 TextStyledElement GetTextStyledElement();
291
292 #ifndef SWIGHIDDEN
293 TRN_ContentElement m_impl;
294 #endif
295 };
296
301 class TextRun : public ContentElement
302 {
303 friend class Paragraph;
304 friend class ElementRef<TextRun>;
305
309 TextRun(TRN_TextRun impl);
310
311 public:
312 ~TextRun();
313 void Destroy();
314
320 void SetText(const UString& text);
321
327 UString GetText();
328 };
329
334 typedef Common::Iterator<ContentElement> ContentNodeIterator;
335
340 class ContentNode : public ContentElement
341 {
342 friend class FlowDocument;
343 friend class ElementRef<TableCell>;
344 friend class ElementRef<ContentNode>;
345
346 protected:
350 ContentNode(TRN_ContentNode impl);
351
352 public:
353 ~ContentNode();
354 void Destroy();
355
365 ContentNodeIterator GetContentNodeIterator();
366 };
367
371 class 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
380 public:
381 enum TextJustification
382 {
386 e_text_justification_invalid = 0,
390 e_text_justify_left = 1,
394 e_text_justify_right = 2,
398 e_text_justify_center = 3
399 };
400
401 ~Paragraph();
402 void Destroy();
403
410 TextRun AddText(const UString& text);
411
417 void SetSpaceBefore(double val);
418
424 double GetSpaceBefore();
425
431 void SetSpaceAfter(double val);
432
438 double GetSpaceAfter();
439
445 void SetJustificationMode(TextJustification val);
446
452 TextJustification GetJustificationMode();
453
459 void SetStartIndent(double val);
460
466 double GetStartIndent();
467
473 void SetEndIndent(double val);
474
480 double GetEndIndent();
481
487 void SetTextIndent(double val);
488
494 double GetTextIndent();
495
504 void SetBorder(double thickness, UInt8 red, UInt8 green, UInt8 blue);
505
511 double GetBorderThickness();
512
518 void AddTabStop(double val);
519
526 double GetNextTabStop(double val);
527
533 void SetDefaultTabStop(double val);
534
540 double GetDefaultTabStop();
541
547 void SetSpacesPerTab(UInt32 val);
548
554 UInt32 GetSpacesPerTab();
555
561 void SetDisplayRtl(bool val);
562
568 bool IsDisplayRtl();
569 };
570
571
575 class TableCell : public ContentNode
576 {
577 friend class Table;
578 friend class TableRow;
579 friend class ElementRef<TableCell>;
580
584 TableCell(TRN_TableCell impl);
585
586 public:
587 enum CellAlignmentVertical
588 {
592 e_alignment_top = 1,
596 e_alignment_center = 2,
600 e_alignment_bottom = 3,
601 };
602
603 enum CellAlignmentHorizontal
604 {
608 e_alignment_left = 1,
612 e_alignment_middle = 2,
616 e_alignment_right = 3,
617 };
618
619 ~TableCell();
620 void Destroy();
621
627 Paragraph AddParagraph();
628
634 Paragraph AddParagraph(const UString& text);
635
641 Table AddTable();
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
681 double GetBorderThickness();
682
688 void SetVerticalAlignment(CellAlignmentVertical val);
689
695 CellAlignmentVertical GetVerticalAlignment();
696
702 void SetHorizontalAlignment(CellAlignmentHorizontal val);
703
709 CellAlignmentHorizontal GetHorizontalAlignment();
710
716 void SetHeight(double val);
717
723 double GetHeight();
724
730 void SetWidth(double val);
731
737 double GetWidth();
738 };
739
743 class TableRow : public ContentNode
744 {
745 friend class Table;
746 friend class ElementRef<TableRow>;
747
751 TableRow(TRN_TableRow impl);
752
753 public:
754 ~TableRow();
755 void Destroy();
756
762 TableCell AddTableCell();
763
769 void SetRowHeight(double val);
770
779 UInt32 GetNumColumns();
780 };
781
785 class Table : public ContentNode
786 {
787 friend class FlowDocument;
788 friend class ElementRef<Table>;
789 friend class TableCell;
790
794 Table(TRN_Table impl);
795
796 public:
797 ~Table();
798 void Destroy();
799
805 TableRow AddTableRow();
806
815 TableCell GetTableCell(UInt32 column, UInt32 row);
816
822 void SetDefaultColumnWidth(double val);
823
829 double GetDefaultRowHeight();
830
836 void SetDefaultRowHeight(double val);
837
846 void SetBorder(double thickness, UInt8 red, UInt8 green, UInt8 blue);
847
853 double GetBorderThickness();
854
860 UInt32 GetNumRows();
861
867 UInt32 GetNumColumns();
868 };
869
873 class 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
884 public:
885 enum NumberFormat
886 {
887 e_none = 0,
888 e_decimal,
889 e_lower_roman,
890 e_upper_roman,
891 e_lower_letter,
892 e_upper_letter,
893 e_ordinal,
894 e_ordinal_text,
895 e_chinese_counting,
896 e_chinese_counting_thousand,
897 e_cardinal_text,
898 e_decimal_zero,
899 };
900
901 ~List();
902
908 void SetNumberFormat(const NumberFormat format);
909
917 void SetNumberFormat(const NumberFormat format, const UString& suffix, bool cascade);
918
924 TextStyledElement GetLabelStyle();
925
931 void SetStartIndex(int idx);
932
938 ListItem AddItem();
939
951 void ContinueList();
952
958 int GetIndentationLevel();
959
965 int GetListIdentifier();
966
967 #ifndef SWIGHIDDEN
968 TRN_List m_impl;
969 #endif
970 };
971
975 class 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
984 public:
985 ~ListItem();
986
992 Paragraph AddParagraph();
993
1000 Paragraph AddParagraph(const UString& text);
1001
1007 List AddList();
1008
1014 int GetIndentationLevel();
1015
1021 int GetListIdentifier();
1022
1028 int GetItemIndex();
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
pdftron::Layout::TextStyledElement::SetFontFace
void SetFontFace(const UString &font_name)
pdftron::Layout::TableCell::e_alignment_center
Definition: ContentTree.h:596
pdftron::Layout::Paragraph::SetDisplayRtl
void SetDisplayRtl(bool val)
pdftron::Layout::List::AddItem
ListItem AddItem()
pdftron::Layout::Paragraph::GetEndIndent
double GetEndIndent()
pdftron::Layout::List::e_upper_roman
Definition: ContentTree.h:890
pdftron::Layout::Table::AddTableRow
TableRow AddTableRow()
pdftron::Layout::TableCell::GetVerticalAlignment
CellAlignmentVertical GetVerticalAlignment()
pdftron::Layout::List::e_chinese_counting_thousand
Definition: ContentTree.h:896
pdftron::Layout::Paragraph::GetSpaceBefore
double GetSpaceBefore()
pdftron::Layout::Table::GetDefaultRowHeight
double GetDefaultRowHeight()
pdftron::Layout::TableCell::SetHorizontalAlignment
void SetHorizontalAlignment(CellAlignmentHorizontal val)
pdftron::Layout::TextStyledElement::IsBold
bool IsBold()
pdftron::Layout::ElementRef::GetElement
T & GetElement()
pdftron::Layout::ElementRef
Definition: ContentTree.h:39
pdftron::Layout::ListItem::AddList
List AddList()
pdftron::Layout::TableCell::Destroy
void Destroy()
pdftron::Layout::TextStyledElement::GetFontFace
UString GetFontFace()
pdftron::Layout::Paragraph::SetEndIndent
void SetEndIndent(double val)
pdftron::Layout::Paragraph::e_text_justify_right
Definition: ContentTree.h:394
pdftron::Layout::Table::SetDefaultColumnWidth
void SetDefaultColumnWidth(double val)
pdftron::Layout::Paragraph::GetTextIndent
double GetTextIndent()
pdftron::Layout::TableCell::SetWidth
void SetWidth(double val)
pdftron::Layout::ContentElement::GetTextStyledElement
TextStyledElement GetTextStyledElement()
pdftron::Layout::Paragraph::e_text_justify_center
Definition: ContentTree.h:398
pdftron::Layout::List::e_chinese_counting
Definition: ContentTree.h:895
pdftron::Layout::Paragraph::GetSpaceAfter
double GetSpaceAfter()
pdftron::Layout::TableRow::AddTableCell
TableCell AddTableCell()
pdftron::Layout::ContentNode::Destroy
void Destroy()
pdftron::Layout::ElementRef::operator*
T & operator*()
pdftron::Layout::ContentNode::GetContentNodeIterator
ContentNodeIterator GetContentNodeIterator()
pdftron::Layout::Paragraph::SetJustificationMode
void SetJustificationMode(TextJustification val)
pdftron::Layout::ListItem::~ListItem
~ListItem()
pdftron::Layout::Table::SetDefaultRowHeight
void SetDefaultRowHeight(double val)
pdftron::Layout::ListItem::GetItemIndex
int GetItemIndex()
pdftron::Layout::ContentNodeIterator
Common::Iterator< ContentElement > ContentNodeIterator
Definition: ContentTree.h:334
pdftron::Layout::Table::Destroy
void Destroy()
pdftron::Layout::TableCell::GetWidth
double GetWidth()
pdftron::Layout::ElementRef::ElementRef
ElementRef()
UString.h
pdftron::Layout::List::e_decimal
Definition: ContentTree.h:888
pdftron::Layout::TableCell::SetVerticalAlignment
void SetVerticalAlignment(CellAlignmentVertical val)
pdftron::Layout::ElementRef::IsValid
bool IsValid()
pdftron::Layout::Table::~Table
~Table()
pdftron::UInt8
TRN_UInt8 UInt8
Definition: BasicTypes.h:15
pdftron::Layout::TableCell::SetHeight
void SetHeight(double val)
pdftron::Layout::TextRun::~TextRun
~TextRun()
pdftron::Layout::List::m_impl
TRN_List m_impl
Definition: ContentTree.h:968
pdftron::Layout::List::ContinueList
void ContinueList()
pdftron::Layout::ContentElement::AsTableRow
ElementRef< TableRow > AsTableRow() const
pdftron::Layout::TextRun::SetText
void SetText(const UString &text)
pdftron::Layout::TableCell::AddTable
Table AddTable()
pdftron::Layout::ContentElement::AsListItem
ElementRef< ListItem > AsListItem() const
pdftron::Layout::Table::GetNumRows
UInt32 GetNumRows()
pdftron::Layout::List
Definition: ContentTree.h:873
pdftron::Layout::TableCell::e_alignment_bottom
Definition: ContentTree.h:600
pdftron::Layout::TextStyledElement::SetBackgroundColor
void SetBackgroundColor(UInt8 red, UInt8 green, UInt8 blue)
pdftron::Layout::List::SetNumberFormat
void SetNumberFormat(const NumberFormat format)
pdftron::Layout::ContentElement::AsTextRun
ElementRef< TextRun > AsTextRun() const
pdftron::Layout::TableCell::MergeCellsRight
TableCell MergeCellsRight(UInt32 num)
pdftron::Layout::TableCell::e_alignment_left
Definition: ContentTree.h:608
pdftron::Layout::TableCell::CellAlignmentHorizontal
CellAlignmentHorizontal
Definition: ContentTree.h:603
pdftron::Layout::List::e_ordinal
Definition: ContentTree.h:893
pdftron::Layout::TableCell::GetHeight
double GetHeight()
pdftron::Layout::TableRow::~TableRow
~TableRow()
pdftron::Layout::ListItem::GetIndentationLevel
int GetIndentationLevel()
pdftron::Layout::Table::GetTableCell
TableCell GetTableCell(UInt32 column, UInt32 row)
pdftron::Layout::ContentElement
Definition: ContentTree.h:200
pdftron::Layout::TableCell::GetBorderThickness
double GetBorderThickness()
pdftron::Layout::ListItem::AddParagraph
Paragraph AddParagraph()
pdftron::Layout::TableCell::e_alignment_top
Definition: ContentTree.h:592
pdftron::Layout::Paragraph::GetDefaultTabStop
double GetDefaultTabStop()
pdftron::Layout::Paragraph::SetStartIndent
void SetStartIndent(double val)
pdftron::Layout::ElementRef::operator->
T * operator->()
pdftron::Layout::FlowDocument
Definition: FlowDocument.h:17
pdftron::Layout::List::GetLabelStyle
TextStyledElement GetLabelStyle()
pdftron::Layout::Paragraph::Destroy
void Destroy()
pdftron::Layout::ContentNode
Definition: ContentTree.h:340
pdftron::UInt32
TRN_UInt32 UInt32
Definition: BasicTypes.h:13
pdftron::Layout::TableRow::Destroy
void Destroy()
pdftron::Layout::Table::GetNumColumns
UInt32 GetNumColumns()
pdftron::Layout::List::e_lower_roman
Definition: ContentTree.h:889
pdftron::Layout::ContentElement::AsParagraph
ElementRef< Paragraph > AsParagraph() const
pdftron::Layout::TableCell::MergeCellsDown
TableCell MergeCellsDown(UInt32 num)
pdftron::Layout::List::GetListIdentifier
int GetListIdentifier()
pdftron::Layout::List::e_ordinal_text
Definition: ContentTree.h:894
pdftron::Layout::List::e_none
Definition: ContentTree.h:887
pdftron::Layout::ListItem::GetListIdentifier
int GetListIdentifier()
pdftron::Layout::TextStyledElement::SetTextColor
void SetTextColor(UInt8 red, UInt8 green, UInt8 blue)
pdftron::Layout::ContentNode::ContentNode
ContentNode(TRN_ContentNode impl)
pdftron::Layout::ContentNode::~ContentNode
~ContentNode()
pdftron::Layout::TableRow::GetNumColumns
UInt32 GetNumColumns()
pdftron::Layout::Paragraph::AddText
TextRun AddText(const UString &text)
pdftron::Layout::ContentElement::m_impl
TRN_ContentElement m_impl
Definition: ContentTree.h:293
pdftron::Layout::Paragraph::GetStartIndent
double GetStartIndent()
pdftron::Layout::Paragraph::GetBorderThickness
double GetBorderThickness()
pdftron::Layout::TableCell::SetBackgroundColor
void SetBackgroundColor(UInt8 red, UInt8 green, UInt8 blue)
pdftron::Layout::Paragraph::SetSpacesPerTab
void SetSpacesPerTab(UInt32 val)
pdftron::Layout::List::~List
~List()
pdftron::Layout::Paragraph::~Paragraph
~Paragraph()
pdftron::Layout::TextStyledElement::SetItalic
void SetItalic(bool val)
pdftron::Layout::TableCell::AddParagraph
Paragraph AddParagraph()
pdftron::Layout::Paragraph::TextJustification
TextJustification
Definition: ContentTree.h:381
pdftron::Layout::Paragraph::SetSpaceBefore
void SetSpaceBefore(double val)
pdftron::Layout::List::GetIndentationLevel
int GetIndentationLevel()
BasicTypes.h
pdftron::Layout::ContentElement::AsContentNode
ElementRef< ContentNode > AsContentNode() const
pdftron::Layout::TableCell::SetBorder
void SetBorder(double thickness, UInt8 red, UInt8 green, UInt8 blue)
pdftron::Layout::TextStyledElement::m_impl
TRN_TextStyledElement m_impl
Definition: ContentTree.h:189
pdftron::Common::Iterator
Definition: Iterator.h:20
pdftron::Layout::TableCell::~TableCell
~TableCell()
pdftron::Layout::ContentElement::Destroy
void Destroy()
pdftron::Layout::Paragraph
Definition: ContentTree.h:371
pdftron::Layout::Paragraph::GetJustificationMode
TextJustification GetJustificationMode()
pdftron::Layout::TextRun::GetText
UString GetText()
pdftron::Layout::ListItem
Definition: ContentTree.h:975
pdftron::Layout::Table::GetBorderThickness
double GetBorderThickness()
pdftron::Layout::TextStyledElement
Definition: ContentTree.h:100
pdftron::Layout::TextStyledElement::SetBold
void SetBold(bool val)
pdftron::Layout::ContentElement::AsList
ElementRef< List > AsList() const
pdftron::Layout::Paragraph::e_text_justify_left
Definition: ContentTree.h:390
pdftron::Layout::Paragraph::AddTabStop
void AddTabStop(double val)
pdftron::Layout::TextStyledElement::SetFontSize
void SetFontSize(double font_size)
pdftron::Layout::List::e_upper_letter
Definition: ContentTree.h:892
pdftron::Layout::Paragraph::IsDisplayRtl
bool IsDisplayRtl()
pdftron::Layout::Paragraph::SetBorder
void SetBorder(double thickness, UInt8 red, UInt8 green, UInt8 blue)
pdftron::Layout::Paragraph::GetSpacesPerTab
UInt32 GetSpacesPerTab()
pdftron::Layout::List::SetStartIndex
void SetStartIndex(int idx)
pdftron::Layout::ContentElement::~ContentElement
~ContentElement()
pdftron::Layout::ContentElement::AsTable
ElementRef< Table > AsTable() const
pdftron::Layout::TableCell::e_alignment_middle
Definition: ContentTree.h:612
pdftron::Layout::TableCell
Definition: ContentTree.h:575
pdftron::Layout::List::NumberFormat
NumberFormat
Definition: ContentTree.h:885
pdftron::Layout::Paragraph::SetTextIndent
void SetTextIndent(double val)
pdftron::Layout::List::e_lower_letter
Definition: ContentTree.h:891
pdftron::Layout::TableCell::GetHorizontalAlignment
CellAlignmentHorizontal GetHorizontalAlignment()
pdftron::Layout::ContentElement::ContentElement
ContentElement(TRN_ContentElement impl)
pdftron::Layout::Paragraph::SetSpaceAfter
void SetSpaceAfter(double val)
pdftron::Layout::TextRun
Definition: ContentTree.h:301
pdftron::Layout::List::e_cardinal_text
Definition: ContentTree.h:897
pdftron::Layout::TableCell::e_alignment_right
Definition: ContentTree.h:616
pdftron::Layout::Table::SetBorder
void SetBorder(double thickness, UInt8 red, UInt8 green, UInt8 blue)
pdftron::Layout::TableCell::CellAlignmentVertical
CellAlignmentVertical
Definition: ContentTree.h:587
pdftron::Layout::ContentElement::AsTableCell
ElementRef< TableCell > AsTableCell() const
pdftron::Layout::TextRun::Destroy
void Destroy()
pdftron::Layout::Paragraph::GetNextTabStop
double GetNextTabStop(double val)
pdftron::Layout::Paragraph::SetDefaultTabStop
void SetDefaultTabStop(double val)
pdftron::UString
Definition: UString.h:27
pdftron::Layout::Table
Definition: ContentTree.h:785
pdftron::Layout::ListItem::m_impl
TRN_ListItem m_impl
Definition: ContentTree.h:1031
pdftron::Layout::Paragraph::e_text_justification_invalid
Definition: ContentTree.h:386
pdftron::Layout::TextStyledElement::GetFontSize
double GetFontSize()
pdftron::Layout::TableRow
Definition: ContentTree.h:743
pdftron::Layout::TextStyledElement::IsItalic
bool IsItalic()
pdftron::Layout::List::e_decimal_zero
Definition: ContentTree.h:898
pdftron::Layout::TableRow::SetRowHeight
void SetRowHeight(double val)