diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-06-29 13:06:21 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-06-29 14:21:48 +0200 |
commit | 5e67fb190be69b40ce24a36540031d07c691db07 (patch) | |
tree | bf7618078fb8a961f3640d7568bbb957f25566ab /ucb/source | |
parent | 22d9af36bf1716607272b25513349b3d325a3ebf (diff) |
UCP CMIS: avoid breaking the media type when saving a document
Change-Id: Iab7f932c25f66734994dfa44a09fc1d9f511ad11
Diffstat (limited to 'ucb/source')
-rw-r--r-- | ucb/source/ucp/cmis/cmis_content.cxx | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index 6c4152149abb..43cb6829dd50 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -405,6 +405,21 @@ namespace cmis { xRow->appendObject( rProp, uno::makeAny( queryCreatableContentsInfo( xEnv ) ) ); } + else if ( rProp.Name == "MediaType" ) + { + try + { + libcmis::Document* document = dynamic_cast< libcmis::Document* >( getObject().get( ) ); + if ( NULL != document ) + xRow->appendString( rProp, STD_TO_OUSTR( document->getContentType() ) ); + else + xRow->appendVoid( rProp ); + } + catch ( const libcmis::Exception& ) + { + xRow->appendVoid( rProp ); + } + } else SAL_INFO( "cmisucp", "Looking for unsupported property " << rProp.Name ); } @@ -601,10 +616,11 @@ namespace cmis libcmis::Document* document = dynamic_cast< libcmis::Document* >( object.get( ) ); if ( NULL != document ) { + string sMime = document->getContentType( ); boost::shared_ptr< ostream > pOut( new ostringstream ( ios_base::binary | ios_base::in | ios_base::out ) ); uno::Reference < io::XOutputStream > xOutput = new ucbhelper::StdOutputStream( pOut ); copyData( xInputStream, xOutput ); - document->setContentStream( pOut, string( ), bReplaceExisting ); + document->setContentStream( pOut, sMime, bReplaceExisting ); } } else @@ -837,6 +853,9 @@ namespace cmis beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CreatableContentsInfo" ) ), -1, getCppuType( static_cast< const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ), + beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ), + -1, getCppuType( static_cast< const rtl::OUString * >( 0 ) ), + beans::PropertyAttribute::BOUND ), }; const int nProps = SAL_N_ELEMENTS(aGenericProperties); |