Aspose::Words::Lists::ListCollection Class Reference

Stores and manages formatting of bulleted and numbered lists used in a document. More...

#include "Aspose.Words.Cpp/Model/Lists/ListCollection.h"

Inherits System::Collections::Generic::IEnumerable< System::SharedPtr< Aspose::Words::Lists::List > >.

Public Member Functions

int32_t get_Count ()
 Gets the count of numbered and bulleted lists in the document. More...
 
System::SharedPtr< Aspose::Words::DocumentBaseget_Document () const
 Gets the owner document. More...
 
System::SharedPtr< System::Collections::Generic::IEnumerator< System::SharedPtr< Aspose::Words::Lists::List > > > GetEnumerator ()
 Gets the enumerator object that will enumerate lists in the document. More...
 
System::SharedPtr< Aspose::Words::Lists::ListAdd (Aspose::Words::Lists::ListTemplate listTemplate)
 Creates a new list based on a predefined template and adds it to the collection of lists in the document. More...
 
System::SharedPtr< Aspose::Words::Lists::ListAdd (System::SharedPtr< Aspose::Words::Style > listStyle)
 Creates a new list that references a list style and adds it to the collection of lists in the document. More...
 
System::SharedPtr< Aspose::Words::Lists::ListAddCopy (System::SharedPtr< Aspose::Words::Lists::List > srcList)
 Creates a new list by copying the specified list and adding it to the collection of lists in the document. More...
 
System::SharedPtr< Aspose::Words::Lists::ListGetListByListId (int32_t listId)
 Gets a list by a list identifier. More...
 
System::SharedPtr< Aspose::Words::Lists::Listidx_get (int32_t index)
 Gets a list by index. More...
 
- Public Member Functions inherited from System::Object
 Object ()
 Creates object. Initializes all internal data structures. More...
 
virtual ~Object ()
 Destroys object. Frees all internal data structures. More...
 
 Object (Object const &x)
 Copy constructor. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
Objectoperator= (Object const &x)
 Assignment operator. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
ObjectSharedRefAdded ()
 Increments shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int SharedRefRemovedSafe ()
 Decrements and returns shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int RemovedSharedRefs (int count)
 Decreases shared reference count by specified value. More...
 
Detail::SmartPtrCounter * WeakRefAdded ()
 Increments weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
void WeakRefRemoved ()
 Decrements weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
Detail::SmartPtrCounter * GetCounter ()
 Gets reference counter data structure associated with the object. More...
 
int SharedCount () const
 Gets current value of shared refernce counter. More...
 
void Lock ()
 Implements C# lock() statement locking. Call directly or use LockContext sentry object. More...
 
void Unlock ()
 Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. More...
 
virtual bool Equals (ptr obj)
 Compares objects using C# Object.Equals semantics. More...
 
virtual int GetHashCode () const
 Analog of C# Object.GetHashCode() method. Enables hashing of custom objects. More...
 
virtual String ToString () ASPOSE_CONST
 Analog of C# Object.ToString() method. Enables converting custom objects to string. More...
 
virtual ptr MemberwiseClone () const
 Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. More...
 
virtual const TypeInfoGetType () const
 Gets actual type of object. Analog of C# System.Object.GetType() call. More...
 
virtual bool Is (const TypeInfo &targetType) const
 Check if object represents an instance of type described by targetType. Analog of C# 'is' operator. More...
 
virtual void SetTemplateWeakPtr (unsigned int argument)
 Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. More...
 

Additional Inherited Members

- Public Types inherited from System::Collections::Generic::IEnumerable< System::SharedPtr< Aspose::Words::Lists::List > >
typedef IEnumerator< System::SharedPtr< Aspose::Words::Lists::List > > IEnumeratorType
 Enumerator type. More...
 
- Public Types inherited from System::Object
typedef SmartPtr< Objectptr
 Alias for smart pointer type. More...
 
typedef System::Details::SharedMembersType shared_members_type
 structure to keep list of shared pointers contained in object. More...
 
- Static Public Member Functions inherited from System::Object
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 Reference-compares value type object with nullptr. More...
 
template<typename T1 , typename T2 >
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares reference type objects in C# style. More...
 
template<typename T1 , typename T2 >
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares value type objects in C# style. More...
 
static const TypeInfoType ()
 Impleemnts C# typeof(System.Object) construct. More...
 
template<>
bool Equals (float const &objA, float const &objB)
 
template<>
bool Equals (double const &objA, double const &objB)
 
template<>
bool ReferenceEquals (String const &str, std::nullptr_t)
 
template<>
bool ReferenceEquals (String const &str1, String const &str2)
 

Detailed Description

Stores and manages formatting of bulleted and numbered lists used in a document.

