Kaydet (Commit) 70ab6ff7 authored tarafından László Németh's avatar László Németh

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: 's avatarLászló Németh <nemeth@numbertext.org>
üst 66850d9e
......@@ -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 -------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment