sc/inc/document.hxx                            |    2 ++
 sc/source/core/data/dociter.cxx                |    4 ++--
 sc/source/core/data/documen3.cxx               |    5 +++++
 sc/source/core/data/document10.cxx             |    9 +++++++++
 sc/source/filter/xml/XMLStylesExportHelper.cxx |    1 +
 5 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit ac9aa53d51a4f359342274d107aed6df85658c55
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Apr 17 21:40:28 2019 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Apr 18 08:49:41 2019 +0200

    crashtesting: failure on import of ooo6593-5.stc
    
    since
        commit 7282014e362a1529a36c88eb308df8ed359c2cfa
        Date:   Fri Feb 1 15:15:16 2019 +0100
        tdf#50916 Makes numbers of columns dynamic
    
    Change-Id: I858e61b3a1158bf47b5855e56d63c77cc87aa09b
    Reviewed-on: https://gerrit.libreoffice.org/70902
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 48dbe6c04e69..cdeab88fdfcb 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -787,6 +787,7 @@ public:
     ScRangePairListRef& GetRowNameRangesRef() { return xRowNameRanges; }
 
     SC_DLLPUBLIC SCCOL ClampToAllocatedColumns(SCTAB nTab, SCCOL nCol) const;
+    SC_DLLPUBLIC SCCOL GetAllocatedColumnsCount(SCTAB nTab) const;
 
     SC_DLLPUBLIC ScDBCollection* GetDBCollection() const { return 
pDBCollection.get();}
     void                         SetDBCollection( 
std::unique_ptr<ScDBCollection> pNewDBCollection,
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 8458e2895684..ec81363846f2 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -829,7 +829,6 @@ ScCellIterator::ScCellIterator( ScDocument* pDoc, const 
ScRange& rRange, Subtota
     maEndPos(rRange.aEnd),
     mnSubTotalFlags(nSubTotalFlags)
 {
-    maEndPos.SetCol( pDoc->ClampToAllocatedColumns(maStartPos.Tab(), 
maEndPos.Col()) );
     init();
 }
 
@@ -914,7 +913,8 @@ bool ScCellIterator::getCurrent()
             do
             {
                 maCurPos.IncCol();
-                if (maCurPos.Col() > maEndPos.Col())
+                if (maCurPos.Col() >= 
mpDoc->GetAllocatedColumnsCount(maCurPos.Tab())
+                    || maCurPos.Col() > maEndPos.Col())
                 {
                     maCurPos.SetCol(maStartPos.Col());
                     maCurPos.IncTab();
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 75f1cdab071a..0bcf1aa37580 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -2103,4 +2103,9 @@ SCCOL ScDocument::ClampToAllocatedColumns(SCTAB nTab, 
SCCOL nCol) const
     return maTabs[nTab]->ClampToAllocatedColumns(nCol);
 }
 
+SCCOL ScDocument::GetAllocatedColumnsCount(SCTAB nTab) const
+{
+    return maTabs[nTab]->GetAllocatedColumnsCount();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 3df2e918408535acd2c4d028bfae70901ad24e62
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Apr 17 21:03:26 2019 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Apr 18 08:49:32 2019 +0200

    crashtesting: failure on export of ooo118068-1.ods  to ods
    
    since
        commit 7282014e362a1529a36c88eb308df8ed359c2cfa
        Date:   Fri Feb 1 15:15:16 2019 +0100
        tdf#50916 Makes numbers of columns dynamic
    
    Change-Id: Ib8dc06b80beed81a2543f343483599c425e87369
    Reviewed-on: https://gerrit.libreoffice.org/70901
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index bd6db82a7d00..48dbe6c04e69 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2454,6 +2454,7 @@ public:
     void                    DeleteBroadcasters( sc::ColumnBlockPosition& 
rBlockPos, const ScAddress& rTopPos, SCROW nLength );
 
     std::unique_ptr<sc::ColumnIterator> GetColumnIterator( SCTAB nTab, SCCOL 
nCol, SCROW nRow1, SCROW nRow2 ) const;
+    void CreateColumnIfNotExists( SCTAB nTab, SCCOL nCol );
 
     SC_DLLPUBLIC void StoreTabToCache(SCTAB nTab, SvStream& rStrm) const;
     SC_DLLPUBLIC void RestoreTabFromCache(SCTAB nTab, SvStream& rStream);
diff --git a/sc/source/core/data/document10.cxx 
b/sc/source/core/data/document10.cxx
index c286ecba4c98..429fc33074fb 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -916,6 +916,15 @@ std::unique_ptr<sc::ColumnIterator> 
ScDocument::GetColumnIterator( SCTAB nTab, S
     return pTab->GetColumnIterator(nCol, nRow1, nRow2);
 }
 
+void ScDocument::CreateColumnIfNotExists( SCTAB nTab, SCCOL nCol )
+{
+    const ScTable* pTab = FetchTable(nTab);
+    if (!pTab)
+        return;
+
+    pTab->CreateColumnIfNotExists(nCol);
+}
+
 bool ScDocument::EnsureFormulaCellResults( const ScRange& rRange, bool 
bSkipRunning )
 {
     bool bAnyDirty = false;
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx 
b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index 6b2fb2e4a2a4..9cc648340a3c 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -455,6 +455,7 @@ void ScMyDefaultStyles::FillDefaultStyles(const sal_Int32 
nTable,
         return ;
 
     SCTAB nTab = static_cast<SCTAB>(nTable);
+    pDoc->CreateColumnIfNotExists(nTab, nLastCol);
     sal_Int32 nPos;
     ScMyDefaultStyleList* pDefaults = &maColDefaults;
     bool bPrevAutoStyle(false);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to