summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCao Cuong Ngo <cao.cuong.ngo@gmail.com>2013-08-23 15:43:03 +0200
committerCao Cuong Ngo <cao.cuong.ngo@gmail.com>2013-08-23 15:43:03 +0200
commit90565319e35b11366f97c09d382ec7e7ce8b2580 (patch)
treee96106632980687de59ed542bc6769f33545ae8b
parent3e3008d518f09f5ce95cc00aa7d739f8a6eb6989 (diff)
CMIS properties dialog: get multiple values
Change-Id: Ife7562d52cc3070c8d409f2da68d4e2aa5faea69
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx25
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx136
2 files changed, 57 insertions, 104 deletions
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index f73024de1999..682278c16a66 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -2182,43 +2182,42 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName,
pNewLine->m_aName->SetText( sName );
- SvtSysLocale aSysLocale;
- const LocaleDataWrapper& rLocaleWrapper = aSysLocale.GetLocaleData();
OUString sValue;
if ( sType == CMIS_TYPE_INTEGER )
{
- sal_Int64 nTmpValue = 0;
+ Sequence< sal_Int64 > nTmpValue;
rAny >>= nTmpValue;
sal_uInt32 nIndex = m_aNumberFormatter.GetFormatIndex( NF_NUMBER_SYSTEM );
- m_aNumberFormatter.GetInputLineString( nTmpValue, nIndex, sValue );
+ m_aNumberFormatter.GetInputLineString( nTmpValue[0], nIndex, sValue );
}
else if ( sType == CMIS_TYPE_DECIMAL )
{
- double dTmpValue = 0.0;
+ Sequence< double > dTmpValue;
rAny >>= dTmpValue;
sal_uInt32 nIndex = m_aNumberFormatter.GetFormatIndex( NF_NUMBER_SYSTEM );
- m_aNumberFormatter.GetInputLineString( dTmpValue, nIndex, sValue );
+ m_aNumberFormatter.GetInputLineString( dTmpValue[0], nIndex, sValue );
}
else if ( sType == CMIS_TYPE_BOOL )
{
- bool bTmpValue = false;
+ Sequence< bool > bTmpValue;
rAny >>= bTmpValue;
- sValue = ( bTmpValue ? rLocaleWrapper.getTrueWord() : rLocaleWrapper.getFalseWord() );
- if ( bTmpValue )
+ if ( bTmpValue[0] )
pNewLine->m_aYesButton->Check();
else
pNewLine->m_aNoButton->Check();
}
else if ( sType == CMIS_TYPE_STRING )
{
- rAny >>= sValue;
+ Sequence< OUString > seqValue;
+ rAny >>= seqValue;
+ sValue = seqValue[0];
}
else if ( sType == CMIS_TYPE_DATETIME )
{
- util::DateTime aTmpDateTime;
+ Sequence< util::DateTime > aTmpDateTime;
rAny >>= aTmpDateTime;
- pNewLine->m_aDateField->SetDate( Date( aTmpDateTime.Day, aTmpDateTime.Month, aTmpDateTime.Year ) );
- pNewLine->m_aTimeField->SetTime( Time( aTmpDateTime.Hours, aTmpDateTime.Minutes, aTmpDateTime.Seconds, aTmpDateTime.NanoSeconds ) );
+ pNewLine->m_aDateField->SetDate( Date( aTmpDateTime[0].Day, aTmpDateTime[0].Month, aTmpDateTime[0].Year ) );
+ pNewLine->m_aTimeField->SetTime( Time( aTmpDateTime[0].Hours, aTmpDateTime[0].Minutes, aTmpDateTime[0].Seconds, aTmpDateTime[0].NanoSeconds ) );
}
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 6ac4106e6306..5b8451cff881 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -85,114 +85,78 @@ namespace
uno::Any lcl_cmisPropertyToUno( libcmis::PropertyPtr pProperty )
{
uno::Any aValue;
- bool bMultiValued = pProperty->getPropertyType( )->isMultiValued( );
switch ( pProperty->getPropertyType( )->getType( ) )
{
default:
case libcmis::PropertyType::String:
{
vector< string > aCmisStrings = pProperty->getStrings( );
- if ( bMultiValued )
+ uno::Sequence< OUString > aStrings( aCmisStrings.size( ) );
+ OUString* aStringsArr = aStrings.getArray( );
+ sal_Int32 i = 0;
+ for ( vector< string >::iterator it = aCmisStrings.begin( );
+ it != aCmisStrings.end( ); ++it, ++i )
{
- uno::Sequence< OUString > aStrings( aCmisStrings.size( ) );
- OUString* aStringsArr = aStrings.getArray( );
- sal_Int32 i = 0;
- for ( vector< string >::iterator it = aCmisStrings.begin( );
- it != aCmisStrings.end( ); ++it, ++i )
- {
- string str = *it;
- aStringsArr[i] = STD_TO_OUSTR( str );
- }
- aValue <<= aStrings;
- }
- else if ( !aCmisStrings.empty( ) )
- {
- aValue <<= STD_TO_OUSTR( aCmisStrings.front( ) );
+ string str = *it;
+ aStringsArr[i] = STD_TO_OUSTR( str );
}
+ aValue <<= aStrings;
}
break;
case libcmis::PropertyType::Integer:
{
vector< long > aCmisLongs = pProperty->getLongs( );
- if ( bMultiValued )
+ uno::Sequence< sal_Int64 > aLongs( aCmisLongs.size( ) );
+ sal_Int64* aLongsArr = aLongs.getArray( );
+ sal_Int32 i = 0;
+ for ( vector< long >::iterator it = aCmisLongs.begin( );
+ it != aCmisLongs.end( ); ++it, ++i )
{
- uno::Sequence< sal_Int64 > aLongs( aCmisLongs.size( ) );
- sal_Int64* aLongsArr = aLongs.getArray( );
- sal_Int32 i = 0;
- for ( vector< long >::iterator it = aCmisLongs.begin( );
- it != aCmisLongs.end( ); ++it, ++i )
- {
- aLongsArr[i] = *it;
- }
- aValue <<= aLongs;
- }
- else if ( !aCmisLongs.empty( ) )
- {
- aValue <<= aCmisLongs.front( );
+ aLongsArr[i] = *it;
}
+ aValue <<= aLongs;
}
break;
case libcmis::PropertyType::Decimal:
{
vector< double > aCmisDoubles = pProperty->getDoubles( );
- if ( bMultiValued )
- {
- uno::Sequence< double > aDoubles( aCmisDoubles.size( ) );
- double* aDoublesArr = aDoubles.getArray( );
- sal_Int32 i = 0;
- for ( vector< double >::iterator it = aCmisDoubles.begin( );
- it != aCmisDoubles.end( ); ++it, ++i )
- {
- aDoublesArr[i] = *it;
- }
- aValue <<= aDoubles;
- }
- else if ( !aCmisDoubles.empty( ) )
+ uno::Sequence< double > aDoubles( aCmisDoubles.size( ) );
+ double* aDoublesArr = aDoubles.getArray( );
+ sal_Int32 i = 0;
+ for ( vector< double >::iterator it = aCmisDoubles.begin( );
+ it != aCmisDoubles.end( ); ++it, ++i )
{
- aValue <<= aCmisDoubles.front( );
+ aDoublesArr[i] = *it;
}
+ aValue <<= aDoubles;
}
break;
case libcmis::PropertyType::Bool:
{
vector< bool > aCmisBools = pProperty->getBools( );
- if ( bMultiValued )
+ uno::Sequence< sal_Bool > aBools( aCmisBools.size( ) );
+ sal_Bool* aBoolsArr = aBools.getArray( );
+ sal_Int32 i = 0;
+ for ( vector< bool >::iterator it = aCmisBools.begin( );
+ it != aCmisBools.end( ); ++it, ++i )
{
- uno::Sequence< sal_Bool > aBools( aCmisBools.size( ) );
- sal_Bool* aBoolsArr = aBools.getArray( );
- sal_Int32 i = 0;
- for ( vector< bool >::iterator it = aCmisBools.begin( );
- it != aCmisBools.end( ); ++it, ++i )
- {
- aBoolsArr[i] = *it;
- }
- aValue <<= aBools;
- }
- else if ( !aCmisBools.empty( ) )
- {
- aValue <<= sal_Bool( aCmisBools.front( ) );
+ aBoolsArr[i] = *it;
}
+ aValue <<= aBools;
}
break;
case libcmis::PropertyType::DateTime:
{
vector< boost::posix_time::ptime > aCmisTimes = pProperty->getDateTimes( );
- if ( bMultiValued )
+ uno::Sequence< util::DateTime > aTimes( aCmisTimes.size( ) );
+ util::DateTime* aTimesArr = aTimes.getArray( );
+ sal_Int32 i = 0;
+ for ( vector< boost::posix_time::ptime >::iterator it = aCmisTimes.begin( );
+ it != aCmisTimes.end( ); ++it, ++i )
{
- uno::Sequence< util::DateTime > aTimes( aCmisTimes.size( ) );
- util::DateTime* aTimesArr = aTimes.getArray( );
- sal_Int32 i = 0;
- for ( vector< boost::posix_time::ptime >::iterator it = aCmisTimes.begin( );
- it != aCmisTimes.end( ); ++it, ++i )
- {
- aTimesArr[i] = lcl_boostToUnoTime( *it );
- }
- aValue <<= aTimes;
- }
- else if ( !aCmisTimes.empty( ) )
- {
- aValue <<= lcl_boostToUnoTime( aCmisTimes.front( ) );
+ aTimesArr[i] = lcl_boostToUnoTime( *it );
}
+ aValue <<= aTimes;
}
break;
}
@@ -215,11 +179,11 @@ namespace
type = libcmis::PropertyType::String;
else if ( prop.Type == CMIS_TYPE_BOOL )
type = libcmis::PropertyType::Bool;
- else if ( prop.Type == CMIS_TYPE_INTEGER )
+ else if ( prop.Type == CMIS_TYPE_INTEGER )
type = libcmis::PropertyType::Integer;
- else if ( prop.Type == CMIS_TYPE_DECIMAL )
+ else if ( prop.Type == CMIS_TYPE_DECIMAL )
type = libcmis::PropertyType::Decimal;
- else if ( prop.Type == CMIS_TYPE_DATETIME )
+ else if ( prop.Type == CMIS_TYPE_DATETIME )
type = libcmis::PropertyType::DateTime;
propertyType->setId( OUSTR_TO_STDSTR( id ));
@@ -233,23 +197,13 @@ namespace
std::vector< std::string > values;
// convert UNO value to string vector
- if ( bMultiValued )
- {
- uno::Sequence< OUString > aStrings;
- value >>= aStrings;
- sal_Int32 len = aStrings.getLength( );
- for ( sal_Int32 i = 0; i < len; i++ )
- {
- string str = OUSTR_TO_STDSTR( aStrings[i] );
- values.push_back( str );
- }
- }
- else
+ uno::Sequence< OUString > aStrings;
+ value >>= aStrings;
+ sal_Int32 len = aStrings.getLength( );
+ for ( sal_Int32 i = 0; i < len; i++ )
{
- OUString val;
- value >>= val;
- std::string str = OUSTR_TO_STDSTR( val );
- values.push_back( str);
+ string str = OUSTR_TO_STDSTR( aStrings[i] );
+ values.push_back( str );
}
libcmis::PropertyPtr property( new libcmis::Property( propertyType, values ) );