Kaydet (Commit) da00f5e6 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Adapt to LibreOffice the previous commit

..."i121935 - UCB: new 'addProperty' and 'removeProperty' commands."

Change-Id: If0451c6d1b6471d27f5fb1551ccf0230e62dfb60
üst 41c05c60
......@@ -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>
......
/* -*- 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: */
......@@ -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: */
......@@ -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
......
......@@ -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,
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment