LibreOffice Module svx (master) 1
|
This class creates description strings for shapes. More...
#include <DescriptionGenerator.hxx>
Public Types | |
enum class | PropertyType { Color , Integer } |
Public Member Functions | |
DescriptionGenerator (css::uno::Reference< css::drawing::XShape > xShape) | |
Creates a new description generator with an empty description string. More... | |
~DescriptionGenerator () | |
void | Initialize (std::u16string_view sPrefix) |
Initialize the description with the given prefix followed by the shape style in parentheses and a colon. More... | |
void | Initialize (TranslateId 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 (std::u16string_view sString) |
Append the given string as is to the current description. More... | |
Private Member Functions | |
void | AddColor (const OUString &sPropertyName) |
Add a property value formatted as color to the description string. More... | |
void | AddInteger (const OUString &sPropertyName) |
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... | |
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 48 of file DescriptionGenerator.hxx.
|
strong |
Enumerator | |
---|---|
Color | |
Integer |
Definition at line 51 of file DescriptionGenerator.hxx.
accessibility::DescriptionGenerator::DescriptionGenerator | ( | 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.
xShape | The shape from which properties will be extracted by later calls to <member>addProperty</member>. |
Definition at line 39 of file DescriptionGenerator.cxx.
References mxShape.
accessibility::DescriptionGenerator::~DescriptionGenerator | ( | ) |
Definition at line 46 of file DescriptionGenerator.cxx.
|
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 145 of file DescriptionGenerator.cxx.
References accessibility::lookUpColorName(), msDescription, mxSet, and nValue.
Referenced by AddProperty().
|
private |
Add a property value formatted as integer to the description string.
Definition at line 166 of file DescriptionGenerator.cxx.
References msDescription, mxSet, and nValue.
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.
sPropertyName | The Name of the property to append. |
aType | Type of the property's value. It controls the transformation into the value's string representation. |
sLocalizedName | Localized name of the property. An empty string tells the method to use the property name instead. |
Definition at line 102 of file DescriptionGenerator.cxx.
References AddColor(), AddInteger(), Color, Integer, mbIsFirstProperty, msDescription, mxSet, mxShape, and SvxResId().
Referenced by accessibility::AccessibleControlShape::CreateAccessibleDescription().
void accessibility::DescriptionGenerator::AppendString | ( | std::u16string_view | sString | ) |
Append the given string as is to the current description.
sString | String to append to the current description. It is not modified in any way. |
Definition at line 137 of file DescriptionGenerator.cxx.
References msDescription.
Referenced by accessibility::AccessibleControlShape::CreateAccessibleDescription().
void accessibility::DescriptionGenerator::Initialize | ( | std::u16string_view | sPrefix | ) |
Initialize the description with the given prefix followed by the shape style in parentheses and a colon.
sPrefix | An introductory description of the shape that is made more specific by later calls to <member>addProperty</member>. |
Definition at line 61 of file DescriptionGenerator.cxx.
References msDescription, mxSet, sPrefix, and SvxResId().
Referenced by accessibility::AccessibleControlShape::CreateAccessibleDescription(), and Initialize().
void accessibility::DescriptionGenerator::Initialize | ( | TranslateId | pResourceId | ) |
Initialize the description with the specified string from the resource followed by the shape style in parentheses and a colon.
pResourceId | A 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 48 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.
Definition at line 96 of file DescriptionGenerator.cxx.
References msDescription.
|
private |
This flag is used to determine whether to insert a separator e.g.
a comma before the next property.
Definition at line 127 of file DescriptionGenerator.hxx.
Referenced by AddProperty().
|
private |
The description string that is build.
Definition at line 122 of file DescriptionGenerator.hxx.
Referenced by AddColor(), AddInteger(), AddProperty(), AppendString(), Initialize(), and operator()().
|
private |
Reference to the shape's property set.
Definition at line 119 of file DescriptionGenerator.hxx.
Referenced by AddColor(), AddInteger(), AddProperty(), and Initialize().
|
private |
Reference to the shape from which the properties are extracted.
Definition at line 116 of file DescriptionGenerator.hxx.
Referenced by AddProperty().