[Libreoffice-commits] core.git: sc/source sw/qa
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Feb 12 15:45:47 UTC 2019
sc/source/filter/excel/xelink.cxx | 4 ++
sc/source/ui/view/scextopt.cxx | 2 -
sw/qa/extras/ooxmlexport/data/tdf122594.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 37 +++++++++++++++++++++++++++
4 files changed, 42 insertions(+), 1 deletion(-)
New commits:
commit b3d88a0875efcbc3efcabeef743ff0dc4d8cf686
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Tue Feb 12 15:14:01 2019 +0100
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Tue Feb 12 16:45:24 2019 +0100
tdf#122594 XLSX OLE in DOCX: export ActiveTable
(visible sheet) of an embedded spreadsheet,
instead of exporting always the first sheet.
Change-Id: I5c6f982b1b814a5f3830f08d247f4db3fdc3c384
Reviewed-on: https://gerrit.libreoffice.org/67733
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index 63e70d5a6bfa..084277320706 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -727,6 +727,10 @@ XclExpTabInfo::XclExpTabInfo( const XclExpRoot& rRoot ) :
SCTAB nDisplScTab = rDocOpt.GetDocSettings().mnDisplTab;
+ // missing viewdata at embedded XLSX OLE objects
+ if (nDisplScTab == -1 )
+ nDisplScTab = rDoc.GetVisibleTab();
+
// find first visible exported sheet
if( (nFirstVisScTab == SCTAB_INVALID) || !IsExportTab( nFirstVisScTab ) )
{
diff --git a/sc/source/ui/view/scextopt.cxx b/sc/source/ui/view/scextopt.cxx
index 38b08bd58545..167b75d721ab 100644
--- a/sc/source/ui/view/scextopt.cxx
+++ b/sc/source/ui/view/scextopt.cxx
@@ -28,7 +28,7 @@
ScExtDocSettings::ScExtDocSettings() :
mfTabBarWidth( -1.0 ),
mnLinkCnt( 0 ),
- mnDisplTab( 0 )
+ mnDisplTab( -1 )
{
}
diff --git a/sw/qa/extras/ooxmlexport/data/tdf122594.docx b/sw/qa/extras/ooxmlexport/data/tdf122594.docx
new file mode 100644
index 000000000000..847d8ef590b5
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf122594.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index a91fe0c3b67b..7f485a1f2847 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -947,6 +947,43 @@ DECLARE_OOXMLEXPORT_TEST(testTdf122563, "tdf122563.docx")
"width:255.75pt;height:63.75pt");
}
+DECLARE_OOXMLEXPORT_TEST(testTdf122594, "tdf122594.docx")
+{
+ // test import/export of ActiveTable (visible sheet) of embedded XLSX OLE objects
+ uno::Reference<text::XTextEmbeddedObjectsSupplier> xEmbeddedObjectsSupplier(mxComponent,
+ uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xObjects(xEmbeddedObjectsSupplier->getEmbeddedObjects(),
+ uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xObjects->getCount());
+
+ uno::Reference<beans::XPropertySet> xSheets;
+ xObjects->getByIndex(0) >>= xSheets;
+
+ uno::Reference<frame::XModel> xModel;
+ xSheets->getPropertyValue("Model") >>= xModel;
+ uno::Reference<document::XViewDataSupplier> xViewDataSupplier(xModel, uno::UNO_QUERY);
+
+ uno::Reference<container::XIndexAccess> xIndexAccess(xViewDataSupplier->getViewData());
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xIndexAccess->getCount());
+
+ uno::Sequence<beans::PropertyValue> aSeq;
+ if (xIndexAccess->getByIndex(0) >>= aSeq)
+ {
+ sal_Int32 nCount(aSeq.getLength());
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ {
+ OUString sName(aSeq[i].Name);
+ if (sName == "ActiveTable")
+ {
+ OUString sTabName;
+ if (aSeq[i].Value >>= sTabName)
+ // Sheet2, not Sheet1
+ CPPUNIT_ASSERT_EQUAL(OUString("Munka2"), sTabName);
+ }
+ }
+ }
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list