kbrown / rpms / libreoffice

Forked from rpms/libreoffice 2 years ago
Clone

Blame SOURCES/0013-resolved-fdo-53103-actually-use-the-external-data-fi.patch

f0633d
From ea40b8b14d830f5025a3fe2e9da9163b83a843e5 Mon Sep 17 00:00:00 2001
f0633d
From: Eike Rathke <erack@redhat.com>
f0633d
Date: Wed, 27 Nov 2013 00:04:44 +0100
f0633d
Subject: [PATCH 013/109] resolved fdo#53103 actually use the external data
f0633d
 filter options
f0633d
f0633d
ScDocShell::ConvertFrom() queries the filter options from the SfxItemSet
f0633d
at SfxMedium, which is fine when loading the data into the table
f0633d
selector first, but the final load via ScAreaLink created a bare
f0633d
SfxMedium without options set. Do so.
f0633d
f0633d
Additionally it may now even work that ScDocShell sets options at
f0633d
SfxMedium, which the ScAreaLink code prepared for but previously the
f0633d
SfxMedium did not have an SfxItemSet.
f0633d
f0633d
Change-Id: I45d6a24906dc3ba41654b8c0951dd84939d8af5e
f0633d
(cherry picked from commit 513eadd422ff6a41cfe9a16f82cf32872d729652)
f0633d
Reviewed-on: https://gerrit.libreoffice.org/6823
f0633d
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
f0633d
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
f0633d
---
f0633d
 sc/inc/tablink.hxx                 |  8 +++++++-
f0633d
 sc/source/ui/docshell/arealink.cxx |  2 +-
f0633d
 sc/source/ui/docshell/tablink.cxx  | 18 ++++++++++++------
f0633d
 3 files changed, 20 insertions(+), 8 deletions(-)
f0633d
f0633d
diff --git a/sc/inc/tablink.hxx b/sc/inc/tablink.hxx
f0633d
index 068d87f..49833af 100644
f0633d
--- a/sc/inc/tablink.hxx
f0633d
+++ b/sc/inc/tablink.hxx
f0633d
@@ -72,6 +72,7 @@ public:
f0633d
 
f0633d
 class ScDocument;
f0633d
 class SfxMedium;
f0633d
+class SfxFilter;
f0633d
 
f0633d
 class SC_DLLPUBLIC ScDocumentLoader
f0633d
 {
f0633d
@@ -96,7 +97,12 @@ public:
f0633d
 
f0633d
     void                ReleaseDocRef();    // without calling DoClose
f0633d
 
f0633d
-    static OUString GetOptions( SfxMedium& rMedium );
f0633d
+    /** Create SfxMedium for stream read with SfxFilter and filter options set
f0633d
+        at the medium's SfxItemSet.
f0633d
+     */
f0633d
+    static SfxMedium*   CreateMedium( const OUString& rFileName, const SfxFilter* pFilter, const OUString& rOptions );
f0633d
+
f0633d
+    static OUString     GetOptions( SfxMedium& rMedium );
f0633d
 
f0633d
     /** Returns the filter name and options from a file name.
f0633d
         @param bWithContent
f0633d
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
f0633d
index 6409fbd..f80c80a 100644
f0633d
--- a/sc/source/ui/docshell/arealink.cxx
f0633d
+++ b/sc/source/ui/docshell/arealink.cxx
f0633d
@@ -253,7 +253,7 @@ sal_Bool ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
f0633d
     if ( rNewFilter != aFilterName )
f0633d
         aOptions.Erase();
f0633d
 
f0633d
-    SfxMedium* pMed = new SfxMedium(aNewUrl, STREAM_STD_READ, pFilter);
f0633d
+    SfxMedium* pMed = ScDocumentLoader::CreateMedium( aNewUrl, pFilter, aOptions);
f0633d
 
f0633d
     // aRef->DoClose() will be closed explicitly, but it is still more safe to use SfxObjectShellLock here
f0633d
     ScDocShell* pSrcShell = new ScDocShell(SFX_CREATE_MODE_INTERNAL);
f0633d
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
f0633d
index ba1ed72..0164e27 100644
f0633d
--- a/sc/source/ui/docshell/tablink.cxx
f0633d
+++ b/sc/source/ui/docshell/tablink.cxx
f0633d
@@ -519,6 +519,17 @@ void ScDocumentLoader::RemoveAppPrefix( OUString& rFilterName )
f0633d
         rFilterName = rFilterName.copy( aAppPrefix.getLength());
f0633d
 }
f0633d
 
f0633d
+SfxMedium* ScDocumentLoader::CreateMedium( const OUString& rFileName, const SfxFilter* pFilter,
f0633d
+        const OUString& rOptions )
f0633d
+{
f0633d
+    // Always create SfxItemSet so ScDocShell can set options.
f0633d
+    SfxItemSet* pSet = new SfxAllItemSet( SFX_APP()->GetPool() );
f0633d
+    if ( !rOptions.isEmpty() )
f0633d
+        pSet->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, rOptions ) );
f0633d
+
f0633d
+    return new SfxMedium( rFileName, STREAM_STD_READ, pFilter, pSet );
f0633d
+}
f0633d
+
f0633d
 ScDocumentLoader::ScDocumentLoader( const OUString& rFileName,
f0633d
                                     OUString& rFilterName, OUString& rOptions,
f0633d
                                     sal_uInt32 nRekCnt, bool bWithInteraction ) :
f0633d
@@ -530,12 +541,7 @@ ScDocumentLoader::ScDocumentLoader( const OUString& rFileName,
f0633d
 
f0633d
     const SfxFilter* pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( rFilterName );
f0633d
 
f0633d
-    //  ItemSet immer anlegen, damit die DocShell die Optionen setzen kann
f0633d
-    SfxItemSet* pSet = new SfxAllItemSet( SFX_APP()->GetPool() );
f0633d
-    if ( !rOptions.isEmpty() )
f0633d
-        pSet->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, rOptions ) );
f0633d
-
f0633d
-    pMedium = new SfxMedium( rFileName, STREAM_STD_READ, pFilter, pSet );
f0633d
+    pMedium = CreateMedium( rFileName, pFilter, rOptions);
f0633d
     if ( pMedium->GetError() != ERRCODE_NONE )
f0633d
         return ;
f0633d
 
f0633d
-- 
f0633d
1.8.4.2
f0633d