[]
        
(Showing Draft Content)

GrapeCity.Documents.Word.FormattingBag

Class FormattingBag

Namespace
GrapeCity.Documents.Word
Assembly
GcDocs.Word.dll

Abstract class that provides base functionality to store and resolve formatting in objects.

public abstract class FormattingBag
Inheritance
object
FormattingBag
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Fields

KeyDelimiter

For internal use.

protected const string KeyDelimiter = "#"

Field Value

string

KeyFormat

For internal use.

protected const string KeyFormat = "{0}#{1}"

Field Value

string

Properties

BaseKey

Gets the base (this class) key for formatting properties.

protected virtual string BaseKey { get; }

Property Value

string

ParentKey

Gets the parent (previous level) key for formatting properties.

protected string ParentKey { get; }

Property Value

string

RootKey

Gets the root (concatenation of the parent and base) key for formatting properties.

protected string RootKey { get; }

Property Value

string

SyncBaseKeys

Gets the base keys to synchronize formatting properties with this object.

protected string[] SyncBaseKeys { get; }

Property Value

string[]

Methods

ClearFormatting()

Clears direct formatting in the object.

public virtual void ClearFormatting()

ConcateKeys(string, string)

Concatenates a root key with a short formatting key.

protected string ConcateKeys(string rootKey, string key)

Parameters

rootKey string

A root formatting key.

key string

A short formatting key.

Returns

string

The final formatting key.

ConcateKeys(string, string[])

Concatenates a root key with a short formatting key array.

protected string[] ConcateKeys(string rootKey, string[] keys)

Parameters

rootKey string

A root formatting key.

keys string[]

A short formatting key array.

Returns

string[]

The final formatting key array.

ConcateKeys(string[], string)

Concatenates a root key array with a short formatting key.

protected string[] ConcateKeys(string[] rootKeys, string key)

Parameters

rootKeys string[]

A root formatting key array.

key string

A short formatting key.

Returns

string[]

The final formatting key array.

FixInheritedValues()

Fixes all inherited values as "direct" values for this instance.

protected virtual void FixInheritedValues()

GetChildKeyPart(string)

Gets the first part of short key from the full key for the formatting property.

protected string GetChildKeyPart(string formattingKey)

Parameters

formattingKey string

A full key of the formatting property/

Returns

string

A first part of short key of the formatting property.

GetDirectFormatting<T>(string, T)

Gets the direct formatting property value.

protected T GetDirectFormatting<T>(string key, T defaultValue)

Parameters

key string

The short formatting property key.

defaultValue T

The default value of the property.

Returns

T

A value of the property, if the property key not found, returns defaultValue.

Type Parameters

T

A type of the returning value.

GetDirectPropertyFormatting<T>(T, string)

Gets the direct formatting property value.

protected T GetDirectPropertyFormatting<T>(T defaultValue, string key = "")

Parameters

defaultValue T

The default value of the property.

key string

The property name. It should start with "Direct" prefix.

Returns

T

A value of the property, if the property key not found, returns defaultValue.

Type Parameters

T

A type of the returning value.

GetFormatting<T>(string, T, out int, bool)

Gets the formatting property value.

protected T GetFormatting<T>(string key, T defaultValue, out int level, bool isFullKey = false)

Parameters

key string

The short formatting property key.

defaultValue T

The default value of the property.

level int

Returns the level of inheritance where the property is assigned.

isFullKey bool

Whether the key is full or short.

Returns

T

A value of the property, if the property key not found, returns defaultValue.

Type Parameters

T

A type of the returning value.

GetFormatting<T>(string, T)

Gets the formatting property value.

protected T GetFormatting<T>(string key, T defaultValue)

Parameters

key string

The short formatting property key.

defaultValue T

The default value of the property.

Returns

T

A value of the property, if the property key not found, returns defaultValue.

Type Parameters

T

A type of the returning value.

GetFormattingKey(string)

Gets a full key for the formatting property.

protected string GetFormattingKey(string key)

Parameters

key string

A short key of the formatting property.

Returns

string

A full key for the formatting property.

GetPropertyFormatting<T>(T, string)

Gets the formatting property value.

protected T GetPropertyFormatting<T>(T defaultValue, string key = "")

Parameters

defaultValue T

The default value of the property.

key string

The short formatting property key.

Returns

T

A value of the property, if the property key not found, returns defaultValue.

Type Parameters

T

A type of the returning value.

GetShortKey(string)

Gets a short key from the full key for the formatting property.

protected string GetShortKey(string formattingKey)

Parameters

formattingKey string

A full key of the formatting property/

Returns

string

A short key of the formatting property.

HasDirectFormatting(string, string)

Gets whether the direct formatting contains any data for an object with specified keys.

