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

2019-08-09 Thread Arkadiy Illarionov (via logerrit)
 sc/qa/unit/helper/qahelper.cxx   |4 
 sc/source/core/data/documen5.cxx |   10 --
 sc/source/core/data/dpobject.cxx |   10 --
 sc/source/core/data/dpoutput.cxx |   22 +---
 sc/source/core/data/dpresfilter.cxx  |   10 --
 sc/source/core/data/dptabsrc.cxx |   24 ++--
 sc/source/core/data/tabprotection.cxx|   11 --
 sc/source/core/tool/addincol.cxx |   64 -
 sc/source/core/tool/appoptio.cxx |4 
 sc/source/core/tool/charthelper.cxx  |9 +
 sc/source/core/tool/rangeseq.cxx |   18 +--
 sc/source/core/tool/rangeutl.cxx |4 
 sc/source/core/tool/unitconv.cxx |6 -
 sc/source/core/tool/userlist.cxx |8 -
 sc/source/filter/excel/xechart.cxx   |   72 ++
 sc/source/filter/excel/xeescher.cxx  |   16 +--
 sc/source/filter/ftools/fapihelper.cxx   |7 -
 sc/source/filter/oox/formulabase.cxx |   12 --
 sc/source/filter/oox/workbookhelper.cxx  |   18 +--
 sc/source/filter/xcl97/xcl97esc.cxx  |7 -
 sc/source/filter/xcl97/xcl97rec.cxx  |4 
 sc/source/filter/xml/XMLCodeNameProvider.cxx |7 -
 sc/source/filter/xml/XMLExportDatabaseRanges.cxx |   11 --
 sc/source/filter/xml/xmlcvali.cxx|   16 +--
 sc/source/filter/xml/xmlimprt.cxx|   69 ++
 sc/source/filter/xml/xmlstyli.cxx|4 
 sc/source/ui/Accessibility/AccessibleCell.cxx|   13 --
 sc/source/ui/Accessibility/AccessibleGlobal.cxx  |   11 --
 sc/source/ui/cctrl/tbzoomsliderctrl.cxx  |7 -
 sc/source/ui/dbgui/dapidata.cxx  |   10 --
 sc/source/ui/dbgui/tpsort.cxx|4 
 sc/source/ui/docshell/docsh2.cxx |7 -
 sc/source/ui/miscdlgs/optsolver.cxx  |   16 +--
 sc/source/ui/miscdlgs/solveroptions.cxx  |4 
 sc/source/ui/miscdlgs/solverutil.cxx |3 
 sc/source/ui/unoobj/appluno.cxx  |5 -
 sc/source/ui/unoobj/celllistsource.cxx   |9 +
 sc/source/ui/unoobj/cellsuno.cxx |   85 ++---
 sc/source/ui/unoobj/cellvaluebinding.cxx |9 +
 sc/source/ui/unoobj/chart2uno.cxx|   41 
 sc/source/ui/unoobj/chartuno.cxx |   31 +-
 sc/source/ui/unoobj/condformatuno.cxx|8 -
 sc/source/ui/unoobj/cursuno.cxx  |4 
 sc/source/ui/unoobj/dapiuno.cxx  |   39 +++
 sc/source/ui/unoobj/datauno.cxx  |   18 +--
 sc/source/ui/unoobj/defltuno.cxx |6 -
 sc/source/ui/unoobj/dispuno.cxx  |   10 --
 sc/source/ui/unoobj/docuno.cxx   |   66 +
 sc/source/ui/unoobj/eventuno.cxx |4 
 sc/source/ui/unoobj/filtuno.cxx  |5 -
 sc/source/ui/unoobj/fmtuno.cxx   |6 -
 sc/source/ui/unoobj/funcuno.cxx  |7 -
 sc/source/ui/unoobj/shapeuno.cxx |   19 +--
 sc/source/ui/unoobj/styleuno.cxx |   28 ++---
 sc/source/ui/unoobj/viewuno.cxx  |5 -
 sc/source/ui/vba/vbachart.cxx|7 -
 sc/source/ui/vba/vbachartobjects.cxx |   14 +-
 sc/source/ui/vba/vbaeventshelper.cxx |   10 --
 sc/source/ui/vba/vbapagebreaks.cxx   |   18 +--
 sc/source/ui/vba/vbapagesetup.cxx|7 -
 sc/source/ui/vba/vbarange.cxx|   27 ++---
 sc/source/ui/vba/vbasheetobject.cxx  |   13 +-
 sc/source/ui/vba/vbaworkbook.cxx |   69 ++
 sc/source/ui/vba/vbaworksheets.cxx   |5 -
 sc/source/ui/vba/vbawsfunction.cxx   |6 -
 sc/source/ui/view/dbfunc3.cxx|7 -
 sc/source/ui/view/drawvie4.cxx   |   14 +-
 sc/source/ui/view/viewdata.cxx   |  113 +++
 68 files changed, 494 insertions(+), 743 deletions(-)

New commits:
commit fca94779872b8ba0b0583d0b7068f1a46beb88c5
Author: Arkadiy Illarionov 
AuthorDate: Sat Aug 3 22:59:04 2019 +0300
Commit: Arkadiy Illarionov 
CommitDate: Fri Aug 9 16:58:06 2019 +0200

Simplify Sequence iterations in sc

Use range-based loops, STL and comphelper functions

Change-Id: I047fb2e6ec9591166339b9748c5013a32185f14b
Reviewed-on: https://gerrit.libreoffice.org/76912
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov 

diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index c5f183161a78..219d47635feb 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -11,6 +11,7 @@
 #include "csv_handler.hxx"
 #include "debughelper.hxx"
 #include 
+#include 
 

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

2019-07-19 Thread Noel Grandin (via logerrit)
 sc/qa/extras/scpdfexport.cxx  |7 +---
 sc/qa/unit/copy_paste_test.cxx|9 ++---
 sc/source/core/data/documen5.cxx  |5 +--
 sc/source/core/tool/address.cxx   |2 -
 sc/source/core/tool/charthelper.cxx   |7 +---
 sc/source/core/tool/webservicelink.cxx|5 +--
 sc/source/filter/excel/xeescher.cxx   |3 -
 sc/source/filter/excel/xichart.cxx|4 +-
 sc/source/filter/excel/xltoolbar.cxx  |2 -
 sc/source/filter/oox/excelfilter.cxx  |2 -
 sc/source/filter/oox/pagesettings.cxx |2 -
 sc/source/filter/oox/richstring.cxx   |2 -
 sc/source/filter/xml/XMLTrackedChangesContext.cxx |4 --
 sc/source/filter/xml/xmlcelli.cxx |   13 +++
 sc/source/filter/xml/xmlexprt.cxx |   18 ---
 sc/source/filter/xml/xmlsubti.cxx |6 +--
 sc/source/filter/xml/xmlwrap.cxx  |   11 ++
 sc/source/ui/Accessibility/AccessibleDocument.cxx |   21 +---
 sc/source/ui/dataprovider/dataprovider.cxx|2 -
 sc/source/ui/docshell/docsh8.cxx  |3 -
 sc/source/ui/drawfunc/fuins2.cxx  |   10 ++
 sc/source/ui/unoobj/TablePivotCharts.cxx  |5 +--
 sc/source/ui/unoobj/chartuno.cxx  |5 +--
 sc/source/ui/unoobj/docuno.cxx|   36 +-
 sc/source/ui/unoobj/fielduno.cxx  |3 -
 sc/source/ui/unoobj/textuno.cxx   |9 +
 sc/source/ui/vba/vbaapplication.cxx   |8 ++--
 sc/source/ui/vba/vbarange.cxx |5 +--
 sc/source/ui/vba/vbaworkbook.cxx  |2 -
 sc/source/ui/vba/vbaworksheet.cxx |9 +
 sc/source/ui/view/drawvie4.cxx|8 +---
 31 files changed, 94 insertions(+), 134 deletions(-)

New commits:
commit 8239e13dac39741003dfbce7099c3197080aafa8
Author: Noel Grandin 
AuthorDate: Fri Jul 19 20:09:55 2019 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 20 07:56:54 2019 +0200

loplugin:referencecasting in sc

Change-Id: Ife30500d1ff67e06afc4d64634febfb4c161c702
Reviewed-on: https://gerrit.libreoffice.org/75976
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx
index c21cdaa2dde7..059401f86340 100644
--- a/sc/qa/extras/scpdfexport.cxx
+++ b/sc/qa/extras/scpdfexport.cxx
@@ -88,8 +88,8 @@ void ScPDFExportTest::setUp()
 uno::Reference xModel2(xModel, UNO_QUERY);
 CPPUNIT_ASSERT(xModel2.is());
 
-Reference xController(
-xModel2->createDefaultViewController(xTargetFrame), UNO_QUERY);
+Reference xController
+= xModel2->createDefaultViewController(xTargetFrame);
 CPPUNIT_ASSERT(xController.is());
 
 // introduce model/view/controller to each other
@@ -161,8 +161,7 @@ std::shared_ptr 
ScPDFExportTest::exportToPdf(uno::Reference rCellRange(rSheet, UNO_QUERY);
-uno::Reference xCellRange = 
rCellRange->getCellRangeByPosition(
+uno::Reference xCellRange = 
rSheet->getCellRangeByPosition(
 range.aStart.Col(), range.aStart.Row(), range.aEnd.Col(), 
range.aEnd.Row());
 {
 uno::Reference xController = 
xModel->getCurrentController();
diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx
index 6d4e0fb3f6bf..4087b9d48946 100644
--- a/sc/qa/unit/copy_paste_test.cxx
+++ b/sc/qa/unit/copy_paste_test.cxx
@@ -64,7 +64,7 @@ void ScCopyPasteTest::testCopyPasteXLS()
 uno::Reference< frame::XModel2 > xModel2 ( xDocSh->GetModel(), UNO_QUERY );
 CPPUNIT_ASSERT( xModel2.is() );
 
-Reference< frame::XController2 > xController ( 
xModel2->createDefaultViewController( xTargetFrame ), UNO_QUERY );
+Reference< frame::XController2 > xController = 
xModel2->createDefaultViewController( xTargetFrame );
 CPPUNIT_ASSERT( xController.is() );
 
 // introduce model/view/controller to each other
@@ -187,7 +187,7 @@ void ScCopyPasteTest::testTdf84411()
 uno::Reference< frame::XModel2 > xModel2 ( xDocSh->GetModel(), UNO_QUERY );
 CPPUNIT_ASSERT( xModel2.is() );
 
-Reference< frame::XController2 > xController ( 
xModel2->createDefaultViewController( xTargetFrame ), UNO_QUERY );
+Reference< frame::XController2 > xController = 
xModel2->createDefaultViewController( xTargetFrame );
 CPPUNIT_ASSERT( xController.is() );
 
 // introduce model/view/controller to each other
@@ -256,7 +256,7 @@ void ScCopyPasteTest::testTdf124565()
 uno::Reference< frame::XModel2 > xModel2 ( xDocSh->GetModel(), UNO_QUERY );
 CPPUNIT_ASSERT( xModel2.is() );
 
-Reference< frame::XController2 > xController ( 
xModel2->createDefaultViewController( xTargetFrame ), UNO_QUERY );
+Reference< frame::XController2 > 

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

2019-07-17 Thread Mike Kaganski (via logerrit)
 sc/qa/unit/copy_paste_test.cxx |   74 +
 sc/source/core/data/table2.cxx |7 ++-
 2 files changed, 79 insertions(+), 2 deletions(-)

New commits:
commit 2d4ccc58e9ef3b98a88407e1a7a3abf3379f0d20
Author: Mike Kaganski 
AuthorDate: Wed Jul 17 12:15:28 2019 +1000
Commit: Mike Kaganski 
CommitDate: Wed Jul 17 09:53:50 2019 +0200

tdf#126421: don't limit pasted data to allocated columns in destination

Change-Id: Ic30360795c5dac1dc232f95bd25f5a11946c7dee
Reviewed-on: https://gerrit.libreoffice.org/75738
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx
index 8a65609b51b1..6d4e0fb3f6bf 100644
--- a/sc/qa/unit/copy_paste_test.cxx
+++ b/sc/qa/unit/copy_paste_test.cxx
@@ -33,11 +33,13 @@ public:
 void testCopyPasteXLS();
 void testTdf84411();
 void testTdf124565();
+void testTdf126421();
 
 CPPUNIT_TEST_SUITE(ScCopyPasteTest);
 CPPUNIT_TEST(testCopyPasteXLS);
 CPPUNIT_TEST(testTdf84411);
 CPPUNIT_TEST(testTdf124565);
+CPPUNIT_TEST(testTdf126421);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -126,6 +128,14 @@ void ScCopyPasteTest::testCopyPasteXLS()
 
 namespace {
 
+ScMarkData::MarkedTabsType TabsInRange(const ScRange& r)
+{
+ScMarkData::MarkedTabsType aResult;
+for (SCTAB i = r.aStart.Tab(); i <= r.aEnd.Tab(); ++i)
+aResult.insert(i);
+return aResult;
+}
+
 void lcl_copy( const OUString& rSrcRange, const OUString& rDstRange, 
ScDocument& rDoc, ScTabViewShell* pViewShell )
 {
 ScDocument aClipDoc(SCDOCMODE_CLIP);
@@ -135,6 +145,7 @@ void lcl_copy( const OUString& rSrcRange, const OUString& 
rDstRange, ScDocument&
 ScRefFlags nRes = aSrcRange.Parse(rSrcRange, , 
rDoc.GetAddressConvention());
 CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & ScRefFlags::VALID));
 pViewShell->GetViewData().GetMarkData().SetMarkArea(aSrcRange);
+
pViewShell->GetViewData().GetMarkData().SetSelectedTabs(TabsInRange(aSrcRange));
 pViewShell->GetViewData().GetView()->CopyToClip(, false, false, 
false, false);
 
 // 2. Paste
@@ -142,6 +153,7 @@ void lcl_copy( const OUString& rSrcRange, const OUString& 
rDstRange, ScDocument&
 nRes = aDstRange.Parse(rDstRange, , rDoc.GetAddressConvention());
 CPPUNIT_ASSERT_MESSAGE("Failed to parse.", (nRes & ScRefFlags::VALID));
 pViewShell->GetViewData().GetMarkData().SetMarkArea(aDstRange);
+
pViewShell->GetViewData().GetMarkData().SetSelectedTabs(TabsInRange(aDstRange));
 pViewShell->GetViewData().GetView()->PasteFromClip(InsertDeleteFlags::ALL, 
);
 }
 
@@ -289,6 +301,68 @@ void ScCopyPasteTest::testTdf124565()
 xDocSh->DoClose();
 }
 
+void ScCopyPasteTest::testTdf126421()
+{
+uno::Reference xDesktop
+= frame::Desktop::create(::comphelper::getProcessComponentContext());
+CPPUNIT_ASSERT(xDesktop.is());
+
+// create a frame
+Reference xTargetFrame = xDesktop->findFrame("_blank", 0);
+CPPUNIT_ASSERT(xTargetFrame.is());
+
+// 1. Create spreadsheet
+uno::Sequence aEmptyArgList;
+uno::Reference xComponent
+= xDesktop->loadComponentFromURL("private:factory/scalc", "_blank", 0, 
aEmptyArgList);
+CPPUNIT_ASSERT(xComponent.is());
+
+// Get the document model
+SfxObjectShell* pFoundShell = 
SfxObjectShell::GetShellFromComponent(xComponent);
+CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
+
+ScDocShellRef xDocSh = dynamic_cast(pFoundShell);
+CPPUNIT_ASSERT(xDocSh);
+
+uno::Reference xModel2(xDocSh->GetModel(), UNO_QUERY);
+CPPUNIT_ASSERT(xModel2.is());
+
+Reference 
xController(xModel2->createDefaultViewController(xTargetFrame),
+   UNO_QUERY);
+CPPUNIT_ASSERT(xController.is());
+
+// introduce model/view/controller to each other
+xController->attachModel(xModel2.get());
+xModel2->connectController(xController.get());
+xTargetFrame->setComponent(xController->getComponentWindow(), 
xController.get());
+xController->attachFrame(xTargetFrame);
+xModel2->setCurrentController(xController.get());
+
+ScDocument& rDoc = xDocSh->GetDocument();
+
+// Get the document controller
+ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false);
+CPPUNIT_ASSERT(pViewShell != nullptr);
+
+// 2. Setup data
+for (int r = 0; r < 2; ++r)
+for (int c = 0; c < 1024; ++c)
+rDoc.SetValue(c, r, 0, (c + 1) * 100 + (r + 1));
+
+const SCTAB n2ndTab = rDoc.GetMaxTableNumber() + 1;
+rDoc.MakeTable(n2ndTab);
+const auto aTabNames = rDoc.GetAllTableNames();
+
+lcl_copy(aTabNames[0] + ".A1:AMJ2", aTabNames[n2ndTab] + ".A1:AMJ2", rDoc, 
pViewShell);
+
+// 3. Check all cells in destination table
+for (int r = 0; r < 2; ++r)
+for (int c = 0; c < 1024; ++c)
+CPPUNIT_ASSERT_EQUAL(double((c + 1) * 100 + (r + 1)), 
rDoc.GetValue(c, r, 

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

2019-07-03 Thread Tünde Tóth (via logerrit)
 sc/qa/unit/data/xlsx/hyperlink_export.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx  |   19 +++
 sc/source/filter/excel/xecontent.cxx   |4 
 3 files changed, 23 insertions(+)

New commits:
commit 3cdc1b35b9d86bcfa1277e3e94925ae7b18b8fde
Author: Tünde Tóth 
AuthorDate: Tue Jul 2 10:07:24 2019 +0200
Commit: László Németh 
CommitDate: Wed Jul 3 11:14:57 2019 +0200

tdf#126177 XLSX export: fix hyperlinks to documents

After export hyperlinks to documents didn't work, because the
the hyperlink relationship targets contained also the anchor.

Change-Id: I0bfc5bd1ef2b37f769d6a6b97e31c1b4bbfcb9aa
Reviewed-on: https://gerrit.libreoffice.org/74988
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/sc/qa/unit/data/xlsx/hyperlink_export.xlsx 
b/sc/qa/unit/data/xlsx/hyperlink_export.xlsx
new file mode 100644
index ..4c3952d96290
Binary files /dev/null and b/sc/qa/unit/data/xlsx/hyperlink_export.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 9d628f97faa9..06eaf398407f 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -225,6 +225,7 @@ public:
 void testTdf125173XLSX();
 void testTdf79972XLSX();
 void testTdf126024XLSX();
+void testTdf126177XLSX();
 
 void testXltxExport();
 
@@ -355,6 +356,7 @@ public:
 CPPUNIT_TEST(testTdf125173XLSX);
 CPPUNIT_TEST(testTdf79972XLSX);
 CPPUNIT_TEST(testTdf126024XLSX);
+CPPUNIT_TEST(testTdf126177XLSX);
 
 CPPUNIT_TEST(testXltxExport);
 
@@ -4437,6 +4439,23 @@ void ScExportTest::testTdf126024XLSX()
 assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "TargetMode", 
"External");
 }
 
+void ScExportTest::testTdf126177XLSX()
+{
+ScDocShellRef xDocSh = loadDoc("hyperlink_export.", FORMAT_XLSX);
+CPPUNIT_ASSERT(xDocSh.is());
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+
+xmlDocPtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
+CPPUNIT_ASSERT(pDoc);
+assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink", "location", 
"Munka1!A5");
+
+xmlDocPtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/_rels/sheet1.xml.rels");
+CPPUNIT_ASSERT(pXmlRels);
+OUString aTarget = getXPath(pXmlRels, "/r:Relationships/r:Relationship", 
"Target");
+CPPUNIT_ASSERT(aTarget.endsWith("test.xlsx"));
+assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "TargetMode", 
"External");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xecontent.cxx 
b/sc/source/filter/excel/xecontent.cxx
index 234c681c59c3..3237ff1fca75 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -445,6 +445,10 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, 
const SvxURLField& rU
 aXclStrm<< sal_uInt16( 0 );
 
 mnFlags |= EXC_HLINK_MARK;
+
+OUString location = XclXmlUtils::ToOUString(*mxTextMark);
+if (msTarget.endsWith(location))
+msTarget = msTarget.copy(0, msTarget.getLength() - 
location.getLength() - 1);
 }
 
 SetRecSize( 32 + mxVarData->Tell() );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-06-21 Thread Tünde Tóth (via logerrit)
 sc/qa/unit/data/xlsx/hyperlink_formula.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx   |   18 ++
 sc/source/filter/excel/xetable.cxx  |   11 +++
 3 files changed, 29 insertions(+)

New commits:
commit 1bdbdc6ebcdba2784dcfa56b50632c4706ba14b5
Author: Tünde Tóth 
AuthorDate: Thu Jun 20 16:52:20 2019 +0200
Commit: László Németh 
CommitDate: Fri Jun 21 15:18:56 2019 +0200

tdf#126024 XLSX export: fix hyperlink on formula cell

Hyperlink on formula cell lost after export.

Change-Id: I682c8bb559b5adde84b350f79c35a2e769f106ec
Reviewed-on: https://gerrit.libreoffice.org/74457
Tested-by: Jenkins
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/sc/qa/unit/data/xlsx/hyperlink_formula.xlsx 
b/sc/qa/unit/data/xlsx/hyperlink_formula.xlsx
new file mode 100644
index ..77ae2bdc7f7b
Binary files /dev/null and b/sc/qa/unit/data/xlsx/hyperlink_formula.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 416fb9f32139..9d628f97faa9 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -224,6 +224,7 @@ public:
 void testTdf123645XLSX();
 void testTdf125173XLSX();
 void testTdf79972XLSX();
+void testTdf126024XLSX();
 
 void testXltxExport();
 
@@ -353,6 +354,7 @@ public:
 CPPUNIT_TEST(testTdf123645XLSX);
 CPPUNIT_TEST(testTdf125173XLSX);
 CPPUNIT_TEST(testTdf79972XLSX);
+CPPUNIT_TEST(testTdf126024XLSX);
 
 CPPUNIT_TEST(testXltxExport);
 
@@ -4419,6 +4421,22 @@ void ScExportTest::testTdf79972XLSX()
 assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "TargetMode", 
"External");
 }
 
+void ScExportTest::testTdf126024XLSX()
+{
+ScDocShellRef xDocSh = loadDoc("hyperlink_formula.", FORMAT_XLSX);
+CPPUNIT_ASSERT(xDocSh.is());
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+
+xmlDocPtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
+CPPUNIT_ASSERT(pDoc);
+assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink", "ref", "A2");
+
+xmlDocPtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/_rels/sheet1.xml.rels");
+CPPUNIT_ASSERT(pXmlRels);
+assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "Target", 
"https://bugs.documentfoundation.org/;);
+assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "TargetMode", 
"External");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index c8a34cd89faf..d7a3adf8f7e6 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -2581,6 +2581,17 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& 
rRoot ) :
 
 case CELLTYPE_FORMULA:
 {
+if (pPattern)
+{
+OUString aUrl = 
pPattern->GetItemSet().Get(ATTR_HYPERLINK).GetValue();
+if (!aUrl.isEmpty())
+{
+std::shared_ptr aLink;
+aLink.reset(new XclExpHyperlink(GetRoot(), 
SvxURLField(aUrl, aUrl), aScPos));
+mxHyperlinkList->AppendRecord(aLink);
+}
+}
+
 xCell.reset(new XclExpFormulaCell(
 GetRoot(), aXclPos, pPattern, nMergeBaseXFId,
 *rScCell.mpFormula, maArrayBfr, maShrfmlaBfr, 
maTableopBfr));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-06-20 Thread Dennis Francis (via logerrit)
 sc/qa/unit/data/functions/array/fods/fourier.fods |  236 +++---
 sc/source/core/tool/interpr3.cxx  |8 
 2 files changed, 215 insertions(+), 29 deletions(-)

New commits:
commit e324a6cea23fe19ec8a67f368c31e1567928a5af
Author: Dennis Francis 
AuthorDate: Thu Jun 20 11:59:44 2019 +0530
Commit: Dennis Francis 
CommitDate: Thu Jun 20 13:18:11 2019 +0200

tdf#126012: Take care of polar and min-magnitude flags...

even in one point case (FOURIER). Add relevant test cases too.

Change-Id: I647ac14ff8e9ee11664b23b37d150f51e6a08354
Reviewed-on: https://gerrit.libreoffice.org/74412
Reviewed-by: Dennis Francis 
Tested-by: Dennis Francis 

diff --git a/sc/qa/unit/data/functions/array/fods/fourier.fods 
b/sc/qa/unit/data/functions/array/fods/fourier.fods
index 789e1bd15f73..91b1aa4d098e 100644
--- a/sc/qa/unit/data/functions/array/fods/fourier.fods
+++ b/sc/qa/unit/data/functions/array/fods/fourier.fods
@@ -1,20 +1,20 @@
 
 
 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">
- 
2019-02-19T14:19:02.7820374922019-03-03T16:30:38.015797381PT2H52M20S66LibreOfficeDev/6.3.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/b4df9b0b4c7411f257b0a397687587114a53208e
+ 
2019-02-19T14:19:02.7820374922019-06-20T11:49:43.838698519PT3H13M28S71LibreOfficeDev/6.3.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/74a7b890524af4a52e711d8f0793ce844ded0948
  
   
0
0
-   20041
-   4713
+   58208
+   25287

 
  view1
  
   
1
-   8
+   17
0
0
0
@@ -31,8 +31,8 @@
false
   
   
-   0
-   3
+   1
+   71
0
0
0
@@ -41,7 +41,7 @@
0
0
0
-   0
+   44
0
100
60
@@ -49,8 +49,8 @@
false
   
   
-   4
-   39
+   3
+   15
0
0
0
@@ -67,8 +67,8 @@
false
   
  
- Sheet1
- 1861
+ Sheet2
+ 1307
  0
  100
  60
@@ -125,9 +125,9 @@
  
 

-   Generic 
Printer
+   DeskJet-2130-series
false
-   nwH+/0dlbmVyaWMgUHJpbnRlcgAAU0dFTlBSVAAWAAMAwAAEAAhSAAAEdAAASm9iRGF0YSAxCnByaW50ZXI9R2VuZXJpYyBQcmludGVyCm9yaWVudGF0aW9uPVBvcnRyYWl0CmNvcGllcz0xCmNvbGxhdGU9ZmFsc2UKbWFyZ2luZGFqdXN0bWVudD0wLDAsMCwwCmNvbG9yZGVwdGg9MjQKcHNsZXZlbD0wCnBkZmRldmljZT0xCmNvbG9yZGV2aWNlPTAKUFBEQ29udGV4RGF0YQpEdXBsZXg6Tm9uZQBQYWdlU2l6ZTpBNAAAEgBDT01QQVRfRFVQTEVYX01PREUPAER1cGxleE1vZGU6Ok9mZg==
+   

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

2019-06-02 Thread László Németh (via logerrit)
 sc/qa/unit/data/ods/tdf112567.ods |binary
 sc/qa/unit/subsequent_export-test.cxx |   31 +++
 sc/source/filter/excel/xename.cxx |   25 -
 3 files changed, 55 insertions(+), 1 deletion(-)

New commits:
commit 32a11727a0f709c11685d4200b1db08dac211dec
Author: László Németh 
AuthorDate: Thu May 30 19:57:41 2019 +0200
Commit: László Németh 
CommitDate: Mon Jun 3 07:23:08 2019 +0200

tdf#112567 XLSX export: correct built-in names

Non-en_US locale setting resulted broken XLSX export
with incorrect localized range separator. The previous
commit 19976f079800ec4c1d0d5d7e226986cb41f834c2
"tdf#112567 XLSX export: fix broken built-in names"
only avoided of the bad export of the XSLX documents
with correct definedName.

Note: this commit fixes the bad XLSX documents
during the next import/export cycle.

Change-Id: I9101c5df0f29c7a42fd49f4c2765dcf47a711916
Reviewed-on: https://gerrit.libreoffice.org/73220
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sc/qa/unit/data/ods/tdf112567.ods 
b/sc/qa/unit/data/ods/tdf112567.ods
new file mode 100644
index ..fda79997e534
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf112567.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 94bfd5ae4f36..416fb9f32139 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -220,6 +220,7 @@ public:
 void testTdf91634XLSX();
 void testTdf115159();
 void testTdf112567();
+void testTdf112567b();
 void testTdf123645XLSX();
 void testTdf125173XLSX();
 void testTdf79972XLSX();
@@ -348,6 +349,7 @@ public:
 CPPUNIT_TEST(testTdf91634XLSX);
 CPPUNIT_TEST(testTdf115159);
 CPPUNIT_TEST(testTdf112567);
+CPPUNIT_TEST(testTdf112567b);
 CPPUNIT_TEST(testTdf123645XLSX);
 CPPUNIT_TEST(testTdf125173XLSX);
 CPPUNIT_TEST(testTdf79972XLSX);
@@ -4334,6 +4336,35 @@ void ScExportTest::testTdf112567()
 xDocSh->DoClose();
 }
 
+void ScExportTest::testTdf112567b()
+{
+// Set the system locale to Hungarian (a language with different range 
separator)
+SvtSysLocaleOptions aOptions;
+aOptions.SetLocaleConfigString("hu-HU");
+aOptions.Commit();
+comphelper::ScopeGuard g([] {
+aOptions.SetLocaleConfigString(OUString());
+aOptions.Commit();
+});
+
+ScDocShellRef xShell = loadDoc("tdf112567.", FORMAT_ODS);
+CPPUNIT_ASSERT(xShell.is());
+ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
+CPPUNIT_ASSERT(xDocSh.is());
+xShell->DoClose();
+
+xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, 
"xl/workbook.xml", FORMAT_XLSX);
+CPPUNIT_ASSERT(pDoc);
+
+//assert the existing OOXML built-in name is not duplicated
+assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName", 1);
+
+//and it contains "," instead of ";"
+assertXPathContent(pDoc, "/x:workbook/x:definedNames/x:definedName[1]", 
"Sheet1!$A:$A,Sheet1!$1:$1");
+
+xDocSh->DoClose();
+}
+
 void ScExportTest::testTdf123645XLSX()
 {
 ScDocShellRef xDocSh = loadDoc("chart_hyperlink.", FORMAT_XLSX);
diff --git a/sc/source/filter/excel/xename.cxx 
b/sc/source/filter/excel/xename.cxx
index ee418fb80d5c..35d84b86194e 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -92,6 +92,8 @@ public:
 private:
 /** Writes the body of the NAME record to the passed stream. */
 virtual voidWriteBody( XclExpStream& rStrm ) override;
+/** Convert localized range separators */
+OUStringGetWithDefaultRangeSeparator( const OUString& rSymbol 
) const;
 
 private:
 OUStringmaOrigName; /// The original user-defined name.
@@ -294,6 +296,27 @@ void XclExpName::Save( XclExpStream& rStrm )
 XclExpRecord::Save( rStrm );
 }
 
+OUString XclExpName::GetWithDefaultRangeSeparator( const OUString& rSymbol ) 
const
+{
+sal_Int32 nPos = rSymbol.indexOf(';');
+if ( nPos > -1 )
+{
+// convert with validation
+ScRange aRange;
+ScAddress::Details detailsXL( ::formula::FormulaGrammar::CONV_XL_A1 );
+ScRefFlags nRes = aRange.Parse( rSymbol.copy(0, nPos), (), 
detailsXL );
+if ( nRes & ScRefFlags::VALID )
+{
+nRes = aRange.Parse( rSymbol.copy(nPos+1), (), detailsXL 
);
+if ( nRes & ScRefFlags::VALID )
+{
+return rSymbol.replaceFirst(";", ",");
+}
+}
+}
+return rSymbol;
+}
+
 void XclExpName::SaveXml( XclExpXmlStream& rStrm )
 {
 sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream();
@@ -314,7 +337,7 @@ void XclExpName::SaveXml( XclExpXmlStream& rStrm )
 // OOXTODO: XML_workbookParameter, "",
 // OOXTODO: XML_xlm, ""
 );
-rWorkbook->writeEscaped( msSymbol 

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

2019-05-24 Thread Tünde Tóth (via logerrit)
 sc/qa/unit/data/xlsx/tdf79972.xlsx|binary
 sc/qa/unit/subsequent_export-test.cxx |   18 ++
 sc/source/filter/excel/xetable.cxx|   13 +
 3 files changed, 31 insertions(+)

New commits:
commit ff634cf62a663c1e6e744cedf26d9746b235721d
Author: Tünde Tóth 
AuthorDate: Fri May 24 09:48:35 2019 +0200
Commit: László Németh 
CommitDate: Fri May 24 15:09:59 2019 +0200

tdf#79972 XLSX export: fix hyperlink at numeric data

Hyperlink at numeric data lost after export.

tdf79972.xlsx: Test file from Excel 2016.

Change-Id: I6064724e6e38325386c4dfc8f1e9d93cce041975
Reviewed-on: https://gerrit.libreoffice.org/72894
Reviewed-by: László Németh 
Tested-by: László Németh 
Tested-by: Jenkins

diff --git a/sc/qa/unit/data/xlsx/tdf79972.xlsx 
b/sc/qa/unit/data/xlsx/tdf79972.xlsx
new file mode 100644
index ..49f797cce41a
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf79972.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index ef7346967397..94bfd5ae4f36 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -222,6 +222,7 @@ public:
 void testTdf112567();
 void testTdf123645XLSX();
 void testTdf125173XLSX();
+void testTdf79972XLSX();
 
 void testXltxExport();
 
@@ -349,6 +350,7 @@ public:
 CPPUNIT_TEST(testTdf112567);
 CPPUNIT_TEST(testTdf123645XLSX);
 CPPUNIT_TEST(testTdf125173XLSX);
+CPPUNIT_TEST(testTdf79972XLSX);
 
 CPPUNIT_TEST(testXltxExport);
 
@@ -4370,6 +4372,22 @@ void ScExportTest::testTdf125173XLSX()
 assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", 
"TargetMode", "External");
 }
 
+void ScExportTest::testTdf79972XLSX()
+{
+ScDocShellRef xDocSh = loadDoc("tdf79972.", FORMAT_XLSX);
+CPPUNIT_ASSERT(xDocSh.is());
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+
+xmlDocPtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
+CPPUNIT_ASSERT(pDoc);
+assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink", "ref", "A1");
+
+xmlDocPtr pXmlRels = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/_rels/sheet1.xml.rels");
+CPPUNIT_ASSERT(pXmlRels);
+assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "Target", 
"https://bugs.documentfoundation.org/show_bug.cgi?id=79972;);
+assertXPath(pXmlRels, "/r:Relationships/r:Relationship", "TargetMode", 
"External");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index e236a795f72d..c8a34cd89faf 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -24,6 +24,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -2522,6 +2524,17 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& 
rRoot ) :
 {
 double fValue = rScCell.mfValue;
 
+if (pPattern)
+{
+OUString aUrl = 
pPattern->GetItemSet().Get(ATTR_HYPERLINK).GetValue();
+if (!aUrl.isEmpty())
+{
+std::shared_ptr aLink;
+aLink.reset(new XclExpHyperlink(GetRoot(), 
SvxURLField(aUrl, aUrl), aScPos));
+mxHyperlinkList->AppendRecord(aLink);
+}
+}
+
 // try to create a Boolean cell
 if( pPattern && ((fValue == 0.0) || (fValue == 1.0)) )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-03 Thread Vasily Melenchuk (via logerrit)
 sc/qa/unit/copy_paste_test.cxx |   65 +
 sc/source/core/data/table7.cxx |   10 ++
 2 files changed, 75 insertions(+)

New commits:
commit 7ca7d61dc25f409e209b3a432c7f07469b17e316
Author: Vasily Melenchuk 
AuthorDate: Fri May 3 00:09:37 2019 +0300
Commit: Eike Rathke 
CommitDate: Fri May 3 22:43:49 2019 +0200

tdf#124565: calc: copy/paste manual row height

Row height being pasted is not sufficient without knowing
if it is auto height or was set manually.

Change-Id: I3c892fbe3ea5a54e7468fb23b993fa19370f85af
Reviewed-on: https://gerrit.libreoffice.org/71706
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx
index ac14129d0e74..967faaadf13a 100644
--- a/sc/qa/unit/copy_paste_test.cxx
+++ b/sc/qa/unit/copy_paste_test.cxx
@@ -32,10 +32,12 @@ public:
 
 void testCopyPasteXLS();
 void testTdf84411();
+void testTdf124565();
 
 CPPUNIT_TEST_SUITE(ScCopyPasteTest);
 CPPUNIT_TEST(testCopyPasteXLS);
 CPPUNIT_TEST(testTdf84411);
+CPPUNIT_TEST(testTdf124565);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -224,6 +226,69 @@ void ScCopyPasteTest::testTdf84411()
 xComponent->dispose();
 }
 
+void ScCopyPasteTest::testTdf124565()
+{
+// Create new document
+ScDocShell* xDocSh = new ScDocShell(
+SfxModelFlags::EMBEDDED_OBJECT |
+SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS |
+SfxModelFlags::DISABLE_DOCUMENT_RECOVERY);
+xDocSh->DoInitNew();
+
+uno::Reference< frame::XDesktop2 > xDesktop = 
frame::Desktop::create(::comphelper::getProcessComponentContext());
+CPPUNIT_ASSERT( xDesktop.is() );
+
+Reference< frame::XFrame > xTargetFrame = xDesktop->findFrame( "_blank", 0 
);
+CPPUNIT_ASSERT( xTargetFrame.is() );
+
+uno::Reference< frame::XModel2 > xModel2 ( xDocSh->GetModel(), UNO_QUERY );
+CPPUNIT_ASSERT( xModel2.is() );
+
+Reference< frame::XController2 > xController ( 
xModel2->createDefaultViewController( xTargetFrame ), UNO_QUERY );
+CPPUNIT_ASSERT( xController.is() );
+
+// introduce model/view/controller to each other
+xController->attachModel( xModel2.get() );
+xModel2->connectController( xController.get() );
+xTargetFrame->setComponent( xController->getComponentWindow(), 
xController.get() );
+xController->attachFrame( xTargetFrame );
+xModel2->setCurrentController( xController.get() );
+
+ScDocument& rDoc = xDocSh->GetDocument();
+ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false);
+CPPUNIT_ASSERT(pViewShell != nullptr);
+
+// Set content and height of first row
+rDoc.SetString(ScAddress(0, 0, 0), "Test");
+rDoc.SetRowHeight(0, 0, 500);
+rDoc.SetManualHeight(0, 0, 0, true);
+
+// Copy first row
+ScDocument aClipDoc(SCDOCMODE_CLIP);
+ScRange aCopyRange(0, 0, 0, MAXCOL, 0, 0);
+pViewShell->GetViewData().GetMarkData().SetMarkArea(aCopyRange);
+pViewShell->GetViewData().GetView()->CopyToClip(, false, false, 
false, false);
+
+// Paste to second row
+SCTAB nTab = 0;
+SCCOL nCol = 0;
+SCROW nRow = 1;
+
+ScRange aPasteRange(nCol, nRow, nTab, MAXCOL, nRow, nTab);
+pViewShell->GetViewData().GetMarkData().SetMarkArea(aPasteRange);
+pViewShell->GetViewData().GetView()->PasteFromClip(InsertDeleteFlags::ALL, 
);
+
+// Copy-pasted?
+CPPUNIT_ASSERT_EQUAL_MESSAGE("String was not pasted!", OUString("Test"), 
rDoc.GetString(nCol, nRow, nTab));
+
+// And height same as in source?
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Row#2 height is invalid!", sal_uInt16(500), 
rDoc.GetRowHeight(nRow, nTab));
+
+CPPUNIT_ASSERT_MESSAGE("Row#2 must be manual height!", 
rDoc.IsManualRowHeight(nRow, nTab));
+
+xDocSh->DoClose();
+}
+
 ScCopyPasteTest::ScCopyPasteTest()
   : ScBootstrapFixture( "sc/qa/unit/data" )
 {
diff --git a/sc/source/core/data/table7.cxx b/sc/source/core/data/table7.cxx
index ae67c319651e..7b67a096bc96 100644
--- a/sc/source/core/data/table7.cxx
+++ b/sc/source/core/data/table7.cxx
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 
 bool ScTable::IsMerged( SCCOL nCol, SCROW nRow ) const
 {
@@ -139,8 +140,17 @@ void ScTable::CopyOneCellFromClip(
 }
 
 if (nCol1 == 0 && nCol2 == MAXCOL && mpRowHeights)
+{
 mpRowHeights->setValue(nRow1, nRow2, 
pSrcTab->GetOriginalHeight(nSrcRow));
 
+if (pRowFlags && pSrcTab->pRowFlags) {
+   if (pSrcTab->pRowFlags->GetValue(nSrcRow) & CRFlags::ManualSize)
+   pRowFlags->OrValue(nRow1, CRFlags::ManualSize);
+   else
+   pRowFlags->AndValue(nRow1, ~CRFlags::ManualSize);
+}
+}
+
 // Copy graphics over too
 bool bCopyGraphics
 = (rCxt.getInsertFlag() & InsertDeleteFlags::OBJECTS) != 
InsertDeleteFlags::NONE;
___
Libreoffice-commits mailing list

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

2019-05-02 Thread Mike Kaganski (via logerrit)
 sc/qa/unit/data/ods/pivottable_fieldInRowsAndData.ods |binary
 sc/qa/unit/pivottable_filters_test.cxx|   15 +++
 sc/source/filter/excel/xepivotxml.cxx |   16 
 3 files changed, 31 insertions(+)

New commits:
commit 31297f32aa9a35897055b0d377af332a4bb977a1
Author: Mike Kaganski 
AuthorDate: Thu May 2 19:44:47 2019 +0300
Commit: Mike Kaganski 
CommitDate: Thu May 2 19:48:10 2019 +0200

tdf#125086: Write dataField attribute for fields that also appear in Data

Change-Id: Id9f8f07bfdb1060f0c3d7ed6f8526a6bfdd84eb4
Reviewed-on: https://gerrit.libreoffice.org/71687
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/qa/unit/data/ods/pivottable_fieldInRowsAndData.ods 
b/sc/qa/unit/data/ods/pivottable_fieldInRowsAndData.ods
new file mode 100644
index ..cbb773857605
Binary files /dev/null and 
b/sc/qa/unit/data/ods/pivottable_fieldInRowsAndData.ods differ
diff --git a/sc/qa/unit/pivottable_filters_test.cxx 
b/sc/qa/unit/pivottable_filters_test.cxx
index 5df1766190cb..14fca36bae17 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -93,6 +93,7 @@ public:
 void testTdf124883();
 void testTdf125046();
 void testTdf125055();
+void testTdf125086();
 
 CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest);
 
@@ -143,6 +144,7 @@ public:
 CPPUNIT_TEST(testTdf124883);
 CPPUNIT_TEST(testTdf125046);
 CPPUNIT_TEST(testTdf125055);
+CPPUNIT_TEST(testTdf125086);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2684,6 +2686,19 @@ void ScPivotTableFiltersTest::testTdf125055()
pDoc, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "m"));
 }
 
+void ScPivotTableFiltersTest::testTdf125086()
+{
+ScDocShellRef xDocSh = loadDoc("pivottable_fieldInRowsAndData.", 
FORMAT_ODS);
+CPPUNIT_ASSERT(xDocSh.is());
+
+xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory,
+   
"xl/pivotTables/pivotTable1.xml", FORMAT_XLSX);
+CPPUNIT_ASSERT(pDoc);
+assertXPath(pDoc, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[2]", 
"axis", "axisRow");
+// "dataField" attribute was not written for this "axisRow" field
+assertXPath(pDoc, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[2]", 
"dataField", "1");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xepivotxml.cxx 
b/sc/source/filter/excel/xepivotxml.cxx
index e3ee0d7e0573..3143f3b1b04a 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -973,8 +973,24 @@ void XclExpXmlPivotTables::SavePivotTableXml( 
XclExpXmlStream& rStrm, const ScDP
 aMemberSequence.emplace_back(nItem, true);
 }
 
+// tdf#125086: check if this field *also* appears in Data region
+bool bAppearsInData = false;
+{
+OUString aSrcName = 
ScDPUtil::getSourceDimensionName(pDim->GetName());
+const auto it = std::find_if(
+aDataFields.begin(), aDataFields.end(), [](const 
DataField& rDataField) {
+OUString aThisName
+= 
ScDPUtil::getSourceDimensionName(rDataField.mpDim->GetName());
+return aThisName == aSrcName;
+});
+if (it != aDataFields.end())
+bAppearsInData = true;
+}
+
 auto pAttList = sax_fastparser::FastSerializerHelper::createAttrList();
 pAttList->add(XML_axis, toOOXMLAxisType(eOrient));
+if (bAppearsInData)
+pAttList->add(XML_dataField, ToPsz10(true));
 pAttList->add(XML_compact, ToPsz10(false));
 pAttList->add(XML_showAll, ToPsz10(false));
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-02 Thread László Németh (via logerrit)
 sc/qa/unit/data/xlsx/tdf112567.xlsx   |binary
 sc/qa/unit/subsequent_export-test.cxx |   30 ++
 sc/source/filter/excel/xename.cxx |8 +++-
 3 files changed, 37 insertions(+), 1 deletion(-)

New commits:
commit 19976f079800ec4c1d0d5d7e226986cb41f834c2
Author: László Németh 
AuthorDate: Mon Apr 29 17:31:16 2019 +0200
Commit: László Németh 
CommitDate: Thu May 2 08:27:33 2019 +0200

tdf#112567 XLSX export: fix broken built-in names

Localized range separators resulted broken XLSX export
with duplicated built-in names. For example, XLSX export
of a Format->Print range using Hungarian locale in LibO
raised an error message in MSO, because the export
contained the same range also with a bad semicolon:

Sheet1!$A:$A;Sheet1!$1:$1
Sheet1!$A:$A,Sheet1!$1:$1

Change-Id: Iee6ff7c5f5952fc1e736cebfc290c64a851786ab
Reviewed-on: https://gerrit.libreoffice.org/71538
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sc/qa/unit/data/xlsx/tdf112567.xlsx 
b/sc/qa/unit/data/xlsx/tdf112567.xlsx
new file mode 100644
index ..287c0cc1aa0e
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf112567.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 23727d5b17c7..2db10074d785 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -60,6 +60,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 
@@ -214,6 +216,7 @@ public:
 void testTdf115192XLSX();
 void testTdf91634XLSX();
 void testTdf115159();
+void testTdf112567();
 void testTdf123645XLSX();
 
 void testXltxExport();
@@ -336,6 +339,7 @@ public:
 CPPUNIT_TEST(testTdf115192XLSX);
 CPPUNIT_TEST(testTdf91634XLSX);
 CPPUNIT_TEST(testTdf115159);
+CPPUNIT_TEST(testTdf112567);
 CPPUNIT_TEST(testTdf123645XLSX);
 
 CPPUNIT_TEST(testXltxExport);
@@ -4199,6 +4203,32 @@ void ScExportTest::testTdf115159()
 xDocSh->DoClose();
 }
 
+void ScExportTest::testTdf112567()
+{
+// Set the system locale to Hungarian (a language with different range 
separator)
+SvtSysLocaleOptions aOptions;
+aOptions.SetLocaleConfigString("hu-HU");
+aOptions.Commit();
+comphelper::ScopeGuard g([] {
+aOptions.SetLocaleConfigString(OUString());
+aOptions.Commit();
+});
+
+ScDocShellRef xShell = loadDoc("tdf112567.", FORMAT_XLSX);
+CPPUNIT_ASSERT(xShell.is());
+ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
+CPPUNIT_ASSERT(xDocSh.is());
+xShell->DoClose();
+
+xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, 
"xl/workbook.xml", FORMAT_XLSX);
+CPPUNIT_ASSERT(pDoc);
+
+//assert the existing OOXML built-in name is not duplicated
+assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName", 1);
+
+xDocSh->DoClose();
+}
+
 void ScExportTest::testTdf123645XLSX()
 {
 ScDocShellRef xDocSh = loadDoc("chart_hyperlink.", FORMAT_XLSX);
diff --git a/sc/source/filter/excel/xename.cxx 
b/sc/source/filter/excel/xename.cxx
index ee3bfa2c10f3..ee418fb80d5c 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -537,8 +537,14 @@ sal_uInt16 XclExpNameManagerImpl::FindBuiltInNameIdx(
 for( size_t nPos = 0; nPos < mnFirstUserIdx; ++nPos )
 {
 XclExpNameRef xName = maNameList.GetRecord( nPos );
-if( xName->GetBuiltInName() == cBuiltIn && xName->GetSymbol() == 
sSymbol )
+if( xName->GetBuiltInName() == cBuiltIn && 
xName->GetSymbol().replace(';', ',') == sSymbol.replace(';', ',') )
 {
+// tdf#112567 restore the original built-in names with 
non-localized separators
+// TODO: support more localizations, if needed
+if ( xName->GetSymbol() != sSymbol )
+{
+xName->SetSymbol(xName->GetSymbol().replace(';', ','));
+}
 return static_cast< sal_uInt16 >( nPos + 1 );
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-01 Thread Mike Kaganski (via logerrit)
 sc/qa/unit/data/xlsx/pivottable_1s_difference.xlsx |binary
 sc/qa/unit/pivottable_filters_test.cxx |   38 +
 sc/source/filter/excel/xepivotxml.cxx  |6 ++-
 3 files changed, 42 insertions(+), 2 deletions(-)

New commits:
commit f8472069d451ec001e602bbc5329ad030fae1219
Author: Mike Kaganski 
AuthorDate: Wed May 1 07:22:44 2019 +0300
Commit: Mike Kaganski 
CommitDate: Wed May 1 09:40:22 2019 +0200

tdf#125055: properly round fractions of seconds

... so that 2017-07-10T09:11:02.99... becomes 2017-07-10T09:11:03,
not 2017-07-10T09:11:02. The latter created duplicated items in pivot
table cache previously.

TODO: check what to do if the times are actually different by 100 ns?
What Excel does then? Should we increase cache item precision?

Change-Id: I622d1c784ee9fddf6b387bec2d8af87bae5668ba
Reviewed-on: https://gerrit.libreoffice.org/71610
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/qa/unit/data/xlsx/pivottable_1s_difference.xlsx 
b/sc/qa/unit/data/xlsx/pivottable_1s_difference.xlsx
new file mode 100644
index ..de8906cf94ca
Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivottable_1s_difference.xlsx 
differ
diff --git a/sc/qa/unit/pivottable_filters_test.cxx 
b/sc/qa/unit/pivottable_filters_test.cxx
index d9804d0713f1..5df1766190cb 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -92,6 +92,7 @@ public:
 void testTdf124810();
 void testTdf124883();
 void testTdf125046();
+void testTdf125055();
 
 CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest);
 
@@ -141,6 +142,7 @@ public:
 CPPUNIT_TEST(testTdf124810);
 CPPUNIT_TEST(testTdf124883);
 CPPUNIT_TEST(testTdf125046);
+CPPUNIT_TEST(testTdf125055);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2646,6 +2648,42 @@ void ScPivotTableFiltersTest::testTdf125046()
 "longText", "1");
 }
 
+void ScPivotTableFiltersTest::testTdf125055()
+{
+ScDocShellRef xDocSh = loadDoc("pivottable_1s_difference.", FORMAT_XLSX);
+CPPUNIT_ASSERT(xDocSh.is());
+
+xmlDocPtr pDoc = XPathHelper::parseExport2(
+*this, *xDocSh, m_xSFactory, 
"xl/pivotCache/pivotCacheDefinition1.xml", FORMAT_XLSX);
+CPPUNIT_ASSERT(pDoc);
+
+// 1-second precision should not result in duplicated entries for values 
different by ~1 s.
+// Previously truncating nanoseconds in GetExcelFormattedDate converted
+// "2017-07-10T09:11:02.9..." into "2017-07-10T09:11:02", creating two 
identical strings
+// Only compare times here: see comment to 
ScPivotTableFiltersTest::testPivotCacheExportXLSX
+// "TODO Date generator in tests are one day higher, than during standard 
xlsx export"
+OUString sISODateTime = getXPath(
+pDoc, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", 
"minDate");
+CPPUNIT_ASSERT_EQUAL(OUString("T09:11:02"), sISODateTime.copy(10));
+sISODateTime = getXPath(
+pDoc, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", 
"maxDate");
+CPPUNIT_ASSERT_EQUAL(OUString("T09:11:03"), sISODateTime.copy(10));
+assertXPath(pDoc, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems",
+"count", "3");
+assertXPathChildren(pDoc, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems",
+3); // 2 different values + empty
+sISODateTime = getXPath(
+pDoc, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems/x:d[1]", 
"v");
+CPPUNIT_ASSERT_EQUAL(OUString("T09:11:02"), sISODateTime.copy(10));
+sISODateTime = getXPath(
+pDoc, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems/x:d[2]", 
"v");
+CPPUNIT_ASSERT_EQUAL(OUString("T09:11:03"), sISODateTime.copy(10));
+// Trailing empty
+CPPUNIT_ASSERT_EQUAL(
+2, getXPathPosition(
+   pDoc, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "m"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xepivotxml.cxx 
b/sc/source/filter/excel/xepivotxml.cxx
index 8c263795fe94..dc825f0c836b 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -192,8 +192,10 @@ namespace {
  */
 OUString GetExcelFormattedDate( double fSerialDateTime, const 
SvNumberFormatter& rFormatter )
 {
-//::sax::Converter::convertDateTime(sBuf, 
(DateTime(rFormatter.GetNullDate()) + fSerialDateTime).GetUNODateTime(), 0, 
true);
-css::util::DateTime aUDateTime = (DateTime(rFormatter.GetNullDate()) + 
fSerialDateTime).GetUNODateTime();
+// tdf#125055: properly round the value to seconds when truncating 
nanoseconds below
+constexpr double fHalfSecond = 1 / 86400.0 * 0.5;
+css::util::DateTime aUDateTime
+= 

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

2019-04-30 Thread Mike Kaganski (via logerrit)
 sc/qa/unit/data/xlsx/pivottable_long_text.xlsx |binary
 sc/qa/unit/pivottable_filters_test.cxx |   14 ++
 sc/source/filter/excel/xepivotxml.cxx  |   11 +++
 3 files changed, 25 insertions(+)

New commits:
commit 6952a3ba27d0d0fc08c5701b4ed7dd9982c9c60d
Author: Mike Kaganski 
AuthorDate: Tue Apr 30 16:45:54 2019 +0300
Commit: Mike Kaganski 
CommitDate: Tue Apr 30 17:07:39 2019 +0200

tdf#125046: export longText attribute for sharedItems element

Change-Id: Id727f10763bc5017eeb3e267b425d6013786d6a2
Reviewed-on: https://gerrit.libreoffice.org/71585
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/qa/unit/data/xlsx/pivottable_long_text.xlsx 
b/sc/qa/unit/data/xlsx/pivottable_long_text.xlsx
new file mode 100644
index ..f56db722e915
Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivottable_long_text.xlsx 
differ
diff --git a/sc/qa/unit/pivottable_filters_test.cxx 
b/sc/qa/unit/pivottable_filters_test.cxx
index 222772b48866..d9804d0713f1 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -91,6 +91,7 @@ public:
 void tesTtdf124772NumFmt();
 void testTdf124810();
 void testTdf124883();
+void testTdf125046();
 
 CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest);
 
@@ -139,6 +140,7 @@ public:
 CPPUNIT_TEST(tesTtdf124772NumFmt);
 CPPUNIT_TEST(testTdf124810);
 CPPUNIT_TEST(testTdf124883);
+CPPUNIT_TEST(testTdf125046);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2632,6 +2634,18 @@ void ScPivotTableFiltersTest::testTdf124883()
 "Count of Value2");
 }
 
+void ScPivotTableFiltersTest::testTdf125046()
+{
+ScDocShellRef xDocSh = loadDoc("pivottable_long_text.", FORMAT_XLSX);
+CPPUNIT_ASSERT(xDocSh.is());
+
+xmlDocPtr pDoc = XPathHelper::parseExport2(
+*this, *xDocSh, m_xSFactory, 
"xl/pivotCache/pivotCacheDefinition1.xml", FORMAT_XLSX);
+CPPUNIT_ASSERT(pDoc);
+assertXPath(pDoc, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems",
+"longText", "1");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xepivotxml.cxx 
b/sc/source/filter/excel/xepivotxml.cxx
index 75cb94dd2baa..8c263795fe94 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -350,6 +350,7 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( 
XclExpXmlStream& rStrm, const Entr
 double fMin = std::numeric_limits::infinity(), fMax = 
-std::numeric_limits::infinity();
 bool isValueInteger = true;
 bool isContainsDate = rCache.IsDateDimension(i);
+bool isLongText = false;
 for (const auto& rFieldItem : rFieldItems)
 {
 ScDPItemData::Type eType = rFieldItem.GetType();
@@ -369,6 +370,10 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( 
XclExpXmlStream& rStrm, const Entr
 isValueInteger = false;
 }
 }
+else if (eType == ScDPItemData::String && !isLongText)
+{
+isLongText = rFieldItem.GetString().getLength() > 255;
+}
 }
 
 auto pAttList = sax_fastparser::FastSerializerHelper::createAttrList();
@@ -444,6 +449,12 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( 
XclExpXmlStream& rStrm, const Entr
 {
 pAttList->add(XML_count, 
OString::number(static_cast(rFieldItems.size(;
 }
+
+if (isLongText)
+{
+pAttList->add(XML_longText, ToPsz10(true));
+}
+
 sax_fastparser::XFastAttributeListRef xAttributeList(pAttList);
 
 pDefStrm->startElement(XML_sharedItems, xAttributeList);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-04-25 Thread Mike Kaganski (via logerrit)
 sc/qa/unit/subsequent_filters-test.cxx |   15 +++
 sc/source/filter/excel/colrowst.cxx|2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit e056abae09796f2b3806e94e62cae7f0d262d4d5
Author: Mike Kaganski 
AuthorDate: Thu Apr 25 15:30:49 2019 +0300
Commit: Mike Kaganski 
CommitDate: Thu Apr 25 20:09:39 2019 +0200

tdf#50916: XLS: make sure to set default widths to all columns

See 
https://lists.freedesktop.org/archives/libreoffice/2019-April/082479.html
Ths partially reverts commit 1463625ae26900d2461fd72a5a2c894b9f1b8726

Change-Id: I36ec01c8d331d879143f60e12dc239158a8822ec
Reviewed-on: https://gerrit.libreoffice.org/71301
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 

diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index 578ff72435d2..fa9abf92f4f1 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -248,6 +248,7 @@ public:
 void testTdf62268();
 void testVBAMacroFunctionODS();
 void testAutoheight2Rows();
+void testXLSDefColWidth();
 
 CPPUNIT_TEST_SUITE(ScFiltersTest);
 CPPUNIT_TEST(testBooleanFormatXLSX);
@@ -387,6 +388,7 @@ public:
 CPPUNIT_TEST(testTdf62268);
 CPPUNIT_TEST(testVBAMacroFunctionODS);
 CPPUNIT_TEST(testAutoheight2Rows);
+CPPUNIT_TEST(testXLSDefColWidth);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -4269,6 +4271,19 @@ void ScFiltersTest::testAutoheight2Rows()
 xDocSh->DoClose();
 }
 
+void ScFiltersTest::testXLSDefColWidth()
+{
+// XLS has only 256 columns; but on import, we need to set default width 
to all above that limit
+ScDocShellRef xDocSh = loadDoc("chartx.", FORMAT_XLS); // just some XLS 
with narrow columns
+ScDocument& rDoc = xDocSh->GetDocument();
+
+int nWidth = rDoc.GetColWidth(MAXCOL, 0, false);
+// This was 1280
+CPPUNIT_ASSERT_EQUAL(1005, nWidth);
+
+xDocSh->DoClose();
+}
+
 ScFiltersTest::ScFiltersTest()
   : ScBootstrapFixture( "sc/qa/unit/data" )
 {
diff --git a/sc/source/filter/excel/colrowst.cxx 
b/sc/source/filter/excel/colrowst.cxx
index 5640335f08b8..fb8e3e1c3836 100644
--- a/sc/source/filter/excel/colrowst.cxx
+++ b/sc/source/filter/excel/colrowst.cxx
@@ -184,7 +184,7 @@ void XclImpColRowSettings::Convert( SCTAB nScTab )
 // column widths --
 
 maColWidths.build_tree();
-for( SCCOL nCol : rDoc.GetColumnsRange(nScTab, 0, MAXCOL) )
+for (SCCOL nCol = 0; nCol <= MAXCOL; ++nCol)
 {
 sal_uInt16 nWidth = mnDefWidth;
 if (GetColFlag(nCol, ExcColRowFlags::Used))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-04-24 Thread Mike Kaganski (via logerrit)
 sc/qa/unit/subsequent_export-test.cxx |  104 --
 sc/source/filter/excel/xetable.cxx|   43 --
 sc/source/filter/inc/xetable.hxx  |9 +-
 3 files changed, 69 insertions(+), 87 deletions(-)

New commits:
commit 071d72cc3662168c58358ce53a77ceacbf80f545
Author: Mike Kaganski 
AuthorDate: Tue Apr 23 15:59:24 2019 +0300
Commit: Mike Kaganski 
CommitDate: Wed Apr 24 09:22:56 2019 +0200

tdf#124741: export default column width to XLSX

For some reason, we have never exported the default column width
to XLSX, although we have such export for XLS. This led to bugs
like tdf#100946. Workarounds applied to those bugs have made LO
to export columns which shouldn't have been exported, abusing
"customWidth" attribute in XclExpColinfo::XclExpColinfo depending
on if the column has size different from an app-global default;
after that, sheet-local default was determined, and then columns
which have mbCustomWidth set (i.e., different from app default),
as well as those different from sheet-local default, were stored.
Effectively, the hack had disabled the removal of defaults from
maColInfos in XclExpColinfoBuffer::Finalize. We even had unit
tests explicitly testing that we export those columns that Excel
skips. The effect of that is not only unnecessary data in the file;
the data was actually wrong (customWidth actually means that the
width was edited manually by user, even if equal to the default,
thus changing Excel handling of the column); and also Calc
initializes all columns to the right of last used column for such
a file. Only in case when app-global default happened to match
sheet-local one, columns would have properties allowing them to
be removed from maColInfos in the end of XclExpColinfoBuffer::Finalize,
which still resulted in problems similar to the workarounded one.

This patch implements proper export of the default column width
to XLSX, thus partially reverting changes made for tdf#100946 in
commit 40d892a2db4d750aaf0562c63004e693c028273c. Actually, our
export to XLSX does not depend on the 5-pixel correction (see
ECMA-376-1:2016 18.3.1.81), since the exported default depends
only on most-used column width. XclExpDefcolwidth implementation
was edited to only take the correction into account when exporting
to XLS (to keep status quo; it's clear that XLS widths export
and import implementation is incorrect: some empirical formula
is used in XclTools::GetXclDefColWidthCorrection, that was
introduced in commit 555d702903fb0857122024e1ab78a72d122d3f16 for
i#3006, that doesn't match any documentation, and changes widths
of columns in exported XLS - something to be fixed independently).

Change-Id: I227aca17e56247cbb839444717066a898987c4f1
Reviewed-on: https://gerrit.libreoffice.org/71132
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 

diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 57c4469355f7..23727d5b17c7 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -782,80 +782,60 @@ void ScExportTest::testCustomColumnWidthExportXLSX()
 xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
 CPPUNIT_ASSERT(pSheet);
 
-// First column, has everything default (width in Calc: 1280)
+// tdf#124741: check that we export default width, otherwise the skipped 
columns would have
+// wrong width. Previously defaultColWidth attribute was missing
+double nDefWidth
+= getXPath(pSheet, "/x:worksheet/x:sheetFormatPr", 
"defaultColWidth").toDouble();
+CPPUNIT_ASSERT_DOUBLES_EQUAL(11.53515625, nDefWidth, 0.01);
+
+// First column, has everything default (width in Calc: 1280), skipped
+
+// Second column, has custom width (width in Calc: 1225)
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "0");
-assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "customWidth", 
"false");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "customWidth", "true");
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "collapsed", "false");
-assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "min", "1");
-assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "max", "1");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "min", "2");
+assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "max", "2");
 
-// Second column, has custom width (width in Calc: 1225)
-assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "false");
+// Third column, has everything default (width in Calc: 1280), skipped
+
+// Fourth column has custom width. Columns from 4 to 7 are hidden
+assertXPath(pSheet, 

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

2019-04-22 Thread Mike Kaganski (via logerrit)
 sc/qa/unit/pivottable_filters_test.cxx|   19 +++
 sc/source/filter/oox/pivottablebuffer.cxx |3 +++
 sc/source/ui/unoobj/dapiuno.cxx   |8 
 3 files changed, 30 insertions(+)

New commits:
commit 7f6a6664a1f3a37a97d02d5f0894300aff0d8db5
Author: Mike Kaganski 
AuthorDate: Mon Apr 22 14:56:07 2019 +0300
Commit: Mike Kaganski 
CommitDate: Mon Apr 22 15:56:31 2019 +0200

tdf#124883: don't drop data field names on import

The name attribute of dataField element was already read in
PivotTable::importDataField; and then it was ignored in
PivotTableField::convertDataField. ScDataPilotFieldObj had no
handler for name in its ScDataPilotFieldObj::[gs]etPropertyValue,
although it has [gs]etName for that - so this change puts pieces
together to allow to use the imported name correctly.

Change-Id: I5357601b26e6635ab132ff6a1294645995aff97e
Reviewed-on: https://gerrit.libreoffice.org/71068
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/qa/unit/pivottable_filters_test.cxx 
b/sc/qa/unit/pivottable_filters_test.cxx
index 9682b2a10131..222772b48866 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -90,6 +90,7 @@ public:
 void testTdf124736();
 void tesTtdf124772NumFmt();
 void testTdf124810();
+void testTdf124883();
 
 CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest);
 
@@ -137,6 +138,7 @@ public:
 CPPUNIT_TEST(testTdf124736);
 CPPUNIT_TEST(tesTtdf124772NumFmt);
 CPPUNIT_TEST(testTdf124810);
+CPPUNIT_TEST(testTdf124883);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2613,6 +2615,23 @@ void ScPivotTableFiltersTest::testTdf124810()
 }
 }
 
+void ScPivotTableFiltersTest::testTdf124883()
+{
+ScDocShellRef xDocSh = loadDoc("pivot-table/two-data-fields.", 
FORMAT_XLSX);
+CPPUNIT_ASSERT(xDocSh.is());
+
+xmlDocPtr pTable = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory,
+"xl/pivotTables/pivotTable1.xml", FORMAT_XLSX);
+xDocSh->DoClose();
+CPPUNIT_ASSERT(pTable);
+
+// The field names must be kept just as they appear in original XLSX
+assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField[1]", 
"name",
+"Sum of Value");
+assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField[2]", 
"name",
+"Count of Value2");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/oox/pivottablebuffer.cxx 
b/sc/source/filter/oox/pivottablebuffer.cxx
index 772637feb674..8af348942bcd 100644
--- a/sc/source/filter/oox/pivottablebuffer.cxx
+++ b/sc/source/filter/oox/pivottablebuffer.cxx
@@ -577,6 +577,9 @@ void PivotTableField::convertDataField( const 
PTDataFieldModel& rDataField )
 // field orientation
 aPropSet.setProperty( PROP_Orientation, DataPilotFieldOrientation_DATA 
);
 
+if (!rDataField.maName.isEmpty())
+aPropSet.setProperty(PROP_Name, rDataField.maName);
+
 /*  Field aggregation function. Documentation is a little bit confused
 about which names to use for the count functions. The name 'count'
 means 'count all', and 'countNum' means 'count numbers'. On the
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index ab921ea659b5..0f3fa929ef4a 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -1910,6 +1910,12 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue( 
const OUString& aPropertyNa
 {
 setRepeatItemLabels(cppu::any2bool(aValue));
 }
+else if (aPropertyName == SC_UNONAME_NAME)
+{
+OUString sName;
+if (aValue >>= sName)
+setName(sName);
+}
 }
 
 Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const OUString& 
aPropertyName )
@@ -1999,6 +2005,8 @@ Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const 
OUString& aPropertyNam
 aRet <<= getShowEmpty();
 else if ( aPropertyName == SC_UNONAME_REPEATITEMLABELS )
 aRet <<= getRepeatItemLabels();
+else if (aPropertyName == SC_UNONAME_NAME)
+aRet <<= getName();
 
 return aRet;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-04-17 Thread Mike Kaganski (via logerrit)
 sc/qa/unit/data/ods/pivot-table-num-fmt.ods |binary
 sc/qa/unit/pivottable_filters_test.cxx  |   27 +
 sc/source/filter/excel/xepivotxml.cxx   |   44 +---
 3 files changed, 61 insertions(+), 10 deletions(-)

New commits:
commit 26e85974a0287ab5869e7ff0145a66b853d66a02
Author: Mike Kaganski 
AuthorDate: Wed Apr 17 11:11:58 2019 +0300
Commit: Mike Kaganski 
CommitDate: Wed Apr 17 13:01:47 2019 +0200

tdf#124772: export data field number format to XLSX

... otherwise Excel would reset data formatting e.g. from currency
to plain numbers upon refresh.

Excel relies on per-field format setting in pivot tables, while Calc
takes fields formatting from source.

Change-Id: Ia8cdf3f8fcd23720e3daaf989152c170057b339c
Reviewed-on: https://gerrit.libreoffice.org/70860
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 

diff --git a/sc/qa/unit/data/ods/pivot-table-num-fmt.ods 
b/sc/qa/unit/data/ods/pivot-table-num-fmt.ods
new file mode 100644
index ..e6cfd138c12d
Binary files /dev/null and b/sc/qa/unit/data/ods/pivot-table-num-fmt.ods differ
diff --git a/sc/qa/unit/pivottable_filters_test.cxx 
b/sc/qa/unit/pivottable_filters_test.cxx
index e6ccb4914ef9..f9d10f9f4451 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -88,6 +88,7 @@ public:
 void testTdf123939();
 void testTdf124651();
 void testTdf124736();
+void tesTtdf124772NumFmt();
 
 CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest);
 
@@ -133,6 +134,7 @@ public:
 CPPUNIT_TEST(testTdf123939);
 CPPUNIT_TEST(testTdf124651);
 CPPUNIT_TEST(testTdf124736);
+CPPUNIT_TEST(tesTtdf124772NumFmt);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2538,6 +2540,31 @@ void ScPivotTableFiltersTest::testTdf124736()
 "t", "default");
 }
 
+void ScPivotTableFiltersTest::tesTtdf124772NumFmt()
+{
+ScDocShellRef xDocSh = loadDoc("pivot-table-num-fmt.", FORMAT_ODS);
+CPPUNIT_ASSERT(xDocSh.is());
+
+std::shared_ptr pXPathFile
+= ScBootstrapFixture::exportTo(xDocSh.get(), FORMAT_XLSX);
+xDocSh->DoClose();
+
+xmlDocPtr pTable
+= XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/pivotTables/pivotTable1.xml");
+CPPUNIT_ASSERT(pTable);
+
+// This asserts that numFmtId attribute is present
+const OUString sXclNumFmt
+= getXPath(pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField", 
"numFmtId");
+
+pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/styles.xml");
+CPPUNIT_ASSERT(pTable);
+
+// Check that we refer to correct format
+assertXPath(pTable, "/x:styleSheet/x:numFmts/x:numFmt[@numFmtId='" + 
sXclNumFmt.toUtf8() + "']",
+"formatCode", "\\$#,##0");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xepivotxml.cxx 
b/sc/source/filter/excel/xepivotxml.cxx
index 2161f68d6478..43dc30196160 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -16,6 +16,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -23,10 +26,12 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -1063,6 +1068,10 @@ void XclExpXmlPivotTables::SavePivotTableXml( 
XclExpXmlStream& rStrm, const ScDP
 
 if (!aDataFields.empty())
 {
+css::uno::Reference xDimsByName;
+if (auto xDimSupplier = const_cast(rDPObj).GetSource())
+xDimsByName = xDimSupplier->getDimensions();
+
 pPivotStrm->startElement(XML_dataFields,
 XML_count, OString::number(static_cast(aDataFields.size())),
 FSEND);
@@ -1077,17 +1086,32 @@ void XclExpXmlPivotTables::SavePivotTableXml( 
XclExpXmlStream& rStrm, const ScDP
 // Excel (at least 2016) seems to insist on the presence of "name" 
attribute in
 // dataField element, even if empty
 const OString sName = pName ? pName->toUtf8() : "";
-pPivotStrm->write("<")->writeId(XML_dataField);
-rStrm.WriteAttributes(XML_name, sName, FSEND);
-
-rStrm.WriteAttributes(XML_fld, OString::number(nDimIdx).getStr(), 
FSEND);
-
-ScGeneralFunction eFunc = rDim.GetFunction();
-const char* pSubtotal = toOOXMLSubtotalType(eFunc);
+auto pItemAttList = 
sax_fastparser::FastSerializerHelper::createAttrList();
+pItemAttList->add(XML_name, sName);
+pItemAttList->add(XML_fld, OString::number(nDimIdx));
+const char* pSubtotal = toOOXMLSubtotalType(rDim.GetFunction());
 if (pSubtotal)
-rStrm.WriteAttributes(XML_subtotal, pSubtotal, FSEND);
-
-pPivotStrm->write("/>");
+pItemAttList->add(XML_subtotal, pSubtotal);
+if (xDimsByName)
+   

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

2019-04-16 Thread Mike Kaganski (via logerrit)
 sc/qa/unit/pivottable_filters_test.cxx |   56 +
 sc/source/filter/excel/xepivotxml.cxx  |   87 +
 2 files changed, 112 insertions(+), 31 deletions(-)

New commits:
commit 0871804bab38e1b2fdc19ff176189356e155f367
Author: Mike Kaganski 
AuthorDate: Mon Apr 15 23:33:38 2019 +0300
Commit: Mike Kaganski 
CommitDate: Tue Apr 16 09:48:21 2019 +0200

tdf#124736: Sort group field items

Excel expects the group field items to be in ascending order starting
from "<01/02/2010", then "Jan", "Feb", ..., then end with ">01/02/2020".

Change-Id: I29e9b55f43091ed007f59e10dec64f46a37c7d5f
Reviewed-on: https://gerrit.libreoffice.org/70800
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/qa/unit/pivottable_filters_test.cxx 
b/sc/qa/unit/pivottable_filters_test.cxx
index cc8bcc042ab8..e6ccb4914ef9 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -87,6 +87,7 @@ public:
 void testTdf123923();
 void testTdf123939();
 void testTdf124651();
+void testTdf124736();
 
 CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest);
 
@@ -131,6 +132,7 @@ public:
 CPPUNIT_TEST(testTdf123923);
 CPPUNIT_TEST(testTdf123939);
 CPPUNIT_TEST(testTdf124651);
+CPPUNIT_TEST(testTdf124736);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2482,6 +2484,60 @@ void ScPivotTableFiltersTest::testTdf124651()
 assertXPath(pDoc, "/x:pivotTableDefinition/x:dataFields/x:dataField", 
"name", "");
 }
 
+void ScPivotTableFiltersTest::testTdf124736()
+{
+ScDocShellRef xDocSh = loadDoc("pivot-table/shared-dategroup.", 
FORMAT_XLSX);
+CPPUNIT_ASSERT(xDocSh.is());
+
+std::shared_ptr pXPathFile
+= ScBootstrapFixture::exportTo(xDocSh.get(), FORMAT_XLSX);
+xDocSh->DoClose();
+
+xmlDocPtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory,
+
"xl/pivotCache/pivotCacheDefinition1.xml");
+CPPUNIT_ASSERT(pTable);
+
+assertXPath(pTable,
+
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems",
+"count", "45");
+// Group items must start with "<05/16/1958", then years sorted ascending, 
then ">06/11/2009"
+// They used to have years in the beginning, then "<05/16/1958", then 
">06/11/2009".
+// The "<" and ">" date strings are locale-dependent, so test depends on 
en_US locale
+assertXPath(
+pTable,
+
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems/x:s[1]",
+"v", "<05/16/1958");
+for (int i = 2; i <= 44; ++i)
+assertXPath(
+pTable,
+
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems/x:s["
++ OString::number(i) + "]",
+"v", OUString::number(1963 + i));
+assertXPath(
+pTable,
+
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems/x:s[45]",
+"v", ">06/11/2009");
+
+// Now check that table references these in correct order 
(document-dependent, so this is how
+// it should be in this specific testdoc which shows "<" and ">" values in 
the end)
+pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/pivotTables/pivotTable1.xml");
+CPPUNIT_ASSERT(pTable);
+assertXPath(pTable, 
"/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]/x:items", "count",
+"46");
+const int vals[] = { 1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 
14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 
29, 30,
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 
0,  44 };
+for (size_t i = 0; i < SAL_N_ELEMENTS(vals); ++i)
+{
+assertXPath(pTable,
+
"/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]/x:items/x:item["
++ OString::number(i + 1) + "]",
+"x", OUString::number(vals[i]));
+}
+assertXPath(pTable, 
"/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]/x:items/x:item[46]",
+"t", "default");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xepivotxml.cxx 
b/sc/source/filter/excel/xepivotxml.cxx
index 6f98ffddcaa4..2161f68d6478 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -197,7 +197,42 @@ OUString GetExcelFormattedDate( double fSerialDateTime, 
const SvNumberFormatter&
 ::sax::Converter::convertDateTime(sBuf, aUDateTime, nullptr, true);
 return sBuf.makeStringAndClear();
 }
+
+// Excel seems to expect different order of group item values; we need to 
rearrange elements
+// to output "date2" last.
+// Since ScDPItemData::DateFirst is -1, ScDPItemData::DateLast is 1, and 
other date group
+// items 

[Libreoffice-commits] core.git: sc/qa sc/source sc/uiconfig solenv/sanitizers

2019-04-14 Thread Caolán McNamara (via logerrit)
 sc/qa/uitest/calc_tests2/consolidate.py   |9 
 sc/source/ui/dbgui/consdlg.cxx|  415 ++
 sc/source/ui/inc/consdlg.hxx  |   84 +++---
 sc/source/ui/inc/reffact.hxx  |2 
 sc/source/ui/view/reffact.cxx |4 
 sc/source/ui/view/tabvwshc.cxx|   75 ++---
 sc/uiconfig/scalc/ui/consolidatedialog.ui |  107 +++
 solenv/sanitizers/ui/modules/scalc.suppr  |6 
 8 files changed, 343 insertions(+), 359 deletions(-)

New commits:
commit c3bca577807d7cbd93ce8c66aab8798de45bef16
Author: Caolán McNamara 
AuthorDate: Sat Apr 13 19:23:23 2019 +0100
Commit: Caolán McNamara 
CommitDate: Sun Apr 14 15:54:08 2019 +0200

weld ScConsolidateDlg

Change-Id: I7d52aea1917503a37cdc7d1ae16d7d2377397f30
Reviewed-on: https://gerrit.libreoffice.org/70714
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/qa/uitest/calc_tests2/consolidate.py 
b/sc/qa/uitest/calc_tests2/consolidate.py
index 4d47d03be898..508ac7aaee83 100644
--- a/sc/qa/uitest/calc_tests2/consolidate.py
+++ b/sc/qa/uitest/calc_tests2/consolidate.py
@@ -87,14 +87,15 @@ class consolidate(UITestCase):
 xeddestarea = xDialog.getChild("eddestarea")
 xconsareas = xDialog.getChild("consareas")
 self.assertEqual(get_state_as_dict(xfunc)["SelectEntryText"], "Sum")
-self.assertEqual(get_state_as_dict(xconsareas)["EntryCount"], "3")
+self.assertEqual(get_state_as_dict(xconsareas)["Children"], "3")
 self.assertEqual(get_state_as_dict(xeddestarea)["Text"], "$Total.$A$2")
 self.assertEqual(get_state_as_dict(xbyrow)["Selected"], "true")
 self.assertEqual(get_state_as_dict(xbycol)["Selected"], "true")
 #delete first range
-select_pos(xconsareas, "0")
+xFirstEntry = xconsareas.getChild("0")
+xFirstEntry.executeAction("SELECT", tuple())
 xdelete.executeAction("CLICK", tuple())
-self.assertEqual(get_state_as_dict(xconsareas)["EntryCount"], "2")
+self.assertEqual(get_state_as_dict(xconsareas)["Children"], "2")
 xOKBtn = xDialog.getChild("ok")
 self.ui_test.close_dialog_through_button(xOKBtn)
 
@@ -120,4 +121,4 @@ class consolidate(UITestCase):
 
 self.ui_test.close_doc()
 
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/ui/dbgui/consdlg.cxx b/sc/source/ui/dbgui/consdlg.cxx
index c2138dd89ffe..127d18dfde66 100644
--- a/sc/source/ui/dbgui/consdlg.cxx
+++ b/sc/source/ui/dbgui/consdlg.cxx
@@ -64,77 +64,48 @@ public:
 OUString  aStrArea;
 };
 
-ScConsolidateDlg::ScConsolidateDlg( SfxBindings* pB, SfxChildWindow* pCW, 
vcl::Window* pParent,
-const SfxItemSet&   rArgSet )
-
-:   ScAnyRefDlg ( pB, pCW, pParent, "ConsolidateDialog" , 
"modules/scalc/ui/consolidatedialog.ui" ),
-aStrUndefined   ( ScResId( SCSTR_UNDEFINED ) ),
-theConsData ( static_cast(
-   rArgSet.Get( rArgSet.GetPool()->
-GetWhich( SID_CONSOLIDATE ) )
-  ).GetData() ),
-rViewData   ( 
static_cast(SfxViewShell::Current())->
-GetViewData() ),
-pDoc( 
static_cast(SfxViewShell::Current())->
-GetViewData().GetDocument() ),
-pRangeUtil  ( new ScRangeUtil ),
-nAreaDataCount  ( 0 ),
-nWhichCons  ( rArgSet.GetPool()->GetWhich( SID_CONSOLIDATE ) ),
-bDlgLostFocus   ( false )
+ScConsolidateDlg::ScConsolidateDlg(SfxBindings* pB, SfxChildWindow* pCW, 
weld::Window* pParent,
+   const SfxItemSet& rArgSet)
+
+: ScAnyRefDlgController(pB, pCW, pParent, 
"modules/scalc/ui/consolidatedialog.ui", "ConsolidateDialog")
+, aStrUndefined   ( ScResId( SCSTR_UNDEFINED ) )
+, theConsData ( static_cast(
+ rArgSet.Get( rArgSet.GetPool()->
+  GetWhich( SID_CONSOLIDATE ) )
+).GetData() )
+, rViewData   ( static_cast(SfxViewShell::Current())->
+  GetViewData() )
+, pDoc( static_cast(SfxViewShell::Current())->
+  GetViewData().GetDocument() )
+, pRangeUtil  ( new ScRangeUtil )
+, nAreaDataCount  ( 0 )
+, nWhichCons  ( rArgSet.GetPool()->GetWhich( SID_CONSOLIDATE ) )
+, bDlgLostFocus   ( false )
+, m_xLbFunc(m_xBuilder->weld_combo_box("func"))
+, m_xLbConsAreas(m_xBuilder->weld_tree_view("consareas"))
+, m_xLbDataArea(m_xBuilder->weld_combo_box("lbdataarea"))
+, m_xEdDataArea(new 
formula::WeldRefEdit(m_xBuilder->weld_entry("eddataarea")))
+, m_xRbDataArea(new 

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

2019-04-12 Thread Serge Krot (via logerrit)
 sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py |  191 ++
 sc/source/ui/inc/checklistmenu.hxx|7 
 sc/source/ui/inc/gridwin.hxx  |4 
 sc/source/ui/view/gridwin.cxx |   15 +
 4 files changed, 216 insertions(+), 1 deletion(-)

New commits:
commit 4e7e3670c31329d60f5cc782abc4568c2aba33a7
Author: Serge Krot 
AuthorDate: Tue Mar 5 17:03:31 2019 +0100
Commit: Thorsten Behrens 
CommitDate: Fri Apr 12 11:46:58 2019 +0200

tdf#117276 sc: autofilter was unexpected reset with OK pressed

Change-Id: I53331434bb4d5e2f13e9f2ab5b768e9880aecca8
Reviewed-on: https://gerrit.libreoffice.org/68765
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py 
b/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py
new file mode 100644
index ..6d01a4b1fd61
--- /dev/null
+++ b/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py
@@ -0,0 +1,191 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.calc.document import get_sheet_from_doc
+from uitest.debug import sleep
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import get_row
+from uitest.path import get_srcdir_url
+
+
+def get_url_for_data_file(file_name):
+return get_srcdir_url() + "/sc/qa/uitest/autofilter/data/" + file_name
+
+def is_row_hidden(doc, index):
+row = get_row(doc, index)
+val = row.getPropertyValue("IsVisible")
+return not val
+
+#Bug 117276 - Autofilter settings being reset in some cases
+
+class tdf117276_autofilter_reset(UITestCase):
+def get_values_count_in_AutoFilter(self, xGridWindow, columnIndex, 
buttonName = "cancel"):
+# open filter pop-up window
+self.assertIsNotNone(xGridWindow)
+xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": columnIndex, "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+self.assertIsNotNone(xFloatWindow)
+
+# get check list
+xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+self.assertIsNotNone(xCheckListMenu)
+
+xTreeList = xCheckListMenu.getChild("check_list_box")
+self.assertIsNotNone(xTreeList)
+
+valuesCount = len(xTreeList.getChildren())
+
+# close pop-up window
+xButton = xFloatWindow.getChild(buttonName)
+self.assertIsNotNone(xButton)
+xButton.executeAction("CLICK", tuple())
+
+return valuesCount
+
+def openAutoFilterAndCloseIt(self, xGridWindow, columnIndex, buttonName):
+self.get_values_count_in_AutoFilter(xGridWindow, columnIndex, 
buttonName)
+
+def check_state(self, document, xGridWindow):
+self.assertFalse(is_row_hidden(document, 0))  # column headers
+self.assertTrue(is_row_hidden(document, 1))
+self.assertTrue(is_row_hidden(document, 2))
+self.assertTrue(is_row_hidden(document, 3))
+self.assertTrue(is_row_hidden(document, 4))
+self.assertFalse(is_row_hidden(document, 5))
+
+self.assertEqual(1, self.get_values_count_in_AutoFilter(xGridWindow, 
"0"))
+self.assertEqual(2, self.get_values_count_in_AutoFilter(xGridWindow, 
"1"))
+
+def test_run(self):
+self.ui_test.create_doc_in_start_center("calc")
+document = self.ui_test.get_component()
+calcDoc = self.xUITest.getTopFocusWindow()
+xGridWindow = calcDoc.getChild("grid_window")
+
+#self.ui_test.execute_dialog_through_command(".uno:Insert")  # insert 
sheet
+#xDialog = self.xUITest.getTopFocusWindow()
+#xOKButton = xDialog.getChild("ok")
+#xOKButton.executeAction("CLICK", tuple())
+
+# 1. prepare document
+#|A   | B  |
+#  -
+#  1 | HEADER-A   | HEADER-B   |
+#  -
+#  2 | Unique a2  | common value for B2:B4 |
+#  3 | Unique a3  | common value for B2:B4 |
+#  4 | Unique a4  | common value for B2:B4 |
+#  5 | Unique a5  | Unique b5  |
+#  6 | Unique a6  | Unique b6  |
+#
+# row-1
+enter_text_to_cell(xGridWindow, "A1", "HEADER-A")
+enter_text_to_cell(xGridWindow, "B1", "HEADER-B")
+
+# row-1
+enter_text_to_cell(xGridWindow, "A2", "Unique a2")
+enter_text_to_cell(xGridWindow, "B2", "common value for B2:B4")
+
+# row-2
+enter_text_to_cell(xGridWindow, "A3", "Unique 

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

2019-04-11 Thread Mike Kaganski (via logerrit)
 sc/qa/unit/data/ods/tdf124651_simplePivotTable.ods |binary
 sc/qa/unit/pivottable_filters_test.cxx |   15 +++
 sc/source/filter/excel/xepivotxml.cxx  |7 +--
 3 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit 577b95f4d0cc1cf8836ff35fc30189c64fefb508
Author: Mike Kaganski 
AuthorDate: Wed Apr 10 15:18:07 2019 +0300
Commit: Mike Kaganski 
CommitDate: Thu Apr 11 08:26:18 2019 +0200

tdf#124651: always write "name" attribute to dataField element

Despite being optional as per ECMA-376-1:2016, Excel 2016 seems to
require the presence of "name" attribute in dataField element of
pivot table definition, so make sure to write at least empty string
there.

Change-Id: Iaab5674f86b7dd0b267776678e11af47086635d7
Reviewed-on: https://gerrit.libreoffice.org/70522
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 

diff --git a/sc/qa/unit/data/ods/tdf124651_simplePivotTable.ods 
b/sc/qa/unit/data/ods/tdf124651_simplePivotTable.ods
new file mode 100644
index ..05fd5fec838f
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf124651_simplePivotTable.ods 
differ
diff --git a/sc/qa/unit/pivottable_filters_test.cxx 
b/sc/qa/unit/pivottable_filters_test.cxx
index 739af618ec7d..d5b1afd64701 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -85,6 +85,7 @@ public:
 void testTdf112106();
 void testTdf123923();
 void testTdf123939();
+void testTdf124651();
 
 CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest);
 
@@ -127,6 +128,7 @@ public:
 CPPUNIT_TEST(testTdf112106);
 CPPUNIT_TEST(testTdf123923);
 CPPUNIT_TEST(testTdf123939);
+CPPUNIT_TEST(testTdf124651);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2430,6 +2432,19 @@ void ScPivotTableFiltersTest::testTdf123939()
 "containsMixedTypes", "1");
 }
 
+void ScPivotTableFiltersTest::testTdf124651()
+{
+ScDocShellRef xDocSh = loadDoc("tdf124651_simplePivotTable.", FORMAT_ODS);
+CPPUNIT_ASSERT(xDocSh.is());
+
+xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory,
+"xl/pivotTables/pivotTable1.xml", FORMAT_XLSX);
+CPPUNIT_ASSERT(pDoc);
+// We have to export name attribute, even though it's optional according 
to ECMA-376 standard,
+// because Excel (at least 2016) seems to require it.
+assertXPath(pDoc, "/x:pivotTableDefinition/x:dataFields/x:dataField", 
"name", "");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xepivotxml.cxx 
b/sc/source/filter/excel/xepivotxml.cxx
index 1a47e2cfeb5b..69c98d13c55b 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -947,9 +947,12 @@ void XclExpXmlPivotTables::SavePivotTableXml( 
XclExpXmlStream& rStrm, const ScDP
 assert(aCachedDims[nDimIdx]); // the loop above should have 
screened for NULL's.
 const ScDPSaveDimension& rDim = *rDataField.mpDim;
 const boost::optional & pName = rDim.GetLayoutName();
+// tdf#124651: despite being optional in CT_DataField according to 
ECMA-376 Part 1,
+// Excel (at least 2016) seems to insist on the presence of "name" 
attribute in
+// dataField element, even if empty
+const OString sName = pName ? pName->toUtf8() : "";
 pPivotStrm->write("<")->writeId(XML_dataField);
-if (pName)
-rStrm.WriteAttributes(XML_name, pName->toUtf8(), FSEND);
+rStrm.WriteAttributes(XML_name, sName, FSEND);
 
 rStrm.WriteAttributes(XML_fld, OString::number(nDimIdx).getStr(), 
FSEND);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-04-10 Thread László Németh (via logerrit)
 sc/qa/unit/data/xlsx/tdf115159.xlsx   |binary
 sc/qa/unit/subsequent_export-test.cxx |   19 +++
 sc/source/filter/excel/xename.cxx |   16 +++-
 3 files changed, 26 insertions(+), 9 deletions(-)

New commits:
commit 9d63c7035a86bb3a355433b567d2d8cd53d582fa
Author: László Németh 
AuthorDate: Wed Apr 10 10:34:31 2019 +0200
Commit: László Németh 
CommitDate: Wed Apr 10 17:12:18 2019 +0200

tdf#115159 XLSX export: don't duplicate print titles

In FindBuiltInNameIdx(), check the duplication by
using the exported symbol of the ranges, instead
of the (in the case of whole rows) always different
XclTokenArray data.

Change-Id: Iba439d765bbbfaf5379113548f3d86d1c984e71c
Reviewed-on: https://gerrit.libreoffice.org/70507
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sc/qa/unit/data/xlsx/tdf115159.xlsx 
b/sc/qa/unit/data/xlsx/tdf115159.xlsx
new file mode 100644
index ..e1b625d60aa1
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf115159.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 159152871adf..76acc6b5c640 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -213,6 +213,7 @@ public:
 void testTdf114969XLSX();
 void testTdf115192XLSX();
 void testTdf91634XLSX();
+void testTdf115159();
 
 void testXltxExport();
 
@@ -333,6 +334,7 @@ public:
 CPPUNIT_TEST(testTdf114969XLSX);
 CPPUNIT_TEST(testTdf115192XLSX);
 CPPUNIT_TEST(testTdf91634XLSX);
+CPPUNIT_TEST(testTdf115159);
 
 CPPUNIT_TEST(testXltxExport);
 
@@ -4204,6 +4206,23 @@ void ScExportTest::testTdf91634XLSX()
 assertXPath(pXmlRels, "/r:Relationships/r:Relationship[@Id='rId1']", 
"TargetMode", "External");
 }
 
+void ScExportTest::testTdf115159()
+{
+ScDocShellRef xShell = loadDoc("tdf115159.", FORMAT_XLSX);
+CPPUNIT_ASSERT(xShell.is());
+ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
+CPPUNIT_ASSERT(xDocSh.is());
+xShell->DoClose();
+
+xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, 
"xl/workbook.xml", FORMAT_XLSX);
+CPPUNIT_ASSERT(pDoc);
+
+//assert the existing OOXML built-in name is not duplicated
+assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName", 1);
+
+xDocSh->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xename.cxx 
b/sc/source/filter/excel/xename.cxx
index 625578743f80..c0db80cbafba 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -70,8 +70,8 @@ public:
 @return  The built-in name index or EXC_BUILTIN_UNKNOWN for 
user-defined names. */
 sal_Unicode  GetBuiltInName() const { return mcBuiltIn; }
 
-/** Returns the token array for this defined name. */
-const XclTokenArrayRef& GetTokenArray() const { return mxTokArr; }
+/** Returns the symbol value for this defined name. */
+const OUString& GetSymbol() const { return msSymbol; }
 
 /** Returns true, if this is a document-global defined name. */
 bool IsGlobal() const { return mnXclTab == EXC_NAME_GLOBAL; }
@@ -157,7 +157,7 @@ private:
 
 /** Returns the index of an existing built-in NAME record with the passed 
definition, otherwise 0. */
 sal_uInt16  FindBuiltInNameIdx( const OUString& rName,
-const XclTokenArray& rTokArr ) const;
+const OUString& sSymbol ) const;
 /** Returns an unused name for the passed name. */
 OUStringGetUnusedName( const OUString& rName ) const;
 
@@ -525,7 +525,7 @@ sal_uInt16 XclExpNameManagerImpl::FindNamedExp( SCTAB nTab, 
OUString sName )
 }
 
 sal_uInt16 XclExpNameManagerImpl::FindBuiltInNameIdx(
-const OUString& rName, const XclTokenArray& rTokArr ) const
+const OUString& rName, const OUString& sSymbol ) const
 {
 /*  Get built-in index from the name. Special case: the database range
 'unnamed' will be mapped to Excel's built-in '_FilterDatabase' name. */
@@ -537,11 +537,9 @@ sal_uInt16 XclExpNameManagerImpl::FindBuiltInNameIdx(
 for( size_t nPos = 0; nPos < mnFirstUserIdx; ++nPos )
 {
 XclExpNameRef xName = maNameList.GetRecord( nPos );
-if( xName->GetBuiltInName() == cBuiltIn )
+if( xName->GetBuiltInName() == cBuiltIn && xName->GetSymbol() == 
sSymbol )
 {
-XclTokenArrayRef xTokArr = xName->GetTokenArray();
-if( xTokArr && (*xTokArr == rTokArr) )
-return static_cast< sal_uInt16 >( nPos + 1 );
+return static_cast< sal_uInt16 >( nPos + 1 );
 }
 }
 }
@@ -628,7 +626,7 @@ sal_uInt16 XclExpNameManagerImpl::CreateName( SCTAB nTab, 
const ScRangeData& rRa
 cannot be done earlier. 

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

2019-04-08 Thread Caolán McNamara (via logerrit)
 sc/qa/unit/data/wks/fail/ofz14129-1.wks |binary
 sc/source/filter/lotus/tool.cxx |7 ---
 2 files changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 6e7bfc896e6cb4d91dcecf974f0d9ee41f35b86a
Author: Caolán McNamara 
AuthorDate: Mon Apr 8 15:21:09 2019 +0100
Commit: Caolán McNamara 
CommitDate: Mon Apr 8 22:12:27 2019 +0200

ofz#14129 assert on empty string

Change-Id: I9ef3ef2b3b853df43b2f84bfd7e5da824682
Reviewed-on: https://gerrit.libreoffice.org/70419
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/qa/unit/data/wks/fail/ofz14129-1.wks 
b/sc/qa/unit/data/wks/fail/ofz14129-1.wks
new file mode 100644
index ..016d87e63a86
Binary files /dev/null and b/sc/qa/unit/data/wks/fail/ofz14129-1.wks differ
diff --git a/sc/source/filter/lotus/tool.cxx b/sc/source/filter/lotus/tool.cxx
index dabbd05dcd03..2c0a0f7465e9 100644
--- a/sc/source/filter/lotus/tool.cxx
+++ b/sc/source/filter/lotus/tool.cxx
@@ -480,9 +480,10 @@ bool RangeNameBufferWK3::FindRel( const OUString& rRef, 
sal_uInt16& rIndex )
 
 bool RangeNameBufferWK3::FindAbs( const OUString& rRef, sal_uInt16& rIndex )
 {
-OUStringaTmp( rRef );
-aTmp = aTmp.copy(1);
-StringHashEntry aRef( aTmp ); // search w/o '$'!
+if (rRef.isEmpty())
+return false;
+OUString aTmp(rRef.copy(1));
+StringHashEntry aRef(aTmp); // search w/o '$'!
 
 std::vector::iterator itr = std::find_if(maEntries.begin(), 
maEntries.end(),
 [](const Entry& rEntry) { return aRef == rEntry.aStrHashEntry; });
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-04-08 Thread Caolán McNamara (via logerrit)
 sc/qa/unit/data/wks/pass/ofz14086-1.wks |binary
 sc/source/core/data/table2.cxx  |2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 541ad37f2153ba0671e46c7bdf4159cee604dd5f
Author: Caolán McNamara 
AuthorDate: Sun Apr 7 21:21:37 2019 +0100
Commit: Caolán McNamara 
CommitDate: Mon Apr 8 09:53:45 2019 +0200

ofz#14086 another batch of oss-fuzz failures

since...

commit 7282014e362a1529a36c88eb308df8ed359c2cfa
Date:   Fri Feb 1 15:15:16 2019 +0100

tdf#50916 Makes numbers of columns dynamic.

Change-Id: Ib4f39c03aadc41fb2a226f47e452fd66b9b34821
Reviewed-on: https://gerrit.libreoffice.org/70387
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/qa/unit/data/wks/pass/ofz14086-1.wks 
b/sc/qa/unit/data/wks/pass/ofz14086-1.wks
new file mode 100644
index ..74c229abd7bd
Binary files /dev/null and b/sc/qa/unit/data/wks/pass/ofz14086-1.wks differ
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index b049ff193b66..e737b11cab3b 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1493,7 +1493,7 @@ ScFormulaCell* ScTable::SetFormulaCell( SCCOL nCol, SCROW 
nRow, ScFormulaCell* p
 return nullptr;
 }
 
-return aCol[nCol].SetFormulaCell(nRow, pCell, sc::ConvertToGroupListening);
+return CreateColumnIfNotExists(nCol).SetFormulaCell(nRow, pCell, 
sc::ConvertToGroupListening);
 }
 
 bool ScTable::SetFormulaCells( SCCOL nCol, SCROW nRow, 
std::vector& rCells )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-04-08 Thread Caolán McNamara (via logerrit)
 sc/qa/unit/data/qpro/pass/ofz14090-1.wb2 |binary
 sc/qa/unit/data/slk/pass/ofz14088-1.slk  |1 +
 sc/source/core/data/table2.cxx   |2 +-
 sc/source/core/data/table5.cxx   |2 +-
 4 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 31ac398cfa30694b18240d31df17a58d699b5bf6
Author: Caolán McNamara 
AuthorDate: Sat Apr 6 14:03:11 2019 +0100
Commit: Caolán McNamara 
CommitDate: Mon Apr 8 09:54:03 2019 +0200

ofz#14088 ofz#14090 another batch of oss-fuzz failures

since...

commit 7282014e362a1529a36c88eb308df8ed359c2cfa
Date:   Fri Feb 1 15:15:16 2019 +0100

tdf#50916 Makes numbers of columns dynamic.

Change-Id: I447a91468428b463480d835e1983ec11218613a0
Reviewed-on: https://gerrit.libreoffice.org/70388
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/qa/unit/data/qpro/pass/ofz14090-1.wb2 
b/sc/qa/unit/data/qpro/pass/ofz14090-1.wb2
new file mode 100644
index ..57fa24d40855
Binary files /dev/null and b/sc/qa/unit/data/qpro/pass/ofz14090-1.wb2 differ
diff --git a/sc/qa/unit/data/slk/pass/ofz14088-1.slk 
b/sc/qa/unit/data/slk/pass/ofz14088-1.slk
new file mode 100644
index ..abeaa781088e
--- /dev/null
+++ b/sc/qa/unit/data/slk/pass/ofz14088-1.slk
@@ -0,0 +1 @@
+C;Y2;ERX26;Y1;ERX25;K
ID  SCALC3
\ No newline at end of file
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index e737b11cab3b..9839763e8a14 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2555,7 +2555,7 @@ void ScTable::ApplyBlockFrame(const SvxBoxItem& 
rLineOuter, const SvxBoxInfoItem
 void ScTable::ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr 
)
 {
 if (ValidColRow(nCol,nRow))
-aCol[nCol].ApplyPattern( nRow, rAttr );
+CreateColumnIfNotExists(nCol).ApplyPattern( nRow, rAttr );
 }
 
 void ScTable::ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL 
nEndCol, SCROW nEndRow,
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index 5a50a7cfcdcc..a32c27ae10bd 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -1099,7 +1099,7 @@ void ScTable::StartListening( sc::StartListeningContext& 
rCxt, const ScAddress&
 if (!ValidCol(rAddress.Col()))
 return;
 
-aCol[rAddress.Col()].StartListening(rCxt, rAddress, rListener);
+CreateColumnIfNotExists(rAddress.Col()).StartListening(rCxt, rAddress, 
rListener);
 }
 
 void ScTable::EndListening( sc::EndListeningContext& rCxt, const ScAddress& 
rAddress, SvtListener& rListener )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-04-06 Thread Caolán McNamara (via logerrit)
 sc/qa/unit/data/slk/pass/ofz14093-1.slk |1 +
 sc/source/core/data/table2.cxx  |   10 ++
 2 files changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 6db38ca2cc9cafb353dd2ca2f4a617d5fa3eb51d
Author: Caolán McNamara 
AuthorDate: Sat Apr 6 14:03:11 2019 +0100
Commit: Caolán McNamara 
CommitDate: Sat Apr 6 16:44:07 2019 +0200

ofz#14093 bunch of new ofz detected crashes related to tdf#50916

since...

commit 7282014e362a1529a36c88eb308df8ed359c2cfa
Date:   Fri Feb 1 15:15:16 2019 +0100

tdf#50916 Makes numbers of columns dynamic.

Change-Id: I7588e34a9a52cde0d38dd9c1f15e6bbdb3601241
Reviewed-on: https://gerrit.libreoffice.org/70345
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/qa/unit/data/slk/pass/ofz14093-1.slk 
b/sc/qa/unit/data/slk/pass/ofz14093-1.slk
new file mode 100644
index ..7667ddb0a00a
--- /dev/null
+++ b/sc/qa/unit/data/slk/pass/ofz14093-1.slk
@@ -0,0 +1 @@
+C;X152;K" 
\ No newline at end of file
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index a74fc3a9a289..b049ff193b66 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1405,11 +1405,13 @@ bool ScTable::TestCopyScenarioTo( const ScTable* 
pDestTab ) const
 bool ScTable::SetString( SCCOL nCol, SCROW nRow, SCTAB nTabP, const OUString& 
rString,
  const ScSetStringParam * pParam )
 {
-if (ValidColRow(nCol,nRow))
-return aCol[nCol].SetString(
-nRow, nTabP, rString, pDocument->GetAddressConvention(), pParam );
-else
+if (!ValidColRow(nCol,nRow))
+{
 return false;
+}
+
+return CreateColumnIfNotExists(nCol).SetString(
+nRow, nTabP, rString, pDocument->GetAddressConvention(), pParam);
 }
 
 bool ScTable::SetEditText( SCCOL nCol, SCROW nRow, 
std::unique_ptr pEditText )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-04-01 Thread tundet (via logerrit)
 sc/qa/unit/data/xlsx/test_115192.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx |   14 ++
 sc/source/filter/xcl97/xcl97rec.cxx   |   10 --
 3 files changed, 18 insertions(+), 6 deletions(-)

New commits:
commit 186a9aae2d9612a9d6408e4871bc49963d4f9bb6
Author: tundet 
AuthorDate: Fri Mar 29 10:22:06 2019 +0100
Commit: László Németh 
CommitDate: Mon Apr 1 17:50:45 2019 +0200

tdf#115192 XLSX export: fix hyperlink inserted to shape

Hyperlink inserted to shape didn't work after export, because
the LO wrote TargetMode="External" code incorrectly in the xml.

test_115192.xlsx: Test file from Excel 2016.

Change-Id: I3a9d39c1aa5de5af6d1ca43d16c45a5401ec6f3d
Reviewed-on: https://gerrit.libreoffice.org/69915
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sc/qa/unit/data/xlsx/test_115192.xlsx 
b/sc/qa/unit/data/xlsx/test_115192.xlsx
new file mode 100755
index ..17bef2cb977e
Binary files /dev/null and b/sc/qa/unit/data/xlsx/test_115192.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index d9f5a93a8ca2..9ce85f021ccb 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -211,6 +211,7 @@ public:
 void testTdf121612();
 void testPivotCacheAfterExportXLSX();
 void testTdf114969XLSX();
+void testTdf115192XLSX();
 
 void testXltxExport();
 
@@ -329,6 +330,7 @@ public:
 CPPUNIT_TEST(testTdf121612);
 CPPUNIT_TEST(testPivotCacheAfterExportXLSX);
 CPPUNIT_TEST(testTdf114969XLSX);
+CPPUNIT_TEST(testTdf115192XLSX);
 
 CPPUNIT_TEST(testXltxExport);
 
@@ -4172,6 +4174,18 @@ void ScExportTest::testTdf114969XLSX()
 assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[2]", "location", 
"'1.1.1.1'!C2");
 }
 
+void ScExportTest::testTdf115192XLSX()
+{
+ScDocShellRef xDocSh = loadDoc("test_115192.", FORMAT_XLSX);
+CPPUNIT_ASSERT(xDocSh.is());
+
+xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, 
"xl/drawings/_rels/drawing1.xml.rels", FORMAT_XLSX);
+CPPUNIT_ASSERT(pDoc);
+assertXPath(pDoc, "/r:Relationships/r:Relationship[@Id='rId1']", 
"TargetMode", "External");
+assertXPathNoAttribute(pDoc, 
"/r:Relationships/r:Relationship[@Id='rId2']", "TargetMode");
+assertXPath(pDoc, "/r:Relationships/r:Relationship[@Id='rId3']", 
"TargetMode", "External");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx 
b/sc/source/filter/xcl97/xcl97rec.cxx
index 2d2fa5decf18..38fd9c27103e 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1096,7 +1096,7 @@ ScRefFlags parseAddress(const OUString& rString, 
ScAddress& rAddress, const ScDo
 return rAddress.Parse(rString, pDoc, 
formula::FormulaGrammar::CONV_XL_R1C1);
 }
 
-bool transformURL(const OUString& rOldURL, OUString& rNewURL, const 
ScDocument* pDoc)
+void transformURL(const OUString& rOldURL, OUString& rNewURL, const 
ScDocument* pDoc)
 {
 if (rOldURL.startsWith("#"))
 {
@@ -1112,7 +1112,7 @@ bool transformURL(const OUString& rOldURL, OUString& 
rNewURL, const ScDocument*
 {
 OUString aString = aRange.Format(nResult, pDoc, 
formula::FormulaGrammar::CONV_XL_OOX);
 rNewURL = "#" + aString;
-return true;
+return;
 }
 else
 {
@@ -1121,13 +1121,12 @@ bool transformURL(const OUString& rOldURL, OUString& 
rNewURL, const ScDocument*
 {
 OUString aString = aAddress.Format(nResult, pDoc, 
formula::FormulaGrammar::CONV_XL_OOX);
 rNewURL = "#" + aString;
-return true;
+return;
 }
 }
 }
 
 rNewURL = rOldURL;
-return false;
 }
 
 class ScURLTransformer : public oox::drawingml::URLTransformer
@@ -1147,8 +1146,7 @@ public:
 
 virtual bool isExternalURL(const OUString& rURL) const override
 {
-OUString aNewURL;
-return transformURL(rURL, aNewURL, );
+return !rURL.startsWith("#");
 }
 
 private:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-03-28 Thread Winfried Donkers (via logerrit)
 sc/qa/unit/data/functions/mathematical/fods/rounddown.fods |   19 ++
 sc/qa/unit/data/functions/mathematical/fods/roundup.fods   |   19 ++
 sc/source/core/inc/interpre.hxx|1 
 sc/source/core/tool/interpr2.cxx   |   37 ++---
 4 files changed, 66 insertions(+), 10 deletions(-)

New commits:
commit edcbe8c4e02a67c74ec6f85f28899431dbfa0765
Author: Winfried Donkers 
AuthorDate: Tue Mar 26 16:27:09 2019 +0100
Commit: Eike Rathke 
CommitDate: Thu Mar 28 23:18:37 2019 +0100

tdf#124286 fix annoying rounding error.

In case of ROUNDDOWN and ROUNDUP, it is possible that seemingly clear 
decimal
values are rounded unexpectedly (from the user's POV). This is caused by 
the i
decimal to binary to decimal conversions.
By rounding to 12 significanr digits before calling the round-down of -up
function, most of these unexpected roundings are eliminated.

Change-Id: Ia19181383b77e1ff40a067c4a1cea1ece0955871
Reviewed-on: https://gerrit.libreoffice.org/69762
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/mathematical/fods/rounddown.fods 
b/sc/qa/unit/data/functions/mathematical/fods/rounddown.fods
index 5726eea4c9d5..0389f6348ef1 100644
--- a/sc/qa/unit/data/functions/mathematical/fods/rounddown.fods
+++ b/sc/qa/unit/data/functions/mathematical/fods/rounddown.fods
@@ -2123,6 +2123,23 @@
  
 
 
+ 
+  0.940
+ 
+ 
+  0.94
+ 
+ 
+  TRUE
+ 
+ 
+  =ROUNDDOWN(31415.92654, 3)
+ 
+ 
+ 
+ 
+
+
  
  
  
@@ -2408,4 +2425,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/qa/unit/data/functions/mathematical/fods/roundup.fods 
b/sc/qa/unit/data/functions/mathematical/fods/roundup.fods
index d1a56f7491cf..3fa289d4a2fc 100644
--- a/sc/qa/unit/data/functions/mathematical/fods/roundup.fods
+++ b/sc/qa/unit/data/functions/mathematical/fods/roundup.fods
@@ -2075,6 +2075,23 @@
  
 
 
+ 
+  0.060
+ 
+ 
+  0.06
+ 
+ 
+  TRUE
+ 
+ 
+  =ROUNDUP(8.06-8,2)
+ 
+ 
+ 
+ 
+
+
  
  
  
@@ -2360,4 +2377,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 3fd3dcf7668c..398fe707f86f 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -776,6 +776,7 @@ private:
 void ScConvertOOo();
 void ScEuroConvert();
 void ScRoundSignificant();
+static void RoundSignificant( double fX, double fDigits, double  );
 
 // financial functions
 void ScNPV();
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index b47acaddaf72..b8e4baef418f 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -983,10 +983,25 @@ void ScInterpreter::RoundNumber( rtl_math_RoundingMode 
eMode )
 else
 {
 sal_Int16 nDec = GetInt16();
+double fX = GetDouble();
 if ( nGlobalError != FormulaError::NONE || nDec < -20 || nDec > 20 
)
 PushIllegalArgument();
 else
-fVal = ::rtl::math::round( GetDouble(), nDec, eMode );
+{
+if ( ( eMode == rtl_math_RoundingMode_Down ||
+   eMode == rtl_math_RoundingMode_Up ) &&
+ nDec < 12 && fmod( fX, 1.0 ) != 0.0 )
+{
+// tdf124286 : round to 12 significant digits before 
rounding
+// down or up to avoid unexpected rounding 
errors
+// caused by decimal -> binary -> decimal 
conversion
+double fRes;
+RoundSignificant( fX, 12, fRes );
+fVal = ::rtl::math::round( fRes, nDec, eMode );
+}
+else
+fVal = ::rtl::math::round( fX, nDec, eMode );
+}
 }
 PushDouble(fVal);
 }
@@ -1007,6 +1022,17 @@ void ScInterpreter::ScRoundUp()
 RoundNumber( rtl_math_RoundingMode_Up );
 }
 
+void ScInterpreter::RoundSignificant( double fX, double fDigits, double  )
+{
+bool bNegVal = ( fX < 0 );
+if ( bNegVal )
+fX *= -1.0;
+double fTemp = ::rtl::math::approxFloor( log10( fX ) ) + 1.0 - fDigits;
+fRes = ::rtl::math::round( pow(10.0, -fTemp ) * fX ) * pow( 10.0, fTemp );
+if ( bNegVal )
+fRes *= -1.0;
+}
+
 // tdf#106931
 void ScInterpreter::ScRoundSignificant()
 {
@@ -1024,13 +1050,8 @@ void ScInterpreter::ScRoundSignificant()
 PushDouble( 0.0 );
 else
 {
-bool bNegVal = ( fX < 0 );
-if ( bNegVal )
-fX *= -1.0;
-double fTemp = ::rtl::math::approxFloor( log10( fX ) ) + 1.0 - 
fDigits;
-double fRes = 

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

2019-03-25 Thread Andrea Gelmini (via logerrit)
 0 files changed

New commits:
commit d3d02f29ec6af6fb2f4f386490701b94787686b7
Author: Andrea Gelmini 
AuthorDate: Fri Mar 22 13:20:24 2019 +
Commit: Julien Nabet 
CommitDate: Mon Mar 25 08:59:44 2019 +0100

Removed executable permission on data files

Change-Id: Ic21b28fd094f706dd7b1de32907d75e28f27494a
Reviewed-on: https://gerrit.libreoffice.org/69558
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/sc/qa/unit/data/ods/sheet_name_with_dots.ods 
b/sc/qa/unit/data/ods/sheet_name_with_dots.ods
old mode 100755
new mode 100644
diff --git a/sc/source/filter/excel/xecontent.cxx 
b/sc/source/filter/excel/xecontent.cxx
old mode 100755
new mode 100644
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx 
b/svx/source/customshapes/EnhancedCustomShape2d.cxx
old mode 100755
new mode 100644
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-03-22 Thread Tünde Tóth (via logerrit)
 sc/qa/unit/data/ods/sheet_name_with_dots.ods |binary
 sc/qa/unit/subsequent_export-test.cxx|   13 +
 sc/source/filter/excel/xecontent.cxx |   13 -
 3 files changed, 21 insertions(+), 5 deletions(-)

New commits:
commit 37a3af2413f9407639157caef67d7d5168230e49
Author: Tünde Tóth 
AuthorDate: Thu Mar 14 14:44:31 2019 +0100
Commit: László Németh 
CommitDate: Fri Mar 22 12:56:25 2019 +0100

tdf#114969 XLSX export: fix 'sheet.name.with.dot'!A1-like links

When the sheet name/cell address separator was an exclamation mark,
bad conversion of the optional dot separator replaced the last dot
of the exported sheet name, resulting broken links:

'sheet.name.with!dot'!A1

Change-Id: I84fb6c8da345c144b04657ea350f1f96614071b7
Reviewed-on: https://gerrit.libreoffice.org/69272
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sc/qa/unit/data/ods/sheet_name_with_dots.ods 
b/sc/qa/unit/data/ods/sheet_name_with_dots.ods
new file mode 100755
index ..dc5b8193fe71
Binary files /dev/null and b/sc/qa/unit/data/ods/sheet_name_with_dots.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index ccd6b16ad4db..d9f5a93a8ca2 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -210,6 +210,7 @@ public:
 void testTdf118990();
 void testTdf121612();
 void testPivotCacheAfterExportXLSX();
+void testTdf114969XLSX();
 
 void testXltxExport();
 
@@ -327,6 +328,7 @@ public:
 CPPUNIT_TEST(testTdf118990);
 CPPUNIT_TEST(testTdf121612);
 CPPUNIT_TEST(testPivotCacheAfterExportXLSX);
+CPPUNIT_TEST(testTdf114969XLSX);
 
 CPPUNIT_TEST(testXltxExport);
 
@@ -4159,6 +4161,17 @@ void ScExportTest::testPivotCacheAfterExportXLSX()
 xDocSh->DoClose();
 }
 
+void ScExportTest::testTdf114969XLSX()
+{
+ScDocShellRef xDocSh = loadDoc("sheet_name_with_dots.", FORMAT_ODS);
+CPPUNIT_ASSERT(xDocSh.is());
+
+xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, 
"xl/worksheets/sheet1.xml", FORMAT_XLSX);
+CPPUNIT_ASSERT(pDoc);
+assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[1]", "location", 
"'1.1.1.1'!C1");
+assertXPath(pDoc, "/x:worksheet/x:hyperlinks/x:hyperlink[2]", "location", 
"'1.1.1.1'!C2");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xecontent.cxx 
b/sc/source/filter/excel/xecontent.cxx
old mode 100644
new mode 100755
index 84663591f51b..1bc2697aa518
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -416,11 +416,14 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& 
rRoot, const SvxURLField& rU
 {
 OUString aTextMark( rUrl.copy( 1 ) );
 
-sal_Int32 nSepPos = aTextMark.lastIndexOf( '.' );
-if(nSepPos != -1)
-aTextMark = aTextMark.replaceAt( nSepPos, 1, "!" );
-else
-nSepPos = aTextMark.lastIndexOf( '!' );
+sal_Int32 nSepPos = aTextMark.lastIndexOf( '!' );
+sal_Int32 nPointPos = aTextMark.lastIndexOf( '.' );
+// last dot is the separator, if there is no ! after it
+if(nSepPos < nPointPos)
+{
+   nSepPos = nPointPos;
+   aTextMark = aTextMark.replaceAt( nSepPos, 1, "!" );
+}
 
 if(nSepPos != -1)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-03-08 Thread Libreoffice Gerrit user
 sc/qa/unit/data/ods/pivot-table-str-and-err-in-data.ods |binary
 sc/qa/unit/pivottable_filters_test.cxx  |   29 
 sc/source/filter/excel/xepivotxml.cxx   |7 ++-
 3 files changed, 34 insertions(+), 2 deletions(-)

New commits:
commit 44a524379548c916d304a71980f6911231768018
Author: Mike Kaganski 
AuthorDate: Fri Mar 8 14:01:03 2019 +0300
Commit: Mike Kaganski 
CommitDate: Fri Mar 8 14:21:28 2019 +0100

tdf#123939: string and error are same type for pivot cache in XLSX

Change-Id: Id39d322661f7537e8999acafee655c0cc16a78c1
Reviewed-on: https://gerrit.libreoffice.org/68911
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/qa/unit/data/ods/pivot-table-str-and-err-in-data.ods 
b/sc/qa/unit/data/ods/pivot-table-str-and-err-in-data.ods
new file mode 100644
index ..9c58dc8958ae
Binary files /dev/null and 
b/sc/qa/unit/data/ods/pivot-table-str-and-err-in-data.ods differ
diff --git a/sc/qa/unit/pivottable_filters_test.cxx 
b/sc/qa/unit/pivottable_filters_test.cxx
index 5e737486d5b3..014c1fdab035 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -82,6 +82,7 @@ public:
 void testPivotTableTabularModeXLSX();
 void testTdf112106();
 void testTdf123923();
+void testTdf123939();
 
 CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest);
 
@@ -121,6 +122,7 @@ public:
 CPPUNIT_TEST(testPivotTableTabularModeXLSX);
 CPPUNIT_TEST(testTdf112106);
 CPPUNIT_TEST(testTdf123923);
+CPPUNIT_TEST(testTdf123939);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2345,6 +2347,33 @@ void ScPivotTableFiltersTest::testTdf123923()
 "v", "#REF!");
 }
 
+void ScPivotTableFiltersTest::testTdf123939()
+{
+// tdf#123939: Excel warns on containsMixedTypes="1" if sharedItems has 
only strings and errors
+
+ScDocShellRef xShell = loadDoc("pivot-table-str-and-err-in-data.", 
FORMAT_ODS);
+CPPUNIT_ASSERT(xShell.is());
+
+std::shared_ptr pXPathFile
+= ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+xmlDocPtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory,
+
"xl/pivotCache/pivotCacheDefinition1.xml");
+CPPUNIT_ASSERT(pTable);
+
+assertXPathNoAttribute(pTable,
+   
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems",
+   "containsMixedTypes");
+
+// But we must emit containsMixedTypes="1" for a mix of errors and 
non-string types!
+
+pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory,
+  
"xl/pivotCache/pivotCacheDefinition2.xml");
+CPPUNIT_ASSERT(pTable);
+
+assertXPath(pTable, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems",
+"containsMixedTypes", "1");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xepivotxml.cxx 
b/sc/source/filter/excel/xepivotxml.cxx
index b7fbd6bc1556..eed70122dfd8 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -261,6 +261,9 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( 
XclExpXmlStream& rStrm, const Entr
 for (const auto& rFieldItem : rFieldItems)
 {
 ScDPItemData::Type eType = rFieldItem.GetType();
+// tdf#123939 : error and string are same for cache; if both are 
present, keep only one
+if (eType == ScDPItemData::Error)
+eType = ScDPItemData::String;
 aDPTypes.insert(eType);
 if (eType == ScDPItemData::Value)
 {
@@ -286,8 +289,8 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( 
XclExpXmlStream& rStrm, const Entr
 std::set aDPTypesWithoutBlank = aDPTypes;
 aDPTypesWithoutBlank.erase(ScDPItemData::Empty);
 
-bool isContainsString = 
aDPTypesWithoutBlank.find(ScDPItemData::String) != aDPTypesWithoutBlank.end() ||
-aDPTypesWithoutBlank.find(ScDPItemData::Error) 
!= aDPTypesWithoutBlank.end();
+const bool isContainsString
+= aDPTypesWithoutBlank.find(ScDPItemData::String) != 
aDPTypesWithoutBlank.end();
 bool isContainsBlank = aDPTypes.find(ScDPItemData::Empty) != 
aDPTypeEnd;
 bool isContainsNumber = !isContainsDate && 
aDPTypesWithoutBlank.find(ScDPItemData::Value) != aDPTypesWithoutBlank.end();
 bool isContainsNonDate = !(isContainsDate && 
aDPTypesWithoutBlank.size() <= 1);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-03-08 Thread Libreoffice Gerrit user
 sc/qa/unit/data/ods/pivot-table-err-in-cache.ods |binary
 sc/qa/unit/pivottable_filters_test.cxx   |   19 +++
 sc/source/core/tool/interpr1.cxx |1 +
 3 files changed, 20 insertions(+)

New commits:
commit 1f970c20a25deed282dbaf08a4be5af25e4951db
Author: Mike Kaganski 
AuthorDate: Thu Mar 7 16:38:20 2019 +0300
Commit: Mike Kaganski 
CommitDate: Fri Mar 8 14:21:05 2019 +0100

tdf#123923: make COUNTIF propagate errors in its first parameter

In a specific case, Err:504 was emitted by COUNTIF when its 1st
parameter was #REF!. This value was written into pivot cache definition
when exporting to XLSX. Clearly Excel only expected propagated #REF!
there, emitted error to user, and dropped the pivot table.

This problem made XLSX pivot table cache generated by Calc unusable
by Excel, despite ECMA-376 Part 1, 18.10.1.27 tells that the error
value is application-dependent.

The change makes COUNTIF to propagate errors received in its 1st
parameter, instead of owerwriting them with own Err:504. This will
likely need to be extended to other functions, if similar problems
would arise.

Change-Id: I459fa163a0e3e5f2c658631d66e096f4d46b1ace
Reviewed-on: https://gerrit.libreoffice.org/68868
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/qa/unit/data/ods/pivot-table-err-in-cache.ods 
b/sc/qa/unit/data/ods/pivot-table-err-in-cache.ods
new file mode 100644
index ..b566a61f8898
Binary files /dev/null and b/sc/qa/unit/data/ods/pivot-table-err-in-cache.ods 
differ
diff --git a/sc/qa/unit/pivottable_filters_test.cxx 
b/sc/qa/unit/pivottable_filters_test.cxx
index 7697fdb20b48..5e737486d5b3 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -81,6 +81,7 @@ public:
 void testPivotTableDuplicatedMemberFilterXLSX();
 void testPivotTableTabularModeXLSX();
 void testTdf112106();
+void testTdf123923();
 
 CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest);
 
@@ -119,6 +120,7 @@ public:
 CPPUNIT_TEST(testPivotTableDuplicatedMemberFilterXLSX);
 CPPUNIT_TEST(testPivotTableTabularModeXLSX);
 CPPUNIT_TEST(testTdf112106);
+CPPUNIT_TEST(testTdf123923);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2326,6 +2328,23 @@ void ScPivotTableFiltersTest::testTdf112106()
 xDocSh->DoClose();
 }
 
+void ScPivotTableFiltersTest::testTdf123923()
+{
+// tdf#123923: Excel fails when it finds "Err:504" instead of "#REF!" in 
pivot table cache
+
+ScDocShellRef xShell = loadDoc("pivot-table-err-in-cache.", FORMAT_ODS);
+CPPUNIT_ASSERT(xShell.is());
+
+std::shared_ptr pXPathFile
+= ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+xmlDocPtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory,
+
"xl/pivotCache/pivotCacheDefinition1.xml");
+CPPUNIT_ASSERT(pTable);
+
+assertXPath(pTable, 
"/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems/x:e",
+"v", "#REF!");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index bc57c63388ae..75fd8f82b874 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5738,6 +5738,7 @@ void ScInterpreter::ScCountIf()
 }
 break;
 default:
+PopError(); // Propagate it further
 PushIllegalParameter();
 return ;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-02-15 Thread Libreoffice Gerrit user
 sc/qa/extras/anchor.cxx  |   62 +++
 sc/source/core/data/drwlayer.cxx |   15 ++---
 2 files changed, 73 insertions(+), 4 deletions(-)

New commits:
commit e756b6f310f309ac29bb2bce92309bb74edd788d
Author: Samuel Mehrbrodt 
AuthorDate: Thu Feb 14 10:34:35 2019 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Fri Feb 15 08:00:13 2019 +0100

tdf#122982 Remove image from cell when cutting the cell

Change-Id: Idd73dcc88a8cd76eb4011bb26efdd5c712d16e5e
Reviewed-on: https://gerrit.libreoffice.org/67844
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sc/qa/extras/anchor.cxx b/sc/qa/extras/anchor.cxx
index 35cd9a567d35..92e09a0c2f25 100644
--- a/sc/qa/extras/anchor.cxx
+++ b/sc/qa/extras/anchor.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -41,12 +42,14 @@ public:
 void testTdf76183();
 void testODFAnchorTypes();
 void testCopyColumnWithImages();
+void testCutWithImages();
 
 CPPUNIT_TEST_SUITE(ScAnchorTest);
 CPPUNIT_TEST(testUndoAnchor);
 CPPUNIT_TEST(testTdf76183);
 CPPUNIT_TEST(testODFAnchorTypes);
 CPPUNIT_TEST(testCopyColumnWithImages);
+CPPUNIT_TEST(testCutWithImages);
 CPPUNIT_TEST_SUITE_END();
 private:
 
@@ -308,6 +311,65 @@ void ScAnchorTest::testCopyColumnWithImages()
 pDocSh->DoClose();
 }
 
+void ScAnchorTest::testCutWithImages()
+{
+OUString aFileURL;
+createFileURL("3AnchorTypes.ods", aFileURL);
+// open the document with graphic included
+uno::Reference xComponent = 
loadFromDesktop(aFileURL);
+CPPUNIT_ASSERT(xComponent.is());
+
+// Get the document model
+SfxObjectShell* pFoundShell = 
SfxObjectShell::GetShellFromComponent(xComponent);
+CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
+
+ScDocShell* pDocSh = dynamic_cast(pFoundShell);
+CPPUNIT_ASSERT(pDocSh);
+
+ScDocument* pDoc = &(pDocSh->GetDocument());
+ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+CPPUNIT_ASSERT(pDrawLayer);
+
+// Get the document controller
+ScTabViewShell* pViewShell = pDocSh->GetBestViewShell(false);
+CPPUNIT_ASSERT(pViewShell != nullptr);
+
+// Cut whole column
+{
+// Cut source range
+ScRange aSrcRange;
+aSrcRange.Parse("A1:A11", pDoc, pDoc->GetAddressConvention());
+pViewShell->GetViewData().GetMarkData().SetMarkArea(aSrcRange);
+pViewShell->GetViewData().GetView()->CutToClip();
+
+std::map> aRowObjects
+= pDrawLayer->GetObjectsAnchoredToRange(0, 0, 0, 11);
+
+// Images should have been removed from the cells
+CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no image anchored to 
A3", 0,
+ static_cast(aRowObjects[2].size()));
+CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no image anchored to 
A11", 0,
+ static_cast(aRowObjects[10].size()));
+}
+
+// Cut individual cells
+{
+// Cut source cells
+ScRange aSrcRange;
+aSrcRange.Parse("A3:B3", pDoc, pDoc->GetAddressConvention());
+pViewShell->GetViewData().GetMarkData().SetMarkArea(aSrcRange);
+pViewShell->GetViewData().GetView()->CutToClip();
+
+// Image should have been removed from the cell
+std::map> aRowObjects
+= pDrawLayer->GetObjectsAnchoredToRange(0, 0, 2, 2);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no image anchored to 
A3", 0,
+ static_cast(aRowObjects[2].size()));
+}
+
+pDocSh->DoClose();
+}
+
 void ScAnchorTest::tearDown()
 {
 if (mxComponent.is())
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index fa7a784fbb4a..259e76fe08fa 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1446,11 +1446,18 @@ void ScDrawLayer::DeleteObjectsInSelection( const 
ScMarkData& rMark )
 if (!IsNoteCaption( pObject ))
 {
 tools::Rectangle aObjRect = 
pObject->GetCurrentBoundRect();
-if ( aMarkBound.IsInside( aObjRect ) )
+ScRange aRange = pDoc->GetRange(nTab, aObjRect);
+bool bObjectInMarkArea
+= aMarkBound.IsInside(aObjRect) && 
rMark.IsAllMarked(aRange);
+const ScDrawObjData* pObjData = 
ScDrawLayer::GetObjData(pObject);
+ScAnchorType aAnchorType = 
ScDrawLayer::GetAnchorType(*pObject);
+bool bObjectAnchoredToMarkedCell
+= ((aAnchorType == SCA_CELL || aAnchorType == 
SCA_CELL_RESIZE)
+   && rMark.IsCellMarked(pObjData->maStart.Col(),
+ pObjData->maStart.Row()));
+if (bObjectInMarkArea || 

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

2019-02-12 Thread Libreoffice Gerrit user
 sc/qa/unit/data/ods/tdf121040.ods  |binary
 sc/qa/unit/subsequent_filters-test.cxx |   18 ++
 sc/source/core/data/column2.cxx|   16 +---
 sc/source/ui/view/output2.cxx  |6 --
 4 files changed, 35 insertions(+), 5 deletions(-)

New commits:
commit 20f6e0babf3cb0dd66a2dfcfa7a15cb2d9f2592b
Author: Serge Krot 
AuthorDate: Wed Feb 6 20:02:02 2019 +0100
Commit: Thorsten Behrens 
CommitDate: Tue Feb 12 11:29:56 2019 +0100

tdf#121040 sc: cell with ### has too big height

Make the same behavior as inside MSO - numbers with any
different number format should not be broken on two or more lines
regardless "wrap text automatically" option.

Change-Id: I135ecef1ad01171dd22828100309311bd8eea6ce
Reviewed-on: https://gerrit.libreoffice.org/67470
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/sc/qa/unit/data/ods/tdf121040.ods 
b/sc/qa/unit/data/ods/tdf121040.ods
new file mode 100644
index ..ef25565a7ea8
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf121040.ods differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index 2a49c9265de1..7e7df9c35c4b 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -189,6 +189,7 @@ public:
 void testMiscRowHeights();
 void testOptimalHeightReset();
 void testCustomNumFormatHybridCellODS();
+void testTdf121040();
 
 void testPrintRangeODS();
 void testOutlineODS();
@@ -328,6 +329,7 @@ public:
 CPPUNIT_TEST(testMiscRowHeights);
 CPPUNIT_TEST(testOptimalHeightReset);
 CPPUNIT_TEST(testCustomNumFormatHybridCellODS);
+CPPUNIT_TEST(testTdf121040);
 CPPUNIT_TEST(testPrintRangeODS);
 CPPUNIT_TEST(testOutlineODS);
 CPPUNIT_TEST(testColumnStyleXLSX);
@@ -2837,6 +2839,22 @@ void ScFiltersTest::testCustomNumFormatHybridCellODS()
 xDocSh->DoClose();
 }
 
+void ScFiltersTest::testTdf121040()
+{
+ScDocShellRef xDocSh = loadDoc("tdf121040.", FORMAT_ODS);
+CPPUNIT_ASSERT_MESSAGE("Failed to load tdf121040.ods", xDocSh.is());
+
+const SCTAB nTab = 0;
+ScDocument& rDoc = xDocSh->GetDocument();
+
+// The first 9 rows should have the same height
+const sal_uInt16 nHeight = rDoc.GetRowHeight(0, nTab, false);
+for (SCTAB nRow=1; nRow<9; nRow++)
+{
+CPPUNIT_ASSERT_EQUAL(nHeight, rDoc.GetRowHeight(nRow, nTab, false));
+}
+}
+
 void ScFiltersTest::testPrintRangeODS()
 {
 ScDocShellRef xDocSh = loadDoc("print-range.", FORMAT_ODS);
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 09950a7825d7..b937bfaa1ded 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -150,8 +150,18 @@ long ScColumn::GetNeededSize(
 
 SvNumberFormatter* pFormatter = pDocument->GetFormatTable();
 sal_uInt32 nFormat = pPattern->GetNumberFormat( pFormatter, pCondSet );
-// #i111387# disable automatic line breaks only for "General" number format
-if (bBreak && ( nFormat % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 )
+
+// get "cell is value" flag
+// Must be synchronized with ScOutputData::LayoutStrings()
+bool bCellIsValue = (aCell.meType == CELLTYPE_VALUE);
+if (aCell.meType == CELLTYPE_FORMULA)
+{
+ScFormulaCell* pFCell = aCell.mpFormula;
+bCellIsValue = pFCell->IsRunning() || pFCell->IsValue();
+}
+
+// #i111387#, tdf#121040: disable automatic line breaks for all number 
formats
+if (bBreak && bCellIsValue && (pFormatter->GetType(nFormat) == 
SvNumFormatType::NUMBER))
 {
 // If a formula cell needs to be interpreted during aCell.hasNumeric()
 // to determine the type, the pattern may get invalidated because the
@@ -173,7 +183,7 @@ long ScColumn::GetNeededSize(
 else
 {
 nFormat = pPattern->GetNumberFormat( pFormatter, pCondSet );
-if ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
+if (pFormatter->GetType(nFormat) == SvNumFormatType::NUMBER)
 bBreak = false;
 }
 }
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 93febfee2a3f..ef857609adb6 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1717,8 +1717,10 @@ tools::Rectangle ScOutputData::LayoutStrings(bool 
bPixelToLogic, bool bPaint, co
 *pPattern, pCondSet, mpDoc, nTab, 
bNumberFormatIsText );
 
 bool bBreak = ( aVars.GetLineBreak() || aVars.GetHorJust() 
== SvxCellHorJustify::Block );
-// #i111387# #o11817313# disable automatic line breaks 
only for "General" number format
-if (bBreak && bCellIsValue && 
(aVars.GetResultValueFormat() % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
+// #i111387# #o11817313# tdf#121040 disable automatic line 
breaks for all 

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

2019-01-30 Thread Libreoffice Gerrit user
 sc/qa/uitest/autofilter/data/tdf122260.ods |binary
 sc/qa/uitest/autofilter/tdf117276.py   |2 
 sc/qa/uitest/autofilter/tdf122260.py   |  102 +
 sc/source/ui/view/gridwin.cxx  |1 
 4 files changed, 104 insertions(+), 1 deletion(-)

New commits:
commit fb3c3216ba1a6fc978176eebcef0cab4599a39e7
Author: Serge Krot 
AuthorDate: Mon Jan 28 11:02:37 2019 +0100
Commit: Thorsten Behrens 
CommitDate: Wed Jan 30 20:26:02 2019 +0100

tdf#122260 sc: Autofilters not properly cleared

Change-Id: I301b9ae8640e93b1ecf9e6818c9792ce45993cba
Reviewed-on: https://gerrit.libreoffice.org/67001
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/sc/qa/uitest/autofilter/data/tdf122260.ods 
b/sc/qa/uitest/autofilter/data/tdf122260.ods
new file mode 100644
index ..00c86d00a398
Binary files /dev/null and b/sc/qa/uitest/autofilter/data/tdf122260.ods differ
diff --git a/sc/qa/uitest/autofilter/tdf117276.py 
b/sc/qa/uitest/autofilter/tdf117276.py
index c5129e145b9b..acd7d11899b5 100644
--- a/sc/qa/uitest/autofilter/tdf117276.py
+++ b/sc/qa/uitest/autofilter/tdf117276.py
@@ -101,7 +101,7 @@ class tdf117276(UITestCase):
 xCheckListMenu = xFloatWindow.getChild("check_list_menu")
 xTreeList = xCheckListMenu.getChild("check_list_box")
 
-x8000Entry = xTreeList.getChild("0")
+x8000Entry = xTreeList.getChild("1") # check "8000"
 x8000Entry.executeAction("CLICK", tuple())
 
 xOkBtn = xFloatWindow.getChild("ok")
diff --git a/sc/qa/uitest/autofilter/tdf122260.py 
b/sc/qa/uitest/autofilter/tdf122260.py
new file mode 100644
index ..7d9df8564ab7
--- /dev/null
+++ b/sc/qa/uitest/autofilter/tdf122260.py
@@ -0,0 +1,102 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.calc.document import get_sheet_from_doc
+from libreoffice.calc.conditional_format import 
get_conditional_format_from_sheet
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import get_row
+
+
+from uitest.path import get_srcdir_url
+def get_url_for_data_file(file_name):
+return get_srcdir_url() + "/sc/qa/uitest/autofilter/data/" + file_name
+
+def is_row_hidden(doc, index):
+row = get_row(doc, index)
+val = row.getPropertyValue("IsVisible")
+return not val
+
+#Bug 122260 - EDITING Autofilters not properly cleared
+class tdf122260(UITestCase):
+def check_value_in_AutoFilter(self, gridwin, columnIndex, valueIndex):
+# open filter pop-up window
+self.assertIsNotNone(gridwin)
+gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", 
"COL": columnIndex, "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+self.assertIsNotNone(xFloatWindow)
+
+# get check list
+xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+self.assertIsNotNone(xCheckListMenu)
+
+xTreeList = xCheckListMenu.getChild("check_list_box")
+self.assertIsNotNone(xTreeList)
+
+# on/off required checkbox
+xEntry = xTreeList.getChild(valueIndex)
+self.assertIsNotNone(xEntry)
+xEntry.executeAction("CLICK", tuple())
+
+# close pop-up window
+xOkBtn = xFloatWindow.getChild("ok")
+self.assertIsNotNone(xOkBtn)
+xOkBtn.executeAction("CLICK", tuple())
+
+def get_values_count_in_AutoFilter(self, gridwin, columnIndex):
+# open filter pop-up window
+self.assertIsNotNone(gridwin)
+gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", 
"COL": columnIndex, "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+self.assertIsNotNone(xFloatWindow)
+
+# get check list
+xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+self.assertIsNotNone(xCheckListMenu)
+
+xTreeList = xCheckListMenu.getChild("check_list_box")
+self.assertIsNotNone(xTreeList)
+
+valuesCount = len(xTreeList.getChildren())
+
+# close pop-up window
+xOkBtn = xFloatWindow.getChild("ok")
+self.assertIsNotNone(xOkBtn)
+xOkBtn.executeAction("CLICK", tuple())
+
+return valuesCount
+
+def test_tdf122260_autofilter(self):
+calc_doc = 
self.ui_test.load_file(get_url_for_data_file("tdf122260.ods"))
+xCalcDoc = self.xUITest.getTopFocusWindow()
+gridwin = xCalcDoc.getChild("grid_window")
+

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

2019-01-10 Thread Libreoffice Gerrit user
 sc/qa/unit/data/functions/date_time/fods/second.fods |   91 +--
 sc/source/core/tool/interpr2.cxx |5 -
 2 files changed, 88 insertions(+), 8 deletions(-)

New commits:
commit 1692034d53ce28b2c5d1c63ab429232a92b2f861
Author: Winfried Donkers 
AuthorDate: Sun Dec 23 14:57:01 2018 +0100
Commit: Eike Rathke 
CommitDate: Thu Jan 10 14:03:14 2019 +0100

tdf#121978 use round again for Calc function SECOND.

Round was inadvertedly replaced by floor in commit 
273b3e10eab70ebc084cb62568bd699fddfb376e.

Change-Id: Ie0824e228c62509952a11b866638482a409c851d
Reviewed-on: https://gerrit.libreoffice.org/65579
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/date_time/fods/second.fods 
b/sc/qa/unit/data/functions/date_time/fods/second.fods
index 8db288ae3ae9..fbeda46f4841 100644
--- a/sc/qa/unit/data/functions/date_time/fods/second.fods
+++ b/sc/qa/unit/data/functions/date_time/fods/second.fods
@@ -342,6 +342,13 @@
   

   
+  
+   
+   :
+   
+   :
+   
+  
   

   
@@ -527,6 +534,7 @@
   
   
   
+  

   
   
@@ -826,11 +834,11 @@
  
 
 
- 
-  12
+ 
+  13
  
- 
-  12
+ 
+  13
  
  
   TRUE
@@ -839,11 +847,80 @@
   =SECOND(J9)
  
  
-  tdf11880
+  tdf118800
+ 
+ 
+ 
+  10:11:12.6000
+ 
+ 
+
+
+ 
+  9
+ 
+ 
+  9
+ 
+ 
+  TRUE
+ 
+ 
+  =SECOND(J10)
+ 
+ 
+  tdf121978
+ 
+ 
+ 
+  2018-10-22 11:34:53.
+ 
+ 
+  2018-10-22 11:31:44.
+ 
+ 
+
+
+ 
+  9
+ 
+ 
+  9
+ 
+ 
+  TRUE
+ 
+ 
+  =SECOND(J11)
+ 
+ 
+  tdf121978
+ 
+ 
+ 
+  00:00:08.9990
+ 
+ 
+
+
+ 
+  8
+ 
+ 
+  8
+ 
+ 
+  TRUE
+ 
+ 
+  =SECOND(J12)
+ 
+ 
+  tdf121978
  
  
- 
-  10:11:12.60
+ 
+  00:00:08.2500
  
  
 
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index aeba2c660b5d..eeaae0d236a3 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -156,7 +156,10 @@ void ScInterpreter::ScGetSec()
 sal_uInt16 nHour, nMinute, nSecond;
 double fFractionOfSecond;
 tools::Time::GetClock( GetDouble(), nHour, nMinute, nSecond, 
fFractionOfSecond, 0);
-PushDouble( nSecond);
+if ( fFractionOfSecond >= 0.5 )
+nSecond = ( nSecond + 1 ) % 60;
+PushDouble( nSecond );
+
 }
 
 void ScInterpreter::ScGetHour()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-11-30 Thread Libreoffice Gerrit user
 sc/qa/unit/data/functions/statistical/fods/large.fods |   16 ++-
 sc/qa/unit/data/functions/statistical/fods/small.fods |   17 ++-
 sc/source/core/inc/interpre.hxx   |5 
 sc/source/core/tool/interpr3.cxx  |   93 +-
 sc/source/core/tool/interpr5.cxx  |   33 --
 5 files changed, 141 insertions(+), 23 deletions(-)

New commits:
commit e4c2d0bb57ab8ea8f5c400d103d01376b8140f22
Author: Takeshi Abe 
AuthorDate: Tue Nov 27 11:28:18 2018 +0900
Commit: Eike Rathke 
CommitDate: Fri Nov 30 22:14:17 2018 +0100

i#32345 Support a matrix of rank argument for LARGE()/SMALL()

This is a followup of e22ab5e6f6b0ea49231ca454a567133996306116.

Change-Id: I7052e113173204f7cfcd40622f52c5d4e14b3aa9
Reviewed-on: https://gerrit.libreoffice.org/64139
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/statistical/fods/large.fods 
b/sc/qa/unit/data/functions/statistical/fods/large.fods
index 6e701e71671f..d72e3bde9a20 100644
--- a/sc/qa/unit/data/functions/statistical/fods/large.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/large.fods
@@ -4794,10 +4794,18 @@
  
 
 
- 
- 
- 
- 
+ 
+  -2
+ 
+ 
+  -2
+ 
+ 
+  TRUE
+ 
+ 
+  =MDETERM(LARGE(I30:I39,{1,2;3,4}))
+ 
  
  
   2
diff --git a/sc/qa/unit/data/functions/statistical/fods/small.fods 
b/sc/qa/unit/data/functions/statistical/fods/small.fods
index 94a6ae6344ef..549be5c7e187 100644
--- a/sc/qa/unit/data/functions/statistical/fods/small.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/small.fods
@@ -4186,10 +4186,19 @@
  
  
 
-
- 
- 
- 
+
+ 
+  -13
+ 
+ 
+  -13
+ 
+ 
+  TRUE
+ 
+ 
+  =MDETERM(SMALL(F1:F11,{1,2;3,4}))
+ 
  
  
   90012
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 7608098d53bb..b6c68dcdb264 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -175,6 +175,8 @@ public:
 
 ScMatrixRef GetNewMat(SCSIZE nC, SCSIZE nR, bool bEmpty = false);
 
+ScMatrixRef GetNewMat(SCSIZE nC, SCSIZE nR, const std::vector& 
rValues);
+
 enum VolatileType {
 VOLATILE,
 VOLATILE_MACRO,
@@ -225,6 +227,8 @@ private:
 
 VolatileType meVolatileType;
 
+void MakeMatNew(ScMatrixRef& rMat, SCSIZE nC, SCSIZE nR);
+
 /// Merge global and document specific settings.
 void MergeCalcConfig();
 
@@ -934,6 +938,7 @@ private:
 void ScMedian();
 double GetMedian( ::std::vector & rArray );
 double GetPercentileExclusive( ::std::vector & rArray, double 
fPercentile );
+std::vector GetTopNumberArray( SCSIZE& rCol, SCSIZE& rRow );
 void GetNumberSequenceArray( sal_uInt8 nParamCount, ::std::vector& 
rArray, bool bConvertTextInArray );
 void GetSortArray( sal_uInt8 nParamCount, ::std::vector& 
rSortArray, ::std::vector* pIndexOrder, bool bConvertTextInArray, bool 
bAllowEmptyArray );
 static void QuickSort(::std::vector& rSortArray, 
::std::vector* pIndexOrder);
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index ac980b7257da..f91d0037ddb5 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -3639,14 +3639,15 @@ void ScInterpreter::CalculateSmallLarge(bool bSmall)
 if ( !MustHaveParamCount( GetByte(), 2 )  )
 return;
 
-std::vector aArray;
-GetNumberSequenceArray(1, aArray, false);
+SCSIZE nCol = 0, nRow = 0;
+auto aArray = GetTopNumberArray(nCol, nRow);
 auto aArraySize = aArray.size();
 if (aArraySize == 0 || nGlobalError != FormulaError::NONE)
 {
 PushNoValue();
 return;
 }
+assert(aArraySize == nCol * nRow);
 for (double fArg : aArray)
 {
 double f = ::rtl::math::approxFloor(fArg);
@@ -3701,8 +3702,7 @@ void ScInterpreter::CalculateSmallLarge(bool bSmall)
 aArray.clear();
 for (SCSIZE n : aRankArray)
 aArray.push_back(aSortArray[bSmall ? n-1 : nSize-n]);
-ScMatrixRef pResult = GetNewMat(1, aArraySize, true);
-pResult->PutDoubleVector(aArray, 0, 0);
+ScMatrixRef pResult = GetNewMat(nCol, nRow, aArray);
 PushMatrix(pResult);
 }
 }
@@ -3841,6 +3841,91 @@ void ScInterpreter::ScTrimMean()
 }
 }
 
+std::vector ScInterpreter::GetTopNumberArray( SCSIZE& rCol, SCSIZE& 
rRow )
+{
+std::vector aArray;
+switch (GetStackType())
+{
+case svDouble:
+aArray.push_back(PopDouble());
+rCol = rRow = 1;
+break;
+case svSingleRef:
+{
+ScAddress aAdr;
+PopSingleRef(aAdr);
+ScRefCellValue aCell(*pDok, aAdr);
+if (aCell.hasNumeric())
+{
+aArray.push_back(GetCellValue(aAdr, aCell));
+  

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

2018-11-29 Thread Libreoffice Gerrit user
 sc/qa/unit/data/functions/mathematical/fods/sum.fods| 1087 
 sc/qa/unit/data/functions/statistical/fods/average.fods | 1994 ++--
 sc/source/core/opencl/formulagroupcl.cxx|   22 
 sc/source/core/opencl/op_logical.hxx|3 
 sc/source/core/opencl/op_math.hxx   |1 
 sc/source/core/opencl/op_spreadsheet.hxx|1 
 sc/source/core/opencl/op_statistical.hxx|9 
 sc/source/core/opencl/opbase.hxx|2 
 8 files changed, 1419 insertions(+), 1700 deletions(-)

New commits:
commit b5cd5296ff9601ed0a38909971e0886492d5d7c2
Author: Luboš Luňák 
AuthorDate: Thu Nov 29 12:07:37 2018 +0100
Commit: Michael Meeks 
CommitDate: Thu Nov 29 13:05:41 2018 +0100

make OpenCL bail out if it can't handle multi-column refs

The opencl code splits SvDoubleRef into subarguments by each column,
but many functions simply treat each subargument as one argument
for the function, thus possibly getting things wrong (e.g. SUMPRODUCT
would make a product of each column and sum those, rather than making
a product of the whole SvDoubleRef).
So bail out if multi-column SvDoubleRef is encountered, unless
the function is known to handle this case properly (either it takes
extra care, such as VLOOKUP, or it doesn't matter, such as SUM, AND, MAX).

Change-Id: Ied89a2fc252fb35fe49796140489ff4588038e25
Reviewed-on: https://gerrit.libreoffice.org/64238
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/sc/qa/unit/data/functions/mathematical/fods/sum.fods 
b/sc/qa/unit/data/functions/mathematical/fods/sum.fods
index 9b8660f1be28..1aec65bdebef 100644
--- a/sc/qa/unit/data/functions/mathematical/fods/sum.fods
+++ b/sc/qa/unit/data/functions/mathematical/fods/sum.fods
@@ -1,12 +1,12 @@
 
 
 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
+ 
2016-06-25T07:16:38.437590147P0D1LibreOfficeDev/6.2.0.0.alpha1$Linux_X86_64
 
LibreOffice_project/400aebc2a7f18703904577749faea02130b05f90
  
   
0
0
-   26393
+   28650
4515

 
@@ -31,8 +31,8 @@
false
   
   
-   3
-   8
+   0
+   9
0
0
0
@@ -50,7 +50,7 @@
   
  
  Sheet2
- 1241
+ 1738
  0
  100
  60
@@ -58,7 +58,7 @@
  true
  true
  true
- 12632256
+ 12632256
  true
  true
  true
@@ -76,25 +76,28 @@

   
   
-   7
-   false
-   false
-   true
-   true
-   false
-   false
+   true
false
1270
-   1270
+   7
+   false
+   1
true
-   true
-   true
-   true
true
-   false
-   12632256
-   false
-   Lexmark-E352dn
+   false
+   1
+   true
+   true
+   true
+   12632256
+   true
+   true
+   false
+   true
+   true
+   1270
+   3
+   true

 
  en
@@ -104,16 +107,19 @@
  
 

-   true
-   true
-   3
-   1
-   true
-   1
-   true
-   

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

2018-11-28 Thread Libreoffice Gerrit user
 sc/qa/unit/data/ods/tdf121612.ods |binary
 sc/qa/unit/subsequent_export-test.cxx |   20 
 sc/source/filter/excel/xepivotxml.cxx |   11 +--
 3 files changed, 29 insertions(+), 2 deletions(-)

New commits:
commit 6481bda69ade61cb5420156272fcf17edd43d620
Author: Vasily Melenchuk 
AuthorDate: Thu Nov 22 11:30:29 2018 +0300
Commit: Thorsten Behrens 
CommitDate: Thu Nov 29 00:57:59 2018 +0100

tdf#121612: update pivot caches during saving to XLSX

Cache was empty so pivot table was not exported completely
and pivot table filter were missing.

Change-Id: Ib0b9e98a5588159c5c7de1e2e5d2bdcbfe986d8d
Reviewed-on: https://gerrit.libreoffice.org/63785
Tested-by: Jenkins
Reviewed-by: Katarina Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/sc/qa/unit/data/ods/tdf121612.ods 
b/sc/qa/unit/data/ods/tdf121612.ods
new file mode 100644
index ..6afc4e0c931c
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf121612.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 1425ff330954..f084ad015f29 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -206,6 +207,7 @@ public:
 void testKeepSettingsOfBlankRows();
 
 void testTdf118990();
+void testTdf121612();
 
 CPPUNIT_TEST_SUITE(ScExportTest);
 CPPUNIT_TEST(test);
@@ -319,6 +321,7 @@ public:
 CPPUNIT_TEST(testKeepSettingsOfBlankRows);
 
 CPPUNIT_TEST(testTdf118990);
+CPPUNIT_TEST(testTdf121612);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -4169,6 +4172,23 @@ void ScExportTest::testTdf118990()
 xDocSh->DoClose();
 }
 
+void ScExportTest::testTdf121612()
+{
+ScDocShellRef xDocSh = loadDoc("tdf121612.", FORMAT_ODS);
+CPPUNIT_ASSERT(xDocSh.is());
+xDocSh = saveAndReload(xDocSh.get(), FORMAT_XLSX);
+
+ScDocument& rDoc = xDocSh->GetDocument();
+
+// There should be a pivot table
+CPPUNIT_ASSERT(rDoc.HasPivotTable());
+
+// DP collection is not lost after export and has one entry
+ScDPCollection* pDPColl = rDoc.GetDPCollection();
+CPPUNIT_ASSERT(pDPColl);
+CPPUNIT_ASSERT_EQUAL(size_t(1), pDPColl->GetCount());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xepivotxml.cxx 
b/sc/source/filter/excel/xepivotxml.cxx
index b7e790eca6da..271b4cb8fdf4 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -418,15 +418,22 @@ XclExpXmlPivotTableManager::XclExpXmlPivotTableManager( 
const XclExpRoot& rRoot
 
 void XclExpXmlPivotTableManager::Initialize()
 {
-const ScDocument& rDoc = GetDoc();
+ScDocument& rDoc = GetDoc();
 if (!rDoc.HasPivotTable())
 // No pivot table to export.
 return;
 
-const ScDPCollection* pDPColl = rDoc.GetDPCollection();
+ScDPCollection* pDPColl = rDoc.GetDPCollection();
 if (!pDPColl)
 return;
 
+// Update caches from DPObject
+for (size_t i = 0; i < pDPColl->GetCount(); ++i)
+{
+ScDPObject& rDPObj = (*pDPColl)[i];
+rDPObj.SyncAllDimensionMembers();
+}
+
 // Go through the caches first.
 
 std::vector aCaches;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-11-15 Thread Libreoffice Gerrit user
 sc/qa/unit/data/functions/statistical/fods/large.fods |8 +-
 sc/qa/unit/data/functions/statistical/fods/small.fods |   16 +++-
 sc/source/core/tool/interpr3.cxx  |   66 +++---
 3 files changed, 72 insertions(+), 18 deletions(-)

New commits:
commit e22ab5e6f6b0ea49231ca454a567133996306116
Author: Takeshi Abe 
AuthorDate: Tue Oct 30 18:03:10 2018 +0900
Commit: Eike Rathke 
CommitDate: Thu Nov 15 22:12:01 2018 +0100

Resolves: i#32345 Make LARGE()/SMALL() return an array

... if the second parameter is an array.

This change follows their specification in ODF 1.2.

Change-Id: I45c8923f462e9477e1234b47e39dcdd8d2198784
Reviewed-on: https://gerrit.libreoffice.org/62541
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/statistical/fods/large.fods 
b/sc/qa/unit/data/functions/statistical/fods/large.fods
index a00fd8d522ce..6e701e71671f 100644
--- a/sc/qa/unit/data/functions/statistical/fods/large.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/large.fods
@@ -4752,13 +4752,15 @@
  
 
 
- 
-  10
+ 
+  9
  
  
   9
  
- 
+ 
+  TRUE
+ 
  
   =AVERAGE(LARGE(I29:I38,{1,2,3}))
  
diff --git a/sc/qa/unit/data/functions/statistical/fods/small.fods 
b/sc/qa/unit/data/functions/statistical/fods/small.fods
index 5f191b43edb4..94a6ae6344ef 100644
--- a/sc/qa/unit/data/functions/statistical/fods/small.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/small.fods
@@ -4155,12 +4155,18 @@
  
 
 
- 
-  4
+ 
+  1
+ 
+ 
+  1
+ 
+ 
+  TRUE
+ 
+ 
+  =AVERAGE(SMALL(F1:F11,{5,2,3}))
  
- 
- 
- 
  
   AOO 32345
  
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 2b117b2be56c..0d41e175e335 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -31,7 +31,9 @@
 #include 
 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -3635,29 +3637,73 @@ void ScInterpreter::CalculateSmallLarge(bool bSmall)
 {
 if ( !MustHaveParamCount( GetByte(), 2 )  )
 return;
-double f = ::rtl::math::approxFloor(GetDouble());
-if (f < 1.0)
+
+std::vector aArray;
+GetNumberSequenceArray(1, aArray, false);
+auto aArraySize = aArray.size();
+if (aArraySize == 0 || nGlobalError != FormulaError::NONE)
 {
-PushIllegalArgument();
+PushNoValue();
 return;
 }
-SCSIZE k = static_cast(f);
+for (double fArg : aArray)
+{
+double f = ::rtl::math::approxFloor(fArg);
+if (f < 1.0)
+{
+PushIllegalArgument();
+return;
+}
+}
+
+std::vector aRankArray;
+aRankArray.reserve(aArraySize);
+std::transform(aArray.begin(), aArray.end(), 
std::back_inserter(aRankArray),
+   [](double f) { return static_cast(f); });
+
+auto itMaxRank = std::max_element(aRankArray.begin(), aRankArray.end());
+assert(itMaxRank != aRankArray.end());
+SCSIZE k = *itMaxRank;
+
 vector aSortArray;
-/* TODO: using nth_element() is best for one single value, but LARGE/SMALL
- * actually are defined to return an array of values if an array of
- * positions was passed, in which case, depending on the number of values,
- * we may or will need a real sorted array again, see #i32345. */
 GetNumberSequenceArray(1, aSortArray, false );
 SCSIZE nSize = aSortArray.size();
 if (nSize == 0 || nGlobalError != FormulaError::NONE || nSize < k)
 PushNoValue();
-else
+else if (aArraySize == 1)
 {
-// TODO: the sorted case for array: PushDouble( aSortArray[ bSmall ? 
k-1 : nSize-k ] );
 vector::iterator iPos = aSortArray.begin() + (bSmall ? k-1 : 
nSize-k);
 ::std::nth_element( aSortArray.begin(), iPos, aSortArray.end());
 PushDouble( *iPos);
 }
+else
+{
+std::set aIndices;
+for (SCSIZE n : aRankArray)
+aIndices.insert(bSmall ? n-1 : nSize-n);
+// We can spare sorting when the total number of ranks is small enough.
+// Find only the elements at given indices if, arbitrarily, the index 
size is
+// smaller than 1/3 of the haystack array's size; just sort it 
squarely, otherwise.
+if (aIndices.size() < nSize/3)
+{
+auto itBegin = aSortArray.begin();
+for (SCSIZE i : aIndices)
+{
+auto it = aSortArray.begin() + i;
+std::nth_element(itBegin, it, aSortArray.end());
+itBegin = ++it;
+}
+}
+else
+std::sort(aSortArray.begin(), aSortArray.end());
+
+aArray.clear();
+for (SCSIZE n : aRankArray)
+aArray.push_back(aSortArray[bSmall ? n-1 : nSize-n]);
+ScMatrixRef 

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

2018-10-18 Thread Libreoffice Gerrit user
 sc/qa/unit/helper/qahelper.hxx  |8 -
 sc/qa/unit/helper/shared_test_impl.hxx  |   10 +-
 sc/qa/unit/pivottable_filters_test.cxx  |2 
 sc/qa/unit/subsequent_export-test.cxx   |   12 +-
 sc/qa/unit/subsequent_filters-test.cxx  |6 -
 sc/qa/unit/ucalc.cxx|   30 +++
 sc/qa/unit/ucalc_column.cxx |4 
 sc/qa/unit/ucalc_condformat.cxx |   18 ++--
 sc/qa/unit/ucalc_formula.cxx|   40 -
 sc/qa/unit/ucalc_pivottable.cxx |   50 ++--
 sc/qa/unit/ucalc_sort.cxx   |   14 +--
 sc/source/core/data/funcdesc.cxx|6 -
 sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx |2 
 sc/source/ui/unoobj/condformatuno.cxx   |   42 +-
 14 files changed, 122 insertions(+), 122 deletions(-)

New commits:
commit dfd5385d97d4c359185450f5d0acc5aac4a7527b
Author: Noel Grandin 
AuthorDate: Thu Oct 18 08:08:12 2018 +0200
Commit: Noel Grandin 
CommitDate: Thu Oct 18 10:46:58 2018 +0200

loplugin:staticvar in sc

Change-Id: I9f1d66e9af454a27a341e56bbe50a558898b65a1
Reviewed-on: https://gerrit.libreoffice.org/61900
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index aac73cf8238a..37bbdc35ff50 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -90,10 +90,10 @@ struct TestParam
 bool const bOptimal;
 };
 const char* sTestDoc;
-int const nImportType;
-int const nExportType; // -1 for import test, otherwise this is an export 
test
-int const nRowData;
-RowData* const pData;
+int nImportType;
+int nExportType; // -1 for import test, otherwise this is an export test
+int nRowData;
+RowData const * pData;
 };
 
 struct FileFormat {
diff --git a/sc/qa/unit/helper/shared_test_impl.hxx 
b/sc/qa/unit/helper/shared_test_impl.hxx
index 114f2571f610..88548cca3699 100644
--- a/sc/qa/unit/helper/shared_test_impl.hxx
+++ b/sc/qa/unit/helper/shared_test_impl.hxx
@@ -43,7 +43,7 @@ struct DataBarData
 databar::ScAxisPosition eAxisPosition;
 };
 
-DataBarData aData[] = {
+DataBarData const aData[] = {
 { ScRange(1,2,0,1,5,0), COLORSCALE_AUTO, COLORSCALE_AUTO, 
databar::AUTOMATIC },
 { ScRange(3,2,0,3,5,0), COLORSCALE_MIN, COLORSCALE_MAX, databar::AUTOMATIC 
},
 { ScRange(5,2,0,5,5,0), COLORSCALE_PERCENTILE, COLORSCALE_PERCENT, 
databar::AUTOMATIC },
@@ -82,7 +82,7 @@ struct ColorScale2EntryData
 ScColorScaleEntryType eUpperType;
 };
 
-ColorScale2EntryData aData2Entry[] = {
+ColorScale2EntryData const aData2Entry[] = {
 { ScRange(1,2,0,1,5,0), COLORSCALE_MIN, COLORSCALE_MAX },
 { ScRange(3,2,0,3,5,0), COLORSCALE_PERCENTILE, COLORSCALE_PERCENT },
 { ScRange(5,2,0,5,5,0), COLORSCALE_VALUE, COLORSCALE_FORMULA }
@@ -121,7 +121,7 @@ struct ColorScale3EntryData
 ScColorScaleEntryType eUpperType;
 };
 
-ColorScale3EntryData aData3Entry[] = {
+ColorScale3EntryData const aData3Entry[] = {
 { ScRange(1,1,1,1,6,1), COLORSCALE_MIN, COLORSCALE_PERCENTILE, 
COLORSCALE_MAX },
 { ScRange(3,1,1,3,6,1), COLORSCALE_PERCENTILE, COLORSCALE_VALUE, 
COLORSCALE_PERCENT },
 { ScRange(5,1,1,5,6,1), COLORSCALE_VALUE, COLORSCALE_VALUE, 
COLORSCALE_FORMULA }
@@ -159,11 +159,11 @@ void testFunctionsExcel2010_Impl( ScDocument& rDoc )
 {
 // Original test case document is functions-excel-2010.xlsx
 // Which test rows to evaluate, 1-based as in UI to ease maintenance.
-struct
+static struct
 {
 SCROW nRow;
 bool  bEvaluate;
-} aTests[] = {
+} const aTests[] = {
 {  2, false },  // name=[ AGGREGATE ], result=0, expected=1
 {  3, true  },
 {  4, true  },
diff --git a/sc/qa/unit/pivottable_filters_test.cxx 
b/sc/qa/unit/pivottable_filters_test.cxx
index 609ee98e0a63..ceb43d6ce664 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -153,7 +153,7 @@ void ScPivotTableFiltersTest::tearDown()
 
 void ScPivotTableFiltersTest::registerNamespaces(xmlXPathContextPtr& 
pXmlXPathCtx)
 {
-struct
+static const struct
 {
 xmlChar* pPrefix;
 xmlChar* pURI;
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index ef0b5c96eec2..2472b3f9d55f 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -341,7 +341,7 @@ private:
 
 void ScExportTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx)
 {
-struct { xmlChar* pPrefix; xmlChar* pURI; } aNamespaces[] =
+static const struct { xmlChar* pPrefix; xmlChar* pURI; } aNamespaces[] =
 {
 { 

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

2018-10-15 Thread Libreoffice Gerrit user
 sc/qa/unit/data/functions/statistical/fods/skew.fods  |   16 
 sc/qa/unit/data/functions/statistical/fods/skewp.fods |   16 
 sc/source/core/tool/interpr3.cxx  |7 +++
 3 files changed, 31 insertions(+), 8 deletions(-)

New commits:
commit 10fff25227db4d2161dcc3e498654f6bc499a5b2
Author: Takeshi Abe 
AuthorDate: Sat Sep 29 17:12:04 2018 +0900
Commit: Eike Rathke 
CommitDate: Mon Oct 15 13:39:30 2018 +0200

sc: Let SKEW/SKEWP raise #!DIV/0 when < 3 numbers are given

as ODF 1.2 mentions such constaints of these functions, and
Excel's documentation also admits it with more specific remark:





Change-Id: If19350997ddcb6f0fb36e29e090e260c3ae3d262
Reviewed-on: https://gerrit.libreoffice.org/61130
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/statistical/fods/skew.fods 
b/sc/qa/unit/data/functions/statistical/fods/skew.fods
index eb778fd7b4c8..d33270cc7058 100644
--- a/sc/qa/unit/data/functions/statistical/fods/skew.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/skew.fods
@@ -5047,10 +5047,18 @@
  
 
 
- 
- 
- 
- 
+ 
+  #DIV/0!
+ 
+ 
+  #DIV/0!
+ 
+ 
+  TRUE
+ 
+ 
+  =SKEW(1,2)
+ 
  
  
   90031
diff --git a/sc/qa/unit/data/functions/statistical/fods/skewp.fods 
b/sc/qa/unit/data/functions/statistical/fods/skewp.fods
index 07795c6009c0..57017c6fb09c 100644
--- a/sc/qa/unit/data/functions/statistical/fods/skewp.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/skewp.fods
@@ -5041,10 +5041,18 @@
  
 
 
- 
- 
- 
- 
+ 
+  #DIV/0!
+ 
+ 
+  #DIV/0!
+ 
+ 
+  TRUE
+ 
+ 
+  =SKEWP(1,2)
+ 
  
  
   90031
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index ed2dc48f8f7c..2b117b2be56c 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -3323,6 +3323,13 @@ void ScInterpreter::CalculateSkewOrSkewp( bool bSkewp )
 std::vector values;
 if (!CalculateSkew( fSum, fCount, vSum, values))
 return;
+ // SKEW/SKEWP's constraints: they require at least three numbers
+if (fCount < 3.0)
+{
+// for interoperability with Excel
+PushError(FormulaError::DivisionByZero);
+return;
+}
 
 double fMean = fSum / fCount;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-15 Thread Libreoffice Gerrit user
 sc/qa/unit/data/functions/statistical/fods/kurt.fods |8 
 sc/source/core/tool/interpr3.cxx |4 +++-
 2 files changed, 7 insertions(+), 5 deletions(-)

New commits:
commit e785c027af8d26b78211b0caa740bae7c0384d3a
Author: Takeshi Abe 
AuthorDate: Wed Oct 3 18:10:49 2018 +0900
Commit: Eike Rathke 
CommitDate: Mon Oct 15 13:37:42 2018 +0200

sc: Make KURT() return #DIV/0! when <4 arguments are given

as Excel does:



Change-Id: I1059e6e5dd9f01688219492e76af6dbbe97be41a
Reviewed-on: https://gerrit.libreoffice.org/61286
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/statistical/fods/kurt.fods 
b/sc/qa/unit/data/functions/statistical/fods/kurt.fods
index 2634ee802da4..c808f9b58b84 100644
--- a/sc/qa/unit/data/functions/statistical/fods/kurt.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/kurt.fods
@@ -4118,12 +4118,12 @@
 
 
  
-  #NUM!
+  #DIV/0!
  
- 
-  #NUM!
+ 
+  #DIV/0!
  
- 
+ 
   TRUE
  
  
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 02242d9745bc..ed2dc48f8f7c 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -2868,8 +2868,10 @@ void ScInterpreter::ScKurt()
 if ( !CalculateSkew(fSum,fCount,vSum,values) )
 return;
 
-if (fCount == 0.0)
+// ODF 1.2 constraints: # of numbers >= 4
+if (fCount < 4.0)
 {
+// for interoperability with Excel
 PushError( FormulaError::DivisionByZero);
 return;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-08 Thread Libreoffice Gerrit user
 sc/qa/unit/datatransformation_test.cxx   |  433 ---
 sc/source/ui/dataprovider/datatransformation.cxx |  247 +
 2 files changed, 407 insertions(+), 273 deletions(-)

New commits:
commit 4a00c79aafc6dde331cf4bb351d98226a9337171
Author: Vikas Mahato 
AuthorDate: Tue Aug 21 23:58:58 2018 +0530
Commit: Eike Rathke 
CommitDate: Mon Oct 8 16:39:31 2018 +0200

Added date time transformations - follow-up

Change-Id: I130feda7c835b067a542736ad6fadc79cabc4f41
Reviewed-on: https://gerrit.libreoffice.org/59413
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/datatransformation_test.cxx 
b/sc/qa/unit/datatransformation_test.cxx
index 97a8e49c79d8..f1aba85b82bc 100644
--- a/sc/qa/unit/datatransformation_test.cxx
+++ b/sc/qa/unit/datatransformation_test.cxx
@@ -16,7 +16,8 @@
 #include 
 #include 
 #include 
-
+#include 
+#include 
 #include 
 
 class ScDataTransformationTest : public ScBootstrapFixture
@@ -543,269 +544,440 @@ void ScDataTransformationTest::testReplaceNull()
 
 void ScDataTransformationTest::testGetDateString()
 {
-m_pDoc->SetValue(2, 0, 0, 43248.5624189815);
-m_pDoc->SetValue(2, 1, 0, 42941.5624189815);
-m_pDoc->SetValue(2, 2, 0, 42518.5624189815);
+SvNumberFormatter* pFormatter = m_pDoc->GetFormatTable();
+css::util::Date aDate1(25,1,2011);
+css::util::Date aDate2(12,10,1994);
+css::util::Date aDate3(23,9,1996);
+css::util::Date aDate4(15,8,1947);
+
+double nDate1 = static_cast(aDate1 - pFormatter->GetNullDate());
+double nDate2 = static_cast(aDate2 - pFormatter->GetNullDate());
+double nDate3 = static_cast(aDate3 - pFormatter->GetNullDate());
+double nDate4 = static_cast(aDate4 - pFormatter->GetNullDate());
+
+m_pDoc->SetValue(2, 0, 0, nDate1);
+m_pDoc->SetValue(2, 1, 0, nDate2);
+m_pDoc->SetValue(2, 2, 0, nDate3);
+m_pDoc->SetValue(2, 3, 0, nDate4);
 
 sc:: DateTimeTransformation aTransform({2}, 
sc::DATETIME_TRANSFORMATION_TYPE::DATE_STRING   );
 aTransform.Transform(*m_pDoc);
 
-CPPUNIT_ASSERT_EQUAL(OUString("05/28/18"), m_pDoc->GetString(2, 0, 0));
-CPPUNIT_ASSERT_EQUAL(OUString("07/25/17"), m_pDoc->GetString(2, 1, 0));
-CPPUNIT_ASSERT_EQUAL(OUString("05/28/16"), m_pDoc->GetString(2, 2, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("01/25/11"), m_pDoc->GetString(2, 0, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("10/12/94"), m_pDoc->GetString(2, 1, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("09/23/96"), m_pDoc->GetString(2, 2, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("08/15/47"), m_pDoc->GetString(2, 3, 0));
 }
 
 void ScDataTransformationTest::testGetYear()
 {
-m_pDoc->SetValue(2, 0, 0, 20);
-m_pDoc->SetValue(2, 1, 0, 3342.44);
-m_pDoc->SetValue(2, 2, 0, 955.05);
-m_pDoc->SetValue(2, 3, 0, 4890.22);
+SvNumberFormatter* pFormatter = m_pDoc->GetFormatTable();
+css::util::Date aDate1(25,1,2011);
+css::util::Date aDate2(12,10,1994);
+css::util::Date aDate3(23,9,1996);
+css::util::Date aDate4(15,8,1947);
+
+double nDate1 = static_cast(aDate1 - pFormatter->GetNullDate());
+double nDate2 = static_cast(aDate2 - pFormatter->GetNullDate());
+double nDate3 = static_cast(aDate3 - pFormatter->GetNullDate());
+double nDate4 = static_cast(aDate4 - pFormatter->GetNullDate());
+
+m_pDoc->SetValue(2, 0, 0, nDate1);
+m_pDoc->SetValue(2, 1, 0, nDate2);
+m_pDoc->SetValue(2, 2, 0, nDate3);
+m_pDoc->SetValue(2, 3, 0, nDate4);
 
 sc:: DateTimeTransformation aTransform({2}, 
sc::DATETIME_TRANSFORMATION_TYPE::YEAR   );
 aTransform.Transform(*m_pDoc);
 
-CPPUNIT_ASSERT_DOUBLES_EQUAL(1900, m_pDoc->GetValue(2, 0, 0), 0);
-CPPUNIT_ASSERT_DOUBLES_EQUAL(1909, m_pDoc->GetValue(2, 1, 0), 0);
-CPPUNIT_ASSERT_DOUBLES_EQUAL(1902, m_pDoc->GetValue(2, 2, 0), 0);
-CPPUNIT_ASSERT_DOUBLES_EQUAL(1913, m_pDoc->GetValue(2, 3, 0), 0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(2011, m_pDoc->GetValue(2, 0, 0), 0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(1994, m_pDoc->GetValue(2, 1, 0), 0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(1996, m_pDoc->GetValue(2, 2, 0), 0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(1947, m_pDoc->GetValue(2, 3, 0), 0);
 }
 
 void ScDataTransformationTest::testGetStartOfYear()
 {
-m_pDoc->SetValue(2, 0, 0, 43248.5624189815);
-m_pDoc->SetValue(2, 1, 0, 42941.5624189815);
-m_pDoc->SetValue(2, 2, 0, 42518.5624189815);
-m_pDoc->SetValue(2, 3, 0, 44217.5624189815);
+SvNumberFormatter* pFormatter = m_pDoc->GetFormatTable();
+css::util::Date aDate1(25,1,2011);
+css::util::Date aDate2(12,10,1994);
+css::util::Date aDate3(23,9,1996);
+css::util::Date aDate4(15,8,1947);
+
+double nDate1 = static_cast(aDate1 - pFormatter->GetNullDate());
+double nDate2 = static_cast(aDate2 - pFormatter->GetNullDate());
+double nDate3 = static_cast(aDate3 - pFormatter->GetNullDate());
+double nDate4 = static_cast(aDate4 - pFormatter->GetNullDate());
+
+m_pDoc->SetValue(2, 

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

2018-10-02 Thread Libreoffice Gerrit user
 sc/qa/uitest/calc_tests2/tdf120174.py |   35 ++
 sc/source/core/tool/formularesult.cxx |   11 ++
 2 files changed, 46 insertions(+)

New commits:
commit 4cb160d58c62e6214f86ba94c9c2834dab6cfe8f
Author: Dennis Francis 
AuthorDate: Sat Sep 29 21:39:19 2018 +0530
Commit: Michael Meeks 
CommitDate: Tue Oct 2 16:32:55 2018 +0200

tdf#120174 : Always copy mbValueCached flag in Assign()

so that fast result return maintains correctness.

Although not necessary for fixing this bug,
lets take advantage of fast result return in the case
of empty result token by setting mfValue to 0.0 and
setting mbValueCached flag.

The fast result return was implemented in :-


commit 77f7b4768a79e5a8489b163670e0ce10fbd07c49
Author: Dennis Francis 
Date:   Wed Jul 11 17:19:28 2018 +0530

Allow fast result return for formula-cells with...

"double" result which is a very frequent use-case.
This improves overall running times in most cases,
not just for the threaded path.

Change-Id: I18d10ee3cea613923e2057e746a6a8187bb18647
Reviewed-on: https://gerrit.libreoffice.org/59395
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 


Also added a ui-test for the fix. A normal unit test would
have sufficed, but I could not get it to reproduce the issue
from a ucalc environment somehow.

Change-Id: I9b95b571b596a7bb68768ea0de8ee4334448b540
Reviewed-on: https://gerrit.libreoffice.org/61140
Reviewed-by: Michael Meeks 
Tested-by: Jenkins

diff --git a/sc/qa/uitest/calc_tests2/tdf120174.py 
b/sc/qa/uitest/calc_tests2/tdf120174.py
new file mode 100644
index ..e078147a9c6f
--- /dev/null
+++ b/sc/qa/uitest/calc_tests2/tdf120174.py
@@ -0,0 +1,35 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.calc import enter_text_to_cell
+import org.libreoffice.unotest
+import pathlib
+
+def get_url_for_data_file(file_name):
+return 
pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
+
+class tdf120174(UITestCase):
+def test_tdf120174(self):
+calc_doc = self.ui_test.create_doc_in_start_center("calc")
+xCalcDoc = self.xUITest.getTopFocusWindow()
+gridwin = xCalcDoc.getChild("grid_window")
+document = self.ui_test.get_component()
+enter_text_to_cell(gridwin, "A1", "121")
+enter_text_to_cell(gridwin, "B1", "=A1")
+self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 
121) # B1
+gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+# Delete contents of A1
+gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"}))
+# Before the fix the result would be still 121.
+self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 
0) # B1
+self.xUITest.executeCommand(".uno:Undo")
+self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 
121) # B1
+self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/core/tool/formularesult.cxx 
b/sc/source/core/tool/formularesult.cxx
index 4387af07511e..629072ece09f 100644
--- a/sc/source/core/tool/formularesult.cxx
+++ b/sc/source/core/tool/formularesult.cxx
@@ -107,6 +107,10 @@ void ScFormulaResult::ResolveToken( const 
formula::FormulaToken * p )
 p->DecRef();
 mbToken = false;
 meMultiline = MULTILINE_FALSE;
+// Take advantage of fast double result return for empty 
result token.
+// by setting mfValue to 0 and turning on mbValueCached flag.
+mfValue = 0.0;
+mbValueCached = true;
 break;
 case formula::svDouble:
 mfValue = p->GetDouble();
@@ -132,6 +136,11 @@ void ScFormulaResult::Assign( const ScFormulaResult & r )
 {
 if (this == )
 return;
+
+// It is important to reset the value-cache flag to that of the source
+// unconditionally.
+mbValueCached = r.mbValueCached;
+
 if (r.mbEmpty)
 {
 if (mbToken && mpToken)
@@ -140,6 +149,8 @@ void ScFormulaResult::Assign( const ScFormulaResult & r )
 mbEmpty = true;
 mbEmptyDisplayedAsString = r.mbEmptyDisplayedAsString;
 meMultiline = r.meMultiline;
+// here r.mfValue will be 0.0 which is ensured in ResolveToken().
+mfValue = 0.0;
 }
 else if (r.mbToken)
 {

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

2018-09-29 Thread Libreoffice Gerrit user
 sc/qa/unit/subsequent_filters-test.cxx   |   24 
 sc/source/filter/oox/drawingfragment.cxx |2 ++
 2 files changed, 22 insertions(+), 4 deletions(-)

New commits:
commit a7756236858788b11816cbaba433768ba4ccc72a
Author: Justin Luth 
AuthorDate: Fri Sep 28 20:41:34 2018 +0300
Commit: Justin Luth 
CommitDate: Sat Sep 29 20:26:47 2018 +0200

tdf#111980 sc optionbutton autoGroups different for form/activeX

This patch only affects calc. (Perhaps .xls* is the only
format that supports non-activeX radio buttons?)

Commit 9f969799629fe6bdf8b922d8cb922846aa646ece worried
about form and activeX buttons sharing the autoGroup_.
This patch prevents that.

Change-Id: Ia57a14f1cdd6363aa5d6d991469668fcc56016ca
Reviewed-on: https://gerrit.libreoffice.org/61095
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index ef2b5ee22aef..0b0406127e82 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -1694,18 +1694,34 @@ void ScFiltersTest::testActiveXOptionButtonGroup()
 xPropertySet->getPropertyValue("GroupName") >>= sGroupName;
 CPPUNIT_ASSERT_EQUAL(OUString("Sheet1"), sGroupName);
 
-// Form optionbuttons (without Group names) were not grouped.
+// Optionbuttons (without Group names) were not grouped.
 // The two optionbuttons should have the same auto-generated group name.
+OUString sGroupName2; //ActiveX controls
+xControlShape.set(xIA_DrawPage->getByIndex(2), uno::UNO_QUERY_THROW);
+xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY_THROW);
+xPropertySet->getPropertyValue("GroupName") >>= sGroupName2;
+CPPUNIT_ASSERT_EQUAL( false, sGroupName2.isEmpty() );
+
+OUString sGroupName3;
+xControlShape.set(xIA_DrawPage->getByIndex(3), uno::UNO_QUERY_THROW);
+xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY_THROW);
+xPropertySet->getPropertyValue("GroupName") >>= sGroupName3;
+CPPUNIT_ASSERT_EQUAL( sGroupName2, sGroupName3 );
+CPPUNIT_ASSERT( sGroupName != sGroupName3 );
+
+OUString sGroupName4; //Form controls
 xControlShape.set(xIA_DrawPage->getByIndex(4), uno::UNO_QUERY_THROW);
 xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY_THROW);
-xPropertySet->getPropertyValue("GroupName") >>= sGroupName;
-CPPUNIT_ASSERT_EQUAL(false, sGroupName.isEmpty());
+xPropertySet->getPropertyValue("GroupName") >>= sGroupName4;
+CPPUNIT_ASSERT_EQUAL( false, sGroupName4.isEmpty() );
 
 OUString sGroupName5;
 xControlShape.set(xIA_DrawPage->getByIndex(5), uno::UNO_QUERY_THROW);
 xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY_THROW);
 xPropertySet->getPropertyValue("GroupName") >>= sGroupName5;
-CPPUNIT_ASSERT_EQUAL(sGroupName, sGroupName5);
+CPPUNIT_ASSERT_EQUAL( sGroupName4, sGroupName5 );
+CPPUNIT_ASSERT( sGroupName2 != sGroupName5 );
+CPPUNIT_ASSERT( sGroupName != sGroupName5 );
 }
 
 void ScFiltersTest::testChartImportODS()
diff --git a/sc/source/filter/oox/drawingfragment.cxx 
b/sc/source/filter/oox/drawingfragment.cxx
index 5ad5f48a7b02..52c349f31fd8 100644
--- a/sc/source/filter/oox/drawingfragment.cxx
+++ b/sc/source/filter/oox/drawingfragment.cxx
@@ -536,6 +536,8 @@ Reference< XShape > 
VmlDrawing::createAndInsertClientXShape( const ::oox::vml::S
 case XML_Radio:
 {
 AxOptionButtonModel& rAxModel = aControl.createModel< 
AxOptionButtonModel >();
+// unique name to prevent autoGroping with ActiveX controls.
+rAxModel.maGroupName = "autoGroup_formControl";
 convertControlText( rAxModel.maFontData, rAxModel.mnTextColor, 
rAxModel.maCaption, pTextBox, pClientData->mnTextHAlign );
 convertControlBackground( rAxModel, rShape );
 rAxModel.maValue = OUString::number( pClientData->mnChecked );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-09-05 Thread Libreoffice Gerrit user
 sc/qa/unit/data/xlsx/tdf117287_comment.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx   |   43 +---
 sc/source/filter/xcl97/xcl97rec.cxx |   25 +---
 3 files changed, 47 insertions(+), 21 deletions(-)

New commits:
commit 7010edf9c3cd1a602417421980092dee9ce7ea94
Author: Ilhan Yesil 
AuthorDate: Mon Sep 3 12:57:01 2018 +0200
Commit: Katarina Behrens 
CommitDate: Wed Sep 5 10:39:57 2018 +0200

tdf#117287 When saving as Xlsx, export visible flag if comment is visble

The visible flag will be exported now, when a comment is visible and
the file is saved as Xlsx.

Change-Id: Id05ab5f94ea85f48db123d1043ecdc4813a64382
Reviewed-on: https://gerrit.libreoffice.org/59934
Tested-by: Jenkins
Reviewed-by: Katarina Behrens 

diff --git a/sc/qa/unit/data/xlsx/tdf117287_comment.xlsx 
b/sc/qa/unit/data/xlsx/tdf117287_comment.xlsx
new file mode 100644
index ..486bdef90f84
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf117287_comment.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 596cfe751e20..5d0f1dce5313 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -121,6 +121,7 @@ public:
 void testFormatExportODS();
 
 void testCommentExportXLSX();
+void testCommentExportXLSX_2_XLSX();
 #if HAVE_MORE_FONTS
 void testCustomColumnWidthExportXLSX();
 #endif
@@ -242,8 +243,8 @@ public:
 CPPUNIT_TEST(testCellNoteExportODS);
 CPPUNIT_TEST(testCellNoteExportXLS);
 CPPUNIT_TEST(testFormatExportODS);
-
 CPPUNIT_TEST(testCommentExportXLSX);
+CPPUNIT_TEST(testCommentExportXLSX_2_XLSX);
 #if HAVE_MORE_FONTS
 CPPUNIT_TEST(testCustomColumnWidthExportXLSX);
 #endif
@@ -698,8 +699,10 @@ void ScExportTest::testCommentExportXLSX()
 ScDocShellRef xShell = loadDoc("comment.", FORMAT_ODS);
 CPPUNIT_ASSERT(xShell.is());
 
-std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
-const xmlDocPtr pComments = XPathHelper::parseExport(pXPathFile, 
m_xSFactory, "xl/comments1.xml");
+std::shared_ptr pXPathFile
+= ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+const xmlDocPtr pComments
+= XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/comments1.xml");
 CPPUNIT_ASSERT(pComments);
 
 assertXPath(pComments, "/x:comments/x:authors/x:author[1]", "BAKO");
@@ -707,7 +710,8 @@ void ScExportTest::testCommentExportXLSX()
 
 assertXPath(pComments, 
"/x:comments/x:commentList/x:comment/x:text/x:r/x:t", "Komentarz");
 
-const xmlDocPtr pVmlDrawing = XPathHelper::parseExport(pXPathFile, 
m_xSFactory, "xl/drawings/vmlDrawing1.vml");
+const xmlDocPtr pVmlDrawing
+= XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/vmlDrawing1.vml");
 CPPUNIT_ASSERT(pVmlDrawing);
 
 //assertXPath(pVmlDrawing, "/xml/v:shapetype", "coordsize", "21600,21600");
@@ -720,6 +724,37 @@ void ScExportTest::testCommentExportXLSX()
 assertXPath(pVmlDrawing, "/xml/v:shape/v:shadow", "obscured", "t");
 }
 
+void ScExportTest::testCommentExportXLSX_2_XLSX()
+{
+//tdf#117287 FILESAVE XLSX: Comments always disappear after opening the 
exported XLSX file with Excel
+ScDocShellRef xShell = loadDoc("tdf117287_comment.", FORMAT_XLSX);
+CPPUNIT_ASSERT(xShell.is());
+
+
+ScDocument& rDoc = xShell->GetDocument();
+ScAddress aPosC9(2, 8, 0);
+ScPostIt *pNote = rDoc.GetNote(aPosC9);
+
+CPPUNIT_ASSERT(pNote);
+CPPUNIT_ASSERT(!pNote->IsCaptionShown());
+
+pNote->ShowCaption(aPosC9, true);
+
+std::shared_ptr pXPathFile
+= ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+const xmlDocPtr pComments
+= XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/comments1.xml");
+CPPUNIT_ASSERT(pComments);
+
+assertXPath(pComments, 
"/x:comments/x:commentList/x:comment/x:text/x:r/x:t", "visible comment");
+
+const xmlDocPtr pVmlDrawing
+= XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/drawings/vmlDrawing1.vml");
+CPPUNIT_ASSERT(pVmlDrawing);
+
+assertXPath(pVmlDrawing, "/xml/v:shape/x:ClientData/x:Visible", 0);
+}
+
 #if HAVE_MORE_FONTS
 void ScExportTest::testCustomColumnWidthExportXLSX()
 {
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx 
b/sc/source/filter/xcl97/xcl97rec.cxx
index a23ad826ed7c..b1e082154374 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -537,22 +537,10 @@ static void lcl_FillProps( EscherPropertyContainer& 
rPropOpt, SdrObject* pCaptio
 if( !rPropOpt.GetOpt( ESCHER_Prop_FitTextToShape, nValue ) )
 rPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x00080008 ); 
 // bool field
 
-if( rPropOpt.GetOpt( ESCHER_Prop_fillColor, nValue ) )
-{
-// If the Colour is the same as the 'ToolTip' System colour 

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

2018-08-31 Thread Libreoffice Gerrit user
 sc/qa/unit/data/xls/pass/ooo956-3.xls |binary
 sc/source/core/data/formulacell.cxx   |   18 --
 2 files changed, 16 insertions(+), 2 deletions(-)

New commits:
commit 8eafa504e99bdf946e006527092d1974f18b66cc
Author: Luboš Luňák 
AuthorDate: Thu Aug 23 12:27:24 2018 +0200
Commit: Eike Rathke 
CommitDate: Fri Aug 31 10:52:31 2018 +0200

properly reset nSeenInIteration when iterating cell cycles

ooo#956-3 has a somewhat complex cell cycle structure. Calc detects
cycle G40, H40, H47, H37, D40 -> G40, marks these cells as bIsIterCell,
adds them to the list of cells in RecursionHelper and starts iterating.
However, there are more cells involved, e.g. there's another cycle
D41, G41, H41, H47, H37 -> D41, which Calc doesn't detect (probably
because it partially overlaps with the detected cycle).

This means that InterpretTail() was setting nSeenInIteration for every
involved cell, but it wasn't unset, because some of the cells weren't
know to be part of the iteration. And so on the next recalc, these
cells weren't interpreted, because Interpret() aborted early because
of the stale nSeenInIteration value. And in threaded calculation, this
eventually led to hitting an assert in MaybeInterpret().

And obvious fix for this is to set nSeenInIteration only for cells
that Calc treats as being part of the iteration. Which is what this
commit does.

That's however not a complete fix. Doing a recalc with ooo#956-3 now
at least gives somewhat sensible values, but it needs repeated hard
recalcs to actually reach the correct values that converge, or the delta
change in the iteration settings need to be (needlessly) small, 1E-6,
while Excel manages with just 1E-2. So what also should be done is probably
detecting all cells involved in the cycle and treating them as such.

Change-Id: I05fd149b453363c335f1f5d5d3748354ae624613
Reviewed-on: https://gerrit.libreoffice.org/59495
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/xls/pass/ooo956-3.xls 
b/sc/qa/unit/data/xls/pass/ooo956-3.xls
new file mode 100644
index ..dc8f353b2bc9
Binary files /dev/null and b/sc/qa/unit/data/xls/pass/ooo956-3.xls differ
diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index 660ea65f0a1a..9ad6d4b9cb86 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1457,8 +1457,15 @@ class RecursionCounter
 {
 ScRecursionHelper&  rRec;
 boolbStackedInIteration;
+#ifdef DBG_UTIL
+const ScFormulaCell* cell;
+#endif
 public:
-RecursionCounter( ScRecursionHelper& r, ScFormulaCell* p ) : rRec(r)
+RecursionCounter( ScRecursionHelper& r, ScFormulaCell* p )
+: rRec(r)
+#ifdef DBG_UTIL
+, cell(p)
+#endif
 {
 bStackedInIteration = rRec.IsDoingIteration();
 if (bStackedInIteration)
@@ -1469,7 +1476,12 @@ public:
 {
 rRec.DecRecursionCount();
 if (bStackedInIteration)
+{
+#ifdef DBG_UTIL
+assert(rRec.GetRecursionInIterationStack().top() == cell);
+#endif
 rRec.GetRecursionInIterationStack().pop();
+}
 }
 };
 }
@@ -1806,7 +1818,9 @@ void ScFormulaCell::Interpret()
 void ScFormulaCell::InterpretTail( ScInterpreterContext& rContext, 
ScInterpretTailParameter eTailParam )
 {
 RecursionCounter aRecursionCounter( pDocument->GetRecursionHelper(), this);
-nSeenInIteration = pDocument->GetRecursionHelper().GetIteration();
+// TODO If this cell is not an iteration cell, add it to the list of 
iteration cells?
+if(bIsIterCell)
+nSeenInIteration = pDocument->GetRecursionHelper().GetIteration();
 if( !pCode->GetCodeLen() && pCode->GetCodeError() == FormulaError::NONE )
 {
 // #i11719# no RPN and no error and no token code but result string 
present
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-30 Thread Libreoffice Gerrit user
 sc/qa/unit/ucalc.cxx  |8 
 sc/source/ui/docshell/docfunc.cxx |   25 +
 sc/source/ui/docshell/impex.cxx   |1 +
 sc/source/ui/inc/undobase.hxx |2 +-
 sc/source/ui/inc/undoblk.hxx  |8 
 sc/source/ui/inc/undodat.hxx  |2 +-
 sc/source/ui/inc/undotab.hxx  |2 +-
 sc/source/ui/undo/undobase.cxx|4 ++--
 sc/source/ui/undo/undoblk.cxx |   16 
 sc/source/ui/undo/undodat.cxx |4 ++--
 sc/source/ui/undo/undotab.cxx |5 +++--
 sc/source/ui/unoobj/cellsuno.cxx  |1 +
 sc/source/ui/view/viewfun2.cxx|   10 +++---
 sc/source/ui/view/viewfun3.cxx|   10 +-
 sc/source/ui/view/viewfun4.cxx|1 +
 sc/source/ui/view/viewfunc.cxx|6 +++---
 16 files changed, 49 insertions(+), 56 deletions(-)

New commits:
commit 1f9f35177aca7000edd0ec5e68e4045e04cce535
Author: Noel Grandin 
AuthorDate: Thu Aug 30 09:47:24 2018 +0200
Commit: Noel Grandin 
CommitDate: Thu Aug 30 12:53:56 2018 +0200

pass ScRefUndoData around by std::unique_ptr

Change-Id: I317a0c7665f4c146fc34bcffdae8835cf674ff61
Reviewed-on: https://gerrit.libreoffice.org/59787
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 791b25ab85b2..193522887b8b 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -3748,8 +3748,8 @@ void Test::testCopyPasteSkipEmpty()
 m_pDoc->CopyToDocument(aDestRange, InsertDeleteFlags::ALL, false, 
*pRedoDoc, );
 
 // Create an undo object for this.
-ScRefUndoData* pRefUndoData = new ScRefUndoData(m_pDoc);
-ScUndoPaste aUndo((), aDestRange, aMark, std::move(pUndoDoc), 
std::move(pRedoDoc), InsertDeleteFlags::ALL, pRefUndoData);
+std::unique_ptr pRefUndoData(new ScRefUndoData(m_pDoc));
+ScUndoPaste aUndo((), aDestRange, aMark, std::move(pUndoDoc), 
std::move(pRedoDoc), InsertDeleteFlags::ALL, std::move(pRefUndoData));
 
 // Check the content after the paste.
 {
@@ -6741,10 +6741,10 @@ ScUndoPaste* Test::createUndoPaste(ScDocShell& rDocSh, 
const ScRange& rRange, Sc
 ScDocument& rDoc = rDocSh.GetDocument();
 ScMarkData aMarkData;
 aMarkData.SetMarkArea(rRange);
-ScRefUndoData* pRefUndoData = new ScRefUndoData();
+std::unique_ptr pRefUndoData(new ScRefUndoData());
 
 return new ScUndoPaste(
-, rRange, aMarkData, std::move(pUndoDoc), nullptr, 
InsertDeleteFlags::ALL, pRefUndoData, false);
+, rRange, aMarkData, std::move(pUndoDoc), nullptr, 
InsertDeleteFlags::ALL, std::move(pRefUndoData), false);
 }
 
 void Test::setExpandRefs(bool bExpand)
diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index f995de081037..a49e78d89f65 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1799,7 +1799,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const 
ScMarkData* pTabMark,
 WaitObject aWait( ScDocShell::GetActiveDialogParent() );  // important 
due to TrackFormulas at UpdateReference
 
 ScDocumentUniquePtr pRefUndoDoc;
-ScRefUndoData* pUndoData = nullptr;
+std::unique_ptr pUndoData;
 if ( bRecord )
 {
 pRefUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
@@ -1807,7 +1807,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const 
ScMarkData* pTabMark,
 
 // pRefUndoDoc is filled in InsertCol / InsertRow
 
-pUndoData = new ScRefUndoData(  );
+pUndoData.reset(new ScRefUndoData(  ));
 
 rDoc.BeginDrawUndo();
 }
@@ -1849,7 +1849,6 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const 
ScMarkData* pTabMark,
 if (!bApi)
 rDocShell.ErrorMessage(STR_MSSG_INSERTCELLS_0);
 rDocShell.GetUndoManager()->LeaveListAction();
-delete pUndoData;
 return false;
 }
 
@@ -1954,7 +1953,6 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const 
ScMarkData* pTabMark,
 if (!bApi)
 rDocShell.ErrorMessage(STR_MSSG_INSERTCELLS_0);
 rDocShell.GetUndoManager()->LeaveListAction();
-delete pUndoData;
 return false;
 }
 }
@@ -2025,7 +2023,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const 
ScMarkData* pTabMark,
 
 rDocShell.GetUndoManager()->AddUndoAction( new ScUndoInsertCells(
 , ScRange( nStartCol, nStartRow, nStartTab, nEndCol, 
nEndRow, nEndTab ),
-nUndoPos, pTabs, pScenarios, eCmd, std::move(pRefUndoDoc), 
pUndoData, bPartOfPaste ) );
+nUndoPos, pTabs, pScenarios, eCmd, std::move(pRefUndoDoc), 
std::move(pUndoData), bPartOfPaste ) );
 }
 
 // #i8302 : we remerge growing ranges, with the new part inserted
@@ -2122,7 +2120,6 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const 
ScMarkData* pTabMark,
   

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

2018-08-17 Thread Libreoffice Gerrit user
 sc/qa/unit/data/fods/SlowValidNewTabName1.fods |  408 +
 sc/source/core/data/document.cxx   |   19 -
 2 files changed, 420 insertions(+), 7 deletions(-)

New commits:
commit bc28d51cb88c796da241d1ab914bbe6bb174cc49
Author: Caolán McNamara 
AuthorDate: Fri Aug 17 10:50:34 2018 +0100
Commit: Eike Rathke 
CommitDate: Fri Aug 17 20:23:08 2018 +0200

ofz: make ValidNewTabName faster wrt collisions

Change-Id: Id2058719c3bc822518faa922a6cd0409b4088ac7
Reviewed-on: https://gerrit.libreoffice.org/59253
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/fods/SlowValidNewTabName1.fods 
b/sc/qa/unit/data/fods/SlowValidNewTabName1.fods
new file mode 100644
index ..3f5dd3fc4115
--- /dev/null
+++ b/sc/qa/unit/data/fods/SlowValidNewTabName1.fods
@@ -0,0 +1,408 @@
+
+http://purl.org/dc/elements/1.1/; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
office:mimetype="application/vnd.oasis.opendocument.presentation" 
office:version="1.0">
+  
+
+  0
+  27093
+
+  
+  
+  
+
+  
+  
+
+  
+
+
+  9style:table-column-properties style:column-width="3.8194in"/>
+   ties draw:fill="none" draw:textarea-horizontal-align="center" 
fo:padding="0.0382in"/>
+  
+
+  
+  
+
+
+
+
+
+
+  
+  
+  NMTOKENSe:presentation>
+  
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+

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

2018-08-15 Thread Libreoffice Gerrit user
 sc/qa/unit/data/xlsx/tdf118990.xlsx   |binary
 sc/qa/unit/subsequent_export-test.cxx |   33 +
 sc/source/filter/excel/xecontent.cxx  |3 ++-
 3 files changed, 35 insertions(+), 1 deletion(-)

New commits:
commit f24b0ec13c5c8edda5ffb1336b0eb6da173dfc97
Author: Mike Kaganski 
AuthorDate: Wed Aug 15 12:35:30 2018 +0300
Commit: Mike Kaganski 
CommitDate: Wed Aug 15 18:56:50 2018 +0200

tdf#118990: use full URI for absolute references

Previously (since commit 7eb5e135422f1a5830a44d129300bc3fafb4627d)
only path relative to reference host was stored, and host itself
was dropped. That resulted in URIs like "/share/file.xlsx", even
without scheme. For Windows shares, this broke UNC paths like
"\\HOSTNAME\share\file.xlsx" (which are stored in XLSX by Excel as
"file:///\\HOSTNAME\share\file.xlsx"), and on subsequent import,
this resulted in paths on the same drive as the document (like
"C:\share\file.xlsx").

With this change, we will store "file://HOSTNAME/share/file.xlsx",
which is correctly processed by both LibreOffice and MS Excel.

Change-Id: I3f13aa0b3ae8dc41ec28eaa1416d536469c4562a
Reviewed-on: https://gerrit.libreoffice.org/59064
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 

diff --git a/sc/qa/unit/data/xlsx/tdf118990.xlsx 
b/sc/qa/unit/data/xlsx/tdf118990.xlsx
new file mode 100644
index ..b680edceef0e
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf118990.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index bb134b0b1d1e..56546a588789 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -211,6 +211,8 @@ public:
 void testOpenDocumentAsReadOnly();
 void testKeepSettingsOfBlankRows();
 
+void testTdf118990();
+
 CPPUNIT_TEST_SUITE(ScExportTest);
 CPPUNIT_TEST(test);
 CPPUNIT_TEST(testTdf111876);
@@ -320,6 +322,8 @@ public:
 CPPUNIT_TEST(testOpenDocumentAsReadOnly);
 CPPUNIT_TEST(testKeepSettingsOfBlankRows);
 
+CPPUNIT_TEST(testTdf118990);
+
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -4064,6 +4068,35 @@ void ScExportTest::testKeepSettingsOfBlankRows()
 assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row", 2);
 }
 
+void ScExportTest::testTdf118990()
+{
+ScDocShellRef xDocSh = loadDoc("tdf118990.", FORMAT_XLSX);
+CPPUNIT_ASSERT(xDocSh.is());
+xDocSh = saveAndReload(xDocSh.get(), FORMAT_XLSX);
+ScDocument& rDoc = xDocSh->GetDocument();
+
+// TODO: also test A1, which contains a UNC reference to 
\\localhost\share\lookupsource.xlsx,
+// but currently looses "localhost" part when normalized in INetURLObject, 
becoming
+// file:///share/lookupsource.xlsx - which is incorrect, since it points 
to local filesystem
+// and not to Windows network share.
+
+#if defined LINUX // following INetURLObject::setAbsURIRef
+#define TDF118990_SCHEME "smb:"
+#else // for Windows and macOS
+#define TDF118990_SCHEME "file:"
+#endif
+
+ASSERT_FORMULA_EQUAL(rDoc, ScAddress(0, 1, 0),
+ "VLOOKUP(B1,'" TDF118990_SCHEME 
"//192.168.1.1/share/lookupsource.xlsx'#$Sheet1.A1:B5,2)",
+ "Wrong Windows share (using host IP) URL in A2");
+
+ASSERT_FORMULA_EQUAL(rDoc, ScAddress(0, 2, 0),
+ "VLOOKUP(B1,'" TDF118990_SCHEME 
"//NETWORKHOST/share/lookupsource.xlsx'#$Sheet1.A1:B5,2)",
+ "Wrong Windows share (using hostname) URL in A3");
+
+xDocSh->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xecontent.cxx 
b/sc/source/filter/excel/xecontent.cxx
index cdc4269f144c..20217b48ef4e 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -459,7 +459,8 @@ OUString XclExpHyperlink::BuildFileName(
 sal_uInt16& rnLevel, bool& rbRel, const OUString& rUrl, const 
XclExpRoot& rRoot, bool bEncoded )
 {
 INetURLObject aURLObject( rUrl );
-OUString aDosName( bEncoded ? aURLObject.GetURLPath() : 
aURLObject.getFSysPath( FSysStyle::Dos ) );
+OUString aDosName(bEncoded ? 
aURLObject.GetMainURL(INetURLObject::DecodeMechanism::ToIUri)
+   : aURLObject.getFSysPath(FSysStyle::Dos));
 rnLevel = 0;
 rbRel = rRoot.IsRelUrl();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-15 Thread Libreoffice Gerrit user
 sc/qa/unit/data/functions/mathematical/fods/mod.fods |8 
 sc/source/core/tool/interpr2.cxx |2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 992242a15c3f6cc6aed55fa2a4177d80d33a7277
Author: Takeshi Abe 
AuthorDate: Thu Jul 26 16:42:31 2018 +0900
Commit: Eike Rathke 
CommitDate: Wed Aug 15 13:11:17 2018 +0200

sc: Report #DIV/0! when MOD()'s divisor is 0

as Excel does [1], while ODF 1.2 does not specify which kind of
error should be assigned for that case.

[1] 
https://support.office.com/en-us/article/mod-function-9b6cd169-b6ee-406a-a97b-edf2a9dc24f3

Change-Id: Id6ebf790ac407f2a8b8769fc0518f136a1271a3d
Reviewed-on: https://gerrit.libreoffice.org/58351
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/mathematical/fods/mod.fods 
b/sc/qa/unit/data/functions/mathematical/fods/mod.fods
index 7148b59df4b7..262f4fff02f9 100644
--- a/sc/qa/unit/data/functions/mathematical/fods/mod.fods
+++ b/sc/qa/unit/data/functions/mathematical/fods/mod.fods
@@ -3220,12 +3220,12 @@
 
 
  
-  Err:502
+  #DIV/0!
  
- 
-  Err502
+ 
+  #DIV/0!
  
- 
+ 
   TRUE
  
  
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index f6560dcb95ab..c185ecfe9223 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -2368,7 +2368,7 @@ void ScInterpreter::ScMod()
 double fDenom   = GetDouble();   // Denominator
 if ( fDenom == 0.0 )
 {
-PushIllegalArgument();
+PushError(FormulaError::DivisionByZero);
 return;
 }
 double fNum = GetDouble();   // Numerator
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-15 Thread Libreoffice Gerrit user
 sc/qa/unit/subsequent_export-test.cxx |5 +++--
 sc/source/filter/html/htmlimp.cxx |2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 1597dbb5ba5d68b5807236c1d045f5215f221c91
Author: Justin Luth 
AuthorDate: Thu Aug 9 15:04:20 2018 +0300
Commit: Eike Rathke 
CommitDate: Wed Aug 15 12:02:07 2018 +0200

tdf#119141 Revert "sc htmlimp: non-global sheet range names"

This reverts commit 5720c85ccea9f1481bd604b806c5be728e59a13f,
which was made in response to the suggestion in
comment 6 of bug 114487 and backported to 6.0.6.

But ScAreaLink::FindExtRange doesn't bother to search the
local rangenames, and the Links to External Files dialog also
doesn't give non-global variables as options.

Since this was just a "logical" change, simply revert it
to repair the regression. Any attempt to support local rangenames
is something bigger that isn't appropriate for backport to stable.

Change-Id: I8bd4dcc6492da2712e13b2e54cf81609cdc5936e
Reviewed-on: https://gerrit.libreoffice.org/58761
Reviewed-by: Justin Luth 
Tested-by: Justin Luth 
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 4f30673e8c28..bb134b0b1d1e 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -3343,9 +3343,10 @@ void ScExportTest::testAbsNamedRangeHTML()
 xDocSh2->DoHardRecalc();
 
 ScDocument& rDoc = xDocSh2->GetDocument();
-ScRangeData* pRangeData = 
rDoc.GetRangeName(0)->findByUpperName(OUString("HTML_1"));
+ScRangeData* pRangeData = 
rDoc.GetRangeName()->findByUpperName(OUString("HTML_1"));
 ScSingleRefData* pRef = 
pRangeData->GetCode()->FirstToken()->GetSingleRef();
-CPPUNIT_ASSERT_MESSAGE("Sheet1.HTML_1 is an absolute 
reference",!pRef->IsTabRel());
+// see tdf#119141 for the reason why this isn't Sheet1.HTML_1
+CPPUNIT_ASSERT_MESSAGE("HTML_1 is an absolute 
reference",!pRef->IsTabRel());
 }
 
 void ScExportTest::testSheetLocalRangeNameXLS()
diff --git a/sc/source/filter/html/htmlimp.cxx 
b/sc/source/filter/html/htmlimp.cxx
index 45b942ab1b98..4957b2d381ad 100644
--- a/sc/source/filter/html/htmlimp.cxx
+++ b/sc/source/filter/html/htmlimp.cxx
@@ -107,7 +107,7 @@ void ScHTMLImport::InsertRangeName( ScDocument* pDoc, const 
OUString& rName, con
 ScTokenArray aTokArray;
 aTokArray.AddDoubleReference( aRefData );
 ScRangeData* pRangeData = new ScRangeData( pDoc, rName, aTokArray );
-pDoc->GetRangeName( rRange.aStart.Tab() )->insert( pRangeData );
+pDoc->GetRangeName()->insert( pRangeData );
 }
 
 void ScHTMLImport::WriteToDocument(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-13 Thread Libreoffice Gerrit user
 sc/qa/unit/data/xls/pass/ooo47086-1.xls |binary
 sc/source/core/tool/compiler.cxx|2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 85f141b533b9b778971ddf755d93df09f92d495d
Author: Caolán McNamara 
AuthorDate: Sat Aug 11 20:27:09 2018 +0100
Commit: Caolán McNamara 
CommitDate: Mon Aug 13 09:44:57 2018 +0200

crashtesting: load of ooo47086-1.xls

presumably since...

commit df1d4bd528027c60bcab2f2e0a87303610fad326
Date:   Sat Aug 4 20:10:55 2018 +0200

ScCompiler::IsString, pass down the string length if we know it

reading the old code, it looks it would have returned true
for this case of input of a bare " but change this to return false
as that doesn't seem quite right for this case

Change-Id: Id54ffe6440bb842d8103174edd6b99940ca5d142
Reviewed-on: https://gerrit.libreoffice.org/58889
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/qa/unit/data/xls/pass/ooo47086-1.xls 
b/sc/qa/unit/data/xls/pass/ooo47086-1.xls
new file mode 100644
index ..eb5b0a628482
Binary files /dev/null and b/sc/qa/unit/data/xls/pass/ooo47086-1.xls differ
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index d0849f8e1bf7..39a70965e205 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3002,7 +3002,7 @@ bool ScCompiler::IsString()
 while ( *p )
 p++;
 sal_Int32 nLen = sal::static_int_cast( p - cSymbol - 1 );
-if (cSymbol[nLen] != '"')
+if (!nLen || cSymbol[nLen] != '"')
 return false;
 svl::SharedString aSS = 
pDoc->GetSharedStringPool().intern(OUString(cSymbol+1, nLen-1));
 maRawToken.SetString(aSS.getData(), aSS.getDataIgnoreCase());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-10 Thread Libreoffice Gerrit user
 sc/qa/unit/data/xlsx/tdf41425.xlsx|binary
 sc/qa/unit/subsequent_export-test.cxx |   15 +++
 sc/source/filter/excel/xetable.cxx|3 +++
 3 files changed, 18 insertions(+)

New commits:
commit 99b9ea63bfc9a5fe63a0cd7b30b66ce2c1bde08e
Author: László Németh 
AuthorDate: Fri Aug 3 16:11:16 2018 +0200
Commit: László Németh 
CommitDate: Fri Aug 10 09:23:17 2018 +0200

tdf#41425 XLS/XLSX export: workaround for style and validation loss

of cells of blank rows.

This workaround is probably a fix for problems of most users, but for
a full solution it needs to extend the workaround for all rows with not
default settings, also avoiding of the possible performance problems.

Note: the number 1000 of the extra rows came from a similar workaround used 
in
XLSX export of Google Spreadsheets, but instead of listing extra empty 1000
rows in OOXML, this fix writes only the cells with not default settings from
the extra 1000 blank rows.

Change-Id: Icac9441b7eb1520dcd20fc04337e070d070591c7
Reviewed-on: https://gerrit.libreoffice.org/58575
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sc/qa/unit/data/xlsx/tdf41425.xlsx 
b/sc/qa/unit/data/xlsx/tdf41425.xlsx
new file mode 100644
index ..f7d3ec9ed6ec
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf41425.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 1b4f353fb2dd..4f30673e8c28 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -209,6 +209,7 @@ public:
 void testHiddenRepeatedRowsODS();
 void testHyperlinkTargetFrameODS();
 void testOpenDocumentAsReadOnly();
+void testKeepSettingsOfBlankRows();
 
 CPPUNIT_TEST_SUITE(ScExportTest);
 CPPUNIT_TEST(test);
@@ -317,6 +318,7 @@ public:
 CPPUNIT_TEST(testHiddenRepeatedRowsODS);
 CPPUNIT_TEST(testHyperlinkTargetFrameODS);
 CPPUNIT_TEST(testOpenDocumentAsReadOnly);
+CPPUNIT_TEST(testKeepSettingsOfBlankRows);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -4048,6 +4050,19 @@ void ScExportTest::testOpenDocumentAsReadOnly()
 xDocSh2->DoClose();
 }
 
+void ScExportTest::testKeepSettingsOfBlankRows()
+{
+ScDocShellRef xDocSh = loadDoc("tdf41425.", FORMAT_XLSX);
+CPPUNIT_ASSERT(xDocSh.is());
+
+std::shared_ptr pXPathFile = 
ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"xl/worksheets/sheet1.xml");
+CPPUNIT_ASSERT(pSheet);
+
+// saved blank row with not default setting in A2
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row", 2);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index b68b094d0660..9f777e4c8f35 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -2455,6 +2455,9 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot 
) :
 if(nLastUsedScCol > nMaxScCol)
 nLastUsedScCol = nMaxScCol;
 
+// check extra blank rows to avoid of losing their not default settings 
(workaround for tdf#41425)
+nLastUsedScRow += 1000;
+
 if(nLastUsedScRow > nMaxScRow)
 nLastUsedScRow = nMaxScRow;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-06 Thread Libreoffice Gerrit user
 sc/qa/unit/datatransformation_test.cxx   |  322 ++
 sc/source/ui/dataprovider/datatransformation.cxx |  526 ++-
 sc/source/ui/inc/datatransformation.hxx  |   20 
 3 files changed, 866 insertions(+), 2 deletions(-)

New commits:
commit 38ec31b6ff7341f7c1b050ba650798b35f13e52c
Author: Vikas Mahato 
AuthorDate: Fri Jul 27 07:26:48 2018 +0530
Commit: Markus Mohrhard 
CommitDate: Mon Aug 6 17:48:42 2018 +0200

Added date and time transformations

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

diff --git a/sc/qa/unit/datatransformation_test.cxx 
b/sc/qa/unit/datatransformation_test.cxx
index 06d82181657c..97a8e49c79d8 100644
--- a/sc/qa/unit/datatransformation_test.cxx
+++ b/sc/qa/unit/datatransformation_test.cxx
@@ -52,6 +52,24 @@ public:
 void testNumberOdd();
 void testNumberSign();
 void testReplaceNull();
+void testGetDateString();
+void testGetYear();
+void testGetStartOfYear();
+void testGetEndOfYear();
+void testGetMonth();
+void testGetMonthName();
+void testGetStartOfMonth();
+void testGetEndOfMonth();
+void testGetDay();
+void testGetDayOfWeek();
+void testGetDayOfYear();
+void testGetQuarter();
+void testGetStartOfQuarter();
+void testGetEndOfQuarter();
+void testGetTime();
+void testGetHour();
+void testGetMinute();
+void testGetSecond();
 
 CPPUNIT_TEST_SUITE(ScDataTransformationTest);
 CPPUNIT_TEST(testColumnRemove);
@@ -78,6 +96,24 @@ public:
 CPPUNIT_TEST(testNumberOdd);
 CPPUNIT_TEST(testNumberSign);
 CPPUNIT_TEST(testReplaceNull);
+CPPUNIT_TEST(testGetDateString);
+CPPUNIT_TEST(testGetYear);
+CPPUNIT_TEST(testGetStartOfYear);
+CPPUNIT_TEST(testGetEndOfYear);
+CPPUNIT_TEST(testGetMonth);
+CPPUNIT_TEST(testGetMonthName);
+CPPUNIT_TEST(testGetStartOfMonth);
+CPPUNIT_TEST(testGetEndOfMonth);
+CPPUNIT_TEST(testGetDay);
+CPPUNIT_TEST(testGetDayOfWeek);
+CPPUNIT_TEST(testGetDayOfYear);
+CPPUNIT_TEST(testGetQuarter);
+CPPUNIT_TEST(testGetStartOfQuarter);
+CPPUNIT_TEST(testGetEndOfQuarter);
+CPPUNIT_TEST(testGetTime);
+CPPUNIT_TEST(testGetHour);
+CPPUNIT_TEST(testGetMinute);
+CPPUNIT_TEST(testGetSecond);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -505,6 +541,292 @@ void ScDataTransformationTest::testReplaceNull()
 
 }
 
+void ScDataTransformationTest::testGetDateString()
+{
+m_pDoc->SetValue(2, 0, 0, 43248.5624189815);
+m_pDoc->SetValue(2, 1, 0, 42941.5624189815);
+m_pDoc->SetValue(2, 2, 0, 42518.5624189815);
+
+sc:: DateTimeTransformation aTransform({2}, 
sc::DATETIME_TRANSFORMATION_TYPE::DATE_STRING   );
+aTransform.Transform(*m_pDoc);
+
+CPPUNIT_ASSERT_EQUAL(OUString("05/28/18"), m_pDoc->GetString(2, 0, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("07/25/17"), m_pDoc->GetString(2, 1, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("05/28/16"), m_pDoc->GetString(2, 2, 0));
+}
+
+void ScDataTransformationTest::testGetYear()
+{
+m_pDoc->SetValue(2, 0, 0, 20);
+m_pDoc->SetValue(2, 1, 0, 3342.44);
+m_pDoc->SetValue(2, 2, 0, 955.05);
+m_pDoc->SetValue(2, 3, 0, 4890.22);
+
+sc:: DateTimeTransformation aTransform({2}, 
sc::DATETIME_TRANSFORMATION_TYPE::YEAR   );
+aTransform.Transform(*m_pDoc);
+
+CPPUNIT_ASSERT_DOUBLES_EQUAL(1900, m_pDoc->GetValue(2, 0, 0), 0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(1909, m_pDoc->GetValue(2, 1, 0), 0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(1902, m_pDoc->GetValue(2, 2, 0), 0);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(1913, m_pDoc->GetValue(2, 3, 0), 0);
+}
+
+void ScDataTransformationTest::testGetStartOfYear()
+{
+m_pDoc->SetValue(2, 0, 0, 43248.5624189815);
+m_pDoc->SetValue(2, 1, 0, 42941.5624189815);
+m_pDoc->SetValue(2, 2, 0, 42518.5624189815);
+m_pDoc->SetValue(2, 3, 0, 44217.5624189815);
+
+sc:: DateTimeTransformation aTransform({2}, 
sc::DATETIME_TRANSFORMATION_TYPE::START_OF_YEAR   );
+aTransform.Transform(*m_pDoc);
+
+CPPUNIT_ASSERT_EQUAL(OUString("01/01/18"), m_pDoc->GetString(2, 0, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("01/01/17"), m_pDoc->GetString(2, 1, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("01/01/16"), m_pDoc->GetString(2, 2, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("01/01/21"), m_pDoc->GetString(2, 3, 0));
+}
+
+void ScDataTransformationTest::testGetEndOfYear()
+{
+m_pDoc->SetValue(2, 0, 0, 43248.5624189815);
+m_pDoc->SetValue(2, 1, 0, 42941.5624189815);
+m_pDoc->SetValue(2, 2, 0, 42518.5624189815);
+m_pDoc->SetValue(2, 3, 0, 44217.5624189815);
+
+sc:: DateTimeTransformation aTransform({2}, 
sc::DATETIME_TRANSFORMATION_TYPE::END_OF_YEAR   );
+aTransform.Transform(*m_pDoc);
+
+CPPUNIT_ASSERT_EQUAL(OUString("12/31/18"), m_pDoc->GetString(2, 0, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("12/31/17"), m_pDoc->GetString(2, 1, 

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

2018-08-03 Thread Libreoffice Gerrit user
 sc/qa/uitest/statistics/data/regression.ods |binary
 sc/qa/uitest/statistics/regression.py   |   18 -
 sc/source/ui/StatisticsDialogs/RegressionDialog.cxx |   21 +---
 sc/source/ui/inc/RegressionDialog.hxx   |2 +
 sc/uiconfig/scalc/ui/regressiondialog.ui|   12 ++-
 5 files changed, 40 insertions(+), 13 deletions(-)

New commits:
commit 2ffe228264caa77b18c3bea56823f000b2d01a7e
Author: Dennis Francis 
AuthorDate: Wed Aug 1 17:59:23 2018 +0530
Commit: Dennis Francis 
CommitDate: Fri Aug 3 19:12:36 2018 +0200

Allow forcing of intercept to zero in regression dialog

Change-Id: I3958c139141a9e717256a638d319e0bb5879e6a4
Reviewed-on: https://gerrit.libreoffice.org/58565
Tested-by: Jenkins
Reviewed-by: Dennis Francis 

diff --git a/sc/qa/uitest/statistics/data/regression.ods 
b/sc/qa/uitest/statistics/data/regression.ods
index f9f65bfda0f5..1c8b72cc912b 100644
Binary files a/sc/qa/uitest/statistics/data/regression.ods and 
b/sc/qa/uitest/statistics/data/regression.ods differ
diff --git a/sc/qa/uitest/statistics/regression.py 
b/sc/qa/uitest/statistics/regression.py
index ccf1258a776e..6f5fd2ca0e27 100644
--- a/sc/qa/uitest/statistics/regression.py
+++ b/sc/qa/uitest/statistics/regression.py
@@ -31,17 +31,18 @@ class regression(UITestCase):
 document = self.ui_test.get_component()
 
 # Initially the final check status is "FALSE" (failed).
-self.assertEqual(get_cell_by_position(document, 11, 1, 5).getString(), 
"FALSE",
+self.assertEqual(get_cell_by_position(document, 14, 1, 6).getString(), 
"FALSE",
  "Check status must be FALSE before the test")
-self._do_regression(regression_type = "LINEAR", data_groupedby_column 
= data_groupedby_column)
+self._do_regression(regression_type = "LINEAR", data_groupedby_column 
= data_groupedby_column, calc_intercept = True)
+self._do_regression(regression_type = "LINEAR", data_groupedby_column 
= data_groupedby_column, calc_intercept = False)
 self._do_regression(regression_type = "LOG", data_groupedby_column = 
data_groupedby_column)
 self._do_regression(regression_type = "POWER", data_groupedby_column = 
data_groupedby_column)
-self.assertEqual(get_cell_by_position(document, 11, 1, 5).getString(), 
"TRUE",
+self.assertEqual(get_cell_by_position(document, 14, 1, 6).getString(), 
"TRUE",
  "One of more of the checks failed for 
data_groupedby_column = {}, manually try with the document".
  format(data_groupedby_column))
 self.ui_test.close_doc()
 
-def _do_regression(self, regression_type, data_groupedby_column = True):
+def _do_regression(self, regression_type, data_groupedby_column = True, 
calc_intercept = True):
 assert(regression_type == "LINEAR" or regression_type == "LOG" or 
regression_type == "POWER")
 
self.ui_test.execute_modeless_dialog_through_command(".uno:RegressionDialog")
 xDialog = self.xUITest.getTopFocusWindow()
@@ -54,6 +55,7 @@ class regression(UITestCase):
 xlinearradio = xDialog.getChild("linear-radio")
 xlogarithmicradio = xDialog.getChild("logarithmic-radio")
 xpowerradio = xDialog.getChild("power-radio")
+xnointerceptcheck = xDialog.getChild("nointercept-check")
 
 ## Set the X, Y and output ranges
 xvariable1rangeedit.executeAction("FOCUS", tuple()) # Without this the 
range parser does not kick in somehow
@@ -79,7 +81,10 @@ class regression(UITestCase):
 xoutputrangeedit.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
 xoutputrangeedit.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
 if regression_type == "LINEAR":
-xoutputrangeedit.executeAction("TYPE", 
mkPropertyValues({"TEXT":"$ActualLinear.$A$1"}))
+if calc_intercept:
+xoutputrangeedit.executeAction("TYPE", 
mkPropertyValues({"TEXT":"$ActualLinear.$A$1"}))
+else:
+xoutputrangeedit.executeAction("TYPE", 
mkPropertyValues({"TEXT":"$ActualLinearNoIntercept.$A$1"}))
 elif regression_type == "LOG":
 xoutputrangeedit.executeAction("TYPE", 
mkPropertyValues({"TEXT":"$ActualLog.$A$1"}))
 else:
@@ -97,6 +102,9 @@ class regression(UITestCase):
 else:
 xpowerradio.executeAction("CLICK", tuple())
 
+if not calc_intercept:
+xnointerceptcheck.executeAction("CLICK", tuple())
+
 xOKBtn = xDialog.getChild("ok")
 self.ui_test.close_dialog_through_button(xOKBtn)
 
diff --git a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx 
b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx
index b3e744cdf71d..5cc45f1cee4a 100644
--- a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx
@@ -116,9 

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

2018-08-01 Thread Libreoffice Gerrit user
 sc/qa/extras/macros-test.cxx   |1 +
 sc/qa/unit/helper/qahelper.cxx |1 +
 sc/source/core/data/attarray.cxx   |1 +
 sc/source/core/data/attrib.cxx |1 +
 sc/source/core/data/bcaslot.cxx|1 +
 sc/source/core/data/column4.cxx|1 +
 sc/source/core/data/conditio.cxx   |1 +
 sc/source/core/data/documen2.cxx   |1 +
 sc/source/core/data/documen4.cxx   |1 +
 sc/source/core/data/documen7.cxx   |1 +
 sc/source/core/data/documen8.cxx   |1 +
 sc/source/core/data/document.cxx   |1 +
 sc/source/core/data/document10.cxx |1 +
 sc/source/core/data/dpresfilter.cxx|1 +
 sc/source/core/data/dpsave.cxx |1 +
 sc/source/core/data/dptabres.cxx   |1 +
 sc/source/core/data/dptabsrc.cxx   |1 +
 sc/source/core/data/formulacell.cxx|1 +
 sc/source/core/data/global2.cxx|1 +
 sc/source/core/data/postit.cxx |1 +
 sc/source/core/data/segmenttree.cxx|1 +
 sc/source/core/data/table3.cxx |1 +
 sc/source/core/data/table6.cxx |1 +
 sc/source/core/opencl/formulagroupcl.cxx   |1 +
 sc/source/core/opencl/opbase.cxx   |1 +
 sc/source/core/tool/addincfg.cxx   |2 ++
 sc/source/core/tool/addincol.cxx   |1 +
 sc/source/core/tool/address.cxx|1 +
 sc/source/core/tool/calcconfig.cxx |1 +
 sc/source/core/tool/compiler.cxx   |1 +
 sc/source/core/tool/dbdata.cxx |1 +
 sc/source/core/tool/formulagroup.cxx   |1 +
 sc/source/core/tool/formulaopt.cxx |1 +
 sc/source/core/tool/formularesult.cxx  |2 ++
 sc/source/core/tool/grouparealistener.cxx  |2 ++
 sc/source/core/tool/interpr1.cxx   |1 +
 sc/source/core/tool/interpr8.cxx   |1 +
 sc/source/core/tool/lookupcache.cxx|2 ++
 sc/source/core/tool/parclass.cxx   |1 +
 sc/source/core/tool/rangelst.cxx   |1 +
 sc/source/core/tool/scmatrix.cxx   |1 +
 sc/source/core/tool/token.cxx  |1 +
 sc/source/filter/excel/excform.cxx |1 +
 sc/source/filter/excel/excrecds.cxx|1 +
 sc/source/filter/excel/impop.cxx   |1 +
 sc/source/filter/excel/tokstack.cxx|1 +
 sc/source/filter/excel/xecontent.cxx   |1 +
 sc/source/filter/excel/xeformula.cxx   |1 +
 sc/source/filter/excel/xelink.cxx  |1 +
 sc/source/filter/excel/xeroot.cxx  |1 +
 sc/source/filter/excel/xichart.cxx |1 +
 sc/source/filter/excel/xicontent.cxx   |1 +
 sc/source/filter/excel/xiescher.cxx|1 +
 sc/source/filter/excel/xihelper.cxx|1 +
 sc/source/filter/excel/xilink.cxx  |1 +
 sc/source/filter/excel/xipivot.cxx |1 +
 sc/source/filter/excel/xistream.cxx|1 +
 sc/source/filter/excel/xistring.cxx|1 +
 sc/source/filter/excel/xistyle.cxx |1 +
 sc/source/filter/excel/xlpivot.cxx |1 +
 sc/source/filter/excel/xlroot.cxx  |1 +
 sc/source/filter/excel/xlstyle.cxx |1 +
 sc/source/filter/excel/xltoolbar.cxx   |1 +
 sc/source/filter/excel/xltools.cxx |1 +
 sc/source/filter/ftools/fapihelper.cxx |1 +
 sc/source/filter/lotus/lotattr.cxx |1 +
 sc/source/filter/lotus/lotform.cxx |1 +
 sc/source/filter/lotus/lotimpop.cxx|1 +
 sc/source/filter/lotus/lotread.cxx |2 ++
 sc/source/filter/lotus/tool.cxx|1 +
 sc/source/filter/oox/condformatbuffer.cxx  |1 +
 sc/source/filter/oox/excelfilter.cxx   |1 +
 sc/source/filter/oox/externallinkbuffer.cxx|1 +
 sc/source/filter/oox/extlstcontext.cxx |1 +
 sc/source/filter/oox/formulabuffer.cxx |1 +
 sc/source/filter/oox/formulaparser.cxx |1 +
 sc/source/filter/oox/pivotcachebuffer.cxx

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

2018-07-27 Thread Libreoffice Gerrit user
 sc/qa/unit/datatransformation_test.cxx   |   19 
 sc/source/ui/dataprovider/datatransformation.cxx |   49 +++
 sc/source/ui/inc/datatransformation.hxx  |   16 +++
 3 files changed, 83 insertions(+), 1 deletion(-)

New commits:
commit 0c350906b1d6dc27383619dd3338fe28768f1c2e
Author: Vikas 
AuthorDate: Tue Jul 24 21:36:07 2018 +0530
Commit: Markus Mohrhard 
CommitDate: Sat Jul 28 01:04:24 2018 +0200

Added ReplaceNullTransformation

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

diff --git a/sc/qa/unit/datatransformation_test.cxx 
b/sc/qa/unit/datatransformation_test.cxx
index 00b6b69d4946..06d82181657c 100644
--- a/sc/qa/unit/datatransformation_test.cxx
+++ b/sc/qa/unit/datatransformation_test.cxx
@@ -51,6 +51,7 @@ public:
 void testNumberEven();
 void testNumberOdd();
 void testNumberSign();
+void testReplaceNull();
 
 CPPUNIT_TEST_SUITE(ScDataTransformationTest);
 CPPUNIT_TEST(testColumnRemove);
@@ -76,6 +77,7 @@ public:
 CPPUNIT_TEST(testNumberEven);
 CPPUNIT_TEST(testNumberOdd);
 CPPUNIT_TEST(testNumberSign);
+CPPUNIT_TEST(testReplaceNull);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -486,6 +488,23 @@ void ScDataTransformationTest::testNumberSign()
 CPPUNIT_ASSERT_EQUAL(-1.0, m_pDoc->GetValue(2, 3, 0));
 }
 
+void ScDataTransformationTest::testReplaceNull()
+{
+m_pDoc->SetString(2, 0, 0, "Berlin");
+m_pDoc->SetString(2, 1, 0, "");
+m_pDoc->SetString(2, 2, 0, "");
+m_pDoc->SetString(2, 3, 0, "Peking");
+
+sc::ReplaceNullTransformation aTransform({2}, "Empty");
+aTransform.Transform(*m_pDoc);
+
+CPPUNIT_ASSERT_EQUAL(OUString("Berlin"), m_pDoc->GetString(2, 0, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("Empty"), m_pDoc->GetString(2, 1, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("Empty"), m_pDoc->GetString(2, 2, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("Peking"), m_pDoc->GetString(2, 3, 0));
+
+}
+
 ScDataTransformationTest::ScDataTransformationTest() :
 ScBootstrapFixture( "sc/qa/unit/data/dataprovider" ),
 m_pDoc(nullptr)
diff --git a/sc/source/ui/dataprovider/datatransformation.cxx 
b/sc/source/ui/dataprovider/datatransformation.cxx
index 53d6745cb689..9efe3ed447e9 100644
--- a/sc/source/ui/dataprovider/datatransformation.cxx
+++ b/sc/source/ui/dataprovider/datatransformation.cxx
@@ -648,6 +648,55 @@ std::set NumberTransformation::getColumn() const
 {
 return mnCol;
 }
+
+ReplaceNullTransformation::ReplaceNullTransformation(const std::set 
nCol, const OUString sReplaceWith):
+mnCol(nCol),
+msReplaceWith(sReplaceWith)
+{
+}
+
+void ReplaceNullTransformation::Transform(ScDocument& rDoc) const
+{
+if (mnCol.empty())
+return;
+
+SCROW nEndRow = 0;
+for(auto& rCol : mnCol)
+{
+nEndRow = getLastRow(rDoc, rCol);
+}
+
+for(auto& rCol : mnCol)
+{
+for (SCROW nRow = 0; nRow < nEndRow; ++nRow)
+{
+CellType eType;
+rDoc.GetCellType(rCol, nRow, 0, eType);
+if (eType == CELLTYPE_NONE)
+{
+   // OUString aStr = rDoc.GetString(rCol, nRow, 0);
+   // if (aStr == "" || aStr.isEmpty())
+rDoc.SetString(rCol, nRow, 0, msReplaceWith);
+}
+}
+}
+
+}
+
+std::set ReplaceNullTransformation::getColumn() const
+{
+return mnCol;
+}
+
+OUString ReplaceNullTransformation::getReplaceString() const
+{
+return msReplaceWith;
+}
+
+TransformationType ReplaceNullTransformation::getTransformationType() const
+{
+ return TransformationType::REMOVE_NULL_TRANSFORMATION;
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/datatransformation.hxx 
b/sc/source/ui/inc/datatransformation.hxx
index 0096e0c5a623..48651699a4ef 100644
--- a/sc/source/ui/inc/datatransformation.hxx
+++ b/sc/source/ui/inc/datatransformation.hxx
@@ -29,7 +29,8 @@ enum class TransformationType
 SORT_TRANSFORMATION,
 TEXT_TRANSFORMATION,
 AGGREGATE_FUNCTION,
-NUMBER_TRANSFORMATION
+NUMBER_TRANSFORMATION,
+REMOVE_NULL_TRANSFORMATION
 };
 
 enum class TEXT_TRANSFORM_TYPE { TO_LOWER, TO_UPPER, CAPITALIZE, TRIM };
@@ -148,6 +149,19 @@ class SC_DLLPUBLIC NumberTransformation : public 
DataTransformation
 std::set getColumn() const;
 };
 
+class SC_DLLPUBLIC ReplaceNullTransformation : public DataTransformation
+{
+std::set mnCol;
+OUString msReplaceWith;
+
+public:
+ReplaceNullTransformation(const std::set nCol, const OUString 
sReplaceWith);
+virtual void Transform(ScDocument& rDoc) const override;
+virtual TransformationType getTransformationType() const override;
+std::set getColumn() const;
+OUString getReplaceString() const;
+};
+
 }
 
 #endif
___
Libreoffice-commits mailing list

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

2018-07-25 Thread Libreoffice Gerrit user
 sc/qa/unit/data/functions/statistical/fods/confidence.t.fods |8 
 sc/source/core/tool/interpr3.cxx |2 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit f30afe009e9e9da32dfc0aa1490d1f7ce787d101
Author: Takeshi Abe 
AuthorDate: Thu Jul 12 18:02:54 2018 +0900
Commit: Eike Rathke 
CommitDate: Thu Jul 26 02:00:14 2018 +0200

sc: Make CONFIDENCE.T() raise #DIV/0! when size is 1

... for interoperability with Excel, as remarked in

.

Change-Id: I2d24573055455fa014c38f6e5985e3501ed6ba6e
Reviewed-on: https://gerrit.libreoffice.org/57322
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/statistical/fods/confidence.t.fods 
b/sc/qa/unit/data/functions/statistical/fods/confidence.t.fods
index b1131857129a..fd8cf4491c28 100644
--- a/sc/qa/unit/data/functions/statistical/fods/confidence.t.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/confidence.t.fods
@@ -3016,12 +3016,12 @@
 
 
  
-  Err:523
+  #DIV/0!
  
- 
-  Err:523
+ 
+  #DIV/0!
  
- 
+ 
   TRUE
  
  
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 78756b0810e8..689ea4e4de59 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -2434,6 +2434,8 @@ void ScInterpreter::ScConfidenceT()
 double alpha = GetDouble();
 if (sigma <= 0.0 || alpha <= 0.0 || alpha >= 1.0 || n < 1.0)
 PushIllegalArgument();
+else if (n == 1.0) // for interoperability with Excel
+PushError(FormulaError::DivisionByZero);
 else
 PushDouble( sigma * GetTInv( alpha, n - 1, 2 ) / sqrt( n ) );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-21 Thread Libreoffice Gerrit user
 sc/qa/unit/subsequent_export-test.cxx |2 +-
 sc/source/filter/excel/xestyle.cxx|   11 ---
 2 files changed, 9 insertions(+), 4 deletions(-)

New commits:
commit fa881095bc62c3646406c82a98d8503377288a54
Author: Markus Mohrhard 
AuthorDate: Sat Jul 21 23:16:19 2018 +0200
Commit: Markus Mohrhard 
CommitDate: Sun Jul 22 04:18:04 2018 +0200

tdf#98074, using the same builtinId maps the styles to the same one

Additionally, using customBuiltin for all styles is a bad idea as well.

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

diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index f6e151390a5e..1b4f353fb2dd 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -3926,7 +3926,7 @@ void ScExportTest::testNatNumInNumberFormatXLSX()
 xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, 
"xl/styles.xml", FORMAT_XLSX);
 CPPUNIT_ASSERT(pDoc);
 
-assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", 
"[DBNum2][$-804]General;[RED][DBNum2][$-804]General");
+assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[3]", "formatCode", 
"[DBNum2][$-804]General;[RED][DBNum2][$-804]General");
 
 xDocSh->DoClose();
 }
diff --git a/sc/source/filter/excel/xestyle.cxx 
b/sc/source/filter/excel/xestyle.cxx
index a36f75e8921b..0805149cd7a3 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -2342,13 +2342,19 @@ static const char* lcl_StyleNameFromId( sal_Int32 
nStyleId )
 
 void XclExpStyle::SaveXml( XclExpXmlStream& rStrm )
 {
+constexpr sal_Int32 CELL_STYLE_MAX_BUILTIN_ID = 54;
 OString sName;
+OString sBuiltinId;
+const char* pBuiltinId = nullptr;
 if( IsBuiltIn() )
 {
 sName = OString( lcl_StyleNameFromId( mnStyleId ) );
+sBuiltinId = OString::number( std::min( static_cast( 
CELL_STYLE_MAX_BUILTIN_ID - 1 ), static_cast ( mnStyleId ) ) );
+pBuiltinId = sBuiltinId.getStr();
 }
 else
 sName = XclXmlUtils::ToOString( maName );
+
 // get the index in sortedlist associated with the mnXId
 sal_Int32 nXFId = rStrm.GetRoot().GetXFBuffer().GetXFIndex( maXFId.mnXFId 
);
 // get the style index associated with index into sortedlist
@@ -2357,11 +2363,10 @@ void XclExpStyle::SaveXml( XclExpXmlStream& rStrm )
 XML_name,   sName.getStr(),
 XML_xfId,   OString::number( nXFId ).getStr(),
 // builtinId of 54 or above is invalid according to OpenXML SDK validator.
-#define CELL_STYLE_MAX_BUILTIN_ID 54
- XML_builtinId, OString::number( 
std::min( static_cast( CELL_STYLE_MAX_BUILTIN_ID - 1 ), static_cast 
( mnStyleId ) ) ).getStr(),
+XML_builtinId, pBuiltinId,
 // OOXTODO: XML_iLevel,
 // OOXTODO: XML_hidden,
-XML_customBuiltin,  ToPsz( ! IsBuiltIn() ),
+// XML_customBuiltin,  ToPsz( ! IsBuiltIn() ),
 FSEND );
 // OOXTODO: XML_extLst
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-19 Thread Libreoffice Gerrit user
 sc/qa/unit/data/functions/date_time/fods/hour.fods   |   31 ++-
 sc/qa/unit/data/functions/date_time/fods/minute.fods |   26 ++-
 sc/qa/unit/data/functions/date_time/fods/second.fods |   26 ++-
 sc/source/core/tool/interpr2.cxx |6 +--
 4 files changed, 74 insertions(+), 15 deletions(-)

New commits:
commit c69e7266916ac1b8917477fb4eccdb9098da5792
Author: Winfried Donkers 
AuthorDate: Thu Jul 19 12:05:14 2018 +0200
Commit: Eike Rathke 
CommitDate: Thu Jul 19 14:01:30 2018 +0200

tdf#118800 fix rounding error in Calc function HOUR, MINUTE, SECOND.

Change-Id: I7a875b172493112b66fca8f70d2061371a05486c
Reviewed-on: https://gerrit.libreoffice.org/57721
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/date_time/fods/hour.fods 
b/sc/qa/unit/data/functions/date_time/fods/hour.fods
index 847632a9750a..bb5abc52ab4e 100644
--- a/sc/qa/unit/data/functions/date_time/fods/hour.fods
+++ b/sc/qa/unit/data/functions/date_time/fods/hour.fods
@@ -154,8 +154,8 @@ Function basISODateTime(dVal#)
basISODateTime = 
format(year(dt),)- 
format(Month(dt),00)- 
format(day(dt),00)  
format(Hour(dt),00): 
format(Minute(dt),00): 
format(Second(dt),00)
 End Function
 
-  
-  
+
+
   
  
 
@@ -1755,11 +1755,26 @@ End Function
  
 
 
- 
- 
- 
- 
- 
+ 
+  10
+ 
+ 
+  10
+ 
+ 
+  TRUE
+ 
+ 
+  =HOUR(J10)
+ 
+ 
+  tdf11880
+ 
+ 
+ 
+  10:59:59.60
+ 
+ 
 
 
  
@@ -2432,4 +2447,4 @@ End Function

   
  
-
\ No newline at end of file
+
diff --git a/sc/qa/unit/data/functions/date_time/fods/minute.fods 
b/sc/qa/unit/data/functions/date_time/fods/minute.fods
index d27ec1ef5031..69fba0187454 100644
--- a/sc/qa/unit/data/functions/date_time/fods/minute.fods
+++ b/sc/qa/unit/data/functions/date_time/fods/minute.fods
@@ -896,7 +896,29 @@
  
  
 
-
+
+ 
+  11
+ 
+ 
+  11
+ 
+ 
+  TRUE
+ 
+ 
+  =MINUTE(J9)
+ 
+ 
+  tdf11880
+ 
+ 
+ 
+  10:11:59.60
+ 
+ 
+
+
  
  
  
@@ -1105,4 +1127,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/qa/unit/data/functions/date_time/fods/second.fods 
b/sc/qa/unit/data/functions/date_time/fods/second.fods
index e6d2b46946e5..8db288ae3ae9 100644
--- a/sc/qa/unit/data/functions/date_time/fods/second.fods
+++ b/sc/qa/unit/data/functions/date_time/fods/second.fods
@@ -825,7 +825,29 @@
  
  
 
-
+
+ 
+  12
+ 
+ 
+  12
+ 
+ 
+  TRUE
+ 
+ 
+  =SECOND(J9)
+ 
+ 
+  tdf11880
+ 
+ 
+ 
+  10:11:12.60
+ 
+ 
+
+
  
  
  
@@ -1034,4 +1056,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 299fecb359f3..e055324fa679 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -146,7 +146,7 @@ void ScInterpreter::ScGetMin()
 {
 double fTime = GetDouble();
 fTime -= ::rtl::math::approxFloor(fTime);   // date part absent
-long nVal = 
static_cast(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5)) % 
::tools::Time::secondPerHour;
+long nVal = 
static_cast(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR)) % 
::tools::Time::secondPerHour;
 PushDouble( static_cast(nVal / ::tools::Time::secondPerMinute) );
 }
 
@@ -154,7 +154,7 @@ void ScInterpreter::ScGetSec()
 {
 double fTime = GetDouble();
 fTime -= ::rtl::math::approxFloor(fTime);   // date part absent
-long nVal = 
static_cast(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5)) % 
::tools::Time::secondPerMinute;
+long nVal = 
static_cast(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR)) % 
::tools::Time::secondPerMinute;
 PushDouble( static_cast(nVal) );
 }
 
@@ -162,7 +162,7 @@ void ScInterpreter::ScGetHour()
 {
 double fTime = GetDouble();
 fTime -= ::rtl::math::approxFloor(fTime);   // date part absent
-long nVal = 
static_cast(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5)) / 
::tools::Time::secondPerHour;
+long nVal = 
static_cast(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR)) / 
::tools::Time::secondPerHour;
 PushDouble(static_cast(nVal));
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-15 Thread Libreoffice Gerrit user
 sc/qa/unit/data/contentCSV/new_cond_format_test_sheet2.csv |2 +-
 sc/source/filter/excel/xestyle.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 0f0466c6498287c3eb790136655ac65f501b9f0f
Author: Markus Mohrhard 
AuthorDate: Sun Jul 15 00:35:21 2018 +0200
Commit: Markus Mohrhard 
CommitDate: Sun Jul 15 23:58:19 2018 +0200

related tdf#117816, the dxf ID is a global and not a sheet property

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

diff --git a/sc/qa/unit/data/contentCSV/new_cond_format_test_sheet2.csv 
b/sc/qa/unit/data/contentCSV/new_cond_format_test_sheet2.csv
index b35f4e58e25b..9bbdfede11ac 100644
--- a/sc/qa/unit/data/contentCSV/new_cond_format_test_sheet2.csv
+++ b/sc/qa/unit/data/contentCSV/new_cond_format_test_sheet2.csv
@@ -1,3 +1,3 @@
 2.00,2
-1,1.00
+1,1.000
 4.00,3
diff --git a/sc/source/filter/excel/xestyle.cxx 
b/sc/source/filter/excel/xestyle.cxx
index 050eaa850c30..ca0db5c3e42f 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -2981,12 +2981,12 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
 xFormatter->FillKeywordTableForExcel( *mpKeywordTable );
 
 SCTAB nTables = rRoot.GetDoc().GetTableCount();
+sal_Int32 nIndex = 0;
 for(SCTAB nTab = 0; nTab < nTables; ++nTab)
 {
 ScConditionalFormatList* pList = rRoot.GetDoc().GetCondFormList(nTab);
 if (pList)
 {
-sal_Int32 nIndex = 0;
 for (ScConditionalFormatList::const_iterator itr = pList->begin();
 itr != pList->end(); ++itr)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/qa sc/source sc/uiconfig sc/UIConfig_scalc.mk

2018-07-11 Thread Manuj Vashist
 sc/UIConfig_scalc.mk  |1 
 sc/qa/unit/datatransformation_test.cxx|   24 -
 sc/source/ui/dataprovider/datatransformation.cxx  |  313 +++---
 sc/source/ui/inc/dataproviderdlg.hxx  |1 
 sc/source/ui/inc/datatransformation.hxx   |6 
 sc/source/ui/miscdlgs/dataproviderdlg.cxx |  102 ++-
 sc/uiconfig/scalc/ui/numbertransformationentry.ui |  118 
 7 files changed, 394 insertions(+), 171 deletions(-)

New commits:
commit 5ed11c2ba2b1897955e80d240815f79239b324c2
Author: Manuj Vashist 
Date:   Tue Jul 10 04:56:37 2018 +0530

Added Number transformation in Data Provider Dlg

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

diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 3b79d5d6b225..70d17e3ace35 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -159,6 +159,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/texttransformationentry \
sc/uiconfig/scalc/ui/sorttransformationentry \
sc/uiconfig/scalc/ui/aggregatefunctionentry \
+   sc/uiconfig/scalc/ui/numbertransformationentry \
sc/uiconfig/scalc/ui/movecopysheet \
sc/uiconfig/scalc/ui/movingaveragedialog \
sc/uiconfig/scalc/ui/multipleoperationsdialog \
diff --git a/sc/qa/unit/datatransformation_test.cxx 
b/sc/qa/unit/datatransformation_test.cxx
index baea46c694ad..00b6b69d4946 100644
--- a/sc/qa/unit/datatransformation_test.cxx
+++ b/sc/qa/unit/datatransformation_test.cxx
@@ -303,7 +303,7 @@ void ScDataTransformationTest::testNumberRound()
 m_pDoc->SetValue(2, 2, 0, 57453.651345687654345676);
 m_pDoc->SetValue(2, 3, 0, -453.22234567543);
 
-sc::NumberTransformation aTransform(2, sc::NUMBER_TRANSFORM_TYPE::ROUND, 
4);
+sc::NumberTransformation aTransform({2}, sc::NUMBER_TRANSFORM_TYPE::ROUND, 
4);
 aTransform.Transform(*m_pDoc);
 
 CPPUNIT_ASSERT_EQUAL(2034.3425, m_pDoc->GetValue(2, 0, 0));
@@ -319,7 +319,7 @@ void ScDataTransformationTest::testNumberRoundUp()
 m_pDoc->SetValue(2, 2, 0, 57453.65);
 m_pDoc->SetValue(2, 3, 0, -453.22);
 
-sc::NumberTransformation aTransform(2, 
sc::NUMBER_TRANSFORM_TYPE::ROUND_UP);
+sc::NumberTransformation aTransform({2}, 
sc::NUMBER_TRANSFORM_TYPE::ROUND_UP);
 aTransform.Transform(*m_pDoc);
 
 CPPUNIT_ASSERT_EQUAL(2035.0, m_pDoc->GetValue(2, 0, 0));
@@ -335,7 +335,7 @@ void ScDataTransformationTest::testNumberRoundDown()
 m_pDoc->SetValue(2, 2, 0, 57453.65);
 m_pDoc->SetValue(2, 3, 0, -453.22);
 
-sc::NumberTransformation aTransform(2, 
sc::NUMBER_TRANSFORM_TYPE::ROUND_DOWN);
+sc::NumberTransformation aTransform({2}, 
sc::NUMBER_TRANSFORM_TYPE::ROUND_DOWN);
 aTransform.Transform(*m_pDoc);
 
 CPPUNIT_ASSERT_EQUAL(2034.0, m_pDoc->GetValue(2, 0, 0));
@@ -351,7 +351,7 @@ void ScDataTransformationTest::testNumberAbsolute()
 m_pDoc->SetValue(2, 2, 0, 57453.65);
 m_pDoc->SetValue(2, 3, 0, -453.22);
 
-sc::NumberTransformation aTransform(2, 
sc::NUMBER_TRANSFORM_TYPE::ABSOLUTE);
+sc::NumberTransformation aTransform({2}, 
sc::NUMBER_TRANSFORM_TYPE::ABSOLUTE);
 aTransform.Transform(*m_pDoc);
 
 CPPUNIT_ASSERT_EQUAL(2034.34, m_pDoc->GetValue(2, 0, 0));
@@ -367,7 +367,7 @@ void ScDataTransformationTest::testNumberLogE()
 m_pDoc->SetValue(2, 2, 0, -9);
 m_pDoc->SetValue(2, 3, 0, 500);
 
-sc::NumberTransformation aTransform(2, sc::NUMBER_TRANSFORM_TYPE::LOG_E);
+sc::NumberTransformation aTransform({2}, sc::NUMBER_TRANSFORM_TYPE::LOG_E);
 aTransform.Transform(*m_pDoc);
 
 CPPUNIT_ASSERT_DOUBLES_EQUAL(0, m_pDoc->GetValue(2, 0, 0), 1e-10);
@@ -383,7 +383,7 @@ void ScDataTransformationTest::testNumberLog10()
 m_pDoc->SetValue(2, 2, 0, -9);
 m_pDoc->SetValue(2, 3, 0, 500);
 
-sc::NumberTransformation aTransform(2, sc::NUMBER_TRANSFORM_TYPE::LOG_10);
+sc::NumberTransformation aTransform({2}, 
sc::NUMBER_TRANSFORM_TYPE::LOG_10);
 aTransform.Transform(*m_pDoc);
 
 CPPUNIT_ASSERT_DOUBLES_EQUAL(0, m_pDoc->GetValue(2, 0, 0), 1e-10);
@@ -399,7 +399,7 @@ void ScDataTransformationTest::testNumberCube()
 m_pDoc->SetValue(2, 2, 0, 8);
 m_pDoc->SetValue(2, 3, 0, -8);
 
-sc::NumberTransformation aTransform(2, sc::NUMBER_TRANSFORM_TYPE::CUBE);
+sc::NumberTransformation aTransform({2}, sc::NUMBER_TRANSFORM_TYPE::CUBE);
 aTransform.Transform(*m_pDoc);
 
 CPPUNIT_ASSERT_EQUAL(8.0, m_pDoc->GetValue(2, 0, 0));
@@ -415,7 +415,7 @@ void ScDataTransformationTest::testNumberSquare()
 m_pDoc->SetValue(2, 2, 0, 8);
 m_pDoc->SetValue(2, 3, 0, -8);
 
-sc::NumberTransformation aTransform(2, sc::NUMBER_TRANSFORM_TYPE::SQUARE);
+sc::NumberTransformation aTransform({2}, 
sc::NUMBER_TRANSFORM_TYPE::SQUARE);
 aTransform.Transform(*m_pDoc);
 
 

[Libreoffice-commits] core.git: sc/qa sc/source sc/uiconfig sc/UIConfig_scalc.mk

2018-07-08 Thread Manuj Vashist
 sc/UIConfig_scalc.mk |1 
 sc/qa/unit/datatransformation_test.cxx   |8 -
 sc/source/ui/dataprovider/datatransformation.cxx |  124 ---
 sc/source/ui/inc/dataproviderdlg.hxx |1 
 sc/source/ui/inc/datatransformation.hxx  |4 
 sc/source/ui/miscdlgs/dataproviderdlg.cxx|   79 ++
 sc/uiconfig/scalc/ui/texttransformationentry.ui  |  109 
 7 files changed, 261 insertions(+), 65 deletions(-)

New commits:
commit 9546f6fec9c16c0440ef6db940aa704d2f8c6657
Author: Manuj Vashist 
Date:   Mon Jul 2 17:14:11 2018 +0530

added Text transformation in data provider dlg

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

diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 6eb7c34d49f9..498540b645fb 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -156,6 +156,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/managenamesdialog \
sc/uiconfig/scalc/ui/mergecellsdialog \
sc/uiconfig/scalc/ui/mergecolumnentry \
+   sc/uiconfig/scalc/ui/texttransformationentry \
sc/uiconfig/scalc/ui/movecopysheet \
sc/uiconfig/scalc/ui/movingaveragedialog \
sc/uiconfig/scalc/ui/multipleoperationsdialog \
diff --git a/sc/qa/unit/datatransformation_test.cxx 
b/sc/qa/unit/datatransformation_test.cxx
index 3546104fdbee..baea46c694ad 100644
--- a/sc/qa/unit/datatransformation_test.cxx
+++ b/sc/qa/unit/datatransformation_test.cxx
@@ -170,7 +170,7 @@ void ScDataTransformationTest::testTextToLower()
 m_pDoc->SetString(2, 2, 0, "Paris");
 m_pDoc->SetString(2, 3, 0, "Peking");
 
-sc::TextTransformation aTransform(2, sc::TEXT_TRANSFORM_TYPE::TO_LOWER);
+sc::TextTransformation aTransform({2}, sc::TEXT_TRANSFORM_TYPE::TO_LOWER);
 aTransform.Transform(*m_pDoc);
 
 CPPUNIT_ASSERT_EQUAL(OUString("berlin"), m_pDoc->GetString(2, 0, 0));
@@ -186,7 +186,7 @@ void ScDataTransformationTest::testTextToUpper()
 m_pDoc->SetString(2, 2, 0, "Paris");
 m_pDoc->SetString(2, 3, 0, "Peking");
 
-sc::TextTransformation aTransform(2, sc::TEXT_TRANSFORM_TYPE::TO_UPPER);
+sc::TextTransformation aTransform({2}, sc::TEXT_TRANSFORM_TYPE::TO_UPPER);
 aTransform.Transform(*m_pDoc);
 
 CPPUNIT_ASSERT_EQUAL(OUString("BERLIN"), m_pDoc->GetString(2, 0, 0));
@@ -202,7 +202,7 @@ void ScDataTransformationTest::testTextCapitalize()
 m_pDoc->SetString(2, 2, 0, "si tu la ves");
 m_pDoc->SetString(2, 3, 0, "cUaNdO mE EnAmOro");
 
-sc::TextTransformation aTransform(2, sc::TEXT_TRANSFORM_TYPE::CAPITALIZE);
+sc::TextTransformation aTransform({2}, 
sc::TEXT_TRANSFORM_TYPE::CAPITALIZE);
 aTransform.Transform(*m_pDoc);
 
 CPPUNIT_ASSERT_EQUAL(OUString("Hello World"), m_pDoc->GetString(2, 0, 0));
@@ -217,7 +217,7 @@ void ScDataTransformationTest::testTextTrim()
 m_pDoc->SetString(2, 1, 0, "Brussels ");
 m_pDoc->SetString(2, 2, 0, " Paris ");
 
-sc::TextTransformation aTransform(2, sc::TEXT_TRANSFORM_TYPE::TRIM);
+sc::TextTransformation aTransform({2}, sc::TEXT_TRANSFORM_TYPE::TRIM);
 aTransform.Transform(*m_pDoc);
 
 CPPUNIT_ASSERT_EQUAL(OUString("Berlin"), m_pDoc->GetString(2, 0, 0));
diff --git a/sc/source/ui/dataprovider/datatransformation.cxx 
b/sc/source/ui/dataprovider/datatransformation.cxx
index a1eae17c0df9..75e84a23c2ef 100644
--- a/sc/source/ui/dataprovider/datatransformation.cxx
+++ b/sc/source/ui/dataprovider/datatransformation.cxx
@@ -176,7 +176,7 @@ const ScSortParam & SortTransformation::getSortParam() const
 return maSortParam;
 }
 
-TextTransformation::TextTransformation(SCCOL nCol, const TEXT_TRANSFORM_TYPE 
rType):
+TextTransformation::TextTransformation(const std::set& nCol, const 
TEXT_TRANSFORM_TYPE rType):
 mnCol(nCol),
 maType(rType)
 {
@@ -184,85 +184,91 @@ TextTransformation::TextTransformation(SCCOL nCol, const 
TEXT_TRANSFORM_TYPE rTy
 
 void TextTransformation::Transform(ScDocument& rDoc) const
 {
-SCROW nEndRow = getLastRow(rDoc, mnCol);
-
-switch (maType)
+SCROW nEndRow = 0;
+for(auto& rCol : mnCol)
 {
-case TEXT_TRANSFORM_TYPE::TO_LOWER:
+nEndRow = getLastRow(rDoc, rCol);
+}
+for(auto& rCol : mnCol)
+{
+switch (maType)
 {
-for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
+case TEXT_TRANSFORM_TYPE::TO_LOWER:
 {
-CellType eType;
-rDoc.GetCellType(mnCol, nRow, 0, eType);
-if (eType == CELLTYPE_STRING)
+for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
 {
-OUString aStr = rDoc.GetString(mnCol, nRow, 0);
-rDoc.SetString(mnCol, nRow, 0, 
ScGlobal::pCharClass->lowercase(aStr));
+CellType 

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

2018-07-08 Thread Vikas
 sc/qa/unit/datatransformation_test.cxx   |  213 
 sc/source/ui/dataprovider/datatransformation.cxx |  236 +++
 sc/source/ui/inc/datatransformation.hxx  |   19 +
 3 files changed, 467 insertions(+), 1 deletion(-)

New commits:
commit 510073cf047101cf6297fcec2ad8296f9e63c486
Author: Vikas 
Date:   Tue Jul 3 11:47:14 2018 +0530

Added number transformations for external data

 - Round allows you to round the numbers in the column up to a given number 
of decimal places
 - Round Up rounds the numbers in the column up to the nearest whole number
 - Round Down rounds the numbers in the column down to the nearest whole 
number
 - Absolute Value returns the absolute value of the numbers in the column
 - Logarithm
- Natural returns the natural logarithm
- Base-10 returns the base-10 logarithm
 - Cube returns the cube of the numbers
 - Square returns the square of the numbers
 - Square Root returns the square root of the numbers
 - Is Even returns TRUE if the values in the column are eve
 - Is Odd returns TRUE if the values in the column are odd
 - Sign returns 1 if the values in the column are positive, -1 if they are 
negative, and 0 otherwise.

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

diff --git a/sc/qa/unit/datatransformation_test.cxx 
b/sc/qa/unit/datatransformation_test.cxx
index c011941a6cb7..3546104fdbee 100644
--- a/sc/qa/unit/datatransformation_test.cxx
+++ b/sc/qa/unit/datatransformation_test.cxx
@@ -39,6 +39,18 @@ public:
 void testAggregateAverage();
 void testAggregateMin();
 void testAggregateMax();
+void testNumberRound();
+void testNumberRoundUp();
+void testNumberRoundDown();
+void testNumberAbsolute();
+void testNumberLogE();
+void testNumberLog10();
+void testNumberCube();
+void testNumberSquare();
+void testNumberSquareRoot();
+void testNumberEven();
+void testNumberOdd();
+void testNumberSign();
 
 CPPUNIT_TEST_SUITE(ScDataTransformationTest);
 CPPUNIT_TEST(testColumnRemove);
@@ -52,6 +64,18 @@ public:
 CPPUNIT_TEST(testAggregateAverage);
 CPPUNIT_TEST(testAggregateMin);
 CPPUNIT_TEST(testAggregateMax);
+CPPUNIT_TEST(testNumberRound);
+CPPUNIT_TEST(testNumberRoundUp);
+CPPUNIT_TEST(testNumberRoundDown);
+CPPUNIT_TEST(testNumberAbsolute);
+CPPUNIT_TEST(testNumberLogE);
+CPPUNIT_TEST(testNumberLog10);
+CPPUNIT_TEST(testNumberCube);
+CPPUNIT_TEST(testNumberSquare);
+CPPUNIT_TEST(testNumberSquareRoot);
+CPPUNIT_TEST(testNumberEven);
+CPPUNIT_TEST(testNumberOdd);
+CPPUNIT_TEST(testNumberSign);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -272,6 +296,195 @@ void ScDataTransformationTest::testAggregateMax()
 CPPUNIT_ASSERT_DOUBLES_EQUAL(2034, m_pDoc->GetValue(3, 4, 0), 1e-10);
 }
 
+void ScDataTransformationTest::testNumberRound()
+{
+m_pDoc->SetValue(2, 0, 0, 2034.342453456);
+m_pDoc->SetValue(2, 1, 0, 2342.252678567542);
+m_pDoc->SetValue(2, 2, 0, 57453.651345687654345676);
+m_pDoc->SetValue(2, 3, 0, -453.22234567543);
+
+sc::NumberTransformation aTransform(2, sc::NUMBER_TRANSFORM_TYPE::ROUND, 
4);
+aTransform.Transform(*m_pDoc);
+
+CPPUNIT_ASSERT_EQUAL(2034.3425, m_pDoc->GetValue(2, 0, 0));
+CPPUNIT_ASSERT_EQUAL(2342.2527, m_pDoc->GetValue(2, 1, 0));
+CPPUNIT_ASSERT_EQUAL(57453.6513, m_pDoc->GetValue(2, 2, 0));
+CPPUNIT_ASSERT_EQUAL(-453.2223, m_pDoc->GetValue(2, 3, 0));
+}
+
+void ScDataTransformationTest::testNumberRoundUp()
+{
+m_pDoc->SetValue(2, 0, 0, 2034.34);
+m_pDoc->SetValue(2, 1, 0, 2342.22);
+m_pDoc->SetValue(2, 2, 0, 57453.65);
+m_pDoc->SetValue(2, 3, 0, -453.22);
+
+sc::NumberTransformation aTransform(2, 
sc::NUMBER_TRANSFORM_TYPE::ROUND_UP);
+aTransform.Transform(*m_pDoc);
+
+CPPUNIT_ASSERT_EQUAL(2035.0, m_pDoc->GetValue(2, 0, 0));
+CPPUNIT_ASSERT_EQUAL(2343.0, m_pDoc->GetValue(2, 1, 0));
+CPPUNIT_ASSERT_EQUAL(57454.0, m_pDoc->GetValue(2, 2, 0));
+CPPUNIT_ASSERT_EQUAL(-453.0, m_pDoc->GetValue(2, 3, 0));
+}
+
+void ScDataTransformationTest::testNumberRoundDown()
+{
+m_pDoc->SetValue(2, 0, 0, 2034.34);
+m_pDoc->SetValue(2, 1, 0, 2342.22);
+m_pDoc->SetValue(2, 2, 0, 57453.65);
+m_pDoc->SetValue(2, 3, 0, -453.22);
+
+sc::NumberTransformation aTransform(2, 
sc::NUMBER_TRANSFORM_TYPE::ROUND_DOWN);
+aTransform.Transform(*m_pDoc);
+
+CPPUNIT_ASSERT_EQUAL(2034.0, m_pDoc->GetValue(2, 0, 0));
+CPPUNIT_ASSERT_EQUAL(2342.0, m_pDoc->GetValue(2, 1, 0));
+CPPUNIT_ASSERT_EQUAL(57453.0, m_pDoc->GetValue(2, 2, 0));
+CPPUNIT_ASSERT_EQUAL(-454.0, m_pDoc->GetValue(2, 3, 0));
+}
+
+void ScDataTransformationTest::testNumberAbsolute()
+{
+m_pDoc->SetValue(2, 0, 0, 2034.34);
+

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

2018-07-08 Thread Dennis Francis
 sc/qa/uitest/statistics/data/regression.ods |binary
 sc/source/ui/StatisticsDialogs/RegressionDialog.cxx |2 +-
 sc/uiconfig/scalc/ui/regressiondialog.ui|9 -
 3 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 187af5be47db42e2f4ab94319f932b847f897ce2
Author: Dennis Francis 
Date:   Sun Jul 8 11:12:14 2018 +0530

tdf#118556 : Respect locale specific decimal separator...

in Regression dialog box's confidence-level entry.
Do not write floating-point numbers to cells as strings using
OUString::number() converter if the cell is supposed to be a
numeric one.

This also amends the uitest document such that the "expected"
confidence level cell is numeric and not string.

Thanks to Julien Nabet  for pointing me to
the specific issue.

Change-Id: I7d12674bf69fc53348366a03b7e6ff0af9588511
Reviewed-on: https://gerrit.libreoffice.org/57151
Tested-by: Jenkins
Reviewed-by: Dennis Francis 

diff --git a/sc/qa/uitest/statistics/data/regression.ods 
b/sc/qa/uitest/statistics/data/regression.ods
index e38d0a7ab26b..f9f65bfda0f5 100644
Binary files a/sc/qa/uitest/statistics/data/regression.ods and 
b/sc/qa/uitest/statistics/data/regression.ods differ
diff --git a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx 
b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx
index 086ef9b451cd..b3e744cdf71d 100644
--- a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx
@@ -513,7 +513,7 @@ void 
ScRegressionDialog::WriteRegressionANOVAResults(AddressWalkerWriter& rOutpu
 rOutput.newLine();
 rOutput.writeString(ScResId(STR_LABEL_CONFIDENCE_LEVEL));
 rOutput.nextColumn();
-rOutput.writeString(OUString::number(mpConfidenceLevelField->GetValue() / 
100.0));
+rOutput.writeValue(mpConfidenceLevelField->GetValue() / 100.0);
 rTemplate.autoReplaceAddress("%CONFIDENCE_LEVEL_ADDR%", rOutput.current());
 rOutput.newLine();
 }
diff --git a/sc/uiconfig/scalc/ui/regressiondialog.ui 
b/sc/uiconfig/scalc/ui/regressiondialog.ui
index 4ef37adfafdd..faa4aa307cfd 100644
--- a/sc/uiconfig/scalc/ui/regressiondialog.ui
+++ b/sc/uiconfig/scalc/ui/regressiondialog.ui
@@ -3,6 +3,12 @@
 
   
   
+  
+1
+0.94996
+0.01
+0.10001
+  
   
 False
 6
@@ -466,7 +472,8 @@
 True
 start
 center
-0.95
+0,95
+confidencelevel-adjustment
 2
 True
 0.94996
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-06 Thread Vikas
 sc/qa/unit/datatransformation_test.cxx   |   80 ++
 sc/source/ui/dataprovider/datatransformation.cxx |   98 +++
 sc/source/ui/inc/datatransformation.hxx  |   16 +++
 3 files changed, 193 insertions(+), 1 deletion(-)

New commits:
commit 8981adda6a24a172245b8cd0dd60e31644e23c75
Author: Vikas 
Date:   Tue Jul 3 17:05:36 2018 +0530

Added aggregate functions for external data

- Sum, which returns the sum of values in the column.
- Average, which returns the average of values in the column.
- Min, which returns the minimum of the values in the column.
- Max, which returns the maximum of the values in the column.

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

diff --git a/sc/qa/unit/datatransformation_test.cxx 
b/sc/qa/unit/datatransformation_test.cxx
index 8cec163eeb43..c011941a6cb7 100644
--- a/sc/qa/unit/datatransformation_test.cxx
+++ b/sc/qa/unit/datatransformation_test.cxx
@@ -35,6 +35,10 @@ public:
 void testTextToUpper();
 void testTextCapitalize();
 void testTextTrim();
+void testAggregateSum();
+void testAggregateAverage();
+void testAggregateMin();
+void testAggregateMax();
 
 CPPUNIT_TEST_SUITE(ScDataTransformationTest);
 CPPUNIT_TEST(testColumnRemove);
@@ -44,6 +48,10 @@ public:
 CPPUNIT_TEST(testTextToUpper);
 CPPUNIT_TEST(testTextCapitalize);
 CPPUNIT_TEST(testTextTrim);
+CPPUNIT_TEST(testAggregateSum);
+CPPUNIT_TEST(testAggregateAverage);
+CPPUNIT_TEST(testAggregateMin);
+CPPUNIT_TEST(testAggregateMax);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -193,6 +201,78 @@ void ScDataTransformationTest::testTextTrim()
 CPPUNIT_ASSERT_EQUAL(OUString("Paris"), m_pDoc->GetString(2, 2, 0));
 }
 
+void ScDataTransformationTest::testAggregateSum()
+{
+m_pDoc->SetValue(2, 0, 0, 2034);
+m_pDoc->SetValue(2, 1, 0, 2342);
+m_pDoc->SetValue(2, 2, 0, 57452);
+
+m_pDoc->SetValue(4, 0, 0, 4829.98);
+m_pDoc->SetValue(4, 1, 0, 53781.3);
+m_pDoc->SetValue(4, 2, 0, 9876.4);
+m_pDoc->SetValue(4, 3, 0, 0);
+
+sc::AggregateFunction aTransform({2, 4}, sc::AGGREGATE_FUNCTION::SUM);
+aTransform.Transform(*m_pDoc);
+
+CPPUNIT_ASSERT_DOUBLES_EQUAL(61828, m_pDoc->GetValue(2, 4, 0), 1e-10);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(68487.68, m_pDoc->GetValue(4, 4, 0), 1e-10);
+}
+
+void ScDataTransformationTest::testAggregateAverage()
+{
+m_pDoc->SetValue(2, 0, 0, 2034);
+m_pDoc->SetValue(2, 1, 0, 2342);
+m_pDoc->SetValue(2, 2, 0, 57453);
+
+m_pDoc->SetValue(3, 0, 0, 4);
+m_pDoc->SetValue(3, 1, 0, 4);
+m_pDoc->SetValue(3, 2, 0, 4);
+
+sc::AggregateFunction aTransform({2, 3}, sc::AGGREGATE_FUNCTION::AVERAGE);
+aTransform.Transform(*m_pDoc);
+
+CPPUNIT_ASSERT_DOUBLES_EQUAL(20609.67, m_pDoc->GetValue(2, 3, 0), 
1e-10);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(4, m_pDoc->GetValue(3, 3, 0), 1e-10);
+}
+
+void ScDataTransformationTest::testAggregateMin()
+{
+m_pDoc->SetValue(2, 0, 0, 2034);
+m_pDoc->SetValue(2, 1, 0, 2342);
+m_pDoc->SetValue(2, 2, 0, 57453);
+
+m_pDoc->SetValue(3, 0, 0, 2034);
+m_pDoc->SetValue(3, 1, 0, -2342);
+m_pDoc->SetValue(3, 2, 0, 57453);
+
+sc::AggregateFunction aTransform({2, 3}, sc::AGGREGATE_FUNCTION::MIN);
+aTransform.Transform(*m_pDoc);
+
+CPPUNIT_ASSERT_DOUBLES_EQUAL(2034, m_pDoc->GetValue(2, 3, 0), 1e-10);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(-2342, m_pDoc->GetValue(3, 3, 0), 1e-10);
+}
+
+void ScDataTransformationTest::testAggregateMax()
+{
+m_pDoc->SetValue(2, 0, 0, 2034);
+m_pDoc->SetValue(2, 1, 0, 2342);
+m_pDoc->SetValue(2, 2, 0, 57453);
+m_pDoc->SetValue(2, 3, 0, -453);
+
+m_pDoc->SetValue(3, 0, 0, 2034);
+m_pDoc->SetValue(3, 1, 0, -2342);
+m_pDoc->SetValue(3, 2, 0, -57453);
+m_pDoc->SetValue(3, 3, 0, -453);
+
+sc::AggregateFunction aTransform({2, 3}, sc::AGGREGATE_FUNCTION::MAX);
+aTransform.Transform(*m_pDoc);
+
+CPPUNIT_ASSERT_DOUBLES_EQUAL(57453, m_pDoc->GetValue(2, 4, 0), 1e-10);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(2034, m_pDoc->GetValue(3, 4, 0), 1e-10);
+}
+
+
 ScDataTransformationTest::ScDataTransformationTest() :
 ScBootstrapFixture( "sc/qa/unit/data/dataprovider" ),
 m_pDoc(nullptr)
diff --git a/sc/source/ui/dataprovider/datatransformation.cxx 
b/sc/source/ui/dataprovider/datatransformation.cxx
index 84df313aacdc..fd779bf6587a 100644
--- a/sc/source/ui/dataprovider/datatransformation.cxx
+++ b/sc/source/ui/dataprovider/datatransformation.cxx
@@ -10,6 +10,7 @@
 #include 
 
 #include 
+#include 
 
 namespace sc {
 
@@ -268,6 +269,103 @@ TransformationType 
TextTransformation::getTransformationType() const
 return TransformationType::TEXT_TRANSFORMATION;
 }
 
+AggregateFunction::AggregateFunction(const std::set& rColumns, const 
AGGREGATE_FUNCTION rType):
+

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

2018-07-06 Thread Vikas
 sc/qa/unit/datatransformation_test.cxx   |   70 
 sc/source/ui/dataprovider/datatransformation.cxx |   95 +++
 sc/source/ui/inc/datatransformation.hxx  |   16 +++
 3 files changed, 180 insertions(+), 1 deletion(-)

New commits:
commit 483ca6e6bb9c920cc96212c7042e13fbbb5fa767
Author: Vikas 
Date:   Mon Jul 2 01:29:09 2018 +0530

Added text transformations for external data

 - Uppercase, which sets all text in the selected columns to upper case.
 - Lowercase, which sets all text in the selected columns to lower case.
 - Capitalize Each Word, which makes all words in the selected column start 
with a capital letter and sets all subsequent letters in a word to lower case.
 - Trim, which removes any leading or trailing whitespace characters from 
text.

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

diff --git a/sc/qa/unit/datatransformation_test.cxx 
b/sc/qa/unit/datatransformation_test.cxx
index d4c0e11a2642..8cec163eeb43 100644
--- a/sc/qa/unit/datatransformation_test.cxx
+++ b/sc/qa/unit/datatransformation_test.cxx
@@ -31,11 +31,19 @@ public:
 void testColumnRemove();
 void testColumnSplit();
 void testColumnMerge();
+void testTextToLower();
+void testTextToUpper();
+void testTextCapitalize();
+void testTextTrim();
 
 CPPUNIT_TEST_SUITE(ScDataTransformationTest);
 CPPUNIT_TEST(testColumnRemove);
 CPPUNIT_TEST(testColumnSplit);
 CPPUNIT_TEST(testColumnMerge);
+CPPUNIT_TEST(testTextToLower);
+CPPUNIT_TEST(testTextToUpper);
+CPPUNIT_TEST(testTextCapitalize);
+CPPUNIT_TEST(testTextTrim);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -123,6 +131,68 @@ void ScDataTransformationTest::testColumnMerge()
 }
 }
 
+void ScDataTransformationTest::testTextToLower()
+{
+m_pDoc->SetString(2, 0, 0, "Berlin");
+m_pDoc->SetString(2, 1, 0, "Brussels");
+m_pDoc->SetString(2, 2, 0, "Paris");
+m_pDoc->SetString(2, 3, 0, "Peking");
+
+sc::TextTransformation aTransform(2, sc::TEXT_TRANSFORM_TYPE::TO_LOWER);
+aTransform.Transform(*m_pDoc);
+
+CPPUNIT_ASSERT_EQUAL(OUString("berlin"), m_pDoc->GetString(2, 0, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("brussels"), m_pDoc->GetString(2, 1, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("paris"), m_pDoc->GetString(2, 2, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("peking"), m_pDoc->GetString(2, 3, 0));
+}
+
+void ScDataTransformationTest::testTextToUpper()
+{
+m_pDoc->SetString(2, 0, 0, "Berlin");
+m_pDoc->SetString(2, 1, 0, "Brussels");
+m_pDoc->SetString(2, 2, 0, "Paris");
+m_pDoc->SetString(2, 3, 0, "Peking");
+
+sc::TextTransformation aTransform(2, sc::TEXT_TRANSFORM_TYPE::TO_UPPER);
+aTransform.Transform(*m_pDoc);
+
+CPPUNIT_ASSERT_EQUAL(OUString("BERLIN"), m_pDoc->GetString(2, 0, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("BRUSSELS"), m_pDoc->GetString(2, 1, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("PARIS"), m_pDoc->GetString(2, 2, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("PEKING"), m_pDoc->GetString(2, 3, 0));
+}
+
+void ScDataTransformationTest::testTextCapitalize()
+{
+m_pDoc->SetString(2, 0, 0, "hello woRlD");
+m_pDoc->SetString(2, 1, 0, "qUe vA");
+m_pDoc->SetString(2, 2, 0, "si tu la ves");
+m_pDoc->SetString(2, 3, 0, "cUaNdO mE EnAmOro");
+
+sc::TextTransformation aTransform(2, sc::TEXT_TRANSFORM_TYPE::CAPITALIZE);
+aTransform.Transform(*m_pDoc);
+
+CPPUNIT_ASSERT_EQUAL(OUString("Hello World"), m_pDoc->GetString(2, 0, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("Que Va"), m_pDoc->GetString(2, 1, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("Si Tu La Ves"), m_pDoc->GetString(2, 2, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("Cuando Me Enamoro"), m_pDoc->GetString(2, 
3, 0));
+}
+
+void ScDataTransformationTest::testTextTrim()
+{
+m_pDoc->SetString(2, 0, 0, " Berlin");
+m_pDoc->SetString(2, 1, 0, "Brussels ");
+m_pDoc->SetString(2, 2, 0, " Paris ");
+
+sc::TextTransformation aTransform(2, sc::TEXT_TRANSFORM_TYPE::TRIM);
+aTransform.Transform(*m_pDoc);
+
+CPPUNIT_ASSERT_EQUAL(OUString("Berlin"), m_pDoc->GetString(2, 0, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("Brussels"), m_pDoc->GetString(2, 1, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("Paris"), m_pDoc->GetString(2, 2, 0));
+}
+
 ScDataTransformationTest::ScDataTransformationTest() :
 ScBootstrapFixture( "sc/qa/unit/data/dataprovider" ),
 m_pDoc(nullptr)
diff --git a/sc/source/ui/dataprovider/datatransformation.cxx 
b/sc/source/ui/dataprovider/datatransformation.cxx
index 09370a8e82c7..84df313aacdc 100644
--- a/sc/source/ui/dataprovider/datatransformation.cxx
+++ b/sc/source/ui/dataprovider/datatransformation.cxx
@@ -173,6 +173,101 @@ ScSortParam SortTransformation::getSortParam() const
 return maSortParam;
 }
 
+TextTransformation::TextTransformation(SCCOL nCol, const 

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

2018-06-29 Thread Stephan Bergmann
 sc/qa/unit/ucalc.cxx   |4 ++--
 sc/qa/unit/ucalc_formula.cxx   |   10 +-
 sc/source/ui/dbgui/csvgrid.cxx |2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 671538c601f6171fd27432528620a6ff1f5d2d4d
Author: Stephan Bergmann 
Date:   Fri Jun 29 15:54:20 2018 +0200

Improved loplugin:redundantcast (const-qualified typedefs): sc

Change-Id: I2bba240b444811ff0b29149b4b731a1fa01d6270
Reviewed-on: https://gerrit.libreoffice.org/56700
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 6fb52101ed0c..6db74263c27b 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -5001,7 +5001,7 @@ void Test::testFindAreaPosVertical()
 
 m_pDoc->FindAreaPos(nCol, nRow, 0, SC_MOVE_DOWN);
 
-CPPUNIT_ASSERT_EQUAL(static_cast(MAXROW), nRow);
+CPPUNIT_ASSERT_EQUAL(MAXROW, nRow);
 CPPUNIT_ASSERT_EQUAL(static_cast(0), nCol);
 
 nCol = 1;
@@ -5068,7 +5068,7 @@ void Test::testFindAreaPosColRight()
 m_pDoc->FindAreaPos(nCol, nRow, 0, SC_MOVE_RIGHT);
 
 CPPUNIT_ASSERT_EQUAL(static_cast(0), nRow);
-CPPUNIT_ASSERT_EQUAL(static_cast(MAXCOL), nCol);
+CPPUNIT_ASSERT_EQUAL(MAXCOL, nCol);
 
 nCol = 2;
 nRow = 1;
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 5900e3555ada..a3b0125c9beb 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -373,7 +373,7 @@ void Test::testFormulaParseReference()
 CPPUNIT_ASSERT_EQUAL(static_cast(0), aRange.aStart.Row());
 CPPUNIT_ASSERT_EQUAL(static_cast(0), aRange.aEnd.Tab());
 CPPUNIT_ASSERT_EQUAL(static_cast(1), aRange.aEnd.Col());
-CPPUNIT_ASSERT_EQUAL(static_cast(MAXROW), aRange.aEnd.Row());
+CPPUNIT_ASSERT_EQUAL(MAXROW, aRange.aEnd.Row());
 CPPUNIT_ASSERT_EQUAL(static_cast(ScRefFlags::COL_VALID | 
ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID |
  ScRefFlags::COL2_VALID | 
ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID),
  static_cast(nRes & (ScRefFlags::COL_VALID 
| ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID |
@@ -390,7 +390,7 @@ void Test::testFormulaParseReference()
 CPPUNIT_ASSERT_EQUAL(static_cast(0), aRange.aStart.Col());
 CPPUNIT_ASSERT_EQUAL(static_cast(1), aRange.aStart.Row());
 CPPUNIT_ASSERT_EQUAL(static_cast(0), aRange.aEnd.Tab());
-CPPUNIT_ASSERT_EQUAL(static_cast(MAXCOL), aRange.aEnd.Col());
+CPPUNIT_ASSERT_EQUAL(MAXCOL, aRange.aEnd.Col());
 CPPUNIT_ASSERT_EQUAL(static_cast(1), aRange.aEnd.Row());
 CPPUNIT_ASSERT_EQUAL(static_cast(ScRefFlags::COL_VALID | 
ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID |
  ScRefFlags::COL2_VALID | 
ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID),
@@ -408,7 +408,7 @@ void Test::testFormulaParseReference()
 CPPUNIT_ASSERT_EQUAL(static_cast(0), aRange.aStart.Row());
 CPPUNIT_ASSERT_EQUAL(static_cast(4), aRange.aEnd.Tab());
 CPPUNIT_ASSERT_EQUAL(static_cast(2), aRange.aEnd.Col());
-CPPUNIT_ASSERT_EQUAL(static_cast(MAXROW), aRange.aEnd.Row());
+CPPUNIT_ASSERT_EQUAL(MAXROW, aRange.aEnd.Row());
 CPPUNIT_ASSERT_EQUAL(static_cast(ScRefFlags::COL_VALID | 
ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID |
  ScRefFlags::COL2_VALID | 
ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID),
  static_cast(nRes & (ScRefFlags::COL_VALID 
| ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID |
@@ -427,7 +427,7 @@ void Test::testFormulaParseReference()
 CPPUNIT_ASSERT_EQUAL(static_cast(0), aRange.aStart.Row());
 CPPUNIT_ASSERT_EQUAL(static_cast(0), aRange.aEnd.Tab());
 CPPUNIT_ASSERT_EQUAL(static_cast(1), aRange.aEnd.Col());
-CPPUNIT_ASSERT_EQUAL(static_cast(MAXROW), aRange.aEnd.Row());
+CPPUNIT_ASSERT_EQUAL(MAXROW, aRange.aEnd.Row());
 CPPUNIT_ASSERT_EQUAL(static_cast(ScRefFlags::COL_VALID | 
ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID |
  ScRefFlags::COL2_VALID | 
ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID),
  static_cast(nRes & (ScRefFlags::COL_VALID 
| ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID |
@@ -445,7 +445,7 @@ void Test::testFormulaParseReference()
 CPPUNIT_ASSERT_EQUAL(static_cast(0), aRange.aStart.Col());
 CPPUNIT_ASSERT_EQUAL(static_cast(1), aRange.aStart.Row());
 CPPUNIT_ASSERT_EQUAL(static_cast(0), aRange.aEnd.Tab());
-CPPUNIT_ASSERT_EQUAL(static_cast(MAXCOL), aRange.aEnd.Col());
+CPPUNIT_ASSERT_EQUAL(MAXCOL, aRange.aEnd.Col());
 CPPUNIT_ASSERT_EQUAL(static_cast(1), aRange.aEnd.Row());
 CPPUNIT_ASSERT_EQUAL(static_cast(ScRefFlags::COL_VALID | 
ScRefFlags::ROW_VALID | ScRefFlags::TAB_VALID |
  ScRefFlags::COL2_VALID | 
ScRefFlags::ROW2_VALID | ScRefFlags::TAB2_VALID),
diff --git 

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

2018-06-27 Thread Henry Castro
 sc/qa/unit/tiledrendering/tiledrendering.cxx |6 ++
 sc/source/ui/docshell/docsh.cxx  |   19 +++
 sc/source/ui/inc/tabvwsh.hxx |7 +--
 sc/source/ui/undo/undoblk.cxx|2 +-
 sc/source/ui/vba/excelvbahelper.cxx  |4 ++--
 sc/source/ui/view/cellsh.cxx |   25 +++--
 sc/source/ui/view/cellsh1.cxx|   16 +---
 sc/source/ui/view/cliputil.cxx   |2 +-
 sc/source/ui/view/drawvie4.cxx   |1 -
 sc/source/ui/view/gridwin.cxx|2 +-
 sc/source/ui/view/tabvwshc.cxx   |   16 
 sc/source/ui/view/viewfun3.cxx   |   11 +--
 sc/source/ui/view/viewfun7.cxx   |2 +-
 13 files changed, 53 insertions(+), 60 deletions(-)

New commits:
commit b9652803096b68a33702601aac52e78c8a4250c6
Author: Henry Castro 
Date:   Tue Jun 26 23:32:41 2018 -0400

tdf#118308: Incorrect Paste Special dialog when ...

pasting content from another cell

In tiled rendering case (headless) each window has its own clipboard,
otherwise exists a unique clipboard (UNO service).

Change-Id: I7d5d0b085faeaffa3fc0a80914fbe9349f4aa402
Reviewed-on: https://gerrit.libreoffice.org/56508
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 5313f87eea24..01ac014b173b 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1551,12 +1552,17 @@ void ScTiledRenderingTest::testMultiViewCopyPaste()
 // view #1
 ScTabViewShell* pView1 = 
dynamic_cast(SfxViewShell::Current());
 CPPUNIT_ASSERT(pView1);
+// emulate clipboard
+
pView1->GetViewData().GetActiveWin()->SetClipboard(css::datatransfer::clipboard::SystemClipboard::create(comphelper::getProcessComponentContext()));
 
 // view #2
 SfxLokHelper::createView();
 ScTabViewShell* pView2 = 
dynamic_cast(SfxViewShell::Current());
+// emulate clipboard
+
pView2->GetViewData().GetActiveWin()->SetClipboard(css::datatransfer::clipboard::SystemClipboard::create(comphelper::getProcessComponentContext()));
 CPPUNIT_ASSERT(pView2);
 CPPUNIT_ASSERT(pView1 != pView2);
+CPPUNIT_ASSERT(pView1->GetViewData().GetActiveWin()->GetClipboard() != 
pView2->GetViewData().GetActiveWin()->GetClipboard());
 
 // copy text view 1
 pView1->SetCursor(0, 0);
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 40d6107accb5..474bf7e06ed0 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2786,24 +2786,11 @@ ScDocFunc *ScDocShell::CreateDocFunc()
 
 ScDocument* ScDocShell::GetClipDoc()
 {
-css::uno::Reference xTransferable;
-
+vcl::Window* pWin = nullptr;
 if (ScTabViewShell* pViewShell = GetBestViewShell())
-xTransferable.set(pViewShell->GetClipData());
-else
-{
-SfxViewFrame* pViewFrame = nullptr;
-css::uno::Reference 
xClipboard;
-
-if ((pViewFrame = SfxViewFrame::GetFirst(this, false)))
-xClipboard = pViewFrame->GetWindow().GetClipboard();
-else if ((pViewFrame = SfxViewFrame::GetFirst()))
- xClipboard = pViewFrame->GetWindow().GetClipboard();
-
-xTransferable.set(xClipboard.is() ? xClipboard->getContents() : 
nullptr, css::uno::UNO_QUERY);
-}
+pWin = pViewShell->GetViewData().GetActiveWin();
 
-const ScTransferObj* pObj = ScTransferObj::GetOwnClipboard(xTransferable);
+const ScTransferObj* pObj = 
ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(pWin));
 if (pObj)
 {
 ScDocument* pDoc = pObj->GetDocument();
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 2181e61aa325..8b4753e18c42 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -167,9 +167,6 @@ private:
 OUString   maName;
 OUString   maScope;
 
-// ClipData
-css::uno::Reference   m_xClipData;
-
 private:
 voidConstruct( TriState nForceDesignMode );
 
@@ -394,9 +391,7 @@ public:
 static void notifyAllViewsHeaderInvalidation(bool Columns, SCTAB 
nCurrentTabIndex);
 static bool isAnyEditViewInRange(bool bColumns, SCCOLROW nStart, SCCOLROW 
nEnd);
 css::uno::Reference getSelectedXShapes();
-
-const css::uno::Reference & 
GetClipData() { return m_xClipData; };
-void SetClipData(const 
css::uno::Reference& xTransferable) { 
m_xClipData = xTransferable; }
+static  css::uno::Reference 
GetClipData(vcl::Window* pWin);
 };
 
 #endif
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 107fe23fd21f..0de0757d8b0b 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ 

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

2018-06-26 Thread Justin Luth
 sc/qa/unit/subsequent_export-test.cxx |8 
 sc/source/filter/excel/xeformula.cxx  |2 -
 sc/source/filter/excel/xename.cxx |   59 --
 sc/source/filter/inc/xename.hxx   |2 -
 4 files changed, 59 insertions(+), 12 deletions(-)

New commits:
commit e1a77d0affef507d597e7dceb5514073658332df
Author: Justin Luth 
Date:   Mon May 7 19:29:49 2018 +0300

tdf#113991 xls/xlsx export: emulate relative GLOBAL named ranges

The MS formats apparently require absolute sheet references in
named ranges. So, it can't directly use LO's GLOBAL relative ranges.
Instead, attempt to emulate that by duplicating the GLOBAL name
directly into every sheet. If the name already exists, then
(in theory) it would have overridden the global one anyway,
so just drop it in that case.

Change-Id: I32ab6f957a60fde7ec8a1912cfb0974a55db3886
Reviewed-on: https://gerrit.libreoffice.org/54743
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index cc5177f53980..046ce15783d8 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -3383,6 +3383,14 @@ void ScExportTest::testRelativeNamedExpressionsXLS()
 aPos = ScAddress(5,5,1);
 CPPUNIT_ASSERT_EQUAL(18.0, rDoc.GetValue(aPos));
 ASSERT_FORMULA_EQUAL(rDoc, aPos, "SUM(test_conflict)", nullptr);
+// Sheet2:H3
+aPos = ScAddress(7,2,1);
+CPPUNIT_ASSERT_EQUAL(10.0, rDoc.GetValue(aPos));
+ASSERT_FORMULA_EQUAL(rDoc, aPos, "single_global_A3", nullptr);
+// Sheet2:H6
+aPos = ScAddress(7,5,1);
+CPPUNIT_ASSERT_EQUAL(75.0, rDoc.GetValue(aPos));
+ASSERT_FORMULA_EQUAL(rDoc, aPos, "SUM(A6:F6)", nullptr);
 xDocSh2->DoClose();
 }
 
diff --git a/sc/source/filter/excel/xeformula.cxx 
b/sc/source/filter/excel/xeformula.cxx
index 3cd1bd9a06bf..dc3297c45ee9 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -2089,7 +2089,7 @@ void XclExpFmlaCompImpl::ProcessDefinedName( const 
XclExpScToken& rTokData )
 SCTAB nTab = (nSheet < 0 ? SCTAB_GLOBAL : nSheet);
 
 XclExpNameManager& rNameMgr = GetNameManager();
-sal_uInt16 nNameIdx = rNameMgr.InsertName(nTab, 
rTokData.mpScToken->GetIndex());
+sal_uInt16 nNameIdx = rNameMgr.InsertName(nTab, 
rTokData.mpScToken->GetIndex(), GetCurrScTab());
 if( nNameIdx != 0 )
 {
 // global names always with tName token, local names dependent on 
config
diff --git a/sc/source/filter/excel/xename.cxx 
b/sc/source/filter/excel/xename.cxx
index d44246600241..62181ef8eee2 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -115,7 +115,7 @@ public:
 voidInitialize();
 
 /** Inserts the Calc name with the passed index and returns the Excel NAME 
index. */
-sal_uInt16  InsertName( SCTAB nTab, sal_uInt16 nScNameIdx );
+sal_uInt16  InsertName( SCTAB nTab, sal_uInt16 nScNameIdx, SCTAB 
nCurrTab );
 
 /** Inserts a new built-in defined name. */
 sal_uInt16  InsertBuiltInName( sal_Unicode cBuiltIn, const 
XclTokenArrayRef& xTokArr, SCTAB nScTab, const ScRangeList& aRangeList );
@@ -335,14 +335,17 @@ void XclExpName::WriteBody( XclExpStream& rStrm )
 mxTokArr->WriteArray( rStrm );  // token array without size
 }
 
-void lcl_EnsureAbs3DToken( const SCTAB nTab, formula::FormulaToken* pTok )
+/** Returns true (needed fixing) if FormulaToken was not absolute and 3D.
+So, regardless of whether the fix was successful or not, true is still 
returned since a fix was required.*/
+bool lcl_EnsureAbs3DToken( const SCTAB nTab, formula::FormulaToken* pTok, 
const bool bFix = true )
 {
+bool bFixRequired = false;
 if ( !pTok || ( pTok->GetType() != formula::svSingleRef && pTok->GetType() 
!= formula::svDoubleRef ) )
-return;
+return bFixRequired;
 
 ScSingleRefData* pRef1 = pTok->GetSingleRef();
 if ( !pRef1 )
-return;
+return bFixRequired;
 
 ScSingleRefData* pRef2 = nullptr;
 if ( pTok->GetType() == formula::svDoubleRef )
@@ -350,6 +353,9 @@ void lcl_EnsureAbs3DToken( const SCTAB nTab, 
formula::FormulaToken* pTok )
 
 if ( pRef1->IsTabRel() || !pRef1->IsFlag3D() )
 {
+bFixRequired = true;
+if ( bFix )
+{
 if ( pRef1->IsTabRel() && nTab != SCTAB_GLOBAL )
 pRef1->SetAbsTab( nTab + pRef1->Tab() );  //XLS requirement
 if ( !pRef1->IsTabRel() )
@@ -358,16 +364,19 @@ void lcl_EnsureAbs3DToken( const SCTAB nTab, 
formula::FormulaToken* pTok )
 if ( pRef2 && !pRef2->IsTabRel() )
 pRef2->SetFlag3D( pRef2->Tab() != pRef1->Tab() );
 }
+}
 }
 
 if ( pRef2 && pRef2->IsTabRel() && !pRef1->IsTabRel() )
 {
-if ( nTab != SCTAB_GLOBAL )
+bFixRequired = true;
+ 

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

2018-06-20 Thread Andrea Gelmini
 sc/qa/uitest/goalSeek/tdf43693.py |2 +-
 sc/source/core/tool/formularesult.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 708dbf3a170cfd0564f1d872f33c27806b83cafe
Author: Andrea Gelmini 
Date:   Wed Jun 20 23:41:46 2018 +0200

Fix typos

Change-Id: I6a42d683e2d4d2d8887822dc17ab2fd7f51982a5
Reviewed-on: https://gerrit.libreoffice.org/56210
Tested-by: Jenkins
Reviewed-by: Jens Carl 

diff --git a/sc/qa/uitest/goalSeek/tdf43693.py 
b/sc/qa/uitest/goalSeek/tdf43693.py
index 991c91bbe46a..ade370e2b8fa 100644
--- a/sc/qa/uitest/goalSeek/tdf43693.py
+++ b/sc/qa/uitest/goalSeek/tdf43693.py
@@ -16,7 +16,7 @@ import pathlib
 def get_url_for_data_file(file_name):
 return 
pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
 
-#Bug 43693 - Goal Seek: reproducable crash using "target value search"
+#Bug 43693 - Goal Seek: reproducible crash using "target value search"
 
 class tdf43693(UITestCase):
 def test_tdf43693_goalSeek(self):
diff --git a/sc/source/core/tool/formularesult.cxx 
b/sc/source/core/tool/formularesult.cxx
index ad10f51a36ba..2431713cffdf 100644
--- a/sc/source/core/tool/formularesult.cxx
+++ b/sc/source/core/tool/formularesult.cxx
@@ -275,7 +275,7 @@ inline bool isValue( formula::StackVar sv )
 {
 return sv == formula::svDouble || sv == formula::svError
 || sv == formula::svEmptyCell
-// The initial unitialized result value is double 0.0, even if the type
+// The initial uninitialized result value is double 0.0, even if the 
type
 // is unknown, so the interpreter asking for it gets that double
 // instead of having to convert a string which may result in #VALUE!
 // (otherwise the unknown would be neither error nor double nor string)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-06-11 Thread Justin Luth
 sc/qa/unit/subsequent_export-test.cxx |4 ++--
 sc/source/filter/html/htmlimp.cxx |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 5720c85ccea9f1481bd604b806c5be728e59a13f
Author: Justin Luth 
Date:   Tue Jun 5 19:30:58 2018 +0300

tdf#114487 sc htmlimp: non-global sheet range names

Allow multiple file imports, each one having a
non-conflicting range name, by being sheet specific. As
Eike states, "This does *not* mean that they couldn't
be referenced from other sheets. By prefixing the sheet
name it can be used from any other sheet, for example
Sheet2.HTML_1. (This wasn't possible in early versions
with sheet-local names but it has been possible for
a while already)."

In theory, it would previously have been possible to create
a generic sheet with calculations using a range name
that doesn't exist yet, and then importing *any* file
to be analyzed.

In practice that has never been possible
since all names were relative, and imports always
create a new sheet, so the relative name would point
elsewhere. Also, the non-existant name only resolves
after a round-trip of the file, not immediately
upon file import.

So, it is logical to set the imported range names
to be sheet-local instead of global.

Change-Id: I3103f0655b2373bb731c192bb5d2c0757938ee28
Reviewed-on: https://gerrit.libreoffice.org/55349
Tested-by: Jenkins 
Reviewed-by: Justin Luth 
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 5eda7f6ef609..cc5177f53980 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -3337,9 +3337,9 @@ void ScExportTest::testAbsNamedRangeHTML()
 xDocSh2->DoHardRecalc();
 
 ScDocument& rDoc = xDocSh2->GetDocument();
-ScRangeData* pRangeData = 
rDoc.GetRangeName()->findByUpperName(OUString("HTML_1"));
+ScRangeData* pRangeData = 
rDoc.GetRangeName(0)->findByUpperName(OUString("HTML_1"));
 ScSingleRefData* pRef = 
pRangeData->GetCode()->FirstToken()->GetSingleRef();
-CPPUNIT_ASSERT_MESSAGE("HTML_1 is an absolute 
reference",!pRef->IsTabRel());
+CPPUNIT_ASSERT_MESSAGE("Sheet1.HTML_1 is an absolute 
reference",!pRef->IsTabRel());
 }
 
 void ScExportTest::testSheetLocalRangeNameXLS()
diff --git a/sc/source/filter/html/htmlimp.cxx 
b/sc/source/filter/html/htmlimp.cxx
index 4957b2d381ad..45b942ab1b98 100644
--- a/sc/source/filter/html/htmlimp.cxx
+++ b/sc/source/filter/html/htmlimp.cxx
@@ -107,7 +107,7 @@ void ScHTMLImport::InsertRangeName( ScDocument* pDoc, const 
OUString& rName, con
 ScTokenArray aTokArray;
 aTokArray.AddDoubleReference( aRefData );
 ScRangeData* pRangeData = new ScRangeData( pDoc, rName, aTokArray );
-pDoc->GetRangeName()->insert( pRangeData );
+pDoc->GetRangeName( rRange.aStart.Tab() )->insert( pRangeData );
 }
 
 void ScHTMLImport::WriteToDocument(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-06-11 Thread Justin Luth
 sc/qa/unit/data/ods/tdf113991_relativeNamedRanges.ods |binary
 sc/qa/unit/subsequent_export-test.cxx |   22 ++
 sc/source/filter/excel/xename.cxx |   63 --
 3 files changed, 80 insertions(+), 5 deletions(-)

New commits:
commit b7a30d4bfbcf6b4c4fd773e8e1a436928e1224e3
Author: Justin Luth 
Date:   Sat May 5 19:39:59 2018 +0300

tdf#113991 xls/xlsx export: no relative sheet in named ranges

MSO apparently requires absolute sheet references
in named ranges.

XLS and XLSX compose the range in entirely different ways.
XLS doesn't use the sSymbol result at all, while XLSX is
entirely dependent upon it.

XLS doesn't require the range to be 3D in order to be absolute,
but XLSX and ODS do require that, so it only makes sense to ensure
that 3D is always enabled when the range changes to absolute
in order to enhance inter-operability.

GLOBAL names will be handled in a followup commit.

Change-Id: Idd2bd841264fdbb30e861da8956da3d28158dfa3
Reviewed-on: https://gerrit.libreoffice.org/54739
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/ods/tdf113991_relativeNamedRanges.ods 
b/sc/qa/unit/data/ods/tdf113991_relativeNamedRanges.ods
new file mode 100644
index ..ed5c6ce3bc09
Binary files /dev/null and 
b/sc/qa/unit/data/ods/tdf113991_relativeNamedRanges.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 3ff3c4301e3d..5eda7f6ef609 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -179,6 +179,7 @@ public:
 #endif
 void testAbsNamedRangeHTML();
 void testSheetLocalRangeNameXLS();
+void testRelativeNamedExpressionsXLS();
 void testSheetTextBoxHyperlinkXLSX();
 void testFontSizeXLSX();
 void testSheetCharacterKerningSpaceXLSX();
@@ -286,6 +287,7 @@ public:
 CPPUNIT_TEST(testPreserveTextWhitespace2XLSX);
 CPPUNIT_TEST(testAbsNamedRangeHTML);
 CPPUNIT_TEST(testSheetLocalRangeNameXLS);
+CPPUNIT_TEST(testRelativeNamedExpressionsXLS);
 CPPUNIT_TEST(testSheetTextBoxHyperlinkXLSX);
 CPPUNIT_TEST(testFontSizeXLSX);
 CPPUNIT_TEST(testSheetCharacterKerningSpaceXLSX);
@@ -3364,6 +3366,26 @@ void ScExportTest::testSheetLocalRangeNameXLS()
 xDocSh2->DoClose();
 }
 
+void ScExportTest::testRelativeNamedExpressionsXLS()
+{
+ScDocShellRef xDocSh = loadDoc("tdf113991_relativeNamedRanges.", 
FORMAT_ODS);
+xDocSh->DoHardRecalc();
+ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLS);
+xDocSh->DoClose();
+xDocSh2->DoHardRecalc();
+ScDocument& rDoc = xDocSh2->GetDocument();
+
+// Sheet1:G3
+ScAddress aPos(6,2,0);
+CPPUNIT_ASSERT_EQUAL(1.0, rDoc.GetValue(aPos));
+ASSERT_FORMULA_EQUAL(rDoc, aPos, "single_cell_A3", nullptr);
+// Sheet2:F6
+aPos = ScAddress(5,5,1);
+CPPUNIT_ASSERT_EQUAL(18.0, rDoc.GetValue(aPos));
+ASSERT_FORMULA_EQUAL(rDoc, aPos, "SUM(test_conflict)", nullptr);
+xDocSh2->DoClose();
+}
+
 void ScExportTest::testSheetTextBoxHyperlinkXLSX()
 {
 ScDocShellRef xShell = loadDoc("textbox-hyperlink.", FORMAT_XLSX);
diff --git a/sc/source/filter/excel/xename.cxx 
b/sc/source/filter/excel/xename.cxx
index 84ab353ee2d8..c55840e2532e 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -23,6 +23,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -334,6 +335,41 @@ void XclExpName::WriteBody( XclExpStream& rStrm )
 mxTokArr->WriteArray( rStrm );  // token array without size
 }
 
+void lcl_EnsureAbs3DToken( const SCTAB nTab, formula::FormulaToken* pTok )
+{
+if ( !pTok || ( pTok->GetType() != formula::svSingleRef && pTok->GetType() 
!= formula::svDoubleRef ) )
+return;
+
+ScSingleRefData* pRef1 = pTok->GetSingleRef();
+if ( !pRef1 )
+return;
+
+ScSingleRefData* pRef2 = nullptr;
+if ( pTok->GetType() == formula::svDoubleRef )
+pRef2 = pTok->GetSingleRef2();
+
+if ( pRef1->IsTabRel() || !pRef1->IsFlag3D() )
+{
+if ( pRef1->IsTabRel() && nTab != SCTAB_GLOBAL )
+pRef1->SetAbsTab( nTab + pRef1->Tab() );  //XLS requirement
+if ( !pRef1->IsTabRel() )
+{
+pRef1->SetFlag3D( true );  //XLSX requirement
+if ( pRef2 && !pRef2->IsTabRel() )
+pRef2->SetFlag3D( pRef2->Tab() != pRef1->Tab() );
+}
+}
+
+if ( pRef2 && pRef2->IsTabRel() && !pRef1->IsTabRel() )
+{
+if ( nTab != SCTAB_GLOBAL )
+{
+pRef2->SetAbsTab( nTab + pRef2->Tab() );
+pRef2->SetFlag3D( pRef2->Tab() != pRef1->Tab() );
+}
+}
+}
+
 XclExpNameManagerImpl::XclExpNameManagerImpl( const XclExpRoot& rRoot ) :
 XclExpRoot( rRoot ),
 mnFirstUserIdx( 0 )
@@ -543,12 +579,29 @@ sal_uInt16 

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

2018-06-07 Thread Vasily Melenchuk
 sc/qa/unit/data/ods/tdf62268.ods   |binary
 sc/qa/unit/helper/qahelper.cxx |3 +
 sc/qa/unit/subsequent_export-test.cxx  |   59 +++--
 sc/qa/unit/subsequent_filters-test.cxx |   26 --
 sc/source/filter/xml/xmlimprt.cxx  |   21 +++
 sc/source/filter/xml/xmlimprt.hxx  |5 ++
 sc/source/filter/xml/xmlrowi.cxx   |   16 
 7 files changed, 94 insertions(+), 36 deletions(-)

New commits:
commit 1e55a47e89a9d9d6cf9cb3993484022aaf2c097b
Author: Vasily Melenchuk 
Date:   Fri Apr 6 20:19:10 2018 +0300

tdf#62268: allow row height recalculation on document load

During document load rows with style:use-optimal-row-height="true"
should recalculate it's height.

Change-Id: Ib38b5b753d9ff8352116d77851d228c5d77bd530
Reviewed-on: https://gerrit.libreoffice.org/52521
Reviewed-by: Katarina Behrens 
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 

diff --git a/sc/qa/unit/data/ods/tdf62268.ods b/sc/qa/unit/data/ods/tdf62268.ods
new file mode 100644
index ..da88adfd25cd
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf62268.ods differ
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index 8aa9cc883568..ed660cfa7928 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -754,7 +754,8 @@ void ScBootstrapFixture::miscRowHeightsTest( TestParam 
const * aTestValues, unsi
 bool bOpt = !(rDoc.GetRowFlags( nRow, nTab ) & 
CRFlags::ManualSize);
 CPPUNIT_ASSERT_EQUAL(aTestValues[ index ].pData[ i 
].bOptimal, bOpt);
 }
-CPPUNIT_ASSERT_EQUAL(nExpectedHeight, nHeight);
+// Due to some minor differences on Mac this comparison is 
made bit fuzzy
+CPPUNIT_ASSERT_LESSEQUAL( 3, abs( nHeight - nExpectedHeight ) 
);
 }
 }
 xShell->DoClose();
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index bf1813ee7edd..3ff3c4301e3d 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -1026,60 +1026,57 @@ void ScExportTest::testOutlineExportXLSX()
 // We expected that exactly 13 unique Nodes will be produced
 assertXPath(pSheet, "/x:worksheet/x:cols/x:col", 13);
 
-// We need to save all 30 rows, as it provides information about 
outLineLevel
-assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "r", "1");
+// First row is empty and default so it is not written into XML file
+// so we need to save 29 rows, as it provides information about 
outLineLevel
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "r", "2");
 assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "hidden", 
"false");
-assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "outlineLevel", 
"0");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "outlineLevel", 
"1");
 assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "collapsed", 
"false");
-assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "r", "2");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "r", "3");
 assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "hidden", 
"false");
-assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "outlineLevel", 
"1");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "outlineLevel", 
"2");
 assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "collapsed", 
"false");
-assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "r", "3");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "r", "4");
 assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "hidden", 
"false");
 assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "outlineLevel", 
"2");
 assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "collapsed", 
"false");
-assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "r", "4");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "r", "5");
 assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "hidden", 
"false");
-assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "outlineLevel", 
"2");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "outlineLevel", 
"3");
 assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "collapsed", 
"false");
-assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[5]", "r", "5");
+assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[5]", "r", "6");
 assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[5]", "hidden", 
"false");
 assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[5]", "outlineLevel", 
"3");
 assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[5]", "collapsed", 
"false");
-assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[6]", "r", "6");
-assertXPath(pSheet, 

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

2018-06-04 Thread Justin Luth
 sc/qa/unit/subsequent_export-test.cxx |   16 
 sc/source/filter/html/htmlimp.cxx |2 ++
 2 files changed, 18 insertions(+)

New commits:
commit c42b1cf2464924b125aeae15968fb79cf795bc81
Author: Justin Luth 
Date:   Wed May 23 08:36:54 2018 +0300

tdf#114487 sc htmlimp: rangeNames should be 3D

Without a visible sheet name, these absolute ranges
become relative after a round-trip.

Another way to handle this would be to ensure that ODS
(and other text-based formats) export Absolute in a
way that can be properly imported. But handling
it on import is safer and ensures UI consistency.

The InitRange default is for !IsFlag3D and !IsTabRel().
Since the range already imports as absolute, just add
the appropriate 3D flags.

Change-Id: Ia664e6f87e235096e1c2e5b702e18505e375e2ad
Reviewed-on: https://gerrit.libreoffice.org/54725
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 2a7a76e244a8..8762cbcc339a 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -175,6 +175,7 @@ public:
 #if !defined _WIN32
 void testSupBookVirtualPathXLS();
 #endif
+void testAbsNamedRangeHTML();
 void testSheetLocalRangeNameXLS();
 void testSheetTextBoxHyperlinkXLSX();
 void testFontSizeXLSX();
@@ -281,6 +282,7 @@ public:
 CPPUNIT_TEST(testImageWithSpecialID);
 CPPUNIT_TEST(testPreserveTextWhitespaceXLSX);
 CPPUNIT_TEST(testPreserveTextWhitespace2XLSX);
+CPPUNIT_TEST(testAbsNamedRangeHTML);
 CPPUNIT_TEST(testSheetLocalRangeNameXLS);
 CPPUNIT_TEST(testSheetTextBoxHyperlinkXLSX);
 CPPUNIT_TEST(testFontSizeXLSX);
@@ -3325,6 +3327,20 @@ void ScExportTest::testImageWithSpecialID()
 }
 }
 
+void ScExportTest::testAbsNamedRangeHTML()
+{
+ScDocShellRef xDocSh = loadDoc("numberformat.", FORMAT_HTML);
+xDocSh->DoHardRecalc();
+ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_ODS);
+xDocSh->DoClose();
+xDocSh2->DoHardRecalc();
+
+ScDocument& rDoc = xDocSh2->GetDocument();
+ScRangeData* pRangeData = 
rDoc.GetRangeName()->findByUpperName(OUString("HTML_1"));
+ScSingleRefData* pRef = 
pRangeData->GetCode()->FirstToken()->GetSingleRef();
+CPPUNIT_ASSERT_MESSAGE("HTML_1 is an absolute 
reference",!pRef->IsTabRel());
+}
+
 void ScExportTest::testSheetLocalRangeNameXLS()
 {
 ScDocShellRef xDocSh = loadDoc("named-ranges-local.", FORMAT_XLS);
diff --git a/sc/source/filter/html/htmlimp.cxx 
b/sc/source/filter/html/htmlimp.cxx
index a5f1f11abe4b..4957b2d381ad 100644
--- a/sc/source/filter/html/htmlimp.cxx
+++ b/sc/source/filter/html/htmlimp.cxx
@@ -102,6 +102,8 @@ void ScHTMLImport::InsertRangeName( ScDocument* pDoc, const 
OUString& rName, con
 {
 ScComplexRefData aRefData;
 aRefData.InitRange( rRange );
+aRefData.Ref1.SetFlag3D( true );
+aRefData.Ref2.SetFlag3D( aRefData.Ref2.Tab() != aRefData.Ref1.Tab() );
 ScTokenArray aTokArray;
 aTokArray.AddDoubleReference( aRefData );
 ScRangeData* pRangeData = new ScRangeData( pDoc, rName, aTokArray );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-05-29 Thread Caolán McNamara
 sc/qa/unit/data/xls/forcepoint-pivot-1.xls |binary
 sc/source/filter/excel/xipivot.cxx |8 
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 0162cfd55f397ded2af7d32f50cb3cba763c68bc
Author: Caolán McNamara 
Date:   Mon May 28 21:22:56 2018 +0100

forcepoint#40 null deref

presumably since

commit 0098bee792c3e208ea4f6ef1c676958d3f4cd207
Date:   Thu Sep 21 06:48:09 2017 +0200

tdf#112501: Pivot table: popupbuttons are placed on wrong cells

Change-Id: I5413c0ba06fca25cb22256a20ef9640767dd9e50
Reviewed-on: https://gerrit.libreoffice.org/54968
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/qa/unit/data/xls/forcepoint-pivot-1.xls 
b/sc/qa/unit/data/xls/forcepoint-pivot-1.xls
new file mode 100644
index ..12919922666b
Binary files /dev/null and b/sc/qa/unit/data/xls/forcepoint-pivot-1.xls differ
diff --git a/sc/source/filter/excel/xipivot.cxx 
b/sc/source/filter/excel/xipivot.cxx
index 118e9a014691..b0452408054b 100644
--- a/sc/source/filter/excel/xipivot.cxx
+++ b/sc/source/filter/excel/xipivot.cxx
@@ -1566,13 +1566,13 @@ void XclImpPivotTable::ApplyMergeFlags(const ScRange& 
rOutRange, const ScDPSaveD
 itr= aFieldBtns.begin();
 itrEnd = aFieldBtns.end();
 vector::const_iterator itDim = 
aFieldDims.begin();
-for (; itr != itrEnd; ++itr, ++itDim)
+for (; itr != itrEnd; ++itr)
 {
 ScMF nMFlag = ScMF::Button;
-const ScDPSaveDimension* pDim = *itDim;
-if (pDim->HasInvisibleMember())
+const ScDPSaveDimension* pDim = itDim != aFieldDims.end() ? 
*itDim++ : nullptr;
+if (pDim && pDim->HasInvisibleMember())
 nMFlag |= ScMF::HiddenMember;
-if (!pDim->IsDataLayout())
+if (!pDim || !pDim->IsDataLayout())
 nMFlag |= ScMF::ButtonPopup;
 rDoc.ApplyFlagsTab(itr->Col(), itr->Row(), itr->Col(), itr->Row(), 
itr->Tab(), nMFlag);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-05-09 Thread Winfried Donkers
 sc/qa/unit/data/functions/statistical/fods/countif.fods |   22 
 sc/source/core/data/dociter.cxx |2 -
 2 files changed, 18 insertions(+), 6 deletions(-)

New commits:
commit 1a8febcaa4f932124d417877a3b08bd059c0362d
Author: Winfried Donkers 
Date:   Wed May 9 10:40:03 2018 +0200

tdf#117433 count empty cells properly with COUNTIF.

All empty columns after the first column of the range were skipped.
When the query contains an 'cell is empty' expression, skipping is omitted.

Change-Id: I0d5b0d24c2d08bad88479cd5b356529a0a709156
Reviewed-on: https://gerrit.libreoffice.org/54021
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/statistical/fods/countif.fods 
b/sc/qa/unit/data/functions/statistical/fods/countif.fods
index 557e70b2044f..8625ebe7aeff 100644
--- a/sc/qa/unit/data/functions/statistical/fods/countif.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/countif.fods
@@ -3865,10 +3865,22 @@
  
 
 
- 
- 
- 
- 
+ 
+  12
+ 
+ 
+  12
+ 
+ 
+  TRUE
+ 
+ 
+  =COUNTIF(P20:R23,)
+ 
+ 
+  tdf#117433
+ 
+ 
  
  
  
@@ -4469,4 +4481,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index b09c4413301b..0c74233f4c90 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1144,7 +1144,7 @@ bool ScQueryCellIterator::GetThis()
 }
 pCol = &(pDoc->maTabs[nTab])->aCol[nCol];
 }
-while (pCol->IsEmptyData());
+while (!rItem.mbMatchEmpty && pCol->IsEmptyData());
 
 InitPos();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-05-03 Thread Winfried Donkers
 sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods |  145 
 sc/source/core/tool/interpr3.cxx|2 
 2 files changed, 146 insertions(+), 1 deletion(-)

New commits:
commit 5cee94308b8dbceb11de4ac02e1d7c9808ccdb02
Author: Winfried Donkers 
Date:   Wed May 2 15:51:48 2018 +0200

tdf#117041 use correct expression in if statement.

Follow up of commit e58b3f987681d0034f692db82345af06de217836.

Change-Id: Ia142ae401a8c86e3411830703794eedb351bca09
Reviewed-on: https://gerrit.libreoffice.org/53733
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods 
b/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods
index 86e67be89a36..4b57e0150907 100644
--- a/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods
@@ -4469,6 +4469,151 @@
  
 
 
+
+  1
+ 
+ 
+  1
+ 
+ 
+  TRUE
+ 
+ 
+  =HYPGEOMDIST(2,4,1,10,1)
+ 
+ 
+  tdf117041
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+
+
+  0
+ 
+ 
+  0
+ 
+ 
+  TRUE
+ 
+ 
+  =HYPGEOMDIST(2,4,1,10,1)
+ 
+ 
+  tdf117041
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+
+
+  0.4
+ 
+ 
+  0.4
+ 
+ 
+  TRUE
+ 
+ 
+  =HYPGEOMDIST(1,4,1,10,0)
+ 
+ 
+  tdf117041
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+
+
+  0
+ 
+ 
+  0
+ 
+ 
+  TRUE
+ 
+ 
+  =HYPGEOMDIST(1,4,4,6,0)
+ 
+ 
+  tdf117041
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+
+
+  0.4
+ 
+ 
+  0.4
+ 
+ 
+  TRUE
+ 
+ 
+  =HYPGEOMDIST(2,4,4,6,0)
+ 
+ 
+  tdf117041
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+
  
  
  
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 2a9535e31c8d..b52a62fd3d20 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -1868,7 +1868,7 @@ void ScInterpreter::ScHypGeomDist( int nMinParamCount )
 
 for ( int i = ( bCumulative ? 0 : x ); i <= x && nGlobalError == 
FormulaError::NONE; i++ )
 {
-if ( (i >= n - N + M)  || (i >= M) )
+if ( (n - i <= N - M) && (i <= M) )
 fVal +=  GetHypGeomDist( i, n, M, N );
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-25 Thread Winfried Donkers
 sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods |   73 ++--
 sc/source/core/tool/interpr3.cxx|   20 +--
 2 files changed, 71 insertions(+), 22 deletions(-)

New commits:
commit e58b3f987681d0034f692db82345af06de217836
Author: Winfried Donkers 
Date:   Fri Apr 20 21:23:08 2018 +0200

tdf#117041 implement note at end of ODFF1.2 par. 6.18.37

And avoid double code by putting the non-cumulative calculation in
the loop as well.

Change-Id: I8538582e7d33370f5e44382924b9e3e89efa28dd
Reviewed-on: https://gerrit.libreoffice.org/53221
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods 
b/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods
index 668562200ee5..86e67be89a36 100644
--- a/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods
@@ -4385,11 +4385,22 @@
  
 
 
- 
- 
- 
- 
- 
+ 
+  0.988500551352757
+ 
+ 
+  0.988500551352757
+ 
+ 
+  TRUE
+ 
+ 
+  =HYPGEOMDIST(53,55,269,300,1)
+ 
+ 
+  tdf117041
+ 
+ 
  
  
  
@@ -4399,12 +4410,52 @@
  
  
 
-
- 
+
+ 
+  0.95624768719555
+ 
+ 
+  0.95624768719555
+ 
+ 
+  TRUE
+ 
+ 
+  =HYPGEOMDIST(34,36,89,100,1)
+ 
+ 
+  tdf117041
+ 
+ 
+ 
+ 
+ 
+  
+ 
  
- 
- 
- 
+ 
+ 
+ 
+ 
+ 
+
+
+
+  0
+ 
+ 
+  0
+ 
+ 
+  TRUE
+ 
+ 
+  =HYPGEOMDIST(24,36,89,100)
+ 
+ 
+  tdf117041
+ 
+ 
  
  
  
@@ -5084,4 +5135,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 46328e5d8009..2a9535e31c8d 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -1844,7 +1844,7 @@ static void lcl_PutFactorialElements( ::std::vector< 
double >& cn, double fLower
 
 @see fdo#71722
 @see tdf#102948, make Calc function ODFF1.2-compliant
-
+@see tdf#117041, implement note at bottom of ODFF1.2 par.6.18.37
  */
 void ScInterpreter::ScHypGeomDist( int nMinParamCount )
 {
@@ -1858,23 +1858,21 @@ void ScInterpreter::ScHypGeomDist( int nMinParamCount )
 double n = ::rtl::math::approxFloor(GetDouble());
 double x = ::rtl::math::approxFloor(GetDouble());
 
-if( (x < 0.0) || (n < x) || (M < x) || (N < n) || (N < M) || (x < n - N + 
M) )
+if ( (x < 0.0) || (n < x) || (N < n) || (N < M) || (M < 0.0) )
 {
 PushIllegalArgument();
 return;
 }
 
-if ( bCumulative )
-{
-double fVal = 0.0;
-
-for ( int i = 0; i <= x && nGlobalError == FormulaError::NONE; i++ )
-fVal += GetHypGeomDist( i, n, M, N );
+double fVal = 0.0;
 
-PushDouble( fVal );
+for ( int i = ( bCumulative ? 0 : x ); i <= x && nGlobalError == 
FormulaError::NONE; i++ )
+{
+if ( (i >= n - N + M)  || (i >= M) )
+fVal +=  GetHypGeomDist( i, n, M, N );
 }
-else
-PushDouble( GetHypGeomDist( x, n, M, N ) );
+
+PushDouble( fVal );
 }
 
 /** Calculates a value of the hypergeometric distribution.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-16 Thread Gabor Kelemen
 sc/qa/unit/subsequent_export-test.cxx  |1 -
 sc/qa/unit/ucalc.cxx   |1 -
 sc/source/core/data/colorscale.cxx |1 -
 sc/source/core/data/documen2.cxx   |1 -
 sc/source/core/data/documen7.cxx   |2 --
 sc/source/core/data/document.cxx   |1 -
 sc/source/core/data/dpdimsave.cxx  |1 -
 sc/source/core/data/dpitemdata.cxx |1 -
 sc/source/core/data/dpobject.cxx   |1 -
 sc/source/core/data/global2.cxx|1 -
 sc/source/core/data/pivot2.cxx |1 -
 sc/source/core/data/table2.cxx |1 -
 sc/source/core/data/table4.cxx |1 -
 sc/source/core/tool/address.cxx|1 -
 sc/source/core/tool/appoptio.cxx   |5 ++---
 sc/source/core/tool/compiler.cxx   |1 -
 sc/source/core/tool/consoli.cxx|1 -
 sc/source/core/tool/docoptio.cxx   |2 --
 sc/source/core/tool/inputopt.cxx   |1 -
 sc/source/core/tool/interpr1.cxx   |1 -
 sc/source/core/tool/interpr2.cxx   |1 -
 sc/source/core/tool/interpr3.cxx   |1 -
 sc/source/core/tool/rangeutl.cxx   |2 --
 sc/source/core/tool/token.cxx  |1 -
 sc/source/core/tool/viewopti.cxx   |1 -
 sc/source/filter/excel/excdoc.cxx  |1 -
 sc/source/filter/excel/excimp8.cxx |1 -
 sc/source/filter/excel/excrecds.cxx|1 -
 sc/source/filter/excel/exctools.cxx|1 -
 sc/source/filter/excel/read.cxx|1 +
 sc/source/filter/excel/xehelper.cxx|1 +
 sc/source/filter/excel/xename.cxx  |1 -
 sc/source/filter/ftools/fprogressbar.cxx   |1 +
 sc/source/filter/inc/fprogressbar.hxx  |1 -
 sc/source/filter/xml/XMLExportDatabaseRanges.cxx   |1 -
 sc/source/filter/xml/xmldrani.cxx  |1 -
 sc/source/ui/Accessibility/AccessibleCellBase.cxx  |2 --
 sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx |2 --
 sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx|1 +
 sc/source/ui/StatisticsDialogs/ChiSquareTestDialog.cxx |1 +
 sc/source/ui/StatisticsDialogs/CorrelationDialog.cxx   |1 +
 sc/source/ui/StatisticsDialogs/CovarianceDialog.cxx|1 +
 sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx |1 +
 sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx  |1 +
 sc/source/ui/StatisticsDialogs/FTestDialog.cxx |1 +
 sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx   |1 +
 sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx |1 +
 sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx |1 +
 sc/source/ui/StatisticsDialogs/RegressionDialog.cxx|1 +
 sc/source/ui/StatisticsDialogs/SamplingDialog.cxx  |1 +
 sc/source/ui/StatisticsDialogs/TTestDialog.cxx |1 +
 sc/source/ui/StatisticsDialogs/ZTestDialog.cxx |1 +
 sc/source/ui/app/scmod.cxx |2 --
 sc/source/ui/attrdlg/attrdlg.cxx   |1 -
 sc/source/ui/attrdlg/tabpages.cxx  |1 -
 sc/source/ui/condformat/condformatdlg.cxx  |2 --
 sc/source/ui/condformat/condformatdlgentry.cxx |2 +-
 sc/source/ui/condformat/condformatmgr.cxx  |1 -
 sc/source/ui/dbgui/dapidata.cxx|1 -
 sc/source/ui/dbgui/dapitype.cxx|1 -
 sc/source/ui/dbgui/dbnamdlg.cxx|1 -
 sc/source/ui/dbgui/dpgroupdlg.cxx  |1 -
 sc/source/ui/dbgui/imoptdlg.cxx|1 -
 sc/source/ui/dbgui/pfiltdlg.cxx|1 -
 sc/source/ui/dbgui/scendlg.cxx |1 -
 sc/source/ui/dbgui/sortdlg.cxx |1 -
 sc/source/ui/dbgui/subtdlg.cxx |1 -
 sc/source/ui/docshell/tpstat.cxx   |1 -
 

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

2018-04-10 Thread Michael Meeks
 sc/qa/unit/data/functions/spreadsheet/fods/vlookup2.fods | 1562 +++
 sc/source/core/data/table3.cxx   |9 
 2 files changed, 1571 insertions(+)

New commits:
commit a953fa1c0f6a40a08859570516c511f3a8410a35
Author: Michael Meeks 
Date:   Sun Apr 8 00:24:15 2018 +0100

vlookup - optimize SC_EQUAL and NOT_EQUAL.

Also don't accept partial matches ie. CONTAINS != EQUAL,
for VLOOKUP even if document option "search criteria =, <>
for whole cells" is turned off.

This also adds a new spreadsheet test file vlookup2.fods
with the option "search criteria =,<> for whole cells" turned off,
with VLOOKUP test cases that ensures that partial matches are not
accepted.

Change-Id: Ib1f4781b216431546c3fd6967f22518e86abf36b
Reviewed-on: https://gerrit.libreoffice.org/52589
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/vlookup2.fods 
b/sc/qa/unit/data/functions/spreadsheet/fods/vlookup2.fods
new file mode 100644
index ..d47779d928a1
--- /dev/null
+++ b/sc/qa/unit/data/functions/spreadsheet/fods/vlookup2.fods
@@ -0,0 +1,1562 @@
+
+
+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-05-23T19:52:21.032366237P0D1LibreOfficeDev/6.1.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/c6d3d0642e0f5d24cab402a8a7c6f81406d044cf
+ 
+  
+   0
+   0
+   30809
+   2257
+   
+
+ view1
+ 
+  
+   2
+   15
+   0
+   0
+   0
+   0
+   2
+   0
+   0
+   0
+   0
+   0
+   80
+   60
+   true
+   false
+  
+  
+   12
+   6
+   0
+   0
+   0
+   0
+   2
+   0
+   0
+   0
+   0
+   0
+   80
+   60
+   true
+   false
+  
+ 
+ Sheet1
+ 1658
+ 0
+ 80
+ 60
+ false
+ true
+ true
+ true
+ 12632256
+ true
+ true
+ true
+ true
+ false
+ false
+ false
+ 1270
+ 1270
+ 1
+ 1
+ true
+ false
+
+   
+  
+  
+   7
+   true
+   false
+   false
+   0
+   false
+   owH+/0Rlc2tKZXRfMjEzMAAAQ1VQUzpEZXNrSmV0XzIxMzAWAAMAwAAEAAhSAAAEdAAASm9iRGF0YSAxCnByaW50ZXI9RGVza0pldF8yMTMwCm9yaWVudGF0aW9uPVBvcnRyYWl0CmNvcGllcz0xCmNvbGxhdGU9ZmFsc2UKbWFyZ2luZGFqdXN0bWVudD0wLDAsMCwwCmNvbG9yZGVwdGg9MjQKcHNsZXZlbD0wCnBkZmRldmljZT0xCmNvbG9yZGV2aWNlPTAKUFBEQ29udGV4RGF0YQpJbnB1dFNsb3Q6TWFpbgBQYWdlU2l6ZTpBNAAAEgBDT01QQVRfRFVQTEVYX01PREUTAER1cGxleE1vZGU6OlVua25vd24=
+   DeskJet_2130
+   
+
+ en
+ US
+ 
+ 
+ 
+
+   
+   true
+   3
+   true
+   false
+   true
+   true
+   12632256
+   true
+   true
+   false
+   true
+   false
+   true
+   false
+   true
+   1
+   false
+   1270
+   1270
+   false
+   1
+   true
+  
+ 
+ 
+  
+   http://openoffice.org/2004/office; 

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

2018-04-09 Thread Winfried Donkers
 sc/qa/unit/data/functions/mathematical/fods/aggregate.fods |   40 -
 sc/source/core/tool/interpr6.cxx   |6 +
 2 files changed, 42 insertions(+), 4 deletions(-)

New commits:
commit 0a4c1fb68c3619e61099a7c548f550b0d3fd7a53
Author: Winfried Donkers 
Date:   Fri Apr 6 19:55:12 2018 +0200

tdf#116706 fix for AGGREGATE with hidden rows and single references.

Change-Id: I6ac88f26b46a17e1857b7b40d2034fb321973625
Reviewed-on: https://gerrit.libreoffice.org/52522
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/qa/unit/data/functions/mathematical/fods/aggregate.fods 
b/sc/qa/unit/data/functions/mathematical/fods/aggregate.fods
index 66162e697742..62e72ca08da6 100644
--- a/sc/qa/unit/data/functions/mathematical/fods/aggregate.fods
+++ b/sc/qa/unit/data/functions/mathematical/fods/aggregate.fods
@@ -5881,7 +5881,43 @@
  
  
 
-
+
+ 
+  0
+ 
+ 
+  0
+ 
+ 
+  TRUE
+ 
+ 
+  =AGGREGATE(3,5,$C$6)
+ 
+ 
+  tdf116706
+ 
+ 
+
+
+ 
+  0
+ 
+ 
+  0
+ 
+ 
+  TRUE
+ 
+ 
+  =AGGREGATE(3,5,$C$6:$C$6)
+ 
+ 
+  tdf116706
+ 
+ 
+
+
  
 
 
@@ -5920,4 +5956,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index e1bc0d696b0b..4d5febc210e1 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -678,8 +678,10 @@ void ScInterpreter::IterateParameters( ScIterFunc eFunc, 
bool bTextAsZero )
 ++nCount;
 break;
 }
-if ( ( mnSubTotalFlags & SubtotalFlags::IgnoreFiltered ) &&
- pDok->RowFiltered( aAdr.Row(), aAdr.Tab() ) )
+if ( ( ( mnSubTotalFlags & SubtotalFlags::IgnoreFiltered ) &&
+ pDok->RowFiltered( aAdr.Row(), aAdr.Tab() ) ) ||
+ ( ( mnSubTotalFlags & SubtotalFlags::IgnoreHidden ) &&
+   pDok->RowHidden( aAdr.Row(), aAdr.Tab() ) ) )
 {
 break;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-29 Thread Winfried Donkers
 sc/qa/unit/data/functions/statistical/fods/mode.mult.fods |   28 ++--
 sc/source/core/inc/interpre.hxx   |3 
 sc/source/core/tool/interpr3.cxx  |   89 ++
 sc/source/core/tool/interpr4.cxx  |4 
 sc/source/core/tool/interpr5.cxx  |   63 -
 5 files changed, 81 insertions(+), 106 deletions(-)

New commits:
commit fc121c32ca0effb47d219066a6848435cba562cc
Author: Winfried Donkers 
Date:   Wed Mar 21 16:57:36 2018 +0100

tdf#97977 make MODE.MULT fully compatible with Excel.

Also, improve efficiency of function.

Change-Id: Id01542bdd997e0cacfdfd16683d1ac832d22fa35
Reviewed-on: https://gerrit.libreoffice.org/51708
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/statistical/fods/mode.mult.fods 
b/sc/qa/unit/data/functions/statistical/fods/mode.mult.fods
index e26bd6673d3a..23a631162d52 100644
--- a/sc/qa/unit/data/functions/statistical/fods/mode.mult.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/mode.mult.fods
@@ -3416,8 +3416,8 @@
   1
  
  
- 
-  1
+ 
+  2
  
  
 
@@ -3443,8 +3443,8 @@
  
  
  
- 
-  2
+ 
+  1
  
  
 
@@ -3669,11 +3669,11 @@
  
 
 
- 
-  1
+ 
+  2
  
- 
-  1
+ 
+  2
  
  
   TRUE
@@ -3688,11 +3688,11 @@
  
 
 
- 
-  2
+ 
+  1
  
- 
-  2
+ 
+  1
  
  
   TRUE
@@ -3780,7 +3780,7 @@
   {=MODE.MULT(J15:L17)}
  
  
-  Calc returns the result array as a sorted array and Excel does 
not. 
+   
  
  
  
@@ -4210,4 +4210,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 71bf46a80c50..e7d7f5e2aff8 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -932,8 +932,7 @@ private:
 void GetSortArray( sal_uInt8 nParamCount, ::std::vector& 
rSortArray, ::std::vector* pIndexOrder, bool bConvertTextInArray, bool 
bAllowEmptyArray );
 static void QuickSort(::std::vector& rSortArray, 
::std::vector* pIndexOrder);
 void ScModalValue();
-void ScModalValue_MS();
-void ScModalValue_Multi();
+void ScModalValue_MS( bool bSingle );
 void ScAveDev();
 void ScAggregate();
 void ScDevSq();
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index b66a27706a68..a33470ec9c30 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -3539,50 +3539,89 @@ void ScInterpreter::ScModalValue()
 }
 }
 
-void ScInterpreter::ScModalValue_MS()
+void ScInterpreter::ScModalValue_MS( bool bSingle )
 {
 sal_uInt8 nParamCount = GetByte();
 if ( !MustHaveParamCountMin( nParamCount, 1 ) )
 return;
 vector aArray;
 GetNumberSequenceArray( nParamCount, aArray, false );
-SCSIZE nSize = aArray.size();
+vector< double > aSortArray( aArray );
+QuickSort( aSortArray, nullptr );
+SCSIZE nSize = aSortArray.size();
 if ( nSize == 0 || nGlobalError != FormulaError::NONE )
 PushNoValue();
 else
 {
-SCSIZE nMaxIndex = 0, nMax = 1, nCount = 1, i, j;
-double nOldVal = aArray[ 0 ];
-
-for ( i = 1; i < nSize ; i++ )
+SCSIZE nMax = 1, nCount = 1;
+double nOldVal = aSortArray[ 0 ];
+vector< double > aResultArray( 1 );
+SCSIZE i;
+for ( i = 1; i < nSize; i++ )
 {
-for ( j = i; j < nSize; j++ )
-{
-if ( aArray[ j ] == nOldVal )
-nCount++;
-}
-if ( nCount > nMax )
-{
-nMax = nCount;
-nMaxIndex = i - 1;
-nCount = 1;
-}
-while ( (i < (nSize - 1)) && (nOldVal == aArray[ i ]) )
-i++;
-if ( ( nSize - i ) > nMax )
+if ( aSortArray[ i ] == nOldVal )
+nCount++;
+else
 {
-nOldVal = aArray[ i ];
+if ( nCount >= nMax && nCount > 1 )
+{
+if ( nCount > nMax )
+{
+nMax = nCount;
+if ( aResultArray.size() != 1 )
+vector< double >( 1 ).swap( aResultArray );
+aResultArray[ 0 ] = nOldVal;
+}
+else
+aResultArray.emplace_back( nOldVal );
+}
+nOldVal = aSortArray[ i ];
 nCount = 1;
 }
-else
-break;
+}
+if ( nCount >= nMax && nCount > 1 )
+{
+   

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

2018-03-26 Thread Caolán McNamara
 sc/qa/unit/data/xls/pass/forcepoint-selfseriesadd.xls |binary
 sc/source/filter/excel/xichart.cxx|5 +
 2 files changed, 5 insertions(+)

New commits:
commit 01582612fe1283025685b09d23aba27435696c92
Author: Caolán McNamara 
Date:   Mon Mar 26 08:57:09 2018 +0100

forcepoint #29 detect illegal self series add

Change-Id: I3bba0f942780c54951a3a810c05cc3b56ca18a5e
Reviewed-on: https://gerrit.libreoffice.org/51854
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/qa/unit/data/xls/pass/forcepoint-selfseriesadd.xls 
b/sc/qa/unit/data/xls/pass/forcepoint-selfseriesadd.xls
new file mode 100755
index ..e5eafd262520
Binary files /dev/null and 
b/sc/qa/unit/data/xls/pass/forcepoint-selfseriesadd.xls differ
diff --git a/sc/source/filter/excel/xichart.cxx 
b/sc/source/filter/excel/xichart.cxx
index 91774388322c..50329d2350b4 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -1872,6 +1872,11 @@ void XclImpChSeries::SetDataLabel( const 
XclImpChTextRef& xLabel )
 void XclImpChSeries::AddChildSeries( const XclImpChSeries& rSeries )
 {
 OSL_ENSURE( !HasParentSeries(), "XclImpChSeries::AddChildSeries - not 
allowed for child series" );
+if ( == this)
+{
+SAL_WARN("sc.filter", "self add attempt");
+return;
+}
 
 /*  In Excel, trend lines and error bars are stored as own series. In Calc,
 these are properties of the parent series. This function adds the
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-26 Thread Caolán McNamara
 sc/qa/unit/data/xls/fail/forcepoint-group-range-1.xls |binary
 sc/source/core/data/column3.cxx   |2 ++
 2 files changed, 2 insertions(+)

New commits:
commit 6215deb5d2845e339e82108179d5a5ab91915ffd
Author: Caolán McNamara 
Date:   Mon Mar 26 09:23:48 2018 +0100

forcepoint #30 check validity of group range

Change-Id: Ie0611f36809b051ce46030e44c137b4e1f8d2fe0
Reviewed-on: https://gerrit.libreoffice.org/51856
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/qa/unit/data/xls/fail/forcepoint-group-range-1.xls 
b/sc/qa/unit/data/xls/fail/forcepoint-group-range-1.xls
new file mode 100755
index ..1aca9c7f113e
Binary files /dev/null and 
b/sc/qa/unit/data/xls/fail/forcepoint-group-range-1.xls differ
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index c5d75e70d7b0..3774086251de 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -3096,6 +3096,8 @@ public:
 xPrevGrp->mnLength += xCurGrp->mnLength;
 pCur->SetCellGroup(xPrevGrp);
 sc::formula_block::iterator itGrpEnd = it;
+if (xCurGrp->mnLength > std::distance(itGrpEnd, itEnd))
+throw css::lang::IllegalArgumentException();
 std::advance(itGrpEnd, xCurGrp->mnLength);
 for (++it; it != itGrpEnd; ++it)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-16 Thread Henry Castro
 sc/qa/unit/tiledrendering/tiledrendering.cxx |   43 +++
 sc/source/ui/app/scmod.cxx   |   32 +++-
 sc/source/ui/formdlg/formula.cxx |6 +--
 sc/source/ui/inc/anyrefdg.hxx|4 +-
 sc/source/ui/miscdlgs/anyrefdg.cxx   |   32 
 5 files changed, 73 insertions(+), 44 deletions(-)

New commits:
commit 009d2756b1678477ec23d5647bd5004c4bff3a62
Author: Henry Castro 
Date:   Thu Mar 15 14:23:48 2018 -0400

lokdialog: do not lock events when opened ScFilter Dialog

When exists 2 or more views and one of the views open the ScFilter dialog,
the other views are locked and no event process.

In tiled rendering case, collaborative editing is not functional with 2 or
more views are locked, so the patch prevents locking the other views

Change-Id: I0133d38ac5ecef4d3ebc22f3e922602704dcd0b3
Reviewed-on: https://gerrit.libreoffice.org/51370
Tested-by: Jenkins 
Reviewed-by: Henry Castro 

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 2eba19977076..cdd9af6df92f 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -30,10 +30,12 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -91,6 +93,7 @@ public:
 void testLanguageStatus();
 void testMultiViewCopyPaste();
 void testIMESupport();
+void testFilterDlg();
 
 CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
 CPPUNIT_TEST(testRowColumnSelections);
@@ -122,6 +125,7 @@ public:
 CPPUNIT_TEST(testLanguageStatus);
 CPPUNIT_TEST(testMultiViewCopyPaste);
 CPPUNIT_TEST(testIMESupport);
+CPPUNIT_TEST(testFilterDlg);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1608,6 +1612,45 @@ void ScTiledRenderingTest::testIMESupport()
 comphelper::LibreOfficeKit::setActive(false);
 }
 
+void ScTiledRenderingTest::testFilterDlg()
+{
+comphelper::LibreOfficeKit::setActive();
+
+createDoc("empty.ods");
+
+// view #1
+SfxViewShell* pView1 = SfxViewShell::Current();
+int nView1 = SfxLokHelper::getView();
+
+// view #2
+SfxLokHelper::createView();
+SfxViewShell* pView2 = SfxViewShell::Current();
+CPPUNIT_ASSERT(pView1 != pView2);
+{
+pView2->GetViewFrame()->GetDispatcher()->Execute(SID_FILTER,
+SfxCallMode::SLOT|SfxCallMode::RECORD);
+}
+
+Scheduler::ProcessEventsToIdle();
+SfxChildWindow* pRefWindow = 
pView2->GetViewFrame()->GetChildWindow(SID_FILTER);
+CPPUNIT_ASSERT(pRefWindow);
+
+// switch to view 1
+SfxLokHelper::setView(nView1);
+CPPUNIT_ASSERT_EQUAL(true, 
pView2->GetViewFrame()->GetDispatcher()->IsLocked());
+CPPUNIT_ASSERT_EQUAL(false, 
pView1->GetViewFrame()->GetDispatcher()->IsLocked());
+
+KeyEvent aEvent(27, KEY_ESCAPE, 0);
+Application::PostKeyEvent(VclEventId::WindowKeyInput, 
pRefWindow->GetWindow(), );
+Application::PostKeyEvent(VclEventId::WindowKeyUp, 
pRefWindow->GetWindow(), );
+
+Scheduler::ProcessEventsToIdle();
+CPPUNIT_ASSERT_EQUAL(false, 
pView2->GetViewFrame()->GetDispatcher()->IsLocked());
+CPPUNIT_ASSERT_EQUAL(false, 
pView1->GetViewFrame()->GetDispatcher()->IsLocked());
+
+comphelper::LibreOfficeKit::setActive(false);
+}
+
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 8cd2725c67d5..29c2c33d81df 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1554,20 +1554,25 @@ void ScModule::SetRefDialog( sal_uInt16 nId, bool bVis, 
SfxViewFrame* pViewFrm )
 }
 }
 
-static SfxChildWindow* lcl_GetChildWinFromAnyView( sal_uInt16 nId )
+static inline SfxChildWindow* lcl_GetChildWinFromCurrentView( sal_uInt16 nId )
 {
-// First, try the current view
 SfxViewFrame* pViewFrm = SfxViewFrame::Current();
 
 // #i46999# current view frame can be null (for example, when closing help)
-SfxChildWindow* pChildWnd = pViewFrm ? pViewFrm->GetChildWindow( nId ) : 
nullptr;
+return pViewFrm ? pViewFrm->GetChildWindow( nId ) : nullptr;
+}
+
+static SfxChildWindow* lcl_GetChildWinFromAnyView( sal_uInt16 nId )
+{
+// First, try the current view
+SfxChildWindow* pChildWnd = lcl_GetChildWinFromCurrentView( nId );
 if ( pChildWnd )
 return pChildWnd;   // found in the current view
 
 //  if not found there, get the child window from any open view
 //  it can be open only in one view because nCurRefDlgId is global
 
-pViewFrm = SfxViewFrame::GetFirst();
+SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst();
 while ( pViewFrm )
 {
 pChildWnd = pViewFrm->GetChildWindow( nId );
@@ -1588,7 +1593,7 @@ bool ScModule::IsModalMode(SfxObjectShell* pDocSh)

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

2018-03-15 Thread Winfried Donkers
 sc/qa/unit/data/functions/statistical/fods/mode.sngl.fods |  114 --
 sc/source/core/inc/interpre.hxx   |1 
 sc/source/core/tool/interpr3.cxx  |   48 +
 sc/source/core/tool/interpr4.cxx  |2 
 4 files changed, 151 insertions(+), 14 deletions(-)

New commits:
commit c71e8df90b916f32a1d7d3a0849d0cdf14924475
Author: Winfried Donkers 
Date:   Thu Mar 1 17:34:23 2018 +0100

tdf#97977 related : make MODE.SNGL comply with Excel.

MODE.SNGL is to return the first occurrence of the number that has the
most occurences in the array of numbers in case of multiple
numbers having the same amount of (maximum) occurrences.

Change-Id: If76115ddc6b84367cbcb75de611f29076a538476
Reviewed-on: https://gerrit.libreoffice.org/50593
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/statistical/fods/mode.sngl.fods 
b/sc/qa/unit/data/functions/statistical/fods/mode.sngl.fods
index e16f7d92d1a1..1dba7a7fcd3f 100644
--- a/sc/qa/unit/data/functions/statistical/fods/mode.sngl.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/mode.sngl.fods
@@ -3925,10 +3925,18 @@
  
 
 
- 
- 
- 
- 
+ 
+  1
+ 
+ 
+  1
+ 
+ 
+  TRUE
+ 
+ 
+  =MODE.SNGL(H1:H12)
+ 
  
  
   10
@@ -3942,15 +3950,97 @@
  
  
 
-
- 
- 
- 
- 
+
+ 
+  4
+ 
+ 
+  4
+ 
+ 
+  TRUE
+ 
+ 
+  =MODE.SNGL(4,2,3,1,1,2,3,4,1,2,3,4)
+ 
  
 
-
- 
+
+ 
+  5
+ 
+ 
+  5
+ 
+ 
+  TRUE
+ 
+ 
+  =MODE.SNGL(5,1,3,4,5,5,1,H1:H4)
+ 
+ 
+
+
+ 
+  1
+ 
+ 
+  1
+ 
+ 
+  TRUE
+ 
+ 
+  =MODE.SNGL(1,2,3,4,1,2,3,4,1,2,3,4,H1:H12)
+ 
+ 
+
+
+ 
+  4
+ 
+ 
+  4
+ 
+ 
+  TRUE
+ 
+ 
+  =MODE.SNGL(4,2,3,1,1,2,3,4,1,2,3,4,H1:H12)
+ 
+ 
+
+
+ 
+  1.00E+000
+ 
+ 
+  1
+ 
+ 
+  TRUE
+ 
+ 
+  =MODE.SNGL(H1:H12,4,2,3,1,1,2,3,4,1,2,3,4)
+ 
+ 
+
+
+ 
+  2.00E+000
+ 
+ 
+  2
+ 
+ 
+  TRUE
+ 
+ 
+  =MODE.SNGL(H2,H1,H3:H12,4,2,3,1,1,2,3,4,1,2,3,4)
+ 
+ 
+
+
  
  
  
@@ -4204,4 +4294,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 3a3450654ff2..8f68245f99d7 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -932,6 +932,7 @@ private:
 void GetSortArray( sal_uInt8 nParamCount, ::std::vector& 
rSortArray, ::std::vector* pIndexOrder, bool bConvertTextInArray, bool 
bAllowEmptyArray );
 static void QuickSort(::std::vector& rSortArray, 
::std::vector* pIndexOrder);
 void ScModalValue();
+void ScModalValue_MS();
 void ScModalValue_Multi();
 void ScAveDev();
 void ScAggregate();
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index edbb01b4e0fa..db91105fcf10 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -3510,7 +3510,6 @@ void ScInterpreter::ScModalValue()
 SCSIZE nMaxIndex = 0, nMax = 1, nCount = 1;
 double nOldVal = aSortArray[0];
 SCSIZE i;
-
 for ( i = 1; i < nSize; i++)
 {
 if (aSortArray[i] == nOldVal)
@@ -3540,6 +3539,53 @@ void ScInterpreter::ScModalValue()
 }
 }
 
+void ScInterpreter::ScModalValue_MS()
+{
+sal_uInt8 nParamCount = GetByte();
+if ( !MustHaveParamCountMin( nParamCount, 1 ) )
+return;
+vector aArray;
+GetNumberSequenceArray( nParamCount, aArray, false );
+SCSIZE nSize = aArray.size();
+if ( nSize == 0 || nGlobalError != FormulaError::NONE )
+PushNoValue();
+else
+{
+SCSIZE nMaxIndex = 0, nMax = 1, nCount = 1, i, j;
+double nOldVal = aArray[ 0 ];
+
+for ( i = 1; i < nSize ; i++ )
+{
+for ( j = i; j < nSize; j++ )
+{
+if ( aArray[ j ] == nOldVal )
+nCount++;
+}
+if ( nCount > nMax )
+{
+nMax = nCount;
+nMaxIndex = i - 1;
+nCount = 1;
+}
+while ( nOldVal == aArray[ i ] && i < nSize - 1 )
+i++;
+if ( ( nSize - i ) > nMax )
+{
+nOldVal = aArray[ i ];
+nCount = 1;
+}
+else
+break;
+}
+if ( nMax == 1 && nCount == 1 )
+PushNoValue();
+else if ( nMax == 1 )
+PushDouble( nOldVal );

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

2018-02-09 Thread Markus Mohrhard
 sc/qa/unit/datatransformation_test.cxx   |4 -
 sc/source/ui/dataprovider/datatransformation.cxx |   50 ---
 sc/source/ui/inc/datatransformation.hxx  |   11 ++---
 sc/source/ui/miscdlgs/dataproviderdlg.cxx|3 -
 4 files changed, 46 insertions(+), 22 deletions(-)

New commits:
commit 8ef47e605372aba103d19f6b8ee8a00dab40fdab
Author: Markus Mohrhard 
Date:   Thu Feb 8 22:44:46 2018 +0100

support multiple columns in column data transformations

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

diff --git a/sc/qa/unit/datatransformation_test.cxx 
b/sc/qa/unit/datatransformation_test.cxx
index 4639d4e087d5..d4c0e11a2642 100644
--- a/sc/qa/unit/datatransformation_test.cxx
+++ b/sc/qa/unit/datatransformation_test.cxx
@@ -53,7 +53,7 @@ void ScDataTransformationTest::testColumnRemove()
 }
 }
 
-sc::ColumnRemoveTransformation aTransformation(5);
+sc::ColumnRemoveTransformation aTransformation({5});
 aTransformation.Transform(*m_pDoc);
 
 for (SCROW nRow = 0; nRow < 10; ++nRow)
@@ -109,7 +109,7 @@ void ScDataTransformationTest::testColumnMerge()
 m_pDoc->SetString(4, 2, 0, "France");
 m_pDoc->SetString(4, 3, 0, "China");
 
-sc::MergeColumnTransformation aTransform(2, 4, ", ");
+sc::MergeColumnTransformation aTransform({2, 4}, ", ");
 aTransform.Transform(*m_pDoc);
 
 CPPUNIT_ASSERT_EQUAL(OUString("Berlin, Germany"), m_pDoc->GetString(2, 0, 
0));
diff --git a/sc/source/ui/dataprovider/datatransformation.cxx 
b/sc/source/ui/dataprovider/datatransformation.cxx
index 039c17209304..bbb9bd068c7f 100644
--- a/sc/source/ui/dataprovider/datatransformation.cxx
+++ b/sc/source/ui/dataprovider/datatransformation.cxx
@@ -26,8 +26,8 @@ SCROW DataTransformation::getLastRow(const ScDocument& rDoc, 
SCCOL nCol)
 return nEndRow;
 }
 
-ColumnRemoveTransformation::ColumnRemoveTransformation(SCCOL nCol):
-mnCol(nCol)
+ColumnRemoveTransformation::ColumnRemoveTransformation(const std::set& 
rColumns):
+maColumns(rColumns)
 {
 }
 
@@ -37,7 +37,10 @@ ColumnRemoveTransformation::~ColumnRemoveTransformation()
 
 void ColumnRemoveTransformation::Transform(ScDocument& rDoc) const
 {
-rDoc.DeleteCol(0, 0, MAXROW, 0, mnCol, 1);
+for (auto& rCol : maColumns)
+{
+rDoc.DeleteCol(0, 0, MAXROW, 0, rCol, 1);
+}
 }
 
 SplitColumnTransformation::SplitColumnTransformation(SCCOL nCol, sal_Unicode 
cSeparator):
@@ -68,27 +71,46 @@ void SplitColumnTransformation::Transform(ScDocument& rDoc) 
const
 }
 }
 
-MergeColumnTransformation::MergeColumnTransformation(SCCOL nCol1, SCCOL nCol2, 
const OUString& rMergeString):
-mnCol1(nCol1),
-mnCol2(nCol2),
+MergeColumnTransformation::MergeColumnTransformation(const std::set& 
rColumns, const OUString& rMergeString):
+maColumns(rColumns),
 maMergeString(rMergeString)
 {
 }
 
 void MergeColumnTransformation::Transform(ScDocument& rDoc) const
 {
-SCROW nEndRow1 = getLastRow(rDoc, mnCol1);
-SCROW nEndRow2 = getLastRow(rDoc, mnCol2);
-SCROW nEndRow = std::max(nEndRow1, nEndRow2);
+if (maColumns.empty())
+return;
 
-for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
+SCROW nMaxRow = 0;
+for (auto& itr : maColumns)
 {
-OUString aStr1 = rDoc.GetString(mnCol1, nRow, 0);
-OUString aStr2 = rDoc.GetString(mnCol2, nRow, 0);
-rDoc.SetString(mnCol1, nRow, 0, aStr1 + maMergeString + aStr2);
+nMaxRow = getLastRow(rDoc, itr);
 }
 
-rDoc.DeleteCol(0, 0, MAXROW, 0, mnCol2, 1);
+SCCOL nTargetCol = *maColumns.begin();
+
+
+for (SCROW nRow = 0; nRow <= nMaxRow; ++nRow)
+{
+OUStringBuffer aStr = rDoc.GetString(nTargetCol, nRow, 0);
+for (auto& itr : maColumns)
+{
+if (itr != nTargetCol)
+{
+aStr.append(maMergeString).append(rDoc.GetString(itr, nRow, 
0));
+}
+}
+rDoc.SetString(nTargetCol, nRow, 0, aStr.makeStringAndClear());
+}
+
+for (auto& itr : maColumns)
+{
+if (itr == nTargetCol)
+continue;
+
+rDoc.DeleteCol(0, 0, MAXROW, 0, itr, 1);
+}
 }
 
 SortTransformation::SortTransformation(const ScSortParam& rSortParam):
diff --git a/sc/source/ui/inc/datatransformation.hxx 
b/sc/source/ui/inc/datatransformation.hxx
index d647fecb8e5d..251397ca8304 100644
--- a/sc/source/ui/inc/datatransformation.hxx
+++ b/sc/source/ui/inc/datatransformation.hxx
@@ -15,6 +15,8 @@
 
 #include 
 
+#include 
+
 class ScDocument;
 
 namespace sc {
@@ -34,11 +36,11 @@ public:
 
 class SC_DLLPUBLIC ColumnRemoveTransformation : public DataTransformation
 {
-SCCOL mnCol;
+std::set maColumns;
 
 public:
 
-ColumnRemoveTransformation(SCCOL nCol);
+

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

2018-01-21 Thread Caolán McNamara
 sc/qa/unit/data/xls/fail/ofz5527-1.xls |binary
 sc/source/filter/excel/xicontent.cxx   |4 +++-
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit f6eefd96cb16a9b5607fe59bdbf9b1121c9b56e8
Author: Caolán McNamara 
Date:   Sun Jan 21 16:15:30 2018 +

copy ScAddress before possibly joining it

Change-Id: Ib1148584b9771da67d3f4b3141184228e1bbe3a2
Reviewed-on: https://gerrit.libreoffice.org/48271
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/qa/unit/data/xls/fail/ofz5527-1.xls 
b/sc/qa/unit/data/xls/fail/ofz5527-1.xls
new file mode 100644
index ..334cafe42445
Binary files /dev/null and b/sc/qa/unit/data/xls/fail/ofz5527-1.xls differ
diff --git a/sc/source/filter/excel/xicontent.cxx 
b/sc/source/filter/excel/xicontent.cxx
index b0d5b7284feb..626963c3a2a2 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -678,6 +678,8 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm )
 
 // *** create the Calc conditional formatting ***
 
+const ScAddress aPos(rPos); //in case maRanges.Join invalidates it
+
 if( !mxScCondFmt.get() )
 {
 mxScCondFmt.reset( new ScConditionalFormat( 0/*nKey*/, () ) 
);
@@ -686,7 +688,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm )
 mxScCondFmt->SetRange(maRanges);
 }
 
-ScCondFormatEntry* pEntry = new ScCondFormatEntry( eMode, xTokArr1.get(), 
pTokArr2.get(), (), rPos, aStyleName );
+ScCondFormatEntry* pEntry = new ScCondFormatEntry(eMode, xTokArr1.get(), 
pTokArr2.get(), (), aPos, aStyleName);
 mxScCondFmt->AddEntry( pEntry );
 ++mnCondIndex;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-12-09 Thread Kohei Yoshida
 sc/qa/unit/helper/qahelper.cxx|3 ---
 sc/source/filter/inc/orcusfiltersimpl.hxx |1 -
 sc/source/filter/inc/orcusinterface.hxx   |2 --
 sc/source/ui/dataprovider/csvdataprovider.cxx |5 -
 sc/source/ui/docshell/datastream.cxx  |4 
 sc/source/ui/inc/dataprovider.hxx |4 
 6 files changed, 19 deletions(-)

New commits:
commit c7755e615918c1a0cb3245f75334ba08f69ac226
Author: Kohei Yoshida 
Date:   Fri Dec 8 21:08:29 2017 -0500

Remove __ORCUS_STATIC_LIB defines.

Since orcus is now integrated as dynamic shared libraries, we don't
need these defines (in theory).

Change-Id: I33ea2e862ecc23becf5d01173d3fb31c03797159
Reviewed-on: https://gerrit.libreoffice.org/46166
Tested-by: Jenkins 
Reviewed-by: Kohei Yoshida 

diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index b53c8377e1a0..117c4d21e9e8 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -23,9 +23,6 @@
 #include 
 #include 
 
-#if defined(_WIN32)
-#define __ORCUS_STATIC_LIB
-#endif
 #include 
 
 #include 
diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx 
b/sc/source/filter/inc/orcusfiltersimpl.hxx
index 27604fbd7a19..ee69df00b552 100644
--- a/sc/source/filter/inc/orcusfiltersimpl.hxx
+++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
@@ -12,7 +12,6 @@
 
 #include 
 
-#define __ORCUS_STATIC_LIB
 #include 
 
 class ScOrcusFiltersImpl : public ScOrcusFilters
diff --git a/sc/source/filter/inc/orcusinterface.hxx 
b/sc/source/filter/inc/orcusinterface.hxx
index c19cf038ee7b..465014b0caf4 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -24,7 +24,6 @@
 #include 
 #include 
 
-#define __ORCUS_STATIC_LIB
 #include 
 
 #include 
@@ -182,7 +181,6 @@ public:
 
 virtual void set_row_hidden(orcus::spreadsheet::row_t row, bool hidden) 
override;
 
-
 virtual void set_merge_cell_range(const orcus::spreadsheet::range_t& 
range) override;
 };
 
diff --git a/sc/source/ui/dataprovider/csvdataprovider.cxx 
b/sc/source/ui/dataprovider/csvdataprovider.cxx
index 1d61996f7a6e..a6850edec3de 100644
--- a/sc/source/ui/dataprovider/csvdataprovider.cxx
+++ b/sc/source/ui/dataprovider/csvdataprovider.cxx
@@ -11,11 +11,6 @@
 #include 
 #include 
 
-#if defined(_WIN32)
-#if !defined __ORCUS_STATIC_LIB // avoid -Werror,-Wunused-macros
-#define __ORCUS_STATIC_LIB
-#endif
-#endif
 #include 
 
 namespace {
diff --git a/sc/source/ui/docshell/datastream.cxx 
b/sc/source/ui/docshell/datastream.cxx
index f74feb7a7d06..eea81a1f41ae 100644
--- a/sc/source/ui/docshell/datastream.cxx
+++ b/sc/source/ui/docshell/datastream.cxx
@@ -29,10 +29,6 @@
 
 #include 
 
-
-#if defined(_WIN32)
-#define __ORCUS_STATIC_LIB
-#endif
 #include 
 
 #include 
diff --git a/sc/source/ui/inc/dataprovider.hxx 
b/sc/source/ui/inc/dataprovider.hxx
index 14637a49703f..61d1e112f14f 100644
--- a/sc/source/ui/inc/dataprovider.hxx
+++ b/sc/source/ui/inc/dataprovider.hxx
@@ -33,10 +33,6 @@
 
 #include 
 
-#if defined(_WIN32)
-#define __ORCUS_STATIC_LIB
-#endif
-
 #include 
 
 class SvStream;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-12-01 Thread Aron Budea
 sc/qa/unit/data/xlsx/built-in_ranges.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx |   28 
 sc/source/filter/excel/xltools.cxx|6 +-
 sc/source/filter/inc/xltools.hxx  |4 ++--
 4 files changed, 35 insertions(+), 3 deletions(-)

New commits:
commit f8b9d0fb0767d8bbe8477f92abaf6b8e0ff65546
Author: Aron Budea 
Date:   Tue Nov 28 07:23:12 2017 +0100

tdf#109240, tdf#112571: don't export dupe built-in named ranges

XclTools::GetBuiltInDefNameIndex(...) only checked for prefix used in
binary Excel format, and didn't recognize OOXML built-in names, which
resulted in saving them twice in OOXML files.

Adapt to check both binary and OOXML prefixes, similarly to
XclTools::IsBuiltInStyleName(...).

Saving "bad" files after the fix will purge bad "_0", "_0_0" etc.
suffixed built-in names due to how GetBuiltInDefNameIndex(...) works.

Change-Id: I1bbe11f9c654a142a4626003df4cb0fd2a0f9c71
Reviewed-on: https://gerrit.libreoffice.org/45381
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/qa/unit/data/xlsx/built-in_ranges.xlsx 
b/sc/qa/unit/data/xlsx/built-in_ranges.xlsx
new file mode 100644
index ..b18a4862fdd6
Binary files /dev/null and b/sc/qa/unit/data/xlsx/built-in_ranges.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 0e7a3913ba35..06ed9dcdf9ad 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -103,6 +103,7 @@ public:
 void testConditionalFormatRangeListXLSX();
 void testMiscRowHeightExport();
 void testNamedRangeBugfdo62729();
+void testBuiltinRangesXLSX();
 void testRichTextExportODS();
 void testRichTextCellFormatXLSX();
 void testFormulaRefSheetNameODS();
@@ -212,6 +213,7 @@ public:
 CPPUNIT_TEST(testConditionalFormatRangeListXLSX);
 CPPUNIT_TEST(testMiscRowHeightExport);
 CPPUNIT_TEST(testNamedRangeBugfdo62729);
+CPPUNIT_TEST(testBuiltinRangesXLSX);
 CPPUNIT_TEST(testRichTextExportODS);
 CPPUNIT_TEST(testRichTextCellFormatXLSX);
 CPPUNIT_TEST(testFormulaRefSheetNameODS);
@@ -1159,6 +1161,32 @@ void ScExportTest::testNamedRangeBugfdo62729()
 xDocSh->DoClose();
 }
 
+void ScExportTest::testBuiltinRangesXLSX()
+{
+ScDocShellRef xShell = loadDoc("built-in_ranges.", FORMAT_XLSX);
+CPPUNIT_ASSERT(xShell.is());
+ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
+CPPUNIT_ASSERT(xDocSh.is());
+xShell->DoClose();
+
+xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, 
"xl/workbook.xml", FORMAT_XLSX);
+CPPUNIT_ASSERT(pDoc);
+
+//assert the existing OOXML built-in names are still there
+assertXPathContent(pDoc, 
"/x:workbook/x:definedNames/x:definedName[@name='_xlnm._FilterDatabase'][@localSheetId='0']",
 "'Sheet1 Test'!$A$1:$A$5");
+assertXPathContent(pDoc, 
"/x:workbook/x:definedNames/x:definedName[@name='_xlnm._FilterDatabase'][@localSheetId='1']",
 "'Sheet2 Test'!$K$10:$K$14");
+assertXPathContent(pDoc, 
"/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area'][@localSheetId='0']",
 "'Sheet1 Test'!$A$1:$A$5");
+assertXPathContent(pDoc, 
"/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area'][@localSheetId='1']",
 "'Sheet2 Test'!$K$10:$M$18");
+
+//...and that no extra ones are added (see tdf#112571)
+assertXPath(pDoc, 
"/x:workbook/x:definedNames/x:definedName[@name='_xlnm._FilterDatabase_0'][@localSheetId='0']",
 0);
+assertXPath(pDoc, 
"/x:workbook/x:definedNames/x:definedName[@name='_xlnm._FilterDatabase_0'][@localSheetId='1']",
 0);
+assertXPath(pDoc, 
"/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area_0'][@localSheetId='0']",
 0);
+assertXPath(pDoc, 
"/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area_0'][@localSheetId='1']",
 0);
+
+xDocSh->DoClose();
+}
+
 void ScExportTest::testRichTextExportODS()
 {
 struct
diff --git a/sc/source/filter/excel/xltools.cxx 
b/sc/source/filter/excel/xltools.cxx
index 34e572460f4a..cffb346ec27b 100644
--- a/sc/source/filter/excel/xltools.cxx
+++ b/sc/source/filter/excel/xltools.cxx
@@ -482,8 +482,12 @@ OUString XclTools::GetBuiltInDefNameXml( sal_Unicode 
cBuiltIn )
 
 sal_Unicode XclTools::GetBuiltInDefNameIndex( const OUString& rDefName )
 {
-sal_Int32 nPrefixLen = strlen(maDefNamePrefix);
+sal_Int32 nPrefixLen = 0;
 if( rDefName.startsWithIgnoreAsciiCase( maDefNamePrefix ) )
+nPrefixLen = strlen(maDefNamePrefix);
+else if( rDefName.startsWithIgnoreAsciiCase( maDefNamePrefixXml ) )
+nPrefixLen = strlen(maDefNamePrefixXml);
+if( nPrefixLen > 0 )
 {
 for( sal_Unicode cBuiltIn = 0; cBuiltIn < EXC_BUILTIN_UNKNOWN; 
++cBuiltIn )
 {
diff --git a/sc/source/filter/inc/xltools.hxx 

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

2017-11-29 Thread Winfried Donkers
 sc/qa/unit/data/functions/text/fods/replace.fods |  230 +--
 sc/source/core/tool/interpr1.cxx |   17 +
 2 files changed, 227 insertions(+), 20 deletions(-)

New commits:
commit aaba725b466950f47c4e93d790986d209e80ead3
Author: Winfried Donkers 
Date:   Tue Nov 28 15:55:56 2017 +0100

tdf#97198 Make Calc function REPLACE work with UniCode non-BMP-characters.

Change-Id: Ie9bd27ba2c28bdad0af9d91cb270ef37d5384791
Reviewed-on: https://gerrit.libreoffice.org/45421
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/text/fods/replace.fods 
b/sc/qa/unit/data/functions/text/fods/replace.fods
index 140b735e7090..1ab069f6460a 100644
--- a/sc/qa/unit/data/functions/text/fods/replace.fods
+++ b/sc/qa/unit/data/functions/text/fods/replace.fods
@@ -1141,36 +1141,230 @@
  
 
 
- 
- 
- 
- 
+ 
+  Q
+ 
+ 
+  Q
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(;5;1;Q)
+ 
  
- 
+ 
+  B😂
+ 
  
 
-
- 
- 
- 
- 
+
+ 
+  ab😂B😂gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+  ab😂B😂gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I11;4;3;I10)
+ 
  
- 
+ 
+  ab😂de𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+
+
+ 
+  B😂xXx😂d
+ 
+ 
+  B😂xXx😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;3;1;xXx)
+ 
+ 
+ 
+  B😂c😂d
+ 
+ 
+
+
+ 
+  BxXxc😂d
+ 
+ 
+  BxXxc😂d
+  
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;2;1;xXx)
+  
+  
+ 
+ 
+ 
+  B😂𝖍𝖙😂d
+ 
+ 
+  B😂𝖍𝖙😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;3;1;𝖍𝖙)
+ 
+ 
+  
  
 
 
- 
+ 
+  Bx𝖍𝖙xc😂d
+ 
+ 
+  Bx𝖍𝖙xc😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;2;1;x𝖍𝖙x)
+ 
+  
+  
+  
+ 
+
+ 
+  BxXx😂c😂d
+ 
+ 
+  BxXx😂c😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;2;0;xXx)
+ 
+ 
+  
+ 
+
+
+ 
+  B😂xXxc😂d
+ 
+ 
+  B😂xXxc😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;3;0;xXx)
+ 
+  
+  
+  
+ 
+ 
+ 
+  xYxB😂c😂d
+ 
+ 
+  xYxB😂c😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;1;0;xYx)
+ 
+ 
+
+
+ 
+  xYx😂c😂d
+ 
+ 
+  xYx😂c😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;1;1;xYx)
+ 
+ 
+  
+ 
+
+
+ 
+  xYxc😂d
+ 
+ 
+  xYxc😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;1;2;xYx)
+ 
+  
+  
+  
+ 
+
+ 
+  xYx😂d
+ 
+ 
+  xYx😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;1;3;xYx)
+ 
+ 
  
- 
- 
+ 
+
+
+ 
+  xYxd
+ 
+ 
+  xYxd
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;1;4;xYx)
+ 
  
  
  
 
-
- 
+
  
- 
  
  
  
@@ -1210,4 +1404,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 2895c93f2a2e..164c1185e1b8 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8451,9 +8451,22 @@ void ScInterpreter::ScReplace()
 nPos = nLen + 1;
 if (nCount > nLen - nPos + 1)
 nCount = nLen - nPos + 1;
-aOldStr = aOldStr.replaceAt( nPos-1, nCount, "" );
+sal_Int32 nIdx = 0;
+sal_Int32 nCnt = 0;
+while ( nIdx < nLen && nPos > nCnt + 1 )
+{
+aOldStr.iterateCodePoints(  );
+++nCnt;
+}
+sal_Int32 nStart = nIdx;
+while ( nIdx < nLen && nPos + nCount - 1 > nCnt )
+{
+aOldStr.iterateCodePoints(  );
+++nCnt;
+}
+aOldStr = aOldStr.replaceAt( nStart, nIdx - nStart, "" );
 if ( CheckStringResultLen( aOldStr, aNewStr ) )
-aOldStr = aOldStr.replaceAt( nPos-1, 0, aNewStr );
+aOldStr = aOldStr.replaceAt( nStart, 0, aNewStr );
 PushString( aOldStr );
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-24 Thread Winfried Donkers
 sc/qa/unit/data/functions/text/fods/left.fods |   88 +-
 sc/source/core/tool/interpr1.cxx  |7 +-
 2 files changed, 92 insertions(+), 3 deletions(-)

New commits:
commit 4e3530b4f870e0470c23ae89cdb8b9a09af54d59
Author: Winfried Donkers 
Date:   Mon Nov 13 15:43:00 2017 +0100

tdf#97198 Make Calc function LEFT work with Unicode non-BMP characters

Change-Id: I66d24dd962f824079fd0aea2827bd5b975ffe698
Reviewed-on: https://gerrit.libreoffice.org/44684
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/text/fods/left.fods 
b/sc/qa/unit/data/functions/text/fods/left.fods
index 535eff455432..45d659aab04e 100644
--- a/sc/qa/unit/data/functions/text/fods/left.fods
+++ b/sc/qa/unit/data/functions/text/fods/left.fods
@@ -1152,6 +1152,92 @@
  
  
 
+
+ 
+  ab😂d
+ 
+ 
+  ab😂d
+ 
+ 
+  WAAR
+ 
+ 
+  =LEFT(I11;4)
+ 
+ 
+  Excel 2016 returns the same result
+ 
+ 
+ ab😂de𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+
+
+ 
+  𧌒
+ 
+ 
+  𧌒
+ 
+ 
+  WAAR
+ 
+ 
+  =LEFT(I12;2)
+ 
+ 
+  Excel 2016 returns the same result
+ 
+ 
+ 𧌒𧀬
+ 
+ 
+
+
+ 
+  u
+ 
+ 
+  u
+ 
+ 
+  WAAR
+ 
+ 
+  =LEFT(I13;2)
+ 
+ 
+  Excel 2016 returns the same result
+ 
+ 
+ 
+  üë
+ 
+ 
+
+
+ 
+  𝕬𝖈𝖍𝖙
+ 
+ 
+  𝕬𝖈𝖍𝖙
+ 
+ 
+  WAAR
+ 
+ 
+  =LEFT(I14;4)
+ 
+ 
+  Excel 2016 returns the same result
+ 
+ 
+ 
+  𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+
 
  
  
@@ -1195,4 +1281,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 88b1fd43759d..2895c93f2a2e 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8579,8 +8579,11 @@ void ScInterpreter::ScLeft()
 else
 n = 1;
 OUString aStr = GetString().getString();
-n = std::min(n, aStr.getLength());
-aStr = aStr.copy( 0, n );
+sal_Int32 nIdx = 0;
+sal_Int32 nCnt = 0;
+while ( nIdx < aStr.getLength() && n > nCnt++ )
+aStr.iterateCodePoints(  );
+aStr = aStr.copy( 0, nIdx );
 PushString( aStr );
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-24 Thread Winfried Donkers
 sc/qa/unit/data/functions/text/fods/search.fods |  160 +---
 sc/source/core/tool/interpr1.cxx|   11 +
 2 files changed, 156 insertions(+), 15 deletions(-)

New commits:
commit 78b7e5f76e72647e0cab662ad2c9342d4538704f
Author: Winfried Donkers 
Date:   Thu Nov 23 18:21:19 2017 +0100

tdf#97198 Make Calc function SEARCH work with UniCode non-BMP characters.

Change-Id: I99b44dc88fe9c8d4d5d7a319bd6bc84dd2bff4f3
Reviewed-on: https://gerrit.libreoffice.org/45170
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/text/fods/search.fods 
b/sc/qa/unit/data/functions/text/fods/search.fods
index 12723d0e1154..c09827350d89 100644
--- a/sc/qa/unit/data/functions/text/fods/search.fods
+++ b/sc/qa/unit/data/functions/text/fods/search.fods
@@ -1416,21 +1416,153 @@
  
  
 
-
- 
- 
- 
- 
- 
+
+ 
+  2
+ 
+ 
+  2
+ 
+ 
+  TRUE
+ 
+ 
+  =SEARCH(I21;J21)
+ 
+ 
+  Excel 2016 has same result
+ 
+ 
+ 
+  B😂
+ 
+ 
+  ab😂de𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
 
-
- 
- 
- 
- 
- 
+
+ 
+  3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  =SEARCH(I22;J21)
+ 
+ 
+  Excel 2016 has same result
+ 
+ 
+ 
+  😂d
+ 
+ 
+  ab😂
+ 
+ 
+
+
+ 
+  3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  =SEARCH(I23;J23)
+ 
+ 
+  Excel 2016 returns 4
+ 
+ 
+ 
+  𧀬
+ 
+ 𧌒𧀬
+ 
+ 
+
+
+ 
+  8
+ 
+ 
+  8
+ 
+ 
+  TRUE
+ 
+ 
+  =SEARCH(I24;J21)
+ 
+ 
+  Excel 2016 returns 10
+ 
+ 
+ 
+  h
+ 
+ 
+
+
+ 
+  4
+ 
+ 
+  4
+ 
+ 
+  TRUE
+ 
+ 
+  =SEARCH(I25;J25)
+ 
+ 
+  Excel 2016 has same result
+ 
+ 
+ 
+  e
+ 
+ 
+  üë
+ 
+ 
+
+
+ 
+  3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  =SEARCH(I26;J26)
+ 
+ 
+  Excel 2016 returns 5
+ 
+ 
+ 
+  𝖍𝖙
+ 
+ 
+  𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
 
-
+
  
  
  
@@ -1483,4 +1615,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 96d8f764a418..88b1fd43759d 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8942,7 +8942,16 @@ void ScInterpreter::ScSearch()
 if (!bBool)
 PushNoValue();
 else
-PushDouble((double)nPos + 1);
+{
+sal_Int32 nIdx = 0;
+sal_Int32 nCnt = 0;
+while ( nIdx <= nPos )
+{
+sStr.iterateCodePoints(  );
+++nCnt;
+}
+PushDouble( ( double )nCnt );
+}
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-24 Thread Winfried Donkers
 sc/qa/unit/data/functions/text/fods/len.fods |  100 +--
 sc/source/core/tool/interpr1.cxx |   10 ++
 2 files changed, 102 insertions(+), 8 deletions(-)

New commits:
commit 47155ce8fb4302d377b374d39b501d0a0f7577c5
Author: Winfried Donkers 
Date:   Mon Nov 13 15:18:52 2017 +0100

tdf#97198 Make Calc function LEN work with Unicode non-BMP characters.

Change-Id: Ibfdaaf1ed313257fc5f9036a7dd1ef51033fa8cd
Reviewed-on: https://gerrit.libreoffice.org/44681
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/text/fods/len.fods 
b/sc/qa/unit/data/functions/text/fods/len.fods
index 2d643cef2fcd..adc36d87f379 100644
--- a/sc/qa/unit/data/functions/text/fods/len.fods
+++ b/sc/qa/unit/data/functions/text/fods/len.fods
@@ -1189,13 +1189,99 @@
  
  
 
-
- 
- 
- 
- 
+
+ 
+  16
+ 
+ 
+  16
+ 
+ 
+  TRUE
+ 
+ 
+  =LEN(I10)
+ 
+ 
+  Excel 2016 returns 25
+ 
+ 
+ ab😂de𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
  
- 
+
+
+ 
+  3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  =LEN(I11)
+ 
+ 
+  Excel 2016 returns 4
+ 
+ 
+ 
+  ab😂
+ 
+ 
+
+
+ 
+  4
+ 
+ 
+  4
+ 
+ 
+  TRUE
+ 
+ 
+  =LEN(I12)
+ 
+ 
+  Excel 2016 returns 6
+ 
+ 
+ 𧌒𧀬
+ 
+ 
+
+
+ 
+  6
+ 
+ 
+  6
+ 
+ 
+  TRUE
+ 
+ 
+  =LEN(I13)
+ 
+ 
+  Excel 2016 returns 6
+ 
+ 
+ 
+  üë
+ 
+ 
+
+
+  
+  
+ 
+  
+  
+  
  
 
 
@@ -1232,4 +1318,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index f83040c79e39..96d8f764a418 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -3064,7 +3064,15 @@ void ScInterpreter::ScLower()
 
 void ScInterpreter::ScLen()
 {
-PushDouble(GetString().getLength());
+OUString aStr = GetString().getString();
+sal_Int32 nIdx = 0;
+sal_Int32 nCnt = 0;
+while ( nIdx < aStr.getLength() )
+{
+aStr.iterateCodePoints(  );
+++nCnt;
+}
+PushDouble( nCnt );
 }
 
 void ScInterpreter::ScT()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-24 Thread Winfried Donkers
 sc/qa/unit/data/functions/text/fods/find.fods |  148 +-
 sc/source/core/tool/interpr1.cxx  |   11 +
 2 files changed, 156 insertions(+), 3 deletions(-)

New commits:
commit 5e2a3eed69060d63070d72df60cd84247ca0bc9e
Author: Winfried Donkers 
Date:   Thu Nov 23 18:44:34 2017 +0100

tdf#97198 Make Calc function FIND work with UniCode non-BMP characters.

Change-Id: I512199a5d29aa955b278f0666c7ce904e67d9767
Reviewed-on: https://gerrit.libreoffice.org/45171
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/text/fods/find.fods 
b/sc/qa/unit/data/functions/text/fods/find.fods
index f5a1f2a2c06b..4f966cbe53a4 100644
--- a/sc/qa/unit/data/functions/text/fods/find.fods
+++ b/sc/qa/unit/data/functions/text/fods/find.fods
@@ -1254,7 +1254,151 @@
  
  
 
-
+
+ 
+  #VALUE!
+ 
+ 
+  #VALUE!
+ 
+ 
+  TRUE
+ 
+ 
+  =FIND(I16;J16)
+ 
+ 
+  Excel 2016 has same result
+ 
+ 
+ 
+  B😂
+ 
+ 
+  ab😂de𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+
+
+ 
+  3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  =FIND(I17;J16)
+ 
+ 
+  Excel 2016 has same result
+ 
+ 
+ 
+  😂d
+ 
+ 
+ 
+
+
+ 
+  3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  =FIND(I18;J18)
+ 
+ 
+  Excel 2016 returns 4
+ 
+ 
+ 
+  𧀬
+ 
+ 𧌒𧀬
+ 
+ 
+
+
+ 
+  8
+ 
+ 
+  8
+ 
+ 
+  TRUE
+ 
+ 
+  =FIND(I19;J16)
+ 
+ 
+  Excel 2016 returns 10
+ 
+ 
+ 
+  h
+ 
+ 
+
+
+ 
+  4
+ 
+ 
+  4
+ 
+ 
+  TRUE
+ 
+ 
+  =FIND(I20;J20)
+ 
+ 
+  Excel 2016 has same result
+ 
+ 
+ 
+  e
+ 
+ 
+  üë
+ 
+ 
+
+
+ 
+  3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  =FIND(I21;J21)
+ 
+ 
+  Excel 2016 returns 5
+ 
+ 
+ 
+  𝖍𝖙
+ 
+ 
+  𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+
+
  
  
  
@@ -1288,4 +1432,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 2f2955b52927..f83040c79e39 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8526,7 +8526,16 @@ void ScInterpreter::ScFind()
 if (nPos == -1)
 PushNoValue();
 else
-PushDouble((double)(nPos + 1));
+{
+sal_Int32 nIdx = 0;
+nCnt = 0;
+while ( nIdx <= nPos )
+{
+sStr.iterateCodePoints(  );
+++nCnt;
+}
+PushDouble( ( double )nCnt );
+}
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-24 Thread Winfried Donkers
 sc/qa/unit/data/functions/text/fods/right.fods |  112 ++---
 sc/source/core/tool/interpr1.cxx   |   26 +
 2 files changed, 108 insertions(+), 30 deletions(-)

New commits:
commit 09455734727daa3774158795febd910b33b1d784
Author: Winfried Donkers 
Date:   Thu Nov 16 16:40:25 2017 +0100

tdf#97198 Make Calc function RIGHT work with Unicode non-BMP characters.

Change-Id: I775bc50d8e5948a2af9efb77dcea9d7cae7293d5
Reviewed-on: https://gerrit.libreoffice.org/44834
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/text/fods/right.fods 
b/sc/qa/unit/data/functions/text/fods/right.fods
index 9f4b97f1f8b3..fff9ffc855cc 100644
--- a/sc/qa/unit/data/functions/text/fods/right.fods
+++ b/sc/qa/unit/data/functions/text/fods/right.fods
@@ -1251,9 +1251,12 @@
  
   un
  
+ 
+  TRUE
+ 
  
  
- 
+ 
  
   b
  
@@ -1282,55 +1285,110 @@
  
 
 
- 
- 
- 
- 
- 
+ 
+  𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+  𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+  TRUE
+ 
+ 
+  
=RIGHT(ab😂de𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!;11)
+ 
+ 
+  Excel 2016 returns same result
+ 
+ 
  
   c
  
  
 
 
- 
- 
- 
- 
- 
+ 
+  b😂
+ 
+ 
+  b😂
+ 
+ 
+  TRUE
+ 
+ 
+  =RIGHT(ab😂;2)
+ 
+ 
+  Excel 2016 returns same result
+ 
+ 
  
   d
  
  
 
 
- 
- 
- 
- 
- 
+ 
+  𧀬
+ 
+ 
+  𧀬
+ 
+ 
+  TRUE
+ 
+ 
+  =RIGHT(𧌒𧀬;2)
+ 
+ 
+  Excel 2016 returns same result
+ 
+ 
  
   E
  
  
 
 
- 
- 
- 
- 
- 
+ 
+  ̈
+ 
+ 
+  ̈
+ 
+ 
+  TRUE
+ 
+ 
+  =RIGHT(üë;2)
+ 
+ 
+  Excel 2016 returns same result
+ 
+ 
  
   f
  
  
 
 
- 
- 
- 
- 
- 
+ 
+  𝖚𝖓𝖌!
+ 
+ 
+  𝖚𝖓𝖌!
+ 
+ 
+  TRUE
+ 
+ 
+  =RIGHT(𝕬𝖈𝖍𝖙𝖚𝖓𝖌!;4)
+ 
+ 
+  Excel 2016 returns same result
+ 
+ 
  
   g
  
@@ -1488,4 +1546,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index d53c00f9fcd7..2f2955b52927 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8867,9 +8867,29 @@ void ScInterpreter::ScRight()
 else
 n = 1;
 OUString aStr = GetString().getString();
-if( n < aStr.getLength() )
-aStr = aStr.copy( aStr.getLength() - n );
-PushString( aStr );
+sal_Int32 nLen = aStr.getLength();
+sal_Int32 nIdx = 0;
+sal_Int32 nCnt = 0;
+while ( nIdx < nLen )
+{
+aStr.iterateCodePoints(  );
+++nCnt;
+}
+if ( nCnt <= n )
+PushString( aStr );
+else
+{
+sal_Int32 nCLen = nCnt;
+nIdx = 0;
+nCnt = 0;
+while ( nIdx < nLen && n < ( nCLen - nCnt ) )
+{
+aStr.iterateCodePoints(  );
+++nCnt;
+}
+aStr = aStr.copy( nIdx, nLen - nIdx );
+PushString( aStr );
+}
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-24 Thread Winfried Donkers
 sc/qa/unit/data/functions/text/fods/mid.fods |  175 ++-
 sc/source/core/tool/interpr1.cxx |   28 +++-
 2 files changed, 166 insertions(+), 37 deletions(-)

New commits:
commit e78f508997f9384518c2dd1a005c5306ccd24783
Author: Winfried Donkers 
Date:   Tue Nov 21 16:08:32 2017 +0100

tdf#97198 Make calc function MID work with Unicode non-BMP characters.

Change-Id: Ic86344495490d6ca942f9fd2752874da22ef531f
Reviewed-on: https://gerrit.libreoffice.org/45040
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/qa/unit/data/functions/text/fods/mid.fods 
b/sc/qa/unit/data/functions/text/fods/mid.fods
index 56fcd55d3f27..68c7feb10299 100644
--- a/sc/qa/unit/data/functions/text/fods/mid.fods
+++ b/sc/qa/unit/data/functions/text/fods/mid.fods
@@ -1054,41 +1054,158 @@
  
  
 
-
- 
- 
- 
- 
- 
+
+ 
+  
+ 
+ 
+  
+ 
+ 
+  TRUE
+ 
+ 
+  =MID(I2;12;8)
+ 
+ 
 
 
- 
- 
- 
- 
+ 
+  Err:502
+ 
+ 
+  Err:502
+ 
+ 
+  TRUE
+ 
+ 
+  =MID(I2;0;3)
+ 
+ 
 
 
- 
- 
- 
- 
+ 
+  b😂
+ 
+ 
+  b😂
+ 
+ 
+  TRUE
+ 
+ 
+  =MID(I8;J8;K8)
+ 
+ 
+  result Excel 2016 is b😂
+ 
+ 
+ ab😂de𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+  2
+ 
 
-
- 
- 
- 
- 
- 
+
+ 
+  b
+ 
+ 
+  b
+ 
+ 
+  TRUE
+ 
+ 
+  =MID(I9;J9;K9)
+ 
+ 
+  result Excel 2016 is b
+ 
+ 
+ 
+  ab😂
+ 
+ 
+  2
+ 
+ 
+  1
+ 
 
-
- 
- 
- 
- 
- 
- 
+
+ 
+  𧌒𧀬
+ 
+ 
+  𧌒𧀬
+ 
+ 
+  TRUE
+ 
+ 
+  =MID(I10;J10;K10)
+ 
+ 
+  result Excel 2016 is 𧌒
+ 
+ 
+ 𧌒𧀬
+ 
+ 
+  2
+ 
+
+
+ 
+  ü
+ 
+ 
+  ü
+ 
+ 
+  TRUE
+ 
+ 
+  =MID(I11;J11;K11)
+ 
+ 
+  result Excel 2016 is identical
+ 
+ 
+ 
+  üë
+ 
+ 
+  2
+ 
+
+
+ 
+  𝖍𝖙𝖚
+ 
+ 
+  𝖍𝖙𝖚
+ 
+ 
+  TRUE
+ 
+ 
+  =MID(I12;J12;K12)
+ 
+ 
+  result Excel 2016 is 𝖈
+ 
+ 
+ 
+  𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+  3
+ 
 
-
+
  
  
  
@@ -1130,4 +1247,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 5bb02e6e363d..d53c00f9fcd7 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8914,18 +8914,30 @@ void ScInterpreter::ScMid()
 {
 if ( MustHaveParamCount( GetByte(), 3 ) )
 {
-double fCnt= GetStringPositionArgument();
-double fAnfang = GetStringPositionArgument();
+sal_Int32 nSubLen = ( sal_Int32 )GetStringPositionArgument();
+sal_Int32 nStart  = ( sal_Int32 )GetStringPositionArgument();
 OUString aStr = GetString().getString();
-if (fAnfang < 1.0 || fCnt < 0.0)
+if ( nStart < 1 || nSubLen < 0 )
 PushIllegalArgument();
 else
 {
-sal_Int32 nCharacters = 
std::min(static_cast(fCnt), aStr.getLength() - fAnfang + 
1);
-OUString sRes;
-if (nCharacters > 0)
-sRes = aStr.copy(static_cast(fAnfang-1), 
nCharacters);
-PushString(sRes);
+sal_Int32 nLen = aStr.getLength();
+sal_Int32 nIdx = 0;
+sal_Int32 nCnt = 0;
+while ( nIdx < nLen && nStart - 1 > nCnt )
+{
+aStr.iterateCodePoints(  );
+++nCnt;
+}
+sal_Int32 nIdx0 = nIdx;  //start position
+
+while ( nIdx < nLen && nStart + nSubLen - 1 > nCnt )
+{
+aStr.iterateCodePoints(  );
+++nCnt;
+}
+aStr = aStr.copy( nIdx0, nIdx - nIdx0 );
+PushString( aStr );
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


<    1   2   3   4   5   6   >