Bug 95095 - Do not generate thumbnail on load of a document if not necessary
Summary: Do not generate thumbnail on load of a document if not necessary
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
5.0.1.2 release
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.1.0
Keywords:
: 125060 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-10-15 18:43 UTC by Jan Holesovsky
Modified: 2020-04-14 12:04 UTC (History)
2 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 Jan Holesovsky 2015-10-15 18:43:59 UTC
The thumbnails in the startcenter are nice, but they take quite a lot of time to generate; 300ms and more, which is for many documents a tremendous amount of time.

As a solution, we should generate the thumbnails only when the document is closed or when it is saved.

The unfortunate consequence is that there is a scenario when the thumbnails will not be generated:

* open a document the user has never opened before
* do some modifications
* close the document, but choose _not_ to save the modifications.

When the thumbnail was generated on load, we still had a thumbnail of the document.  When we avoid that, we won't have the thumbnail - as obviously it makes no sense to generate a thumbnail of the non-saved changes (and we don't have the original document at hand).

I believe this is a good trade-off, as in all the other scenarios (the user opens the doc, and closes it again; the user does modifications & saves them) the thumbnail will be generated.
Comment 1 Commit Notification 2015-10-15 19:46:47 UTC
Jan Holesovsky committed a patch related to this issue.
It has been pushed to "master":

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

tdf#95095: Don't create thumbnails on load.

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 2 Jan Holesovsky 2015-10-15 19:50:25 UTC
Fixed now...
Comment 3 Commit Notification 2015-10-16 09:57:08 UTC
Jan Holesovsky committed a patch related to this issue.
It has been pushed to "master":

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

Revert "tdf#95095: Don't create thumbnails on load."

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 4 Jan Holesovsky 2015-10-16 09:59:42 UTC
Actually - it looks worse than I had hoped, reverted in master again.  I'll try to come up with a better fix there.
Comment 5 Jan Holesovsky 2015-10-21 07:14:01 UTC
Instead of the "avoid it always" approach, I've added a property value "AvoidRecentDocs" that (when set to true), does not add the document to the recent documents list, and consequently avoids creation of the thumbnail.

I guess this is useful in many cases when LibreOffice is controlled externally, and performance is important.

Use like (see the "AvoidRecentDocs" part):

Dim Doc As Object
Dim FileProperties(2) As New com.sun.star.beans.PropertyValue
Dim Url As String
 
Url = "file:///tmp/test-csv.csv"
FileProperties(0).Name = "FilterName"
FileProperties(0).Value ="Text - txt - csv (StarCalc)"
FileProperties(1).Name = "FilterOptions"
FileProperties(1).value  = "44,34,0,1"
FileProperties(2).Name = "AvoidRecentDocs"
FileProperties(2).value  = true
 
Doc = StarDesktop.loadComponentFromURL(Url, "_blank", 0, FileProperties())
Comment 6 Commit Notification 2015-10-21 07:28:02 UTC
Jan Holesovsky committed a patch related to this issue.
It has been pushed to "master":

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

tdf#95095: Implement "AvoidRecentDocs" property for loadComponentFromURL().

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 7 Jan Holesovsky 2015-10-21 07:32:09 UTC
Now fixed.
Comment 8 Commit Notification 2015-10-21 08:06:02 UTC
Jan Holesovsky committed a patch related to this issue.
It has been pushed to "master":

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

tdf#95095: Rename "AvoidRecentDocs" to "PickListEntry" for consistency.

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 9 Jan Holesovsky 2015-10-21 08:10:15 UTC
Turns out that Base already had a property doing the same thing, called "PickListEntry" with the possibility to be set to false to avoid adding to the recent documents; so I have renamed "AvoidRecentDocs" to "PickListEntry" for consistency with the existing code & examples.

In the BASIC example from comment 5, you need to use:

FileProperties(2).Name = "PickListEntry"
FileProperties(2).value  = false
Comment 10 Oliver Brinzing 2019-05-11 08:35:39 UTC
*** Bug 125060 has been marked as a duplicate of this bug. ***