Table.h
1 #pragma once
2 // Copyright (c) 2001-2024 Aspose Pty Ltd. All Rights Reserved.
3 
4 // C# preprocessor directive: #if !NETCORE
5 
6 
7 // C# preprocessor directive: #endif
8 
9 
10 #include <system/enum_helpers.h>
11 #include <system/array.h>
12 
13 #include "Aspose.PDF.Cpp/Generator/BaseParagraph.h"
14 #include "Aspose.PDF.Cpp/aspose_pdf_api_defs.h"
15 
16 namespace Aspose
17 {
18 namespace Pdf
19 {
20 enum class BorderCornerStyle;
21 enum class BorderCornerType;
22 class BorderInfo;
23 class Cell;
24 class Color;
25 enum class ColumnAdjustment;
26 class Document;
27 namespace Drawing
28 {
29 class Graph;
30 } // namespace Drawing
31 class FloatingBox;
32 class FormattedFragment;
33 class GraphInfo;
34 enum class HorizontalAlignment;
35 namespace LogicalStructure
36 {
37 class TableElement;
38 } // namespace LogicalStructure
39 class MarginInfo;
40 class Operator;
41 class Page;
42 class PageGenerator;
43 class Paragraphs;
44 class Point;
45 class Row;
46 class Rows;
47 enum class TableBroken;
48 namespace Tagged
49 {
50 class TaggedContext;
51 } // namespace Tagged
52 namespace Text
53 {
54 class TextFragment;
55 class TextState;
56 } // namespace Text
57 } // namespace Pdf
58 } // namespace Aspose
59 namespace System
60 {
61 namespace Collections
62 {
63 namespace Generic
64 {
65 template <typename> class List;
66 } // namespace Generic
67 } // namespace Collections
68 namespace Globalization
69 {
70 class CultureInfo;
71 } // namespace Globalization
72 namespace Xml
73 {
74 class XmlReader;
75 class XmlTextWriter;
76 } // namespace Xml
77 } // namespace System
78 
79 namespace Aspose {
80 
81 namespace Pdf {
82 
86 class ASPOSE_PDF_SHARED_CLASS Table final : public Aspose::Pdf::BaseParagraph
87 {
88  typedef Table ThisType;
90 
91  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
92  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
93 
97  friend class Aspose::Pdf::Tagged::TaggedContext;
100  friend class Aspose::Pdf::PageGenerator;
101  friend class Aspose::Pdf::Document;
102  friend class Aspose::Pdf::Page;
103  friend class Aspose::Pdf::Cell;
104  friend class Aspose::Pdf::Row;
105 
106 public:
107 
111  ASPOSE_PDF_SHARED_API const System::SharedPtr<Color>& get_BackgroundColor() const;
115  ASPOSE_PDF_SHARED_API void set_BackgroundColor(System::SharedPtr<Color> value);
119  ASPOSE_PDF_SHARED_API const System::SharedPtr<Text::TextFragment>& get_BreakText() const;
123  ASPOSE_PDF_SHARED_API void set_BreakText(System::SharedPtr<Text::TextFragment> value);
127  ASPOSE_PDF_SHARED_API BorderCornerStyle get_CornerStyle() const;
131  ASPOSE_PDF_SHARED_API void set_CornerStyle(BorderCornerStyle value);
135  ASPOSE_PDF_SHARED_API const System::SharedPtr<Text::TextState>& get_RepeatingRowsStyle() const;
139  ASPOSE_PDF_SHARED_API void set_RepeatingRowsStyle(System::SharedPtr<Text::TextState> value);
143  ASPOSE_PDF_SHARED_API int32_t get_RepeatingColumnsCount() const;
147  ASPOSE_PDF_SHARED_API void set_RepeatingColumnsCount(int32_t value);
151  ASPOSE_PDF_SHARED_API int32_t get_RepeatingRowsCount() const;
155  ASPOSE_PDF_SHARED_API void set_RepeatingRowsCount(int32_t value);
159  ASPOSE_PDF_SHARED_API System::String get_ColumnWidths() const;
163  ASPOSE_PDF_SHARED_API void set_ColumnWidths(System::String value);
167  ASPOSE_PDF_SHARED_API TableBroken get_Broken() const;
171  ASPOSE_PDF_SHARED_API void set_Broken(TableBroken value);
175  ASPOSE_PDF_SHARED_API const System::SharedPtr<BorderInfo>& get_DefaultCellBorder() const;
179  ASPOSE_PDF_SHARED_API void set_DefaultCellBorder(System::SharedPtr<BorderInfo> value);
183  ASPOSE_PDF_SHARED_API System::String get_DefaultColumnWidth() const;
187  ASPOSE_PDF_SHARED_API void set_DefaultColumnWidth(System::String value);
191  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::Rows> get_Rows() const;
195  ASPOSE_PDF_SHARED_API const System::SharedPtr<BorderInfo>& get_Border() const;
199  ASPOSE_PDF_SHARED_API void set_Border(System::SharedPtr<BorderInfo> value);
203  ASPOSE_PDF_SHARED_API const System::SharedPtr<MarginInfo>& get_DefaultCellPadding() const;
207  ASPOSE_PDF_SHARED_API void set_DefaultCellPadding(System::SharedPtr<MarginInfo> value);
215  ASPOSE_PDF_SHARED_API void set_DefaultCellTextState(System::SharedPtr<Text::TextState> value);
219  ASPOSE_PDF_SHARED_API Aspose::Pdf::HorizontalAlignment get_Alignment() const;
223  ASPOSE_PDF_SHARED_API void set_Alignment(Aspose::Pdf::HorizontalAlignment value);
227  ASPOSE_PDF_SHARED_API float get_Left() const;
231  ASPOSE_PDF_SHARED_API void set_Left(float value);
235  ASPOSE_PDF_SHARED_API float get_Top() const;
239  ASPOSE_PDF_SHARED_API void set_Top(float value);
243  ASPOSE_PDF_SHARED_API bool get_IsBroken() const;
247  ASPOSE_PDF_SHARED_API void set_IsBroken(bool value);
251  ASPOSE_PDF_SHARED_API bool get_IsBordersIncluded() const;
255  ASPOSE_PDF_SHARED_API void set_IsBordersIncluded(bool value);
259  ASPOSE_PDF_SHARED_API Aspose::Pdf::ColumnAdjustment get_ColumnAdjustment() const;
263  ASPOSE_PDF_SHARED_API void set_ColumnAdjustment(Aspose::Pdf::ColumnAdjustment value);
264 
268  ASPOSE_PDF_SHARED_API Table();
269 
274  ASPOSE_PDF_SHARED_API double GetWidth();
280  ASPOSE_PDF_SHARED_API double GetHeight(System::SharedPtr<Page> parentPage = nullptr);
286  ASPOSE_PDF_SHARED_API void SetColumnTextState(int32_t colNumber, System::SharedPtr<Text::TextState> textState);
291  ASPOSE_PDF_SHARED_API System::SharedPtr<System::Object> Clone() override;
292 
293 protected:
294 
298  int32_t get_MaxCellsCount() const;
302  int32_t get_PrintedRowsCount() const;
306  const System::ArrayPtr<double>& get_InternalColumnWidths() const;
310  void set_InternalColumnWidths(System::ArrayPtr<double> value);
314  int32_t get_ColsCount();
318  bool get_IsProcessSpecialSymbols() const;
322  const System::ArrayPtr<System::SharedPtr<Text::TextState>>& get_ColumnTextStates() const;
326  double get_TablesTopMargin();
330  const System::SharedPtr<Table>& get_ParentTable() const;
334  void set_ParentTable(System::SharedPtr<Table> value);
338  System::String get_McName() const;
342  void set_McName(System::String value);
346  int32_t get_McId() const;
350  void set_McId(int32_t value);
351  double get_RepeatingRowsHeight();
352 
356  static double GetBorderHeight(System::SharedPtr<BorderInfo> border);
360  static double GetBorderWidth(System::SharedPtr<BorderInfo> border);
365  double GetColumnWidth(int32_t index);
387  static double GetLineWidth(System::SharedPtr<GraphInfo> info);
392  static double GetLineSingleWidth(System::SharedPtr<GraphInfo> info);
393  static void DrawDoubleBorder(System::SharedPtr<BorderInfo> border, System::SharedPtr<Point> leftTop, System::SharedPtr<Point> rightBottom, System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<Operator>>> operators, double left, double right, double top, double bottom);
403  static void DrawBackground(System::SharedPtr<Point> leftTop, double width, double height, System::SharedPtr<Color> color, System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<Operator>>> operators, BorderCornerType type, double radius);
404  static void ApplyBorderToCurXY(double& curX, double& curY, System::SharedPtr<BorderInfo> border, double leftRowBorderWidth);
411  double GetAllBordersWidth();
412  double GetRepeatingColumnWidth();
424  bool Process(double& curX, double& curY, bool isCalculatedMode, double pageRealWidth, double bottomY, System::SharedPtr<Page> page, bool isProcessSpecialSymbols, System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<Operator>>> operators);
429  static double GetColumnWidth(System::String stringColumnWidth);
430  static System::ArrayPtr<double> GetColumnWidths(System::String columnWidthString, double realWidth, bool isCutRightPageMargin);
436  void ApplyColumnWidth(double realWidth, System::SharedPtr<Page> page);
440  void ResetFormattedFragments(System::SharedPtr<Paragraphs> paragraphs);
441  ASPOSE_PDF_SHARED_API void Serialize(System::SharedPtr<System::Xml::XmlTextWriter> writer) override;
442  ASPOSE_PDF_SHARED_API void Deserialize(System::SharedPtr<System::Xml::XmlReader> reader) override;
443 
444  virtual ASPOSE_PDF_SHARED_API ~Table();
445 
446 private:
447 
448  System::SharedPtr<Text::TextState> defaultCellTextState;
449  bool isNullAddedToRows;
450  bool isPreprocessed;
452  int32_t pr_MaxCellsCount;
453 
457  void set_MaxCellsCount(int32_t value);
458 
459  int32_t pr_PrintedRowsCount;
460 
464  void set_PrintedRowsCount(int32_t value);
465 
466  System::SharedPtr<Color> pr_BackgroundColor;
468  BorderCornerStyle pr_CornerStyle;
469  System::ArrayPtr<double> pr_InternalColumnWidths;
470  System::SharedPtr<Text::TextState> pr_RepeatingRowsStyle;
471  int32_t pr_RepeatingColumnsCount;
472  int32_t pr_RepeatingRowsCount;
473  System::String pr_ColumnWidths;
474  TableBroken pr_Broken;
475  System::SharedPtr<BorderInfo> pr_DefaultCellBorder;
476  System::String pr_DefaultColumnWidth;
478  System::SharedPtr<MarginInfo> pr_DefaultCellPadding;
480  float pr_Left;
481  float pr_Top;
482  bool pr_IsBroken;
483  bool pr_IsBordersIncluded;
484  Aspose::Pdf::ColumnAdjustment pr_ColumnAdjustment;
485  bool pr_IsProcessSpecialSymbols;
486 
490  void set_IsProcessSpecialSymbols(bool value);
491 
493 
497  void set_ColumnTextStates(System::ArrayPtr<System::SharedPtr<Text::TextState>> value);
498 
499  System::WeakPtr<Table> pr_ParentTable;
500 
501  double get_Width();
502 
503  System::String pr_McName;
504  int32_t pr_McId;
506 
507  static System::SharedPtr<System::Globalization::CultureInfo> get_InvariantCulture();
508 
517  static void DrawRoundedPathSegment(System::SharedPtr<Point> first, System::SharedPtr<Point> second, System::SharedPtr<Point> third, bool isCornerRounded, System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<Operator>>> operators);
518  bool ProcessVerticalBroken(double& curX, double& curY, double pageRealWidth, System::SharedPtr<Page> page, bool isCalculatedMode, System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<Operator>>> operators);
519  void RecalculateAutoFitRows(double pageRealWidth);
520  void PreProcessAutoFitRow(System::SharedPtr<Row> row, System::ArrayPtr<double> borderWidths, double pageRealWidth);
521  void PreProcessRow(System::SharedPtr<Row> row, int32_t i);
522  void PreProcess(double pageRealWidth);
524  void AddRowsOperators(System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<Operator>>> operators, int32_t count);
525  System::SharedPtr<Row> GetBreakRow(double curX, double curY, bool isCalculatedMode, double pageRealWidth, double bottomY, System::SharedPtr<Page> page);
526 
527 };
528 
529 } // namespace Pdf
530 } // namespace Aspose
531 
532 
Represents graph - graphics generator paragraph.
Definition: Graph.h:53
Represents Table structure element in logical structure.
Definition: BLSTableElement.h:69
String class used across the library. Is a substitute for C# System.String when translating code...
Definition: string.h:121
ASPOSE_PDF_SHARED_API void set_DefaultCellPadding(System::SharedPtr< MarginInfo > value)
Sets default margin for row cells
class ASPOSECPP_SHARED_CLASS List
Definition: ienumerable.h:17
Represents a FloatingBox in a Pdf document. FloatingBox is custom positioned.
Definition: FloatingBox.h:45
Class representing PDF document
Definition: Document.h:625
Definition: Artifact.h:67
Represents abstract formatted fragment.
Definition: FormattedFragment.h:60
ASPOSE_PDF_SHARED_API void set_DefaultCellBorder(System::SharedPtr< BorderInfo > value)
Gets default cell border;
ASPOSE_PDF_SHARED_API System::SharedPtr< System::Object > Clone() override
Clone the row.
double GetHeight(System::SharedPtr< Table > table, System::SharedPtr< Page > page, double curY, double bottomY)
ASPOSE_PDF_SHARED_API const System::SharedPtr< Color > & get_BackgroundColor() const
Gets the background color.
ASPOSE_PDF_SHARED_API System::SharedPtr< Text::TextState > get_DefaultCellTextState()
Gets default text state for row cells
HorizontalAlignment
Describes horizontal alignment.
Definition: HorizontalAlignment.h:16
ASPOSE_PDF_SHARED_API const System::SharedPtr< BorderInfo > & get_DefaultCellBorder() const
Gets default cell border;
void Serialize(System::SharedPtr< System::Xml::XmlTextWriter > writer)
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: fwd.h:22
Represents a text type.
means saving in XML format
void Deserialize(System::SharedPtr< System::Xml::XmlReader > reader)
Class representing page of PDF document.
Definition: Page.h:375
Definition: AFRelationship.h:4
ASPOSE_PDF_SHARED_API const System::SharedPtr< MarginInfo > & get_DefaultCellPadding() const
Gets default margin for row cells
Subclass of System::SmartPtr which sets itself to weak mode at construction. Please note that this cl...
Definition: TextFragmentState.h:69
This class represents a margin for different objects.
Definition: MarginInfo.h:42
Defies a method that enables object cloning - creating a copy of an object. Objects of this class sho...
Definition: icloneable.h:15
ColumnAdjustment
Enumerates column adjustment types.
Definition: ColumnAdjustment.h:16
Represents a row of the table.
Definition: Row.h:53
ASPOSE_PDF_SHARED_API const System::SharedPtr< BorderInfo > & get_Border() const
Gets the border.
ASPOSE_PDF_SHARED_API void set_Border(System::SharedPtr< BorderInfo > value)
Sets the border.
Represents a cell of the table&#39;s row.
Definition: Cell.h:65
A printer&#39;s point (1/72 of an inch).
List forward declaration.
Definition: Artifact.h:74
The coordinates are in the page coordinate context.
bool Process(System::SharedPtr< Table > table, double &curY, double &curX, bool isCalculatedMode, double realPageWidth, double bottomY, System::SharedPtr< Page > page, int32_t &rowNumber)
Process row.
BorderCornerStyle
Enumerates the border corner styles for border.
Definition: BorderCornerStyle.h:11
Represents a table that can be added to the page.
Definition: Table.h:86
Represents a abstract base object can be added to the page(doc.Paragraphs.Add()). ...
Definition: BaseParagraph.h:66
ASPOSE_PDF_SHARED_API void set_DefaultCellTextState(System::SharedPtr< Text::TextState > value)
Sets default text state for row cells
TableBroken
Enumerates the table broken.
Definition: VerticalBroken.h:11
double get_Width() const
Gets row width(for internal use)
ASPOSE_PDF_SHARED_API void set_BackgroundColor(System::SharedPtr< Color > value)
Sets the background color.
Whole PDF file will be submitted.