diff options
author | Matthew Pottage <matthewpottage@invincitech.com> | 2014-10-28 16:50:02 +0000 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-02-06 23:06:58 +0100 |
commit | 4f7a1f5b9499d5fbeff413a4914283c2bfe7c2d9 (patch) | |
tree | d626505be68b47a1219d9838f9d5dc35c7271248 /filter/source | |
parent | fdo#39440: remove redundant checks and breaks (diff) | |
download | core-4f7a1f5b9499d5fbeff413a4914283c2bfe7c2d9.tar.gz core-4f7a1f5b9499d5fbeff413a4914283c2bfe7c2d9.zip |
fdo#75757: Remove inheritance from std::vector
Deprecated comphelper/sequenceasvector.hxx.
Rewritten code using it. Using instead the functions containerToSequence and
sequenceToContainer, found in include/comphelper/sequence.hxx.
One class that inherits from it (in framework/inc/stdtypes.h), and
the code using that has been left.
Signed-off-by: Michael Stahl <mstahl@redhat.com>
Conflicts:
writerfilter/source/dmapper/DomainMapper.cxx
writerfilter/source/dmapper/TblStylePrHandler.hxx
writerfilter/source/dmapper/WrapPolygonHandler.hxx
Change-Id: Ice61c94ffb052e389281aebb7cdf185134221061
Diffstat (limited to 'filter/source')
-rw-r--r-- | filter/source/config/cache/basecontainer.cxx | 6 | ||||
-rw-r--r-- | filter/source/config/cache/cacheitem.cxx | 5 | ||||
-rw-r--r-- | filter/source/config/cache/cacheitem.hxx | 4 | ||||
-rw-r--r-- | filter/source/config/cache/contenthandlerfactory.cxx | 8 | ||||
-rw-r--r-- | filter/source/config/cache/filtercache.cxx | 33 | ||||
-rw-r--r-- | filter/source/config/cache/filterfactory.cxx | 17 | ||||
-rw-r--r-- | filter/source/config/cache/frameloaderfactory.cxx | 8 | ||||
-rw-r--r-- | filter/source/config/cache/typedetection.cxx | 5 |
8 files changed, 44 insertions, 42 deletions
diff --git a/filter/source/config/cache/basecontainer.cxx b/filter/source/config/cache/basecontainer.cxx index e34b71d03522..5555d475bb02 100644 --- a/filter/source/config/cache/basecontainer.cxx +++ b/filter/source/config/cache/basecontainer.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/document/FilterConfigRefresh.hpp> #include <com/sun/star/uno/Type.h> #include <comphelper/enumhelper.hxx> +#include <comphelper/sequence.hxx> #include <cppuhelper/supportsservice.hxx> #include <osl/diagnose.h> #include <rtl/instance.hxx> @@ -335,7 +336,7 @@ css::uno::Sequence< OUString > SAL_CALL BaseContainer::getElementNames() { FilterCache* pCache = impl_getWorkingCache(); OUStringList lKeys = pCache->getItemNames(m_eType); - lKeys >> lNames; + lNames = comphelper::containerToSequence(lKeys); } catch(const css::uno::Exception&) { @@ -468,8 +469,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::crea Further its easier to work directly with the return value instaed of checking of NULL returns! */ - css::uno::Sequence< OUString > lSubSet; - lKeys >> lSubSet; + css::uno::Sequence< OUString > lSubSet = comphelper::containerToSequence(lKeys); ::comphelper::OEnumerationByName* pEnum = new ::comphelper::OEnumerationByName(this, lSubSet); return css::uno::Reference< css::container::XEnumeration >(static_cast< css::container::XEnumeration* >(pEnum), css::uno::UNO_QUERY); } diff --git a/filter/source/config/cache/cacheitem.cxx b/filter/source/config/cache/cacheitem.cxx index ef0b66fe686a..36420be2331c 100644 --- a/filter/source/config/cache/cacheitem.cxx +++ b/filter/source/config/cache/cacheitem.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <osl/diagnose.h> +#include <comphelper/sequence.hxx> namespace filter{ @@ -234,8 +235,8 @@ bool isSubSet(const css::uno::Any& aSubSet, (aSet >>= uno_s2) ) { - OUStringList stl_s1(uno_s1); - OUStringList stl_s2(uno_s2); + OUStringList stl_s1(comphelper::sequenceToContainer<OUStringList>(uno_s1)); + OUStringList stl_s2(comphelper::sequenceToContainer<OUStringList>(uno_s2)); for (OUStringList::const_iterator it1 = stl_s1.begin(); it1 != stl_s1.end() ; diff --git a/filter/source/config/cache/cacheitem.hxx b/filter/source/config/cache/cacheitem.hxx index 06214e6d662c..788036adca39 100644 --- a/filter/source/config/cache/cacheitem.hxx +++ b/filter/source/config/cache/cacheitem.hxx @@ -27,7 +27,7 @@ #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/NamedValue.hpp> -#include <comphelper/sequenceasvector.hxx> +#include <vector> #include <comphelper/sequenceashashmap.hxx> #include <osl/mutex.hxx> @@ -49,7 +49,7 @@ struct BaseLock }; -typedef ::comphelper::SequenceAsVector< OUString > OUStringList; +typedef ::std::vector< OUString > OUStringList; diff --git a/filter/source/config/cache/contenthandlerfactory.cxx b/filter/source/config/cache/contenthandlerfactory.cxx index 0244786cd829..fe774f8b9c91 100644 --- a/filter/source/config/cache/contenthandlerfactory.cxx +++ b/filter/source/config/cache/contenthandlerfactory.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <comphelper/enumhelper.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> namespace filter{ @@ -124,13 +125,10 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::crea css::uno::Sequence< css::beans::PropertyValue > lConfig; aHandler >> lConfig; - ::comphelper::SequenceAsVector< css::uno::Any > stlArguments(lArguments); + ::std::vector< css::uno::Any > stlArguments(comphelper::sequenceToContainer<::std::vector< css::uno::Any > >(lArguments)); stlArguments.insert(stlArguments.begin(), css::uno::makeAny(lConfig)); - css::uno::Sequence< css::uno::Any > lInitData; - stlArguments >> lInitData; - - xInit->initialize(lInitData); + xInit->initialize(comphelper::containerToSequence(stlArguments)); } return xHandler; diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index 828e9f6b42b6..f8d995fc23a7 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -40,7 +40,7 @@ #include <com/sun/star/beans/Property.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/document/CorruptedFilterConfigurationException.hpp> -#include <comphelper/sequenceasvector.hxx> +#include <comphelper/sequence.hxx> #include <comphelper/processfactory.hxx> #include <unotools/configpaths.hxx> @@ -940,7 +940,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider( css::configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() ) ); - ::comphelper::SequenceAsVector< css::uno::Any > lParams; + ::std::vector< css::uno::Any > lParams; css::beans::NamedValue aParam; // set root path @@ -958,9 +958,11 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess // open it if (bReadOnly) - xCfg = xConfigProvider->createInstanceWithArguments(SERVICE_CONFIGURATIONACCESS, lParams.getAsConstList()); + xCfg = xConfigProvider->createInstanceWithArguments(SERVICE_CONFIGURATIONACCESS, + comphelper::containerToSequence(lParams)); else - xCfg = xConfigProvider->createInstanceWithArguments(SERVICE_CONFIGURATIONUPDATEACCESS, lParams.getAsConstList()); + xCfg = xConfigProvider->createInstanceWithArguments(SERVICE_CONFIGURATIONUPDATEACCESS, + comphelper::containerToSequence(lParams)); // If configuration could not be opened ... but factory method does not throwed an exception // trigger throwing of our own CorruptedFilterConfigurationException. @@ -1228,7 +1230,7 @@ void FilterCache::impl_validateAndOptimize() CacheItem& rLoader = pIt->second; css::uno::Any& rTypesReg = rLoader[PROPNAME_TYPES]; - OUStringList lTypesReg (rTypesReg); + OUStringList lTypesReg (comphelper::sequenceToContainer<OUStringList>(rTypesReg.get<css::uno::Sequence<OUString> >())); for (OUStringList::const_iterator pTypesReg = lTypesReg.begin(); pTypesReg != lTypesReg.end() ; @@ -1242,7 +1244,7 @@ void FilterCache::impl_validateAndOptimize() CacheItem& rDefaultLoader = m_lFrameLoaders[sDefaultFrameLoader]; rDefaultLoader[PROPNAME_NAME ] <<= sDefaultFrameLoader; - rDefaultLoader[PROPNAME_TYPES] <<= lTypes.getAsConstList(); + rDefaultLoader[PROPNAME_TYPES] <<= comphelper::containerToSequence(lTypes); OUString sLogOut = sLog.makeStringAndClear(); OSL_ENSURE(!nErrors, OUStringToOString(sLogOut,RTL_TEXTENCODING_UTF8).getStr()); @@ -1543,8 +1545,9 @@ void FilterCache::impl_readPatchUINames(const css::uno::Reference< css::containe if (!(aVal >>= xUIName) && !xUIName.is()) return; - const ::comphelper::SequenceAsVector< OUString > lLocales(xUIName->getElementNames()); - ::comphelper::SequenceAsVector< OUString >::const_iterator pLocale ; + const ::std::vector< OUString > lLocales(comphelper::sequenceToContainer<::std::vector< OUString >>( + xUIName->getElementNames())); + ::std::vector< OUString >::const_iterator pLocale ; ::comphelper::SequenceAsHashMap lUINames; for ( pLocale = lLocales.begin(); @@ -1935,7 +1938,7 @@ css::uno::Sequence< OUString > FilterCache::impl_convertFlagField2FlagNames(sal_ if ((nFlags & FLAGVAL_USESOPTIONS ) == FLAGVAL_USESOPTIONS ) lFlagNames.push_back(FLAGNAME_USESOPTIONS ); if ((nFlags & FLAGVAL_COMBINED ) == FLAGVAL_COMBINED ) lFlagNames.push_back(FLAGNAME_COMBINED ); - return lFlagNames.getAsConstList(); + return comphelper::containerToSequence(lFlagNames); } /*----------------------------------------------- @@ -2097,10 +2100,10 @@ void FilterCache::impl_interpretDataVal4Type(const OUString& sValue, case 2: rItem[PROPNAME_CLIPBOARDFORMAT] <<= ::rtl::Uri::decode(sValue, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8); break; // URLPattern - case 3: rItem[PROPNAME_URLPATTERN] <<= impl_tokenizeString(sValue, (sal_Unicode)';').getAsConstList(); + case 3: rItem[PROPNAME_URLPATTERN] <<= comphelper::containerToSequence(impl_tokenizeString(sValue, (sal_Unicode)';')); break; // Extensions - case 4: rItem[PROPNAME_EXTENSIONS] <<= impl_tokenizeString(sValue, (sal_Unicode)';').getAsConstList(); + case 4: rItem[PROPNAME_EXTENSIONS] <<= comphelper::containerToSequence(impl_tokenizeString(sValue, (sal_Unicode)';')); break; } } @@ -2136,7 +2139,7 @@ void FilterCache::impl_interpretDataVal4Filter(const OUString& sValue, case 4: rItem[PROPNAME_FLAGS] <<= sValue.toInt32(); break; // UserData - case 5: rItem[PROPNAME_USERDATA] <<= impl_tokenizeString(sValue, (sal_Unicode)';').getAsConstList(); + case 5: rItem[PROPNAME_USERDATA] <<= comphelper::containerToSequence(impl_tokenizeString(sValue, (sal_Unicode)';')); break; // FileFormatVersion case 6: rItem[PROPNAME_FILEFORMATVERSION] <<= sValue.toInt32(); @@ -2282,7 +2285,8 @@ OUString FilterCache::impl_searchFrameLoaderForType(const OUString& sType) const { const OUString& sItem = pIt->first; ::comphelper::SequenceAsHashMap lProps(pIt->second); - OUStringList lTypes(lProps[PROPNAME_TYPES]); + OUStringList lTypes( + comphelper::sequenceToContainer<OUStringList>(lProps[PROPNAME_TYPES].get<css::uno::Sequence<OUString> >())); if (::std::find(lTypes.begin(), lTypes.end(), sType) != lTypes.end()) return sItem; @@ -2302,7 +2306,8 @@ OUString FilterCache::impl_searchContentHandlerForType(const OUString& sType) co { const OUString& sItem = pIt->first; ::comphelper::SequenceAsHashMap lProps(pIt->second); - OUStringList lTypes(lProps[PROPNAME_TYPES]); + OUStringList lTypes( + comphelper::sequenceToContainer<OUStringList>( lProps[PROPNAME_TYPES].get<css::uno::Sequence<OUString> >() )); if (::std::find(lTypes.begin(), lTypes.end(), sType) != lTypes.end()) return sItem; } diff --git a/filter/source/config/cache/filterfactory.cxx b/filter/source/config/cache/filterfactory.cxx index 87b829093b44..f6108bf523d9 100644 --- a/filter/source/config/cache/filterfactory.cxx +++ b/filter/source/config/cache/filterfactory.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/enumhelper.hxx> +#include <comphelper/sequence.hxx> #include <rtl/ustrbuf.hxx> #include <officecfg/Setup.hxx> #include <officecfg/TypeDetection/UISort.hxx> @@ -142,13 +143,10 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::createInstan css::uno::Sequence< css::beans::PropertyValue > lConfig; aFilter >> lConfig; - ::comphelper::SequenceAsVector< css::uno::Any > stlArguments(lArguments); + ::std::vector< css::uno::Any > stlArguments(comphelper::sequenceToContainer<::std::vector< css::uno::Any > >(lArguments)); stlArguments.insert(stlArguments.begin(), css::uno::makeAny(lConfig)); - css::uno::Sequence< css::uno::Any > lInitData; - stlArguments >> lInitData; - - xInit->initialize(lInitData); + xInit->initialize(comphelper::containerToSequence(stlArguments)); } return xFilter; @@ -180,7 +178,7 @@ css::uno::Sequence< OUString > SAL_CALL FilterFactory::getAvailableServiceNames( catch(const css::uno::Exception&) { lUNOFilters.clear(); } - return lUNOFilters.getAsConstList(); + return comphelper::containerToSequence(lUNOFilters); } @@ -234,7 +232,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::crea // pack list of item names as an enum list // Attention: Do not return empty reference for empty list! // The outside check "hasMoreElements()" should be enough, to detect this state :-) - css::uno::Sequence< OUString > lSet = lEnumSet.getAsConstList(); + css::uno::Sequence< OUString > lSet = comphelper::containerToSequence(lEnumSet); ::comphelper::OEnumerationByName* pEnum = new ::comphelper::OEnumerationByName(this, lSet); return css::uno::Reference< css::container::XEnumeration >(static_cast< css::container::XEnumeration* >(pEnum), css::uno::UNO_QUERY); } @@ -477,7 +475,7 @@ OUStringList FilterFactory::impl_getListOfInstalledModules() const // <- SAFE ---------------------- css::uno::Reference< css::container::XNameAccess > xModuleConfig = officecfg::Setup::Office::Factories::get(xContext); - OUStringList lModules(xModuleConfig->getElementNames()); + OUStringList lModules(comphelper::sequenceToContainer<OUStringList>(xModuleConfig->getElementNames())); return lModules; } @@ -558,7 +556,8 @@ OUStringList FilterFactory::impl_readSortedFilterListFromConfig(const OUString& // Note: conversion of the returned Any to OUStringList throws // an IllegalArgumentException if the type does not match ... // but it resets the OUStringList to a length of 0 if the Any is empty! - OUStringList lSortedFilters(xModule->getByName(PROPNAME_SORTEDFILTERLIST)); + OUStringList lSortedFilters( + comphelper::sequenceToContainer<OUStringList>(xModule->getByName(PROPNAME_SORTEDFILTERLIST).get<css::uno::Sequence<OUString> >())); return lSortedFilters; } } diff --git a/filter/source/config/cache/frameloaderfactory.cxx b/filter/source/config/cache/frameloaderfactory.cxx index d14188851f3b..320a9918be57 100644 --- a/filter/source/config/cache/frameloaderfactory.cxx +++ b/filter/source/config/cache/frameloaderfactory.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <comphelper/enumhelper.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> namespace filter{ @@ -121,13 +122,10 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::createI css::uno::Sequence< css::beans::PropertyValue > lConfig; aLoader >> lConfig; - ::comphelper::SequenceAsVector< css::uno::Any > stlArguments(lArguments); + ::std::vector< css::uno::Any > stlArguments(comphelper::sequenceToContainer<::std::vector<css::uno::Any> >(lArguments)); stlArguments.insert(stlArguments.begin(), css::uno::makeAny(lConfig)); - css::uno::Sequence< css::uno::Any > lInitData; - stlArguments >> lInitData; - - xInit->initialize(lInitData); + xInit->initialize(comphelper::containerToSequence(stlArguments)); } return xLoader; diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx index a7d306892eda..15ba4d085a97 100644 --- a/filter/source/config/cache/typedetection.cxx +++ b/filter/source/config/cache/typedetection.cxx @@ -33,6 +33,7 @@ #include <tools/urlobj.hxx> #include <unotools/localfilehelper.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> #define DEBUG_TYPE_DETECTION 0 @@ -679,8 +680,8 @@ bool TypeDetection::impl_getPreselectionForType( // otherwise we must know, if it matches to the given URL really. // especially if it matches by its extension or pattern registration. - OUStringList lExtensions(aType[PROPNAME_EXTENSIONS]); - OUStringList lURLPattern(aType[PROPNAME_URLPATTERN]); + OUStringList lExtensions(comphelper::sequenceToContainer<OUStringList>(aType[PROPNAME_EXTENSIONS].get<css::uno::Sequence<OUString> >() )); + OUStringList lURLPattern(comphelper::sequenceToContainer<OUStringList>(aType[PROPNAME_URLPATTERN].get<css::uno::Sequence<OUString> >() )); for (OUStringList::const_iterator pIt = lExtensions.begin(); pIt != lExtensions.end() ; |