summaryrefslogtreecommitdiff
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
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
-rw-r--r--basctl/uiconfig/basicide/menubar/menubar.xml2
-rw-r--r--chart2/uiconfig/menubar/menubar.xml2
-rw-r--r--dbaccess/uiconfig/dbapp/menubar/menubar.xml2
-rw-r--r--dbaccess/uiconfig/dbquery/menubar/menubar.xml2
-rw-r--r--dbaccess/uiconfig/dbrelation/menubar/menubar.xml2
-rw-r--r--dbaccess/uiconfig/dbtable/menubar/menubar.xml2
-rw-r--r--dbaccess/uiconfig/dbtdata/menubar/menubar.xml2
-rw-r--r--extensions/source/bibliography/uiconfig/sbibliography/menubar/menubar.xml2
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/document/XCmisDocument.idl16
-rw-r--r--offapi/com/sun/star/ucb/CheckinArgument.idl60
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu10
-rw-r--r--sc/uiconfig/scalc/menubar/menubar.xml2
-rw-r--r--sd/uiconfig/sdraw/menubar/menubar.xml4
-rw-r--r--sd/uiconfig/simpress/menubar/menubar.xml2
-rw-r--r--sfx2/inc/sfx2/docfile.hxx2
-rw-r--r--sfx2/inc/sfx2/objsh.hxx2
-rw-r--r--sfx2/inc/sfx2/sfxbasecontroller.hxx2
-rw-r--r--sfx2/inc/sfx2/sfxbasemodel.hxx8
-rw-r--r--sfx2/inc/sfx2/sfxcommands.h2
-rw-r--r--sfx2/inc/sfx2/sfxsids.hrc3
-rw-r--r--sfx2/sdi/docslots.sdi10
-rw-r--r--sfx2/sdi/sfx.sdi48
-rw-r--r--sfx2/source/appl/appuno.cxx3
-rw-r--r--sfx2/source/doc/docfile.cxx60
-rw-r--r--sfx2/source/doc/objserv.cxx78
-rw-r--r--sfx2/source/doc/objstor.cxx22
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx138
-rw-r--r--sfx2/source/view/sfxbasecontroller.cxx2
-rw-r--r--starmath/uiconfig/smath/menubar/menubar.xml4
-rw-r--r--sw/uiconfig/sglobal/menubar/menubar.xml2
-rw-r--r--sw/uiconfig/sweb/menubar/menubar.xml2
-rw-r--r--sw/uiconfig/swform/menubar/menubar.xml2
-rw-r--r--sw/uiconfig/swreport/menubar/menubar.xml2
-rw-r--r--sw/uiconfig/swriter/menubar/menubar.xml2
-rw-r--r--sw/uiconfig/swxform/menubar/menubar.xml2
-rw-r--r--ucb/source/core/ucb.cxx15
-rw-r--r--ucb/source/core/ucb.hxx5
-rw-r--r--ucb/source/core/ucbcmds.cxx93
-rw-r--r--ucb/source/core/ucbcmds.hxx3
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx288
-rw-r--r--ucb/source/ucp/cmis/cmis_content.hxx11
-rw-r--r--ucbhelper/inc/ucbhelper/content.hxx13
-rw-r--r--ucbhelper/source/client/content.cxx47
44 files changed, 900 insertions, 82 deletions
diff --git a/basctl/uiconfig/basicide/menubar/menubar.xml b/basctl/uiconfig/basicide/menubar/menubar.xml
index 58a453cfda51..886909d66af9 100644
--- a/basctl/uiconfig/basicide/menubar/menubar.xml
+++ b/basctl/uiconfig/basicide/menubar/menubar.xml
@@ -30,6 +30,8 @@
<menu:menuitem menu:id=".uno:SaveAs"/>
<menu:menuitem menu:id=".uno:SaveAll"/>
<menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menu menu:id=".uno:TemplateMenu">
<menu:menupopup>
<menu:menuitem menu:id=".uno:Organizer"/>
diff --git a/chart2/uiconfig/menubar/menubar.xml b/chart2/uiconfig/menubar/menubar.xml
index 3d0e33bdd6c2..311a60b6b177 100644
--- a/chart2/uiconfig/menubar/menubar.xml
+++ b/chart2/uiconfig/menubar/menubar.xml
@@ -28,6 +28,8 @@
<menu:menuitem menu:id=".uno:SaveAs" menu:helpid="5502" menu:label="" />
<menu:menuitem menu:id=".uno:SaveAll" menu:helpid="5309" menu:label="" />
<menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menuitem menu:id=".uno:Reload" menu:helpid="5508" menu:label="" />
<menu:menuitem menu:id=".uno:VersionDialog" menu:helpid="6583" menu:label="" />
<menu:menuitem menu:id=".uno:SendMail" menu:helpid="5331" menu:label="" />
diff --git a/dbaccess/uiconfig/dbapp/menubar/menubar.xml b/dbaccess/uiconfig/dbapp/menubar/menubar.xml
index 9c65ce8dfb62..1ddbe5a2c73b 100644
--- a/dbaccess/uiconfig/dbapp/menubar/menubar.xml
+++ b/dbaccess/uiconfig/dbapp/menubar/menubar.xml
@@ -30,6 +30,8 @@
<menu:menuitem menu:id=".uno:SaveAs"/>
<menu:menuitem menu:id=".uno:SaveAll"/>
<menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:ExportTo"/>
<menu:menu menu:id=".uno:SendToMenu">
diff --git a/dbaccess/uiconfig/dbquery/menubar/menubar.xml b/dbaccess/uiconfig/dbquery/menubar/menubar.xml
index 4b605eab96fc..dd84ef30e99a 100644
--- a/dbaccess/uiconfig/dbquery/menubar/menubar.xml
+++ b/dbaccess/uiconfig/dbquery/menubar/menubar.xml
@@ -28,6 +28,8 @@
<menu:menuitem menu:id=".uno:Save"/>
<menu:menuitem menu:id=".uno:SaveAs"/>
<menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:Quit"/>
</menu:menupopup>
diff --git a/dbaccess/uiconfig/dbrelation/menubar/menubar.xml b/dbaccess/uiconfig/dbrelation/menubar/menubar.xml
index 1d5e0a394b82..f4a9ffc1e493 100644
--- a/dbaccess/uiconfig/dbrelation/menubar/menubar.xml
+++ b/dbaccess/uiconfig/dbrelation/menubar/menubar.xml
@@ -27,6 +27,8 @@
<menu:menuitem menu:id=".uno:SaveAll"/>
<menu:menuitem menu:id=".uno:Save"/>
<menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:Quit"/>
</menu:menupopup>
diff --git a/dbaccess/uiconfig/dbtable/menubar/menubar.xml b/dbaccess/uiconfig/dbtable/menubar/menubar.xml
index 496664da758e..63982adf15f0 100644
--- a/dbaccess/uiconfig/dbtable/menubar/menubar.xml
+++ b/dbaccess/uiconfig/dbtable/menubar/menubar.xml
@@ -28,6 +28,8 @@
<menu:menuitem menu:id=".uno:Save"/>
<menu:menuitem menu:id=".uno:SaveAs"/>
<menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:Quit"/>
</menu:menupopup>
diff --git a/dbaccess/uiconfig/dbtdata/menubar/menubar.xml b/dbaccess/uiconfig/dbtdata/menubar/menubar.xml
index e22b66ab7df3..95c327e9c900 100644
--- a/dbaccess/uiconfig/dbtdata/menubar/menubar.xml
+++ b/dbaccess/uiconfig/dbtdata/menubar/menubar.xml
@@ -28,6 +28,8 @@
<menu:menuitem menu:id=".uno:Save"/>
<menu:menuitem menu:id=".uno:SaveAs"/>
<menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:Quit"/>
</menu:menupopup>
diff --git a/extensions/source/bibliography/uiconfig/sbibliography/menubar/menubar.xml b/extensions/source/bibliography/uiconfig/sbibliography/menubar/menubar.xml
index 05416afd99e3..32419a7de2e6 100644
--- a/extensions/source/bibliography/uiconfig/sbibliography/menubar/menubar.xml
+++ b/extensions/source/bibliography/uiconfig/sbibliography/menubar/menubar.xml
@@ -11,6 +11,8 @@
<menu:menuitem menu:id=".uno:SaveAs"/>
<menu:menuitem menu:id=".uno:SaveAll"/>
<menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menuitem menu:id=".uno:Reload"/>
<menu:menuitem menu:id=".uno:VersionDialog"/>
<menu:menuseparator/>
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index d5a65a3c9184..7e1bc58fcea4 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -3768,6 +3768,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/ucb,\
AlreadyInitializedException \
AuthenticationRequest \
CHAOSProgressStart \
+ CheckinArgument \
CertificateValidationRequest \
Command \
CommandAbortedException \
diff --git a/offapi/com/sun/star/document/XCmisDocument.idl b/offapi/com/sun/star/document/XCmisDocument.idl
index c456808071d9..fabd69f087a0 100644
--- a/offapi/com/sun/star/document/XCmisDocument.idl
+++ b/offapi/com/sun/star/document/XCmisDocument.idl
@@ -24,10 +24,26 @@ interface XCmisDocument : com::sun::star::uno::XInterface
*/
void checkOut( );
+ /** Cancel checked out document, this will discard all changes since
+ check-out.
+ */
+ void cancelCheckOut( );
+
+ /** Creates a new version of the document from the private working
+ copy.
+ */
+ void checkIn( [in] boolean isMajor, [in] string comment );
+
/** Tells whether a document can support versioning or not.
*/
boolean isVersionable( );
+ boolean canCheckOut( );
+
+ boolean canCancelCheckOut( );
+
+ boolean canCheckIn( );
+
/** Contains the properties values named after their CMIS ID.
*/
[attribute] com::sun::star::beans::PropertyValues CmisPropertiesValues;
diff --git a/offapi/com/sun/star/ucb/CheckinArgument.idl b/offapi/com/sun/star/ucb/CheckinArgument.idl
new file mode 100644
index 000000000000..08f6822a20d2
--- /dev/null
+++ b/offapi/com/sun/star/ucb/CheckinArgument.idl
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef __com_sun_star_ucb_CheckinArgument_idl__
+#define __com_sun_star_ucb_CheckinArgument_idl__
+
+
+
+module com { module sun { module star { module ucb {
+
+/** contains information needed to checkin a document.
+
+ <p>The checkin command is always called on the target private
+ working copy document.</p>
+*/
+struct CheckinArgument
+{
+ /** Tells whether to create a new major or minor version during the
+ checkin.
+ */
+ boolean MajorVersion;
+
+ /** Contains the version comment to set during the checkin.
+ */
+ string VersionComment;
+
+ /** contains the URL of the source of the action (e.g. the URL of
+ the temporary file to checkin).
+ */
+ string SourceURL;
+
+ /** contains the URL of the private working copy to checkin.
+ */
+ string TargetURL;
+
+ /** contains the title of the transferred object, if it is different
+ from the original one.
+
+ <p>If this field is filled, for example, a file will be renamed
+ while it is being checked in.</p>
+ */
+ string NewTitle;
+
+ /** contains the Mime-Type of the content to check-in as it may be
+ different from the original one.
+ */
+ string MimeType;
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 4011c05578fc..e80fb4d8b5be 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -1901,6 +1901,16 @@
<value xml:lang="en-US">Check-Out</value>
</prop>
</node>
+ <node oor:name=".uno:CancelCheckOut" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Cancel Check-Out...</value>
+ </prop>
+ </node>
+ <node oor:name=".uno:CheckIn" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Check-In...</value>
+ </prop>
+ </node>
<node oor:name=".uno:CloseDoc" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">~Close</value>
diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml
index 490266c4caf4..901dedadf8a7 100644
--- a/sc/uiconfig/scalc/menubar/menubar.xml
+++ b/sc/uiconfig/scalc/menubar/menubar.xml
@@ -14,6 +14,8 @@
<menu:menuitem menu:id=".uno:SaveAsTemplate"/>
<menu:menuitem menu:id=".uno:SaveAll"/>
<menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:Reload"/>
<menu:menuitem menu:id=".uno:VersionDialog"/>
diff --git a/sd/uiconfig/sdraw/menubar/menubar.xml b/sd/uiconfig/sdraw/menubar/menubar.xml
index 0dbc2f6fd1c3..e23ff0c4f837 100644
--- a/sd/uiconfig/sdraw/menubar/menubar.xml
+++ b/sd/uiconfig/sdraw/menubar/menubar.xml
@@ -13,7 +13,9 @@
<menu:menuitem menu:id=".uno:SaveAs"/>
<menu:menuitem menu:id=".uno:SaveAsTemplate"/>
<menu:menuitem menu:id=".uno:SaveAll"/>
- <menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:Reload"/>
<menu:menuitem menu:id=".uno:VersionDialog"/>
diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml
index 629a7057a512..de67010ce9ff 100644
--- a/sd/uiconfig/simpress/menubar/menubar.xml
+++ b/sd/uiconfig/simpress/menubar/menubar.xml
@@ -14,6 +14,8 @@
<menu:menuitem menu:id=".uno:SaveAsTemplate"/>
<menu:menuitem menu:id=".uno:SaveAll"/>
<menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:Reload"/>
<menu:menuitem menu:id=".uno:VersionDialog"/>
diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx
index 9a134b651b8b..5ba00f65e830 100644
--- a/sfx2/inc/sfx2/docfile.hxx
+++ b/sfx2/inc/sfx2/docfile.hxx
@@ -194,6 +194,8 @@ public:
sal_Bool SwitchDocumentToFile( const rtl::OUString& aURL );
::rtl::OUString GetBaseURL( bool bForSaving=false );
+ void SetInCheckIn( bool bInCheckIn );
+ bool IsInCheckIn( );
#if _SOLAR__PRIVATE
SAL_DLLPRIVATE sal_Bool HasStorage_Impl() const;
diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx
index 88a2abe87a4b..d2a3b3d76440 100644
--- a/sfx2/inc/sfx2/objsh.hxx
+++ b/sfx2/inc/sfx2/objsh.hxx
@@ -734,6 +734,8 @@ public:
SAL_DLLPRIVATE sal_Bool QuerySaveSizeExceededModules_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
SAL_DLLPRIVATE void CheckOut( );
+ SAL_DLLPRIVATE void CancelCheckOut( );
+ SAL_DLLPRIVATE void CheckIn( );
};
#define SFX_GLOBAL_CLASSID \
diff --git a/sfx2/inc/sfx2/sfxbasecontroller.hxx b/sfx2/inc/sfx2/sfxbasecontroller.hxx
index b8daf8b24e88..4db98d5634bb 100644
--- a/sfx2/inc/sfx2/sfxbasecontroller.hxx
+++ b/sfx2/inc/sfx2/sfxbasecontroller.hxx
@@ -387,7 +387,7 @@ private:
SAL_DLLPRIVATE SfxViewFrame& GetViewFrame_Impl() const;
SAL_DLLPRIVATE void ShowInfoBars( );
- DECL_LINK( CheckOutHandler, PushButton * );
+ DECL_LINK( CheckOutHandler, void * );
//________________________________________________________________________________________________________
// private variables
diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx
index 3cabf59a7933..49e4dcae72be 100644
--- a/sfx2/inc/sfx2/sfxbasemodel.hxx
+++ b/sfx2/inc/sfx2/sfxbasemodel.hxx
@@ -1422,8 +1422,16 @@ public:
throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL checkOut( ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL cancelCheckOut( ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL checkIn( sal_Bool bIsMajor, const rtl::OUString & rMessage )
+ throw ( ::com::sun::star::uno::RuntimeException );
virtual sal_Bool SAL_CALL isVersionable( ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL canCheckOut( ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL canCancelCheckOut( ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL canCheckIn( ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ sal_Bool getBoolPropertyValue( const rtl::OUString& rName ) throw ( ::com::sun::star::uno::RuntimeException );
//____________________________________________________________________________________________________
// SfxListener
diff --git a/sfx2/inc/sfx2/sfxcommands.h b/sfx2/inc/sfx2/sfxcommands.h
index 46c7ebcac274..f054ca959d90 100644
--- a/sfx2/inc/sfx2/sfxcommands.h
+++ b/sfx2/inc/sfx2/sfxcommands.h
@@ -45,6 +45,8 @@
#define CMD_SID_DOCINFO_TITLE ".uno:DocInfoTitle"
#define CMD_SID_OPENTEMPLATE ".uno:OpenTemplate"
#define CMD_SID_CHECKOUT ".uno:CheckOut"
+#define CMD_SID_CANCELCHECKOUT ".uno:CancelCheckOut"
+#define CMD_SID_CHECKIN ".uno:CheckIn"
#define CMD_SID_OPENURL ".uno:OpenUrl"
#define CMD_SID_OPTIONS ".uno:Options"
#define CMD_SID_ORGANIZER ".uno:Organizer"
diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc
index 9586dde26c50..0998c65b53f4 100644
--- a/sfx2/inc/sfx2/sfxsids.hrc
+++ b/sfx2/inc/sfx2/sfxsids.hrc
@@ -144,6 +144,8 @@
#define SID_DIRECTEXPORTDOCASPDF (SID_SFX_START + 1674)
#define SID_UPDATEDOCMODE (SID_SFX_START + 1668)
#define SID_CHECKOUT (SID_SFX_START + 512)
+#define SID_CANCELCHECKOUT (SID_SFX_START + 513)
+#define SID_CHECKIN (SID_SFX_START + 514)
#define SID_FORCERELOAD (SID_SFX_START + 1502)
#define SID_FILE_DIALOG (SID_SFX_START + 304)
@@ -310,6 +312,7 @@
#define SID_DOCINFO_KEYWORDS (SID_SFX_START + 591)
#define SID_DOCINFO_COMMENTS (SID_SFX_START + 592)
#define SID_DOCINFO_AUTHOR (SID_SFX_START + 593)
+#define SID_DOCINFO_MAJOR (SID_SFX_START + 594)
#define SID_NEWDOCDIRECT (SID_SFX_START + 537)
#define SID_DOCFRAME (SID_SFX_START + 598)
#define SID_TARGETNAME (SID_SFX_START + 560)
diff --git a/sfx2/sdi/docslots.sdi b/sfx2/sdi/docslots.sdi
index 6ba11a83f8e0..111ba6ddf690 100644
--- a/sfx2/sdi/docslots.sdi
+++ b/sfx2/sdi/docslots.sdi
@@ -182,6 +182,16 @@ interface OfficeDocument : Document
ExecMethod = ExecFile_Impl;
StateMethod = GetState_Impl;
]
+ SID_CANCELCHECKOUT
+ [
+ ExecMethod = ExecFile_Impl;
+ StateMethod = GetState_Impl;
+ ]
+ SID_CHECKIN
+ [
+ ExecMethod = ExecFile_Impl;
+ StateMethod = GetState_Impl;
+ ]
}
//=========================================================================
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 635342a40bcc..a7468cef6a2c 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -4468,6 +4468,54 @@ SfxVoidItem CheckOut SID_CHECKOUT
GroupId = GID_DOCUMENT;
]
+SfxVoidItem CancelCheckOut SID_CANCELCHECKOUT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DOCUMENT;
+]
+
+SfxVoidItem CheckIn SID_CHECKIN
+(SfxStringItem VersionComment SID_DOCINFO_COMMENTS,SfxBoolItem VersionMajor SID_DOCINFO_MAJOR)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DOCUMENT;
+]
+
//--------------------------------------------------------------------------
SfxStringItem OpenUrl SID_OPENURL
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 36be7f935710..fa308568b59d 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -131,7 +131,8 @@ SfxFormalArgument aFormalArgs[] = {
SFX_ARGUMENT(SID_DEFAULTFILENAME,"SuggestedSaveAsName",SfxStringItem),
SFX_ARGUMENT(SID_DEFAULTFILEPATH,"SuggestedSaveAsDir",SfxStringItem),
SFX_ARGUMENT(SID_DOCINFO_AUTHOR,"VersionAuthor",SfxStringItem),
- SFX_ARGUMENT(SID_DOCINFO_COMMENTS,"VersionComment",SfxStringItem),
+ SFX_ARGUMENT(SID_DOCINFO_COMMENTS,"VersionComment",SfxBoolItem),
+ SFX_ARGUMENT(SID_DOCINFO_MAJOR,"VersionMajor",SfxStringItem),
SFX_ARGUMENT(SID_FILE_FILTEROPTIONS,"FilterOptions",SfxStringItem),
SFX_ARGUMENT(SID_FILTER_NAME,"FilterName",SfxStringItem),
// SFX_ARGUMENT(SID_FILE_NAME,"FileName",SfxStringItem),
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index e5380e73e4dd..b36a44155b79 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -262,6 +262,7 @@ public:
bool m_bTriedStorage:1;
bool m_bRemote:1;
bool m_bInputStreamIsReadOnly:1;
+ bool m_bInCheckIn:1;
OUString m_aName;
OUString m_aLogicName;
@@ -336,6 +337,7 @@ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP ) :
m_bTriedStorage(false),
m_bRemote(false),
m_bInputStreamIsReadOnly(false),
+ m_bInCheckIn(false),
m_pSet(NULL),
m_pURLObj(NULL),
m_pFilter(NULL),
@@ -1924,23 +1926,31 @@ void SfxMedium::Transfer_Impl()
::ucbhelper::Content aSourceContent;
::ucbhelper::Content aTransferContent;
- // Get the parent URL from the XChild if possible: why would the URL necessarily have
- // a hierarchical path? It's not always the case for CMIS.
::ucbhelper::Content aDestContent;
::ucbhelper::Content::create( aDestURL, xComEnv, comphelper::getProcessComponentContext(), aDestContent );
- Reference< ::com::sun::star::container::XChild> xChild( aDestContent.get(), uno::UNO_QUERY );
- rtl::OUString sParentUrl;
- if ( xChild.is( ) )
+ if ( !IsInCheckIn( ) )
{
- Reference< ::com::sun::star::ucb::XContent > xParent( xChild->getParent( ), uno::UNO_QUERY );
- if ( xParent.is( ) )
+ // Get the parent URL from the XChild if possible: why would the URL necessarily have
+ // a hierarchical path? It's not always the case for CMIS.
+ Reference< ::com::sun::star::container::XChild> xChild( aDestContent.get(), uno::UNO_QUERY );
+ rtl::OUString sParentUrl;
+ if ( xChild.is( ) )
{
- sParentUrl = xParent->getIdentifier( )->getContentIdentifier();
+ Reference< ::com::sun::star::ucb::XContent > xParent( xChild->getParent( ), uno::UNO_QUERY );
+ if ( xParent.is( ) )
+ {
+ sParentUrl = xParent->getIdentifier( )->getContentIdentifier();
+ }
}
- }
- if ( !sParentUrl.isEmpty() )
- aDest = INetURLObject( sParentUrl );
+ if ( !sParentUrl.isEmpty() )
+ aDest = INetURLObject( sParentUrl );
+ }
+ else
+ {
+ // For checkin, we need the object URL, not the parent folder
+ aDest = INetURLObject( aDestURL );
+ }
// LongName wasn't defined anywhere, only used here... get the Title instead
// as it's less probably empty
@@ -1997,8 +2007,24 @@ void SfxMedium::Transfer_Impl()
try
{
rtl::OUString aMimeType = GetFilter()->GetMimeType( );
- if (!aTransferContent.transferContent( aSourceContent, ::ucbhelper::InsertOperation_COPY, aFileName, nNameClash, aMimeType ))
+ ::ucbhelper::InsertOperation eOperation = ::ucbhelper::InsertOperation_COPY;
+ bool bMajor = false;
+ rtl::OUString sComment;
+ if ( IsInCheckIn( ) )
+ {
+ eOperation = ::ucbhelper::InsertOperation_CHECKIN;
+ SFX_ITEMSET_ARG( GetItemSet(), pMajor, SfxBoolItem, SID_DOCINFO_MAJOR, false );
+ bMajor = pMajor && pMajor->GetValue( );
+ SFX_ITEMSET_ARG( GetItemSet(), pComments, SfxStringItem, SID_DOCINFO_COMMENTS, false );
+ if ( pComments )
+ sComment = pComments->GetValue( );
+ }
+ rtl::OUString sResultURL;
+ if (!aTransferContent.transferContent( aSourceContent, eOperation,
+ aFileName, nNameClash, aMimeType, bMajor, sComment, &sResultURL ))
pImp->m_eError = ERRCODE_IO_GENERAL;
+ else if ( !sResultURL.isEmpty( ) ) // Likely to happen only for checkin
+ SwitchDocumentToFile( sResultURL );
}
catch ( const ::com::sun::star::ucb::CommandAbortedException& )
{
@@ -3694,4 +3720,14 @@ sal_Bool SfxMedium::SwitchDocumentToFile( const rtl::OUString& aURL )
return bResult;
}
+void SfxMedium::SetInCheckIn( bool bInCheckIn )
+{
+ pImp->m_bInCheckIn = bInCheckIn;
+}
+
+bool SfxMedium::IsInCheckIn( )
+{
+ return pImp->m_bInCheckIn;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 13571881069c..116f97608c5f 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -361,6 +361,43 @@ void SfxObjectShell::CheckOut( )
}
}
+void SfxObjectShell::CancelCheckOut( )
+{
+ try
+ {
+ uno::Reference< document::XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY_THROW );
+ // TODO Pop up dialog to ask whether to loose data or not
+ xCmisDoc->cancelCheckOut( );
+ }
+ catch ( const uno::RuntimeException& e )
+ {
+ ErrorBox* pErrorBox = new ErrorBox( &GetFrame()->GetWindow(), WB_OK, e.Message );
+ pErrorBox->Execute( );
+ delete pErrorBox;
+ }
+}
+
+void SfxObjectShell::CheckIn( )
+{
+ try
+ {
+ uno::Reference< document::XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY_THROW );
+ sal_Bool bIsMajor = sal_False;
+ rtl::OUString sComment( "Some sample comment" );
+ // TODO Pop up dialog to ask for comment and major
+ xCmisDoc->checkIn( bIsMajor, sComment );
+ uno::Reference< util::XModifiable > xModifiable( GetModel( ), uno::UNO_QUERY );
+ if ( xModifiable.is( ) )
+ xModifiable->setModified( sal_False );
+ }
+ catch ( const uno::RuntimeException& e )
+ {
+ ErrorBox* pErrorBox = new ErrorBox( &GetFrame()->GetWindow(), WB_OK, e.Message );
+ pErrorBox->Execute( );
+ delete pErrorBox;
+ }
+}
+
//--------------------------------------------------------------------
void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
@@ -912,6 +949,16 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
CheckOut( );
break;
}
+ case SID_CANCELCHECKOUT:
+ {
+ CancelCheckOut( );
+ break;
+ }
+ case SID_CHECKIN:
+ {
+ CheckIn( );
+ break;
+ }
}
// Prevent entry in the Pick-lists
@@ -976,6 +1023,37 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
}
break;
+ case SID_CANCELCHECKOUT:
+ case SID_CHECKIN:
+ {
+ bool bShow = false;
+ Reference< XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY );
+ beans::PropertyValues aCmisProperties = xCmisDoc->getCmisPropertiesValues( );
+
+ if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) )
+ {
+ // Loop over the CMIS Properties to find cmis:isVersionSeriesCheckedOut
+ bool bFoundCheckedout = false;
+ sal_Bool bCheckedOut = sal_False;
+ for ( sal_Int32 i = 0; i < aCmisProperties.getLength() && !bFoundCheckedout; ++i )
+ {
+ if ( aCmisProperties[i].Name == "cmis:isVersionSeriesCheckedOut" )
+ {
+ bFoundCheckedout = true;
+ aCmisProperties[i].Value >>= bCheckedOut;
+ }
+ }
+ bShow = bCheckedOut;
+ }
+
+ if ( !bShow )
+ {
+ rSet.DisableItem( nWhich );
+ rSet.Put( SfxVisibilityItem( nWhich, sal_False ) );
+ }
+ }
+ break;
+
case SID_VERSION:
{
SfxObjectShell *pDoc = this;
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 45b1cb28fa37..9fe53943155e 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -1374,7 +1374,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
pFilter = rMedium.GetFilter();
- const SfxStringItem *pVersionItem = pSet ? (const SfxStringItem*)
+ const SfxStringItem *pVersionItem = ( !rMedium.IsInCheckIn( ) && pSet ) ? (const SfxStringItem*)
SfxRequest::GetItem( pSet, SID_DOCINFO_COMMENTS, sal_False, TYPE(SfxStringItem) ) : NULL;
::rtl::OUString aTmpVersionURL;
@@ -1460,7 +1460,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl
}
}
- if ( bOk && pVersionItem )
+ if ( bOk && pVersionItem && !rMedium.IsInCheckIn() )
{
// store a version also
const SfxStringItem *pAuthorItem = pSet ? (const SfxStringItem*)
@@ -1624,7 +1624,12 @@ sal_Bool SfxObjectShell::SaveTo_Impl
AddLog( ::rtl::OUString( OSL_LOG_PREFIX "Medium commit." ) );
+ rtl::OUString sName( rMedium.GetName( ) );
bOk = rMedium.Commit();
+ rtl::OUString sNewName( rMedium.GetName( ) );
+
+ if ( sName != sNewName )
+ GetMedium( )->SwitchDocumentToFile( sNewName );
if ( bOk )
{
@@ -2414,10 +2419,23 @@ sal_Bool SfxObjectShell::DoSave_Impl( const SfxItemSet* pArgs )
pSet->ClearItem( SID_VERSION );
pSet->ClearItem( SID_DOC_BASEURL );
+ // copy the version comment and major items for the checkin only
+ if ( pRetrMedium->IsInCheckIn( ) )
+ {
+ const SfxPoolItem* pMajor = pArgs->GetItem( SID_DOCINFO_MAJOR );
+ if ( pMajor )
+ pSet->Put( *pMajor );
+
+ const SfxPoolItem* pComments = pArgs->GetItem( SID_DOCINFO_COMMENTS );
+ if ( pComments )
+ pSet->Put( *pComments );
+ }
+
// create a medium as a copy; this medium is only for writingm, because it
// uses the same name as the original one writing is done through a copy,
// that will be transferred to the target (of course after calling HandsOff)
SfxMedium* pMediumTmp = new SfxMedium( pRetrMedium->GetName(), pRetrMedium->GetOpenMode(), pFilter, pSet );
+ pMediumTmp->SetInCheckIn( pRetrMedium->IsInCheckIn( ) );
pMediumTmp->SetLongName( pRetrMedium->GetLongName() );
if ( pMediumTmp->GetErrorCode() != ERRCODE_NONE )
{
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index cc2abe9ec95d..46f0bee4debd 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1621,11 +1621,13 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa
m_pData->m_pObjectShell->AddLog( ::rtl::OUString( OSL_LOG_PREFIX "storeSelf" ) );
SfxSaveGuard aSaveGuard(this, m_pData, sal_False);
+ sal_Bool bCheckIn = sal_False;
for ( sal_Int32 nInd = 0; nInd < aSeqArgs.getLength(); nInd++ )
{
// check that only acceptable parameters are provided here
if ( aSeqArgs[nInd].Name != "VersionComment" && aSeqArgs[nInd].Name != "Author"
- && aSeqArgs[nInd].Name != "InteractionHandler" && aSeqArgs[nInd].Name != "StatusIndicator" )
+ && aSeqArgs[nInd].Name != "InteractionHandler" && aSeqArgs[nInd].Name != "StatusIndicator"
+ && aSeqArgs[nInd].Name != "VersionMajor" && aSeqArgs[nInd].Name != "CheckIn" )
{
m_pData->m_pObjectShell->AddLog( ::rtl::OUString( OSL_LOG_PREFIX "unexpected parameter for storeSelf, might be no problem if SaveAs is executed." ) );
m_pData->m_pObjectShell->StoreLog();
@@ -1634,10 +1636,34 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa
aMessage += aSeqArgs[nInd].Name;
throw lang::IllegalArgumentException( aMessage, uno::Reference< uno::XInterface >(), 1 );
}
+ else if ( aSeqArgs[nInd].Name == "CheckIn" )
+ {
+ aSeqArgs[nInd].Value >>= bCheckIn;
+ }
+ }
+
+ // Remove CheckIn property if needed
+ sal_uInt16 nSlotId = SID_SAVEDOC;
+ uno::Sequence< beans::PropertyValue > aArgs = aSeqArgs;
+ if ( bCheckIn )
+ {
+ nSlotId = SID_CHECKIN;
+ sal_Int32 nLength = aSeqArgs.getLength( );
+ aArgs = uno::Sequence< beans::PropertyValue >( nLength - 1 );
+ sal_Int32 nNewI = 0;
+ for ( sal_Int32 i = 0; i < nLength; ++i )
+ {
+ beans::PropertyValue aProp = aSeqArgs[i];
+ if ( aProp.Name != "CheckIn" )
+ {
+ aArgs[nNewI] = aProp;
+ ++nNewI;
+ }
+ }
}
SfxAllItemSet *pParams = new SfxAllItemSet( SFX_APP()->GetPool() );
- TransformParameters( SID_SAVEDOC, aSeqArgs, *pParams );
+ TransformParameters( nSlotId, aArgs, *pParams );
SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOC, GlobalEventConfig::GetEventName(STR_EVENT_SAVEDOC), m_pData->m_pObjectShell ) );
@@ -1662,7 +1688,12 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa
}
}
else
+ {
+ // Tell the SfxMedium if we are in checkin instead of normal save
+ m_pData->m_pObjectShell->GetMedium( )->SetInCheckIn( nSlotId == SID_CHECKIN );
bRet = m_pData->m_pObjectShell->Save_Impl( pParams );
+ m_pData->m_pObjectShell->GetMedium( )->SetInCheckIn( nSlotId != SID_CHECKIN );
+ }
DELETEZ( pParams );
@@ -2577,9 +2608,81 @@ void SAL_CALL SfxBaseModel::checkOut( ) throw ( uno::RuntimeException )
}
}
-sal_Bool SAL_CALL SfxBaseModel::isVersionable( ) throw ( uno::RuntimeException )
+void SAL_CALL SfxBaseModel::cancelCheckOut( ) throw ( uno::RuntimeException )
{
- sal_Bool bVersionable = sal_False;
+ SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium();
+ if ( pMedium )
+ {
+ try
+ {
+ ::ucbhelper::Content aContent( pMedium->GetName(),
+ uno::Reference<ucb::XCommandEnvironment>(),
+ comphelper::getProcessComponentContext() );
+
+ uno::Any aResult = aContent.executeCommand( "cancelCheckout", uno::Any( ) );
+ rtl::OUString sURL;
+ aResult >>= sURL;
+
+ m_pData->m_pObjectShell->GetMedium( )->SwitchDocumentToFile( sURL );
+ m_pData->m_xDocumentProperties->setTitle( getTitle( ) );
+ uno::Sequence< beans::PropertyValue > aSequence ;
+ TransformItems( SID_OPENDOC, *pMedium->GetItemSet(), aSequence );
+ attachResource( sURL, aSequence );
+
+ // Reload the CMIS properties
+ loadCmisProperties( );
+ }
+ catch ( const uno::Exception & e )
+ {
+ throw uno::RuntimeException( e.Message, e.Context );
+ }
+ }
+}
+
+void SAL_CALL SfxBaseModel::checkIn( sal_Bool bIsMajor, const rtl::OUString& rMessage ) throw ( uno::RuntimeException )
+{
+ SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium();
+ if ( pMedium )
+ {
+ try
+ {
+ uno::Sequence< beans::PropertyValue > aProps( 3 );
+ aProps[0].Name = "VersionMajor";
+ aProps[0].Value = uno::makeAny( bIsMajor );
+ aProps[1].Name = "VersionComment";
+ aProps[1].Value = uno::makeAny( rMessage );
+ aProps[2].Name = "CheckIn";
+ aProps[2].Value = uno::makeAny( sal_True );
+
+ rtl::OUString sName( pMedium->GetName( ) );
+ storeSelf( aProps );
+
+ // Refresh pMedium as it has probably changed during the storeSelf call
+ pMedium = m_pData->m_pObjectShell->GetMedium( );
+ rtl::OUString sNewName( pMedium->GetName( ) );
+
+ // URL has changed, update the document
+ if ( sName != sNewName )
+ {
+ m_pData->m_xDocumentProperties->setTitle( getTitle( ) );
+ uno::Sequence< beans::PropertyValue > aSequence ;
+ TransformItems( SID_OPENDOC, *pMedium->GetItemSet(), aSequence );
+ attachResource( sNewName, aSequence );
+
+ // Reload the CMIS properties
+ loadCmisProperties( );
+ }
+ }
+ catch ( const uno::Exception & e )
+ {
+ throw uno::RuntimeException( e.Message, e.Context );
+ }
+ }
+}
+
+sal_Bool SfxBaseModel::getBoolPropertyValue( const rtl::OUString& rName ) throw ( uno::RuntimeException )
+{
+ sal_Bool bValue = sal_False;
SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium();
if ( pMedium )
{
@@ -2589,10 +2692,9 @@ sal_Bool SAL_CALL SfxBaseModel::isVersionable( ) throw ( uno::RuntimeException )
uno::Reference<ucb::XCommandEnvironment>(),
comphelper::getProcessComponentContext() );
com::sun::star::uno::Reference < beans::XPropertySetInfo > xProps = aContent.getProperties();
- ::rtl::OUString aIsVersionableProp( "IsVersionable" );
- if ( xProps->hasPropertyByName( aIsVersionableProp ) )
+ if ( xProps->hasPropertyByName( rName ) )
{
- aContent.getPropertyValue( aIsVersionableProp ) >>= bVersionable;
+ aContent.getPropertyValue( rName ) >>= bValue;
}
}
catch ( const uno::Exception & e )
@@ -2600,7 +2702,27 @@ sal_Bool SAL_CALL SfxBaseModel::isVersionable( ) throw ( uno::RuntimeException )
throw uno::RuntimeException( e.Message, e.Context );
}
}
- return bVersionable;
+ return bValue;
+}
+
+sal_Bool SAL_CALL SfxBaseModel::isVersionable( ) throw ( uno::RuntimeException )
+{
+ return getBoolPropertyValue( "IsVersionable" );
+}
+
+sal_Bool SAL_CALL SfxBaseModel::canCheckOut( ) throw ( uno::RuntimeException )
+{
+ return getBoolPropertyValue( "CanCheckOut" );
+}
+
+sal_Bool SAL_CALL SfxBaseModel::canCancelCheckOut( ) throw ( uno::RuntimeException )
+{
+ return getBoolPropertyValue( "CanCancelCheckOut" );
+}
+
+sal_Bool SAL_CALL SfxBaseModel::canCheckIn( ) throw ( uno::RuntimeException )
+{
+ return getBoolPropertyValue( "CanCheckIn" );
}
void SfxBaseModel::loadCmisProperties( )
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index 54827c5d7436..81638ff2076b 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -1470,7 +1470,7 @@ void SfxBaseController::ShowInfoBars( )
}
}
-IMPL_LINK( SfxBaseController, CheckOutHandler, PushButton*, pBtn )
+IMPL_LINK_NOARG ( SfxBaseController, CheckOutHandler )
{
if ( m_pData->m_pViewShell )
m_pData->m_pViewShell->GetObjectShell()->CheckOut( );
diff --git a/starmath/uiconfig/smath/menubar/menubar.xml b/starmath/uiconfig/smath/menubar/menubar.xml
index 6339e0036477..8a4d7c989737 100644
--- a/starmath/uiconfig/smath/menubar/menubar.xml
+++ b/starmath/uiconfig/smath/menubar/menubar.xml
@@ -30,6 +30,10 @@
<menu:menuitem menu:id=".uno:SaveAs"/>
<menu:menuitem menu:id=".uno:SaveAll"/>
<menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:Reload"/>
<menu:menuitem menu:id=".uno:VersionDialog"/>
diff --git a/sw/uiconfig/sglobal/menubar/menubar.xml b/sw/uiconfig/sglobal/menubar/menubar.xml
index 5adef7aa0d16..95806e80ef73 100644
--- a/sw/uiconfig/sglobal/menubar/menubar.xml
+++ b/sw/uiconfig/sglobal/menubar/menubar.xml
@@ -14,6 +14,8 @@
<menu:menuitem menu:id=".uno:SaveAsTemplate"/>
<menu:menuitem menu:id=".uno:SaveAll"/>
<menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:Reload"/>
<menu:menuitem menu:id=".uno:VersionDialog"/>
diff --git a/sw/uiconfig/sweb/menubar/menubar.xml b/sw/uiconfig/sweb/menubar/menubar.xml
index 8ed158f33305..49d96f6603ad 100644
--- a/sw/uiconfig/sweb/menubar/menubar.xml
+++ b/sw/uiconfig/sweb/menubar/menubar.xml
@@ -14,6 +14,8 @@
<menu:menuitem menu:id=".uno:SaveAsTemplate"/>
<menu:menuitem menu:id=".uno:SaveAll"/>
<menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menuitem menu:id=".uno:Reload"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:ExportTo"/>
diff --git a/sw/uiconfig/swform/menubar/menubar.xml b/sw/uiconfig/swform/menubar/menubar.xml
index 82862544c5f6..2fbd4c3da861 100644
--- a/sw/uiconfig/swform/menubar/menubar.xml
+++ b/sw/uiconfig/swform/menubar/menubar.xml
@@ -14,6 +14,8 @@
<menu:menuitem menu:id=".uno:SaveAsTemplate"/>
<menu:menuitem menu:id=".uno:SaveAll"/>
<menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:Reload"/>
<menu:menuitem menu:id=".uno:VersionDialog"/>
diff --git a/sw/uiconfig/swreport/menubar/menubar.xml b/sw/uiconfig/swreport/menubar/menubar.xml
index 3a643448b979..a1de857e5010 100644
--- a/sw/uiconfig/swreport/menubar/menubar.xml
+++ b/sw/uiconfig/swreport/menubar/menubar.xml
@@ -14,6 +14,8 @@
<menu:menuitem menu:id=".uno:SaveAsTemplate"/>
<menu:menuitem menu:id=".uno:SaveAll"/>
<menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:Reload"/>
<menu:menuitem menu:id=".uno:VersionDialog"/>
diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml
index 35b474d9bdd3..3e7a0f0f1b34 100644
--- a/sw/uiconfig/swriter/menubar/menubar.xml
+++ b/sw/uiconfig/swriter/menubar/menubar.xml
@@ -14,6 +14,8 @@
<menu:menuitem menu:id=".uno:SaveAsTemplate"/>
<menu:menuitem menu:id=".uno:SaveAll"/>
<menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:Reload"/>
<menu:menuitem menu:id=".uno:VersionDialog"/>
diff --git a/sw/uiconfig/swxform/menubar/menubar.xml b/sw/uiconfig/swxform/menubar/menubar.xml
index 0643aa31ea91..7bf5e6b479fe 100644
--- a/sw/uiconfig/swxform/menubar/menubar.xml
+++ b/sw/uiconfig/swxform/menubar/menubar.xml
@@ -14,6 +14,8 @@
<menu:menuitem menu:id=".uno:SaveAsTemplate"/>
<menu:menuitem menu:id=".uno:SaveAll"/>
<menu:menuitem menu:id=".uno:CheckOut"/>
+ <menu:menuitem menu:id=".uno:CancelCheckOut"/>
+ <menu:menuitem menu:id=".uno:CheckIn"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:Reload"/>
<menu:menuitem menu:id=".uno:VersionDialog"/>
diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx
index 568f530cb2d3..ee3926c639ad 100644
--- a/ucb/source/core/ucb.cxx
+++ b/ucb/source/core/ucb.cxx
@@ -679,6 +679,21 @@ Any SAL_CALL UniversalContentBroker::execute(
globalTransfer( aTransferArg, Environment );
}
+ else if ( ( aCommand.Handle == CHECKIN_HANDLE ) || aCommand.Name == CHECKIN_NAME )
+ {
+ ucb::CheckinArgument aCheckinArg;
+ if ( !( aCommand.Argument >>= aCheckinArg ) )
+ {
+ ucbhelper::cancelCommandExecution(
+ makeAny( IllegalArgumentException(
+ OUString( "Wrong argument type!" ),
+ static_cast< cppu::OWeakObject * >( this ),
+ -1 ) ),
+ Environment );
+ // Unreachable
+ }
+ aRet <<= checkIn( aCheckinArg, Environment );
+ }
else
{
//////////////////////////////////////////////////////////////////
diff --git a/ucb/source/core/ucb.hxx b/ucb/source/core/ucb.hxx
index 9de5839aa08e..1f11b330c6af 100644
--- a/ucb/source/core/ucb.hxx
+++ b/ucb/source/core/ucb.hxx
@@ -21,6 +21,7 @@
#define _UCB_HXX
+#include <com/sun/star/ucb/CheckinArgument.hpp>
#include <com/sun/star/ucb/XUniversalContentBroker.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -181,6 +182,10 @@ private:
com::sun::star::ucb::XCommandEnvironment >& xEnv )
throw( com::sun::star::uno::Exception );
+ com::sun::star::uno::Any checkIn( const com::sun::star::ucb::CheckinArgument& rArg,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& xEnv ) throw( com::sun::star::uno::Exception );
+
bool configureUcb()
throw ( com::sun::star::uno::RuntimeException);
diff --git a/ucb/source/core/ucbcmds.cxx b/ucb/source/core/ucbcmds.cxx
index 975b53fc8bd0..043ceefbef8d 100644
--- a/ucb/source/core/ucbcmds.cxx
+++ b/ucb/source/core/ucbcmds.cxx
@@ -249,6 +249,13 @@ CommandProcessorInfo::CommandProcessorInfo()
getCppuType(
static_cast<
ucb::GlobalTransferCommandArgument * >( 0 ) ) ); // ArgType
+ (*m_pInfo)[ 2 ]
+ = ucb::CommandInfo(
+ rtl::OUString( CHECKIN_NAME ), // Name
+ CHECKIN_HANDLE, // Handle
+ getCppuType(
+ static_cast<
+ ucb::GlobalTransferCommandArgument * >( 0 ) ) ); // ArgType
}
//=========================================================================
@@ -1782,7 +1789,7 @@ void UniversalContentBroker::globalTransfer(
try
{
ucb::Command aCommand(
- rtl::OUString("transfer"), // Name
+ rtl::OUString( "transfer" ), // Name
-1, // Handle
uno::makeAny( aTransferArg ) ); // Argument
@@ -2028,4 +2035,88 @@ void UniversalContentBroker::globalTransfer(
}
}
+uno::Any UniversalContentBroker::checkIn( const ucb::CheckinArgument& rArg,
+ const uno::Reference< ucb::XCommandEnvironment >& xEnv ) throw ( uno::Exception )
+{
+ uno::Any aRet;
+ // Use own command environment with own interaction handler intercepting
+ // some interaction requests that shall not be handled by the user-supplied
+ // interaction handler.
+ uno::Reference< ucb::XCommandEnvironment > xLocalEnv;
+ if (xEnv.is())
+ {
+ uno::Reference< uno::XComponentContext > xCtx(
+ comphelper::getComponentContext( m_xSMgr ) );
+
+ xLocalEnv.set( ucb::CommandEnvironment::create(
+ xCtx,
+ new InteractionHandlerProxy( xEnv->getInteractionHandler() ),
+ xEnv->getProgressHandler() ) );
+ }
+
+ uno::Reference< ucb::XContent > xTarget;
+ uno::Reference< ucb::XContentIdentifier > xId
+ = createContentIdentifier( rArg.TargetURL );
+ if ( xId.is() )
+ {
+ try
+ {
+ xTarget = queryContent( xId );
+ }
+ catch ( ucb::IllegalIdentifierException const & )
+ {
+ }
+ }
+
+ if ( !xTarget.is() )
+ {
+ uno::Any aProps
+ = uno::makeAny(beans::PropertyValue(
+ rtl::OUString( "Uri" ), -1,
+ uno::makeAny( rArg.TargetURL ),
+ beans::PropertyState_DIRECT_VALUE ) );
+ ucbhelper::cancelCommandExecution(
+ ucb::IOErrorCode_CANT_READ,
+ uno::Sequence< uno::Any >( &aProps, 1 ),
+ xEnv,
+ rtl::OUString( "Can't instanciate target object!" ),
+ this );
+ // Unreachable
+ }
+
+ uno::Reference< ucb::XCommandProcessor > xCommandProcessor(
+ xTarget, uno::UNO_QUERY );
+ if ( !xCommandProcessor.is() )
+ {
+ uno::Any aProps
+ = uno::makeAny(
+ beans::PropertyValue(
+ rtl::OUString( "Uri" ), -1,
+ uno::makeAny( rArg.TargetURL ),
+ beans::PropertyState_DIRECT_VALUE ) );
+ ucbhelper::cancelCommandExecution(
+ ucb::IOErrorCode_CANT_READ,
+ uno::Sequence< uno::Any >( &aProps, 1 ),
+ xEnv,
+ rtl::OUString( "Target content is not a XCommandProcessor!" ),
+ this );
+ // Unreachable
+ }
+
+ try
+ {
+ ucb::Command aCommand(
+ rtl::OUString( "checkin" ), -1,
+ uno::makeAny( rArg ) );
+
+ aRet = xCommandProcessor->execute( aCommand, 0, xLocalEnv );
+ }
+ catch ( ucb::UnsupportedCommandException const & )
+ {
+ // 'checkin' command is not supported by commandprocessor:
+ // ignore.
+ }
+ return aRet;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/core/ucbcmds.hxx b/ucb/source/core/ucbcmds.hxx
index 89b86f38e409..c0664f39705c 100644
--- a/ucb/source/core/ucbcmds.hxx
+++ b/ucb/source/core/ucbcmds.hxx
@@ -32,6 +32,9 @@
#define GLOBALTRANSFER_NAME "globalTransfer"
#define GLOBALTRANSFER_HANDLE 1025
+#define CHECKIN_NAME "checkin"
+#define CHECKIN_HANDLE 1026
+
#endif /* !_UCBCMDS_HXX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 6ea78e0be528..0c6ba3625bc5 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -53,7 +53,9 @@
#include <libcmis/document.hxx>
+#include <comphelper/processfactory.hxx>
#include <ucbhelper/cancelcommandexecution.hxx>
+#include <ucbhelper/content.hxx>
#include <ucbhelper/contentidentifier.hxx>
#include <ucbhelper/std_inputstream.hxx>
#include <ucbhelper/std_outputstream.hxx>
@@ -454,7 +456,8 @@ namespace cmis
{
boost::shared_ptr< libcmis::AllowableActions > allowableActions = getObject( xEnv )->getAllowableActions( );
sal_Bool bReadOnly = sal_False;
- if ( !allowableActions->isAllowed( libcmis::ObjectAction::SetContentStream ) )
+ if ( !allowableActions->isAllowed( libcmis::ObjectAction::SetContentStream ) &&
+ !allowableActions->isAllowed( libcmis::ObjectAction::CheckIn ) )
bReadOnly = sal_True;
xRow->appendBoolean( rProp, bReadOnly );
@@ -563,6 +566,60 @@ namespace cmis
xRow->appendVoid( rProp );
}
}
+ else if ( rProp.Name == "CanCheckOut" )
+ {
+ try
+ {
+ libcmis::ObjectPtr pObject = getObject( xEnv );
+ libcmis::AllowableActionsPtr aAllowables = pObject->getAllowableActions( );
+ bool bAllowed = false;
+ if ( aAllowables )
+ {
+ bAllowed = aAllowables->isAllowed( libcmis::ObjectAction::CheckOut );
+ }
+ xRow->appendBoolean( rProp, bAllowed );
+ }
+ catch ( const libcmis::Exception& )
+ {
+ xRow->appendVoid( rProp );
+ }
+ }
+ else if ( rProp.Name == "CanCancelCheckOut" )
+ {
+ try
+ {
+ libcmis::ObjectPtr pObject = getObject( xEnv );
+ libcmis::AllowableActionsPtr aAllowables = pObject->getAllowableActions( );
+ bool bAllowed = false;
+ if ( aAllowables )
+ {
+ bAllowed = aAllowables->isAllowed( libcmis::ObjectAction::CancelCheckOut );
+ }
+ xRow->appendBoolean( rProp, bAllowed );
+ }
+ catch ( const libcmis::Exception& )
+ {
+ xRow->appendVoid( rProp );
+ }
+ }
+ else if ( rProp.Name == "CanCheckIn" )
+ {
+ try
+ {
+ libcmis::ObjectPtr pObject = getObject( xEnv );
+ libcmis::AllowableActionsPtr aAllowables = pObject->getAllowableActions( );
+ bool bAllowed = false;
+ if ( aAllowables )
+ {
+ bAllowed = aAllowables->isAllowed( libcmis::ObjectAction::CheckIn );
+ }
+ xRow->appendBoolean( rProp, bAllowed );
+ }
+ catch ( const libcmis::Exception& )
+ {
+ xRow->appendVoid( rProp );
+ }
+ }
else
SAL_INFO( "cmisucp", "Looking for unsupported property " << rProp.Name );
}
@@ -662,6 +719,170 @@ namespace cmis
return aRet;
}
+ rtl::OUString Content::checkIn( const ucb::CheckinArgument& rArg,
+ const uno::Reference< ucb::XCommandEnvironment > & xEnv )
+ throw( uno::Exception )
+ {
+ ucbhelper::Content aSourceContent( rArg.SourceURL, xEnv, comphelper::getProcessComponentContext( ) );
+ uno::Reference< io::XInputStream > xIn = aSourceContent.openStream( );
+
+ libcmis::ObjectPtr object;
+ try
+ {
+ object = getObject( xEnv );
+ }
+ catch ( const libcmis::Exception& )
+ {
+ }
+
+ libcmis::Document* pPwc = dynamic_cast< libcmis::Document* >( object.get( ) );
+ if ( !pPwc )
+ {
+ ucbhelper::cancelCommandExecution(
+ ucb::IOErrorCode_GENERAL,
+ uno::Sequence< uno::Any >( 0 ),
+ xEnv,
+ "Checkin only supported by documents" );
+ }
+
+ 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( xIn, xOutput );
+
+ map< string, libcmis::PropertyPtr > newProperties;
+ libcmis::DocumentPtr pDoc = pPwc->checkIn( rArg.MajorVersion, OUSTR_TO_STDSTR( rArg.VersionComment ), newProperties,
+ pOut, OUSTR_TO_STDSTR( rArg.MimeType ), OUSTR_TO_STDSTR( rArg.NewTitle ) );
+
+ // Get the URL and send it back as a result
+ URL aCmisUrl( m_sURL );
+ vector< string > aPaths = pDoc->getPaths( );
+ if ( !aPaths.empty() )
+ {
+ string sPath = aPaths.front( );
+ aCmisUrl.setObjectPath( STD_TO_OUSTR( sPath ) );
+ }
+ else
+ {
+ // We may have unfiled document depending on the server, those
+ // won't have any path, use their ID instead
+ string sId = pDoc->getId( );
+ aCmisUrl.setObjectId( STD_TO_OUSTR( sId ) );
+ }
+ return aCmisUrl.asString( );
+ }
+
+ rtl::OUString Content::checkOut( const uno::Reference< ucb::XCommandEnvironment > & xEnv )
+ throw( uno::Exception )
+ {
+ rtl::OUString aRet;
+ try
+ {
+ // Checkout the document if possible
+ 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,
+ "Checkout only supported by documents" );
+ }
+ libcmis::DocumentPtr pPwc = pDoc->checkOut( );
+
+ // Compute the URL of the Private Working Copy (PWC)
+ URL aCmisUrl( m_sURL );
+ vector< string > aPaths = pPwc->getPaths( );
+ if ( !aPaths.empty() )
+ {
+ string sPath = aPaths.front( );
+ aCmisUrl.setObjectPath( STD_TO_OUSTR( sPath ) );
+ }
+ else
+ {
+ // We may have unfiled PWC depending on the server, those
+ // won't have any path, use their ID instead
+ string sId = pPwc->getId( );
+ aCmisUrl.setObjectId( STD_TO_OUSTR( sId ) );
+ }
+ aRet = aCmisUrl.asString( );
+ }
+ catch ( const libcmis::Exception& e )
+ {
+ SAL_INFO( "cmisucp", "Unexpected libcmis exception: " << e.what( ) );
+ ucbhelper::cancelCommandExecution(
+ ucb::IOErrorCode_GENERAL,
+ uno::Sequence< uno::Any >( 0 ),
+ xEnv,
+ rtl::OUString::createFromAscii( e.what() ) );
+ }
+ return aRet;
+ }
+
+ rtl::OUString Content::cancelCheckOut( const uno::Reference< ucb::XCommandEnvironment > & xEnv )
+ throw( uno::Exception )
+ {
+ rtl::OUString aRet;
+ try
+ {
+ libcmis::DocumentPtr pPwc = boost::dynamic_pointer_cast< libcmis::Document >( getObject( xEnv ) );
+ if ( pPwc.get( ) == NULL )
+ {
+ ucbhelper::cancelCommandExecution(
+ ucb::IOErrorCode_GENERAL,
+ uno::Sequence< uno::Any >( 0 ),
+ xEnv,
+ "CancelCheckout only supported by documents" );
+ }
+ pPwc->cancelCheckout( );
+
+ // Get the Original document (latest version)
+ vector< libcmis::DocumentPtr > aVersions = pPwc->getAllVersions( );
+ libcmis::DocumentPtr pDoc;
+ for ( vector< libcmis::DocumentPtr >::iterator it = aVersions.begin();
+ it != aVersions.end( ) && pDoc != NULL; ++it )
+ {
+ libcmis::DocumentPtr pVersion = *it;
+ map< string, libcmis::PropertyPtr > aProps = pVersion->getProperties( );
+ bool bIsLatestVersion = false;
+ map< string, libcmis::PropertyPtr >::iterator propIt = aProps.find( string( "cmis:isLatestVersion" ) );
+ if ( propIt != aProps.end( ) && !propIt->second->getBools( ).empty( ) )
+ {
+ bIsLatestVersion = propIt->second->getBools( ).front( );
+ }
+
+ if ( bIsLatestVersion )
+ pDoc.reset( pVersion.get( ) );
+ }
+
+ // Compute the URL of the Document
+ URL aCmisUrl( m_sURL );
+ vector< string > aPaths = pDoc->getPaths( );
+ if ( !aPaths.empty() )
+ {
+ string sPath = aPaths.front( );
+ aCmisUrl.setObjectPath( STD_TO_OUSTR( sPath ) );
+ }
+ else
+ {
+ // We may have unfiled doc depending on the server, those
+ // won't have any path, use their ID instead
+ string sId = pDoc->getId( );
+ aCmisUrl.setObjectId( STD_TO_OUSTR( sId ) );
+ }
+ aRet = aCmisUrl.asString( );
+ }
+ catch ( const libcmis::Exception& e )
+ {
+ SAL_INFO( "cmisucp", "Unexpected libcmis exception: " << e.what( ) );
+ ucbhelper::cancelCommandExecution(
+ ucb::IOErrorCode_GENERAL,
+ uno::Sequence< uno::Any >( 0 ),
+ xEnv,
+ rtl::OUString::createFromAscii( e.what() ) );
+ }
+ return aRet;
+ }
+
void Content::transfer( const ucb::TransferInfo& rTransferInfo,
const uno::Reference< ucb::XCommandEnvironment > & xEnv )
throw( uno::Exception )
@@ -756,11 +977,10 @@ 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, sMime, OUSTR_TO_STDSTR( rMimeType ), bReplaceExisting );
+ document->setContentStream( pOut, OUSTR_TO_STDSTR( rMimeType ), string( ), bReplaceExisting );
}
}
else
@@ -997,6 +1217,15 @@ namespace cmis
beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVersionable" ) ),
-1, getCppuBooleanType(),
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
+ beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CanCheckOut" ) ),
+ -1, getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
+ beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CanCancelCheckOut" ) ),
+ -1, getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
+ beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CanCheckIn" ) ),
+ -1, getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
};
const int nProps = SAL_N_ELEMENTS(aGenericProperties);
@@ -1035,6 +1264,9 @@ namespace cmis
// Mandatory CMIS-only commands
ucb::CommandInfo ( rtl::OUString( "checkout" ), -1, getCppuVoidType() ),
+ ucb::CommandInfo ( rtl::OUString( "cancelCheckout" ), -1, getCppuVoidType() ),
+ ucb::CommandInfo ( rtl::OUString( "checkIn" ), -1,
+ getCppuType( static_cast<ucb::TransferInfo * >( 0 ) ) ),
// Folder Only, omitted if not a folder
ucb::CommandInfo
@@ -1227,46 +1459,20 @@ namespace cmis
}
else if ( aCommand.Name == "checkout" )
{
- try
- {
- // Checkout the document if possible
- 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,
- "Checkout only supported by documents" );
- }
- libcmis::DocumentPtr pPwc = pDoc->checkOut( );
-
- // Compute the URL of the Private Working Copy (PWC)
- URL aCmisUrl( m_sURL );
- vector< string > aPaths = pPwc->getPaths( );
- if ( !aPaths.empty() )
- {
- string sPath = aPaths.front( );
- aCmisUrl.setObjectPath( STD_TO_OUSTR( sPath ) );
- }
- else
- {
- // We may have unfiled PWC depending on the server, those
- // won't have any path, use their ID instead
- string sId = pPwc->getId( );
- aCmisUrl.setObjectId( STD_TO_OUSTR( sId ) );
- }
- aRet <<= aCmisUrl.asString( );
- }
- catch ( const libcmis::Exception& e )
+ aRet <<= checkOut( xEnv );
+ }
+ else if ( aCommand.Name == "cancelCheckout" )
+ {
+ aRet <<= cancelCheckOut( xEnv );
+ }
+ else if ( aCommand.Name == "checkin" )
+ {
+ ucb::CheckinArgument aArg;
+ if ( !( aCommand.Argument >>= aArg ) )
{
- SAL_INFO( "cmisucp", "Unexpected libcmis exception: " << e.what( ) );
- ucbhelper::cancelCommandExecution(
- ucb::IOErrorCode_GENERAL,
- uno::Sequence< uno::Any >( 0 ),
- xEnv,
- rtl::OUString::createFromAscii( e.what() ) );
+ ucbhelper::cancelCommandExecution ( getBadArgExcept(), xEnv );
}
+ aRet <<= checkIn( aArg, xEnv );
}
else
{
diff --git a/ucb/source/ucp/cmis/cmis_content.hxx b/ucb/source/ucp/cmis/cmis_content.hxx
index 8790834ed0cd..42c8482a28fb 100644
--- a/ucb/source/ucp/cmis/cmis_content.hxx
+++ b/ucb/source/ucp/cmis/cmis_content.hxx
@@ -34,6 +34,7 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/ucb/CheckinArgument.hpp>
#include <com/sun/star/ucb/ContentCreationException.hpp>
#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
#include <com/sun/star/ucb/TransferInfo.hpp>
@@ -117,6 +118,16 @@ private:
const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv )
throw( com::sun::star::uno::Exception );
+ rtl::OUString checkIn( const com::sun::star::ucb::CheckinArgument& rArg,
+ const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw( com::sun::star::uno::Exception );
+
+ rtl::OUString checkOut( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw( com::sun::star::uno::Exception );
+
+ rtl::OUString cancelCheckOut( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw( com::sun::star::uno::Exception );
+
void destroy( ) throw( com::sun::star::uno::Exception );
void copyData( com::sun::star::uno::Reference< com::sun::star::io::XInputStream > xIn,
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;
}