summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorCao Cuong Ngo <cao.cuong.ngo@gmail.com>2013-09-12 15:27:37 +0200
committerBosdonnat Cedric <cedric.bosdonnat@free.fr>2013-09-23 12:56:09 +0000
commitb61970cfbe12722efd6218db6489980381b8783d (patch)
treefec47f16c02a2b3732561466c783a7e96b7c4a4e /ucb
parent0618b35ebda29b911058254cd34620e8b24ab8f7 (diff)
Cmis Versions dialog
Change-Id: Ie863282062a6932a55543143e841917c54223ac9 Reviewed-on: https://gerrit.libreoffice.org/5925 Reviewed-by: Bosdonnat Cedric <cedric.bosdonnat@free.fr> Tested-by: Bosdonnat Cedric <cedric.bosdonnat@free.fr>
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx47
-rw-r--r--ucb/source/ucp/cmis/cmis_content.hxx5
2 files changed, 52 insertions, 0 deletions
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 43f8c35afc04..4bc7c3c6fc7c 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -1054,6 +1054,46 @@ namespace cmis
return aRet;
}
+ uno::Sequence< document::CmisVersion> Content::getAllVersions( const uno::Reference< ucb::XCommandEnvironment > & xEnv )
+ throw( uno::Exception )
+ {
+ try
+ {
+ // get the document
+ libcmis::DocumentPtr pDoc = boost::dynamic_pointer_cast< libcmis::Document >( getObject( xEnv ) );
+ if ( pDoc.get( ) == NULL )
+ {
+ ucbhelper::cancelCommandExecution(
+ ucb::IOErrorCode_GENERAL,
+ uno::Sequence< uno::Any >( 0 ),
+ xEnv,
+ "Can not get the document" );
+ }
+ vector< libcmis::DocumentPtr > aCmisVersions = pDoc->getAllVersions( );
+ uno::Sequence< document::CmisVersion > aVersions( aCmisVersions.size( ) );
+ int i = 0;
+ for ( vector< libcmis::DocumentPtr >::iterator it = aCmisVersions.begin();
+ it != aCmisVersions.end( ); ++it, ++i )
+ {
+ libcmis::DocumentPtr pVersion = *it;
+ aVersions[i].Id = STD_TO_OUSTR( pVersion->getId( ) );
+ aVersions[i].Author = STD_TO_OUSTR( pVersion->getCreatedBy( ) );
+ aVersions[i].TimeStamp = lcl_boostToUnoTime( pVersion->getCreationDate( ) );
+ }
+ return aVersions;
+ }
+ catch ( const libcmis::Exception& e )
+ {
+ SAL_INFO( "ucb.ucp.cmis", "Unexpected libcmis exception: " << e.what( ) );
+ ucbhelper::cancelCommandExecution(
+ ucb::IOErrorCode_GENERAL,
+ uno::Sequence< uno::Any >( 0 ),
+ xEnv,
+ OUString::createFromAscii( e.what() ) );
+ }
+ return uno::Sequence< document::CmisVersion > ( );
+ }
+
void Content::transfer( const ucb::TransferInfo& rTransferInfo,
const uno::Reference< ucb::XCommandEnvironment > & xEnv )
throw( uno::Exception )
@@ -1472,6 +1512,9 @@ namespace cmis
ucb::CommandInfo ( OUString( "checkIn" ), -1,
getCppuType( static_cast<ucb::TransferInfo * >( 0 ) ) ),
ucb::CommandInfo ( OUString( "updateProperties" ), -1, getCppuVoidType() ),
+ ucb::CommandInfo
+ ( OUString( "getAllVersions" ),
+ -1, getCppuType( static_cast<uno::Sequence< document::CmisVersion > * >( 0 ) ) ),
// Folder Only, omitted if not a folder
@@ -1645,6 +1688,10 @@ namespace cmis
}
aRet <<= checkIn( aArg, xEnv );
}
+ else if ( aCommand.Name == "getAllVersions" )
+ {
+ aRet <<= getAllVersions( xEnv );
+ }
else if ( aCommand.Name == "updateProperties" )
{
updateProperties( aCommand.Argument, xEnv );
diff --git a/ucb/source/ucp/cmis/cmis_content.hxx b/ucb/source/ucp/cmis/cmis_content.hxx
index a3dd3beac80e..d34c03b7cb5b 100644
--- a/ucb/source/ucp/cmis/cmis_content.hxx
+++ b/ucb/source/ucp/cmis/cmis_content.hxx
@@ -20,6 +20,7 @@
#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
#include <com/sun/star/ucb/TransferInfo.hpp>
#include <com/sun/star/ucb/XContentCreator.hpp>
+#include <com/sun/star/document/CmisVersion.hpp>
#include <ucbhelper/contenthelper.hxx>
#include <libcmis/libcmis.hxx>
@@ -118,6 +119,10 @@ private:
const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment >& xEnv );
+ com::sun::star::uno::Sequence< com::sun::star::document::CmisVersion >
+ getAllVersions( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw( com::sun::star::uno::Exception );
+
sal_Bool feedSink( com::sun::star::uno::Reference< com::sun::star::uno::XInterface> aSink,
const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );