Issue 41193

Summary: add ability to remove (a selection of) hard formatting usng Search & Replace
Product: Writer Reporter: ftack <ftack>
Component: editingAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: issues, robin.laing
Version: OOo 1.1.4Keywords: oooqa, rfe_eval_ok, usability
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Latest Confirmation in: ---
Developer Difficulty: ---

Description ftack 2005-01-24 10:43:36 UTC
It currently is not possible to search for specific direct formatting and remove
it. Steps to reproduce the problem

(1) Type a few lines of text, highlight a word and press Ctrl+I to format it in
italics

(2) Open the "Search & replace" dialog. With the cursor in "Search for' press
format, select "italic" from the font tab. Leave "replace with" empty. Press
"Replace all". The message "Search key replaced 1 times" appears, but
nevertheless, the italics remains in the doc.

I know you can press Find All to highlight all instances, then choose Format -
Default to remove any direct formatting. However, this indeed removes any direct
formatting such as super and subscripts, font colors, etc, and not only italics.

A more precise control of what formatting to remove and what not indeed on its
own constitutes an enhancement over the current situation, but comes in
particularly handy when there is a need to "clean-up" imported or badly
formatted documents without loosing valuable direct formatting.
Comment 1 michael.ruess 2005-01-24 10:51:27 UTC
MRU->SBA: please evaluate this RFE.
Comment 2 lohmaier 2005-01-24 19:28:40 UTC
Works as expected here.

Replacing with nothing removes the text (the display gets updated after the
dialog is closed, there alredy exists another issue about that).

You probably want to search for "word", format "italics" and replace with
"word", format "not italics".

