summaryrefslogtreecommitdiff
path: root/ucb/source/ucp/hierarchy
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 /ucb/source/ucp/hierarchy
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 'ucb/source/ucp/hierarchy')
-rw-r--r--ucb/source/ucp/hierarchy/hierarchycontent.cxx93
-rw-r--r--ucb/source/ucp/hierarchy/hierarchydata.cxx49
2 files changed, 58 insertions, 84 deletions
diff --git a/ucb/source/ucp/hierarchy/hierarchycontent.cxx b/ucb/source/ucp/hierarchy/hierarchycontent.cxx
index fe1750221fee..f6b02647e732 100644
--- a/ucb/source/ucp/hierarchy/hierarchycontent.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchycontent.cxx
@@ -63,6 +63,7 @@
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertysequence.hxx>
#include <ucbhelper/contentidentifier.hxx>
#include <ucbhelper/propertyvalueset.hxx>
#include <ucbhelper/cancelcommandexecution.hxx>
@@ -427,17 +428,13 @@ uno::Any SAL_CALL HierarchyContent::execute(
// Remove own and all children's persistent data.
if ( !removeData() )
{
- uno::Any aProps
- = uno::makeAny(
- beans::PropertyValue(
- "Uri",
- -1,
- uno::makeAny(m_xIdentifier->
- getContentIdentifier()),
- beans::PropertyState_DIRECT_VALUE));
+ uno::Sequence<uno::Any> aArgs(comphelper::InitAnyPropertySequence(
+ {
+ {"Uri", uno::Any(m_xIdentifier->getContentIdentifier())}
+ }));
ucbhelper::cancelCommandExecution(
ucb::IOErrorCode_CANT_WRITE,
- uno::Sequence< uno::Any >(&aProps, 1),
+ aArgs,
Environment,
"Cannot remove persistent data!",
this );
@@ -1285,17 +1282,13 @@ uno::Sequence< uno::Any > HierarchyContent::setPropertyValues(
{
if ( !storeData() )
{
- uno::Any aProps
- = uno::makeAny(
- beans::PropertyValue(
- "Uri",
- -1,
- uno::makeAny(m_xIdentifier->
- getContentIdentifier()),
- beans::PropertyState_DIRECT_VALUE));
+ uno::Sequence<uno::Any> aArgs(comphelper::InitAnyPropertySequence(
+ {
+ {"Uri", uno::Any(m_xIdentifier->getContentIdentifier())}
+ }));
ucbhelper::cancelCommandExecution(
ucb::IOErrorCode_CANT_WRITE,
- uno::Sequence< uno::Any >(&aProps, 1),
+ aArgs,
xEnv,
"Cannot store persistent data!",
this );
@@ -1432,16 +1425,13 @@ void HierarchyContent::insert( sal_Int32 nNameClashResolve,
if ( !storeData() )
{
- uno::Any aProps
- = uno::makeAny(beans::PropertyValue(
- "Uri",
- -1,
- uno::makeAny(m_xIdentifier->
- getContentIdentifier()),
- beans::PropertyState_DIRECT_VALUE));
+ uno::Sequence<uno::Any> aArgs(comphelper::InitAnyPropertySequence(
+ {
+ {"Uri", uno::Any(m_xIdentifier->getContentIdentifier())}
+ }));
ucbhelper::cancelCommandExecution(
ucb::IOErrorCode_CANT_WRITE,
- uno::Sequence< uno::Any >(&aProps, 1),
+ aArgs,
xEnv,
"Cannot store persistent data!",
this );
@@ -1555,15 +1545,13 @@ void HierarchyContent::transfer(
{
if ( aId.startsWith( rInfo.SourceURL ) )
{
- uno::Any aProps
- = uno::makeAny(beans::PropertyValue(
- "Uri",
- -1,
- uno::makeAny(rInfo.SourceURL),
- beans::PropertyState_DIRECT_VALUE));
+ uno::Sequence<uno::Any> aArgs(comphelper::InitAnyPropertySequence(
+ {
+ {"Uri", uno::Any(rInfo.SourceURL)}
+ }));
ucbhelper::cancelCommandExecution(
ucb::IOErrorCode_RECURSIVE,
- uno::Sequence< uno::Any >(&aProps, 1),
+ aArgs,
xEnv,
"Target is equal to or is a child of source!",
this );
@@ -1594,15 +1582,13 @@ void HierarchyContent::transfer(
if ( !xSource.is() )
{
- uno::Any aProps
- = uno::makeAny(beans::PropertyValue(
- "Uri",
- -1,
- uno::makeAny(xId->getContentIdentifier()),
- beans::PropertyState_DIRECT_VALUE));
+ uno::Sequence<uno::Any> aArgs(comphelper::InitAnyPropertySequence(
+ {
+ {"Uri", uno::Any(xId->getContentIdentifier())}
+ }));
ucbhelper::cancelCommandExecution(
ucb::IOErrorCode_CANT_READ,
- uno::Sequence< uno::Any >(&aProps, 1),
+ aArgs,
xEnv,
"Cannot instantiate source object!",
this );
@@ -1627,15 +1613,13 @@ void HierarchyContent::transfer(
createNewContent( aContentInfo ).get() );
if ( !xTarget.is() )
{
- uno::Any aProps
- = uno::makeAny(beans::PropertyValue(
- "Folder",
- -1,
- uno::makeAny(aId),
- beans::PropertyState_DIRECT_VALUE));
+ uno::Sequence<uno::Any> aArgs(comphelper::InitAnyPropertySequence(
+ {
+ {"Folder", uno::Any(aId)}
+ }));
ucbhelper::cancelCommandExecution(
ucb::IOErrorCode_CANT_CREATE,
- uno::Sequence< uno::Any >(&aProps, 1),
+ aArgs,
xEnv,
"XContentCreator::createNewContent failed!",
this );
@@ -1756,18 +1740,13 @@ void HierarchyContent::transfer(
// Remove all persistent data of source and its children.
if ( !xSource->removeData() )
{
- uno::Any aProps
- = uno::makeAny(
- beans::PropertyValue(
- "Uri",
- -1,
- uno::makeAny(
- xSource->m_xIdentifier->
- getContentIdentifier()),
- beans::PropertyState_DIRECT_VALUE));
+ uno::Sequence<uno::Any> aArgs(comphelper::InitAnyPropertySequence(
+ {
+ {"Uri", uno::Any(xSource->m_xIdentifier->getContentIdentifier())}
+ }));
ucbhelper::cancelCommandExecution(
ucb::IOErrorCode_CANT_WRITE,
- uno::Sequence< uno::Any >(&aProps, 1),
+ aArgs,
xEnv,
"Cannot remove persistent data of source object!",
this );
diff --git a/ucb/source/ucp/hierarchy/hierarchydata.cxx b/ucb/source/ucp/hierarchy/hierarchydata.cxx
index b9ce98c567d2..bef1f9bd3883 100644
--- a/ucb/source/ucp/hierarchy/hierarchydata.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchydata.cxx
@@ -37,6 +37,7 @@
#include <com/sun/star/container/XNameReplace.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
#include <com/sun/star/util/XOfficeInstallationDirectories.hpp>
+#include <comphelper/propertysequence.hxx>
#include "hierarchyprovider.hxx"
#include "hierarchyuri.hxx"
@@ -284,12 +285,10 @@ bool HierarchyEntry::setData( const HierarchyEntryData& rData )
bRoot = false;
}
- uno::Sequence< uno::Any > aArguments( 1 );
- beans::PropertyValue aProperty;
-
- aProperty.Name = CFGPROPERTY_NODEPATH;
- aProperty.Value <<= aParentPath;
- aArguments[ 0 ] <<= aProperty;
+ uno::Sequence<uno::Any> aArguments(comphelper::InitAnyPropertySequence(
+ {
+ {CFGPROPERTY_NODEPATH, uno::Any(aParentPath)}
+ }));
uno::Reference< util::XChangesBatch > xBatch(
m_xConfigProvider->createInstanceWithArguments(
@@ -537,12 +536,10 @@ bool HierarchyEntry::move(
bNewRoot = false;
}
- uno::Sequence< uno::Any > aArguments( 1 );
- beans::PropertyValue aProperty;
-
- aProperty.Name = CFGPROPERTY_NODEPATH;
- aProperty.Value <<= aOldParentPath;
- aArguments[ 0 ] <<= aProperty;
+ uno::Sequence<uno::Any> aArguments(comphelper::InitAnyPropertySequence(
+ {
+ {CFGPROPERTY_NODEPATH, uno::Any(aOldParentPath)}
+ }));
xOldParentBatch.set(
m_xConfigProvider->createInstanceWithArguments(
@@ -564,14 +561,15 @@ bool HierarchyEntry::move(
{
bDifferentParents = true;
- aProperty.Name = CFGPROPERTY_NODEPATH;
- aProperty.Value <<= aNewParentPath;
- aArguments[ 0 ] <<= aProperty;
+ uno::Sequence<uno::Any> aArguments2(comphelper::InitAnyPropertySequence(
+ {
+ {CFGPROPERTY_NODEPATH, uno::Any(aNewParentPath)}
+ }));
xNewParentBatch.set(
m_xConfigProvider->createInstanceWithArguments(
READWRITE_SERVICE_NAME,
- aArguments ),
+ aArguments2 ),
uno::UNO_QUERY );
OSL_ENSURE(
@@ -787,12 +785,10 @@ bool HierarchyEntry::remove()
bRoot = false;
}
- uno::Sequence< uno::Any > aArguments( 1 );
- beans::PropertyValue aProperty;
-
- aProperty.Name = CFGPROPERTY_NODEPATH;
- aProperty.Value <<= aParentPath;
- aArguments[ 0 ] <<= aProperty;
+ uno::Sequence<uno::Any> aArguments(comphelper::InitAnyPropertySequence(
+ {
+ {CFGPROPERTY_NODEPATH, uno::Any(aParentPath)}
+ }));
uno::Reference< util::XChangesBatch > xBatch(
m_xConfigProvider->createInstanceWithArguments(
@@ -1021,11 +1017,10 @@ HierarchyEntry::getRootReadAccess()
{
// Create Root object.
- uno::Sequence< uno::Any > aArguments( 1 );
- beans::PropertyValue aProperty;
- aProperty.Name = CFGPROPERTY_NODEPATH;
- aProperty.Value <<= OUString(); // root path
- aArguments[ 0 ] <<= aProperty;
+ uno::Sequence<uno::Any> aArguments(comphelper::InitAnyPropertySequence(
+ {
+ {CFGPROPERTY_NODEPATH, uno::Any(OUString())} // root path
+ }));
m_bTriedToGetRootReadAccess = true;