tdf#128895 sc xmlimport: create enough dynamic cols if props

Since LO 6.3, only 64 columns are created by default,
where previously it was a fixed 1024.

A common user practice is to hide all columns not used,
but this collapsed property was lost because
only part of the columns were actually created and thus exported.

In this example, import specifies 1017 hidden columns (H-AMJ),
but since only 64 columns are created, export only specified 57.

So ensure that on import, any column with defined properties
is created - even if they don't contain any content.

Change-Id: If928880baf5585613715a1f4361a9059584d1ad2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126540
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
(cherry picked from commit 297ab561c6754f89326a1e8ce1751233669578d7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126668
diff --git a/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods b/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods
new file mode 100644
index 0000000..fa01636
--- /dev/null
+++ b/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx
index 8fbe40a..32f9454 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -143,6 +143,7 @@ public:
#endif
    void testOutlineExportXLSX();
    void testHiddenEmptyRowsXLSX();
    void testHiddenEmptyColsODS();
    void testAllRowsHiddenXLSX();
    void testLandscapeOrientationXLSX();

@@ -259,6 +260,7 @@ public:
#endif
    CPPUNIT_TEST(testOutlineExportXLSX);
    CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
    CPPUNIT_TEST(testHiddenEmptyColsODS);
    CPPUNIT_TEST(testAllRowsHiddenXLSX);
    CPPUNIT_TEST(testLandscapeOrientationXLSX);
    CPPUNIT_TEST(testInlineArrayXLS);
@@ -1525,6 +1527,22 @@ void ScExportTest::testHiddenEmptyRowsXLSX()
    xShell->DoClose();
}

void ScExportTest::testHiddenEmptyColsODS()
{
    //tdf#98106 FILESAVE: Hidden and empty rows became visible when export to .XLSX
    ScDocShellRef xShell = loadDoc(u"tdf128895_emptyHiddenCols.", FORMAT_ODS);
    CPPUNIT_ASSERT(xShell.is());

    std::shared_ptr<utl::TempFile> pXPathFile
        = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS);
    xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml");
    CPPUNIT_ASSERT(pSheet);
    assertXPath(pSheet, "//table:table/table:table-column[2]");
    assertXPath(pSheet, "//table:table/table:table-column[2]", "number-columns-repeated", "1017");

    xShell->DoClose();
}

void ScExportTest::testLandscapeOrientationXLSX()
{
    //tdf#48767 - Landscape page orientation is not loaded from .xlsx format with MS Excel, after export with Libre Office
diff --git a/sc/source/filter/xml/xmlcoli.cxx b/sc/source/filter/xml/xmlcoli.cxx
index 09224bb..fc40a6f 100644
--- a/sc/source/filter/xml/xmlcoli.cxx
+++ b/sc/source/filter/xml/xmlcoli.cxx
@@ -93,6 +93,7 @@ void SAL_CALL ScXMLTableColContext::endFastElement( sal_Int32 /*nElement*/ )
            nLastColumn = pDoc->MaxCol();
        if (nCurrentColumn > pDoc->MaxCol())
            nCurrentColumn = pDoc->MaxCol();
        pDoc->CreateColumnIfNotExists(nSheet, nLastColumn);
        uno::Reference<table::XColumnRowRange> xColumnRowRange (xSheet->getCellRangeByPosition(nCurrentColumn, 0, nLastColumn, 0), uno::UNO_QUERY);
        if (xColumnRowRange.is())
        {