protected virtual bool HasDirectFormatting(string parentKey, string baseKey)

Parameters

parentKey string

The parent key of the object.

baseKey string

The base key of the object.

Returns

bool

true if the direct formatting is applied to the object with specified keys.

HasDirectFormatting(string)

Gets whether the direct formatting applied for the property.

protected bool HasDirectFormatting(string key = "")

Parameters

key string

The short formatting property key.

Returns

bool

true if the property is assigned in direct formatting.

HasDirectFormattingWithIgnore(string, string, string)

Gets whether the attached FormattingBag class has direct formatting in the shape except ignored key.

protected bool HasDirectFormattingWithIgnore(string parentKey, string baseKey, string ignoredKeyPart)

Parameters

parentKey string

The parent key of the object.

baseKey string

The base formatting key of the class.

ignoredKeyPart string

The ignored formatting key (or key part) of the class.

Returns

bool

True if the attached FormattingBag class has direct formatting in the shape, otherwise false. Keys contained ignoredKeyPart are ignored.

HasDirectFormattingWithIgnore(string, string)

Gets whether the attached FormattingBag class has direct formatting in the shape except ignored key.

protected bool HasDirectFormattingWithIgnore(string baseKey, string ignoredKeyPart)

Parameters

baseKey string

The base formatting key of the class.

ignoredKeyPart string

The ignored formatting key (or key part) of the class.

Returns

bool

True if the attached FormattingBag class has direct formatting in the shape, otherwise false. Keys contained ignoredKeyPart are ignored.

HasDirectPropertyFormatting(string)

Gets whether the direct formatting applied for the property.

protected bool HasDirectPropertyFormatting(string key = "")

Parameters

key string

The property name. It should start with "HasDirect" prefix.

Returns

bool

true if the property is assigned in direct formatting.

RemoveDirectFormatting(string)

Resets the direct formatting property.

protected void RemoveDirectFormatting(string key)

Parameters

key string

The short formatting property key.

SetDirectPropertyFormatting(object, string)

Sets the direct formatting property value.

protected void SetDirectPropertyFormatting(object value, string key = "")

Parameters

value object

The formatting property value.

key string

The short formatting property key to set value.

SetDirectPropertyFormattingEx<T>(object, T, string)

Sets the direct formatting property value.

protected void SetDirectPropertyFormattingEx<T>(object value, T defaultValue, string key = "")

Parameters

value object

The formatting property value.

defaultValue T

The default value of the property.

key string

The short formatting property key to set value.

Type Parameters

T

A type of the value.

Remarks

If value equals default value then formatting will be removed.

SetFormatting(string, object, bool)

Sets the formatting property value.

protected virtual void SetFormatting(string key, object value, bool tryRemoveInheritance = true)

Parameters

key string

The short formatting property key to set value.

value object

The formatting property value.

tryRemoveInheritance bool

Whether to remove this instance inheritance and fix all inherited values as "direct" values.

SetFormatting<T>(string, object, T, bool)

Sets the formatting property value.

protected void SetFormatting<T>(string key, object value, T defaultValue, bool tryRemoveInheritance = true)

Parameters

key string

The short formatting property key to set value.

value object

The formatting property value.

defaultValue T

The default value of the property.

tryRemoveInheritance bool

Whether to remove this instance inheritance and fix all inherited values as "direct" values.

Type Parameters

T

A type of the value.

Remarks

If value equals default value then formatting will be removed.

SetPropertyFormatting(object, string)

Sets the formatting property value.

protected void SetPropertyFormatting(object value, string key = "")

Parameters

value object

The formatting property value.

key string

The short formatting property key to set value.

SetPropertyFormattingEx<T>(object, T, string)

Sets the formatting property value.

protected void SetPropertyFormattingEx<T>(object value, T defaultValue, string key = "")

Parameters

value object

The formatting property value.

defaultValue T

The default value of the property.

key string

The short formatting property key to set value.

Type Parameters

T

A type of the value.

Remarks

If value equals default value then formatting will be removed.

TryGetDirectFormatting<T>(string, T, out T, bool)

Gets the direct formatting property value.

protected bool TryGetDirectFormatting<T>(string key, T defaultValue, out T value, bool isFullKey = false)

Parameters

key string

The short formatting property key.

defaultValue T

The default value of the property.

value T

A value of the property, if the property key not found, returns defaultValue.

isFullKey bool

Whether the key is full or short.

Returns

bool

True if the property key found, otherwise false.

Type Parameters

T

A type of the returning value.

UpdateVersion(int?)

Updates version of current GrapeCity.Documents.Word.IVersionedFormatting.

protected void UpdateVersion(int? newValue = null)

Parameters

newValue int?

New value. If null then version will be increased by 1.