Bug 141439 - FIND & REPLACE: Should be possible to specify both a search expression and a style
Summary: FIND & REPLACE: Should be possible to specify both a search expression and a ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Find-Search Styles
  Show dependency treegraph
 
Reported: 2021-04-01 20:37 UTC by Eyal Rozenberg
Modified: 2021-05-11 08:37 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eyal Rozenberg 2021-04-01 20:37:04 UTC
In LO writer, you can either search for a given string (or an expression), or for any occurrence of a given style. But - you cannot do both at once.

You should definitely be able to say "Find the word foo in all paragraphs with paragraph style MyStyle"; and possibly also specify the character style, list style and page style as well.
Comment 1 Dieter 2021-04-21 06:59:22 UTC
I think this is enhancement request
cc: Design-Team
Comment 2 Heiko Tietze 2021-04-21 08:29:52 UTC
Why not combine string+style+format+foo+bar? Can of worms to me not worth digging into. Such complex interaction patterns are better solved per extension. => WF

More opinions please.
Comment 3 Eyal Rozenberg 2021-04-21 09:19:51 UTC
(In reply to Heiko Tietze from comment #2)
> Why not combine string+style+format+foo+bar? Can of worms to me not worth
> digging into. Such complex interaction patterns are better solved per extension.

1. You're attacking a straw man. It's string + style; no foo and no bar.
2. This has been a Microsoft Office feature since the 1990s IIRC.
3. It is a common use case "What was that chapter where I'm talking about European stuff? Let me Search for Heading 1 + 'Europe' "
4. It doesn't seem like such a complex interaction. Instead of searching all paragraphs for the string, you first filter out those which don't match the style. A bit more complex if character styles are supported. But the regular search must involve some kind of concatenation of text runs from within the document tree, right? Isn't that just as complex, if not more so?
Comment 4 Dave Barton 2021-04-21 10:21:01 UTC
As stated in comment 2, "complex interaction patterns are better solved per extension."
Such an extension already exists "Alternative Find & Replace for Writer (AltSearch)": https://extensions.libreoffice.org/en/extensions/show/alternative-dialog-find-replace-for-writer.
Using this extension with the search:
[:::ParaStyleName=Heading 1::]Europe
will find the text string in any Heading 1 style.
Comment 5 Eyal Rozenberg 2021-04-21 11:11:54 UTC
(In reply to Dave Barton from comment #4)
> As stated in comment 2, "complex interaction patterns are better solved per
> extension."

Except they're not complex. You'll note this bug does not request arbitrarily complex combinations of features and patterns - just something pretty straightforward.

> Such an extension already exists "Alternative Find & Replace for Writer
> (AltSearch)"

Indeed, that extension exists. While this decreases from the "severity" of the need to implement the feature, it also indicates it is significant enough for someone to have written an extension which covers it. So IMHO that about balances out the impact of the existence of an extension on a missing feature bug.


It should also be mentioned that the extension does not replace or integrate into the Search dialog; it is accessible through Tools | Add-Ons, and is a bit intimidating for inexperienced users due to various aspects of its UI. (I use it of course.)
Comment 6 Thomas Lendo 2021-05-04 21:29:10 UTC
I support the idea of a combination of search possibilities despite of the existence of an extension. But how could that be implemented without cluttering the UI?

Would be nice to have cascading find criteria like the sort criteria in Calc (Sort Key 1, Sort Key 2 ...).
Comment 7 Eyal Rozenberg 2021-05-04 21:59:53 UTC
(In reply to Thomas Lendo from comment #6)
> I support the idea of a combination of search possibilities despite of the
> existence of an extension. But how could that be implemented without
> cluttering the UI?

Well, we could do what MS does, which is not use the Find pattern textbox and Replace pattern textbox for selecting styles. What we have now, while clever, is a bit on the smarty-pants side IMHO. It's acceptable while this requested feature is missing, but otherwise - not so much. We could have a mini style selector box of some kind, that opens up when you click something to indicate you want to specify a search style.
Comment 8 jan d 2021-05-06 17:18:16 UTC
As it was mentioned that MS Office does have that feature and that they do formatting search in another way – is there any video, manual… that shows how their implementation is presented to the user?
(I think it would be interesting also aside of this particular request)
Comment 9 jan d 2021-05-06 17:29:41 UTC
In general, I do think that a style-based-restriced search is as valid as the currently implemented character-attribute-restricted   and paragraph-attribute-restricted  search. 

Both (character,paragraph) are a bit cumbersome to use  – on the other hand, they are usually hidden away.

Introducing style-restricted-search would probably mean adding another button (opening a list of styles like the list character attributes). Which I would not find problematic.
Comment 10 Michael Warner 2021-05-06 21:39:05 UTC
(In reply to jan d from comment #8)
> As it was mentioned that MS Office does have that feature and that they do
> formatting search in another way – is there any video, manual… that shows
> how their implementation is presented to the user?
> (I think it would be interesting also aside of this particular request)

I found a tutorial video on YouTube for it:
https://www.youtube.com/watch?v=7j92Py8J3qg
Comment 11 Heiko Tietze 2021-05-07 07:00:54 UTC
The topic was on the agenda for the design meeting. And while some agree with the idea others defer the task to extensions. 

MSO allows to search for <Foo> with format filters, as we do. Our solution is limited to character attributes while MSO also offers paragraph level. The use case "Replace all Default PS by Text Body" is done differently, namely after checking Paragraph Style.

What remains is to search for a heading with special text. And my take here is still => WF since it's a very rare corner-case cluttering the dialog even more if implemented. If you can search for it you need to consider replacing. And that's super weird.

Keeping the ticket because this view is not adopted by the majority.
Comment 12 Eyal Rozenberg 2021-05-07 12:24:02 UTC
(In reply to Heiko Tietze from comment #11)
> it's a very rare corner-case

On the contrary. Assuming one uses Paragraph and Character styles - which is the preferred modus operandi for a word processor and certainly one we should cater to no less than direct formatting - the specific formatting detail are a minor concern. As the user, you set styles, nor formats; and that's what you search for:

* Where does it say Encyclopaedia in a legal reference?
* Which subsection has "budget" in the title?
* Which URLs have "library" in their text?

and note that none of this can be expressed by the search capability we have now.

It makes much less sense to search for:

* Where do I have "foo" in Liberation Mono?
* Where do I have "bar" in font size 18?

so I don't see how we could have the latter capability while foregoing the former.

I wonder - although of course this is purely speculative - if some of the meeting participants were not thinking mostly about documents where direct formatting is used.