Download it now!
Bug 128357 - [Enhancement] "Default Style" should be first on all languages
Summary: [Enhancement] "Default Style" should be first on all languages
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Shivam Kumar Singh
URL:
Whiteboard: target:7.0.0
Keywords: difficultyInteresting, easyHack, skillCpp, topicUI
Depends on:
Blocks: Sidebar-Styles-Improvements
  Show dependency treegraph
 
Reported: 2019-10-23 19:38 UTC by Pierre C
Modified: 2020-02-27 12:46 UTC (History)
4 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 Pierre C 2019-10-23 19:38:41 UTC
In writer, when using character style, you often have to sue the default style

In French UI, it is sorted by name and so appears farfrom the top ("Style par défaut")

I think this particular style sould be on the top of the list for all languages
Comment 1 Heiko Tietze 2020-01-23 12:34:09 UTC
First is "Default Style" then "Bullet" ... "Visited Internet Links" come properly sorted. But with a different localization it happens what you say (tested with 6.2.8.2 german UI). So yes, this needs to be fixed.
Comment 2 Pierre C 2020-01-23 13:09:00 UTC
Thanks for confirming the bug
Comment 3 Pierre C 2020-01-27 21:49:18 UTC
The problem is the same with page styles. Default style is not on the top. Shall I fill a new bug or complete this one ?
Comment 4 Heiko Tietze 2020-01-28 08:27:41 UTC Comment hidden (off-topic)
Comment 5 Shivam Kumar Singh 2020-01-31 15:51:10 UTC
(In reply to Heiko Tietze from comment #4)
> (In reply to Pierre C from comment #3)
> > The problem is the same with page styles. Default style is not on the top.

Hi everyone , After working a lot on this bug I understood that :-

- the code pointer for page style is in 
 /sw/source/core/doc/DocumentStylePoolManager.cxx where the styles are declared 
 in line 497 .

- the style array is converted to a vector<OUString> in 
  SwStyleNameMapper::GetPageDescUINameArray and after that it is inserted into 
  unordered_map<OUString> in /sw/source/core/doc/SwStyleNameMapper.cxx in the 
  HashFromRange method .
I cannot follow the code after this point, also as we are employing an unordered_map in HashFromRange , it does not really sort the elements in any specific order . Where is the actual sorting of style names done  then ?

Someone please guide me on this .
Comment 6 Jim Raykowski 2020-02-01 09:36:09 UTC
"Default Style" is hard coded in sfx2/source/dialog/templdlg.cxx
static void MakeTree_Impl(StyleTreeArr_Impl& rArr)
Maybe use STR_POOLCOLL_STANDARD, STR_POOLPAGE_STANDARD, or STR_TABSTYLE_DEFAULT
Look for line with comment // tdf#91106 sort top level styles
https://opengrok.libreoffice.org/xref/core/sfx2/source/dialog/templdlg.cxx?r=f7804fc2#611

HTH
Comment 7 Heiko Tietze 2020-02-03 11:33:30 UTC
Shivam, did you solve this with the latest patches? To lazy to check myself ;-)
Comment 8 Shivam Kumar Singh 2020-02-03 12:24:50 UTC
(In reply to Heiko Tietze from comment #7)
> Shivam, did you solve this with the latest patches? To lazy to check myself
> ;-)

My patch would work but only for the English UI .
Jim gave me some instructions and code pointers, will submit another patch by today . Hope that solves the bug :D
Comment 9 Commit Notification 2020-02-27 11:12:14 UTC
Shivam Kumar Singh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ddf96414896fd19b2ed82f9e4d4974855cf1e83a

tdf#128357 Forcing default style to stay at top in page styles

It will be available in 7.0.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 10 Shivam Kumar Singh 2020-02-27 11:26:32 UTC
There's no tag in here. Can it be considered an InterestingHack ?
Comment 11 Heiko Tietze 2020-02-27 12:46:18 UTC
(In reply to Shivam Kumar Singh from comment #10)
> There's no tag in here. Can it be considered an InterestingHack ?

Absolutely, it was quite some effort in the end.