[Libreoffice-commits] core.git: sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Feb 7 20:04:04 UTC 2019
sc/source/filter/oox/workbookhelper.cxx | 36 ++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
New commits:
commit 70ab6ff7c22ce850c9041bfeeeaba7038011a0a7
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Thu Feb 7 19:44:11 2019 +0100
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Thu Feb 7 21:03:40 2019 +0100
tdf#122594 OLE import in DOCX: show selected sheet
of an embedded XLSX OLE object, instead of showing
always the first sheet.
Change-Id: I583a17dc8a3cd06ee15fbbb950328f0b9b164a63
Reviewed-on: https://gerrit.libreoffice.org/67516
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index 87b5fe016e39..5aa60f2f932e 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -20,6 +20,7 @@
#include <workbookhelper.hxx>
#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <com/sun/star/sheet/XDatabaseRanges.hpp>
@@ -29,6 +30,7 @@
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XViewDataSupplier.hpp>
#include <osl/thread.h>
#include <oox/helper/progressbar.hxx>
#include <oox/helper/propertyset.hxx>
@@ -71,6 +73,7 @@
#include <editutil.hxx>
#include <editeng/editstat.hxx>
#include <unotools/charclass.hxx>
+#include <ViewSettingsSequenceDefines.hxx>
#include <memory>
@@ -84,6 +87,7 @@ using namespace ::com::sun::star::sheet;
using namespace ::com::sun::star::style;
using namespace ::com::sun::star::table;
using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
using ::oox::core::FilterBase;
using ::oox::core::FragmentHandler;
@@ -715,6 +719,38 @@ void WorkbookHelper::finalizeWorkbookImport()
aCalcConfig.meStringRefAddressSyntax = formula::FormulaGrammar::CONV_A1_XL_A1;
getScDocument().SetCalcConfig(aCalcConfig);
}
+
+ // set selected sheet
+ Reference<XViewDataSupplier> xViewDataSupplier(getDocument(), UNO_QUERY);
+ if (xViewDataSupplier.is())
+ {
+ Reference<XIndexAccess> xIndexAccess(xViewDataSupplier->getViewData());
+ if (xIndexAccess.is() && xIndexAccess->getCount() > 0)
+ {
+ Sequence< 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 == SC_ACTIVETABLE)
+ {
+ OUString sTabName;
+ if(aSeq[i].Value >>= sTabName)
+ {
+ SCTAB nTab(0);
+ if (getScDocument().GetTable(sTabName, nTab))
+ {
+ getScDocument().SetVisibleTab(nTab);
+ i = nCount;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
// document model -------------------------------------------------------------
More information about the Libreoffice-commits
mailing list