Aspose::Words::Settings::WriteProtection Class Reference

Detailed Description

Specifies write protection settings for a document.

Write protection specifies whether the author has recommended that the document is to be opened as read-only and/or require a password to modify a document.

Write protection is different from document protection. Write protection is specified in Microsoft Word in the options of the Save As dialog box.

You do not create instances of this class directly. You access document protection settings via the WriteProtection property.

#include <Aspose.Words.Cpp/Model/Settings/WriteProtection.h>

+ Inheritance diagram for Aspose::Words::Settings::WriteProtection:

Public Member Functions

bool get_IsWriteProtected ()
 Returns true when a write protection password is set. More...
 
bool get_ReadOnlyRecommended () const
 Specifies whether the document author has recommended that the document be opened as read-only. More...
 
void set_ReadOnlyRecommended (bool value)
 Specifies whether the document author has recommended that the document be opened as read-only. More...
 
void SetPassword (String password)
 Sets the write protection password for the document. More...
 
bool ValidatePassword (String password)
 Returns true if the specified password is the same as the write-protection password the document was protected with. If document is not write-protected with password then returns false. More...
 
- Public Member Functions inherited from Object
ASPOSECPP_SHARED_API Object ()
 
ASPOSECPP_SHARED_API Object (Object const &x)
 
virtual ASPOSECPP_SHARED_API ~Object ()
 
virtual ASPOSECPP_SHARED_API bool Equals (ptr obj)
 
Detail::SmartPtrCounter * GetCounter ()
 
virtual ASPOSECPP_SHARED_API int GetHashCode () const
 
virtual ASPOSECPP_SHARED_API const TypeInfoGetType () const
 
virtual ASPOSECPP_SHARED_API bool Is (const TypeInfo &targetType) const
 
ASPOSECPP_SHARED_API void Lock ()
 
virtual ASPOSECPP_SHARED_API ptr MemberwiseClone () const
 
Objectoperator= (Object const &x)
 
bool ReferenceEquals (String const &str, std::nullptr_t)
 
bool ReferenceEquals (String const &str1, String const &str2)
 
int RemovedSharedRefs (int count)
 
virtual ASPOSECPP_SHARED_API void SetTemplateWeakPtr (unsigned int argument)
 
int SharedCount () const
 
ObjectSharedRefAdded ()
 
int SharedRefRemovedSafe ()
 
virtual ASPOSECPP_SHARED_API String ToString () const
 
ASPOSECPP_SHARED_API void Unlock ()
 
Detail::SmartPtrCounter * WeakRefAdded ()
 
void WeakRefRemoved ()
 

Additional Inherited Members

- Public Types inherited from Object
typedef SmartPtr< Objectptr
 
typedef System::Details::SharedMembersType shared_members_type
 
- Static Public Member Functions inherited from Object
bool Equals (double const &objA, double const &objB)
 
bool Equals (float const &objA, float const &objB)
 
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 
static const TypeInfoType ()
 

Member Function Documentation

◆ get_IsWriteProtected()

bool Aspose::Words::Settings::WriteProtection::get_IsWriteProtected ( )

Returns true when a write protection password is set.

◆ get_ReadOnlyRecommended()

bool Aspose::Words::Settings::WriteProtection::get_ReadOnlyRecommended ( ) const

Specifies whether the document author has recommended that the document be opened as read-only.

◆ set_ReadOnlyRecommended()

void Aspose::Words::Settings::WriteProtection::set_ReadOnlyRecommended ( bool  value)

Specifies whether the document author has recommended that the document be opened as read-only.

◆ SetPassword()

void Aspose::Words::Settings::WriteProtection::SetPassword ( System::String  password)

Sets the write protection password for the document.

If a password is set, Microsoft Word will require the user to enter it or open the document as read-only.

Parameters
passwordThe password to set. Cannot be null, but can be an empty string.

◆ ValidatePassword()

bool Aspose::Words::Settings::WriteProtection::ValidatePassword ( System::String  password)

Returns true if the specified password is the same as the write-protection password the document was protected with. If document is not write-protected with password then returns false.