summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-07-25 09:34:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-07-25 12:03:17 +0200
commitf74da1315a5b2ec232a66944e41ff90231b383be (patch)
tree60d464c45df3531013642d61cbc8302ac815a1ae /dbaccess
parent04a6a5d5cdc6889c6f0e41b3df537f59baeee9f9 (diff)
use more comphelper::InitAnyPropertySequence
Found with: git grep -n -A10 'Sequence.*Any' -- *.cxx | grep -B5 -w PropertyValueProvider and: git grep -n 'Sequence.*Any.*( *&' Change-Id: Icb18c98bdd3f8352817e443ff78de5df042859ad Reviewed-on: https://gerrit.libreoffice.org/40389 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/dataaccess/ComponentDefinition.cxx10
-rw-r--r--dbaccess/source/core/dataaccess/documentcontainer.cxx21
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.cxx36
-rw-r--r--dbaccess/source/filter/xml/dbloader2.cxx28
-rw-r--r--dbaccess/source/filter/xml/xmlComponent.cxx22
-rw-r--r--dbaccess/source/filter/xml/xmlHierarchyCollection.cxx17
-rw-r--r--dbaccess/source/filter/xml/xmlTable.cxx16
-rw-r--r--dbaccess/source/ui/dlg/CollectionView.cxx16
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx22
-rw-r--r--dbaccess/source/ui/uno/unosqlmessage.cxx11
10 files changed, 73 insertions, 126 deletions
diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
index 5d442e62c30b..7fb8872fe14e 100644
--- a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
+++ b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
@@ -25,6 +25,7 @@
#include <comphelper/sequence.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <comphelper/property.hxx>
+#include <comphelper/propertysequence.hxx>
#include "definitioncolumn.hxx"
using namespace ::com::sun::star::uno;
@@ -77,11 +78,10 @@ void OComponentDefinition::initialize( const Sequence< Any >& aArguments )
OUString rName;
if( (aArguments.getLength() == 1) && (aArguments[0] >>= rName) )
{
- Sequence< Any > aNewArgs(1);
- PropertyValue aValue;
- aValue.Name = PROPERTY_NAME;
- aValue.Value <<= rName;
- aNewArgs[0] <<= aValue;
+ Sequence<Any> aNewArgs(comphelper::InitAnyPropertySequence(
+ {
+ {PROPERTY_NAME, Any(rName)}
+ }));
OContentHelper::initialize(aNewArgs);
}
else
diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx
index 2d1f03d8cd87..543242afb2bc 100644
--- a/dbaccess/source/core/dataaccess/documentcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx
@@ -37,6 +37,7 @@
#include "core_resource.hxx"
#include "strings.hrc"
#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/propertysequence.hxx>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <vcl/svapp.hxx>
@@ -338,20 +339,12 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
for(;elements != elementsEnd;++elements)
{
xCopyFrom->getByName(*elements) >>= xObjectToCopy;
- Sequence< Any > aArguments(3);
- PropertyValue aArgument;
- // set as folder
- aArgument.Name = "Name";
- aArgument.Value <<= *elements;
- aArguments[0] <<= aArgument;
- //parent
- aArgument.Name = "Parent";
- aArgument.Value <<= xContent;
- aArguments[1] <<= aArgument;
-
- aArgument.Name = PROPERTY_EMBEDDEDOBJECT;
- aArgument.Value <<= xObjectToCopy;
- aArguments[2] <<= aArgument;
+ Sequence<Any> aArguments(comphelper::InitAnyPropertySequence(
+ {
+ {"Name", Any(*elements)}, // set as folder
+ {"Parent", Any(xContent)},
+ {PROPERTY_EMBEDDEDOBJECT, Any(xObjectToCopy)},
+ }));
OUString sServiceName;
if ( Reference< XNameAccess >( xObjectToCopy, UNO_QUERY ).is() )
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index 744ca5464122..4c7fd57ab7d3 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -27,6 +27,7 @@
#include <comphelper/sequence.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/classids.hxx>
+#include <comphelper/propertysequence.hxx>
#include <com/sun/star/frame/XUntitledNumbers.hpp>
#include <com/sun/star/awt/XTopWindow.hpp>
#include <com/sun/star/awt/Size.hpp>
@@ -1345,21 +1346,12 @@ void ODocumentDefinition::saveAs()
rename(pDocuSave->getName());
updateDocumentTitle();
- Sequence< Any > aArguments(3);
- PropertyValue aValue;
- // set as folder
- aValue.Name = PROPERTY_NAME;
- aValue.Value <<= sOldName;
- aArguments[0] <<= aValue;
-
- aValue.Name = PROPERTY_PERSISTENT_NAME;
- aValue.Value <<= sPersistentName;
- aArguments[1] <<= aValue;
-
- aValue.Name = PROPERTY_AS_TEMPLATE;
- aValue.Value <<= m_pImpl->m_aProps.bAsTemplate;
- aArguments[2] <<= aValue;
-
+ uno::Sequence<uno::Any> aArguments(comphelper::InitAnyPropertySequence(
+ {
+ {PROPERTY_NAME, uno::Any(sOldName)}, // set as folder
+ {PROPERTY_PERSISTENT_NAME, uno::Any(sPersistentName)},
+ {PROPERTY_AS_TEMPLATE, uno::Any(m_pImpl->m_aProps.bAsTemplate)},
+ }));
Reference< XMultiServiceFactory > xORB( m_xParentContainer, UNO_QUERY_THROW );
Reference< XInterface > xComponent( xORB->createInstanceWithArguments( SERVICE_SDB_DOCUMENTDEFINITION, aArguments ) );
Reference< XNameContainer > xNameContainer( m_xParentContainer, UNO_QUERY_THROW );
@@ -2017,15 +2009,11 @@ void ODocumentDefinition::fillReportData( const Reference< XComponentContext >&
const Reference< util::XCloseable >& _rxComponent,
const Reference< XConnection >& _rxActiveConnection )
{
- Sequence< Any > aArgs(2);
- PropertyValue aValue;
- aValue.Name = "TextDocument";
- aValue.Value <<= _rxComponent;
- aArgs[0] <<= aValue;
- aValue.Name = "ActiveConnection";
- aValue.Value <<= _rxActiveConnection;
- aArgs[1] <<= aValue;
-
+ uno::Sequence<uno::Any> aArgs(comphelper::InitAnyPropertySequence(
+ {
+ {"TextDocument", uno::Any(_rxComponent)},
+ {"ActiveConnection", uno::Any(_rxActiveConnection)}
+ }));
try
{
Reference< XJobExecutor > xExecuteable(
diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx
index a20c299e8caf..5f8d2d07fbcc 100644
--- a/dbaccess/source/filter/xml/dbloader2.cxx
+++ b/dbaccess/source/filter/xml/dbloader2.cxx
@@ -58,6 +58,7 @@
#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/types.hxx>
+#include <comphelper/propertysequence.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <osl/file.hxx>
@@ -338,18 +339,11 @@ namespace
bool DBContentLoader::impl_executeNewDatabaseWizard( Reference< XModel >& _rxModel, bool& _bShouldStartTableWizard )
{
- Sequence< Any > aWizardArgs(2);
- aWizardArgs[0] <<= PropertyValue(
- "ParentWindow",
- 0,
- makeAny( lcl_getTopMostWindow( m_aContext ) ),
- PropertyState_DIRECT_VALUE);
-
- aWizardArgs[1] <<= PropertyValue(
- "InitialSelection",
- 0,
- makeAny( _rxModel ),
- PropertyState_DIRECT_VALUE);
+ Sequence<Any> aWizardArgs(comphelper::InitAnyPropertySequence(
+ {
+ {"ParentWindow", Any(lcl_getTopMostWindow( m_aContext ))},
+ {"InitialSelection", Any(_rxModel)}
+ }));
// create the dialog
Reference< XExecutableDialog > xAdminDialog( m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.sdb.DatabaseWizardDialog", aWizardArgs, m_aContext), UNO_QUERY_THROW);
@@ -559,12 +553,10 @@ IMPL_LINK_NOARG( DBContentLoader, OnStartTableWizard, void*, void )
m_nStartWizard = nullptr;
try
{
- Sequence< Any > aWizArgs(1);
- PropertyValue aValue;
- aValue.Name = "DatabaseLocation";
- aValue.Value <<= m_sCurrentURL;
- aWizArgs[0] <<= aValue;
-
+ Sequence<Any> aWizArgs(comphelper::InitAnyPropertySequence(
+ {
+ {"DatabaseLocation", Any(m_sCurrentURL)}
+ }));
SolarMutexGuard aGuard;
Reference< XJobExecutor > xTableWizard( m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.wizards.table.CallTableWizard", aWizArgs, m_aContext), UNO_QUERY);
if ( xTableWizard.is() )
diff --git a/dbaccess/source/filter/xml/xmlComponent.cxx b/dbaccess/source/filter/xml/xmlComponent.cxx
index f1ceb62e3797..538b55bed691 100644
--- a/dbaccess/source/filter/xml/xmlComponent.cxx
+++ b/dbaccess/source/filter/xml/xmlComponent.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
+#include <comphelper/propertysequence.hxx>
namespace dbaxml
{
@@ -80,22 +81,13 @@ OXMLComponent::OXMLComponent( ODBFilter& rImport
}
if ( !m_sHREF.isEmpty() && !m_sName.isEmpty() && _xParentContainer.is() )
{
- Sequence< Any > aArguments(3);
- PropertyValue aValue;
- // set as folder
- aValue.Name = PROPERTY_NAME;
- aValue.Value <<= m_sName;
- aArguments[0] <<= aValue;
-
- aValue.Name = PROPERTY_PERSISTENT_NAME;
sal_Int32 nIndex = m_sHREF.lastIndexOf('/')+1;
- aValue.Value <<= m_sHREF.getToken(0,'/',nIndex);
- aArguments[1] <<= aValue;
-
- aValue.Name = PROPERTY_AS_TEMPLATE;
- aValue.Value <<= m_bAsTemplate;
- aArguments[2] <<= aValue;
-
+ Sequence<Any> aArguments(comphelper::InitAnyPropertySequence(
+ {
+ {PROPERTY_NAME, Any(m_sName)}, // set as folder
+ {PROPERTY_PERSISTENT_NAME, Any(m_sHREF.getToken(0,'/',nIndex))},
+ {PROPERTY_AS_TEMPLATE, Any(m_bAsTemplate)},
+ }));
try
{
Reference< XMultiServiceFactory > xORB( _xParentContainer, UNO_QUERY_THROW );
diff --git a/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx b/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx
index d7a10a735814..9d82f99b5622 100644
--- a/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx
+++ b/dbaccess/source/filter/xml/xmlHierarchyCollection.cxx
@@ -29,6 +29,7 @@
#include "stringconstants.hxx"
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
+#include <comphelper/propertysequence.hxx>
namespace dbaxml
{
@@ -71,20 +72,14 @@ OXMLHierarchyCollection::OXMLHierarchyCollection( ODBFilter& rImport
{
try
{
- Sequence< Any > aArguments(2);
- PropertyValue aValue;
- // set as folder
- aValue.Name = "Name";
- aValue.Value <<= m_sName;
- aArguments[0] <<= aValue;
- //parent
- aValue.Name = "Parent";
- aValue.Value <<= _xParentContainer;
- aArguments[1] <<= aValue;
-
Reference<XMultiServiceFactory> xORB(_xParentContainer,UNO_QUERY);
if ( xORB.is() )
{
+ Sequence<Any> aArguments(comphelper::InitAnyPropertySequence(
+ {
+ {"Name", Any(m_sName)}, // set as folder
+ {"Parent", Any(_xParentContainer)},
+ }));
m_xContainer.set(xORB->createInstanceWithArguments(_sCollectionServiceName,aArguments),UNO_QUERY);
Reference<XNameContainer> xNameContainer(_xParentContainer,UNO_QUERY);
if ( xNameContainer.is() && !xNameContainer->hasByName(m_sName) )
diff --git a/dbaccess/source/filter/xml/xmlTable.cxx b/dbaccess/source/filter/xml/xmlTable.cxx
index ceb86414d249..b6ca98b0d84a 100644
--- a/dbaccess/source/filter/xml/xmlTable.cxx
+++ b/dbaccess/source/filter/xml/xmlTable.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <comphelper/namecontainer.hxx>
+#include <comphelper/propertysequence.hxx>
namespace dbaxml
{
@@ -87,16 +88,11 @@ OXMLTable::OXMLTable( ODBFilter& _rImport
break;
}
}
- Sequence< Any > aArguments(2);
- PropertyValue aValue;
- // set as folder
- aValue.Name = "Name";
- aValue.Value <<= m_sName;
- aArguments[0] <<= aValue;
- //parent
- aValue.Name = "Parent";
- aValue.Value <<= m_xParentContainer;
- aArguments[1] <<= aValue;
+ uno::Sequence<uno::Any> aArguments(comphelper::InitAnyPropertySequence(
+ {
+ {"Name", uno::Any(m_sName)}, // set as folder
+ {"Parent", uno::Any(m_xParentContainer)}
+ }));
m_xTable.set(
GetOwnImport().GetComponentContext()->getServiceManager()->createInstanceWithArgumentsAndContext(m_sServiceName,aArguments, GetOwnImport().GetComponentContext()),
UNO_QUERY);
diff --git a/dbaccess/source/ui/dlg/CollectionView.cxx b/dbaccess/source/ui/dlg/CollectionView.cxx
index e7267ca68ca7..78ee969ccdd1 100644
--- a/dbaccess/source/ui/dlg/CollectionView.cxx
+++ b/dbaccess/source/ui/dlg/CollectionView.cxx
@@ -25,6 +25,7 @@
#include "strings.hrc"
#include <comphelper/processfactory.hxx>
#include <comphelper/interaction.hxx>
+#include <comphelper/propertysequence.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -148,16 +149,11 @@ IMPL_LINK_NOARG(OCollectionView, Save_Click, Button*, void)
}
else // sub folder doesn't exist
{
- Sequence< Any > aValues(2);
- PropertyValue aValue;
- aValue.Name = "ResourceName";
- aValue.Value <<= sSubFolder;
- aValues[0] <<= aValue;
-
- aValue.Name = "ResourceType";
- aValue.Value <<= OUString("folder");
- aValues[1] <<= aValue;
-
+ Sequence<Any> aValues(comphelper::InitAnyPropertySequence(
+ {
+ {"ResourceName", Any(sSubFolder)},
+ {"ResourceType", Any(OUString("folder"))}
+ }));
InteractiveAugmentedIOException aException(OUString(),Reference<XInterface>(),
InteractionClassification_ERROR,
IOErrorCode_NOT_EXISTING_PATH,aValues);
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index 10b7f2a07b36..1458bb93a853 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -70,6 +70,7 @@
#include "FieldDescriptions.hxx"
#include <comphelper/processfactory.hxx>
#include <comphelper/stl_types.hxx>
+#include <comphelper/propertysequence.hxx>
#include <svx/svxids.hrc>
@@ -1378,21 +1379,12 @@ bool insertHierachyElement( vcl::Window* _pParent, const Reference< XComponentCo
try
{
Reference<XMultiServiceFactory> xORB( xNameAccess, UNO_QUERY_THROW );
- Sequence< Any > aArguments(3);
- PropertyValue aValue;
- // set as folder
- aValue.Name = "Name";
- aValue.Value <<= sNewName;
- aArguments[0] <<= aValue;
- //parent
- aValue.Name = "Parent";
- aValue.Value <<= xNameAccess;
- aArguments[1] <<= aValue;
-
- aValue.Name = PROPERTY_EMBEDDEDOBJECT;
- aValue.Value <<= _xContent;
- aArguments[2] <<= aValue;
-
+ uno::Sequence<uno::Any> aArguments(comphelper::InitAnyPropertySequence(
+ {
+ {"Name", uno::Any(sNewName)}, // set as folder
+ {"Parent", uno::Any(xNameAccess)},
+ {PROPERTY_EMBEDDEDOBJECT, uno::Any(_xContent)},
+ }));
OUString sServiceName(_bCollection ? ((_bForm) ? OUString(SERVICE_NAME_FORM_COLLECTION) : OUString(SERVICE_NAME_REPORT_COLLECTION)) : OUString(SERVICE_SDB_DOCUMENTDEFINITION));
Reference<XContent > xNew( xORB->createInstanceWithArguments( sServiceName, aArguments ), UNO_QUERY_THROW );
diff --git a/dbaccess/source/ui/uno/unosqlmessage.cxx b/dbaccess/source/ui/uno/unosqlmessage.cxx
index 7d7f003a5f57..222fd7bf05dd 100644
--- a/dbaccess/source/ui/uno/unosqlmessage.cxx
+++ b/dbaccess/source/ui/uno/unosqlmessage.cxx
@@ -24,6 +24,7 @@
#include "stringconstants.hxx"
#include "strings.hxx"
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertysequence.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <connectivity/dbexception.hxx>
@@ -91,10 +92,12 @@ void OSQLMessageDialog::initialize(Sequence<Any> const & args)
Reference< css::awt::XWindow > parentWindow;
if ((args.getLength() == 3) && (args[0] >>= title) && (args[1] >>= parentWindow)) {
- Sequence<Any> s(3);
- s[0] <<= PropertyValue( "Title", -1, makeAny(title), PropertyState_DIRECT_VALUE);
- s[1] <<= PropertyValue( "ParentWindow", -1, makeAny(parentWindow), PropertyState_DIRECT_VALUE);
- s[2] <<= PropertyValue( "SQLException", -1, args[2], PropertyState_DIRECT_VALUE);
+ Sequence<Any> s(comphelper::InitAnyPropertySequence(
+ {
+ {"Title", Any(title)},
+ {"ParentWindow", Any(parentWindow)},
+ {"SQLException", args[2]}
+ }));
OGenericUnoDialog::initialize(s);
} else {
OGenericUnoDialog::initialize(args);