summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-11-19 09:14:59 +0200
committerNoel Grandin <noel@peralex.com>2015-11-19 09:33:29 +0200
commit2554efabb6d7cd2ad9f7cfdddd0712c25cdca1cd (patch)
tree1b8fd3940910ffcd328e16a53e208c099f67ab21 /sc
parentf7b5f477bfd942e0a1d8880c372635000d724dd7 (diff)
use comphelper::containerToSequence
in chart2, we remove a local equivalent of the method Change-Id: I25129a3d1ea1dd724eb9cd38a57be37a78b3d100
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/excel/xltoolbar.cxx10
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx33
-rw-r--r--sc/source/ui/vba/vbaformatconditions.cxx11
3 files changed, 12 insertions, 42 deletions
diff --git a/sc/source/filter/excel/xltoolbar.cxx b/sc/source/filter/excel/xltoolbar.cxx
index 5e26d7c4428b..a65b3e586e98 100644
--- a/sc/source/filter/excel/xltoolbar.cxx
+++ b/sc/source/filter/excel/xltoolbar.cxx
@@ -19,8 +19,10 @@
#include <com/sun/star/ui/ItemType.hpp>
#include <fstream>
#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
#include <vcl/graph.hxx>
#include <map>
+
using namespace com::sun::star;
typedef std::map< sal_Int16, OUString > IdToString;
@@ -301,13 +303,7 @@ bool ScTBC::ImportToolBarControl( ScCTBWrapper& rWrapper, const css::uno::Refere
sProps[ 0 ].Value = uno::makeAny( ui::ItemType::SEPARATOR_LINE );
toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
}
- uno::Sequence< beans::PropertyValue > sProps( props.size() );
- beans::PropertyValue* pProp = sProps.getArray();
-
- for ( std::vector< css::beans::PropertyValue >::iterator it = props.begin(); it != props.end(); ++it, ++pProp )
- *pProp = *it;
-
- toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
+ toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( comphelper::containerToSequence(props) ) );
}
return true;
}
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 0ef1b0e2707f..deb144f19c3c 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -57,6 +57,7 @@
#include <com/sun/star/text/XText.hpp>
#include <comphelper/extract.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
#include <rtl/math.hxx>
#include <boost/checked_delete.hpp>
@@ -104,14 +105,6 @@ const SfxItemPropertyMapEntry* lcl_GetDataSequencePropertyMap()
return aDataSequencePropertyMap_Impl;
}
-template< typename T >
-css::uno::Sequence< T > lcl_VectorToSequence( const ::std::vector< T > & rCont )
-{
- css::uno::Sequence< T > aResult( rCont.size());
- ::std::copy( rCont.begin(), rCont.end(), aResult.getArray());
- return aResult;
-}
-
struct lcl_appendTableNumber : public ::std::unary_function< SCTAB, void >
{
explicit lcl_appendTableNumber( OUStringBuffer & rBuffer ) :
@@ -1794,7 +1787,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL ScChart2DataProvider::detectArgum
SolarMutexGuard aGuard;
OSL_ENSURE( m_pDocument, "No Document -> no detectArguments" );
if(!m_pDocument ||!xDataSource.is())
- return lcl_VectorToSequence( aResult );
+ return comphelper::containerToSequence( aResult );
sal_Int32 nDataInRows = 0;
sal_Int32 nDataInCols = 0;
@@ -1980,7 +1973,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL ScChart2DataProvider::detectArgum
uno::Reference< chart2::data::XDataSource > xCompareDataSource;
try
{
- xCompareDataSource.set( this->createDataSource( lcl_VectorToSequence( aResult ) ) );
+ xCompareDataSource.set( this->createDataSource( comphelper::containerToSequence( aResult ) ) );
}
catch( const lang::IllegalArgumentException & )
{
@@ -2039,12 +2032,12 @@ uno::Sequence< beans::PropertyValue > SAL_CALL ScChart2DataProvider::detectArgum
{
aResult.push_back(
beans::PropertyValue( OUString("SequenceMapping"), -1,
- uno::makeAny( lcl_VectorToSequence(aSequenceMappingVector) )
+ uno::makeAny( comphelper::containerToSequence(aSequenceMappingVector) )
, beans::PropertyState_DIRECT_VALUE ));
}
}
- return lcl_VectorToSequence( aResult );
+ return comphelper::containerToSequence( aResult );
}
sal_Bool SAL_CALL ScChart2DataProvider::createDataSequenceByRangeRepresentationPossible( const OUString& aRangeRepresentation )
@@ -2414,21 +2407,7 @@ uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence> > SAL_CALL
ScChart2DataSource::getDataSequences() throw ( uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
-
- LabeledList::const_iterator aItr(m_aLabeledSequences.begin());
- LabeledList::const_iterator aEndItr(m_aLabeledSequences.end());
-
- uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aRet(m_aLabeledSequences.size());
-
- sal_Int32 i = 0;
- while (aItr != aEndItr)
- {
- aRet[i] = *aItr;
- ++i;
- ++aItr;
- }
-
- return aRet;
+ return comphelper::containerToSequence< uno::Reference< chart2::data::XLabeledDataSequence> >(m_aLabeledSequences);
}
void ScChart2DataSource::AddLabeledSequence(const uno::Reference < chart2::data::XLabeledDataSequence >& xNew)
diff --git a/sc/source/ui/vba/vbaformatconditions.cxx b/sc/source/ui/vba/vbaformatconditions.cxx
index dc9a9adbee1c..2f6506d4c5f3 100644
--- a/sc/source/ui/vba/vbaformatconditions.cxx
+++ b/sc/source/ui/vba/vbaformatconditions.cxx
@@ -20,6 +20,7 @@
#include <ooo/vba/excel/XRange.hpp>
#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
#include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
+#include <comphelper/sequence.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <vector>
#include "unonames.hxx"
@@ -28,6 +29,7 @@
#include "vbaworkbook.hxx"
#include "vbastyles.hxx"
#include "vbaglobals.hxx"
+
using namespace ::ooo::vba;
using namespace ::com::sun::star;
@@ -191,14 +193,7 @@ ScVbaFormatConditions::Add( ::sal_Int32 _nType, const uno::Any& _aOperator, cons
aProperty.Name = STYLENAME;
aProperty.Value = uno::makeAny( sStyleName );
- // convert vector to sequence
- uno::Sequence< beans::PropertyValue > aPropertyValueList(aPropertyValueVector.size());
- VecPropValues::iterator it = aPropertyValueVector.begin();
- VecPropValues::iterator it_end = aPropertyValueVector.end();
- for ( sal_Int32 index=0; it != it_end; ++it )
- aPropertyValueList[ index++ ] = *it;
-
- mxSheetConditionalEntries->addNew(aPropertyValueList);
+ mxSheetConditionalEntries->addNew(comphelper::containerToSequence(aPropertyValueVector));
for (sal_Int32 i = mxSheetConditionalEntries->getCount()-1; i >= 0; i--)
{
uno::Reference< sheet::XSheetConditionalEntry > xSheetConditionalEntry( mxSheetConditionalEntries->getByIndex(i), uno::UNO_QUERY_THROW );