https://bugs.documentfoundation.org/show_bug.cgi?id=159862

Julien Nabet <serval2...@yahoo.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|Windows (All)               |All
            Version|7.3.4.2 release             |5.2.0.4 release
     Ever confirmed|0                           |1
                 CC|                            |er...@redhat.com,
                   |                            |serval2...@yahoo.fr
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|libreoffice-b...@lists.free |serval2...@yahoo.fr
                   |desktop.org                 |

--- Comment #1 from Julien Nabet <serval2...@yahoo.fr> ---
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

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to