[Libreoffice-commits] core.git: 5 commits - sc/inc sc/qa sc/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Mon May 18 20:48:11 PDT 2015
sc/inc/stlsheet.hxx | 3 ++
sc/qa/unit/data/xlsx/cond_parent.xlsx |binary
sc/qa/unit/data/xlsx/ref_string.xlsx |binary
sc/qa/unit/subsequent_filters-test.cxx | 37 ++++++++++++++++++++++++++++++++-
sc/source/core/data/stlsheet.cxx | 5 ++++
sc/source/filter/excel/xeextlst.cxx | 1
sc/source/filter/oox/stylesbuffer.cxx | 7 ++++--
7 files changed, 50 insertions(+), 3 deletions(-)
New commits:
commit c4151c058167a9076d9c77cd7ac71ed0a41c2ba7
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue May 19 05:31:26 2015 +0200
coverity#1298899, resource leak
Change-Id: I2bf0df28c23af19bf417e70a0039c7bdccefd6cf
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 9f2f381..b0286e6 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -2437,7 +2437,7 @@ void testCustomIconSetsXLSX_Impl(ScDocument& rDoc, SCCOL nCol, SCROW nRow, ScIco
CPPUNIT_ASSERT(pEntry);
CPPUNIT_ASSERT_EQUAL(condformat::ICONSET, pEntry->GetType());
const ScIconSetFormat* pIconSet = static_cast<const ScIconSetFormat*>(pEntry);
- ScIconSetInfo* pInfo = pIconSet->GetIconSetInfo(ScAddress(nCol, nRow, 1));
+ std::unique_ptr<ScIconSetInfo> pInfo(pIconSet->GetIconSetInfo(ScAddress(nCol, nRow, 1)));
if (nIndex == -1)
CPPUNIT_ASSERT(!pInfo);
else
commit ac3bc7ccd498aa0b2bc1beb8d7a377391086da10
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue May 19 05:29:40 2015 +0200
coverity#1298900, init member
Change-Id: I0d4e3e96a376e2d0e7232bb1bbe397ec80047320
diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx
index c90b57f..2639bec 100644
--- a/sc/source/filter/excel/xeextlst.cxx
+++ b/sc/source/filter/excel/xeextlst.cxx
@@ -259,6 +259,7 @@ void XclExpExtIconSet::SaveXml(XclExpXmlStream& rStrm)
XclExpExtCfRule::XclExpExtCfRule( const XclExpRoot& rRoot, const ScFormatEntry& rFormat, const ScAddress& rPos, const OString& rId, sal_Int32 nPriority ):
XclExpRoot(rRoot),
maId(rId),
+ pType(NULL),
mnPriority(nPriority)
{
switch (rFormat.GetType())
commit 912189fdd6543028ccd81ca01df576de2ab9b106
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue May 19 05:27:18 2015 +0200
add test for OOXML ref string conversion
Change-Id: Icef24eb47b34f1609026a4ead01329846034405a
diff --git a/sc/qa/unit/data/xlsx/ref_string.xlsx b/sc/qa/unit/data/xlsx/ref_string.xlsx
new file mode 100644
index 0000000..08076cb
Binary files /dev/null and b/sc/qa/unit/data/xlsx/ref_string.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 1c6f94a..9f2f381 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -199,6 +199,7 @@ public:
void testVBAUserFunctionXLSM();
void testEmbeddedImageXLS();
void testEditEngStrikeThroughXLSX();
+ void testRefStringXLSX();
CPPUNIT_TEST_SUITE(ScFiltersTest);
CPPUNIT_TEST(testBooleanFormatXLSX);
@@ -291,6 +292,7 @@ public:
CPPUNIT_TEST(testEmbeddedImageXLS);
CPPUNIT_TEST(testErrorOnExternalReferences);
CPPUNIT_TEST(testEditEngStrikeThroughXLSX);
+ CPPUNIT_TEST(testRefStringXLSX);
CPPUNIT_TEST_SUITE_END();
private:
@@ -3045,6 +3047,22 @@ void ScFiltersTest::testEditEngStrikeThroughXLSX()
}
}
+void ScFiltersTest::testRefStringXLSX()
+{
+ ScDocShellRef xDocSh = loadDoc("ref_string.", XLSX);
+ CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.Is());
+
+ ScDocument& rDoc = xDocSh->GetDocument();
+
+ double nVal = rDoc.GetValue(2, 2, 0);
+ ASSERT_DOUBLES_EQUAL(3.0, nVal);
+
+ const ScCalcConfig& rCalcConfig = rDoc.GetCalcConfig();
+ CPPUNIT_ASSERT_EQUAL(formula::FormulaGrammar::CONV_XL_A1, rCalcConfig.meStringRefAddressSyntax);
+
+ xDocSh->DoClose();
+}
+
ScFiltersTest::ScFiltersTest()
: ScBootstrapFixture( "/sc/qa/unit/data" )
{
commit 02b6abe87c4a9d3c11f795d36078fcabbbda498b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue May 19 05:26:16 2015 +0200
add test for tdf#91335
Change-Id: I27d70b5c3bdba01a57fa66416da725a426c6b784
diff --git a/sc/qa/unit/data/xlsx/cond_parent.xlsx b/sc/qa/unit/data/xlsx/cond_parent.xlsx
new file mode 100644
index 0000000..90f9007
Binary files /dev/null and b/sc/qa/unit/data/xlsx/cond_parent.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 249c04c..1c6f94a 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -32,6 +32,7 @@
#include <editeng/editobj.hxx>
#include <editeng/borderline.hxx>
#include <editeng/flditem.hxx>
+#include <editeng/justifyitem.hxx>
#include <dbdata.hxx>
#include "validat.hxx"
#include "formulacell.hxx"
@@ -138,6 +139,7 @@ public:
void testCondFormatThemeColorXLSX();
void testCondFormatThemeColor2XLSX(); // negative bar color and axis color
void testComplexIconSetsXLSX();
+ void testCondFormatParentXLSX();
void testLiteralInFormulaXLS();
@@ -247,6 +249,7 @@ public:
CPPUNIT_TEST(testCondFormatThemeColorXLSX);
CPPUNIT_TEST(testCondFormatThemeColor2XLSX);
CPPUNIT_TEST(testComplexIconSetsXLSX);
+ CPPUNIT_TEST(testCondFormatParentXLSX);
CPPUNIT_TEST(testLiteralInFormulaXLS);
CPPUNIT_TEST(testNumberFormatHTML);
@@ -2469,6 +2472,20 @@ void ScFiltersTest::testComplexIconSetsXLSX()
testCustomIconSetsXLSX_Impl(rDoc, 3, 3, IconSet_3Arrows, 2);
}
+void ScFiltersTest::testCondFormatParentXLSX()
+{
+ ScDocShellRef xDocSh = ScBootstrapFixture::loadDoc( "cond_parent.", XLSX );
+
+ CPPUNIT_ASSERT_MESSAGE("Failed to load cond_parent.xlsx", xDocSh.Is());
+
+ ScDocument& rDoc = xDocSh->GetDocument();
+ const SfxItemSet* pCondSet = rDoc.GetCondResult(2, 5, 0);
+ const ScPatternAttr* pPattern = rDoc.GetPattern(2, 5, 0);
+ const SfxPoolItem& rPoolItem = pPattern->GetItem(ATTR_VER_JUSTIFY, pCondSet);
+ const SvxVerJustifyItem& rVerJustify = static_cast<const SvxVerJustifyItem&>(rPoolItem);
+ CPPUNIT_ASSERT_EQUAL(SVX_VER_JUSTIFY_TOP, static_cast<SvxCellVerJustify>(rVerJustify.GetValue()));
+}
+
void ScFiltersTest::testLiteralInFormulaXLS()
{
ScDocShellRef xDocSh = loadDoc("shared-string/literal-in-formula.", XLS);
commit 2ae89f59fdad8ac5a98ce02ea31cbe55a5048c43
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue May 19 04:53:07 2015 +0200
don't use default style as parent for OOXML cond format style, tdf#91335
Change-Id: I1388bb5ab71f6f6d174872023f085240f3bff916
diff --git a/sc/inc/stlsheet.hxx b/sc/inc/stlsheet.hxx
index cb65a01..6bfcfd5 100644
--- a/sc/inc/stlsheet.hxx
+++ b/sc/inc/stlsheet.hxx
@@ -22,6 +22,8 @@
#include <svl/style.hxx>
+#include "scdllapi.h"
+
#define SCSTYLEBIT_STANDARD 0x0001
class ScStyleSheetPool;
@@ -48,6 +50,7 @@ public:
ScStyleSheet( const ScStyleSheet& rStyle );
virtual bool SetParent ( const OUString& rParentName ) SAL_OVERRIDE;
+ SC_DLLPUBLIC void ResetParent();
virtual SfxItemSet& GetItemSet () SAL_OVERRIDE;
virtual bool IsUsed () const SAL_OVERRIDE;
virtual bool HasFollowSupport () const SAL_OVERRIDE;
diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx
index 5d278ff..be060c2 100644
--- a/sc/source/core/data/stlsheet.cxx
+++ b/sc/source/core/data/stlsheet.cxx
@@ -121,6 +121,11 @@ bool ScStyleSheet::SetParent( const OUString& rParentName )
return bResult;
}
+void ScStyleSheet::ResetParent()
+{
+ GetItemSet().SetParent(NULL);
+}
+
SfxItemSet& ScStyleSheet::GetItemSet()
{
if ( !pSet )
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 5e73b68..598ea49 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -3117,9 +3117,12 @@ OUString StylesBuffer::createDxfStyle( sal_Int32 nDxfId ) const
// Create a cell style. This may overwrite an existing style if
// one with the same name exists.
+ ScStyleSheet& rStyleSheet = ScfTools::MakeCellStyleSheet(
+ *getScDocument().GetStyleSheetPool(), rStyleName, true);
+
+ rStyleSheet.ResetParent();
SfxItemSet& rStyleItemSet =
- ScfTools::MakeCellStyleSheet(
- *getScDocument().GetStyleSheetPool(), rStyleName, true).GetItemSet();
+ rStyleSheet.GetItemSet();
pDxf->fillToItemSet(rStyleItemSet);
}
More information about the Libreoffice-commits
mailing list