include/sfx2/dinfdlg.hxx | 4 ++++ include/sfx2/sfxbasemodel.hxx | 5 +++++ offapi/com/sun/star/document/XCmisDocument.idl | 2 ++ sfx2/source/dialog/dinfdlg.cxx | 22 ++++++++++++++++++++++ sfx2/source/doc/objserv.cxx | 5 ++++- sfx2/source/doc/sfxbasemodel.cxx | 23 +++++++++++++++++++++++ ucb/source/ucp/cmis/cmis_content.cxx | 25 +++++++++++++++++++++++++ ucb/source/ucp/cmis/cmis_content.hxx | 5 +++++ 8 files changed, 90 insertions(+), 1 deletion(-)
New commits: commit b9383942694097fd1fa243fe6a5f1962ab3f3671 Author: Cao Cuong Ngo <cao.cuong....@gmail.com> Date: Tue Jul 9 18:54:35 2013 +0200 CMIS properties dialog: update properties Change-Id: Ia506713b61dc6c1343eac3640863c86a2fc3f18f diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx index 49eac9b..d389170 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 10115b6..bcc1bf0 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 51bcf50..4e34a0f 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 8d1e79e..2bf7a04 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 acb008f..91a59f7 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 4f0f7a3..a35f6c5 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 34da455..370b402 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 88e2392..56c9890 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 ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits