TextStamp.h
1 #pragma once
2 // Copyright (c) 2001-2024 Aspose Pty Ltd. All Rights Reserved.
3 
4 #include <system/array.h>
5 
6 #include "Aspose.PDF.Cpp/Text/TextOptions/TextFormattingOptions.h"
7 #include "Aspose.PDF.Cpp/Stamp.h"
8 #include "Aspose.PDF.Cpp/aspose_pdf_api_defs.h"
9 
10 namespace Aspose
11 {
12 namespace Pdf
13 {
14 namespace Engine
15 {
16 namespace Data
17 {
18 class IPdfDataStream;
19 class IPdfObject;
20 } // namespace Data
21 } // namespace Engine
22 namespace Facades
23 {
24 class FormattedText;
25 } // namespace Facades
26 enum class HorizontalAlignment;
27 class Page;
28 class Rectangle;
29 namespace Tests
30 {
31 namespace Facades
32 {
33 class FormattedTextTests;
34 } // namespace Facades
35 namespace Text
36 {
37 class TextBuilderTests;
38 } // namespace Text
39 } // namespace Tests
40 namespace Text
41 {
42 class Font;
43 class TextFragment;
44 class TextParagraph;
45 class TextState;
46 } // namespace Text
47 class TextStamp;
48 class XForm;
49 } // namespace Pdf
50 } // namespace Aspose
51 namespace System
52 {
53 namespace Collections
54 {
55 namespace Generic
56 {
57 template <typename> class List;
58 } // namespace Generic
59 } // namespace Collections
60 } // namespace System
61 
62 namespace Aspose {
63 
64 namespace Pdf {
65 
69 class ASPOSE_PDF_SHARED_CLASS TextStamp : public Aspose::Pdf::Stamp
70 {
71  typedef TextStamp ThisType;
73 
74  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
75  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
76 
80  friend class Aspose::Pdf::Tests::Text::TextBuilderTests;
81  friend class Aspose::Pdf::Tests::Facades::FormattedTextTests;
82 
83 private:
84 
85  class TextLine : public System::Object
86  {
87  typedef TextLine ThisType;
88  typedef System::Object BaseType;
89 
90  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
91  RTTI_INFO_DECL();
92 
93  public:
94 
95  System::String get_Text() const;
96  double get_Spacing() const;
97 
98  TextLine(System::String text, double spacing);
99  TextLine(System::String text);
100 
101  private:
102 
103  System::String _text;
104  double _spacing;
105 
106  };
107 
108  class WordInfo : public System::Object
109  {
110  typedef WordInfo ThisType;
111  typedef System::Object BaseType;
112 
113  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
114  RTTI_INFO_DECL();
115 
116  public:
117 
118  System::String text;
119  System::String space;
120 
121  System::String get_SpecialFont() const;
122  void set_SpecialFont(System::String value);
123 
124  WordInfo(System::String text);
125  WordInfo();
126 
127  private:
128 
129  System::String pr_SpecialFont;
130 
131  };
132 
133 
134 public:
135 
139  ASPOSE_PDF_SHARED_API bool get_Draw() const;
143  ASPOSE_PDF_SHARED_API void set_Draw(bool value);
149  ASPOSE_PDF_SHARED_API bool get_TreatYIndentAsBaseLine() const;
155  ASPOSE_PDF_SHARED_API void set_TreatYIndentAsBaseLine(bool value);
160  ASPOSE_PDF_SHARED_API bool get_WordWrap() const;
165  ASPOSE_PDF_SHARED_API void set_WordWrap(bool value);
169  ASPOSE_PDF_SHARED_API Aspose::Pdf::Text::TextFormattingOptions::WordWrapMode get_WordWrapMode() const;
173  ASPOSE_PDF_SHARED_API void set_WordWrapMode(Aspose::Pdf::Text::TextFormattingOptions::WordWrapMode value);
177  ASPOSE_PDF_SHARED_API bool get_Justify();
181  ASPOSE_PDF_SHARED_API void set_Justify(bool value);
185  ASPOSE_PDF_SHARED_API bool get_Scale() const;
189  ASPOSE_PDF_SHARED_API void set_Scale(bool value);
193  ASPOSE_PDF_SHARED_API System::String get_Value();
197  ASPOSE_PDF_SHARED_API void set_Value(System::String value);
201  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::Text::TextState> get_TextState() const;
205  ASPOSE_PDF_SHARED_API Aspose::Pdf::HorizontalAlignment get_TextAlignment() const;
209  ASPOSE_PDF_SHARED_API void set_TextAlignment(Aspose::Pdf::HorizontalAlignment value);
213  ASPOSE_PDF_SHARED_API double get_Width() override;
217  ASPOSE_PDF_SHARED_API void set_Width(double value) override;
221  ASPOSE_PDF_SHARED_API double get_Height() override;
225  ASPOSE_PDF_SHARED_API void set_Height(double value) override;
229  ASPOSE_PDF_SHARED_API double get_MaxRowWidth() const;
233  ASPOSE_PDF_SHARED_API void set_MaxRowWidth(double value);
234 
241  ASPOSE_PDF_SHARED_API TextStamp(System::String value);
247  ASPOSE_PDF_SHARED_API TextStamp(System::String value, System::SharedPtr<Aspose::Pdf::Text::TextState> textState);
248 
255  ASPOSE_PDF_SHARED_API void Put(System::SharedPtr<Page> page) override;
256 
261  ASPOSE_PDF_SHARED_API TextStamp(System::SharedPtr<Facades::FormattedText> formattedText);
262 
263 protected:
264 
269 
270  static System::SharedPtr<Aspose::Pdf::Text::Font> get_DefaultFont();
271 
272  static float DefaultFontSize;
273 
274  ASPOSE_PDF_SHARED_API void ClearCache() override;
279  ASPOSE_PDF_SHARED_API System::SharedPtr<Rectangle> getRect() override;
285  virtual ASPOSE_PDF_SHARED_API System::SharedPtr<XForm> createXForm(System::SharedPtr<Page> page);
286 
287 private:
288 
293  bool _wordwrap;
294  bool _scale;
295  bool _draw;
296  bool _useBaseLineOrigin;
297  bool _isOrigingSet;
298  double _desiredWidth;
299  double _desiredHeight;
301  static double VERTICAL_INDENT;
303  double _maxRowWidth;
304 
305  bool IsBlankSpace(char16_t c);
309  int32_t FindSplitIndex(System::String word, int32_t startIndex, double maxWidth);
315 
316 };
317 
318 } // namespace Pdf
319 } // namespace Aspose
320 
321 
Class which represents formatted text. Contains information about text and its color, size, style.
Definition: FormattedText.h:65
String class used across the library. Is a substitute for C# System.String when translating code...
Definition: string.h:121
class ASPOSECPP_SHARED_CLASS List
Definition: ienumerable.h:17
An abstract class for various kinds of stamps which come as descendants.
Definition: Stamp.h:47
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:64
Definition: Artifact.h:67
Represents text paragraphs as multiline text object.
Definition: TextParagraph.h:86
HorizontalAlignment
Describes horizontal alignment.
Definition: HorizontalAlignment.h:16
Definition: signed_info.h:13
Aspose::Pdf::HorizontalAlignment _textAlignemnt
Alignment of the text.
Definition: TextStamp.h:268
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.
WordWrapMode
Defines word wrapping strategies
Definition: TextFormattingOptions.h:48
Definition: AFRelationship.h:4
Represents textual stamp.
Definition: TextStamp.h:69
static float DefaultFontSize
Definition: TextStamp.h:272
List forward declaration.
Definition: Artifact.h:74
The coordinates are in the page coordinate context.
Represents a text state of a text
Definition: TextState.h:135
Whole PDF file will be submitted.