make comphelper::containerToSequence a little smarter

So we don't have to specify the source and destination type as often.

Change-Id: Id9e286417a1cb246d163cbc3c536b231a4a92624
Reviewed-on: https://gerrit.libreoffice.org/30700
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2016-11-08 15:53:21 +02:00
parent 57998f642d
commit 389999abdb
33 changed files with 46 additions and 61 deletions

View File

@ -88,7 +88,7 @@ void ChartConfigItem::ImplCommit()
void ChartConfigItem::addPropertyNotification( const OUString & rPropertyName )
{
m_aPropertiesToNotify.insert( rPropertyName );
EnableNotification( comphelper::containerToSequence<OUString>( m_aPropertiesToNotify ));
EnableNotification( comphelper::containerToSequence( m_aPropertiesToNotify ));
}
uno::Any ChartConfigItem::getProperty( const OUString & aPropertyName )

View File

@ -559,7 +559,7 @@ Sequence< ScriptEventDescriptor > SAL_CALL ImplEventAttacherManager::getScriptEv
{
Guard< Mutex > aGuard( aLock );
::std::deque<AttacherIndex_Impl>::iterator aIt = implCheckIndex( nIndex );
return comphelper::containerToSequence<ScriptEventDescriptor>(aIt->aEventList);
return comphelper::containerToSequence(aIt->aEventList);
}

View File

@ -606,7 +606,7 @@ IMPL_LINK_NOARG(SvxHlinkDlgMarkWnd, ClickCloseHdl_Impl, Button*, void)
uno::Sequence< beans::NamedValue > aSettings
{
{ TG_SETTING_LASTMARK, css::uno::makeAny(sLastSelectedMark) },
{ TG_SETTING_LASTPATH, css::uno::makeAny(comphelper::containerToSequence<OUString>(aLastSelectedPath)) }
{ TG_SETTING_LASTPATH, css::uno::makeAny(comphelper::containerToSequence(aLastSelectedPath)) }
};
// write

View File

@ -56,7 +56,7 @@ IMPL_LINK_NOARG(TSAURLsDialog, OKHdl_Impl, Button*, void)
{
std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Security::Scripting::TSAURLs::set(comphelper::containerToSequence<OUString>(m_aURLs), batch);
officecfg::Office::Common::Security::Scripting::TSAURLs::set(comphelper::containerToSequence(m_aURLs), batch);
batch->commit();
EndDialog(RET_OK);

View File

@ -412,7 +412,7 @@ Sequence< Type > OConnection::getTypes() throw (RuntimeException, std::exception
if ( !m_bSupportsGroups )
aNormalizedTypes.erase( cppu::UnoType<XGroupsSupplier>::get() );
return comphelper::containerToSequence<Type>(aNormalizedTypes);
return comphelper::containerToSequence(aNormalizedTypes);
}
Sequence< sal_Int8 > OConnection::getImplementationId() throw (RuntimeException, std::exception)

View File

@ -332,10 +332,7 @@ ExtensionManager::getExtensionsWithSameIdentifier(
"Could not find extension: " + identifier + ", " + fileName,
static_cast<cppu::OWeakObject*>(this), -1);
return comphelper::containerToSequence<
Reference<css::deployment::XPackage>,
::std::list<Reference<css::deployment::XPackage> >
> (listExtensions);
return comphelper::containerToSequence(listExtensions);
}
catch ( const css::deployment::DeploymentException & )
{
@ -369,10 +366,7 @@ bool ExtensionManager::isUserDisabled(
}
OSL_ASSERT(listExtensions.size() == 3);
return isUserDisabled( ::comphelper::containerToSequence<
Reference<css::deployment::XPackage>,
::std::list<Reference<css::deployment::XPackage> >
> (listExtensions));
return isUserDisabled( ::comphelper::containerToSequence(listExtensions) );
}
bool ExtensionManager::isUserDisabled(
@ -425,10 +419,7 @@ void ExtensionManager::activateExtension(
OSL_ASSERT(listExtensions.size() == 3);
activateExtension(
::comphelper::containerToSequence<
Reference<css::deployment::XPackage>,
::std::list<Reference<css::deployment::XPackage> >
> (listExtensions),
::comphelper::containerToSequence(listExtensions),
bUserDisabled, bStartup, xAbortChannel, xCmdEnv);
fireModified();

View File

@ -335,10 +335,7 @@ throw (css::uno::RuntimeException, std::exception)
}
}
css::uno::Sequence< css::frame::DispatchInformation > aSeq =
comphelper::containerToSequence< css::frame::DispatchInformation, std::list< css::frame::DispatchInformation > >( aDispatchInfoList );
return aSeq;
return comphelper::containerToSequence( aDispatchInfoList );
}
bool canInsertRecords(const Reference< beans::XPropertySet>& _rxCursorSet)

