summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-11-19 13:43:23 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-11-20 08:14:13 +0000
commitfe3fd05966a668c1cdf53e8221b8614e9a07de65 (patch)
tree4c6c105b78d0cb9c45431c2fecd2583d6a2aa85c /chart2
parent1d5c39192e81f950289dbdd7991a0e8a67c0aabc (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 'chart2')
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx10
-rw-r--r--chart2/source/inc/ContainerHelper.hxx35
-rw-r--r--chart2/source/model/main/DataSeries.cxx12
-rw-r--r--chart2/source/view/main/PropertyMapper.cxx5
4 files changed, 5 insertions, 57 deletions
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index 00611617d01b..035f7e9372ff 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -1453,15 +1453,7 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstanceW
uno::Sequence< OUString > SAL_CALL ChartDocumentWrapper::getAvailableServiceNames()
throw (uno::RuntimeException, std::exception)
{
- tServiceNameMap & rMap = lcl_getStaticServiceNameMap();
- uno::Sequence< OUString > aResult( rMap.size());
-
- ::std::transform( rMap.begin(), rMap.end(),
- aResult.getArray(),
- ::o3tl::select1st< tServiceNameMap::value_type >() );
-
- return aResult;
-
+ return comphelper::mapKeysToSequence( lcl_getStaticServiceNameMap() );
}
// ____ XAggregation ____
diff --git a/chart2/source/inc/ContainerHelper.hxx b/chart2/source/inc/ContainerHelper.hxx
index 9f01b47ab01b..a50554d8a0b0 100644
--- a/chart2/source/inc/ContainerHelper.hxx
+++ b/chart2/source/inc/ContainerHelper.hxx
@@ -70,41 +70,6 @@ template< typename T >
return SequenceToSTLSequenceContainer< ::std::vector< T > >( rSeq );
}
-/** converts the keys of a Pair Associative Container into a UNO sequence
-
- example:
-
- ::std::multimap< sal_Int32, OUString > aMyMultiMap;
- uno::Sequence< sal_Int32 > aMyKeys( ContainerHelper::MapKeysToSequence( aMyMultiMap ));
- // note: aMyKeys may contain duplicate keys here
- */
-template< class Map >
-::com::sun::star::uno::Sequence< typename Map::key_type > MapKeysToSequence(
- const Map & rCont )
-{
- ::com::sun::star::uno::Sequence< typename Map::key_type > aResult( rCont.size());
- ::std::transform( rCont.begin(), rCont.end(), aResult.getArray(),
- ::o3tl::select1st< typename Map::value_type >() );
- return aResult;
-}
-
-/** converts the values of a Pair Associative Container into a UNO sequence
-
- example:
-
- ::std::map< sal_Int32, OUString > aMyMultiMap;
- uno::Sequence< OUString > aMyValues( ContainerHelper::MapValuesToSequence( aMyMultiMap ));
- */
-template< class Map >
-::com::sun::star::uno::Sequence< typename Map::mapped_type > MapValuesToSequence(
- const Map & rCont )
-{
- ::com::sun::star::uno::Sequence< typename Map::mapped_type > aResult( rCont.size());
- ::std::transform( rCont.begin(), rCont.end(), aResult.getArray(),
- ::o3tl::select2nd< typename Map::value_type >() );
- return aResult;
-}
-
} // namespace ContainerHelper
} // namespace chart
diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx
index 1a42a726646e..11c617481f02 100644
--- a/chart2/source/model/main/DataSeries.cxx
+++ b/chart2/source/model/main/DataSeries.cxx
@@ -275,18 +275,8 @@ void SAL_CALL DataSeries::getFastPropertyValue
if( nHandle == DataSeriesProperties::PROP_DATASERIES_ATTRIBUTED_DATA_POINTS )
{
// TODO: only add those property sets that are really modified
- uno::Sequence< sal_Int32 > aSeq( m_aAttributedDataPoints.size());
- sal_Int32 * pIndexArray = aSeq.getArray();
- sal_Int32 i = 0;
- for( tDataPointAttributeContainer::const_iterator aIt( m_aAttributedDataPoints.begin());
- aIt != m_aAttributedDataPoints.end(); ++aIt )
- {
- pIndexArray[ i ] = (*aIt).first;
- ++i;
- }
-
- rValue <<= aSeq;
+ rValue <<= comphelper::mapKeysToSequence(m_aAttributedDataPoints);
}
else
OPropertySet::getFastPropertyValue( rValue, nHandle );
diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx
index 9b588a706340..461752cfd84c 100644
--- a/chart2/source/view/main/PropertyMapper.cxx
+++ b/chart2/source/view/main/PropertyMapper.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
#include <com/sun/star/drawing/LineJoint.hpp>
+#include <comphelper/sequence.hxx>
namespace chart
{
@@ -65,8 +66,8 @@ void PropertyMapper::setMappedProperties(
for( sal_Int32 nI=0; nI<aNames.getLength(); ++nI )
aNewMap[ aNames[nI] ] = aValues[nI];
lcl_overwriteOrAppendValues( aNewMap, *pOverwriteMap );
- aNames = ContainerHelper::MapKeysToSequence( aNewMap );
- aValues = ContainerHelper::MapValuesToSequence( aNewMap );
+ aNames = comphelper::mapKeysToSequence( aNewMap );
+ aValues = comphelper::mapValuesToSequence( aNewMap );
}
PropertyMapper::setMultiProperties( aNames, aValues, xTarget );