Alternatively you can use regular expression (search for "word" format
"italics", replace with "&", format "not italics" with [x] regular expression
checked. The ampersand is a placeholder for the text that was found.

-> worksforme.
Comment 3 ftack 2005-01-25 19:58:00 UTC
It sits a bit deeper than that. One can indeed replace "italics' with "not
italic, normal". This works correctly. However, it replaces one formatting
(Italics) with another (not-italics). It does not, as I request, remove
formatting (such that the underlying paragraph style takes over).

Yuo can see that when you change the underlying paragraph style to be italic.
The text where the replacement was made remains upright, indicating that indeed
the format search replace did not remove formatting there, but instead
substituted with "not italic" formatting. This behaviour is consistent and
correct, if you specified "not-italic" in the replace with box.

The issue I am presenting here is: if I specify NOTHING in the replace with box,
then any Italic formatting should be removed. Search Italic, replace with
"nothing" should remove the formatting just like search "word" replace by
nothing will remove "word". Currently, the italics remains in place, even though
after "Replace all" Writer messages "Search key replaced x times".

Actually, replace with nothing does NOT remove the text for me when using
Replace All. However, to my consternation, text is indeed removed when using
Replace! That is yet another issue, but as you say it might already have been
filled.
Comment 4 lohmaier 2005-01-29 21:41:17 UTC
> However, it replaces one formatting (Italics) with another (not-italics). It 
> does not, as I request, remove formatting (such that the underlying paragraph 
> style takes over).

That's true, but that is a design limitation. You cannot only remove one
attribute. You have to use Fromat|Standard (see issue 31638 as well)

I don't think it is beneficial to remove the formatting when you don't specify
anything in the formats for replace-with. It is more likely to search for a date
or name and replace that with an updated value (and to keep the formatting) than
to remove the formatting (to remove the formatting, you can simply use
Format|Default. (Use Find all to highlight all matches)
If you don't mind I'll close it as worksforme.
Comment 5 ftack 2005-01-31 14:19:28 UTC
I don't agree. Using the approach "Format - Default" will remove any formatting,
also formatting the user wishes to keep such as super/subscripts. This prevents
the user from automating the cleanup of a large document: after resetting all
formatting, tedious manual work of reapplying direct formatting where needed,
such as super- en subscripts, can start. A diily life example: a user marks
added text by coloring it red. OK, he'd better used the revision functions, but
many people do not. At best, they'll do it next time. In the mean time, using
Search All then Format Default will remove all super and subscripts in chemical
formulae, italics in plant names, etc. and the only option in Writer is to do
manual work, either by removing the formatting one by one or by removing all
formatting, then reapplying manually what needs to be kept.

I do not see the benefit of the current "design limitation". What is wrong with
the user to replace a specific format with nothing? After all, this is the same
logic that is applied in replacing text with nothing, except it applies to
formatting. I therefore am convinced that an enhancement suggestion for greater
control over searching and replacing formatting is valid and should be filed, be
it not with the highest priority. I do not have the troubles mentionned above
wiht my own documents.
Comment 6 lohmaier 2005-02-03 20:17:39 UTC
Why do you think a design *limitation* is a benefit?

Furthermore: changing the behaviour of the dialog is a major task (backwards
compatibility). 
So some other way has to be found to tell "remove that formatting".

And you are contradicting yourself.
If you search for "italics" and the search matches text with subscipt and
superscript, what should OOo do if you specify no format as replace? -> How can
OOo know that you only want to remove the italics?

So the Format-Selection has to offer an item "use default for italics" or
something similar.
Comment 7 lohmaier 2005-02-03 20:18:34 UTC
forgot to reassign
Comment 8 eyolf 2005-06-04 00:40:05 UTC
>If you search for "italics" and the search matches text with 
>subscipt and superscript, what should OOo do if you specify no 
>format as replace? -> How can OOo know that you only want 
>to remove the italics?

If what you search for is "italics", OOo should be able to sort out that
"italics" is what should be removed, and not "all direct formatting". Also, it
should be able to remove this formatting command without replacing it with
anything else, other than the value inherited from the higher level, i.e. the
paragraph level. I understand from the issue 31638 (turning on and off italics
leaves behind traces of the formatting), that this may be a problem, but if it
is a problem which sets obstacles to the feature that ftack points out, it is a
problem which should be solved...
The issue is essential if one has to clean up documents that are produced by
writers who don't use styles but only direct formatting. The scenario deescribed
by ftack is precise, as far as I understand: I haven't found a way to remove
only some, selected, formatting. After trying for an hour or two, playing around
with the search&replace, I gave up, opened the document in Word, and had it
cleaned up in two minutes.  

So the Format-Selection has to offer an item "use default for italics" or
something similar.
Comment 9 eyolf 2005-06-04 00:44:12 UTC
Just to make it clear and avoid any misunderstanding: the last paragraph in my
previous comment was the end of cloph's previous comment, which I forgot to edit
out before I submitted the comment. Sorry.
Comment 10 lohmaier 2005-06-05 21:02:54 UTC
> OOo should be able to sort out that "italics" is what should be removed, and
not > "all direct formatting".

So OOo should be more clever than the user -> not possible.

You cannot replace any formatting by "no formatting". You have to explicitly
choose the formats you don't want to have a applied.

Given the text is italic+superscript and you search for italic, it matches the
text that is both italic+superscript. If you did choose "no format" it would
remove the superscitp as well. There is no way for OOo to figure out what the
user wants.
If the superscript-case is too easy for you, what about italics & bold &
underlined. 

So for your proposal to work, one needs the current options "italics",
"non-italic" and a third one: "reset italic-settings"

The problem is that there is no such function to reset a subset of the
formatting. You can only reset the whole formatting (that is what I meant with
"design limitation" - more details in issue 31638). This is what makes this one
a major task and therefore very unlikely to be implemented (high effort and only
marginal benefit).
Comment 11 eyolf 2005-06-05 21:57:18 UTC
> So OOo should be more clever than the user -> not possible.

In this case, the user has searched for italics, and so finding italics (and not
"all formatting") would not require OOo to be more clever than the user, but to
do what it is told, which is what programs are good at.

If there is no way for OOo to distinguish between <em>not "italics"</em> and
<em>"not-italics"</em>, i.e. to remove "italics" from "italics-and-bold-and
underlined" without changing it to "not-italics-and-bold-and-underlined", then
that really is a design limitation. You may be right that the direct benefits
are limited, but in my experience (which admittedly is limited so far), the
handling of the hierarchy of formatting sources: template - style - direct
formatting, is flawed, and the flaw seems to be related to this issue (and issue
31638). If that is the case, a solution here will be part of a whole cleanup
which will have far more wide-ranging benefits for the way the program works. I
would advocate an approach more in the direction of css, where the cascading
structure is clear: a parameter which is not defined for an item, will take its
value from the higher-level definitions. Thus, removing "italics" from a
character would not require a "not-italics" setting - the paragraph style or the
template.
Therefore, the issue with re-assigning a template to a document, which I
complain about in the forum
(http://www.oooforum.org/forum/viewtopic.phtml?t=20789) is part of the same
problem, I assume. I hope I'm wrong...

Comment 12 lohmaier 2005-06-06 18:53:04 UTC
I think we were both talking about the same thing with different things in mind.

I wrote: with the current options it is not possible to *clear* the formatting
for a selection of attributes. Therefore when you search for italics and replace
with "<none>" this cannot work. A new function to clear the formatting for a
selection of the attributes has to be introduced *before* this one can be solved.

You can only change "italics" to explicit "not italics", but not "<use the
setting from the paragraph/style for italics>"

for attaching a detached document back to a template there exists another issue,
but this is in no way related to this issue.

It would not require a "not-italic" setting but "clear italics" or similar, as
no-italics is a hard-formatting with the information "not italic". I think this
was the main misunderstanding.
Comment 13 ftack 2005-06-07 10:01:15 UTC
...which hopefully has now clarified to everyone what the original issue posted
was about: have the ability to *remove* direct formatting selectively. It would
be a very relevant enhancement, but we learned that it may technically be very
difficult to implement in the short term. A pitty, but that doesn't add or
detract from the relevance of the issue.

In terms of user interface, it would not really require a '"clear italics" or
similar' option. Just having the user specify nothing will do perfectly. This
behaviour would be fully consistent with replacing content, i.e., a word or a
phrase: currently, for replacing a word or phrase with "nothing", the user fills
the "Search for" dialog, but not the "replace with". It can perfectly work in a
similar way for formatting: the user could specify formatting in the "Search
for" dialog, and nothing in the "replace" dialog, meaning "replace all
occurences of "Italics" formatting with nothing. this indeed boils down to
"remove all instances of "Italics" formatting. Besides, it is the way these
things have been handled for many years in competors products.
Comment 14 lohmaier 2005-06-09 20:56:49 UTC
> Just having the user specify nothing will do perfectly

No. It won't. Search finds portions of text, not only formatting. Searching for
italics will find all of "italics", "italics+bold" "italics+underlined",... And
not the formatting, but the text that has this format. You'll apply "no format"
to this portion of text -> you'll remove all formatting.

Furthermore: How will this work when you don't want to remove the formatting but
only replace the text? -> doesn't work. Believe me. 
Comment 15 ace_dent 2008-05-16 00:39:43 UTC
OpenOffice.org Issue Tracker - Feedback Request.

The Issue you raised is currently assigned to 'Requirements' pending review, but
has not been updated within the last 3 years. Please consider re-testing with
one of the latest versions of OOo, as the problem(s) may have already been
addressed. Either use the recent stable version:
http://download.openoffice.org/index.html
or consider trying the new OOo 3 BETA (still in testing):
http://download.openoffice.org/3.0beta/
 
Please report back the outcome so this Issue may be Closed or Progressed as
necessary - otherwise it may be Resolved as Invalid in the future. You may also
wish to search for (and note) any duplicates of this Issue that may have
advanced further by checking the Issue Tracker:
http://www.openoffice.org/issues/query.cgi
 
Many thanks,
Andrew
 
Cleaning-up and Closing old Issues as part of:
~ The Grand Bug Squash, pre v3 ~
http://marketing.openoffice.org/3.0/announcementbeta.html
Comment 16 T. J. Frazier 2008-05-27 11:31:09 UTC
This unsatisfactory behavior persists in v. 2.4.

There are two problems discussed here:  (1) specifying what the user wants, and
(2) doing that.

Problem (1) might be solved with a highly-tailored context menu, appearing when
the "Replace" box is right-clicked (there is already a context menu there).  The
menu could offer choices such as "Default format", "Set non-italic", "Set
non-bold", and so on.  I would rather see a "Remove italic" option, but see below.

Problem (2) has wider implications, as discussed in Issue 31638.  The process of
reworking direct formatting can leave artifacts in the file.  That's serious
enough, but the artifacts can interfere grossly with subsequent formatting
changes, which is _very_ serious.  This is the kind of problem that has our
users screaming for a WP-style "Reveal Codes" view (Issue 3395).
We may have to pop up a box, and ask the user what to do, in specific cases.  /tj
Comment 17 ftack 2008-05-29 13:06:09 UTC
There is only one issue here, which is that OOo does not allow to selectively
remove hard formatting, e.g. only italic when items are italic+bold, or
italic+superscript. I believe the issue has proven to be valid and therefore
should not be closed without any action just because it is old.

I am very scared of a "Word perfect reveal formatting codes" because this
represents the ultimate nightmare where you have the right as a user to fiddle
with individual formatting codes in between your content. One of the great
strengths of OOo has been the separation of formatting and contents by using
styles. This is consistent to the extent that even direct formatting internally
is handled with character styles. It is the latter that now proves to be a
limitation in implementing possibilities for the selective removal of formatting
with search/replace. However, if that is the price for  a style-centric
approach, then I am happy to pay it.
Comment 18 mestech 2010-02-24 21:29:37 UTC
I just came across this RFE while trying to figure out how to remove selective
formatting from a document.  The difference is I don't know what formatting was
used and cannot delete it.  The document was edited in both Word and WordPerfect.

This RFE is related to issue 3395 as that would allow at least some aspect of
finding and deleting hard formatting codes.  Maybe not as nice as Search and
Replace but in the right direction.

I disagree with ftack.  Though styles are great when used properly, when you
have to work with documents that have been direct formatted before you get a
chance to touch them, lack of a way to find the direct formatting is a major
headache.  I have spent days trying to fix a problem due to direct formatting in
OOo.  Something that styles doesn't override.  Even selecting all the text and
selecting "Default styles".

There are many issues that are related to direct formatting that could all be
resolved with a Reveal Codes like tool and a "Remove all formatting" from
selected text tool.  Heck, even the ability to display formatting points in View
Non-printing Characters would be useful.

A drop down menu to select codes for Search and Replace is useless if you don't
know what the code is unless it selects the code from the nearest text to the
cursor.