[Libreoffice-commits] core.git: sfx2/source

Jan Holesovsky kendy at collabora.com
Thu Oct 15 12:45:42 PDT 2015


 sfx2/source/appl/sfxpicklist.cxx |    6 +++---
 sfx2/source/inc/sfxpicklist.hxx  |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 468b55301f385771d65d2f15f9ad7879af29f1cf
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Oct 15 21:34:41 2015 +0200

    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

diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx
index 4e05fdd..0ef604c 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 5252a61..19b378d 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();


More information about the Libreoffice-commits mailing list