cui/source/options/optaboutconfig.cxx | 574 +++++++++++++++++----------------- cui/source/options/optaboutconfig.hxx | 2 2 files changed, 299 insertions(+), 277 deletions(-)
New commits: commit eb0c9b43e7f09054a864eb44c24c43b27c0f21f5 Author: Mihály Palenik <palenik.mih...@gmail.com> Date: Mon Jun 22 13:38:04 2015 +0200 Review Expert Configuration dialog's tree view. In Expert configuration dialog's tree view didn't work correctly. Now I followed the old pattern. Additionaly the entries' name are shorter. Change-Id: Ib7ecd065f02c8f3bbef94daf7f32cb68ab676ee8 Reviewed-on: https://gerrit.libreoffice.org/16411 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index f2de149..cd1cd4b 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -55,6 +55,23 @@ struct Prop_Impl {} }; +struct UserData +{ + bool bIsPropertyPath; + OUString sPropertyPath; + Reference<XNameAccess> aXNameAccess; + + UserData( OUString rPropertyPath ) + : bIsPropertyPath( true ) + , sPropertyPath(rPropertyPath) + {} + + UserData( Reference<XNameAccess> rXNameAccess ) + : bIsPropertyPath( false ) + , aXNameAccess( rXNameAccess ) + {} +}; + VCL_BUILDER_FACTORY_ARGS(CuiCustomMultilineEdit,WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK) void CuiCustomMultilineEdit::KeyInput( const KeyEvent& rKeyEvent ) @@ -176,7 +193,7 @@ void CuiAboutConfigTabPage::dispose() ModelessDialog::dispose(); } -void CuiAboutConfigTabPage::InsertEntry(const OUString& rProp, const OUString& rStatus, +void CuiAboutConfigTabPage::InsertEntry(const OUString& rPropertyPath, const OUString& rProp, const OUString& rStatus, const OUString& rType, const OUString& rValue, SvTreeListEntry *pParentEntry) { SvTreeListEntry* pEntry = new SvTreeListEntry; @@ -185,6 +202,7 @@ void CuiAboutConfigTabPage::InsertEntry(const OUString& rProp, const OUString& r pEntry->AddItem( new SvLBoxString( pEntry, 0, rStatus)); pEntry->AddItem( new SvLBoxString( pEntry, 0, rType)); pEntry->AddItem( new SvLBoxString( pEntry, 0, rValue)); + pEntry->SetUserData( new UserData(rPropertyPath) ); m_pPrefBox->Insert( pEntry, pParentEntry ); @@ -228,208 +246,208 @@ bool CuiAboutConfigTabPage::FillItemSet() void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAccess, SvTreeListEntry *pParentEntry) { + OUString sPath = Reference< XHierarchicalName >( + xNameAccess, uno::UNO_QUERY_THROW )->getHierarchicalName(); uno::Sequence< OUString > seqItems = xNameAccess->getElementNames(); for( sal_Int32 i = 0; i < seqItems.getLength(); ++i ) { Any aNode = xNameAccess->getByName( seqItems[i] ); - Reference< XNameAccess > xChildNameAccess; + bool bNotLeaf = false; + + Reference< XNameAccess > xNextNameAccess; try { - xChildNameAccess = Reference< XNameAccess >(aNode, uno::UNO_QUERY); - OUString sPath = Reference< XHierarchicalName >( - xChildNameAccess, uno::UNO_QUERY_THROW )->getHierarchicalName(); - uno::Sequence< OUString > seqChildItems = xChildNameAccess->getElementNames(); + xNextNameAccess = Reference< XNameAccess >(aNode, uno::UNO_QUERY); + bNotLeaf = xNextNameAccess.is(); + } + catch (const RuntimeException& e) + { + SAL_WARN( "cui.options", "CuiAboutConfigTabPage: exception " << e.Message); + } - bool bIsNotLeaf = false; + if (bNotLeaf) + { + // not leaf node + SvTreeListEntry* pEntry = new SvTreeListEntry; + pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, SvTreeListBox::GetDefaultExpandedNodeImage(), + SvTreeListBox::GetDefaultCollapsedNodeImage(), false)); + pEntry->AddItem( new SvLBoxString( pEntry, 0, seqItems[i])); + //It is needed, without this the selection line will be truncated. + pEntry->AddItem( new SvLBoxString( pEntry, 0, "")); + pEntry->AddItem( new SvLBoxString( pEntry, 0, "")); + pEntry->AddItem( new SvLBoxString( pEntry, 0, "")); + + pEntry->SetUserData( new UserData(xNextNameAccess) ); + m_pPrefBox->Insert( pEntry, pParentEntry ); + } + else + { + // leaf node + OUString sType = aNode.getValueTypeName(); - for( sal_Int32 l = 0; l < seqChildItems.getLength(); ++l ) + OUString sValue; + switch( aNode.getValueType().getTypeClass() ) { - aNode = xChildNameAccess->getByName( seqChildItems[l] ); - - Reference< XNameAccess > xGrandChildNameAccess = Reference< XNameAccess >(aNode, uno::UNO_QUERY); - if(xGrandChildNameAccess.is()) - { - // not leaf node - if(bIsNotLeaf) - continue; - SvTreeListEntry* pEntry = new SvTreeListEntry; - pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, SvTreeListBox::GetDefaultExpandedNodeImage(), - SvTreeListBox::GetDefaultCollapsedNodeImage(), false)); - pEntry->AddItem( new SvLBoxString( pEntry, 0, sPath)); - //It is needed, without this the selection line will be truncated. - pEntry->AddItem( new SvLBoxString( pEntry, 0, "")); - pEntry->AddItem( new SvLBoxString( pEntry, 0, "")); - pEntry->AddItem( new SvLBoxString( pEntry, 0, "")); - - pEntry->SetUserData( new Reference<XNameAccess>(xChildNameAccess) ); - m_pPrefBox->Insert( pEntry, pParentEntry ); - bIsNotLeaf = true; - } - else - { - // leaf node - OUString sType = aNode.getValueTypeName(); - - OUString sValue; - switch( aNode.getValueType().getTypeClass() ) - { - case ::com::sun::star::uno::TypeClass_VOID: - break; + case ::com::sun::star::uno::TypeClass_VOID: + break; - case ::com::sun::star::uno::TypeClass_BOOLEAN: - sValue = OUString::boolean( aNode.get<bool>() ); - break; + case ::com::sun::star::uno::TypeClass_BOOLEAN: + sValue = OUString::boolean( aNode.get<bool>() ); + break; - case ::com::sun::star::uno::TypeClass_SHORT: - case ::com::sun::star::uno::TypeClass_LONG: - case ::com::sun::star::uno::TypeClass_HYPER: - sValue = OUString::number( aNode.get<sal_Int64>() ); - break; + case ::com::sun::star::uno::TypeClass_SHORT: + case ::com::sun::star::uno::TypeClass_LONG: + case ::com::sun::star::uno::TypeClass_HYPER: + sValue = OUString::number( aNode.get<sal_Int64>() ); + break; - case ::com::sun::star::uno::TypeClass_DOUBLE: - sValue = OUString::number( aNode.get<double>() ); - break; + case ::com::sun::star::uno::TypeClass_DOUBLE: + sValue = OUString::number( aNode.get<double>() ); + break; - case ::com::sun::star::uno::TypeClass_STRING: - sValue = aNode.get<OUString>(); - break; + case ::com::sun::star::uno::TypeClass_STRING: + sValue = aNode.get<OUString>(); + break; - case ::com::sun::star::uno::TypeClass_SEQUENCE: - if( sType == "[]boolean" ) + case ::com::sun::star::uno::TypeClass_SEQUENCE: + if( sType == "[]boolean" ) + { + uno::Sequence<sal_Bool> seq = aNode.get< uno::Sequence<sal_Bool> >(); + for( sal_Int32 j = 0; j != seq.getLength(); ++j ) + { + if( j != 0 ) { - uno::Sequence<sal_Bool> seq = aNode.get< uno::Sequence<sal_Bool> >(); - for( sal_Int32 j = 0; j != seq.getLength(); ++j ) - { - if( j != 0 ) - { - sValue += ","; - } - sValue += OUString::boolean( seq[j] ); - } + sValue += ","; } - else if( sType == "[]byte" ) + sValue += OUString::boolean( seq[j] ); + } + } + else if( sType == "[]byte" ) + { + uno::Sequence<sal_Int8> seq = aNode.get< uno::Sequence<sal_Int8> >(); + for( sal_Int32 j = 0; j != seq.getLength(); ++j ) + { + OUString s = OUString::number( + static_cast<sal_uInt8>(seq[j]), 16 ); + if( s.getLength() == 1 ) { - uno::Sequence<sal_Int8> seq = aNode.get< uno::Sequence<sal_Int8> >(); - for( sal_Int32 j = 0; j != seq.getLength(); ++j ) - { - OUString s = OUString::number( - static_cast<sal_uInt8>(seq[j]), 16 ); - if( s.getLength() == 1 ) - { - sValue += "0"; - } - sValue += s.toAsciiUpperCase(); - } + sValue += "0"; } - else if( sType == "[][]byte" ) + sValue += s.toAsciiUpperCase(); + } + } + else if( sType == "[][]byte" ) + { + uno::Sequence< uno::Sequence<sal_Int8> > seq = aNode.get< uno::Sequence< uno::Sequence<sal_Int8> > >(); + for( sal_Int32 j = 0; j != seq.getLength(); ++j ) + { + if( j != 0 ) { - uno::Sequence< uno::Sequence<sal_Int8> > seq = aNode.get< uno::Sequence< uno::Sequence<sal_Int8> > >(); - for( sal_Int32 j = 0; j != seq.getLength(); ++j ) - { - if( j != 0 ) - { - sValue += ","; - } - for( sal_Int32 k = 0; k != seq[j].getLength(); ++k ) - { - OUString s = OUString::number( - static_cast<sal_uInt8>(seq[j][k]), 16 ); - if( s.getLength() == 1 ) - { - sValue += "0"; - } - sValue += s.toAsciiUpperCase(); - } - } + sValue += ","; } - else if( sType == "[]short" ) + for( sal_Int32 k = 0; k != seq[j].getLength(); ++k ) { - uno::Sequence<sal_Int16> seq = aNode.get< uno::Sequence<sal_Int16> >(); - for( sal_Int32 j = 0; j != seq.getLength(); ++j ) + OUString s = OUString::number( + static_cast<sal_uInt8>(seq[j][k]), 16 ); + if( s.getLength() == 1 ) { - if( j != 0 ) - { - sValue += ","; - } - sValue += OUString::number( seq[j] ); + sValue += "0"; } + sValue += s.toAsciiUpperCase(); } - else if( sType == "[]long" ) + } + } + else if( sType == "[]short" ) + { + uno::Sequence<sal_Int16> seq = aNode.get< uno::Sequence<sal_Int16> >(); + for( sal_Int32 j = 0; j != seq.getLength(); ++j ) + { + if( j != 0 ) { - uno::Sequence<sal_Int32> seq = aNode.get< uno::Sequence<sal_Int32> >(); - for( sal_Int32 j = 0; j != seq.getLength(); ++j ) - { - if( j != 0 ) - { - sValue += ","; - } - sValue += OUString::number( seq[j] ); - } + sValue += ","; } - else if( sType == "[]hyper" ) + sValue += OUString::number( seq[j] ); + } + } + else if( sType == "[]long" ) + { + uno::Sequence<sal_Int32> seq = aNode.get< uno::Sequence<sal_Int32> >(); + for( sal_Int32 j = 0; j != seq.getLength(); ++j ) + { + if( j != 0 ) { - uno::Sequence<sal_Int64> seq = aNode.get< uno::Sequence<sal_Int64> >(); - for( sal_Int32 j = 0; j != seq.getLength(); ++j ) - { - if( j != 0 ) - { - sValue += ","; - } - sValue += OUString::number( seq[j] ); - } + sValue += ","; } - else if( sType == "[]double" ) + sValue += OUString::number( seq[j] ); + } + } + else if( sType == "[]hyper" ) + { + uno::Sequence<sal_Int64> seq = aNode.get< uno::Sequence<sal_Int64> >(); + for( sal_Int32 j = 0; j != seq.getLength(); ++j ) + { + if( j != 0 ) { - uno::Sequence<double> seq = aNode.get< uno::Sequence<double> >(); - for( sal_Int32 j = 0; j != seq.getLength(); ++j ) - { - if( j != 0 ) - { - sValue += ","; - } - sValue += OUString::number( seq[j] ); - } + sValue += ","; } - else if( sType == "[]string" ) + sValue += OUString::number( seq[j] ); + } + } + else if( sType == "[]double" ) + { + uno::Sequence<double> seq = aNode.get< uno::Sequence<double> >(); + for( sal_Int32 j = 0; j != seq.getLength(); ++j ) + { + if( j != 0 ) { - uno::Sequence<OUString> seq = aNode.get< uno::Sequence<OUString> >(); - for( sal_Int32 j = 0; j != seq.getLength(); ++j ) - { - if( j != 0 ) - { - sValue += ","; - } - sValue += seq[j]; - } + sValue += ","; } - else + sValue += OUString::number( seq[j] ); + } + } + else if( sType == "[]string" ) + { + uno::Sequence<OUString> seq = aNode.get< uno::Sequence<OUString> >(); + for( sal_Int32 j = 0; j != seq.getLength(); ++j ) + { + if( j != 0 ) { - SAL_WARN( - "cui.options", - "path \"" << sPath << "\" member " << seqItems[i] - << " of unsupported type " << sType); + sValue += ","; } - break; - - default: - SAL_WARN( - "cui.options", - "path \"" << sPath << "\" member " << seqItems[i] - << " of unsupported type " << sType); - break; + sValue += seq[j]; } - - InsertEntry( sPath, seqChildItems[l], sType, sValue, pParentEntry); } + else + { + SAL_WARN( + "cui.options", + "path \"" << sPath << "\" member " << seqItems[i] + << " of unsupported type " << sType); + } + break; + + default: + SAL_WARN( + "cui.options", + "path \"" << sPath << "\" member " << seqItems[i] + << " of unsupported type " << sType); + break; } - } - catch (const RuntimeException& e) - { - SAL_WARN( "cui.options", "CuiAboutConfigTabPage: exception " << e.Message); + + //Short name + int index = 0; + int lineage; + SvTreeListEntry *parentEntry = pParentEntry; + for(lineage = 0; parentEntry != nullptr; ++lineage) + parentEntry = m_pPrefBox->GetParent(parentEntry); + + for(int j = 1; j < lineage; ++j) + index = sPath.indexOf("/", index + 1); + + InsertEntry(sPath, sPath.copy(index+1), seqItems[i], sType, sValue, pParentEntry); } } - m_pPrefBox->SetAlternatingRowColors( true ); } @@ -531,21 +549,22 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl ) { SvTreeListEntry* pEntry = m_pPrefBox->FirstSelected(); - if(pEntry->GetUserData() != nullptr) + UserData *pUserData = static_cast<UserData*>(pEntry->GetUserData()); + if(!pUserData->bIsPropertyPath) { //if selection is not node if(!pEntry->HasChildren()) - FillItems( *static_cast<Reference<XNameAccess>*>(pEntry->GetUserData()), pEntry ); + FillItems( pUserData->aXNameAccess, pEntry ); } else { //if selection is a node - OUString sPropertyPath = SvTabListBox::GetEntryText( pEntry, 0 ); OUString sPropertyName = SvTabListBox::GetEntryText( pEntry, 1 ); OUString sPropertyType = SvTabListBox::GetEntryText( pEntry, 2 ); OUString sPropertyValue = SvTabListBox::GetEntryText( pEntry, 3 ); - boost::shared_ptr< Prop_Impl > pProperty (new Prop_Impl( sPropertyPath, sPropertyName, makeAny( sPropertyValue ) ) ); + boost::shared_ptr< Prop_Impl > pProperty (new Prop_Impl( pUserData->sPropertyPath, sPropertyName, makeAny( sPropertyValue ) ) ); + bool bSaveChanges = false; bool bOpenDialog = true; OUString sDialogValue; @@ -567,6 +586,7 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl ) pProperty->Value = uno::makeAny( bValue ); bOpenDialog = false; + bSaveChanges = true; } else if ( sPropertyType == "void" ) { @@ -596,6 +616,7 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl ) if( pValueDialog->Execute() == RET_OK ) { sNewValue = pValueDialog->getValue(); + bSaveChanges = true; if ( sPropertyType == "short") { sal_Int16 nShort; @@ -608,130 +629,131 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl ) throw uno::Exception(); pProperty->Value = uno::makeAny( nShort ); } - else - if( sPropertyType == "long" ) - { - sal_Int32 nLong = sNewValue.toInt32(); - if( !( nLong==0 && sNewValue.getLength()!=1 ) && nLong < SAL_MAX_INT32 && nLong > SAL_MIN_INT32) - pProperty->Value = uno::makeAny( nLong ); - else - throw uno::Exception(); - } - else if( sPropertyType == "hyper") - { - sal_Int64 nHyper = sNewValue.toInt64(); - if( !( nHyper==0 && sNewValue.getLength()!=1 ) && nHyper < SAL_MAX_INT32 && nHyper > SAL_MIN_INT32) - pProperty->Value = uno::makeAny( nHyper ); - else - throw uno::Exception(); - } - else if( sPropertyType == "double") - { - double nDoub = sNewValue.toDouble(); - if( !( nDoub ==0 && sNewValue.getLength()!=1 ) && nDoub < SAL_MAX_INT32 && nDoub > SAL_MIN_INT32) - pProperty->Value = uno::makeAny( nDoub ); - else - throw uno::Exception(); - } - else if( sPropertyType == "float") - { - float nFloat = sNewValue.toFloat(); - if( !( nFloat ==0 && sNewValue.getLength()!=1 ) && nFloat < SAL_MAX_INT32 && nFloat > SAL_MIN_INT32) - pProperty->Value = uno::makeAny( nFloat ); - else - throw uno::Exception(); - } - else if( sPropertyType == "string" ) - { - pProperty->Value = uno::makeAny( sNewValue ); - } - else if( sPropertyType == "[]short" ) + else if( sPropertyType == "long" ) + { + sal_Int32 nLong = sNewValue.toInt32(); + if( !( nLong==0 && sNewValue.getLength()!=1 ) && nLong < SAL_MAX_INT32 && nLong > SAL_MIN_INT32) + pProperty->Value = uno::makeAny( nLong ); + else + throw uno::Exception(); + } + else if( sPropertyType == "hyper") + { + sal_Int64 nHyper = sNewValue.toInt64(); + if( !( nHyper==0 && sNewValue.getLength()!=1 ) && nHyper < SAL_MAX_INT32 && nHyper > SAL_MIN_INT32) + pProperty->Value = uno::makeAny( nHyper ); + else + throw uno::Exception(); + } + else if( sPropertyType == "double") + { + double nDoub = sNewValue.toDouble(); + if( !( nDoub ==0 && sNewValue.getLength()!=1 ) && nDoub < SAL_MAX_INT32 && nDoub > SAL_MIN_INT32) + pProperty->Value = uno::makeAny( nDoub ); + else + throw uno::Exception(); + } + else if( sPropertyType == "float") + { + float nFloat = sNewValue.toFloat(); + if( !( nFloat ==0 && sNewValue.getLength()!=1 ) && nFloat < SAL_MAX_INT32 && nFloat > SAL_MIN_INT32) + pProperty->Value = uno::makeAny( nFloat ); + else + throw uno::Exception(); + } + else if( sPropertyType == "string" ) + { + pProperty->Value = uno::makeAny( sNewValue ); + } + else if( sPropertyType == "[]short" ) + { + //create string sequence from comma separated string + //uno::Sequence< OUString > seqStr; + std::vector< OUString > seqStr; + seqStr = commaStringToSequence( sNewValue ); + + //create appropriate sequence with same size as string sequence + uno::Sequence< sal_Int16 > seqShort( seqStr.size() ); + //convert all strings to appropriate type + for( size_t i = 0; i < seqStr.size(); ++i ) { - //create string sequence from comma separated string - //uno::Sequence< OUString > seqStr; - std::vector< OUString > seqStr; - seqStr = commaStringToSequence( sNewValue ); - - //create appropriate sequence with same size as string sequence - uno::Sequence< sal_Int16 > seqShort( seqStr.size() ); - //convert all strings to appropriate type - for( size_t i = 0; i < seqStr.size(); ++i ) - { - seqShort[i] = (sal_Int16) seqStr[i].toInt32(); - } - pProperty->Value = uno::makeAny( seqShort ); + seqShort[i] = (sal_Int16) seqStr[i].toInt32(); } - else if( sPropertyType == "[]long" ) - { - std::vector< OUString > seqStrLong; - seqStrLong = commaStringToSequence( sNewValue ); + pProperty->Value = uno::makeAny( seqShort ); + } + else if( sPropertyType == "[]long" ) + { + std::vector< OUString > seqStrLong; + seqStrLong = commaStringToSequence( sNewValue ); - uno::Sequence< sal_Int32 > seqLong( seqStrLong.size() ); - for( size_t i = 0; i < seqStrLong.size(); ++i ) - { - seqLong[i] = seqStrLong[i].toInt32(); - } - pProperty->Value = uno::makeAny( seqLong ); - } - else if( sPropertyType == "[]hyper" ) + uno::Sequence< sal_Int32 > seqLong( seqStrLong.size() ); + for( size_t i = 0; i < seqStrLong.size(); ++i ) { - std::vector< OUString > seqStrHyper; - seqStrHyper = commaStringToSequence( sNewValue ); - uno::Sequence< sal_Int64 > seqHyper( seqStrHyper.size() ); - for( size_t i = 0; i < seqStrHyper.size(); ++i ) - { - seqHyper[i] = seqStrHyper[i].toInt64(); - } - pProperty->Value = uno::makeAny( seqHyper ); + seqLong[i] = seqStrLong[i].toInt32(); } - else if( sPropertyType == "[]double" ) + pProperty->Value = uno::makeAny( seqLong ); + } + else if( sPropertyType == "[]hyper" ) + { + std::vector< OUString > seqStrHyper; + seqStrHyper = commaStringToSequence( sNewValue ); + uno::Sequence< sal_Int64 > seqHyper( seqStrHyper.size() ); + for( size_t i = 0; i < seqStrHyper.size(); ++i ) { - std::vector< OUString > seqStrDoub; - seqStrDoub = commaStringToSequence( sNewValue ); - uno::Sequence< double > seqDoub( seqStrDoub.size() ); - for( size_t i = 0; i < seqStrDoub.size(); ++i ) - { - seqDoub[i] = seqStrDoub[i].toDouble(); - } - pProperty->Value = uno::makeAny( seqDoub ); + seqHyper[i] = seqStrHyper[i].toInt64(); } - else if( sPropertyType == "[]float" ) + pProperty->Value = uno::makeAny( seqHyper ); + } + else if( sPropertyType == "[]double" ) + { + std::vector< OUString > seqStrDoub; + seqStrDoub = commaStringToSequence( sNewValue ); + uno::Sequence< double > seqDoub( seqStrDoub.size() ); + for( size_t i = 0; i < seqStrDoub.size(); ++i ) { - std::vector< OUString > seqStrFloat; - seqStrFloat = commaStringToSequence( sNewValue ); - uno::Sequence< sal_Int16 > seqFloat( seqStrFloat.size() ); - for( size_t i = 0; i < seqStrFloat.size(); ++i ) - { - seqFloat[i] = seqStrFloat[i].toFloat(); - } - pProperty->Value = uno::makeAny( seqFloat ); + seqDoub[i] = seqStrDoub[i].toDouble(); } - else if( sPropertyType == "[]string" ) + pProperty->Value = uno::makeAny( seqDoub ); + } + else if( sPropertyType == "[]float" ) + { + std::vector< OUString > seqStrFloat; + seqStrFloat = commaStringToSequence( sNewValue ); + uno::Sequence< sal_Int16 > seqFloat( seqStrFloat.size() ); + for( size_t i = 0; i < seqStrFloat.size(); ++i ) { - pProperty->Value = uno::makeAny( comphelper::containerToSequence( commaStringToSequence( sNewValue ))); + seqFloat[i] = seqStrFloat[i].toFloat(); } - else //unknown - throw uno::Exception(); - + pProperty->Value = uno::makeAny( seqFloat ); + } + else if( sPropertyType == "[]string" ) + { + pProperty->Value = uno::makeAny( comphelper::containerToSequence( commaStringToSequence( sNewValue ))); + } + else //unknown + throw uno::Exception(); sDialogValue = sNewValue; - - AddToModifiedVector( pProperty ); - - //update listbox value. - m_pPrefBox->SetEntryText( sDialogValue, pEntry, 3 ); - //update m_prefBoxEntries - SvTreeListEntries::iterator it = std::find_if(m_prefBoxEntries.begin(), m_prefBoxEntries.end(), - [&sPropertyPath, &sPropertyName](SvTreeListEntry &entry) -> bool - { - return static_cast< SvLBoxString* >( entry.GetItem(1) )->GetText().equals( sPropertyPath ) && - static_cast< SvLBoxString* >( entry.GetItem(2) )->GetText().equals( sPropertyName ); - } - ); - if (it != m_prefBoxEntries.end()) - it->ReplaceItem( new SvLBoxString( &(*it), 0, sDialogValue ), 4 ); } } + + if(bSaveChanges) + { + AddToModifiedVector( pProperty ); + + //update listbox value. + m_pPrefBox->SetEntryText( sDialogValue, pEntry, 3 ); + //update m_prefBoxEntries + SvTreeListEntries::iterator it = std::find_if(m_prefBoxEntries.begin(), m_prefBoxEntries.end(), + [&pUserData, &sPropertyName](SvTreeListEntry &entry) -> bool + { + return static_cast< SvLBoxString* >( entry.GetItem(1) )->GetText().equals( pUserData->sPropertyPath ) && + static_cast< SvLBoxString* >( entry.GetItem(2) )->GetText().equals( sPropertyName ); + } + ); + if (it != m_prefBoxEntries.end()) + it->ReplaceItem( new SvLBoxString( &(*it), 0, sDialogValue ), 4 ); + } } catch( uno::Exception& ) { diff --git a/cui/source/options/optaboutconfig.hxx b/cui/source/options/optaboutconfig.hxx index 2ef620e..48f97e3 100644 --- a/cui/source/options/optaboutconfig.hxx +++ b/cui/source/options/optaboutconfig.hxx @@ -67,7 +67,7 @@ public: explicit CuiAboutConfigTabPage(vcl::Window* pParent); virtual ~CuiAboutConfigTabPage(); virtual void dispose() SAL_OVERRIDE; - void InsertEntry(const OUString& rProp, const OUString& rStatus, const OUString& rType, const OUString& rValue, + void InsertEntry(const OUString &rPropertyPath, const OUString& rProp, const OUString& rStatus, const OUString& rType, const OUString& rValue, SvTreeListEntry *pParentEntry = nullptr); void Reset(); void FillItems(const com::sun::star::uno::Reference<com::sun::star::container::XNameAccess>& xNameAccess,
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits