summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCao Cuong Ngo <cao.cuong.ngo@gmail.com>2013-07-09 18:54:35 +0200
committerCao Cuong Ngo <cao.cuong.ngo@gmail.com>2013-07-09 20:27:16 +0200
commitb9383942694097fd1fa243fe6a5f1962ab3f3671 (patch)
tree2dc4053b9a5e73f30a77969fbe37c9e20312eb05
parentc3d6ada991be98a9764707fd448673a0eb366453 (diff)
CMIS properties dialog: update properties
Change-Id: Ia506713b61dc6c1343eac3640863c86a2fc3f18f
-rw-r--r--include/sfx2/dinfdlg.hxx4
-rw-r--r--include/sfx2/sfxbasemodel.hxx5
-rw-r--r--offapi/com/sun/star/document/XCmisDocument.idl2
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx22
-rw-r--r--sfx2/source/doc/objserv.cxx5
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx23
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx25
-rw-r--r--ucb/source/ucp/cmis/cmis_content.hxx5
8 files changed, 90 insertions, 1 deletions
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index 49eac9b143d3..d38917053caf 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -162,6 +162,10 @@ public:
const com::sun::star::uno::Any& rValue );
std::vector< CmisProperty* > GetCmisProperties() const;
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::document::CmisProperty >
+ GetCmisPropertiesSeq() const;
+
void ClearCmisProperties();
void AddCmisProperty( const OUString& sId, const OUString& sName,
const bool bUpdatable, const bool bRequired,
diff --git a/include/sfx2/sfxbasemodel.hxx b/include/sfx2/sfxbasemodel.hxx
index 10115b6d3631..bcc1bf07d27b 100644
--- a/include/sfx2/sfxbasemodel.hxx
+++ b/include/sfx2/sfxbasemodel.hxx
@@ -1316,6 +1316,11 @@ public:
css::document::CmisProperty >& _cmisproperties )
throw (css::uno::RuntimeException);
+ virtual void SAL_CALL updateCmisProperties(
+ const css::uno::Sequence<
+ css::document::CmisProperty >& _cmisproperties )
+ 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/com/sun/star/document/XCmisDocument.idl b/offapi/com/sun/star/document/XCmisDocument.idl
index 51bcf508649f..4e34a0f9dbc4 100644
--- a/offapi/com/sun/star/document/XCmisDocument.idl
+++ b/offapi/com/sun/star/document/XCmisDocument.idl
@@ -44,6 +44,8 @@ interface XCmisDocument : com::sun::star::uno::XInterface
boolean canCheckIn( );
+ void updateCmisProperties( [in] sequence <com::sun::star::document::CmisProperty> cmisProperties );
+
/** Contains the properties values named after their CMIS ID.
*/
[attribute] sequence <com::sun::star::document::CmisProperty> CmisProperties;
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 8d1e79efafe8..2bf7a0448c3c 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -574,6 +574,28 @@ std::vector< CmisProperty* > SfxDocumentInfoItem::GetCmisProperties() const
return aRet;
}
+uno::Sequence< document::CmisProperty > SfxDocumentInfoItem::GetCmisPropertiesSeq() const
+{
+ Sequence< document::CmisProperty > aPropertiesSeq( m_aCmisProperties.size() );
+ sal_Int32 i = 0;
+ std::vector< CmisProperty* >::const_iterator pIter;
+ for ( pIter = m_aCmisProperties.begin();
+ pIter != m_aCmisProperties.end(); ++pIter, ++i )
+ {
+ CmisProperty* aProp = *pIter;
+ aPropertiesSeq[i].Id = aProp->m_sId;
+ aPropertiesSeq[i].Name = aProp->m_sName;
+ aPropertiesSeq[i].Updatable = aProp->m_bUpdatable;
+ aPropertiesSeq[i].Required = aProp->m_bRequired;
+ aPropertiesSeq[i].MultiValued = aProp->m_bMultiValued;
+ aPropertiesSeq[i].OpenChoice = aProp->m_bOpenChoice;
+ aPropertiesSeq[i].Choices = aProp->m_aChoices;
+ aPropertiesSeq[i].Value = aProp->m_aValue;
+ }
+
+ return aPropertiesSeq;
+}
+
void SfxDocumentInfoItem::ClearCmisProperties()
{
for ( sal_uInt32 i = 0; i < m_aCmisProperties.size(); i++ )
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index acb008fe598d..91a59f7197ea 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -518,10 +518,13 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
{
// user has done some changes to DocumentInfo
pDocInfoItem->UpdateDocumentInfo(getDocProperties());
+ uno::Sequence< document::CmisProperty > aNewCmisProperties =
+ pDocInfoItem->GetCmisPropertiesSeq( );
+ xCmisDoc->updateCmisProperties( aNewCmisProperties );
SetUseUserData( ((const SfxDocumentInfoItem *)pDocInfoItem)->IsUseUserData() );
// add data from dialog for possible recording purpose
rReq.AppendItem( SfxDocumentInfoItem( GetTitle(),
- getDocProperties(), aCmisProperties, IsUseUserData() ) );
+ getDocProperties(), aNewCmisProperties, IsUseUserData() ) );
}
rReq.Done();
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 4f0f7a35a58f..a35f6c5b639b 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -2476,6 +2476,29 @@ void SAL_CALL SfxBaseModel::setCmisProperties( const Sequence< document::CmisPro
m_pData->m_cmisProperties = _cmisproperties;
}
+void SAL_CALL SfxBaseModel::updateCmisProperties( const Sequence< document::CmisProperty >& aProperties )
+ throw ( RuntimeException )
+{
+ SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium();
+ if ( pMedium )
+ {
+ try
+ {
+ ::ucbhelper::Content aContent( pMedium->GetName( ),
+ Reference<ucb::XCommandEnvironment>(),
+ comphelper::getProcessComponentContext() );\
+
+ aContent.executeCommand( "updateProperties", uno::makeAny( aProperties ) );
+ loadCmisProperties( );
+ }
+ catch (const Exception & e)
+ {
+ throw RuntimeException( e.Message, e.Context );
+ }
+ }
+
+}
+
void SAL_CALL SfxBaseModel::checkOut( ) throw ( RuntimeException )
{
SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium();
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 34da455a5933..370b402c991e 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -416,6 +416,25 @@ namespace cmis
static_cast< cppu::OWeakObject * >( this ), -1) );
}
+ libcmis::ObjectPtr Content::updateProperties(
+ const uno::Any& /*iCmisProps*/,
+ const uno::Reference< ucb::XCommandEnvironment >& xEnv )
+ {
+ // TODO convert iCmisProps to aProperties;
+ map< string, libcmis::PropertyPtr > aProperties;
+ libcmis::ObjectPtr updateObj;
+ try
+ {
+ updateObj = getObject( xEnv )->updateProperties( aProperties );
+ }
+ catch ( const libcmis::Exception& e )
+ {
+ SAL_INFO( "cmisucp", "Unexpected libcmis exception: "<< e.what( ) );
+ }
+
+ return updateObj;
+ }
+
uno::Reference< sdbc::XRow > Content::getPropertyValues(
const uno::Sequence< beans::Property >& rProperties,
const uno::Reference< ucb::XCommandEnvironment >& xEnv )
@@ -1331,6 +1350,8 @@ namespace cmis
ucb::CommandInfo ( OUString( "cancelCheckout" ), -1, getCppuVoidType() ),
ucb::CommandInfo ( OUString( "checkIn" ), -1,
getCppuType( static_cast<ucb::TransferInfo * >( 0 ) ) ),
+ ucb::CommandInfo ( OUString( "updateProperties" ), -1, getCppuVoidType() ),
+
// Folder Only, omitted if not a folder
ucb::CommandInfo
@@ -1538,6 +1559,10 @@ namespace cmis
}
aRet <<= checkIn( aArg, xEnv );
}
+ else if ( aCommand.Name == "updateProperties" )
+ {
+ updateProperties( aCommand.Argument, xEnv );
+ }
else
{
SAL_INFO( "cmisucp", "Unknown command to execute" );
diff --git a/ucb/source/ucp/cmis/cmis_content.hxx b/ucb/source/ucp/cmis/cmis_content.hxx
index 88e239208440..56c9890cfa17 100644
--- a/ucb/source/ucp/cmis/cmis_content.hxx
+++ b/ucb/source/ucp/cmis/cmis_content.hxx
@@ -143,6 +143,11 @@ public:
getProperties( const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment > & xEnv );
+ virtual libcmis::ObjectPtr updateProperties(
+ const com::sun::star::uno::Any& iCmisProps,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > & xEnv);
+
virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >
getCommands( const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment > & xEnv );