LibreOffice Module oox (master) 1
Static Public Member Functions | List of all members
oox::ContainerHelper Class Reference

Static helper functions for improved API container handling. More...

#include <containerhelper.hxx>

Static Public Member Functions

static OUString getUnusedName (const css::uno::Reference< css::container::XNameAccess > &rxNameAccess, const OUString &rSuggestedName, sal_Unicode cSeparator)
 Returns a name that is not used in the passed name container. More...
 
static bool insertByName (const css::uno::Reference< css::container::XNameContainer > &rxNameContainer, const OUString &rName, const css::uno::Any &rObject)
 Inserts an object into a name container. More...
 
static OUString insertByUnusedName (const css::uno::Reference< css::container::XNameContainer > &rxNameContainer, const OUString &rSuggestedName, sal_Unicode cSeparator, const css::uno::Any &rObject)
 Inserts an object into a name container. More...
 
template<typename VectorType >
static const VectorType::value_type * getVectorElement (const VectorType &rVector, sal_Int32 nIndex)
 Returns the pointer to an existing element of the passed vector, or a null pointer, if the passed index is out of bounds. More...
 
template<typename VectorType >
static VectorType::value_type * getVectorElementAccess (VectorType &rVector, sal_Int32 nIndex)
 Returns the pointer to an existing element of the passed vector, or a null pointer, if the passed index is out of bounds. More...
 
template<typename VectorType >
static const VectorType::value_type & getVectorElement (const VectorType &rVector, sal_Int32 nIndex, const typename VectorType::value_type &rDefault)
 Returns the reference to an existing element of the passed vector, or the passed default value, if the passed index is out of bounds. More...
 
template<typename MapType >
static const MapType::mapped_type * getMapElement (const MapType &rMap, const typename MapType::key_type &rKey)
 Returns the pointer to an existing element of the passed map, or a null pointer, if an element with the passed key does not exist. More...
 
template<typename MapType >
static const MapType::mapped_type & getMapElement (const MapType &rMap, const typename MapType::key_type &rKey, const typename MapType::mapped_type &rDefault)
 Returns the reference to an existing element of the passed map, or the passed default value, if an element with the passed key does not exist. More...
 
template<typename MatrixType >
static css::uno::Sequence< css::uno::Sequence< typename MatrixType::value_type > > matrixToSequenceSequence (const MatrixType &rMatrix)
 Creates a UNO sequence of sequences from a matrix with copies of all elements. More...
 

Detailed Description

Static helper functions for improved API container handling.

Definition at line 136 of file containerhelper.hxx.

Member Function Documentation

◆ getMapElement() [1/2]

template<typename MapType >
const MapType::mapped_type * oox::ContainerHelper::getMapElement ( const MapType &  rMap,
const typename MapType::key_type &  rKey 
)
static

Returns the pointer to an existing element of the passed map, or a null pointer, if an element with the passed key does not exist.

Definition at line 264 of file containerhelper.hxx.

Referenced by oox::vml::Drawing::getControlInfo(), oox::vml::Drawing::getOleObjectInfo(), and oox::core::FastParser::registerNamespace().

◆ getMapElement() [2/2]

template<typename MapType >
const MapType::mapped_type & oox::ContainerHelper::getMapElement ( const MapType &  rMap,
const typename MapType::key_type &  rKey,
const typename MapType::mapped_type &  rDefault 
)
static

Returns the reference to an existing element of the passed map, or the passed default value, if an element with the passed key does not exist.

Definition at line 271 of file containerhelper.hxx.

◆ getUnusedName()

OUString oox::ContainerHelper::getUnusedName ( const css::uno::Reference< css::container::XNameAccess > &  rxNameAccess,
const OUString &  rSuggestedName,
sal_Unicode  cSeparator 
)
static

Returns a name that is not used in the passed name container.

