summaryrefslogtreecommitdiff
path: root/ucbhelper
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-10-30 11:06:18 +0100
committerCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-10-31 12:03:30 +0100
commit1a9261124eed5baa04b069a1cb1b51f24423ec9b (patch)
tree1cb64575ef26bb2790e73b51371eff869f44cc13 /ucbhelper
parent1eb7a921641107cdd802e8bbc6117d6f303f73f5 (diff)
CMIS: added cancelCheckOut and checkIn implementations and menu items
Although the implementation is here, the dialogs to show when clicking on the menu items aren't there yet. Change-Id: I14886ec8ea8b97a35ca6c8474bc33e30da1a86d3
Diffstat (limited to 'ucbhelper')
-rw-r--r--ucbhelper/inc/ucbhelper/content.hxx13
-rw-r--r--ucbhelper/source/client/content.cxx47
2 files changed, 46 insertions, 14 deletions
diff --git a/ucbhelper/inc/ucbhelper/content.hxx b/ucbhelper/inc/ucbhelper/content.hxx
index 259c77292492..16b186c37427 100644
--- a/ucbhelper/inc/ucbhelper/content.hxx
+++ b/ucbhelper/inc/ucbhelper/content.hxx
@@ -81,7 +81,8 @@ enum InsertOperation
{
InsertOperation_COPY, // copy source data
InsertOperation_MOVE, // move source data
- InsertOperation_LINK // create a link to source
+ InsertOperation_LINK, // create a link to source
+ InsertOperation_CHECKIN // check-in source data
};
//=========================================================================
@@ -664,13 +665,21 @@ public:
* will overwrite the clashing content and all its data,
* NameClash::RENAME will generate and supply a non-clashing title.
* @see com/sun/star/ucb/NameClash.idl
+ * @param rMimeType contains the MIME type of the document to write.
+ * @param bMajorVersion tells to create a new major version for checkin operations
+ * @param rCommentVersion contains the comment to use for checkin operations
+ * @param rResultURL is a hacky way to get the update URL after the operation in
+ * case there was a change (introduced for the checkin operation)
*/
sal_Bool
transferContent( const Content& rSourceContent,
InsertOperation eOperation,
const ::rtl::OUString & rTitle,
const sal_Int32 nNameClashAction,
- const ::rtl::OUString & rMimeType = ::rtl::OUString( ) )
+ const ::rtl::OUString & rMimeType = ::rtl::OUString( ),
+ bool bMajorVersion = false,
+ const ::rtl::OUString & rCommentVersion = ::rtl::OUString( ),
+ ::rtl::OUString* pResultURL = NULL )
throw( ::com::sun::star::ucb::CommandAbortedException,
::com::sun::star::uno::RuntimeException,
::com::sun::star::uno::Exception );
diff --git a/ucbhelper/source/client/content.cxx b/ucbhelper/source/client/content.cxx
index 22c9b31269f1..95e589ff8d96 100644
--- a/ucbhelper/source/client/content.cxx
+++ b/ucbhelper/source/client/content.cxx
@@ -27,6 +27,7 @@
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/ucb/CheckinArgument.hpp>
#include <com/sun/star/ucb/ContentCreationError.hpp>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/ucb/XCommandInfo.hpp>
@@ -962,7 +963,10 @@ sal_Bool Content::transferContent( const Content& rSourceContent,
InsertOperation eOperation,
const rtl::OUString & rTitle,
const sal_Int32 nNameClashAction,
- const rtl::OUString & rMimeType )
+ const rtl::OUString & rMimeType,
+ bool bMajorVersion,
+ const rtl::OUString & rVersionComment,
+ rtl::OUString* pResultURL )
throw( CommandAbortedException, RuntimeException, Exception )
{
Reference< XUniversalContentBroker > pBroker(
@@ -971,6 +975,8 @@ sal_Bool Content::transferContent( const Content& rSourceContent,
// Execute command "globalTransfer" at UCB.
TransferCommandOperation eTransOp = TransferCommandOperation();
+ rtl::OUString sCommand( "globalTransfer" );
+ bool bCheckIn = false;
switch ( eOperation )
{
case InsertOperation_COPY:
@@ -985,6 +991,12 @@ sal_Bool Content::transferContent( const Content& rSourceContent,
eTransOp = TransferCommandOperation_LINK;
break;
+ case InsertOperation_CHECKIN:
+ eTransOp = TransferCommandOperation_COPY;
+ sCommand = rtl::OUString( "checkin" );
+ bCheckIn = true;
+ break;
+
default:
ucbhelper::cancelCommandExecution(
makeAny( IllegalArgumentException(
@@ -995,20 +1007,31 @@ sal_Bool Content::transferContent( const Content& rSourceContent,
m_xImpl->getEnvironment() );
// Unreachable
}
-
- GlobalTransferCommandArgument2 aTransferArg(
- eTransOp,
- rSourceContent.getURL(), // SourceURL
- getURL(), // TargetFolderURL,
- rTitle,
- nNameClashAction,
- rMimeType );
Command aCommand;
- aCommand.Name = rtl::OUString("globalTransfer");
+ aCommand.Name = sCommand;
aCommand.Handle = -1; // n/a
- aCommand.Argument <<= aTransferArg;
- pBroker->execute( aCommand, 0, m_xImpl->getEnvironment() );
+ if ( !bCheckIn )
+ {
+ GlobalTransferCommandArgument2 aTransferArg(
+ eTransOp,
+ rSourceContent.getURL(), // SourceURL
+ getURL(), // TargetFolderURL,
+ rTitle,
+ nNameClashAction,
+ rMimeType );
+ aCommand.Argument <<= aTransferArg;
+ }
+ else
+ {
+ CheckinArgument aCheckinArg( bMajorVersion, rVersionComment,
+ rSourceContent.getURL(), getURL(), rTitle, rMimeType );
+ aCommand.Argument <<= aCheckinArg;
+ }
+
+ Any aRet = pBroker->execute( aCommand, 0, m_xImpl->getEnvironment() );
+ if ( pResultURL != NULL )
+ aRet >>= *pResultURL;
return sal_True;
}