diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-10-15 21:34:41 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-10-15 21:44:32 +0200 |
commit | 468b55301f385771d65d2f15f9ad7879af29f1cf (patch) | |
tree | 4367580acc873157c6fbd49ba62ca8267671cc5d | |
parent | bd2f6ab505a2b76da0b829607a73b5f9a6be3008 (diff) |
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
-rw-r--r-- | sfx2/source/appl/sfxpicklist.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/inc/sfxpicklist.hxx | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index 4e05fdd2e2e3..0ef604c2dbbd 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -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; diff --git a/sfx2/source/inc/sfxpicklist.hxx b/sfx2/source/inc/sfxpicklist.hxx index 5252a61e8112..19b378d17c30 100644 --- a/sfx2/source/inc/sfxpicklist.hxx +++ b/sfx2/source/inc/sfxpicklist.hxx @@ -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(); |