Bug 43067 - Format paintbrush doesn't remove format attribute
Summary: Format paintbrush doesn't remove format attribute
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Master old -3.6
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-18 07:31 UTC by Maxime de Roucy
Modified: 2011-11-24 06:34 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
content.xml of the example file (3.02 KB, text/xml)
2011-11-18 07:31 UTC, Maxime de Roucy
Details
example.odt (8.48 KB, application/vnd.oasis.opendocument.text)
2011-11-24 01:12 UTC, Maxime de Roucy
Details
further examples to test paintbrush (10.07 KB, application/vnd.oasis.opendocument.text)
2011-11-24 05:15 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maxime de Roucy 2011-11-18 07:31:02 UTC
Created attachment 53662 [details]
content.xml of the example file

For example if I take a document with the content.xml attached and select the "test1" and then try to apply the format to "test2" -> test2 isn't modified.

That's due to the fact that

rWrtShell.SetAttr(*pTemplateItemSet);

line 528 of core/sw/source/ui/uiview/formatclipboard.cxx

doesn't replace the SfxItemSet of rWrtShell but merge it with the existing one...
Comment 1 Regina Henschel 2011-11-23 10:49:54 UTC
I do not understand your problem. For me paintbrush works as described.

What format settings has your "test1"? Is it a hard set character property, or is it set in an applied character style, or is it a hard setting in the parent paragraph, or is it set in the paragraph style? Are you sure about what settings paintbrush has read?

How do you "apply" the content of the paintbrush? Do you click to word, mark a word, use ctrl+paintbrush, use ctrl+shift+paintbrush?

Can you please describe in more detail, what you do, what you get, what you expect to get and why you think it is an error.

Can you please attach a full document?
Comment 2 Maxime de Roucy 2011-11-24 01:11:40 UTC
I attached an example.odt matching the content.xml previously attached.

What I do :
* Put the cursor on "test1".
* Clic on the "format paintbrush" button.
* Select "test2" (drop the left mouse button)

What I get : nothing change

What I expected : the selection should be "un-bolded" (same format as test1).

################

As I explained in this mail :
http://lists.freedesktop.org/archives/libreoffice/2011-November/021210.html

I tried to solve this problem by adding "rWrtShell.ResetAttr();" just before the 
"rWrtShell.SetAttr(*pTemplateItemSet);" line of core/sw/source/ui/uiview/formatclipboard.cxx

It works approximately but it still need some advice in order to differentiate formatting attributes that come from style:family="paragraph" and those that come from style:family="text".
Comment 3 Maxime de Roucy 2011-11-24 01:12:17 UTC
Created attachment 53828 [details]
example.odt
Comment 4 Regina Henschel 2011-11-24 05:14:04 UTC
I do not see an error here. The string test1 does not have any format settings. So the format paintbrush transports nothing. Take the second example in the attached file. The line has a paragraph style with bold and the string "normal" has a direct setting to normal. Now being "normal" is a true direct setting and paintbrush contains it and can copy it to "test4 [Use Ctrl+click paintbrush to exclude the paragraph settings.] 

I'm not sure, that this behavior should be changed. For example take the color for the second line in the attached example2.odt and copy it with paintbrush to the first line. I think, that it is correct, that only the color is transported and the weight remains unchanged "not set" or "set bold".

We have Strg+M to remove direct formatting, no need to change the meaning of paintbrush.

But this is only my personal opinion. Have you ask the usability people about changing the meaning of paintbrush?
Comment 5 Regina Henschel 2011-11-24 05:15:03 UTC
Created attachment 53830 [details]
further examples to test paintbrush
Comment 6 Maxime de Roucy 2011-11-24 05:42:40 UTC
I will ask the usability people. But for me and the users I asked the format paintbrush should copy the fact the text isn't in bold for example.
It should apply EXACTLY the same format on the selection.
Comment 7 Michael Stahl (allotropia) 2011-11-24 05:56:17 UTC
in styles.xml there is:

 <style:style style:name="Standard" style:family="paragraph" style:class="text"/>

which does not define anything.

 <text:p text:style-name="Standard">test1 

the text "text1" is not inside a text:span, so only the paragraph style affects its formatting.  because the paragraph style does not say anything about font weight, no change is made to the existing formatting.

if you add the following to the style that is pasted
(and i actually don't know how to do this with the UI):

 <style:text-properties fo:font-weight="normal"/>

then using the paint brush will remove the bold formatting.

so i would say this works as it should, this is not a bug.
Comment 8 Maxime de Roucy 2011-11-24 06:20:21 UTC
I understand how it works and why it behaves like that.

But for me when the attributes array are pasted it should erase the previous attributes.

For example, I copy this attribute array :
[weight=bold]
and I want to paste it on a text with this attribute array :
[color=red]

According to me the second attribute array should *not* become :
[weight=bold,color=red]
but
[weight=bold]
instead.

So it is not a "bug" as a coding error but it's a "bug" as a request to change the behavior.
Comment 9 Michael Stahl (allotropia) 2011-11-24 06:25:48 UTC
hmm... i don't know our UI very well :)

if we indeed don't have a UI function to do what you want,
then perhaps a new one can be added;
the existing paint brush is needed as-is, perhaps we should have another one.

i have no opinion on whether that is a good idea, please ask our UX folks :)
Comment 10 Maxime de Roucy 2011-11-24 06:34:48 UTC
Ok I will talk to the UX people and ask them if I can add another kind of paintbrush.

thanks