From aaf41776b992a4552764f0fdf91671ffebc618fa Mon Sep 17 00:00:00 2001 From: Vitaliy Anderson Date: Tue, 31 Jan 2017 05:11:12 -0800 Subject: Compatibility options refactoring. Part 1 small fix SvtCompatibilityOptions_Impl::impl_GetPropertyNames() solve problem with wrong lProperties names Change-Id: I0b71a80d542d8175c3f6e6cdf5fe857143714acb Reviewed-on: https://gerrit.libreoffice.org/33752 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- unotools/source/config/compatibility.cxx | 33 +++++++++++--------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/unotools/source/config/compatibility.cxx b/unotools/source/config/compatibility.cxx index b13972b683b5..58522acc79ce 100644 --- a/unotools/source/config/compatibility.cxx +++ b/unotools/source/config/compatibility.cxx @@ -145,17 +145,6 @@ class SvtCompatibilityOptions_Impl : public ConfigItem *//*-*****************************************************************************************************/ Sequence< OUString > impl_GetPropertyNames( Sequence< OUString >& rItems ); - /*-**************************************************************************************************** - @short expand the list for all well known properties to destination - @seealso method impl_GetPropertyNames() - - @param "lSource" , original list - @param "lDestination" , destination of operation - @return A list of configuration key names is returned. - *//*-*****************************************************************************************************/ - static void impl_ExpandPropertyNames( const Sequence< OUString >& lSource, - Sequence< OUString >& lDestination ); - private: std::vector< SvtCompatibilityEntry > m_aOptions; SvtCompatibilityEntry m_aDefOptions; @@ -292,29 +281,29 @@ Sequence< OUString > SvtCompatibilityOptions_Impl::impl_GetPropertyNames( Sequen { // First get ALL names of current existing list items in configuration! rItems = GetNodeNames( SETNODE_ALLFILEFORMATS ); + // expand list to result list ... Sequence< OUString > lProperties( rItems.getLength() * ( SvtCompatibilityEntry::getElementCount() - 1 ) ); - impl_ExpandPropertyNames( rItems, lProperties ); - // Return result. - return lProperties; -} -void SvtCompatibilityOptions_Impl::impl_ExpandPropertyNames( - const Sequence< OUString >& lSource, Sequence< OUString >& lDestination ) -{ - sal_Int32 nSourceCount = lSource.getLength(); + sal_Int32 nSourceCount = rItems.getLength(); + sal_Int32 nDestStep = 0; // Copy entries to destination and expand every item with 2 supported sub properties. for ( sal_Int32 nSourceStep = 0; nSourceStep < nSourceCount; ++nSourceStep ) { OUString sFixPath; sFixPath = SETNODE_ALLFILEFORMATS; sFixPath += PATHDELIMITER; - sFixPath += lSource[ nSourceStep ]; + sFixPath += rItems[ nSourceStep ]; sFixPath += PATHDELIMITER; - for ( int i = static_cast(SvtCompatibilityEntry::Index::Module); i < static_cast(SvtCompatibilityEntry::Index::INVALID); ++i ) - lDestination[ i - 1 ] = sFixPath + SvtCompatibilityEntry::getName( SvtCompatibilityEntry::Index(i) ); + { + lProperties[ nDestStep ] = sFixPath + SvtCompatibilityEntry::getName( SvtCompatibilityEntry::Index(i) ); + nDestStep++; + } } + + // Return result. + return lProperties; } namespace -- cgit