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

This class is a singleton that has the purpose to transform between service names of shapes and associated enum values and to create new accessible objects for given shapes. More...

#include <ShapeTypeHandler.hxx>

Collaboration diagram for accessibility::ShapeTypeHandler:
[legend]

Public Types

enum  { UNKNOWN_SHAPE_TYPE = 0 }
 

Public Member Functions

ShapeTypeId GetTypeId (const OUString &aServiceName) const
 Determines the type id of a shape with the given service name. More...
 
ShapeTypeId GetTypeId (const css::uno::Reference< css::drawing::XShape > &rxShape) const
 Determines the type id of the specified shape. More...
 
rtl::Reference< AccessibleShapeCreateAccessibleObject (const AccessibleShapeInfo &rShapeInfo, const AccessibleShapeTreeInfo &rShapeTreeInfo) const
 Create a new accessible object for the given shape. More...
 
void AddShapeTypeList (int nDescriptorCount, ShapeTypeDescriptor const aDescriptorList[])
 Add new shape types to the internal tables. More...
 

Static Public Member Functions

static ShapeTypeHandlerInstance ()
 This function returns a reference to the only instance of this class. More...
 
static OUString CreateAccessibleBaseName (const css::uno::Reference< css::drawing::XShape > &rxShape)
 get the accessible base name for an object More...
 

Private Types

typedef std::unordered_map< OUString, ShapeTypeIdtServiceNameToSlotId
 This hash map allows the fast look up of a type descriptor for a given service name. More...
 

Private Member Functions

 ShapeTypeHandler ()
 Create the single instance of this class and initialize its list of type descriptors with an entry of an unknown type. More...
 
 ShapeTypeHandler (const ShapeTypeHandler &aHandler)
 
ShapeTypeHandleroperator= (const ShapeTypeHandler &aHandler)
 
 ~ShapeTypeHandler ()
 This destructor is never called at the moment. More...
 
SVX_DLLPRIVATE long GetSlotId (const OUString &aServiceName) const
 Determine the slot id of the specified shape type. More...
 
SVX_DLLPRIVATE long GetSlotId (const css::uno::Reference< css::drawing::XShape > &rxShape) const
 Determine the slot id of the specified shape type. More...
 

Private Attributes

::std::vector< ShapeTypeDescriptormaShapeTypeDescriptorList
 List of shape type descriptors. More...
 
tServiceNameToSlotId maServiceNameToSlotId
 

Static Private Attributes

static ShapeTypeHandlerinstance = nullptr
 Pointer to the only instance of this class. More...
 

Detailed Description

This class is a singleton that has the purpose to transform between service names of shapes and associated enum values and to create new accessible objects for given shapes.

Definition at line 78 of file ShapeTypeHandler.hxx.

Member Typedef Documentation

typedef std::unordered_map<OUString,ShapeTypeId> accessibility::ShapeTypeHandler::tServiceNameToSlotId
private

This hash map allows the fast look up of a type descriptor for a given service name.

Definition at line 170 of file ShapeTypeHandler.hxx.

Member Enumeration Documentation

anonymous enum
Enumerator
UNKNOWN_SHAPE_TYPE 

Definition at line 81 of file ShapeTypeHandler.hxx.

Constructor & Destructor Documentation

accessibility::ShapeTypeHandler::ShapeTypeHandler ( )
private

Create the single instance of this class and initialize its list of type descriptors with an entry of an unknown type.

Definition at line 126 of file ShapeTypeHandler.cxx.

References accessibility::CreateEmptyShapeReference(), maServiceNameToSlotId, maShapeTypeDescriptorList, and UNKNOWN_SHAPE_TYPE.

Referenced by Instance().

accessibility::ShapeTypeHandler::ShapeTypeHandler ( const ShapeTypeHandler aHandler)
private
accessibility::ShapeTypeHandler::~ShapeTypeHandler ( )
private

This destructor is never called at the moment.

But because this class is a singleton this is not a problem.

Definition at line 138 of file ShapeTypeHandler.cxx.

References instance.

Member Function Documentation

void accessibility::ShapeTypeHandler::AddShapeTypeList ( int  nDescriptorCount,
ShapeTypeDescriptor const  aDescriptorList[] 
)

Add new shape types to the internal tables.

Each new shape type is described by one shape type descriptor. See ShapeTypeDescriptor for more details.

Parameters
nDescriptorCountNumber of new shape types.
aDescriptorListArray of new shape type descriptors.

Definition at line 149 of file ShapeTypeHandler.cxx.

References i, accessibility::ShapeTypeDescriptor::maCreateFunction, maServiceNameToSlotId, maShapeTypeDescriptorList, accessibility::ShapeTypeDescriptor::mnShapeTypeId, and accessibility::ShapeTypeDescriptor::msServiceName.

