diff options
author | Noel Power <noel.power@suse.com> | 2013-07-29 10:00:15 +0100 |
---|---|---|
committer | Petr Mladek <pmladek@suse.cz> | 2013-07-30 10:25:06 +0000 |
commit | f5073172ace5722ad1bc9ee59d39e84077bf9846 (patch) | |
tree | 5b4cd99bc8ec4d18cd61c20b377f806658504e68 | |
parent | 9957058b1cf9460df23d03d90e2276c33ea33cdc (diff) |
fix for fdo#62729 reference pos can point to non existing table
there is an existing function ( called at least from uno names api also )
that updates the tab pos, calling that seems to fix this problem
(cherry picked from commit b5fffdb8d0438a2fe933a5742d41fe50a14b71f3)
with squash of
unit test for fdo#62729 ( with tweak for 4.0 )
(cherry picked from commit 7b3d8e0a7dcf6ae05e1de5c33ed382822cf52cce)
b9be75459aa49b8bab968dedae9e0760ccef9a26
Reviewed-on: https://gerrit.libreoffice.org/5124
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit cb626d01772985bd0eed0f5963475d0e801379c8)
Conflicts:
sc/source/filter/xml/xmlexprt.cxx
Change-Id: I6f6f31895eda9c338eeabd3f3285bf2c9eb23b7e
Reviewed-on: https://gerrit.libreoffice.org/5164
Reviewed-by: Petr Mladek <pmladek@suse.cz>
Tested-by: Petr Mladek <pmladek@suse.cz>
-rw-r--r-- | sc/qa/unit/data/ods/fdo62729.ods | bin | 0 -> 6772 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 30 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlexprt.cxx | 1 |
3 files changed, 31 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/fdo62729.ods b/sc/qa/unit/data/ods/fdo62729.ods Binary files differnew file mode 100644 index 000000000000..00b50798f6bc --- /dev/null +++ b/sc/qa/unit/data/ods/fdo62729.ods diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 844020d71461..fe7e9636c06c 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -78,6 +78,7 @@ public: void testPasswordExport(); void testConditionalFormatExportXLSX(); void testMiscRowHeightExport(); + void testNamedRangeBugfdo62729(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -86,6 +87,7 @@ public: #endif CPPUNIT_TEST(testConditionalFormatExportXLSX); CPPUNIT_TEST(testMiscRowHeightExport); + CPPUNIT_TEST(testNamedRangeBugfdo62729); CPPUNIT_TEST_SUITE_END(); private: @@ -371,6 +373,34 @@ void ScExportTest::testMiscRowHeightExport() } } + +void ScExportTest::testNamedRangeBugfdo62729() +{ + ScDocShellRef xShell = loadDocument("fdo62729.", ODS); + CPPUNIT_ASSERT(xShell.Is()); + ScDocument* pDoc = xShell->GetDocument(); + CPPUNIT_ASSERT(pDoc); + + ScRangeName* pNames = pDoc->GetRangeName(); + //should be just a single named range + CPPUNIT_ASSERT(pNames->size() == 1 ); + pDoc->DeleteTab(0); + //should be still a single named range + CPPUNIT_ASSERT(pNames->size() == 1 ); + ScDocShellRef xDocSh = saveAndReload(xShell, ODS); + xShell->DoClose(); + + CPPUNIT_ASSERT(xDocSh.Is()); + pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + + pNames = pDoc->GetRangeName(); + //after reload should still have a named range + CPPUNIT_ASSERT(pNames->size() == 1 ); + + xDocSh->DoClose(); +} + ScExportTest::ScExportTest() : m_aBaseString(RTL_CONSTASCII_USTRINGPARAM("/sc/qa/unit/data")) { diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 3882e2f2baa9..b5159f3e9ae9 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -3733,6 +3733,7 @@ void ScXMLExport::WriteNamedRange(ScRangeName* pRangeName) AddAttribute(sAttrName, it->second->GetName()); rtl::OUString sBaseCellAddress; + it->second->ValidateTabRefs(); ScRangeStringConverter::GetStringFromAddress( sBaseCellAddress, it->second->GetPos(), pDoc, FormulaGrammar::CONV_OOO, ' ', false, SCA_ABS_3D); AddAttribute(XML_NAMESPACE_TABLE, XML_BASE_CELL_ADDRESS, sBaseCellAddress); |