Kaydet (Commit) 468b5530 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

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

Creating thumbnails is quite an expensive operation, so let's avoid that on
load, and do that only on the document save or document close.

In case the user chooses not to save a modified document, thumbnail is not
generated which can lead to document that has no thumbnail; but that's
probably a good tradeoff for the speedup.

Change-Id: I61bf5ec3fae9596e87963ac7a28ba6e4e52c4e99
üst bd2f6ab5
......@@ -159,7 +159,7 @@ SfxPickList::PickListEntry* SfxPickList::GetPickListEntry( sal_uInt32 nIndex )
return 0;
}
void SfxPickList::AddDocumentToPickList( SfxObjectShell* pDocSh )
void SfxPickList::AddDocumentToPickList(SfxObjectShell* pDocSh, bool bAvoidThumbnail)
{
SfxMedium *pMed = pDocSh->GetMedium();
if( !pMed )
......@@ -197,7 +197,7 @@ void SfxPickList::AddDocumentToPickList( SfxObjectShell* pDocSh )
boost::optional<OUString> aThumbnail;
// don't generate thumbnail when in headless mode, or on non-desktop (?)
#if HAVE_FEATURE_DESKTOP
if (!pDocSh->IsModified() && !Application::IsHeadlessModeEnabled())
if (!bAvoidThumbnail && !pDocSh->IsModified() && !Application::IsHeadlessModeEnabled())
{
// not modified => the document matches what is in the shell
SFX_ITEMSET_ARG( pMed->GetItemSet(), pEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, false );
......@@ -412,7 +412,7 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint )
case SFX_EVENT_OPENDOC:
{
AddDocumentToPickList(pDocSh);
AddDocumentToPickList(pDocSh, /* bAvoidThumbnail = */ true);
}
break;
......
......@@ -58,7 +58,7 @@ class SfxPickList : public SfxListener
certain requirements, e.g. being writable. Check implementation for requirement
details.
*/
static void AddDocumentToPickList( SfxObjectShell* pDocShell );
static void AddDocumentToPickList(SfxObjectShell* pDocShell, bool bAvoidThumbnail = false);
public:
static SfxPickList& Get();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment