Aspose.Tasks for C++
VbaModule.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="VbaModule.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2025 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 #include <system/string.h>
9 #include <cstdint>
10 
11 #include "aspose.tasks.cpp/Vba/IVbaModule.h"
12 #include "aspose.tasks.cpp/aspose_tasks_api_defs.h"
13 
14 namespace Aspose
15 {
16 namespace Tasks
17 {
18 namespace Vba
19 {
20 class VbaModuleReader;
21 class VbaModuleSourceCodeWriter;
22 class VbaProjectFolderBuilder;
23 class VbaProjectWriter;
24 } // namespace Vba
25 class VbaInternalModule;
26 class VbaModuleAttributeCollection;
27 class VbaModuleCollection;
28 enum class VbaModuleType;
29 class VbaProject;
30 } // namespace Tasks
31 } // namespace Aspose
32 
33 namespace Aspose {
34 
35 namespace Tasks {
36 
37 /// <summary>
38 /// Represents a VBA module.
39 /// </summary>
40 class ASPOSE_TASKS_SHARED_CLASS VbaModule final : public Aspose::Tasks::IVbaModule
41 {
42  typedef VbaModule ThisType;
43  typedef Aspose::Tasks::IVbaModule BaseType;
44 
45  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
46  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
47 
48  friend class Aspose::Tasks::Vba::VbaProjectFolderBuilder;
49  friend class Aspose::Tasks::Vba::VbaProjectWriter;
50  friend class Aspose::Tasks::Vba::VbaModuleSourceCodeWriter;
51  friend class Aspose::Tasks::Vba::VbaModuleReader;
52  friend class Aspose::Tasks::VbaInternalModule;
54  friend class Aspose::Tasks::VbaProject;
55 
56 public:
57 
58  /// <summary>
59  /// Gets a collection of the module's attributes.
60  /// </summary>
61  ASPOSE_TASKS_SHARED_API System::SharedPtr<VbaModuleAttributeCollection> get_Attributes() override;
62  /// <summary>
63  /// Gets a name of the VBA module
64  /// </summary>
65  ASPOSE_TASKS_SHARED_API System::String get_Name() override;
66  /// <summary>
67  /// Gets a name of the VBA module
68  /// </summary>
69  ASPOSE_TASKS_SHARED_API void set_Name(const System::String& value);
70  /// <summary>
71  /// Gets the type of the module.
72  /// </summary>
73  ASPOSE_TASKS_SHARED_API VbaModuleType get_Type() const;
74  /// <summary>
75  /// Gets a source code of the VBA module
76  /// </summary>
77  ASPOSE_TASKS_SHARED_API System::String get_SourceCode() override;
78  /// <summary>
79  /// Sets a source code of the VBA module
80  /// </summary>
81  ASPOSE_TASKS_SHARED_API void set_SourceCode(const System::String& value);
82 
83  /// <summary>
84  /// Creates an instance of <see cref="VbaModule"></see> with VbaModuleType.ProceduralModule type.
85  /// </summary>
86  static ASPOSE_TASKS_SHARED_API System::SharedPtr<VbaModule> CreateProceduralModule(const System::String& name);
87  /// <summary>
88  /// Creates an instance of <see cref="VbaModule"></see> with VbaModuleType.ClassModule type.
89  /// </summary>
90  static ASPOSE_TASKS_SHARED_API System::SharedPtr<VbaModule> CreateClassModule(const System::String& name);
91 
92 protected:
93 
94  /// <summary>
95  /// Gets a collection of the module's attributes.
96  /// </summary>
97  ASPOSE_TASKS_SHARED_API void set_Attributes(const System::SharedPtr<VbaModuleAttributeCollection>& value);
98  /// <summary>
99  /// Gets the type of the module.
100  /// </summary>
101  ASPOSE_TASKS_SHARED_API void set_Type(VbaModuleType value);
102  ASPOSE_TASKS_SHARED_API bool get_Modified() const;
103  ASPOSE_TASKS_SHARED_API void set_Modified(bool value);
104  ASPOSE_TASKS_SHARED_API bool get_IsNew() const;
105  ASPOSE_TASKS_SHARED_API void set_IsNew(bool value);
106  ASPOSE_TASKS_SHARED_API int32_t get_Offset() const;
107  ASPOSE_TASKS_SHARED_API void set_Offset(int32_t value);
108 
109  /// <summary>
110  /// Initializes a new instance of the <see cref="VbaModule"></see> class.
111  /// </summary>
112  ASPOSE_TASKS_SHARED_API VbaModule();
113 
114  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(VbaModule, CODEPORTING_ARGS());
115  #ifdef ASPOSE_GET_SHARED_MEMBERS
116  ASPOSE_TASKS_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
117  #endif
118 
119 
120 private:
121 
122  System::String sourceCode;
123  System::String name;
124  System::SharedPtr<VbaModuleAttributeCollection> pr_Attributes;
125  VbaModuleType pr_Type;
126  bool pr_Modified;
127  bool pr_IsNew;
128  int32_t pr_Offset;
129 
130  static void ValidateModuleName(const System::String& name);
131 
132 };
133 
134 } // namespace Tasks
135 } // namespace Aspose
136 
137 
Represents a collection of VbaModule objects.
Definition: VbaModuleCollection.h:47
Definition: Asn.h:12
Represents a module with VBA code.
Definition: IVbaModule.h:32
Represents VbaProject.
Definition: VbaProject.h:63
System::String get_Name() const
Gets project name
Represents a VBA module.
Definition: VbaModule.h:40