View File

@ -255,8 +255,7 @@ namespace pcr
m_bSupportedPropertiesAreKnown = true;
}
Sequence< Property > aSurvived = comphelper::containerToSequence<Property>( m_aSupportedProperties );
return aSurvived;
return comphelper::containerToSequence( m_aSupportedProperties );
}

View File

@ -998,7 +998,7 @@ Sequence< Type > OFormattedModel::getSupportedBindingTypes()
aTypes.push_front(cppu::UnoType< sal_Bool >::get() );
break;
}
return comphelper::containerToSequence<Type>(aTypes);
return comphelper::containerToSequence(aTypes);
}
Any OFormattedModel::getDefaultForReset() const

View File

@ -1403,7 +1403,7 @@ namespace frm
}
// copy the indexes to the sequence
aSelectIndexes = comphelper::containerToSequence<sal_Int16>( aSelectionSet );
aSelectIndexes = comphelper::containerToSequence( aSelectionSet );
}
break;
@ -1420,7 +1420,7 @@ namespace frm
++idx;
}
aSelectIndexes = comphelper::containerToSequence<sal_Int16>( aSelectionSet );
aSelectIndexes = comphelper::containerToSequence( aSelectionSet );
}
break;
}

View File

@ -169,7 +169,7 @@ namespace frm
aTypes.push_front( cppu::UnoType<OUString>::get() );
// push_front, because this is the preferred type
return comphelper::containerToSequence<Type>(aTypes);
return comphelper::containerToSequence(aTypes);
}

View File

@ -81,7 +81,7 @@ namespace frm
TypeBag::TypeSequence TypeBag::getTypes() const
{
return comphelper::containerToSequence<css::uno::Type>(m_aTypes);
return comphelper::containerToSequence(m_aTypes);
}

View File

@ -291,6 +291,15 @@ namespace comphelper
return result;
}
// this one does better type deduction, but does not allow us to copy into a different element type
template < typename SrcType >
inline css::uno::Sequence< typename SrcType::value_type > containerToSequence( const SrcType& i_Container )
{
css::uno::Sequence< typename SrcType::value_type > result( i_Container.size() );
::std::copy( i_Container.begin(), i_Container.end(), result.getArray() );
return result;
}
template <typename T>
inline css::uno::Sequence<T> containerToSequence(
::std::vector<T> const& v )

View File

@ -42,12 +42,7 @@ struct DataFlavorEx : public css::datatransfer::DataFlavor
SotClipboardFormatId mnSotId;
};
// JP 23.03.2001 - this struct is only for "hide" the STD of the vetor,
// because our makefile filter all this symbols and so nobody can use
// these struct in any interfacses.
struct DataFlavorExVector : public ::std::vector< DataFlavorEx >
{
};
typedef ::std::vector<DataFlavorEx> DataFlavorExVector;
SOT_DLLPUBLIC bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector,

View File

@ -26,6 +26,7 @@
#include <tools/link.hxx>
#include <tools/ref.hxx>
#include <sot/formats.hxx>
#include <sot/exchange.hxx>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase4.hxx>
#include <com/sun/star/frame/XTerminateListener.hpp>
@ -51,7 +52,6 @@ class INetBookmark;
class INetImage;
class FileList;
class SotStorageStream;
struct DataFlavorExVector;
namespace vcl { class Window; }
// Drag&Drop defines

View File

