[Libreoffice-commits] core.git: 7 commits - extensions/source offapi/com offapi/UnoApi_offapi.mk ucb/source
Stephan Bergmann
sbergman at redhat.com
Thu Aug 15 07:55:46 PDT 2013
extensions/source/update/feed/updatefeed.cxx | 62 ++---
offapi/UnoApi_offapi.mk | 2
offapi/com/sun/star/ucb/Content.idl | 63 +++++
offapi/com/sun/star/ucb/PropertyCommandArgument.idl | 46 +++
offapi/com/sun/star/ucb/WebDAVHTTPMethod.idl | 114 +++++++++
offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl | 22 -
ucb/source/ucp/webdav-neon/DAVProperties.cxx | 32 ++
ucb/source/ucp/webdav-neon/DAVProperties.hxx | 2
ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx | 56 ++--
ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx | 3
ucb/source/ucp/webdav-neon/webdavcontent.cxx | 161 +++++++++++--
ucb/source/ucp/webdav-neon/webdavcontent.hxx | 16 +
ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx | 15 +
ucb/source/ucp/webdav/DAVProperties.cxx | 40 +++
ucb/source/ucp/webdav/DAVProperties.hxx | 2
ucb/source/ucp/webdav/DAVResourceAccess.cxx | 64 ++---
ucb/source/ucp/webdav/DAVResourceAccess.hxx | 5
ucb/source/ucp/webdav/webdavcontent.cxx | 216 +++++++++++++-----
ucb/source/ucp/webdav/webdavcontent.hxx | 16 +
ucb/source/ucp/webdav/webdavcontentcaps.cxx | 15 +
20 files changed, 743 insertions(+), 209 deletions(-)
New commits:
commit 0fcac72211375a5a0e00db4f93cd6e712f91c4b7
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Aug 15 16:53:55 2013 +0200
Adapt to LibreOffice the previous commit
..."i121946 - Use enums to identify WebDAV/HTTP methods."
Change-Id: I59c8b011192df008af539aa41ec5976f042572f6
diff --git a/offapi/com/sun/star/ucb/WebDAVHTTPMethod.idl b/offapi/com/sun/star/ucb/WebDAVHTTPMethod.idl
index 81fed33..dc0f5f0 100644
--- a/offapi/com/sun/star/ucb/WebDAVHTTPMethod.idl
+++ b/offapi/com/sun/star/ucb/WebDAVHTTPMethod.idl
@@ -23,7 +23,7 @@ module com { module sun { module star { module ucb {
/** Standard WebDAV/HTTP methods.
- @since Apache OpenOffice 4.0
+ @since Apache OpenOffice 4.0, LibreOffice 4.2
*/
enum WebDAVHTTPMethod
{
diff --git a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
index b4e80afe..cb2b90c65 100644
--- a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
@@ -237,7 +237,7 @@ void DAVResourceAccess::PROPFIND(
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString( "PROPFIND" ),
+ ucb::WebDAVHTTPMethod_PROPFIND,
aHeaders );
m_xSession->PROPFIND( getRequestURI(),
@@ -279,7 +279,7 @@ void DAVResourceAccess::PROPFIND(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString( "PROPFIND" ),
+ ucb::WebDAVHTTPMethod_PROPFIND,
aHeaders );
m_xSession->PROPFIND( getRequestURI(),
@@ -319,7 +319,7 @@ void DAVResourceAccess::PROPPATCH(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString( "PROPPATCH" ),
+ ucb::WebDAVHTTPMethod_PROPPATCH,
aHeaders );
m_xSession->PROPPATCH( getRequestURI(),
@@ -359,7 +359,7 @@ void DAVResourceAccess::HEAD(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString("HEAD"),
+ ucb::WebDAVHTTPMethod_HEAD,
aHeaders );
m_xSession->HEAD( getRequestURI(),
@@ -399,7 +399,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString("GET"),
+ ucb::WebDAVHTTPMethod_GET,
aHeaders );
xStream = m_xSession->GET( getRequestURI(),
@@ -440,7 +440,7 @@ void DAVResourceAccess::GET(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString("GET"),
+ ucb::WebDAVHTTPMethod_GET,
aHeaders );
m_xSession->GET( getRequestURI(),
@@ -481,7 +481,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString("GET"),
+ ucb::WebDAVHTTPMethod_GET,
aHeaders );
xStream = m_xSession->GET( getRequestURI(),
@@ -526,7 +526,7 @@ void DAVResourceAccess::GET(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString("GET"),
+ ucb::WebDAVHTTPMethod_GET,
aHeaders );
m_xSession->GET( getRequestURI(),
@@ -611,7 +611,7 @@ void DAVResourceAccess::PUT(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString("PUT"),
+ ucb::WebDAVHTTPMethod_PUT,
aHeaders );
m_xSession->PUT( getRequestURI(),
@@ -663,7 +663,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::POST(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString("POST"),
+ ucb::WebDAVHTTPMethod_POST,
aHeaders );
xStream = m_xSession->POST( getRequestURI(),
@@ -726,7 +726,7 @@ void DAVResourceAccess::POST(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString("POST"),
+ ucb::WebDAVHTTPMethod_POST,
aHeaders );
m_xSession->POST( getRequestURI(),
@@ -774,7 +774,7 @@ void DAVResourceAccess::MKCOL(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString("MKCOL"),
+ ucb::WebDAVHTTPMethod_MKCOL,
aHeaders );
m_xSession->MKCOL( getRequestURI(),
@@ -814,7 +814,7 @@ void DAVResourceAccess::COPY(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString("COPY"),
+ ucb::WebDAVHTTPMethod_COPY,
aHeaders );
m_xSession->COPY( rSourcePath,
@@ -856,7 +856,7 @@ void DAVResourceAccess::MOVE(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString("MOVE"),
+ ucb::WebDAVHTTPMethod_MOVE,
aHeaders );
m_xSession->MOVE( rSourcePath,
@@ -895,7 +895,7 @@ void DAVResourceAccess::DESTROY(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString( "DESTROY" ),
+ ucb::WebDAVHTTPMethod_DELETE,
aHeaders );
m_xSession->DESTROY( getRequestURI(),
@@ -934,7 +934,7 @@ void DAVResourceAccess::LOCK(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString("LOCK"),
+ ucb::WebDAVHTTPMethod_LOCK,
aHeaders );
m_xSession->LOCK( getRequestURI(),
@@ -976,7 +976,7 @@ sal_Int64 DAVResourceAccess::LOCK(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString("LOCK"),
+ ucb::WebDAVHTTPMethod_LOCK,
aHeaders );
nNewTimeout = m_xSession->LOCK( getRequestURI(),
@@ -1018,7 +1018,7 @@ void DAVResourceAccess::UNLOCK(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString("UNLOCK"),
+ ucb::WebDAVHTTPMethod_UNLOCK,
aHeaders );
m_xSession->UNLOCK( getRequestURI(),
@@ -1115,7 +1115,7 @@ const OUString & DAVResourceAccess::getRequestURI() const
void DAVResourceAccess::getUserRequestHeaders(
const uno::Reference< ucb::XCommandEnvironment > & xEnv,
const OUString & rURI,
- const OUString & rMethod,
+ ucb::WebDAVHTTPMethod eMethod,
DAVRequestHeaders & rRequestHeaders )
{
if ( xEnv.is() )
@@ -1126,7 +1126,7 @@ void DAVResourceAccess::getUserRequestHeaders(
if ( xDAVEnv.is() )
{
uno::Sequence< beans::StringPair > aRequestHeaders
- = xDAVEnv->getUserRequestHeaders( rURI, rMethod );
+ = xDAVEnv->getUserRequestHeaders( rURI, eMethod );
for ( sal_Int32 n = 0; n < aRequestHeaders.getLength(); ++n )
{
diff --git a/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx b/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx
index c9c0de5..134d3e3 100644
--- a/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx
+++ b/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx
@@ -38,6 +38,7 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/ucb/Lock.hpp>
+#include <com/sun/star/ucb/WebDAVHTTPMethod.hpp>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include "DAVAuthListener.hxx"
#include "DAVException.hxx"
@@ -240,7 +241,7 @@ public:
const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment > & xEnv,
const OUString & rURI,
- const OUString & rMethod,
+ com::sun::star::ucb::WebDAVHTTPMethod eMethod,
DAVRequestHeaders & rRequestHeaders );
private:
commit 7165b05968ed7d6a52986382877e82e09f7150aa
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Sun Mar 24 12:23:39 2013 +0000
i121946 - Use enums to identify WebDAV/HTTP methods
(cherry picked from commit 122e10cfd23b379b97e2d8ec002e7f0562ebd6f7)
Conflicts:
extensions/source/update/feed/updatefeed.cxx
offapi/com/sun/star/ucb/makefile.mk
offapi/type_reference/typelibrary_history.txt
offapi/type_reference/types.rdb
ucb/source/ucp/webdav/DAVResourceAccess.cxx
ucb/source/ucp/webdav/DAVResourceAccess.hxx
plus headerize.pl
(Would be an incompatible API CHANGE if we had not unpublished
XWebDAVCommandEnvironment with 78cca63070ae6cf82b45ec3bc75fafa2db31a7f2 "Revert
publishing of lots of UNO types.")
Change-Id: I153e394a194d0fcad29d3e3b27d5b24f7c259fc4
diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx
index b18b5c8..82e4427 100644
--- a/extensions/source/update/feed/updatefeed.cxx
+++ b/extensions/source/update/feed/updatefeed.cxx
@@ -174,7 +174,7 @@ public:
// XWebDAVCommandEnvironment
virtual uno::Sequence< beans::StringPair > SAL_CALL getUserRequestHeaders(
- const OUString&, const OUString& )
+ const OUString&, ucb::WebDAVHTTPMethod )
throw ( uno::RuntimeException ) { return m_aRequestHeaderList; };
// XServiceInfo
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 26652d4..8aff46b 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -1530,6 +1530,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/ucb,\
WebDAVContentProvider \
WebDAVDocumentContent \
WebDAVFolderContent \
+ WebDAVHTTPMethod \
))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/ui,\
ActionTrigger \
diff --git a/offapi/com/sun/star/ucb/WebDAVHTTPMethod.idl b/offapi/com/sun/star/ucb/WebDAVHTTPMethod.idl
new file mode 100644
index 0000000..81fed33
--- /dev/null
+++ b/offapi/com/sun/star/ucb/WebDAVHTTPMethod.idl
@@ -0,0 +1,114 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_ucb_WebDAVHTTPMethod_idl__
+#define __com_sun_star_ucb_WebDAVHTTPMethod_idl__
+
+module com { module sun { module star { module ucb {
+
+
+/** Standard WebDAV/HTTP methods.
+
+ @since Apache OpenOffice 4.0
+*/
+enum WebDAVHTTPMethod
+{
+ /** HTTP request method as defined in
+ <a target="_blank" href="http://tools.ietf.org/html/rfc2616#section-9.3">RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1</a>
+ */
+ GET,
+
+ /** HTTP request method as defined in
+ <a target="_blank" href="http://tools.ietf.org/html/rfc2616#section-9.4">RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1</a>
+ */
+ HEAD,
+
+ /** HTTP request method as defined in
+ <a target="_blank" href="http://tools.ietf.org/html/rfc2616#section-9.5">RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1</a>
+ */
+ POST,
+
+ /** HTTP request method as defined in
+ <a target="_blank" href="http://tools.ietf.org/html/rfc2616#section-9.6">RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1</a>
+ */
+ PUT,
+
+ /** HTTP request method as defined in
+ <a target="_blank" href="http://tools.ietf.org/html/rfc2616#section-9.7">RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1</a>
+ */
+ DELETE,
+
+ /** HTTP request method as defined in
+ <a target="_blank" href="http://tools.ietf.org/html/rfc2616#section-9.8">RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1</a>
+ */
+ TRACE,
+
+ /** HTTP request method as defined in
+ <a target="_blank" href="http://tools.ietf.org/html/rfc2616#section-9.2">RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1</a>
+ */
+ OPTIONS,
+
+ /** HTTP request method as defined in
+ <a target="_blank" href="http://tools.ietf.org/html/rfc2616#section-9.9">RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1</a>
+ */
+ CONNECT,
+
+ /** HTTP request method as defined in
+ <a target="_blank" href="http://tools.ietf.org/html/rfc5789">RFC 5789: PATCH Method for HTTP</a>
+ */
+ PATCH,
+
+ /** WebDAV methods as defined in
+ <a target="_blank" href="http://tools.ietf.org/html/rfc4918#section-9.1">HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)</a>
+ */
+ PROPFIND,
+
+ /** WebDAV methods as defined in
+ <a target="_blank" href="http://tools.ietf.org/html/rfc4918#section-9.2">HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)</a>
+ */
+ PROPPATCH,
+
+ /** WebDAV methods as defined in
+ <a target="_blank" href="http://tools.ietf.org/html/rfc4918#section-9.3">HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)</a>
+ */
+ MKCOL,
+
+ /** WebDAV methods as defined in
+ <a target="_blank" href="http://tools.ietf.org/html/rfc4918#section-9.8">HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)</a>
+ */
+ COPY,
+
+ /** WebDAV methods as defined in
+ <a target="_blank" href="http://tools.ietf.org/html/rfc4918#section-9.9">HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)</a>
+ */
+ MOVE,
+
+ /** WebDAV methods as defined in
+ <a target="_blank" href="http://tools.ietf.org/html/rfc4918#section-9.10">HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)</a>
+ */
+ LOCK,
+
+ /** WebDAV methods as defined in
+ <a target="_blank" href="http://tools.ietf.org/html/rfc4918#section-9.11">HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)</a>
+ */
+ UNLOCK
+
+};
+
+}; }; }; };
+
+#endif
diff --git a/offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl b/offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl
index 7bc1732..bbf072c 100644
--- a/offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl
+++ b/offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl
@@ -20,6 +20,7 @@
#define __com_sun_star_ucb_XWebDAVCommandEnvironment_idl__
#include <com/sun/star/ucb/XCommandEnvironment.idl>
+#include <com/sun/star/ucb/WebDAVHTTPMethod.idl>
#include <com/sun/star/beans/StringPair.idl>
@@ -38,15 +39,16 @@ interface XWebDAVCommandEnvironment : XCommandEnvironment
The request URI.
@param aMethod
- The WebDAV/HTTP method ("GET","PUT","MKCOL",...).
+ The WebDAV/HTTP method ("GET","PUT","MKCOL",...) as defined in
+ <type>WebDAVHTTPMethod</type>.
@return
A sequence of header name, header value pairs. The header
names must be the plain names and contain no trailing ":".
*/
sequence<com::sun::star::beans::StringPair> getUserRequestHeaders(
- [in] string aURI,
- [in] string aMethod);
+ [in] string aURI,
+ [in] WebDAVHTTPMethod eMethod);
};
}; }; }; };
diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
index 9c1d3e9..088b868 100644
--- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
@@ -186,8 +186,7 @@ void DAVResourceAccess::PROPFIND(
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii(
- "PROPFIND" ),
+ ucb::WebDAVHTTPMethod_PROPFIND,
aHeaders );
m_xSession->PROPFIND( getRequestURI(),
@@ -229,8 +228,7 @@ void DAVResourceAccess::PROPFIND(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii(
- "PROPFIND" ),
+ ucb::WebDAVHTTPMethod_PROPFIND,
aHeaders );
m_xSession->PROPFIND( getRequestURI(),
@@ -270,8 +268,7 @@ void DAVResourceAccess::PROPPATCH(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii(
- "PROPPATCH" ),
+ ucb::WebDAVHTTPMethod_PROPPATCH,
aHeaders );
m_xSession->PROPPATCH( getRequestURI(),
@@ -311,7 +308,7 @@ void DAVResourceAccess::HEAD(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii( "HEAD" ),
+ ucb::WebDAVHTTPMethod_HEAD,
aHeaders );
m_xSession->HEAD( getRequestURI(),
@@ -351,7 +348,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii( "GET" ),
+ ucb::WebDAVHTTPMethod_GET,
aHeaders );
xStream = m_xSession->GET( getRequestURI(),
@@ -392,7 +389,7 @@ void DAVResourceAccess::GET(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii( "GET" ),
+ ucb::WebDAVHTTPMethod_GET,
aHeaders );
m_xSession->GET( getRequestURI(),
@@ -433,7 +430,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii( "GET" ),
+ ucb::WebDAVHTTPMethod_GET,
aHeaders );
xStream = m_xSession->GET( getRequestURI(),
@@ -478,7 +475,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET(
{
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString( "GET" ),
+ ucb::WebDAVHTTPMethod_GET,
rRequestHeaders );
xStream = m_xSession->GET( getRequestURI(),
@@ -523,7 +520,7 @@ void DAVResourceAccess::GET(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii( "GET" ),
+ ucb::WebDAVHTTPMethod_GET,
aHeaders );
m_xSession->GET( getRequestURI(),
@@ -610,7 +607,7 @@ void DAVResourceAccess::PUT(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii( "PUT" ),
+ ucb::WebDAVHTTPMethod_PUT,
aHeaders );
m_xSession->PUT( getRequestURI(),
@@ -662,7 +659,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::POST(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii( "POST" ),
+ ucb::WebDAVHTTPMethod_POST,
aHeaders );
xStream = m_xSession->POST( getRequestURI(),
@@ -725,7 +722,7 @@ void DAVResourceAccess::POST(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii( "POST" ),
+ ucb::WebDAVHTTPMethod_POST,
aHeaders );
m_xSession->POST( getRequestURI(),
@@ -773,7 +770,7 @@ void DAVResourceAccess::MKCOL(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii( "MKCOL" ),
+ ucb::WebDAVHTTPMethod_MKCOL,
aHeaders );
m_xSession->MKCOL( getRequestURI(),
@@ -813,7 +810,7 @@ void DAVResourceAccess::COPY(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii( "COPY" ),
+ ucb::WebDAVHTTPMethod_COPY,
aHeaders );
m_xSession->COPY( rSourcePath,
@@ -855,7 +852,7 @@ void DAVResourceAccess::MOVE(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii( "MOVE" ),
+ ucb::WebDAVHTTPMethod_MOVE,
aHeaders );
m_xSession->MOVE( rSourcePath,
@@ -894,8 +891,7 @@ void DAVResourceAccess::DESTROY(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii(
- "DESTROY" ),
+ ucb::WebDAVHTTPMethod_DELETE,
aHeaders );
m_xSession->DESTROY( getRequestURI(),
@@ -934,7 +930,7 @@ void DAVResourceAccess::LOCK(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii( "LOCK" ),
+ ucb::WebDAVHTTPMethod_LOCK,
aHeaders );
m_xSession->LOCK( getRequestURI(),
@@ -976,7 +972,7 @@ sal_Int64 DAVResourceAccess::LOCK(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii( "LOCK" ),
+ ucb::WebDAVHTTPMethod_LOCK,
aHeaders );
nNewTimeout = m_xSession->LOCK( getRequestURI(),
@@ -1018,7 +1014,7 @@ void DAVResourceAccess::UNLOCK(
DAVRequestHeaders aHeaders;
getUserRequestHeaders( xEnv,
getRequestURI(),
- OUString::createFromAscii( "UNLOCK" ),
+ ucb::WebDAVHTTPMethod_UNLOCK,
aHeaders );
m_xSession->UNLOCK( getRequestURI(),
@@ -1106,8 +1102,8 @@ const OUString & DAVResourceAccess::getRequestURI() const
// static
void DAVResourceAccess::getUserRequestHeaders(
const uno::Reference< ucb::XCommandEnvironment > & xEnv,
- const OUString & rURI,
- const OUString & rMethod,
+ const rtl::OUString & rURI,
+ ucb::WebDAVHTTPMethod eMethod,
DAVRequestHeaders & rRequestHeaders )
{
if ( !xEnv.is() )
@@ -1120,7 +1116,7 @@ void DAVResourceAccess::getUserRequestHeaders(
return;
uno::Sequence< beans::StringPair > aRequestHeaders
- = xDAVEnv->getUserRequestHeaders( rURI, rMethod );
+ = xDAVEnv->getUserRequestHeaders( rURI, eMethod );
for ( sal_Int32 n = 0; n < aRequestHeaders.getLength(); ++n )
{
diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.hxx b/ucb/source/ucp/webdav/DAVResourceAccess.hxx
index 23705ce..222b37e 100644
--- a/ucb/source/ucp/webdav/DAVResourceAccess.hxx
+++ b/ucb/source/ucp/webdav/DAVResourceAccess.hxx
@@ -30,6 +30,7 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/ucb/Lock.hpp>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/ucb/WebDAVHTTPMethod.hpp>
#include "DAVAuthListener.hxx"
#include "DAVException.hxx"
#include "DAVSession.hxx"
@@ -226,8 +227,8 @@ public:
getUserRequestHeaders(
const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment > & xEnv,
- const OUString & rURI,
- const OUString & rMethod,
+ const rtl::OUString & rURI,
+ com::sun::star::ucb::WebDAVHTTPMethod eMethod,
DAVRequestHeaders & rRequestHeaders );
private:
commit 3d737afda8a5bdc12254d1379300ef09a47164c9
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Aug 15 16:10:14 2013 +0200
Adapt to LibreOffice the previous commit
..."i121945 - WebDAV ucp: return StringPair instead of NamedValue."
Change-Id: Ib9cc95b03ba2a298c2d8f3c49045ea5a073bd2fd
diff --git a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
index a3976b9..b4e80afe 100644
--- a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
@@ -1125,23 +1125,15 @@ void DAVResourceAccess::getUserRequestHeaders(
if ( xDAVEnv.is() )
{
- uno::Sequence< beans::NamedValue > aRequestHeaders
+ uno::Sequence< beans::StringPair > aRequestHeaders
= xDAVEnv->getUserRequestHeaders( rURI, rMethod );
for ( sal_Int32 n = 0; n < aRequestHeaders.getLength(); ++n )
{
- OUString aValue;
- sal_Bool isString = aRequestHeaders[ n ].Value >>= aValue;
-
- if ( !isString )
- {
- OSL_ENSURE( isString,
- "DAVResourceAccess::getUserRequestHeaders :"
- "Value is not a string! Ignoring..." );
- }
-
rRequestHeaders.push_back(
- DAVRequestHeader( aRequestHeaders[ n ].Name, aValue ) );
+ DAVRequestHeader(
+ aRequestHeaders[ n ].First,
+ aRequestHeaders[ n ].Second ) );
}
}
}
commit 424300b69a43c569dae5753db63c2ad7444d3d73
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Sun Mar 24 12:22:48 2013 +0000
i121945 - WebDAV ucp: return StringPair instead of NamedValue
Make css::ucb::XWebDAVCommandEnvironment::getUserRequestHeaders() return
a sequence of css::beans::StringPair; this avoids all the any overhead,
and is much more simple and intuitive.
(cherry picked from commit 80199136d0d84b51b3d0529fb313b8f20f5cf851)
Conflicts:
extensions/source/update/feed/updatefeed.cxx
offapi/type_reference/typelibrary_history.txt
offapi/type_reference/types.rdb
ucb/source/ucp/webdav/DAVResourceAccess.cxx
(Would be an incompatible API CHANGE if we had not unpublished
XWebDAVCommandEnvironment with 78cca63070ae6cf82b45ec3bc75fafa2db31a7f2 "Revert
publishing of lots of UNO types.")
Change-Id: I1c5d0a0b225fe86aca6ba6d6c8903985005387c2
diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx
index 96a9311..b18b5c8 100644
--- a/extensions/source/update/feed/updatefeed.cxx
+++ b/extensions/source/update/feed/updatefeed.cxx
@@ -173,7 +173,7 @@ public:
throw ( uno::RuntimeException ) { return uno::Reference< ucb::XProgressHandler >(); };
// XWebDAVCommandEnvironment
- virtual uno::Sequence< beans::NamedValue > SAL_CALL getUserRequestHeaders(
+ virtual uno::Sequence< beans::StringPair > SAL_CALL getUserRequestHeaders(
const OUString&, const OUString& )
throw ( uno::RuntimeException ) { return m_aRequestHeaderList; };
@@ -188,7 +188,7 @@ public:
protected:
virtual ~UpdateInformationProvider();
- static uno::Any getConfigurationItem(uno::Reference<lang::XMultiServiceFactory> const & configurationProvider, OUString const & node, OUString const & item);
+ static OUString getConfigurationItem(uno::Reference<lang::XMultiServiceFactory> const & configurationProvider, OUString const & node, OUString const & item);
private:
uno::Reference< io::XInputStream > load(const OUString& rURL);
@@ -207,7 +207,7 @@ private:
const uno::Reference< xml::dom::XDocumentBuilder > m_xDocumentBuilder;
const uno::Reference< xml::xpath::XXPathAPI > m_xXPathAPI;
- uno::Sequence< beans::NamedValue > m_aRequestHeaderList;
+ uno::Sequence< beans::StringPair > m_aRequestHeaderList;
uno::Reference< ucb::XCommandProcessor > m_xCommandProcessor;
uno::Reference< task::XInteractionHandler > m_xInteractionHandler;
@@ -327,24 +327,22 @@ UpdateInformationProvider::UpdateInformationProvider(
com::sun::star::configuration::theDefaultProvider::get(xContext));
OUStringBuffer buf;
- OUString name;
- getConfigurationItem(
- xConfigurationProvider,
- "org.openoffice.Setup/Product",
- "ooName") >>= name;
- buf.append(name);
+ buf.append(
+ getConfigurationItem(
+ xConfigurationProvider,
+ "org.openoffice.Setup/Product",
+ "ooName"));
buf.append(sal_Unicode(' '));
- OUString version;
- getConfigurationItem(
- xConfigurationProvider,
- "org.openoffice.Setup/Product",
- "ooSetupVersion") >>= version;
- buf.append(version);
- OUString extension;
- getConfigurationItem(
- xConfigurationProvider,
- "org.openoffice.Setup/Product",
- "ooSetupExtension") >>= extension;
+ buf.append(
+ getConfigurationItem(
+ xConfigurationProvider,
+ "org.openoffice.Setup/Product",
+ "ooSetupVersion"));
+ OUString extension(
+ getConfigurationItem(
+ xConfigurationProvider,
+ "org.openoffice.Setup/Product",
+ "ooSetupExtension"));
if (!extension.isEmpty()) {
buf.append(extension);
}
@@ -366,13 +364,13 @@ UpdateInformationProvider::UpdateInformationProvider(
SAL_INFO("extensions.update", "UpdateUserAgent: " << aUserAgent);
- m_aRequestHeaderList[0].Name = "Accept-Language";
- m_aRequestHeaderList[0].Value = getConfigurationItem( xConfigurationProvider, "org.openoffice.Setup/L10N", "ooLocale" );
+ m_aRequestHeaderList[0].First = "Accept-Language";
+ m_aRequestHeaderList[0].Second = getConfigurationItem( xConfigurationProvider, "org.openoffice.Setup/L10N", "ooLocale" );
if( !aUserAgent.isEmpty() )
{
m_aRequestHeaderList.realloc(2);
- m_aRequestHeaderList[1].Name = "User-Agent";
- m_aRequestHeaderList[1].Value = uno::makeAny(aUserAgent);
+ m_aRequestHeaderList[1].First = "User-Agent";
+ m_aRequestHeaderList[1].Second = aUserAgent;
}
}
@@ -401,10 +399,11 @@ UpdateInformationProvider::~UpdateInformationProvider()
//------------------------------------------------------------------------------
-uno::Any
+OUString
UpdateInformationProvider::getConfigurationItem(uno::Reference<lang::XMultiServiceFactory> const & configurationProvider, OUString const & node, OUString const & item)
{
- beans::NamedValue aProperty;
+ rtl::OUString sRet;
+ beans::PropertyValue aProperty;
aProperty.Name = "nodepath";
aProperty.Value = uno::makeAny(node);
@@ -417,7 +416,8 @@ UpdateInformationProvider::getConfigurationItem(uno::Reference<lang::XMultiServi
aArgumentList ),
uno::UNO_QUERY_THROW);
- return xNameAccess->getByName(item);
+ xNameAccess->getByName(item) >>= sRet;
+ return sRet;
}
//------------------------------------------------------------------------------
diff --git a/offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl b/offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl
index eda3d14..7bc1732 100644
--- a/offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl
+++ b/offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl
@@ -20,7 +20,7 @@
#define __com_sun_star_ucb_XWebDAVCommandEnvironment_idl__
#include <com/sun/star/ucb/XCommandEnvironment.idl>
-#include <com/sun/star/beans/NamedValue.idl>
+#include <com/sun/star/beans/StringPair.idl>
module com { module sun { module star { module ucb {
@@ -43,9 +43,8 @@ interface XWebDAVCommandEnvironment : XCommandEnvironment
@return
A sequence of header name, header value pairs. The header
names must be the plain names and contain no trailing ":".
- The header value must be an Any containing a string.
*/
- sequence<com::sun::star::beans::NamedValue> getUserRequestHeaders(
+ sequence<com::sun::star::beans::StringPair> getUserRequestHeaders(
[in] string aURI,
[in] string aMethod);
};
diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
index ba6652b..9c1d3e9 100644
--- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
@@ -1119,24 +1119,14 @@ void DAVResourceAccess::getUserRequestHeaders(
if ( !xDAVEnv.is() )
return;
- uno::Sequence< beans::NamedValue > aRequestHeaders
+ uno::Sequence< beans::StringPair > aRequestHeaders
= xDAVEnv->getUserRequestHeaders( rURI, rMethod );
for ( sal_Int32 n = 0; n < aRequestHeaders.getLength(); ++n )
{
- OUString aValue;
- sal_Bool isString = aRequestHeaders[ n ].Value >>= aValue;
-
- if ( !isString )
- {
- OSL_ENSURE( isString,
- "DAVResourceAccess::getUserRequestHeaders :"
- "Value is not a string! Ignoring..." );
- continue;
- }
-
rRequestHeaders.push_back(
- DAVRequestHeader( aRequestHeaders[ n ].Name, aValue ) );
+ DAVRequestHeader( aRequestHeaders[ n ].First,
+ aRequestHeaders[ n ].Second ) );
}
}
commit b2dfbdff7a7436c8fc4a8d2304f573bf783b2d32
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Sun Mar 24 12:22:31 2013 +0000
i121944 - Implement inheritance in css::ucb::XWebDAVCommandEnvironment
It should be derived from css::ucb::XCommandEnvironment
(cherry picked from commit 817e11dccbfe3431f9cc0466051f4d154ce33e5e)
Conflicts:
extensions/source/update/feed/updatefeed.cxx
offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl
offapi/type_reference/typelibrary_history.txt
offapi/type_reference/types.rdb
(Would be an incompatible API CHANGE if we had not unpublished
XWebDAVCommandEnvironment with 78cca63070ae6cf82b45ec3bc75fafa2db31a7f2 "Revert
publishing of lots of UNO types.")
Change-Id: Ie44bed44cce09c2423adab33c3790bdcb9be452d
diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx
index 2a51d95..96a9311 100644
--- a/extensions/source/update/feed/updatefeed.cxx
+++ b/extensions/source/update/feed/updatefeed.cxx
@@ -19,7 +19,7 @@
#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implementationentry.hxx>
#include <com/sun/star/beans/Property.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -34,7 +34,6 @@
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/ucb/UniversalContentBroker.hpp>
-#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/ucb/XWebDAVCommandEnvironment.hpp>
#include <com/sun/star/ucb/XCommandProcessor2.hpp>
#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
@@ -132,8 +131,7 @@ public:
//------------------------------------------------------------------------------
class UpdateInformationProvider :
- public ::cppu::WeakImplHelper4< deployment::XUpdateInformationProvider,
- ucb::XCommandEnvironment,
+ public ::cppu::WeakImplHelper3< deployment::XUpdateInformationProvider,
ucb::XWebDAVCommandEnvironment,
lang::XServiceInfo >
{
diff --git a/offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl b/offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl
index 2547aab..eda3d14 100644
--- a/offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl
+++ b/offapi/com/sun/star/ucb/XWebDAVCommandEnvironment.idl
@@ -19,7 +19,7 @@
#ifndef __com_sun_star_ucb_XWebDAVCommandEnvironment_idl__
#define __com_sun_star_ucb_XWebDAVCommandEnvironment_idl__
-#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/ucb/XCommandEnvironment.idl>
#include <com/sun/star/beans/NamedValue.idl>
@@ -27,12 +27,8 @@ module com { module sun { module star { module ucb {
/** A command environment that can be used to deal with WebDAV/HTTP specific
commands.
-
- <p>Supply an implementation of this interface together with an
- XCommandEnvironment implementation, when executing a command
- using XCommandProcessor.
*/
-interface XWebDAVCommandEnvironment : com::sun::star::uno::XInterface
+interface XWebDAVCommandEnvironment : XCommandEnvironment
{
/** This method gets called while assembling an WebDAV/HTTP request.
The returned headername-headervalue pairs will be appended to
@@ -54,7 +50,6 @@ interface XWebDAVCommandEnvironment : com::sun::star::uno::XInterface
[in] string aMethod);
};
-
}; }; }; };
#endif
commit da00f5e6249c1beef6e7c377398b33cc9af27d09
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Aug 15 14:43:17 2013 +0200
Adapt to LibreOffice the previous commit
..."i121935 - UCB: new 'addProperty' and 'removeProperty' commands."
Change-Id: If0451c6d1b6471d27f5fb1551ccf0230e62dfb60
diff --git a/offapi/com/sun/star/ucb/Content.idl b/offapi/com/sun/star/ucb/Content.idl
index 4b2f143..0e41da8 100644
--- a/offapi/com/sun/star/ucb/Content.idl
+++ b/offapi/com/sun/star/ucb/Content.idl
@@ -487,7 +487,7 @@ published service Content
<type scope="com::sun::star::lang">IllegalArgumentException</type>
if the Name of the property is empty.</p>
<blockquote>
- Note: This command replaces the deprecated interface method
+ Note: This command is new since Apache OpenOffice 4.0, LibreOffice 4.2 and replaces the deprecated interface method
<member scope="com::sun::star::beans">XPropertyContainer::addProperty</member>.
</blockquote>
</td>
@@ -502,7 +502,7 @@ published service Content
<type scope="com::sun::star::beans">NotRemoveableException</type>
if the property is not removable.</p>
<blockquote>
- Note: This command replaces the deprecated interface method
+ Note: This command is new since Apache OpenOffice 4.0, LibreOffice 4.2 and replaces the deprecated interface method
<member scope="com::sun::star::beans">XPropertyContainer::removeProperty</member>.
</blockquote>
</td>
diff --git a/offapi/com/sun/star/ucb/PropertyCommandArgument.idl b/offapi/com/sun/star/ucb/PropertyCommandArgument.idl
index f213046..10ffaa0 100644
--- a/offapi/com/sun/star/ucb/PropertyCommandArgument.idl
+++ b/offapi/com/sun/star/ucb/PropertyCommandArgument.idl
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -25,7 +26,7 @@ module com { module sun { module star { module ucb {
/** The argument for the "addProperty" command.
@see XCommandProcessor
- @since Apache OpenOffice 4.0
+ @since Apache OpenOffice 4.0, LibreOffice 4.2
*/
struct PropertyCommandArgument
{
@@ -41,3 +42,5 @@ struct PropertyCommandArgument
}; }; }; };
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/webdav-neon/DAVProperties.cxx b/ucb/source/ucp/webdav-neon/DAVProperties.cxx
index a95aea3..1daf6d5 100644
--- a/ucb/source/ucp/webdav-neon/DAVProperties.cxx
+++ b/ucb/source/ucp/webdav-neon/DAVProperties.cxx
@@ -172,4 +172,36 @@ bool DAVProperties::isUCBDeadProperty( const NeonPropName & rName )
== 0 ) );
}
+bool DAVProperties::isUCBSpecialProperty(
+ const OUString& rFullName, OUString& rParsedName)
+{
+ if ( !rFullName.startsWith( "<prop:" ) || !rFullName.endsWith( "\">" ) )
+ return false;
+
+ sal_Int32 nStart = strlen( "<prop:" );
+ sal_Int32 nEnd = rFullName.indexOf( sal_Unicode( ' ' ), nStart );
+ if ( nEnd <= nStart ) // incl. -1 for "not found"
+ return false;
+
+ OUString sPropName = rFullName.copy( nStart, nEnd - nStart );
+
+ // TODO skip whitespaces?
+ if ( !rFullName.match( "xmlns:prop=\"", ++nEnd ) )
+ return false;
+
+ nStart = nEnd + strlen( "xmlns:prop=\"" );
+ nEnd = rFullName.indexOf( sal_Unicode( '"' ), nStart );
+ if ( nEnd != rFullName.getLength() - sal_Int32( strlen( "\">" ) )
+ || nEnd == nStart )
+ {
+ return false;
+ }
+
+ rParsedName = rFullName.copy( nStart, nEnd - nStart );
+ if ( !rParsedName.endsWith( "/" ) )
+ rParsedName += "/";
+
+ return rParsedName.getLength();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/webdav-neon/DAVProperties.hxx b/ucb/source/ucp/webdav-neon/DAVProperties.hxx
index 5e8d219..f800011 100644
--- a/ucb/source/ucp/webdav-neon/DAVProperties.hxx
+++ b/ucb/source/ucp/webdav-neon/DAVProperties.hxx
@@ -57,6 +57,8 @@ struct DAVProperties
OUString & rFullName );
static bool isUCBDeadProperty( const NeonPropName & rName );
+ static bool isUCBSpecialProperty( const OUString & rFullName,
+ OUString & rParsedName );
};
} // namespace webdav_ucp
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index 49e8655..81b27b6 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -72,6 +72,7 @@
#include <com/sun/star/ucb/OpenCommandArgument3.hpp>
#include <com/sun/star/ucb/OpenMode.hpp>
#include <com/sun/star/ucb/PostCommandArgument2.hpp>
+#include <com/sun/star/ucb/PropertyCommandArgument.hpp>
#include <com/sun/star/ucb/TransferInfo.hpp>
#include <com/sun/star/ucb/UnsupportedCommandException.hpp>
#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
@@ -644,6 +645,66 @@ uno::Any SAL_CALL Content::execute(
aRet = uno::makeAny( createNewContent( aArg ) );
}
+ else if ( aCommand.Name == "addProperty" )
+ {
+ ucb::PropertyCommandArgument aPropArg;
+ if ( !( aCommand.Argument >>= aPropArg ))
+ {
+ ucbhelper::cancelCommandExecution(
+ uno::makeAny( lang::IllegalArgumentException(
+ "Wrong argument type!",
+ static_cast< cppu::OWeakObject * >( this ),
+ -1 ) ),
+ Environment );
+ }
+
+ // TODO when/if XPropertyContainer is removed,
+ // the command execution can be canceled in addProperty
+ try
+ {
+ addProperty( aPropArg, Environment );
+ }
+ catch ( const beans::PropertyExistException &e )
+ {
+ ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment );
+ }
+ catch ( const beans::IllegalTypeException&e )
+ {
+ ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment );
+ }
+ catch ( const lang::IllegalArgumentException&e )
+ {
+ ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment );
+ }
+ }
+ else if ( aCommand.Name == "removeProperty" )
+ {
+ OUString sPropName;
+ if ( !( aCommand.Argument >>= sPropName ) )
+ {
+ ucbhelper::cancelCommandExecution(
+ uno::makeAny( lang::IllegalArgumentException(
+ "Wrong argument type!",
+ static_cast< cppu::OWeakObject * >( this ),
+ -1 ) ),
+ Environment );
+ }
+
+ // TODO when/if XPropertyContainer is removed,
+ // the command execution can be canceled in removeProperty
+ try
+ {
+ removeProperty( sPropName, Environment );
+ }
+ catch( const beans::UnknownPropertyException &e )
+ {
+ ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment );
+ }
+ catch( const beans::NotRemoveableException &e )
+ {
+ ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment );
+ }
+ }
else
{
//////////////////////////////////////////////////////////////////
@@ -697,10 +758,8 @@ void SAL_CALL Content::abort( sal_Int32 /*CommandId*/ )
//
//=========================================================================
-// virtual
-void SAL_CALL Content::addProperty( const OUString& Name,
- sal_Int16 Attributes,
- const uno::Any& DefaultValue )
+void Content::addProperty( const ucb::PropertyCommandArgument& aCmdArg,
+ const uno::Reference< ucb::XCommandEnvironment >& xEnv )
throw( beans::PropertyExistException,
beans::IllegalTypeException,
lang::IllegalArgumentException,
@@ -709,14 +768,26 @@ void SAL_CALL Content::addProperty( const OUString& Name,
// if ( m_bTransient )
// @@@ ???
- if ( Name.isEmpty() )
- throw lang::IllegalArgumentException();
+ if ( aCmdArg.Property.Name.isEmpty() )
+ throw lang::IllegalArgumentException(
+ "\"addProperty\" with empty Property.Name",
+ static_cast< cppu::OWeakObject * >( this ),
+ -1 );
// Check property type.
- if ( !UCBDeadPropertyValue::supportsType( DefaultValue.getValueType() ) )
+ if ( !UCBDeadPropertyValue::supportsType( aCmdArg.Property.Type ) )
+ {
+ throw beans::IllegalTypeException(
+ "\"addProperty\" unsupported Property.Type",
+ static_cast< cppu::OWeakObject * >( this ) );
+ }
+
+ if ( aCmdArg.DefaultValue.hasValue()
+ && aCmdArg.DefaultValue.getValueType() != aCmdArg.Property.Type )
{
- OSL_FAIL( "Content::addProperty - Unsupported property type!" );
- throw beans::IllegalTypeException();
+ throw beans::IllegalTypeException(
+ "\"addProperty\" DefaultValue does not match Property.Type",
+ static_cast< ::cppu::OWeakObject * >( this ) );
}
//////////////////////////////////////////////////////////////////////
@@ -724,14 +795,16 @@ void SAL_CALL Content::addProperty( const OUString& Name,
// exist in dynamic and static(!) properties.
//////////////////////////////////////////////////////////////////////
- // @@@ Need real command environment here, but where to get it from?
- // XPropertyContainer interface should be replaced by
- // XCommandProcessor commands!
- uno::Reference< ucb::XCommandEnvironment > xEnv;
+ // Take into account special properties with custom namespace
+ // using <prop:the_propname xmlns:prop="the_namespace">
+ OUString aSpecialName;
+ bool bIsSpecial = DAVProperties::isUCBSpecialProperty(
+ aCmdArg.Property.Name, aSpecialName );
// Note: This requires network access!
if ( getPropertySetInfo( xEnv, sal_False /* don't cache data */ )
- ->hasPropertyByName( Name ) )
+ ->hasPropertyByName(
+ bIsSpecial ? aSpecialName : aCmdArg.Property.Name ) )
{
// Property does already exist.
throw beans::PropertyExistException();
@@ -741,7 +814,8 @@ void SAL_CALL Content::addProperty( const OUString& Name,
// Add a new dynamic property.
//////////////////////////////////////////////////////////////////////
- ProppatchValue aValue( PROPSET, Name, DefaultValue );
+ ProppatchValue aValue(
+ PROPSET, aCmdArg.Property.Name, aCmdArg.DefaultValue );
std::vector< ProppatchValue > aProppatchValues;
aProppatchValues.push_back( aValue );
@@ -765,7 +839,7 @@ void SAL_CALL Content::addProperty( const OUString& Name,
// Notify propertyset info change listeners.
beans::PropertySetInfoChangeEvent evt(
static_cast< cppu::OWeakObject * >( this ),
- Name,
+ bIsSpecial ? aSpecialName : aCmdArg.Property.Name,
-1, // No handle available
beans::PropertySetInfoChange::PROPERTY_INSERTED );
notifyPropertySetInfoChange( evt );
@@ -778,7 +852,8 @@ void SAL_CALL Content::addProperty( const OUString& Name,
// Store property locally.
ContentImplHelper::addProperty(
- Name, Attributes, DefaultValue );
+ bIsSpecial ? aSpecialName : aCmdArg.Property.Name,
+ aCmdArg.Property.Attributes, aCmdArg.DefaultValue );
}
else
{
@@ -796,9 +871,9 @@ void SAL_CALL Content::addProperty( const OUString& Name,
case FTP:
case NON_DAV:
// Store property locally.
- ContentImplHelper::addProperty( Name,
- Attributes,
- DefaultValue );
+ ContentImplHelper::addProperty(
+ bIsSpecial ? aSpecialName : aCmdArg.Property.Name,
+ aCmdArg.Property.Attributes, aCmdArg.DefaultValue );
break;
default:
@@ -822,18 +897,12 @@ void SAL_CALL Content::addProperty( const OUString& Name,
}
}
-//=========================================================================
-// virtual
-void SAL_CALL Content::removeProperty( const OUString& Name )
+void Content::removeProperty( const OUString& Name,
+ const uno::Reference< ucb::XCommandEnvironment >& xEnv )
throw( beans::UnknownPropertyException,
beans::NotRemoveableException,
uno::RuntimeException )
{
- // @@@ Need real command environment here, but where to get it from?
- // XPropertyContainer interface should be replaced by
- // XCommandProcessor commands!
- uno::Reference< ucb::XCommandEnvironment > xEnv;
-
//////////////////////////////////////////////////////////////////////
// Try to remove property from server.
//////////////////////////////////////////////////////////////////////
@@ -916,6 +985,35 @@ void SAL_CALL Content::removeProperty( const OUString& Name )
}
}
+// virtual
+void SAL_CALL Content::addProperty( const OUString& Name,
+ sal_Int16 Attributes,
+ const uno::Any& DefaultValue )
+ throw( beans::PropertyExistException,
+ beans::IllegalTypeException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException )
+{
+ beans::Property aProperty;
+ aProperty.Name = Name;
+ aProperty.Type = DefaultValue.getValueType();
+ aProperty.Attributes = Attributes;
+ aProperty.Handle = -1;
+
+ addProperty( ucb::PropertyCommandArgument( aProperty, DefaultValue ),
+ uno::Reference< ucb::XCommandEnvironment >());
+}
+
+// virtual
+void SAL_CALL Content::removeProperty( const OUString& Name )
+ throw( beans::UnknownPropertyException,
+ beans::NotRemoveableException,
+ uno::RuntimeException )
+{
+ removeProperty( Name,
+ uno::Reference< ucb::XCommandEnvironment >() );
+}
+
//=========================================================================
//
// XContentCreator methods.
@@ -1588,11 +1686,16 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
// Optional props.
//////////////////////////////////////////////////////////////
+ OUString aSpecialName;
+ bool bIsSpecial = DAVProperties::isUCBSpecialProperty(
+ rName, aSpecialName );
+
if ( !xInfo.is() )
xInfo = getPropertySetInfo( xEnv,
sal_False /* don't cache data */ );
- if ( !xInfo->hasPropertyByName( rName ) )
+ if ( !xInfo->hasPropertyByName(
+ bIsSpecial ? aSpecialName : rName ) )
{
// Check, whether property exists. Skip otherwise.
// PROPPATCH::set would add the property automatically, which
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.hxx b/ucb/source/ucp/webdav-neon/webdavcontent.hxx
index 74140fd..f2d378b 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.hxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.hxx
@@ -55,6 +55,7 @@ namespace com { namespace sun { namespace star { namespace sdbc {
namespace com { namespace sun { namespace star { namespace ucb {
struct OpenCommandArgument3;
struct PostCommandArgument2;
+ struct PropertyCommandArgument;
struct TransferInfo;
} } } }
@@ -204,6 +205,21 @@ private:
const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment >& Environment );
+ void addProperty( const com::sun::star::ucb::PropertyCommandArgument &aCmdArg,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& Environment )
+ throw( com::sun::star::beans::PropertyExistException,
+ com::sun::star::beans::IllegalTypeException,
+ com::sun::star::lang::IllegalArgumentException,
+ com::sun::star::uno::RuntimeException );
+
+ void removeProperty( const OUString& Name,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& Environment )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::beans::NotRemoveableException,
+ com::sun::star::uno::RuntimeException );
+
public:
Content( const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext >& rxContext,
diff --git a/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx b/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx
index 92a5721..bae5cb6 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx
@@ -41,6 +41,7 @@
#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
#include <com/sun/star/ucb/PostCommandArgument2.hpp>
+#include <com/sun/star/ucb/PropertyCommandArgument.hpp>
#include <com/sun/star/ucb/TransferInfo.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/util/DateTime.hpp>
@@ -520,7 +521,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
{
osl::Guard< osl::Mutex > aGuard( m_aMutex );
- uno::Sequence< ucb::CommandInfo > aCmdInfo( 8 );
+ uno::Sequence< ucb::CommandInfo > aCmdInfo( 10 );
///////////////////////////////////////////////////////////////
// Mandatory commands
@@ -581,6 +582,18 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
-1,
getCppuType( static_cast<
ucb::PostCommandArgument2 * >( 0 ) ) );
+ aCmdInfo[ 8 ] =
+ ucb::CommandInfo(
+ OUString( "addProperty" ),
+ -1,
+ getCppuType( static_cast<
+ ucb::PropertyCommandArgument * >( 0 ) ) );
+ aCmdInfo[ 9 ] =
+ ucb::CommandInfo(
+ OUString( "removeProperty" ),
+ -1,
+ getCppuType( static_cast<
+ rtl::OUString * >( 0 ) ) );
sal_Bool bFolder = sal_False;
commit 41c05c607cd52d327f51cd986d21aa0cdafa1ae1
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Sun Mar 24 12:21:56 2013 +0000
i121935 - UCB: new "addProperty" and "removeProperty" commands
(cherry picked from commit 3d5d60176c01f9d3504559b816281fca11aea403)
Conflicts:
offapi/com/sun/star/ucb/Content.idl
offapi/com/sun/star/ucb/makefile.mk
ucb/source/ucp/webdav/DAVProperties.cxx
ucb/source/ucp/webdav/webdavcontent.cxx
plus headerize.pl
Change-Id: I59b270ef5a72271671ae0857d11f557eec829387
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 747a305..26652d4 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -3858,6 +3858,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/ucb,\
PostCommandArgument \
PostCommandArgument2 \
Priority \
+ PropertyCommandArgument \
PropertyValueInfo \
PropertyValueState \
RecipientInfo \
diff --git a/offapi/com/sun/star/ucb/Content.idl b/offapi/com/sun/star/ucb/Content.idl
index cb55c0f..4b2f143 100644
--- a/offapi/com/sun/star/ucb/Content.idl
+++ b/offapi/com/sun/star/ucb/Content.idl
@@ -448,6 +448,65 @@ published service Content
</p>
</td>
</tr>
+ <tr>
+ <td>addProperty</td>
+ <td>void</td>
+ <td><type>PropertyCommandArgument</type> aCmdArg</td>
+ <td>
+ Adds a new properties to the content.
+ <p>
+ <member>PropertyCommandArgument::Property</member>
+ contains information about the property to be added.
+ <member>PropertyCommandArgument::DefaultValue</member>
+ may contain the default value for the property. Its type must
+ match the one specified in <member scope="com::sun::star::beans">Property::Type</member>.
+ </p>
+ <p>Note that the dynamic properties must be kept persistent. The
+ service <type>Store</type> (UCB persistence service) may be used to
+ implement this.</p>
+ <p><b>Important:</b> The implementation must at least support
+ adding properties of the following basic data types:</p>
+ <p>
+ <ul>
+ <li>boolean
+ <li>char
+ <li>byte
+ <li>string
+ <li>short
+ <li>long
+ <li>hyper
+ <li>float
+ <li>double
+ </ul>
+ </p>
+ <p>
+ Raises a <type scope="com::sun::star::beans">PropertyExistException</type>
+ if a property with the same name already exists;
+ <type scope="com::sun::star::beans">IllegalTypeException</type>
+ if the property has an unsupported type;
+ <type scope="com::sun::star::lang">IllegalArgumentException</type>
+ if the Name of the property is empty.</p>
+ <blockquote>
+ Note: This command replaces the deprecated interface method
+ <member scope="com::sun::star::beans">XPropertyContainer::addProperty</member>.
+ </blockquote>
+ </td>
+ </tr>
+ <tr>
+ <td>removeProperty</td>
+ <td>void</td>
+ <td>string PropertyName</td>
+ <td>Removes the properties from the content.
+ <p>Raises a <type scope="com::sun::star::beans">UnknownPropertyException</type>
+ if the property does not exist;
+ <type scope="com::sun::star::beans">NotRemoveableException</type>
+ if the property is not removable.</p>
+ <blockquote>
+ Note: This command replaces the deprecated interface method
+ <member scope="com::sun::star::beans">XPropertyContainer::removeProperty</member>.
+ </blockquote>
+ </td>
+ </tr>
</table>
<h3>Properties</h3>
@@ -785,7 +844,7 @@ published service Content
<td>TargetURL</td>
<td>string</td>
<td>for contents that are links to other contents, contains the URL of
- the target content</td>
+ the target content</td>
</tr>
<tr>
<td>TimeLimitStore</td>
@@ -796,7 +855,7 @@ published service Content
<td>UserName</td>
<td>string</td>
<td>contains a user name. (e.g. the user name needed to access a
- POP3-Account)</td>
+ POP3-Account)</td>
</tr>
<tr>
<td>VerificationMode</td>
diff --git a/offapi/com/sun/star/ucb/PropertyCommandArgument.idl b/offapi/com/sun/star/ucb/PropertyCommandArgument.idl
new file mode 100644
index 0000000..f213046
--- /dev/null
+++ b/offapi/com/sun/star/ucb/PropertyCommandArgument.idl
@@ -0,0 +1,43 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_ucb_PropertyCommandArgument_idl__
+#define __com_sun_star_ucb_PropertyCommandArgument_idl__
+
+#include <com/sun/star/beans/Property.idl>
+
+module com { module sun { module star { module ucb {
+
+/** The argument for the "addProperty" command.
+
+ @see XCommandProcessor
+ @since Apache OpenOffice 4.0
+*/
+struct PropertyCommandArgument
+{
+ /** The property that the command has to add.
+ */
+ com::sun::star::beans::Property Property;
+
+ /** The default value of the property.
+ */
+ any DefaultValue;
+};
+
+}; }; }; };
+
+#endif
diff --git a/ucb/source/ucp/webdav/DAVProperties.cxx b/ucb/source/ucp/webdav/DAVProperties.cxx
index 7340dbe..bbc894d 100644
--- a/ucb/source/ucp/webdav/DAVProperties.cxx
+++ b/ucb/source/ucp/webdav/DAVProperties.cxx
@@ -19,6 +19,7 @@
#include <string.h>
#include "DAVProperties.hxx"
+#include <rtl/ustrbuf.hxx>
using namespace http_dav_ucp;
@@ -180,4 +181,43 @@ bool DAVProperties::isUCBDeadProperty( const SerfPropName & rName )
== 0 ) );
}
+bool DAVProperties::isUCBSpecialProperty(const rtl::OUString& rFullName, rtl::OUString& rParsedName)
+{
+ sal_Int32 nLen = rFullName.getLength();
+ if ( nLen <= 0 ||
+ !rFullName.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "<prop:" ) ) ||
+ !rFullName.endsWithAsciiL( RTL_CONSTASCII_STRINGPARAM( "\">" ) ) )
+ return false;
+
+ sal_Int32 nStart = RTL_CONSTASCII_LENGTH( "<prop:" );
+ sal_Int32 nEnd = rFullName.indexOf( sal_Unicode( ' ' ), nStart );
+ if ( nEnd == -1 )
+ return false;
+
+ rtl::OUString sPropName = rFullName.copy( nStart, nEnd - nStart );
+ if ( !sPropName.getLength() )
+ return false;
+
+ // TODO skip whitespaces?
+ if ( !rFullName.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "xmlns:prop=\"" ), ++nEnd ) )
+ return false;
+
+ nStart = nEnd + RTL_CONSTASCII_LENGTH( "xmlns:prop=\"" );
+ nEnd = rFullName.indexOf( sal_Unicode( '"' ), nStart );
+ if ( nEnd != nLen - RTL_CONSTASCII_LENGTH( "\">" ) )
+ return false;
+
+ rtl::OUString sNamesp = rFullName.copy( nStart, nEnd - nStart );
+ if ( !( nLen = sNamesp.getLength() ) )
+ return false;
+
+ rtl::OUStringBuffer aBuff( sNamesp );
+ if ( sNamesp[nLen - 1] != '/' )
+ aBuff.append( sal_Unicode( '/' ) );
+ aBuff.append( sPropName );
+ rParsedName = aBuff.makeStringAndClear();
+
+ return rParsedName.getLength();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/webdav/DAVProperties.hxx b/ucb/source/ucp/webdav/DAVProperties.hxx
index 1906c7f..8bf3ca3 100644
--- a/ucb/source/ucp/webdav/DAVProperties.hxx
+++ b/ucb/source/ucp/webdav/DAVProperties.hxx
@@ -48,6 +48,8 @@ struct DAVProperties
OUString & rFullName );
static bool isUCBDeadProperty( const SerfPropName & rName );
+ static bool isUCBSpecialProperty( const rtl::OUString & rFullName,
+ rtl::OUString & rParsedName );
};
} // namespace http_dav_ucp
diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx
index 7ff158b..f995bd0 100644
--- a/ucb/source/ucp/webdav/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav/webdavcontent.cxx
@@ -56,6 +56,7 @@
#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
#include <com/sun/star/ucb/OpenMode.hpp>
#include <com/sun/star/ucb/PostCommandArgument2.hpp>
+#include <com/sun/star/ucb/PropertyCommandArgument.hpp>
#include <com/sun/star/ucb/TransferInfo.hpp>
#include <com/sun/star/ucb/UnsupportedCommandException.hpp>
#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
@@ -743,6 +744,68 @@ uno::Any SAL_CALL Content::execute(
aRet = uno::makeAny( createNewContent( aArg ) );
}
+ else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "addProperty" )))
+ {
+ ucb::PropertyCommandArgument aPropArg;
+ if ( !( aCommand.Argument >>= aPropArg ))
+ {
+ ucbhelper::cancelCommandExecution(
+ uno::makeAny( lang::IllegalArgumentException(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Wrong argument type!" )),
+ static_cast< cppu::OWeakObject * >( this ),
+ -1 ) ),
+ Environment );
+ }
+
+ // TODO when/if XPropertyContainer is removed,
+ // the command execution can be canceled in addProperty
+ try
+ {
+ addProperty( aPropArg, Environment );
+ }
+ catch ( const beans::PropertyExistException &e )
+ {
+ ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment );
+ }
+ catch ( const beans::IllegalTypeException&e )
+ {
+ ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment );
+ }
+ catch ( const lang::IllegalArgumentException&e )
+ {
+ ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment );
+ }
+ }
+ else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "removeProperty" )))
+ {
+ rtl::OUString sPropName;
+ if ( !( aCommand.Argument >>= sPropName ) )
+ {
+ ucbhelper::cancelCommandExecution(
+ uno::makeAny( lang::IllegalArgumentException(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Wrong argument type!" )),
+ static_cast< cppu::OWeakObject * >( this ),
+ -1 ) ),
+ Environment );
+ }
+
+ // TODO when/if XPropertyContainer is removed,
+ // the command execution can be canceled in removeProperty
+ try
+ {
+ removeProperty( sPropName, Environment );
+ }
+ catch( const beans::UnknownPropertyException &e )
+ {
+ ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment );
+ }
+ catch( const beans::NotRemoveableException &e )
+ {
+ ucbhelper::cancelCommandExecution( uno::makeAny( e ), Environment );
+ }
+ }
else
{
//////////////////////////////////////////////////////////////////
@@ -794,42 +857,53 @@ void SAL_CALL Content::abort( sal_Int32 /*CommandId*/ )
//
//=========================================================================
-// virtual
-void SAL_CALL Content::addProperty( const OUString& Name,
- sal_Int16 Attributes,
- const uno::Any& DefaultValue )
- throw( beans::PropertyExistException,
- beans::IllegalTypeException,
- lang::IllegalArgumentException,
- uno::RuntimeException )
+void Content::addProperty( const com::sun::star::ucb::PropertyCommandArgument &aCmdArg,
+ const uno::Reference< ucb::XCommandEnvironment >& xEnv )
+throw( beans::PropertyExistException,
+ beans::IllegalTypeException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException )
{
// if ( m_bTransient )
// @@@ ???
+ const beans::Property aProperty = aCmdArg.Property;
+ const uno::Any aDefaultValue = aCmdArg.DefaultValue;
- if ( Name.isEmpty() )
- throw lang::IllegalArgumentException();
+ // check property Name
+ if ( !aProperty.Name.getLength() )
+ throw lang::IllegalArgumentException(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "\"addProperty\" with empty Property.Name")),
+ static_cast< ::cppu::OWeakObject * >( this ),
+ -1 );
// Check property type.
- if ( !UCBDeadPropertyValue::supportsType( DefaultValue.getValueType() ) )
- {
- OSL_ENSURE( sal_False,
- "Content::addProperty - Unsupported property type!" );
- throw beans::IllegalTypeException();
- }
+ if ( !UCBDeadPropertyValue::supportsType( aProperty.Type ) )
+ throw beans::IllegalTypeException(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "\"addProperty\" unsupported Property.Type")),
+ static_cast< ::cppu::OWeakObject * >( this ) );
+
+ // check default value
+ if ( aDefaultValue.hasValue() && aDefaultValue.getValueType() != aProperty.Type )
+ throw beans::IllegalTypeException(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "\"addProperty\" DefaultValue does not match Property.Type")),
+ static_cast< ::cppu::OWeakObject * >( this ) );
//////////////////////////////////////////////////////////////////////
// Make sure a property with the requested name does not already
// exist in dynamic and static(!) properties.
//////////////////////////////////////////////////////////////////////
- // @@@ Need real command environment here, but where to get it from?
- // XPropertyContainer interface should be replaced by
- // XCommandProcessor commands!
- uno::Reference< ucb::XCommandEnvironment > xEnv;
+ // Take into account special properties with custom namespace
+ // using <prop:the_propname xmlns:prop="the_namespace">
+ rtl::OUString aSpecialName;
+ bool bIsSpecial = DAVProperties::isUCBSpecialProperty( aProperty.Name, aSpecialName );
// Note: This requires network access!
if ( getPropertySetInfo( xEnv, sal_False /* don't cache data */ )
- ->hasPropertyByName( Name ) )
+ ->hasPropertyByName( bIsSpecial ? aSpecialName : aProperty.Name ) )
{
// Property does already exist.
throw beans::PropertyExistException();
@@ -839,7 +913,7 @@ void SAL_CALL Content::addProperty( const OUString& Name,
// Add a new dynamic property.
//////////////////////////////////////////////////////////////////////
- ProppatchValue aValue( PROPSET, Name, DefaultValue );
+ ProppatchValue aValue( PROPSET, aProperty.Name, aDefaultValue );
std::vector< ProppatchValue > aProppatchValues;
aProppatchValues.push_back( aValue );
@@ -861,7 +935,7 @@ void SAL_CALL Content::addProperty( const OUString& Name,
// Notify propertyset info change listeners.
beans::PropertySetInfoChangeEvent evt(
static_cast< cppu::OWeakObject * >( this ),
- Name,
+ bIsSpecial ? aSpecialName : aProperty.Name,
-1, // No handle available
beans::PropertySetInfoChange::PROPERTY_INSERTED );
notifyPropertySetInfoChange( evt );
@@ -873,8 +947,9 @@ void SAL_CALL Content::addProperty( const OUString& Name,
// Support for setting arbitrary dead properties is optional!
// Store property locally.
- ContentImplHelper::addProperty(
- Name, Attributes, DefaultValue );
+ ContentImplHelper::addProperty( bIsSpecial ? aSpecialName : aProperty.Name,
+ aProperty.Attributes,
+ aDefaultValue );
}
else
{
@@ -891,9 +966,9 @@ void SAL_CALL Content::addProperty( const OUString& Name,
case NON_DAV:
// Store property locally.
- ContentImplHelper::addProperty( Name,
- Attributes,
- DefaultValue );
+ ContentImplHelper::addProperty( bIsSpecial ? aSpecialName : aProperty.Name,
+ aProperty.Attributes,
+ aDefaultValue );
break;
default:
@@ -920,25 +995,19 @@ void SAL_CALL Content::addProperty( const OUString& Name,
}
}
-//=========================================================================
-// virtual
-void SAL_CALL Content::removeProperty( const OUString& Name )
- throw( beans::UnknownPropertyException,
- beans::NotRemoveableException,
- uno::RuntimeException )
+void Content::removeProperty( const rtl::OUString& Name,
+ const uno::Reference< ucb::XCommandEnvironment >& xEnv )
+throw( beans::UnknownPropertyException,
+ beans::NotRemoveableException,
+ uno::RuntimeException )
{
- // @@@ Need real command environment here, but where to get it from?
- // XPropertyContainer interface should be replaced by
- // XCommandProcessor commands!
- uno::Reference< ucb::XCommandEnvironment > xEnv;
-
#if 0
// @@@ REMOVABLE z.Z. nicht richtig an der PropSetInfo gesetzt!!!
try
{
beans::Property aProp
- = getPropertySetInfo( xEnv, sal_False /* don't cache data */ )
- ->getPropertyByName( Name );
+ = getPropertySetInfo( xEnv, sal_False /* don't cache data */ )
+ ->getPropertyByName( Name );
if ( !( aProp.Attributes & beans::PropertyAttribute::REMOVABLE ) )
{
@@ -1001,20 +1070,20 @@ void SAL_CALL Content::removeProperty( const OUString& Name )
const ResourceType & rType = getResourceType( xEnv );
switch ( rType )
{
- case UNKNOWN:
- case DAV:
- throw beans::UnknownPropertyException();
-
- case NON_DAV:
- // Try to remove property from local store.
- ContentImplHelper::removeProperty( Name );
- break;
-
- default:
- OSL_ENSURE( sal_False,
- "Content::removeProperty - "
- "Unsupported resource type!" );
- break;
+ case UNKNOWN:
+ case DAV:
+ throw beans::UnknownPropertyException();
+
+ case NON_DAV:
+ // Try to remove property from local store.
+ ContentImplHelper::removeProperty( Name );
+ break;
+
+ default:
+ OSL_ENSURE( sal_False,
+ "Content::removeProperty - "
+ "Unsupported resource type!" );
+ break;
}
}
catch ( uno::Exception const & )
@@ -1035,6 +1104,35 @@ void SAL_CALL Content::removeProperty( const OUString& Name )
}
}
+// virtual
+void SAL_CALL Content::addProperty( const rtl::OUString& Name,
+ sal_Int16 Attributes,
+ const uno::Any& DefaultValue )
+ throw( beans::PropertyExistException,
+ beans::IllegalTypeException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException )
+{
+ beans::Property aProperty;
+ aProperty.Name = Name;
+ aProperty.Type = DefaultValue.getValueType();
+ aProperty.Attributes = Attributes;
+ aProperty.Handle = -1;
+
+ addProperty( ucb::PropertyCommandArgument( aProperty, DefaultValue ),
+ uno::Reference< ucb::XCommandEnvironment >());
+}
+
+// virtual
+void SAL_CALL Content::removeProperty( const rtl::OUString& Name )
+ throw( beans::UnknownPropertyException,
+ beans::NotRemoveableException,
+ uno::RuntimeException )
+{
+ removeProperty( Name,
+ uno::Reference< ucb::XCommandEnvironment >() );
+}
+
//=========================================================================
//
// XContentCreator methods.
@@ -1749,11 +1847,14 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
// Optional props.
//////////////////////////////////////////////////////////////
+ rtl::OUString aSpecialName;
+ bool bIsSpecial = DAVProperties::isUCBSpecialProperty( rName, aSpecialName );
+
if ( !xInfo.is() )
xInfo = getPropertySetInfo( xEnv,
sal_False /* don't cache data */ );
- if ( !xInfo->hasPropertyByName( rName ) )
+ if ( !xInfo->hasPropertyByName( bIsSpecial ? aSpecialName : rName ) )
{
// Check, whether property exists. Skip otherwise.
// PROPPATCH::set would add the property automatically, which
@@ -1798,7 +1899,8 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
"Property is read-only!" ),
static_cast< cppu::OWeakObject * >( this ) );
}
- if ( rName == "CreatableContentsInfo" )
+ if ( rName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
{
// Read-only property!
aRet[ n ] <<= lang::IllegalAccessException(
diff --git a/ucb/source/ucp/webdav/webdavcontent.hxx b/ucb/source/ucp/webdav/webdavcontent.hxx
index 6ffbd22..10c3022 100644
--- a/ucb/source/ucp/webdav/webdavcontent.hxx
+++ b/ucb/source/ucp/webdav/webdavcontent.hxx
@@ -46,6 +46,7 @@ namespace com { namespace sun { namespace star { namespace sdbc {
namespace com { namespace sun { namespace star { namespace ucb {
struct OpenCommandArgument2;
+ struct PropertyCommandArgument;
struct PostCommandArgument2;
struct TransferInfo;
} } } }
@@ -190,6 +191,21 @@ private:
const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment >& Environment );
+ // XPropertyContainer replacement
+ void addProperty( const com::sun::star::ucb::PropertyCommandArgument &aCmdArg,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& Environment )
+ throw( com::sun::star::beans::PropertyExistException,
+ com::sun::star::beans::IllegalTypeException,
+ com::sun::star::lang::IllegalArgumentException,
+ com::sun::star::uno::RuntimeException );
+
+ void removeProperty( const rtl::OUString& Name,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& Environment )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::beans::NotRemoveableException,
+ com::sun::star::uno::RuntimeException );
public:
Content( const ::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
diff --git a/ucb/source/ucp/webdav/webdavcontentcaps.cxx b/ucb/source/ucp/webdav/webdavcontentcaps.cxx
index f075ba0..8933167 100644
--- a/ucb/source/ucp/webdav/webdavcontentcaps.cxx
+++ b/ucb/source/ucp/webdav/webdavcontentcaps.cxx
@@ -26,6 +26,7 @@
#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
#include <com/sun/star/ucb/PostCommandArgument2.hpp>
+#include <com/sun/star/ucb/PropertyCommandArgument.hpp>
#include <com/sun/star/ucb/TransferInfo.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/util/DateTime.hpp>
@@ -492,7 +493,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
{
osl::Guard< osl::Mutex > aGuard( m_aMutex );
- uno::Sequence< ucb::CommandInfo > aCmdInfo( 8 );
+ uno::Sequence< ucb::CommandInfo > aCmdInfo( 10 );
///////////////////////////////////////////////////////////////
// Mandatory commands
@@ -553,6 +554,18 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
-1,
getCppuType( static_cast<
ucb::PostCommandArgument2 * >( 0 ) ) );
+ aCmdInfo[ 8 ] =
+ ucb::CommandInfo(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "addProperty" ) ),
+ -1,
+ getCppuType( static_cast<
+ ucb::PropertyCommandArgument * >( 0 ) ) );
+ aCmdInfo[ 9 ] =
+ ucb::CommandInfo(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "removeProperty" ) ),
+ -1,
+ getCppuType( static_cast<
+ rtl::OUString * >( 0 ) ) );
sal_Bool bFolder = sal_False;
More information about the Libreoffice-commits
mailing list