A collection of Style objects that represent both the built-in and user-defined styles in a document. More...
#include "Aspose.Words.Cpp/Model/Styles/StyleCollection.h"
Inherits System::Collections::Generic::IEnumerable< System::SharedPtr< Aspose::Words::Style > >.
Public Member Functions | |
System::SharedPtr< Aspose::Words::DocumentBase > | get_Document () const |
Gets the owner document. More... | |
System::SharedPtr< Aspose::Words::Font > | get_DefaultFont () |
Gets document default text formatting. More... | |
System::SharedPtr< Aspose::Words::ParagraphFormat > | get_DefaultParagraphFormat () |
Gets document default paragraph formatting. More... | |
int32_t | get_Count () |
Gets the number of styles in the collection. More... | |
System::SharedPtr< Aspose::Words::Style > | idx_get (System::String name) |
Gets a style by name or alias. More... | |
System::SharedPtr< Aspose::Words::Style > | idx_get (Aspose::Words::StyleIdentifier sti) |
Gets a built-in style by its locale independent identifier. More... | |
System::SharedPtr< Aspose::Words::Style > | idx_get (int32_t index) |
Gets a style by index. More... | |
System::SharedPtr< System::Collections::Generic::IEnumerator< System::SharedPtr< Aspose::Words::Style > > > | GetEnumerator () |
Gets an enumerator object that will enumerate styles in the alphabetical order of their names. More... | |
System::SharedPtr< Aspose::Words::Style > | Add (Aspose::Words::StyleType type, System::String name) |
Creates a new user defined style and adds it the collection. More... | |
System::SharedPtr< Aspose::Words::Style > | AddCopy (System::SharedPtr< Aspose::Words::Style > style) |
Copies a style into this collection. More... | |
![]() | |
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... | |
Object & | operator= (Object const &x) |
Assignment operator. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More... | |
Object * | SharedRefAdded () |
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 TypeInfo & | GetType () 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 | |
![]() | |
typedef IEnumerator< System::SharedPtr< Aspose::Words::Style > > | IEnumeratorType |
Enumerator type. More... | |
![]() | |
typedef SmartPtr< Object > | ptr |
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 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 TypeInfo & | Type () |
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) |
A collection of Style objects that represent both the built-in and user-defined styles in a document.
System::SharedPtr<Aspose::Words::Style> Aspose::Words::StyleCollection::Add | ( | Aspose::Words::StyleType | type, |
System::String | name | ||
) |
Creates a new user defined style and adds it the collection.
You can create character, paragraph or a list style.
When creating a list style, the style is created with default numbered list formatting (1 \ a \ i).
Throws an exception if a style with this name already exists.
type | A Aspose::Words::StyleType value that specifies the type of the style to create. |
name | Case sensitive name of the style to create. |
System::SharedPtr<Aspose::Words::Style> Aspose::Words::StyleCollection::AddCopy | ( | System::SharedPtr< Aspose::Words::Style > | style | ) |
Copies a style into this collection.
style | Style to be copied. |
Style to be copied can belong to the same document as well as to different document.
Linked style is copied.
This method does doesn't copy base styles.
If collection already contains a style with the same name, then new name is automatically generated by adding "_number" suffix starting from 0 e.g. "Normal_0", "Heading 1_1" etc. Use Aspose::Words::Style::get_Name setter for changing the name of the imported style.
int32_t Aspose::Words::StyleCollection::get_Count | ( | ) |
Gets the number of styles in the collection.
System::SharedPtr<Aspose::Words::Font> Aspose::Words::StyleCollection::get_DefaultFont | ( | ) |
Gets document default text formatting.
Note that document-wide defaults were introduced in Microsoft Word 2007 and are fully supported in OOXML formats (Aspose::Words::LoadFormat::Docx) only. Earlier document formats have limited support for this feature and only font names can be stored.
System::SharedPtr<Aspose::Words::ParagraphFormat> Aspose::Words::StyleCollection::get_DefaultParagraphFormat | ( | ) |
Gets document default paragraph formatting.
Note that document-wide defaults were introduced in Microsoft Word 2007 and are fully supported in OOXML formats (Aspose::Words::LoadFormat::Docx) only. Earlier document formats have no support for document default paragraph formatting.
System::SharedPtr<Aspose::Words::DocumentBase> Aspose::Words::StyleCollection::get_Document | ( | ) | const |
Gets the owner document.
|
virtual |
Gets an enumerator object that will enumerate styles in the alphabetical order of their names.
Implements System::Collections::Generic::IEnumerable< System::SharedPtr< Aspose::Words::Style > >.
System::SharedPtr<Aspose::Words::Style> Aspose::Words::StyleCollection::idx_get | ( | Aspose::Words::StyleIdentifier | sti | ) |
Gets a built-in style by its locale independent identifier.
When accessing a style that does not yet exist, automatically creates it.
sti | A Aspose::Words::StyleIdentifier value that specifies the built in style to retrieve. |
System::SharedPtr<Aspose::Words::Style> Aspose::Words::StyleCollection::idx_get | ( | int32_t | index | ) |
Gets a style by index.
System::SharedPtr<Aspose::Words::Style> Aspose::Words::StyleCollection::idx_get | ( | System::String | name | ) |
Gets a style by name or alias.
Case sensitive, returns null if the style with the given name is not found.
If this is an English name of a built in style that does not yet exist, automatically creates it.