diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-09-09 11:45:13 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-09-09 11:45:13 +0200 |
commit | 0cb550725d7e128e72e67739aff5338865c28abc (patch) | |
tree | 0ffabe03dd8b83e273539f26f633273d50c37397 /comphelper | |
parent | aa611d78df11fcc1e35ead5fa093143bf17e4cf6 (diff) | |
parent | 1f0839c836781bc41f8c301b6262eabc978c90f8 (diff) |
merge commit to DEV300_m57
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/inc/comphelper/processfactory.hxx | 11 | ||||
-rw-r--r-- | comphelper/inc/comphelper/stl_types.hxx | 54 | ||||
-rw-r--r-- | comphelper/inc/comphelper/stlunosequence.hxx | 480 | ||||
-rw-r--r-- | comphelper/inc/comphelper/storagehelper.hxx | 3 | ||||
-rw-r--r-- | comphelper/source/misc/mediadescriptor.cxx | 9 | ||||
-rw-r--r-- | comphelper/source/misc/string.cxx | 27 | ||||
-rw-r--r-- | comphelper/source/misc/types.cxx | 11 | ||||
-rw-r--r-- | comphelper/source/misc/uieventslogger.cxx | 3 | ||||
-rw-r--r-- | comphelper/source/processfactory/processfactory.cxx | 20 | ||||
-rw-r--r-- | comphelper/source/property/propertybag.cxx | 5 | ||||
-rw-r--r-- | comphelper/source/property/propertycontainerhelper.cxx | 4 | ||||
-rw-r--r-- | comphelper/source/streaming/memorystream.cxx | 3 |
12 files changed, 153 insertions, 477 deletions
diff --git a/comphelper/inc/comphelper/processfactory.hxx b/comphelper/inc/comphelper/processfactory.hxx index d2ae887ba341..9b24f8e784ac 100644 --- a/comphelper/inc/comphelper/processfactory.hxx +++ b/comphelper/inc/comphelper/processfactory.hxx @@ -79,10 +79,19 @@ COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XI const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArgs ) SAL_THROW( ( ::com::sun::star::uno::RuntimeException ) ); +/** + * This function gets the process service factory's default component context. + * If no service factory is set the function returns a null interface. + */ +COMPHELPER_DLLPUBLIC +::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > +getProcessComponentContext(); + } + extern "C" { -/// @internal +/// @internal ATTENTION returns ACQUIRED pointer! release it explicitly! COMPHELPER_DLLPUBLIC ::com::sun::star::uno::XComponentContext * comphelper_getProcessComponentContext(); diff --git a/comphelper/inc/comphelper/stl_types.hxx b/comphelper/inc/comphelper/stl_types.hxx index aeb6342048c9..4b3126043a08 100644 --- a/comphelper/inc/comphelper/stl_types.hxx +++ b/comphelper/inc/comphelper/stl_types.hxx @@ -49,6 +49,7 @@ #include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/beans/PropertyValue.hpp> @@ -192,6 +193,59 @@ inline mem_fun1_t<_Tp,_Arg> mem_fun(void (_Tp::*__f)(_Arg)) } //......................................................................... +/** output iterator that appends OUStrings into an OUStringBuffer. + */ +class OUStringBufferAppender : + public ::std::iterator< ::std::output_iterator_tag, void, void, void, void> +{ +public: + typedef OUStringBufferAppender Self; + typedef ::std::output_iterator_tag iterator_category; + typedef void value_type; + typedef void reference; + typedef void pointer; + typedef size_t difference_type; + + OUStringBufferAppender(::rtl::OUStringBuffer & i_rBuffer) + : m_rBuffer(i_rBuffer) { } + Self & operator=(::rtl::OUString const & i_rStr) + { + m_rBuffer.append( i_rStr ); + return *this; + } + Self & operator*() { return *this; } // so operator= works + Self & operator++() { return *this; } + Self & operator++(int) { return *this; } + +private: + ::rtl::OUStringBuffer & m_rBuffer; +}; + +//......................................................................... +/** algorithm similar to std::copy, but inserts a separator between elements. + */ +template< typename ForwardIter, typename OutputIter, typename T > +OutputIter intersperse( + ForwardIter start, ForwardIter end, OutputIter out, T const & separator) +{ + if (start != end) { + *out = *start; + ++start; + ++out; + } + + while (start != end) { + *out = separator; + ++out; + *out = *start; + ++start; + ++out; + } + + return out; +} + +//......................................................................... } //... namespace comphelper ................................................ diff --git a/comphelper/inc/comphelper/stlunosequence.hxx b/comphelper/inc/comphelper/stlunosequence.hxx index 2ffe08cb6b75..c9bc525cabd6 100644 --- a/comphelper/inc/comphelper/stlunosequence.hxx +++ b/comphelper/inc/comphelper/stlunosequence.hxx @@ -5,9 +5,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: stlunosequence.hxx,v $ + * $RCSfile: $ * - * $Revision: 1.3 $ + * $Revision: $ * * This file is part of OpenOffice.org. * @@ -31,457 +31,59 @@ #define _COMPHELPER_STLUNOITERATOR_HXX #include <com/sun/star/uno/Sequence.hxx> -#include <iterator> #include <sal/types.h> -namespace comphelper { namespace stlunosequence { - template<typename S, typename V> - class StlSequence; - - template<typename S, typename V> - class StlSequenceIterator : public std::iterator<std::random_access_iterator_tag, V, sal_Int32> - { - public: - typedef ::std::random_access_iterator_tag iterator_category; - typedef V& reference; - typedef V value_type; - typedef sal_Int32 difference_type; - typedef V* pointer; - typedef const V& const_reference; - - StlSequenceIterator(); - StlSequenceIterator(S * uno_sequence, typename StlSequenceIterator<S,V>::difference_type index); - - reference operator*() const; - StlSequenceIterator<S,V>& operator++(); - StlSequenceIterator<S,V> operator++(int); - StlSequenceIterator<S,V>& operator--(); - StlSequenceIterator<S,V> operator--(int); - StlSequenceIterator<S,V>& operator+=(const typename StlSequenceIterator<S,V>::difference_type by); - StlSequenceIterator<S,V>& operator-=(const typename StlSequenceIterator<S,V>::difference_type by); - StlSequenceIterator<S,V> operator+(const typename StlSequenceIterator<S,V>::difference_type by) const; - StlSequenceIterator<S,V> operator-(const typename StlSequenceIterator<S,V>::difference_type by) const; - typename StlSequenceIterator<S,V>::difference_type operator-(const StlSequenceIterator<S,V>& to) const; - - bool operator==(const StlSequenceIterator<S,V>& other) const; - bool operator!=(const StlSequenceIterator<S,V>& other) const; - bool operator<(const StlSequenceIterator<S,V>& other) const; - reference operator[](const typename StlSequenceIterator<S,V>::difference_type by) const; - - - protected: - friend class StlSequence<S,V>; - S * m_UnoSequence; - typename StlSequenceIterator<S,V>::difference_type m_Index; - }; - - template<typename S, typename V> - class StlSequenceConstIterator : public StlSequenceIterator<S,V> - { - public: - typedef const V& reference; - StlSequenceConstIterator(); - StlSequenceConstIterator(S * uno_sequence, typename StlSequenceIterator<S,V>::difference_type by); - typename StlSequenceIterator<S,V>::const_reference operator*() const - { - return (*(this->m_UnoSequence))[this->m_Index]; - } - - typename StlSequenceIterator<S,V>::const_reference operator[](const typename StlSequenceIterator<S,V>::difference_type by) const - { - return (*(this->m_UnoSequence))[this->m_Index+by]; - } - }; - - template<typename S, typename V> - class StlSequence - { - public: - typedef sal_Int32 size_type; - typedef V& reference; - typedef const V& const_reference; - typedef sal_Int32 difference_type; - typedef V value_type; - typedef StlSequenceIterator<S,V> iterator; - typedef StlSequenceConstIterator<S,V> const_iterator; - - StlSequence(S& uno_sequence); - - typename StlSequence<S,V>::size_type size() const; - typename StlSequence<S,V>::size_type max_size() const; - bool empty() const; - void swap(StlSequence<S,V>& other); - typename StlSequence<S,V>::iterator begin(); - typename StlSequence<S,V>::iterator end(); - typename StlSequence<S,V>::const_iterator begin() const; - typename StlSequence<S,V>::const_iterator end() const; - - bool operator==(const StlSequence<S,V>& other) const; - bool operator!=(const StlSequence<S,V>& other) const; - bool operator<(const StlSequence<S,V>& other) const; - bool operator>(const StlSequence<S,V>& other) const; - bool operator<=(const StlSequence<S,V>& other) const; - bool operator>=(const StlSequence<S,V>& other) const; - - - private: - friend class StlSequenceIterator<S,V>; - S * m_UnoSequence; - static const typename StlSequence<S,V>::size_type begin_of_sequence; - static const typename StlSequence<S,V>::size_type end_of_sequence; - }; - - //StlSequenceIterator - template<typename S, typename V> - StlSequenceIterator<S,V>::StlSequenceIterator() - : m_UnoSequence(0), m_Index(StlSequence<S,V>::end_of_sequence) - {} - - template<typename S, typename V> - StlSequenceConstIterator<S,V>::StlSequenceConstIterator() - {} - - template<typename S, typename V> - StlSequenceIterator<S, V>::StlSequenceIterator(S * uno_sequence, typename StlSequenceIterator<S,V>::difference_type index) - : m_UnoSequence(uno_sequence), m_Index(index) - {} - - template<typename S, typename V> - StlSequenceConstIterator<S, V>::StlSequenceConstIterator(S * uno_sequence, typename StlSequenceIterator<S,V>::difference_type index) - : StlSequenceIterator<S,V>(uno_sequence, index) - {} - - template<typename S, typename V> - inline typename StlSequenceIterator<S,V>::reference StlSequenceIterator<S, V>::operator*() const - { - return (*m_UnoSequence)[m_Index]; - } - - template<typename S, typename V> - inline StlSequenceIterator<S,V>& StlSequenceIterator<S, V>::operator++() - { - ++m_Index; - if(m_Index>=m_UnoSequence->getLength()) - m_Index = StlSequence<S,V>::end_of_sequence; - return *this; - } - - template<typename S, typename V> - inline StlSequenceIterator<S,V> StlSequenceIterator<S, V>::operator++(int) - { - StlSequenceIterator<S,V> temp = *this; - ++*this; - return temp; - } - - template<typename S, typename V> - inline StlSequenceIterator<S,V>& StlSequenceIterator<S, V>::operator--() - { - if(m_Index==StlSequence<S,V>::end_of_sequence) - m_Index = m_UnoSequence->getLength(); - --m_Index; - return *this; - } - - template<typename S, typename V> - inline StlSequenceIterator<S,V> StlSequenceIterator<S, V>::operator--(int) - { - StlSequenceIterator<S,V> temp = *this; - --*this; - return temp; - } - - template<typename S, typename V> - inline StlSequenceIterator<S,V>& StlSequenceIterator<S, V>::operator+=(const typename StlSequenceIterator<S,V>::difference_type by) - { - if(by<0) - { - this->operator-=(-by); - return *this; - } - if(by==0) - return *this; - m_Index+=by; - if(m_Index>=m_UnoSequence->getLength()) - m_Index=StlSequence<S,V>::end_of_sequence; - return *this; - } - - template<typename S, typename V> - inline StlSequenceIterator<S,V>& StlSequenceIterator<S, V>::operator-=(const typename StlSequenceIterator<S,V>::difference_type by) - { - if(by<0) - { - if(-by==by) return *this; // breaking infinitive loop on MIN_INT - this->operator+=(-by); - return *this; - } - if(by==0) - return *this; - if(m_Index==StlSequence<S,V>::end_of_sequence) - m_Index=m_UnoSequence->getLength(); - m_Index-=by; - return *this; - } - - template<typename S, typename V> - inline StlSequenceIterator<S,V> StlSequenceIterator<S, V>::operator+(const typename StlSequenceIterator<S,V>::difference_type by) const - { - StlSequenceIterator<S,V> result = StlSequenceIterator<S,V>(*this); - result+=by; - return result; - } - - template<typename S, typename V> - inline StlSequenceIterator<S,V> StlSequenceIterator<S, V>::operator-(const typename StlSequenceIterator<S,V>::difference_type by) const - { - StlSequenceIterator<S,V> result = StlSequenceIterator<S,V>(*this); - result-=by; - return result; - } - - template<typename S, typename V> - inline typename StlSequenceIterator<S,V>::difference_type StlSequenceIterator<S, V>::operator-(const StlSequenceIterator<S,V>& to) const - { - if(m_Index==StlSequence<S,V>::end_of_sequence ^ to.m_Index==StlSequence<S,V>::end_of_sequence) - { - if(m_Index==StlSequence<S,V>::end_of_sequence) - return m_UnoSequence->getLength()-to.m_Index; - else - return m_Index-m_UnoSequence->getLength(); - } - return m_Index-to.m_Index; - } - - template<typename S, typename V> - inline bool StlSequenceIterator<S, V>::operator==(const StlSequenceIterator<S,V>& other) const - { - return (m_Index == other.m_Index); - } - - template<typename S, typename V> - inline bool StlSequenceIterator<S, V>::operator!=(const StlSequenceIterator<S,V>& other) const - { - return !this->operator==(other); - } - - template<typename S, typename V> - inline bool StlSequenceIterator<S, V>::operator<(const StlSequenceIterator<S,V>& other) const - { - if(m_Index==StlSequence<S,V>::end_of_sequence ^ other.m_Index==StlSequence<S,V>::end_of_sequence) - return other.m_Index==StlSequence<S,V>::end_of_sequence; - return m_Index<other.m_Index; - } - - template<typename S, typename V> - inline typename StlSequenceIterator<S,V>::reference StlSequenceIterator<S, V>::operator[](const typename StlSequenceIterator<S,V>::difference_type by) const - { - return (*(this->m_UnoSequence))[this->m_Index+by]; - } - - // StlSequence - template<typename S, typename V> - StlSequence<S,V>::StlSequence(S& uno_sequence) - : m_UnoSequence(&uno_sequence) - {} - - template<typename S, typename V> - inline typename StlSequence<S,V>::size_type StlSequence<S,V>::size() const - { - return m_UnoSequence->getLength(); - } - - template<typename S, typename V> - inline typename StlSequence<S,V>::size_type StlSequence<S,V>::max_size() const - { - return this->size(); - } - - template<typename S, typename V> - inline bool StlSequence<S,V>::empty() const - { - return this->size() == 0; - } - - template<typename S, typename V> - inline void StlSequence<S,V>::swap(StlSequence<S,V>& other) - { - ::std::swap(*this, other); - } - - template<typename S, typename V> - inline typename StlSequence<S,V>::iterator StlSequence<S,V>::begin() - { - return typename StlSequence<S,V>::iterator(m_UnoSequence, begin_of_sequence); - } - - template<typename S, typename V> - inline typename StlSequence<S,V>::iterator StlSequence<S,V>::end() - { - return typename StlSequence<S,V>::iterator(m_UnoSequence, end_of_sequence); - } - - template<typename S, typename V> - inline typename StlSequence<S,V>::const_iterator StlSequence<S,V>::begin() const - { - return typename StlSequence<S,V>::const_iterator(m_UnoSequence, begin_of_sequence); - } - - template<typename S, typename V> - inline typename StlSequence<S,V>::const_iterator StlSequence<S,V>::end() const - { - return typename StlSequence<S,V>::const_iterator(m_UnoSequence, end_of_sequence); - } - - template<typename S, typename V> - inline bool StlSequence<S,V>::operator==(const StlSequence<S,V>& other) const - { - if(this->size() != other.size()) return false; - return ::std::equal(this->begin(), this->end(), other.begin()); - } - - template<typename S, typename V> - inline bool StlSequence<S,V>::operator<(const StlSequence<S,V>& other) const - { - return ::std::lexicographical_compare(this->begin(), this->end(), other.begin(), other.end()); - } - - template<typename S, typename V> - inline bool StlSequence<S,V>::operator!=(const StlSequence<S,V>& other) const - { return !(*this == other); } - - template<typename S, typename V> - inline bool StlSequence<S,V>::operator>(const StlSequence<S,V>& other) const - { return (other < *this); } - - template<typename S, typename V> - inline bool StlSequence<S,V>::operator<=(const StlSequence<S,V>& other) const - { return !(other < *this); } - - template<typename S, typename V> - inline bool StlSequence<S,V>::operator>=(const StlSequence<S,V>& other) const - { return !(*this < other); } - - template<typename S, typename V> - const typename StlSequence<S,V>::size_type StlSequence<S,V>::begin_of_sequence = 0; - - template<typename S, typename V> - const typename StlSequence<S,V>::size_type StlSequence<S,V>::end_of_sequence = -1; -}} - namespace comphelper { /** - @short a wrapper-class that provides stl-container-like access to an existing - ::com::sun::star::uno::Sequence - @descr This template class allows using an existing ::com::sun::star::uno::Sequence - like any other stl container. It provides standard-compliant mutable random access - iterators. Because random access iterators are the most generic iterators defined - by the stl, any stl algorithm can be applied to the Sequence. - <p> - This is just a basic stl forward container, but _not_ an stl sequence (the size of the - ::com::sun::star::uno::Sequence cannot be changed using the StlUnoSequence interface). - Inserts are expensive operations on ::com::sun::star::uno::Sequence - use - ::std::copy() to a efficient stl container implementing the stl sequence interface - and the available insert iterator adapters you need those. - <p> - @attention There is one requirement of an stl container that this class does not meet: - It is _not_ owner of its contents and thus it does not destroy its contents when destructed. - @attention No additional boundschecking over the requirements of the STL are performed. - E.g. sequence.begin()-- results in undefined behavior. - @attention StlUnoSequence is not threadsafe. - <p> - Example: (creating a ::std::list from a ::com::sun::star::uno::Sequence) - <code> - ::com::sun::star::uno::Sequence<sal_Int32> uno_seq(10); - ::comphelper::StlUnoSequence<sal_Int32> stl_seq(&uno_seq); - ::std::list stl_list(stl_seq.begin(), stl_seq.end()); - </code> - <p> - Example: (sorting ::com::sun::star::uno::Sequence inplace) - <code> - ::com::sun::star::uno::Sequence<sal_Int32> uno_seq(10); - ::comphelper::StlUnoSequence<sal_Int32> stl_seq(&uno_seq); - ::std::sort(stl_seq.begin(), stl_seq.end()); - </code> - <p> - Example: (counting occurrences of 4711 in a ::com::sun::star::uno::Sequence) - <code> - ::com::sun::star::uno::Sequence<sal_Int32> uno_seq(10); - ::comphelper::StlUnoSequence<sal_Int32> stl_seq(&uno_seq); - sal_Int32 count = 0; - ::std::count(stl_seq.begin(), stl_seq.end(), 4711, count); - </code> - <p> - Example: (inserting the second half of one Sequence after the first element of another) - <code> - ::com::sun::star::uno::Sequence<sal_Int32> uno_seq1(10); - ::com::sun::star::uno::Sequence<sal_Int32> uno_seq2(10); - ::com::sun::star::uno::Sequence<sal_Int32> result(15); - ::comphelper::StlUnoSequence<sal_Int32> stl_seq1(&uno_seq1); - ::comphelper::StlUnoSequence<sal_Int32> stl_seq2(&uno_seq1); - ::comphelper::StlUnoSequence<sal_Int32> stl_result(&result); - ::std::list<sal_Int32> temp(uno_seq1.begin(), uno_seq1.end()); - ::std::copy(uno_seq2.begin()+5, uno_seq2.end(), ::std::insert_iterator< ::std::list<sal_Int32> >(temp, ++temp.begin())); - ::std::copy(temp.begin(), temp.end(), result.begin()); - </code> - - @see http://www.sgi.com/tech/stl/Container.html - @see http://www.sgi.com/tech/stl/Sequence.html - @see http://www.sgi.com/tech/stl/RandomAccessIterator.html + @short stl-container-like access to an existing ::com::sun::star::uno::Sequence + @descr These template functions allows using an existing + ::com::sun::star::uno::Sequence using stl algorithms. They provides + standard-compliant mutable random access iterators. Because random access + iterators are the most generic iterators defined by the stl, any stl algorithm + can be applied to the Sequence (excluding algorithms requiring output + iterators). + <p> + Example: (creating a ::std::list from a ::com::sun::star::uno::Sequence) + <code> + ::com::sun::star::uno::Sequence<sal_Int32> aSeq(10); + ::std::list stl_list(stl_begin(aSeq), stl_end(aSeq)); + </code> + <p> + Example: (sorting ::com::sun::star::uno::Sequence inplace) + <code> + ::com::sun::star::uno::Sequence<sal_Int32> aSeq(10); + ::std::sort(stl_begin(aSeq), stl_seq.end(aSeq)); + </code> + <p> + Example: (counting occurrences of 4711 in a ::com::sun::star::uno::Sequence) + <code> + ::com::sun::star::uno::Sequence<sal_Int32> aSeq(10); + sal_Int32 count = 0; + ::std::count(stl_begin(aSeq), stl_end(aSeq), 4711, count); + </code> + <p> + + @see http://www.sgi.com/tech/stl/Container.html + @see http://www.sgi.com/tech/stl/Sequence.html + @see http://www.sgi.com/tech/stl/RandomAccessIterator.html */ template <typename V> - class StlUnoSequence : public stlunosequence::StlSequence< ::com::sun::star::uno::Sequence<V>, V> - { - public: - /* - @short named constructor (these are needed to keep const-correctness) - */ - static StlUnoSequence<V> createInstance(::com::sun::star::uno::Sequence<V>& uno_sequence) - { return StlUnoSequence<V>(uno_sequence); } - /* - @short named constructor (these are needed to keep const-correctness) - */ - static const StlUnoSequence<V> createInstance(const ::com::sun::star::uno::Sequence<V>& uno_sequence) - { return StlUnoSequence<V>(const_cast< ::com::sun::star::uno::Sequence<V>& >(uno_sequence)); } - private: - StlUnoSequence(::com::sun::star::uno::Sequence<V>& uno_sequence) - : stlunosequence::StlSequence< ::com::sun::star::uno::Sequence<V>, V>(uno_sequence) - {} - }; - - /* - @short shortcut for StlUnoSequence<V>::createInstance(uno_sequence).begin() - */ - template <typename V> - typename StlUnoSequence<V>::iterator stl_begin(::com::sun::star::uno::Sequence<V>& uno_sequence) - { return StlUnoSequence<V>::createInstance(uno_sequence).begin(); } + V* stl_begin(::com::sun::star::uno::Sequence<V>& rSeq) + { return rSeq.getArray(); } - /* - @short shortcut for StlUnoSequence<V>::createInstance(uno_sequence).end() - */ template <typename V> - typename StlUnoSequence<V>::iterator stl_end(::com::sun::star::uno::Sequence<V>& uno_sequence) - { return StlUnoSequence<V>::createInstance(uno_sequence).end(); } + V* stl_end(::com::sun::star::uno::Sequence<V>& rSeq) + { return rSeq.getArray() + rSeq.getLength(); } - /* - @short shortcut for StlUnoSequence<V>::createInstance(uno_sequence).begin() - */ template <typename V> - typename StlUnoSequence<V>::const_iterator stl_begin(const ::com::sun::star::uno::Sequence<V>& uno_sequence) - { - return StlUnoSequence<V>::createInstance(uno_sequence).begin(); - } + const V* stl_begin(const ::com::sun::star::uno::Sequence<V>& rSeq) + { return rSeq.getConstArray(); } - /* - @short shortcut for StlUnoSequence<V>::createInstance(uno_sequence).end() - */ template <typename V> - typename StlUnoSequence<V>::const_iterator stl_end(const ::com::sun::star::uno::Sequence<V>& uno_sequence) - { - return StlUnoSequence<V>::createInstance(uno_sequence).end(); - } + const V* stl_end(const ::com::sun::star::uno::Sequence<V>& rSeq) + { return rSeq.getConstArray() + rSeq.getLength(); } } #endif diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx index b99f7e1233ca..efb5431959ba 100644 --- a/comphelper/inc/comphelper/storagehelper.hxx +++ b/comphelper/inc/comphelper/storagehelper.hxx @@ -48,9 +48,6 @@ namespace comphelper { -sal_Bool COMPHELPER_DLLPUBLIC IsValidZipEntryFileName( - const sal_Unicode *pChar, sal_Int32 nLength, sal_Bool bSlashAllowed ); - class COMPHELPER_DLLPUBLIC OStorageHelper { public: diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx index da0dd71a5520..9f463cdf0380 100644 --- a/comphelper/source/misc/mediadescriptor.cxx +++ b/comphelper/source/misc/mediadescriptor.cxx @@ -726,8 +726,13 @@ class StillReadWriteInteraction : public ::ucbhelper::InterceptedInteraction css::ucb::InteractiveIOException exIO; xRequest->getRequest() >>= exIO; bAbort = ( - (exIO.Code == css::ucb::IOErrorCode_ACCESS_DENIED ) || - (exIO.Code == css::ucb::IOErrorCode_LOCKING_VIOLATION ) + (exIO.Code == css::ucb::IOErrorCode_ACCESS_DENIED ) + || (exIO.Code == css::ucb::IOErrorCode_LOCKING_VIOLATION ) +#ifdef MACOSX + // this is a workaround for MAC, on this platform if the file is locked + // the returned error code looks to be wrong + || (exIO.Code == css::ucb::IOErrorCode_GENERAL ) +#endif ); } break; diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx index 77a251372d85..e9437528b0de 100644 --- a/comphelper/source/misc/string.cxx +++ b/comphelper/source/misc/string.cxx @@ -36,10 +36,13 @@ #include <vector> #include <algorithm> -#include "comphelper/string.hxx" -#include "rtl/ustring.hxx" -#include "sal/types.h" -#include "comphelper/stlunosequence.hxx" +#include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> +#include <sal/types.h> + +#include <comphelper/string.hxx> +#include <comphelper/stlunosequence.hxx> +#include <comphelper/stl_types.hxx> namespace comphelper { namespace string { @@ -96,12 +99,12 @@ rtl::OUString searchAndReplaceAsciiL( ::rtl::OUString convertCommaSeparated( ::com::sun::star::uno::Sequence< ::rtl::OUString > const& i_rSeq) { - ::rtl::OUString ret; - for (sal_Int32 i = 0; i < i_rSeq.getLength(); ++i) { - if (i != 0) ret += ::rtl::OUString::createFromAscii(", "); - ret += i_rSeq[i]; - } - return ret; + ::rtl::OUStringBuffer buf; + ::comphelper::intersperse( + ::comphelper::stl_begin(i_rSeq), ::comphelper::stl_end(i_rSeq), + ::comphelper::OUStringBufferAppender(buf), + ::rtl::OUString::createFromAscii(", ")); + return buf.makeStringAndClear(); } ::com::sun::star::uno::Sequence< ::rtl::OUString > @@ -119,10 +122,6 @@ rtl::OUString searchAndReplaceAsciiL( } while (idx >= 0); ::com::sun::star::uno::Sequence< ::rtl::OUString > kws(vec.size()); std::copy(vec.begin(), vec.end(), stl_begin(kws)); - /* - for (size_t i = 0; i < vec.size(); ++i) { - kws[i] = vec.at(i); - }*/ return kws; } diff --git a/comphelper/source/misc/types.cxx b/comphelper/source/misc/types.cxx index 2b20fd9acca3..2a9180c038b0 100644 --- a/comphelper/source/misc/types.cxx +++ b/comphelper/source/misc/types.cxx @@ -87,8 +87,7 @@ sal_Bool operator ==(const Time& _rLeft, const Time& _rRight) sal_Int32 getINT32(const Any& _rAny) { sal_Int32 nReturn = 0; - _rAny >>= nReturn; - + OSL_VERIFY( _rAny >>= nReturn ); return nReturn; } @@ -96,7 +95,7 @@ sal_Int32 getINT32(const Any& _rAny) sal_Int16 getINT16(const Any& _rAny) { sal_Int16 nReturn = 0; - _rAny >>= nReturn; + OSL_VERIFY( _rAny >>= nReturn ); return nReturn; } @@ -104,7 +103,7 @@ sal_Int16 getINT16(const Any& _rAny) double getDouble(const Any& _rAny) { double nReturn = 0.0; - _rAny >>= nReturn; + OSL_VERIFY( _rAny >>= nReturn ); return nReturn; } @@ -112,7 +111,7 @@ double getDouble(const Any& _rAny) float getFloat(const Any& _rAny) { float nReturn = 0.0; - _rAny >>= nReturn; + OSL_VERIFY( _rAny >>= nReturn ); return nReturn; } @@ -120,7 +119,7 @@ float getFloat(const Any& _rAny) ::rtl::OUString getString(const Any& _rAny) { ::rtl::OUString nReturn; - _rAny >>= nReturn; + OSL_VERIFY( _rAny >>= nReturn ); return nReturn; } diff --git a/comphelper/source/misc/uieventslogger.cxx b/comphelper/source/misc/uieventslogger.cxx index 3ff875a4e67d..a55d5b58854d 100644 --- a/comphelper/source/misc/uieventslogger.cxx +++ b/comphelper/source/misc/uieventslogger.cxx @@ -375,9 +375,10 @@ namespace comphelper } else logdata[2] = UNKNOWN_ORIGIN; - logdata[3] = url.Complete; if(url.Complete.match(URL_FILE)) logdata[3] = URL_FILE; + else + logdata[3] = url.Main; m_Logger->log(LogLevel::INFO, m_Formatter->formatMultiColumn(logdata)); m_SessionLogEventCount++; } diff --git a/comphelper/source/processfactory/processfactory.cxx b/comphelper/source/processfactory/processfactory.cxx index 0f50f4a4cb01..c4eac583e3c0 100644 --- a/comphelper/source/processfactory/processfactory.cxx +++ b/comphelper/source/processfactory/processfactory.cxx @@ -98,24 +98,30 @@ Reference< XInterface > createProcessComponentWithArguments( const ::rtl::OUStri return xComponent; } -} // namesapce comphelper - -extern "C" { -uno::XComponentContext * comphelper_getProcessComponentContext() +Reference< XComponentContext > getProcessComponentContext() { - uno::Reference<uno::XComponentContext> xRet; + Reference< XComponentContext > xRet; uno::Reference<beans::XPropertySet> const xProps( comphelper::getProcessServiceFactory(), uno::UNO_QUERY ); if (xProps.is()) { try { - xRet.set( xProps->getPropertyValue( - rtl::OUString( + xRet.set( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ), uno::UNO_QUERY ); } catch (beans::UnknownPropertyException const&) { } } + return xRet; +} + +} // namespace comphelper + +extern "C" { +uno::XComponentContext * comphelper_getProcessComponentContext() +{ + uno::Reference<uno::XComponentContext> xRet; + xRet = ::comphelper::getProcessComponentContext(); if (xRet.is()) xRet->acquire(); return xRet.get(); diff --git a/comphelper/source/property/propertybag.cxx b/comphelper/source/property/propertybag.cxx index a56793e05769..383e1cc2c5aa 100644 --- a/comphelper/source/property/propertybag.cxx +++ b/comphelper/source/property/propertybag.cxx @@ -168,10 +168,11 @@ namespace comphelper // will throw an UnknownPropertyException if necessary if ( ( rProp.Attributes & PropertyAttribute::REMOVEABLE ) == 0 ) throw NotRemoveableException( ::rtl::OUString(), NULL ); + const sal_Int32 nHandle = rProp.Handle; - revokeProperty( rProp.Handle ); + revokeProperty( nHandle ); - m_pImpl->aDefaults.erase( rProp.Handle ); + m_pImpl->aDefaults.erase( nHandle ); } //-------------------------------------------------------------------- diff --git a/comphelper/source/property/propertycontainerhelper.cxx b/comphelper/source/property/propertycontainerhelper.cxx index 9d1662d1ecf2..7f5db1d6cf7e 100644 --- a/comphelper/source/property/propertycontainerhelper.cxx +++ b/comphelper/source/property/propertycontainerhelper.cxx @@ -76,12 +76,12 @@ namespace // comparing two property descriptions (by name) struct PropertyDescriptionNameMatch : public ::std::unary_function< PropertyDescription, bool > { - const ::rtl::OUString& m_rCompare; + ::rtl::OUString m_rCompare; PropertyDescriptionNameMatch( const ::rtl::OUString& _rCompare ) : m_rCompare( _rCompare ) { } bool operator() (const PropertyDescription& x ) const { - return x.aProperty.Name == m_rCompare; + return x.aProperty.Name.equals(m_rCompare); } }; } diff --git a/comphelper/source/streaming/memorystream.cxx b/comphelper/source/streaming/memorystream.cxx index b999c0f8e6af..a2baef21010e 100644 --- a/comphelper/source/streaming/memorystream.cxx +++ b/comphelper/source/streaming/memorystream.cxx @@ -167,6 +167,9 @@ void SAL_CALL UNOMemoryStream::seek( sal_Int64 location ) throw (IllegalArgument if ( location > static_cast< sal_Int64 >( maData.size() ) ) maData.resize( static_cast< sal_Int32 >( location ) ); + if ( location > static_cast< sal_Int64 >( maData.size() ) ) + maData.resize( static_cast< sal_Int32 >( location ) ); + mnCursor = static_cast< sal_Int32 >( location ); } |