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

@descr 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 tools::Long GetSlotId (const OUString &aServiceName) const
 Determine the slot id of the specified shape type. More...
 
SVX_DLLPRIVATE tools::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

@descr 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 79 of file ShapeTypeHandler.hxx.

Member Typedef Documentation

◆ tServiceNameToSlotId

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 171 of file ShapeTypeHandler.hxx.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
UNKNOWN_SHAPE_TYPE 

Definition at line 82 of file ShapeTypeHandler.hxx.

Constructor & Destructor Documentation

◆ ShapeTypeHandler() [1/2]

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 123 of file ShapeTypeHandler.cxx.

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

Referenced by Instance().

◆ ShapeTypeHandler() [2/2]

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

◆ ~ShapeTypeHandler()

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 135 of file ShapeTypeHandler.cxx.

References instance.

Member Function Documentation

◆ AddShapeTypeList()

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 146 of file ShapeTypeHandler.cxx.

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

Referenced by accessibility::RegisterDrawShapeTypes().

◆ CreateAccessibleBaseName()

OUString accessibility::ShapeTypeHandler::CreateAccessibleBaseName ( const css::uno::Reference< css::drawing::XShape > &  rxShape)
static

◆ CreateAccessibleObject()

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 106 of file ShapeTypeHandler.cxx.

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

◆ GetSlotId() [1/2]

SVX_DLLPRIVATE tools::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.

◆ GetSlotId() [2/2]

tools::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 170 of file ShapeTypeHandler.cxx.

References I, and maServiceNameToSlotId.

Referenced by CreateAccessibleObject().

◆ GetTypeId() [1/2]

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.

◆ GetTypeId() [2/2]

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 77 of file ShapeTypeHandler.cxx.

References I, maServiceNameToSlotId, and maShapeTypeDescriptorList.

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

◆ Instance()

ShapeTypeHandler & accessibility::ShapeTypeHandler::Instance ( )
static

◆ operator=()

ShapeTypeHandler & accessibility::ShapeTypeHandler::operator= ( const ShapeTypeHandler aHandler)
private

Member Data Documentation

◆ instance

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

Pointer to the only instance of this class.

Definition at line 159 of file ShapeTypeHandler.hxx.

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

◆ maServiceNameToSlotId

tServiceNameToSlotId accessibility::ShapeTypeHandler::maServiceNameToSlotId
mutableprivate

Definition at line 172 of file ShapeTypeHandler.hxx.

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

◆ maShapeTypeDescriptorList

::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 166 of file ShapeTypeHandler.hxx.

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


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