LibreOffice Module svx (master)  1
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
accessibility::DescriptionGenerator Class Reference

This class creates description strings for shapes. More...

#include <DescriptionGenerator.hxx>

Public Types

enum  PropertyType {
  PropertyType::Color,
  PropertyType::Integer
}
 

Public Member Functions

 DescriptionGenerator (const css::uno::Reference< css::drawing::XShape > &xShape)
 Creates a new description generator with an empty description string. More...
 
 ~DescriptionGenerator ()
 
void Initialize (const OUString &sPrefix)
 Initialize the description with the given prefix followed by the shape style in parentheses and a colon. More...
 
void Initialize (const char *pResourceId)
 Initialize the description with the specified string from the resource followed by the shape style in parentheses and a colon. More...
 
OUString operator() (void)
 Returns the description string and then resets it. More...
 
void AddProperty (const OUString &sPropertyName, PropertyType aType)
 Add the given property name and its associated value to the description string. More...
 
void AppendString (const OUString &sString)
 Append the given string as is to the current description. More...
 

Private Member Functions

SVX_DLLPRIVATE void AddColor (const OUString &sPropertyName, const OUString &sLocalizedName)
 Add a property value formatted as color to the description string. More...
 
SVX_DLLPRIVATE void AddInteger (const OUString &sPropertyName, const OUString &sLocalizedName)
 Add a property value formatted as integer to the description string. More...
 

Private Attributes

css::uno::Reference< css::drawing::XShape > mxShape
 Reference to the shape from which the properties are extracted. More...
 
css::uno::Reference< css::beans::XPropertySet > mxSet
 Reference to the shape's property set. More...
 
OUStringBuffer msDescription
 The description string that is build. More...
 
bool mbIsFirstProperty
 This flag is used to determine whether to insert a separator e.g. More...
 

Detailed Description

This class creates description strings for shapes.

Initialized with a given shape additional calls to the <member>addProperty</member> method will build a descriptive string that starts with a general shape description and the shapes style. Appended are all the specified property names and values that differ from the default values in the style.

Definition at line 41 of file DescriptionGenerator.hxx.

Member Enumeration Documentation

Enumerator
Color 
Integer 

Definition at line 44 of file DescriptionGenerator.hxx.

Constructor & Destructor Documentation

accessibility::DescriptionGenerator::DescriptionGenerator ( const css::uno::Reference< css::drawing::XShape > &  xShape)

Creates a new description generator with an empty description string.

Usually you will want to call initialize next to specify a general description of the shape.

Parameters
xShapeThe shape from which properties will be extracted by later calls to <member>addProperty</member>.

Definition at line 53 of file DescriptionGenerator.cxx.

References mxShape.

accessibility::DescriptionGenerator::~DescriptionGenerator ( )

Definition at line 62 of file DescriptionGenerator.cxx.

Member Function Documentation

void accessibility::DescriptionGenerator::AddColor ( const OUString &  sPropertyName,
const OUString &  sLocalizedName 
)
private

Add a property value formatted as color to the description string.

Search for the given color in the global color table.

If found append its name to the description. Otherwise append its RGB tuple.

Definition at line 168 of file DescriptionGenerator.cxx.

References accessibility::lookUpColorName(), msDescription, and mxSet.

Referenced by AddProperty().

void accessibility::DescriptionGenerator::AddInteger ( const OUString &  sPropertyName,
const OUString &  sLocalizedName 
)
private

Add a property value formatted as integer to the description string.

Definition at line 193 of file DescriptionGenerator.cxx.

References msDescription, and mxSet.

Referenced by AddProperty().

void accessibility::DescriptionGenerator::AddProperty ( const OUString &  sPropertyName,
PropertyType  aType 
)

Add the given property name and its associated value to the description string.

If the property value does not differ from the default value of the shape's style then the description string is not modified.

Parameters
sPropertyNameThe Name of the property to append.
aTypeType of the property's value. It controls the transformation into the value's string representation.
sLocalizedNameLocalized name of the property. An empty string tells the method to use the property name instead.

Definition at line 124 of file DescriptionGenerator.cxx.

References AddColor(), AddInteger(), Color, Integer, mbIsFirstProperty, msDescription, mxSet, mxShape, and SvxResId().

Referenced by accessibility::AccessibleControlShape::CreateAccessibleDescription().

void accessibility::DescriptionGenerator::AppendString ( const OUString &  sString)

Append the given string as is to the current description.

Parameters
sStringString to append to the current description. It is not modified in any way.

Definition at line 159 of file DescriptionGenerator.cxx.

References msDescription.

Referenced by accessibility::AccessibleControlShape::CreateAccessibleDescription().

void accessibility::DescriptionGenerator::Initialize ( const OUString &  sPrefix)

Initialize the description with the given prefix followed by the shape style in parentheses and a colon.

Parameters
sPrefixAn introductory description of the shape that is made more specific by later calls to <member>addProperty</member>.

Definition at line 81 of file DescriptionGenerator.cxx.

References msDescription, mxSet, sPrefix, and SvxResId().

Referenced by accessibility::AccessibleControlShape::CreateAccessibleDescription(), and Initialize().

void accessibility::DescriptionGenerator::Initialize ( const char *  pResourceId)

Initialize the description with the specified string from the resource followed by the shape style in parentheses and a colon.

Parameters
pResourceIdA resource id the specifies the introductory description of the shape that is made more specific by later calls to <member>addProperty</member>.

Definition at line 67 of file DescriptionGenerator.cxx.

References Initialize(), sPrefix, and SvxResId().

OUString accessibility::DescriptionGenerator::operator() ( void  )

Returns the description string and then resets it.

Usually called as last method before destroying the object.

Returns
The description string in its current form.

Definition at line 117 of file DescriptionGenerator.cxx.

References msDescription.

Member Data Documentation

bool accessibility::DescriptionGenerator::mbIsFirstProperty
private

This flag is used to determine whether to insert a separator e.g.

a comma before the next property.

Definition at line 121 of file DescriptionGenerator.hxx.

Referenced by AddProperty().

OUStringBuffer accessibility::DescriptionGenerator::msDescription
private

The description string that is build.

Definition at line 116 of file DescriptionGenerator.hxx.

Referenced by AddColor(), AddInteger(), AddProperty(), AppendString(), Initialize(), and operator()().

css::uno::Reference< css::beans::XPropertySet> accessibility::DescriptionGenerator::mxSet
private

Reference to the shape's property set.

Definition at line 113 of file DescriptionGenerator.hxx.

Referenced by AddColor(), AddInteger(), AddProperty(), and Initialize().

css::uno::Reference< css::drawing::XShape> accessibility::DescriptionGenerator::mxShape
private

Reference to the shape from which the properties are extracted.

Definition at line 110 of file DescriptionGenerator.hxx.

Referenced by AddProperty().


The documentation for this class was generated from the following files: