diff options
Diffstat (limited to 'ucb/source/ucp/gio/gio_content.cxx')
-rw-r--r-- | ucb/source/ucp/gio/gio_content.cxx | 196 |
1 files changed, 115 insertions, 81 deletions
diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx index fa6d8f74c8..6e214308ae 100644 --- a/ucb/source/ucp/gio/gio_content.cxx +++ b/ucb/source/ucp/gio/gio_content.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -151,8 +151,8 @@ void SAL_CALL Content::abort( sal_Int32 /*CommandId*/ ) rtl::OUString SAL_CALL Content::getContentType() throw( uno::RuntimeException ) { - return isFolder(uno::Reference< ucb::XCommandEnvironment >()) - ? rtl::OUString::createFromAscii( GIO_FOLDER_TYPE ) + return isFolder(uno::Reference< ucb::XCommandEnvironment >()) + ? rtl::OUString::createFromAscii( GIO_FOLDER_TYPE ) : rtl::OUString::createFromAscii( GIO_FILE_TYPE ); } @@ -183,17 +183,17 @@ uno::Any convertToException(GError *pError, const uno::Reference< uno::XInterfac EXCEPT(aExcept); } break; case G_IO_ERROR_NOT_MOUNTED: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, + { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, ucb::IOErrorCode_NOT_EXISTING_PATH, aArgs); EXCEPT(aExcept); } break; case G_IO_ERROR_NOT_FOUND: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, + { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, ucb::IOErrorCode_NOT_EXISTING, aArgs); EXCEPT(aExcept); } break; case G_IO_ERROR_EXISTS: - { ucb::NameClashException aExcept(sMessage, rContext, + { ucb::NameClashException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, sName); EXCEPT(aExcept); } break; @@ -202,32 +202,32 @@ uno::Any convertToException(GError *pError, const uno::Reference< uno::XInterfac EXCEPT(aExcept); } break; case G_IO_ERROR_PERMISSION_DENIED: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, + { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, ucb::IOErrorCode_ACCESS_DENIED, aArgs); EXCEPT(aExcept); } break; case G_IO_ERROR_IS_DIRECTORY: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, + { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, ucb::IOErrorCode_NO_FILE, aArgs); EXCEPT(aExcept); } break; case G_IO_ERROR_NOT_REGULAR_FILE: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, + { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, ucb::IOErrorCode_NO_FILE, aArgs); EXCEPT(aExcept); } break; case G_IO_ERROR_NOT_DIRECTORY: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, + { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, ucb::IOErrorCode_NO_DIRECTORY, aArgs); EXCEPT(aExcept); } break; case G_IO_ERROR_FILENAME_TOO_LONG: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, + { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, ucb::IOErrorCode_NAME_TOO_LONG, aArgs); EXCEPT(aExcept); } break; case G_IO_ERROR_PENDING: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, + { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, ucb::IOErrorCode_PENDING, aArgs); EXCEPT(aExcept); } break; @@ -235,50 +235,50 @@ uno::Any convertToException(GError *pError, const uno::Reference< uno::XInterfac case G_IO_ERROR_CANCELLED: case G_IO_ERROR_TOO_MANY_LINKS: case G_IO_ERROR_WRONG_ETAG: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, + { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, ucb::IOErrorCode_GENERAL, aArgs); EXCEPT(aExcept); } break; case G_IO_ERROR_NOT_SUPPORTED: case G_IO_ERROR_CANT_CREATE_BACKUP: case G_IO_ERROR_WOULD_MERGE: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, + { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, ucb::IOErrorCode_NOT_SUPPORTED, aArgs); EXCEPT(aExcept); } break; case G_IO_ERROR_NO_SPACE: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, + { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, ucb::IOErrorCode_OUT_OF_DISK_SPACE, aArgs); EXCEPT(aExcept); } break; case G_IO_ERROR_INVALID_FILENAME: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, + { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, ucb::IOErrorCode_INVALID_CHARACTER, aArgs); EXCEPT(aExcept); } break; case G_IO_ERROR_READ_ONLY: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, + { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, ucb::IOErrorCode_WRITE_PROTECTED, aArgs); EXCEPT(aExcept); } break; case G_IO_ERROR_TIMED_OUT: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, + { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, ucb::IOErrorCode_DEVICE_NOT_READY, aArgs); EXCEPT(aExcept); } break; case G_IO_ERROR_WOULD_RECURSE: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, + { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, ucb::IOErrorCode_RECURSIVE, aArgs); EXCEPT(aExcept); } break; case G_IO_ERROR_BUSY: case G_IO_ERROR_WOULD_BLOCK: - { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, + { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, ucb::IOErrorCode_LOCKING_VIOLATION, aArgs); EXCEPT(aExcept); } break; case G_IO_ERROR_HOST_NOT_FOUND: - { ucb::InteractiveNetworkResolveNameException aExcept(sMessage, rContext, + { ucb::InteractiveNetworkResolveNameException aExcept(sMessage, rContext, task::InteractionClassification_ERROR, sHost); EXCEPT(aExcept);} break; @@ -288,7 +288,7 @@ uno::Any convertToException(GError *pError, const uno::Reference< uno::XInterfac case G_IO_ERROR_NOT_SYMBOLIC_LINK: case G_IO_ERROR_NOT_MOUNTABLE_FILE: case G_IO_ERROR_FAILED_HANDLED: - { ucb::InteractiveNetworkGeneralException aExcept(sMessage, rContext, + { ucb::InteractiveNetworkGeneralException aExcept(sMessage, rContext, task::InteractionClassification_ERROR); EXCEPT(aExcept);} break; @@ -306,7 +306,7 @@ uno::Any Content::mapGIOError( GError *pError ) uno::Any Content::getBadArgExcept() { - return uno::makeAny( lang::IllegalArgumentException( + return uno::makeAny( lang::IllegalArgumentException( rtl::OUString::createFromAscii( "Wrong argument type!" ), static_cast< cppu::OWeakObject * >( this ), -1) ); } @@ -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 ); @@ -419,7 +420,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValuesFromGFileInfo(GFileInfo * if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) ) { if (g_file_info_has_attribute(pInfo, G_FILE_ATTRIBUTE_STANDARD_TYPE)) - xRow->appendBoolean( rProp, ( g_file_info_get_file_type( pInfo ) == G_FILE_TYPE_REGULAR || + xRow->appendBoolean( rProp, ( g_file_info_get_file_type( pInfo ) == G_FILE_TYPE_REGULAR || g_file_info_get_file_type( pInfo ) == G_FILE_TYPE_UNKNOWN ) ); else xRow->appendVoid( rProp ); @@ -457,7 +458,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValuesFromGFileInfo(GFileInfo * } else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DateModified" ) ) ) { - if( g_file_info_has_attribute( pInfo, G_FILE_ATTRIBUTE_TIME_CHANGED ) ) + if( g_file_info_has_attribute( pInfo, G_FILE_ATTRIBUTE_TIME_CHANGED ) ) xRow->appendTimestamp( rProp, getDateFromUnix(g_file_info_get_attribute_uint64(pInfo, G_FILE_ATTRIBUTE_TIME_CHANGED)) ); else xRow->appendVoid( rProp ); @@ -499,10 +500,14 @@ 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 { - fprintf(stderr, "Looking for unsupported property %s\n", + fprintf(stderr, "Looking for unsupported property %s\n", rtl::OUStringToOString(rProp.Name, RTL_TEXTENCODING_UTF8).getStr()); } #endif @@ -520,10 +525,10 @@ 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 +static lang::IllegalAccessException getReadOnlyException( const uno::Reference< uno::XInterface >& rContext ) { return lang::IllegalAccessException ( rtl::OUString::createFromAscii( "Property is read-only!" ), rContext ); @@ -607,10 +612,10 @@ sal_Bool Content::exchangeIdentity( const uno::Reference< ucb::XContentIdentifie uno::Reference< ucb::XContentIdentifier > xNewChildId = new ::ucbhelper::ContentIdentifier( m_xSMgr, aNewChildURL ); - + if ( !xChild->exchangeIdentity( xNewChildId ) ) return sal_False; - + ++it; } return sal_True; @@ -650,7 +655,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( sal_Int32 nChanged = 0, nTitlePos = -1; const char *newName = NULL; uno::Sequence< beans::PropertyChangeEvent > aChanges(nCount); - + uno::Sequence< uno::Any > aRet( nCount ); const beans::PropertyValue* pValues = rValues.getConstArray(); for ( sal_Int32 n = 0; n < nCount; ++n ) @@ -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) ); } @@ -703,9 +709,9 @@ uno::Sequence< uno::Any > Content::setPropertyValues( aEvent.NewValue = uno::makeAny(aNewTitle); aChanges.getArray()[ nChanged ] = aEvent; nTitlePos = nChanged++; - + g_file_info_set_name(pNewInfo, newName); - } + } } else { @@ -737,7 +743,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( aNewURL += rtl::OUString( newName, strlen(newName), RTL_TEXTENCODING_UTF8 ); uno::Reference< ucb::XContentIdentifier > xNewId = new ::ucbhelper::ContentIdentifier( m_xSMgr, aNewURL ); - + if (!exchangeIdentity( xNewId ) ) { aRet[ nTitlePos ] <<= uno::Exception @@ -808,7 +814,7 @@ sal_Bool Content::feedSink( uno::Reference< uno::XInterface > xSink, uno::Reference< io::XOutputStream > xOut = uno::Reference< io::XOutputStream >(xSink, uno::UNO_QUERY ); uno::Reference< io::XActiveDataSink > xDataSink = uno::Reference< io::XActiveDataSink >(xSink, uno::UNO_QUERY ); - + if ( !xOut.is() && !xDataSink.is() ) return sal_False; @@ -820,7 +826,7 @@ sal_Bool Content::feedSink( uno::Reference< uno::XInterface > xSink, uno::Reference< io::XInputStream > xIn = new ::gio::InputStream(pStream); if ( !xIn.is() ) return sal_False; - + if ( xOut.is() ) copyData( xIn, xOut ); @@ -840,9 +846,9 @@ uno::Any Content::open(const ucb::OpenCommandArgument2 & rOpenCommand, { uno::Sequence< uno::Any > aArgs( 1 ); aArgs[ 0 ] <<= m_xIdentifier->getContentIdentifier(); - uno::Any aErr = uno::makeAny( + uno::Any aErr = uno::makeAny( ucb::InteractiveAugmentedIOException(rtl::OUString(), static_cast< cppu::OWeakObject * >( this ), - task::InteractionClassification_ERROR, + task::InteractionClassification_ERROR, bIsFolder ? ucb::IOErrorCode_NOT_EXISTING_PATH : ucb::IOErrorCode_NOT_EXISTING, aArgs) ); @@ -867,12 +873,12 @@ uno::Any Content::open(const ucb::OpenCommandArgument2 & rOpenCommand, { if ( ( rOpenCommand.Mode == ucb::OpenMode::DOCUMENT_SHARE_DENY_NONE ) || - ( rOpenCommand.Mode == ucb::OpenMode::DOCUMENT_SHARE_DENY_WRITE ) + ( rOpenCommand.Mode == ucb::OpenMode::DOCUMENT_SHARE_DENY_WRITE ) ) { - ucbhelper::cancelCommandExecution( - uno::makeAny ( ucb::UnsupportedOpenModeException - ( rtl::OUString(), static_cast< cppu::OWeakObject * >( this ), + ucbhelper::cancelCommandExecution( + uno::makeAny ( ucb::UnsupportedOpenModeException + ( rtl::OUString(), static_cast< cppu::OWeakObject * >( this ), sal_Int16( rOpenCommand.Mode ) ) ), xEnv ); } @@ -883,7 +889,7 @@ uno::Any Content::open(const ucb::OpenCommandArgument2 & rOpenCommand, // implementation. Support for this type of // sink is optional... #ifdef DEBUG - g_warning ("Failed to load data from '%s'", + g_warning ("Failed to load data from '%s'", rtl::OUStringToOString(m_xIdentifier->getContentIdentifier(), RTL_TEXTENCODING_UTF8).getStr()); #endif @@ -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; @@ -996,10 +1010,10 @@ void Content::destroy( sal_Bool bDeletePhysical ) ::gio::Content::ContentRefList aChildren; queryChildren( aChildren ); - + ContentRefList::const_iterator it = aChildren.begin(); ContentRefList::const_iterator end = aChildren.end(); - + while ( it != end ) { (*it)->destroy( bDeletePhysical ); @@ -1055,7 +1069,7 @@ void Content::insert(const uno::Reference< io::XInputStream > &xInputStream, } } -void Content::transfer( const ucb::TransferInfo& aTransferInfo, const uno::Reference< ucb::XCommandEnvironment >& xEnv ) +void Content::transfer( const ucb::TransferInfo& aTransferInfo, const uno::Reference< ucb::XCommandEnvironment >& xEnv ) throw( uno::Exception ) { rtl::OUString sDest = m_xIdentifier->getContentIdentifier(); @@ -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 ) +{ + 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 ); + + // 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; + + return seq; + } + else + { + return uno::Sequence< ucb::ContentInfo >(); + } +} + +uno::Sequence< ucb::ContentInfo > SAL_CALL Content::queryCreatableContentsInfo() + throw( uno::RuntimeException ) { - 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 ); - - // 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; - - return seq; + return queryCreatableContentsInfo( uno::Reference< ucb::XCommandEnvironment >() ); } -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::Reference< ucb::XContent > + SAL_CALL Content::createNewContent( const ucb::ContentInfo& Info ) + throw( uno::RuntimeException ) { bool create_document; const char *name; @@ -1120,7 +1148,7 @@ com::sun::star::uno::Reference< com::sun::star::ucb::XContent > else { #ifdef DEBUG - g_warning( "Failed to create new content '%s'", rtl::OUStringToOString(Info.Type, + g_warning( "Failed to create new content '%s'", rtl::OUStringToOString(Info.Type, RTL_TEXTENCODING_UTF8).getStr() ); #endif return uno::Reference< ucb::XContent >(); @@ -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 ); |