diff options
Diffstat (limited to 'oox/inc/oox/helper/containerhelper.hxx')
-rw-r--r-- | oox/inc/oox/helper/containerhelper.hxx | 473 |
1 files changed, 85 insertions, 388 deletions
diff --git a/oox/inc/oox/helper/containerhelper.hxx b/oox/inc/oox/helper/containerhelper.hxx index f4f3717eac3f..96b9feeffe07 100644 --- a/oox/inc/oox/helper/containerhelper.hxx +++ b/oox/inc/oox/helper/containerhelper.hxx @@ -30,8 +30,6 @@ #include <vector> #include <map> -#include <boost/shared_ptr.hpp> -#include <boost/bind.hpp> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Sequence.h> @@ -49,304 +47,6 @@ namespace oox { // ============================================================================ -/** Template for a vector of ref-counted objects with additional accessor functions. - - An instance of the class RefVector< Type > stores elements of the type - ::boost::shared_ptr< Type >. The new accessor functions has() and get() - work correctly for indexes out of the current range, there is no need to - check the passed index before. - */ -template< typename ObjType > -class RefVector : public ::std::vector< ::boost::shared_ptr< ObjType > > -{ -public: - typedef ::std::vector< ::boost::shared_ptr< ObjType > > container_type; - typedef typename container_type::value_type value_type; - typedef typename container_type::size_type size_type; - -public: - /** Returns true, if the object with the passed index exists. Returns - false, if the vector element exists but is an empty reference. */ - inline bool has( sal_Int32 nIndex ) const - { - const value_type* pxRef = getRef( nIndex ); - return pxRef && pxRef->get(); - } - - /** Returns a reference to the object with the passed index, or 0 on error. */ - inline value_type get( sal_Int32 nIndex ) const - { - if( const value_type* pxRef = getRef( nIndex ) ) return *pxRef; - return value_type(); - } - - /** Returns the index of the last element, or -1, if the vector is empty. - Does *not* check whether the last element is an empty reference. */ - inline sal_Int32 getLastIndex() const { return static_cast< sal_Int32 >( this->size() ) - 1; } - - /** Calls the passed functor for every contained object, automatically - skips all elements that are empty references. */ - template< typename FunctorType > - inline void forEach( FunctorType aFunctor ) const - { - ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( aFunctor ) ); - } - - /** Calls the passed member function of ObjType on every contained object, - automatically skips all elements that are empty references. */ - template< typename FuncType > - inline void forEachMem( FuncType pFunc ) const - { - forEach( ::boost::bind( pFunc, _1 ) ); - } - - /** Calls the passed member function of ObjType on every contained object, - automatically skips all elements that are empty references. */ - template< typename FuncType, typename ParamType > - inline void forEachMem( FuncType pFunc, ParamType aParam ) const - { - forEach( ::boost::bind( pFunc, _1, aParam ) ); - } - - /** Calls the passed member function of ObjType on every contained object, - automatically skips all elements that are empty references. */ - template< typename FuncType, typename ParamType1, typename ParamType2 > - inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const - { - forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) ); - } - - /** Calls the passed member function of ObjType on every contained object, - automatically skips all elements that are empty references. */ - template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 > - inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const - { - forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) ); - } - - /** Calls the passed functor for every contained object. Passes the index as - first argument and the object reference as second argument to rFunctor. */ - template< typename FunctorType > - inline void forEachWithIndex( const FunctorType& rFunctor ) const - { - ::std::for_each( this->begin(), this->end(), ForEachFunctorWithIndex< FunctorType >( rFunctor ) ); - } - - /** Calls the passed member function of ObjType on every contained object. - Passes the vector index to the member function. */ - template< typename FuncType > - inline void forEachMemWithIndex( FuncType pFunc ) const - { - forEachWithIndex( ::boost::bind( pFunc, _2, _1 ) ); - } - - /** Calls the passed member function of ObjType on every contained object. - Passes the vector index as first argument to the member function. */ - template< typename FuncType, typename ParamType > - inline void forEachMemWithIndex( FuncType pFunc, ParamType aParam ) const - { - forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam ) ); - } - - /** Calls the passed member function of ObjType on every contained object. - Passes the vector index as first argument to the member function. */ - template< typename FuncType, typename ParamType1, typename ParamType2 > - inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const - { - forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) ); - } - - /** Calls the passed member function of ObjType on every contained object. - Passes the vector index as first argument to the member function. */ - template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 > - inline void forEachMemWithIndex( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const - { - forEachWithIndex( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) ); - } - - /** Searches for an element by using the passed functor that takes a - constant reference of the object type (const ObjType&). */ - template< typename FunctorType > - inline value_type findIf( const FunctorType& rFunctor ) const - { - typename container_type::const_iterator aIt = ::std::find_if( this->begin(), this->end(), FindFunctor< FunctorType >( rFunctor ) ); - return (aIt == this->end()) ? value_type() : *aIt; - } - -private: - template< typename FunctorType > - struct ForEachFunctor - { - FunctorType maFunctor; - inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {} - inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( *rxValue ); } - }; - - template< typename FunctorType > - struct ForEachFunctorWithIndex - { - FunctorType maFunctor; - sal_Int32 mnIndex; - inline explicit ForEachFunctorWithIndex( const FunctorType& rFunctor ) : maFunctor( rFunctor ), mnIndex( 0 ) {} - inline void operator()( const value_type& rxValue ) { if( rxValue.get() ) maFunctor( mnIndex, *rxValue ); ++mnIndex; } - }; - - template< typename FunctorType > - struct FindFunctor - { - FunctorType maFunctor; - inline explicit FindFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {} - inline bool operator()( const value_type& rxValue ) { return rxValue.get() && maFunctor( *rxValue ); } - }; - - inline const value_type* getRef( sal_Int32 nIndex ) const - { - return ((0 <= nIndex) && (static_cast< size_type >( nIndex ) < this->size())) ? - &(*this)[ static_cast< size_type >( nIndex ) ] : 0; - } -}; - -// ============================================================================ - -/** Template for a map of ref-counted objects with additional accessor functions. - - An instance of the class RefMap< Type > stores elements of the type - ::boost::shared_ptr< Type >. The new accessor functions has() and get() - work correctly for nonexisting keys, there is no need to check the passed - key before. - */ -template< typename KeyType, typename ObjType, typename CompType = ::std::less< KeyType > > -class RefMap : public ::std::map< KeyType, ::boost::shared_ptr< ObjType >, CompType > -{ -public: - typedef ::std::map< KeyType, ::boost::shared_ptr< ObjType >, CompType > container_type; - typedef typename container_type::key_type key_type; - typedef typename container_type::mapped_type mapped_type; - typedef typename container_type::value_type value_type; - typedef typename container_type::key_compare key_compare; - -public: - /** Returns true, if the object accossiated to the passed key exists. - Returns false, if the key exists but points to an empty reference. */ - inline bool has( key_type nKey ) const - { - const mapped_type* pxRef = getRef( nKey ); - return pxRef && pxRef->get(); - } - - /** Returns a reference to the object accossiated to the passed key, or an - empty reference on error. */ - inline mapped_type get( key_type nKey ) const - { - if( const mapped_type* pxRef = getRef( nKey ) ) return *pxRef; - return mapped_type(); - } - - /** Calls the passed functor for every contained object, automatically - skips all elements that are empty references. */ - template< typename FunctorType > - inline void forEach( const FunctorType& rFunctor ) const - { - ::std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( rFunctor ) ); - } - - /** Calls the passed member function of ObjType on every contained object, - automatically skips all elements that are empty references. */ - template< typename FuncType > - inline void forEachMem( FuncType pFunc ) const - { - forEach( ::boost::bind( pFunc, _1 ) ); - } - - /** Calls the passed member function of ObjType on every contained object, - automatically skips all elements that are empty references. */ - template< typename FuncType, typename ParamType > - inline void forEachMem( FuncType pFunc, ParamType aParam ) const - { - forEach( ::boost::bind( pFunc, _1, aParam ) ); - } - - /** Calls the passed member function of ObjType on every contained object, - automatically skips all elements that are empty references. */ - template< typename FuncType, typename ParamType1, typename ParamType2 > - inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const - { - forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) ); - } - - /** Calls the passed member function of ObjType on every contained object, - automatically skips all elements that are empty references. */ - template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 > - inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const - { - forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) ); - } - /** Calls the passed functor for every contained object. Passes the key as - first argument and the object reference as second argument to rFunctor. */ - template< typename FunctorType > - inline void forEachWithKey( const FunctorType& rFunctor ) const - { - ::std::for_each( this->begin(), this->end(), ForEachFunctorWithKey< FunctorType >( rFunctor ) ); - } - - /** Calls the passed member function of ObjType on every contained object. - Passes the object key as argument to the member function. */ - template< typename FuncType > - inline void forEachMemWithKey( FuncType pFunc ) const - { - forEachWithKey( ::boost::bind( pFunc, _2, _1 ) ); - } - - /** Calls the passed member function of ObjType on every contained object. - Passes the object key as first argument to the member function. */ - template< typename FuncType, typename ParamType > - inline void forEachMemWithKey( FuncType pFunc, ParamType aParam ) const - { - forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam ) ); - } - - /** Calls the passed member function of ObjType on every contained object. - Passes the object key as first argument to the member function. */ - template< typename FuncType, typename ParamType1, typename ParamType2 > - inline void forEachMemWithKey( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const - { - forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2 ) ); - } - - /** Calls the passed member function of ObjType on every contained object. - Passes the object key as first argument to the member function. */ - template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 > - inline void forEachMemWithKey( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const - { - forEachWithKey( ::boost::bind( pFunc, _2, _1, aParam1, aParam2, aParam3 ) ); - } - -private: - template< typename FunctorType > - struct ForEachFunctor - { - FunctorType maFunctor; - inline explicit ForEachFunctor( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {} - inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( *rValue.second ); } - }; - - template< typename FunctorType > - struct ForEachFunctorWithKey - { - FunctorType maFunctor; - inline explicit ForEachFunctorWithKey( const FunctorType& rFunctor ) : maFunctor( rFunctor ) {} - inline void operator()( const value_type& rValue ) { if( rValue.second.get() ) maFunctor( rValue.first, *rValue.second ); } - }; - - inline const mapped_type* getRef( key_type nKey ) const - { - typename container_type::const_iterator aIt = find( nKey ); - return (aIt == this->end()) ? 0 : &aIt->second; - } -}; - -// ============================================================================ - /** Template for a 2-dimensional array of objects. This class template provides a similar interface to the ::std::vector @@ -518,45 +218,53 @@ public: /** Returns the pointer to an existing element of the passed vector, or a null pointer, if the passed index is out of bounds. */ - template< typename Type > - static const Type* getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex ); + template< typename VectorType > + static const typename 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. */ - template< typename Type > - static Type* getVectorElement( ::std::vector< Type >& rVector, sal_Int32 nIndex ); + template< typename VectorType > + static typename VectorType::value_type* + getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex ); /** Returns the reference to an existing element of the passed vector, or the passed default value, if the passed index is out of bounds. */ - template< typename Type > - static const Type& getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex, const Type& rDefault ); + template< typename VectorType > + static const typename 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. */ - template< typename Type > - static Type& getVectorElement( ::std::vector< Type >& rVector, sal_Int32 nIndex, Type& rDefault ); + template< typename VectorType > + static typename VectorType::value_type& + getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex, typename VectorType::value_type& rDefault ); /** 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. */ - template< typename Type, typename KeyType > - static const Type* getMapElement( const ::std::map< KeyType, Type >& rMap, KeyType nKey ); + template< typename MapType > + static const typename 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. */ - template< typename Type, typename KeyType > - static Type* getMapElement( ::std::map< KeyType, Type >& rMap, KeyType nKey ); + template< typename MapType > + static typename MapType::mapped_type* + getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey ); /** 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. */ - template< typename Type, typename KeyType > - static const Type& getMapElement( const ::std::map< KeyType, Type >& rMap, KeyType nKey, const Type& rDefault ); + template< typename MapType > + static const typename 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. */ - template< typename Type, typename KeyType > - static Type& getMapElement( ::std::map< KeyType, Type >& rMap, KeyType nKey, Type& rDefault ); + template< typename MapType > + static typename MapType::mapped_type& + getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey, typename MapType::mapped_type& rDefault ); - // vector/matrix to Sequence ---------------------------------------------- + // vector/map/matrix to UNO sequence -------------------------------------- /** Creates a UNO sequence from a std::vector with copies of all elements. @@ -565,9 +273,20 @@ public: @return A com.sun.star.uno.Sequence object with copies of all objects contained in the passed vector. */ - template< typename Type > - static ::com::sun::star::uno::Sequence< Type > - vectorToSequence( const ::std::vector< Type >& rVector ); + template< typename VectorType > + static ::com::sun::star::uno::Sequence< typename VectorType::value_type > + vectorToSequence( const VectorType& rVector ); + + /** Creates a UNO sequence from a std::map with copies of all elements. + + @param rMap The map to be converted to a sequence. + + @return A com.sun.star.uno.Sequence object with copies of all objects + contained in the passed map. + */ + template< typename MapType > + static ::com::sun::star::uno::Sequence< typename MapType::mapped_type > + mapToSequence( const MapType& rMap ); /** Creates a UNO sequence of sequences from a matrix with copies of all elements. @@ -577,126 +296,104 @@ public: com.sun.star.uno.Sequence objects with copies of all objects contained in the passed matrix. */ - template< typename Type > - static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Type > > - matrixToSequenceSequence( const Matrix< Type >& rMatrix ); + template< typename MatrixType > + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< typename MatrixType::value_type > > + matrixToSequenceSequence( const MatrixType& rMatrix ); }; // ---------------------------------------------------------------------------- -template< typename Type > -const Type* ContainerHelper::getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex ) +template< typename VectorType > +/*static*/ const typename VectorType::value_type* ContainerHelper::getVectorElement( const VectorType& rVector, sal_Int32 nIndex ) { return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : 0; } -template< typename Type > -Type* ContainerHelper::getVectorElement( ::std::vector< Type >& rVector, sal_Int32 nIndex ) +template< typename VectorType > +/*static*/ typename VectorType::value_type* ContainerHelper::getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex ) { return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : 0; } -template< typename Type > -const Type& ContainerHelper::getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex, const Type& rDefault ) +template< typename VectorType > +/*static*/ const typename VectorType::value_type& ContainerHelper::getVectorElement( const VectorType& rVector, sal_Int32 nIndex, const typename VectorType::value_type& rDefault ) { return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? rVector[ static_cast< size_t >( nIndex ) ] : rDefault; } -template< typename Type > -Type& ContainerHelper::getVectorElement( ::std::vector< Type >& rVector, sal_Int32 nIndex, Type& rDefault ) +template< typename VectorType > +/*static*/ typename VectorType::value_type& ContainerHelper::getVectorElementAccess( VectorType& rVector, sal_Int32 nIndex, typename VectorType::value_type& rDefault ) { return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? rVector[ static_cast< size_t >( nIndex ) ] : rDefault; } -template< typename Type, typename KeyType > -const Type* ContainerHelper::getMapElement( const ::std::map< KeyType, Type >& rMap, KeyType nKey ) +template< typename MapType > +/*static*/ const typename MapType::mapped_type* ContainerHelper::getMapElement( const MapType& rMap, const typename MapType::key_type& rKey ) { - typename ::std::map< KeyType, Type >::const_iterator aIt = rMap.find( nKey ); + typename MapType::const_iterator aIt = rMap.find( rKey ); return (aIt == rMap.end()) ? 0 : &aIt->second; } -template< typename Type, typename KeyType > -Type* ContainerHelper::getMapElement( ::std::map< KeyType, Type >& rMap, KeyType nKey ) +template< typename MapType > +/*static*/ typename MapType::mapped_type* ContainerHelper::getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey ) { - typename ::std::map< KeyType, Type >::iterator aIt = rMap.find( nKey ); + typename MapType::iterator aIt = rMap.find( rKey ); return (aIt == rMap.end()) ? 0 : &aIt->second; } -template< typename Type, typename KeyType > -const Type& ContainerHelper::getMapElement( const ::std::map< KeyType, Type >& rMap, KeyType nKey, const Type& rDefault ) +template< typename MapType > +/*static*/ const typename MapType::mapped_type& ContainerHelper::getMapElement( const MapType& rMap, const typename MapType::key_type& rKey, const typename MapType::mapped_type& rDefault ) { - typename ::std::map< KeyType, Type >::const_iterator aIt = rMap.find( nKey ); + typename MapType::const_iterator aIt = rMap.find( rKey ); return (aIt == rMap.end()) ? rDefault : aIt->second; } -template< typename Type, typename KeyType > -Type& ContainerHelper::getMapElement( ::std::map< KeyType, Type >& rMap, KeyType nKey, Type& rDefault ) +template< typename MapType > +/*static*/ typename MapType::mapped_type& ContainerHelper::getMapElementAccess( MapType& rMap, const typename MapType::key_type& rKey, typename MapType::mapped_type& rDefault ) { - typename ::std::map< KeyType, Type >::iterator aIt = rMap.find( nKey ); + typename MapType::iterator aIt = rMap.find( rKey ); return (aIt == rMap.end()) ? rDefault : aIt->second; } -template< typename Type > -::com::sun::star::uno::Sequence< Type > ContainerHelper::vectorToSequence( const ::std::vector< Type >& rVector ) +template< typename VectorType > +/*static*/ ::com::sun::star::uno::Sequence< typename VectorType::value_type > ContainerHelper::vectorToSequence( const VectorType& rVector ) { + typedef typename VectorType::value_type ValueType; if( rVector.empty() ) - return ::com::sun::star::uno::Sequence< Type >(); - return ::com::sun::star::uno::Sequence< Type >( &rVector.front(), static_cast< sal_Int32 >( rVector.size() ) ); + return ::com::sun::star::uno::Sequence< ValueType >(); + return ::com::sun::star::uno::Sequence< ValueType >( &rVector.front(), static_cast< sal_Int32 >( rVector.size() ) ); } -template< typename Type > -::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Type > > ContainerHelper::matrixToSequenceSequence( const Matrix< Type >& rMatrix ) +template< typename MapType > +/*static*/ ::com::sun::star::uno::Sequence< typename MapType::mapped_type > ContainerHelper::mapToSequence( const MapType& rMap ) +{ + typedef typename MapType::mapped_type ValueType; + if( rMap.empty() ) + return ::com::sun::star::uno::Sequence< ValueType >(); + ::com::sun::star::uno::Sequence< ValueType > aSeq( static_cast< sal_Int32 >( rMap.size() ) ); + sal_Int32 nIndex = 0; + for( typename MapType::const_iterator aIt = rMap.begin(), aEnd = rMap.end(); aIt != aEnd; ++aIt, ++nIndex ) + aSeq[ nIndex ] = *aIt; + return aSeq; +} + +template< typename MatrixType > +/*static*/ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< typename MatrixType::value_type > > ContainerHelper::matrixToSequenceSequence( const MatrixType& rMatrix ) { - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Type > > aSeq; + typedef typename MatrixType::value_type ValueType; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ValueType > > aSeq; if( !rMatrix.empty() ) { aSeq.realloc( static_cast< sal_Int32 >( rMatrix.height() ) ); for( size_t nRow = 0, nHeight = rMatrix.height(); nRow < nHeight; ++nRow ) aSeq[ static_cast< sal_Int32 >( nRow ) ] = - ::com::sun::star::uno::Sequence< Type >( &rMatrix.row_front( nRow ), static_cast< sal_Int32 >( rMatrix.width() ) ); + ::com::sun::star::uno::Sequence< ValueType >( &rMatrix.row_front( nRow ), static_cast< sal_Int32 >( rMatrix.width() ) ); } return aSeq; } // ============================================================================ -/** This helper manages named objects in a container, which is created on demand. - */ -class ObjectContainer -{ -public: - explicit ObjectContainer( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, - const ::rtl::OUString& rServiceName ); - ~ObjectContainer(); - - /** Returns true, if the object with the passed name exists in the container. */ - bool hasObject( const ::rtl::OUString& rObjName ) const; - - /** Returns the object with the passed name from the container. */ - ::com::sun::star::uno::Any getObject( const ::rtl::OUString& rObjName ) const; - - /** Inserts the passed object into the container, returns its final name. */ - ::rtl::OUString insertObject( - const ::rtl::OUString& rObjName, - const ::com::sun::star::uno::Any& rObj, - bool bInsertByUnusedName ); - -private: - void createContainer() const; - -private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - mxFactory; /// Factory to create the container. - mutable ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > - mxContainer; /// Container for the objects. - ::rtl::OUString maServiceName; /// Service name to create the container. - sal_Int32 mnIndex; /// Index to create unique identifiers. -}; - -// ============================================================================ - } // namespace oox #endif - |