@ -632,7 +632,7 @@ bool Runtime::pyIterUnpack( PyObject *const pObj, Any &a ) const
items.push_back( pyObject2Any( rItem.get() ) );
}
while( (pItem = PyIter_Next( pObj )) );
a <<= comphelper::containerToSequence<Any>(items);
a <<= comphelper::containerToSequence(items);
return true;
}

View File

@ -2414,7 +2414,7 @@ uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence> > SAL_CALL
ScChart2DataSource::getDataSequences() throw ( uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
return comphelper::containerToSequence< uno::Reference< chart2::data::XLabeledDataSequence> >(m_aLabeledSequences);
return comphelper::containerToSequence(m_aLabeledSequences);
}
void ScChart2DataSource::AddLabeledSequence(const uno::Reference < chart2::data::XLabeledDataSequence >& xNew)

View File

@ -407,7 +407,7 @@ ScriptEventHelper::getEventListeners()
}
}
return comphelper::containerToSequence<OUString>(eventMethods);
return comphelper::containerToSequence(eventMethods);
}
Sequence< ScriptEventDescriptor >

View File

@ -1730,7 +1730,7 @@ CustomAnimationEffectPtr EffectSequenceHelper::append( const CustomAnimationPres
if( bFilter )
{
aUserData = ::comphelper::containerToSequence< NamedValue, std::vector< NamedValue > >( aNewUserData );
aUserData = ::comphelper::containerToSequence( aNewUserData );
xNode->setUserData( aUserData );
}

View File

@ -205,7 +205,7 @@ throw (uno::RuntimeException, std::exception)
}
}
return comphelper::containerToSequence< sal_Int16 >( aGroupList );
return comphelper::containerToSequence( aGroupList );
}
Sequence< frame::DispatchInformation > SAL_CALL SfxAppDispatchProvider::getConfigurableDispatchInformation( sal_Int16 nCmdGroup )
@ -249,10 +249,7 @@ throw (uno::RuntimeException, std::exception)
}
}
uno::Sequence< frame::DispatchInformation > aSeq =
comphelper::containerToSequence< frame::DispatchInformation, std::list< frame::DispatchInformation > >( aCmdList );
return aSeq;
return comphelper::containerToSequence( aCmdList );
}
}

View File

@ -812,7 +812,7 @@ namespace sfx2
// create a representation of the group which is understandable by the XFilterGroupManager
if ( _rGroup.size() )
{
Sequence< StringPair > aFilters( comphelper::containerToSequence<StringPair>(_rGroup) );
Sequence< StringPair > aFilters( comphelper::containerToSequence(_rGroup) );
if ( _bAddExtension )
{
StringPair* pFilters = aFilters.getArray();

View File

@ -1169,7 +1169,7 @@ throw (RuntimeException, std::exception)
}
}
return comphelper::containerToSequence< sal_Int16 >( aGroupList );
return comphelper::containerToSequence( aGroupList );
}
uno::Sequence< frame::DispatchInformation > SAL_CALL SfxBaseController::getConfigurableDispatchInformation( sal_Int16 nCmdGroup )
@ -1214,10 +1214,7 @@ throw (RuntimeException, std::exception)
}
}
uno::Sequence< frame::DispatchInformation > aSeq =
comphelper::containerToSequence< frame::DispatchInformation, std::list< frame::DispatchInformation > >( aCmdList );
return aSeq;
return comphelper::containerToSequence( aCmdList );
}
bool SfxBaseController::HandleEvent_Impl( NotifyEvent& rEvent )

View File

