Aspose.Tasks for C++
OleObjectCollection.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="OleObjectCollection.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2024 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 #include <system/collections/ilist.h>
9 #include <system/array.h>
10 #include <cstdint>
11 
12 #include "aspose.tasks.cpp/aspose_tasks_api_defs.h"
13 
14 namespace Aspose
15 {
16 namespace Tasks
17 {
18 namespace IO
19 {
20 namespace MSProject
21 {
22 class MppOleObjectWriter;
23 class MPPReader;
24 class MPPWriter;
25 namespace Writers
26 {
27 class MppVisualObjectPlacementWriter;
28 } // namespace Writers
29 } // namespace MSProject
30 } // namespace IO
31 class OleObject;
32 class Project;
33 } // namespace Tasks
34 } // namespace Aspose
35 namespace System
36 {
37 namespace Collections
38 {
39 namespace Generic
40 {
41 template <typename> class IEnumerable;
42 template <typename> class IEnumerator;
43 template <typename> class List;
44 } // namespace Generic
45 } // namespace Collections
46 } // namespace System
47 
48 namespace Aspose {
49 
50 namespace Tasks {
51 
52 /// <summary>
53 /// Represents a collection containing the instances of the <see cref="OleObject"></see> class.
54 /// </summary>
55 class ASPOSE_TASKS_SHARED_CLASS OleObjectCollection final : public System::Collections::Generic::IList<System::SharedPtr<Aspose::Tasks::OleObject>>
56 {
58  typedef System::Collections::Generic::IList<System::SharedPtr<Aspose::Tasks::OleObject>> BaseType;
59 
60  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
61  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
62 
63  friend class Aspose::Tasks::IO::MSProject::Writers::MppVisualObjectPlacementWriter;
64  friend class Aspose::Tasks::Project;
65  friend class Aspose::Tasks::IO::MSProject::MppOleObjectWriter;
66  friend class Aspose::Tasks::IO::MSProject::MPPReader;
67  friend class Aspose::Tasks::IO::MSProject::MPPWriter;
68 
69 public:
70 
71  /// <summary>
72  /// Returns an enumerator for this collection.
73  /// </summary>
74  /// <returns>an enumerator for this collection.</returns>
75  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::IEnumerator<System::SharedPtr<OleObject>>> GetEnumerator() override;
76  /// <summary>
77  /// Converts the instance of the <see cref="OleObjectCollection"></see> class to a list containing the instances of the <see cref="OleObject"></see> class.
78  /// </summary>
79  /// <returns>Converted to list the instance of the <see cref="OleObjectCollection"></see> class containing the instances of the <see cref="OleObject"></see> class.</returns>
80  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<OleObject>>> ToList();
81  /// <summary>
82  /// Clears the collection. In order to persist these changes project.Save should be called with new MPPSaveOptions { WriteViewData = true; }
83  /// </summary>
84  /// <example>
85  /// How to clear OLE objects and persist these changes.
86  /// <code>
87  /// [C#]
88  /// project.OleObjects.Clear();
89  /// project.Save("output.mpp", new MPPSaveOptions {WriteViewData = true;} )
90  /// </code>
91  /// </example>
92  ASPOSE_TASKS_SHARED_API void Clear() override;
93 
94 protected:
95 
96  ASPOSE_TASKS_SHARED_API const System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<OleObject>>>& get_RemovedObjects() const;
97  ASPOSE_TASKS_SHARED_API const System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<OleObject>>>& get_AddedObjects() const;
98 
99  ASPOSE_TASKS_SHARED_API OleObjectCollection();
100 
101  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(OleObjectCollection, CODEPORTING_ARGS());
102 
103  ASPOSE_TASKS_SHARED_API OleObjectCollection(const System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<OleObject>>>& objects);
104 
105  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(OleObjectCollection, CODEPORTING_ARGS(const System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<OleObject>>>& objects));
106  ASPOSE_TASKS_SHARED_API void Add(const System::SharedPtr<System::Collections::Generic::IEnumerable<System::SharedPtr<OleObject>>>& list);
107  ASPOSE_TASKS_SHARED_API System::SharedPtr<OleObject> GetById(int32_t oleObjectId);
108 
109  virtual ASPOSE_TASKS_SHARED_API ~OleObjectCollection();
110 
111  #ifdef ASPOSE_GET_SHARED_MEMBERS
112  ASPOSE_TASKS_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
113  #endif
114 
115 
116 private:
117 
118  System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<OleObject>>> oleObjects;
119 
120  int32_t get_Count() const override;
121  bool get_IsReadOnly() const override;
122 
123  System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<OleObject>>> pr_RemovedObjects;
124 
125  ASPOSE_TASKS_SHARED_API void set_RemovedObjects(const System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<OleObject>>>& value);
126 
127  System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<OleObject>>> pr_AddedObjects;
128 
129  ASPOSE_TASKS_SHARED_API void set_AddedObjects(const System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<OleObject>>>& value);
130 
131  System::SharedPtr<OleObject> idx_get(int32_t index) const override;
132  void idx_set(int32_t index, System::SharedPtr<OleObject> value) override;
133 
134  bool Contains(const System::SharedPtr<OleObject>& item) const override;
135  void CopyTo(System::ArrayPtr<System::SharedPtr<OleObject>> array, int32_t arrayIndex) override;
136  bool Remove(const System::SharedPtr<OleObject>& item) override;
137  void Add(const System::SharedPtr<OleObject>& item) override;
138  int32_t IndexOf(const System::SharedPtr<OleObject>& item) const override;
139  void Insert(int32_t index, const System::SharedPtr<OleObject>& item) override;
140  void RemoveAt(int32_t index) override;
141 
142 };
143 
144 } // namespace Tasks
145 } // namespace Aspose
146 
147 
Represents a project.
Definition: Project.h:551
Represents a collection containing the instances of the OleObject class.
Definition: OleObjectCollection.h:55