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:26:38 +0200 |
commit | f5c45d91032d1f9e6783a15bd89c36a4a9841742 (patch) | |
tree | a7ff63f27490af689314dfbd77170878861dbcd8 /ucb | |
parent | a64ea3c1ab202f5941f1bbe803f8673ec81a221f (diff) |
UCP CMIS: avoid breaking the media type when saving a document
Change-Id: Iab7f932c25f66734994dfa44a09fc1d9f511ad11
Diffstat (limited to 'ucb')
-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); |