diff options
author | Noel Grandin <noel@peralex.com> | 2015-11-19 13:43:23 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-11-20 08:14:13 +0000 |
commit | fe3fd05966a668c1cdf53e8221b8614e9a07de65 (patch) | |
tree | 4c6c105b78d0cb9c45431c2fecd2583d6a2aa85c /xmloff | |
parent | 1d5c39192e81f950289dbdd7991a0e8a67c0aabc (diff) |
add mapKeysToSequence/mapValuesToSequence methods to comphelper
and use them
Change-Id: If4dc9df63db37185228aeaaab2979498d61304ec
Reviewed-on: https://gerrit.libreoffice.org/20055
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/chart/SchXMLExport.cxx | 9 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLTableContext.cxx | 5 | ||||
-rw-r--r-- | xmloff/source/forms/eventexport.cxx | 11 |
3 files changed, 7 insertions, 18 deletions
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 13a13da29e7f..729b0311fa95 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -34,6 +34,7 @@ #include <comphelper/processfactory.hxx> #include <tools/globname.hxx> #include <comphelper/classids.hxx> +#include <comphelper/sequence.hxx> #include <xmloff/nmspmap.hxx> #include <xmloff/xmlnmspe.hxx> @@ -392,10 +393,7 @@ Sequence< Reference< chart2::data::XLabeledDataSequence > > lcl_getAllSeriesSequ } } - Sequence< Reference< chart2::data::XLabeledDataSequence > > aRet( aContainer.size()); - ::std::copy( aContainer.begin(), aContainer.end(), aRet.getArray()); - - return aRet; + return comphelper::containerToSequence< Reference< chart2::data::XLabeledDataSequence > >( aContainer ); } Reference< chart2::data::XLabeledDataSequence > @@ -444,8 +442,7 @@ Reference< chart2::data::XDataSource > lcl_pressUsedDataIntoRectangularFormat( c aLabeledSeqVector.push_back( aSeriesSeqVector[nN] ); } - Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeq( aLabeledSeqVector.size() ); - ::std::copy( aLabeledSeqVector.begin(), aLabeledSeqVector.end(), aSeq.getArray() ); + Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeq( comphelper::containerToSequence(aLabeledSeqVector) ); return lcl_createDataSource( aSeq ); } diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx index a895c8e13da6..3ac2e358bd8c 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -30,6 +30,7 @@ #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> #include <xmloff/nmspmap.hxx> +#include <comphelper/sequence.hxx> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/chart2/XAnyDescriptionAccess.hpp> #include <com/sun/star/chart2/XDataSeriesContainer.hpp> @@ -1020,9 +1021,7 @@ void SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary( if( static_cast<sal_Int32>(aRemainingSeries.size()) != aSeriesSeq.getLength() ) { //remove the series that have only hidden data - Sequence< Reference< chart2::XDataSeries > > aRemainingSeriesSeq( aRemainingSeries.size()); - ::std::copy( aRemainingSeries.begin(), aRemainingSeries.end(), aRemainingSeriesSeq.getArray()); - xSeriesContainer->setDataSeries( aRemainingSeriesSeq ); + xSeriesContainer->setDataSeries( comphelper::containerToSequence(aRemainingSeries) ); //remove unused sequences Reference< chart2::data::XDataSource > xDataSource( xChartDoc, uno::UNO_QUERY ); diff --git a/xmloff/source/forms/eventexport.cxx b/xmloff/source/forms/eventexport.cxx index e26ed665ceec..57b995cd33f4 100644 --- a/xmloff/source/forms/eventexport.cxx +++ b/xmloff/source/forms/eventexport.cxx @@ -21,6 +21,7 @@ #include <osl/diagnose.h> #include "strings.hxx" #include <tools/debug.hxx> +#include <comphelper/sequence.hxx> namespace xmloff { @@ -106,15 +107,7 @@ namespace xmloff Sequence< OUString > SAL_CALL OEventDescriptorMapper::getElementNames( ) throw(RuntimeException, std::exception) { - Sequence< OUString > aReturn(m_aMappedEvents.size()); - OUString* pReturn = aReturn.getArray(); - for ( MapString2PropertyValueSequence::const_iterator aCollect = m_aMappedEvents.begin(); - aCollect != m_aMappedEvents.end(); - ++aCollect, ++pReturn - ) - *pReturn = aCollect->first; - - return aReturn; + return comphelper::mapKeysToSequence(m_aMappedEvents); } sal_Bool SAL_CALL OEventDescriptorMapper::hasByName( const OUString& _rName ) throw(RuntimeException, std::exception) |