A list in a Microsoft Word document is a set of list formatting properties. The formatting of the lists is stored in the Aspose::Words::Lists::ListCollection collection separately from the paragraphs of text.

You do not create objects of this class. There is always only one Aspose::Words::Lists::ListCollection object per document and it is accessible via the Aspose::Words::DocumentBase::get_Lists property.

To create a new list based on a predefined list template or based on a list style, use the Aspose::Words::Lists::ListCollection::Add(System::SharedPtr<Aspose::Words::Style>) method.

To create a new list with formatting identical to an existing list, use the Aspose::Words::Lists::ListCollection::AddCopy(System::SharedPtr<Aspose::Words::Lists::List>) method.

To make a paragraph bulleted or numbered, you need to apply list formatting to a paragraph by assigning a Aspose::Words::Lists::List object to the Aspose::Words::ListFormat::get_List property of Aspose::Words::ListFormat.

To remove list formatting from a paragraph, use the Aspose::Words::ListFormat::RemoveNumbers method.

If you know a bit about WordprocessingML, then you might know it defines separate concepts for "list" and "list definition". This exactly corresponds to how list formatting is stored in a Microsoft Word document at the low level. List definition is like a "schema" and list is like an instance of a list definition.

To simplify programming model, Aspose.Words hides the distinction between list and list definition in much the same way like Microsoft Word hides this in its user interface. This allows you to concentrate more on how you want your document to look like, rather than building low-level objects to satisfy requirements of the Microsoft Word file format.

It is not possible to delete lists once they are created in the current version of Aspose.Words. This is similar to Microsoft Word where user does not have explicit control over list definitions.

See also
Aspose::Words::Lists::List, Aspose::Words::Lists::ListLevel, Aspose::Words::ListFormat

Member Function Documentation

◆ Add() [1/2]

System::SharedPtr<Aspose::Words::Lists::List> Aspose::Words::Lists::ListCollection::Add ( Aspose::Words::Lists::ListTemplate  listTemplate)

Creates a new list based on a predefined template and adds it to the collection of lists in the document.

Parameters
listTemplateThe template of the list.
Returns
The newly created list.

Aspose.Words list templates correspond to the 21 list templates available in the Bullets and Numbering dialog box in Microsoft Word 2003.

All lists created using this method have 9 list levels.

◆ Add() [2/2]

System::SharedPtr<Aspose::Words::Lists::List> Aspose::Words::Lists::ListCollection::Add ( System::SharedPtr< Aspose::Words::Style listStyle)

Creates a new list that references a list style and adds it to the collection of lists in the document.

Parameters
listStyleThe list style.
Returns
The newly created list.

The newly created list references the list style. If you change the properties of the list style, it is reflected in the properties of the list. Vice versa, if you change the properties of the list, it is reflected in the properties of the list style.

◆ AddCopy()

System::SharedPtr<Aspose::Words::Lists::List> Aspose::Words::Lists::ListCollection::AddCopy ( System::SharedPtr< Aspose::Words::Lists::List srcList)

Creates a new list by copying the specified list and adding it to the collection of lists in the document.

Parameters
srcListThe source list to copy from.
Returns
The newly created list.

The source list can be from any document. If the source list belongs to a different document, a copy of the list is created and added to the current document.

If the source list is a reference to or a definition of a list style, the newly created list is not related to the original list style.

◆ get_Count()

int32_t Aspose::Words::Lists::ListCollection::get_Count ( )

Gets the count of numbered and bulleted lists in the document.

◆ get_Document()

System::SharedPtr<Aspose::Words::DocumentBase> Aspose::Words::Lists::ListCollection::get_Document ( ) const

Gets the owner document.

◆ GetEnumerator()

System::SharedPtr<System::Collections::Generic::IEnumerator<System::SharedPtr<Aspose::Words::Lists::List> > > Aspose::Words::Lists::ListCollection::GetEnumerator ( )
virtual

Gets the enumerator object that will enumerate lists in the document.

Implements System::Collections::Generic::IEnumerable< System::SharedPtr< Aspose::Words::Lists::List > >.

◆ GetListByListId()

System::SharedPtr<Aspose::Words::Lists::List> Aspose::Words::Lists::ListCollection::GetListByListId ( int32_t  listId)

Gets a list by a list identifier.

Parameters
listIdThe list identifier.
Returns
Returns the list object. Returns null if a list with the specified identifier was not found.

You don't normally need to use this method. Most of the time you apply list formatting to paragraphs just by settings the Aspose::Words::ListFormat::get_List property of the Aspose::Words::ListFormat object.

◆ idx_get()

System::SharedPtr<Aspose::Words::Lists::List> Aspose::Words::Lists::ListCollection::idx_get ( int32_t  index)

Gets a list by index.