diff options
author | Noel Grandin <noel@peralex.com> | 2015-11-19 09:14:59 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-11-19 09:33:29 +0200 |
commit | 2554efabb6d7cd2ad9f7cfdddd0712c25cdca1cd (patch) | |
tree | 1b8fd3940910ffcd328e16a53e208c099f67ab21 /sw | |
parent | f7b5f477bfd942e0a1d8880c372635000d724dd7 (diff) |
use comphelper::containerToSequence
in chart2, we remove a local equivalent of the method
Change-Id: I25129a3d1ea1dd724eb9cd38a57be37a78b3d100
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/fields/flddropdown.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/unocore/unofield.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/unocore/unoflatpara.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/unocore/unoport.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8toolbar.cxx | 9 |
5 files changed, 10 insertions, 45 deletions
diff --git a/sw/source/core/fields/flddropdown.cxx b/sw/source/core/fields/flddropdown.cxx index 95d8c4046f62..ee31b1bb0f05 100644 --- a/sw/source/core/fields/flddropdown.cxx +++ b/sw/source/core/fields/flddropdown.cxx @@ -23,6 +23,7 @@ #include <osl/diagnose.h> #include <svl/poolitem.hxx> +#include <comphelper/sequence.hxx> #include <unofldmid.h> #include <unoprnms.hxx> @@ -120,18 +121,7 @@ void SwDropDownField::SetItems(const uno::Sequence<OUString> & rItems) uno::Sequence<OUString> SwDropDownField::GetItemSequence() const { - uno::Sequence<OUString> aSeq( aValues.size() ); - OUString* pSeq = aSeq.getArray(); - int i = 0; - vector<OUString>::const_iterator aIt; - - for (aIt = aValues.begin(); aIt != aValues.end(); ++aIt) - { - pSeq[i] = *aIt; - i++; - } - - return aSeq; + return comphelper::containerToSequence(aValues); } diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index cbf3d98d84b3..a4d63b892ab8 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -2825,14 +2825,7 @@ uno::Sequence< OUString > SwXTextFieldMasters::getElementNames() } } - uno::Sequence< OUString > aSeq( static_cast<sal_Int32>(aFieldNames.size()) ); - OUString* pArray = aSeq.getArray(); - for (size_t i = 0; i<aFieldNames.size(); ++i) - { - pArray[i] = aFieldNames[i]; - } - - return aSeq; + return comphelper::containerToSequence(aFieldNames); } sal_Bool SwXTextFieldMasters::hasByName(const OUString& rName) throw( uno::RuntimeException, std::exception ) diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx index 8f9db59d9fdb..0688b392753a 100644 --- a/sw/source/core/unocore/unoflatpara.cxx +++ b/sw/source/core/unocore/unoflatpara.cxx @@ -47,6 +47,7 @@ #include <viewopt.hxx> #include <comphelper/servicehelper.hxx> #include <comphelper/propertysetinfo.hxx> +#include <comphelper/sequence.hxx> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/text/XTextRange.hpp> @@ -107,17 +108,11 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, if (rPropertyName == "FieldPositions") { - uno::Sequence<sal_Int32> ret(GetConversionMap().getFieldPositions().size()); - std::copy(GetConversionMap().getFieldPositions().begin(), - GetConversionMap().getFieldPositions().end(), ret.begin()); - return uno::makeAny(ret); + return uno::makeAny( comphelper::containerToSequence( GetConversionMap().getFieldPositions() ) ); } else if (rPropertyName == "FootnotePositions") { - uno::Sequence<sal_Int32> ret(GetConversionMap().getFootnotePositions().size()); - std::copy(GetConversionMap().getFootnotePositions().begin(), - GetConversionMap().getFootnotePositions().end(), ret.begin()); - return uno::makeAny(ret); + return uno::makeAny( comphelper::containerToSequence( GetConversionMap().getFootnotePositions() ) ); } return uno::Any(); } diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx index 8af520380d4a..ca603e804262 100644 --- a/sw/source/core/unocore/unoport.cxx +++ b/sw/source/core/unocore/unoport.cxx @@ -47,6 +47,7 @@ #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> +#include <comphelper/sequence.hxx> using namespace ::com::sun::star; @@ -702,16 +703,7 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion: css::uno::Reference<css::uno::XInterface>(), a); } - uno::Sequence< beans::GetDirectPropertyTolerantResult > aResult( aResultVector.size() ); - std::vector< beans::GetDirectPropertyTolerantResult >::const_iterator aIt = aResultVector.begin(); - beans::GetDirectPropertyTolerantResult *pResult = aResult.getArray(); - for( sal_Int32 nResult = 0; nResult < aResult.getLength(); ++nResult ) - { - pResult[nResult] = *aIt; - ++aIt; - } - - return aResult; + return comphelper::containerToSequence(aResultVector); } void SwXTextPortion::addPropertiesChangeListener( diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx index c447e35e48d4..2a2eaab5fd2e 100644 --- a/sw/source/filter/ww8/ww8toolbar.cxx +++ b/sw/source/filter/ww8/ww8toolbar.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/ui/ItemType.hpp> #include <fstream> #include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> #include <unotools/configmgr.hxx> #include <vcl/graph.hxx> #include <map> @@ -748,13 +749,7 @@ SwTBC::ImportToolBarControl( SwCTBWrapper& rWrapper, const css::uno::Reference< 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; } |