[Libreoffice-commits] core.git: sc/source sw/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Feb 19 00:14:36 UTC 2019


 sc/source/filter/excel/xeview.cxx          |   14 ++++++++++++++
 sc/source/ui/unoobj/docuno.cxx             |    8 +++++++-
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx |   21 +++++++++++++++++++++
 3 files changed, 42 insertions(+), 1 deletion(-)

New commits:
commit 3707e2a7b8b05617b0afb75374f866c967593861
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Mon Feb 18 18:29:51 2019 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Tue Feb 19 01:14:12 2019 +0100

    tdf#122624 XLSX OLE in DOCX: export view positions
    
    of the visible sheet of an embedded spreadsheet,
    instead of exporting always the first column and row.
    
    Change-Id: Iaf87bfc5b7658cd4d64cb9c83c50bbf66fd6e7f0
    Reviewed-on: https://gerrit.libreoffice.org/67982
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sc/source/filter/excel/xeview.cxx b/sc/source/filter/excel/xeview.cxx
index 766601c66206..d4f9f19b08fb 100644
--- a/sc/source/filter/excel/xeview.cxx
+++ b/sc/source/filter/excel/xeview.cxx
@@ -419,6 +419,20 @@ void XclExpTabViewSettings::SaveXml( XclExpXmlStream& rStrm )
 {
     sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
     rWorksheet->startElement( XML_sheetViews, FSEND );
+
+    // handle missing viewdata at embedded XLSX OLE objects
+    if (maData.mbSelected)
+    {
+        SCCOL nPosLeft = rStrm.GetRoot().GetDoc().GetPosLeft();
+        SCROW nPosTop = rStrm.GetRoot().GetDoc().GetPosTop();
+        if (nPosLeft > 0 || nPosTop > 0)
+        {
+            ScAddress aLeftTop(nPosLeft, nPosTop, 0);
+            XclExpAddressConverter& rAddrConv = GetAddressConverter();
+            maData.maFirstXclPos = rAddrConv.CreateValidAddress( aLeftTop, false );
+        }
+    }
+
     rWorksheet->startElement( XML_sheetView,
             // OOXTODO: XML_windowProtection,
             XML_showFormulas,               ToPsz( maData.mbShowFormulas ),
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 497e1454b632..ae8bd965f0b2 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -2443,12 +2443,18 @@ uno::Reference< container::XIndexAccess > SAL_CALL ScModelObj::getViewData(  )
             xRet.set( xCont, uno::UNO_QUERY_THROW );
 
             uno::Sequence< beans::PropertyValue > aSeq;
-            aSeq.realloc(1);
+            aSeq.realloc(3);
             OUString sName;
             pDocShell->GetDocument().GetName( pDocShell->GetDocument().GetVisibleTab(), sName );
             OUString sOUName(sName);
             aSeq[0].Name = SC_ACTIVETABLE;
             aSeq[0].Value <<= sOUName;
+            SCCOL nPosLeft = pDocShell->GetDocument().GetPosLeft();
+            aSeq[1].Name = SC_POSITIONLEFT;
+            aSeq[1].Value <<= nPosLeft;
+            SCROW nPosTop = pDocShell->GetDocument().GetPosTop();
+            aSeq[2].Name = SC_POSITIONTOP;
+            aSeq[2].Value <<= nPosTop;
             xCont->insertByIndex( 0, uno::makeAny( aSeq ) );
         }
     }
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index 7f485a1f2847..797c2d1e8884 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -967,6 +967,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf122594, "tdf122594.docx")
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xIndexAccess->getCount());
 
     uno::Sequence<beans::PropertyValue> aSeq;
+    sal_Int32 nCheck = 0;
     if (xIndexAccess->getByIndex(0) >>= aSeq)
     {
         sal_Int32 nCount(aSeq.getLength());
@@ -977,11 +978,31 @@ DECLARE_OOXMLEXPORT_TEST(testTdf122594, "tdf122594.docx")
             {
                 OUString sTabName;
                 if (aSeq[i].Value >>= sTabName)
+                {
                     // Sheet2, not Sheet1
                     CPPUNIT_ASSERT_EQUAL(OUString("Munka2"), sTabName);
+                    nCheck++;
+                }
+            }
+            // tdf#122624 column and row viewarea positions
+            else if (sName == "PositionLeft")
+            {
+                sal_Int32 nPosLeft;
+                aSeq[i].Value >>= nPosLeft;
+                CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), nPosLeft);
+                nCheck++;
+            }
+            else if (sName == "PositionTop")
+            {
+                sal_Int32 nPosTop;
+                aSeq[i].Value >>= nPosTop;
+                CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), nPosTop);
+                nCheck++;
             }
         }
     }
+
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), nCheck);
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list