[Libreoffice-commits] .: ucb/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Fri Jun 29 05:26:32 PDT 2012


 ucb/source/ucp/cmis/cmis_content.cxx |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 5e67fb190be69b40ce24a36540031d07c691db07
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Fri Jun 29 13:06:21 2012 +0200

    UCP CMIS: avoid breaking the media type when saving a document
    
    Change-Id: Iab7f932c25f66734994dfa44a09fc1d9f511ad11

diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 6c41521..43cb682 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);


More information about the Libreoffice-commits mailing list