CompositeNode.h
1 //////////////////////////////////////////////////////////////////////////
2 // Copyright 2001-2019 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.
7 //////////////////////////////////////////////////////////////////////////
8 #pragma once
9 
10 
11 #include <xml/xpath/xpath_navigator.h>
12 #include <system/text/string_builder.h>
13 #include <system/string.h>
14 #include <system/shared_ptr.h>
15 #include <system/object.h>
16 #include <system/collections/ienumerator.h>
17 #include <system/collections/ienumerable.h>
18 #include <system/array.h>
19 #include <cstdint>
20 
21 #include "Aspose.Words.Cpp/Model/Nodes/NodeType.h"
22 #include "Aspose.Words.Cpp/Model/Nodes/Node.h"
23 #include "Aspose.Words.Cpp/Model/Nodes/INodeCollection.h"
24 #include "Aspose.Words.Cpp/aspose_words_api_defs.h"
25 
26 namespace Aspose { namespace Words { enum class VisitorAction; } }
27 namespace Aspose { namespace Words { namespace Layout { namespace Core { class LayoutShapeDrawingMLAdapter; } } } }
28 namespace Aspose { namespace Words { namespace Layout { namespace Core { class LayoutShapeVMLAdapter; } } } }
29 namespace Aspose { namespace Words { class ImportInfoCollector; } }
30 namespace Aspose { namespace Words { class AnnotationUtil; } }
31 namespace Aspose { namespace Words { class StyleSeparatorInserter; } }
32 namespace Aspose { namespace Words { namespace Fields { class FieldQuoteUpdater; } } }
33 namespace Aspose { namespace Words { namespace Fields { class FieldIncludeTextUpdater; } } }
34 namespace Aspose { namespace Words { class NodeCollection; } }
35 namespace Aspose { namespace Words { namespace Layout { class ParagraphPrConverter; } } }
36 namespace Aspose { namespace Words { namespace Comparison { class ComparerNodeUtil; } } }
37 namespace Aspose { namespace Words { namespace Comparison { class ComparerIndexer; } } }
38 namespace Aspose { namespace Words { class NodeIndexer; } }
39 namespace Aspose { namespace Words { class DocumentInserter; } }
40 namespace Aspose { namespace Words { namespace Replacing { class FindReplaceIndexer; } } }
41 namespace Aspose { namespace Words { namespace Tables { class TableMerger; } } }
42 namespace Aspose { namespace Words { namespace RW { namespace Docx { namespace Writer { class DocxFieldsWriter; } } } } }
43 namespace Aspose { namespace Words { namespace RW { class InlineMarkupResolver; } } }
44 namespace Aspose { namespace Words { class NodeEnumerator; } }
45 namespace Aspose { namespace Words { namespace RW { namespace Nrx { namespace Reader { class NrxRunReaderBase; } } } } }
46 namespace Aspose { namespace Words { namespace Replacing { class FindReplace; } } }
47 namespace Aspose { namespace Words { class RevisionGroup; } }
48 namespace Aspose { namespace Words { namespace Revisions { class RevisionUtil; } } }
49 namespace Aspose { namespace Words { namespace Revisions { class BookmarkDeleter; } } }
50 namespace Aspose { namespace Words { namespace Revisions { class BookmarkMover; } } }
51 namespace Aspose { namespace Words { namespace Validation { class ShapeValidator; } } }
52 namespace Aspose { namespace Words { namespace Layout { namespace Core { class WarningGenerator; } } } }
53 namespace Aspose { namespace Words { namespace Layout { namespace Core { class DocumentLayout; } } } }
54 namespace Aspose { namespace Words { namespace Fields { class FieldOldResultNodeCollection; } } }
55 namespace Aspose { namespace Words { namespace Fields { class FieldReplacer; } } }
56 namespace Aspose { namespace Words { namespace Markup { class SdtContentUpdater; } } }
57 namespace Aspose { namespace Words { namespace Tables { class FixedGridCalculator; } } }
58 namespace Aspose { namespace Words { namespace RW { namespace Odt { namespace Writer { class OdtTrackedChangesWriter; } } } } }
59 namespace Aspose { namespace Words { namespace RW { namespace Docx { namespace Reader { class DocxAltChunkReader; } } } } }
60 namespace Aspose { namespace Words { namespace Fields { class FieldToc; } } }
61 namespace Aspose { namespace Words { namespace Fields { class ParagraphTocEntry; } } }
62 namespace Aspose { namespace Words { namespace Fields { class TocEntryExtractor; } } }
63 namespace Aspose { namespace Words { namespace Markup { class SdtContentHelper; } } }
64 namespace Aspose { namespace Words { namespace Markup { class StructuredDocumentTag; } } }
65 namespace Aspose { namespace Words { namespace Math { class OfficeMath; } } }
66 namespace Aspose { namespace Words { class NodeCopier; } }
67 namespace Aspose { namespace Words { class NodeRemover; } }
68 namespace Aspose { namespace Words { class NodeTextCollector; } }
69 namespace Aspose { namespace Words { class NodeRangeVisitingHelper; } }
70 namespace Aspose { namespace Words { class NodeUtil; } }
71 namespace Aspose { namespace Words { namespace Layout { class AttributeConverter; } } }
72 namespace Aspose { namespace Words { namespace Layout { class DocumentSpanConverter; } } }
73 namespace Aspose { namespace Words { class Bookmark; } }
74 namespace Aspose { namespace Words { namespace BuildingBlocks { class BuildingBlock; } } }
75 namespace Aspose { namespace Words { class DocumentBase; } }
76 namespace Aspose { namespace Words { namespace Fields { class NodeRangeResultApplier; } } }
77 namespace Aspose { namespace Words { class FootnoteSeparator; } }
78 namespace Aspose { namespace Words { class DocumentBuilder; } }
79 namespace Aspose { namespace Words { class WordCounter; } }
80 namespace Aspose { namespace Words { namespace Drawing { class ShapeBase; } } }
81 namespace Aspose { namespace Words { namespace RW { namespace Html { namespace Writer { class HtmlCoreWriter; } } } } }
82 namespace Aspose { namespace Words { namespace RW { namespace Wml { namespace Writer { class WmlEquationXmlWriter; } } } } }
83 namespace Aspose { namespace Words { namespace RW { class MarkupResolver; } } }
84 namespace Aspose { namespace Words { class InlineStory; } }
85 namespace Aspose { namespace Words { class FootnoteSeparatorCollection; } }
86 namespace Aspose { namespace Words { namespace Markup { class SmartTag; } } }
87 namespace Aspose { namespace Words { class Story; } }
88 namespace Aspose { namespace Words { class Section; } }
89 namespace Aspose { namespace Words { namespace TableLayout { class TableLayouter; } } }
90 namespace Aspose { namespace Words { namespace Tables { class Cell; } } }
91 namespace Aspose { namespace Words { namespace Tables { class Row; } } }
92 namespace Aspose { namespace Words { namespace Tables { class Table; } } }
93 namespace Aspose { namespace Words { class Paragraph; } }
94 namespace Aspose { namespace Words { namespace RW { namespace Docx { namespace Reader { class DocxDocumentReaderBase; } } } } }
95 namespace Aspose { namespace Words { namespace RW { namespace Nrx { namespace Reader { class NrxDocumentReaderBase; } } } } }
96 namespace Aspose { namespace Words { namespace RW { namespace Html { namespace Writer { class HtmlDocumentSplitter; } } } } }
97 namespace Aspose { namespace Words { namespace RW { namespace Odt { namespace Reader { class OdtTextIndexesReader; } } } } }
98 namespace Aspose { namespace Words { namespace RW { namespace Odt { namespace Reader { class OdtTableCellReader; } } } } }
99 namespace Aspose { namespace Words { namespace RW { namespace Odt { namespace Reader { class OdtTableReader; } } } } }
100 namespace Aspose { namespace Words { namespace RW { namespace Vml { class VmlShapeReader; } } } }
101 namespace Aspose { namespace Words { namespace RW { namespace Odt { namespace Reader { class OdtParagraphReader; } } } } }
102 namespace Aspose { namespace Words { namespace RW { namespace Wml { namespace Reader { class WmlInlineReader; } } } } }
103 namespace Aspose { namespace Words { class WordUtil; } }
104 namespace Aspose { namespace Words { namespace RW { namespace Docx { namespace Reader { class DocxStoryReader; } } } } }
105 namespace Aspose { namespace Words { namespace RW { namespace Doc { namespace Escher { class EsShapeFiler; } } } } }
106 namespace Aspose { namespace Words { namespace RW { namespace Doc { namespace Reader { class ModelBuilder; } } } } }
107 namespace Aspose { namespace Words { namespace RW { namespace Html { namespace Reader { class HtmlTableReader; } } } } }
108 namespace Aspose { namespace Words { namespace RW { namespace Rtf { namespace Reader { class RtfModelBuilder; } } } } }
109 namespace Aspose { namespace Words { namespace RW { namespace Rtf { namespace Writer { class RtfDocPrWriter; } } } } }
110 namespace Aspose { namespace Words { namespace RW { namespace Wml { namespace Reader { class WmlBodyReader; } } } } }
111 namespace Aspose { namespace Words { class INodeCloningListener; } }
112 namespace Aspose { namespace Words { class NodeList; } }
113 namespace Aspose { namespace Words { class DocumentVisitor; } }
114 
115 namespace Aspose {
116 
117 namespace Words {
118 
119 
120 /// <summary>
121 /// Base class for nodes that can contain other nodes.
122 /// </summary>
123 /// <remarks>
124 /// <p>A document is represented as a tree of nodes, similar to DOM or XmlDocument.</p>
125 /// <p>For more info see the Composite design pattern.</p>
126 /// <p>The <see cref="Aspose::Words::CompositeNode" /> class:</p>
127 /// <list type="bullet">
128 /// <item>Provides access to the child nodes.</item>
129 /// <item>Implements Composite operations such as insert and remove children.</item>
130 /// <item>Provides methods for XPath navigation.</item>
131 /// </list>
132 /// </remarks>
133 ///
134 class CompositeNode : public Aspose::Words::Node, public System::Collections::Generic::IEnumerable<System::SharedPtr<Aspose::Words::Node>>, public Aspose::Words::INodeCollection
135 {
136  typedef CompositeNode ThisType;
137  typedef Aspose::Words::Node BaseType;
138  typedef System::Collections::Generic::IEnumerable<System::SharedPtr<Aspose::Words::Node>> BaseType1;
139  typedef Aspose::Words::INodeCollection BaseType2;
140 
141  typedef ::System::BaseTypesInfo<BaseType, BaseType1, BaseType2> ThisTypeBaseTypesInfo;
142  ASPOSE_WORDS_SHARED_RTTI_INFO_DECL();
143 
145  friend class Aspose::Words::Layout::Core::LayoutShapeDrawingMLAdapter;
146  friend class Aspose::Words::Layout::Core::LayoutShapeVMLAdapter;
147  friend class Aspose::Words::ImportInfoCollector;
148  friend class Aspose::Words::AnnotationUtil;
149  friend class Aspose::Words::StyleSeparatorInserter;
150  friend class Aspose::Words::Fields::FieldQuoteUpdater;
151  friend class Aspose::Words::Fields::FieldIncludeTextUpdater;
152  friend class Aspose::Words::NodeCollection;
153  friend class Aspose::Words::Layout::ParagraphPrConverter;
154  friend class Aspose::Words::Comparison::ComparerNodeUtil;
155  friend class Aspose::Words::Comparison::ComparerIndexer;
156  friend class Aspose::Words::NodeIndexer;
157  friend class Aspose::Words::DocumentInserter;
158  friend class Aspose::Words::Replacing::FindReplaceIndexer;
159  friend class Aspose::Words::Tables::TableMerger;
160  friend class Aspose::Words::RW::Docx::Writer::DocxFieldsWriter;
161  friend class Aspose::Words::RW::InlineMarkupResolver;
162  friend class Aspose::Words::NodeEnumerator;
163  friend class Aspose::Words::RW::Nrx::Reader::NrxRunReaderBase;
164  friend class Aspose::Words::Replacing::FindReplace;
165  friend class Aspose::Words::RevisionGroup;
166  friend class Aspose::Words::Revisions::RevisionUtil;
167  friend class Aspose::Words::Revisions::BookmarkDeleter;
168  friend class Aspose::Words::Revisions::BookmarkMover;
169  friend class Aspose::Words::Validation::ShapeValidator;
170  friend class Aspose::Words::Layout::Core::WarningGenerator;
171  friend class Aspose::Words::Layout::Core::DocumentLayout;
172  friend class Aspose::Words::Fields::FieldOldResultNodeCollection;
173  friend class Aspose::Words::Fields::FieldReplacer;
174  friend class Aspose::Words::Markup::SdtContentUpdater;
175  friend class Aspose::Words::Tables::FixedGridCalculator;
176  friend class Aspose::Words::RW::Odt::Writer::OdtTrackedChangesWriter;
177  friend class Aspose::Words::RW::Docx::Reader::DocxAltChunkReader;
178  friend class Aspose::Words::Fields::FieldToc;
179  friend class Aspose::Words::Fields::ParagraphTocEntry;
180  friend class Aspose::Words::Fields::TocEntryExtractor;
181  friend class Aspose::Words::Markup::SdtContentHelper;
182  friend class Aspose::Words::Markup::StructuredDocumentTag;
183  friend class Aspose::Words::Math::OfficeMath;
184  friend class Aspose::Words::NodeCopier;
185  friend class Aspose::Words::NodeRemover;
186  friend class Aspose::Words::NodeTextCollector;
187  friend class Aspose::Words::NodeRangeVisitingHelper;
188  friend class Aspose::Words::NodeUtil;
189  friend class Aspose::Words::Layout::AttributeConverter;
190  friend class Aspose::Words::Layout::DocumentSpanConverter;
191  friend class Aspose::Words::Bookmark;
192  friend class Aspose::Words::BuildingBlocks::BuildingBlock;
193  friend class Aspose::Words::DocumentBase;
194  friend class Aspose::Words::Fields::NodeRangeResultApplier;
195  friend class Aspose::Words::FootnoteSeparator;
196  friend class Aspose::Words::DocumentBuilder;
197  friend class Aspose::Words::WordCounter;
198  friend class Aspose::Words::Drawing::ShapeBase;
199  friend class Aspose::Words::RW::Html::Writer::HtmlCoreWriter;
200  friend class Aspose::Words::RW::Wml::Writer::WmlEquationXmlWriter;
201  friend class Aspose::Words::RW::MarkupResolver;
202  friend class Aspose::Words::InlineStory;
203  friend class Aspose::Words::FootnoteSeparatorCollection;
204  friend class Aspose::Words::Markup::SmartTag;
205  friend class Aspose::Words::Story;
206  friend class Aspose::Words::Section;
207  friend class Aspose::Words::TableLayout::TableLayouter;
208  friend class Aspose::Words::Tables::Cell;
209  friend class Aspose::Words::Tables::Row;
210  friend class Aspose::Words::Tables::Table;
211  friend class Aspose::Words::Paragraph;
212  friend class Aspose::Words::RW::Docx::Reader::DocxDocumentReaderBase;
213  friend class Aspose::Words::RW::Nrx::Reader::NrxDocumentReaderBase;
214  friend class Aspose::Words::RW::Html::Writer::HtmlDocumentSplitter;
215  friend class Aspose::Words::RW::Odt::Reader::OdtTextIndexesReader;
216  friend class Aspose::Words::RW::Odt::Reader::OdtTableCellReader;
217  friend class Aspose::Words::RW::Odt::Reader::OdtTableReader;
218  friend class Aspose::Words::RW::Vml::VmlShapeReader;
219  friend class Aspose::Words::RW::Odt::Reader::OdtParagraphReader;
220  friend class Aspose::Words::RW::Wml::Reader::WmlInlineReader;
221  friend class Aspose::Words::WordUtil;
222  friend class Aspose::Words::RW::Docx::Reader::DocxStoryReader;
223  friend class Aspose::Words::RW::Doc::Escher::EsShapeFiler;
224  friend class Aspose::Words::RW::Doc::Reader::ModelBuilder;
225  friend class Aspose::Words::RW::Html::Reader::HtmlTableReader;
226  friend class Aspose::Words::RW::Rtf::Reader::RtfModelBuilder;
227  friend class Aspose::Words::RW::Rtf::Writer::RtfDocPrWriter;
228  friend class Aspose::Words::RW::Wml::Reader::WmlBodyReader;
229 
230 public:
231  using Aspose::Words::Node::Clone;
232 
233 public:
234 
235  /// <summary>
236  /// Returns true as this node can have child nodes.
237  /// </summary>
238  virtual ASPOSE_WORDS_SHARED_API bool get_IsComposite();
239  /// <summary>
240  /// Returns true if this node has any child nodes.
241  /// </summary>
242  ASPOSE_WORDS_SHARED_API bool get_HasChildNodes();
243  /// <summary>
244  /// Gets all immediate child nodes of this node.
245  /// </summary>
246  /// <remarks>
247  /// <p>Note, <see cref="Aspose::Words::CompositeNode::get_ChildNodes" /> is equivalent to calling <c>GetChildNodes(NodeType.Any, false)</c>
248  /// and creates and returns a new collection every time it is accessed.</p>
249  /// <p>If there are no child nodes, this property returns an empty collection.</p>
250  /// </remarks>
251  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::NodeCollection> get_ChildNodes();
252  /// <summary>
253  /// Gets the first child of the node.
254  /// </summary>
255  /// <remarks>
256  /// If there is no first child node, a null is returned.
257  /// </remarks>
258  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::Node> get_FirstChild() const;
259  /// <summary>
260  /// Gets the last child of the node.
261  /// </summary>
262  /// <remarks>
263  /// If there is no last child node, a null is returned.
264  /// </remarks>
265  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::Node> get_LastChild() const;
266  /// <summary>
267  /// Gets the number of immediate children of this node.
268  /// </summary>
269  ASPOSE_WORDS_SHARED_API int32_t get_Count();
270  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::CompositeNode> get_Container();
271 
272  virtual ASPOSE_WORDS_SHARED_API ~CompositeNode();
273 
274  /// <summary>
275  /// Gets the text of this node and of all its children.
276  /// </summary>
277  /// <remarks>
278  /// <p>The returned string includes all control and special characters as described in <see cref="Aspose::Words::ControlChar" />.</p>
279  /// </remarks>
280  virtual ASPOSE_WORDS_SHARED_API System::String GetText();
281  ///
282  /// <summary>
283  /// Returns a live collection of child nodes that match the specified type.
284  /// </summary>
285  /// <remarks>
286  /// <p>The collection of nodes returned by this method is always live.</p>
287  /// <remarks>
288  /// <p>A live collection is always in sync with the document. For example, if you
289  /// selected all sections in a document and enumerate through the collection
290  /// deleting the sections, the section is removed from the collection immediately
291  /// when it is removed from the document.</p>
292  /// </remarks>
293  /// </remarks>
294  /// <param name="nodeType">Specifies the type of nodes to select.</param>
295  /// <param name="isDeep">True to select from all child nodes recursively.
296  /// False to select only among immediate children. </param>
297  /// <returns>A live collection of child nodes of the specified type.</returns>
298  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::NodeCollection> GetChildNodes(Aspose::Words::NodeType nodeType, bool isDeep);
299  /// <summary>
300  /// Returns an Nth child node that matches the specified type.
301  /// </summary>
302  /// <remarks>
303  /// <p>If index is out of range, a null is returned.</p>
304  /// </remarks>
305  /// <param name="nodeType">Specifies the type of the child node.</param>
306  /// <param name="index">Zero based index of the child node to select.
307  /// Negative indexes are also allowed and indicate access from the end,
308  /// that is -1 means the last node.</param>
309  /// <param name="isDeep">True to select from all child nodes recursively.
310  /// False to select only among immediate children. See remarks for more info.</param>
311  /// <returns>The child node that matches the criteria or null if no matching node is found.</returns>
312  /// <remarks>Note that markup nodes (<see cref="Aspose::Words::NodeType::StructuredDocumentTag" /> and <see cref="Aspose::Words::NodeType::SmartTag" />)
313  /// are traversed even when isDeep = false and GetChild is invoked for non-markup node type. For example if the first run in a para
314  /// is wrapped in a StructuredDocumentTag, it will still be returned by GetChild(NodeType.Run, 0, false).</remarks>
315  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::Node> GetChild(Aspose::Words::NodeType nodeType, int32_t index, bool isDeep);
316  /// <summary>
317  /// Selects a list of nodes matching the XPath expression.
318  /// </summary>
319  /// <remarks>
320  /// <p>Only expressions with element names are supported at the moment. Expressions
321  /// that use attribute names are not supported.</p>
322  /// </remarks>
323  /// <param name="xpath">The XPath expression.</param>
324  /// <returns>A list of nodes matching the XPath query.</returns>
325  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::NodeList> SelectNodes(System::String xpath);
326  /// <summary>
327  /// Selects the first Node that matches the XPath expression.
328  /// </summary>
329  /// <remarks>
330  /// <p>Only expressions with element names are supported at the moment. Expressions
331  /// that use attribute names are not supported.</p>
332  /// </remarks>
333  /// <param name="xpath">The XPath expression.</param>
334  /// <returns>The first Node that matches the XPath query or null if no matching node is found.</returns>
335  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::Node> SelectSingleNode(System::String xpath);
336  /// <summary>
337  /// Provides support for the for each style iteration over the child nodes of this node.
338  /// </summary>
339  ASPOSE_WORDS_SHARED_API System::SharedPtr<System::Collections::Generic::IEnumerator<System::SharedPtr<Aspose::Words::Node>>> GetEnumerator();
340  /// <summary>
341  /// Adds the specified node to the end of the list of child nodes for this node.
342  /// </summary>
343  /// <remarks>
344  /// <p>If the newChild is already in the tree, it is first removed.</p>
345  /// <p>If the node being inserted was created from another document, you should use
346  /// <see cref="Aspose::Words::DocumentBase::ImportNode(System::SharedPtr&lt;Aspose::Words::Node&gt;, bool, Aspose::Words::ImportFormatMode)" /> to import the node to the current document.
347  /// The imported node can then be inserted into the current document.</p>
348  /// </remarks>
349  /// <param name="newChild">The node to add.</param>
350  /// <returns>The node added.</returns>
351  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::Node> AppendChild(System::SharedPtr<Aspose::Words::Node> newChild);
352  /// <summary>
353  /// Adds the specified node to the beginning of the list of child nodes for this node.
354  /// </summary>
355  /// <remarks>
356  /// <p>If the newChild is already in the tree, it is first removed.</p>
357  /// <p>If the node being inserted was created from another document, you should use
358  /// <see cref="Aspose::Words::DocumentBase::ImportNode(System::SharedPtr&lt;Aspose::Words::Node&gt;, bool, Aspose::Words::ImportFormatMode)" /> to import the node to the current document.
359  /// The imported node can then be inserted into the current document.</p>
360  /// </remarks>
361  /// <param name="newChild">The node to add.</param>
362  /// <returns>The node added.</returns>
363  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::Node> PrependChild(System::SharedPtr<Aspose::Words::Node> newChild);
364  /// <summary>
365  /// Inserts the specified node immediately after the specified reference node.
366  /// </summary>
367  /// <remarks>
368  /// <p>If refChild is null, inserts newChild at the beginning of the list of child nodes.</p>
369  /// </remarks>
370  /// <remarks>
371  /// <p>If the newChild is already in the tree, it is first removed.</p>
372  /// <p>If the node being inserted was created from another document, you should use
373  /// <see cref="Aspose::Words::DocumentBase::ImportNode(System::SharedPtr&lt;Aspose::Words::Node&gt;, bool, Aspose::Words::ImportFormatMode)" /> to import the node to the current document.
374  /// The imported node can then be inserted into the current document.</p>
375  /// </remarks>
376  /// <param name="newChild">The Node to insert.</param>
377  /// <param name="refChild">The Node that is the reference node. The newNode is placed after the refNode. </param>
378  /// <returns>The inserted node.</returns>
379  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::Node> InsertAfter(System::SharedPtr<Aspose::Words::Node> newChild, System::SharedPtr<Aspose::Words::Node> refChild);
380  /// <summary>
381  /// Inserts the specified node immediately before the specified reference node.
382  /// </summary>
383  /// <remarks>
384  /// <p>If refChild is null, inserts newChild at the end of the list of child nodes.</p>
385  /// </remarks>
386  /// <remarks>
387  /// <p>If the newChild is already in the tree, it is first removed.</p>
388  /// <p>If the node being inserted was created from another document, you should use
389  /// <see cref="Aspose::Words::DocumentBase::ImportNode(System::SharedPtr&lt;Aspose::Words::Node&gt;, bool, Aspose::Words::ImportFormatMode)" /> to import the node to the current document.
390  /// The imported node can then be inserted into the current document.</p>
391  /// </remarks>
392  /// <param name="newChild">The Node to insert.</param>
393  /// <param name="refChild">The Node that is the reference node. The newChild is placed before this node.</param>
394  /// <returns>The inserted node.</returns>
395  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::Node> InsertBefore(System::SharedPtr<Aspose::Words::Node> newChild, System::SharedPtr<Aspose::Words::Node> refChild);
396  /// <summary>
397  /// Removes the specified child node.
398  /// </summary>
399  /// <remarks>
400  /// <p>The parent of oldChild is set to null after the node is removed.</p>
401  /// </remarks>
402  /// <param name="oldChild">The node to remove.</param>
403  /// <returns>The removed node.</returns>
404  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::Node> RemoveChild(System::SharedPtr<Aspose::Words::Node> oldChild);
405  /// <summary>
406  /// Removes all the child nodes of the current node.
407  /// </summary>
408  ASPOSE_WORDS_SHARED_API void RemoveAllChildren();
409  /// <summary>
410  /// Removes all <see cref="Aspose::Words::Markup::SmartTag" /> descendant nodes of the current node.
411  /// </summary>
412  /// <remarks>This method does not remove the content of the smart tags.</remarks>
413  ASPOSE_WORDS_SHARED_API void RemoveSmartTags();
414  /// <summary>
415  /// Returns the index of the specified child node in the child node array.
416  /// </summary>
417  /// <remarks>
418  /// Returns -1 if the node is not found in the child nodes.
419  /// </remarks>
420  ASPOSE_WORDS_SHARED_API int32_t IndexOf(System::SharedPtr<Aspose::Words::Node> child);
421  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::Node> GetNextMatchingNode(System::SharedPtr<Aspose::Words::Node>& curNode);
422 
423 protected:
424 
425  bool get_HasNonMarkupDescendants();
426  bool get_HasOneChildOnly();
427  System::SharedPtr<Aspose::Words::Node> get_FirstNonMarkupDescendant();
428  System::SharedPtr<Aspose::Words::Node> get_LastNonMarkupDescendant();
429  System::SharedPtr<Aspose::Words::CompositeNode> get_FirstNonMarkupCompositeDescendant();
430  System::SharedPtr<Aspose::Words::CompositeNode> get_LastNonMarkupCompositeDescendant();
431  System::SharedPtr<Aspose::Words::Node> get_FirstNonAnnotationChild();
432  System::SharedPtr<Aspose::Words::Node> get_LastNonAnnotationChild();
433 
434  ASPOSE_WORDS_SHARED_API CompositeNode();
435  ASPOSE_WORDS_SHARED_API CompositeNode(System::SharedPtr<Aspose::Words::DocumentBase> doc);
436 
437  ASPOSE_WORDS_SHARED_API void CoreRemoveSelfOnly();
438  bool HasInlineNodes();
439  virtual ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::Node> Clone(bool isCloneChildren, System::SharedPtr<Aspose::Words::INodeCloningListener> cloningListener);
440  virtual ASPOSE_WORDS_SHARED_API void GetTextToBuilder(System::SharedPtr<System::Text::StringBuilder> builder);
441  System::SharedPtr<Aspose::Words::NodeCollection> GetChildNodes(System::ArrayPtr<Aspose::Words::NodeType> nodeTypes, bool isDeep);
442  System::SharedPtr<Aspose::Words::Node> AppendChildForLoad(System::SharedPtr<Aspose::Words::Node> newChild);
443  void InsertBefore(System::SharedPtr<Aspose::Words::Node> start, System::SharedPtr<Aspose::Words::Node> end, System::SharedPtr<Aspose::Words::Node> refNode);
444  void InsertAfter(System::SharedPtr<Aspose::Words::Node> start, System::SharedPtr<Aspose::Words::Node> end, System::SharedPtr<Aspose::Words::Node> refNode);
445  int32_t IndexOfChildByDescendant(System::SharedPtr<Aspose::Words::Node> descendant, bool skipAnnotations);
446  virtual ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::Node> GetNodeFromPos(int32_t position);
447  virtual ASPOSE_WORDS_SHARED_API int32_t GetTextLength();
448  virtual ASPOSE_WORDS_SHARED_API System::String GetEndText();
449  System::String GetChildrenText();
450  ASPOSE_WORDS_SHARED_API bool AcceptCore(System::SharedPtr<Aspose::Words::DocumentVisitor> visitor);
451  virtual Aspose::Words::VisitorAction AcceptStart(System::SharedPtr<Aspose::Words::DocumentVisitor> visitor) = 0;
452  virtual Aspose::Words::VisitorAction AcceptEnd(System::SharedPtr<Aspose::Words::DocumentVisitor> visitor) = 0;
453  ASPOSE_WORDS_SHARED_API bool AcceptChildren(System::SharedPtr<Aspose::Words::DocumentVisitor> visitor);
454  virtual bool CanInsert(System::SharedPtr<Aspose::Words::Node> newChild) = 0;
455  System::SharedPtr<Aspose::Words::Node> Insert(System::SharedPtr<Aspose::Words::Node> newChild, System::SharedPtr<Aspose::Words::Node> refChild, bool isAfter);
456  ASPOSE_WORDS_SHARED_API System::Object::shared_members_type GetSharedMembers() override;
457 
458 private:
459 
460  System::SharedPtr<Aspose::Words::Node> mFirstChild;
461  System::SharedPtr<Aspose::Words::Node> mLastChild;
462 
463  void GetChildrenTextInternal(System::SharedPtr<System::Text::StringBuilder> builder);
464  void InsertAfterCore(System::SharedPtr<Aspose::Words::Node> newChild, System::SharedPtr<Aspose::Words::Node> prevChild);
465  void InsertBeforeCore(System::SharedPtr<Aspose::Words::Node> newChild, System::SharedPtr<Aspose::Words::Node> nextChild);
466  System::SharedPtr<Aspose::Words::Node> RemoveChildCore(System::SharedPtr<Aspose::Words::Node> oldChild);
467 
468 };
469 
470 }
471 }
Represents a collection of nodes matching an XPath query executed using the Aspose::Words::CompositeN...
Definition: NodeList.h:42
Definition: DocumentVisitor.h:47
Definition: IFontData.h:19
Definition: CompareOptions.h:16
Definition: Hyphenation.h:18
Definition: Border.h:47
Represents a collection of nodes of a specific type.
Definition: NodeCollection.h:75
Definition: ShapeBase.h:51
Base class for nodes that can contain other nodes.
Definition: CompositeNode.h:134
Definition: Border.h:65
Definition: BuildingBlock.h:27
#define FRIEND_FUNCTION_System_MakeObject
Macro to befriend MakeObject function.
Definition: smart_ptr.h:1366
VisitorAction
Allows the visitor to control the enumeration of nodes.
Definition: VisitorAction.h:23