Body.h
1 //////////////////////////////////////////////////////////////////////////
2 // Copyright 2001-2020 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 "Aspose.Words.Cpp/Model/Sections/Story.h"
12 
13 namespace Aspose { namespace Words { class Section; } }
14 namespace Aspose { namespace Words { class DocumentBase; } }
15 namespace Aspose { namespace Words { class DocumentVisitor; } }
16 namespace Aspose { namespace Words { enum class VisitorAction; } }
17 
18 namespace Aspose {
19 
20 namespace Words {
21 
22 
23 /// <summary>
24 /// Represents a container for the main text of a section.
25 /// </summary>
26 /// <remarks>
27 /// <p><b>Body</b> can contain <b>Paragraph</b> and <b>Table</b> child nodes.</p>
28 /// <p><b>Body</b> is a section-level node and can only be a child of <b>Section</b>.
29 /// There can only be one <b>Body</b> in a <b>Section</b>.</p>
30 /// <p>A minimal valid <b>Body</b> needs to contain at least one <b>Paragraph</b>.</p>
31 /// </remarks>
32 class Body : public Aspose::Words::Story
33 {
34  typedef Body ThisType;
35  typedef Aspose::Words::Story BaseType;
36 
37  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
38  ASPOSE_WORDS_SHARED_RTTI_INFO_DECL();
39 
40 public:
41 
42  /// <summary>
43  /// Returns <b>NodeType.Body</b>.
44  /// </summary>
45  virtual ASPOSE_WORDS_SHARED_API Aspose::Words::NodeType get_NodeType() const;
46  /// <summary>
47  /// Gets the parent section of this story.
48  /// </summary>
49  /// <remarks>
50  /// <p><b>ParentSection</b> is equivalent to <c>(Section)ParentNode</c>.</p>
51  /// </remarks>
52  ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::Section> get_ParentSection();
53 
54  /// <summary>
55  /// Initializes a new instance of the <b>Body</b> class.
56  /// </summary>
57  /// <remarks>
58  /// <p>When <b>Body</b> is created, it belongs to the specified document, but is not
59  /// yet part of the document and <b>ParentNode</b> is null.</p>
60  /// <p>To append <b>Body</b> to a <b>Section</b> use Section.InsertAfter or Section.InsertBefore.</p>
61  /// </remarks>
62  /// <param name="doc">The owner document.</param>
63  ASPOSE_WORDS_SHARED_API Body(System::SharedPtr<Aspose::Words::DocumentBase> doc);
64 
65  /// <summary>
66  /// Accepts a visitor.
67  /// </summary><remarks>
68  /// <p>Enumerates over this node and all of its children. Each node calls a corresponding method on DocumentVisitor.</p>
69  /// <p>For more info see the Visitor design pattern.</p>
70  /// </remarks><param name="visitor">The visitor that will visit the nodes.</param><returns>True if all nodes were visited; false if DocumentVisitor stopped the operation before visiting all nodes.</returns>
71  /// <remarks>
72  /// Calls DocumentVisitor.VisitBodyStart, then calls Accept for all child nodes of the section
73  /// and calls DocumentVisitor.VisitBodyEnd at the end.
74  /// </remarks>
75  virtual ASPOSE_WORDS_SHARED_API bool Accept(System::SharedPtr<Aspose::Words::DocumentVisitor> visitor);
76  /// <summary>
77  /// If the last child is not a paragraph, creates and appends one empty paragraph.
78  /// </summary>
79  ASPOSE_WORDS_SHARED_API void EnsureMinimum();
80 
81 protected:
82 
83  virtual ASPOSE_WORDS_SHARED_API Aspose::Words::VisitorAction AcceptStart(System::SharedPtr<Aspose::Words::DocumentVisitor> visitor);
84  virtual ASPOSE_WORDS_SHARED_API Aspose::Words::VisitorAction AcceptEnd(System::SharedPtr<Aspose::Words::DocumentVisitor> visitor);
85 
86  virtual ASPOSE_WORDS_SHARED_API ~Body();
87 
88 private:
89 
90  ThisType* CppMemberwiseClone() ASPOSE_CONST override { return new ThisType(*this); }
91 
92 };
93 
94 }
95 }
Definition: IFontData.h:20
VisitorAction
Allows the visitor to control the enumeration of nodes.
Definition: VisitorAction.h:23