diff options
author | Cao Cuong Ngo <cao.cuong.ngo@gmail.com> | 2013-07-10 16:11:04 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2013-09-02 13:51:50 +0200 |
commit | b3a2011b4c81d2c2ac4f816fe0b2b445d8dec4f0 (patch) | |
tree | 15841832834391b13fc0a6aeca66e2f8b113d52b | |
parent | 7c29619b4673465b5f2dd589e5d6fb8234364397 (diff) |
Cmis update properties
Change-Id: I13db07386f766019701ad9348988dcede718660c
-rw-r--r-- | include/sfx2/dinfdlg.hxx | 5 | ||||
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 54 |
2 files changed, 45 insertions, 14 deletions
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx index 9650a0f947c7..2522bc55b93a 100644 --- a/include/sfx2/dinfdlg.hxx +++ b/include/sfx2/dinfdlg.hxx @@ -590,6 +590,11 @@ public: struct CmisPropertyLine { + OUString m_sId; + bool m_bUpdatable; + bool m_bRequired; + bool m_bMultiValued; + bool m_bOpenChoice; FixedText m_aName; FixedText m_aType; CmisPropertiesEdit m_aValueEdit; diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index e2de7c9b5b03..a53281ac85e7 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -578,21 +578,33 @@ std::vector< CmisProperty* > SfxDocumentInfoItem::GetCmisProperties() const uno::Sequence< document::CmisProperty > SfxDocumentInfoItem::GetCmisPropertiesSeq() const { - Sequence< document::CmisProperty > aPropertiesSeq( m_aCmisProperties.size() ); + sal_Int32 i = 0; std::vector< CmisProperty* >::const_iterator pIter; + sal_Int32 updatableCount = 0, nCount = 0; + + for ( pIter = m_aCmisProperties.begin(); + pIter != m_aCmisProperties.end(); ++pIter, ++i ) + { + if ( ( *pIter )->m_bUpdatable ) updatableCount++; + } + Sequence< document::CmisProperty > aPropertiesSeq( updatableCount ); + for ( pIter = m_aCmisProperties.begin(); - pIter != m_aCmisProperties.end(); ++pIter, ++i ) + pIter != m_aCmisProperties.end(); ++pIter, ++i ) + if (( *pIter )->m_bUpdatable ) { 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; + aPropertiesSeq[nCount].Id = aProp->m_sId; + aPropertiesSeq[nCount].Name = aProp->m_sName; + aPropertiesSeq[nCount].Updatable = aProp->m_bUpdatable; + aPropertiesSeq[nCount].Required = aProp->m_bRequired; + aPropertiesSeq[nCount].MultiValued = aProp->m_bMultiValued; + aPropertiesSeq[nCount].OpenChoice = aProp->m_bOpenChoice; + aPropertiesSeq[nCount].Choices = aProp->m_aChoices; + aPropertiesSeq[nCount].Value = aProp->m_aValue; + + nCount++; } return aPropertiesSeq; @@ -2303,6 +2315,7 @@ void CmisPropertiesYesNoButton::Resize() // struct CmisPropertyLine --------------------------------------------- CmisPropertyLine::CmisPropertyLine( Window* pParent ) : + m_sId ( ), m_aName ( pParent, SfxResId( SFX_CMIS_PROPERTY_NAME ) ), m_aType ( pParent, SfxResId( SFX_CMIS_PROPERTY_TYPE ) ), m_aValueEdit ( pParent, SfxResId( SFX_CMIS_ED_PROPERTY_VALUE ), this ), @@ -2501,12 +2514,19 @@ void CmisPropertiesWindow::updateLineWidth() } } -void CmisPropertiesWindow::AddLine( const OUString& /*sId*/, const OUString& sName, - const bool bUpdatable, const bool /*bRequired*/, - const bool /*bMultiValued*/, const bool /*bOpenChoice*/, +void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName, + const bool bUpdatable, const bool bRequired, + const bool bMultiValued, const bool bOpenChoice, Any& /*aChoices*/, Any& rAny ) { CmisPropertyLine* pNewLine = new CmisPropertyLine( this ); + + pNewLine->m_sId = sId; + pNewLine->m_bUpdatable = bUpdatable; + pNewLine->m_bRequired = bRequired; + pNewLine->m_bMultiValued = bMultiValued; + pNewLine->m_bOpenChoice = bOpenChoice; + pNewLine->m_aValueEdit.SetLoseFocusHdl( LINK( this, CmisPropertiesWindow, EditLoseFocusHdl ) ); pNewLine->m_aName.SetAccessibleName(m_aName.GetAccessibleName()); @@ -2669,6 +2689,12 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con { CmisPropertyLine* pLine = *pIter; + aPropertiesSeq[i].Id = pLine->m_sId; + aPropertiesSeq[i].Updatable = pLine->m_bUpdatable; + aPropertiesSeq[i].Required = pLine->m_bRequired; + aPropertiesSeq[i].OpenChoice = pLine->m_bOpenChoice; + aPropertiesSeq[i].MultiValued = pLine->m_bMultiValued; + String sPropertyName = pLine->m_aName.GetText(); if ( sPropertyName.Len() > 0 ) { @@ -2845,7 +2871,7 @@ sal_Bool SfxCmisPropertiesPage::FillItemSet( SfxItemSet& rSet ) sal_Int32 i = 0, nCount = aPropertySeq.getLength(); for ( ; i < nCount; ++i ) { - if ( !aPropertySeq[i].Name.isEmpty() ) + if ( !aPropertySeq[i].Id.isEmpty() ) pInfo->AddCmisProperty( aPropertySeq[i].Id, aPropertySeq[i].Name, aPropertySeq[i].Updatable, |