Referenced by accessibility::RegisterDrawShapeTypes().

OUString accessibility::ShapeTypeHandler::CreateAccessibleBaseName ( const css::uno::Reference< css::drawing::XShape > &  rxShape)
static
rtl::Reference< AccessibleShape > accessibility::ShapeTypeHandler::CreateAccessibleObject ( const AccessibleShapeInfo rShapeInfo,
const AccessibleShapeTreeInfo rShapeTreeInfo 
) const

Create a new accessible object for the given shape.

This factory method determines the type descriptor for the type of the given shape, then calls the descriptor's create function, and finally initializes the new object.

Parameters
rShapeInfoBundle of information passed to the new accessible shape.
rShapeTreeInfoBundle of information passed down the shape tree.
Returns
Pointer to the implementation object that implements the XAccessible interface. This pointer may be NULL if the specified shape is of unknown type.

Definition at line 109 of file ShapeTypeHandler.cxx.

References GetSlotId(), maShapeTypeDescriptorList, and accessibility::AccessibleShapeInfo::mxShape.

long accessibility::ShapeTypeHandler::GetSlotId ( const OUString &  aServiceName) const
private

Determine the slot id of the specified shape type.

With this id internal methods can access the associated type descriptor.

Parameters
aServiceNameService name of the shape for which to return the slot id.
Returns
Returns the slot id of the shape with the given service name or 0 when the service name is not known.

Definition at line 173 of file ShapeTypeHandler.cxx.

References maServiceNameToSlotId.

Referenced by CreateAccessibleObject().

SVX_DLLPRIVATE long accessibility::ShapeTypeHandler::GetSlotId ( const css::uno::Reference< css::drawing::XShape > &  rxShape) const
private

Determine the slot id of the specified shape type.

With this id internal methods can access the associated type descriptor.

Parameters
rxShapeShape for which to return the slot id.
Returns
Returns the slot id of the shape with the given service name or 0 when the service name is not known.
ShapeTypeId accessibility::ShapeTypeHandler::GetTypeId ( const OUString &  aServiceName) const

Determines the type id of a shape with the given service name.

The given service name is first transformed into a slot id that identifies the place of the type descriptor.

Parameters
aServiceNameService name of the shape for which to return the type id.
Returns
Returns the type id of the shape with the given service name or -1 when the service name is not known.

From that descriptor the shape type id is returned.

Definition at line 80 of file ShapeTypeHandler.cxx.

References maServiceNameToSlotId, and maShapeTypeDescriptorList.

Referenced by accessibility::AccessibleGraphicShape::CreateAccessibleBaseName(), accessibility::AccessibleOLEShape::CreateAccessibleBaseName(), accessibility::AccessibleControlShape::CreateAccessibleBaseName(), CreateAccessibleBaseName(), accessibility::AccessibleControlShape::CreateAccessibleDescription(), and accessibility::AccessibleShape::UpdateStates().

ShapeTypeId accessibility::ShapeTypeHandler::GetTypeId ( const css::uno::Reference< css::drawing::XShape > &  rxShape) const

Determines the type id of the specified shape.

Parameters
xShapeReference to the shape for which to return the type id.
Returns
Returns the type id of the specified shape or -1 when the given reference is either not set or the referenced object does not support the XShapeDescriptor interface.
ShapeTypeHandler & accessibility::ShapeTypeHandler::Instance ( )
static
ShapeTypeHandler& accessibility::ShapeTypeHandler::operator= ( const ShapeTypeHandler aHandler)
private

Member Data Documentation

ShapeTypeHandler * accessibility::ShapeTypeHandler::instance = nullptr
staticprivate

Pointer to the only instance of this class.

Definition at line 158 of file ShapeTypeHandler.hxx.

Referenced by Instance(), and ~ShapeTypeHandler().

tServiceNameToSlotId accessibility::ShapeTypeHandler::maServiceNameToSlotId
mutableprivate

Definition at line 171 of file ShapeTypeHandler.hxx.

Referenced by AddShapeTypeList(), GetSlotId(), GetTypeId(), and ShapeTypeHandler().

::std::vector<ShapeTypeDescriptor> accessibility::ShapeTypeHandler::maShapeTypeDescriptorList
private

List of shape type descriptors.

This list is normally build up in several steps when libraries that implement shapes are loaded and call the addShapeTypeList method. After that no modifications of the list take place.

Definition at line 165 of file ShapeTypeHandler.hxx.

Referenced by AddShapeTypeList(), CreateAccessibleObject(), GetTypeId(), and ShapeTypeHandler().


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