Description: In Calc, while using a Macro to modify the settings of a Search Descriptor, setting the value of .SearchWildcard to false, even though .SearchWildcard is already set to False, changes the value of .SearchRegularExpression to false again if it was set tot true. Steps to Reproduce: 1. Create a SearchDescriptor 2. Set .SearchRegularExpression to true 3. Set .SearchWildcard to false 4. Check the value of .SearchRegularExpression again. it will now be false. Actual Results: Setting .SearchWildcard to False, changes .SearchRegularExpression to False also. Expected Results: If .SearchWildcard is set to False, .SearchRegularExpression should not be altered. Reproducible: Always User Profile Reset: Yes Additional Info: The below macro will demonstrate the error. Sub main Dim oDescriptor 'The search descriptor oDescriptor = ThisComponent.CurrentController.getActiveSheet().createSearchDescriptor() oDescriptor.SearchRegularExpression = true msgbox(oDescriptor.SearchRegularExpression) oDescriptor.SearchWildcard = fasle msgbox(oDescriptor.SearchRegularExpression) End Sub Version: 7.3.4.2 (x64) / LibreOffice Community Build ID: 728fec16bd5f605073805c3c9e7c4212a0120dc5 CPU threads: 2; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win Locale: en-US (en_US); UI: en-US Calc: CL
Indeed! On pc Debian x86-64 with master sources updated today, I could reproduce this. Here's the debug: 1) when calling oDescriptor.SearchRegularExpression = true, it gets there: 348 void SvxSearchItem::SetRegExp( bool bVal ) 349 { 350 if ( bVal ) 351 { 352 m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::REGEXP; <==HERE 353 } 354 else if ( SearchAlgorithms2::REGEXP == m_aSearchOpt.AlgorithmType2 ) 355 { 356 m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE; 357 } 358 } #0 SvxSearchItem::SetRegExp(bool) (this=0x55feb38452e0, bVal=true) at svl/source/items/srchitem.cxx:352 #1 0x00007fee5382583d in ScCellSearchObj::setPropertyValue(rtl::OUString const&, com::sun::star::uno::Any const&) (this=0x55feb370b1f0, aPropertyName="SearchRegularExpression", aValue=uno::Any("boolean": 1 '\001')) at sc/source/ui/unoobj/srchuno.cxx:136 => OK 2) when calling msgbox(oDescriptor.SearchRegularExpression), it gets there: 243 bool SvxSearchItem::GetRegExp() const 244 { 245 return m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::REGEXP ; 246 } #0 SvxSearchItem::GetRegExp() const (this=0x55feb38452e0) at include/svl/srchitem.hxx:245 #1 0x00007fee538260a6 in ScCellSearchObj::getPropertyValue(rtl::OUString const&) (this=0x55feb370b1f0, aPropertyName="SearchRegularExpression") at sc/source/ui/unoobj/srchuno.cxx:159 so here it returns true as expected. => OK 3) when calling oDescriptor.SearchWildcard = false, it gets there: 361 void SvxSearchItem::SetWildcard( bool bVal ) 362 { 363 if ( bVal ) 364 { 365 m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::WILDCARD; 366 } 367 else if ( SearchAlgorithms2::REGEXP == m_aSearchOpt.AlgorithmType2 ) 368 { 369 m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE;//HERE 370 } 371 } So when calling msgbox(oDescriptor.SearchRegularExpression) the second time, it returns false since now m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE and not css::util::SearchAlgorithms2::REGEXP => KO I suppose line 367 is a wrong copy-paste, it should be: else if ( SearchAlgorithms2::WILDCARD == m_aSearchOpt.AlgorithmType2 ) It's been like this since 3a0abd3019ec3ca29b8f1378cdb32ebf741e6306 add SvxSearchItem::GetWildcard() SetWildcard() in 2016 Patch on gerrit here: https://gerrit.libreoffice.org/c/core/+/163876
Julien Nabet committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/dd5710a8dd4e05059ac248243d950e28d830905d tdf#159862: set SearchWildcard to false changes SearchRegularExpression value It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Patch for 24.2 branch waiting for review here: https://gerrit.libreoffice.org/c/core/+/163836
Julien Nabet committed a patch related to this issue. It has been pushed to "libreoffice-24-2": https://git.libreoffice.org/core/commit/0e803a23b8a1c4c66cdd3cef00252867ba9a1193 tdf#159862: set SearchWildcard to false changes SearchRegularExpression value It will be available in 24.2.2. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
I can confirm the bug is fixed in the daily build. Thank you Julien Nabet.
Thank you for the feedback Don! Let's put this one to VERIFIED then.