search/mag_sel search/close
FieldHyperlink.h
1 // Copyright 2001-2021 Aspose Pty Ltd. All Rights Reserved.
3 //
4 // This file is part of Aspose.Words. The source code in this file
5 // is only intended as a supplement to the documentation, and is provided
6 // "as is", without warranty of any kind, either expressed or implied.
9 #pragma once
10 
11 #include <system/string.h>
12 #include <cstdint>
13 
14 #include <Aspose.Words.Cpp/Fields/FieldSwitchType.h>
15 #include <Aspose.Words.Cpp/Fields/IFieldResultFormatProvider.h>
16 #include <Aspose.Words.Cpp/Fields/IFieldResultFormatApplier.h>
17 #include <Aspose.Words.Cpp/Fields/IFieldCodeTokenInfoProvider.h>
18 #include <Aspose.Words.Cpp/Fields/Field.h>
19 #include <Aspose.Words.Cpp/aspose_words_api_defs.h>
20 
21 namespace Aspose { namespace Words { namespace Layout { namespace Core { class SpanField; } } } }
22 namespace Aspose { namespace Words { namespace Fields { class FieldCodeHyperlink; } } }
23 namespace Aspose { namespace Words { namespace RW { namespace MarkupLanguage { namespace Writer { class MarkupLanguageFieldWriterBase; } } } } }
24 namespace Aspose { namespace Words { namespace Fields { class FieldUpdateAction; } } }
25 namespace Aspose { namespace Words { class Inline; } }
26 namespace Aspose { namespace Words { class NodeRange; } }
27 namespace Aspose { namespace Words { class RunPr; } }
28 
29 namespace Aspose {
30 
31 namespace Words {
32 
33 namespace Fields {
34 
66 class ASPOSE_WORDS_SHARED_CLASS FieldHyperlink : public Aspose::Words::Fields::Field, public Aspose::Words::Fields::IFieldCodeTokenInfoProvider, public Aspose::Words::Fields::IFieldResultFormatProvider
67 {
68  typedef FieldHyperlink ThisType;
70  typedef Aspose::Words::Fields::IFieldCodeTokenInfoProvider BaseType1;
71  typedef Aspose::Words::Fields::IFieldResultFormatProvider BaseType2;
72 
73  typedef ::System::BaseTypesInfo<BaseType, BaseType1, BaseType2> ThisTypeBaseTypesInfo;
74  ASPOSE_WORDS_SHARED_RTTI_INFO_DECL();
75 
76  friend class Aspose::Words::Layout::Core::SpanField;
77  friend class Aspose::Words::Fields::FieldCodeHyperlink;
78  friend class Aspose::Words::RW::MarkupLanguage::Writer::MarkupLanguageFieldWriterBase;
79 
80 private:
81 
82  class HyperlinkStyleFormatApplier : public Aspose::Words::Fields::IFieldResultFormatApplier
83  {
84  typedef HyperlinkStyleFormatApplier ThisType;
85  typedef Aspose::Words::Fields::IFieldResultFormatApplier BaseType;
86 
87  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
88  RTTI_INFO_DECL();
89 
90  public:
91 
93  void ApplyFormat(System::SharedPtr<Aspose::Words::NodeRange> result) override;
94 
95  private:
96 
97  HyperlinkStyleFormatApplier();
98 
99  MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(HyperlinkStyleFormatApplier, CODEPORTING_ARGS());
100 
101  };
102 
103  class RetainingFormatApplier : public Aspose::Words::Fields::IFieldResultFormatApplier
104  {
105  typedef RetainingFormatApplier ThisType;
106  typedef Aspose::Words::Fields::IFieldResultFormatApplier BaseType;
107 
108  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
109  RTTI_INFO_DECL();
110 
111  public:
112 
114  void ApplyFormat(System::SharedPtr<Aspose::Words::NodeRange> result) override;
115 
116  private:
117 
119 
120  RetainingFormatApplier(System::SharedPtr<Aspose::Words::RunPr> runPr);
121 
122  MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(RetainingFormatApplier, CODEPORTING_ARGS(System::SharedPtr<Aspose::Words::RunPr> runPr));
123 
124  };
125 
126 public:
127 
159  ASPOSE_WORDS_SHARED_API System::String get_Target();
160 
162  ASPOSE_WORDS_SHARED_API void set_Target(System::String value);
163 
195  ASPOSE_WORDS_SHARED_API System::String get_Address();
196 
198  ASPOSE_WORDS_SHARED_API void set_Address(System::String value);
199 
231  ASPOSE_WORDS_SHARED_API System::String get_SubAddress();
232 
234  ASPOSE_WORDS_SHARED_API void set_SubAddress(System::String value);
235 
267  ASPOSE_WORDS_SHARED_API bool get_IsImageMap();
268 
270  ASPOSE_WORDS_SHARED_API void set_IsImageMap(bool value);
271 
303  ASPOSE_WORDS_SHARED_API bool get_OpenInNewWindow();
304 
306  ASPOSE_WORDS_SHARED_API void set_OpenInNewWindow(bool value);
307 
339  ASPOSE_WORDS_SHARED_API System::String get_ScreenTip();
340 
342  ASPOSE_WORDS_SHARED_API void set_ScreenTip(System::String value);
343 
344  ASPOSE_WORDS_SHARED_API Aspose::Words::Fields::FieldSwitchType GetSwitchType(System::String switchName) override;
345  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::Inline> GetSourceNode() override;
347 
348 protected:
349 
350  System::String get_HRef();
351 
352  static const int32_t AddressArgumentIndex;
353 
354  static const System::String& SubAddressSwitch();
355  static const System::String& IsImageMapSwitch();
356  static const System::String& OpenInNewWindowSwitch();
357  static const System::String& ScreenTipSwitch();
358  static const System::String& TargetSwitch();
359  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::Fields::FieldUpdateAction> UpdateCore() override;
360  ASPOSE_WORDS_SHARED_API void BeforeUnlink() override;
361  ASPOSE_WORDS_SHARED_API bool NeedStoreOldResultNodes() override;
362 
363  virtual ASPOSE_WORDS_SHARED_API ~FieldHyperlink();
364 
365 private:
366 
367  bool get_HasResult();
368  bool get_IsDirectResultUpdate();
369 
370  System::String GetHyperlinkText();
371  System::String GetAddressSchemeAware();
372  static System::String TrimAddressScheme(System::String address, System::String scheme);
373 
374 };
375 
376 }
377 }
378 }