[Libreoffice-commits] core.git: include/sfx2 offapi/com offapi/UnoApi_offapi.mk sfx2/source sfx2/uiconfig sfx2/UIConfig_sfx.mk ucb/source
Cao Cuong Ngo
cao.cuong.ngo at gmail.com
Mon Sep 23 05:56:36 PDT 2013
include/sfx2/objsh.hxx | 2
include/sfx2/sfxbasemodel.hxx | 4
offapi/UnoApi_offapi.mk | 1
offapi/com/sun/star/document/CmisVersion.idl | 52 +++
offapi/com/sun/star/document/XCmisDocument.idl | 3
sfx2/UIConfig_sfx.mk | 1
sfx2/source/dialog/versdlg.cxx | 111 ++++++++
sfx2/source/doc/objserv.cxx | 15 +
sfx2/source/doc/sfxbasemodel.cxx | 23 +
sfx2/source/inc/versdlg.hxx | 24 +
sfx2/uiconfig/ui/versionscmis.ui | 340 +++++++++++++++++++++++++
sfx2/uiconfig/ui/versionsofdialog.ui | 16 +
ucb/source/ucp/cmis/cmis_content.cxx | 47 +++
ucb/source/ucp/cmis/cmis_content.hxx | 5
14 files changed, 642 insertions(+), 2 deletions(-)
New commits:
commit b61970cfbe12722efd6218db6489980381b8783d
Author: Cao Cuong Ngo <cao.cuong.ngo at gmail.com>
Date: Thu Sep 12 15:27:37 2013 +0200
Cmis Versions dialog
Change-Id: Ie863282062a6932a55543143e841917c54223ac9
Reviewed-on: https://gerrit.libreoffice.org/5925
Reviewed-by: Bosdonnat Cedric <cedric.bosdonnat at free.fr>
Tested-by: Bosdonnat Cedric <cedric.bosdonnat at free.fr>
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index 4d530d9..ee2ff12 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -37,6 +37,7 @@
#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/document/CmisVersion.hpp>
#include <boost/shared_ptr.hpp>
//________________________________________________________________________________________________________________
@@ -714,6 +715,7 @@ public:
SAL_DLLPRIVATE void CheckOut( );
SAL_DLLPRIVATE void CancelCheckOut( );
SAL_DLLPRIVATE void CheckIn( );
+ SAL_DLLPRIVATE ::com::sun::star::uno::Sequence< ::com::sun::star::document::CmisVersion > GetCmisVersions();
};
#define SFX_GLOBAL_CLASSID \
diff --git a/include/sfx2/sfxbasemodel.hxx b/include/sfx2/sfxbasemodel.hxx
index 084a0f3..fde9aa0 100644
--- a/include/sfx2/sfxbasemodel.hxx
+++ b/include/sfx2/sfxbasemodel.hxx
@@ -33,6 +33,7 @@
#include <com/sun/star/container/XNameReplace.hpp>
#include <com/sun/star/frame/XController2.hpp>
#include <com/sun/star/document/XCmisDocument.hpp>
+#include <com/sun/star/document/CmisVersion.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/document/XDocumentRecovery.hpp>
#include <com/sun/star/document/XUndoManagerSupplier.hpp>
@@ -1321,6 +1322,9 @@ public:
css::document::CmisProperty >& _cmisproperties )
throw (css::uno::RuntimeException);
+ virtual css::uno::Sequence< css::document::CmisVersion > SAL_CALL getAllVersions ( )
+ throw (css::uno::RuntimeException );
+
virtual void SAL_CALL checkOut( ) throw ( css::uno::RuntimeException );
virtual void SAL_CALL cancelCheckOut( ) throw ( css::uno::RuntimeException );
virtual void SAL_CALL checkIn( sal_Bool bIsMajor, const OUString & rMessage )
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index be91841..c97bf41 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2160,6 +2160,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/document,\
BrokenPackageRequest \
ChangedByOthersRequest \
CmisProperty \
+ CmisVersion \
CorruptedFilterConfigurationException \
DocumentEvent \
EmptyUndoStackException \
diff --git a/offapi/com/sun/star/document/CmisVersion.idl b/offapi/com/sun/star/document/CmisVersion.idl
new file mode 100644
index 0000000..8171283
--- /dev/null
+++ b/offapi/com/sun/star/document/CmisVersion.idl
@@ -0,0 +1,52 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_document_CmisVersion_idl__
+#define __com_sun_star_document_CmisVersion_idl__
+
+#include <com/sun/star/util/DateTime.idl>
+
+module com { module sun { module star { module document {
+
+/** specifies a CMIS document version.
+ */
+struct CmisVersion
+{
+ /** unique ID of the Cmis version
+ */
+ string Id;
+
+ /** specifies the time when the revision was created.
+ */
+ util::DateTime TimeStamp;
+
+ /** contains the author that created the version.
+ */
+ string Author;
+
+ /** contains the comment the author has left.
+ */
+ string Comment;
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/document/XCmisDocument.idl b/offapi/com/sun/star/document/XCmisDocument.idl
index 4e34a0f..0f6ef8f 100644
--- a/offapi/com/sun/star/document/XCmisDocument.idl
+++ b/offapi/com/sun/star/document/XCmisDocument.idl
@@ -10,6 +10,7 @@
#define __com_sun_star_document_XCmisDocument_idl__
#include <com/sun/star/document/CmisProperty.idl>
+#include <com/sun/star/document/CmisVersion.idl>
#include <com/sun/star/uno/XInterface.idl>
module com { module sun { module star { module document {
@@ -46,6 +47,8 @@ interface XCmisDocument : com::sun::star::uno::XInterface
void updateCmisProperties( [in] sequence <com::sun::star::document::CmisProperty> cmisProperties );
+ sequence <com::sun::star::document::CmisVersion> getAllVersions( );
+
/** Contains the properties values named after their CMIS ID.
*/
[attribute] sequence <com::sun::star::document::CmisProperty> CmisProperties;
diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk
index ff75447..a2629d2 100644
--- a/sfx2/UIConfig_sfx.mk
+++ b/sfx2/UIConfig_sfx.mk
@@ -27,6 +27,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
sfx2/uiconfig/ui/singletabdialog \
sfx2/uiconfig/ui/versionsofdialog \
sfx2/uiconfig/ui/versioncommentdialog \
+ sfx2/uiconfig/ui/versionscmis \
sfx2/uiconfig/ui/startcenter \
sfx2/uiconfig/ui/cmisinfopage \
sfx2/uiconfig/ui/cmisline \
diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx
index abc4644..c36540c 100644
--- a/sfx2/source/dialog/versdlg.cxx
+++ b/sfx2/source/dialog/versdlg.cxx
@@ -81,7 +81,7 @@ public:
{ *this = rCpy; }
SfxVersionTableDtor( const uno::Sequence < util::RevisionTag >& rInfo );
-
+ SfxVersionTableDtor( const uno::Sequence < document::CmisVersion > & rInfo );
~SfxVersionTableDtor()
{ DelDtor(); }
@@ -114,6 +114,23 @@ SfxVersionTableDtor::SfxVersionTableDtor( const uno::Sequence < util::RevisionTa
}
}
+SfxVersionTableDtor::SfxVersionTableDtor( const uno::Sequence < document::CmisVersion >& rInfo )
+{
+ for ( sal_Int32 n=0; n<(sal_Int32)rInfo.getLength(); n++ )
+ {
+ SfxVersionInfo* pInfo = new SfxVersionInfo;
+ pInfo->aName = rInfo[n].Id;
+ pInfo->aComment = rInfo[n].Comment;
+ pInfo->aAuthor = rInfo[n].Author;
+
+ Date aDate ( rInfo[n].TimeStamp.Day, rInfo[n].TimeStamp.Month, rInfo[n].TimeStamp.Year );
+ Time aTime ( rInfo[n].TimeStamp.Hours, rInfo[n].TimeStamp.Minutes, rInfo[n].TimeStamp.Seconds, rInfo[n].TimeStamp.NanoSeconds );
+
+ pInfo->aCreationDate = DateTime( aDate, aTime );
+ aTableList.push_back( pInfo );
+ }
+}
+
void SfxVersionTableDtor::DelDtor()
{
for ( size_t i = 0, n = aTableList.size(); i < n; ++i )
@@ -218,6 +235,7 @@ SfxVersionDialog::SfxVersionDialog ( SfxViewFrame* pVwFrame, sal_Bool bIsSaveVer
get(m_pViewButton, "show");
get(m_pDeleteButton, "delete");
get(m_pCompareButton, "compare");
+ get(m_pCmisButton, "cmis");
SvSimpleTableContainer *pContainer = get<SvSimpleTableContainer>("versions");
Size aControlSize(260, 114);
@@ -234,6 +252,7 @@ SfxVersionDialog::SfxVersionDialog ( SfxViewFrame* pVwFrame, sal_Bool bIsSaveVer
m_pCompareButton->SetClickHdl ( aClickLink );
m_pOpenButton->SetClickHdl ( aClickLink );
m_pSaveCheckBox->SetClickHdl ( aClickLink );
+ m_pCmisButton->SetClickHdl ( aClickLink );
m_pVersionBox->SetSelectHdl( LINK( this, SfxVersionDialog, SelectHdl_Impl ) );
m_pVersionBox->SetDoubleClickHdl( LINK( this, SfxVersionDialog, DClickHdl_Impl ) );
@@ -329,6 +348,7 @@ void SfxVersionDialog::Init_Impl()
m_pViewButton->Disable();
m_pDeleteButton->Disable();
m_pCompareButton->Disable();
+ m_pCmisButton->Enable();
SelectHdl_Impl(m_pVersionBox);
}
@@ -456,6 +476,12 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton )
pViewFrame->GetDispatcher()->Execute( SID_DOCUMENT_COMPARE, SFX_CALLMODE_ASYNCHRON, aSet );
Close();
}
+ else if (pButton == m_pCmisButton)
+ {
+ SfxCmisVersionsDialog* pDlg = new SfxCmisVersionsDialog(pViewFrame, false);
+ pDlg->Execute();
+ delete pDlg;
+ }
return 0L;
}
@@ -504,4 +530,87 @@ IMPL_LINK(SfxViewVersionDialog_Impl, ButtonHdl, Button*, pButton)
return 0L;
}
+SfxCmisVersionsDialog::SfxCmisVersionsDialog ( SfxViewFrame* pVwFrame, sal_Bool bIsSaveVersionOnClose )
+ : SfxModalDialog(NULL, "VersionsCmisDialog", "sfx/ui/versionscmis.ui")
+ , pViewFrame(pVwFrame)
+ , m_pTable(NULL)
+ , m_bIsSaveVersionOnClose(bIsSaveVersionOnClose)
+{
+ get(m_pSaveButton, "save");
+ get(m_pSaveCheckBox, "always");
+ get(m_pOpenButton, "open");
+ get(m_pViewButton, "show");
+ get(m_pDeleteButton, "delete");
+ get(m_pCompareButton, "compare");
+
+ SvSimpleTableContainer *pContainer = get<SvSimpleTableContainer>("versions");
+ Size aControlSize(260, 114);
+ aControlSize = pContainer->LogicToPixel(aControlSize, MAP_APPFONT);
+ pContainer->set_width_request(aControlSize.Width());
+ pContainer->set_height_request(aControlSize.Height());
+
+ m_pVersionBox = new SfxVersionsTabListBox_Impl(*pContainer, WB_TABSTOP);
+
+ m_pVersionBox->GrabFocus();
+ m_pVersionBox->SetStyle( m_pVersionBox->GetStyle() | WB_HSCROLL | WB_CLIPCHILDREN );
+ m_pVersionBox->SetSelectionMode( SINGLE_SELECTION );
+
+ long nTabs_Impl[] = { 3, 0, 0, 0 };
+
+ m_pVersionBox->SvSimpleTable::SetTabs(&nTabs_Impl[0]);
+ OUString sHeader1(get<FixedText>("datetime")->GetText());
+ OUString sHeader2(get<FixedText>("savedby")->GetText());
+ OUString sHeader3(get<FixedText>("comments")->GetText());
+ OUStringBuffer sHeader;
+ sHeader.append(sHeader1).append("\t").append(sHeader2)
+ .append("\t ").append(sHeader3);
+ m_pVersionBox->InsertHeaderEntry(sHeader.makeStringAndClear());
+
+ HeaderBar &rBar = m_pVersionBox->GetTheHeaderBar();
+ HeaderBarItemBits nBits = rBar.GetItemBits(1) | HIB_FIXEDPOS | HIB_FIXED;
+ nBits &= ~HIB_CLICKABLE;
+ rBar.SetItemBits(1, nBits);
+ rBar.SetItemBits(2, nBits);
+ rBar.SetItemBits(3, nBits);
+
+ m_pVersionBox->Resize();
+
+ OUString sText = GetText();
+ sText = sText + " " + pViewFrame->GetObjectShell()->GetTitle();
+ SetText( sText );
+
+ LoadVersions();
+
+ m_pVersionBox->setColSizes();
+
+}
+
+SfxCmisVersionsDialog::~SfxCmisVersionsDialog()
+{
+ delete m_pTable;
+ delete m_pVersionBox;
+}
+
+void SfxCmisVersionsDialog::LoadVersions()
+{
+ SfxObjectShell *pObjShell = pViewFrame->GetObjectShell();
+ uno::Sequence < document::CmisVersion > aVersions = pObjShell->GetCmisVersions( );
+ delete m_pTable;
+ m_pTable = new SfxVersionTableDtor( aVersions );
+ {
+ for ( size_t n = 0; n < m_pTable->size(); ++n )
+ {
+ SfxVersionInfo *pInfo = m_pTable->at( n );
+ OUString aEntry = formatTime(pInfo->aCreationDate, Application::GetSettings().GetLocaleDataWrapper());
+ aEntry += "\t";
+ aEntry += pInfo->aAuthor;
+ aEntry += "\t";
+ aEntry += ConvertWhiteSpaces_Impl( pInfo->aComment );
+ SvTreeListEntry *pEntry = m_pVersionBox->InsertEntry( aEntry );
+ pEntry->SetUserData( pInfo );
+ }
+ }
+
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index a06d519..fc40769 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -405,6 +405,21 @@ void SfxObjectShell::CheckIn( )
}
}
+uno::Sequence< document::CmisVersion > SfxObjectShell::GetCmisVersions( )
+{
+ try
+ {
+ uno::Reference< document::XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY_THROW );
+ return xCmisDoc->getAllVersions( );
+ }
+ catch ( const uno::RuntimeException& e )
+ {
+ ErrorBox* pErrorBox = new ErrorBox( &GetFrame()->GetWindow(), WB_OK, e.Message );
+ pErrorBox->Execute( );
+ delete pErrorBox;
+ }
+ return uno::Sequence< document::CmisVersion > ( );
+}
//--------------------------------------------------------------------
void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 4224e3e..5eae505 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -2604,6 +2604,29 @@ void SAL_CALL SfxBaseModel::checkIn( sal_Bool bIsMajor, const OUString& rMessage
}
}
+uno::Sequence< document::CmisVersion > SAL_CALL SfxBaseModel::getAllVersions( ) throw ( RuntimeException )
+{
+ uno::Sequence< document::CmisVersion > aVersions;
+ SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium();
+ if ( pMedium )
+ {
+ try
+ {
+ ::ucbhelper::Content aContent( pMedium->GetName(),
+ Reference<ucb::XCommandEnvironment>(),
+ comphelper::getProcessComponentContext() );
+
+ Any aResult = aContent.executeCommand( "getAllVersions", Any( ) );
+ aResult >>= aVersions;
+ }
+ catch ( const Exception & e )
+ {
+ throw RuntimeException( e.Message, e.Context );
+ }
+ }
+ return aVersions;
+}
+
sal_Bool SfxBaseModel::getBoolPropertyValue( const OUString& rName ) throw ( RuntimeException )
{
sal_Bool bValue = sal_False;
diff --git a/sfx2/source/inc/versdlg.hxx b/sfx2/source/inc/versdlg.hxx
index bdb30c2..ad96ef0 100644
--- a/sfx2/source/inc/versdlg.hxx
+++ b/sfx2/source/inc/versdlg.hxx
@@ -52,6 +52,7 @@ class SfxVersionDialog : public SfxModalDialog
PushButton* m_pViewButton;
PushButton* m_pDeleteButton;
PushButton* m_pCompareButton;
+ PushButton* m_pCmisButton;
SfxViewFrame* pViewFrame;
SfxVersionTableDtor* m_pTable;
bool m_bIsSaveVersionOnClose;
@@ -84,6 +85,29 @@ public:
SfxViewVersionDialog_Impl(Window *pParent, SfxVersionInfo& rInfo, bool bEdit);
};
+class SfxCmisVersionsDialog : public SfxModalDialog
+{
+ PushButton* m_pSaveButton;
+ CheckBox* m_pSaveCheckBox;
+ SfxVersionsTabListBox_Impl* m_pVersionBox;
+ PushButton* m_pOpenButton;
+ PushButton* m_pViewButton;
+ PushButton* m_pDeleteButton;
+ PushButton* m_pCompareButton;
+ SfxViewFrame* pViewFrame;
+ SfxVersionTableDtor* m_pTable;
+ bool m_bIsSaveVersionOnClose;
+
+ DECL_LINK(DClickHdl_Impl, void *);
+ DECL_LINK(SelectHdl_Impl, void *);
+ DECL_LINK( ButtonHdl_Impl, Button* );
+ void LoadVersions();
+
+public:
+ SfxCmisVersionsDialog ( SfxViewFrame* pFrame, sal_Bool );
+ virtual ~SfxCmisVersionsDialog ();
+};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/uiconfig/ui/versionscmis.ui b/sfx2/uiconfig/ui/versionscmis.ui
new file mode 100644
index 0000000..f5b75ac
--- /dev/null
+++ b/sfx2/uiconfig/ui/versionscmis.ui
@@ -0,0 +1,340 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.6 -->
+ <!-- interface-requires LibreOffice 1.0 -->
+ <object class="GtkDialog" id="VersionsCmisDialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">6</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="layout_style">start</property>
+ <child>
+ <object class="GtkButton" id="close">
+ <property name="label">gtk-close</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="open">
+ <property name="label">gtk-open</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="show">
+ <property name="label" translatable="yes">_Show...</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="delete">
+ <property name="label">gtk-delete</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="compare">
+ <property name="label" translatable="yes">_Compare</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkButton" id="help">
+ <property name="label">gtk-help</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">6</property>
+ <property name="secondary">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="row_spacing">12</property>
+ <child>
+ <object class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkGrid" id="grid2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkButton" id="save">
+ <property name="label" translatable="yes">Save _New Version</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="always">
+ <property name="label" translatable="yes">_Always save a new version on closing</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">New versions</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkGrid" id="grid3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="spacing">12</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <object class="GtkLabel" id="datetime">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes">Date and time</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="savedby">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes">Saved by</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="comments">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes">Comments</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="svtlo-SvSimpleTableContainer" id="versions">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="Simple Table Container-selection1"/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Existing versions</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">close</action-widget>
+ <action-widget response="0">open</action-widget>
+ <action-widget response="0">show</action-widget>
+ <action-widget response="0">delete</action-widget>
+ <action-widget response="0">compare</action-widget>
+ <action-widget response="0">help</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/sfx2/uiconfig/ui/versionsofdialog.ui b/sfx2/uiconfig/ui/versionsofdialog.ui
index 00d197f..45d6276 100644
--- a/sfx2/uiconfig/ui/versionsofdialog.ui
+++ b/sfx2/uiconfig/ui/versionsofdialog.ui
@@ -87,6 +87,20 @@
</packing>
</child>
<child>
+ <object class="GtkButton" id="cmis">
+ <property name="label" translatable="yes">CMIS</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+
+ <child>
<object class="GtkButton" id="help">
<property name="label">gtk-help</property>
<property name="visible">True</property>
@@ -97,7 +111,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">5</property>
+ <property name="position">6</property>
<property name="secondary">True</property>
</packing>
</child>
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 43f8c35..4bc7c3c 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 a3dd3be..d34c03b 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 );
More information about the Libreoffice-commits
mailing list