[Libreoffice-commits] .: Branch 'feature/unlimited-number-of-sheets' - 2 commits - sc/source

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Mon May 30 12:55:33 PDT 2011


 sc/source/core/data/document.cxx |    5 ++++-
 sc/source/ui/docshell/docsh.cxx  |    9 +++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 92ca4e867935c935935208f597c0ebc1cda8a894
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon May 30 20:38:52 2011 +0200

    fix segv when inserting multiple sheets

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index c52c69c..f6f197b 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -523,7 +523,8 @@ bool ScDocument::InsertTabs( SCTAB nPos, const std::vector<rtl::OUString>& rName
                 for (; it != pTab.end(); ++it)
                     if ( *it )
                         (*it)->UpdateInsertTab(nPos, nNewSheets);
-                pTab.resize(nTabCount + nNewSheets, NULL);
+                it = pTab.begin();
+                pTab.insert(it+nPos,nNewSheets, NULL);
                 for (SCTAB i = 0; i < nNewSheets; ++i)
                 {
                     pTab[nPos + i] = new ScTable(this, nPos + i, rNames.at(i));
@@ -536,8 +537,10 @@ bool ScDocument::InsertTabs( SCTAB nPos, const std::vector<rtl::OUString>& rName
                 UpdateBroadcastAreas( URM_INSDEL, aRange, 0,0,nNewSheets);
                 it = pTab.begin();
                 for (; it != pTab.end(); ++it)
+                {
                     if ( *it )
                         (*it)->UpdateCompile();
+                }
                 it = pTab.begin();
                 for (; it != pTab.end(); ++it)
                     if ( *it )
commit 2579dc3be9ab0f2d502f30551629510d17ceb2ae
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun May 29 20:22:30 2011 +0200

    notify vba correctly about inserting of several worksheets

diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 5a23b08..7671d55 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -542,6 +542,15 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
                 aArgs[0] <<= rScHint.GetTab1();
                 xVbaEvents->processVbaEvent( WORKBOOK_NEWSHEET, aArgs );
             }
+            else if (rScHint.GetId() == SC_TABS_INSERTED)
+            {
+                for (SCTAB i = 0; i < rScHint.GetTab2(); ++i)
+                {
+                    uno::Sequence< uno::Any > aArgs( 1 );
+                    aArgs[0] <<= rScHint.GetTab1() + i;
+                    xVbaEvents->processVbaEvent( WORKBOOK_NEWSHEET, aArgs );
+                }
+            }
         }
         else if ( rHint.ISA( SfxEventHint ) )
         {


More information about the Libreoffice-commits mailing list