TextFragmentState.h
1 #pragma once
2 // Copyright (c) 2001-2024 Aspose Pty Ltd. All Rights Reserved.
3 
4 #include <system/shared_ptr.h>
5 #include <system/enum_helpers.h>
6 #include <cstdint>
7 
8 #include "Aspose.PDF.Cpp/Text/TextState.h"
9 #include "Aspose.PDF.Cpp/aspose_pdf_api_defs.h"
10 
11 namespace Aspose
12 {
13 namespace Pdf
14 {
15 class ApsToPdfConverter;
16 class Color;
17 namespace Engine
18 {
19 namespace CommonData
20 {
21 namespace Text
22 {
23 namespace Segmenting
24 {
25 class TextSegmenter;
26 } // namespace Segmenting
27 } // namespace Text
28 } // namespace CommonData
29 } // namespace Engine
30 class Heading;
31 enum class HorizontalAlignment;
32 class Matrix;
33 class PageGenerator;
34 class Rectangle;
35 namespace Tests
36 {
37 class RegressionTests_v17_12;
38 namespace Text
39 {
40 class TextParagraphAbsorberTests;
41 } // namespace Text
42 } // namespace Tests
43 namespace Text
44 {
45 enum class CoordinateOrigin;
46 class Font;
47 enum class FontStyles;
48 class TabStops;
49 class TextFormattingOptions;
50 class TextFragment;
51 class TextParagraph;
52 enum class TextRenderingMode;
53 } // namespace Text
54 class TextStamp;
55 enum class VerticalAlignment;
56 } // namespace Pdf
57 } // namespace Aspose
58 namespace System
59 {
60 namespace Collections
61 {
62 namespace Generic
63 {
64 template <typename, typename> class Dictionary;
65 } // namespace Generic
66 } // namespace Collections
67 class EventArgs;
68 class String;
69 template <typename> class WeakPtr;
70 } // namespace System
71 
72 namespace Aspose {
73 
74 namespace Pdf {
75 
76 namespace Text {
77 
97 class ASPOSE_PDF_SHARED_CLASS TextFragmentState final : public Aspose::Pdf::Text::TextState
98 {
101 
102  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
103  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
104 
105  friend class Aspose::Pdf::ApsToPdfConverter;
106  friend class Aspose::Pdf::Heading;
108  friend class Aspose::Pdf::PageGenerator;
112  friend class Aspose::Pdf::Tests::Text::TextParagraphAbsorberTests;
113  friend class Aspose::Pdf::Tests::RegressionTests_v17_12;
114 
115 public:
116 
120  ASPOSE_PDF_SHARED_API float get_CharacterSpacing() override;
124  ASPOSE_PDF_SHARED_API void set_CharacterSpacing(float value) override;
128  ASPOSE_PDF_SHARED_API float get_HorizontalScaling() override;
132  ASPOSE_PDF_SHARED_API void set_HorizontalScaling(float value) override;
136  ASPOSE_PDF_SHARED_API float get_WordSpacing() override;
140  ASPOSE_PDF_SHARED_API void set_WordSpacing(float value) override;
144  ASPOSE_PDF_SHARED_API bool get_Invisible() override;
148  ASPOSE_PDF_SHARED_API void set_Invisible(bool value) override;
152  ASPOSE_PDF_SHARED_API TextRenderingMode get_RenderingMode() override;
156  ASPOSE_PDF_SHARED_API void set_RenderingMode(TextRenderingMode value) override;
160  ASPOSE_PDF_SHARED_API bool get_Subscript() override;
164  ASPOSE_PDF_SHARED_API void set_Subscript(bool value) override;
168  ASPOSE_PDF_SHARED_API bool get_Superscript() override;
172  ASPOSE_PDF_SHARED_API void set_Superscript(bool value) override;
180  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::Text::TabStops> get_TabStops() const;
190  ASPOSE_PDF_SHARED_API float get_LineSpacing() override;
200  ASPOSE_PDF_SHARED_API void set_LineSpacing(float value) override;
204  ASPOSE_PDF_SHARED_API System::SharedPtr<Color> get_ForegroundColor() override;
208  ASPOSE_PDF_SHARED_API void set_ForegroundColor(System::SharedPtr<Color> value) override;
212  ASPOSE_PDF_SHARED_API System::SharedPtr<Color> get_StrokingColor() override;
216  ASPOSE_PDF_SHARED_API void set_StrokingColor(System::SharedPtr<Color> value) override;
220  ASPOSE_PDF_SHARED_API System::SharedPtr<Color> get_BackgroundColor() override;
224  ASPOSE_PDF_SHARED_API void set_BackgroundColor(System::SharedPtr<Color> value) override;
228  ASPOSE_PDF_SHARED_API bool get_Underline() override;
232  ASPOSE_PDF_SHARED_API void set_Underline(bool value) override;
236  ASPOSE_PDF_SHARED_API bool get_StrikeOut() override;
240  ASPOSE_PDF_SHARED_API void set_StrikeOut(bool value) override;
244  ASPOSE_PDF_SHARED_API FontStyles get_FontStyle() override;
248  ASPOSE_PDF_SHARED_API void set_FontStyle(FontStyles value) override;
252  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::Text::Font> get_Font() override;
256  ASPOSE_PDF_SHARED_API void set_Font(System::SharedPtr<Aspose::Pdf::Text::Font> value) override;
260  ASPOSE_PDF_SHARED_API float get_FontSize() override;
264  ASPOSE_PDF_SHARED_API void set_FontSize(float value) override;
273  ASPOSE_PDF_SHARED_API Aspose::Pdf::HorizontalAlignment get_HorizontalAlignment() override;
282  ASPOSE_PDF_SHARED_API void set_HorizontalAlignment(Aspose::Pdf::HorizontalAlignment value) override;
287  ASPOSE_PDF_SHARED_API System::SharedPtr<TextFormattingOptions> get_FormattingOptions() const;
292  ASPOSE_PDF_SHARED_API void set_FormattingOptions(System::SharedPtr<TextFormattingOptions> value);
301  ASPOSE_PDF_SHARED_API Aspose::Pdf::Text::CoordinateOrigin get_CoordinateOrigin() override;
310  ASPOSE_PDF_SHARED_API void set_CoordinateOrigin(Aspose::Pdf::Text::CoordinateOrigin value) override;
314  ASPOSE_PDF_SHARED_API double get_Rotation();
318  ASPOSE_PDF_SHARED_API void set_Rotation(double value);
322  ASPOSE_PDF_SHARED_API bool get_DrawTextRectangleBorder() const;
326  ASPOSE_PDF_SHARED_API void set_DrawTextRectangleBorder(bool value);
327 
333  ASPOSE_PDF_SHARED_API double MeasureString(System::String str) override;
339  ASPOSE_PDF_SHARED_API double MeasureHeight(char16_t character);
340 
347  ASPOSE_PDF_SHARED_API TextFragmentState(System::SharedPtr<TextFragment> fragment);
348 
356  ASPOSE_PDF_SHARED_API void ApplyChangesFrom(System::SharedPtr<TextState> textState) override;
363  ASPOSE_PDF_SHARED_API bool IsFitRectangle(System::String str, System::SharedPtr<Rectangle> rect);
364 
365 protected:
366 
367  const System::SharedPtr<TextFragment>& get_Fragment() const;
368  void set_Fragment(System::SharedPtr<TextFragment> value);
369  ASPOSE_PDF_SHARED_API System::SharedPtr<Matrix> get_TextMatrix() override;
370  ASPOSE_PDF_SHARED_API void set_TextMatrix(System::SharedPtr<Matrix> value) override;
374  ASPOSE_PDF_SHARED_API bool get_IsTextWithPositions() override;
378  ASPOSE_PDF_SHARED_API void set_IsTextWithPositions(bool value) override;
382  ASPOSE_PDF_SHARED_API System::SharedPtr<System::Collections::Generic::Dictionary<int32_t, double>> get_Adjustments() override;
386  ASPOSE_PDF_SHARED_API void set_Adjustments(System::SharedPtr<System::Collections::Generic::Dictionary<int32_t, double>> value) override;
391  bool get_IsBBoxFontSizeCoefficientApplied() const;
396  void set_IsBBoxFontSizeCoefficientApplied(bool value);
401  bool get_IsSingleState() const;
409  ASPOSE_PDF_SHARED_API void set_TabStops(System::SharedPtr<Aspose::Pdf::Text::TabStops> value);
418  ASPOSE_PDF_SHARED_API Aspose::Pdf::VerticalAlignment get_VerticalAlignment() override;
427  ASPOSE_PDF_SHARED_API void set_VerticalAlignment(Aspose::Pdf::VerticalAlignment value) override;
431  ASPOSE_PDF_SHARED_API float get_TextHeight() override;
432 
438  void ApplyChangesFrom(System::SharedPtr<TextState> textState, bool groupChangesOnly);
440  void SyncVerticalAlignment(Aspose::Pdf::VerticalAlignment verticalAlignment);
441  void SyncHorizontalAlignment(Aspose::Pdf::HorizontalAlignment horizontalAlignment);
442  void Disconnect();
443  ASPOSE_PDF_SHARED_API System::SharedPtr<TextState> CopyPublicProperties() override;
444 
445 private:
446 
447  System::WeakPtr<TextFragment> pr_Fragment;
448  bool groupPreparationMode;
449  bool prepareIsolateToSingleSegmentDone;
450  bool isBBoxFontSizeCoefficientApplied;
456  bool _isSingleState;
458  double rotation;
459 
464  void set_IsSingleState(bool value);
465 
466  bool pr_DrawTextRectangleBorder;
467 
468  void OnRectChanged(System::SharedPtr<System::Object> sender, System::SharedPtr<System::EventArgs> eventArgs);
469  void ResetGroupPreparations();
470  void PrepareIsolateToSingleSegment();
471  void SetFontAndFontSize(System::SharedPtr<Aspose::Pdf::Text::Font> _font, float _fontSize);
472 
473 };
474 
475 } // namespace Text
476 } // namespace Pdf
477 } // namespace Aspose
478 
479 
VerticalAlignment
Enumeration of possible vertical alignment values.
Definition: VerticalAlignment.h:16
String class used across the library. Is a substitute for C# System.String when translating code...
Definition: string.h:121
Represents fragment of Pdf text.
Definition: TextFragment.h:170
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
Represents heading.
Definition: Heading.h:58
FontStyles
Specifies style information applied to text.
Definition: FontStyles.h:22
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: fwd.h:22
Definition: AFRelationship.h:4
TextRenderingMode
The text rendering mode, Tmode, determines whether showing text shall cause glyph outlines to be stro...
Definition: TextRenderingMode.h:19
Subclass of System::SmartPtr which sets itself to weak mode at construction. Please note that this cl...
Definition: TextFragmentState.h:69
Reresents textual stamp.
Definition: TextStamp.h:68
Forward declaration of Dictionary class.
Definition: Artifact.h:73
Represents a text state of a text fragment.
Definition: TextFragmentState.h:97
CoordinateOrigin
Text CoordinateOrigin enumeration.
Definition: CoordinateOrigin.h:13
Represents a text state of a text
Definition: TextState.h:135
Whole PDF file will be submitted.