diff options
author | Mihály Palenik <palenik.mihaly@gmail.com> | 2015-06-16 11:51:10 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-06-16 14:21:59 +0000 |
commit | db35b73037483cd22cd7d4ac93fe40f23fbe3967 (patch) | |
tree | 80319d709ec07338436bc734baa9568c7c5854e6 | |
parent | 56f5a402287e735f5a9c1f84931dcbc9e7b579e7 (diff) |
Change table to tree view in Expert Configuration dialog.
Expert Configuration dialog was too slow when accessibility was used.
Therefore the table was changed to tree view. In tree view the children
of entries is loaded dynamically.
Change-Id: I267833e46005058fdfedb6f012afe2f9b390636b
Reviewed-on: https://gerrit.libreoffice.org/16307
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | cui/source/options/optaboutconfig.cxx | 652 | ||||
-rw-r--r-- | cui/source/options/optaboutconfig.hxx | 6 |
2 files changed, 345 insertions, 313 deletions
diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index ea0e70776566..121060dc7189 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -158,7 +158,6 @@ CuiAboutConfigTabPage::CuiAboutConfigTabPage( vcl::Window* pParent/*, const SfxI util::SearchFlags::REG_NOT_ENDOFLINE); m_pPrefBox->SetTabs(aTabs, MAP_PIXEL); - m_pPrefBox->SetAlternatingRowColors( true ); } CuiAboutConfigTabPage::~CuiAboutConfigTabPage() @@ -177,17 +176,17 @@ void CuiAboutConfigTabPage::dispose() ModelessDialog::dispose(); } -void CuiAboutConfigTabPage::InsertEntry(const OUString& rProp, const OUString& rStatus, const OUString& rType, const OUString& rValue) +void CuiAboutConfigTabPage::InsertEntry(const OUString& rProp, const OUString& rStatus, + const OUString& rType, const OUString& rValue, SvTreeListEntry *pParentEntry) { SvTreeListEntry* pEntry = new SvTreeListEntry; - pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false)); //It is needed, otherwise causes crash pEntry->AddItem( new SvLBoxString( pEntry, 0, rProp)); pEntry->AddItem( new SvLBoxString( pEntry, 0, rStatus)); pEntry->AddItem( new SvLBoxString( pEntry, 0, rType)); pEntry->AddItem( new SvLBoxString( pEntry, 0, rValue)); - m_pPrefBox->Insert( pEntry ); + m_pPrefBox->Insert( pEntry, pParentEntry ); SvTreeListEntry* pEntryClone = new SvTreeListEntry; pEntryClone->Clone( pEntry ); @@ -227,190 +226,211 @@ bool CuiAboutConfigTabPage::FillItemSet() return bModified; } -void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAccess) +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] ); - bool bNotLeaf = false; - - Reference< XNameAccess > xNextNameAccess; + Reference< XNameAccess > xChildNameAccess; try { - xNextNameAccess = Reference< XNameAccess >(aNode, uno::UNO_QUERY); - bNotLeaf = xNextNameAccess.is(); - } - catch (const RuntimeException& e) - { - SAL_WARN( "cui.options", "CuiAboutConfigTabPage: exception " << e.Message); - } + xChildNameAccess = Reference< XNameAccess >(aNode, uno::UNO_QUERY); + OUString sPath = Reference< XHierarchicalName >( + xChildNameAccess, uno::UNO_QUERY_THROW )->getHierarchicalName(); + uno::Sequence< OUString > seqChildItems = xChildNameAccess->getElementNames(); - if (bNotLeaf) - { - // not leaf node - FillItems( xNextNameAccess ); - } - else - { - // leaf node - OUString sType = aNode.getValueTypeName(); + bool bIsNotLeaf = false; - OUString sValue; - switch( aNode.getValueType().getTypeClass() ) + for( sal_Int32 l = 0; l < seqChildItems.getLength(); ++l ) { - case ::com::sun::star::uno::TypeClass_VOID: - break; + aNode = xChildNameAccess->getByName( seqChildItems[l] ); - case ::com::sun::star::uno::TypeClass_BOOLEAN: - sValue = OUString::boolean( aNode.get<bool>() ); - break; + 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, m_pPrefBox->GetDefaultExpandedNodeImage(), + m_pPrefBox->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(); - 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; + OUString sValue; + switch( aNode.getValueType().getTypeClass() ) + { + case ::com::sun::star::uno::TypeClass_VOID: + break; - case ::com::sun::star::uno::TypeClass_DOUBLE: - sValue = OUString::number( aNode.get<double>() ); - break; + case ::com::sun::star::uno::TypeClass_BOOLEAN: + sValue = OUString::boolean( aNode.get<bool>() ); + break; - case ::com::sun::star::uno::TypeClass_STRING: - sValue = aNode.get<OUString>(); - 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_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 ) + 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_SEQUENCE: + if( sType == "[]boolean" ) { - sValue += ","; + 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 += 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 ) + else if( sType == "[]byte" ) { - sValue += "0"; + 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 += 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 ) + else if( sType == "[][]byte" ) { - sValue += ","; + 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(); + } + } } - for( sal_Int32 k = 0; k != seq[j].getLength(); ++k ) + else if( sType == "[]short" ) { - OUString s = OUString::number( - static_cast<sal_uInt8>(seq[j][k]), 16 ); - if( s.getLength() == 1 ) + uno::Sequence<sal_Int16> seq = aNode.get< uno::Sequence<sal_Int16> >(); + for( sal_Int32 j = 0; j != seq.getLength(); ++j ) { - sValue += "0"; + if( j != 0 ) + { + sValue += ","; + } + sValue += OUString::number( seq[j] ); } - sValue += s.toAsciiUpperCase(); } - } - } - 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 ) + else if( sType == "[]long" ) { - sValue += ","; + 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 += 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 ) + else if( sType == "[]hyper" ) { - sValue += ","; + 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 += 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 ) + else if( sType == "[]double" ) { - sValue += ","; + 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 += 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 ) + else if( sType == "[]string" ) { - sValue += ","; + 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 += 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 ) + else { - sValue += ","; + SAL_WARN( + "cui.options", + "path \"" << sPath << "\" member " << seqItems[i] + << " of unsupported type " << sType); } - sValue += seq[j]; + break; + + default: + SAL_WARN( + "cui.options", + "path \"" << sPath << "\" member " << seqItems[i] + << " of unsupported type " << sType); + break; } - } - 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; + InsertEntry( sPath, seqChildItems[l], sType, sValue, pParentEntry); + } } - - InsertEntry( sPath, seqItems[i], sType, sValue); + } + catch (const RuntimeException& e) + { + SAL_WARN( "cui.options", "CuiAboutConfigTabPage: exception " << e.Message); } } + + m_pPrefBox->SetAlternatingRowColors( true ); } Reference< XNameAccess > CuiAboutConfigTabPage::getConfigAccess( const OUString& sNodePath, bool bUpdate ) @@ -511,202 +531,212 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl ) { SvTreeListEntry* pEntry = m_pPrefBox->FirstSelected(); - OUString sPropertyPath = SvTabListBox::GetEntryText( pEntry, 0 ); - OUString sPropertyName = SvTabListBox::GetEntryText( pEntry, 1 ); - OUString sPropertyType = SvTabListBox::GetEntryText( pEntry, 2 ); - OUString sPropertyValue = SvTabListBox::GetEntryText( pEntry, 3 ); + if(pEntry->GetUserData() != nullptr) + { + //if selection is not node + if(!pEntry->HasChildren()) + FillItems( *static_cast<Reference<XNameAccess>*>(pEntry->GetUserData()), 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( sPropertyPath, sPropertyName, makeAny( sPropertyValue ) ) ); - bool bOpenDialog; - OUString sDialogValue; - OUString sNewValue; + bool bOpenDialog = true; + OUString sDialogValue; + OUString sNewValue; - if( sPropertyType == "boolean" ) - { - bool bValue; - if( sPropertyValue == "true" ) + if( sPropertyType == "boolean" ) + { + bool bValue; + if( sPropertyValue == "true" ) + { + sDialogValue = "false"; + bValue = false; + } + else + { + sDialogValue = "true"; + bValue = true; + } + + pProperty->Value = uno::makeAny( bValue ); + bOpenDialog = false; + } + else if ( sPropertyType == "void" ) { - sDialogValue = "false"; - bValue = false; + bOpenDialog = false; } else { - sDialogValue = "true"; - bValue = true; + sDialogValue = sPropertyValue; + bOpenDialog = true; } - pProperty->Value = uno::makeAny( bValue ); - bOpenDialog = false; - } - else if ( sPropertyType == "void" ) - { - bOpenDialog = false; - } - else - { - sDialogValue = sPropertyValue; - bOpenDialog = true; - } - - try - { - if( bOpenDialog ) + try { - //Cosmetic length limit for integer values. - int limit=0; - if( sPropertyType == "short" ) - limit = SHORT_LEN_LIMIT; - else if( sPropertyType == "long" ) - limit = LONG_LEN_LIMIT; - else if( sPropertyType == "hyper" ) - limit = HYPER_LEN_LIMIT; - - VclPtrInstance<CuiAboutConfigValueDialog> pValueDialog(nullptr, sDialogValue, limit); - - if( pValueDialog->Execute() == RET_OK ) + if( bOpenDialog ) { - sNewValue = pValueDialog->getValue(); - if ( sPropertyType == "short") + //Cosmetic length limit for integer values. + int limit=0; + if( sPropertyType == "short" ) + limit = SHORT_LEN_LIMIT; + else if( sPropertyType == "long" ) + limit = LONG_LEN_LIMIT; + else if( sPropertyType == "hyper" ) + limit = HYPER_LEN_LIMIT; + + VclPtrInstance<CuiAboutConfigValueDialog> pValueDialog(nullptr, sDialogValue, limit); + + if( pValueDialog->Execute() == RET_OK ) { - sal_Int16 nShort; - sal_Int32 nNumb = sNewValue.toInt32(); - - //if the value is 0 and length is not 1, there is something wrong - if( !( nNumb==0 && sNewValue.getLength()!=1 ) && nNumb < SAL_MAX_INT16 && nNumb > SAL_MIN_INT16) - nShort = (sal_Int16) nNumb; - else - 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") + sNewValue = pValueDialog->getValue(); + if ( sPropertyType == "short") { - 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 ); + sal_Int16 nShort; + sal_Int32 nNumb = sNewValue.toInt32(); + + //if the value is 0 and length is not 1, there is something wrong + if( !( nNumb==0 && sNewValue.getLength()!=1 ) && nNumb < SAL_MAX_INT16 && nNumb > SAL_MIN_INT16) + nShort = (sal_Int16) nNumb; else throw uno::Exception(); + pProperty->Value = uno::makeAny( nShort ); } - 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 ) + else + if( sPropertyType == "long" ) { - seqShort[i] = (sal_Int16) seqStr[i].toInt32(); + 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(); } - pProperty->Value = uno::makeAny( seqShort ); - } - else if( sPropertyType == "[]long" ) - { - std::vector< OUString > seqStrLong; - seqStrLong = commaStringToSequence( sNewValue ); + 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 ) + { + seqShort[i] = (sal_Int16) seqStr[i].toInt32(); + } + 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 ) + 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" ) { - seqLong[i] = seqStrLong[i].toInt32(); + 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 ); } - 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 ) + else if( sPropertyType == "[]double" ) { - seqHyper[i] = seqStrHyper[i].toInt64(); + 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 ); } - 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 ) + else if( sPropertyType == "[]float" ) { - seqDoub[i] = seqStrDoub[i].toDouble(); + 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 ); } - 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 ) + else if( sPropertyType == "[]string" ) { - seqFloat[i] = seqStrFloat[i].toFloat(); + pProperty->Value = uno::makeAny( comphelper::containerToSequence( commaStringToSequence( sNewValue ))); } - pProperty->Value = uno::makeAny( seqFloat ); - } - else if( sPropertyType == "[]string" ) - { - pProperty->Value = uno::makeAny( comphelper::containerToSequence( commaStringToSequence( sNewValue ))); - } - else //unknown - throw uno::Exception(); + else //unknown + throw uno::Exception(); - sDialogValue = sNewValue; + 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 ); + } } } - 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 ); - } - catch( uno::Exception& ) - { + catch( uno::Exception& ) + { + } } - return 0; } diff --git a/cui/source/options/optaboutconfig.hxx b/cui/source/options/optaboutconfig.hxx index f487418f42ef..2ef620ec2837 100644 --- a/cui/source/options/optaboutconfig.hxx +++ b/cui/source/options/optaboutconfig.hxx @@ -67,9 +67,11 @@ 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& 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); + void FillItems(const com::sun::star::uno::Reference<com::sun::star::container::XNameAccess>& xNameAccess, + SvTreeListEntry *pParentEntry = nullptr); static com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > getConfigAccess( const OUString& sNodePath, bool bUpdate ); bool FillItemSet(); }; |