Bug 94173 - Calc does not save your own created autoformat presets
Summary: Calc does not save your own created autoformat presets
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.6.7.2 release
Hardware: Other Linux (All)
: medium normal
Assignee: Julien Nabet
URL:
Whiteboard: target:5.1.0 target:5.0.3 target:4.4.6
Keywords: bibisected
: 61330 61331 82948 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-09-12 21:53 UTC by Yan Pas
Modified: 2018-11-20 22:21 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
test (7.51 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-09-12 21:53 UTC, Yan Pas
Details
Autoformat screenshoot (34.73 KB, image/png)
2015-09-13 20:23 UTC, m_a_riosv
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yan Pas 2015-09-12 21:53:12 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Build Identifier: LibreOffice 5.0.1.2

Colorize 5x5 array of cells, click format -> autoformat -> add new; Enter the name of your new autoformat, click OK. Then again open format -> autoformat. There are no format you have created!!!!

Reproducible: Always




[Information automatically included from LibreOffice]
Locale: ru
Module: SpreadsheetDocument
[Information guessed from browser]
OS: Linux (All)
OS is 64bit: yes


Reset User Profile?No
Comment 1 Yan Pas 2015-09-12 21:53:30 UTC
Created attachment 118655 [details]
test
Comment 2 Julien Nabet 2015-09-13 13:57:58 UTC
On pc Debian x86-64 with LO Debian package 5.0.1.2, I don't reproduce this.

Did you choose a name in lowercase? (in this case, it might be at the bottom of the list)
Comment 3 m_a_riosv 2015-09-13 14:36:29 UTC
Hi @Yan, thanks for  reporting.

Reproducible.
Win7x64
Version: 5.0.2.1 (x64)Build ID: 9a18d52abbdfbdc2ac9acebec2b92e7859eb73b7
Version: 4.4.6.0.0+ Build ID: 7785e87aa9fc706b1474e6a480affca067542f5d
TinderBox: Win-x86@51-TDF, Branch:libreoffice-4-4, Time: 2015-09-02_22:14:25
Version: 4.3.7.2 Build ID: 8a35821d8636a03b8bf4e15b48f59794652c68ba
Versión: 4.2.8.0.0 Id. de compilación: 48d50dbfc06349262c9d50868e5c1f630a573ebd
Versión: 4.1.6.2 Id. de compilación: 40ff705089295be5be0aae9b15123f687c05b0a
Version 3.6.7.2 (Build ID: e183d5b)


Last working for me-
LibreOffice 3.5.7.2 Build ID: 3215f89-f603614-ab984f2-7348103-1225a5b

In those version working "Default" is at the top of the Formats list, in those not working is sorted with others Format names.

Creating one with '0New' name disappear after close and reopen Autoformat.

Please @Julien, could you play a bit creating and deleting a couple of them with different names.
Comment 4 Julien Nabet 2015-09-13 14:54:14 UTC
Thank you mariosv for the hint, I could reproduce this if the new entry is at the beginning of the list.
For example: "0New", "Arrowtest", ...
But "BlueTest" is ok for example.
Comment 5 Julien Nabet 2015-09-13 17:18:56 UTC
In autoform.cxx, line 1082, if I change this line:
for (++it; bRet && it != itEnd; ++it) // Skip the first item.
into this:
for (; bRet && it != itEnd; ++it)
it's ok
(see http://opengrok.libreoffice.org/xref/core/sc/source/core/tool/autoform.cxx#1082)
The goal is to skip "Default" (the always first entry in autoformat list)

However, seeing there's a "Default" in Autoformat in Writer, I suppose there should one too in Calc.
So the quoted change must be wrong and I should search why Default doesn't appear.
Comment 6 m_a_riosv 2015-09-13 20:23:38 UTC
Created attachment 118680 [details]
Autoformat screenshoot

(In reply to Julien Nabet from comment #5)

> However, seeing there's a "Default" in Autoformat in Writer, I suppose there
> should one too in Calc.
> So the quoted change must be wrong and I should search why Default doesn't
> appear.

For me there is one "Default" in calc, not at the beginning but in their sort order.
Comment 7 Julien Nabet 2015-09-13 21:18:31 UTC
I'm not sure at all but wonder if it could be related to this commit:
http://cgit.freedesktop.org/libreoffice/core/commit/?id=72c1b6141d590fb4479925ed8bc88b79357c2bfc
extract of gdb session:
Breakpoint 2, ScAutoFormat::Load (this=0x35b29f0) at /home/julien/compile-libreoffice/libreoffice/sc/source/core/tool/autoform.cxx:1039
1039	                    insert(pData);
(gdb) p maData
$19 = boost::ptr_map with 2.0 elements = {["00Test"] = {aName = "00Test", nStrResId = 65535, bIncludeFont = true, bIncludeJustify = true, bIncludeFrame = true, 
    bIncludeBackground = true, bIncludeValueFormat = true, bIncludeWidthHeight = true, m_swFields = {<boost::noncopyable_::noncopyable> = {<No data fields>}, pData = 0x0, 
      size = 0}, ppDataField = 0x359bc40}, ["Default"] = {aName = "Default", nStrResId = 65535, bIncludeFont = true, bIncludeJustify = true, bIncludeFrame = true, 
    bIncludeBackground = true, bIncludeValueFormat = true, bIncludeWidthHeight = true, m_swFields = {<boost::noncopyable_::noncopyable> = {<No data fields>}, pData = 0x0, 
      size = 0}, ppDataField = 0x350a8d0}}

So it seems that to fix this, "Default" should be first in the list and the rest sorted.
Comment 8 Julien Nabet 2015-09-14 07:11:51 UTC
I'll give it a try. I think we need to resurrect Compare function (to put Default at first) and use it in MapType definition.
Comment 9 Julien Nabet 2015-09-14 20:02:24 UTC
Sorry, I don't know how to do this.
Hopefully, I'm quite sure this could be done in few minutes by anyone knowing C++ :-)
Comment 10 Julien Nabet 2015-09-15 19:58:00 UTC
Finally I gave a new try and succeeded to have Default always showing first (and so the new entry, even if new first on the list, is saved).
I submitted a patch to review here:
https://gerrit.libreoffice.org/18598 (master branch)
Comment 11 Julien Nabet 2015-09-15 19:59:41 UTC
Setting version according to Mario's comment 3
Comment 12 Julien Nabet 2015-09-16 12:17:02 UTC
*** Bug 82948 has been marked as a duplicate of this bug. ***
Comment 13 Julien Nabet 2015-09-16 12:17:41 UTC
*** Bug 61331 has been marked as a duplicate of this bug. ***
Comment 14 Julien Nabet 2015-09-18 22:12:03 UTC
*** Bug 61330 has been marked as a duplicate of this bug. ***
Comment 15 Commit Notification 2015-09-30 12:13:03 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

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

tdf#94173: Calc doesn't save your own created autoformat presets

It will be available in 5.1.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 16 Yan Pas 2015-09-30 12:16:25 UTC
And what about 5.0.3, will the patch be backporteed?
Comment 17 Julien Nabet 2015-09-30 12:44:20 UTC
I cherry-picked the patch and submitted to review for 5.0 branch here:
https://gerrit.libreoffice.org/#/c/19029/
Comment 18 Commit Notification 2015-10-05 10:48:50 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

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

use collator for UI visible sorting, tdf#94173 follow-up

It will be available in 5.1.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 19 Commit Notification 2015-10-05 11:01:26 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-5-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=457a9f405f3778547cc2fcafff445d89e87c7db6&h=libreoffice-5-0

tdf#94173: Calc doesn't save your own created autoformat presets

It will be available in 5.0.3.

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 20 Commit Notification 2015-10-05 11:18:28 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-4-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=75d6000da3d185da1694631c4444be8dd9dd5eac&h=libreoffice-4-4

tdf#94173: Calc doesn't save your own created autoformat presets

It will be available in 4.4.7.

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 21 Julien Nabet 2015-10-05 12:04:34 UTC
Thank you to Eike for the follow-up (use collator, see http://cgit.freedesktop.org/libreoffice/core/commit/?id=a71febc99d2cfc2fe51dec8c0bca5d84d8577168).
Let's put this one to FIXED now.
Comment 22 Commit Notification 2015-10-05 16:17:25 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-4-4-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6cf58fbb1f5f44fa868b74146c3008dc8ffa46e8&h=libreoffice-4-4-6

tdf#94173: Calc doesn't save your own created autoformat presets

It will be available in 4.4.6.

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.