Parameters
rxNameAccesscom.sun.star.container.XNameAccess interface of the name container.
rSuggestedNameSuggested name for the object.
Returns
An unused name. Will be equal to the suggested name, if not contained, otherwise a numerical index will be appended.

Definition at line 75 of file containerhelper.cxx.

References nIndex.

Referenced by insertByUnusedName().

◆ getVectorElement() [1/2]

template<typename VectorType >
const VectorType::value_type * oox::ContainerHelper::getVectorElement ( const VectorType &  rVector,
sal_Int32  nIndex 
)
static

Returns the pointer to an existing element of the passed vector, or a null pointer, if the passed index is out of bounds.

Definition at line 246 of file containerhelper.hxx.

References nIndex.

Referenced by oox::ole::VbaSiteModel::createControlModel().

◆ getVectorElement() [2/2]

template<typename VectorType >
const VectorType::value_type & oox::ContainerHelper::getVectorElement ( const VectorType &  rVector,
sal_Int32  nIndex,
const typename VectorType::value_type &  rDefault 
)
static

Returns the reference to an existing element of the passed vector, or the passed default value, if the passed index is out of bounds.

Definition at line 258 of file containerhelper.hxx.

References nIndex.

◆ getVectorElementAccess()

template<typename VectorType >
VectorType::value_type * oox::ContainerHelper::getVectorElementAccess ( VectorType &  rVector,
sal_Int32  nIndex 
)
static

Returns the pointer to an existing element of the passed vector, or a null pointer, if the passed index is out of bounds.

Definition at line 252 of file containerhelper.hxx.

References nIndex.

◆ insertByName()

bool oox::ContainerHelper::insertByName ( const css::uno::Reference< css::container::XNameContainer > &  rxNameContainer,
const OUString &  rName,
const css::uno::Any &  rObject 
)
static

Inserts an object into a name container.

Parameters
rxNameContainercom.sun.star.container.XNameContainer interface of the name container.
rNameExact name for the object.
rObjectThe object to be inserted.
Returns
True = object successfully inserted.

Definition at line 88 of file containerhelper.cxx.

References Exception.

Referenced by oox::ole::VbaFormControl::createAndConvert(), oox::ole::VbaUserForm::importForm(), insertByUnusedName(), and oox::ObjectContainer::insertObject().

◆ insertByUnusedName()

OUString oox::ContainerHelper::insertByUnusedName ( const css::uno::Reference< css::container::XNameContainer > &  rxNameContainer,
const OUString &  rSuggestedName,
sal_Unicode  cSeparator,
const css::uno::Any &  rObject 
)
static

Inserts an object into a name container.

The function will use an unused name to insert the object, based on the suggested object name. It is possible to specify whether the existing object or the new inserted object will be renamed, if the container already has an object with the name suggested for the new object.

Parameters
rxNameContainercom.sun.star.container.XNameContainer interface of the name container.
rSuggestedNameSuggested name for the object.
rObjectThe object to be inserted.

The new object will be inserted with a name not yet extant in the container (this is done by appending a numerical index to the suggested name).

Returns
The final name the object is inserted with. Will always be equal to the suggested name, if parameter bRenameOldExisting is true.

Definition at line 109 of file containerhelper.cxx.

References getUnusedName(), and insertByName().

Referenced by oox::ObjectContainer::insertObject().

◆ matrixToSequenceSequence()

template<typename MatrixType >
css::uno::Sequence< css::uno::Sequence< typename MatrixType::value_type > > oox::ContainerHelper::matrixToSequenceSequence ( const MatrixType &  rMatrix)
static

Creates a UNO sequence of sequences from a matrix with copies of all elements.

Parameters
rMatrixThe matrix to be converted to a sequence of sequences.
Returns
A com.sun.star.uno.Sequence object containing com.sun.star.uno.Sequence objects with copies of all objects contained in the passed matrix.

Definition at line 278 of file containerhelper.hxx.

References aSeq.


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