[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sc/inc sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Sat Jan 11 08:02:40 PST 2014


 sc/inc/scextopt.hxx            |    7 +++++++
 sc/source/ui/view/scextopt.cxx |   12 ++++++++++++
 sc/source/ui/view/viewdata.cxx |    4 ++++
 3 files changed, 23 insertions(+)

New commits:
commit 5363d7b89d9b7732ba7f3d9bc04008bdc29fefd0
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Jan 10 15:10:23 2014 -0500

    fdo#73484: Ensure that we import all tab settings from Excel.
    
    The old code would not import settings of the last sheet if maTabData was
    not large enough before the loop begins. Enlarge maTabData ahead of time
    to ensure we load all tab settings.
    
    (cherry picked from commit 3e87471b6815a3cad48cab2ef81073bad5453c56)
    
    Conflicts:
    	sc/inc/scextopt.hxx
    
    Change-Id: I9093a93ef26ccba9fef06a8929d1d86311f5c55d
    Reviewed-on: https://gerrit.libreoffice.org/7383
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/inc/scextopt.hxx b/sc/inc/scextopt.hxx
index 22e6ab6..80513f2 100644
--- a/sc/inc/scextopt.hxx
+++ b/sc/inc/scextopt.hxx
@@ -96,6 +96,13 @@ public:
 
     /** Returns read access to the settings of a sheet, if extant; otherwise 0. */
     const ScExtTabSettings* GetTabSettings( SCTAB nTab ) const;
+
+    /**
+     * @return index of the last sheet that has settings, or -1 if no tab
+     *         settings are present.
+     */
+    SCTAB GetLastTab() const;
+
     /** Returns read/write access to the settings of a sheet, may create a new struct. */
     ScExtTabSettings&   GetOrCreateTabSettings( SCTAB nTab );
 
diff --git a/sc/source/ui/view/scextopt.cxx b/sc/source/ui/view/scextopt.cxx
index 39670ca..0a8031d 100644
--- a/sc/source/ui/view/scextopt.cxx
+++ b/sc/source/ui/view/scextopt.cxx
@@ -68,6 +68,8 @@ public:
     const ScExtTabSettings* GetTabSettings( SCTAB nTab ) const;
     ScExtTabSettings&   GetOrCreateTabSettings( SCTAB nTab );
 
+    SCTAB GetLastTab() const;
+
 private:
     typedef ::boost::shared_ptr< ScExtTabSettings >     ScExtTabSettingsRef;
     typedef ::std::map< SCTAB, ScExtTabSettingsRef >    ScExtTabSettingsMap;
@@ -109,6 +111,11 @@ ScExtTabSettings& ScExtTabSettingsCont::GetOrCreateTabSettings( SCTAB nTab )
     return *rxTabSett;
 }
 
+SCTAB ScExtTabSettingsCont::GetLastTab() const
+{
+    return maMap.empty() ? -1 : maMap.rbegin()->first;
+}
+
 void ScExtTabSettingsCont::CopyFromMap( const ScExtTabSettingsMap& rMap )
 {
     maMap.clear();
@@ -183,6 +190,11 @@ const ScExtTabSettings* ScExtDocOptions::GetTabSettings( SCTAB nTab ) const
     return mxImpl->maTabSett.GetTabSettings( nTab );
 }
 
+SCTAB ScExtDocOptions::GetLastTab() const
+{
+    return mxImpl->maTabSett.GetLastTab();
+}
+
 ScExtTabSettings& ScExtDocOptions::GetOrCreateTabSettings( SCTAB nTab )
 {
     return mxImpl->maTabSett.GetOrCreateTabSettings( nTab );
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 2bfc181..67ce9aa 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -2468,6 +2468,10 @@ void ScViewData::ReadExtOptions( const ScExtDocOptions& rDocOpt )
     pView->SetPendingRelTabBarWidth( rDocSett.mfTabBarWidth );
 
     // sheet settings
+    SCTAB nLastTab = rDocOpt.GetLastTab();
+    if (static_cast<SCTAB>(maTabData.size()) <= nLastTab)
+        maTabData.resize(nLastTab+1);
+
     for( SCTAB nTab = 0; nTab < static_cast<SCTAB>(maTabData.size()); ++nTab )
     {
         if( const ScExtTabSettings* pTabSett = rDocOpt.GetTabSettings( nTab ) )


More information about the Libreoffice-commits mailing list