[Libreoffice-commits] core.git: sc/CppunitTest_sc_subsequent_export-test2.mk sc/CppunitTest_sc_subsequent_export-test.mk sc/CppunitTest_sc_subsequent_export_test.mk sc/CppunitTest_sc_subsequent_filters-test2.mk sc/CppunitTest_sc_subsequent_filters-test.mk sc/CppunitTest_sc_subsequent_filters_test.mk sc/Module_sc.mk sc/qa sc/subsequent_setup.mk
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jun 3 09:50:31 UTC 2021
sc/CppunitTest_sc_subsequent_export-test.mk | 12
sc/CppunitTest_sc_subsequent_export-test2.mk | 12
sc/CppunitTest_sc_subsequent_filters-test.mk | 12
sc/CppunitTest_sc_subsequent_filters-test2.mk | 12
sc/CppunitTest_sc_subsequent_filters_test.mk | 137 -
sc/Module_sc.mk | 7
sc/qa/unit/subsequent_export-test.cxx | 1974 -----------------
sc/qa/unit/subsequent_export-test2.cxx | 2301 ++++++++++++++++++++
sc/qa/unit/subsequent_filters-test.cxx | 2803 -------------------------
sc/qa/unit/subsequent_filters-test2.cxx | 2882 ++++++++++++++++++++++++++
sc/subsequent_setup.mk | 40
11 files changed, 5287 insertions(+), 4905 deletions(-)
New commits:
commit d09ba873adb58ca76b02fe852b31b6a8ca9591a4
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Jun 2 21:28:56 2021 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Jun 3 11:49:42 2021 +0200
sc: split subsequent modules into smaller parts
Change-Id: Iee175a064714fa1c7b40c1c450c2fffb59f4fd7c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116625
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sc/CppunitTest_sc_subsequent_export-test.mk b/sc/CppunitTest_sc_subsequent_export-test.mk
new file mode 100644
index 000000000000..1ca3ac158292
--- /dev/null
+++ b/sc/CppunitTest_sc_subsequent_export-test.mk
@@ -0,0 +1,12 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call sc_subsequent_test,export-test))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/CppunitTest_sc_subsequent_export-test2.mk b/sc/CppunitTest_sc_subsequent_export-test2.mk
new file mode 100644
index 000000000000..061b22299467
--- /dev/null
+++ b/sc/CppunitTest_sc_subsequent_export-test2.mk
@@ -0,0 +1,12 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call sc_subsequent_test,export-test2))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/CppunitTest_sc_subsequent_filters-test.mk b/sc/CppunitTest_sc_subsequent_filters-test.mk
new file mode 100644
index 000000000000..aab51ef0f6c5
--- /dev/null
+++ b/sc/CppunitTest_sc_subsequent_filters-test.mk
@@ -0,0 +1,12 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call sc_subsequent_test,filters-test))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/CppunitTest_sc_subsequent_filters-test2.mk b/sc/CppunitTest_sc_subsequent_filters-test2.mk
new file mode 100644
index 000000000000..94bf7d8da7d6
--- /dev/null
+++ b/sc/CppunitTest_sc_subsequent_filters-test2.mk
@@ -0,0 +1,12 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call sc_subsequent_test,filters-test2))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/CppunitTest_sc_subsequent_filters_test.mk b/sc/CppunitTest_sc_subsequent_filters_test.mk
deleted file mode 100644
index a3040d0747cc..000000000000
--- a/sc/CppunitTest_sc_subsequent_filters_test.mk
+++ /dev/null
@@ -1,137 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-$(eval $(call gb_CppunitTest_CppunitTest,sc_subsequent_filters_test))
-
-$(eval $(call gb_CppunitTest_use_common_precompiled_header,sc_subsequent_filters_test))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,sc_subsequent_filters_test, \
- sc/qa/unit/subsequent_filters-test \
-))
-
-$(eval $(call gb_CppunitTest_use_externals,sc_subsequent_filters_test, \
- boost_headers \
- mdds_headers \
- libxml2 \
-))
-
-$(eval $(call gb_CppunitTest_use_libraries,sc_subsequent_filters_test, \
- basegfx \
- comphelper \
- cppu \
- cppuhelper \
- drawinglayer \
- editeng \
- for \
- forui \
- i18nlangtag \
- msfilter \
- oox \
- sal \
- salhelper \
- sax \
- sb \
- sc \
- scqahelper \
- sfx \
- sot \
- subsequenttest \
- svl \
- svt \
- svx \
- svxcore \
- test \
- tk \
- tl \
- ucbhelper \
- unotest \
- utl \
- vbahelper \
- vcl \
- xo \
-))
-
-$(eval $(call gb_CppunitTest_set_include,sc_subsequent_filters_test,\
- -I$(SRCDIR)/sc/source/ui/inc \
- -I$(SRCDIR)/sc/inc \
- -I$(SRCDIR)/sc/source/filter/inc \
- $$(INCLUDE) \
-))
-
-$(eval $(call gb_CppunitTest_use_api,sc_subsequent_filters_test,\
- udkapi \
- offapi \
- oovbaapi \
-))
-
-$(eval $(call gb_CppunitTest_use_ure,sc_subsequent_filters_test))
-$(eval $(call gb_CppunitTest_use_vcl,sc_subsequent_filters_test))
-
-$(eval $(call gb_CppunitTest_use_components,sc_subsequent_filters_test,\
- basic/util/sb \
- basctl/util/basctl \
- chart2/source/chartcore \
- chart2/source/controller/chartcontroller \
- comphelper/util/comphelp \
- configmgr/source/configmgr \
- dbaccess/util/dba \
- embeddedobj/util/embobj \
- emfio/emfio \
- eventattacher/source/evtatt \
- filter/source/config/cache/filterconfig1 \
- forms/util/frm \
- framework/util/fwk \
- i18npool/source/search/i18nsearch \
- i18npool/util/i18npool \
- linguistic/source/lng \
- oox/util/oox \
- package/source/xstor/xstor \
- package/util/package2 \
- sax/source/expatwrap/expwrap \
- scaddins/source/analysis/analysis \
- scaddins/source/datefunc/date \
- sc/util/sc \
- sc/util/scfilt \
- sc/util/vbaobj \
- sfx2/util/sfx \
- sot/util/sot \
- svl/util/svl \
- svl/source/fsstor/fsstorage \
- svtools/util/svt \
- toolkit/util/tk \
- ucb/source/core/ucb1 \
- ucb/source/ucp/file/ucpfile1 \
- ucb/source/ucp/tdoc/ucptdoc1 \
- unotools/util/utl \
- unoxml/source/rdf/unordf \
- unoxml/source/service/unoxml \
- uui/util/uui \
- vcl/vcl.common \
- xmloff/util/xo \
- xmlsecurity/util/xmlsecurity \
-))
-
-$(eval $(call gb_CppunitTest_use_components,sc_subsequent_filters_test,\
- xmlsecurity/util/xsec_xmlsec \
-))
-
-$(eval $(call gb_CppunitTest_use_externals,sc_subsequent_filters_test,\
- orcus \
- orcus-parser \
- boost_filesystem \
- boost_system \
- boost_iostreams \
- zlib \
-))
-
-$(eval $(call gb_CppunitTest_use_configuration,sc_subsequent_filters_test))
-
-$(eval $(call gb_CppunitTest_use_more_fonts,sc_subsequent_filters_test))
-
-# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 1d31df9b44fa..a75da398136f 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -10,6 +10,7 @@
include $(SRCDIR)/sc/common_unoapi_tests.mk
include $(SRCDIR)/sc/ucalc_setup.mk
+include $(SRCDIR)/sc/subsequent_setup.mk
$(eval $(call gb_Module_Module,sc))
@@ -75,8 +76,10 @@ $(eval $(call gb_Module_add_slowcheck_targets,sc, \
CppunitTest_sc_new_cond_format_api \
CppunitTest_sc_pdf_export \
CppunitTest_sc_pivottable_filters_test \
- CppunitTest_sc_subsequent_filters_test \
- CppunitTest_sc_subsequent_export_test \
+ CppunitTest_sc_subsequent_filters-test \
+ CppunitTest_sc_subsequent_filters-test2 \
+ CppunitTest_sc_subsequent_export-test \
+ CppunitTest_sc_subsequent_export-test2 \
CppunitTest_sc_uicalc \
))
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 439143d0153d..adbf755bb462 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -202,101 +202,8 @@ public:
void testShapeAutofitXLSX();
void testHyperlinkXLSX();
void testMoveCellAnchoredShapesODS();
- void testMatrixMultiplicationXLSX();
void testPreserveTextWhitespaceXLSX();
void testPreserveTextWhitespace2XLSX();
- void testTextDirectionXLSX();
- void testTdf120168();
- void testTdf66668();
- void testTdf130108();
- void testTdf76949();
- void testTdf107586();
- void testTdf55417();
- void testTdf129985();
- void testTdf73063();
-
- xmlDocUniquePtr testTdf95640(std::u16string_view rFileName, sal_Int32 nSourceFormat,
- sal_Int32 nDestFormat);
- void testTdf95640_ods_to_xlsx();
- void testTdf95640_ods_to_xlsx_with_standard_list();
- void testTdf95640_xlsx_to_xlsx();
- void testDateAutofilterXLSX();
- void testDateAutofilterODS();
- void testAutofilterColorsODF();
- void testAutofilterColorsOOXML();
- void testAutofilterColorsStyleOOXML();
-
- void testRefStringXLSX();
- void testRefStringConfigXLSX();
- void testRefStringUnspecified();
- void testHeaderImageODS();
-
- void testTdf88657ODS();
- void testTdf41722();
- void testTdf113621();
- void testEscapeCharInNumberFormatXLSX();
- void testNatNumInNumberFormatXLSX();
- void testExponentWithoutSignFormatXLSX();
- void testExtendedLCIDXLSX();
-
- void testHiddenRepeatedRowsODS();
- void testHyperlinkTargetFrameODS();
- void testOpenDocumentAsReadOnly();
- void testKeepSettingsOfBlankRows();
-
- void testTdf133595();
- void testTdf134769();
- void testTdf106181();
- void testTdf105272();
- void testTdf118990();
- void testTdf121612();
- void testTdf112936();
- void testPivotCacheAfterExportXLSX();
- void testTdf114969XLSX();
- void testTdf115192XLSX();
- void testTdf91634XLSX();
- void testTdf115159();
- void testTdf112567();
- void testTdf112567b();
- void testTdf123645XLSX();
- void testTdf125173XLSX();
- void testTdf79972XLSX();
- void testTdf126024XLSX();
- void testTdf126177XLSX();
- void testCommentTextVAlignment();
- void testCommentTextHAlignment();
- void testValidationCopyPaste();
-
- void testXltxExport();
- void testRotatedImageODS();
- void testTdf128976();
- void testTdf120502();
- void testTdf131372();
- void testTdf81470();
- void testTdf122331();
- void testTdf83779();
- void testTdf121716_ExportEvenHeaderFooterXLSX();
- void testTdf134459_HeaderFooterColorXLSX();
- void testTdf134817_HeaderFooterTextWith2SectionXLSX();
- void testTdf121718_UseFirstPageNumberXLSX();
- void testHeaderFontStyleXLSX();
- void testTdf135828_Shape_Rect();
- void testTdf123353();
- void testTdf140098();
- void testTdf133688_precedents();
- void testTdf91251_missingOverflowRoundtrip();
- void testTdf137000_handle_upright();
- void testTdf126305_DataValidatyErrorAlert();
- void testTdf76047_externalLink();
- void testTdf87973_externalLinkSkipUnuseds();
- void testTdf51022_lostPrintRange();
- void testTdf138741_externalLinkSkipUnusedsCrash();
- void testTdf138824_linkToParentDirectory();
- void testTdf129969();
- void testTdf84874();
- void testTdf136721_paper_size();
- void testTdf139258_rotated_image();
- void testTdf126541_SheetVisibilityImportXlsx();
void testTdf113646();
CPPUNIT_TEST_SUITE(ScExportTest);
@@ -400,106 +307,13 @@ public:
CPPUNIT_TEST(testShapeAutofitXLSX);
CPPUNIT_TEST(testHyperlinkXLSX);
CPPUNIT_TEST(testMoveCellAnchoredShapesODS);
- CPPUNIT_TEST(testMatrixMultiplicationXLSX);
- CPPUNIT_TEST(testTextDirectionXLSX);
- CPPUNIT_TEST(testTdf120168);
- CPPUNIT_TEST(testTdf66668);
- CPPUNIT_TEST(testTdf130108);
- CPPUNIT_TEST(testTdf76949);
- CPPUNIT_TEST(testTdf107586);
- CPPUNIT_TEST(testTdf55417);
- CPPUNIT_TEST(testTdf129985);
- CPPUNIT_TEST(testTdf73063);
- CPPUNIT_TEST(testTdf95640_ods_to_xlsx);
- CPPUNIT_TEST(testTdf95640_ods_to_xlsx_with_standard_list);
- CPPUNIT_TEST(testTdf95640_xlsx_to_xlsx);
- CPPUNIT_TEST(testDateAutofilterXLSX);
- CPPUNIT_TEST(testDateAutofilterODS);
- CPPUNIT_TEST(testAutofilterColorsODF);
- CPPUNIT_TEST(testAutofilterColorsOOXML);
- CPPUNIT_TEST(testAutofilterColorsStyleOOXML);
-
- CPPUNIT_TEST(testRefStringXLSX);
- CPPUNIT_TEST(testRefStringConfigXLSX);
- CPPUNIT_TEST(testRefStringUnspecified);
- CPPUNIT_TEST(testHeaderImageODS);
-
- CPPUNIT_TEST(testTdf88657ODS);
- CPPUNIT_TEST(testTdf41722);
- CPPUNIT_TEST(testTdf113621);
- CPPUNIT_TEST(testEscapeCharInNumberFormatXLSX);
- CPPUNIT_TEST(testNatNumInNumberFormatXLSX);
- CPPUNIT_TEST(testExponentWithoutSignFormatXLSX);
- CPPUNIT_TEST(testExtendedLCIDXLSX);
-
- CPPUNIT_TEST(testHiddenRepeatedRowsODS);
- CPPUNIT_TEST(testHyperlinkTargetFrameODS);
- CPPUNIT_TEST(testOpenDocumentAsReadOnly);
- CPPUNIT_TEST(testKeepSettingsOfBlankRows);
-
- CPPUNIT_TEST(testTdf133595);
- CPPUNIT_TEST(testTdf134769);
- CPPUNIT_TEST(testTdf106181);
- CPPUNIT_TEST(testTdf105272);
- CPPUNIT_TEST(testTdf118990);
- CPPUNIT_TEST(testTdf121612);
- CPPUNIT_TEST(testTdf112936);
- CPPUNIT_TEST(testPivotCacheAfterExportXLSX);
- CPPUNIT_TEST(testTdf114969XLSX);
- CPPUNIT_TEST(testTdf115192XLSX);
- CPPUNIT_TEST(testTdf91634XLSX);
- CPPUNIT_TEST(testTdf115159);
- CPPUNIT_TEST(testTdf112567);
- CPPUNIT_TEST(testTdf112567b);
- CPPUNIT_TEST(testTdf123645XLSX);
- CPPUNIT_TEST(testTdf125173XLSX);
- CPPUNIT_TEST(testTdf79972XLSX);
- CPPUNIT_TEST(testTdf126024XLSX);
- CPPUNIT_TEST(testTdf126177XLSX);
- CPPUNIT_TEST(testCommentTextVAlignment);
- CPPUNIT_TEST(testCommentTextHAlignment);
- CPPUNIT_TEST(testValidationCopyPaste);
-
- CPPUNIT_TEST(testXltxExport);
- CPPUNIT_TEST(testRotatedImageODS);
- CPPUNIT_TEST(testTdf128976);
- CPPUNIT_TEST(testTdf120502);
- CPPUNIT_TEST(testTdf131372);
- CPPUNIT_TEST(testTdf81470);
- CPPUNIT_TEST(testTdf122331);
- CPPUNIT_TEST(testTdf83779);
- CPPUNIT_TEST(testTdf121716_ExportEvenHeaderFooterXLSX);
- CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX);
- CPPUNIT_TEST(testTdf134817_HeaderFooterTextWith2SectionXLSX);
- CPPUNIT_TEST(testTdf121718_UseFirstPageNumberXLSX);
- CPPUNIT_TEST(testHeaderFontStyleXLSX);
- CPPUNIT_TEST(testTdf135828_Shape_Rect);
- CPPUNIT_TEST(testTdf123353);
- CPPUNIT_TEST(testTdf140098);
- CPPUNIT_TEST(testTdf133688_precedents);
- CPPUNIT_TEST(testTdf91251_missingOverflowRoundtrip);
- CPPUNIT_TEST(testTdf137000_handle_upright);
- CPPUNIT_TEST(testTdf126305_DataValidatyErrorAlert);
- CPPUNIT_TEST(testTdf76047_externalLink);
- CPPUNIT_TEST(testTdf87973_externalLinkSkipUnuseds);
- CPPUNIT_TEST(testTdf51022_lostPrintRange);
- CPPUNIT_TEST(testTdf138741_externalLinkSkipUnusedsCrash);
- CPPUNIT_TEST(testTdf138824_linkToParentDirectory);
- CPPUNIT_TEST(testTdf129969);
- CPPUNIT_TEST(testTdf84874);
- CPPUNIT_TEST(testTdf136721_paper_size);
- CPPUNIT_TEST(testTdf139258_rotated_image);
- CPPUNIT_TEST(testTdf126541_SheetVisibilityImportXlsx);
CPPUNIT_TEST(testTdf113646);
CPPUNIT_TEST_SUITE_END();
private:
-
- ScDocShellRef loadDocAndSetupModelViewController(std::u16string_view rFileName, sal_Int32 nFormat, bool bReadWrite);
void testExcelCellBorders( sal_uLong nFormatType );
uno::Reference<uno::XInterface> m_xCalcComponent;
-
};
void ScExportTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx)
@@ -4319,412 +4133,13 @@ void ScExportTest::testMoveCellAnchoredShapesODS()
xDocSh2->DoClose();
}
-void ScExportTest::testMatrixMultiplicationXLSX()
-{
- ScDocShellRef xShell = loadDoc(u"matrix-multiplication.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xShell.is());
-
- ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- OUString CellFormulaRange = getXPath(pDoc,
- "/x:worksheet/x:sheetData/x:row[4]/x:c/x:f","ref");
-
- // make sure that the CellFormulaRange is G5:G6.
- CPPUNIT_ASSERT_EQUAL(OUString("G5:G6"), CellFormulaRange);
-
- OUString CellFormulaType = getXPath(pDoc,
- "/x:worksheet/x:sheetData/x:row[4]/x:c/x:f","t");
-
- // make sure that the CellFormulaType is array.
- CPPUNIT_ASSERT_EQUAL(OUString("array"), CellFormulaType);
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testRefStringXLSX()
-{
- ScDocShellRef xDocSh = loadDoc(u"ref_string.", FORMAT_XLSX);
- CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is());
-
- //make sure ref syntax gets saved for MSO-produced docs
- xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX);
- CPPUNIT_ASSERT_MESSAGE("Failed to reload doc", xDocSh.is());
-
- ScDocument& rDoc = xDocSh->GetDocument();
- ScCalcConfig aCalcConfig = rDoc.GetCalcConfig();
- CPPUNIT_ASSERT_EQUAL(formula::FormulaGrammar::CONV_XL_A1, aCalcConfig.meStringRefAddressSyntax);
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testRefStringConfigXLSX()
-{
- // this doc is configured with CalcA1 ref syntax
- ScDocShellRef xDocSh = loadDoc(u"empty.", FORMAT_XLSX);
- CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is());
-
- xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX);
- CPPUNIT_ASSERT_MESSAGE("Failed to reload doc", xDocSh.is());
-
- ScDocument& rDoc = xDocSh->GetDocument();
- ScCalcConfig aConfig = rDoc.GetCalcConfig();
- CPPUNIT_ASSERT_EQUAL_MESSAGE("String ref syntax doesn't match", formula::FormulaGrammar::CONV_OOO,
- aConfig.meStringRefAddressSyntax);
-
- xDocSh->DoClose();
-
- // this doc has no entry for ref syntax
- xDocSh = loadDoc(u"empty-noconf.", FORMAT_XLSX);
- CPPUNIT_ASSERT_MESSAGE("Failed to open 2nd doc", xDocSh.is());
-
- ScDocument& rDoc2 = xDocSh->GetDocument();
- aConfig = rDoc2.GetCalcConfig();
- // therefore after import, ref syntax should be set to CalcA1 | ExcelA1
- CPPUNIT_ASSERT_EQUAL_MESSAGE("String ref syntax doesn't match", formula::FormulaGrammar::CONV_A1_XL_A1,
- aConfig.meStringRefAddressSyntax);
-
- //set ref syntax to something else than ExcelA1 (native to xlsx format) ...
- aConfig.meStringRefAddressSyntax = formula::FormulaGrammar::CONV_XL_R1C1;
- rDoc2.SetCalcConfig( aConfig );
-
- ScDocShellRef xNewDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX);
- CPPUNIT_ASSERT_MESSAGE("Failed to reload 2nd doc", xNewDocSh.is());
-
- // ... and make sure it got saved
- ScDocument& rDoc3 = xNewDocSh->GetDocument();
- aConfig = rDoc3.GetCalcConfig();
- CPPUNIT_ASSERT_EQUAL_MESSAGE("String ref syntax doesn't match", formula::FormulaGrammar::CONV_XL_R1C1,
- aConfig.meStringRefAddressSyntax);
-
- xDocSh->DoClose();
- xNewDocSh->DoClose();
-}
-
-void ScExportTest::testRefStringUnspecified()
-{
- ScDocShell* pShell = new ScDocShell(
- SfxModelFlags::EMBEDDED_OBJECT |
- SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS |
- SfxModelFlags::DISABLE_DOCUMENT_RECOVERY);
- pShell->DoInitNew();
-
- ScDocument& rDoc = pShell->GetDocument();
- ScCalcConfig aConfig = rDoc.GetCalcConfig();
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Default string ref syntax value doesn't match", formula::FormulaGrammar::CONV_UNSPECIFIED,
- aConfig.meStringRefAddressSyntax);
-
- // change formula syntax (i.e. not string ref syntax) to ExcelA1
- rDoc.SetGrammar( formula::FormulaGrammar::GRAM_NATIVE_XL_A1 );
-
- ScDocShellRef xDocSh = saveAndReload(pShell, FORMAT_ODS);
- CPPUNIT_ASSERT_MESSAGE("Failed to reload doc", xDocSh.is());
-
- // with string ref syntax at its default value, we should've saved ExcelA1
- ScDocument& rDoc2 = xDocSh->GetDocument();
- aConfig = rDoc2.GetCalcConfig();
- CPPUNIT_ASSERT_EQUAL_MESSAGE("String ref syntax doesn't match", formula::FormulaGrammar::CONV_XL_A1,
- aConfig.meStringRefAddressSyntax);
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testHeaderImageODS()
-{
- // Graphic as header background was lost on export.
- ScDocShellRef xShell = loadDoc(u"header-image.", FORMAT_ODS);
- ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_ODS);
- uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xDocSh->GetModel(), uno::UNO_QUERY);
- uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies();
- uno::Reference<container::XNameAccess> xPageStyles(xStyleFamilies->getByName("PageStyles"), uno::UNO_QUERY);
- uno::Reference<beans::XPropertySet> xStyle(xPageStyles->getByName("Default"), uno::UNO_QUERY);
-
- uno::Reference<graphic::XGraphic> xGraphic;
- xStyle->getPropertyValue("HeaderBackGraphic") >>= xGraphic;
- CPPUNIT_ASSERT(xGraphic.is());
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTextDirectionXLSX()
-{
- ScDocShellRef xDocSh = loadDoc(u"writingMode.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", "readingOrder", "1");//LTR
- assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment", "readingOrder", "2");//RTL
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf120168()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf120168.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- // Without the fix in place, this test would have failed with
- // - Expected: left
- // - Actual : general
- assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", "horizontal", "left");
- assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment", "horizontal", "right");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf66668()
-{
- // Would hang on exporting without the fix in place
- ScDocShellRef xDocSh = loadDoc(u"tdf66668.", FORMAT_XLSX);
- CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf130108()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf130108.", FORMAT_ODS);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:font/x:b", "val", "1");
- assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:font/x:i", "val", "0");
- assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:font/x:color", "rgb", "FFFFFFFF");
- assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:font/x:sz", "val", "10");
- assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:fill/x:patternFill/x:bgColor", "rgb", "FFCC0000");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf76949()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf76949.", FORMAT_ODS);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pSheet = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pSheet);
-
- assertXPathContent(pSheet, "/x:worksheet/x:sheetData/x:row/x:c/x:f", "_xlfn.CHISQ.DIST(1,1,1)");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf107586()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf107586.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pSheet = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pSheet);
-
- // Without the fix in place, this test would have failed with
- // XPath '/x:worksheet/x:sheetPr/x:tabColor' number of nodes is incorrect
- assertXPath(pSheet, "/x:worksheet/x:sheetPr/x:tabColor", "rgb", "FF9BBB59");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf55417()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf55417.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[1]/x:alignment", 1);
- assertXPath(pDoc, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", 1);
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf129985()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf129985.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", "m/d/yyyy");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf73063()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf73063.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", "[$-1C1A]dddd\", \"d\". \"mmmm\\ yyyy;@");
-
- xDocSh->DoClose();
-}
-
-xmlDocUniquePtr ScExportTest::testTdf95640(std::u16string_view rFileName, sal_Int32 nSourceFormat,
- sal_Int32 nDestFormat)
-{
- ScDocShellRef xShell = loadDoc(rFileName, nSourceFormat);
- CPPUNIT_ASSERT(xShell);
-
- auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), nDestFormat);
- xShell->DoClose();
-
- return XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
-}
-
-void ScExportTest::testTdf95640_ods_to_xlsx()
-{
- // Roundtripping sort options with user defined list to XLSX
- xmlDocUniquePtr pDoc = testTdf95640(u"tdf95640.", FORMAT_ODS, FORMAT_XLSX);
-
- assertXPath(pDoc, "//x:worksheet/x:autoFilter", "ref", "A1:B4");
-
- assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "ref", "A2:A4");
-
- assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "customList",
- "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec");
-}
-
-void ScExportTest::testTdf95640_ods_to_xlsx_with_standard_list()
-{
- // Roundtripping sort options with user defined list to XLSX
- xmlDocUniquePtr pDoc = testTdf95640(u"tdf95640_standard_list.", FORMAT_ODS, FORMAT_XLSX);
-
- assertXPath(pDoc, "//x:worksheet/x:autoFilter", "ref", "A1:B4");
-
- assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "ref", "A2:A4");
-
- assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "customList",
- "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday");
-}
-
-void ScExportTest::testTdf95640_xlsx_to_xlsx()
-{
- // XLSX Roundtripping sort options with custom sort list - note
- // that compared to ODS source documents above, here we _actually_
- // can use custom lists (beyond the global user defines), like
- // low, medium, high
- xmlDocUniquePtr pDoc = testTdf95640(u"tdf95640.", FORMAT_XLSX, FORMAT_XLSX);
-
- assertXPath(pDoc, "//x:worksheet/x:autoFilter", "ref", "A1:B4");
-
- assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "ref", "A2:A4");
-
- assertXPath(pDoc, "//x:worksheet/x:autoFilter/x:sortState/x:sortCondition", "customList",
- "Low,Medium,High");
-}
-
-void ScExportTest::testDateAutofilterXLSX()
-{
- // XLSX Roundtripping autofilter with date list
- ScDocShellRef xDocSh = loadDoc(u"dateAutofilter.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "//x:autoFilter", "ref", "A1:B4");
- assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "day", "02");
- assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "month", "03");
- assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "year", "2017");
- assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "dateTimeGrouping", "day");
-
- assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[2]", "day", "01");
- assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[2]", "month", "10");
- assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[2]", "year", "2014");
- assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[2]", "dateTimeGrouping", "day");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testDateAutofilterODS()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf142231.", FORMAT_ODS);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "content.xml", FORMAT_ODS);
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[1]", "value", "Calc");
- assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[2]", "value", "2021-05-04");
-}
-
-void ScExportTest::testAutofilterColorsODF()
-{
- ScDocShellRef xDocSh = loadDoc(u"autofilter-colors.", FORMAT_ODS);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "content.xml", FORMAT_ODS);
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[1]", "value", "#e8f2a1");
- assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[1][@loext:data-type='background-color']");
- assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[2]", "value", "#3465a4");
- assertXPath(pDoc, "//table:filter/table:filter-and/table:filter-condition[2][@loext:data-type='text-color']");
-}
-
-void ScExportTest::testAutofilterColorsOOXML()
-{
- ScDocShellRef xDocSh = loadDoc(u"autofilter-colors.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory,
- "xl/tables/table1.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "/x:table/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId", "4");
-}
-
-void ScExportTest::testAutofilterColorsStyleOOXML()
-{
- ScDocShellRef xDocSh = loadDoc(u"autofilter-colors.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc
- = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf[5]/x:fill/x:patternFill/x:bgColor", "rgb",
- "FFFFD7D7");
-}
-
-void ScExportTest::testTdf88657ODS()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf88657.", FORMAT_ODS);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "styles.xml", FORMAT_ODS);
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "//number:fraction", "min-denominator-digits", "3");
-
- xDocSh->DoClose();
-}
-
void ScExportTest::testConditionalFormatRangeListXLSX()
{
ScDocShellRef xDocSh = loadDoc(u"conditionalformat_rangelist.", FORMAT_ODS);
CPPUNIT_ASSERT(xDocSh.is());
-
xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX);
CPPUNIT_ASSERT(pDoc);
-
assertXPath(pDoc, "//x:conditionalFormatting", "sqref", "F4 F10");
-
xDocSh->DoClose();
}
@@ -4732,12 +4147,9 @@ void ScExportTest::testConditionalFormatContainsTextXLSX()
{
ScDocShellRef xDocSh = loadDoc(u"conditionalformat_containstext.", FORMAT_ODS);
CPPUNIT_ASSERT(xDocSh.is());
-
xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX);
CPPUNIT_ASSERT(pDoc);
-
assertXPathContent(pDoc, "//x:conditionalFormatting/x:cfRule/x:formula", "NOT(ISERROR(SEARCH(\"test\",A1)))");
-
xDocSh->DoClose();
}
@@ -4745,45 +4157,34 @@ void ScExportTest::testConditionalFormatPriorityCheckXLSX()
{
ScDocShellRef xDocSh = loadDoc(u"conditional_fmt_checkpriority.", FORMAT_XLSX);
CPPUNIT_ASSERT(xDocSh.is());
-
xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX);
CPPUNIT_ASSERT(pDoc);
-
constexpr bool bHighPriorityExtensionA1 = true; // Should A1's extension cfRule has higher priority than normal cfRule ?
constexpr bool bHighPriorityExtensionA3 = false; // Should A3's extension cfRule has higher priority than normal cfRule ?
-
size_t nA1NormalPriority = 0;
size_t nA1ExtPriority = 0;
size_t nA3NormalPriority = 0;
size_t nA3ExtPriority = 0;
-
for (size_t nIdx = 1; nIdx <= 2; ++nIdx)
{
OString aIdx = OString::number(nIdx);
OUString aCellAddr = getXPath(pDoc, "//x:conditionalFormatting[" + aIdx + "]", "sqref");
OUString aPriority = getXPath(pDoc, "//x:conditionalFormatting[" + aIdx + "]/x:cfRule", "priority");
-
CPPUNIT_ASSERT_MESSAGE("conditionalFormatting sqref must be either A1 or A3", aCellAddr == "A1" || aCellAddr == "A3");
-
if (aCellAddr == "A1")
nA1NormalPriority = aPriority.toUInt32();
else
nA3NormalPriority = aPriority.toUInt32();
-
aCellAddr = getXPathContent(pDoc, "//x:extLst/x:ext[1]/x14:conditionalFormattings/x14:conditionalFormatting[" + aIdx + "]/xm:sqref");
aPriority = getXPath(pDoc, "//x:extLst/x:ext[1]/x14:conditionalFormattings/x14:conditionalFormatting[" + aIdx + "]/x14:cfRule", "priority");
-
CPPUNIT_ASSERT_MESSAGE("x14:conditionalFormatting sqref must be either A1 or A3", aCellAddr == "A1" || aCellAddr == "A3");
-
if (aCellAddr == "A1")
nA1ExtPriority = aPriority.toUInt32();
else
nA3ExtPriority = aPriority.toUInt32();
}
-
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong priorities for A1", bHighPriorityExtensionA1, nA1ExtPriority < nA1NormalPriority);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong priorities for A3", bHighPriorityExtensionA3, nA3ExtPriority < nA3NormalPriority);
-
xDocSh->DoClose();
}
@@ -4791,1389 +4192,14 @@ void ScExportTest::testConditionalFormatOriginXLSX()
{
ScDocShellRef xDocSh = loadDoc(u"conditional_fmt_origin.", FORMAT_XLSX);
CPPUNIT_ASSERT(xDocSh.is());
-
xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX);
CPPUNIT_ASSERT(pDoc);
-
// tdf#124953 : The range-list is B3:C6 F1:G2, origin address in the formula should be B1, not B3.
OUString aFormula = getXPathContent(pDoc, "//x:conditionalFormatting/x:cfRule/x:formula");
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong origin address in formula", OUString("NOT(ISERROR(SEARCH(\"BAC\",B1)))"), aFormula);
-
xDocSh->DoClose();
}
-void ScExportTest::testTdf41722()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf41722.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "//x:conditionalFormatting/x:cfRule[1]", "operator", "containsText");
- assertXPath(pDoc, "//x:conditionalFormatting/x:cfRule[2]", "operator", "containsText");
- assertXPath(pDoc, "//x:conditionalFormatting/x:cfRule[3]", "operator", "containsText");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf113621()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf113621.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "//x:conditionalFormatting", "sqref", "A1:A1048576");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testEscapeCharInNumberFormatXLSX()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf81939.", FORMAT_XLSX);
- CPPUNIT_ASSERT( xDocSh.is() );
- xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX);
- CPPUNIT_ASSERT( xDocSh.is() );
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- const sal_Unicode cEuro (8364); // € symbol
- assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", "00\\ 00\\ 00\\ 00\\ 00");
- assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[3]", "formatCode", "00\\.00\\.00\\.000\\.0"); // tdf#81939
- // "_-* #,##0\ _€_-;\-* #,##0\ _€_-;_-* "- "_€_-;_- at _-" // tdf#81222
- OUString rFormatStrExpected ( "_-* #,##0\\ _" + OUStringChar(cEuro) + "_-;\\-* #,##0\\ _" +
- OUStringChar(cEuro) + "_-;_-* \"- \"_" + OUStringChar(cEuro) + "_-;_- at _-" );
- assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[4]", "formatCode", rFormatStrExpected );
- // "_-* #,##0" €"_-;\-* #,##0" €"_-;_-* "- €"_-;_- at _-");
- rFormatStrExpected = "_-* #,##0\" " + OUStringChar(cEuro) + "\"_-;\\-* #,##0\" " +
- OUStringChar(cEuro) + "\"_-;_-* \"- " + OUStringChar(cEuro) + "\"_-;_- at _-";
- assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[5]", "formatCode", rFormatStrExpected );
- // remove escape char in fraction
- assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[6]", "formatCode", "# ?/?;[RED]\\-# #/#####");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testNatNumInNumberFormatXLSX()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf79398_NatNum5.", FORMAT_ODS);
- CPPUNIT_ASSERT( xDocSh.is() );
- xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX); // Convert [NatNum5] to [DBNum2] in Chinese
- CPPUNIT_ASSERT( xDocSh.is() );
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[3]", "formatCode", "[DBNum2][$-804]General;[RED][DBNum2][$-804]General");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testExponentWithoutSignFormatXLSX()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf102370_ExponentWithoutSign.", FORMAT_ODS);
- CPPUNIT_ASSERT( xDocSh.is() );
- xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX);
- CPPUNIT_ASSERT( xDocSh.is() );
-
- xDocSh = saveAndReload( &(*xDocSh), FORMAT_ODS);
- CPPUNIT_ASSERT(xDocSh.is());
-
- ScDocument& rDoc = xDocSh->GetDocument();
- sal_uInt32 nNumberFormat;
- rDoc.GetNumberFormat(0, 0, 0, nNumberFormat);
- const SvNumberformat* pNumberFormat = rDoc.GetFormatTable()->GetEntry(nNumberFormat);
- const OUString& rFormatStr = pNumberFormat->GetFormatstring();
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Number format lost exponent without sign during Excel export", OUString("0.00E0"), rFormatStr);
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testExtendedLCIDXLSX()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf36038_ExtendedLCID.", FORMAT_ODS);
- CPPUNIT_ASSERT( xDocSh.is() );
- xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX);
- CPPUNIT_ASSERT( xDocSh.is() );
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
- // Check export
- assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", "[$-107041E]dd\\-mm\\-yyyy");
- assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[3]", "formatCode", "[$-D07041E]dd\\-mm\\-yyyy");
- assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[4]", "formatCode", "[$-1030411]dd\\-mm\\-ee");
- assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[5]", "formatCode", "[$-1B030411]dd\\-mm\\-ee");
- assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[6]", "formatCode", "[$-108040D]dd\\-mm\\-yyyy");
- //assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[7]", "formatCode", "[$-108040D]dd\\-mm\\-yyyy");
- assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[7]", "formatCode", "[$-1060401]dd\\-mm\\-yyyy");
- assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[8]", "formatCode", "[$-2060401]dd\\-mm\\-yyyy");
-
- // Check import
- ScDocument& rDoc = xDocSh->GetDocument();
- SvNumberFormatter* pNumFormatter = rDoc.GetFormatTable();
- sal_uInt32 nNumberFormat;
- const OUString aLang[5] = { "[$-41E]", "[$-411]", "[$-40D]", "[$-401]", "[$-500]" };
- const OUString aCalendar[5] = { "[~buddhist]DD-MM-YYYY", "DD-MM-EE", "[~jewish]DD-MM-YYYY", "[~hijri]DD-MM-YYYY", "[~dangi]YYYY/MM/DD" };
- // Note: ja-JP Gengou calendar is an implicit secondary (non-gregorian)
- // calendar, the explicit [~gengou] calendar modifier does not need to be
- // present, the E and EE keywords are used instead of YY and YYYY.
- for ( sal_Int16 nCol = 1; nCol <= 2; nCol++ )
- {
- for ( sal_Int16 nRow = 1; nRow <= 4; nRow++ )
- {
- rDoc.GetNumberFormat(nCol, nRow, 0, nNumberFormat);
- const SvNumberformat* pNumberFormat = pNumFormatter->GetEntry(nNumberFormat);
- const OUString& rFormatStr = pNumberFormat->GetFormatstring();
- const OUString aExpectedFormatStr = aLang[nRow-1] + ( (nCol==2 && nRow!=3) ? OUString("[NatNum1]") : OUString() ) + aCalendar[nRow-1];
-
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Number format lost extended LCID during Excel export", aExpectedFormatStr, rFormatStr);
- }
- }
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testHiddenRepeatedRowsODS()
-{
- ScDocShellRef xDocSh = loadDoc(u"empty.", FORMAT_ODS);
- CPPUNIT_ASSERT( xDocSh.is() );
-
- {
- ScDocument& rDoc = xDocSh->GetDocument();
- rDoc.SetRowHidden(0, 20, 0, true);
- }
-
- xDocSh = saveAndReload( &(*xDocSh), FORMAT_ODS);
- ScDocument& rDoc = xDocSh->GetDocument();
- SCROW nFirstRow = 0;
- SCROW nLastRow = 0;
- bool bHidden = rDoc.RowHidden(0, 0, &nFirstRow, &nLastRow);
- CPPUNIT_ASSERT(bHidden);
- CPPUNIT_ASSERT_EQUAL(SCROW(0), nFirstRow);
- CPPUNIT_ASSERT_EQUAL(SCROW(20), nLastRow);
- xDocSh->DoClose();
-}
-
-void ScExportTest::testHyperlinkTargetFrameODS()
-{
- ScDocShellRef xDocSh = loadDoc(u"hyperlink_frame.", FORMAT_ODS);
- CPPUNIT_ASSERT(xDocSh.is());
-
- ScDocument& rDoc = xDocSh->GetDocument();
- const EditTextObject* pEditText = rDoc.GetEditText(ScAddress(2, 5, 0));
- CPPUNIT_ASSERT(pEditText);
-
- const SvxFieldData* pData = pEditText->GetFieldData(0, 0, text::textfield::Type::URL);
- CPPUNIT_ASSERT_MESSAGE("Failed to get the URL data.", pData);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Failed to get the URL data.", text::textfield::Type::URL, pData->GetClassId());
-
- const SvxURLField* pURLData = static_cast<const SvxURLField*>(pData);
- OUString aTargetFrame = pURLData->GetTargetFrame();
- CPPUNIT_ASSERT_EQUAL(OUString("_blank"), aTargetFrame);
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "content.xml", FORMAT_ODS);
- CPPUNIT_ASSERT(pDoc);
- OUString aTargetFrameExport = getXPath(pDoc,
- "/office:document-content/office:body/office:spreadsheet/table:table/table:table-row[2]/table:table-cell[2]/text:p/text:a", "target-frame-name");
- CPPUNIT_ASSERT_EQUAL(OUString("_blank"), aTargetFrameExport);
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testOpenDocumentAsReadOnly()
-{
- ScDocShellRef xDocSh = loadDoc(u"open-as-read-only.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh->IsSecurityOptOpenReadOnly());
- ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh2->IsSecurityOptOpenReadOnly());
- xDocSh->DoClose();
- xDocSh2->DoClose();
-}
-
-void ScExportTest::testKeepSettingsOfBlankRows()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf41425.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
- xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pSheet);
-
- // saved blank row with not default setting in A2
- assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row", 2);
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf133595()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf133595.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
- xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pSheet);
-
- // without the fix in place, mc:AlternateContent would have been added to sheet1
- assertXPath(pSheet, "/x:worksheet/mc:AlternateContent", 0);
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf134769()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf134769.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
- xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pSheet);
-
- // without the fix in place, the legacyDrawing would have been exported after the checkbox
- // and Excel would have claimed the document is corrupted
- // Use their ids to check the order
- assertXPath(pSheet, "/x:worksheet/x:drawing", "id", "rId2");
- assertXPath(pSheet, "/x:worksheet/x:legacyDrawing", "id", "rId3");
- assertXPath(pSheet, "/x:worksheet/mc:AlternateContent/mc:Choice/x:controls/mc:AlternateContent/mc:Choice/x:control", "id", "rId4");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf106181()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf106181.", FORMAT_ODS);
- CPPUNIT_ASSERT(xDocSh.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
- xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pSheet);
-
- assertXPath(pSheet, "/x:worksheet/mc:AlternateContent/mc:Choice/x:controls/mc:AlternateContent/mc:Choice/x:control", "name", "Check Box");
- assertXPath(pSheet, "/x:worksheet/mc:AlternateContent/mc:Choice/x:controls/mc:AlternateContent/mc:Choice/x:control/x:controlPr", "altText", "Check Box 1");
-
- xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml");
- CPPUNIT_ASSERT(pDrawing);
-
- assertXPath(pDrawing, "/xdr:wsDr/mc:AlternateContent/mc:Choice/xdr:twoCellAnchor/xdr:sp/xdr:nvSpPr/xdr:cNvPr", "name", "Check Box 1");
- assertXPath(pDrawing, "/xdr:wsDr/mc:AlternateContent/mc:Choice/xdr:twoCellAnchor/xdr:sp/xdr:nvSpPr/xdr:cNvPr", "descr", "Check Box");
- assertXPath(pDrawing, "/xdr:wsDr/mc:AlternateContent/mc:Choice/xdr:twoCellAnchor/xdr:sp/xdr:nvSpPr/xdr:cNvPr", "hidden", "0");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf105272()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf105272.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
- xDocSh = saveAndReload(xDocSh.get(), FORMAT_XLSX);
- ScDocument& rDoc = xDocSh->GetDocument();
- //without the fix in place,it would fail
- //Expected: Table1[[#This Row],[Total]]/Table1[[#This Row],['# Athletes]]
- //Actual : table1[[#this row],[total]]/table1[[#this row],['# athletes]]
-
- ASSERT_FORMULA_EQUAL(rDoc, ScAddress(7, 3, 0),
- "Table1[[#This Row],[Total]]/Table1[[#This Row],['# Athletes]]",
- "Wrong formula");
-}
-
-void ScExportTest::testTdf118990()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf118990.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
- xDocSh = saveAndReload(xDocSh.get(), FORMAT_XLSX);
- ScDocument& rDoc = xDocSh->GetDocument();
-
- // TODO: also test A1, which contains a UNC reference to \\localhost\share\lookupsource.xlsx,
- // but currently looses "localhost" part when normalized in INetURLObject, becoming
- // file:///share/lookupsource.xlsx - which is incorrect, since it points to local filesystem
- // and not to Windows network share.
-
- ASSERT_FORMULA_EQUAL(rDoc, ScAddress(0, 1, 0),
- "VLOOKUP(B1,'file://192.168.1.1/share/lookupsource.xlsx'#$Sheet1.A1:B5,2)",
- "Wrong Windows share (using host IP) URL in A2");
-
- ASSERT_FORMULA_EQUAL(rDoc, ScAddress(0, 2, 0),
- "VLOOKUP(B1,'file://NETWORKHOST/share/lookupsource.xlsx'#$Sheet1.A1:B5,2)",
- "Wrong Windows share (using hostname) URL in A3");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf121612()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf121612.", FORMAT_ODS);
- CPPUNIT_ASSERT(xDocSh.is());
- xDocSh = saveAndReload(xDocSh.get(), FORMAT_XLSX);
-
- ScDocument& rDoc = xDocSh->GetDocument();
-
- // There should be a pivot table
- CPPUNIT_ASSERT(rDoc.HasPivotTable());
-
- // DP collection is not lost after export and has one entry
- ScDPCollection* pDPColl = rDoc.GetDPCollection();
- CPPUNIT_ASSERT(pDPColl);
- CPPUNIT_ASSERT_EQUAL(size_t(1), pDPColl->GetCount());
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf112936()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf112936.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "//x:pivotCacheDefinition", "recordCount", "4");
- assertXPath(pDoc, "//x:pivotCacheDefinition", "createdVersion", "3");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testXltxExport()
-{
- // Create new document
- ScDocShell* pShell = new ScDocShell(
- SfxModelFlags::EMBEDDED_OBJECT |
- SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS |
- SfxModelFlags::DISABLE_DOCUMENT_RECOVERY);
- pShell->DoInitNew();
-
- // Export as template and check content type
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *pShell, m_xSFactory, "[Content_Types].xml", FORMAT_XLTX);
- CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/ContentType:Types/ContentType:Override[@PartName='/xl/workbook.xml']",
- "ContentType", "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml");
-}
-
-void ScExportTest::testPivotCacheAfterExportXLSX()
-{
- ScDocShellRef xDocSh = loadDoc(u"numgroup_example.", FORMAT_ODS);
- CPPUNIT_ASSERT(xDocSh.is());
-
- // export only
- std::shared_ptr<utl::TempFile> pTemp = saveAs(xDocSh.get(), FORMAT_XLSX);
-
- ScDocument& rDoc = xDocSh->GetDocument();
- CPPUNIT_ASSERT(rDoc.HasPivotTable());
-
- // Two pivot tables
- ScDPCollection* pDPColl = rDoc.GetDPCollection();
- CPPUNIT_ASSERT(pDPColl);
- CPPUNIT_ASSERT_EQUAL(size_t(2), pDPColl->GetCount());
-
- // One cache
- ScDPCollection::SheetCaches& rSheetCaches = pDPColl->GetSheetCaches();
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rSheetCaches.size());
- const ScDPCache* pCache = rSheetCaches.getExistingCache(ScRange(0, 0, 0, 3, 30, 0));
- CPPUNIT_ASSERT_MESSAGE("Pivot cache is expected for A1:D31 on the first sheet.", pCache);
-
- // See if XLSX export didn't damage group info of the 1st pivot table
- const ScDPNumGroupInfo* pInfo = pCache->GetNumGroupInfo(1);
- CPPUNIT_ASSERT_MESSAGE("No number group info :(", pInfo);
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf114969XLSX()
-{
- ScDocShellRef xDocSh = loadDoc(u"sheet_name_with_dots.", FORMAT_ODS);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[1]", "location", "'1.1.1.1'!C1");
- assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[2]", "location", "'1.1.1.1'!C2");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf115192XLSX()
-{
- ScDocShellRef xDocSh = loadDoc(u"test_115192.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/_rels/drawing1.xml.rels", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/r:Relationships/r:Relationship[@Id='rId1']", "TargetMode", "External");
- assertXPathNoAttribute(pDoc, "/r:Relationships/r:Relationship[@Id='rId2']", "TargetMode");
- assertXPath(pDoc, "/r:Relationships/r:Relationship[@Id='rId3']", "TargetMode", "External");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf91634XLSX()
-{
- ScDocShellRef xDocSh = loadDoc(u"image_hyperlink.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml");
- CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:pic/xdr:nvPicPr/xdr:cNvPr/a:hlinkClick", 1);
-
- xmlDocUniquePtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/_rels/drawing1.xml.rels");
- CPPUNIT_ASSERT(pXmlRels);
- assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", "Target", "https://www.google.com/");
- assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", "TargetMode", "External");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testValidationCopyPaste()
-{
- ScDocShellRef xDocSh = loadDoc(u"validation-copypaste.", FORMAT_ODS);
- CPPUNIT_ASSERT(xDocSh.is());
- ScDocument& rSrcDoc = xDocSh->GetDocument();
-
- // Copy B1 from src doc to clip
- ScDocument aClipDoc(SCDOCMODE_CLIP);
- ScRange aSrcRange(1, 0, 1);
- ScClipParam aClipParam(aSrcRange, false);
- ScMarkData aMark(rSrcDoc.GetSheetLimits());
- aMark.SetMarkArea(aSrcRange);
- rSrcDoc.CopyToClip(aClipParam, &aClipDoc, &aMark, false, false);
-
- // Create second document, paste B1 from clip
- ScDocShell* pShell2
- = new ScDocShell(SfxModelFlags::EMBEDDED_OBJECT | SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS
- | SfxModelFlags::DISABLE_DOCUMENT_RECOVERY);
- pShell2->DoInitNew();
- ScDocument& rDestDoc = pShell2->GetDocument();
- ScRange aDstRange(1, 0, 0);
- ScMarkData aMark2(rDestDoc.GetSheetLimits());
- aMark2.SetMarkArea(aDstRange);
- rDestDoc.CopyFromClip(aDstRange, aMark2, InsertDeleteFlags::ALL, nullptr, &aClipDoc);
-
- // save as XLSX
- std::shared_ptr<utl::TempFile> pXPathFile
- = ScBootstrapFixture::exportTo(&(*pShell2), FORMAT_XLSX);
-
- // check validation
- xmlDocUniquePtr pDoc
- = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pDoc);
- assertXPathContent(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation/x:formula1", "#REF!");
-}
-
-void ScExportTest::testTdf115159()
-{
- ScDocShellRef xShell = loadDoc(u"tdf115159.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xShell.is());
- ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
- xShell->DoClose();
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/workbook.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- //assert the existing OOXML built-in name is not duplicated
- assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName", 1);
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf112567()
-{
- // Set the system locale to Hungarian (a language with different range separator)
- SvtSysLocaleOptions aOptions;
- OUString sLocaleConfigString = aOptions.GetLanguageTag().getBcp47();
- aOptions.SetLocaleConfigString("hu-HU");
- aOptions.Commit();
- comphelper::ScopeGuard g([&aOptions, &sLocaleConfigString] {
- aOptions.SetLocaleConfigString(sLocaleConfigString);
- aOptions.Commit();
- });
-
- ScDocShellRef xShell = loadDoc(u"tdf112567.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xShell.is());
- ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
- xShell->DoClose();
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/workbook.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- //assert the existing OOXML built-in name is not duplicated
- assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName", 1);
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf112567b()
-{
- // Set the system locale to Hungarian (a language with different range separator)
- SvtSysLocaleOptions aOptions;
- OUString sLocaleConfigString = aOptions.GetLanguageTag().getBcp47();
- aOptions.SetLocaleConfigString("hu-HU");
- aOptions.Commit();
- comphelper::ScopeGuard g([&aOptions, &sLocaleConfigString] {
- aOptions.SetLocaleConfigString(sLocaleConfigString);
- aOptions.Commit();
- });
-
- ScDocShellRef xShell = loadDoc(u"tdf112567.", FORMAT_ODS);
- CPPUNIT_ASSERT(xShell.is());
- ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
- xShell->DoClose();
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/workbook.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- //assert the existing OOXML built-in name is not duplicated
- assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName", 1);
-
- //and it contains "," instead of ";"
- assertXPathContent(pDoc, "/x:workbook/x:definedNames/x:definedName[1]", "Sheet1!$A:$A,Sheet1!$1:$1");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf123645XLSX()
-{
- ScDocShellRef xDocSh = loadDoc(u"chart_hyperlink.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml");
- CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:graphicFrame/xdr:nvGraphicFramePr/xdr:cNvPr/a:hlinkClick", 1);
- assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:graphicFrame/xdr:nvGraphicFramePr/xdr:cNvPr/a:hlinkClick", 1);
- assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[3]/xdr:graphicFrame/xdr:nvGraphicFramePr/xdr:cNvPr/a:hlinkClick", 1);
-
- xmlDocUniquePtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/_rels/drawing1.xml.rels");
- CPPUNIT_ASSERT(pXmlRels);
- assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", "TargetMode", "External");
- assertXPathNoAttribute(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId3']", "TargetMode");
- assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId5']", "TargetMode", "External");
- assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", "Target", "file:///C:/TEMP/test.xlsx");
- assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId3']", "Target", "#Sheet2!A1");
- assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId5']", "Target", "https://bugs.documentfoundation.org/show_bug.cgi?id=123645");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf125173XLSX()
-{
- ScDocShellRef xDocSh = loadDoc(u"text_box_hyperlink.", FORMAT_ODS);
- CPPUNIT_ASSERT(xDocSh.is());
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml");
- CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:nvSpPr/xdr:cNvPr/a:hlinkClick", 1);
-
- xmlDocUniquePtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/_rels/drawing1.xml.rels");
- CPPUNIT_ASSERT(pXmlRels);
- assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", "Target", "http://www.google.com/");
- assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", "TargetMode", "External");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf79972XLSX()
-{
- ScDocShellRef xDocSh = loadDoc(u"tdf79972.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink", "ref", "A1");
-
- xmlDocUniquePtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/_rels/sheet1.xml.rels");
- CPPUNIT_ASSERT(pXmlRels);
- assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "Target", "https://bugs.documentfoundation.org/show_bug.cgi?id=79972");
- assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "TargetMode", "External");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf126024XLSX()
-{
- ScDocShellRef xDocSh = loadDoc(u"hyperlink_formula.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink", "ref", "A2");
-
- xmlDocUniquePtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/_rels/sheet1.xml.rels");
- CPPUNIT_ASSERT(pXmlRels);
- assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "Target", "https://bugs.documentfoundation.org/");
- assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "TargetMode", "External");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf126177XLSX()
-{
- ScDocShellRef xDocSh = loadDoc(u"hyperlink_export.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pDoc);
- assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink", "location", "Munka1!A5");
-
- xmlDocUniquePtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/_rels/sheet1.xml.rels");
- CPPUNIT_ASSERT(pXmlRels);
- OUString aTarget = getXPath(pXmlRels, "/r:Relationships/r:Relationship", "Target");
- CPPUNIT_ASSERT(aTarget.endsWith("test.xlsx"));
- assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "TargetMode", "External");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testCommentTextVAlignment()
-{
- // Testing comment text alignments.
- ScDocShellRef xShell = loadDoc(u"CommentTextVAlign.", FORMAT_ODS);
- CPPUNIT_ASSERT(xShell.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile
- = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
-
- xmlDocUniquePtr pVmlDrawing
- = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/vmlDrawing1.vml");
- CPPUNIT_ASSERT(pVmlDrawing);
-
- assertXPathContent(pVmlDrawing, "/xml/v:shape/xx:ClientData/xx:TextVAlign", "Center");
-
- xShell->DoClose();
-}
-
-void ScExportTest::testCommentTextHAlignment()
-{
- // Testing comment text alignments.
- ScDocShellRef xShell = loadDoc(u"CommentTextHAlign.", FORMAT_ODS);
- CPPUNIT_ASSERT(xShell.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile
- = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
-
- xmlDocUniquePtr pVmlDrawing
- = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/vmlDrawing1.vml");
- CPPUNIT_ASSERT(pVmlDrawing);
-
- assertXPathContent(pVmlDrawing, "/xml/v:shape/xx:ClientData/xx:TextHAlign", "Center");
-
- xShell->DoClose();
-}
-
-void ScExportTest::testRotatedImageODS()
-{
- // Error was, that the length values in shapes were not
- // written in the given unit into the file.
- css::uno::Reference<css::sheet::XGlobalSheetSettings> xGlobalSheetSettings
- = css::sheet::GlobalSheetSettings::create(comphelper::getProcessComponentContext());
- xGlobalSheetSettings->setMetric(static_cast<sal_Int16>(FieldUnit::MM));
-
- ScDocShellRef xDocSh = loadDoc(u"tdf103092_RotatedImage.", FORMAT_ODS, true);
- CPPUNIT_ASSERT(xDocSh.is());
-
- std::shared_ptr<utl::TempFile> pTemp = saveAs(xDocSh.get(), FORMAT_ODS);
- CPPUNIT_ASSERT(pTemp);
- xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pTemp, m_xSFactory, "content.xml");
- CPPUNIT_ASSERT(pXmlDoc);
-
- const OUString sTransform = getXPath(
- pXmlDoc,
- "/office:document-content/office:body/office:spreadsheet/"
- "table:table/table:shapes/draw:frame",
- "transform");
- // Attribute transform has the structure skew (...) rotate (...) translate (x y)
- // parts are separated by blank
- OUString sTranslate(sTransform.copy(sTransform.lastIndexOf('(')));
- sTranslate = sTranslate.copy(1, sTranslate.getLength()-2); // remove '(' and ')'
- const OUString sX(sTranslate.getToken(0, ' '));
- const OUString sY(sTranslate.getToken(1, ' '));
- CPPUNIT_ASSERT(sX.endsWith("mm"));
- CPPUNIT_ASSERT(sY.endsWith("mm"));
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf128976()
-{
- ScDocShellRef xShell = loadDoc(u"tdf128976.", FORMAT_XLS);
- CPPUNIT_ASSERT(xShell.is());
-
- ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLS);
- xShell->DoClose();
- CPPUNIT_ASSERT(xDocSh.is());
-
- ScDocument& rDoc = xDocSh->GetDocument();
-
- // Trying to save very small fractional default column width to XLS (where only integer values
- // between 0 and 255 are allowed as default) resulted in negative (-1) value after correction,
- // and was written as 65535 (invalid default width). As the result, all columns had large width
- // when reopened: 28415 (and Excel warned about invalid format).
- const sal_uInt16 nColumn0Width = rDoc.GetColWidth(SCCOL(0), SCTAB(0), false);
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(45), nColumn0Width);
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf120502()
-{
- // Create an empty worksheet; resize last column on its first sheet; export to XLSX, and check
- // that the last exported column number is correct
- css::uno::Reference<css::frame::XDesktop2> xDesktop
- = css::frame::Desktop::create(comphelper::getProcessComponentContext());
- CPPUNIT_ASSERT(xDesktop);
-
- css::uno::Sequence<css::beans::PropertyValue> args(1);
- args[0].Name = "Hidden";
- args[0].Value <<= true;
-
- css::uno::Reference<css::lang::XComponent> xComponent
- = xDesktop->loadComponentFromURL("private:factory/scalc", "_blank", 0, args);
- CPPUNIT_ASSERT(xComponent);
-
- // Get the document model
- SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent);
- CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
-
- ScDocShellRef xShell = dynamic_cast<ScDocShell*>(pFoundShell);
- CPPUNIT_ASSERT(xShell);
-
- ScDocument& rDoc = xShell->GetDocument();
- const SCCOL nMaxCol = rDoc.MaxCol(); // 0-based
-
- const auto nOldWidth = rDoc.GetColWidth(nMaxCol, 0);
- rDoc.SetColWidth(nMaxCol, 0, nOldWidth + 100);
-
- std::shared_ptr<utl::TempFile> pXPathFile
- = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
- xShell->DoClose();
- xmlDocUniquePtr pSheet1
- = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pSheet1);
-
- // This was 1025 when nMaxCol+1 was 1024
- assertXPath(pSheet1, "/x:worksheet/x:cols/x:col", "max", OUString::number(nMaxCol + 1));
-}
-
-void ScExportTest::testTdf131372()
-{
- ScDocShellRef xShell = loadDoc(u"tdf131372.", FORMAT_ODS);
- CPPUNIT_ASSERT(xShell);
-
- auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
-
- xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pSheet);
-
- assertXPathContent(pSheet, "/x:worksheet/x:sheetData/x:row/x:c[1]/x:f", "NA()");
- assertXPathContent(pSheet, "/x:worksheet/x:sheetData/x:row/x:c[2]/x:f", "#N/A");
-
- xShell->DoClose();
-
-}
-void ScExportTest::testTdf81470()
-{
- ScDocShellRef xShell = loadDoc(u"tdf81470.", FORMAT_XLS);
- CPPUNIT_ASSERT(xShell);
-
- //without the fix in place, it would have crashed at export time
- auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
-
- //also check revisions are exported
- xmlDocUniquePtr pHeaders = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/revisions/revisionHeaders.xml");
- CPPUNIT_ASSERT(pHeaders);
-
- assertXPath(pHeaders, "/x:headers/x:header[1]", "dateTime", "2014-07-11T13:46:00.000000000Z");
- assertXPath(pHeaders, "/x:headers/x:header[1]", "userName", "Kohei Yoshida");
- assertXPath(pHeaders, "/x:headers/x:header[2]", "dateTime", "2014-07-11T18:38:00.000000000Z");
- assertXPath(pHeaders, "/x:headers/x:header[2]", "userName", "Kohei Yoshida");
- assertXPath(pHeaders, "/x:headers/x:header[3]", "dateTime", "2014-07-11T18:43:00.000000000Z");
- assertXPath(pHeaders, "/x:headers/x:header[3]", "userName", "Kohei Yoshida");
-
- xShell->DoClose();
-}
-
-void ScExportTest::testTdf122331()
-{
- ScDocShellRef xShell = loadDoc(u"tdf122331.", FORMAT_ODS);
- CPPUNIT_ASSERT(xShell);
-
- auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
-
- xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pSheet);
-
- assertXPath(pSheet, "/x:worksheet/x:sheetPr", "filterMode", "true");
- assertXPath(pSheet, "/x:worksheet/x:autoFilter", "ref", "A1:B761");
- assertXPath(pSheet, "/x:worksheet/x:autoFilter/x:filterColumn", "colId", "1");
-
- xShell->DoClose();
-}
-
-void ScExportTest::testTdf83779()
-{
- // Roundtripping TRUE/FALSE constants (not functions) must convert them to functions
- ScDocShellRef xShell = loadDoc(u"tdf83779.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xShell);
-
- auto pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
-
- xmlDocUniquePtr pVmlDrawing
- = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pVmlDrawing);
-
- assertXPathContent(pVmlDrawing, "/x:worksheet/x:sheetData/x:row[1]/x:c/x:f", "FALSE()");
- assertXPathContent(pVmlDrawing, "/x:worksheet/x:sheetData/x:row[2]/x:c/x:f", "TRUE()");
-
- xShell->DoClose();
-}
-
-void ScExportTest::testTdf121716_ExportEvenHeaderFooterXLSX()
-{
- // Header and footer on even pages should be exported properly
- // If there are separate odd/even header, but only 1 footer for all pages (this is possible only in LibreOffice)
- // then the footer will be duplicated to have the same footer separately for even/odd pages
-
- ScDocShellRef xShell = loadDoc(u"tdf121716_EvenHeaderFooter.", FORMAT_ODS);
- CPPUNIT_ASSERT(xShell.is());
-
- ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
- xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "/x:worksheet/x:headerFooter", "differentOddEven", "true");
- assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader", "&Lodd/right&Cpage&Rheader");
- assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter", "&Lboth&C&12page&Rfooter");
- assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:evenHeader", "&Lpage&Cheader&Reven/left");
- assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:evenFooter", "&Lboth&C&12page&Rfooter");
-
- pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet2.xml");
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "/x:worksheet/x:headerFooter", "differentOddEven", "true");
- assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader", "&Coddh");
- assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter", "&Coddf");
- assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:evenHeader", "&Cevenh");
- assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:evenFooter", "&Levenf");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf134459_HeaderFooterColorXLSX()
-{
- // Colors in header and footer should be exported, and imported properly
- ScDocShellRef xShell = loadDoc(u"tdf134459_HeaderFooterColor.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xShell.is());
-
- ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader", "&L&Kc06040l&C&K4c3789c&Rr");
- assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter", "&Ll&C&K64cf5fc&R&Kcd15aar");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf134817_HeaderFooterTextWith2SectionXLSX()
-{
- // Header/footer text with multiple selection should be exported, and imported properly
- ScDocShellRef xShell = loadDoc(u"tdf134817_HeaderFooterTextWith2Section.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xShell.is());
-
- ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX);
- CPPUNIT_ASSERT(pDoc);
-
- assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader", "&L&\"Abadi,Regular\"&11aaa&\"Bembo,Regular\"&20bbb");
- assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter", "&R&\"Cambria,Regular\"&14camb&\"Dante,Regular\"&18dant");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf121718_UseFirstPageNumberXLSX()
-{
- // If "First page number" is not checked then useFirstPageNumb, and firstPageNumber should not be exported.
- ScDocShellRef xShell = loadDoc(u"tdf121718_UseFirstPageNumber.", FORMAT_ODS);
- CPPUNIT_ASSERT(xShell.is());
-
- ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
- xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "/x:worksheet/x:pageSetup", "useFirstPageNumber", "true");
- assertXPath(pDoc, "/x:worksheet/x:pageSetup", "firstPageNumber", "10");
-
- pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet2.xml");
- CPPUNIT_ASSERT(pDoc);
-
- assertXPathNoAttribute(pDoc, "/x:worksheet/x:pageSetup", "useFirstPageNumber");
- assertXPathNoAttribute(pDoc, "/x:worksheet/x:pageSetup", "firstPageNumber");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testHeaderFontStyleXLSX()
-{
- ScDocShellRef xShell = loadDoc(u"tdf134826.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xShell.is());
-
- ScDocument& rDoc = xShell->GetDocument();
- SfxStyleSheetBase* pStyleSheet = rDoc.GetStyleSheetPool()->Find(rDoc.GetPageStyle(0), SfxStyleFamily::Page);
- const SfxItemSet& rItemSet = pStyleSheet->GetItemSet();
- const ScPageHFItem& rHFItem = rItemSet.Get(ATTR_PAGE_HEADERRIGHT);
- const EditTextObject* pTextObj = rHFItem.GetLeftArea();
-
- std::vector<EECharAttrib> rLst;
-
- // first line is bold.
- pTextObj->GetCharAttribs(0, rLst);
- bool bHasBold = std::any_of(rLst.begin(), rLst.end(), [](const EECharAttrib& rAttrib) {
- return rAttrib.pAttr->Which() == EE_CHAR_WEIGHT &&
- static_cast<const SvxWeightItem&>(*rAttrib.pAttr).GetWeight() == WEIGHT_BOLD; });
- CPPUNIT_ASSERT_MESSAGE("First line should be bold.", bHasBold);
-
- // second line is italic.
- pTextObj->GetCharAttribs(1, rLst);
- bool bHasItalic = std::any_of(rLst.begin(), rLst.end(), [](const EECharAttrib& rAttrib) {
- return rAttrib.pAttr->Which() == EE_CHAR_ITALIC &&
- static_cast<const SvxPostureItem&>(*rAttrib.pAttr).GetPosture() == ITALIC_NORMAL; });
- CPPUNIT_ASSERT_MESSAGE("Second line should be italic.", bHasItalic);
-
- xShell->DoClose();
-}
-
-void ScExportTest::testTdf135828_Shape_Rect()
-{
- if (!IsDefaultDPI())
- return;
- // tdf#135828 Check that the width and the height of rectangle of the shape is correct.
- // tdf#123613 Check the positioning, and allow massive rounding errors because of the back and
- // forth conversion between emu and hmm.
- ScDocShellRef xShell = loadDoc(u"tdf135828_Shape_Rect.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xShell.is());
-
- ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
-
- xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml");
- CPPUNIT_ASSERT(pDrawing);
-
- double nXPosOfTopleft = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:off", "x" ).toDouble();
- double nYPosOfTopleft = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:off", "y" ).toDouble();
- double nWidth = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cx").toDouble();
- double nHeight = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cy").toDouble();
-
- CPPUNIT_ASSERT_DOUBLES_EQUAL( 854640, nXPosOfTopleft, 10000);
- CPPUNIT_ASSERT_DOUBLES_EQUAL( -570600, nYPosOfTopleft, 10000);
- CPPUNIT_ASSERT_DOUBLES_EQUAL( 294840, nWidth, 10000);
- CPPUNIT_ASSERT_DOUBLES_EQUAL( 1988280, nHeight, 10000);
-}
-
-void ScExportTest::testTdf123353()
-{
- ScDocShellRef xShell = loadDoc(u"tdf123353.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xShell.is());
-
- ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "/x:worksheet/x:autoFilter/x:filterColumn/x:filters", "blank", "1");
-
- xShell->DoClose();
-}
-
-void ScExportTest::testTdf140098()
-{
- ScDocShellRef xShell = loadDoc(u"tdf140098.", FORMAT_ODS);
- CPPUNIT_ASSERT(xShell.is());
-
- ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
-
- xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "/x:worksheet/x:autoFilter/x:filterColumn/x:filters", "blank", "1");
-
- xShell->DoClose();
-}
-
-void ScExportTest::testTdf133688_precedents()
-{
- // tdf#133688 Check that we do not export detective shapes.
- ScDocShellRef xShell = loadDoc(u"tdf133688_dont_save_precedents_to_xlsx.", FORMAT_ODS);
- CPPUNIT_ASSERT(xShell.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile
- = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
- xmlDocUniquePtr pDrawing
- = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml");
- CPPUNIT_ASSERT(pDrawing);
-
- // We do not export any shapes.
- assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor[1]", 0);
-}
-
-void ScExportTest::testTdf91251_missingOverflowRoundtrip()
-{
- // tdf#91251 check whether textBox overflow property (horzOverflow and vertOverflow) is
- // getting preserved after roundtrip
- ScDocShellRef xShell = loadDoc(u"tdf91251_missingOverflowRoundtrip.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xShell.is());
-
- ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
-
- xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml");
- CPPUNIT_ASSERT(pDrawing);
-
- assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr", "horzOverflow", "clip");
- assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr", "horzOverflow", "clip");
-}
-
-void ScExportTest::testTdf137000_handle_upright()
-{
- // tdf#106197 When exporting the "upright" attribute, we must set
- // TextPreRotateAngle to 0.
- // (Upright is an xml attribute of xdr:txBody/a:bodyPr. It is set when
- // in a textbox menu we choose: do not rotate this element.)
- ScDocShellRef xShell = loadDoc(u"tdf137000_export_upright.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xShell.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile
- = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
- xmlDocUniquePtr pDrawing
- = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml");
- CPPUNIT_ASSERT(pDrawing);
-
- assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr",
- "rot", "-5400000");
-}
-
-void ScExportTest::testTdf126305_DataValidatyErrorAlert()
-{
- ScDocShellRef xShell = loadDoc(u"tdf126305.", FORMAT_ODS);
- CPPUNIT_ASSERT(xShell.is());
-
- ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
- xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation[1]", "errorStyle", "stop");
- assertXPath(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation[2]", "errorStyle", "warning");
- assertXPath(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation[3]", "errorStyle", "information");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf76047_externalLink()
-{
- ScDocShellRef pShell = loadDoc(u"tdf76047_externalLink.", FORMAT_XLSX);
- CPPUNIT_ASSERT(pShell.is());
-
- // load data from external links. (tdf76047_externalLinkSource.ods)
- // that file has to be in the same directory as tdf76047_externalLink.xlsx
- pShell->ReloadAllLinks();
- ScDocument& rDoc = pShell->GetDocument();
-
- // compare the data loaded from external links with the expected result stored in the test file
- for (int nCol = 1; nCol <= 5; nCol++)
- {
- for (int nRow = 3; nRow <= 5; nRow++)
- {
- OUString aStr1 = rDoc.GetString(ScAddress(nCol, nRow, 0));
- OUString aStr2 = rDoc.GetString(ScAddress(nCol, nRow + 5, 0));
- OUString aStr3 = rDoc.GetString(ScAddress(nCol, nRow + 11, 0));
-
- CPPUNIT_ASSERT_EQUAL(aStr1, aStr3);
- CPPUNIT_ASSERT_EQUAL(aStr2, aStr3);
- }
- }
-}
-
-void ScExportTest::testTdf87973_externalLinkSkipUnuseds()
-{
- ScDocShellRef pShell = loadDoc(u"tdf87973_externalLinkSkipUnuseds.", FORMAT_ODS);
- CPPUNIT_ASSERT(pShell.is());
-
- // try to load data from external link: tdf132105_external.ods
- // that file has to be in the same directory as tdf87973_externalLinkSkipUnuseds.ods
- pShell->ReloadAllLinks();
- ScDocument& rDoc = pShell->GetDocument();
-
- // change external link to: 87973_externalSource.ods
- OUString aFormula, aFormula2;
- rDoc.GetFormula(3, 1, 0, aFormula);
- auto nIdxOfFilename = aFormula.indexOf("tdf132105_external.ods");
- aFormula = aFormula.replaceAt(nIdxOfFilename, 22, "87973_externalSource.ods");
- auto nIdxOfFile = aFormula.indexOf("file");
-
- // saveAndReload save the file to a temporary directory
- // the link must be changed to point to that directory
- utl::TempFile aTempFile;
- auto aTempFilename = aTempFile.GetURL();
- auto nIdxOfTmpFile = aTempFilename.lastIndexOf('/');
- aTempFilename = aTempFilename.copy(0, nIdxOfTmpFile + 1);
-
- aFormula = aFormula.replaceAt(nIdxOfFile, nIdxOfFilename - nIdxOfFile, aTempFilename);
- rDoc.SetFormula(ScAddress(3, 1, 0), aFormula, formula::FormulaGrammar::GRAM_NATIVE_UI);
-
- // tdf#138832: test the same thing with singleref link
- rDoc.GetFormula(3, 2, 0, aFormula);
- nIdxOfFilename = aFormula.indexOf("tdf132105_external.ods");
- aFormula = aFormula.replaceAt(nIdxOfFilename, 22, "87973_externalSource.ods");
- nIdxOfFile = aFormula.indexOf("file");
-
- aFormula = aFormula.replaceAt(nIdxOfFile, nIdxOfFilename - nIdxOfFile, aTempFilename);
- rDoc.SetFormula(ScAddress(3, 2, 0), aFormula, formula::FormulaGrammar::GRAM_NATIVE_UI);
-
- // save and load back
- ScDocShellRef pDocSh = saveAndReload(&(*pShell), FORMAT_XLSX);
- CPPUNIT_ASSERT(pDocSh.is());
-
- // check if the new filename is present in the link (and not replaced by '[2]')
- ScDocument& rDoc2 = pDocSh->GetDocument();
- rDoc2.GetFormula(3, 1, 0, aFormula2);
- CPPUNIT_ASSERT(aFormula2.indexOf("tdf132105_external.ods") < 0);
- CPPUNIT_ASSERT(aFormula2.indexOf("87973_externalSource.ods") >= 0);
- rDoc2.GetFormula(3, 2, 0, aFormula2);
- CPPUNIT_ASSERT(aFormula2.indexOf("tdf132105_external.ods") < 0);
- CPPUNIT_ASSERT(aFormula2.indexOf("87973_externalSource.ods") >= 0);
-
- pDocSh->DoClose();
-}
-
-void ScExportTest::testTdf51022_lostPrintRange()
-{
- ScDocShellRef pShell = loadDoc(u"tdf87973_externalLinkSkipUnuseds.", FORMAT_ODS);
- CPPUNIT_ASSERT(pShell.is());
-
- pShell->ReloadAllLinks();
- ScDocument& rDoc = pShell->GetDocument();
-
- //Add print ranges
- ScRange aRange1(1, 2, 0, 3, 4, 0);
- ScRange aRange2(1, 6, 0, 3, 7, 0);
- rDoc.AddPrintRange(0, aRange1);
- rDoc.AddPrintRange(0, aRange2);
-
- // save and load back
- ScDocShellRef pDocSh = saveAndReload(&(*pShell), FORMAT_ODS);
- CPPUNIT_ASSERT(pDocSh.is());
-
- // check if the same print ranges are present
- ScDocument& rDoc2 = pDocSh->GetDocument();
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(2), rDoc2.GetPrintRangeCount(0));
- CPPUNIT_ASSERT_EQUAL(aRange1, *rDoc2.GetPrintRange(0, 0));
- CPPUNIT_ASSERT_EQUAL(aRange2, *rDoc2.GetPrintRange(0, 1));
-
- pDocSh->DoClose();
-}
-
-void ScExportTest::testTdf138741_externalLinkSkipUnusedsCrash()
-{
- ScDocShellRef xShell = loadDoc(u"tdf138741_externalLinkSkipUnusedsCrash.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xShell);
-
- //without the fix in place, it would have crashed at export time
- ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
-
- xShell->DoClose();
-}
-
-void ScExportTest::testTdf138824_linkToParentDirectory()
-{
- ScDocShellRef xShell = loadDoc(u"childDir/tdf138824_linkToParentDirectory.", FORMAT_ODS);
- CPPUNIT_ASSERT(xShell.is());
-
- ScDocument& rDoc = xShell->GetDocument();
-
- // saveAndReload save the file to a temporary directory
- // the link must be changed to point to that parent directory
- utl::TempFile aTempFile;
- auto aTempFilename = aTempFile.GetURL();
- auto nIdxOfTmpFile = aTempFilename.lastIndexOf('/');
- nIdxOfTmpFile = aTempFilename.lastIndexOf('/', nIdxOfTmpFile);
- aTempFilename = aTempFilename.copy(0, nIdxOfTmpFile + 1);
-
- // change external link to tmp directory
- OUString aFormula;
- rDoc.GetFormula(3, 1, 0, aFormula);
- auto nIdxOfFilename = aFormula.indexOf("tdf138824_externalSource.ods");
- auto nIdxOfFile = aFormula.indexOf("file");
-
- aFormula = aFormula.replaceAt(nIdxOfFile, nIdxOfFilename - nIdxOfFile, aTempFilename);
- rDoc.SetFormula(ScAddress(3, 1, 0), aFormula, formula::FormulaGrammar::GRAM_NATIVE_UI);
-
- ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile
- = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
- xmlDocUniquePtr pDoc = XPathHelper::parseExport(
- pXPathFile, m_xSFactory, "xl/externalLinks/_rels/externalLink1.xml.rels");
- CPPUNIT_ASSERT(pDoc);
-
- // test also the Linux specific bug tdf#121472
- assertXPath(pDoc, "/r:Relationships/r:Relationship", "Target",
- "../tdf138824_externalSource.ods");
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf129969()
-{
- ScDocShellRef xShell = loadDoc(u"external_hyperlink.", FORMAT_ODS);
- CPPUNIT_ASSERT(xShell.is());
-
- ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
- CPPUNIT_ASSERT(xDocSh.is());
- ScDocument& rDoc = xDocSh->GetDocument();
- ScAddress aPos(0, 0, 0);
- const EditTextObject* pEditText = rDoc.GetEditText(aPos);
- const SvxFieldData* pData = pEditText->GetFieldData(0, 0, text::textfield::Type::URL);
- const SvxURLField* pURLData = static_cast<const SvxURLField*>(pData);
- CPPUNIT_ASSERT(pURLData->GetURL().endsWith("/%23folder/test.ods#Sheet2.B10"));
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf84874()
-{
- ScDocShellRef xShell = loadDoc(u"tdf84874.", FORMAT_ODS);
- CPPUNIT_ASSERT(xShell.is());
-
- ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
- xShell->DoClose();
- CPPUNIT_ASSERT(xDocSh.is());
-
- ScDocument& rDoc = xDocSh->GetDocument();
-
- const ScValidationData* pData = rDoc.GetValidationEntry(1);
- OUString aTitle, aText;
- pData->GetInput(aTitle, aText);
- sal_uInt32 nPromptTitleLen = aTitle.getLength();
- sal_uInt32 nPromptTextLen = aText.getLength();
-
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(255), nPromptTitleLen);
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(255), nPromptTextLen);
-
- ScValidErrorStyle eErrStyle = SC_VALERR_STOP;
- pData->GetErrMsg(aTitle, aText, eErrStyle);
- sal_uInt32 nErrorTitleLen = aTitle.getLength();
- sal_uInt32 nErrorTextLen = aText.getLength();
-
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(255), nErrorTitleLen);
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(255), nErrorTextLen);
-
- xDocSh->DoClose();
-}
-
-void ScExportTest::testTdf136721_paper_size()
-{
- ScDocShellRef xShell = loadDoc(u"tdf136721_letter_sized_paper.", FORMAT_XLSX);
- CPPUNIT_ASSERT(xShell.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
- xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
- CPPUNIT_ASSERT(pDoc);
-
- assertXPath(pDoc, "/x:worksheet/x:pageSetup", "paperSize", "70");
-}
-
-void ScExportTest::testTdf139258_rotated_image()
-{
- // Check that the topleft position of the image is correct.
- ScDocShellRef xShell = loadDoc(u"tdf139258_rotated_image.", FORMAT_ODS);
- CPPUNIT_ASSERT(xShell.is());
-
- std::shared_ptr<utl::TempFile> pXPathFile
- = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
-
- xmlDocUniquePtr pDrawing
- = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml");
- CPPUNIT_ASSERT(pDrawing);
-
- assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:from/xdr:col", "1");
- assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:from/xdr:row", "12");
- assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:to/xdr:col", "6");
- assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:to/xdr:row", "25");
-}
-
-ScDocShellRef ScExportTest::loadDocAndSetupModelViewController(std::u16string_view rFileName, sal_Int32 nFormat, bool bReadWrite)
-{
- uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(::comphelper::getProcessComponentContext());
- CPPUNIT_ASSERT(xDesktop.is());
-
- // create a frame
- Reference< frame::XFrame > xTargetFrame = xDesktop->findFrame("_blank", 0);
- CPPUNIT_ASSERT(xTargetFrame.is());
-
- // 1. Open the document
- ScDocShellRef xDocSh = loadDoc(rFileName, nFormat, bReadWrite);
- CPPUNIT_ASSERT_MESSAGE(OString("Failed to load " + OUStringToOString(rFileName, RTL_TEXTENCODING_UTF8)).getStr(), xDocSh.is());
-
- uno::Reference< frame::XModel2 > xModel2 = xDocSh->GetModel();
- CPPUNIT_ASSERT(xModel2.is());
-
- Reference< frame::XController2 > xController = xModel2->createDefaultViewController(xTargetFrame);
- CPPUNIT_ASSERT(xController.is());
-
- // introduce model/view/controller to each other
- xController->attachModel(xModel2);
- xModel2->connectController(xController);
- xTargetFrame->setComponent(xController->getComponentWindow(), xController);
- xController->attachFrame(xTargetFrame);
- xModel2->setCurrentController(xController);
-
- return xDocSh;
-}
-
-void ScExportTest::testTdf126541_SheetVisibilityImportXlsx()
-{
- // Import an ods file with 'Hide' global grid visibility setting.
- ScDocShellRef xShell = loadDocAndSetupModelViewController(u"tdf126541_GridOffGlobally.", FORMAT_ODS, true);
- CPPUNIT_ASSERT(!xShell->GetDocument().GetViewOptions().GetOption(VOPT_GRID));
-
- // Importing xlsx file should set the global grid visibility setting to 'Show'
- // Sheet based grid line visibility setting should not overwrite the global setting.
- xShell = loadDocAndSetupModelViewController(u"tdf126541_GridOff.", FORMAT_XLSX, true);
- CPPUNIT_ASSERT(xShell->GetDocument().GetViewOptions().GetOption(VOPT_GRID));
-}
-
void ScExportTest::testTdf113646()
{
ScDocShellRef xShell = loadDoc(u"tdf113646.", FORMAT_ODS);
diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx
new file mode 100644
index 000000000000..5bfcaf0778fe
--- /dev/null
+++ b/sc/qa/unit/subsequent_export-test2.cxx
@@ -0,0 +1,2301 @@
+
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sal/config.h>
+
+#include <string_view>
+
+#include <officecfg/Office/Common.hxx>
+#include <config_features.h>
+
+#include <sfx2/sfxmodelfactory.hxx>
+
+#include "helper/debughelper.hxx"
+#include "helper/qahelper.hxx"
+#include "helper/xpath.hxx"
+#include "helper/shared_test_impl.hxx"
+
+#include <userdat.hxx>
+#include <docsh.hxx>
+#include <patattr.hxx>
+#include <docpool.hxx>
+#include <scitems.hxx>
+#include <attrib.hxx>
+#include <stlpool.hxx>
+#include <document.hxx>
+#include <formulacell.hxx>
+#include <tokenarray.hxx>
+#include <editutil.hxx>
+#include <scopetools.hxx>
+#include <cellvalue.hxx>
+#include <postit.hxx>
+#include <tokenstringcontext.hxx>
+#include <chgtrack.hxx>
+#include <validat.hxx>
+#include <global.hxx>
+#include <scmod.hxx>
+#include <dpcache.hxx>
+#include <dpobject.hxx>
+#include <clipparam.hxx>
+#include <viewopti.hxx>
+
+#include <svx/svdpage.hxx>
+#include <svx/svdograf.hxx>
+#include <tabprotection.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/editdata.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/section.hxx>
+#include <editeng/crossedoutitem.hxx>
+#include <editeng/borderline.hxx>
+#include <editeng/escapementitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/flditem.hxx>
+#include <editeng/colritem.hxx>
+#include <formula/grammar.hxx>
+#include <unotools/useroptions.hxx>
+#include <comphelper/scopeguard.hxx>
+#include <unotools/syslocaleoptions.hxx>
+#include <tools/datetime.hxx>
+#include <tools/fldunit.hxx>
+#include <svl/zformat.hxx>
+
+#include <test/xmltesttools.hxx>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/graphic/GraphicType.hpp>
+#include <com/sun/star/sheet/GlobalSheetSettings.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+class ScExportTest2 : public ScBootstrapFixture, public XmlTestTools
+{
+protected:
+ virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override;
+
+public:
+ ScExportTest2();
+
+ virtual void setUp() override;
+ virtual void tearDown() override;
+
+ void testMatrixMultiplicationXLSX();
+ void testTextDirectionXLSX();
+ void testTdf120168();
+ void testTdf66668();
+ void testTdf130108();
+ void testTdf76949();
+ void testTdf107586();
+ void testTdf55417();
+ void testTdf129985();
+ void testTdf73063();
+
+ xmlDocUniquePtr testTdf95640(std::u16string_view rFileName, sal_Int32 nSourceFormat,
+ sal_Int32 nDestFormat);
+ void testTdf95640_ods_to_xlsx();
+ void testTdf95640_ods_to_xlsx_with_standard_list();
+ void testTdf95640_xlsx_to_xlsx();
+ void testDateAutofilterXLSX();
+ void testDateAutofilterODS();
+ void testAutofilterColorsODF();
+ void testAutofilterColorsOOXML();
+ void testAutofilterColorsStyleOOXML();
+
+ void testRefStringXLSX();
+ void testRefStringConfigXLSX();
+ void testRefStringUnspecified();
+ void testHeaderImageODS();
+
+ void testTdf88657ODS();
+ void testTdf41722();
+ void testTdf113621();
+ void testEscapeCharInNumberFormatXLSX();
+ void testNatNumInNumberFormatXLSX();
+ void testExponentWithoutSignFormatXLSX();
+ void testExtendedLCIDXLSX();
+
+ void testHiddenRepeatedRowsODS();
+ void testHyperlinkTargetFrameODS();
+ void testOpenDocumentAsReadOnly();
+ void testKeepSettingsOfBlankRows();
+
+ void testTdf133595();
+ void testTdf134769();
+ void testTdf106181();
+ void testTdf105272();
+ void testTdf118990();
+ void testTdf121612();
+ void testTdf112936();
+ void testPivotCacheAfterExportXLSX();
+ void testTdf114969XLSX();
+ void testTdf115192XLSX();
+ void testTdf91634XLSX();
+ void testTdf115159();
+ void testTdf112567();
+ void testTdf112567b();
+ void testTdf123645XLSX();
+ void testTdf125173XLSX();
+ void testTdf79972XLSX();
+ void testTdf126024XLSX();
+ void testTdf126177XLSX();
+ void testCommentTextVAlignment();
+ void testCommentTextHAlignment();
+ void testValidationCopyPaste();
+
+ void testXltxExport();
+ void testRotatedImageODS();
+ void testTdf128976();
+ void testTdf120502();
+ void testTdf131372();
+ void testTdf81470();
+ void testTdf122331();
+ void testTdf83779();
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list