summaryrefslogtreecommitdiff
path: root/sc/source/filter/oox
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2019-02-15 13:02:11 +0100
committerLászló Németh <nemeth@numbertext.org>2019-02-18 23:58:37 +0100
commit6fb9ef15aa67b91dec016873ad8224db2323291c (patch)
tree970c9187ac1509abf8023c6e7d723186ca808b85 /sc/source/filter/oox
parent7c37137b807df3d4859d9029fc3a246db216399e (diff)
tdf#122624 XLSX OLE in DOCX: import view positions
of the visible sheet of an embedded spreadsheet, instead of showing always the first column and row. Change-Id: I7b712d97f152da3cecf8371e21cf0a82ef21f199 Reviewed-on: https://gerrit.libreoffice.org/67867 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sc/source/filter/oox')
-rw-r--r--sc/source/filter/oox/workbookhelper.cxx35
1 files changed, 31 insertions, 4 deletions
diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx
index 5aa60f2f932e..1ed50e0d17c0 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -720,7 +720,7 @@ void WorkbookHelper::finalizeWorkbookImport()
getScDocument().SetCalcConfig(aCalcConfig);
}
- // set selected sheet
+ // set selected sheet and positionleft/positiontop for OLE objects
Reference<XViewDataSupplier> xViewDataSupplier(getDocument(), UNO_QUERY);
if (xViewDataSupplier.is())
{
@@ -730,20 +730,47 @@ void WorkbookHelper::finalizeWorkbookImport()
Sequence< PropertyValue > aSeq;
if (xIndexAccess->getByIndex(0) >>= aSeq)
{
+ OUString sTabName;
+ Reference< XNameAccess > xSheetsNC;
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;
+ }
+ }
+ else if (sName == SC_TABLES)
+ {
+ aSeq[i].Value >>= xSheetsNC;
+ }
+ }
+ if (xSheetsNC.is() && xSheetsNC->hasByName(sTabName))
+ {
+ Sequence<PropertyValue> aProperties;
+ Any aAny = xSheetsNC->getByName(sTabName);
+ if ( aAny >>= aProperties )
+ {
+ nCount = aProperties.getLength();
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ {
+ OUString sName(aProperties[i].Name);
+ if (sName == SC_POSITIONLEFT)
+ {
+ SCCOL nPosLeft;
+ aProperties[i].Value >>= nPosLeft;
+ getScDocument().SetPosLeft(nPosLeft);
+ }
+ else if (sName == SC_POSITIONTOP)
+ {
+ SCROW nPosTop;
+ aProperties[i].Value >>= nPosTop;
+ getScDocument().SetPosTop(nPosTop);
}
}
}