summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCao Cuong Ngo <cao.cuong.ngo@gmail.com>2013-07-09 18:54:35 +0200
committerCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2013-09-02 13:51:49 +0200
commitd259e07e851cafa4e0ca68f7ab18535e82c7aed5 (patch)
tree3d1ea1858ffc9cd3b57d24d7a5cbcc131eff0e18
parentb56a9a22dadc2f78be1c898505a884774fc19e25 (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 7f8ca55ea8db..9650a0f947c7 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -164,6 +164,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 d36eeb9ab0ae..1ddedc8cc63b 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 d5a68c8c6621..e2de7c9b5b03 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -576,6 +576,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 f7b7a7fc4a4e..b89343ec7440 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 8ee40854fe21..1fc65d2279af 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -2474,6 +2474,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 7c1355dce462..3b0093ff2022 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -413,6 +413,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 )
@@ -1328,6 +1347,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
@@ -1535,6 +1556,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 76d523efb70e..669360f92747 100644
--- a/ucb/source/ucp/cmis/cmis_content.hxx
+++ b/ucb/source/ucp/cmis/cmis_content.hxx
@@ -140,6 +140,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 );