#i61429#, deprecated css.ucb.XContentCreator, implemented replacement.
This commit is contained in:
+134
-99
@@ -41,11 +41,10 @@
|
||||
#include <cppuhelper/exc_hlp.hxx>
|
||||
#include <rtl/ustring.h>
|
||||
#include <rtl/ustring.hxx>
|
||||
#ifndef __COM_SUN_STAR_LANG_XINTERFACE_HPP_
|
||||
#include <com/sun/star/uno/XInterface.hpp>
|
||||
#endif
|
||||
#include <com/sun/star/beans/PropertyState.hpp>
|
||||
#include <com/sun/star/beans/PropertyValue.hpp>
|
||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||
#include <com/sun/star/container/XChild.hpp>
|
||||
#include <com/sun/star/beans/XPropertySetInfo.hpp>
|
||||
#include <com/sun/star/io/XActiveDataSink.hpp>
|
||||
@@ -53,13 +52,12 @@
|
||||
#include <com/sun/star/io/XSeekable.hpp>
|
||||
#include <com/sun/star/sdbc/XRow.hpp>
|
||||
#include <com/sun/star/task/XInteractionHandler.hpp>
|
||||
#include <com/sun/star/ucb/CommandEnvironment.hpp>
|
||||
#include <com/sun/star/ucb/CommandFailedException.hpp>
|
||||
#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
|
||||
#include <com/sun/star/ucb/GlobalTransferCommandArgument.hpp>
|
||||
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
|
||||
#ifndef _COM_SUN_STAR_UCB_INTERACTIVEBADTRANSFRERURLEXCEPTION_HPP_
|
||||
#include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp>
|
||||
#endif
|
||||
#include <com/sun/star/ucb/NameClash.hpp>
|
||||
#include <com/sun/star/ucb/NameClashException.hpp>
|
||||
#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
|
||||
@@ -79,7 +77,7 @@
|
||||
|
||||
using namespace com::sun::star;
|
||||
|
||||
namespace ucb_commands
|
||||
namespace
|
||||
{
|
||||
|
||||
//=========================================================================
|
||||
@@ -180,51 +178,6 @@ void SAL_CALL InteractionHandlerProxy::handle(
|
||||
m_xOrig->handle( Request );
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
//
|
||||
// class CommandEnvironment.
|
||||
//
|
||||
//=========================================================================
|
||||
|
||||
class CommandEnvironment :
|
||||
public cppu::WeakImplHelper1< ucb::XCommandEnvironment >
|
||||
{
|
||||
uno::Reference< task::XInteractionHandler > m_xIH;
|
||||
uno::Reference< ucb::XProgressHandler > m_xPH;
|
||||
|
||||
public:
|
||||
CommandEnvironment(
|
||||
const uno::Reference< task::XInteractionHandler > & xIH,
|
||||
const uno::Reference< ucb::XProgressHandler > & xPH )
|
||||
: m_xIH( xIH ), m_xPH( xPH ) {}
|
||||
|
||||
// XCommandEnvironment methods.
|
||||
virtual uno::Reference< task::XInteractionHandler > SAL_CALL
|
||||
getInteractionHandler()
|
||||
throw ( uno::RuntimeException );
|
||||
virtual uno::Reference< ucb::XProgressHandler > SAL_CALL
|
||||
getProgressHandler()
|
||||
throw ( uno::RuntimeException );
|
||||
};
|
||||
|
||||
//=========================================================================
|
||||
// virtual
|
||||
uno::Reference< task::XInteractionHandler > SAL_CALL
|
||||
CommandEnvironment::getInteractionHandler()
|
||||
throw ( uno::RuntimeException )
|
||||
{
|
||||
return m_xIH;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// virtual
|
||||
uno::Reference< ucb::XProgressHandler > SAL_CALL
|
||||
CommandEnvironment::getProgressHandler()
|
||||
throw ( uno::RuntimeException )
|
||||
{
|
||||
return m_xPH;
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
//
|
||||
// class ActiveDataSink.
|
||||
@@ -389,7 +342,7 @@ sal_Bool SAL_CALL CommandProcessorInfo::hasCommandByHandle( sal_Int32 Handle )
|
||||
//=========================================================================
|
||||
//=========================================================================
|
||||
|
||||
static rtl::OUString createDesiredName(
|
||||
rtl::OUString createDesiredName(
|
||||
const rtl::OUString & rSourceURL, const rtl::OUString & rNewTitle )
|
||||
{
|
||||
rtl::OUString aName( rNewTitle );
|
||||
@@ -438,13 +391,13 @@ static rtl::OUString createDesiredName(
|
||||
return rtl::OUString( aName );
|
||||
}
|
||||
|
||||
static rtl::OUString createDesiredName(
|
||||
rtl::OUString createDesiredName(
|
||||
const ucb::GlobalTransferCommandArgument & rArg )
|
||||
{
|
||||
return createDesiredName( rArg.SourceURL, rArg.NewTitle );
|
||||
}
|
||||
|
||||
static rtl::OUString createDesiredName(
|
||||
rtl::OUString createDesiredName(
|
||||
const ucb::TransferInfo & rArg )
|
||||
{
|
||||
return createDesiredName( rArg.SourceURL, rArg.NewTitle );
|
||||
@@ -453,7 +406,7 @@ static rtl::OUString createDesiredName(
|
||||
//=========================================================================
|
||||
enum NameClashContinuation { NOT_HANDLED, ABORT, OVERWRITE, NEW_NAME, UNKNOWN };
|
||||
|
||||
static NameClashContinuation interactiveNameClashResolve(
|
||||
NameClashContinuation interactiveNameClashResolve(
|
||||
const uno::Reference< ucb::XCommandEnvironment > & xEnv,
|
||||
const rtl::OUString & rTargetURL,
|
||||
const rtl::OUString & rClashingName,
|
||||
@@ -528,7 +481,7 @@ static NameClashContinuation interactiveNameClashResolve(
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
static bool setTitle(
|
||||
bool setTitle(
|
||||
const uno::Reference< ucb::XCommandProcessor > & xCommandProcessor,
|
||||
const uno::Reference< ucb::XCommandEnvironment > & xEnv,
|
||||
const rtl::OUString & rNewTitle )
|
||||
@@ -576,7 +529,7 @@ static bool setTitle(
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
static uno::Reference< ucb::XContent > createNew(
|
||||
uno::Reference< ucb::XContent > createNew(
|
||||
const TransferCommandContext & rContext,
|
||||
const uno::Reference< ucb::XContent > & xTarget,
|
||||
sal_Bool bSourceIsFolder,
|
||||
@@ -590,10 +543,12 @@ static uno::Reference< ucb::XContent > createNew(
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
uno::Reference< ucb::XContentCreator > xCreator(
|
||||
xTarget, uno::UNO_QUERY );
|
||||
// First, try it using "CreatabeleContentsInfo" property and
|
||||
// "createNewContent" command -> the "new" way.
|
||||
|
||||
if ( !xCreator.is() )
|
||||
uno::Reference< ucb::XCommandProcessor > xCommandProcessorT(
|
||||
xTarget, uno::UNO_QUERY );
|
||||
if ( !xCommandProcessorT.is() )
|
||||
{
|
||||
uno::Any aProps
|
||||
= uno::makeAny(beans::PropertyValue(
|
||||
@@ -606,24 +561,77 @@ static uno::Reference< ucb::XContent > createNew(
|
||||
ucb::IOErrorCode_CANT_CREATE,
|
||||
uno::Sequence< uno::Any >(&aProps, 1),
|
||||
rContext.xOrigEnv,
|
||||
rtl::OUString::createFromAscii( "Target is no XContentCreator!" ),
|
||||
rtl::OUString::createFromAscii( "Target is no XCommandProcessor!" ),
|
||||
rContext.xProcessor );
|
||||
// Unreachable
|
||||
}
|
||||
|
||||
uno::Sequence< ucb::ContentInfo > aTypesInfo
|
||||
= xCreator->queryCreatableContentsInfo();
|
||||
uno::Sequence< beans::Property > aPropsToObtain( 1 );
|
||||
aPropsToObtain[ 0 ].Name
|
||||
= rtl::OUString::createFromAscii( "CreatableContentsInfo" );
|
||||
aPropsToObtain[ 0 ].Handle
|
||||
= -1;
|
||||
|
||||
ucb::Command aGetPropsCommand(
|
||||
rtl::OUString::createFromAscii( "getPropertyValues" ),
|
||||
-1,
|
||||
uno::makeAny( aPropsToObtain ) );
|
||||
|
||||
uno::Reference< sdbc::XRow > xRow;
|
||||
xCommandProcessorT->execute( aGetPropsCommand, 0, rContext.xEnv ) >>= xRow;
|
||||
|
||||
uno::Sequence< ucb::ContentInfo > aTypesInfo;
|
||||
bool bGotTypesInfo = false;
|
||||
|
||||
if ( xRow.is() )
|
||||
{
|
||||
uno::Any aValue = xRow->getObject(
|
||||
1, uno::Reference< container::XNameAccess >() );
|
||||
if ( aValue.hasValue() && ( aValue >>= aTypesInfo ) )
|
||||
{
|
||||
bGotTypesInfo = true;
|
||||
}
|
||||
}
|
||||
|
||||
uno::Reference< ucb::XContentCreator > xCreator;
|
||||
|
||||
if ( !bGotTypesInfo )
|
||||
{
|
||||
// Second, try it using XContentCreator interface -> the "old" way (not
|
||||
// providing the chance to supply an XCommandEnvironment.
|
||||
|
||||
xCreator.set( xTarget, uno::UNO_QUERY );
|
||||
|
||||
if ( !xCreator.is() )
|
||||
{
|
||||
uno::Any aProps
|
||||
= uno::makeAny(beans::PropertyValue(
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
|
||||
"Folder")),
|
||||
-1,
|
||||
uno::makeAny(rContext.aArg.TargetURL),
|
||||
beans::PropertyState_DIRECT_VALUE));
|
||||
ucbhelper::cancelCommandExecution(
|
||||
ucb::IOErrorCode_CANT_CREATE,
|
||||
uno::Sequence< uno::Any >(&aProps, 1),
|
||||
rContext.xOrigEnv,
|
||||
rtl::OUString::createFromAscii( "Target is no XContentCreator!" ),
|
||||
rContext.xProcessor );
|
||||
// Unreachable
|
||||
}
|
||||
|
||||
aTypesInfo = xCreator->queryCreatableContentsInfo();
|
||||
}
|
||||
|
||||
sal_Int32 nCount = aTypesInfo.getLength();
|
||||
if ( !nCount )
|
||||
{
|
||||
uno::Any aProps
|
||||
= uno::makeAny(beans::PropertyValue(
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
|
||||
"Folder")),
|
||||
-1,
|
||||
uno::makeAny(rContext.aArg.TargetURL),
|
||||
beans::PropertyState_DIRECT_VALUE));
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Folder")),
|
||||
-1,
|
||||
uno::makeAny(rContext.aArg.TargetURL),
|
||||
beans::PropertyState_DIRECT_VALUE));
|
||||
ucbhelper::cancelCommandExecution(
|
||||
ucb::IOErrorCode_CANT_CREATE,
|
||||
uno::Sequence< uno::Any >(&aProps, 1),
|
||||
@@ -680,7 +688,7 @@ static uno::Reference< ucb::XContent > createNew(
|
||||
!!( nAttribs
|
||||
& ucb::ContentInfoAttribute::KIND_FOLDER ) )
|
||||
&&
|
||||
( !!bSourceIsDocument ==
|
||||
( !!bSourceIsDocument ==
|
||||
!!( nAttribs
|
||||
& ucb::ContentInfoAttribute::KIND_DOCUMENT ) )
|
||||
)
|
||||
@@ -710,7 +718,25 @@ static uno::Reference< ucb::XContent > createNew(
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
xNew = xCreator->createNewContent( aTypesInfo[ n ] );
|
||||
if ( !xCreator.is() )
|
||||
{
|
||||
// First, try it using "CreatabeleContentsInfo" property and
|
||||
// "createNewContent" command -> the "new" way.
|
||||
ucb::Command aCreateNewCommand(
|
||||
rtl::OUString::createFromAscii( "createNewContent" ),
|
||||
-1,
|
||||
uno::makeAny( aTypesInfo[ n ] ) );
|
||||
|
||||
xCommandProcessorT->execute( aCreateNewCommand, 0, rContext.xEnv )
|
||||
>>= xNew;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Second, try it using XContentCreator interface -> the "old"
|
||||
// way (not providing the chance to supply an XCommandEnvironment.
|
||||
|
||||
xNew = xCreator->createNewContent( aTypesInfo[ n ] );
|
||||
}
|
||||
|
||||
if ( !xNew.is() )
|
||||
{
|
||||
@@ -739,7 +765,7 @@ static uno::Reference< ucb::XContent > createNew(
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
static void transferProperties(
|
||||
void transferProperties(
|
||||
const TransferCommandContext & rContext,
|
||||
const uno::Reference< ucb::XCommandProcessor > & xCommandProcessorS,
|
||||
const uno::Reference< ucb::XCommandProcessor > & xCommandProcessorN )
|
||||
@@ -904,7 +930,7 @@ static void transferProperties(
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
static uno::Reference< io::XInputStream > getInputStream(
|
||||
uno::Reference< io::XInputStream > getInputStream(
|
||||
const TransferCommandContext & rContext,
|
||||
const uno::Reference< ucb::XCommandProcessor > & xCommandProcessorS )
|
||||
throw( uno::Exception )
|
||||
@@ -992,7 +1018,7 @@ static uno::Reference< io::XInputStream > getInputStream(
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
static uno::Reference< sdbc::XResultSet > getResultSet(
|
||||
uno::Reference< sdbc::XResultSet > getResultSet(
|
||||
const TransferCommandContext & rContext,
|
||||
const uno::Reference< ucb::XCommandProcessor > & xCommandProcessorS )
|
||||
throw( uno::Exception )
|
||||
@@ -1038,7 +1064,7 @@ static uno::Reference< sdbc::XResultSet > getResultSet(
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
static void handleNameClashRename(
|
||||
void handleNameClashRename(
|
||||
const TransferCommandContext & rContext,
|
||||
const uno::Reference< ucb::XContent > & xNew,
|
||||
const uno::Reference<
|
||||
@@ -1217,7 +1243,7 @@ static void handleNameClashRename(
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
static void globalTransfer(
|
||||
void globalTransfer_(
|
||||
const TransferCommandContext & rContext,
|
||||
const uno::Reference< ucb::XContent > & xSource,
|
||||
const uno::Reference< ucb::XContent > & xTarget,
|
||||
@@ -1632,7 +1658,7 @@ static void globalTransfer(
|
||||
rtl::OUString(), // NewTitle;
|
||||
rContext.aArg.NameClash ); // NameClash
|
||||
|
||||
ucb_commands::TransferCommandContext aSubCtx(
|
||||
TransferCommandContext aSubCtx(
|
||||
rContext.xSMgr,
|
||||
rContext.xProcessor,
|
||||
rContext.xEnv,
|
||||
@@ -1649,10 +1675,10 @@ static void globalTransfer(
|
||||
aSubCtx.aArg.SourceURL
|
||||
= xChild->getIdentifier()->getContentIdentifier();
|
||||
|
||||
ucb_commands::globalTransfer( aSubCtx,
|
||||
xChild,
|
||||
xNew,
|
||||
xChildRow );
|
||||
globalTransfer_( aSubCtx,
|
||||
xChild,
|
||||
xNew,
|
||||
xChildRow );
|
||||
}
|
||||
}
|
||||
while ( xResultSet->next() );
|
||||
@@ -1695,7 +1721,7 @@ static void globalTransfer(
|
||||
}
|
||||
}
|
||||
|
||||
} /* namescpace ucb_commands */
|
||||
} /* namescpace */
|
||||
|
||||
//=========================================================================
|
||||
//
|
||||
@@ -1706,8 +1732,7 @@ static void globalTransfer(
|
||||
uno::Reference< ucb::XCommandInfo >
|
||||
UniversalContentBroker::getCommandInfo()
|
||||
{
|
||||
return uno::Reference< ucb::XCommandInfo >(
|
||||
new ucb_commands::CommandProcessorInfo() );
|
||||
return uno::Reference< ucb::XCommandInfo >( new CommandProcessorInfo() );
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
@@ -1717,14 +1742,24 @@ void UniversalContentBroker::globalTransfer(
|
||||
throw( uno::Exception )
|
||||
{
|
||||
// Use own command environment with own interaction handler intercepting
|
||||
// some interaction requests that shell not be handled by the user-supplied
|
||||
// some interaction requests that shall not be handled by the user-supplied
|
||||
// interaction handler.
|
||||
uno::Reference< ucb::XCommandEnvironment > xLocalEnv;
|
||||
if (xEnv.is())
|
||||
xLocalEnv.set( new ucb_commands::CommandEnvironment(
|
||||
new ucb_commands::InteractionHandlerProxy(
|
||||
xEnv->getInteractionHandler() ),
|
||||
xEnv->getProgressHandler() ) );
|
||||
{
|
||||
uno::Reference< beans::XPropertySet > const xProps(
|
||||
m_xSMgr, uno::UNO_QUERY_THROW );
|
||||
uno::Reference< uno::XComponentContext > xCtx;
|
||||
xCtx.set( xProps->getPropertyValue(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ),
|
||||
uno::UNO_QUERY_THROW );
|
||||
|
||||
xLocalEnv.set( ucb::CommandEnvironment::create(
|
||||
xCtx,
|
||||
new InteractionHandlerProxy( xEnv->getInteractionHandler() ),
|
||||
xEnv->getProgressHandler() ) );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -1862,27 +1897,27 @@ void UniversalContentBroker::globalTransfer(
|
||||
|
||||
uno::Any aExc;
|
||||
rtl::OUString aNewTitle;
|
||||
ucb_commands::NameClashContinuation eCont
|
||||
= ucb_commands::interactiveNameClashResolve(
|
||||
NameClashContinuation eCont
|
||||
= interactiveNameClashResolve(
|
||||
xEnv, // always use original environment!
|
||||
rArg.TargetURL, // target folder URL
|
||||
ucb_commands::createDesiredName(
|
||||
aTransferArg ), // clashing name
|
||||
createDesiredName(
|
||||
aTransferArg ), // clashing name
|
||||
aExc,
|
||||
aNewTitle );
|
||||
|
||||
switch ( eCont )
|
||||
{
|
||||
case ucb_commands::NOT_HANDLED:
|
||||
case NOT_HANDLED:
|
||||
// Not handled.
|
||||
cppu::throwException( aExc );
|
||||
// break;
|
||||
|
||||
case ucb_commands::UNKNOWN:
|
||||
case UNKNOWN:
|
||||
// Handled, but not clear, how...
|
||||
// fall-thru intended.
|
||||
|
||||
case ucb_commands::ABORT:
|
||||
case ABORT:
|
||||
throw ucb::CommandFailedException(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM(
|
||||
@@ -1892,13 +1927,13 @@ void UniversalContentBroker::globalTransfer(
|
||||
aExc );
|
||||
// break;
|
||||
|
||||
case ucb_commands::OVERWRITE:
|
||||
case OVERWRITE:
|
||||
aTransferArg.NameClash
|
||||
= ucb::NameClash::OVERWRITE;
|
||||
bRetry = true;
|
||||
break;
|
||||
|
||||
case ucb_commands::NEW_NAME:
|
||||
case NEW_NAME:
|
||||
aTransferArg.NewTitle = aNewTitle;
|
||||
bRetry = true;
|
||||
break;
|
||||
@@ -2015,7 +2050,7 @@ void UniversalContentBroker::globalTransfer(
|
||||
// Unreachable
|
||||
}
|
||||
|
||||
ucb_commands::TransferCommandContext aTransferCtx(
|
||||
TransferCommandContext aTransferCtx(
|
||||
m_xSMgr, this, xLocalEnv, xEnv, rArg );
|
||||
|
||||
if ( rArg.NewTitle.getLength() == 0 )
|
||||
@@ -2025,12 +2060,12 @@ void UniversalContentBroker::globalTransfer(
|
||||
if ( aBaseURI.getLength() )
|
||||
{
|
||||
aTransferCtx.aArg.NewTitle
|
||||
= ucb_commands::createDesiredName( aBaseURI, rtl::OUString() );
|
||||
= createDesiredName( aBaseURI, rtl::OUString() );
|
||||
}
|
||||
}
|
||||
|
||||
// Do it!
|
||||
ucb_commands::globalTransfer( aTransferCtx, xSource, xTarget, xRow );
|
||||
globalTransfer_( aTransferCtx, xSource, xTarget, xRow );
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
+10
-22
@@ -49,7 +49,6 @@
|
||||
#include <com/sun/star/beans/PropertySetInfoChange.hpp>
|
||||
#include <com/sun/star/ucb/ContentAction.hpp>
|
||||
#include <com/sun/star/ucb/NameClash.hpp>
|
||||
#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
|
||||
#include "filglob.hxx"
|
||||
#include "filid.hxx"
|
||||
#include "filrow.hxx"
|
||||
@@ -437,6 +436,15 @@ BaseContent::execute( const Command& aCommand,
|
||||
if(!xRow->wasNull())
|
||||
aAny <<= CasePreservingURL;
|
||||
}
|
||||
else if( ! aCommand.Name.compareToAscii( "createNewContent" ) )
|
||||
{
|
||||
ucb::ContentInfo aArg;
|
||||
if ( !( aCommand.Argument >>= aArg ) )
|
||||
m_pMyShell->installError( CommandId,
|
||||
TASKHANDLING_WRONG_CREATENEWCONTENT_ARGUMENT );
|
||||
else
|
||||
aAny <<= createNewContent( aArg );
|
||||
}
|
||||
else
|
||||
m_pMyShell->installError( CommandId,
|
||||
TASKHANDLER_UNSUPPORTED_COMMAND );
|
||||
@@ -637,27 +645,7 @@ BaseContent::queryCreatableContentsInfo(
|
||||
void )
|
||||
throw( RuntimeException )
|
||||
{
|
||||
Sequence< ContentInfo > seq(2);
|
||||
|
||||
// file
|
||||
seq[0].Type = m_pMyShell->FileContentType;
|
||||
seq[0].Attributes = ContentInfoAttribute::INSERT_WITH_INPUTSTREAM
|
||||
| ContentInfoAttribute::KIND_DOCUMENT;
|
||||
|
||||
Sequence< beans::Property > props( 1 );
|
||||
props[0] = beans::Property(
|
||||
rtl::OUString::createFromAscii( "Title" ),
|
||||
-1,
|
||||
getCppuType( static_cast< rtl::OUString* >( 0 ) ),
|
||||
beans::PropertyAttribute::MAYBEVOID
|
||||
| beans::PropertyAttribute::BOUND );
|
||||
seq[0].Properties = props;
|
||||
|
||||
// folder
|
||||
seq[1].Type = m_pMyShell->FolderContentType;
|
||||
seq[1].Attributes = ContentInfoAttribute::KIND_FOLDER;
|
||||
seq[1].Properties = props;
|
||||
return seq;
|
||||
return m_pMyShell->queryCreatableContentsInfo();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,21 +42,21 @@ namespace fileaccess {
|
||||
#define TASKHANDLING_WRONG_DELETE_ARGUMENT 5
|
||||
#define TASKHANDLING_WRONG_TRANSFER_ARGUMENT 6
|
||||
#define TASKHANDLING_WRONG_INSERT_ARGUMENT 7
|
||||
#define TASKHANDLING_WRONG_CREATENEWCONTENT_ARGUMENT 8
|
||||
#define TASKHANDLING_UNSUPPORTED_OPEN_MODE 9
|
||||
|
||||
#define TASKHANDLING_UNSUPPORTED_OPEN_MODE 8
|
||||
#define TASKHANDLING_DELETED_STATE_IN_OPEN_COMMAND 10
|
||||
#define TASKHANDLING_INSERTED_STATE_IN_OPEN_COMMAND 11
|
||||
|
||||
#define TASKHANDLING_DELETED_STATE_IN_OPEN_COMMAND 9
|
||||
#define TASKHANDLING_INSERTED_STATE_IN_OPEN_COMMAND 10
|
||||
#define TASKHANDLING_OPEN_FILE_FOR_PAGING 12
|
||||
#define TASKHANDLING_NOTCONNECTED_FOR_PAGING 13
|
||||
#define TASKHANDLING_BUFFERSIZEEXCEEDED_FOR_PAGING 14
|
||||
#define TASKHANDLING_IOEXCEPTION_FOR_PAGING 15
|
||||
#define TASKHANDLING_READING_FILE_FOR_PAGING 16
|
||||
|
||||
#define TASKHANDLING_OPEN_FILE_FOR_PAGING 11
|
||||
#define TASKHANDLING_NOTCONNECTED_FOR_PAGING 12
|
||||
#define TASKHANDLING_BUFFERSIZEEXCEEDED_FOR_PAGING 13
|
||||
#define TASKHANDLING_IOEXCEPTION_FOR_PAGING 14
|
||||
#define TASKHANDLING_READING_FILE_FOR_PAGING 15
|
||||
|
||||
#define TASKHANDLING_OPEN_FOR_INPUTSTREAM 16
|
||||
#define TASKHANDLING_OPEN_FOR_STREAM 17
|
||||
#define TASKHANDLING_OPEN_FOR_DIRECTORYLISTING 18
|
||||
#define TASKHANDLING_OPEN_FOR_INPUTSTREAM 17
|
||||
#define TASKHANDLING_OPEN_FOR_STREAM 18
|
||||
#define TASKHANDLING_OPEN_FOR_DIRECTORYLISTING 19
|
||||
|
||||
#define TASKHANDLING_NOFRESHINSERT_IN_INSERT_COMMAND 22
|
||||
#define TASKHANDLING_NONAMESET_INSERT_COMMAND 23
|
||||
|
||||
@@ -286,7 +286,8 @@ namespace fileaccess {
|
||||
errorCode == TASKHANDLING_WRONG_OPEN_ARGUMENT ||
|
||||
errorCode == TASKHANDLING_WRONG_DELETE_ARGUMENT ||
|
||||
errorCode == TASKHANDLING_WRONG_TRANSFER_ARGUMENT ||
|
||||
errorCode == TASKHANDLING_WRONG_INSERT_ARGUMENT )
|
||||
errorCode == TASKHANDLING_WRONG_INSERT_ARGUMENT ||
|
||||
errorCode == TASKHANDLING_WRONG_CREATENEWCONTENT_ARGUMENT )
|
||||
{
|
||||
IllegalArgumentException excep;
|
||||
excep.ArgumentPosition = 0;
|
||||
|
||||
@@ -46,23 +46,18 @@
|
||||
#include <com/sun/star/ucb/NameClash.hpp>
|
||||
#include <com/sun/star/ucb/XContentIdentifier.hpp>
|
||||
#include <com/sun/star/lang/XComponent.hpp>
|
||||
#ifndef _COM_SUN_STAR_UCB_XCONTENTACCESS_
|
||||
#include <com/sun/star/ucb/XContentAccess.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBBUTE_HPP_
|
||||
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
||||
#endif
|
||||
#include <com/sun/star/io/XSeekable.hpp>
|
||||
#include <com/sun/star/io/XTruncate.hpp>
|
||||
#include <com/sun/star/ucb/OpenCommandArgument.hpp>
|
||||
#include <com/sun/star/ucb/XPropertySetRegistryFactory.hpp>
|
||||
#include <com/sun/star/ucb/TransferInfo.hpp>
|
||||
#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
|
||||
#include <com/sun/star/beans/PropertyChangeEvent.hpp>
|
||||
#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
|
||||
#include <rtl/string.hxx>
|
||||
#ifndef _FILERROR_HXX_
|
||||
#include "filerror.hxx"
|
||||
#endif
|
||||
#include "filglob.hxx"
|
||||
#include "filcmd.hxx"
|
||||
#include "filinpstr.hxx"
|
||||
@@ -188,9 +183,10 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF
|
||||
IsHidden( rtl::OUString::createFromAscii( "IsHidden" ) ),
|
||||
ContentType( rtl::OUString::createFromAscii( "ContentType" ) ),
|
||||
IsReadOnly( rtl::OUString::createFromAscii( "IsReadOnly" ) ),
|
||||
CreatableContentsInfo( rtl::OUString::createFromAscii( "CreatableContentsInfo" ) ),
|
||||
FolderContentType( rtl::OUString::createFromAscii( "application/vnd.sun.staroffice.fsys-folder" ) ),
|
||||
FileContentType( rtl::OUString::createFromAscii( "application/vnd.sun.staroffice.fsys-file" ) ),
|
||||
m_sCommandInfo( 8 )
|
||||
m_sCommandInfo( 9 )
|
||||
{
|
||||
// Title
|
||||
m_aDefaultProperties.insert( MyProperty( true,
|
||||
@@ -294,7 +290,7 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF
|
||||
| beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY ) );
|
||||
|
||||
// Remote
|
||||
// Hidden
|
||||
m_aDefaultProperties.insert(
|
||||
MyProperty(
|
||||
true,
|
||||
@@ -357,6 +353,17 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF
|
||||
| beans::PropertyAttribute::BOUND ) );
|
||||
|
||||
|
||||
// CreatableContentsInfo
|
||||
m_aDefaultProperties.insert( MyProperty( true,
|
||||
CreatableContentsInfo,
|
||||
-1 ,
|
||||
getCppuType( static_cast< const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
uno::Any(),
|
||||
beans::PropertyState_DEFAULT_VALUE,
|
||||
beans::PropertyAttribute::MAYBEVOID
|
||||
| beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY ) );
|
||||
|
||||
// Commands
|
||||
m_sCommandInfo[0].Name = rtl::OUString::createFromAscii( "getCommandInfo" );
|
||||
m_sCommandInfo[0].Handle = -1;
|
||||
@@ -390,6 +397,9 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF
|
||||
m_sCommandInfo[7].Handle = -1;
|
||||
m_sCommandInfo[7].ArgType = getCppuType( static_cast< InsertCommandArgument* > ( 0 ) );
|
||||
|
||||
m_sCommandInfo[7].Name = rtl::OUString::createFromAscii( "createNewContent" );
|
||||
m_sCommandInfo[7].Handle = -1;
|
||||
m_sCommandInfo[7].ArgType = getCppuType( static_cast< ucb::ContentInfo * > ( 0 ) );
|
||||
|
||||
if(m_bWithConfig)
|
||||
{
|
||||
@@ -2296,9 +2306,9 @@ shell::commit( const shell::ContentMap::iterator& it,
|
||||
|
||||
sal_Bool isDirectory,isFile,isVolume,isRemoveable,isRemote,isFloppy,isCompactDisc;
|
||||
|
||||
sal_Int64 dirSize = 0;
|
||||
|
||||
if( aFileStatus.isValid( FileStatusMask_FileSize ) )
|
||||
sal_Int64 dirSize = 0;
|
||||
|
||||
if( aFileStatus.isValid( FileStatusMask_FileSize ) )
|
||||
dirSize = aFileStatus.getFileSize();
|
||||
|
||||
if( aFileStatus.isValid( FileStatusMask_Type ) )
|
||||
@@ -2319,7 +2329,7 @@ shell::commit( const shell::ContentMap::iterator& it,
|
||||
isFile =
|
||||
osl::FileStatus::Regular == aFileStatus2.getFileType();
|
||||
|
||||
if( aFileStatus2.isValid( FileStatusMask_FileSize ) )
|
||||
if( aFileStatus2.isValid( FileStatusMask_FileSize ) )
|
||||
dirSize = aFileStatus2.getFileSize();
|
||||
}
|
||||
else
|
||||
@@ -2345,17 +2355,17 @@ shell::commit( const shell::ContentMap::iterator& it,
|
||||
osl::FileStatus::Regular == aFileStatus.getFileType();
|
||||
}
|
||||
|
||||
aAny <<= isVolume;
|
||||
it1 = properties.find( MyProperty( IsVolume ) );
|
||||
if( it1 != properties.end() ) it1->setValue( aAny );
|
||||
if( it1 != properties.end() )
|
||||
it1->setValue( uno::makeAny( isVolume ) );
|
||||
|
||||
aAny <<= isDirectory;
|
||||
it1 = properties.find( MyProperty( IsFolder ) );
|
||||
if( it1 != properties.end() ) it1->setValue( aAny );
|
||||
if( it1 != properties.end() )
|
||||
it1->setValue( uno::makeAny( isDirectory ) );
|
||||
|
||||
aAny <<= isFile;
|
||||
it1 = properties.find( MyProperty( IsDocument ) );
|
||||
if( it1 != properties.end() ) it1->setValue( aAny );
|
||||
if( it1 != properties.end() )
|
||||
it1->setValue( uno::makeAny( isFile ) );
|
||||
|
||||
osl::VolumeInfo aVolumeInfo( VolumeInfoMask_Attributes );
|
||||
if( isVolume &&
|
||||
@@ -2368,44 +2378,47 @@ shell::commit( const shell::ContentMap::iterator& it,
|
||||
isCompactDisc = aVolumeInfo.getCompactDiscFlag();
|
||||
isFloppy = aVolumeInfo.getFloppyDiskFlag();
|
||||
|
||||
aAny <<= isRemote;
|
||||
it1 = properties.find( MyProperty( IsRemote ) );
|
||||
if( it1 != properties.end() ) it1->setValue( aAny );
|
||||
if( it1 != properties.end() )
|
||||
it1->setValue( uno::makeAny( isRemote ) );
|
||||
|
||||
aAny <<= isRemoveable;
|
||||
it1 = properties.find( MyProperty( IsRemoveable ) );
|
||||
if( it1 != properties.end() ) it1->setValue( aAny );
|
||||
if( it1 != properties.end() )
|
||||
it1->setValue( uno::makeAny( isRemoveable ) );
|
||||
|
||||
aAny <<= isCompactDisc;
|
||||
it1 = properties.find( MyProperty( IsCompactDisc ) );
|
||||
if( it1 != properties.end() ) it1->setValue( aAny );
|
||||
if( it1 != properties.end() )
|
||||
it1->setValue( uno::makeAny( isCompactDisc ) );
|
||||
|
||||
aAny <<= isFloppy;
|
||||
it1 = properties.find( MyProperty( IsFloppy ) );
|
||||
if( it1 != properties.end() ) it1->setValue( aAny );
|
||||
if( it1 != properties.end() )
|
||||
it1->setValue( uno::makeAny( isFloppy ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
sal_Bool dummy = false;
|
||||
aAny <<= dummy;
|
||||
it1 = properties.find( MyProperty( IsRemote ) );
|
||||
if( it1 != properties.end() ) it1->setValue( aAny );
|
||||
if( it1 != properties.end() )
|
||||
it1->setValue( aAny );
|
||||
|
||||
it1 = properties.find( MyProperty( IsRemoveable ) );
|
||||
if( it1 != properties.end() ) it1->setValue( aAny );
|
||||
if( it1 != properties.end() )
|
||||
it1->setValue( aAny );
|
||||
|
||||
it1 = properties.find( MyProperty( IsCompactDisc ) );
|
||||
if( it1 != properties.end() ) it1->setValue( aAny );
|
||||
if( it1 != properties.end() )
|
||||
it1->setValue( aAny );
|
||||
|
||||
it1 = properties.find( MyProperty( IsFloppy ) );
|
||||
if( it1 != properties.end() ) it1->setValue( aAny );
|
||||
if( it1 != properties.end() )
|
||||
it1->setValue( aAny );
|
||||
}
|
||||
}
|
||||
|
||||
it1 = properties.find( MyProperty( Size ) );
|
||||
if( it1 != properties.end() )
|
||||
{
|
||||
aAny <<= dirSize;
|
||||
it1->setValue( aAny );
|
||||
}
|
||||
|
||||
it1->setValue( uno::makeAny( dirSize ) );
|
||||
|
||||
it1 = properties.find( MyProperty( IsReadOnly ) );
|
||||
if( it1 != properties.end() )
|
||||
@@ -2414,8 +2427,7 @@ shell::commit( const shell::ContentMap::iterator& it,
|
||||
{
|
||||
sal_uInt64 Attr = aFileStatus.getAttributes();
|
||||
sal_Bool readonly = ( Attr & Attribute_ReadOnly ) != 0;
|
||||
aAny <<= readonly;
|
||||
it1->setValue( aAny );
|
||||
it1->setValue( uno::makeAny( readonly ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2426,13 +2438,11 @@ shell::commit( const shell::ContentMap::iterator& it,
|
||||
{
|
||||
sal_uInt64 Attr = aFileStatus.getAttributes();
|
||||
sal_Bool ishidden = ( Attr & Attribute_Hidden ) != 0;
|
||||
aAny <<= ishidden;
|
||||
it1->setValue( aAny );
|
||||
it1->setValue( uno::makeAny( ishidden ) );
|
||||
}
|
||||
}
|
||||
|
||||
it1 = properties.find( MyProperty( DateModified ) );
|
||||
|
||||
if( it1 != properties.end() )
|
||||
{
|
||||
if( aFileStatus.isValid( FileStatusMask_ModifyTime ) )
|
||||
@@ -2440,7 +2450,7 @@ shell::commit( const shell::ContentMap::iterator& it,
|
||||
TimeValue temp = aFileStatus.getModifyTime();
|
||||
|
||||
// Convert system time to local time (for EA)
|
||||
TimeValue myLocalTime;
|
||||
TimeValue myLocalTime;
|
||||
osl_getLocalTimeFromSystemTime( &temp, &myLocalTime );
|
||||
|
||||
oslDateTime myDateTime;
|
||||
@@ -2454,11 +2464,16 @@ shell::commit( const shell::ContentMap::iterator& it,
|
||||
aDateTime.Day = myDateTime.Day;
|
||||
aDateTime.Month = myDateTime.Month;
|
||||
aDateTime.Year = myDateTime.Year;
|
||||
aAny <<= aDateTime;
|
||||
it1->setValue( aAny );
|
||||
it1->setValue( uno::makeAny( aDateTime ) );
|
||||
}
|
||||
}
|
||||
|
||||
it1 = properties.find( MyProperty( CreatableContentsInfo ) );
|
||||
if( it1 != properties.end() )
|
||||
it1->setValue( uno::makeAny(
|
||||
isDirectory || !aFileStatus.isValid( FileStatusMask_Type )
|
||||
? queryCreatableContentsInfo()
|
||||
: uno::Sequence< ucb::ContentInfo >() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -2493,8 +2508,8 @@ shell::getv(
|
||||
{
|
||||
// Assume failure
|
||||
aIsRegular = false;
|
||||
osl::FileBase::RC result = osl::FileBase::E_INVAL;
|
||||
osl::DirectoryItem aTargetItem;
|
||||
osl::FileBase::RC result = osl::FileBase::E_INVAL;
|
||||
osl::DirectoryItem aTargetItem;
|
||||
osl::DirectoryItem::get( aFileStatus.getLinkTargetURL(), aTargetItem );
|
||||
if ( aTargetItem.is() )
|
||||
{
|
||||
@@ -2999,6 +3014,31 @@ shell::copyPersistentSet( const rtl::OUString& srcUnqPath,
|
||||
} // end for( sal_Int...
|
||||
}
|
||||
|
||||
uno::Sequence< ucb::ContentInfo > shell::queryCreatableContentsInfo()
|
||||
{
|
||||
uno::Sequence< ucb::ContentInfo > seq(2);
|
||||
|
||||
// file
|
||||
seq[0].Type = FileContentType;
|
||||
seq[0].Attributes = ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM
|
||||
| ucb::ContentInfoAttribute::KIND_DOCUMENT;
|
||||
|
||||
uno::Sequence< beans::Property > props( 1 );
|
||||
props[0] = beans::Property(
|
||||
rtl::OUString::createFromAscii( "Title" ),
|
||||
-1,
|
||||
getCppuType( static_cast< rtl::OUString* >( 0 ) ),
|
||||
beans::PropertyAttribute::MAYBEVOID
|
||||
| beans::PropertyAttribute::BOUND );
|
||||
seq[0].Properties = props;
|
||||
|
||||
// folder
|
||||
seq[1].Type = FolderContentType;
|
||||
seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER;
|
||||
seq[1].Properties = props;
|
||||
return seq;
|
||||
}
|
||||
|
||||
/*******************************************************************************/
|
||||
/* */
|
||||
/* some misceancellous static functions */
|
||||
|
||||
@@ -54,21 +54,18 @@
|
||||
#include <com/sun/star/ucb/XCommandProcessor.hpp>
|
||||
#include <com/sun/star/io/XOutputStream.hpp>
|
||||
#include <com/sun/star/io/XInputStream.hpp>
|
||||
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_protected
|
||||
#include <com/sun/star/beans/XPropertySetInfo.hpp>
|
||||
#endif
|
||||
#include <com/sun/star/beans/XPropertiesChangeNotifier.hpp>
|
||||
#include <com/sun/star/ucb/NumberedSortingInfo.hpp>
|
||||
#include <com/sun/star/sdbc/XRow.hpp>
|
||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||
#include <com/sun/star/ucb/XContentProvider.hpp>
|
||||
#ifndef _COM_SUN_STAR_UCB_XDYNAMICRESULTSET_HPP__
|
||||
#include <com/sun/star/ucb/XDynamicResultSet.hpp>
|
||||
#endif
|
||||
#include <com/sun/star/beans/XPropertyContainer.hpp>
|
||||
#include <com/sun/star/beans/XPropertyAccess.hpp>
|
||||
#include <com/sun/star/ucb/XPropertySetRegistryFactory.hpp>
|
||||
#include <com/sun/star/ucb/TransferInfo.hpp>
|
||||
#include <com/sun/star/ucb/ContentInfo.hpp>
|
||||
#include "filtask.hxx"
|
||||
#include "filnot.hxx"
|
||||
|
||||
@@ -307,7 +304,7 @@ namespace fileaccess {
|
||||
|
||||
|
||||
/********************************************************************************/
|
||||
/* transfer-commandos */
|
||||
/* transfer-commands */
|
||||
/********************************************************************************/
|
||||
|
||||
/**
|
||||
@@ -398,6 +395,9 @@ namespace fileaccess {
|
||||
|
||||
void SAL_CALL insertDefaultProperties( const rtl::OUString& aUnqPath );
|
||||
|
||||
com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
|
||||
queryCreatableContentsInfo();
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* */
|
||||
@@ -416,7 +416,6 @@ namespace fileaccess {
|
||||
com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMultiServiceFactory;
|
||||
com::sun::star::uno::Reference< com::sun::star::ucb::XPropertySetRegistry > m_xFileRegistry;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/********************************************************************************/
|
||||
@@ -580,6 +579,7 @@ namespace fileaccess {
|
||||
const rtl::OUString IsHidden;
|
||||
const rtl::OUString ContentType;
|
||||
const rtl::OUString IsReadOnly;
|
||||
const rtl::OUString CreatableContentsInfo;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ void SAL_CALL FTPContent::abort( sal_Int32 /*CommandId*/ )
|
||||
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* Interne Implklasse */
|
||||
/* Internal implementation class. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
@@ -363,66 +363,85 @@ Any SAL_CALL FTPContent::execute(
|
||||
// return aRet;
|
||||
// }
|
||||
|
||||
if(action == THROWAUTHENTICATIONREQUEST) {
|
||||
switch (action)
|
||||
{
|
||||
case NOACTION:
|
||||
break;
|
||||
|
||||
case THROWAUTHENTICATIONREQUEST:
|
||||
ucbhelper::cancelCommandExecution(
|
||||
aRet,
|
||||
Reference<XCommandEnvironment>(0));
|
||||
} else if(action == THROWACCESSDENIED) {
|
||||
Sequence<Any> seq(1);
|
||||
PropertyValue value;
|
||||
value.Name =
|
||||
rtl::OUString::createFromAscii("Uri");
|
||||
value.Handle = -1;
|
||||
value.Value <<= m_aFTPURL.ident(false,false);
|
||||
value.State = PropertyState_DIRECT_VALUE;
|
||||
seq[0] <<= value;
|
||||
ucbhelper::cancelCommandExecution(
|
||||
IOErrorCode_ACCESS_DENIED,
|
||||
seq,
|
||||
Environment);
|
||||
} else if(action == THROWINTERACTIVECONNECT) {
|
||||
InteractiveNetworkConnectException
|
||||
excep;
|
||||
excep.Server = m_aFTPURL.host();
|
||||
aRet <<= excep;
|
||||
ucbhelper::cancelCommandExecution(
|
||||
aRet,
|
||||
Environment);
|
||||
} else if(action == THROWRESOLVENAME) {
|
||||
InteractiveNetworkResolveNameException
|
||||
excep;
|
||||
excep.Server = m_aFTPURL.host();
|
||||
aRet <<= excep;
|
||||
ucbhelper::cancelCommandExecution(
|
||||
aRet,
|
||||
Environment);
|
||||
} else if(action == THROWNOFILE) {
|
||||
Sequence<Any> seq(1);
|
||||
PropertyValue value;
|
||||
value.Name =
|
||||
rtl::OUString::createFromAscii("Uri");
|
||||
value.Handle = -1;
|
||||
value.Value <<= m_aFTPURL.ident(false,false);
|
||||
value.State = PropertyState_DIRECT_VALUE;
|
||||
seq[0] <<= value;
|
||||
ucbhelper::cancelCommandExecution(
|
||||
IOErrorCode_NO_FILE,
|
||||
seq,
|
||||
Environment);
|
||||
} else if(action == THROWQUOTE ||
|
||||
action == THROWGENERAL) {
|
||||
break;
|
||||
|
||||
case THROWACCESSDENIED:
|
||||
{
|
||||
Sequence<Any> seq(1);
|
||||
PropertyValue value;
|
||||
value.Name = rtl::OUString::createFromAscii("Uri");
|
||||
value.Handle = -1;
|
||||
value.Value <<= m_aFTPURL.ident(false,false);
|
||||
value.State = PropertyState_DIRECT_VALUE;
|
||||
seq[0] <<= value;
|
||||
ucbhelper::cancelCommandExecution(
|
||||
IOErrorCode_ACCESS_DENIED,
|
||||
seq,
|
||||
Environment);
|
||||
break;
|
||||
}
|
||||
case THROWINTERACTIVECONNECT:
|
||||
{
|
||||
InteractiveNetworkConnectException excep;
|
||||
excep.Server = m_aFTPURL.host();
|
||||
aRet <<= excep;
|
||||
ucbhelper::cancelCommandExecution(
|
||||
aRet,
|
||||
Environment);
|
||||
break;
|
||||
}
|
||||
case THROWRESOLVENAME:
|
||||
{
|
||||
InteractiveNetworkResolveNameException excep;
|
||||
excep.Server = m_aFTPURL.host();
|
||||
aRet <<= excep;
|
||||
ucbhelper::cancelCommandExecution(
|
||||
aRet,
|
||||
Environment);
|
||||
break;
|
||||
}
|
||||
case THROWNOFILE:
|
||||
{
|
||||
Sequence<Any> seq(1);
|
||||
PropertyValue value;
|
||||
value.Name = rtl::OUString::createFromAscii("Uri");
|
||||
value.Handle = -1;
|
||||
value.Value <<= m_aFTPURL.ident(false,false);
|
||||
value.State = PropertyState_DIRECT_VALUE;
|
||||
seq[0] <<= value;
|
||||
ucbhelper::cancelCommandExecution(
|
||||
IOErrorCode_NO_FILE,
|
||||
seq,
|
||||
Environment);
|
||||
break;
|
||||
}
|
||||
case THROWQUOTE:
|
||||
case THROWGENERAL:
|
||||
ucbhelper::cancelCommandExecution(
|
||||
IOErrorCode_GENERAL,
|
||||
Sequence<Any>(0),
|
||||
Environment);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(aCommand.Name.compareToAscii("getPropertyValues") == 0) {
|
||||
Sequence<Property> Properties;
|
||||
if(!(aCommand.Argument >>= Properties))
|
||||
{
|
||||
aRet <<= IllegalArgumentException();
|
||||
aRet <<= IllegalArgumentException(
|
||||
rtl::OUString::createFromAscii(
|
||||
"Wrong argument type!" ),
|
||||
static_cast< cppu::OWeakObject * >(this),
|
||||
-1);
|
||||
ucbhelper::cancelCommandExecution(aRet,Environment);
|
||||
}
|
||||
|
||||
@@ -433,7 +452,11 @@ Any SAL_CALL FTPContent::execute(
|
||||
Sequence<PropertyValue> propertyValues;
|
||||
|
||||
if( ! ( aCommand.Argument >>= propertyValues ) ) {
|
||||
aRet <<= IllegalArgumentException();
|
||||
aRet <<= IllegalArgumentException(
|
||||
rtl::OUString::createFromAscii(
|
||||
"Wrong argument type!" ),
|
||||
static_cast< cppu::OWeakObject * >(this),
|
||||
-1);
|
||||
ucbhelper::cancelCommandExecution(aRet,Environment);
|
||||
}
|
||||
|
||||
@@ -451,7 +474,11 @@ Any SAL_CALL FTPContent::execute(
|
||||
{
|
||||
InsertCommandArgument aInsertArgument;
|
||||
if ( ! ( aCommand.Argument >>= aInsertArgument ) ) {
|
||||
aRet <<= IllegalArgumentException();
|
||||
aRet <<= IllegalArgumentException(
|
||||
rtl::OUString::createFromAscii(
|
||||
"Wrong argument type!" ),
|
||||
static_cast< cppu::OWeakObject * >(this),
|
||||
-1);
|
||||
ucbhelper::cancelCommandExecution(aRet,Environment);
|
||||
}
|
||||
insert(aInsertArgument,Environment);
|
||||
@@ -463,7 +490,12 @@ Any SAL_CALL FTPContent::execute(
|
||||
else if(aCommand.Name.compareToAscii( "open" ) == 0) {
|
||||
OpenCommandArgument2 aOpenCommand;
|
||||
if ( !( aCommand.Argument >>= aOpenCommand ) ) {
|
||||
aRet <<= IllegalArgumentException();
|
||||
aRet <<= IllegalArgumentException(
|
||||
rtl::OUString::createFromAscii(
|
||||
"Wrong argument type!" ),
|
||||
static_cast< cppu::OWeakObject * >(this),
|
||||
-1);
|
||||
|
||||
ucbhelper::cancelCommandExecution(aRet,Environment);
|
||||
}
|
||||
|
||||
@@ -516,7 +548,10 @@ Any SAL_CALL FTPContent::execute(
|
||||
}
|
||||
}
|
||||
else {
|
||||
aRet <<= UnsupportedDataSinkException();
|
||||
aRet <<= UnsupportedDataSinkException(
|
||||
rtl::OUString(),
|
||||
static_cast< cppu::OWeakObject * >(this),
|
||||
aOpenCommand.Sink);
|
||||
ucbhelper::cancelCommandExecution(aRet,Environment);
|
||||
}
|
||||
}
|
||||
@@ -544,17 +579,39 @@ Any SAL_CALL FTPContent::execute(
|
||||
aOpenCommand.Mode ==
|
||||
OpenMode::DOCUMENT_SHARE_DENY_WRITE) {
|
||||
// Unsupported OpenMode
|
||||
aRet <<= UnsupportedOpenModeException();
|
||||
aRet <<= UnsupportedOpenModeException(
|
||||
rtl::OUString(),
|
||||
static_cast< cppu::OWeakObject * >(this),
|
||||
static_cast< sal_Int16 >(aOpenCommand.Mode));
|
||||
ucbhelper::cancelCommandExecution(aRet,Environment);
|
||||
}
|
||||
else {
|
||||
// IllegalArgumentException:: No OpenMode
|
||||
aRet <<= IllegalArgumentException();
|
||||
aRet <<= IllegalArgumentException(
|
||||
rtl::OUString::createFromAscii(
|
||||
"Unexpected OpenMode!" ),
|
||||
static_cast< cppu::OWeakObject * >(this),
|
||||
-1);
|
||||
|
||||
ucbhelper::cancelCommandExecution(aRet,Environment);
|
||||
}
|
||||
}
|
||||
else {
|
||||
aRet <<= UnsupportedCommandException();
|
||||
} else if(aCommand.Name.compareToAscii("createNewContent") == 0) {
|
||||
ContentInfo aArg;
|
||||
if (!(aCommand.Argument >>= aArg)) {
|
||||
ucbhelper::cancelCommandExecution(
|
||||
makeAny(
|
||||
IllegalArgumentException(
|
||||
rtl::OUString::createFromAscii(
|
||||
"Wrong argument type!" ),
|
||||
static_cast< cppu::OWeakObject * >(this),
|
||||
-1)),
|
||||
Environment);
|
||||
// Unreachable
|
||||
}
|
||||
aRet <<= createNewContent(aArg);
|
||||
} else {
|
||||
aRet <<= UnsupportedCommandException(
|
||||
aCommand.Name,
|
||||
static_cast< cppu::OWeakObject * >(this));
|
||||
ucbhelper::cancelCommandExecution(aRet,Environment);
|
||||
}
|
||||
|
||||
@@ -565,8 +622,11 @@ Any SAL_CALL FTPContent::execute(
|
||||
else if(e.code() == CURLE_COULDNT_RESOLVE_HOST )
|
||||
action = THROWRESOLVENAME;
|
||||
else if(e.code() == CURLE_FTP_USER_PASSWORD_INCORRECT ||
|
||||
#if LIBCURL_VERSION_NUM>=0x070d01 /* 7.13.1 */
|
||||
e.code() == CURLE_LOGIN_DENIED ||
|
||||
#endif
|
||||
e.code() == CURLE_BAD_PASSWORD_ENTERED ||
|
||||
e.code() == CURLE_FTP_WEIRD_PASS_REPLY )
|
||||
e.code() == CURLE_FTP_WEIRD_PASS_REPLY)
|
||||
action = THROWAUTHENTICATIONREQUEST;
|
||||
else if(e.code() == CURLE_FTP_ACCESS_DENIED)
|
||||
action = THROWACCESSDENIED;
|
||||
@@ -575,7 +635,7 @@ Any SAL_CALL FTPContent::execute(
|
||||
else if(e.code() == CURLE_FTP_COULDNT_RETR_FILE)
|
||||
action = THROWNOFILE;
|
||||
else
|
||||
// nothing known about the course of the error
|
||||
// nothing known about the cause of the error
|
||||
action = THROWGENERAL;
|
||||
}
|
||||
}
|
||||
@@ -591,6 +651,14 @@ Any SAL_CALL FTPContent::execute(
|
||||
Sequence<ContentInfo > SAL_CALL
|
||||
FTPContent::queryCreatableContentsInfo( )
|
||||
throw (RuntimeException)
|
||||
{
|
||||
return queryCreatableContentsInfo_Static();
|
||||
}
|
||||
|
||||
// static
|
||||
Sequence<ContentInfo >
|
||||
FTPContent::queryCreatableContentsInfo_Static( )
|
||||
throw (RuntimeException)
|
||||
{
|
||||
Sequence< ContentInfo > seq(2);
|
||||
|
||||
@@ -614,7 +682,6 @@ FTPContent::queryCreatableContentsInfo( )
|
||||
return seq;
|
||||
}
|
||||
|
||||
|
||||
Reference<XContent > SAL_CALL
|
||||
FTPContent::createNewContent( const ContentInfo& Info )
|
||||
throw (RuntimeException)
|
||||
@@ -785,6 +852,9 @@ Reference< XRow > FTPContent::getPropertyValues(
|
||||
const rtl::OUString& Name = seqProp[i].Name;
|
||||
if(Name.compareToAscii("Title") == 0)
|
||||
xRow->appendString(seqProp[i],aDirEntry.m_aName);
|
||||
else if(Name.compareToAscii("CreatableContentsInfo") == 0)
|
||||
xRow->appendObject(seqProp[i],
|
||||
makeAny(queryCreatableContentsInfo()));
|
||||
else if(aDirEntry.m_nMode != INETCOREFTP_FILEMODE_UNKNOWN) {
|
||||
if(Name.compareToAscii("ContentType") == 0)
|
||||
xRow->appendString(seqProp[i],
|
||||
@@ -825,9 +895,6 @@ Reference< XRow > FTPContent::getPropertyValues(
|
||||
Sequence<Any> FTPContent::setPropertyValues(
|
||||
const Sequence<PropertyValue>& seqPropVal)
|
||||
{
|
||||
Sequence<Property> props =
|
||||
getProperties(Reference<XCommandEnvironment>(0));
|
||||
|
||||
Sequence<Any> ret(seqPropVal.getLength());
|
||||
Sequence<PropertyChangeEvent > evt;
|
||||
|
||||
@@ -866,11 +933,20 @@ Sequence<Any> FTPContent::setPropertyValues(
|
||||
ret[i] <<= excep;
|
||||
}
|
||||
} else {
|
||||
// either not unknown or illegal
|
||||
Sequence<Property> props =
|
||||
getProperties(Reference<XCommandEnvironment>(0));
|
||||
|
||||
// either unknown or read-only
|
||||
ret[i] <<= UnknownPropertyException();
|
||||
for(sal_Int32 j = 0; j < props.getLength(); ++j)
|
||||
if(props[j].Name == seqPropVal[i].Name) {
|
||||
ret[i] <<= IllegalAccessException();
|
||||
ret[i] <<= IllegalAccessException(
|
||||
rtl::OUString::createFromAscii(
|
||||
"Property is read-only!"),
|
||||
//props[j].Attributes & PropertyAttribute::READONLY
|
||||
// ? "Property is read-only!"
|
||||
// : "Access denied!"),
|
||||
static_cast< cppu::OWeakObject * >( this ));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,19 +55,6 @@ namespace ftp
|
||||
// UNO service name for the content.
|
||||
#define FTP_CONTENT_SERVICE_NAME "com.sun.star.ucb.FTPContent"
|
||||
|
||||
//=========================================================================
|
||||
|
||||
struct ContentProperties
|
||||
{
|
||||
::rtl::OUString aTitle; // Title
|
||||
::rtl::OUString aContentType; // ContentType
|
||||
sal_Bool bIsDocument; // IsDocument
|
||||
sal_Bool bIsFolder; // IsFolder
|
||||
|
||||
ContentProperties()
|
||||
: bIsDocument( sal_True ), bIsFolder( sal_False ) {}
|
||||
};
|
||||
|
||||
//=========================================================================
|
||||
|
||||
class FTPContentProvider;
|
||||
@@ -150,6 +137,11 @@ namespace ftp
|
||||
::com::sun::star::uno::RuntimeException);
|
||||
|
||||
|
||||
static com::sun::star::uno::Sequence<
|
||||
com::sun::star::ucb::ContentInfo >
|
||||
queryCreatableContentsInfo_Static( )
|
||||
throw (com::sun::star::uno::RuntimeException);
|
||||
|
||||
private:
|
||||
|
||||
FTPContentProvider *m_pFCP;
|
||||
|
||||
@@ -49,7 +49,7 @@ using namespace ftp;
|
||||
uno::Sequence< beans::Property > FTPContent::getProperties(
|
||||
const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/)
|
||||
{
|
||||
#define PROPS_COUNT 7
|
||||
#define PROPS_COUNT 8
|
||||
|
||||
static const beans::Property aPropsInfoTable[] =
|
||||
{
|
||||
@@ -91,7 +91,7 @@ uno::Sequence< beans::Property > FTPContent::getProperties(
|
||||
beans::Property(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateCreated" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast< util::DateTime* >( 0 ) ),
|
||||
getCppuType( static_cast< util::DateTime * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY
|
||||
),
|
||||
@@ -101,10 +101,19 @@ uno::Sequence< beans::Property > FTPContent::getProperties(
|
||||
getCppuBooleanType(),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY
|
||||
),
|
||||
beans::Property(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
||||
"CreatableContentsInfo" ) ),
|
||||
-1,
|
||||
getCppuType(
|
||||
static_cast< const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY
|
||||
)
|
||||
};
|
||||
|
||||
return uno::Sequence< beans::Property >( aPropsInfoTable,PROPS_COUNT);
|
||||
return uno::Sequence< beans::Property >( aPropsInfoTable, PROPS_COUNT );
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
@@ -112,7 +121,7 @@ uno::Sequence< beans::Property > FTPContent::getProperties(
|
||||
uno::Sequence< ucb::CommandInfo > FTPContent::getCommands(
|
||||
const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
|
||||
{
|
||||
// osl::MutexGuard aGuard( m_aMutex );
|
||||
// osl::MutexGuard aGuard( m_aMutex );
|
||||
|
||||
//=================================================================
|
||||
//
|
||||
@@ -120,7 +129,7 @@ uno::Sequence< ucb::CommandInfo > FTPContent::getCommands(
|
||||
//
|
||||
//=================================================================
|
||||
|
||||
#define COMMAND_COUNT 7
|
||||
#define COMMAND_COUNT 8
|
||||
|
||||
static const ucb::CommandInfo aCommandInfoTable[] =
|
||||
{
|
||||
@@ -167,10 +176,15 @@ uno::Sequence< ucb::CommandInfo > FTPContent::getCommands(
|
||||
ucb::CommandInfo(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast< sal_Bool * >( 0 ) )
|
||||
getCppuBooleanType()
|
||||
),
|
||||
ucb::CommandInfo(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
|
||||
)
|
||||
};
|
||||
|
||||
return uno::Sequence<ucb::CommandInfo>(aCommandInfoTable,COMMAND_COUNT);
|
||||
return uno::Sequence< ucb::CommandInfo >( aCommandInfoTable, COMMAND_COUNT );
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "com/sun/star/ucb/XCommandProcessor.hpp"
|
||||
#include "com/sun/star/sdbc/XRow.hpp"
|
||||
#include "ftpresultsetI.hxx"
|
||||
|
||||
#include "ftpcontent.hxx"
|
||||
|
||||
|
||||
using namespace std;
|
||||
@@ -96,6 +96,10 @@ ResultSetI::ResultSetI(const Reference<XMultiServiceFactory>& xMSF,
|
||||
else if(Name.compareToAscii("DateCreated") == 0)
|
||||
xRow->appendTimestamp(seqProp[i],
|
||||
dirvec[n].m_aDate);
|
||||
else if(Name.compareToAscii("CreatableContentsInfo") == 0)
|
||||
xRow->appendObject(
|
||||
seqProp[i],
|
||||
makeAny(FTPContent::queryCreatableContentsInfo_Static()));
|
||||
else
|
||||
xRow->appendVoid(seqProp[i]);
|
||||
}
|
||||
|
||||
@@ -589,6 +589,12 @@ rtl::OUString FTPURL::net_title() const
|
||||
// the client should retry after getting the correct
|
||||
// username + password
|
||||
throw curl_exception(err);
|
||||
#if LIBCURL_VERSION_NUM>=0x070d01 /* 7.13.1 */
|
||||
else if(err == CURLE_LOGIN_DENIED)
|
||||
// the client should retry after getting the correct
|
||||
// username + password
|
||||
throw curl_exception(err);
|
||||
#endif
|
||||
else if(try_more && err == CURLE_FTP_ACCESS_DENIED) {
|
||||
// We were either denied access when trying to login to
|
||||
// an FTP server or when trying to change working directory
|
||||
|
||||
@@ -402,6 +402,7 @@ static util::DateTime getDateFromUnix (time_t t)
|
||||
|
||||
uno::Reference< sdbc::XRow > Content::getPropertyValuesFromGFileInfo(GFileInfo *pInfo,
|
||||
const uno::Reference< lang::XMultiServiceFactory >& rSMgr,
|
||||
const uno::Reference< ucb::XCommandEnvironment > & xEnv,
|
||||
const uno::Sequence< beans::Property >& rProperties)
|
||||
{
|
||||
rtl::Reference< ::ucbhelper::PropertyValueSet > xRow = new ::ucbhelper::PropertyValueSet( rSMgr );
|
||||
@@ -499,6 +500,10 @@ uno::Reference< sdbc::XRow > Content::getPropertyValuesFromGFileInfo(GFileInfo *
|
||||
else
|
||||
xRow->appendVoid( rProp );
|
||||
}
|
||||
else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
|
||||
{
|
||||
xRow->appendObject( rProp, uno::makeAny( queryCreatableContentsInfo( xEnv ) ) );
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
{
|
||||
@@ -520,7 +525,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
|
||||
if (!pInfo)
|
||||
ucbhelper::cancelCommandExecution(mapGIOError(pError), xEnv);
|
||||
|
||||
return getPropertyValuesFromGFileInfo(pInfo, m_xSMgr, rProperties);
|
||||
return getPropertyValuesFromGFileInfo(pInfo, m_xSMgr, xEnv, rProperties);
|
||||
}
|
||||
|
||||
static lang::IllegalAccessException
|
||||
@@ -663,7 +668,8 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
|
||||
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) ||
|
||||
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) ||
|
||||
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) ||
|
||||
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) )
|
||||
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) ||
|
||||
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
|
||||
{
|
||||
aRet[ n ] <<= getReadOnlyException( static_cast< cppu::OWeakObject * >(this) );
|
||||
}
|
||||
@@ -944,6 +950,14 @@ uno::Any SAL_CALL Content::execute(
|
||||
ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv );
|
||||
aRet <<= setPropertyValues( aProperties, xEnv );
|
||||
}
|
||||
else if (aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "createNewContent" ) )
|
||||
&& isFolder( xEnv ) )
|
||||
{
|
||||
ucb::ContentInfo arg;
|
||||
if ( !( aCommand.Argument >>= arg ) )
|
||||
ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv );
|
||||
aRet <<= createNewContent( arg );
|
||||
}
|
||||
else if (aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "insert" ) ))
|
||||
{
|
||||
ucb::InsertCommandArgument arg;
|
||||
@@ -956,8 +970,8 @@ uno::Any SAL_CALL Content::execute(
|
||||
sal_Bool bDeletePhysical = sal_False;
|
||||
aCommand.Argument >>= bDeletePhysical;
|
||||
|
||||
//If no delete physical, try and trashcan it, if that doesn't work go
|
||||
//ahead and try and delete it anyway
|
||||
//If no delete physical, try and trashcan it, if that doesn't work go
|
||||
//ahead and try and delete it anyway
|
||||
if (!bDeletePhysical && !g_file_trash(getGFile(), NULL, NULL))
|
||||
bDeletePhysical = true;
|
||||
|
||||
@@ -1079,36 +1093,50 @@ void Content::transfer( const ucb::TransferInfo& aTransferInfo, const uno::Refer
|
||||
ucbhelper::cancelCommandExecution(mapGIOError(pError), xEnv);
|
||||
}
|
||||
|
||||
com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo > SAL_CALL Content::queryCreatableContentsInfo()
|
||||
throw( com::sun::star::uno::RuntimeException )
|
||||
uno::Sequence< ucb::ContentInfo > Content::queryCreatableContentsInfo(
|
||||
const uno::Reference< ucb::XCommandEnvironment >& xEnv)
|
||||
throw( uno::RuntimeException )
|
||||
{
|
||||
uno::Sequence< ucb::ContentInfo > seq(2);
|
||||
if ( isFolder( xEnv ) )
|
||||
{
|
||||
uno::Sequence< ucb::ContentInfo > seq(2);
|
||||
|
||||
// Minimum set of props we really need
|
||||
uno::Sequence< beans::Property > props( 1 );
|
||||
props[0] = beans::Property(
|
||||
rtl::OUString::createFromAscii( "Title" ),
|
||||
-1,
|
||||
getCppuType( static_cast< rtl::OUString* >( 0 ) ),
|
||||
beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::BOUND );
|
||||
// Minimum set of props we really need
|
||||
uno::Sequence< beans::Property > props( 1 );
|
||||
props[0] = beans::Property(
|
||||
rtl::OUString::createFromAscii( "Title" ),
|
||||
-1,
|
||||
getCppuType( static_cast< rtl::OUString* >( 0 ) ),
|
||||
beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::BOUND );
|
||||
|
||||
// file
|
||||
seq[0].Type = rtl::OUString::createFromAscii( GIO_FILE_TYPE );
|
||||
seq[0].Attributes = ( ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM |
|
||||
ucb::ContentInfoAttribute::KIND_DOCUMENT );
|
||||
seq[0].Properties = props;
|
||||
// file
|
||||
seq[0].Type = rtl::OUString::createFromAscii( GIO_FILE_TYPE );
|
||||
seq[0].Attributes = ( ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM |
|
||||
ucb::ContentInfoAttribute::KIND_DOCUMENT );
|
||||
seq[0].Properties = props;
|
||||
|
||||
// folder
|
||||
seq[1].Type = rtl::OUString::createFromAscii( GIO_FOLDER_TYPE );
|
||||
seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER;
|
||||
seq[1].Properties = props;
|
||||
// folder
|
||||
seq[1].Type = rtl::OUString::createFromAscii( GIO_FOLDER_TYPE );
|
||||
seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER;
|
||||
seq[1].Properties = props;
|
||||
|
||||
return seq;
|
||||
return seq;
|
||||
}
|
||||
else
|
||||
{
|
||||
return uno::Sequence< ucb::ContentInfo >();
|
||||
}
|
||||
}
|
||||
|
||||
com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
|
||||
SAL_CALL Content::createNewContent( const com::sun::star::ucb::ContentInfo& Info )
|
||||
throw( com::sun::star::uno::RuntimeException )
|
||||
uno::Sequence< ucb::ContentInfo > SAL_CALL Content::queryCreatableContentsInfo()
|
||||
throw( uno::RuntimeException )
|
||||
{
|
||||
return queryCreatableContentsInfo( uno::Reference< ucb::XCommandEnvironment >() );
|
||||
}
|
||||
|
||||
uno::Reference< ucb::XContent >
|
||||
SAL_CALL Content::createNewContent( const ucb::ContentInfo& Info )
|
||||
throw( uno::RuntimeException )
|
||||
{
|
||||
bool create_document;
|
||||
const char *name;
|
||||
@@ -1223,6 +1251,9 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
|
||||
beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsHidden" ) ),
|
||||
-1, getCppuBooleanType(),
|
||||
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
|
||||
beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CreatableContentsInfo" ) ),
|
||||
-1, getCppuType( static_cast< const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY )
|
||||
};
|
||||
|
||||
@@ -1232,7 +1263,7 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
|
||||
uno::Sequence< ucb::CommandInfo > Content::getCommands( const uno::Reference< ucb::XCommandEnvironment > & xEnv)
|
||||
{
|
||||
static ucb::CommandInfo aDocumentCommandInfoTable[] =
|
||||
static ucb::CommandInfo aCommandInfoTable[] =
|
||||
{
|
||||
// Required commands
|
||||
ucb::CommandInfo
|
||||
@@ -1262,11 +1293,14 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( const uno::Reference< uc
|
||||
// Folder Only, omitted if not a folder
|
||||
ucb::CommandInfo
|
||||
( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
|
||||
-1, getCppuType( static_cast<ucb::TransferInfo * >( 0 ) ) )
|
||||
-1, getCppuType( static_cast<ucb::TransferInfo * >( 0 ) ) ),
|
||||
ucb::CommandInfo
|
||||
( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
|
||||
-1, getCppuType( static_cast<ucb::ContentInfo * >( 0 ) ) )
|
||||
};
|
||||
|
||||
const int nProps = sizeof (aDocumentCommandInfoTable) / sizeof (aDocumentCommandInfoTable[0]);
|
||||
return uno::Sequence< ucb::CommandInfo >(aDocumentCommandInfoTable, isFolder(xEnv) ? nProps : nProps - 1);
|
||||
const int nProps = sizeof (aCommandInfoTable) / sizeof (aCommandInfoTable[0]);
|
||||
return uno::Sequence< ucb::CommandInfo >(aCommandInfoTable, isFolder(xEnv) ? nProps : nProps - 2);
|
||||
}
|
||||
|
||||
XTYPEPROVIDER_COMMON_IMPL( Content );
|
||||
|
||||
@@ -145,6 +145,7 @@ public:
|
||||
|
||||
static com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > getPropertyValuesFromGFileInfo(
|
||||
GFileInfo *pInfo, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr,
|
||||
const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv,
|
||||
const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& rProperties);
|
||||
|
||||
virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
|
||||
@@ -189,6 +190,11 @@ public:
|
||||
SAL_CALL createNewContent( const com::sun::star::ucb::ContentInfo& Info )
|
||||
throw( com::sun::star::uno::RuntimeException );
|
||||
|
||||
com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
|
||||
queryCreatableContentsInfo(
|
||||
const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv)
|
||||
throw( com::sun::star::uno::RuntimeException );
|
||||
|
||||
GFile* getGFile();
|
||||
};
|
||||
|
||||
|
||||
@@ -240,7 +240,7 @@ uno::Reference< sdbc::XRow > DataSupplier::queryPropertyValues( sal_uInt32 nInde
|
||||
if ( getResult( nIndex ) )
|
||||
{
|
||||
uno::Reference< sdbc::XRow > xRow = Content::getPropertyValuesFromGFileInfo(
|
||||
maResults[ nIndex ]->pInfo, m_xSMgr, getResultSet()->getProperties());
|
||||
maResults[ nIndex ]->pInfo, m_xSMgr, getResultSet()->getEnvironment(), getResultSet()->getProperties());
|
||||
|
||||
maResults[ nIndex ]->xRow = xRow;
|
||||
return xRow;
|
||||
|
||||
@@ -390,6 +390,13 @@ uno::Any SAL_CALL Content::execute(
|
||||
g_warning ("Open falling through ...");
|
||||
#endif
|
||||
|
||||
} else if ( COMMAND_IS( aCommand, "createNewContent" ) && isFolder( xEnv ) ) {
|
||||
ucb::ContentInfo arg;
|
||||
if ( !( aCommand.Argument >>= arg ) )
|
||||
ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv );
|
||||
|
||||
aRet <<= createNewContent( arg );
|
||||
|
||||
} else if ( COMMAND_IS( aCommand, "insert" ) ) {
|
||||
ucb::InsertCommandArgument arg;
|
||||
if ( !( aCommand.Argument >>= arg ) )
|
||||
@@ -444,32 +451,45 @@ void SAL_CALL Content::abort( sal_Int32 /*CommandId*/ )
|
||||
// XContentCreator methods.
|
||||
//
|
||||
|
||||
uno::Sequence< ucb::ContentInfo > SAL_CALL
|
||||
Content::queryCreatableContentsInfo()
|
||||
throw( uno::RuntimeException )
|
||||
uno::Sequence< ucb::ContentInfo > Content::queryCreatableContentsInfo(
|
||||
const uno::Reference< ucb::XCommandEnvironment >& xEnv)
|
||||
throw( uno::RuntimeException )
|
||||
{
|
||||
uno::Sequence< ucb::ContentInfo > seq(2);
|
||||
if ( isFolder( xEnv ) )
|
||||
{
|
||||
uno::Sequence< ucb::ContentInfo > seq(2);
|
||||
|
||||
// Minimum set of props we really need
|
||||
uno::Sequence< beans::Property > props( 1 );
|
||||
props[0] = beans::Property(
|
||||
rtl::OUString::createFromAscii( "Title" ),
|
||||
-1,
|
||||
getCppuType( static_cast< rtl::OUString* >( 0 ) ),
|
||||
beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::BOUND );
|
||||
// Minimum set of props we really need
|
||||
uno::Sequence< beans::Property > props( 1 );
|
||||
props[0] = beans::Property(
|
||||
rtl::OUString::createFromAscii( "Title" ),
|
||||
-1,
|
||||
getCppuType( static_cast< rtl::OUString* >( 0 ) ),
|
||||
beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::BOUND );
|
||||
|
||||
// file
|
||||
seq[0].Type = rtl::OUString::createFromAscii( GVFS_FILE_TYPE );
|
||||
seq[0].Attributes = ( ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM |
|
||||
ucb::ContentInfoAttribute::KIND_DOCUMENT );
|
||||
seq[0].Properties = props;
|
||||
// file
|
||||
seq[0].Type = rtl::OUString::createFromAscii( GVFS_FILE_TYPE );
|
||||
seq[0].Attributes = ( ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM |
|
||||
ucb::ContentInfoAttribute::KIND_DOCUMENT );
|
||||
seq[0].Properties = props;
|
||||
|
||||
// folder
|
||||
seq[1].Type = rtl::OUString::createFromAscii( GVFS_FOLDER_TYPE );
|
||||
seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER;
|
||||
seq[1].Properties = props;
|
||||
// folder
|
||||
seq[1].Type = rtl::OUString::createFromAscii( GVFS_FOLDER_TYPE );
|
||||
seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER;
|
||||
seq[1].Properties = props;
|
||||
|
||||
return seq;
|
||||
return seq;
|
||||
}
|
||||
else
|
||||
{
|
||||
return uno::Sequence< ucb::ContentInfo >();
|
||||
}
|
||||
}
|
||||
|
||||
uno::Sequence< ucb::ContentInfo > SAL_CALL Content::queryCreatableContentsInfo()
|
||||
throw( uno::RuntimeException )
|
||||
{
|
||||
return queryCreatableContentsInfo( uno::Reference< ucb::XCommandEnvironment >() );
|
||||
}
|
||||
|
||||
uno::Reference< ucb::XContent > SAL_CALL
|
||||
@@ -668,7 +688,10 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
|
||||
g_warning ("FIXME: Requested mime-type - an expensive op. indeed!");
|
||||
#endif
|
||||
xRow->appendVoid( rProp );
|
||||
} else {
|
||||
} else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
|
||||
xRow->appendObject( rProp, uno::makeAny( queryCreatableContentsInfo( xEnv ) ) );
|
||||
|
||||
else {
|
||||
xRow->appendVoid( rProp );
|
||||
}
|
||||
}
|
||||
@@ -780,7 +803,8 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
|
||||
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) ||
|
||||
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) ||
|
||||
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) ||
|
||||
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) )
|
||||
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) ||
|
||||
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
|
||||
aRet[ n ] <<= getReadOnlyException( this );
|
||||
|
||||
else if ( rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Title" ) ) ) {
|
||||
@@ -1311,8 +1335,8 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
|
||||
// FIXME: Too expensive for now (?)
|
||||
// beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ),
|
||||
// -1, getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
// beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
|
||||
// -1, getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
// beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
|
||||
beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) ),
|
||||
-1, getCppuType( static_cast< const sal_Int64 * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
|
||||
@@ -1327,6 +1351,9 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
|
||||
beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsHidden" ) ),
|
||||
-1, getCppuBooleanType(),
|
||||
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
|
||||
beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CreatableContentsInfo" ) ),
|
||||
-1, getCppuType( static_cast< const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY )
|
||||
};
|
||||
|
||||
@@ -1339,7 +1366,7 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
uno::Sequence< ucb::CommandInfo > Content::getCommands(
|
||||
const uno::Reference< ucb::XCommandEnvironment > & xEnv )
|
||||
{
|
||||
static ucb::CommandInfo aDocumentCommandInfoTable[] = {
|
||||
static ucb::CommandInfo aCommandInfoTable[] = {
|
||||
// Required commands
|
||||
ucb::CommandInfo
|
||||
( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
|
||||
@@ -1365,17 +1392,19 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
|
||||
( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
|
||||
-1, getCppuType( static_cast<ucb::OpenCommandArgument2 * >( 0 ) ) ),
|
||||
|
||||
// Folder only
|
||||
// Folder Only, omitted if not a folder
|
||||
ucb::CommandInfo
|
||||
( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
|
||||
-1, getCppuType( static_cast<ucb::TransferInfo * >( 0 ) ) )
|
||||
-1, getCppuType( static_cast<ucb::TransferInfo * >( 0 ) ) ),
|
||||
ucb::CommandInfo
|
||||
( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
|
||||
-1, getCppuType( static_cast<ucb::ContentInfo * >( 0 ) ) )
|
||||
};
|
||||
int num = 7;
|
||||
|
||||
if ( isFolder( xEnv ) )
|
||||
num += 1;
|
||||
|
||||
return uno::Sequence< ucb::CommandInfo >(aDocumentCommandInfoTable, num );
|
||||
const int nProps
|
||||
= sizeof( aCommandInfoTable ) / sizeof( aCommandInfoTable[ 0 ] );
|
||||
return uno::Sequence< ucb::CommandInfo >(
|
||||
aCommandInfoTable, isFolder( xEnv ) ? nProps : nProps - 2 );
|
||||
}
|
||||
|
||||
rtl::OUString
|
||||
|
||||
@@ -255,6 +255,13 @@ public:
|
||||
com::sun::star::ucb::XContent > SAL_CALL
|
||||
createNewContent( const com::sun::star::ucb::ContentInfo& Info )
|
||||
throw( com::sun::star::uno::RuntimeException );
|
||||
|
||||
|
||||
com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
|
||||
queryCreatableContentsInfo(
|
||||
const com::sun::star::uno::Reference<
|
||||
com::sun::star::ucb::XCommandEnvironment >& xEnv)
|
||||
throw( com::sun::star::uno::RuntimeException );
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -457,8 +457,8 @@ uno::Any SAL_CALL HierarchyContent::execute(
|
||||
|
||||
aRet <<= getCommandInfo( Environment );
|
||||
}
|
||||
else if ( isFolder() && aCommand.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "open" ) ) )
|
||||
else if ( aCommand.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "open" ) ) && isFolder() )
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// open command for a folder content
|
||||
@@ -481,9 +481,9 @@ uno::Any SAL_CALL HierarchyContent::execute(
|
||||
= new DynamicResultSet( m_xSMgr, this, aOpenCommand );
|
||||
aRet <<= xSet;
|
||||
}
|
||||
else if ( ( m_eKind != ROOT ) && !isReadOnly() &&
|
||||
aCommand.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "insert" ) ) )
|
||||
else if ( aCommand.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "insert" ) ) &&
|
||||
( m_eKind != ROOT ) && !isReadOnly() )
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// insert
|
||||
@@ -508,9 +508,9 @@ uno::Any SAL_CALL HierarchyContent::execute(
|
||||
: ucb::NameClash::ERROR;
|
||||
insert( nNameClash, Environment );
|
||||
}
|
||||
else if ( ( m_eKind != ROOT ) && !isReadOnly() &&
|
||||
aCommand.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "delete" ) ) )
|
||||
else if ( aCommand.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "delete" ) ) &&
|
||||
( m_eKind != ROOT ) && !isReadOnly() )
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// delete
|
||||
@@ -546,9 +546,9 @@ uno::Any SAL_CALL HierarchyContent::execute(
|
||||
// Remove own and all children's Additional Core Properties.
|
||||
removeAdditionalPropertySet( sal_True );
|
||||
}
|
||||
else if ( isFolder() && !isReadOnly() &&
|
||||
aCommand.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "transfer" ) ) )
|
||||
else if ( aCommand.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "transfer" ) ) &&
|
||||
isFolder() && !isReadOnly() )
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// transfer
|
||||
@@ -571,6 +571,31 @@ uno::Any SAL_CALL HierarchyContent::execute(
|
||||
|
||||
transfer( aInfo, Environment );
|
||||
}
|
||||
else if ( aCommand.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "createNewContent" ) ) &&
|
||||
isFolder() && !isReadOnly() )
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// createNewContent
|
||||
// ( Not available at link objects )
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
ucb::ContentInfo aInfo;
|
||||
if ( !( aCommand.Argument >>= aInfo ) )
|
||||
{
|
||||
OSL_ENSURE( sal_False, "Wrong argument type!" );
|
||||
ucbhelper::cancelCommandExecution(
|
||||
uno::makeAny( lang::IllegalArgumentException(
|
||||
rtl::OUString::createFromAscii(
|
||||
"Wrong argument type!" ),
|
||||
static_cast< cppu::OWeakObject * >( this ),
|
||||
-1 ) ),
|
||||
Environment );
|
||||
// Unreachable
|
||||
}
|
||||
|
||||
aRet <<= createNewContent( aInfo );
|
||||
}
|
||||
else
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////
|
||||
@@ -607,54 +632,7 @@ uno::Sequence< ucb::ContentInfo > SAL_CALL
|
||||
HierarchyContent::queryCreatableContentsInfo()
|
||||
throw( uno::RuntimeException )
|
||||
{
|
||||
if ( isFolder() )
|
||||
{
|
||||
osl::Guard< osl::Mutex > aGuard( m_aMutex );
|
||||
|
||||
uno::Sequence< ucb::ContentInfo > aSeq( 2 );
|
||||
|
||||
// Folder.
|
||||
aSeq.getArray()[ 0 ].Type
|
||||
= rtl::OUString::createFromAscii( HIERARCHY_FOLDER_CONTENT_TYPE );
|
||||
aSeq.getArray()[ 0 ].Attributes
|
||||
= ucb::ContentInfoAttribute::KIND_FOLDER;
|
||||
|
||||
uno::Sequence< beans::Property > aFolderProps( 1 );
|
||||
aFolderProps.getArray()[ 0 ] = beans::Property(
|
||||
rtl::OUString::createFromAscii( "Title" ),
|
||||
-1,
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND );
|
||||
aSeq.getArray()[ 0 ].Properties = aFolderProps;
|
||||
|
||||
// Link.
|
||||
aSeq.getArray()[ 1 ].Type
|
||||
= rtl::OUString::createFromAscii( HIERARCHY_LINK_CONTENT_TYPE );
|
||||
aSeq.getArray()[ 1 ].Attributes
|
||||
= ucb::ContentInfoAttribute::KIND_LINK;
|
||||
|
||||
uno::Sequence< beans::Property > aLinkProps( 2 );
|
||||
aLinkProps.getArray()[ 0 ] = beans::Property(
|
||||
rtl::OUString::createFromAscii( "Title" ),
|
||||
-1,
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND );
|
||||
aLinkProps.getArray()[ 1 ] = beans::Property(
|
||||
rtl::OUString::createFromAscii( "TargetURL" ),
|
||||
-1,
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND );
|
||||
aSeq.getArray()[ 1 ].Properties = aLinkProps;
|
||||
|
||||
return aSeq;
|
||||
}
|
||||
else
|
||||
{
|
||||
OSL_ENSURE( sal_False,
|
||||
"queryCreatableContentsInfo called on non-folder object!" );
|
||||
|
||||
return uno::Sequence< ucb::ContentInfo >( 0 );
|
||||
}
|
||||
return m_aProps.getCreatableContentsInfo();
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
@@ -1026,7 +1004,7 @@ uno::Reference< sdbc::XRow > HierarchyContent::getPropertyValues(
|
||||
xRow->appendString ( rProp, rData.getContentType() );
|
||||
}
|
||||
else if ( rProp.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
|
||||
RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
|
||||
{
|
||||
xRow->appendString ( rProp, rData.getTitle() );
|
||||
}
|
||||
@@ -1040,6 +1018,12 @@ uno::Reference< sdbc::XRow > HierarchyContent::getPropertyValues(
|
||||
{
|
||||
xRow->appendBoolean( rProp, rData.getIsFolder() );
|
||||
}
|
||||
else if ( rProp.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
|
||||
{
|
||||
xRow->appendObject(
|
||||
rProp, uno::makeAny( rData.getCreatableContentsInfo() ) );
|
||||
}
|
||||
else if ( rProp.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "TargetURL" ) ) )
|
||||
{
|
||||
@@ -1123,6 +1107,15 @@ uno::Reference< sdbc::XRow > HierarchyContent::getPropertyValues(
|
||||
// @@@ Might actually be read-only!
|
||||
beans::PropertyAttribute::BOUND ),
|
||||
rData.getTargetURL() );
|
||||
xRow->appendObject(
|
||||
beans::Property(
|
||||
rtl::OUString::createFromAscii( "CreatableContentsInfo" ),
|
||||
-1,
|
||||
getCppuType( static_cast<
|
||||
const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY ),
|
||||
uno::makeAny( rData.getCreatableContentsInfo() ) );
|
||||
|
||||
// Append all Additional Core Properties.
|
||||
|
||||
@@ -1161,11 +1154,11 @@ uno::Sequence< uno::Any > HierarchyContent::setPropertyValues(
|
||||
|
||||
beans::PropertyChangeEvent aEvent;
|
||||
aEvent.Source = static_cast< cppu::OWeakObject * >( this );
|
||||
aEvent.Further = sal_False;
|
||||
// aEvent.PropertyName =
|
||||
aEvent.Further = sal_False;
|
||||
// aEvent.PropertyName =
|
||||
aEvent.PropertyHandle = -1;
|
||||
// aEvent.OldValue =
|
||||
// aEvent.NewValue =
|
||||
// aEvent.OldValue =
|
||||
// aEvent.NewValue =
|
||||
|
||||
const beans::PropertyValue* pValues = rValues.getConstArray();
|
||||
sal_Int32 nCount = rValues.getLength();
|
||||
@@ -1209,6 +1202,15 @@ uno::Sequence< uno::Any > HierarchyContent::setPropertyValues(
|
||||
"Property is read-only!" ),
|
||||
static_cast< cppu::OWeakObject * >( this ) );
|
||||
}
|
||||
else if ( rValue.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
|
||||
{
|
||||
// Read-only property!
|
||||
aRet[ n ] <<= lang::IllegalAccessException(
|
||||
rtl::OUString::createFromAscii(
|
||||
"Property is read-only!" ),
|
||||
static_cast< cppu::OWeakObject * >( this ) );
|
||||
}
|
||||
else if ( rValue.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
|
||||
{
|
||||
@@ -1953,3 +1955,58 @@ void HierarchyContent::transfer(
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
//=========================================================================
|
||||
//
|
||||
// HierarchyContentProperties Implementation.
|
||||
//
|
||||
//=========================================================================
|
||||
//=========================================================================
|
||||
|
||||
uno::Sequence< ucb::ContentInfo >
|
||||
HierarchyContentProperties::getCreatableContentsInfo() const
|
||||
{
|
||||
if ( getIsFolder() )
|
||||
{
|
||||
uno::Sequence< ucb::ContentInfo > aSeq( 2 );
|
||||
|
||||
// Folder.
|
||||
aSeq.getArray()[ 0 ].Type
|
||||
= rtl::OUString::createFromAscii( HIERARCHY_FOLDER_CONTENT_TYPE );
|
||||
aSeq.getArray()[ 0 ].Attributes
|
||||
= ucb::ContentInfoAttribute::KIND_FOLDER;
|
||||
|
||||
uno::Sequence< beans::Property > aFolderProps( 1 );
|
||||
aFolderProps.getArray()[ 0 ] = beans::Property(
|
||||
rtl::OUString::createFromAscii( "Title" ),
|
||||
-1,
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND );
|
||||
aSeq.getArray()[ 0 ].Properties = aFolderProps;
|
||||
|
||||
// Link.
|
||||
aSeq.getArray()[ 1 ].Type
|
||||
= rtl::OUString::createFromAscii( HIERARCHY_LINK_CONTENT_TYPE );
|
||||
aSeq.getArray()[ 1 ].Attributes
|
||||
= ucb::ContentInfoAttribute::KIND_LINK;
|
||||
|
||||
uno::Sequence< beans::Property > aLinkProps( 2 );
|
||||
aLinkProps.getArray()[ 0 ] = beans::Property(
|
||||
rtl::OUString::createFromAscii( "Title" ),
|
||||
-1,
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND );
|
||||
aLinkProps.getArray()[ 1 ] = beans::Property(
|
||||
rtl::OUString::createFromAscii( "TargetURL" ),
|
||||
-1,
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND );
|
||||
aSeq.getArray()[ 1 ].Properties = aLinkProps;
|
||||
|
||||
return aSeq;
|
||||
}
|
||||
else
|
||||
{
|
||||
return uno::Sequence< ucb::ContentInfo >( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +101,9 @@ public:
|
||||
|
||||
sal_Bool getIsDocument() const { return !getIsFolder(); }
|
||||
|
||||
com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
|
||||
getCreatableContentsInfo() const;
|
||||
|
||||
const HierarchyEntryData & getHierarchyEntryData() const { return m_aData; }
|
||||
|
||||
private:
|
||||
|
||||
@@ -47,17 +47,20 @@
|
||||
IsFolder x x x x x
|
||||
Title x x x x x
|
||||
TargetURL x x
|
||||
CreatableContentsInfo x x x x x
|
||||
|
||||
getCommandInfo x x x x x
|
||||
getPropertySetInfo x x x x x
|
||||
getPropertyValues x x x x x
|
||||
setPropertyValues x x x x x
|
||||
createNewContent x x
|
||||
insert x x
|
||||
delete x x
|
||||
open x x
|
||||
transfer x x
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
#include <com/sun/star/beans/Property.hpp>
|
||||
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
||||
#include <com/sun/star/beans/PropertyValue.hpp>
|
||||
@@ -76,6 +79,12 @@ using namespace hierarchy_ucp;
|
||||
//
|
||||
//=========================================================================
|
||||
|
||||
#define MAKEPROPSEQUENCE( a ) \
|
||||
uno::Sequence< beans::Property >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
|
||||
|
||||
#define MAKECMDSEQUENCE( a ) \
|
||||
uno::Sequence< ucb::CommandInfo >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
|
||||
|
||||
//=========================================================================
|
||||
//
|
||||
// IMPORTENT: If any property data ( name / type / ... ) are changed, then
|
||||
@@ -143,13 +152,20 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties(
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY
|
||||
)
|
||||
),
|
||||
beans::Property(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
||||
"CreatableContentsInfo" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast<
|
||||
const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY )
|
||||
///////////////////////////////////////////////////////////
|
||||
// New properties
|
||||
///////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence<
|
||||
beans::Property >( aLinkPropertyInfoTable, 5 );
|
||||
return MAKEPROPSEQUENCE( aLinkPropertyInfoTable );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -195,13 +211,20 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties(
|
||||
-1,
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
)
|
||||
),
|
||||
beans::Property(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
||||
"CreatableContentsInfo" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast<
|
||||
const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY )
|
||||
///////////////////////////////////////////////////////////
|
||||
// New properties
|
||||
///////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence<
|
||||
beans::Property >( aLinkPropertyInfoTable, 5 );
|
||||
return MAKEPROPSEQUENCE( aLinkPropertyInfoTable );
|
||||
}
|
||||
}
|
||||
else if ( m_eKind == FOLDER )
|
||||
@@ -248,16 +271,23 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties(
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY
|
||||
)
|
||||
),
|
||||
///////////////////////////////////////////////////////////
|
||||
// Optional standard properties
|
||||
///////////////////////////////////////////////////////////
|
||||
beans::Property(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
||||
"CreatableContentsInfo" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast<
|
||||
const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY )
|
||||
///////////////////////////////////////////////////////////
|
||||
// New properties
|
||||
///////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence<
|
||||
beans::Property >( aFolderPropertyInfoTable, 4 );
|
||||
return MAKEPROPSEQUENCE( aFolderPropertyInfoTable );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -294,16 +324,23 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties(
|
||||
-1,
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
)
|
||||
),
|
||||
///////////////////////////////////////////////////////////
|
||||
// Optional standard properties
|
||||
///////////////////////////////////////////////////////////
|
||||
beans::Property(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
||||
"CreatableContentsInfo" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast<
|
||||
const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY )
|
||||
///////////////////////////////////////////////////////////
|
||||
// New properties
|
||||
///////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence<
|
||||
beans::Property >( aFolderPropertyInfoTable, 4 );
|
||||
return MAKEPROPSEQUENCE( aFolderPropertyInfoTable );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -314,6 +351,9 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties(
|
||||
//
|
||||
//=================================================================
|
||||
|
||||
// Currently no difference between reonly /read-write
|
||||
// -> all props ar read-only
|
||||
|
||||
static beans::Property aRootFolderPropertyInfoTable[] =
|
||||
{
|
||||
///////////////////////////////////////////////////////////////
|
||||
@@ -346,16 +386,23 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties(
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY
|
||||
)
|
||||
),
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Optional standard properties
|
||||
///////////////////////////////////////////////////////////////
|
||||
beans::Property(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
||||
"CreatableContentsInfo" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast<
|
||||
const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY )
|
||||
///////////////////////////////////////////////////////////////
|
||||
// New properties
|
||||
///////////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence<
|
||||
beans::Property >( aRootFolderPropertyInfoTable, 4 );
|
||||
return MAKEPROPSEQUENCE( aRootFolderPropertyInfoTable );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,8 +463,7 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands(
|
||||
// New commands
|
||||
///////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence<
|
||||
ucb::CommandInfo >( aLinkCommandInfoTable, 4 );
|
||||
return MAKECMDSEQUENCE( aLinkCommandInfoTable );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -470,8 +516,7 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands(
|
||||
// New commands
|
||||
///////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence<
|
||||
ucb::CommandInfo >( aLinkCommandInfoTable, 6 );
|
||||
return MAKECMDSEQUENCE( aLinkCommandInfoTable );
|
||||
}
|
||||
}
|
||||
else if ( m_eKind == FOLDER )
|
||||
@@ -529,8 +574,7 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands(
|
||||
// New commands
|
||||
///////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence<
|
||||
ucb::CommandInfo >( aFolderCommandInfoTable, 5 );
|
||||
return MAKECMDSEQUENCE( aFolderCommandInfoTable );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -589,13 +633,18 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast< ucb::TransferInfo * >( 0 ) )
|
||||
),
|
||||
ucb::CommandInfo(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
|
||||
)
|
||||
///////////////////////////////////////////////////////////
|
||||
// New commands
|
||||
///////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence<
|
||||
ucb::CommandInfo >( aFolderCommandInfoTable, 8 );
|
||||
return MAKECMDSEQUENCE( aFolderCommandInfoTable );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -653,8 +702,7 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands(
|
||||
// New commands
|
||||
///////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence<
|
||||
ucb::CommandInfo >( aRootFolderCommandInfoTable, 5 );
|
||||
return MAKECMDSEQUENCE( aRootFolderCommandInfoTable );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -703,13 +751,18 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast< ucb::TransferInfo * >( 0 ) )
|
||||
),
|
||||
ucb::CommandInfo(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
|
||||
)
|
||||
///////////////////////////////////////////////////////////
|
||||
// New commands
|
||||
///////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence<
|
||||
ucb::CommandInfo >( aRootFolderCommandInfoTable, 6 );
|
||||
return MAKECMDSEQUENCE( aRootFolderCommandInfoTable );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,16 +103,59 @@ ContentProperties::ContentProperties( const rtl::OUString& rContentType )
|
||||
bEncrypted( sal_False ),
|
||||
bHasEncryptedEntries( sal_False )
|
||||
{
|
||||
bIsFolder = rContentType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( PACKAGE_FOLDER_CONTENT_TYPE ) )
|
||||
|| rContentType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( PACKAGE_ZIP_FOLDER_CONTENT_TYPE ) );
|
||||
bIsFolder = rContentType.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( PACKAGE_FOLDER_CONTENT_TYPE ) )
|
||||
|| rContentType.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( PACKAGE_ZIP_FOLDER_CONTENT_TYPE ) );
|
||||
bIsDocument = !bIsFolder;
|
||||
|
||||
OSL_ENSURE( bIsFolder ||
|
||||
rContentType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( PACKAGE_STREAM_CONTENT_TYPE ) ) ||
|
||||
rContentType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( PACKAGE_ZIP_STREAM_CONTENT_TYPE ) ),
|
||||
rContentType.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( PACKAGE_STREAM_CONTENT_TYPE ) )
|
||||
|| rContentType.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( PACKAGE_ZIP_STREAM_CONTENT_TYPE ) ),
|
||||
"ContentProperties::ContentProperties - Unknown type!" );
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
|
||||
uno::Sequence< ucb::ContentInfo >
|
||||
ContentProperties::getCreatableContentsInfo( PackageUri const & rUri ) const
|
||||
{
|
||||
if ( bIsFolder )
|
||||
{
|
||||
uno::Sequence< beans::Property > aProps( 1 );
|
||||
aProps.getArray()[ 0 ] = beans::Property(
|
||||
rtl::OUString::createFromAscii( "Title" ),
|
||||
-1,
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND );
|
||||
|
||||
uno::Sequence< ucb::ContentInfo > aSeq( 2 );
|
||||
|
||||
// Folder.
|
||||
aSeq.getArray()[ 0 ].Type
|
||||
= Content::getContentType( rUri.getScheme(), sal_True );
|
||||
aSeq.getArray()[ 0 ].Attributes
|
||||
= ucb::ContentInfoAttribute::KIND_FOLDER;
|
||||
aSeq.getArray()[ 0 ].Properties = aProps;
|
||||
|
||||
// Stream.
|
||||
aSeq.getArray()[ 1 ].Type
|
||||
= Content::getContentType( rUri.getScheme(), sal_False );
|
||||
aSeq.getArray()[ 1 ].Attributes
|
||||
= ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM
|
||||
| ucb::ContentInfoAttribute::KIND_DOCUMENT;
|
||||
aSeq.getArray()[ 1 ].Properties = aProps;
|
||||
|
||||
return aSeq;
|
||||
}
|
||||
else
|
||||
{
|
||||
return uno::Sequence< ucb::ContentInfo >( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
//=========================================================================
|
||||
//
|
||||
@@ -164,9 +207,9 @@ Content* Content::create(
|
||||
|
||||
ucb::ContentInfo aInfo;
|
||||
if ( bFolder || aURI.isRootFolder() )
|
||||
aInfo.Type = GetContentType( aURI.getScheme(), sal_True );
|
||||
aInfo.Type = getContentType( aURI.getScheme(), sal_True );
|
||||
else
|
||||
aInfo.Type = GetContentType( aURI.getScheme(), sal_False );
|
||||
aInfo.Type = getContentType( aURI.getScheme(), sal_False );
|
||||
|
||||
return new Content( rxSMgr, pProvider, xId, xPackage, aURI, aInfo );
|
||||
}
|
||||
@@ -186,9 +229,9 @@ Content* Content::create(
|
||||
PackageUri aURI( Identifier->getContentIdentifier() );
|
||||
|
||||
if ( !Info.Type.equalsIgnoreAsciiCase(
|
||||
GetContentType( aURI.getScheme(), sal_True ) ) &&
|
||||
getContentType( aURI.getScheme(), sal_True ) ) &&
|
||||
!Info.Type.equalsIgnoreAsciiCase(
|
||||
GetContentType( aURI.getScheme(), sal_False ) ) )
|
||||
getContentType( aURI.getScheme(), sal_False ) ) )
|
||||
return 0;
|
||||
|
||||
uno::Reference< container::XHierarchicalNameAccess > xPackage;
|
||||
@@ -208,7 +251,7 @@ Content* Content::create(
|
||||
|
||||
//=========================================================================
|
||||
// static
|
||||
::rtl::OUString Content::GetContentType(
|
||||
::rtl::OUString Content::getContentType(
|
||||
const ::rtl::OUString& aScheme, sal_Bool bFolder )
|
||||
{
|
||||
return ( rtl::OUString::createFromAscii( "application/" )
|
||||
@@ -625,6 +668,31 @@ uno::Any SAL_CALL Content::execute(
|
||||
|
||||
transfer( aInfo, Environment );
|
||||
}
|
||||
else if ( aCommand.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "createNewContent" ) ) &&
|
||||
isFolder() )
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// createNewContent
|
||||
// ( Not available at stream objects )
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
ucb::ContentInfo aInfo;
|
||||
if ( !( aCommand.Argument >>= aInfo ) )
|
||||
{
|
||||
OSL_ENSURE( sal_False, "Wrong argument type!" );
|
||||
ucbhelper::cancelCommandExecution(
|
||||
uno::makeAny( lang::IllegalArgumentException(
|
||||
rtl::OUString::createFromAscii(
|
||||
"Wrong argument type!" ),
|
||||
static_cast< cppu::OWeakObject * >( this ),
|
||||
-1 ) ),
|
||||
Environment );
|
||||
// Unreachable
|
||||
}
|
||||
|
||||
aRet <<= createNewContent( aInfo );
|
||||
}
|
||||
else if ( aCommand.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "flush" ) ) )
|
||||
{
|
||||
@@ -691,43 +759,7 @@ uno::Sequence< ucb::ContentInfo > SAL_CALL
|
||||
Content::queryCreatableContentsInfo()
|
||||
throw( uno::RuntimeException )
|
||||
{
|
||||
if ( isFolder() )
|
||||
{
|
||||
osl::Guard< osl::Mutex > aGuard( m_aMutex );
|
||||
|
||||
uno::Sequence< beans::Property > aProps( 1 );
|
||||
aProps.getArray()[ 0 ] = beans::Property(
|
||||
rtl::OUString::createFromAscii( "Title" ),
|
||||
-1,
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND );
|
||||
|
||||
uno::Sequence< ucb::ContentInfo > aSeq( 2 );
|
||||
|
||||
// Folder.
|
||||
aSeq.getArray()[ 0 ].Type
|
||||
= GetContentType( m_aUri.getScheme(), sal_True );
|
||||
aSeq.getArray()[ 0 ].Attributes
|
||||
= ucb::ContentInfoAttribute::KIND_FOLDER;
|
||||
aSeq.getArray()[ 0 ].Properties = aProps;
|
||||
|
||||
// Stream.
|
||||
aSeq.getArray()[ 1 ].Type
|
||||
= GetContentType( m_aUri.getScheme(), sal_False );
|
||||
aSeq.getArray()[ 1 ].Attributes
|
||||
= ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM
|
||||
| ucb::ContentInfoAttribute::KIND_DOCUMENT;
|
||||
aSeq.getArray()[ 1 ].Properties = aProps;
|
||||
|
||||
return aSeq;
|
||||
}
|
||||
else
|
||||
{
|
||||
OSL_ENSURE( sal_False,
|
||||
"queryCreatableContentsInfo called on non-folder object!" );
|
||||
|
||||
return uno::Sequence< ucb::ContentInfo >( 0 );
|
||||
}
|
||||
return m_aProps.getCreatableContentsInfo( m_aUri );
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
@@ -744,16 +776,16 @@ Content::createNewContent( const ucb::ContentInfo& Info )
|
||||
return uno::Reference< ucb::XContent >();
|
||||
|
||||
if ( !Info.Type.equalsIgnoreAsciiCase(
|
||||
GetContentType( m_aUri.getScheme(), sal_True ) ) &&
|
||||
getContentType( m_aUri.getScheme(), sal_True ) ) &&
|
||||
!Info.Type.equalsIgnoreAsciiCase(
|
||||
GetContentType( m_aUri.getScheme(), sal_False ) ) )
|
||||
getContentType( m_aUri.getScheme(), sal_False ) ) )
|
||||
return uno::Reference< ucb::XContent >();
|
||||
|
||||
rtl::OUString aURL = m_aUri.getUri();
|
||||
aURL += rtl::OUString::createFromAscii( "/" );
|
||||
|
||||
if ( Info.Type.equalsIgnoreAsciiCase(
|
||||
GetContentType( m_aUri.getScheme(), sal_True ) ) )
|
||||
getContentType( m_aUri.getScheme(), sal_True ) ) )
|
||||
aURL += rtl::OUString::createFromAscii( "New_Folder" );
|
||||
else
|
||||
aURL += rtl::OUString::createFromAscii( "New_Stream" );
|
||||
@@ -868,6 +900,14 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
|
||||
{
|
||||
xRow->appendBoolean( rProp, rData.bIsFolder );
|
||||
}
|
||||
else if ( rProp.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
|
||||
{
|
||||
xRow->appendObject(
|
||||
rProp, uno::makeAny(
|
||||
rData.getCreatableContentsInfo(
|
||||
PackageUri( rContentId ) ) ) );
|
||||
}
|
||||
else if ( rProp.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) )
|
||||
{
|
||||
@@ -976,6 +1016,16 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY ),
|
||||
rData.bIsFolder );
|
||||
xRow->appendObject(
|
||||
beans::Property(
|
||||
rtl::OUString::createFromAscii( "CreatableContentsInfo" ),
|
||||
-1,
|
||||
getCppuType( static_cast<
|
||||
const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY ),
|
||||
uno::makeAny(
|
||||
rData.getCreatableContentsInfo( PackageUri( rContentId ) ) ) );
|
||||
xRow->appendString(
|
||||
beans::Property(
|
||||
rtl::OUString::createFromAscii( "MediaType" ),
|
||||
@@ -1113,6 +1163,15 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
|
||||
"Property is read-only!" ),
|
||||
static_cast< cppu::OWeakObject * >( this ) );
|
||||
}
|
||||
else if ( rValue.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
|
||||
{
|
||||
// Read-only property!
|
||||
aRet[ n ] <<= lang::IllegalAccessException(
|
||||
rtl::OUString::createFromAscii(
|
||||
"Property is read-only!" ),
|
||||
static_cast< cppu::OWeakObject * >( this ) );
|
||||
}
|
||||
else if ( rValue.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
|
||||
{
|
||||
@@ -1929,8 +1988,8 @@ void Content::transfer(
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
rtl::OUString aType = xSource->isFolder()
|
||||
? GetContentType( m_aUri.getScheme(), sal_True )
|
||||
: GetContentType( m_aUri.getScheme(), sal_False );
|
||||
? getContentType( m_aUri.getScheme(), sal_True )
|
||||
: getContentType( m_aUri.getScheme(), sal_False );
|
||||
ucb::ContentInfo aContentInfo;
|
||||
aContentInfo.Type = aType;
|
||||
aContentInfo.Attributes = 0;
|
||||
@@ -2411,14 +2470,14 @@ sal_Bool Content::loadData(
|
||||
if ( xEnumAccess.is() )
|
||||
{
|
||||
// folder
|
||||
rProps.aContentType = GetContentType( rURI.getScheme(), sal_True );
|
||||
rProps.aContentType = getContentType( rURI.getScheme(), sal_True );
|
||||
rProps.bIsDocument = sal_False;
|
||||
rProps.bIsFolder = sal_True;
|
||||
}
|
||||
else
|
||||
{
|
||||
// stream
|
||||
rProps.aContentType = GetContentType( rURI.getScheme(), sal_False );
|
||||
rProps.aContentType = getContentType( rURI.getScheme(), sal_False );
|
||||
rProps.bIsDocument = sal_True;
|
||||
rProps.bIsFolder = sal_False;
|
||||
}
|
||||
|
||||
@@ -98,6 +98,9 @@ struct ContentProperties
|
||||
bHasEncryptedEntries( sal_False ) {}
|
||||
|
||||
ContentProperties( const ::rtl::OUString& rContentType );
|
||||
|
||||
com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
|
||||
getCreatableContentsInfo( PackageUri const & rUri ) const;
|
||||
};
|
||||
|
||||
//=========================================================================
|
||||
@@ -190,10 +193,6 @@ private:
|
||||
com::sun::star::container::XHierarchicalNameAccess > &
|
||||
rxPackage );
|
||||
|
||||
static ::rtl::OUString
|
||||
GetContentType( const ::rtl::OUString& aScheme,
|
||||
sal_Bool bFolder );
|
||||
|
||||
sal_Bool
|
||||
hasData( const PackageUri& rURI );
|
||||
sal_Bool
|
||||
@@ -329,6 +328,9 @@ public:
|
||||
::com::sun::star::uno::Reference<
|
||||
::com::sun::star::container::XEnumeration >
|
||||
getIterator();
|
||||
|
||||
static ::rtl::OUString
|
||||
getContentType( const ::rtl::OUString& aScheme, sal_Bool bFolder );
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
MediaType (w) (w) w
|
||||
Title r w w
|
||||
Size - - r
|
||||
CreatableContentsInfo r r r
|
||||
Compressed - - w
|
||||
Encrypted - - w
|
||||
HasEncryptedEntries r - -
|
||||
@@ -58,6 +59,7 @@
|
||||
open x x x
|
||||
transfer x x -
|
||||
flush x x -
|
||||
createNewContent x x -
|
||||
|
||||
*************************************************************************/
|
||||
#include <com/sun/star/beans/Property.hpp>
|
||||
@@ -78,6 +80,12 @@ using namespace package_ucp;
|
||||
//
|
||||
//=========================================================================
|
||||
|
||||
#define MAKEPROPSEQUENCE( a ) \
|
||||
uno::Sequence< beans::Property >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
|
||||
|
||||
#define MAKECMDSEQUENCE( a ) \
|
||||
uno::Sequence< ucb::CommandInfo >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
|
||||
|
||||
//=========================================================================
|
||||
//
|
||||
// IMPORTENT: If any property data ( name / type / ... ) are changed, then
|
||||
@@ -145,6 +153,15 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
),
|
||||
beans::Property(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
||||
"CreatableContentsInfo" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast<
|
||||
const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY
|
||||
),
|
||||
///////////////////////////////////////////////////////////////
|
||||
// New properties
|
||||
///////////////////////////////////////////////////////////////
|
||||
@@ -157,8 +174,7 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
| beans::PropertyAttribute::READONLY
|
||||
)
|
||||
};
|
||||
return uno::Sequence< beans::Property >(
|
||||
aRootFolderPropertyInfoTable, 6 );
|
||||
return MAKEPROPSEQUENCE( aRootFolderPropertyInfoTable );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -210,13 +226,21 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
-1,
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
),
|
||||
beans::Property(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
||||
"CreatableContentsInfo" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast<
|
||||
const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY
|
||||
)
|
||||
///////////////////////////////////////////////////////////////
|
||||
// New properties
|
||||
///////////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence< beans::Property >(
|
||||
aFolderPropertyInfoTable, 5 );
|
||||
return MAKEPROPSEQUENCE( aFolderPropertyInfoTable );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -275,6 +299,15 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY
|
||||
),
|
||||
beans::Property(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
||||
"CreatableContentsInfo" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast<
|
||||
const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY
|
||||
),
|
||||
///////////////////////////////////////////////////////////////
|
||||
// New properties
|
||||
///////////////////////////////////////////////////////////////
|
||||
@@ -291,7 +324,7 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
beans::PropertyAttribute::BOUND
|
||||
)
|
||||
};
|
||||
return uno::Sequence< beans::Property >( aStreamPropertyInfoTable, 8 );
|
||||
return MAKEPROPSEQUENCE( aStreamPropertyInfoTable );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,6 +393,12 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
|
||||
getCppuType(
|
||||
static_cast< ucb::TransferInfo * >( 0 ) )
|
||||
),
|
||||
ucb::CommandInfo(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
|
||||
),
|
||||
///////////////////////////////////////////////////////////
|
||||
// New commands
|
||||
///////////////////////////////////////////////////////////
|
||||
@@ -370,8 +409,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
|
||||
)
|
||||
};
|
||||
|
||||
return uno::Sequence<
|
||||
ucb::CommandInfo >( aRootFolderCommandInfoTable, 7 );
|
||||
return MAKECMDSEQUENCE( aRootFolderCommandInfoTable );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -439,6 +477,12 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
|
||||
getCppuType(
|
||||
static_cast< ucb::TransferInfo * >( 0 ) )
|
||||
),
|
||||
ucb::CommandInfo(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
|
||||
),
|
||||
///////////////////////////////////////////////////////////
|
||||
// New commands
|
||||
///////////////////////////////////////////////////////////
|
||||
@@ -449,8 +493,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
|
||||
)
|
||||
};
|
||||
|
||||
return uno::Sequence<
|
||||
ucb::CommandInfo >( aFolderCommandInfoTable, 9 );
|
||||
return MAKECMDSEQUENCE( aFolderCommandInfoTable );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -517,8 +560,6 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
|
||||
///////////////////////////////////////////////////////////////
|
||||
};
|
||||
|
||||
return uno::Sequence< ucb::CommandInfo >(
|
||||
aStreamCommandInfoTable, 7 );
|
||||
return MAKECMDSEQUENCE( aStreamCommandInfoTable );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ uno::Any SAL_CALL Content::queryInterface( const uno::Type & rType )
|
||||
rType, static_cast< ucb::XContentCreator * >( this ) );
|
||||
if ( aRet.hasValue() )
|
||||
{
|
||||
if ( !isContentCreator() )
|
||||
if ( !m_aProps.isContentCreator() )
|
||||
return uno::Any();
|
||||
}
|
||||
}
|
||||
@@ -249,7 +249,7 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
|
||||
{
|
||||
cppu::OTypeCollection * pCollection = 0;
|
||||
|
||||
if ( isContentCreator() )
|
||||
if ( m_aProps.isContentCreator() )
|
||||
{
|
||||
static cppu::OTypeCollection* pFolderTypes = 0;
|
||||
|
||||
@@ -660,6 +660,49 @@ uno::Any SAL_CALL Content::execute(
|
||||
|
||||
transfer( aInfo, Environment );
|
||||
}
|
||||
else if ( aCommand.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "createNewContent" ) ) )
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// createNewContent ( Supported by document and folders only )
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
{
|
||||
osl::MutexGuard aGuard( m_aMutex );
|
||||
|
||||
ContentType eType = m_aProps.getType();
|
||||
if ( ( eType != FOLDER ) && ( eType != DOCUMENT ) )
|
||||
{
|
||||
ucbhelper::cancelCommandExecution(
|
||||
uno::makeAny( ucb::UnsupportedCommandException(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM(
|
||||
"createNewContent command only "
|
||||
"supported by folders and "
|
||||
"documents!" ) ),
|
||||
static_cast< cppu::OWeakObject * >(
|
||||
this ) ) ),
|
||||
Environment );
|
||||
// Unreachable
|
||||
}
|
||||
}
|
||||
|
||||
ucb::ContentInfo aInfo;
|
||||
if ( !( aCommand.Argument >>= aInfo ) )
|
||||
{
|
||||
OSL_ENSURE( sal_False, "Wrong argument type!" );
|
||||
ucbhelper::cancelCommandExecution(
|
||||
uno::makeAny( lang::IllegalArgumentException(
|
||||
rtl::OUString::createFromAscii(
|
||||
"Wrong argument type!" ),
|
||||
static_cast< cppu::OWeakObject * >( this ),
|
||||
-1 ) ),
|
||||
Environment );
|
||||
// Unreachable
|
||||
}
|
||||
|
||||
aRet <<= createNewContent( aInfo );
|
||||
}
|
||||
else
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////
|
||||
@@ -695,65 +738,7 @@ uno::Sequence< ucb::ContentInfo > SAL_CALL
|
||||
Content::queryCreatableContentsInfo()
|
||||
throw( uno::RuntimeException )
|
||||
{
|
||||
if ( isContentCreator() )
|
||||
{
|
||||
osl::Guard< osl::Mutex > aGuard( m_aMutex );
|
||||
|
||||
uno::Sequence< beans::Property > aProps( 1 );
|
||||
aProps.getArray()[ 0 ] = beans::Property(
|
||||
rtl::OUString::createFromAscii( "Title" ),
|
||||
-1,
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND );
|
||||
|
||||
#ifdef NO_STREAM_CREATION_WITHIN_DOCUMENT_ROOT
|
||||
if ( m_aProps.getType() == DOCUMENT )
|
||||
{
|
||||
// streams cannot be created as direct children of document root
|
||||
uno::Sequence< ucb::ContentInfo > aSeq( 1 );
|
||||
|
||||
// Folder.
|
||||
aSeq.getArray()[ 0 ].Type
|
||||
= rtl::OUString::createFromAscii( TDOC_FOLDER_CONTENT_TYPE );
|
||||
aSeq.getArray()[ 0 ].Attributes
|
||||
= ucb::ContentInfoAttribute::KIND_FOLDER;
|
||||
aSeq.getArray()[ 0 ].Properties = aProps;
|
||||
|
||||
return aSeq;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
uno::Sequence< ucb::ContentInfo > aSeq( 2 );
|
||||
|
||||
// Folder.
|
||||
aSeq.getArray()[ 0 ].Type
|
||||
= rtl::OUString::createFromAscii( TDOC_FOLDER_CONTENT_TYPE );
|
||||
aSeq.getArray()[ 0 ].Attributes
|
||||
= ucb::ContentInfoAttribute::KIND_FOLDER;
|
||||
aSeq.getArray()[ 0 ].Properties = aProps;
|
||||
|
||||
// Stream.
|
||||
aSeq.getArray()[ 1 ].Type
|
||||
= rtl::OUString::createFromAscii( TDOC_STREAM_CONTENT_TYPE );
|
||||
aSeq.getArray()[ 1 ].Attributes
|
||||
= ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM
|
||||
| ucb::ContentInfoAttribute::KIND_DOCUMENT;
|
||||
aSeq.getArray()[ 1 ].Properties = aProps;
|
||||
|
||||
return aSeq;
|
||||
#ifdef NO_STREAM_CREATION_WITHIN_DOCUMENT_ROOT
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
OSL_ENSURE( sal_False,
|
||||
"queryCreatableContentsInfo called on non-contentcreator "
|
||||
"object!" );
|
||||
|
||||
return uno::Sequence< ucb::ContentInfo >( 0 );
|
||||
}
|
||||
return m_aProps.getCreatableContentsInfo();
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
@@ -762,7 +747,7 @@ uno::Reference< ucb::XContent > SAL_CALL
|
||||
Content::createNewContent( const ucb::ContentInfo& Info )
|
||||
throw( uno::RuntimeException )
|
||||
{
|
||||
if ( isContentCreator() )
|
||||
if ( m_aProps.isContentCreator() )
|
||||
{
|
||||
osl::Guard< osl::Mutex > aGuard( m_aMutex );
|
||||
|
||||
@@ -1060,6 +1045,12 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
|
||||
{
|
||||
xRow->appendBoolean( rProp, rData.getIsFolder() );
|
||||
}
|
||||
else if ( rProp.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
|
||||
{
|
||||
xRow->appendObject(
|
||||
rProp, uno::makeAny( rData.getCreatableContentsInfo() ) );
|
||||
}
|
||||
else if ( rProp.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "Storage" ) ) )
|
||||
{
|
||||
@@ -1155,6 +1146,15 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY ),
|
||||
rData.getIsFolder() );
|
||||
xRow->appendObject(
|
||||
beans::Property(
|
||||
rtl::OUString::createFromAscii( "CreatableContentsInfo" ),
|
||||
-1,
|
||||
getCppuType( static_cast<
|
||||
const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY ),
|
||||
uno::makeAny( rData.getCreatableContentsInfo() ) );
|
||||
|
||||
// Storage is only supported by folders.
|
||||
if ( eType == FOLDER )
|
||||
@@ -1265,6 +1265,15 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
|
||||
"Property is read-only!" ),
|
||||
static_cast< cppu::OWeakObject * >( this ) );
|
||||
}
|
||||
else if ( rValue.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
|
||||
{
|
||||
// Read-only property!
|
||||
aRet[ n ] <<= lang::IllegalAccessException(
|
||||
rtl::OUString::createFromAscii(
|
||||
"Property is read-only!" ),
|
||||
static_cast< cppu::OWeakObject * >( this ) );
|
||||
}
|
||||
else if ( rValue.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
|
||||
{
|
||||
@@ -2369,14 +2378,6 @@ void Content::transfer(
|
||||
} // rInfo.MoveData
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
bool Content::isContentCreator()
|
||||
{
|
||||
osl::Guard< osl::Mutex > aGuard( m_aMutex );
|
||||
return
|
||||
( m_aProps.getType() == FOLDER ) || ( m_aProps.getType() == DOCUMENT );
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
//static
|
||||
bool Content::hasData( ContentProvider* pProvider, const Uri & rUri )
|
||||
@@ -3059,3 +3060,79 @@ uno::Reference< io::XStream > Content::getStream(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
//=========================================================================
|
||||
//
|
||||
// ContentProperties Implementation.
|
||||
//
|
||||
//=========================================================================
|
||||
//=========================================================================
|
||||
|
||||
uno::Sequence< ucb::ContentInfo >
|
||||
ContentProperties::getCreatableContentsInfo() const
|
||||
{
|
||||
if ( isContentCreator() )
|
||||
{
|
||||
uno::Sequence< beans::Property > aProps( 1 );
|
||||
aProps.getArray()[ 0 ] = beans::Property(
|
||||
rtl::OUString::createFromAscii( "Title" ),
|
||||
-1,
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND );
|
||||
|
||||
#ifdef NO_STREAM_CREATION_WITHIN_DOCUMENT_ROOT
|
||||
if ( getType() == DOCUMENT )
|
||||
{
|
||||
// streams cannot be created as direct children of document root
|
||||
uno::Sequence< ucb::ContentInfo > aSeq( 1 );
|
||||
|
||||
// Folder.
|
||||
aSeq.getArray()[ 0 ].Type
|
||||
= rtl::OUString::createFromAscii( TDOC_FOLDER_CONTENT_TYPE );
|
||||
aSeq.getArray()[ 0 ].Attributes
|
||||
= ucb::ContentInfoAttribute::KIND_FOLDER;
|
||||
aSeq.getArray()[ 0 ].Properties = aProps;
|
||||
|
||||
return aSeq;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
uno::Sequence< ucb::ContentInfo > aSeq( 2 );
|
||||
|
||||
// Folder.
|
||||
aSeq.getArray()[ 0 ].Type
|
||||
= rtl::OUString::createFromAscii( TDOC_FOLDER_CONTENT_TYPE );
|
||||
aSeq.getArray()[ 0 ].Attributes
|
||||
= ucb::ContentInfoAttribute::KIND_FOLDER;
|
||||
aSeq.getArray()[ 0 ].Properties = aProps;
|
||||
|
||||
// Stream.
|
||||
aSeq.getArray()[ 1 ].Type
|
||||
= rtl::OUString::createFromAscii( TDOC_STREAM_CONTENT_TYPE );
|
||||
aSeq.getArray()[ 1 ].Attributes
|
||||
= ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM
|
||||
| ucb::ContentInfoAttribute::KIND_DOCUMENT;
|
||||
aSeq.getArray()[ 1 ].Properties = aProps;
|
||||
|
||||
return aSeq;
|
||||
#ifdef NO_STREAM_CREATION_WITHIN_DOCUMENT_ROOT
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
OSL_ENSURE( sal_False,
|
||||
"getCreatableContentsInfo called on non-contentcreator "
|
||||
"object!" );
|
||||
|
||||
return uno::Sequence< ucb::ContentInfo >( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
bool ContentProperties::isContentCreator() const
|
||||
{
|
||||
return ( getType() == FOLDER ) || ( getType() == DOCUMENT );
|
||||
}
|
||||
|
||||
@@ -43,7 +43,8 @@ namespace com { namespace sun { namespace star {
|
||||
namespace sdbc { class XRow; }
|
||||
namespace io { class XInputStream; class XOutputStream; }
|
||||
namespace beans { struct PropertyValue; }
|
||||
namespace ucb { struct OpenCommandArgument2; struct TransferInfo; }
|
||||
namespace ucb { struct OpenCommandArgument2; struct TransferInfo;
|
||||
struct ContentInfo; }
|
||||
} } }
|
||||
|
||||
namespace tdoc_ucp
|
||||
@@ -94,6 +95,11 @@ public:
|
||||
const rtl::OUString & getTitle() const { return m_aTitle; }
|
||||
void setTitle( const rtl::OUString & rTitle ) { m_aTitle = rTitle; }
|
||||
|
||||
com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
|
||||
getCreatableContentsInfo() const;
|
||||
|
||||
bool isContentCreator() const;
|
||||
|
||||
private:
|
||||
ContentType m_eType;
|
||||
rtl::OUString m_aContentType;
|
||||
@@ -137,8 +143,6 @@ private:
|
||||
com::sun::star::ucb::XCommandEnvironment > & xEnv );
|
||||
virtual ::rtl::OUString getParentURL();
|
||||
|
||||
bool isContentCreator();
|
||||
|
||||
static bool hasData( ContentProvider* pProvider, const Uri & rUri );
|
||||
bool hasData( const Uri & rUri ) { return hasData( m_pProvider, rUri ); }
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
IsDocument r r r r r r
|
||||
IsFolder r r r r r r
|
||||
Title r r w w w w
|
||||
CreatableContentsInfo r r r r r r
|
||||
Storage - - r r - -
|
||||
DocumentModel - r - - - -
|
||||
|
||||
@@ -57,6 +58,7 @@
|
||||
delete - - x - x -
|
||||
open x x x - x -
|
||||
transfer - x x - - -
|
||||
createNewContent - x x - - -
|
||||
|
||||
#ifdef NO_STREAM_CREATION_WITHIN_DOCUMENT_ROOT
|
||||
(*) not supported by streams that are direct children of document
|
||||
@@ -88,6 +90,12 @@ using namespace tdoc_ucp;
|
||||
//
|
||||
//=========================================================================
|
||||
|
||||
#define MAKEPROPSEQUENCE( a ) \
|
||||
uno::Sequence< beans::Property >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
|
||||
|
||||
#define MAKECMDSEQUENCE( a ) \
|
||||
uno::Sequence< ucb::CommandInfo >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
|
||||
|
||||
//=========================================================================
|
||||
//
|
||||
// IMPORTENT: If any property data ( name / type / ... ) are changed, then
|
||||
@@ -142,15 +150,24 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
-1,
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
)
|
||||
),
|
||||
///////////////////////////////////////////////////////////
|
||||
// Optional standard properties
|
||||
///////////////////////////////////////////////////////////
|
||||
beans::Property(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
||||
"CreatableContentsInfo" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast<
|
||||
const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY
|
||||
)
|
||||
///////////////////////////////////////////////////////////
|
||||
// New properties
|
||||
///////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence< beans::Property >( aStreamPropertyInfoTable, 4 );
|
||||
return MAKEPROPSEQUENCE( aStreamPropertyInfoTable );
|
||||
}
|
||||
else if ( m_aProps.getType() == FOLDER )
|
||||
{
|
||||
@@ -197,6 +214,15 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
///////////////////////////////////////////////////////////
|
||||
// Optional standard properties
|
||||
///////////////////////////////////////////////////////////
|
||||
beans::Property(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
||||
"CreatableContentsInfo" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast<
|
||||
const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY
|
||||
),
|
||||
///////////////////////////////////////////////////////////
|
||||
// New properties
|
||||
///////////////////////////////////////////////////////////
|
||||
@@ -209,7 +235,7 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
| beans::PropertyAttribute::READONLY
|
||||
)
|
||||
};
|
||||
return uno::Sequence< beans::Property >( aFolderPropertyInfoTable, 5 );
|
||||
return MAKEPROPSEQUENCE( aFolderPropertyInfoTable );
|
||||
}
|
||||
else if ( m_aProps.getType() == DOCUMENT )
|
||||
{
|
||||
@@ -257,6 +283,15 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
///////////////////////////////////////////////////////////
|
||||
// Optional standard properties
|
||||
///////////////////////////////////////////////////////////
|
||||
beans::Property(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
||||
"CreatableContentsInfo" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast<
|
||||
const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY
|
||||
),
|
||||
///////////////////////////////////////////////////////////
|
||||
// New properties
|
||||
///////////////////////////////////////////////////////////
|
||||
@@ -269,7 +304,7 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
| beans::PropertyAttribute::READONLY
|
||||
)
|
||||
};
|
||||
return uno::Sequence< beans::Property >( aDocPropertyInfoTable, 5 );
|
||||
return MAKEPROPSEQUENCE( aDocPropertyInfoTable );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -313,15 +348,24 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY
|
||||
)
|
||||
),
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Optional standard properties
|
||||
///////////////////////////////////////////////////////////////
|
||||
beans::Property(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
||||
"CreatableContentsInfo" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast<
|
||||
const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY
|
||||
)
|
||||
///////////////////////////////////////////////////////////////
|
||||
// New properties
|
||||
///////////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence< beans::Property >( aRootPropertyInfoTable, 4 );
|
||||
return MAKEPROPSEQUENCE( aRootPropertyInfoTable );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,8 +440,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
|
||||
// New commands
|
||||
///////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence<
|
||||
ucb::CommandInfo >( aStreamCommandInfoTable1, 6 );
|
||||
return MAKECMDSEQUENCE( aStreamCommandInfoTable1 );
|
||||
}
|
||||
#endif
|
||||
//=================================================================
|
||||
@@ -461,8 +504,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
|
||||
// New commands
|
||||
///////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence<
|
||||
ucb::CommandInfo >( aStreamCommandInfoTable, 7 );
|
||||
return MAKECMDSEQUENCE( aStreamCommandInfoTable );
|
||||
}
|
||||
else if ( m_aProps.getType() == FOLDER )
|
||||
{
|
||||
@@ -527,13 +569,18 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast< ucb::TransferInfo * >( 0 ) )
|
||||
),
|
||||
ucb::CommandInfo(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
|
||||
)
|
||||
///////////////////////////////////////////////////////////
|
||||
// New commands
|
||||
///////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence<
|
||||
ucb::CommandInfo >( aFolderCommandInfoTable, 8 );
|
||||
return MAKECMDSEQUENCE( aFolderCommandInfoTable );
|
||||
}
|
||||
else if ( m_aProps.getType() == DOCUMENT )
|
||||
{
|
||||
@@ -588,13 +635,18 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast< ucb::TransferInfo * >( 0 ) )
|
||||
),
|
||||
ucb::CommandInfo(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
|
||||
)
|
||||
///////////////////////////////////////////////////////////
|
||||
// New commands
|
||||
///////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence<
|
||||
ucb::CommandInfo >( aDocCommandInfoTable, 6 );
|
||||
return MAKECMDSEQUENCE( aDocCommandInfoTable );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -651,7 +703,6 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
|
||||
// New commands
|
||||
///////////////////////////////////////////////////////////
|
||||
};
|
||||
return uno::Sequence<
|
||||
ucb::CommandInfo >( aRootCommandInfoTable, 5 );
|
||||
return MAKECMDSEQUENCE( aRootCommandInfoTable );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -641,6 +641,29 @@ uno::Any SAL_CALL Content::execute(
|
||||
|
||||
unlock( Environment );
|
||||
}
|
||||
else if ( aCommand.Name.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "createNewContent" ) ) &&
|
||||
isFolder( Environment ) )
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// createNewContent
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
ucb::ContentInfo aArg;
|
||||
if ( !( aCommand.Argument >>= aArg ) )
|
||||
{
|
||||
ucbhelper::cancelCommandExecution(
|
||||
uno::makeAny( lang::IllegalArgumentException(
|
||||
rtl::OUString::createFromAscii(
|
||||
"Wrong argument type!" ),
|
||||
static_cast< cppu::OWeakObject * >( this ),
|
||||
-1 ) ),
|
||||
Environment );
|
||||
// Unreachable
|
||||
}
|
||||
|
||||
aRet = uno::makeAny( createNewContent( aArg ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////
|
||||
@@ -1165,8 +1188,8 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
|
||||
std::auto_ptr< DAVResourceAccess > xResAccess;
|
||||
rtl::OUString aEscapedTitle;
|
||||
bool bHasAll = false;
|
||||
uno::Reference< lang::XMultiServiceFactory > xSMgr;
|
||||
uno::Reference< ucb::XContentIdentifier > xIdentifier;
|
||||
uno::Reference< lang::XMultiServiceFactory > xSMgr;
|
||||
uno::Reference< ucb::XContentIdentifier > xIdentifier;
|
||||
rtl::Reference< ::ucbhelper::ContentProviderImplHelper > xProvider;
|
||||
|
||||
{
|
||||
@@ -1413,14 +1436,35 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
|
||||
m_bCollection ) );
|
||||
}
|
||||
|
||||
// Add BaseURI property, if requested.
|
||||
if ( !xProps->contains(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BaseURI" ) ) ) )
|
||||
sal_Int32 nCount = rProperties.getLength();
|
||||
for ( sal_Int32 n = 0; n < nCount; ++n )
|
||||
{
|
||||
xProps->addProperty(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BaseURI" ) ),
|
||||
uno::makeAny( getBaseURI( xResAccess ) ),
|
||||
true );
|
||||
const rtl::OUString rName = rProperties[ n ].Name;
|
||||
if ( rName.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "BaseURI" ) ) )
|
||||
{
|
||||
// Add BaseURI property, if requested.
|
||||
xProps->addProperty(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BaseURI" ) ),
|
||||
uno::makeAny( getBaseURI( xResAccess ) ),
|
||||
true );
|
||||
}
|
||||
else if ( rName.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
|
||||
{
|
||||
// Add CreatableContentsInfo property, if requested.
|
||||
sal_Bool bFolder = sal_False;
|
||||
xProps->getValue(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ) )
|
||||
>>= bFolder;
|
||||
xProps->addProperty(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM( "CreatableContentsInfo" ) ),
|
||||
uno::makeAny( bFolder
|
||||
? queryCreatableContentsInfo()
|
||||
: uno::Sequence< ucb::ContentInfo >() ),
|
||||
true );
|
||||
}
|
||||
}
|
||||
|
||||
uno::Reference< sdbc::XRow > xResultRow
|
||||
@@ -1653,6 +1697,15 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
|
||||
"Property is read-only!" ),
|
||||
static_cast< cppu::OWeakObject * >( this ) );
|
||||
}
|
||||
if ( rName.equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
|
||||
{
|
||||
// Read-only property!
|
||||
aRet[ n ] <<= lang::IllegalAccessException(
|
||||
rtl::OUString::createFromAscii(
|
||||
"Property is read-only!" ),
|
||||
static_cast< cppu::OWeakObject * >( this ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( getResourceType( xEnv, xResAccess ) == DAV )
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
||||
#include <com/sun/star/beans/PropertyValue.hpp>
|
||||
#include <com/sun/star/ucb/CommandInfo.hpp>
|
||||
#include <com/sun/star/ucb/ContentInfo.hpp>
|
||||
#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
|
||||
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
|
||||
#include <com/sun/star/ucb/PostCommandArgument2.hpp>
|
||||
@@ -156,6 +157,16 @@ bool ContentProvider::getProperty(
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY ) );
|
||||
|
||||
m_pProps->insert(
|
||||
beans::Property(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
||||
"CreatableContentsInfo" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast<
|
||||
const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
|
||||
beans::PropertyAttribute::BOUND
|
||||
| beans::PropertyAttribute::READONLY ) );
|
||||
|
||||
// Standard DAV properties.
|
||||
|
||||
m_pProps->insert(
|
||||
@@ -348,6 +359,7 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
sal_Bool bHasDateModified = sal_False;
|
||||
sal_Bool bHasMediaType = sal_False;
|
||||
sal_Bool bHasSize = sal_False;
|
||||
sal_Bool bHasCreatableInfos = sal_False;
|
||||
|
||||
{
|
||||
std::set< rtl::OUString >::const_iterator it = aPropSet.begin();
|
||||
@@ -428,7 +440,13 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
{
|
||||
bHasSize = sal_True;
|
||||
}
|
||||
|
||||
else if ( !bHasCreatableInfos &&
|
||||
(*it).equalsAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM(
|
||||
"CreatableContentsInfo" ) ) )
|
||||
{
|
||||
bHasCreatableInfos = sal_True;
|
||||
}
|
||||
it++;
|
||||
}
|
||||
}
|
||||
@@ -478,6 +496,11 @@ uno::Sequence< beans::Property > Content::getProperties(
|
||||
aPropSet.insert(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) ) );
|
||||
|
||||
if ( !bHasCreatableInfos )
|
||||
aPropSet.insert(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
||||
"CreatableContentsInfo" ) ) );
|
||||
|
||||
// Add cached properties, if present and still missing.
|
||||
if ( xCachedProps.get() )
|
||||
{
|
||||
@@ -602,7 +625,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
|
||||
sal_Bool bSupportsLocking = supportsExclusiveWriteLock( xEnv );
|
||||
|
||||
sal_Int32 nPos = aCmdInfo.getLength();
|
||||
sal_Int32 nMoreCmds = ( bFolder ? 1 : 0 ) + ( bSupportsLocking ? 2 : 0 );
|
||||
sal_Int32 nMoreCmds = ( bFolder ? 2 : 0 ) + ( bSupportsLocking ? 2 : 0 );
|
||||
if ( nMoreCmds )
|
||||
aCmdInfo.realloc( nPos + nMoreCmds );
|
||||
else
|
||||
@@ -620,6 +643,13 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
|
||||
-1,
|
||||
getCppuType( static_cast< ucb::TransferInfo * >( 0 ) ) );
|
||||
nPos++;
|
||||
aCmdInfo[ nPos ] =
|
||||
ucb::CommandInfo(
|
||||
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
||||
"createNewContent" ) ),
|
||||
-1,
|
||||
getCppuType( static_cast< ucb::ContentInfo * >( 0 ) ) );
|
||||
nPos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user