diff options
author | Jim Raykowski <raykowj@gmail.com> | 2024-06-26 19:32:17 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2024-06-28 23:42:41 +0200 |
commit | 3621ddfb9a490c58cfa70679d9bd89099a91e663 (patch) | |
tree | 0592b078a9157d518d9d8d3b6969a6741e3771a8 | |
parent | 2cb5e2256c607acd766e8693ea22b62459d93cbc (diff) |
Resolves tdf#115665 Format in the CTRL+H search affects
the CTRL+F search
Change-Id: I51ccd2186c47a91958c262efac9a1514b9c3b138
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169606
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Tested-by: Jenkins
-rw-r--r-- | include/sfx2/sfxsids.hrc | 1 | ||||
-rw-r--r-- | sfx2/sdi/sfx.sdi | 2 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbunosearchcontrollers.cxx | 3 | ||||
-rw-r--r-- | sw/qa/uitest/findBar/tdf115665.py | 55 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewsrch.cxx | 9 |
5 files changed, 68 insertions, 2 deletions
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index 617d4b2363a6..2c20b3d8b81a 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -587,6 +587,7 @@ class SvxZoomItem; #define SID_GALLERY_BG_BRUSH (SID_SVX_START + 279) #define SID_SEARCH_OPTIONS TypedWhichId<SfxUInt16Item>(SID_SVX_START + 281) #define SID_SEARCH_ITEM TypedWhichId<SvxSearchItem>(SID_SVX_START + 291) +#define SID_SEARCH_USE_ATTR_ITEM_LIST TypedWhichId<SfxBoolItem>(SID_SFX_START + 292) #define SID_SIDEBAR TypedWhichId<SfxBoolItem>(SID_SVX_START + 336) #define SID_NOTEBOOKBAR TypedWhichId<SfxStringItem>(SID_SVX_START + 338) #define SID_MENUBAR TypedWhichId<SfxBoolItem>(SID_SVX_START + 339) diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 9993519b3ebe..9a341064c970 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -1158,7 +1158,7 @@ SfxVoidItem ShowStyle SID_STYLE_SHOW SfxVoidItem ExecuteSearch FID_SEARCH_NOW -(SvxSearchItem SearchItem SID_SEARCH_ITEM, SfxBoolItem Quiet SID_SEARCH_QUIET ) +(SvxSearchItem SearchItem SID_SEARCH_ITEM, SfxBoolItem Quiet SID_SEARCH_QUIET, SfxBoolItem UseAttrItemList SID_SEARCH_USE_ATTR_ITEM_LIST) [ AutoUpdate = FALSE, FastCall = FALSE, diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index c2070618d69e..94ac6c8fde8c 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -178,7 +178,8 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext { "SearchItem.Command", css::uno::Any( static_cast<sal_Int16>(aFindAll ?SvxSearchCmd::FIND_ALL : SvxSearchCmd::FIND ) ) }, { "SearchItem.AlgorithmType", css::uno::Any( sal_Int16(css::util::SearchAlgorithms_ABSOLUTE) ) }, { "SearchItem.AlgorithmType2", css::uno::Any( sal_Int16(css::util::SearchAlgorithms2::ABSOLUTE) ) }, - { "SearchItem.SearchFormatted", css::uno::Any( bSearchFormatted ) } + { "SearchItem.SearchFormatted", css::uno::Any( bSearchFormatted ) }, + { "UseAttrItemList", css::uno::Any(false) } } ) ); css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(xFrame, css::uno::UNO_QUERY); diff --git a/sw/qa/uitest/findBar/tdf115665.py b/sw/qa/uitest/findBar/tdf115665.py new file mode 100644 index 000000000000..94409589e427 --- /dev/null +++ b/sw/qa/uitest/findBar/tdf115665.py @@ -0,0 +1,55 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text +from uitest.uihelper.common import get_state_as_dict + +class tdf115665(UITestCase): + + def test_tdf115665(self): + + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + # Type a line to use for search + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "This is happiness."})) + + # Open the F&R dialog and set to find search term with attribute format UPPERCASE + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + format = xDialog.getChild("format") + with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())) as dialog: + xTabs = dialog.getChild("tabcontrol") + select_pos(xTabs, "1") + xEffectsLb = dialog.getChild("effectslb") + select_by_text(xEffectsLb, "UPPERCASE") + + # Open the find bar + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+f"})) + + # Type "happiness" in the find bar search edit box + xfind = xWriterDoc.getChild("find") + xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "happiness"})) + + xfind_bar = xWriterDoc.getChild("FindBar") + + # Press on Find All in the find bar + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) # 4 is Find All + + # Without the fix in place the test would fail with + # AssertionError: '' != 'happiness' + self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "happiness") + + # Close the find bar + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 0 is pos for close + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx index 9f7c9cabe130..849122fe0e94 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -232,6 +232,15 @@ void SwView::ExecSearch(SfxRequest& rReq) s_pSrchItem = pArgs->Get(SID_SEARCH_ITEM).Clone(); } } + + // tdf#115665 Format in the CTRL+H search affects the CTRL+F search + if (const SfxBoolItem* pUseAttrItemListItem + = pArgs->GetItemIfSet(SID_SEARCH_USE_ATTR_ITEM_LIST, false)) + { + if (!pUseAttrItemListItem->GetValue()) + s_xSearchList.reset(); + } + SvxSearchCmd eCommand = s_pSrchItem->GetCommand(); switch (eCommand) { |