@ -1624,7 +1624,7 @@ Sequence< OUString > ImplementationRegistration::getImplementations(
if (!implNames.empty())
{
Sequence<OUString> seqImpl(comphelper::containerToSequence<OUString>(implNames));
Sequence<OUString> seqImpl(comphelper::containerToSequence(implNames));
xImpl->closeKey();
return seqImpl;
}

View File

@ -851,7 +851,7 @@ Sequence< OUString > OServiceManager::getUniqueAvailableServiceNames(
aNameSet.insert( (*aIt++).first );
*/
return comphelper::containerToSequence<OUString>(aNameSet);
return comphelper::containerToSequence(aNameSet);
}
// XMultiComponentFactory

View File

@ -186,7 +186,7 @@ void SysCredentialsConfig::writeCfg()
OSL_ENSURE( m_bCfgInited, "SysCredentialsConfig::writeCfg : not initialized!" );
m_aConfigItem.setSystemCredentialsURLs( comphelper::containerToSequence<OUString>(m_aCfgContainer) );
m_aConfigItem.setSystemCredentialsURLs( comphelper::containerToSequence(m_aCfgContainer) );
}
OUString SysCredentialsConfig::find( OUString const & aURL )

View File

@ -396,7 +396,7 @@ void FmPropBrw::implSetNewSelection( const InterfaceBag& _rSelection )
Reference< XObjectInspector > xInspector( m_xBrowserController, UNO_QUERY_THROW );
// tell it the objects to inspect
xInspector->inspect( comphelper::containerToSequence< Reference< XInterface > >(_rSelection) );
xInspector->inspect( comphelper::containerToSequence(_rSelection) );
}
catch( const VetoException& )
{

View File

@ -241,7 +241,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoNameItemTable::getElementNames( )
aNameSet.insert(aApiName);
}
return comphelper::containerToSequence<OUString>(aNameSet);
return comphelper::containerToSequence(aNameSet);
}
sal_Bool SAL_CALL SvxUnoNameItemTable::hasByName( const OUString& aApiName )

View File

@ -224,7 +224,7 @@ Sequence< OUString > SAL_CALL NamespaceMap::getElementNames() throw (RuntimeExce
while( aIter.next( aPrefix, aURL ) )
aPrefixSet.insert( aPrefix );
return comphelper::containerToSequence<OUString>(aPrefixSet);
return comphelper::containerToSequence(aPrefixSet);
}
sal_Bool SAL_CALL NamespaceMap::hasByName( const OUString& aName ) throw (RuntimeException, std::exception)

View File

@ -353,7 +353,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoMarkerTable::getElementNames()
// search model pool for line ends
createNamesForPool( mpModelPool, XATTR_LINEEND, aNameSet );
return comphelper::containerToSequence<OUString>(aNameSet);
return comphelper::containerToSequence(aNameSet);
}
sal_Bool SAL_CALL SvxUnoMarkerTable::hasByName( const OUString& aName )

View File

@ -2130,7 +2130,7 @@ uno::Sequence<OUString> SwXTextTable::getCellNames() throw( uno::RuntimeExceptio
SwTableLines& rTableLines = pTable->GetTabLines();
std::vector<OUString> aAllNames;
lcl_InspectLines(rTableLines, aAllNames);
return comphelper::containerToSequence<OUString>(aAllNames);
return comphelper::containerToSequence(aAllNames);
}
uno::Reference<text::XTextTableCursor> SwXTextTable::createCursorByCellName(const OUString& sCellName)

View File

@ -269,7 +269,7 @@ void SAL_CALL UnxFilePickerCommandThread::handleCommand( const OUString &rComman
}
else if ( aType == "stringList" )
{
m_aGetValue <<= comphelper::containerToSequence<OUString>(aList);
m_aGetValue <<= comphelper::containerToSequence(aList);
m_aGetValueCondition.set();
}
else

View File

@ -386,7 +386,7 @@ Sequence< Reference< chart2::data::XLabeledDataSequence > > lcl_getAllSeriesSequ
}
}
return comphelper::containerToSequence< Reference< chart2::data::XLabeledDataSequence > >( aContainer );
return comphelper::containerToSequence( aContainer );
}
Reference< chart2::data::XLabeledDataSequence >

View File

@ -427,7 +427,7 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite )
if (xPropState.is())
{
nCount = aNameSet.size();
Sequence<OUString> aNames( comphelper::containerToSequence<OUString>(aNameSet) );
Sequence<OUString> aNames( comphelper::containerToSequence(aNameSet) );
Sequence < PropertyState > aStates( xPropState->getPropertyStates(aNames) );
const PropertyState *pStates = aStates.getConstArray();
OUString* pNames = aNames.getArray();