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.
I think this is enhancement request
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.
(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?
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:
will find the text string in any Heading 1 style.
(In reply to Dave Barton from comment #4)
> As stated in comment 2, "complex interaction patterns are better solved per
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
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.)
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 ...).
(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.
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)
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.
(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:
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.
(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.