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

2017-03-31 Thread Marco Cecchetti
 sc/qa/unit/tiledrendering/data/smile.png |binary
 sc/qa/unit/tiledrendering/tiledrendering.cxx |   44 +++
 sc/source/ui/inc/gridwin.hxx |5 +++
 sc/source/ui/view/gridwin4.cxx   |7 +---
 svx/source/svdraw/sdrpagewindow.cxx  |   20 +++-
 5 files changed, 70 insertions(+), 6 deletions(-)

New commits:
commit 325d211aae0ef54c8e0b90ca594c4af336818259
Author: Marco Cecchetti 
Date:   Tue Jan 3 11:56:05 2017 +0100

LOK: Calc: unit test for invalidation on insert image

Change-Id: Ie7c55c3a5c366618cafa51f9f1a102fb3cb26ec5

diff --git a/sc/qa/unit/tiledrendering/data/smile.png 
b/sc/qa/unit/tiledrendering/data/smile.png
new file mode 100644
index ..ba0b89172b25
Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/smile.png differ
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 2510d161387a..06fda94ff40b 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -79,6 +79,7 @@ public:
 void testCommentCallback();
 void testUndoLimiting();
 void testUndoRepairDispatch();
+void testInsertGraphicInvalidations();
 
 CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
 CPPUNIT_TEST(testRowColumnSelections);
@@ -103,6 +104,7 @@ public:
 CPPUNIT_TEST(testCommentCallback);
 CPPUNIT_TEST(testUndoLimiting);
 CPPUNIT_TEST(testUndoRepairDispatch);
+CPPUNIT_TEST(testInsertGraphicInvalidations);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1264,7 +1266,49 @@ void ScTiledRenderingTest::testUndoRepairDispatch()
 
 mxComponent->dispose();
 mxComponent.clear();
+comphelper::LibreOfficeKit::setActive(false);
+}
+
+void ScTiledRenderingTest::testInsertGraphicInvalidations()
+{
+comphelper::LibreOfficeKit::setActive();
+
+ScModelObj* pModelObj = createDoc("small.ods");
+CPPUNIT_ASSERT(pModelObj);
+ScViewData* pViewData = ScDocShell::GetViewData();
+CPPUNIT_ASSERT(pViewData);
+
+// view
+ViewCallback aView;
+
SfxViewShell::Current()->registerLibreOfficeKitViewCallback(::callback,
 );
+
+// we need to paint a tile in the view for triggering the tile 
invalidation solution
+int nCanvasWidth = 256;
+int nCanvasHeight = 256;
+std::vector aBuffer(nCanvasWidth * nCanvasHeight * 4);
+ScopedVclPtrInstance pDevice(nullptr, Size(1, 1), 
DeviceFormat::DEFAULT);
+pDevice->SetOutputSizePixelScaleOffsetAndBuffer(Size(nCanvasWidth, 
nCanvasHeight), Fraction(1.0), Point(), aBuffer.data());
+pModelObj->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight, 
/*nTilePosX=*/0, /*nTilePosY=*/0, /*nTileWidth=*/3840, /*nTileHeight=*/3840);
+Scheduler::ProcessEventsToIdle();
+
+// insert an image in view and see if both views are invalidated
+aView.m_bInvalidateTiles = false;
+uno::Sequence aArgs(1);
+aArgs[0].Name = OUString::fromUtf8("FileName");
+aArgs[0].Value <<= (m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"smile.png");
+comphelper::dispatchCommand(".uno:InsertGraphic", aArgs);
+Scheduler::ProcessEventsToIdle();
+CPPUNIT_ASSERT(aView.m_bInvalidateTiles);
 
+// undo image insertion in view and see if both views are invalidated
+aView.m_bInvalidateTiles = false;
+uno::Sequence aArgs2;
+comphelper::dispatchCommand(".uno:Undo", aArgs2);
+Scheduler::ProcessEventsToIdle();
+CPPUNIT_ASSERT(aView.m_bInvalidateTiles);
+
+mxComponent->dispose();
+mxComponent.clear();
 comphelper::LibreOfficeKit::setActive(false);
 }
 
commit 83487c28d3e2d0b331dd161b97a804be8e9bc1b9
Author: Jan Holesovsky 
Date:   Fri Mar 31 18:17:23 2017 +0200

lok sc: Don't depend on the OutputDevice existence when invalidating.

We know that the drawinglayer operates in 100th of millimetre, and that we
need twips for LOK.

Change-Id: I8813f936ab66eaca4d6b9c03341e090d703decb8

diff --git a/svx/source/svdraw/sdrpagewindow.cxx 
b/svx/source/svdraw/sdrpagewindow.cxx
index add2130a32be..729c65ea997e 100644
--- a/svx/source/svdraw/sdrpagewindow.cxx
+++ b/svx/source/svdraw/sdrpagewindow.cxx
@@ -36,7 +36,7 @@
 #include 
 #include 
 #include 
-
+#include 
 
 using namespace ::com::sun::star;
 
@@ -409,7 +409,23 @@ void SdrPageWindow::RedrawLayer(const SdrLayerID* pId,
 // Invalidate call, used from ObjectContact(OfPageView) in 
InvalidatePartOfView(...)
 void SdrPageWindow::InvalidatePageWindow(const basegfx::B2DRange& rRange)
 {
-if(GetPageView().IsVisible() && GetPaintWindow().OutputToWindow())
+if (comphelper::LibreOfficeKit::isActive())
+{
+// we don't really have a paint window with LOK; OTOH we know that the
+// drawinglayer units are 100ths of mm, so they are easy to convert to
+// twips
+const Rectangle aRect100thMM(
+static_cast(floor(rRange.getMinX())),
+   

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

2016-10-04 Thread Tamás Zolnai
 sc/qa/unit/data/xlsx/pivot-table/shared-dategroup.xlsx |binary
 sc/qa/unit/data/xlsx/pivot-table/shared-numgroup.xlsx  |binary
 sc/qa/unit/subsequent_filters-test.cxx |   78 -
 sc/source/core/data/dpobject.cxx   |3 
 4 files changed, 79 insertions(+), 2 deletions(-)

New commits:
commit 7e1fd9aa86ab8d5e86f35df8615f438a3383af98
Author: Tamás Zolnai 
Date:   Thu Sep 29 05:24:22 2016 +0200

Pivot tables: Fix wrong group field number in cache

getCache should not append new group fields to the cache,
but use those which are stored in the dimension data.

Change-Id: I2011b0d3a22644a86c31500d74469b9c4c641649

diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index 63bafd2..0b17d4c 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -2104,9 +2104,7 @@ void ScFiltersTest::testPivotTableSharedGroupXLSX()
 const ScDPCache* pCache = 
rSheetCaches.getExistingCache(ScRange(0,0,1,13,18,1));
 CPPUNIT_ASSERT_MESSAGE("Pivot cache is expected for A1:N19 on the second 
sheet.", pCache);
 CPPUNIT_ASSERT_EQUAL(static_cast(14), pCache->GetFieldCount());
-
-// TODO : Look into this and find out why it fails.
-// CPPUNIT_ASSERT_EQUAL(static_cast(1), 
pCache->GetGroupFieldCount());
+CPPUNIT_ASSERT_EQUAL(static_cast(1), pCache->GetGroupFieldCount());
 
 xDocSh->DoClose();
 }
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 8e6411b..d9b07a4 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -2952,7 +2952,10 @@ const ScDPCache* 
ScDPCollection::SheetCaches::getCache(const ScRange& rRange, co
 }
 
 if (pDimData)
+{
+(itCache->second)->ClearGroupFields();
 pDimData->WriteToCache(*itCache->second);
+}
 
 return itCache->second.get();
 }
commit 93098854c2d2b814a21161bd88071918cb382e87
Author: Tamás Zolnai 
Date:   Wed Oct 5 05:14:42 2016 +0200

Test XLSX import of number groups

Change-Id: I12a8f301607240684676c5b50bdad0eea0923f97

diff --git a/sc/qa/unit/data/xlsx/pivot-table/shared-numgroup.xlsx 
b/sc/qa/unit/data/xlsx/pivot-table/shared-numgroup.xlsx
new file mode 100644
index 000..36f36ef
Binary files /dev/null and 
b/sc/qa/unit/data/xlsx/pivot-table/shared-numgroup.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index 8c90ce2..63bafd2 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -202,6 +202,7 @@ public:
 void testGetPivotDataXLS();
 void testPivotTableSharedGroupXLSX();
 void testPivotTableSharedDateGroupXLSX();
+void testPivotTableSharedNumGroupXLSX();
 
 void testFormulaDependency();
 
@@ -310,6 +311,7 @@ public:
 CPPUNIT_TEST(testGetPivotDataXLS);
 CPPUNIT_TEST(testPivotTableSharedGroupXLSX);
 CPPUNIT_TEST(testPivotTableSharedDateGroupXLSX);
+CPPUNIT_TEST(testPivotTableSharedNumGroupXLSX);
 CPPUNIT_TEST(testRowHeightODS);
 CPPUNIT_TEST(testFormulaDependency);
 CPPUNIT_TEST(testRichTextContentODS);
@@ -2146,6 +2148,41 @@ void ScFiltersTest::testPivotTableSharedDateGroupXLSX()
 xDocSh->DoClose();
 }
 
+void ScFiltersTest::testPivotTableSharedNumGroupXLSX()
+{
+ScDocShellRef xDocSh = loadDoc("pivot-table/shared-numgroup.", 
FORMAT_XLSX);
+CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is());
+ScDocument& rDoc = xDocSh->GetDocument();
+
+// Check whether right number groups are imported for both tables
+// First table
+CPPUNIT_ASSERT_EQUAL(OUString("32674-47673"), 
rDoc.GetString(ScAddress(0,4,1)));
+CPPUNIT_ASSERT_EQUAL(OUString("47674-62673"), 
rDoc.GetString(ScAddress(0,5,1)));
+CPPUNIT_ASSERT_EQUAL(OUString("62674-77673"), 
rDoc.GetString(ScAddress(0,6,1)));
+CPPUNIT_ASSERT_EQUAL(OUString("77674-92673"), 
rDoc.GetString(ScAddress(0,7,1)));
+CPPUNIT_ASSERT_EQUAL(OUString("92674-107673"), 
rDoc.GetString(ScAddress(0,8,1)));
+
+// Second table
+CPPUNIT_ASSERT_EQUAL(OUString("32674-47673"), 
rDoc.GetString(ScAddress(5,4,1)));
+CPPUNIT_ASSERT_EQUAL(OUString("47674-62673"), 
rDoc.GetString(ScAddress(5,5,1)));
+CPPUNIT_ASSERT_EQUAL(OUString("62674-77673"), 
rDoc.GetString(ScAddress(5,6,1)));
+CPPUNIT_ASSERT_EQUAL(OUString("77674-92673"), 
rDoc.GetString(ScAddress(5,7,1)));
+CPPUNIT_ASSERT_EQUAL(OUString("92674-107673"), 
rDoc.GetString(ScAddress(5,8,1)));
+
+// There should be exactly 2 pivot tables and 1 cache.
+ScDPCollection* pDPs = rDoc.GetDPCollection();
+CPPUNIT_ASSERT_EQUAL(static_cast(2), pDPs->GetCount());
+
+ScDPCollection::SheetCaches& rSheetCaches = pDPs->GetSheetCaches();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rSheetCaches.size());
+
+const ScDPCache* pCache = 

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

2016-08-04 Thread Eike Rathke
 sc/qa/unit/ucalc_formula.cxx |6 +-
 sc/source/core/inc/interpre.hxx  |   19 +++
 sc/source/core/tool/interpr1.cxx |6 +++---
 sc/source/core/tool/interpr4.cxx |   19 +++
 4 files changed, 34 insertions(+), 16 deletions(-)

New commits:
commit e85bb29a029300bbed18ca0c25bdc9a31773e9cc
Author: Eike Rathke 
Date:   Thu Aug 4 18:57:46 2016 +0200

re-enable unit test for tdf#100637 nested array IF with scalar

Change-Id: If2b6d5d8dcbad1472d12753083ba431b59713a7f

diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index f5f65bf..d3c158f 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -3926,17 +3926,13 @@ void Test::testFuncIF()
 m_pDoc->SetValue(ScAddress(1,0,0), 3.0);
 CPPUNIT_ASSERT_EQUAL(OUString("not two"), 
m_pDoc->GetString(ScAddress(0,0,0)));
 
-/* FIXME: temporarily disabled because e54cd3fbf40300416ef337981bd356b88ad44a41
- * reverted; reactivate when fixed again. */
-#if 0
-// Test nested IF in array/matrix.
+// Test nested IF in array/matrix if the nested IF is not already a matrix.
 ScMarkData aMark;
 aMark.SelectOneTable(0);
 m_pDoc->InsertMatrixFormula(0,2, 1,2, aMark, "=IF({1;0};IF(1;23);42)");
 // Results must be 23 and 42.
 CPPUNIT_ASSERT_EQUAL(23.0, m_pDoc->GetValue(ScAddress(0,2,0)));
 CPPUNIT_ASSERT_EQUAL(42.0, m_pDoc->GetValue(ScAddress(1,2,0)));
-#endif
 
 m_pDoc->DeleteTab(0);
 }
commit e5632d9b2f194a89ec4e60cd99fc050691b14a1e
Author: Eike Rathke 
Date:   Thu Aug 4 18:56:20 2016 +0200

Resolves: tdf#100637 nested array jump condition needs own JumpMatrix 
context

... even if scalar. For all IF, CHOOSE, IFERROR, IFNA.

Change-Id: If776dbcd7e5991b7a5629fff0b894a6015918572

diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 37afbda..f1b8e0d 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -360,11 +360,17 @@ void PopExternalDoubleRef(ScMatrixRef& rMat);
 void GetExternalDoubleRef(sal_uInt16 nFileId, const OUString& rTabName, const 
ScComplexRefData& aData, ScExternalRefCache::TokenArrayRef& rArray);
 bool PopDoubleRefOrSingleRef( ScAddress& rAdr );
 void PopDoubleRefPushMatrix();
-// If MatrixFormula: convert formula::svDoubleRef to svMatrix, create 
JumpMatrix.
+// If MatrixFormula: convert svDoubleRef to svMatrix, create JumpMatrix.
 // Else convert area reference parameters marked as ForceArray to array.
 // Returns true if JumpMatrix created.
 bool ConvertMatrixParameters();
-inline void MatrixJumpConditionToMatrix();  // if MatrixFormula: 
PopDoubleRefPushMatrix
+// If MatrixFormula: ConvertMatrixJumpConditionToMatrix()
+inline void MatrixJumpConditionToMatrix();
+// For MatrixFormula (preconditions already checked by
+// MatrixJumpConditionToMatrix()): convert svDoubleRef to svMatrix, or if
+// JumpMatrix currently in effect convert also other types to svMatrix so
+// another JumpMatrix will be created by jump commands.
+void ConvertMatrixJumpConditionToMatrix();
 // If MatrixFormula or ForceArray: ConvertMatrixParameters()
 inline bool MatrixParameterConversion();
 ScMatrixRef PopMatrix();
@@ -977,11 +983,8 @@ public:
 
 inline void ScInterpreter::MatrixJumpConditionToMatrix()
 {
-if ( (bMatrixFormula || pCur->IsInForceArray()) && GetStackType() == 
formula::svDoubleRef )
-{
-GetTokenMatrixMap();// make sure it exists, create if not.
-PopDoubleRefPushMatrix();
-}
+if (bMatrixFormula || pCur->IsInForceArray())
+ConvertMatrixJumpConditionToMatrix();
 }
 
 inline bool ScInterpreter::MatrixParameterConversion()
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 9f64ea0..ed433e3 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1374,6 +1374,25 @@ void ScInterpreter::PopDoubleRefPushMatrix()
 SetError( errNoRef );
 }
 
