[Libreoffice-commits] .: 2 commits - sc/qa sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Aug 14 14:18:17 PDT 2012
sc/qa/unit/data/ods/cell-anchored-shapes.ods |binary
sc/qa/unit/subsequent_filters-test.cxx | 41 +++++++++++++++++++++++++++
sc/source/filter/xml/xmlimprt.cxx | 3 +
3 files changed, 44 insertions(+)
New commits:
commit a7a12bd3dee32db44a6b50a68ab700dc8ce437df
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Aug 14 17:16:18 2012 -0400
New unit test for importing cell-anchored shapes from ods.
Change-Id: I3cedafaf1862c69a40a7973ed056bf595f9e7d20
diff --git a/sc/qa/unit/data/ods/cell-anchored-shapes.ods b/sc/qa/unit/data/ods/cell-anchored-shapes.ods
new file mode 100644
index 0000000..5a006f6
Binary files /dev/null and b/sc/qa/unit/data/ods/cell-anchored-shapes.ods differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 8d6a804..95009ac 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -38,6 +38,7 @@
#include <sfx2/docfile.hxx>
#include <sfx2/sfxmodelfactory.hxx>
#include <svl/stritem.hxx>
+#include "svx/svdpage.hxx"
#include <editeng/brshitem.hxx>
#include <editeng/justifyitem.hxx>
@@ -45,6 +46,8 @@
#include <dbdata.hxx>
#include "validat.hxx"
#include "cell.hxx"
+#include "drwlayer.hxx"
+#include "userdat.hxx"
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/drawing/XControlShape.hpp>
@@ -151,6 +154,8 @@ public:
void testNumberFormatHTML();
void testNumberFormatCSV();
+ void testCellAnchoredShapesODS();
+
CPPUNIT_TEST_SUITE(ScFiltersTest);
CPPUNIT_TEST(testRangeNameXLS);
CPPUNIT_TEST(testRangeNameXLSX);
@@ -187,6 +192,8 @@ public:
CPPUNIT_TEST(testNumberFormatHTML);
CPPUNIT_TEST(testNumberFormatCSV);
+ CPPUNIT_TEST(testCellAnchoredShapesODS);
+
//disable testPassword on MacOSX due to problems with libsqlite3
//also crashes on DragonFly due to problems with nss/nspr headers
#if !defined(MACOSX) && !defined(DRAGONFLY) && !defined(WNT)
@@ -1243,6 +1250,40 @@ void ScFiltersTest::testNumberFormatCSV()
xDocSh->DoClose();
}
+void ScFiltersTest::testCellAnchoredShapesODS()
+{
+ OUString aFileNameBase("cell-anchored-shapes.");
+ OUString aFileExt = OUString::createFromAscii(aFileFormats[ODS].pName);
+ OUString aFilterName = OUString::createFromAscii(aFileFormats[ODS].pFilterName);
+ OUString aFilterType = OUString::createFromAscii(aFileFormats[ODS].pTypeName);
+
+ rtl::OUString aFileName;
+ createFileURL(aFileNameBase, aFileExt, aFileName);
+ ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[ODS].nFormatType);
+ CPPUNIT_ASSERT_MESSAGE("Failed to load cell-anchored-shapes.ods", xDocSh.Is());
+
+ // There are two cell-anchored objects on the first sheet.
+ ScDocument* pDoc = xDocSh->GetDocument();
+
+ CPPUNIT_ASSERT_MESSAGE("There should be at least one sheet.", pDoc->GetTableCount() > 0);
+
+ ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ SdrPage* pPage = pDrawLayer->GetPage(0);
+ CPPUNIT_ASSERT_MESSAGE("draw page for sheet 1 should exist.", pPage);
+ sal_uIntPtr nCount = pPage->GetObjCount();
+ CPPUNIT_ASSERT_MESSAGE("There should be 2 objects.", nCount == 2);
+ for (sal_uIntPtr i = 0; i < nCount; ++i)
+ {
+ SdrObject* pObj = pPage->GetObj(i);
+ CPPUNIT_ASSERT_MESSAGE("Failed to get drawing object.", pObj);
+ ScDrawObjData* pData = ScDrawLayer::GetObjData(pObj, false);
+ CPPUNIT_ASSERT_MESSAGE("Failed to retrieve user data for this object.", pData);
+ CPPUNIT_ASSERT_MESSAGE("Bounding rectangle should have been calculated upon import.", !pData->maLastRect.IsEmpty());
+ }
+
+ xDocSh->DoClose();
+}
+
void ScFiltersTest::testColorScale()
{
const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM("colorScale."));
commit 4606ca07de17c930b658206a19446516cf0d4eb7
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Aug 14 16:46:44 2012 -0400
Calculate positions of cell-anchored objects upon ods import.
Since we no longer re-calc row heights on ods import, we need to do
this manually, in order to position cell-anchored objects correctly.
Previously we were getting this for free since the row height recalc
code path did it as part of it.
Change-Id: I8ab5dd1fe7cd8a45b7968e101c893b442d7ce132
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index dcf37b4..4f2ff59 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -3101,8 +3101,11 @@ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeE
SCTAB nTabCount = pDoc->GetTableCount();
for (SCTAB nTab=0; nTab<nTabCount; ++nTab)
+ {
+ pDoc->SetDrawPageSize(nTab);
if (!pSheetData->IsSheetBlocked( nTab ))
pDoc->SetStreamValid( nTab, true );
+ }
}
aTables.FixupOLEs();
}
More information about the Libreoffice-commits
mailing list