Bug 107915 - Icons for styles in the Styles toolbar
Summary: Icons for styles in the Styles toolbar
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.4.0.0.alpha1+
Hardware: All All
: medium enhancement
Assignee: Yousuf Philips (jay) (retired)
URL:
Whiteboard: target:5.5.0 target:6.0.0
Keywords:
Depends on:
Blocks: Toolbars Icon-Themes Writer-Styles Writer-Toolbar-Formatting-Styles Style-Formatting-Writer-Toolbar
  Show dependency treegraph
 
Reported: 2017-05-17 16:34 UTC by Yousuf Philips (jay) (retired)
Modified: 2019-03-21 23:07 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 Yousuf Philips (jay) (retired) 2017-05-17 16:34:15 UTC
@Maxim: With styles in the Style menu using UNO commands like .uno:StyleApply?Style:string=Standard&FamilyName:string=ParagraphStyles, is it possible to assign icons to them and if so, how would it be named, as it is possible to add icons to them in the customization dialog.

Was thinking that the work around would be to make alias commands for each of the styles and then it is easy to assign icons to those.
Comment 1 Maxim Monastirsky 2017-05-22 22:33:19 UTC
(In reply to Yousuf Philips (jay) from comment #0)
> @Maxim: With styles in the Style menu using UNO commands like
> .uno:StyleApply?Style:string=Standard&FamilyName:string=ParagraphStyles,
> is it possible to assign icons to them and if so, how would it be named
It's possible after escaping all problematic characters, see the lclConvertToCanonicalName function from http://opengrok.libreoffice.org/xref/core/framework/source/uiconfiguration/CommandImageResolver.cxx#lclConvertToCanonicalName

There is however one problem if you're going to use links.txt with a command that has a space (e.g. for "Heading 1"), as the links.txt parser assumes that a space separates a link from the original image. But this can be easily solved by adding a space escaping into lclConvertToCanonicalName.

> Was thinking that the work around would be to make alias commands for each
> of the styles and then it is easy to assign icons to those.
Yes, that should work too. But keep in mind that it won't work with styles that user might add via the Add Commands dialog. But if this isn't a problem, then it's a good solution too.
Comment 2 Yousuf Philips (jay) (retired) 2017-05-23 02:07:54 UTC
(In reply to Maxim Monastirsky from comment #1)
> It's possible after escaping all problematic characters, see the
> lclConvertToCanonicalName function from
> http://opengrok.libreoffice.org/xref/core/framework/source/uiconfiguration/
> CommandImageResolver.cxx#lclConvertToCanonicalName
> 
> There is however one problem if you're going to use links.txt with a command
> that has a space (e.g. for "Heading 1"), as the links.txt parser assumes
> that a space separates a link from the original image. But this can be
> easily solved by adding a space escaping into lclConvertToCanonicalName.

Seems very complicated and couldnt figure out the conversion. :D

> Yes, that should work too. But keep in mind that it won't work with styles
> that user might add via the Add Commands dialog. But if this isn't a
> problem, then it's a good solution too.

Yes it would only be for built-in styles that we place in the Styles menu, so this seems to be the simplest option. ;D
Comment 3 Thomas Lendo 2017-05-23 04:52:14 UTC
(In reply to Yousuf Philips (jay) from comment #2)
> (In reply to Maxim Monastirsky from comment #1)
> > Yes, that should work too. But keep in mind that it won't work with styles
> > that user might add via the Add Commands dialog. But if this isn't a
> > problem, then it's a good solution too.
> Yes it would only be for built-in styles that we place in the Styles menu,
> so this seems to be the simplest option. ;D

I don't follow you both. While working with an own company's style toolbar, I'm already assigning icons to these styles via the Add commands window in the Customize dialog. It's working with styles I added manually as described by Regina and it's also working with styles I added in 5.4/5.5 via Add commands.
Comment 4 Maxim Monastirsky 2017-05-23 09:23:39 UTC
(In reply to Yousuf Philips (jay) from comment #2)
> (In reply to Maxim Monastirsky from comment #1)
> > It's possible after escaping all problematic characters, see the
> > lclConvertToCanonicalName function from
> Seems very complicated and couldnt figure out the conversion. :D
Like this: sc_styleapply%3fstyle%3astring=standard&familyname%3astring=paragraphstyles.png

Supporting spaces in lclConvertToCanonicalName is only a matter of adding there this one line:

case ' ':  aBuffer.append("%20"); bRemoveSlash = false; break;

... and replacing spaces in the image file name with %20.

> Yes it would only be for built-in styles that we place in the Styles menu,
> so this seems to be the simplest option. ;D
Agree. I would suggest that too.

(In reply to Thomas Lendo from comment #3)
> I don't follow you both. While working with an own company's style toolbar,
> I'm already assigning icons to these styles via the Add commands window in
> the Customize dialog. It's working with styles I added manually as described
> by Regina and it's also working with styles I added in 5.4/5.5 via Add
> commands.
Yes, you can assign icons manually. It just that they won't pick icons automatically, once we assign them for internal use (e.g. for the Styles menu).
Comment 5 Yousuf Philips (jay) (retired) 2017-05-25 02:01:34 UTC
Initial patch is in for styles formatting toolbar.
https://gerrit.libreoffice.org/38009
Comment 6 Commit Notification 2017-06-02 09:11:41 UTC
Yousuf Philips committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=fe6fb37dff61f83e80076a0c9d9caf3714ed590f

tdf#107915 Add paragraph and character style aliases

It will be available in 5.5.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2017-09-15 21:02:40 UTC
Yousuf Philips committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f9cbf67fb2cf817b6d201604eb7d4bf6182a1392

tdf#107915 More paragraph and character style aliases

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Xisco Faulí 2017-10-16 06:10:39 UTC
A polite ping to Yousuf Philips: is this bug fixed? if so, could you please close it as RESOLVED FIXED ? Thanks
Comment 9 Yousuf Philips (jay) (retired) 2017-10-16 12:24:34 UTC
Icons for tango and breeze were added, so this can be closed.

Breeze commit
https://gerrit.libreoffice.org/#/c/41918/
Comment 10 Commit Notification 2017-10-16 14:52:36 UTC
Yousuf Philips committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c105eddc462f12c50fea4244e1bf49e8fb37da9b

tdf#107915 tdf#75256 numbering style icons for style toolbar

It will be available in 6.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Thomas Lendo 2017-11-09 10:08:32 UTC
(In reply to Yousuf Philips (jay) from comment #9)
> Icons for tango and breeze were added, so this can be closed.
I don't see Tango icons for paragraph and character styles in the Styles formatting toolbar.

Version: 6.0.0.0.alpha1+ (x64)
Build ID: a5af0fd9f27af42cf2e8571f659cdad6e606215b
CPU threads: 8; OS: Windows 10.0; UI render: default; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2017-11-07_00:30:02
Locale: de-DE (de_DE); Calc: group