[Libreoffice-commits] core.git: 3 commits - sc/inc sc/qa sc/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Mon Jun 3 14:43:34 PDT 2013
sc/inc/olinetab.hxx | 4 +-
sc/qa/unit/data/ods/outline.ods |binary
sc/qa/unit/subsequent_filters-test.cxx | 56 +++++++++++++++++++++++++++++++++
sc/source/filter/xml/xmlrowi.cxx | 10 ++---
sc/source/filter/xml/xmlrowi.hxx | 7 +---
5 files changed, 65 insertions(+), 12 deletions(-)
New commits:
commit 30f2fa988fa9ed52bd2db693e099ab2c7f4efdf5
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Jun 3 23:34:36 2013 +0200
move these two variables from member variables to normal variables
Change-Id: Ie57cf12a3dc0984367c34dc4f52fd00036cf3d9d
diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx
index f6b1ae05..548eafc 100644
--- a/sc/source/filter/xml/xmlrowi.cxx
+++ b/sc/source/filter/xml/xmlrowi.cxx
@@ -221,9 +221,7 @@ ScXMLTableRowsContext::ScXMLTableRowsContext( ScXMLImport& rImport,
const bool bTempHeader, const bool bTempGroup ) :
SvXMLImportContext( rImport, nPrfx, rLName ),
nHeaderStartRow(0),
- nHeaderEndRow(0),
nGroupStartRow(0),
- nGroupEndRow(0),
bHeader(bTempHeader),
bGroup(bTempGroup),
bGroupDisplay(true)
@@ -302,7 +300,7 @@ void ScXMLTableRowsContext::EndElement()
ScXMLImport& rXMLImport(GetScImport());
if (bHeader)
{
- nHeaderEndRow = rXMLImport.GetTables().GetCurrentRow();
+ SCROW nHeaderEndRow = rXMLImport.GetTables().GetCurrentRow();
if (nHeaderStartRow <= nHeaderEndRow)
{
uno::Reference <sheet::XPrintAreas> xPrintAreas (rXMLImport.GetTables().GetCurrentXSheet(), uno::UNO_QUERY);
@@ -327,7 +325,7 @@ void ScXMLTableRowsContext::EndElement()
}
else if (bGroup)
{
- nGroupEndRow = rXMLImport.GetTables().GetCurrentRow();
+ SCROW nGroupEndRow = rXMLImport.GetTables().GetCurrentRow();
SCTAB nSheet(rXMLImport.GetTables().GetCurrentSheet());
if (nGroupStartRow <= nGroupEndRow)
{
diff --git a/sc/source/filter/xml/xmlrowi.hxx b/sc/source/filter/xml/xmlrowi.hxx
index c24a103..83e13d5 100644
--- a/sc/source/filter/xml/xmlrowi.hxx
+++ b/sc/source/filter/xml/xmlrowi.hxx
@@ -21,6 +21,7 @@
#include <xmloff/xmlictxt.hxx>
#include <xmloff/xmlimp.hxx>
+#include "address.hxx"
class ScXMLImport;
@@ -53,10 +54,8 @@ public:
class ScXMLTableRowsContext : public SvXMLImportContext
{
- sal_Int32 nHeaderStartRow;
- sal_Int32 nHeaderEndRow;
- sal_Int32 nGroupStartRow;
- sal_Int32 nGroupEndRow;
+ SCROW nHeaderStartRow;
+ SCROW nGroupStartRow;
bool bHeader;
bool bGroup;
bool bGroupDisplay;
commit ebd70ae1d84eed5e5311fcc018a122be2e8719d4
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Jun 3 23:31:34 2013 +0200
add test case for outline import from ODS
Change-Id: I60f92dd13282281d77571e41707d68ae55722d9b
diff --git a/sc/inc/olinetab.hxx b/sc/inc/olinetab.hxx
index 0432465..42c565f 100644
--- a/sc/inc/olinetab.hxx
+++ b/sc/inc/olinetab.hxx
@@ -41,7 +41,7 @@ public:
ScOutlineEntry( SCCOLROW nNewStart, SCCOLROW nNewSize, bool bNewHidden = false );
ScOutlineEntry( const ScOutlineEntry& rEntry );
- SCCOLROW GetStart() const;
+ SC_DLLPUBLIC SCCOLROW GetStart() const;
SCSIZE GetSize() const;
SC_DLLPUBLIC SCCOLROW GetEnd() const;
@@ -53,7 +53,7 @@ public:
/**
* @return true if the control is visible, false otherwise.
*/
- bool IsVisible() const;
+ SC_DLLPUBLIC bool IsVisible() const;
void Move( SCsCOLROW nDelta );
void SetSize( SCSIZE nNewSize );
diff --git a/sc/qa/unit/data/ods/outline.ods b/sc/qa/unit/data/ods/outline.ods
new file mode 100644
index 0000000..bca7d14
Binary files /dev/null and b/sc/qa/unit/data/ods/outline.ods differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index e963bdd..17bfc32 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -40,6 +40,7 @@
#include "docfunc.hxx"
#include "markdata.hxx"
#include "colorscale.hxx"
+#include "olinetab.hxx"
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/drawing/XControlShape.hpp>
@@ -137,6 +138,7 @@ public:
void testOptimalHeightReset();
void testPrintRangeODS();
+ void testOutlineODS();
CPPUNIT_TEST_SUITE(ScFiltersTest);
CPPUNIT_TEST(testBasicCellContentODS);
@@ -201,6 +203,7 @@ public:
CPPUNIT_TEST(testMiscRowHeights);
CPPUNIT_TEST(testOptimalHeightReset);
CPPUNIT_TEST(testPrintRangeODS);
+ CPPUNIT_TEST(testOutlineODS);
CPPUNIT_TEST_SUITE_END();
private:
@@ -1941,6 +1944,59 @@ void ScFiltersTest::testPrintRangeODS()
CPPUNIT_ASSERT_EQUAL(ScRange(0,2,0,0,4,0), *pRange);
}
+void ScFiltersTest::testOutlineODS()
+{
+ ScDocShellRef xDocSh = loadDoc("outline.", ODS);
+ ScDocument* pDoc = xDocSh->GetDocument();
+
+ const ScOutlineTable* pTable = pDoc->GetOutlineTable(0);
+ CPPUNIT_ASSERT(pTable);
+
+ const ScOutlineArray* pArr = pTable->GetRowArray();
+ size_t nDepth = pArr->GetDepth();
+ CPPUNIT_ASSERT_EQUAL(size_t(4), nDepth);
+
+ for(size_t i = 0; i < nDepth; ++i)
+ {
+ CPPUNIT_ASSERT_EQUAL(size_t(1), pArr->GetCount(i));
+ }
+
+ struct OutlineData {
+ SCCOLROW nStart;
+ SCCOLROW nEnd;
+ bool bHidden;
+ bool bVisible;
+
+ size_t nDepth;
+ size_t nIndex;
+ };
+
+ OutlineData aRow[] =
+ {
+ { 1, 29, false, true, 0, 0 },
+ { 2, 26, false, true, 1, 0 },
+ { 4, 23, false, true, 2, 0 },
+ { 6, 20, true, true, 3, 0 }
+ };
+
+ for(size_t i = 0; i < SAL_N_ELEMENTS(aRow); ++i)
+ {
+
+ const ScOutlineEntry* pEntry = pArr->GetEntry(aRow[i].nDepth, aRow[i].nIndex);
+ SCCOLROW nStart = pEntry->GetStart();
+ CPPUNIT_ASSERT_EQUAL(aRow[i].nStart, nStart);
+
+ SCCOLROW nEnd = pEntry->GetEnd();
+ CPPUNIT_ASSERT_EQUAL(aRow[i].nEnd, nEnd);
+
+ bool bHidden = pEntry->IsHidden();
+ CPPUNIT_ASSERT_EQUAL(aRow[i].bHidden, bHidden);
+
+ bool bVisible = pEntry->IsVisible();
+ CPPUNIT_ASSERT_EQUAL(aRow[i].bVisible, bVisible);
+ }
+}
+
ScFiltersTest::ScFiltersTest()
: ScBootstrapFixture( "/sc/qa/unit/data" )
{
commit d91b12383ecdceb4c2be7a5da11d84ac2146fddb
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Jun 3 23:29:51 2013 +0200
restore old code
There is some strange handling for row 0 in the calc core code. Without
a very deep inspection I can't decide whether the test or my change is
the problem but for now we can live with the old behavior.
Change-Id: I69615349f5b46856aba36dada235a49c84eb03af
diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx
index efcc0e4..f6b1ae05 100644
--- a/sc/source/filter/xml/xmlrowi.cxx
+++ b/sc/source/filter/xml/xmlrowi.cxx
@@ -237,8 +237,8 @@ ScXMLTableRowsContext::ScXMLTableRowsContext( ScXMLImport& rImport,
}
else if (bGroup)
{
- ScAddress aAddr = rImport.GetTables().GetCurrentCellPos();
- nHeaderStartRow = aAddr.Row();
+ nGroupStartRow = rImport.GetTables().GetCurrentRow();
+ ++nGroupStartRow;
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
for( sal_Int16 i=0; i < nAttrCount; ++i )
{
More information about the Libreoffice-commits
mailing list