+void ScInterpreter::ConvertMatrixJumpConditionToMatrix()
+{
+StackVar eStackType = GetStackType();
+if (eStackType == svUnknown)
+return; // can't do anything, some caller will catch that
+if (eStackType == svMatrix)
+return; // already matrix, nothing to do
+
+if (eStackType != svDoubleRef && GetStackType(2) != svJumpMatrix)
+return; // always convert svDoubleRef, others only in JumpMatrix 
context
+
+GetTokenMatrixMap();// make sure it exists, create if not.
+ScMatrixRef pMat = GetMatrix();
+if ( pMat )
+PushMatrix( pMat );
+else
+PushIllegalParameter();
+}
+
 ScTokenMatrixMap* ScInterpreter::CreateTokenMatrixMap()
 {
 return new ScTokenMatrixMap;
commit 4e2673a5465f8c9f3124049f8240cefdeed453b3
Author: Eike Rathke 
Date:   Thu Aug 4 16:39:23 2016 +0200

rename MatrixDoubleRefToMatrix() to MatrixJumpConditionToMatrix()

... because that is 

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

2016-07-28 Thread Zdeněk Crhonek
 sc/qa/unit/data/functions/fods/sinh.fods| 2460 
 sc/qa/unit/data/ods/custom_column_width.ods |binary
 sc/qa/unit/subsequent_export-test.cxx   |   96 +
 sc/qa/unit/subsequent_filters-test.cxx  |2 
 sc/source/filter/excel/xetable.cxx  |   19 
 sc/source/filter/excel/xltools.cxx  |5 
 sc/source/filter/inc/xetable.hxx|4 
 sc/source/filter/inc/xltable.hxx|1 
 sc/source/filter/inc/xltools.hxx|1 
 sc/source/filter/oox/worksheethelper.cxx|3 
 10 files changed, 2583 insertions(+), 8 deletions(-)

New commits:
commit 4bd54da67439112cce7811c91c5c039fa7aa42f0
Author: Zdeněk Crhonek 
Date:   Thu Jul 28 19:43:26 2016 +0200

add SINH test case

Change-Id: Ic82520cc0ff41ce9630460ffe6320f8f278f2bf8
Reviewed-on: https://gerrit.libreoffice.org/27646
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/qa/unit/data/functions/fods/sinh.fods 
b/sc/qa/unit/data/functions/fods/sinh.fods
new file mode 100644
index 000..1e7f8bc
--- /dev/null
+++ b/sc/qa/unit/data/functions/fods/sinh.fods
@@ -0,0 +1,2460 @@
+
+
+http://www.w3.org/1999/xlink; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:scr
 ipt="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:form
 x="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" 
xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" 
office:mimetype="application/vnd.oasis.opendocument.spreadsheet">
+ 
2016-06-25T07:16:38.437590147P0D1LibreOfficeDev/5.3.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/f9f090d0d0f2b454d6c1dd14fe735e7e83fda9da
+ 
+  
+   0
+   0
+   28650
+   9031
+   
+
+ view1
+ 
+  
+   2
+   8
+   0
+   0
+   0
+   0
+   2
+   0
+   0
+   0
+   0
+   0
+   100
+   60
+   true
+   false
+  
+  
+   2
+   13
+   0
+   0
+   0
+   0
+   2
+   0
+   0
+   0
+   0
+   0
+   100
+   60
+   true
+   false
+  
+ 
+ Sheet2
+ 1241
+ 0
+ 100
+ 60
+ false
+ true
+ true
+ true
+ 12632256
+ true
+ true
+ true
+ true
+ false
+ false
+ false
+ 1270
+ 1270
+ 1
+ 1
+ true
+ false
+
+   
+  
+  
+   7
+   false
+   false
+   true
+   true
+   false
+   false
+   false
+   1270
+   1270
+   true
+   true
+   true
+   true
+   true
+   false
+   12632256
+   false
+   Lexmark-E352dn
+   
+
+ en
+ US
+ 
+ 
+ 
+
+   
+   true
+   true
+   3
+   1
+   true
+   1
+   true
+   qQH+/0xleG1hcmstRTM1MmRuQ1VQUzpMZXhtYXJrLUUzNTJkbgAWAAMAzwAEAAhSAAAEdAAASm9iRGF0YSAxCnByaW50ZXI9TGV4bWFyay1FMzUyZG4Kb3JpZW50YXRpb249UG9ydHJhaXQKY29waWVzPTEKY29sbGF0ZT1mYWxzZQptYXJnaW5kYWp1c3RtZW50PTAsMCwwLDAKY29sb3JkZXB0aD0yNApwc2xldmVsPTAKcGRmZGV2aWNlPTEKY29sb3JkZXZpY2U9MApQUERDb250ZXhEYXRhCkR1cGxleDpOb25lAElucHV0U2xvdDpUcmF5MQBQYWdlU2l6ZTpBNAAAEgBDT01QQVRfRFVQTEVYX01PREUKAERVUExFWF9PRkY=
+   false
+   0
+  
+ 
+ 
+  
+   http://openoffice.org/2004/office; 
xmlns:xlink="http://www.w3.org/1999/xlink;>
+
+   
+  
+ 
+ 
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+ 
+ 
+  
+   

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

2016-04-09 Thread Markus Mohrhard
 sc/qa/unit/data/xlsx/cond_format_theme_color3.xlsx |binary
 sc/qa/unit/subsequent_filters-test.cxx |   56 +
 sc/source/filter/oox/condformatbuffer.cxx  |   31 +++
 3 files changed, 64 insertions(+), 23 deletions(-)

New commits:
commit 6c9337ecce749ab2769ed1986d05dbb37e2e3fab
Author: Markus Mohrhard 
Date:   Sat Apr 9 08:17:17 2016 +0200

add test case for tdf#98554

Change-Id: I7437a1ed8dd915411f6014bc01d4224fe5604f1d

diff --git a/sc/qa/unit/data/xlsx/cond_format_theme_color3.xlsx 
b/sc/qa/unit/data/xlsx/cond_format_theme_color3.xlsx
new file mode 100644
index 000..2e97684
Binary files /dev/null and b/sc/qa/unit/data/xlsx/cond_format_theme_color3.xlsx 
differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index 8106d21..720cdfe 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -141,6 +141,7 @@ public:
 void testNewCondFormatXLSX();
 void testCondFormatThemeColorXLSX();
 void testCondFormatThemeColor2XLSX(); // negative bar color and axis color
+void testCondFormatThemeColor3XLSX(); // theme index 2 and 3 are switched
 void testComplexIconSetsXLSX();
 void testCondFormatParentXLSX();
 void testColorScaleNumWithRefXLSX();
@@ -259,6 +260,7 @@ public:
 CPPUNIT_TEST(testNewCondFormatXLSX);
 CPPUNIT_TEST(testCondFormatThemeColorXLSX);
 CPPUNIT_TEST(testCondFormatThemeColor2XLSX);
+CPPUNIT_TEST(testCondFormatThemeColor3XLSX);
 CPPUNIT_TEST(testComplexIconSetsXLSX);
 CPPUNIT_TEST(testCondFormatParentXLSX);
 CPPUNIT_TEST(testColorScaleNumWithRefXLSX);
@@ -2472,6 +2474,60 @@ void ScFiltersTest::testCondFormatThemeColor2XLSX()
 
 namespace {
 
+void checkDatabarPositiveColor(ScConditionalFormat* pFormat, const Color& 
rColor)
+{
+CPPUNIT_ASSERT(pFormat);
+const ScFormatEntry* pEntry = pFormat->GetEntry(0);
+CPPUNIT_ASSERT(pEntry);
+CPPUNIT_ASSERT_EQUAL(pEntry->GetType(), condformat::DATABAR);
+const ScDataBarFormat* pDataBar = static_cast(pEntry);
+const ScDataBarFormatData* pDataBarFormatData = pDataBar->GetDataBarData();
+
+CPPUNIT_ASSERT_EQUAL(rColor, pDataBarFormatData->maPositiveColor);
+}
+
+}
+
+void ScFiltersTest::testCondFormatThemeColor3XLSX()
+{
+ScDocShellRef xDocSh = 
ScBootstrapFixture::loadDoc("cond_format_theme_color3.", FORMAT_XLSX);
+
+CPPUNIT_ASSERT_MESSAGE("Failed to load document", xDocSh.Is());
+
+ScDocument& rDoc = xDocSh->GetDocument();
+ScConditionalFormat* pFormat = rDoc.GetCondFormat(1, 3, 0);
+CPPUNIT_ASSERT(pFormat);
+const ScFormatEntry* pEntry = pFormat->GetEntry(0);
+CPPUNIT_ASSERT(pEntry);
+CPPUNIT_ASSERT_EQUAL(pEntry->GetType(), condformat::COLORSCALE);
+const ScColorScaleFormat* pColorScale = static_cast(pEntry);
+
+CPPUNIT_ASSERT_EQUAL(size_t(2), pColorScale->size());
+const ScColorScaleEntry* pColorScaleEntry = pColorScale->GetEntry(0);
+CPPUNIT_ASSERT(pColorScaleEntry);
+CPPUNIT_ASSERT_EQUAL(Color(175, 171, 171), pColorScaleEntry->GetColor());
+
+pColorScaleEntry = pColorScale->GetEntry(1);
+CPPUNIT_ASSERT(pColorScaleEntry);
+CPPUNIT_ASSERT_EQUAL(Color(51, 63, 80), pColorScaleEntry->GetColor());
+
+pFormat = rDoc.GetCondFormat(3, 3, 0);
+checkDatabarPositiveColor(pFormat, Color(59, 56, 56));
+
+pFormat = rDoc.GetCondFormat(5, 3, 0);
+checkDatabarPositiveColor(pFormat, Color(173, 185, 202));
+
+pFormat = rDoc.GetCondFormat(7, 3, 0);
+checkDatabarPositiveColor(pFormat, Color(89, 89, 89));
+
+pFormat = rDoc.GetCondFormat(9, 3, 0);
+checkDatabarPositiveColor(pFormat, Color(217, 217, 217));
+
+xDocSh->DoClose();
+}
+
+namespace {
+
 void testComplexIconSetsXLSX_Impl(ScDocument& rDoc, SCCOL nCol, ScIconSetType 
eType)
 {
 ScConditionalFormat* pFormat = rDoc.GetCondFormat(nCol, 1, 0);
commit a86f37c5182d11d8f43a8b173d0d4dcea4be42c4
Author: Markus Mohrhard 
Date:   Sat Apr 9 08:16:01 2016 +0200

use the better color import method also for databars, tdf#98554

Ideally we would move some of the magic here into the ThemeBuffer class
but this requires a lot more test cases.

Change-Id: I29adadda6b40cd1863ad3d68554acf7f27c57900

diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 6e8239b..1c6b5ba 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -287,27 +287,9 @@ DataBarRule::DataBarRule( const CondFormat& rFormat ):
 
 void DataBarRule::importColor( const AttributeList& rAttribs )
 {
-sal_uInt32 nColor = 0;
-if( rAttribs.hasAttribute( XML_rgb ) )
-nColor = rAttribs.getUnsignedHex( XML_rgb, UNSIGNED_RGB_TRANSPARENT );
-else if( rAttribs.hasAttribute( XML_theme ) )
-{
-sal_uInt32 nThemeIndex = rAttribs.getUnsigned( 

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

2015-08-14 Thread Katarina Behrens
 sc/qa/unit/data/xlsx/empty-noconf.xlsx  |binary
 sc/qa/unit/subsequent_filters-test.cxx  |   31 +--
 sc/source/filter/excel/excdoc.cxx   |7 +--
 sc/source/filter/oox/workbookhelper.cxx |   22 +++---
 sc/source/ui/unoobj/confuno.cxx |7 +--
 5 files changed, 46 insertions(+), 21 deletions(-)

New commits:
commit b0a890e5bda70afa77feb3e89c3d446b00e580a3
Author: Katarina Behrens katarina.behr...@cib.de
Date:   Thu Aug 13 13:45:07 2015 +0200

Some more tdf#92256 related tests

Change-Id: I052cceb229f8ab72277c51600994269e4ea52135
Reviewed-on: https://gerrit.libreoffice.org/17704
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/sc/qa/unit/data/xlsx/empty-noconf.xlsx 
b/sc/qa/unit/data/xlsx/empty-noconf.xlsx
new file mode 100644
index 000..21f80b4
Binary files /dev/null and b/sc/qa/unit/data/xlsx/empty-noconf.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index cd909f9..3eb33b0 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -3109,8 +3109,16 @@ void ScFiltersTest::testRefStringXLSX()
 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);
+ScCalcConfig aCalcConfig = rDoc.GetCalcConfig();
+CPPUNIT_ASSERT_EQUAL(formula::FormulaGrammar::CONV_XL_A1, 
aCalcConfig.meStringRefAddressSyntax);
+
+//make sure ref syntax gets saved for MSO-produced docs
+xDocSh = saveAndReload( (*xDocSh), XLSX);
+CPPUNIT_ASSERT_MESSAGE(Failed to reload doc, xDocSh.Is());
+
+ScDocument rDoc2 = xDocSh-GetDocument();
+aCalcConfig = rDoc2.GetCalcConfig();
+CPPUNIT_ASSERT_EQUAL(formula::FormulaGrammar::CONV_XL_A1, 
aCalcConfig.meStringRefAddressSyntax);
 
 xDocSh-DoClose();
 }
@@ -3128,7 +3136,26 @@ void ScFiltersTest::testRefStringConfigXLSX()
 CPPUNIT_ASSERT_EQUAL_MESSAGE(String ref syntax doesn't match, 
formula::FormulaGrammar::CONV_OOO,
 aConfig.meStringRefAddressSyntax);
 
+xDocSh = loadDoc(empty-noconf., XLSX);
+CPPUNIT_ASSERT_MESSAGE(Failed to open 2nd doc, xDocSh.Is());
+
+//set ref syntax to something else than ExcelA1 (native to xlsx format) ...
+ScDocument rDoc2 = xDocSh-GetDocument();
+aConfig = rDoc2.GetCalcConfig();
+aConfig.meStringRefAddressSyntax = formula::FormulaGrammar::CONV_A1_XL_A1;
+rDoc2.SetCalcConfig( aConfig );
+
+ScDocShellRef xNewDocSh = saveAndReload( (*xDocSh), XLSX);
+CPPUNIT_ASSERT_MESSAGE(Failed to reload 2nd doc, xNewDocSh.Is());
+
+// ... and make sure it got saved
+ScDocument rDoc3 = xNewDocSh-GetDocument();
+aConfig = rDoc3.GetCalcConfig();
+CPPUNIT_ASSERT_EQUAL_MESSAGE(String ref syntax doesn't match, 
formula::FormulaGrammar::CONV_A1_XL_A1,
+aConfig.meStringRefAddressSyntax);
+
 xDocSh-DoClose();
+xNewDocSh-DoClose();
 }
 
 void ScFiltersTest::testBnc762542()
commit 077c8838ace23cfe5c54ae222153dbef815b56b0
Author: Katarina Behrens katarina.behr...@cib.de
Date:   Thu Aug 13 13:13:16 2015 +0200

tdf#92256: Don't force CalcA1 syntax on all !Microsoft xlsx docs

in other words, don't override user's configuration of string ref
syntax

Change-Id: I70281f6869663ccdaabacf506f6effcaf4b5a3fa
Reviewed-on: https://gerrit.libreoffice.org/17702
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/sc/source/filter/oox/workbookhelper.cxx 
b/sc/source/filter/oox/workbookhelper.cxx
index 5b01085..883a58d 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -532,18 +532,6 @@ void WorkbookGlobals::useInternalChartDataTable( bool 
bInternal )
 
 // private 
 
-namespace {
-
-formula::FormulaGrammar::AddressConvention 
getConvention(css::uno::ReferenceXDocumentProperties xDocProps)
-{
-if (xDocProps-getGenerator().startsWithIgnoreAsciiCase(Microsoft))
-return formula::FormulaGrammar::CONV_XL_A1;
-
-return formula::FormulaGrammar::CONV_OOO;
-}
-
-}
-
 void WorkbookGlobals::initialize( bool bWorkbookFile )
 {
 maCellStyles = CellStyles;
@@ -573,9 +561,13 @@ void WorkbookGlobals::initialize( bool bWorkbookFile )
 
 Reference XDocumentPropertiesSupplier  xPropSupplier( mxDoc, UNO_QUERY);
 Reference XDocumentProperties  xDocProps = 
xPropSupplier-getDocumentProperties();
-ScCalcConfig aCalcConfig = mpDoc-GetCalcConfig();
-aCalcConfig.SetStringRefSyntax( getConvention(xDocProps) );
-mpDoc-SetCalcConfig(aCalcConfig);
+
+if (xDocProps-getGenerator().startsWithIgnoreAsciiCase(Microsoft))
+{
+

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

2015-03-27 Thread Markus Mohrhard
 sc/qa/unit/data/xlsx/strike-through.xlsx |binary
 sc/qa/unit/subsequent_filters-test.cxx   |   34 ++
 sc/source/filter/inc/stylesbuffer.hxx|2 -
 sc/source/filter/oox/richstring.cxx  |2 -
 sc/source/filter/oox/stylesbuffer.cxx|   47 +++
 5 files changed, 59 insertions(+), 26 deletions(-)

New commits:
commit 5b7d51af074aa1c4616a6f411892974cc28d2e00
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Fri Mar 27 19:56:04 2015 +0100

add test for tdf#89170

Change-Id: Ia3458ae91ea20aa3f5090f9b85a5030ddde81c3c

diff --git a/sc/qa/unit/data/xlsx/strike-through.xlsx 
b/sc/qa/unit/data/xlsx/strike-through.xlsx
new file mode 100644
index 000..ca56768
Binary files /dev/null and b/sc/qa/unit/data/xlsx/strike-through.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index 16a0e08..07b224f 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -27,6 +27,7 @@
 #include svx/svdoole2.hxx
 #include editeng/wghtitem.hxx
 #include editeng/postitem.hxx
+#include editeng/crossedoutitem.hxx
 #include editeng/udlnitem.hxx
 #include editeng/editobj.hxx
 #include editeng/borderline.hxx
@@ -188,6 +189,7 @@ public:
 void testCopyMergedNumberFormats();
 void testVBAUserFunctionXLSM();
 void testEmbeddedImageXLS();
+void testEditEngStrikeThroughXLSX();
 
 CPPUNIT_TEST_SUITE(ScFiltersTest);
 CPPUNIT_TEST(testBooleanFormatXLSX);
@@ -275,6 +277,7 @@ public:
 CPPUNIT_TEST(testVBAUserFunctionXLSM);
 CPPUNIT_TEST(testEmbeddedImageXLS);
 CPPUNIT_TEST(testErrorOnExternalReferences);
+CPPUNIT_TEST(testEditEngStrikeThroughXLSX);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2867,6 +2870,37 @@ void ScFiltersTest::testErrorOnExternalReferences()
 xDocSh-DoClose();
 }
 
+void ScFiltersTest::testEditEngStrikeThroughXLSX()
+{
+ScDocShellRef xDocSh = loadDoc(strike-through., XLSX);
+CPPUNIT_ASSERT_MESSAGE(Failed to open doc, xDocSh.Is());
+
+ScDocument rDoc = xDocSh-GetDocument();
+
+const EditTextObject* pObj = rDoc.GetEditText(ScAddress(0, 0, 0));
+CPPUNIT_ASSERT(pObj);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pObj-GetParagraphCount());
+CPPUNIT_ASSERT_EQUAL(OUString(this is strike through  this not), 
pObj-GetText(0));
+
+std::vectorEECharAttrib aAttribs;
+pObj-GetCharAttribs(0, aAttribs);
+for (std::vectorEECharAttrib::const_iterator itr = aAttribs.begin(); itr 
!= aAttribs.end(); ++itr)
+{
+if (itr-pAttr-Which() == EE_CHAR_STRIKEOUT)
+{
+const SvxCrossedOutItem rItem = static_castconst 
SvxCrossedOutItem(*itr-pAttr);
+if (itr-nStart == 0)
+{
+CPPUNIT_ASSERT(rItem.GetStrikeout() != STRIKEOUT_NONE);
+}
+else
+{
+CPPUNIT_ASSERT_EQUAL(STRIKEOUT_NONE, rItem.GetStrikeout());
+}
+}
+}
+}
+
 ScFiltersTest::ScFiltersTest()
   : ScBootstrapFixture( /sc/qa/unit/data )
 {
commit 8dd2888ac75c2c2ee9ca0ed0c6abda4dab7420cc
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Fri Mar 27 19:11:35 2015 +0100

we need to use the edit engine attibute id for rich text, tdf#89170

Change-Id: I8489b0341709d44bc62e5ddef49fe232998f3c80

diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index 46e328d..ab0c16a 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -994,7 +994,7 @@ void Font::fillToItemSet( SfxItemSet rItemSet, bool 
bEditEngineText, bool bSkip
 // strike out style
 if( maUsedFlags.mbStrikeoutUsed )
 {
-ScfTools::PutItem( rItemSet, SvxCrossedOutItem( maModel.mbStrikeout ? 
STRIKEOUT_SINGLE : STRIKEOUT_NONE, bEditEngineText ? EE_CHAR_STRIKEOUT : 
ATTR_FONT_CROSSEDOUT ), ATTR_FONT_CROSSEDOUT, bSkipPoolDefs );
+ScfTools::PutItem( rItemSet, SvxCrossedOutItem( maModel.mbStrikeout ? 
STRIKEOUT_SINGLE : STRIKEOUT_NONE, bEditEngineText ? EE_CHAR_STRIKEOUT : 
ATTR_FONT_CROSSEDOUT ), bEditEngineText ? EE_CHAR_STRIKEOUT : 
ATTR_FONT_CROSSEDOUT, bSkipPoolDefs );
 }
 
 // outline style
commit d63c5326b1d03a7a40cd14833853b7bdf324cdd2
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Fri Mar 27 19:09:35 2015 +0100

a boolean variable is enough

Change-Id: I0594de8cc79626720f2f72062c39a6f2590dd64f

diff --git a/sc/source/filter/inc/stylesbuffer.hxx 
b/sc/source/filter/inc/stylesbuffer.hxx
index ed78e48..a7c47e2 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -258,7 +258,7 @@ public:
 needs an rich text cell for this attribute. */
 boolneedsRichTextFormat() const;
 
-voidfillToItemSet( SfxItemSet rItemSet, FontPropertyType 
ePropType, bool bSkipPoolDefs = false ) const;
+void  

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

2015-01-13 Thread Markus Mohrhard
 sc/qa/extras/macros-test.cxx |   11 ---
 sc/qa/unit/data/contentCSV/user-defined-function.csv |1 +
 sc/qa/unit/data/ods/user-defined-function.ods|binary
 sc/qa/unit/helper/qahelper.cxx   |4 +++-
 sc/qa/unit/subsequent_filters-test.cxx   |7 +++
 sc/source/core/opencl/formulagroupcl.cxx |2 --
 6 files changed, 15 insertions(+), 10 deletions(-)

New commits:
commit ac604d212512e45923df247661f965a910291cc0
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Mon Jan 12 11:29:43 2015 +0100

remove unused variable

Change-Id: If22f2d90644f2c03f1b027c73574a857cea890c1

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index d407a79..581bd24 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -3959,8 +3959,6 @@ public:
 
 CLInterpreterResult launchKernel()
 {
-CLInterpreterResult aRes; // invalid by default.
-
 if (!isValid())
 return CLInterpreterResult();
 
commit 731a9aab0fa42ed42b5470e2c6f7e9fc6b1e3a85
Author: Raal r...@post.cz
Date:   Mon Jan 12 11:25:00 2015 +0100

add first test for user defined functions

currently disabled as we have a crash on exit in the test related to the
star basic code

Change-Id: If321561a117ea2c55107916c9cb5e99a2c07bdc6

diff --git a/sc/qa/unit/data/contentCSV/user-defined-function.csv 
b/sc/qa/unit/data/contentCSV/user-defined-function.csv
new file mode 100644
index 000..45a4fb7
--- /dev/null
+++ b/sc/qa/unit/data/contentCSV/user-defined-function.csv
@@ -0,0 +1 @@
+8
diff --git a/sc/qa/unit/data/ods/user-defined-function.ods 
b/sc/qa/unit/data/ods/user-defined-function.ods
new file mode 100644
index 000..1976c85
Binary files /dev/null and b/sc/qa/unit/data/ods/user-defined-function.ods 
differ
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index e0ade4c..c64cac1 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -34,6 +34,7 @@
 #include com/sun/star/text/textfield/Type.hpp
 #include com/sun/star/chart2/XChartDocument.hpp
 #include com/sun/star/chart2/data/XDataReceiver.hpp
+#include com/sun/star/document/MacroExecMode.hpp
 
 using namespace com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -546,11 +547,12 @@ ScDocShellRef ScBootstrapFixture::load( bool bReadWrite,
 SfxMedium* pSrcMed = new SfxMedium(rURL, bReadWrite ? STREAM_STD_READWRITE 
: STREAM_STD_READ );
 pSrcMed-SetFilter(pFilter);
 pSrcMed-UseInteractionHandler(false);
+SfxItemSet* pSet = pSrcMed-GetItemSet();
 if (pPassword)
 {
-SfxItemSet* pSet = pSrcMed-GetItemSet();
 pSet-Put(SfxStringItem(SID_PASSWORD, *pPassword));
 }
+
pSet-Put(SfxUInt16Item(SID_MACROEXECMODE,::com::sun::star::document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN));
 SAL_INFO( sc.qa, about to load   rURL );
 if (!xDocShRef-DoLoad(pSrcMed))
 {
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index 87978d5..13c616d 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -481,6 +481,13 @@ void ScFiltersTest::testFunctionsODS()
 testFile(aCSVFileName, rDoc3, 0, PureString);
 
 xDocSh-DoClose();
+
+// crashes at exit while unloading StarBasic code
+// xDocSh = loadDoc(user-defined-function., ODS);
+// xDocSh-DoHardRecalc(true);
+// ScDocument rDocUserDef = xDocSh-GetDocument();
+// createCSVPath(user-defined-function., aCSVFileName);
+// testFile(aCSVFileName, rDocUserDef, 0);
 }
 
 void ScFiltersTest::testFunctionsExcel2010()
commit 964ddc1469fb7fb7f1c4b66ad8c1479c6283d56e
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Sat Jan 10 20:35:12 2015 +0100

std::cout to SAL_INFO

Change-Id: I92c48f71baa24cef3b061b9bb6853b99ea1546d4

diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index c2948e7..2c6ac2b 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -69,7 +69,6 @@ void ScMacrosTest::testMSP()
 const OUString aFileNameBase(MasterScriptProviderProblem.ods);
 OUString aFileName;
 createFileURL(aFileNameBase, aFileName);
-std::cout  MasterScriptProviderProblem (fdo#67547) test  std::endl;
 uno::Reference com::sun::star::lang::XComponent  xComponent = 
loadFromDesktop(aFileName, com.sun.star.sheet.SpreadsheetDocument);
 
 CPPUNIT_ASSERT_MESSAGE(Failed to load MasterScriptProviderProblem.ods, 
xComponent.is());
@@ -92,7 +91,7 @@ void ScMacrosTest::testMSP()
 OUString sResult;
 aRet = sResult;
 
-std::cout  Result is   sResult  std::endl;
+SAL_INFO(sc.qa, Result is   sResult );
 CPPUNIT_ASSERT_MESSAGE(TestMSP ( for fdo#67547) failed, sResult == OK 
);
 xDocSh-DoClose();
 }
@@ -102,7 +101,6 @@ void 

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

2014-12-23 Thread Markus Mohrhard
 sc/qa/unit/data/xlsb/shared_formula.xlsb  |binary
 sc/qa/unit/subsequent_filters-test.cxx|   23 +++
 sc/source/filter/inc/sheetdatabuffer.hxx  |   14 +-
 sc/source/filter/inc/worksheethelper.hxx  |2 +-
 sc/source/filter/oox/formulaparser.cxx|2 +-
 sc/source/filter/oox/sheetdatabuffer.cxx  |   19 ++-
 sc/source/filter/oox/sheetdatacontext.cxx |7 ++-
 7 files changed, 54 insertions(+), 13 deletions(-)

New commits:
commit 4bc2212a048cde9fc17728eaad4d8637468c1586
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Wed Dec 24 04:25:03 2014 +0100

add test for fdo#86734

Change-Id: I1789f9a4ec2f1dec62ea0958bca03e5e2fcd1fc6

diff --git a/sc/qa/unit/data/xlsb/shared_formula.xlsb 
b/sc/qa/unit/data/xlsb/shared_formula.xlsb
new file mode 100644
index 000..b304e08
Binary files /dev/null and b/sc/qa/unit/data/xlsb/shared_formula.xlsb differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index d556335..f27a5c2 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -173,6 +173,7 @@ public:
 void testSharedFormulaHorizontalXLS();
 void testSharedFormulaWrappedRefsXLS();
 void testSharedFormulaBIFF5();
+void testSharedFormulaXLSB();
 void testExternalRefCacheXLSX();
 void testExternalRefCacheODS();
 void testHybridSharedStringODS();
@@ -255,6 +256,7 @@ public:
 CPPUNIT_TEST(testSharedFormulaHorizontalXLS);
 CPPUNIT_TEST(testSharedFormulaWrappedRefsXLS);
 CPPUNIT_TEST(testSharedFormulaBIFF5);
+CPPUNIT_TEST(testSharedFormulaXLSB);
 CPPUNIT_TEST(testExternalRefCacheXLSX);
 CPPUNIT_TEST(testExternalRefCacheODS);
 CPPUNIT_TEST(testHybridSharedStringODS);
@@ -2556,6 +2558,27 @@ void ScFiltersTest::testSharedFormulaBIFF5()
 xDocSh-DoClose();
 }
 
+void ScFiltersTest::testSharedFormulaXLSB()
+{
+ScDocShellRef xDocSh = loadDoc(shared_formula., XLSB);
+CPPUNIT_ASSERT(xDocSh.Is());
+ScDocument rDoc = xDocSh-GetDocument();
+rDoc.CalcAll();
+
+// E6:E376 should be all formulas, and they should belong to the same 
group.
+const ScFormulaCell* pFC = rDoc.GetFormulaCell(ScAddress(0,0,0));
+CPPUNIT_ASSERT(pFC);
+CPPUNIT_ASSERT_EQUAL(static_castSCROW(0), pFC-GetSharedTopRow());
+CPPUNIT_ASSERT_EQUAL(static_castSCROW(30), pFC-GetSharedLength());
+
+for(SCROW nRow = 0; nRow  30; ++nRow)
+{
+ASSERT_DOUBLES_EQUAL(3.0, rDoc.GetValue(0, nRow, 0));
+}
+
+xDocSh-DoClose();
+}
+
 void ScFiltersTest::testExternalRefCacheXLSX()
 {
 ScDocShellRef xDocSh = loadDoc(external-refs., XLSX);
commit cb5509987469531f7a10544a3b793abd534d0c78
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Wed Dec 24 04:12:18 2014 +0100

OSL_ENSURE = SAL_WARN

Change-Id: I175701912a4cf0d9c661327a31e37a43902b1915

diff --git a/sc/source/filter/oox/formulaparser.cxx 
b/sc/source/filter/oox/formulaparser.cxx
index 8bba050..51f79bc 100644
--- a/sc/source/filter/oox/formulaparser.cxx
+++ b/sc/source/filter/oox/formulaparser.cxx
@@ -596,7 +596,7 @@ ApiTokenSequence FormulaParserImpl::importOoxFormula( const 
CellAddress, const
 
 ApiTokenSequence FormulaParserImpl::importBiff12Formula( const CellAddress, 
FormulaType, SequenceInputStream )
 {
-OSL_FAIL( FormulaParserImpl::importBiff12Formula - not implemented );
+SAL_WARN(sc, FormulaParserImpl::importBiff12Formula - not implemented 
);
 return ApiTokenSequence();
 }
 
commit e1351ed4c5f9152c80b32bbaa53e3eff56671331
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Wed Dec 24 04:11:08 2014 +0100

reimplement shared formula import for xlsb, fdo#86734

Change-Id: Ic5d678a2b1197ce8d83b308b0a4387bf657052d5

diff --git a/sc/source/filter/inc/sheetdatabuffer.hxx 
b/sc/source/filter/inc/sheetdatabuffer.hxx
index c2e7550..1c89814 100644
--- a/sc/source/filter/inc/sheetdatabuffer.hxx
+++ b/sc/source/filter/inc/sheetdatabuffer.hxx
@@ -125,6 +125,10 @@ public:
 /** Inserts a ISO 8601 date cell into the sheet. */
 voidsetDateCell( const CellModel rModel, const OUString 
rDateString );
 
+voidcreateSharedFormula(
+const com::sun::star::table::CellAddress rRange,
+const ApiTokenSequence rTokens);
+
 /** Inserts the passed token array as array formula. */
 voidcreateArrayFormula(
 const ::com::sun::star::table::CellRangeAddress 
rRange,
@@ -149,17 +153,17 @@ public:
 /** Final processing after the sheet has been imported. */
 voidfinalizeImport();
 
-private:
-struct XfIdRowRange;
-
 /** Sets the passed formula token array into a cell. */
 voidsetCellFormula(
 const ::com::sun::star::table::CellAddress 
rCellAddr,
 const ApiTokenSequence rTokens );

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

2014-12-22 Thread Matúš Kukan
 sc/qa/unit/subsequent_filters-test.cxx|2 +-
 sc/source/filter/inc/condformatbuffer.hxx |4 
 sc/source/filter/oox/condformatbuffer.cxx |   13 -
 sc/source/filter/xml/xmlstyle.cxx |1 -
 sc/source/filter/xml/xmlstyli.cxx |1 -
 sc/source/ui/vba/vbaformatcondition.cxx   |3 ++-
 sc/source/ui/vba/vbaformatconditions.cxx  |3 ++-
 7 files changed, 5 insertions(+), 22 deletions(-)

New commits:
commit 61ce99c9fdb75631f5f34b9b1cda98e7e08af08d
Author: Matúš Kukan matus.ku...@collabora.com
Date:   Fri Dec 19 10:19:28 2014 +0100

ConditionalFormat - SC_UNONAME_CONDFMT

Change-Id: Ic6c461e0e91b37c94381e6303d91f4a8438ee600

diff --git a/sc/source/ui/vba/vbaformatcondition.cxx 
b/sc/source/ui/vba/vbaformatcondition.cxx
index 8833c75..1098d5e8 100644
--- a/sc/source/ui/vba/vbaformatcondition.cxx
+++ b/sc/source/ui/vba/vbaformatcondition.cxx
@@ -18,6 +18,7 @@
  */
 #include vbaformatcondition.hxx
 #include vbaformatconditions.hxx
+#include unonames.hxx
 #include ooo/vba/excel/XlFormatConditionType.hpp
 
 using namespace ::ooo::vba;
@@ -147,7 +148,7 @@ ScVbaFormatCondition::notifyRange() throw ( 
script::BasicErrorException )
 {
 try
 {
-mxParentRangePropertySet-setPropertyValue(ConditionalFormat, 
uno::makeAny( mxSheetConditionalEntries) );
+mxParentRangePropertySet-setPropertyValue(SC_UNONAME_CONDFMT, 
uno::makeAny( mxSheetConditionalEntries));
 }
 catch (uno::Exception )
 {
diff --git a/sc/source/ui/vba/vbaformatconditions.cxx 
b/sc/source/ui/vba/vbaformatconditions.cxx
index b8b74e0..be2c9a9 100644
--- a/sc/source/ui/vba/vbaformatconditions.cxx
+++ b/sc/source/ui/vba/vbaformatconditions.cxx
@@ -22,6 +22,7 @@
 #include com/sun/star/sheet/XSheetConditionalEntry.hpp
 #include cppuhelper/exc_hlp.hxx
 #include vector
+#include unonames.hxx
 #include vbaformatconditions.hxx
 #include vbaformatcondition.hxx
 #include vbaworkbook.hxx
@@ -227,7 +228,7 @@ ScVbaFormatConditions::notifyRange() throw ( 
script::BasicErrorException )
 {
 try
 {
-mxParentRangePropertySet-setPropertyValue(ConditionalFormat, 
uno::makeAny( mxSheetConditionalEntries ));
+mxParentRangePropertySet-setPropertyValue(SC_UNONAME_CONDFMT, 
uno::makeAny( mxSheetConditionalEntries ));
 }
 catch (uno::Exception )
 {
commit 026f59d323e713b96faca2bfa6e3b88ce3cdffab
Author: Matúš Kukan matus.ku...@collabora.com
Date:   Wed Dec 17 20:45:53 2014 +0100

Remove unused includes

Change-Id: Ic76f42da7f88357339240ba987d73297905cfe13

diff --git a/sc/source/filter/inc/condformatbuffer.hxx 
b/sc/source/filter/inc/condformatbuffer.hxx
index e36ba56..cdc2553 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -20,15 +20,11 @@
 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_CONDFORMATBUFFER_HXX
 #define INCLUDED_SC_SOURCE_FILTER_INC_CONDFORMATBUFFER_HXX
 
-#include com/sun/star/sheet/ConditionOperator2.hpp
 #include formulaparser.hxx
 #include worksheethelper.hxx
 #include boost/scoped_ptr.hpp
 #include tools/color.hxx
 
-namespace com { namespace sun { namespace star {
-namespace sheet { class XSheetConditionalEntries; }
-} } }
 class ScColorScaleFormat;
 class ScDataBarFormat;
 struct ScDataBarFormatData;
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 4c1894a..b8f92b5 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -19,20 +19,9 @@
 
 #include condformatbuffer.hxx
 
-#include com/sun/star/beans/PropertyValue.hpp
-#include com/sun/star/container/XIndexAccess.hpp
-#include com/sun/star/container/XNameContainer.hpp
 #include com/sun/star/sheet/ConditionOperator2.hpp
-#include com/sun/star/sheet/XSheetCellRanges.hpp
-#include com/sun/star/sheet/XSheetConditionalEntries.hpp
-#include com/sun/star/sheet/XSpreadsheet.hpp
-#include com/sun/star/sheet/XSpreadsheetDocument.hpp
-#include com/sun/star/sheet/XSpreadsheets.hpp
-#include com/sun/star/style/XStyle.hpp
-#include com/sun/star/style/XStyleFamiliesSupplier.hpp
 #include com/sun/star/table/CellAddress.hpp
 #include com/sun/star/table/CellRangeAddress.hpp
-#include com/sun/star/table/XCellRange.hpp
 #include rtl/ustrbuf.hxx
 #include osl/diagnose.h
 #include svl/intitem.hxx
@@ -57,8 +46,6 @@
 namespace oox {
 namespace xls {
 
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
 using namespace ::com::sun::star::sheet;
 using namespace ::com::sun::star::style;
 using namespace ::com::sun::star::table;
diff --git a/sc/source/filter/xml/xmlstyle.cxx 
b/sc/source/filter/xml/xmlstyle.cxx
index 50fe787..cf6ed80 100644
--- a/sc/source/filter/xml/xmlstyle.cxx
+++ b/sc/source/filter/xml/xmlstyle.cxx
@@ -42,7 +42,6 @@
 #include com/sun/star/table/CellJustifyMethod.hpp
 #include com/sun/star/table/TableBorder.hpp
 #include com/sun/star/table/BorderLine2.hpp
-#include 

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

2014-12-07 Thread Markus Mohrhard
 sc/qa/unit/ucalc.cxx   |   30 ++
 sc/qa/unit/ucalc.hxx   |2 ++
 sc/source/core/data/table4.cxx |   10 +++---
 3 files changed, 39 insertions(+), 3 deletions(-)

New commits:
commit e6304affe916ed7e310da7b348f7d2ff166718f5
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Sun Dec 7 09:52:33 2014 +0100

add test case for fdo#86754

Change-Id: I0f57c1124e62d8946b68c614e3ff09d26b569e77

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index d7d8cdb..d2c66bb 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4487,6 +4487,36 @@ void Test::testAutoFill()
 m_pDoc-DeleteTab(0);
 }
 
+void Test::testAutoFillSimple()
+{
+m_pDoc-InsertTab(0, test);
+
+m_pDoc-SetValue(0, 0, 0, 1);
+m_pDoc-SetString(0, 1, 0, =10);
+
+ScMarkData aMarkData;
+aMarkData.SelectTable(0, true);
+
+m_pDoc-Fill( 0, 0, 0, 1, NULL, aMarkData, 6, FILL_TO_BOTTOM, FILL_AUTO);
+
+for(SCROW nRow = 0; nRow  8; ++nRow)
+{
+if (nRow % 2 == 0)
+{
+double nVal = m_pDoc-GetValue(0, nRow, 0);
+CPPUNIT_ASSERT_EQUAL(double((nRow+2)/2), nVal);
+}
+else
+{
+OString aMsg = OString(wrong value in row: ) + 
OString::number(nRow);
+double nVal = m_pDoc-GetValue(0, nRow, 0);
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsg.getStr(), 10.0, nVal);
+}
+}
+
+m_pDoc-DeleteTab(0);
+}
+
 void Test::testCopyPasteFormulas()
 {
 m_pDoc-InsertTab(0, Sheet1);
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index ed35ca1..9ab1199a 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -360,6 +360,7 @@ public:
 void testRenameTable();
 
 void testAutoFill();
+void testAutoFillSimple();
 void testCopyPasteFormulas();
 void testCopyPasteFormulasExternalDoc();
 
@@ -564,6 +565,7 @@ public:
 CPPUNIT_TEST(testSetBackgroundColor);
 CPPUNIT_TEST(testRenameTable);
 CPPUNIT_TEST(testAutoFill);
+CPPUNIT_TEST(testAutoFillSimple);
 CPPUNIT_TEST(testCopyPasteFormulas);
 CPPUNIT_TEST(testCopyPasteFormulasExternalDoc);
 CPPUNIT_TEST(testFindAreaPosVertical);
commit 4cfca1b859bfb6b2dbe18d79a46f689fc6dbfbab
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Sun Dec 7 09:17:50 2014 +0100

handle all fill cases correctly, fdo#86754

That special case only works if the whole source range contains formula
cells. For now we just limit it to the special case of a single source
cell.

Change-Id: I71ccfde06edd97e5a9c78da22053583d05aac411

diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 68f9bd4..61a0be4 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1313,7 +1313,7 @@ void ScTable::FillAutoSimple(
 if (bVertical)  // rInner:=nRow, rOuter:=nCol
 {
 aSrcCell = aCol[rCol].GetCellValue(nSource);
-if (aSrcCell.meType == CELLTYPE_FORMULA)
+if (nISrcStart == nISrcEnd  aSrcCell.meType == 
CELLTYPE_FORMULA)
 {
 FillFormulaVertical(*aSrcCell.mpFormula, rInner, rCol, 
nIStart, nIEnd, pProgress, rProgress);
 return;
commit dcd592731c632f05f851b87567acb417b53687b1
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Sun Dec 7 08:25:16 2014 +0100

improve formatting

Change-Id: Id652ff18023965cb2bcc7c10520f95a51e8ac15d

diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 84bafad..68f9bd4 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1423,8 +1423,12 @@ void ScTable::FillAutoSimple(
 }
 }
 
-if (rInner == nIEnd) break;
-if (bPositive) ++rInner; else --rInner;
+if (rInner == nIEnd)
+break;
+if (bPositive)
+++rInner;
+else
+--rInner;
 
 //  Progress in inner loop only for expensive cells,
 //  and even then not individually for each one
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-12-06 Thread Markus Mohrhard
 sc/qa/unit/ucalc.hxx|2 +
 sc/qa/unit/ucalc_formula.cxx|   37 
 sc/source/core/data/documen2.cxx|3 --
 vcl/source/opengl/OpenGLContext.cxx |3 ++
 4 files changed, 43 insertions(+), 2 deletions(-)

New commits:
commit c0533a4694e63959bc198dfb190511a223d521c0
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Sun Dec 7 05:39:06 2014 +0100

add test for fdo#85856

Change-Id: I4b3f8a0a0ebd089862ccffc452a2852b5868a51d

diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index d5fd983..ed35ca1 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -148,6 +148,7 @@ public:
 void testFormulaRefUpdateNameMove();
 void testFormulaRefUpdateNameExpandRef();
 void testFormulaRefUpdateNameDeleteRow();
+void testFormulaRefUpdateNameCopySheet();
 void testFormulaRefUpdateValidity();
 void testMultipleOperations();
 void testFuncCOLUMN();
@@ -451,6 +452,7 @@ public:
 CPPUNIT_TEST(testFormulaRefUpdateNameMove);
 CPPUNIT_TEST(testFormulaRefUpdateNameExpandRef);
 CPPUNIT_TEST(testFormulaRefUpdateNameDeleteRow);
+CPPUNIT_TEST(testFormulaRefUpdateNameCopySheet);
 CPPUNIT_TEST(testFormulaRefUpdateValidity);
 CPPUNIT_TEST(testMultipleOperations);
 CPPUNIT_TEST(testFuncCOLUMN);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index c66194c..44c78f32 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -2599,6 +2599,43 @@ void Test::testFormulaRefUpdateNameDeleteRow()
 m_pDoc-DeleteTab(0);
 }
 
+void Test::testFormulaRefUpdateNameCopySheet()
+{
+m_pDoc-InsertTab(0, Test);
+m_pDoc-InsertTab(1, Test2);
+
+bool bInserted = m_pDoc-InsertNewRangeName(RED, ScAddress(0,0,0), 
$Test.$B$2);
+CPPUNIT_ASSERT(bInserted);
+bInserted = m_pDoc-InsertNewRangeName(BLUE, ScAddress(0,0,0), 
$Test.$B$3);
+CPPUNIT_ASSERT(bInserted);
+m_pDoc-SetValue(1, 1, 0, 1);
+m_pDoc-SetValue(1, 2, 0, 2);
+
+// insert formula into Test2 that is =RED+BLUE
+m_pDoc-SetString(ScAddress(2,2,1), =RED+BLUE);
+
+double nVal = m_pDoc-GetValue(2, 2, 1);
+CPPUNIT_ASSERT_EQUAL(3.0, nVal);
+m_pDoc-CopyTab(1, 0);
+
+nVal = m_pDoc-GetValue(2, 2, 2);
+CPPUNIT_ASSERT_EQUAL(3.0, nVal);
+
+nVal = m_pDoc-GetValue(2, 2, 0);
+CPPUNIT_ASSERT_EQUAL(3.0, nVal);
+
+m_pDoc-SetValue(1, 1, 1, 3);
+
+nVal = m_pDoc-GetValue(2, 2, 2);
+CPPUNIT_ASSERT_EQUAL(5.0, nVal);
+
+nVal = m_pDoc-GetValue(2, 2, 0);
+CPPUNIT_ASSERT_EQUAL(5.0, nVal);
+
+m_pDoc-DeleteTab(1);
+m_pDoc-DeleteTab(0);
+}
+
 void Test::testFormulaRefUpdateValidity()
 {
 struct {
commit 6c8ada4d81b5ff06c98b238e016b183fdca05c0b
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Sun Dec 7 05:14:10 2014 +0100

we need the original context that contains the data, fdo#85856

Change-Id: I107201ab736b548f010d813540e0a9cec7402e79

diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 404dd31..02e1992 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -882,9 +882,8 @@ bool ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, 
const ScMarkData* pOnlyM
 aRefCxt.mnTabDelta = nDz;
 maTabs[nNewPos]-UpdateReference(aRefCxt, NULL);
 
-sc::RefUpdateInsertTabContext aInsTabCxt(nNewPos, 1);
 maTabs[nNewPos]-UpdateInsertTabAbs(nNewPos); // move all paragraphs 
up by one!!
-maTabs[nOldPos]-UpdateInsertTab(aInsTabCxt);
+maTabs[nOldPos]-UpdateInsertTab(aCxt);
 
 maTabs[nOldPos]-UpdateCompile();
 maTabs[nNewPos]-UpdateCompile( true ); //  maybe already compiled in 
Clone, but used names need recompilation
commit c634ef6d9613eb1847636876f701f66070c7ccb7
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Fri Dec 5 03:32:41 2014 +0100

simple check to prevent crash with old drivers

Change-Id: Ia5cfdcae1d762ed8ee4b182c141565f20c97ec7d

diff --git a/vcl/source/opengl/OpenGLContext.cxx 
b/vcl/source/opengl/OpenGLContext.cxx
index 56e565f..c068cd8 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -914,6 +914,9 @@ bool OpenGLContext::ImplInit()
 if (!g_vShareList.empty())
 hSharedCtx = g_vShareList.front();
 
+if (!wglCreateContextAttribsARB)
+return false;
+
 // now setup the shared context; this needs a temporary context already
 // set up in order to work
 m_aGLWin.hRC = wglCreateContextAttribsARB(m_aGLWin.hDC, hSharedCtx, NULL);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-10-18 Thread Kohei Yoshida
 sc/qa/unit/ucalc.hxx  |   14 ---
 sc/qa/unit/ucalc_formula.cxx  |   80 --
 sc/source/core/tool/token.cxx |   47 
 3 files changed, 132 insertions(+), 9 deletions(-)

New commits:
commit 281847613bd3ae472523822f4be9c21cc353867e
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Sat Oct 18 20:22:53 2014 -0400

fdo#82047: Correctly adjust references in range names on row deletion.

Change-Id: Iac924b0b6932863f7f9cc088f996e0b07c340d2c

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index f3c38ab..cb36699 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3161,6 +3161,53 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceInName(
 if (adjustDoubleRefInName(rRef, rCxt, rPos))
 aRes.mbReferenceModified = true;
 }
+else if (rCxt.mnRowDelta  0)
+{
+// row(s) deleted.
+if (rRef.Ref1.IsRowRel() || rRef.Ref2.IsRowRel())
+// Don't modify relative references in names.
+break;
+
+if (aAbs.aStart.Col()  rCxt.maRange.aStart.Col() || 
rCxt.maRange.aEnd.Col()  aAbs.aEnd.Col())
+// column range of the reference is not entirely in 
the deleted column range.
+break;
+
+ScRange aDeleted = rCxt.maRange;
+aDeleted.aStart.IncRow(rCxt.mnRowDelta);
+
aDeleted.aEnd.SetRow(aDeleted.aStart.Row()-rCxt.mnRowDelta-1);
+
+if (aAbs.aEnd.Row()  aDeleted.aStart.Row() || 
aDeleted.aEnd.Row()  aAbs.aStart.Row())
+// reference range doesn't intersect with the deleted 
range.
+break;
+
+if (aDeleted.aStart.Row() = aAbs.aStart.Row()  
aAbs.aEnd.Row() = aDeleted.aEnd.Row())
+{
+// This reference is entirely deleted.
+rRef.Ref1.SetRowDeleted(true);
+rRef.Ref2.SetRowDeleted(true);
+aRes.mbReferenceModified = true;
+break;
+}
+
+if (aAbs.aStart.Row()  aDeleted.aStart.Row())
+{
+if (aDeleted.aEnd.Row()  aAbs.aEnd.Row())
+// Deleted in the middle.  Make the reference 
shorter.
+rRef.Ref2.IncRow(rCxt.mnRowDelta);
+else
+// Deleted at tail end.  Cut off the lower part.
+rRef.Ref2.SetAbsRow(aDeleted.aStart.Row()-1);
+}
+else
+{
+// Deleted at the top.  Cut the top off and shift up.
+rRef.Ref1.SetAbsRow(aDeleted.aEnd.Row()+1);
+rRef.Ref1.IncRow(rCxt.mnRowDelta);
+rRef.Ref2.IncRow(rCxt.mnRowDelta);
+}
+
+aRes.mbReferenceModified = true;
+}
 else if (rCxt.maRange.Intersects(aAbs))
 {
 if (rCxt.mnColDelta  rCxt.maRange.aStart.Row() = 
aAbs.aStart.Row()  aAbs.aEnd.Row() = rCxt.maRange.aEnd.Row())
commit 03075bfac25408d805b6cfecce56fa0c4cb9d88d
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Sat Oct 18 20:22:28 2014 -0400

fdo#82047: Write test for this.

Change-Id: I0e5e54b517d3fb3cb28eb133b2cbe5bf5ca6b1d6

diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 114ca8d..472779c 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -136,6 +136,7 @@ public:
 void testFormulaRefUpdateName();
 void testFormulaRefUpdateNameMove();
 void testFormulaRefUpdateNameExpandRef();
+void testFormulaRefUpdateNameDeleteRow();
 void testFormulaRefUpdateValidity();
 void testMultipleOperations();
 void testFuncCOLUMN();
@@ -428,6 +429,7 @@ public:
 CPPUNIT_TEST(testFormulaRefUpdateName);
 CPPUNIT_TEST(testFormulaRefUpdateNameMove);
 CPPUNIT_TEST(testFormulaRefUpdateNameExpandRef);
+CPPUNIT_TEST(testFormulaRefUpdateNameDeleteRow);
 CPPUNIT_TEST(testFormulaRefUpdateValidity);
 CPPUNIT_TEST(testMultipleOperations);
 CPPUNIT_TEST(testFuncCOLUMN);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 3ae29cb..5e0018a 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -2285,6 +2285,80 @@ void Test::testFormulaRefUpdateNameExpandRef()
 m_pDoc-DeleteTab(0);
 }
 
+void Test::testFormulaRefUpdateNameDeleteRow()
+{
+m_pDoc-InsertTab(0, Test);
+
+// Insert a new name 'MyRange' to reference B2:B4.
+bool bInserted = m_pDoc-InsertNewRangeName(MyRange, ScAddress(0,0,0), 

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

2014-07-30 Thread Markus Mohrhard
 sc/qa/unit/ucalc.cxx   |   15 +++
 sc/source/core/data/table4.cxx |1 +
 sc/source/ui/inc/gridwin.hxx   |2 +-
 sc/source/ui/view/gridwin.cxx  |   26 +-
 4 files changed, 30 insertions(+), 14 deletions(-)

New commits:
commit 6e53a179bbaaba2c7ad8ad06890a94f9eaf8943a
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Tue Jul 29 19:57:26 2014 +0200

fix wrong calculation for text size, fdo#81499

Change-Id: Ifd9e09dd9e1d843728e1874c48efdd127bffe11e

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 17b02f8..ed066b2 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -273,7 +273,7 @@ class ScGridWindow : public Window, public 
DropTargetHelper, public DragSourceHe
 boolGetEditUrl( const Point rPos,
 OUString* pName=0, OUString* pUrl=0, OUString* 
pTarget=0 );
 
-bool IsSpellErrorAtPos( const Point rPos, SCCOL nCol1, SCCOL nCol2, SCROW 
nRow );
+bool IsSpellErrorAtPos( const Point rPos, SCCOL nCol1, SCROW nRow );
 
 boolHitRangeFinder( const Point rMouse, RfCorner rCorner, 
sal_uInt16* pIndex = NULL,
 SCsCOL* pAddX = NULL, SCsROW* pAddY = NULL 
);
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 5b7528c..bf777ae 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -3010,7 +3010,7 @@ void ScGridWindow::Command( const CommandEvent rCEvt )
 if (bSpellError)
 {
 // Check and see if a misspelled word is under the mouse 
pointer.
-bSpellError = IsSpellErrorAtPos(aPosPixel, nColSpellError, 
nCellX, nCellY);
+bSpellError = IsSpellErrorAtPos(aPosPixel, nColSpellError, 
nCellY);
 }
 }
 
@@ -5334,7 +5334,7 @@ bool ScGridWindow::GetEditUrl( const Point rPos,
 return false;
 }
 
-bool ScGridWindow::IsSpellErrorAtPos( const Point rPos, SCCOL nCol1, SCCOL 
nCol2, SCROW nRow )
+bool ScGridWindow::IsSpellErrorAtPos( const Point rPos, SCCOL nCol1, SCROW 
nRow )
 {
 if (!mpSpellCheckCxt)
 return false;
@@ -5359,17 +5359,6 @@ bool ScGridWindow::IsSpellErrorAtPos( const Point rPos, 
SCCOL nCol1, SCCOL nCol
 if (rPos.Y()  aEditRect.Top())
 return false;
 
-Rectangle aEditRect2 = pViewData-GetEditArea(eWhich, nCol2, nRow, this, 
pPattern, false);
-long nWidth = aEditRect2.Right() - aEditRect.Left();
-aEditRect.setWidth(nWidth);
-
-MapMode aEditMode = pViewData-GetLogicMode(eWhich);
-Rectangle aLogicEdit = PixelToLogic(aEditRect, aEditMode);
-Point aLogicClick = PixelToLogic(rPos, aEditMode);
-
-if (!aLogicEdit.IsInside(aLogicClick))
-return false;
-
 boost::shared_ptrScFieldEditEngine pEngine = createEditEngine(pDocSh, 
*pPattern);
 
 Size aPaperSize = Size(100, 100);
@@ -5380,6 +5369,17 @@ bool ScGridWindow::IsSpellErrorAtPos( const Point rPos, 
SCCOL nCol1, SCCOL nCol
 else
 pEngine-SetText(aCell.mpString-getString());
 
+long nTextWidth = static_castlong(pEngine-CalcTextWidth());
+
+MapMode aEditMode = pViewData-GetLogicMode(eWhich);
+Rectangle aLogicEdit = PixelToLogic(aEditRect, aEditMode);
+Point aLogicClick = PixelToLogic(rPos, aEditMode);
+
+aLogicEdit.setWidth(nTextWidth + 1);
+
+if (!aLogicEdit.IsInside(aLogicClick))
+return false;
+
 pEngine-SetControlWord(pEngine-GetControlWord() | 
EE_CNTRL_ONLINESPELLING);
 pEngine-SetAllMisspellRanges(*pRanges);
 
commit 7bff8e93eb98be4b621c3902de227a3c313cf5b4
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Tue Jul 29 18:52:50 2014 +0200

the range has to be in the correct order, fdo#81803

Change-Id: Ia3907701857e22c11a2cefa5d35437c8f8219ff6

diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 02d1664..0a90209 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1134,6 +1134,7 @@ void ScTable::FillFormulaVertical(
 
 SCCOLROW nRowStart = -1, nRowEnd = -1;
 std::vectorsc::RowSpan aSpans;
+PutInOrder(nRow1, nRow2);
 for (rInner = nRow1; rInner = nRow2; ++rInner)
 {
 if (rInner  nHiddenLast)
commit 896390d79133199910f857cf85004466171ca405
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Tue Jul 29 18:52:14 2014 +0200

add test case for fdo#81803

Change-Id: I00c52bd1a8d949e3fd874c2dedbd9e2345aca74e

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 02950cf..ee5a0d8 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4576,6 +4576,21 @@ void Test::testAutoFill()
 CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc-GetValue(ScAddress(0,4,0)));
 CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc-GetValue(ScAddress(0,5,0)));
 
+// test that filling formulas vertically up does the right thing
+

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

2014-07-29 Thread Kohei Yoshida
 sc/qa/unit/ucalc.hxx  |2 ++
 sc/qa/unit/ucalc_formula.cxx  |   38 ++
 sc/source/ui/docshell/docfunc.cxx |   34 +++---
 sc/source/ui/undo/undobase.cxx|2 +-
 4 files changed, 72 insertions(+), 4 deletions(-)

New commits:
commit 1fcc30503549b47046c84333af542ed739f685ba
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Tue Jul 29 17:19:28 2014 -0400

fdo#80846: Get the parameter order right.

It's column, row, tab in this order, not tab, column row.

Change-Id: I32e69a403feaf18532c7ac241fa2a98fc65a4ba7

diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index dc7efd4..2e244ec 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -172,7 +172,7 @@ public:
 if (!bVal)
 return;
 
-ScRange aRange(mnCurTab, mnCurCol, nRow1, mnCurTab, mnCurCol, nRow2);
+ScRange aRange(mnCurCol, nRow1, mnCurTab, mnCurCol, nRow2, mnCurTab);
 mrDoc.BroadcastCells(aRange, SC_HINT_DATACHANGED);
 };
 };
commit 2ef608aa35ee50a271ba817ef1538e663b4e0cae
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Tue Jul 29 16:55:32 2014 -0400

fdo#80846: Write test for this.

Change-Id: I80dc88028579a76c7116b3558cf560f9bfed109c

diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 880fde6..cf3d0d5 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -131,6 +131,7 @@ public:
 void testFormulaRefUpdateInsertColumns();
 void testFormulaRefUpdateMove();
 void testFormulaRefUpdateMoveUndo();
+void testFormulaRefUpdateDeleteContent();
 void testFormulaRefUpdateNamedExpression();
 void testFormulaRefUpdateNamedExpressionMove();
 void testFormulaRefUpdateNamedExpressionExpandRef();
@@ -405,6 +406,7 @@ public:
 CPPUNIT_TEST(testFormulaRefUpdateInsertColumns);
 CPPUNIT_TEST(testFormulaRefUpdateMove);
 CPPUNIT_TEST(testFormulaRefUpdateMoveUndo);
+CPPUNIT_TEST(testFormulaRefUpdateDeleteContent);
 CPPUNIT_TEST(testFormulaRefUpdateNamedExpression);
 CPPUNIT_TEST(testFormulaRefUpdateNamedExpressionMove);
 CPPUNIT_TEST(testFormulaRefUpdateNamedExpressionExpandRef);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index f9a5ac1..c7f03fa 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -1848,6 +1848,44 @@ void Test::testFormulaRefUpdateMoveUndo()
 m_pDoc-DeleteTab(0);
 }
 
+void Test::testFormulaRefUpdateDeleteContent()
+{
+sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
+
+m_pDoc-InsertTab(0, Test);
+
+// Set value in B2.
+m_pDoc-SetValue(ScAddress(1,1,0), 2.0);
+// Set formula in C2 to reference B2.
+m_pDoc-SetString(ScAddress(2,1,0), =B2);
+
+CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc-GetValue(ScAddress(2,1,0)));
+
+// Delete B2.
+ScDocFunc rFunc = getDocShell().GetDocFunc();
+ScMarkData aMark;
+aMark.SetMarkArea(ScAddress(1,1,0));
+rFunc.DeleteContents(aMark, IDF_CONTENTS, true, true);
+
+CPPUNIT_ASSERT_MESSAGE(B2 should be empty., 
m_pDoc-GetCellType(ScAddress(1,1,0)) == CELLTYPE_NONE);
+CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc-GetValue(ScAddress(2,1,0)));
+
+SfxUndoManager* pUndoMgr = m_pDoc-GetUndoManager();
+CPPUNIT_ASSERT(pUndoMgr);
+
+// Undo and check the result of C2.
+pUndoMgr-Undo();
+CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc-GetValue(ScAddress(1,1,0))); // B2
+CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc-GetValue(ScAddress(2,1,0))); // C2
+
+// Redo and check.
+pUndoMgr-Redo();
+CPPUNIT_ASSERT_MESSAGE(B2 should be empty., 
m_pDoc-GetCellType(ScAddress(1,1,0)) == CELLTYPE_NONE);
+CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc-GetValue(ScAddress(2,1,0)));
+
+m_pDoc-DeleteTab(0);
+}
+
 void Test::testFormulaRefUpdateNamedExpression()
 {
 m_pDoc-InsertTab(0, Formula);
commit 7b13c6d96407b7f4c0c578693bd3b9629015489c
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Tue Jul 29 16:18:05 2014 -0400

Bring this logic from ScViewFaunc::DeleteContents to ScDocFunc's.

To make the bug reported in fdo#80846 reproducible.

Change-Id: Iec400f26c6c6af9ae3bd0afd4fce75939ab1e23d

diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index adce808..d41caee 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -628,6 +628,9 @@ bool ScDocFunc::DeleteContents( const ScMarkData rMark, 
sal_uInt16 nFlags,
aMultiMark );
 }
 
+// To keep track of all non-empty cells within the deleted area.
+boost::shared_ptrScSimpleUndo::DataSpansType pDataSpans;
+
 if ( bRecord )
 {
 pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
@@ -645,6 +648,27 @@ bool ScDocFunc::DeleteContents( const ScMarkData rMark, 
sal_uInt16 nFlags,
 // note captions are handled in drawing undo
 

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

2014-07-12 Thread Kohei Yoshida
 sc/qa/unit/ucalc.cxx   |   68 +
 sc/qa/unit/ucalc.hxx   |2 +
 sc/source/ui/docshell/dbdocfun.cxx |4 +-
 3 files changed, 73 insertions(+), 1 deletion(-)

New commits:
commit 47a82452b5040cd712ffafb7d153fd18940ee1af
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Sat Jul 12 22:09:10 2014 -0400

Add another test case.

Change-Id: I1664bc3faf44abc978391d0f97820c468f4419b0

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index b10bf54..7708427 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -5058,6 +5058,38 @@ void Test::testSortSingleRow()
 bool bSorted = aFunc.Sort(0, aSortData, true, true, true);
 CPPUNIT_ASSERT(bSorted);
 
+// Another test case - single row horizontal sort with header column.
+clearSheet(m_pDoc, 0);
+
+// A1:G1
+m_pDoc-SetString(ScAddress(0,0,0), Header);
+m_pDoc-SetValue(ScAddress(1,0,0),  1.0);
+m_pDoc-SetValue(ScAddress(2,0,0), 10.0);
+m_pDoc-SetValue(ScAddress(3,0,0),  3.0);
+m_pDoc-SetValue(ScAddress(4,0,0),  9.0);
+m_pDoc-SetValue(ScAddress(5,0,0), 12.0);
+m_pDoc-SetValue(ScAddress(6,0,0),  2.0);
+
+// Define A1:G1 as sheet-local anonymous database range.
+m_pDoc-SetAnonymousDBData(
+0, new ScDBData(STR_DB_LOCAL_NONAME, 0, 0, 0, 6, 0, false, true));
+
+// Update the sort data.
+aSortData.nCol1 = 0;
+aSortData.nCol2 = 6;
+aSortData.bByRow = false;
+bSorted = aFunc.Sort(0, aSortData, true, true, true);
+CPPUNIT_ASSERT(bSorted);
+
+// Check the result.
+CPPUNIT_ASSERT_EQUAL(OUString(Header), 
m_pDoc-GetString(ScAddress(0,0,0)));
+CPPUNIT_ASSERT_EQUAL( 1.0, m_pDoc-GetValue(ScAddress(1,0,0)));
+CPPUNIT_ASSERT_EQUAL( 2.0, m_pDoc-GetValue(ScAddress(2,0,0)));
+CPPUNIT_ASSERT_EQUAL( 3.0, m_pDoc-GetValue(ScAddress(3,0,0)));
+CPPUNIT_ASSERT_EQUAL( 9.0, m_pDoc-GetValue(ScAddress(4,0,0)));
+CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc-GetValue(ScAddress(5,0,0)));
+CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc-GetValue(ScAddress(6,0,0)));
+
 m_pDoc-DeleteTab(0);
 }
 
commit 9e5b1eb98b8e97b184f8c6876b154f47b6e0730d
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Sat Jul 12 21:55:59 2014 -0400

fdo#80462: Write test for this.

Change-Id: Icdc83c0264fd76239e8c8772c207cc22ce969a76

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index af272a5..b10bf54 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -5025,6 +5025,42 @@ void Test::testSortHorizontal()
 m_pDoc-DeleteTab(0);
 }
 
+void Test::testSortSingleRow()
+{
+// This test case is from fdo#80462.
+
+m_pDoc-InsertTab(0, Test);
+
+// Sort range consists of only one row.
+m_pDoc-SetString(ScAddress(0,0,0), X);
+m_pDoc-SetString(ScAddress(1,0,0), Y);
+
+// Define A1:B1 as sheet-local anonymous database range.
+m_pDoc-SetAnonymousDBData(
+0, new ScDBData(STR_DB_LOCAL_NONAME, 0, 0, 0, 1, 0));
+
+// Sort A1:B1 horizontally, ascending by row 1.
+ScDBDocFunc aFunc(getDocShell());
+
+ScSortParam aSortData;
+aSortData.nCol1 = 0;
+aSortData.nCol2 = 1;
+aSortData.nRow1 = 0;
+aSortData.nRow2 = 0;
+aSortData.bHasHeader = true;
+aSortData.bByRow = true;
+aSortData.bIncludePattern = true;
+aSortData.maKeyState[0].bDoSort = true;
+aSortData.maKeyState[0].nField = 0;
+aSortData.maKeyState[0].bAscending = true;
+
+// Do the sorting.  This should not crash.
+bool bSorted = aFunc.Sort(0, aSortData, true, true, true);
+CPPUNIT_ASSERT(bSorted);
+
+m_pDoc-DeleteTab(0);
+}
+
 void Test::testSortInFormulaGroup()
 {
 static struct {
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 2df47c0..c592e69 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -341,6 +341,7 @@ public:
 void testFindAreaPosColRight();
 void testSort();
 void testSortHorizontal();
+void testSortSingleRow();
 void testSortWithFormulaRefs();
 void testSortWithStrings();
 void testSortInFormulaGroup();
@@ -509,6 +510,7 @@ public:
 CPPUNIT_TEST(testFindAreaPosColRight);
 CPPUNIT_TEST(testSort);
 CPPUNIT_TEST(testSortHorizontal);
+CPPUNIT_TEST(testSortSingleRow);
 CPPUNIT_TEST(testSortWithFormulaRefs);
 CPPUNIT_TEST(testSortWithStrings);
 CPPUNIT_TEST(testSortInFormulaGroup);
commit 5902dcf0995cdd0a6c1dbd1f9c21b0b2b3f5609f
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Sat Jul 12 21:46:13 2014 -0400

fdo#80462: Don't always increment the start row position.

Sometimes someone might attempt to sort only a single row.

Change-Id: Ie29d4cf7ec0bd3a5c945997083368b6ef6074268

diff --git a/sc/source/ui/docshell/dbdocfun.cxx 
b/sc/source/ui/docshell/dbdocfun.cxx
index 1c7ad53..94578f2 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -489,7 +489,9 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const 

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

2014-04-28 Thread Kohei Yoshida
 sc/qa/unit/ucalc.hxx |2 +
 sc/qa/unit/ucalc_formula.cxx |   50 +++
 sc/source/core/tool/scmatrix.cxx |   12 +++--
 3 files changed, 62 insertions(+), 2 deletions(-)

New commits:
commit 5233971396b2ed8e280ad68912e1a55e803f3856
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Mon Apr 28 13:44:18 2014 -0400

Add a bit more test code to test the normal use cases of MIN.

Change-Id: Iad1e120dff49d569e5fb66905e5fe28462759c5a

diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index de1fd11..1ecc5d2 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -2292,6 +2292,18 @@ void Test::testFuncMIN()
 CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc-GetValue(ScAddress(2,0,0)));
 CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc-GetValue(ScAddress(2,1,0)));
 
+// Inline array input (A4).
+m_pDoc-SetString(ScAddress(0,3,0), =MIN({-2;4;3}));
+CPPUNIT_ASSERT_EQUAL(-2.0, m_pDoc-GetValue(ScAddress(0,3,0)));
+
+// Add more values to B3:B4.
+m_pDoc-SetValue(ScAddress(1,2,0),  20.0);
+m_pDoc-SetValue(ScAddress(1,3,0), -20.0);
+
+// Get the MIN of B1:B4.
+m_pDoc-SetString(ScAddress(2,4,0), =MIN(B1:B4));
+CPPUNIT_ASSERT_EQUAL(-20.0, m_pDoc-GetValue(ScAddress(2,4,0)));
+
 m_pDoc-DeleteTab(0);
 }
 
commit 453ea919e70fa9832f11e3ef042bb80cd86892cc
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Mon Apr 28 13:33:08 2014 -0400

fdo#77969: Return 0 in case of matrix consisting of all empty elements.

Change-Id: I225d50445d7f84a17c0b9492c17247e4c1c9ef44

diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 32da95a..f21baed 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -1235,12 +1235,14 @@ class CalcMaxMinValue : 
std::unary_functionMatrixImplType::element_block_type,
 {
 double mfVal;
 bool mbTextAsZero;
+bool mbHasValue;
 public:
 CalcMaxMinValue( bool bTextAsZero ) :
 mfVal(_Op::init()),
-mbTextAsZero(bTextAsZero) {}
+mbTextAsZero(bTextAsZero),
+mbHasValue(false) {}
 
-double getValue() const { return mfVal; }
+double getValue() const { return mbHasValue ? mfVal : 0.0; }
 
 void operator() (const MatrixImplType::element_block_node_type node)
 {
@@ -1255,6 +1257,8 @@ public:
 block_type::const_iterator itEnd = block_type::end(*node.data);
 for (; it != itEnd; ++it)
 mfVal = _Op::compare(mfVal, *it);
+
+mbHasValue = true;
 }
 break;
 case mdds::mtm::element_boolean:
@@ -1265,6 +1269,7 @@ public:
 block_type::const_iterator itEnd = block_type::end(*node.data);
 double fVal = _Op::boolValue(it, itEnd);
 mfVal = _Op::compare(mfVal, fVal);
+mbHasValue = true;
 }
 break;
 case mdds::mtm::element_string:
@@ -1272,7 +1277,10 @@ public:
 {
 // empty elements are treated as empty strings.
 if (mbTextAsZero)
+{
 mfVal = _Op::compare(mfVal, 0.0);
+mbHasValue = true;
+}
 }
 break;
 default:
commit a4a5f67008a931508a9d963f6b95db9cb9d45aef
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Mon Apr 28 13:23:12 2014 -0400

fdo#77969: Write test for this corner case.

Change-Id: Iac8a3d0693456a380d3290c7be06136b04b50390

diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 71b33a7..9a81c5e 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -130,6 +130,7 @@ public:
 void testFuncSUM();
 void testFuncPRODUCT();
 void testFuncSUMPRODUCT();
+void testFuncMIN();
 void testFuncN();
 void testFuncCOUNTIF();
 void testFuncNUMBERVALUE();
@@ -381,6 +382,7 @@ public:
 CPPUNIT_TEST(testFuncSUM);
 CPPUNIT_TEST(testFuncPRODUCT);
 CPPUNIT_TEST(testFuncSUMPRODUCT);
+CPPUNIT_TEST(testFuncMIN);
 CPPUNIT_TEST(testFuncN);
 CPPUNIT_TEST(testFuncCOUNTIF);
 CPPUNIT_TEST(testFuncNUMBERVALUE);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index b2caf22..de1fd11 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -2257,6 +2257,44 @@ void Test::testFuncSUMPRODUCT()
 m_pDoc-DeleteTab(0);
 }
 
+void Test::testFuncMIN()
+{
+sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto recalc.
+m_pDoc-InsertTab(0, Formula);
+
+// A1:A2
+m_pDoc-SetString(ScAddress(0,0,0), a);
+m_pDoc-SetString(ScAddress(0,1,0), b);
+
+// B1:B2
+m_pDoc-SetValue(ScAddress(1,0,0), 1.0);
+m_pDoc-SetValue(ScAddress(1,1,0), 2.0);
+
+// Matrix in C1:C2.
+ScMarkData aMark;
+aMark.SelectOneTable(0);
+m_pDoc-InsertMatrixFormula(2, 0, 2, 1, aMark, 

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

2014-02-20 Thread Kohei Yoshida
 sc/qa/unit/ucalc.cxx |  347 +-
 sc/qa/unit/ucalc.hxx |   10 
 sc/qa/unit/ucalc_formula.cxx |  348 +++
 sc/source/ui/docshell/externalrefmgr.cxx |   33 ++
 4 files changed, 395 insertions(+), 343 deletions(-)

New commits:
commit 2bcd18892f1903d2434bc5dc6828841e49bb78a2
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Thu Feb 20 16:05:51 2014 -0500

fdo#72041: Intern strings in the external ref cache with the host document.

To ensure that string comparison with those from the external ref cache
works correctly in functions such as VLOOKUP.

Change-Id: Ib5a466cb6c4b26439abe61b0c17406fc8139f6c0

diff --git a/sc/source/ui/docshell/externalrefmgr.cxx 
b/sc/source/ui/docshell/externalrefmgr.cxx
index 343194f..7d77afb 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -1300,7 +1300,7 @@ IMPL_LINK_NOARG(ScExternalRefLink, ExternalRefEndEditHdl)
 
 // 
 
-static FormulaToken* convertToToken( ScRefCellValue rCell )
+static FormulaToken* convertToToken( ScDocument* pHostDoc, ScDocument* 
pSrcDoc, ScRefCellValue rCell )
 {
 if (rCell.hasEmptyValue())
 {
@@ -1312,7 +1312,11 @@ static FormulaToken* convertToToken( ScRefCellValue 
rCell )
 {
 case CELLTYPE_EDIT:
 case CELLTYPE_STRING:
-return new formula::FormulaStringToken(rCell.getString(NULL));
+{
+OUString aStr = rCell.getString(pSrcDoc);
+svl::SharedString aSS = 
pHostDoc-GetSharedStringPool().intern(aStr);
+return new formula::FormulaStringToken(aSS);
+}
 case CELLTYPE_VALUE:
 return new formula::FormulaDoubleToken(rCell.mfValue);
 case CELLTYPE_FORMULA:
@@ -1342,13 +1346,20 @@ static FormulaToken* convertToToken( ScRefCellValue 
rCell )
 templateclass T
 struct ColumnBatch
 {
+ScDocument* mpHostDoc;
+ScDocument* mpSrcDoc;
+
 std::vectorT maStorage;
 CellType meType1;
 CellType meType2;
 SCROW mnRowStart;
 
-ColumnBatch(CellType eType1, CellType eType2) :
-meType1(eType1), meType2(eType2), mnRowStart(-1) {}
+ColumnBatch( ScDocument* pHostDoc, ScDocument* pSrcDoc, CellType eType1, 
CellType eType2 ) :
+mpHostDoc(pHostDoc),
+mpSrcDoc(pSrcDoc),
+meType1(eType1),
+meType2(eType2),
+mnRowStart(-1) {}
 
 void update(ScRefCellValue raCell, const SCCOL nCol, const SCROW nRow, 
ScMatrixRef xMat)
 {
@@ -1380,7 +1391,8 @@ struct ColumnBatch
 template
 inline svl::SharedString 
ColumnBatchsvl::SharedString::getValue(ScRefCellValue rCell) const
 {
-return svl::SharedString(rCell.getString(NULL));
+OUString aStr = rCell.getString(mpSrcDoc);
+return mpHostDoc-GetSharedStringPool().intern(aStr);
 }
 
 templateclass T
@@ -1402,7 +1414,7 @@ inline void ColumnBatchT::putValues(ScMatrixRef xMat, 
const SCCOL nCol) const
 }
 
 static ScTokenArray* convertToTokenArray(
-ScDocument* pSrcDoc, ScRange rRange, 
vectorScExternalRefCache::SingleRangeData rCacheData )
+ScDocument* pHostDoc, ScDocument* pSrcDoc, ScRange rRange, 
vectorScExternalRefCache::SingleRangeData rCacheData )
 {
 ScAddress s = rRange.aStart;
 ScAddress e = rRange.aEnd;
@@ -1448,8 +1460,8 @@ static ScTokenArray* convertToTokenArray(
 static_castSCSIZE(nCol2-nCol1+1), 
static_castSCSIZE(nRow2-nRow1+1));
 
 ScRefCellValue aCell;
-ColumnBatchsvl::SharedString aStringBatch(CELLTYPE_STRING, 
CELLTYPE_EDIT);
-ColumnBatchdouble aDoubleBatch(CELLTYPE_VALUE, CELLTYPE_VALUE);
+ColumnBatchsvl::SharedString aStringBatch(pHostDoc, pSrcDoc, 
CELLTYPE_STRING, CELLTYPE_EDIT);
+ColumnBatchdouble aDoubleBatch(pHostDoc, pSrcDoc, CELLTYPE_VALUE, 
CELLTYPE_VALUE);
 
 for (SCCOL nCol = nDataCol1; nCol = nDataCol2; ++nCol)
 {
@@ -1483,6 +1495,7 @@ static ScTokenArray* convertToTokenArray(
 else
 {
 svl::SharedString aStr = pFCell-GetString();
+aStr = 
pHostDoc-GetSharedStringPool().intern(aStr.getString());
 xMat-PutString(aStr, nC, nR);
 }
 }
@@ -2033,7 +2046,7 @@ ScExternalRefCache::TokenRef 
ScExternalRefManager::getSingleRefTokenFromSrcDoc(
 // Get the cell from src doc, and convert it into a token.
 ScRefCellValue aCell;
 aCell.assign(*pSrcDoc, rPos);
-ScExternalRefCache::TokenRef pToken(convertToToken(aCell));
+ScExternalRefCache::TokenRef pToken(convertToToken(mpDoc, pSrcDoc, aCell));
 
 if (!pToken.get())
 {
@@ -2086,7 +2099,7 @@ ScExternalRefCache::TokenArrayRef 
ScExternalRefManager::getDoubleRefTokensFromSr
 aRange.aStart.SetTab(nTab1);
 

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

2014-02-13 Thread Kohei Yoshida
 sc/qa/unit/ucalc_formula.cxx|   53 +
 sc/source/core/data/dociter.cxx |  388 
 2 files changed, 333 insertions(+), 108 deletions(-)

New commits:
commit 377d749ff8211fa9e69d47a92810af9bc0652990
Author: Kohei Yoshida kohei.yosh...@collabora.com
Date:   Thu Feb 13 14:45:47 2014 -0500

fdo#74558: Re-implement BinarySearch() to disregard empty cell blocks.

The old code before the calc core refactoring took advantage of the old
calc storage which did not store empty cells at all.  The new storage does
store empty cell blocks, and it did negatively affect the binary search
used for VLOOKUP.  The revised binary search code properly skips empty cell
blocks so that it will work more like the old algorithm in 4.1.

This change also fixes fdo#72348, which was caused by the same root cause.

Change-Id: Ic20cc54d8dae26b62f5e9193cd21dad06ad10a3e

diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 5bb9236..de63eb5 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -67,6 +67,14 @@ void incBlock(std::pair_Iter, size_t rPos)
 }
 
 templatetypename _Iter
+void decBlock(std::pair_Iter, size_t rPos)
+{
+// Move to the last element of the previous block.
+--rPos.first;
+rPos.second = rPos.first-size - 1;
+}
+
+templatetypename _Iter
 void incPos(std::pair_Iter, size_t rPos)
 {
 if (rPos.second + 1  rPos.first-size)
@@ -1439,6 +1447,204 @@ bool ScQueryCellIterator::FindEqualOrSortedLastInRange( 
SCCOL nFoundCol,
 return (nFoundCol = MAXCOL)  (nFoundRow = MAXROW);
 }
 
+namespace {
+
+/**
+ * This class sequentially indexes non-empty cells in order, from the top of
+ * the block where the start row position is, to the bottom of the block
+ * where the end row position is.  It skips all empty blocks that may be
+ * present in between.
+ *
+ * The index value is an offset from the first element of the first block
+ * disregarding all empty cell blocks.
+ */
+class NonEmptyCellIndexer
+{
+typedef std::mapsize_t, sc::CellStoreType::const_iterator BlockMapType;
+
+BlockMapType maBlockMap;
+
+const sc::CellStoreType mrCells;
+SCROW mnStartRow;
+SCROW mnEndRow;
+
+size_t mnLowIndex;
+size_t mnHighIndex;
+
+bool mbValid;
+
+public:
+
+typedef std::pairScRefCellValue, SCROW CellType;
+
+/**
+ * @param rCells cell storage container
+ * @param nStartRow logical start row position
+ * @param nEndRow logical end row position, inclusive.
+ * @param bSkipTopStrBlock when true, skip all leading string cells.
+ */
+NonEmptyCellIndexer(
+const sc::CellStoreType rCells, SCROW nStartRow, SCROW nEndRow, bool 
bSkipTopStrBlock ) :
+mrCells(rCells), mnStartRow(nStartRow), mnEndRow(nEndRow), 
mnLowIndex(0), mnHighIndex(0), mbValid(true)
+{
+if (nEndRow  nStartRow)
+{
+mbValid = false;
+return;
+}
+
+// Find the low position.
+
+sc::CellStoreType::const_position_type aLoPos = 
mrCells.position(nStartRow);
+if (aLoPos.first-type == sc::element_type_empty)
+incBlock(aLoPos);
+
+if (aLoPos.first == rCells.end())
+{
+mbValid = false;
+return;
+}
+
+if (bSkipTopStrBlock)
+{
+// Skip all leading string or empty blocks.
+while (aLoPos.first-type == sc::element_type_string ||
+   aLoPos.first-type == sc::element_type_edittext ||
+   aLoPos.first-type == sc::element_type_empty)
+{
+incBlock(aLoPos);
+if (aLoPos.first == rCells.end())
+{
+mbValid = false;
+return;
+}
+}
+}
+
+SCROW nFirstRow = aLoPos.first-position;
+SCROW nLastRow = aLoPos.first-position + aLoPos.first-size - 1;
+
+if (nFirstRow  nEndRow)
+{
+// Both start and end row positions are within the leading skipped
+// blocks.
+mbValid = false;
+return;
+}
+
+// Calculate the index of the low position.
+if (nFirstRow  nStartRow)
+mnLowIndex = nStartRow - nFirstRow;
+else
+{
+// Start row is within the skipped block(s). Set it to the first
+// element of the low block.
+mnLowIndex = 0;
+}
+
+if (nEndRow  nLastRow)
+{
+assert(nEndRow  nFirstRow);
+mnHighIndex = nEndRow - nFirstRow;
+
+maBlockMap.insert(BlockMapType::value_type(aLoPos.first-size, 
aLoPos.first));
+return;
+}
+
+// Find the high position.
+
+sc::CellStoreType::const_position_type aHiPos = 
mrCells.position(aLoPos.first, nEndRow);
+if (aHiPos.first-type == 

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

2013-11-22 Thread Ray
 sc/qa/unit/data/ods/opencl/statistical/parallel_count_bug_243.ods |binary
 sc/qa/unit/opencl-test.cxx|   28 
++
 sc/source/core/opencl/formulagroupcl.cxx  |2 
 sc/source/core/opencl/formulagroupcl_public.hxx   |2 
 4 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit a2972f7d8c5037acb278d9f9fb6e51cef479de1a
Author: I-Jui (Ray) Sung r...@multicorewareinc.com
Date:   Fri Nov 22 11:48:14 2013 -0600

GPU Calc: using intrinsic isnan()

Change-Id: Ic714074a22847fbe4ac39cd035d4924fb0525efd

diff --git a/sc/source/core/opencl/formulagroupcl_public.hxx 
b/sc/source/core/opencl/formulagroupcl_public.hxx
index d001a06..eaf4227 100644
--- a/sc/source/core/opencl/formulagroupcl_public.hxx
+++ b/sc/source/core/opencl/formulagroupcl_public.hxx
@@ -11,7 +11,7 @@
 #define SC_OPENCL_FORMULAGROUPCL_PUBLIC_HXX
 
 const char* publicFunc =
- int isNan(double a) { return a != a; }\n
+ int isNan(double a) { return isnan(a); }\n
  double fsum_count(double a, double b, __private int *p) {\n
  bool t = isNan(a);\n
  (*p) += t?0:1;\n
commit 1869c062c4fe8267323764e2cc9e7367e1ec3674
Author: I-Jui (Ray) Sung r...@multicorewareinc.com
Date:   Fri Nov 22 11:38:21 2013 -0600

GPU Calc: test case for parallel count()

AMLOEXT-243 BUG

Change-Id: I97e2dab35b40f4f7fcd4975ae7c5907e97e19fd9

diff --git a/sc/qa/unit/data/ods/opencl/statistical/parallel_count_bug_243.ods 
b/sc/qa/unit/data/ods/opencl/statistical/parallel_count_bug_243.ods
new file mode 100644
index 000..4a8d5f9
Binary files /dev/null and 
b/sc/qa/unit/data/ods/opencl/statistical/parallel_count_bug_243.ods differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 3f02d9b..faf2ddb 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -242,6 +242,7 @@ public:
 void testStatisticalFormulaCovar();
 void testLogicalFormulaAnd();
 void testMathFormulaSumProduct();
+void testStatisticalParallelCountBug();
 CPPUNIT_TEST_SUITE(ScOpenclTest);
 CPPUNIT_TEST(testSharedFormulaXLS);
 CPPUNIT_TEST(testFinacialFormula);
@@ -415,6 +416,7 @@ public:
 CPPUNIT_TEST(testStatisticalFormulaCovar);
 CPPUNIT_TEST(testLogicalFormulaAnd);
 CPPUNIT_TEST(testMathFormulaSumProduct);
+CPPUNIT_TEST(testStatisticalParallelCountBug);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -4818,6 +4820,32 @@ void ScOpenclTest:: testLogicalFormulaAnd()
 xDocSh-DoClose();
 xDocShRes-DoClose();
 }
+
+//[AMLOEXT-243]
+void ScOpenclTest:: testStatisticalParallelCountBug()
+{
+if (!detectOpenCLDevice())
+return;
+ScDocShellRef xDocSh =
+loadDoc(opencl/statistical/parallel_count_bug_243., ODS);
+ScDocument *pDoc = xDocSh-GetDocument();
+CPPUNIT_ASSERT(pDoc);
+enableOpenCL();
+pDoc-CalcAll();
+ScDocShellRef xDocShRes =
+loadDoc(opencl/statistical/parallel_count_bug_243., ODS);
+ScDocument *pDocRes = xDocShRes-GetDocument();
+CPPUNIT_ASSERT(pDocRes);
+for (SCROW i = 0; i  13; ++i)
+{
+double fLibre = pDoc-GetValue(ScAddress(2, i, 0));
+double fExcel = pDocRes-GetValue(ScAddress(2, i, 0));
+CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
+}
+xDocSh-DoClose();
+xDocShRes-DoClose();
+}
+
 ScOpenclTest::ScOpenclTest()
   : ScBootstrapFixture( /sc/qa/unit/data )
 {
commit 8b9c106064b6899e4bb4a86efb8906eef758c5bf
Author: I-Jui (Ray) Sung r...@multicorewareinc.com
Date:   Fri Nov 22 11:42:14 2013 -0600

GPU Calc: fix a parallel COUNT() problem when input vector size  512

AMLOEXT-243 FIX

Change-Id: I1a356f9a591c1f5a99d2675065b63a7673217ac6

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 7843748..b0bb011 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -695,7 +695,7 @@ public:
 ss  if (lidx == 0)\n;
 ss  current_result =;
 if (dynamic_castOpCount*(mpCodeGen.get()))
-ss  shm_buf[0];
+ss  current_result + shm_buf[0];
 else
 ss  mpCodeGen-Gen2(current_result, shm_buf[0]);
 ss  ;\n;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-11-18 Thread Ray
 sc/qa/unit/data/ods/opencl/compiler/horizontal.ods |binary
 sc/qa/unit/opencl-test.cxx |   32 +++
 sc/source/core/opencl/formulagroupcl.cxx   |   88 ++---
 sc/source/core/opencl/opbase.cxx   |   12 ++
 sc/source/core/opencl/opbase.hxx   |7 -
 5 files changed, 90 insertions(+), 49 deletions(-)

New commits:
commit 912d23636a55473221e3e35768fb9ac42c3e9b76
Author: I-Jui (Ray) Sung r...@multicorewareinc.com
Date:   Mon Nov 18 15:05:25 2013 -0600

GPU Calc: turn on parallel sumifs and parallel sum reduce

Change-Id: Id615ea0f5f16a4dfc517aacb30715c2df84553e3

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 3a63c92..9d1e2a9 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -426,9 +426,10 @@ public:
 }
 virtual bool NeedParallelReduction(void) const
 {
-if (dynamic_castOpSum*(mpCodeGen.get())
- !dynamic_castOpAverage*(mpCodeGen.get()))
-return GetWindowSize() 100 
+if ((dynamic_castOpSum*(mpCodeGen.get())
+ !dynamic_castOpAverage*(mpCodeGen.get())) ||
+dynamic_castOpSumIfs*(mpCodeGen.get()))
+return GetWindowSize() 4 
 ( (GetStartFixed()  GetEndFixed()) ||
   (!GetStartFixed()  !GetEndFixed())  ) ;
 else
@@ -457,10 +458,10 @@ public:
 ss  tmp = 0.0;\n;
 ss  int loopOffset = l*512;\n;
 ss  if((loopOffset + lidx + offset + 256)  min( offset + 
windowSize, arrayLength))\n;
-ss  tmp = A[loopOffset + lidx + offset] + 
-A[loopOffset + lidx + offset + 256];\n;
+ss  tmp = fsum(A[loopOffset + lidx + offset], 0) + 
+fsum(A[loopOffset + lidx + offset + 256], 0);\n;
 ss  else if ((loopOffset + lidx + offset)  min(offset + 
windowSize, arrayLength))\n;
-ss  tmp = A[loopOffset + lidx + offset];\n;
+ss  tmp = fsum(A[loopOffset + lidx + offset], 0);\n;
 ss  shm_buf[lidx] = tmp;\n;
 ss  barrier(CLK_LOCAL_MEM_FENCE);\n;
 ss  for (int i = 128; i 0; i/=2) {\n;
@@ -496,7 +497,8 @@ public:
 size_t nCurWindowSize = mpDVR-GetRefRowSize();
 if (dynamic_castOpSum*(mpCodeGen.get()))
 {
-if (!bIsStartFixed  !bIsEndFixed)
+if ((!bIsStartFixed  !bIsEndFixed) ||
+(bIsStartFixed  bIsEndFixed))
 {
 // set 100 as a temporary threshold for invoking reduction
 // kernel in NeedParalleLReduction function
@@ -510,21 +512,6 @@ public:
 return nCurWindowSize;
 }
 }
-
-if (bIsStartFixed  bIsEndFixed)
-{
-// set 100 as a temporary threshold for invoking reduction
-// kernel in NeedParalleLReduction function
-if (NeedParallelReduction())
-{
-std::string temp = Base::GetName() + [0];
-ss  tmp = ;
-ss  mpCodeGen-Gen2(temp, tmp);
-ss  ;\n\t;
-needBody = false;
-return nCurWindowSize;
-}
-}
 }
 needBody = true;
 
@@ -576,7 +563,8 @@ public:
 
 virtual size_t Marshal(cl_kernel k, int argno, int w, cl_program mpProgram)
 {
-if (!NeedParallelReduction())
+if (!NeedParallelReduction() ||
+dynamic_castOpSumIfs*(mpCodeGen.get()))
 return Base::Marshal(k, argno, w, mpProgram);
 
 assert(Base::mpClmem == NULL);
commit af223ecdf01b76bc1005c8fcc342165639a8823f
Author: I-Jui (Ray) Sung r...@multicorewareinc.com
Date:   Mon Nov 18 13:39:02 2013 -0600

GPU Calc: testcases for horizontal ranges

AMLOEXT-242 BUG

Change-Id: I4b87bdf6183ed81ad767550f5cd49aab51531cf2

diff --git a/sc/qa/unit/data/ods/opencl/compiler/horizontal.ods 
b/sc/qa/unit/data/ods/opencl/compiler/horizontal.ods
new file mode 100644
index 000..18edf64
Binary files /dev/null and b/sc/qa/unit/data/ods/opencl/compiler/horizontal.ods 
differ
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 3f90040..3f02d9b 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -81,6 +81,7 @@ public:
 void testFinacialRateFormula();
 void testFinancialAccrintmFormula();
 void testFinancialAccrintFormula();
+void testCompilerHorizontal();
 void testCompilerNested();
 void testFinacialSLNFormula();
 void testStatisticalFormulaGammaLn();
@@ -251,6 +252,7 @@ public:
 CPPUNIT_TEST(testFinacialIRRFormula);
 CPPUNIT_TEST(testFinacialMIRRFormula);
 CPPUNIT_TEST(testFinacialRateFormula);
+

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

2013-11-16 Thread hongyu zhong
 sc/qa/unit/data/xls/opencl/statistical/Betainv.xls |binary
 sc/qa/unit/opencl-test.cxx |   25 +++
 sc/source/core/opencl/formulagroupcl.cxx   |   10 +
 sc/source/core/opencl/op_statistical.cxx   |  153 +
 sc/source/core/opencl/op_statistical.hxx   |8 -
 sc/source/core/opencl/opbase.cxx   |4 
 sc/source/core/opencl/opinlinefun_statistical.cxx  |1 
 sc/source/core/tool/token.cxx  |1 
 8 files changed, 197 insertions(+), 5 deletions(-)

New commits:
commit 811c671c7ff3229dab1ed9ae81fa9723c603fa80
Author: hongyu zhong hon...@multicorewareinc.com
Date:   Sat Nov 16 17:33:30 2013 +0800

GPU Calc: implemented BETAINV

AMLOEXT-201 FIX

Change-Id: I68a7277b7353ed5a6f4d2ea8d1a4f7fb894bf487
Signed-off-by: haochen haoc...@multicorewareinc.com

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 45ab642..d2a10c5 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1762,6 +1762,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
 mvSubArguments.push_back(SoPHelper(ts,
  ft-Children[i],new OpSumX2PY2));
  break;
+case ocBetaInv:
+mvSubArguments.push_back(SoPHelper(ts,
+ ft-Children[i],new OpBetainv));
+ break;
 case ocExternal:
 if ( !(pChild-GetExternal().compareTo(OUString(
 com.sun.star.sheet.addin.Analysis.getEffect
diff --git a/sc/source/core/opencl/op_statistical.cxx 
b/sc/source/core/opencl/op_statistical.cxx
index ddad803..48c015d 100644
--- a/sc/source/core/opencl/op_statistical.cxx
+++ b/sc/source/core/opencl/op_statistical.cxx
@@ -6198,6 +6198,159 @@ void 
OpBetaDist::GenSlidingWindowFunction(std::stringstream ss,
 ss  return tmp;\n;
 ss  }\n;
 }
+void OpBetainv::BinInlineFun(std::setstd::string decls,
+std::setstd::string funs)
+{
+decls.insert(fMachEpsDecl);
+funs.insert();
+decls.insert(fMaxGammaArgumentDecl);
+funs.insert();
+decls.insert(lcl_IterateInverseBetaInvDecl);
+funs.insert(lcl_IterateInverseBetaInv);
+decls.insert(GetBetaDistDecl);
+funs.insert(GetBetaDist);
+decls.insert(lcl_HasChangeOfSignDecl);
+funs.insert(lcl_HasChangeOfSign);
+decls.insert(lcl_HasChangeOfSignDecl);
+funs.insert(lcl_HasChangeOfSign);
+decls.insert(lcl_HasChangeOfSignDecl);
+funs.insert(lcl_HasChangeOfSign);
+decls.insert(lcl_GetBetaHelperContFracDecl);
+funs.insert(lcl_GetBetaHelperContFrac);
+decls.insert(GetBetaDistPDFDecl);
+funs.insert(GetBetaDistPDF);
+decls.insert(GetLogBetaDecl);
+funs.insert(GetLogBeta);
+decls.insert(GetBetaDecl);
+funs.insert(GetBeta);
+decls.insert(lcl_getLanczosSumDecl);
+funs.insert(lcl_getLanczosSum);
+}
+void OpBetainv::GenSlidingWindowFunction(
+std::stringstream ss,const std::string sSymName,
+SubArguments vSubArguments)
+{
+ss  \ndouble   sSymName;
+ss  _ BinFuncName() (;
+for (unsigned i = 0; i  vSubArguments.size(); i++)
+{
+if (i)
+ss  ,;
+vSubArguments[i]-GenSlidingWindowDecl(ss);
+}
+ss  )\n;
+ss  {\n;
+ss  double tmp0,tmp1,tmp2,tmp3,tmp4;\n;
+ss  int gid0=get_global_id(0);\n;
+size_t i = vSubArguments.size();
+size_t nItems = 0;
+ss \n;
+//while (i--  1)
+for (i = 0; i  vSubArguments.size(); i++)
+{
+FormulaToken *pCur = vSubArguments[i]-GetFormulaToken();
+assert(pCur);
+if (pCur-GetType() == formula::svDoubleVectorRef)
+{
+const formula::DoubleVectorRefToken* pDVR =
+dynamic_castconst formula::DoubleVectorRefToken *(pCur);
+size_t nCurWindowSize = pDVR-GetRefRowSize();
+ss  for (int i = ;
+if (!pDVR-IsStartFixed()  pDVR-IsEndFixed()) {
+#ifdef  ISNAN
+ss  gid0; ipDVR-GetArrayLength();
+ssinCurWindowSize   ; i++){\n;
+#else
+ss  gid0; i   nCurWindowSize  ; i++)\n;
+#endif
+} else if (pDVR-IsStartFixed()  !pDVR-IsEndFixed()) {
+#ifdef  ISNAN
+ss  0; ipDVR-GetArrayLength();
+ssi  gid0+ nCurWindowSize  ; i++){\n;
+#else
+ss  0; i  gid0+ nCurWindowSize  ; i++)\n;
+#endif
+} else if (!pDVR-IsStartFixed()  !pDVR-IsEndFixed()){
+#ifdef  ISNAN
+ss  0; i + gid0pDVR-GetArrayLength();
+ss i   nCurWindowSize  ; i++){\n;
+#else
+ss  0; i   nCurWindowSize  ; i++)\n;
+#endif
+}
+else {
+#ifdef  ISNAN
+ss  0; i   nCurWindowSize  ; i++){\n;
+#else
+ss  0; i   nCurWindowSize  ; i++)\n;
+#endif
+}
+

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

2013-11-03 Thread Ray
 sc/qa/unit/data/xls/opencl/financial/PPMT.xls |binary
 sc/qa/unit/opencl-test.cxx|   25 ++
 sc/source/core/opencl/op_financial.cxx|  218 --
 3 files changed, 159 insertions(+), 84 deletions(-)

New commits:
commit 3c9042ad3db8064af2ccd5171385ee1aaf59d9cf
Author: I-Jui (Ray) Sung r...@multicorewareinc.com
Date:   Sun Nov 3 22:24:38 2013 -0600

GPU Calc: fixed compiler warnings

Change-Id: I9f8af5827340de24a45c9230c6ce2ec186ba8cc6

diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index c8eee29..329dd77 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -2089,7 +2089,6 @@ void OpPMT::GenSlidingWindowFunction(std::stringstream 
ss,
  ssdouble tmp2=0;\n;
  ssdouble tmp3=0;\n;
  ssdouble tmp4=0,tmp5=0;\n;
- unsigned i = vSubArguments.size();
  size_t nItems = 0;
  ss \n;
  //while (i--  1)
commit acd9cdf4be3537893830ac221fa578bf1312002f
Author: mulei mu...@multicorewareinc.com
Date:   Mon Nov 4 10:19:30 2013 +0800

GPU Calc: implement NAN argument handling in PPMT

AMLOEXT-119 FIX

Change-Id: I43dcd08ff846a4008f13c9d02a69478898363131
Signed-off-by: haochen haoc...@multicorewareinc.com
Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com

diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index f2ae100..c8eee29 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -2069,89 +2069,142 @@ void OpPMT::GenSlidingWindowFunction(std::stringstream 
ss,
 funs.insert(GetZw);
 }
 
-void OpPPMT::GenSlidingWindowFunction(std::stringstream ss,
-const std::string sSymName, SubArguments vSubArguments)
-{
-ArgVector argVector;
-ss  \ndouble   sSymName;
-ss  _ BinFuncName() (;
-for (unsigned i = 0; i  vSubArguments.size(); i++)
-{
-if (i)
-ss  ,;
-vSubArguments[i]-GenSlidingWindowDecl(ss);
-argVector.push_back(vSubArguments[i]-GenSlidingWindowDeclRef());
-}
-ss  ) {\n\t;
-ss  int gid0 = get_global_id(0);\n\t;
-ssdouble tFv=0,tType=0;\n\t;
-if(vSubArguments.size()==5)
-sstFv=vSubArguments[4]-GenSlidingWindowDeclRef();\n\t;
-else if(vSubArguments.size()==6)
-{
-sstType=vSubArguments[5]-GenSlidingWindowDeclRef();
-ss;\n\t;
-sstFv=vSubArguments[4]-GenSlidingWindowDeclRef();
-ss;\n\t;
-}
-ss  double tmp = 0.0;\n\t;
-ss double pmt ;\n\t;
-ssif(vSubArguments[0]-GenSlidingWindowDeclRef()==0.0)\n\t;
-ss\treturn (vSubArguments[3]-GenSlidingWindowDeclRef();
-ss+tFv)/;
-ssvSubArguments[2]-GenSlidingWindowDeclRef();\n\t;
-ss double temp1=0;\n\t;
-ss double abl = pow(1.0+;
-ss vSubArguments[0]-GenSlidingWindowDeclRef();
-ss,;
-ss vSubArguments[2]-GenSlidingWindowDeclRef();
-ss);\n\t;
-ss temp1-=tFv;
-ss;\n\t;
-sstemp1-=;
-ssvSubArguments[3]-GenSlidingWindowDeclRef();
-ss*abl;\n\t;
-ss pmt = temp1/(1.0+;
-ssvSubArguments[0]-GenSlidingWindowDeclRef();
-ss*tType;
-ss) / ( (abl-1.0)/;
-ssvSubArguments[0]-GenSlidingWindowDeclRef();
-ss);\n\t;
-ss double temp = pow( 1+;
-ssvSubArguments[0]-GenSlidingWindowDeclRef();
-ss ,;
-ssvSubArguments[1]-GenSlidingWindowDeclRef();
-ss-2);\n\t;
-ss double re;\n\t;
-ss if (tType;
-ss == 0)\n\t;
-ss {\n\t;
-ss re = -;
-ssvSubArguments[0]-GenSlidingWindowDeclRef();
-ss * ;
-ssvSubArguments[3]-GenSlidingWindowDeclRef();
-ss*pow(1+;
-ssvSubArguments[0]-GenSlidingWindowDeclRef();
-ss ,;
-vSubArguments[1]-GenSlidingWindowDeclRef();
-ss-1) - pmt * (pow(1+;
-ssvSubArguments[0]-GenSlidingWindowDeclRef();
-ss ,;
-ssvSubArguments[1]-GenSlidingWindowDeclRef();
-ss-1)-1);\n\t;
-ss }\n\t;
-ss else\n\t;
-ss {\n\t;
-ss re = -;
-ssvSubArguments[0]-GenSlidingWindowDeclRef();
-ss * (;
-ssvSubArguments[3]-GenSlidingWindowDeclRef();
-ss + pmt)* temp - pmt * (temp-1);\n\t;
-ss }\n\t;
-ss tmp = pmt - re;\n\t;
-ss  return tmp;\n;
-ss  };
-}
+ void OpPPMT::GenSlidingWindowFunction(std::stringstream ss,
+ const std::string sSymName, SubArguments vSubArguments)
+ {
+ ArgVector argVector;
+ ss  \ndouble   sSymName;
+ ss  _ BinFuncName() (;
+ for (unsigned i = 0; i  vSubArguments.size(); i++)
+ {
+ if (i)
+ ss  , ;
+ vSubArguments[i]-GenSlidingWindowDecl(ss);
+ }
+ ss  ) {\n;
+ ss  double tmp = 0;\n;
+ ss  int gid0 = get_global_id(0);\n;
+ ssdouble tmp0=0;\n;
+ ssdouble tmp1=0;\n;
+ ssdouble tmp2=0;\n;
+ ssdouble tmp3=0;\n;
+ ssdouble tmp4=0,tmp5=0;\n;
+ unsigned i = vSubArguments.size();
+ size_t nItems = 0;
+ ss \n

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

2013-11-03 Thread Ray
 sc/qa/unit/data/xls/opencl/financial/Price.xls |binary
 sc/qa/unit/opencl-test.cxx |   25 +
 sc/source/core/opencl/formulagroupcl.cxx   |6 
 sc/source/core/opencl/op_financial.cxx |  371 +
 sc/source/core/opencl/op_financial.hxx |8 
 5 files changed, 294 insertions(+), 116 deletions(-)

New commits:
commit 0beb28ce1bec18b84402f2eb2f598c19f5c2
Author: I-Jui (Ray) Sung r...@multicorewareinc.com
Date:   Sun Nov 3 23:15:04 2013 -0600

GPU Calc: refactor op_financial.cxx to fix warning and bad indentation

Change-Id: I93db1e5d2b03904a3d7787cc16f642ebf4752d85

diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index fb6610e..f9f1fa6 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -2155,241 +2155,239 @@ void 
OpPrice::GenSlidingWindowFunction(std::stringstream ss,
 ssdouble tmp3=0;\n;
 ssdouble tmp4=0,tmp5=0;\n;
 ssdouble tmp6=0;\n;
-unsigned i = vSubArguments.size();
 size_t nItems = 0;
 ss \n;
-//while (i--  1)
-   for (size_t i = 0; i  vSubArguments.size(); i++)
-   {
-   FormulaToken *pCur = vSubArguments[i]-GetFormulaToken();
-   assert(pCur);
-   if (pCur-GetType() == formula::svDoubleVectorRef)
-   {
-   const formula::DoubleVectorRefToken* pDVR =
-   dynamic_castconst formula::DoubleVectorRefToken *(pCur);
-   size_t nCurWindowSize = pDVR-GetRefRowSize();
-   ss  for (int i = ;
-   if (!pDVR-IsStartFixed()  pDVR-IsEndFixed()) {
+for (size_t i = 0; i  vSubArguments.size(); i++)
+{
+FormulaToken *pCur = vSubArguments[i]-GetFormulaToken();
+assert(pCur);
+if (pCur-GetType() == formula::svDoubleVectorRef)
+{
+const formula::DoubleVectorRefToken* pDVR =
+dynamic_castconst formula::DoubleVectorRefToken *(pCur);
+size_t nCurWindowSize = pDVR-GetRefRowSize();
+ss  for (int i = ;
+if (!pDVR-IsStartFixed()  pDVR-IsEndFixed()) {
 #ifdef  ISNAN
-   ss  gid0; ipDVR-GetArrayLength();
-   ssinCurWindowSize   ; i++){\n;
+ss  gid0; ipDVR-GetArrayLength();
+ssinCurWindowSize   ; i++){\n;
 #else
-   ss  gid0; i   nCurWindowSize  ; i++)\n;
+ss  gid0; i   nCurWindowSize  ; i++)\n;
 #endif
-   } else if (pDVR-IsStartFixed()  !pDVR-IsEndFixed()) {
+} else if (pDVR-IsStartFixed()  !pDVR-IsEndFixed()) {
 #ifdef  ISNAN
-   ss  0; ipDVR-GetArrayLength();
-   ssi  gid0+ nCurWindowSize  ; i++){\n;
+ss  0; ipDVR-GetArrayLength();
+ssi  gid0+ nCurWindowSize  ; i++){\n;
 #else
-   ss  0; i  gid0+ nCurWindowSize  ; i++)\n;
+ss  0; i  gid0+ nCurWindowSize  ; i++)\n;
 #endif
-   } else if (!pDVR-IsStartFixed()  !pDVR-IsEndFixed()){
+} else if (!pDVR-IsStartFixed()  !pDVR-IsEndFixed()){
 #ifdef  ISNAN
-   ss  0; i + gid0pDVR-GetArrayLength();
-   ss i   nCurWindowSize  ; i++){\n;
+ss  0; i + gid0pDVR-GetArrayLength();
+ss i   nCurWindowSize  ; i++){\n;
 #else
-   ss  0; i   nCurWindowSize  ; i++)\n;
+ss  0; i   nCurWindowSize  ; i++)\n;
 #endif
-   }
-   else {
+}
+else {
 #ifdef  ISNAN
-   ss  0; i   nCurWindowSize  ; i++){\n;
+ss  0; i   nCurWindowSize  ; i++){\n;
 #else
-   ss  0; i   nCurWindowSize  ; i++)\n;
+ss  0; i   nCurWindowSize  ; i++)\n;
 #endif
-   }
-   nItems += nCurWindowSize;
-   }
-   else if (pCur-GetType() == formula::svSingleVectorRef)
-   {
+}
+nItems += nCurWindowSize;
+}
+else if (pCur-GetType() == formula::svSingleVectorRef)
+{
 #ifdef  ISNAN
-   const formula::SingleVectorRefToken* pSVR =
-   dynamic_cast const formula::SingleVectorRefToken* (pCur);
-   ss  if (gid0pSVR-GetArrayLength()  ){\n;
+const formula::SingleVectorRefToken* pSVR =
+dynamic_cast const formula::SingleVectorRefToken* (pCur);
+ss  if (gid0pSVR-GetArrayLength()  ){\n;
 #else
-   nItems += 1;
+nItems += 1;
 #endif
-   }
-   else if (pCur-GetType() == formula::svDouble)
-   {
+}
+else if (pCur-GetType() == formula::svDouble)
+{
 #ifdef  ISNAN
-   ss  {\n;
+ss  {\n;
 #endif
-   nItems += 1;
-   }
-   else
-   {
+

[Libreoffice-commits] core.git: 3 commits - sc/qa sc/source solenv/gbuild

2013-11-03 Thread Markus Mohrhard
 sc/qa/unit/data/xls/opencl/math/sinh.xls |binary
 sc/qa/unit/opencl-test.cxx   |   20 
 sc/source/core/opencl/formulagroupcl.cxx |3 +++
 sc/source/core/opencl/op_math.cxx|   31 +++
 sc/source/core/opencl/op_math.hxx|7 +++
 sc/source/core/tool/token.cxx|1 +
 solenv/gbuild/platform/com_MSC_defs.mk   |2 +-
 7 files changed, 63 insertions(+), 1 deletion(-)

New commits:
commit d36adbd5accd06917edf027cd619ac7eb9540613
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Mon Nov 4 00:27:53 2013 +0100

add original PATH to PATH during unit tests

we need this for our opencl tests to be able to execute the opencl compiler 
during the test

Change-Id: I9f9e8f3ceb26ff62789d888e6eb9f4f94010bb1f

Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com

diff --git a/solenv/gbuild/platform/com_MSC_defs.mk 
b/solenv/gbuild/platform/com_MSC_defs.mk
index cf0e43a..c76d65a 100644
--- a/solenv/gbuild/platform/com_MSC_defs.mk
+++ b/solenv/gbuild/platform/com_MSC_defs.mk
@@ -294,6 +294,6 @@ gb_LTOFLAGS := $(if $(filter TRUE,$(ENABLE_LTO)),-GL)
 # Helper class
 
 # need windows path with backslashes here
-gb_Helper_set_ld_path := PATH=$(shell cygpath -w 
$(INSTDIR)/$(LIBO_URE_LIB_FOLDER));$(shell cygpath -w 
$(INSTDIR)/$(LIBO_BIN_FOLDER))
+gb_Helper_set_ld_path := PATH=$(PATH);$(shell cygpath -w 
$(INSTDIR)/$(LIBO_URE_LIB_FOLDER));$(shell cygpath -w 
$(INSTDIR)/$(LIBO_BIN_FOLDER))
 
 # vim: set noet sw=4:
commit b5c268388ddbc812c2ba07a196f1200a939c6a9a
Author: dechuang dechu...@multicorewareinc.com
Date:   Mon Nov 4 14:35:12 2013 +0800

GPU Calc: implement fix for SINH

AMLOEXT-116 FIX

Change-Id: I0c369a65ffb3de2ac91fdd3d04ca6afe658b9bee
Signed-off-by: haochen haoc...@multicorewareinc.com
Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 1cc0b9f..f0fd68b 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1020,6 +1020,9 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
 mvSubArguments.push_back(SoPHelper(ts,
  ft-Children[i], new OpDuration));
 break;
+case ocSinHyp:
+mvSubArguments.push_back(SoPHelper(ts,
+ ft-Children[i],new OpSinh));
 case ocExternal:
 if ( !(pChild-GetExternal().compareTo(OUString(
 com.sun.star.sheet.addin.Analysis.getEffect
diff --git a/sc/source/core/opencl/op_math.cxx 
b/sc/source/core/opencl/op_math.cxx
index 33ca0e5..32d2eb5 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -80,6 +80,37 @@ void OpCsc::GenSlidingWindowFunction(
 ss  };
 }
 
+void OpSinh::GenSlidingWindowFunction(std::stringstream ss,
+const std::string sSymName, SubArguments vSubArguments)
+{
+FormulaToken *tmpCur = vSubArguments[0]-GetFormulaToken();
+const formula::SingleVectorRefToken*tmpCurDVR= dynamic_castconst
+  formula::SingleVectorRefToken *(tmpCur);
+ss  \ndouble   sSymName;
+ss  _ BinFuncName() (;
+for (unsigned i = 0; i  vSubArguments.size(); i++)
+{
+if (i)
+ss  ,;
+vSubArguments[i]-GenSlidingWindowDecl(ss);
+}
+ss ) {\n;
+ss int gid0=get_global_id(0);\n;
+ss double arg0 =  
+vSubArguments[0]-GenSlidingWindowDeclRef();
+ss ;\n;
+#ifdef ISNAN
+ss if(isNan(arg0)||(gid0=;
+sstmpCurDVR-GetArrayLength();
+ss))\n;
+ssarg0 = 0;\n;
+#endif
+ss  double tmp=( exp(arg0)-exp(-arg0) )/2;\n;
+ss  return tmp;\n;
+ss  };
+}
+
+
 }}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/opencl/op_math.hxx 
b/sc/source/core/opencl/op_math.hxx
index dd497fb..7399a6a 100644
--- a/sc/source/core/opencl/op_math.hxx
+++ b/sc/source/core/opencl/op_math.hxx
@@ -31,6 +31,13 @@ public:
 virtual std::string BinFuncName(void) const { return Csc; }
 };
 
+class OpSinh: public Normal
+{
+public:
+virtual void GenSlidingWindowFunction(std::stringstream ss,
+const std::string sSymName, SubArguments vSubArguments);
+virtual std::string BinFuncName(void) const { return Sinh; }
+};
 }}
 
 #endif
commit cd4d44e5e8b540816ed7757e243f01256418b43e
Author: dechuang dechu...@multicorewareinc.com
Date:   Mon Nov 4 14:23:11 2013 +0800

GPU Calc: unit test cases for SINH

Need open macro NO_FALLBACK_TO_SWINTERP in formulagroupcl.cxx for test

AMLOEXT-116 BUG

Change-Id: Ic3cf18c9b475bc37bdca40cb64c582742bba8a5a
Signed-off-by: haochen haoc...@multicorewareinc.com
Signed-off-by: I-Jui (Ray) Sung r...@multicorewareinc.com

diff --git a/sc/qa/unit/data/xls/opencl/math/sinh.xls 

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

2013-09-27 Thread Markus Mohrhard
 sc/qa/unit/helper/qahelper.cxx |6 
 sc/qa/unit/helper/qahelper.hxx |2 +
 sc/qa/unit/ucalc.cxx   |   41 ++
 sc/qa/unit/ucalc.hxx   |4 ++
 sc/source/ui/view/tabview2.cxx |   56 +++--
 5 files changed, 101 insertions(+), 8 deletions(-)

New commits:
commit 93d22efb334ad85fd02deb83ec1baf538cf0cba3
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Fri Sep 27 17:28:47 2013 +0200

ignore hidden row/columns when navigating, fdo#45020

Change-Id: I597d7dbef07479f66894c7fce5ee21f340b43120

diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index 4566805..bcce76e 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -79,18 +79,38 @@ void moveCursorByProtRule(
 {
 for (SCCOL i = 0; i  nMovX  rCol  MAXCOL; ++i)
 {
-if (!isCellQualified(pDoc, rCol+1, rRow, nTab, bSelectLocked, 
bSelectUnlocked))
+SCCOL nNewUnhiddenCol = rCol + 1;
+SCCOL nEndCol = 0;
+while(pDoc-ColHidden(nNewUnhiddenCol, nTab, NULL, nEndCol))
+{
+if(nNewUnhiddenCol = MAXCOL)
+return;
+
+nNewUnhiddenCol = nEndCol +1;
+}
+
+if (!isCellQualified(pDoc, nNewUnhiddenCol, rRow, nTab, 
bSelectLocked, bSelectUnlocked))
 break;
-++rCol;
+rCol = nNewUnhiddenCol;
 }
 }
 else if (nMovX  0)
 {
 for (SCCOL i = 0; i  nMovX  rCol  0; --i)
 {
-if (!isCellQualified(pDoc, rCol-1, rRow, nTab, bSelectLocked, 
bSelectUnlocked))
+SCCOL nNewUnhiddenCol = rCol - 1;
+SCCOL nStartCol = 0;
+while(pDoc-ColHidden(nNewUnhiddenCol, nTab, nStartCol))
+{
+if(nNewUnhiddenCol = 0)
+return;
+
+nNewUnhiddenCol = nStartCol - 1;
+}
+
+if (!isCellQualified(pDoc, nNewUnhiddenCol, rRow, nTab, 
bSelectLocked, bSelectUnlocked))
 break;
---rCol;
+rCol = nNewUnhiddenCol;
 }
 }
 
@@ -98,18 +118,38 @@ void moveCursorByProtRule(
 {
 for (SCROW i = 0; i  nMovY  rRow  MAXROW; ++i)
 {
-if (!isCellQualified(pDoc, rCol, rRow+1, nTab, bSelectLocked, 
bSelectUnlocked))
+SCROW nNewUnhiddenRow = rRow + 1;
+SCROW nEndRow = 0;
+while(pDoc-RowHidden(nNewUnhiddenRow, nTab, NULL, nEndRow))
+{
+if(nNewUnhiddenRow = MAXROW)
+return;
+
+nNewUnhiddenRow = nEndRow + 1;
+}
+
+if (!isCellQualified(pDoc, rCol, nNewUnhiddenRow, nTab, 
bSelectLocked, bSelectUnlocked))
 break;
-++rRow;
+rRow = nNewUnhiddenRow;
 }
 }
 else if (nMovY  0)
 {
 for (SCROW i = 0; i  nMovY  rRow  0; --i)
 {
-if (!isCellQualified(pDoc, rCol, rRow-1, nTab, bSelectLocked, 
bSelectUnlocked))
+SCROW nNewUnhiddenRow = rRow - 1;
+SCROW nStartRow = 0;
+while(pDoc-RowHidden(nNewUnhiddenRow, nTab, nStartRow))
+{
+if(nNewUnhiddenRow = 0)
+return;
+
+nNewUnhiddenRow = nStartRow - 1;
+}
+
+if (!isCellQualified(pDoc, rCol, nNewUnhiddenRow, nTab, 
bSelectLocked, bSelectUnlocked))
 break;
---rRow;
+rRow = nNewUnhiddenRow;
 }
 }
 }
commit 690228ad4dd4cf10ad6292686d4aad8dcc9e2793
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Wed Sep 25 21:40:33 2013 +0200

add a unit test for fdo#66646

Change-Id: I15bef4e0422261ec473263ac8fc239604146f864

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 4331073..b0b6f32 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4202,6 +4202,27 @@ void Test::testCondFormatInsertRow()
 m_pDoc-DeleteTab(0);
 }
 
+void Test::testMixData()
+{
+m_pDoc-InsertTab(0, Test);
+
+m_pDoc-SetValue(1,0,0,2);
+m_pDoc-SetValue(0,1,0,3);
+ScDocument aClipDoc(SCDOCMODE_CLIP);
+copyToClip(m_pDoc, ScRange(0,0,0,1,0,0), aClipDoc);
+
+ScDocument aMixDoc(SCDOCMODE_CLIP);
+copyToClip(m_pDoc, ScRange(0,1,0,1,1,0), aMixDoc);
+
+pasteFromClip(m_pDoc, ScRange(0,1,0,1,1,0), aClipDoc);
+m_pDoc-MixDocument(ScRange(0,1,0,1,1,0), 1, false, aMixDoc);
+
+CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc-GetValue(1,1,0));
+CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc-GetValue(0,1,0));
+
+m_pDoc-DeleteTab(0);
+}
+
 void Test::printRange(ScDocument* pDoc, const ScRange rRange, const char* 
pCaption)
 {
 SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row();
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 698d683..3c46cab 100644
--- a/sc/qa/unit/ucalc.hxx
+++ 

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

2013-08-01 Thread Noel Power
 sc/qa/unit/data/xlsx/ProtecteSheet1234Pass.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx   |   32 +
 sc/source/filter/excel/excdoc.cxx   |5 ++
 sc/source/filter/excel/excrecds.cxx |   44 
 sc/source/filter/inc/excrecds.hxx   |8 
 sc/source/filter/oox/worksheetsettings.cxx  |   35 +++
 6 files changed, 118 insertions(+), 6 deletions(-)

New commits:
commit 96ef3ad2d84b3d390f0bdd47408d2a7b2c569087
Author: Noel Power noel.po...@suse.com
Date:   Thu Aug 1 16:41:11 2013 +0100

unit test for fdo#64753 ( import/export of sheetprotection )

Change-Id: Ib66a8ef62ba598890c7db634cf54003fd92485a7

diff --git a/sc/qa/unit/data/xlsx/ProtecteSheet1234Pass.xlsx 
b/sc/qa/unit/data/xlsx/ProtecteSheet1234Pass.xlsx
new file mode 100755
index 000..509ebe2
Binary files /dev/null and b/sc/qa/unit/data/xlsx/ProtecteSheet1234Pass.xlsx 
differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 19ecd3d..f881923 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -30,6 +30,7 @@
 #include tokenarray.hxx
 
 #include svx/svdoole2.hxx
+#include tabprotection.hxx
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -58,6 +59,7 @@ public:
 void testInlineArrayXLS();
 void testEmbeddedChartXLS();
 void testFormulaReferenceXLS();
+void testSheetProtectionXLSX();
 
 CPPUNIT_TEST_SUITE(ScExportTest);
 CPPUNIT_TEST(test);
@@ -73,6 +75,8 @@ public:
 CPPUNIT_TEST(testInlineArrayXLS);
 CPPUNIT_TEST(testEmbeddedChartXLS);
 CPPUNIT_TEST(testFormulaReferenceXLS);
+CPPUNIT_TEST(testSheetProtectionXLSX);
+
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -447,6 +451,34 @@ void ScExportTest::testFormulaReferenceXLS()
 xDocSh-DoClose();
 }
 
+void ScExportTest::testSheetProtectionXLSX()
+{
+ScDocShellRef xShell = loadDoc(ProtecteSheet1234Pass., XLSX);
+CPPUNIT_ASSERT(xShell.Is());
+
+ScDocShellRef xDocSh = saveAndReload(xShell, XLSX);
+CPPUNIT_ASSERT(xDocSh.Is());
+
+ScDocument* pDoc = xDocSh-GetDocument();
+CPPUNIT_ASSERT(pDoc);
+const ScTableProtection* pTabProtect = pDoc-GetTabProtection(0);
+CPPUNIT_ASSERT(pTabProtect);
+if ( pTabProtect )
+{
+Sequencesal_Int8 aHash = pTabProtect-getPasswordHash(PASSHASH_XL);
+// check has
+if (aHash.getLength() = 2)
+{
+CPPUNIT_ASSERT( (sal_uInt8)aHash[0] == 204 );
+CPPUNIT_ASSERT( (sal_uInt8)aHash[1] == 61 );
+}
+// we could flesh out this check I guess
+CPPUNIT_ASSERT ( pTabProtect-isOptionEnabled( 
ScTableProtection::OBJECTS ) );
+CPPUNIT_ASSERT ( pTabProtect-isOptionEnabled( 
ScTableProtection::SCENARIOS ) );
+}
+xDocSh-DoClose();
+}
+
 ScExportTest::ScExportTest()
   : ScBootstrapFixture(/sc/qa/unit/data)
 {
commit 8ce1124359783df750d176b8390b4eb0f54fb6ba
Author: Noel Power noel.po...@suse.com
Date:   Thu Aug 1 14:29:34 2013 +0100

2nd step to export SheetProtection fdo#64753, actually export the data

Change-Id: Id9fa1f9b917f9df8ca0ead02dfd5405388039b4b

diff --git a/sc/source/filter/excel/excdoc.cxx 
b/sc/source/filter/excel/excdoc.cxx
index b56f780..89dcce8 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -593,6 +593,11 @@ void ExcTable::FillAsXmlTable( SCTAB nCodeNameIdx )
 // conditional formats
 Add( new XclExpCondFormatBuffer( GetRoot(), xExtLst ) );
 
+ScDocument rDoc = GetDoc();
+const ScTableProtection* pTabProtect = rDoc.GetTabProtection(mnScTab);
+if (pTabProtect  pTabProtect-isProtected())
+Add( new XclExpSheetProtection(true, mnScTab) );
+
 if( HasVbaStorage() )
 if( nCodeNameIdx  GetExtDocOptions().GetCodeNameCount() )
 Add( new XclCodename( GetExtDocOptions().GetCodeName( nCodeNameIdx 
) ) );
diff --git a/sc/source/filter/excel/excrecds.cxx 
b/sc/source/filter/excel/excrecds.cxx
index 3469b36..c63d3c5 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -79,6 +79,7 @@
 #include xecontent.hxx
 
 #include xcl97rec.hxx
+#include tabprotection.hxx
 
 using namespace ::oox;
 
@@ -494,6 +495,49 @@ XclExpProtection::XclExpProtection(bool bValue) :
 {
 }
 
+XclExpSheetProtection::XclExpSheetProtection(bool bValue, SCTAB nTab ) :
+XclExpProtection( bValue),
+mnTab(nTab)
+{
+}
+
+void XclExpSheetProtection::SaveXml( XclExpXmlStream rStrm )
+{
+   ScDocument rDoc = rStrm.GetRoot().GetDoc();
+   const ScTableProtection* pTabProtect = rDoc.GetTabProtection(mnTab);
+   if ( pTabProtect )
+   {
+Sequencesal_Int8 aHash = pTabProtect-getPasswordHash(PASSHASH_XL);
+sal_uInt16 nHash(0x);
+OString sHash;
+if (aHash.getLength() = 2)
+{
+nHash = ((aHash[0]  8)  0x);
+

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

2013-06-02 Thread Markus Mohrhard
 sc/qa/unit/data/ods/print-range.ods|binary
 sc/qa/unit/helper/qahelper.hxx |   30 ++
 sc/qa/unit/subsequent_filters-test.cxx |   16 
 sc/source/filter/excel/xestyle.cxx |2 +-
 sc/source/filter/xml/xmlrowi.cxx   |8 +---
 sc/source/filter/xml/xmlrowi.hxx   |2 +-
 sc/source/filter/xml/xmltabi.cxx   |6 +++---
 7 files changed, 56 insertions(+), 8 deletions(-)

New commits:
commit 63ad78e0c0c5b8ba2897576ae7bbece22b5cd849
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Mon Jun 3 04:27:17 2013 +0200

this was commited accidentally

Change-Id: I2bdbf566d3443a98d3abf967512fc5b53bd25a78

diff --git a/sc/source/filter/excel/xestyle.cxx 
b/sc/source/filter/excel/xestyle.cxx
index c5cb5a3..0623ae5 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -1552,7 +1552,7 @@ void lclGetBorderLine(
 rnXclLine = EXC_LINE_NONE;
 if( pLine )
 {
-sal_uInt16 nOuterWidth = pLine-GetWidth();
+sal_uInt16 nOuterWidth = pLine-GetOutWidth();
 sal_uInt16 nDistance = pLine-GetDistance();
 if( nDistance  0 )
 rnXclLine = EXC_LINE_DOUBLE;
commit a719841d02fb93ddfc80956c5e6e417f551e8a9f
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Mon Jun 3 04:26:43 2013 +0200

add test case for fdo#62938

Change-Id: Ib15ff9d40b01dee2102ec6137d8b6394f7957ab8

diff --git a/sc/qa/unit/data/ods/print-range.ods 
b/sc/qa/unit/data/ods/print-range.ods
new file mode 100644
index 000..d7207e1
Binary files /dev/null and b/sc/qa/unit/data/ods/print-range.ods differ
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index a0168c4..ad25b74 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -115,6 +115,36 @@ void loadFile(const OUString aFileName, std::string 
aContent)
 aContent = aOStream.str();
 }
 
+std::string print(const ScAddress rAddr)
+{
+std::stringstream str;
+str  Col:   rAddr.Col();
+str   Row:   rAddr.Row();
+str   Tab:   rAddr.Tab();
+return str.str();
+}
+
+namespace CppUnit {
+
+template
+struct assertion_traitsScRange
+{
+static bool equal( const ScRange x, const ScRange y )
+{
+return x == y;
+}
+
+static std::string toString( const ScRange x )
+{
+std::stringstream str;
+str  Start:   print(x.aStart);
+str  \nEnd:   print(x.aEnd);
+return str.str();
+}
+};
+
+}
+
 class ScBootstrapFixture : public test::BootstrapFixture
 {
 protected:
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index 824..ad5466a 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -136,6 +136,8 @@ public:
 void testMiscRowHeights();
 void testOptimalHeightReset();
 
+void testPrintRangeODS();
+
 CPPUNIT_TEST_SUITE(ScFiltersTest);
 CPPUNIT_TEST(testBasicCellContentODS);
 CPPUNIT_TEST(testRangeNameXLS);
@@ -198,6 +200,7 @@ public:
 #endif
 CPPUNIT_TEST(testMiscRowHeights);
 CPPUNIT_TEST(testOptimalHeightReset);
+CPPUNIT_TEST(testPrintRangeODS);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1925,6 +1928,19 @@ void ScFiltersTest::testOptimalHeightReset()
 xDocSh-DoClose();
 }
 
+void ScFiltersTest::testPrintRangeODS()
+{
+ScDocShellRef xDocSh = loadDoc(print-range., ODS);
+ScDocument* pDoc = xDocSh-GetDocument();
+const ScRange* pRange = pDoc-GetRepeatRowRange(0);
+CPPUNIT_ASSERT(pRange);
+CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,0,1,0), *pRange);
+
+pRange = pDoc-GetRepeatRowRange(0);
+CPPUNIT_ASSERT(pRange);
+CPPUNIT_ASSERT_EQUAL(ScRange(0,2,1,0,4,1), *pRange);
+}
+
 ScFiltersTest::ScFiltersTest()
   : ScBootstrapFixture( /sc/qa/unit/data )
 {
commit e1c70f2f046ab6c5bb808666b4f5466902b9fcf8
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Mon Jun 3 04:21:13 2013 +0200

the print range can start in row 0, fdo#62938

Change-Id: I8569e4e120a6fd2b626db0bdaadf5d9234d09a36

diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx
index 3fa6142..bbe2c92 100644
--- a/sc/source/filter/xml/xmlrowi.cxx
+++ b/sc/source/filter/xml/xmlrowi.cxx
@@ -218,7 +218,7 @@ ScXMLTableRowsContext::ScXMLTableRowsContext( ScXMLImport 
rImport,
   const OUString rLName,
   const ::com::sun::star::uno::Reference
   
::com::sun::star::xml::sax::XAttributeList xAttrList,
-  const bool bTempHeader, const bool 
bTempGroup ) :
+  const bool bTempHeader, const bool 
bTempGroup, bool bFirstRow ) :
 SvXMLImportContext( rImport, nPrfx, rLName ),
 nHeaderStartRow(0),
 nHeaderEndRow(0),
@@ -232,12 +232,14 @@ 

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

2013-06-02 Thread Markus Mohrhard
 sc/qa/unit/subsequent_filters-test.cxx |4 ++--
 sc/source/filter/xml/xmlrowi.cxx   |   13 ++---
 sc/source/filter/xml/xmlrowi.hxx   |2 +-
 sc/source/filter/xml/xmltabi.cxx   |6 +++---
 4 files changed, 12 insertions(+), 13 deletions(-)

New commits:
commit cb49b8d56a5004827304f56d09acbcbf17c64cbf
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Mon Jun 3 04:57:19 2013 +0200

fix the test case

Change-Id: I0d9babd043d5b9c4c198380b93e29ec3a42b3121

diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index ad5466a..e963bdd 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -1936,9 +1936,9 @@ void ScFiltersTest::testPrintRangeODS()
 CPPUNIT_ASSERT(pRange);
 CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,0,1,0), *pRange);
 
-pRange = pDoc-GetRepeatRowRange(0);
+pRange = pDoc-GetRepeatRowRange(1);
 CPPUNIT_ASSERT(pRange);
-CPPUNIT_ASSERT_EQUAL(ScRange(0,2,1,0,4,1), *pRange);
+CPPUNIT_ASSERT_EQUAL(ScRange(0,2,0,0,4,0), *pRange);
 }
 
 ScFiltersTest::ScFiltersTest()
commit 7dfb72e69c629e5897ee515f8c42b7e45610ab8e
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Mon Jun 3 04:49:12 2013 +0200

correct fix for fdo#62938

Change-Id: Ib8e5cf92d733bafaef7f9e0bb8e3bf823075f489

diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx
index 3fa6142..efcc0e4 100644
--- a/sc/source/filter/xml/xmlrowi.cxx
+++ b/sc/source/filter/xml/xmlrowi.cxx
@@ -231,13 +231,14 @@ ScXMLTableRowsContext::ScXMLTableRowsContext( 
ScXMLImport rImport,
 // don't have any attributes
 if (bHeader)
 {
-nHeaderStartRow = rImport.GetTables().GetCurrentRow();
+ScAddress aAddr = rImport.GetTables().GetCurrentCellPos();
+nHeaderStartRow = aAddr.Row();
 ++nHeaderStartRow;
 }
 else if (bGroup)
 {
-nGroupStartRow = rImport.GetTables().GetCurrentRow();
-++nGroupStartRow;
+ScAddress aAddr = rImport.GetTables().GetCurrentCellPos();
+nHeaderStartRow = aAddr.Row();
 sal_Int16 nAttrCount = xAttrList.is() ? xAttrList-getLength() : 0;
 for( sal_Int16 i=0; i  nAttrCount; ++i )
 {
commit 59519242dd11ac91720a9646197b803f5ed812b7
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Mon Jun 3 04:44:00 2013 +0200

Revert the print range may start in row 0, fdo#62938

This reverts commit 988d388007ddafaa8a59735df99cbce678a689a8.

diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx
index bbe2c92..3fa6142 100644
--- a/sc/source/filter/xml/xmlrowi.cxx
+++ b/sc/source/filter/xml/xmlrowi.cxx
@@ -218,7 +218,7 @@ ScXMLTableRowsContext::ScXMLTableRowsContext( ScXMLImport 
rImport,
   const OUString rLName,
   const ::com::sun::star::uno::Reference
   
::com::sun::star::xml::sax::XAttributeList xAttrList,
-  const bool bTempHeader, const bool 
bTempGroup, bool bFirstRow ) :
+  const bool bTempHeader, const bool 
bTempGroup ) :
 SvXMLImportContext( rImport, nPrfx, rLName ),
 nHeaderStartRow(0),
 nHeaderEndRow(0),
@@ -232,14 +232,12 @@ ScXMLTableRowsContext::ScXMLTableRowsContext( 
ScXMLImport rImport,
 if (bHeader)
 {
 nHeaderStartRow = rImport.GetTables().GetCurrentRow();
-if(!bFirstRow)
-++nHeaderStartRow;
+++nHeaderStartRow;
 }
 else if (bGroup)
 {
 nGroupStartRow = rImport.GetTables().GetCurrentRow();
-if(!bFirstRow)
-++nGroupStartRow;
+++nGroupStartRow;
 sal_Int16 nAttrCount = xAttrList.is() ? xAttrList-getLength() : 0;
 for( sal_Int16 i=0; i  nAttrCount; ++i )
 {
diff --git a/sc/source/filter/xml/xmlrowi.hxx b/sc/source/filter/xml/xmlrowi.hxx
index 1651287..c24a103 100644
--- a/sc/source/filter/xml/xmlrowi.hxx
+++ b/sc/source/filter/xml/xmlrowi.hxx
@@ -70,7 +70,7 @@ public:
const OUString rLName,
const ::com::sun::star::uno::Reference
 
::com::sun::star::xml::sax::XAttributeList xAttrList,
-   const bool bHeader, const bool bGroup, bool bFirstRow = 
false);
+   const bool bHeader, const bool bGroup);
 
 virtual ~ScXMLTableRowsContext();
 
diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx
index d33cf22..a7f014c 100644
--- a/sc/source/filter/xml/xmltabi.cxx
+++ b/sc/source/filter/xml/xmltabi.cxx
@@ -291,17 +291,17 @@ SvXMLImportContext 
*ScXMLTableContext::CreateChildContext( sal_uInt16 nPrefix,
 case XML_TOK_TABLE_ROW_GROUP:
 pContext = new ScXMLTableRowsContext( GetScImport(), nPrefix,

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

2013-03-23 Thread Markus Mohrhard
 sc/qa/unit/helper/qahelper.hxx|1 +
 sc/qa/unit/subsequent_export-test.cxx |   14 ++
 sc/source/core/data/cell2.cxx |8 ++--
 3 files changed, 17 insertions(+), 6 deletions(-)

New commits:
commit 894b5423a8f22ac78a47eb3274969fe5f609fad1
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Sun Mar 24 05:27:31 2013 +0100

close documents at the end of the test

Change-Id: Ic0b60a2420c82f431c5790483e922ed2164f09fb

diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index 58f6f4b..b610f58 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -281,6 +281,7 @@ public:
 CPPUNIT_ASSERT_EQUAL(nExpectedHeight, nHeight);
 }
 }
+xShell-DoClose();
 }
 }
 };
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index db0879d..5dbadba 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -150,6 +150,8 @@ void ScExportTest::testPasswordExport()
 ScDocument* pLoadedDoc = xDocSh-GetDocument();
 double aVal = pLoadedDoc-GetValue(0,0,0);
 ASSERT_DOUBLES_EQUAL(aVal, 1.0);
+
+xDocSh-DoClose();
 }
 
 void ScExportTest::testConditionalFormatExportODS()
@@ -164,6 +166,8 @@ void ScExportTest::testConditionalFormatExportODS()
 OUString aCSVPath;
 createCSVPath( aCSVFile, aCSVPath );
 testCondFile(aCSVPath, pDoc, 0);
+
+xDocSh-DoClose();
 }
 
 void ScExportTest::testConditionalFormatExportXLSX()
@@ -178,6 +182,8 @@ void ScExportTest::testConditionalFormatExportXLSX()
 OUString aCSVPath;
 createCSVPath( aCSVFile, aCSVPath );
 testCondFile(aCSVPath, pDoc, 0);
+
+xDocSh-DoClose();
 }
 
 void ScExportTest::testColorScaleExportODS()
@@ -193,6 +199,8 @@ void ScExportTest::testColorScaleExportODS()
 
 testColorScale2Entry_Impl(pDoc);
 testColorScale3Entry_Impl(pDoc);
+
+xDocSh-DoClose();
 }
 
 void ScExportTest::testColorScaleExportXLSX()
@@ -208,6 +216,8 @@ void ScExportTest::testColorScaleExportXLSX()
 
 testColorScale2Entry_Impl(pDoc);
 testColorScale3Entry_Impl(pDoc);
+
+xDocSh-DoClose();
 }
 
 void ScExportTest::testDataBarExportODS()
@@ -222,6 +232,8 @@ void ScExportTest::testDataBarExportODS()
 CPPUNIT_ASSERT(pDoc);
 
 testDataBar_Impl(pDoc);
+
+xDocSh-DoClose();
 }
 
 void ScExportTest::testDataBarExportXLSX()
@@ -236,6 +248,8 @@ void ScExportTest::testDataBarExportXLSX()
 CPPUNIT_ASSERT(pDoc);
 
 testDataBar_Impl(pDoc);
+
+xDocSh-DoClose();
 }
 
 void ScExportTest::testMiscRowHeightExport()
commit 6c2acf78ad988c100d4163f369411482e5fd0f44
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Sun Mar 24 05:27:03 2013 +0100

remove unused variables

Change-Id: I602169d65c77ae71e0d5dd4b3b95837db91fa7da

diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 9232772..cacd5e1 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -848,10 +848,6 @@ bool ScFormulaCell::UpdateReference(UpdateRefMode 
eUpdateRefMode,
 
 SCCOL nCol1 = r.aStart.Col();
 SCROW nRow1 = r.aStart.Row();
-SCTAB nTab1 = r.aStart.Tab();
-SCCOL nCol2 = r.aEnd.Col();
-SCROW nRow2 = r.aEnd.Row();
-SCTAB nTab2 = r.aEnd.Tab();
 SCCOL nCol = aPos.Col();
 SCROW nRow = aPos.Row();
 SCTAB nTab = aPos.Tab();
commit 70478b0ae41aee6113c4e1e930912a804bd8489c
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Sun Mar 24 05:19:09 2013 +0100

let us move this out of the condition

restores the old behavior

Change-Id: I096934b87ddf646587ccb230986e61f5da22de68

diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index b4a78de..9232772 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -860,10 +860,10 @@ bool ScFormulaCell::UpdateReference(UpdateRefMode 
eUpdateRefMode,
 aUndoPos = *pUndoCellPos;
 ScAddress aOldPos( aPos );
 //  bool bPosChanged = false;   // if this cell was moved
-bool bIsInsert = false;
+bool bIsInsert = (eUpdateRefMode == URM_INSDEL 
+nDx = 0  nDy = 0  nDz = 0);
 if (eUpdateRefMode == URM_INSDEL  r.In( aPos ))
 {
-bIsInsert = (nDx = 0  nDy = 0  nDz = 0);
 aPos.Move(nDx, nDy, nDz);
 bCellStateChanged = aPos != aOldPos;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits