[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-10-14 Thread Eike Rathke
 sc/source/core/tool/compiler.cxx |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit f81b2592cd93dac2cb78fdb22bf661d04bdef25f
Author: Eike Rathke 
Date:   Wed Oct 12 19:47:44 2016 +0200

create NoName error token instead of setting error at the token array

... when handling name token. This can happen when importing BIFF .xls and 
the
original range is not present in the document. The document is broken, but 
such
formula can continue to work if the range expression was not actually 
executed,
for example IF(TRUE(),then_good,else_bad_range) where else_bad_range is 
#NAME?
error.

(cherry picked from commit d3645961d98ce9f0cfb1ef7f0aba7bf020b90945)

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

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index e161b12..5d0af7e 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4442,6 +4442,7 @@ ScRangeData* ScCompiler::GetRangeData( const 
FormulaToken& rToken ) const
 
 bool ScCompiler::HandleRange()
 {
+ScTokenArray* pNew;
 const ScRangeData* pRangeData = GetRangeData( *mpToken);
 if (pRangeData)
 {
@@ -4450,7 +4451,6 @@ bool ScCompiler::HandleRange()
 SetError( errNoName );
 else if (mbJumpCommandReorder)
 {
-ScTokenArray* pNew;
 // put named formula into parentheses.
 // But only if there aren't any yet, parenthetical
 // ocSep doesn't work, e.g. SUM((...;...))
@@ -4491,7 +4491,15 @@ bool ScCompiler::HandleRange()
 }
 }
 else
-SetError(errNoName);
+{
+// No ScRangeData for an already compiled token can happen in BIFF .xls
+// import if the original range is not present in the document.
+pNew = new ScTokenArray;
+pNew->Add( new FormulaErrorToken(errNoName));
+PushTokenArray( pNew, true );
+pNew->Reset();
+return GetToken();
+}
 return true;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-10-12 Thread Eike Rathke
 sc/source/ui/docshell/externalrefmgr.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit dfcf0bbcc51f50dfa93ac74623a069c3b527527a
Author: Eike Rathke 
Date:   Tue Oct 11 15:10:46 2016 +0200

Resolves: tdf#101691 re-intern strings of external formula results

If the external cell referenced is a formula result of type string that
string needs to be re-interned for the reference cache as well.

Change-Id: Iea3c3d777dede2ad6ba0b084533af964da991ca6
(cherry picked from commit 351164ea2c70923e47d5f01f3934c73cfc5839a9)
Reviewed-on: https://gerrit.libreoffice.org/29695
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/ui/docshell/externalrefmgr.cxx 
b/sc/source/ui/docshell/externalrefmgr.cxx
index 4b3c521..bb174ad 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -1571,8 +1571,8 @@ static FormulaToken* convertToToken( ScDocument* 
pHostDoc, ScDocument* pSrcDoc,
 }
 else
 {
-svl::SharedString aStr = pFCell->GetString();
-return new formula::FormulaStringToken(aStr);
+svl::SharedString aSS = 
pHostDoc->GetSharedStringPool().intern( pFCell->GetString().getString());
+return new formula::FormulaStringToken(aSS);
 }
 }
 default:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-10-10 Thread Eike Rathke
 sc/source/core/tool/refupdat.cxx |4 
 sc/source/core/tool/token.cxx|   21 +
 2 files changed, 21 insertions(+), 4 deletions(-)

New commits:
commit 84a8aa8b28599db4ef452416e930690949217d2c
Author: Eike Rathke 
Date:   Fri Oct 7 19:43:32 2016 +0200

Resolves: tdf#101562 ScRefUpdate::Update() needs to flag sticky even 
unchanged

... so area broadcasters can be "adapted" (though not changed) and
broadcast a change to invalidate listening lookup caches.

This is the delete row part of the bug scenario.

(cherry picked from commit 866eb4a7f93414932b8669d1a6afe0611655dfb4)

tdf#101562 inserting within an entire col/row reference needs to flag change

This is the insert part (e.g. Undo) of the bug scenario.

(cherry picked from commit 180fe3e991432a5ab1ef573686ff9b35c732756b)

87060bd9f0ad6d58a11308e58e7ce56875327c52

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

diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx
index 602a636..300dd1d 100644
--- a/sc/source/core/tool/refupdat.cxx
+++ b/sc/source/core/tool/refupdat.cxx
@@ -235,6 +235,8 @@ ScRefUpdateRes ScRefUpdate::Update( ScDocument* pDoc, 
UpdateRefMode eUpdateRefMo
 {
 // End was sticky, but start may have been moved. Only on 
range.
 theCol2 = oldCol2;
+if (eRet == UR_NOTHING)
+eRet = UR_STICKY;
 }
 // Else, if (bCut2 && theCol2 == MAXCOL) then end becomes sticky,
 // but currently there's nothing to do.
@@ -267,6 +269,8 @@ ScRefUpdateRes ScRefUpdate::Update( ScDocument* pDoc, 
UpdateRefMode eUpdateRefMo
 {
 // End was sticky, but start may have been moved. Only on 
range.
 theRow2 = oldRow2;
+if (eRet == UR_NOTHING)
+eRet = UR_STICKY;
 }
 // Else, if (bCut2 && theRow2 == MAXROW) then end becomes sticky,
 // but currently there's nothing to do.
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index fd390a4..ffb9a29 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -2974,10 +2974,23 @@ sc::RefUpdateResult 
ScTokenArray::AdjustReferenceOnShift( const sc::RefUpdateCon
 
 if (rCxt.maRange.In(aAbs))
 {
-ScRange aErrorRange( ScAddress::UNINITIALIZED );
-if (!aAbs.MoveSticky(rCxt.mnColDelta, 
rCxt.mnRowDelta, rCxt.mnTabDelta, aErrorRange))
-aAbs = aErrorRange;
-aRes.mbReferenceModified = true;
+// We shift either by column or by row, not both,
+// so moving the reference has only to be done in
+// the non-sticky case.
+if ((rCxt.mnRowDelta && rRef.IsEntireCol()) || 
(rCxt.mnColDelta && rRef.IsEntireRow()))
+{
+// In entire col/row, values are shifted within
+// the reference, which affects all positional
+// results like in MATCH or matrix positions.
+aRes.mbValueChanged = true;
+}
+else
+{
+ScRange aErrorRange( ScAddress::UNINITIALIZED 
);
+if (!aAbs.MoveSticky(rCxt.mnColDelta, 
rCxt.mnRowDelta, rCxt.mnTabDelta, aErrorRange))
+aAbs = aErrorRange;
+aRes.mbReferenceModified = true;
+}
 }
 else if (rCxt.maRange.Intersects(aAbs))
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-10-04 Thread Markus Mohrhard
 sc/source/filter/xml/celltextparacontext.cxx |9 ++---
 sc/source/filter/xml/celltextparacontext.hxx |3 ++-
 sc/source/filter/xml/xmlcelli.cxx|6 --
 sc/source/filter/xml/xmlcelli.hxx|2 +-
 sc/source/filter/xml/xmlexprt.cxx|6 +-
 sc/source/filter/xml/xmlimprt.cxx|1 +
 sc/source/filter/xml/xmlimprt.hxx|1 +
 7 files changed, 20 insertions(+), 8 deletions(-)

New commits:
commit 0d60b0dc1208b01b659fd1af4b33d1a7f6ee737d
Author: Markus Mohrhard 
Date:   Sun Oct 2 18:27:32 2016 +0200

support TargetFrame in url field import/export code, tdf#77873

Change-Id: Id09ecbd10b8ee60371f223d62f2dd6fe1c2296ca
Reviewed-on: https://gerrit.libreoffice.org/29459
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit b11ad787372c4b833cc58a3738e375af26309b8d)
Reviewed-on: https://gerrit.libreoffice.org/29482
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/source/filter/xml/celltextparacontext.cxx 
b/sc/source/filter/xml/celltextparacontext.cxx
index 3f6c64b..dc89e14 100644
--- a/sc/source/filter/xml/celltextparacontext.cxx
+++ b/sc/source/filter/xml/celltextparacontext.cxx
@@ -94,9 +94,9 @@ void ScXMLCellTextParaContext::PushFieldTitle(const OUString& 
rStyleName)
 }
 
 void ScXMLCellTextParaContext::PushFieldURL(
-const OUString& rURL, const OUString& rRep, const OUString& rStyleName)
+const OUString& rURL, const OUString& rRep, const OUString& rStyleName, 
const OUString& rTargetFrame)
 {
-mrParentCxt.PushParagraphFieldURL(rURL, rRep, rStyleName);
+mrParentCxt.PushParagraphFieldURL(rURL, rRep, rStyleName, rTargetFrame);
 }
 
 ScXMLCellTextSpanContext::ScXMLCellTextSpanContext(
@@ -325,6 +325,9 @@ void ScXMLCellFieldURLContext::StartElement(const 
uno::ReferenceSetTargetFrame(rTargetFrame);
+PushParagraphField(pURLField, rStyleName);
 }
 
 void ScXMLTableRowCellContext::PushParagraphEnd()
diff --git a/sc/source/filter/xml/xmlcelli.hxx 
b/sc/source/filter/xml/xmlcelli.hxx
index 56090ca..d72bc20 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -143,7 +143,7 @@ public:
 void PushParagraphFieldDate(const OUString& rStyleName);
 void PushParagraphFieldSheetName(const OUString& rStyleName);
 void PushParagraphFieldDocTitle(const OUString& rStyleName);
-void PushParagraphFieldURL(const OUString& rURL, const OUString& rRep, 
const OUString& rStyleName);
+void PushParagraphFieldURL(const OUString& rURL, const OUString& rRep, 
const OUString& rStyleName, const OUString& rTargetFrame);
 void PushParagraphEnd();
 
 void SetAnnotation( const ScAddress& rPosition );
diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index 25eb603..aa8ec4a 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2951,9 +2951,13 @@ void writeContent(
 {
 // value
 
-OUString aURL = static_cast(pField)->GetURL();
+const SvxURLField* pURLField = static_cast(pField);
+OUString aURL = pURLField->GetURL();
 rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, 
rExport.GetRelativeReference(aURL));
 rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, "simple");
+OUString aTargetFrame = pURLField->GetTargetFrame();
+if (!aTargetFrame.isEmpty())
+rExport.AddAttribute(XML_NAMESPACE_OFFICE, 
XML_TARGET_FRAME_NAME, aTargetFrame);
 
 OUString aElemName = rExport.GetNamespaceMap().GetQNameByKey(
 XML_NAMESPACE_TEXT, GetXMLToken(XML_A));
diff --git a/sc/source/filter/xml/xmlimprt.cxx 
b/sc/source/filter/xml/xmlimprt.cxx
index f62f350..3b0a675 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -1893,6 +1893,7 @@ const SvXMLTokenMap& 
ScXMLImport::GetCellTextURLAttrTokenMap()
 {
 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_CELL_TEXT_URL_ATTR_UREF },
 { XML_NAMESPACE_XLINK, XML_TYPE, XML_TOK_CELL_TEXT_URL_ATTR_TYPE },
+{ XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME, 
XML_TOK_CELL_TEXT_URL_TARGET_FRAME },
 XML_TOKEN_MAP_END
 };
 
diff --git a/sc/source/filter/xml/xmlimprt.hxx 
b/sc/source/filter/xml/xmlimprt.hxx
index 882f1f0..6fc09d1 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -739,6 +739,7 @@ enum ScXMLCellTextURLAttrTokens
 {
 XML_TOK_CELL_TEXT_URL_ATTR_UREF,
 XML_TOK_CELL_TEXT_URL_ATTR_TYPE,
+XML_TOK_CELL_TEXT_URL_TARGET_FRAME
 };
 
 /**
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org

[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-10-04 Thread Markus Mohrhard
 sc/source/ui/undo/undoblk3.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 47d1aa87cbe8390f9c6190b13733f8c1fd240e30
Author: Markus Mohrhard 
Date:   Wed Sep 28 03:55:01 2016 +0200

tdf#99386, broadcast that cell content changed after merge cells undo/redo

Change-Id: Idf41d1b07e26af66d9eefd18e5d5b582edc205e9
Reviewed-on: https://gerrit.libreoffice.org/29370
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit f6f213bed507d1d7547f6098a67b6e460d46bce6)
Reviewed-on: https://gerrit.libreoffice.org/29377
Reviewed-by: jan iversen 

diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index bb90e11..791c5b7 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -728,6 +728,8 @@ void ScUndoMerge::DoChange( bool bUndo ) const
 
 if (!bDidPaint)
 ScUndoUtil::PaintMore(pDocShell, aRange);
+
+rDoc.BroadcastCells(aRange, SC_HINT_DATACHANGED);
 }
 
 ShowTable(aCurRange);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-09-27 Thread Markus Mohrhard
 sc/source/core/data/colorscale.cxx |4 
 1 file changed, 4 deletions(-)

New commits:
commit 6d66c353fb7ea7d47af2404e7e66cef0f6a690c3
Author: Markus Mohrhard 
Date:   Tue Sep 27 00:11:32 2016 +0200

tdf#101104 this paranoid safety check actually causes a bug

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

diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 42904e1..f71aa96 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -994,10 +994,6 @@ ScIconSetInfo* ScIconSetFormat::GetIconSetInfo(const 
ScAddress& rAddr) const
 double nMin = GetMinValue();
 double nMax = GetMaxValue();
 
-// this check is for safety
-if(nMin > nMax)
-return nullptr;
-
 sal_Int32 nIndex = 0;
 const_iterator itr = begin();
 ++itr;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-09-16 Thread Winfried Donkers
 sc/source/core/tool/interpr2.cxx |   22 +-
 1 file changed, 13 insertions(+), 9 deletions(-)

New commits:
commit 3bf31803959ccc54bb949630f936a768ef47a90b
Author: Winfried Donkers 
Date:   Fri Sep 9 13:18:42 2016 +0200

tdf#101541 function WORKDAY.INTL not working properly

When holidays are adjacent to weekend days, wrong results occurred.

Change-Id: I9ec86e00f1a62ea941ff70617a1b448601aff9cc
Reviewed-on: https://gerrit.libreoffice.org/28771
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit 5e9d5eeb8a33fdcc500377d9eace40b5f5a7f750)
Reviewed-on: https://gerrit.libreoffice.org/28970
Tested-by: Jenkins 
Reviewed-on: https://gerrit.libreoffice.org/28973

diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index bd255fc..d287718 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -513,14 +513,16 @@ void ScInterpreter::ScWorkday_MS()
 size_t nRef = 0;
 while ( nDays )
 {
-while ( nRef < nMax && nSortArray.at( nRef ) < nDate )
-nRef++;
-if ( !( nRef < nMax && nSortArray.at( nRef ) == nDate 
) || nRef >= nMax )
- nDays--;
-
 do
+{
 ++nDate;
+}
 while ( bWeekendMask[ GetDayOfWeek( nDate ) ] ); 
//jump over weekend day(s)
+
+while ( nRef < nMax && nSortArray.at( nRef ) < nDate )
+nRef++;
+if ( !( nRef < nMax && nSortArray.at( nRef ) == nDate 
) || nRef >= nMax )
+nDays--;
 }
 }
 else
@@ -528,14 +530,16 @@ void ScInterpreter::ScWorkday_MS()
 sal_Int16 nRef = nMax - 1;
 while ( nDays )
 {
+do
+{
+  --nDate;
+}
+while ( bWeekendMask[ GetDayOfWeek( nDate ) ] ); 
//jump over weekend day(s)
+
 while ( nRef >= 0 && nSortArray.at( nRef ) > nDate )
 nRef--;
 if ( !( nRef >= 0 && nSortArray.at( nRef ) == nDate ) 
|| nRef < 0 )
  nDays++;
-
-do
-  --nDate;
-while ( bWeekendMask[ GetDayOfWeek( nDate ) ] ); 
//jump over weekend day(s)
 }
 }
 PushDouble( ( double ) ( nDate - nNullDate ) );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-09-02 Thread Tor Lillqvist
 sc/source/core/data/column2.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit f87b678a40ab73402366f409078f20425f258953
Author: Tor Lillqvist 
Date:   Fri Sep 2 20:44:27 2016 +0300

tdf#101866: Get rid of two more erroneous upper-casings of strings

Follow-up to f948dce856d51704e1962553198015dbebb6e527.

Change-Id: I46c5a96a076fa6eec952e31201bb3563464cf602
Reviewed-on: https://gerrit.libreoffice.org/28626
Reviewed-by: Eike Rathke 
Tested-by: Tor Lillqvist 
(cherry picked from commit 326da3886e6f700ad1fb269df201fae9fa01d5df)
Reviewed-on: https://gerrit.libreoffice.org/28629
Tested-by: Jenkins 
Tested-by: Eike Rathke 

diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index fbaf4da..5a9d69a 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -2378,7 +2378,7 @@ bool appendToBlock(
 if (aRes.meType == sc::FormulaResultValue::String)
 {
 rCxt.ensureStrArray(rColArray, nArrayLen);
-(*rColArray.mpStrArray)[nPos] = 
aRes.maString.getDataIgnoreCase();
+(*rColArray.mpStrArray)[nPos] = 
aRes.maString.getData();
 }
 else
 {
@@ -2516,7 +2516,7 @@ copyFirstFormulaBlock(
 pStrArray = rCxt.m_StrArrays.back().get();
 }
 
-(*pStrArray)[nPos] = aRes.maString.getDataIgnoreCase();
+(*pStrArray)[nPos] = aRes.maString.getData();
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-08-18 Thread Caolán McNamara
 sc/source/ui/cctrl/checklistmenu.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit ecef794528282fa7e9fba93b6eff1dac097dae99
Author: Caolán McNamara 
Date:   Tue Aug 16 11:54:38 2016 +0100

Resolves: tdf#101165 crash on deselecting all filters

(cherry picked from commit b101ff56e874824fa9f0d37a8468b07dbf3d002c)

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

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index e5897ec..9d3298e 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -1632,8 +1632,11 @@ SvTreeListEntry* ScCheckListBox::ShowCheckEntry( const 
OUString& sName, ScCheckL
 {
 if ( !pEntry )
 {
-if ( rMember.mbDate )
+if (rMember.mbDate)
 {
+if (rMember.maDateParts.empty())
+return nullptr;
+
 SvTreeListEntry* pYearEntry = FindEntry( nullptr, 
rMember.maDateParts[0] );
 if ( !pYearEntry )
 pYearEntry = InsertEntry( rMember.maDateParts[0], nullptr, 
true );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-08-16 Thread Eike Rathke
 sc/source/core/tool/interpr4.cxx |   15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 6b63d44fee68a8db94b045c60767ee11a7265446
Author: Eike Rathke 
Date:   Fri Aug 5 21:01:49 2016 +0200

Resolves: rhbz#1364406 inherit the actual format index also for date and 
time

So summing [HH]:MM cells or calculating with dates uses the same format
in the result, not just the default format of a type.

This also fixes the apparently broken state stored by 4.4 (and earlier,
later?) where no type information was stored with the formula cell,
which may be just due to the old behavior of not applying the actual
format but determining it on the fly instead.

Change-Id: I14d0a7d07185bf5c77e0d7f6989a4a1d1a468d27
(cherry picked from commit f2e3de4dfcf10f9a59f8fc3f051c620fd50ef3c2)
Reviewed-on: https://gerrit.libreoffice.org/27917
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 2e31123..bf155a8 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4074,9 +4074,18 @@ StackVar ScInterpreter::Interpret()
 if ( nFuncFmtType != css::util::NumberFormat::UNDEFINED )
 {
 nRetTypeExpr = nFuncFmtType;
-// inherit the format index only for currency formats
-nRetIndexExpr = ( nFuncFmtType == 
css::util::NumberFormat::CURRENCY ?
-nFuncFmtIndex : 0 );
+// Inherit the format index for currency, date or time formats.
+switch (nFuncFmtType)
+{
+case css::util::NumberFormat::CURRENCY:
+case css::util::NumberFormat::DATE:
+case css::util::NumberFormat::TIME:
+case css::util::NumberFormat::DATETIME:
+nRetIndexExpr = nFuncFmtIndex;
+break;
+default:
+nRetIndexExpr = 0;
+}
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-08-16 Thread Eike Rathke
 sc/source/core/data/column4.cxx |   14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 10195ce5563d6ac93177b67d484151c01a751922
Author: Eike Rathke 
Date:   Tue Aug 2 19:55:08 2016 +0200

Resolves: tdf#100582 SetMatColsRows() when constructing matrix ScFormulaCell

... from an ScFormulaCellGroup token array, because ScFormulaResult that 
holds
the matrix dimensions is not cloned in that case as we don't clone from an
ScFormulaCell.

Change-Id: I13ab1b29db71ae1618580de995fe12ec423d4dc7
(cherry picked from commit c82a81bbda104ef08dd9e18725a09475b2d65183)
Reviewed-on: https://gerrit.libreoffice.org/27809
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 4c42a7d..bfcf257 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -483,6 +483,16 @@ void ScColumn::CloneFormulaCell(
 sc::CellStoreType::iterator itPos = maCells.begin();
 sc::CellTextAttrStoreType::iterator itAttrPos = maCellTextAttrs.begin();
 
+SCCOL nMatrixCols = 0;
+SCROW nMatrixRows = 0;
+sal_uInt8 nMatrixFlag = rSrc.GetMatrixFlag();
+if (nMatrixFlag == MM_FORMULA)
+{
+rSrc.GetMatColsRows( nMatrixCols, nMatrixRows);
+SAL_WARN_IF( nMatrixCols != 1 || nMatrixRows != 1, "sc.core",
+"ScColumn::CloneFormulaCell - cloning array/matrix with not 
exactly one column or row as single cell");
+}
+
 std::vector aFormulas;
 std::vector::const_iterator itSpan = rRanges.begin(), 
itSpanEnd = rRanges.end();
 for (; itSpan != itSpanEnd; ++itSpan)
@@ -514,7 +524,9 @@ void ScColumn::CloneFormulaCell(
 xGroup->compileCode(*pDocument, aPos, pDocument->GetGrammar());
 for (size_t i = 0; i < nLen; ++i, aPos.IncRow())
 {
-ScFormulaCell* pCell = new ScFormulaCell(pDocument, aPos, 
xGroup, pDocument->GetGrammar(), rSrc.GetMatrixFlag());
+ScFormulaCell* pCell = new ScFormulaCell(pDocument, aPos, 
xGroup, pDocument->GetGrammar(), nMatrixFlag);
+if (nMatrixFlag == MM_FORMULA)
+pCell->SetMatColsRows( nMatrixCols, nMatrixRows);
 if (i == 0)
 {
 xGroup->mpTopCell = pCell;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-08-03 Thread Eike Rathke
 sc/source/filter/oox/formulabase.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e1b88ef7dbbdf7e333630e9295bd317772907ad6
Author: Eike Rathke 
Date:   Fri Jul 15 13:43:09 2016 +0200

mapping ERROR.TYPE to ORG.OPENOFFICE.ERRORTYPE was always wrong

Change-Id: I02b941a1a884a984b39632cad36579130cd71d6c
(cherry picked from commit 3d70765218986abba8b6d7c8e3cadd83a62ee035)
Reviewed-on: https://gerrit.libreoffice.org/27853
Reviewed-by: Michael Stahl 
Tested-by: Jenkins 

diff --git a/sc/source/filter/oox/formulabase.cxx 
b/sc/source/filter/oox/formulabase.cxx
index b17a896..b2e9d63 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -487,7 +487,7 @@ static const FunctionData saFuncTableBiff4[] =
 { "RANK",   "RANK", 216,216,2,  3, 
 V, { VR, RO, VR }, 0 },
 { "DB", "DB",   247,247,4,  5, 
 V, { VR }, 0 },
 { "FREQUENCY",  "FREQUENCY",252,252,2,  2, 
 A, { RA }, 0 },
-{ "ORG.OPENOFFICE.ERRORTYPE","ERROR.TYPE",  261,261,1,  1, 
 V, { VR }, 0 },
+{ "ERROR.TYPE", "ERROR.TYPE",   261,261,1,  1, 
 V, { VR }, 0 },
 { "AVEDEV", "AVEDEV",   269,269,1,  
MX, V, { RX }, 0 },
 { "BETADIST",   "BETADIST", 270,270,3,  5, 
 V, { VR }, 0 },
 { "GAMMALN","GAMMALN",  271,271,1,  1, 
 V, { VR }, 0 },
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-08-03 Thread Caolán McNamara
 sc/source/ui/view/tabvwsh3.cxx |  134 +++--
 1 file changed, 91 insertions(+), 43 deletions(-)

New commits:
commit 00992771455dae0eb83b8c705ae648ad3683f0ef
Author: Caolán McNamara 
Date:   Wed Aug 3 09:35:50 2016 +0100

Resolves: tdf#100123 prefer notation priority in detecting range/address

i.e. try and parse whether something is a range or an address in order of
document address convention, Calc A1, Excel A1 and Excel R1C1, rather than
check if something is a range in any of those conventions before checking 
if it
might be an address in any of those conventions.

Reviewed-on: https://gerrit.libreoffice.org/27821
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

Backported.
 Conflicts:
sc/source/ui/view/tabvwsh3.cxx

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

diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 4fd9a5c..4771771 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -69,48 +69,95 @@
 
 #include 
 
-static sal_uInt16 lcl_ParseRange(ScRange& rScRange, const OUString& aAddress, 
ScDocument* pDoc, sal_uInt16 /* nSlot */)
+namespace
 {
-// start with the address convention set in the document
-formula::FormulaGrammar::AddressConvention eConv = 
pDoc->GetAddressConvention();
-sal_uInt16 nResult = rScRange.Parse(aAddress, pDoc, eConv);
-if ( (nResult & SCA_VALID) )
-return nResult;
-
-// try the default Calc (A1) address convention
-nResult = rScRange.Parse(aAddress, pDoc);
-if ( (nResult & SCA_VALID) )
-return nResult;
-
-// try the Excel A1 address convention
-nResult = rScRange.Parse(aAddress, pDoc, 
formula::FormulaGrammar::CONV_XL_A1);
-if ( (nResult & SCA_VALID) )
-return nResult;
-
-// try Excel R1C1 address convention
-return rScRange.Parse(aAddress, pDoc, 
formula::FormulaGrammar::CONV_XL_R1C1);
-}
+enum class DetectFlags
+{
+NONE,
+RANGE,
+ADDRESS
+};
 
-static sal_uInt16 lcl_ParseAddress(ScAddress& rScAddress, const OUString& 
aAddress, ScDocument* pDoc, sal_uInt16 /* nSlot */)
-{
-// start with the address convention set in the document
-formula::FormulaGrammar::AddressConvention eConv = 
pDoc->GetAddressConvention();
-sal_uInt16 nResult = rScAddress.Parse(aAddress, pDoc, eConv);
-if ( (nResult & SCA_VALID) )
-return nResult;
-
-// try the default Calc (A1) address convention
-nResult = rScAddress.Parse(aAddress, pDoc);
-if ( (nResult & SCA_VALID) )
-return nResult;
-
-// try the Excel A1 address convention
-nResult = rScAddress.Parse(aAddress, pDoc, 
formula::FormulaGrammar::CONV_XL_A1);
-if ( (nResult & SCA_VALID) )
-return nResult;
-
-// try Excel R1C1 address convention
-return rScAddress.Parse(aAddress, pDoc, 
formula::FormulaGrammar::CONV_XL_R1C1);
+struct ScRefFlagsAndType
+{
+sal_uInt16 nResult;
+DetectFlags eDetected;
+};
+
+ScRefFlagsAndType lcl_ParseRangeOrAddress(ScRange& rScRange, ScAddress& 
rScAddress,
+  const OUString& aAddress, 
ScDocument* pDoc)
+{
+ScRefFlagsAndType aRet;
+
+formula::FormulaGrammar::AddressConvention eConv;
+
+// start with the address convention set in the document
+eConv = pDoc->GetAddressConvention();
+aRet.nResult = rScRange.Parse(aAddress, pDoc, eConv);
+if (aRet.nResult & SCA_VALID)
+{
+aRet.eDetected = DetectFlags::RANGE;
+return aRet;
+}
+
+aRet.nResult = rScAddress.Parse(aAddress, pDoc, eConv);
+if (aRet.nResult & SCA_VALID)
+{
+aRet.eDetected = DetectFlags::ADDRESS;
+return aRet;
+}
+
+// try the default Calc (A1) address convention
+aRet.nResult = rScRange.Parse(aAddress, pDoc);
+if (aRet.nResult & SCA_VALID)
+{
+aRet.eDetected = DetectFlags::RANGE;
+return aRet;
+}
+
+aRet.nResult = rScAddress.Parse(aAddress, pDoc);
+if (aRet.nResult & SCA_VALID)
+{
+aRet.eDetected = DetectFlags::ADDRESS;
+return aRet;
+}
+
+// try the Excel A1 address convention
+aRet.nResult = rScRange.Parse(aAddress, pDoc, 
formula::FormulaGrammar::CONV_XL_A1);
+if (aRet.nResult & SCA_VALID)
+{
+aRet.eDetected = DetectFlags::RANGE;
+return aRet;
+}
+
+// try the Excel A1 address convention
+aRet.nResult = rScAddress.Parse(aAddress, pDoc, 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-07-26 Thread Tor Lillqvist
 sc/source/core/opencl/op_statistical.cxx  |   17 --
 sc/source/core/opencl/op_statistical.hxx  |1 
 sc/source/core/opencl/opinlinefun_statistical.cxx |  175 --
 3 files changed, 1 insertion(+), 192 deletions(-)

New commits:
commit 36efa60718b37fbd309dcb85e71023e7e9ffbdfd
Author: Tor Lillqvist 
Date:   Mon Jul 25 19:09:32 2016 +0300

No need for own implementation of erfc() in OpenCL

The own code was copied from the C++ one we used to have in
sal/rtl/math.cxx but which was removed in
a62bc6a65abb47adb0e4caff7e38823c15b302fc. However, it did not work
correctly on some machines at least, like my AMD A10-7800 running
Windows 10. I was unable to figure out why not. This lead to OpenCL
being disabled by the Desktop::CheckOpenCLCompute() code we now run
early on startup.

Anyway, as OpenCL has erfc(), just use that.

(cherry picked from commit 4afa88f289de1150850b52d36f2345fd9a9fbc1e)

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

diff --git a/sc/source/core/opencl/op_statistical.cxx 
b/sc/source/core/opencl/op_statistical.cxx
index d9a16f7..7ec558b 100644
--- a/sc/source/core/opencl/op_statistical.cxx
+++ b/sc/source/core/opencl/op_statistical.cxx
@@ -4098,21 +4098,6 @@ void OpNormdist::GenSlidingWindowFunction(
 ss << "return tmp;\n";
 ss << "}\n";
 }
-void OpNormsdist::BinInlineFun(std::set& decls,
-std::set& funs)
-{
-decls.insert(lcl_Erfc0600Decl);
-funs.insert(lcl_Erfc0600);
-decls.insert(lcl_Erfc2654Decl);
-funs.insert(lcl_Erfc2654);
-decls.insert(lcl_Erf0065Decl);
-funs.insert(lcl_Erf0065);
-decls.insert(rtl_math_erf_rdDecl);
-funs.insert(rtl_math_erf_rd);
-decls.insert(rtl_math_erfc_rdDecl);
-funs.insert(rtl_math_erfc_rd);
-}
-
 void OpNormsdist::GenSlidingWindowFunction(
 std::stringstream ,const std::string ,
 SubArguments )
@@ -4166,7 +4151,7 @@ void OpNormsdist::GenSlidingWindowFunction(
 }
 }
 ss << "x = tmp0;\n";
-ss << "double tmp = 0.5 * rtl_math_erfc_rd((-1)*x * 
0.7071067811865475);\n";
+ss << "double tmp = 0.5 * erfc((-1)*x * 0.7071067811865475);\n";
 ss << "return tmp;\n";
 ss << "}\n";
 }
diff --git a/sc/source/core/opencl/op_statistical.hxx 
b/sc/source/core/opencl/op_statistical.hxx
index 00deb73..970112d 100644
--- a/sc/source/core/opencl/op_statistical.hxx
+++ b/sc/source/core/opencl/op_statistical.hxx
@@ -241,7 +241,6 @@ class OpNormsdist:public Normal{
 public:
 virtual void GenSlidingWindowFunction(std::stringstream ,
 const std::string , SubArguments ) override;
-virtual void BinInlineFun(std::set& ,std::set&) 
override;
 virtual std::string BinFuncName() const override { return "OpNormsdist"; }
 };
 class OpNorminv:public Normal{
diff --git a/sc/source/core/opencl/opinlinefun_statistical.cxx 
b/sc/source/core/opencl/opinlinefun_statistical.cxx
index d16d938..dfed055 100644
--- a/sc/source/core/opencl/opinlinefun_statistical.cxx
+++ b/sc/source/core/opencl/opinlinefun_statistical.cxx
@@ -1361,181 +1361,6 @@ std::string gauss =
 "else\n"
 "return nVal;\n"
 "}\n";
-std::string lcl_Erfc0600Decl=
-"void lcl_Erfc0600( double x, double *fVal );\n";
-std::string lcl_Erfc0600 =
-"void lcl_Erfc0600( double  x, double *fVal )\n"
-"{\n"
-"double fPSum = 0.0;\n"
-"double fQSum = 0.0;\n"
-"double fXPow = 1.0;\n"
-"double *pn;\n"
-"double *qn;\n"
-"if ( x < 2.2 )\n"
-"{\n"
-"double pn22[] = { \n"
-"9.9992049799098E-1,   \n"
-"1.33154163936765307,  \n"
-"8.78115804155881782E-1,   \n"
-"3.31899559578213215E-1,   \n"
-"7.14193832506776067E-2,   \n"
-"7.06940843763253131E-3\n"
-"  };  \n"
-"double qn22[] = { \n"
-"1.0,  \n"
-"2.45992070144245533,  \n"
-"2.65383972869775752,  \n"
-"1.61876655543871376,  \n"
-"5.94651311286481502E-1,   \n"
-"1.26579413030177940E-1,   \n"
-"1.25304936549413393E-2\n"
-"   }; \n"
-"pn = pn22;\n"
-"qn = qn22;\n"
-"  }   \n"
-"  else\n"
-"  \n"
-"   {  \n"
-"double pn60[] = {\n"
-"9.99921140009714409E-1,\n"
-"1.62356584489366647,\n"
-"1.26739901455873222,\n"
-"5.81528574177741135E-1,\n"
-"1.57289620742838702E-1,\n"
-"2.25716982919217555E-2\n"
-"};\n"
-"double qn60[] = {\n"
-"1.0,\n"

[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-07-21 Thread Eike Rathke
 sc/source/core/tool/interpr4.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 38aceeda9df7a04bff344c82c4bc077217b1178d
Author: Eike Rathke 
Date:   Mon Jul 11 14:20:37 2016 +0200

Resolves: tdf#100847 also external svEmptyCell is 0 in numeric context

Regression of 243f19a1878d52a4074b59041dc3bc57ab84e417 that now
differentiates between numeric and string content of external
references' cells.

Change-Id: I7a9635357cc7651353067a38f9ac8bc295f88546
(cherry picked from commit 89a5464a21046821648ec77f03db8316ceb4e6f8)
Reviewed-on: https://gerrit.libreoffice.org/27111
Reviewed-by: Markus Mohrhard 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 9c30e2aab23e34ba91dbe80b7dd5e5c352bbaeb0)
Reviewed-on: https://gerrit.libreoffice.org/27372
Tested-by: Jenkins 

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 9cf3ed1..2e31123 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1991,7 +1991,7 @@ double ScInterpreter::GetDouble()
 PopExternalSingleRef(pToken);
 if (!nGlobalError && pToken)
 {
-if (pToken->GetType() == svDouble)
+if (pToken->GetType() == svDouble || pToken->GetType() == 
svEmptyCell)
 nVal = pToken->GetDouble();
 else
 nVal = ConvertStringToValue( 
pToken->GetString().getString());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-07-18 Thread Eike Rathke
 sc/source/core/tool/token.cxx |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 9bcc12e3b8f29067443b96cfc20cca5d183ed5cd
Author: Eike Rathke 
Date:   Sat Jul 16 01:43:11 2016 +0200

Resolves: tdf#100764 check row when determining bounds for deleted range

Regression introduced with a2e591e26549294cdb07eb685d4069343404d898 for 
tdf#86502

Change-Id: I493c458faedccfd6e2ddf849073a52661ef2e4d0
(cherry picked from commit ab1b351840160655a9f0caedbb35e9fdf203c5a0)
Reviewed-on: https://gerrit.libreoffice.org/27246
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 76018e4..fd390a4 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -4250,7 +4250,10 @@ void checkBounds(
 if (pDeletedRange && aAbs.aStart.Row() <= pDeletedRange->aStart.Row())
 {
 SCROW nOffset = pDeletedRange->aStart.Row() - aAbs.aStart.Row();
-rBounds.push_back(rPos.Row()+nOffset);
+SCROW nRow = rPos.Row() + nOffset;
+// Unlike for rCheckRange, for pDeletedRange nRow can be anywhere>=0.
+if (ValidRow(nRow))
+rBounds.push_back(nRow);
 }
 
 if (aAbs.aEnd.Row() >= rCheckRange.aEnd.Row())
@@ -4272,7 +4275,10 @@ void checkBounds(
 if (pDeletedRange && aAbs.aEnd.Row() >= pDeletedRange->aEnd.Row())
 {
 SCROW nOffset = pDeletedRange->aEnd.Row() + 1 - aAbs.aStart.Row();
-rBounds.push_back(rPos.Row()+nOffset);
+SCROW nRow = rPos.Row() + nOffset;
+// Unlike for rCheckRange, for pDeletedRange nRow can be ~anywhere.
+if (ValidRow(nRow))
+rBounds.push_back(nRow);
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-07-18 Thread Eike Rathke
 sc/source/core/tool/compiler.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 55a38964c28ab2fa9deac8db629c5940284b2394
Author: Eike Rathke 
Date:   Thu Jul 14 18:30:43 2016 +0200

forward compatibility for several _xlfn.ORG.OPENOFFICE.* functions in OOXML

as they will be written by LibreOffice 5.3

ERRORTYPE, MULTIRANGE, GOALSEEK, EASTERSUNDAY, CURRENT and STYLE.

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

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index c6684c8..e161b12 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2682,7 +2682,14 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool 
bInArray )
 OpCode  eOp;
 };
 static const FunctionName aOoxmlAliases[] = {
-{ "EFFECTIVE",  ocEffective }   // EFFECTIVE -> EFFECT
+{ "EFFECTIVE",  ocEffective },  // 
EFFECTIVE -> EFFECT
+// LibreOffice 5.3 will correctly write this, be able to read it.
+{ "_xlfn.ORG.OPENOFFICE.ERRORTYPE", ocErrorType },  // 
_xlfn.ORG.OPENOFFICE.ERRORTYPE -> ERRORTYPE
+{ "_xlfn.ORG.OPENOFFICE.MULTIRANGE",ocMultiArea },  // 
_xlfn.ORG.OPENOFFICE.MULTIRANGE -> MULTIRANGE
+{ "_xlfn.ORG.OPENOFFICE.GOALSEEK",  ocBackSolver }, // 
_xlfn.ORG.OPENOFFICE.GOALSEEK -> GOALSEEK
+{ "_xlfn.ORG.OPENOFFICE.EASTERSUNDAY",  ocEasterSunday },   // 
_xlfn.ORG.OPENOFFICE.EASTERSUNDAY -> EASTERSUNDAY
+{ "_xlfn.ORG.OPENOFFICE.CURRENT",   ocCurrent },// 
_xlfn.ORG.OPENOFFICE.CURRENT -> CURRENT
+{ "_xlfn.ORG.OPENOFFICE.STYLE", ocStyle }   // 
_xlfn.ORG.OPENOFFICE.STYLE -> STYLE
 };
 for (const FunctionName& rOoxmlAlias : aOoxmlAliases)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-07-11 Thread Michael Meeks
 sc/source/core/opencl/op_spreadsheet.cxx |   31 ++-
 1 file changed, 30 insertions(+), 1 deletion(-)

New commits:
commit 9613bb90986277f3a222bea9a6d6d11f53a36622
Author: Michael Meeks 
Date:   Thu Jul 7 20:23:41 2016 +0100

tdf#99512 - opencl - restrict scope of vlookup optimization to doubles.

Change-Id: Iab7316cb167f34c13adafe142af0fdd73eb7d04c
Reviewed-on: https://gerrit.libreoffice.org/27100
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
(cherry picked from commit dead5dc1ae3baab5e25d641322d138dd3d242bff)
Reviewed-on: https://gerrit.libreoffice.org/27105
Reviewed-by: Jan Holesovsky 

diff --git a/sc/source/core/opencl/op_spreadsheet.cxx 
b/sc/source/core/opencl/op_spreadsheet.cxx
index c18b2ba..243d299 100644
--- a/sc/source/core/opencl/op_spreadsheet.cxx
+++ b/sc/source/core/opencl/op_spreadsheet.cxx
@@ -45,12 +45,41 @@ void OpVLookup::GenSlidingWindowFunction(std::stringstream 
,
 CheckSubArgumentIsNan(ss,vSubArguments,arg++);
 int secondParaWidth = 1;
 
+// tdf#99512 - for now only allow non-dynamic indicees (the
+// common-case) to validate consistent return types vs. the input.
+int index = 0;
+int indexArg = vSubArguments.size() - 2;
+if (vSubArguments[indexArg]->GetFormulaToken()->GetType() == 
formula::svDouble)
+{
+const formula::FormulaDoubleToken *dblToken = static_cast(vSubArguments[indexArg]->GetFormulaToken());
+index = ::rtl::math::approxFloor(dblToken->GetDouble());
+}
+
 if (vSubArguments[1]->GetFormulaToken()->GetType() == 
formula::svDoubleVectorRef)
 {
 FormulaToken *tmpCur = vSubArguments[1]->GetFormulaToken();
 const formula::DoubleVectorRefToken*pCurDVR = static_cast(tmpCur);
-secondParaWidth = pCurDVR->GetArrays().size();
+const std::vector items = pCurDVR->GetArrays();
+
+secondParaWidth = items.size();
+
+if (index < 1 || index > secondParaWidth)
+throw Unhandled(__FILE__, __LINE__); // oob index.
+
+if (items[index - 1].mpStringArray)
+{
+rtl_uString **pStrings = items[index - 1].mpStringArray;
+for (size_t i = 0; i < pCurDVR->GetArrayLength(); ++i)
+{
+if (pStrings[i] != nullptr)
+{   // TODO: the GroupTokenConverter should do better.
+throw Unhandled(__FILE__, __LINE__); // mixed arguments.
+}
+}
+}
 }
+else
+throw Unhandled(__FILE__, __LINE__); // unusual vlookup.
 
 arg += secondParaWidth;
 CheckSubArgumentIsNan(ss,vSubArguments,arg++);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-07-04 Thread Michael Stahl
 sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 638a86ec065f43425065d6459fde05bf60c0e575
Author: Michael Stahl 
Date:   Mon Jul 4 21:21:46 2016 +0200

tdf#73335 sc: ODF export: ignore ScChangeAction SC_CAT_NONE harder

ScChangeTrackingExportHelper::WorkWithChangeAction() must not add
attributes when it does not export an element.

Change-Id: Ia6625b73114ab8bf93c4b7a31b484d11bef2fde9
(cherry picked from commit ed913ce8352dc4ad9f4688180a9b27d02e8f524f)
Reviewed-on: https://gerrit.libreoffice.org/26918
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx 
b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
index 8c3b6cc..0e0ec84 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
@@ -672,6 +672,11 @@ void 
ScChangeTrackingExportHelper::CollectActionAutoStyles(ScChangeAction* pActi
 
 void ScChangeTrackingExportHelper::WorkWithChangeAction(ScChangeAction* 
pAction)
 {
+if (pAction->GetType() == SC_CAT_NONE)
+{
+SAL_WARN("sc.filter", "WorkWithChangeAction: type is not writable");
+return;
+}
 rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ID, 
GetChangeID(pAction->GetActionNumber()));
 GetAcceptanceState(pAction);
 if (pAction->IsRejecting())
@@ -688,7 +693,7 @@ void 
ScChangeTrackingExportHelper::WorkWithChangeAction(ScChangeAction* pAction)
 WriteRejection(pAction);
 else
 {
-OSL_FAIL("not a writeable type");
+assert(false); // tdf#73335 this would create duplicate attributes
 }
 rExport.CheckAttrList();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-07-01 Thread Katarina Behrens
 sc/source/ui/miscdlgs/datafdlg.cxx |8 +++-
 sc/source/ui/view/cellsh2.cxx  |4 ++--
 2 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit aa7f3a3434c60bec0196e763ff56c76a8c9b57ff
Author: Katarina Behrens 
Date:   Wed Jun 29 16:21:52 2016 +0200

Step towards disposing of ScDataFormDlg properly

There were some VclPtrs hiding inside std::vector (twice), so fix
that, but the destructor is still not called (getting Window::~Window
inconsistency assert). With this patch however the screenshot cppunit
test no longer fails

Thanks noelgrandin for help

Change-Id: I8b46c4608cbab2070e36ef4abec226bcd997425e
Reviewed-on: https://gerrit.libreoffice.org/26772
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 
(cherry picked from commit ec6956491a0c6553a9fb91f64c6ceb7cd8e8aa52)

fix Window::~Window: inconsistency in top window chain leak

Change-Id: I4f32b77a4b107e5315e0c2bc9b20db897135c8b0
(cherry picked from commit 937cbdb579820aa1dd0526682df1ea98a34168c5)
Reviewed-on: https://gerrit.libreoffice.org/26792
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/miscdlgs/datafdlg.cxx 
b/sc/source/ui/miscdlgs/datafdlg.cxx
index 64dd5de..f1d8f63 100644
--- a/sc/source/ui/miscdlgs/datafdlg.cxx
+++ b/sc/source/ui/miscdlgs/datafdlg.cxx
@@ -216,8 +216,14 @@ void ScDataFormDlg::dispose()
 m_pBtnNext.clear();
 m_pBtnClose.clear();
 m_pSlider.clear();
-m_pGrid.clear();
 m_pFixedText.clear();
+for ( auto aFTIter = maFixedTexts.begin(); aFTIter != maFixedTexts.end(); 
++aFTIter )
+aFTIter->disposeAndClear();
+for ( auto aEditIter = maEdits.begin(); aEditIter != maEdits.end(); 
++aEditIter )
+aEditIter->disposeAndClear();
+maFixedTexts.clear();
+maEdits.clear();
+m_pGrid.clear();
 ModalDialog::dispose();
 }
 
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 354ae1f..643e880 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -342,8 +342,8 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
 ScAbstractDialogFactory* pFact = 
ScAbstractDialogFactory::Create();
 OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
 
-AbstractScDataFormDlg* pDlg = pFact->CreateScDataFormDlg(
-pTabViewShell->GetDialogParent(), pTabViewShell);
+std::unique_ptr 
pDlg(pFact->CreateScDataFormDlg(
+pTabViewShell->GetDialogParent(), pTabViewShell));
 OSL_ENSURE(pDlg, "Dialog create fail!");
 
 pDlg->Execute();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-06-29 Thread Tor Lillqvist
 sc/source/core/data/column2.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 593d8c825df9c0e79b2a8bb9a726ffb34b146845
Author: Tor Lillqvist 
Date:   Mon Jun 27 17:26:44 2016 +0300

tdf#75387: Don't case-fold strings for formula group calculations

There should be no need for it as far as I see. Possibly it made some
sense back when we thought we could use OpenCL for operators and
functions that are supposed to ignore the case of strings they
handle. But we hopefully should never try to use OpenCL for string
data nowadays anyway. And actually, the case-folding ended up
affecting strings handled by the so-called software interpreter. For
the tdf#75387, the sample sheet worked fine when OpenCL was enabled.

Change-Id: I1c170ebf09551fea0964f394cdb3c65079672257
(cherry picked from commit f948dce856d51704e1962553198015dbebb6e527)
Reviewed-on: https://gerrit.libreoffice.org/26746
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 2287b3b..4d7476e 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -2326,7 +2326,7 @@ bool appendToBlock(
 rCxt.ensureStrArray(rColArray, nArrayLen);
 
 for (; itData != itDataEnd; ++itData, ++nPos)
-(*rColArray.mpStrArray)[nPos] = 
itData->getDataIgnoreCase();
+(*rColArray.mpStrArray)[nPos] = itData->getData();
 }
 break;
 case sc::element_type_edittext:
@@ -2338,7 +2338,7 @@ bool appendToBlock(
 for (; itData != itDataEnd; ++itData, ++nPos)
 {
 OUString aStr = ScEditUtil::GetString(**itData, pDoc);
-(*rColArray.mpStrArray)[nPos] = 
rPool.intern(aStr).getDataIgnoreCase();
+(*rColArray.mpStrArray)[nPos] = 
rPool.intern(aStr).getData();
 }
 }
 break;
@@ -2439,7 +2439,7 @@ void copyFirstStringBlock(
 sc::string_block::iterator itEnd = it;
 std::advance(itEnd, nLen);
 for (; it != itEnd; ++it, ++itArray)
-*itArray = it->getDataIgnoreCase();
+*itArray = it->getData();
 }
 break;
 case sc::element_type_edittext:
@@ -2453,7 +2453,7 @@ void copyFirstStringBlock(
 {
 EditTextObject* pText = *it;
 OUString aStr = ScEditUtil::GetString(*pText, );
-*itArray = rPool.intern(aStr).getDataIgnoreCase();
+*itArray = rPool.intern(aStr).getData();
 }
 }
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-06-29 Thread Caolán McNamara
 sc/source/ui/app/transobj.cxx |   15 +++
 sc/source/ui/inc/transobj.hxx |8 +++-
 sc/source/ui/view/gridwin.cxx |   14 --
 sc/source/ui/view/select.cxx  |1 +
 sc/source/ui/view/tabcont.cxx |2 ++
 5 files changed, 37 insertions(+), 3 deletions(-)

New commits:
commit 172d13121ff2afa1a2d2697570394560ae9a6ffa
Author: Caolán McNamara 
Date:   Mon Jun 20 12:13:02 2016 +0100

tdf#96540 dragging between sheets can change the current cursor position

so the at position at time of drop may not be that at the start of
the drag.

So set the current cursor position to ScTransferObj when the drag starts
and retrieve it later

Related to:

commit ac3b66057ba677903b6de354317417b267be0fa0
Author: Kohei Yoshida 
Date:   Thu Sep 16 11:09:29 2010 +0200

calc-selection-fixed-cursor.diff: Migrated

n#502717, i#21869, i#97093, when making selection, don't move the 
cursor position

and

commit c433fa0639ccf5caeb0c128c8a3794322e2a1c81
Author: Markus Mohrhard 
Date:   Fri Jul 6 02:04:44 2012 +0200

adjust the calculation of the cursor pos if ALT is used, fdo#48869

Change-Id: I6316717c860d999270aa7f0fb50af5f6dfc7efd7

I haven't used SetSourceCursorPos everywhere a ScTransferObj is created, 
just
where its created through a drag event

Change-Id: I50c36b4a2ba45426edebc1f1dfa5e262db3c5d03
Reviewed-on: https://gerrit.libreoffice.org/26512
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit f9b46bbd2446a6c9a0aaab31016536bda4a77294)
Reviewed-on: https://gerrit.libreoffice.org/26538
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 85f65e2..d1ac04e 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -116,6 +116,8 @@ ScTransferObj::ScTransferObj( ScDocument* pClipDoc, const 
TransferableObjectDesc
 aObjDesc( rDesc ),
 nDragHandleX( 0 ),
 nDragHandleY( 0 ),
+nSourceCursorX( MAXCOL + 1 ),
+nSourceCursorY( MAXROW + 1 ),
 nDragSourceFlags( 0 ),
 bDragWasInternal( false ),
 bUsedForLink( false ),
@@ -517,6 +519,19 @@ void ScTransferObj::SetDragHandlePos( SCCOL nX, SCROW nY )
 nDragHandleY = nY;
 }
 
+void ScTransferObj::SetSourceCursorPos( SCCOL nX, SCROW nY )
+{
+nSourceCursorX = nX;
+nSourceCursorY = nY;
+}
+
+bool ScTransferObj::WasSourceCursorInSelection() const
+{
+return
+nSourceCursorX >= aBlock.aStart.Col() && nSourceCursorX <= 
aBlock.aEnd.Col() &&
+nSourceCursorY >= aBlock.aStart.Row() && nSourceCursorY <= 
aBlock.aEnd.Row();
+}
+
 void ScTransferObj::SetVisibleTab( SCTAB nNew )
 {
 nVisibleTab = nNew;
diff --git a/sc/source/ui/inc/transobj.hxx b/sc/source/ui/inc/transobj.hxx
index a29fd4c..abce989 100644
--- a/sc/source/ui/inc/transobj.hxx
+++ b/sc/source/ui/inc/transobj.hxx
@@ -49,6 +49,8 @@ private:
 css::uno::Reference xDragSourceRanges;
 SCCOL   nDragHandleX;
 SCROW   nDragHandleY;
+SCCOL   nSourceCursorX;
+SCROW   nSourceCursorY;
 SCTAB   nVisibleTab;
 sal_uInt16  nDragSourceFlags;
 boolbDragWasInternal;
@@ -83,8 +85,11 @@ public:
 SCROW   GetNonFilteredRows() const { return nNonFiltered; }
 SCCOL   GetDragHandleX() const  { return nDragHandleX; }
 SCROW   GetDragHandleY() const  { return nDragHandleY; }
+boolWasSourceCursorInSelection() const;
+SCCOL   GetSourceCursorX() const  { return nSourceCursorX; }
+SCROW   GetSourceCursorY() const  { return nSourceCursorY; }
 SCTAB   GetVisibleTab() const   { return nVisibleTab; }
-sal_uInt16  GetDragSourceFlags() const  { return 
nDragSourceFlags; }
+sal_uInt16  GetDragSourceFlags() const  { return nDragSourceFlags; 
}
 boolHasFilteredRows() const { return bHasFiltered; }
 boolGetUseInApi() const { return bUseInApi; }
 ScDocShell* GetSourceDocShell();
@@ -93,6 +98,7 @@ public:
 
 voidSetDrawPersist( const SfxObjectShellRef& rRef );
 voidSetDragHandlePos( SCCOL nX, SCROW nY );
+voidSetSourceCursorPos( SCCOL nX, SCROW nY );
 voidSetVisibleTab( SCTAB nNew );
 voidSetDragSource( ScDocShell* pSourceShell, const 
ScMarkData& rMark );
 voidSetDragSourceFlags( sal_uInt16 nFlags );
diff --git 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-06-27 Thread Tor Lillqvist
 sc/source/core/opencl/formulagroupcl.cxx |   13 +
 1 file changed, 13 insertions(+)

New commits:
commit bc34f5bae1ffc42fb848b2341020fc3fa52afbe2
Author: Tor Lillqvist 
Date:   Mon Jun 27 12:36:22 2016 +0300

tdf#98515: Bail out early if kernel would have ridiculously many parameters

The Right Thing to do would be to compare the accumulated kernel
parameter size against the CL_DEVICE_MAX_PARAMETER_SIZE of the device,
but let's just do this sanity check for now. Bail out if the kernel
would have more than 50 parameters.

Calculating the accumulated kernel parameter size would be more
complicated and I don't want to touch this code more than
necessary. The kernel compilation will fail anyway if the size of
parameters exceeds the limit and this sanity check is just to make us
bail out a bit earlier.

In tdf#98515 the slowness seems to indeed be caused by the OpenCL code
generation , and there the number of parameters was 999, so this
sanity check does fix the slow loading issue (I checked).

(cherry picked from commit a48aefcae40663b63005d49a04fc7b89a473d613)

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

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 49360df..8055ecf 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -2630,6 +2630,19 @@ 
DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config,
 const formula::DoubleVectorRefToken* pDVR =
 static_cast(pChild);
 
+// FIXME: The Right Thing to do would be to compare the 
accumulated kernel
+// parameter size against the CL_DEVICE_MAX_PARAMETER_SIZE 
of the device, but
+// let's just do this sanity check for now. The kernel 
compilation will
+// hopefully fail anyway if the size of parameters exceeds 
the limit and this
+// sanity check is just to make us bail out a bit earlier.
+
+// The number 50 comes from the fact that the minimum size 
of
+// CL_DEVICE_MAX_PARAMETER_SIZE is 256, which for 32-bit 
code probably means 64
+// of them. Round down a bit.
+
+if (pDVR->GetArrays().size() > 50)
+throw UnhandledToken(pChild, ("Kernel would have 
ridiculously many parameters (" + std::to_string(2 + pDVR->GetArrays().size()) 
+ ")").c_str());
+
 for (size_t j = 0; j < pDVR->GetArrays().size(); ++j)
 {
 SAL_INFO("sc.opencl", "i=" << i << " j=" << j <<
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-06-14 Thread Eike Rathke
 sc/source/core/data/table4.cxx |   43 +
 1 file changed, 39 insertions(+), 4 deletions(-)

New commits:
commit 191100ff3ab38f6487d0da3b23b8544175b61d33
Author: Eike Rathke 
Date:   Mon Jun 13 13:49:43 2016 +0200

Resolves: tdf#90419 diminish precision error in Series Fill

There may be more elegant ways to accomplish this, go and find one..

Change-Id: Iceaa0783db9cf3d3e1aa20f075fe7e0618a1feb6
(cherry picked from commit e89c0e4fb783bd36d5f5fea154ee8608e542dae4)
Reviewed-on: https://gerrit.libreoffice.org/26220
Tested-by: Jenkins 
Reviewed-by: Christian Lohmaier 

diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 532d47c..b2bb054 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -188,6 +188,41 @@ void setSuffixCell(
 
 }
 
+namespace {
+/* TODO: move this to rtl::math::approxDiff() ? Though the name is funny, the
+ * approx is expected to be more correct than the raw diff. */
+/** Calculate a-b trying to diminish precision errors such as for 0.11-0.12
+not return -0.009995 but -0.01 instead.
+ */
+double approxDiff( double a, double b )
+{
+if (a == b)
+return 0.0;
+if (a == 0.0)
+return -b;
+if (b == 0.0)
+return a;
+const double c = a - b;
+const double aa = fabs(a);
+const double ab = fabs(b);
+if (aa < 1e-16 || aa > 1e+16 || ab < 1e-16 || ab > 1e+16)
+// This is going nowhere, live with the result.
+return c;
+
+const double q = aa < ab ? b / a : a / b;
+const double d = (a * q - b * q) / q;
+if (d == c)
+// No differing error, live with the result.
+return c;
+
+// We now have two subtractions with a similar but not equal error. Obtain
+// the exponent of the error magnitude and round accordingly.
+const double e = fabs(d - c);
+const double fExp = floor( log10( e));
+return rtl::math::round( c, -(static_cast(fExp))-1);
+}
+}
+
 void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
 FillCmd& rCmd, FillDateCmd& rDateCmd,
 double& rInc, sal_uInt16& rMinDigits,
@@ -314,7 +349,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
 {
 double nVal1 = aFirstCell.mfValue;
 double nVal2 = GetValue(nCol+nAddX, nRow+nAddY);
-rInc = nVal2 - nVal1;
+rInc = approxDiff( nVal2, nVal1);
 nCol = sal::static_int_cast( nCol + nAddX );
 nRow = sal::static_int_cast( nRow + nAddY );
 bool bVal = true;
@@ -324,7 +359,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
 if (aCell.meType == CELLTYPE_VALUE)
 {
 nVal2 = aCell.mfValue;
-double nDiff = nVal2 - nVal1;
+double nDiff = approxDiff( nVal2, nVal1);
 if ( !::rtl::math::approxEqual( nDiff, rInc, 13 ) )
 bVal = false;
 nVal1 = nVal2;
@@ -389,7 +424,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
 short nFlag2 = lcl_DecompValueString( aStr, nVal2,  
);
 if ( nFlag1 == nFlag2 )
 {
-rInc = (double)nVal2 - (double)nVal1;
+rInc = approxDiff( nVal2, nVal1);
 nCol = sal::static_int_cast( nCol + nAddX );
 nRow = sal::static_int_cast( nRow + nAddY );
 bool bVal = true;
@@ -403,7 +438,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
 nFlag2 = lcl_DecompValueString( aStr, nVal2, 
 );
 if ( nFlag1 == nFlag2 )
 {
-double nDiff = (double)nVal2 - (double)nVal1;
+double nDiff = approxDiff( nVal2, nVal1);
 if ( !::rtl::math::approxEqual( nDiff, rInc, 
13 ) )
 bVal = false;
 nVal1 = nVal2;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-06-14 Thread Winfried Donkers
 sc/source/core/tool/interpr2.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 641dfede9749dcc054b185bd72b227c0a1c093df
Author: Winfried Donkers 
Date:   Tue Jun 14 11:57:49 2016 +0200

tdf#100342 fix order of weekdays in NETWORKDAYS

For the definition of working/weekend days, ODFF1.2 uses 0..6
for Sunday..Saturday. NETWORKDAYS used ISO ordering (Monday..Sunday),
but now complies with ODFF1.2.

Change-Id: I169433adfac5d66af979181c328658040d7ab77f
Reviewed-on: https://gerrit.libreoffice.org/26246
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit d81fa4eb3a8960c1a1280fdd07bafa29de8290d2)
Reviewed-on: https://gerrit.libreoffice.org/26270

diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 2a35f83..bd255fc 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -324,8 +324,9 @@ sal_uInt16 ScInterpreter::GetWeekendAndHolidayMasks(
 if ( nWeekendDays.size() != 7 )
 return  errIllegalArgument;
 
+// Weekend days defined by string, Sunday...Saturday
 for ( int i = 0; i < 7; i++ )
-bWeekendMask[ i ] = ( bool ) nWeekendDays[ i ];
+bWeekendMask[ i ] = ( bool ) nWeekendDays[ ( i == 6 ? 0 : i + 
1 ) ];
 }
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-06-14 Thread Eike Rathke
 sc/source/core/tool/interpr4.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 91eb9901be5d61d6fcd930a898f2ddc372667aab
Author: Eike Rathke 
Date:   Tue Jun 14 14:07:26 2016 +0200

check ExternalSingleRef token for svDouble type

... before accessing GetDouble(). Else convert the string.
The new assert() introduced in FormulaToken::GetDouble() virtual dummy
was hit by loading gnome334723-1.sxc

Change-Id: I144b0cabee3aac44d206d76a83b1c4d81ab4a02e
(cherry picked from commit 243f19a1878d52a4074b59041dc3bc57ab84e417)
Reviewed-on: https://gerrit.libreoffice.org/26261
Reviewed-by: Markus Mohrhard 
Tested-by: Jenkins 

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index cbdc51e..9cf3ed1 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1990,7 +1990,12 @@ double ScInterpreter::GetDouble()
 ScExternalRefCache::TokenRef pToken;
 PopExternalSingleRef(pToken);
 if (!nGlobalError && pToken)
-nVal = pToken->GetDouble();
+{
+if (pToken->GetType() == svDouble)
+nVal = pToken->GetDouble();
+else
+nVal = ConvertStringToValue( 
pToken->GetString().getString());
+}
 }
 break;
 case svExternalDoubleRef:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-06-11 Thread Eike Rathke
 sc/source/core/tool/interpr2.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 8118a7c30e02b96a9dde9da590892c498681227f
Author: Eike Rathke 
Date:   Thu Jun 9 14:43:44 2016 +0200

Resolves: tdf#100285 EASTERSUNDAY() check valid year between 1583 and 9956

Change-Id: I4b25f1eb8e3cf0236b69607bb9ab9b4c57ae918a
(cherry picked from commit 2c08ec226e771de10c8863b7f1cda016fea442d2)
Reviewed-on: https://gerrit.libreoffice.org/26109
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index ef2277a..2a35f83 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -282,6 +282,12 @@ void ScInterpreter::ScEasterSunday()
 nYear = (sal_Int16) ::rtl::math::approxFloor( GetDouble() );
 if ( nYear < 100 )
 nYear = pFormatter->ExpandTwoDigitYear( nYear );
+if (nYear < 1583 || nYear > 9956)
+{
+// Valid Gregorian and maximum year constraints not met.
+PushIllegalArgument();
+return;
+}
 // don't worry, be happy :)
 int B,C,D,E,F,G,H,I,K,L,M,N,O;
 N = nYear % 19;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-06-09 Thread Eike Rathke
 sc/source/core/data/dpresfilter.cxx |   18 ++
 1 file changed, 18 insertions(+)

New commits:
commit 7a3be3a229d10665d724ffc215c9dca4ab8dd0bc
Author: Eike Rathke 
Date:   Tue Jun 7 16:30:45 2016 +0200

Resolves: tdf#89186 descend into dimension children to obtain leaf result

(cherry picked from commit 81f2bbc2fc42688d5f884d3dde58abe4c265694a)

Backported.

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

diff --git a/sc/source/core/data/dpresfilter.cxx 
b/sc/source/core/data/dpresfilter.cxx
index a416bc3..cffc05a 100644
--- a/sc/source/core/data/dpresfilter.cxx
+++ b/sc/source/core/data/dpresfilter.cxx
@@ -219,6 +219,24 @@ const ScDPResultTree::ValuesType* 
ScDPResultTree::getResults(
 pMember = itMem->second;
 }
 
+if (pMember->maValues.empty())
+{
+// Descend into dimension member children while there is no result and
+// exactly one dimension field with exactly one member item, for which
+// no further constraint (filter) has to match.
+const MemberNode* pFieldMember = pMember;
+while (pFieldMember->maChildDimensions.size() == 1)
+{
+DimensionsType::const_iterator itDim( 
pFieldMember->maChildDimensions.begin());
+const DimensionNode* pDim = itDim->second;
+if (pDim->maChildMembers.size() != 1)
+break;  // while
+pFieldMember = pDim->maChildMembers.begin()->second;
+if (!pFieldMember->maValues.empty())
+return >maValues;
+}
+}
+
 return >maValues;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-06-07 Thread Caolán McNamara
 sc/source/ui/miscdlgs/solverutil.cxx |   35 +--
 1 file changed, 21 insertions(+), 14 deletions(-)

New commits:
commit 24f1beffe30e68ad6f19ced885dbee0ba99a7b75
Author: Caolán McNamara 
Date:   Tue Jun 7 10:05:35 2016 +0100

Resolves: tdf#88237 crash without java but with nlp solver installed

Change-Id: Ifb451c299e4586a3a38c83a3111f3ac0b46d9315
(cherry picked from commit a33d18c1e38dd783e779ca1dbf54e1ad90cae751)
(cherry picked from commit 07c32ba5f81a3d2ed66ee182b8a7772d20c4266f)
Reviewed-on: https://gerrit.libreoffice.org/26007
Tested-by: Jenkins 
Reviewed-by: Katarina Behrens 

diff --git a/sc/source/ui/miscdlgs/solverutil.cxx 
b/sc/source/ui/miscdlgs/solverutil.cxx
index e047cb9..b7a19f4 100644
--- a/sc/source/ui/miscdlgs/solverutil.cxx
+++ b/sc/source/ui/miscdlgs/solverutil.cxx
@@ -65,20 +65,27 @@ void ScSolverUtil::GetImplementations( 
uno::Sequence& rImplNames,
 OUString sName = xInfo->getImplementationName();
 OUString sDescription;
 
-uno::Reference xSolver(
-xCFac->createInstanceWithContext(xCtx), 
uno::UNO_QUERY );
-uno::Reference xDesc( 
xSolver, uno::UNO_QUERY );
-if ( xDesc.is() )
-sDescription = xDesc->getComponentDescription();
-
-if ( sDescription.isEmpty() )
-sDescription = sName;  // use 
implementation name if no description available
-
-rImplNames.realloc( nCount+1 );
-rImplNames[nCount] = sName;
-rDescriptions.realloc( nCount+1 );
-rDescriptions[nCount] = sDescription;
-++nCount;
+try
+{
+uno::Reference xSolver(
+xCFac->createInstanceWithContext(xCtx), 
uno::UNO_QUERY );
+uno::Reference xDesc( 
xSolver, uno::UNO_QUERY );
+if ( xDesc.is() )
+sDescription = 
xDesc->getComponentDescription();
+
+if ( sDescription.isEmpty() )
+sDescription = sName;  // use 
implementation name if no description available
+
+rImplNames.realloc( nCount+1 );
+rImplNames[nCount] = sName;
+rDescriptions.realloc( nCount+1 );
+rDescriptions[nCount] = sDescription;
+++nCount;
+}
+catch (const css::uno::Exception& e)
+{
+SAL_INFO("sc", "ScSolverUtil::GetImplementations: 
cannot instantiate: " << sName << ", because: " << e.Message);
+}
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-31 Thread Marco Cecchetti
 sc/source/core/tool/scmatrix.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit a97f9c5790b4751098b0c3f78a387fbff36582a6
Author: Marco Cecchetti 
Date:   Tue May 31 10:42:06 2016 +0200

tdf#84411 - OpenCL: S/W interpreter throws std::out_of_range error

The problem is that in a array fragment, row start can be beyond data
row end.

Change-Id: I33658c87c21d1be237f4675241e3eabdd4ec7058
Reviewed-on: https://gerrit.libreoffice.org/25728
Reviewed-by: Jan Holesovsky 
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 47652d2..c70bf71 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -3065,6 +3065,10 @@ void ScVectorRefMatrix::ensureFullMatrix()
 size_t nRowSize = mnRowSize;
 size_t nRowEnd = mnRowStart + mnRowSize;
 size_t nDataRowEnd = mpToken->GetArrayLength();
+
+if (mnRowStart >= nDataRowEnd)
+return;
+
 if (nRowEnd > nDataRowEnd)
 {
 // Data array is shorter than the row size of the reference. Truncate
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-31 Thread Markus Mohrhard
 sc/source/filter/excel/xestring.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit bc1fbf9bd866091ed9b7c1f63879bfd264abf4e1
Author: Markus Mohrhard 
Date:   Wed Jan 27 16:25:50 2016 +0100

we need the space="preserve" also for formatted strings, tdf#96912

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

diff --git a/sc/source/filter/excel/xestring.cxx 
b/sc/source/filter/excel/xestring.cxx
index 7e87879..b0df834 100644
--- a/sc/source/filter/excel/xestring.cxx
+++ b/sc/source/filter/excel/xestring.cxx
@@ -410,7 +410,7 @@ static sal_uInt16 lcl_WriteRun( XclExpXmlStream& rStrm, 
const ScfUInt16Vec& rBuf
 rWorksheet->endElement( XML_rPr );
 }
 rWorksheet->startElement( XML_t,
-FSEND );
+FSNS(XML_xml, XML_space), "preserve", FSEND );
 rWorksheet->writeEscaped( XclXmlUtils::ToOUString( rBuffer, nStart, 
nLength ) );
 rWorksheet->endElement( XML_t );
 rWorksheet->endElement( XML_r );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-31 Thread Eike Rathke
 sc/source/core/data/document10.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 5e99baf433a3e3d372979cc74240de5c93f71319
Author: Eike Rathke 
Date:   Mon May 30 18:30:48 2016 +0200

Resolves: tdf#97158 CopyOneCellFromClip() does not handle multiple sheets

... so check that and bail out to let the remainder of CopyFromClip()
handle it.

(cherry picked from commit dc9eac5a5f4f247ba5efb67931ffde61f2c8d5b6)
9d07f557572bdeaeda8e923525c8895d79fc0d22
f65b29ff13211449144455668014a80aa8b331a3

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

diff --git a/sc/source/core/data/document10.cxx 
b/sc/source/core/data/document10.cxx
index 8e1a54b..1a41347 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -81,6 +81,10 @@ bool ScDocument::CopyOneCellFromClip(
 if (nDestColSize < nSrcColSize)
 return false;
 
+if (pClipDoc->maTabs.size() > 1)
+// Copying from multiple source sheets is not handled here.
+return false;
+
 ScAddress aSrcPos = aClipRange.aStart;
 
 for (SCCOL nCol = aClipRange.aStart.Col(); nCol <= aClipRange.aEnd.Col(); 
++nCol)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-24 Thread Caolán McNamara
 sc/source/core/data/bcaslot.cxx |9 +
 sc/source/core/inc/bcaslot.hxx  |1 +
 2 files changed, 10 insertions(+)

New commits:
commit a4ca886a6c0febac630761f4e7f685fc96a083ca
Author: Caolán McNamara 
Date:   Tue May 24 13:28:03 2016 +0100

Resolves: tdf#99733 don't crash on moving range of cells

Reviewed-on: https://gerrit.libreoffice.org/25405
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit 0d116ad98d7c25df4ad63839bcf2fd7f152956df)

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

diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx
index feee464..38babac 100644
--- a/sc/source/core/data/bcaslot.cxx
+++ b/sc/source/core/data/bcaslot.cxx
@@ -530,7 +530,11 @@ void ScBroadcastAreaSlot::EraseArea( 
ScBroadcastAreas::iterator& rIter )
 ScBroadcastArea* pArea = (*rIter).mpArea;
 aBroadcastAreaTbl.erase( rIter);
 if (!pArea->DecRef())
+{
+if (pBASM->IsInBulkBroadcast())
+pBASM->RemoveBulkGroupArea(pArea);
 delete pArea;
+}
 }
 }
 
@@ -1182,6 +1186,11 @@ size_t ScBroadcastAreaSlotMachine::RemoveBulkArea( const 
ScBroadcastArea* pArea
 return aBulkBroadcastAreas.erase( pArea );
 }
 
+void ScBroadcastAreaSlotMachine::RemoveBulkGroupArea( ScBroadcastArea* pArea )
+{
+maBulkGroupAreas.erase(pArea);
+}
+
 void ScBroadcastAreaSlotMachine::PushAreaToBeErased( ScBroadcastAreaSlot* 
pSlot,
 ScBroadcastAreas::iterator& rIter )
 {
diff --git a/sc/source/core/inc/bcaslot.hxx b/sc/source/core/inc/bcaslot.hxx
index 27ff119..3b43a19 100644
--- a/sc/source/core/inc/bcaslot.hxx
+++ b/sc/source/core/inc/bcaslot.hxx
@@ -324,6 +324,7 @@ public:
 boolInsertBulkArea( const ScBroadcastArea* p );
 
 void InsertBulkGroupArea( ScBroadcastArea* pArea, const ScRange& rRange );
+void RemoveBulkGroupArea( ScBroadcastArea* pArea );
 void BulkBroadcastGroupAreas();
 
 /// @return: how many removed
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-23 Thread Eike Rathke
 sc/source/core/tool/interpr1.cxx |   87 ---
 sc/source/core/tool/interpr4.cxx |8 +++
 sc/source/core/tool/interpr5.cxx |   33 ++
 3 files changed, 112 insertions(+), 16 deletions(-)

New commits:
commit 4c05c610661096342c0f826936aa3307a7ca78b3
Author: Eike Rathke 
Date:   Fri May 20 15:29:16 2016 +0200

Resolves: tdf#93101 handle external references and propagate error

Cherry-picked 5 commits from master:

tdf#93101 propagate external reference error from refcache token

(cherry picked from commit 7de92ad48d8c4fe7a1f9fb24ef8afc7d8907788e)

tdf#93101 correctly resolve svExternalSingleRef token in GetMatrix()

... including error propagation, and use GetNewMat() instead of a plain
ScFullMatrix so the interpreter error handling is set up.

(cherry picked from commit 2f94ff566f7827792175daedb92f12a7e61ad95d)

tdf#93101 handle svExternalSingleRef in ISERROR()

(cherry picked from commit 824cf015683383b553c744a746ac8e8ea65495cf)

handle svExternalSingleRef in all IS*() functions, tdf#93101 related

(cherry picked from commit f053086fbc625fca8ba7b956738d33ba78a80f9b)

handle svExternalDoubleRef in all IS*() functions, tdf#93101 related

(cherry picked from commit 365c4d8c60e89fd57a91f51ca51a8796fe91edd7)

862c46f9afc2afd0bb2a23aa767158e0945583a5
9e2a4aeb16d6777153d2f47a1c1af68fe2e97780
14181dd2dbb5d412e3dd165dcbf7468cb8ea8b21
48813de703ea926b8828f4e262393f7643216989

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

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 2d888a3..fa9d70a 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -1885,9 +1885,18 @@ bool ScInterpreter::IsString()
 }
 }
 break;
+case svExternalSingleRef:
+{
+ScExternalRefCache::TokenRef pToken;
+PopExternalSingleRef(pToken);
+if (!nGlobalError && pToken->GetType() == svString)
+bRes = true;
+}
+break;
+case svExternalDoubleRef:
 case svMatrix:
 {
-ScMatrixRef pMat = PopMatrix();
+ScMatrixRef pMat = GetMatrix();
 if ( !pMat )
 ;   // nothing
 else if ( !pJumpMatrix )
@@ -2452,6 +2461,22 @@ void ScInterpreter::ScIsRef()
 bRes = !x.get()->GetRefList()->empty();
 }
 break;
+case svExternalSingleRef:
+{
+ScExternalRefCache::TokenRef pToken;
+PopExternalSingleRef(pToken);
+if (!nGlobalError)
+bRes = true;
+}
+break;
+case svExternalDoubleRef:
+{
+ScExternalRefCache::TokenArrayRef pArray;
+PopExternalDoubleRef(pArray);
+if (!nGlobalError)
+bRes = true;
+}
+break;
 default:
 Pop();
 }
@@ -2493,9 +2518,18 @@ void ScInterpreter::ScIsValue()
 }
 }
 break;
+case svExternalSingleRef:
+{
+ScExternalRefCache::TokenRef pToken;
+PopExternalSingleRef(pToken);
+if (!nGlobalError && pToken->GetType() == svDouble)
+bRes = true;
+}
+break;
+case svExternalDoubleRef:
 case svMatrix:
 {
-ScMatrixRef pMat = PopMatrix();
+ScMatrixRef pMat = GetMatrix();
 if ( !pMat )
 ;   // nothing
 else if ( !pJumpMatrix )
@@ -2643,9 +2677,19 @@ void ScInterpreter::ScIsNV()
 }
 }
 break;
+case svExternalSingleRef:
+{
+ScExternalRefCache::TokenRef pToken;
+PopExternalSingleRef(pToken);
+if (nGlobalError == NOTAVAILABLE ||
+(pToken && pToken->GetType() == svError && 
pToken->GetError() == NOTAVAILABLE))
+bRes = true;
+}
+break;
+case svExternalDoubleRef:
 case svMatrix:
 {
-ScMatrixRef pMat = PopMatrix();
+ScMatrixRef pMat = GetMatrix();
 if ( !pMat )
 ;   // nothing
 else if ( !pJumpMatrix )
@@ -2690,9 +2734,19 @@ void ScInterpreter::ScIsErr()
 }
 }
 break;
+case svExternalSingleRef:
+{
+ScExternalRefCache::TokenRef pToken;
+PopExternalSingleRef(pToken);
+if ((nGlobalError && nGlobalError != NOTAVAILABLE) || !pToken ||
+(pToken->GetType() == svError && pToken->GetError() != 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-20 Thread Eike Rathke
 sc/source/core/tool/token.cxx |   53 +-
 1 file changed, 47 insertions(+), 6 deletions(-)

New commits:
commit 01a3831f9dc1b9f64775f3382180d27a3b51f131
Author: Eike Rathke 
Date:   Thu May 19 23:49:08 2016 +0200

Resolves: tdf#83746 wrapAddress() didn't do what it was supposed to do

i.e. subtracted nMaxRow from MAXROW that is set for entire column
references, resulting in row 983040=1048576-65536, instead of doing a
modulo operation.

Also, entire column/row references are now untouched so they still
reference the entire column/row.

Note that in Excel BIFF8 an absolute addressing of row 1 and 65536 means
entire column, so B$1:B$65536 saved and reloaded results in B:B, which
may be unexpected.

Change-Id: Iae65d47ba937b9ade95e4ea1be98012b80e1c9db
(cherry picked from commit 6821ad076c276b997c44520fd700817566a718c5)
Reviewed-on: https://gerrit.libreoffice.org/25182
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 8d9400c..76018e4 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -4805,9 +4805,40 @@ namespace {
 void wrapAddress( ScAddress& rPos, SCCOL nMaxCol, SCROW nMaxRow )
 {
 if (rPos.Col() > nMaxCol)
-rPos.SetCol(rPos.Col() - nMaxCol - 1);
+rPos.SetCol((rPos.Col() % (nMaxCol+1)));
 if (rPos.Row() > nMaxRow)
-rPos.SetRow(rPos.Row() - nMaxRow - 1);
+rPos.SetRow((rPos.Row() % (nMaxRow+1)));
+}
+
+template void wrapRange( T& n1, T& n2, T nMax )
+{
+if (n2 > nMax)
+{
+if (n1 == 0)
+n2 = nMax;  // Truncate to full range instead of wrapping to a 
weird range.
+else
+n2 = n2 % (nMax+1);
+}
+if (n1 > nMax)
+n1 = n1 % (nMax+1);
+}
+
+void wrapColRange( ScRange& rRange, SCCOL nMaxCol )
+{
+SCCOL nCol1 = rRange.aStart.Col();
+SCCOL nCol2 = rRange.aEnd.Col();
+wrapRange( nCol1, nCol2, nMaxCol);
+rRange.aStart.SetCol( nCol1);
+rRange.aEnd.SetCol( nCol2);
+}
+
+void wrapRowRange( ScRange& rRange, SCROW nMaxRow )
+{
+SCROW nRow1 = rRange.aStart.Row();
+SCROW nRow2 = rRange.aEnd.Row();
+wrapRange( nRow1, nRow2, nMaxRow);
+rRange.aStart.SetRow( nRow1);
+rRange.aEnd.SetRow( nRow2);
 }
 
 }
@@ -4834,8 +4865,17 @@ void ScTokenArray::WrapReference( const ScAddress& rPos, 
SCCOL nMaxCol, SCROW nM
 formula::FormulaToken* pToken = *p;
 ScComplexRefData& rRef = *pToken->GetDoubleRef();
 ScRange aAbs = rRef.toAbs(rPos);
-wrapAddress(aAbs.aStart, nMaxCol, nMaxRow);
-wrapAddress(aAbs.aEnd, nMaxCol, nMaxRow);
+// Entire columns/rows are sticky.
+if (!rRef.IsEntireCol() && !rRef.IsEntireRow())
+{
+wrapColRange( aAbs, nMaxCol);
+wrapRowRange( aAbs, nMaxRow);
+}
+else if (rRef.IsEntireCol() && !rRef.IsEntireRow())
+wrapColRange( aAbs, nMaxCol);
+else if (!rRef.IsEntireCol() && rRef.IsEntireRow())
+wrapRowRange( aAbs, nMaxRow);
+// else nothing if both, column and row, are entire.
 aAbs.PutInOrder();
 rRef.SetRange(aAbs, rPos);
 }
@@ -4868,8 +4908,9 @@ bool ScTokenArray::NeedsWrapReference( const ScAddress& 
rPos, SCCOL nMaxCol, SCR
 formula::FormulaToken* pToken = *p;
 ScComplexRefData& rRef = *pToken->GetDoubleRef();
 ScRange aAbs = rRef.toAbs(rPos);
-if (aAbs.aStart.Col() > nMaxCol || aAbs.aStart.Row() > nMaxRow 
||
-aAbs.aEnd.Col() > nMaxCol || aAbs.aEnd.Row() > nMaxRow)
+// Entire columns/rows are sticky.
+if ((!rRef.IsEntireCol() && (aAbs.aStart.Row() > nMaxRow 
|| aAbs.aEnd.Row() > nMaxRow)) ||
+(!rRef.IsEntireRow() && (aAbs.aStart.Col() > nMaxCol 
|| aAbs.aEnd.Col() > nMaxCol)))
 return true;
 }
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-20 Thread Eike Rathke
 sc/source/core/tool/interpr4.cxx |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 81af926d186b22f3cddf34ffcd3a9447d5574cd9
Author: Eike Rathke 
Date:   Fri May 20 18:21:10 2016 +0200

use vector replication for single row/column arrays

... also in GetStringFromMatrix() and GetDoubleOrStringFromMatrix(), not 
only
in GetDoubleFromMatrix().

Change-Id: Idb4bd7d7ed7574cf80d2998d1e5bfa5a6015b833
(cherry picked from commit ccc49b79a8425138d46e7be2acf3ef43b5aa232f)
Reviewed-on: https://gerrit.libreoffice.org/25218
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 011d9c9..92e1304 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -2122,12 +2122,11 @@ svl::SharedString 
ScInterpreter::GetStringFromMatrix(const ScMatrixRef& pMat)
 SCSIZE nCols, nRows, nC, nR;
 pMat->GetDimensions( nCols, nRows);
 pJumpMatrix->GetPos( nC, nR);
-if ( nC < nCols && nR < nRows )
-{
+// Use vector replication for single row/column arrays.
+if ( (nC < nCols || nCols == 1) && (nR < nRows || nRows == 1) )
 return pMat->GetString( *pFormatter, nC, nR);
-}
-else
-SetError( errNoValue);
+
+SetError( errNoValue);
 }
 return svl::SharedString::getEmptyString();
 }
@@ -2168,7 +2167,8 @@ ScMatValType ScInterpreter::GetDoubleOrStringFromMatrix(
 SCSIZE nCols, nRows, nC, nR;
 pMat->GetDimensions( nCols, nRows);
 pJumpMatrix->GetPos( nC, nR);
-if ( nC < nCols && nR < nRows )
+// Use vector replication for single row/column arrays.
+if ( (nC < nCols || nCols == 1) && (nR < nRows || nRows == 1) )
 {
 nMatVal = pMat->Get( nC, nR);
 nMatValType = nMatVal.nType;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-20 Thread Eike Rathke
 sc/source/core/tool/interpr1.cxx |4 
 1 file changed, 4 deletions(-)

New commits:
commit 3fefe33f2eeec3118b9abfdfcb2f253eee8c4c99
Author: Eike Rathke 
Date:   Fri May 20 19:52:55 2016 +0200

handle svExternalDoubleRef just the same as svMatrix in MATCH

Change-Id: Ibd2b6fcc2be85948a7e228494e4e388e79c1e9ab
(cherry picked from commit 9512dd16c92231514b9a5df3891517861a882d73)
Reviewed-on: https://gerrit.libreoffice.org/25220
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 6e9597d..2d888a3 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -4352,10 +4352,6 @@ void ScInterpreter::ScMatch()
 }
 break;
 case svExternalDoubleRef:
-// TODO: Implement this.
-PushIllegalParameter();
-return;
-break;
 case svMatrix :
 {
 svl::SharedString aStr;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-20 Thread Eike Rathke
 sc/source/core/tool/interpr1.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit df48c5aeadf89f89222a8188ce6a6d8bf96bda79
Author: Eike Rathke 
Date:   Fri May 20 16:35:08 2016 +0200

always use GetNewMat() in interpreter context instead of plain 
ScFullMatrix()

... so error handling interpreter is set and im-/mutable flagged
correctly.

Change-Id: I3e2647b6e4a4f4bcfdf7264d6942844941ea6c6b
(cherry picked from commit 981ff6dfd8627981462ec7c10a8a74d636d3d0d5)
Reviewed-on: https://gerrit.libreoffice.org/25213
Reviewed-by: Markus Mohrhard 
Tested-by: Jenkins 

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index bf3c0e2..6e9597d 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -4651,7 +4651,7 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf 
eFunc )
 break;
 case svExternalSingleRef:
 {
-pSumExtraMatrix = new ScFullMatrix(1, 1, 0.0);
+pSumExtraMatrix = GetNewMat(1,1);
 ScExternalRefCache::TokenRef pToken;
 PopExternalSingleRef(pToken);
 if (!pToken)
@@ -5903,7 +5903,7 @@ void ScInterpreter::ScLookup()
 ScMatrixRef pDataMat2;
 if (bVertical)
 {
-ScMatrixRef pTempMat(new ScFullMatrix(1, nR, 0.0));
+ScMatrixRef pTempMat = GetNewMat(1, nR);
 for (SCSIZE i = 0; i < nR; ++i)
 if (pDataMat->IsValue(0, i))
 pTempMat->PutDouble(pDataMat->GetDouble(0, i), 0, i);
@@ -5913,7 +5913,7 @@ void ScInterpreter::ScLookup()
 }
 else
 {
-ScMatrixRef pTempMat(new ScFullMatrix(nC, 1, 0.0));
+ScMatrixRef pTempMat = GetNewMat(nC, 1);
 for (SCSIZE i = 0; i < nC; ++i)
 if (pDataMat->IsValue(i, 0))
 pTempMat->PutDouble(pDataMat->GetDouble(i, 0), i, 0);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-19 Thread Eike Rathke
 sc/source/core/tool/token.cxx |   38 +++---
 1 file changed, 31 insertions(+), 7 deletions(-)

New commits:
commit 2dd04ab835656ebeabc341489650b9b97fa5dd8d
Author: Eike Rathke 
Date:   Wed May 18 23:32:00 2016 +0200

Resolves: tdf#86502 split formula groups referring bounds shifted into

So references can be updated or invalidated individually when deleting
cells with shifting cells up or left.

Change-Id: I03a57e94cf0fa9bb0716ffec21960e85ad5c7094
(cherry picked from commit a2e591e26549294cdb07eb685d4069343404d898)
Reviewed-on: https://gerrit.libreoffice.org/25118
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 1a83051..8d9400c 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -4218,18 +4218,18 @@ namespace {
 
 void checkBounds(
 const ScAddress& rPos, SCROW nGroupLen, const ScRange& rCheckRange,
-const ScSingleRefData& rRef, std::vector& rBounds )
+const ScSingleRefData& rRef, std::vector& rBounds, const ScRange* 
pDeletedRange )
 {
 if (!rRef.IsRowRel())
 return;
 
 ScRange aAbs(rRef.toAbs(rPos));
 aAbs.aEnd.IncRow(nGroupLen-1);
-if (!rCheckRange.Intersects(aAbs))
+if (!rCheckRange.Intersects(aAbs) && (!pDeletedRange || 
!pDeletedRange->Intersects(aAbs)))
 return;
 
 // Get the boundary row positions.
-if (aAbs.aEnd.Row() < rCheckRange.aStart.Row())
+if (aAbs.aEnd.Row() < rCheckRange.aStart.Row() && (!pDeletedRange || 
aAbs.aEnd.Row() < pDeletedRange->aStart.Row()))
 // No intersections.
 return;
 
@@ -4246,6 +4246,12 @@ void checkBounds(
 SCROW nOffset = rCheckRange.aStart.Row() - aAbs.aStart.Row();
 rBounds.push_back(rPos.Row()+nOffset);
 }
+// Same for deleted range.
+if (pDeletedRange && aAbs.aStart.Row() <= pDeletedRange->aStart.Row())
+{
+SCROW nOffset = pDeletedRange->aStart.Row() - aAbs.aStart.Row();
+rBounds.push_back(rPos.Row()+nOffset);
+}
 
 if (aAbs.aEnd.Row() >= rCheckRange.aEnd.Row())
 {
@@ -4262,6 +4268,12 @@ void checkBounds(
 SCROW nOffset = rCheckRange.aEnd.Row() + 1 - aAbs.aStart.Row();
 rBounds.push_back(rPos.Row()+nOffset);
 }
+// Same for deleted range.
+if (pDeletedRange && aAbs.aEnd.Row() >= pDeletedRange->aEnd.Row())
+{
+SCROW nOffset = pDeletedRange->aEnd.Row() + 1 - aAbs.aStart.Row();
+rBounds.push_back(rPos.Row()+nOffset);
+}
 }
 
 void checkBounds(
@@ -4271,6 +4283,9 @@ void checkBounds(
 if (!rRef.IsRowRel())
 return;
 
+ScRange aDeletedRange( ScAddress::UNINITIALIZED );
+const ScRange* pDeletedRange = nullptr;
+
 ScRange aCheckRange = rCxt.maRange;
 if (rCxt.meMode == URM_MOVE)
 {
@@ -4281,8 +4296,17 @@ void checkBounds(
 assert(!"can't move");
 }
 }
+else if (rCxt.meMode == URM_INSDEL &&
+((rCxt.mnColDelta < 0 && rCxt.maRange.aStart.Col() > 0) ||
+ (rCxt.mnRowDelta < 0 && rCxt.maRange.aStart.Row() > 0)))
+{
+// Check bounds also against deleted range where cells are shifted
+// into and references need to be invalidated.
+aDeletedRange = getSelectedRange( rCxt);
+pDeletedRange = 
+}
 
-checkBounds(rPos, nGroupLen, aCheckRange, rRef, rBounds);
+checkBounds(rPos, nGroupLen, aCheckRange, rRef, rBounds, pDeletedRange);
 }
 
 }
@@ -4341,14 +4365,14 @@ void ScTokenArray::CheckRelativeReferenceBounds(
 case svSingleRef:
 {
 const ScSingleRefData& rRef = *p->GetSingleRef();
-checkBounds(rPos, nGroupLen, rRange, rRef, rBounds);
+checkBounds(rPos, nGroupLen, rRange, rRef, rBounds, 
nullptr);
 }
 break;
 case svDoubleRef:
 {
 const ScComplexRefData& rRef = *p->GetDoubleRef();
-checkBounds(rPos, nGroupLen, rRange, rRef.Ref1, 
rBounds);
-checkBounds(rPos, nGroupLen, rRange, rRef.Ref2, 
rBounds);
+checkBounds(rPos, nGroupLen, rRange, rRef.Ref1, 
rBounds, nullptr);
+checkBounds(rPos, nGroupLen, rRange, rRef.Ref2, 
rBounds, nullptr);
 }
 break;
 default:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-17 Thread Arul Michael
 sc/source/core/data/column.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit b7c9357dfbd119b0bad5034d61b1be140f99943b
Author: Arul Michael 
Date:   Mon May 16 15:52:21 2016 +0530

tdf#99255 Calc crashing on Undo after Spell Correction

 Avoiding null pointers being set for ScPostit* while
creating the undo document during spell check.

Change-Id: Ieb09cb2cee1c030f275eb5030dd779d543753c8b
Reviewed-on: https://gerrit.libreoffice.org/25030
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit 2d15020ea29d5541d1c44ff44a06eb5bcb35c52e)
Reviewed-on: https://gerrit.libreoffice.org/25070

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 596e338..4a5f266 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1206,9 +1206,13 @@ void ScColumn::CopyCellToDocument( SCROW nSrcRow, SCROW 
nDestRow, ScColumn& rDes
 {
 rDestCol.maCellTextAttrs.set(nDestRow, 
maCellTextAttrs.get(nSrcRow));
 ScPostIt* pNote = maCellNotes.get(nSrcRow);
-rDestCol.maCellNotes.set(nDestRow, pNote);
 if (pNote)
+{
+rDestCol.maCellNotes.set(nDestRow, pNote);
 pNote->UpdateCaptionPos(ScAddress(rDestCol.nCol, nDestRow, 
rDestCol.nTab));
+}
+else
+rDestCol.maCellNotes.set_empty(nDestRow, nDestRow);
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-12 Thread Stephan Bergmann
 sc/source/ui/dbgui/PivotLayoutDialog.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit af0f89913a250cef9545db6e0e75f3650c65f89c
Author: Stephan Bergmann 
Date:   Tue May 10 11:14:03 2016 +0200

Missing break in switch

Forgotten in 4f1f8b8e993b98095bf50c9e432fb0400d318b1f "pivot: new pivot 
table
layout dialog" (as clarified on IRC).

Change-Id: If35e1a9616e596b16bcb007f6ea172b634c11b85
(cherry picked from commit 100cd38d0530ebaec19338c0c612a73e15fb1b4f)
Reviewed-on: https://gerrit.libreoffice.org/24917
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx 
b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
index 531eb49..72eec8a 100644
--- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
@@ -404,6 +404,7 @@ void ScPivotLayoutDialog::ItemInserted(ScItemValue* 
pItemValue, ScPivotLayoutTre
 mpListBoxColumn->RemoveEntryForItem(pItemValue);
 mpListBoxPage->RemoveEntryForItem(pItemValue);
 }
+break;
 case ScPivotLayoutTreeList::LABEL_LIST:
 {
 mpListBoxRow->RemoveEntryForItem(pItemValue);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-12 Thread Stephan Bergmann
 sc/source/ui/view/tabvwsh3.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit c82f0680283d3a6daaed5717cb791a5ee9692aea
Author: Stephan Bergmann 
Date:   Wed May 11 15:51:34 2016 +0200

Missing break in switch

The case SID_CURRENTDOC used to harmlessly fall through to

  case SID_ATTR_SIZE://XXX ???
  break;

which was removed with ebabf6d1fa648d62dd63529e9fe64dcb631caee8 "fdo#86018 
Don't
do anything when clicked on placeholder in statusbar", making it erroneously
fall through to the case SID_PRINTPREVIEW instead.

Change-Id: Ib7792ed4198ea3e25696a63f0d7ab4df78848e6a
(cherry picked from commit 3c8f49d7f8d70282236bf4f3d6b5a700e169f8e8)
Reviewed-on: https://gerrit.libreoffice.org/24919
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 957fa3f..4fd9a5c 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -494,6 +494,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
 
 rReq.Ignore();//XXX is handled by SFX
 }
+break;
 
 case SID_PRINTPREVIEW:
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-10 Thread Julien Nabet
 sc/source/core/data/documen2.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c9b828dd75961e22da276471f18a3aab1b87ffbc
Author: Julien Nabet 
Date:   Sun Apr 24 20:54:28 2016 +0200

tdf#99479: Delete column with styles resets the 'Apply Style' drop down

To start, the problem appears in SvxStyleToolBoxControl::FillStyleBox()
pStyleSheetPool->First() returns null to pStyle because pStyleSheetPool is 
empty so we don't enter in while ( pStyle )
and can't add non default styles

So why pStyleSheetPool is empty?

pStyleSheetPool comes from pPool (SvxStyleToolBoxControl::Update()),
pPool is retrieved from pDocShell->GetStyleSheetPool() (=> 
static_cast(aDocument.GetStyleSheetPool()))
which is retrieved from xPoolHelper->GetStylePool(); 
ScDocument::GetStyleSheetPool()

Let's move on, why xPoolHelper is empty?

it's because when we delete the column, it does this:
0  ScPoolHelper::SourceDocumentGone (this=0x2c006c0) at 
/home/julien/lo/libreoffice/sc/source/core/data/poolhelp.cxx:116
1  0x2aaad4e28eae in ScDocument::~ScDocument (this=0x8d6ac40, 
__in_chrg=) at 
/home/julien/lo/libreoffice/sc/source/core/data/documen2.cxx:426
2  0x2aaad57a85f8 in ScDocFunc::DeleteCells (this=0x2c04bb0, 
rRange=..., pTabMark=0x3231ad0, eCmd=DEL_DELCOLS, bApi=false)
at /home/julien/lo/libreoffice/sc/source/ui/docshell/docfunc.cxx:2415
3  0x2aaad5cfa0f3 in ScViewFunc::DeleteCells (this=0x3230fd8, 
eCmd=DEL_DELCOLS) at 
/home/julien/lo/libreoffice/sc/source/ui/view/viewfunc.cxx:1512

But calling delete on pRefUndoDoc shouldn't call SourceDocumentGone since 
it's been created as a ScDocument with SCDOCMODE_UNDO eMode
not with "SCDOCMODE_DOCUMENT" eMode. Since xPoolHelper is instantiated when 
only "SCDOCMODE_DOCUMENT" eMode
(see 
http://opengrok.libreoffice.org/xref/core/sc/source/core/data/documen2.cxx#224),
only destructor call of a document with eMode "SCDOCMODE_DOCUMENT" should 
be able to destroy xPoolHelper

So the fix is only to call PoolHelper->SourceDocumentGone(); when 
(xPoolHelper.is() && !bIsClip) but also if !bIsUndo

Change-Id: I1089d20264d0594c7e8ebe9263ebad6e68485c12
Reviewed-on: https://gerrit.libreoffice.org/24345
Tested-by: Jenkins 
Tested-by: Yousuf Philips 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit a7b4a0a9f387310832cce7a6850ec438ce03b31e)
Reviewed-on: https://gerrit.libreoffice.org/24792
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index f436363..97607d4 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -422,7 +422,7 @@ ScDocument::~ScDocument()
 // delete the EditEngine before destroying the xPoolHelper
 delete pCacheFieldEditEngine;
 
-if ( xPoolHelper.is() && !bIsClip )
+if ( xPoolHelper.is() && !bIsClip && !bIsUndo)
 xPoolHelper->SourceDocumentGone();
 xPoolHelper.clear();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-06 Thread Eike Rathke
 sc/source/core/tool/compiler.cxx |   11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 7ff50286bf7a8d99711388dfe7bb5ebeca4aa4d0
Author: Eike Rathke 
Date:   Fri May 6 16:56:29 2016 +0200

tdf#86575 for OOXML write plain #REF! if deleted parts

(cherry picked from commit bb0ef99fb9dce30e99a7e9f7fa295a634d07b423)

write the [#REF!] as defined in ODFF, tdf#86575 related

... if a part of the reference was deleted, instead of [.#REF!A1]

Actually this is a regression that already can be tracked down to
c54616f62bc70a9d39abf8837a9d7c3031c80a41 which changed things to use
ValidAddress() only.

(cherry picked from commit eeb203089f2ba6dffba9a2543c9a7e8bf551bbc5)

70f68722d7af02f6da3380c2dd9d54704c20b451

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

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 9d27219..a841c80 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -1023,7 +1023,8 @@ struct ConventionOOO_A1_ODF : public ConventionOOO_A1
 if( !bSingleRef )
 aAbs2 = rRef.Ref2.toAbs(rPos);
 
-if (FormulaGrammar::isODFF(eGram) && (!ValidAddress(aAbs1) || 
!ValidAddress(aAbs2)))
+if (FormulaGrammar::isODFF(eGram) && (rRef.Ref1.IsDeleted() || 
!ValidAddress(aAbs1) ||
+(!bSingleRef && (rRef.Ref2.IsDeleted() || 
!ValidAddress(aAbs2)
 {
 rBuffer.append(rErrRef);
 // For ODFF write [#REF!], but not for PODF so apps reading ODF
@@ -1421,6 +1422,14 @@ struct ConventionXL_OOX : public ConventionXL_A1
 aPos.SetRow(0);
 }
 
+if (rRef.Ref1.IsDeleted() || (!bSingleRef && rRef.Ref2.IsDeleted()))
+{
+// For OOXML write plain "#REF!" instead of detailed sheet/col/row
+// information.
+rBuf.append(rErrRef);
+return;
+}
+
 ConventionXL_A1::makeRefStr( rBuf, eGram, aPos, rErrRef, rTabNames, 
rRef, bSingleRef, bFromRangeName);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-05 Thread Eike Rathke
 sc/source/ui/view/tabvwsh.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 84c6afa54def64d1ab548378caccde93b563d0f2
Author: Eike Rathke 
Date:   Wed May 4 13:41:59 2016 +0200

Resolves: tdf#94146 a11y crash, obtain formula using the correct pointer

Fallout from IAccessible2 integration. Of the union, wrong string
pointer instead of formula cell pointer was used.

Change-Id: I1afaf014a770ab52e8cbf880708bd66b3ef2
(cherry picked from commit 3a767d91bfa70af4303b905cefa038181d56cc9a)
Reviewed-on: https://gerrit.libreoffice.org/24652
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx
index 480dd22..e902de6 100644
--- a/sc/source/ui/view/tabvwsh.cxx
+++ b/sc/source/ui/view/tabvwsh.cxx
@@ -39,6 +39,7 @@
 #include "dwfunctr.hxx"
 #include "sc.hrc"
 #include "spelldialog.hxx"
+#include "formulacell.hxx"
 #include 
 
 #include 
@@ -115,7 +116,7 @@ OUString ScTabViewShell::GetFormula(ScAddress& rAddress)
 ScRefCellValue aCell(*pDoc, rAddress);
 if (!aCell.isEmpty() && aCell.meType == CELLTYPE_FORMULA)
 {
-sFormula = aCell.mpString->getString();
+aCell.mpFormula->GetFormula( sFormula);
 }
 return sFormula;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-03 Thread Eike Rathke
 sc/source/core/data/column.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit f6d54d43fc9c7b353a97162d026d58402bfbab20
Author: Eike Rathke 
Date:   Mon May 2 16:25:01 2016 +0200

Resolves: tdf#99417 explicitly track formula cells for 
BROADCAST_BROADCASTERS

Change-Id: I717fc6d1d7c2bc01ed2a256f6fc08a055be24e4b
(cherry picked from commit a0b9fa819c9193dee1405cee13690adf00e2d9b9)
Reviewed-on: https://gerrit.libreoffice.org/24592
Reviewed-by: Markus Mohrhard 
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 8e835b9..596e338 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -3169,7 +3169,14 @@ void ScColumn::SetDirty( SCROW nRow1, SCROW nRow2, 
BroadcastMode eMode )
 sc::ProcessFormula(maCells.begin(), maCells, nRow1, nRow2, 
aHdl);
 // Broadcast all broadcasters in range.
 ScHint aHint( SC_HINT_DATACHANGED, ScAddress( nCol, nRow1, 
nTab));
-BroadcastBroadcasters( nRow1, nRow2, aHint);
+if (BroadcastBroadcasters( nRow1, nRow2, aHint))
+{
+// SetDirtyOnRangeHandler implicitly tracks notified
+// formulas via ScDocument::Broadcast(), which
+// BroadcastBroadcastersHandler doesn't, so explicitly
+// track them here.
+pDocument->TrackFormulas();
+}
 }
 break;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-05-03 Thread Eike Rathke
 sc/source/core/tool/token.cxx |   44 +++---
 1 file changed, 25 insertions(+), 19 deletions(-)

New commits:
commit 947cd18108ca03abe79895fa38520338da159aa6
Author: Eike Rathke 
Date:   Mon Apr 25 18:54:41 2016 +0200

Resolves: tdf#99461 reverse logic of TokenPointers::skipToken()

... so that all code tokens are adjusted even if shared with another
flat copied token array, but RPN not if shared. Was vice versa.

ScConditionEntry has shared token arrays for pFormula1|pFCell1
respectively pFormula2|pFCell2 hence the references weren't updated.

Change-Id: I52256b5ea20da753a2a29ff437f09c921566e070
(cherry picked from commit 03124f5be5466c7f7cac012de05ef387b9718c4a)
Reviewed-on: https://gerrit.libreoffice.org/24375
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 29e629b..d73d8d7 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -139,27 +139,33 @@ namespace
 
 bool skipToken( size_t i, const FormulaToken* const * pp )
 {
-// Handle all tokens in RPN, and code tokens only if they have a
-// reference count of 1, which means they are not referenced in
-// RPN.
-if (i == 0)
-return (*pp)->GetRef() > 1;
-
-if (mbSkipRelName)
+// Handle all code tokens, and tokens in RPN only if they have a
+// reference count of 1, which means they are not referenced in the
+// code array. Doing it the other way would skip code tokens that
+// are held by flat copied token arrays and thus are shared. For
+// flat copy arrays the caller has to know what it does and should
+// discard all RPN, update only one array and regenerate all RPN.
+if (i == 1)
 {
-// Skip (do not adjust) relative references resulting from
-// named expressions.
-switch ((*pp)->GetType())
+if ((*pp)->GetRef() > 1)
+return true;
+
+if (mbSkipRelName)
 {
-case svSingleRef:
-return (*pp)->GetSingleRef()->IsRelName();
-case svDoubleRef:
-{
-const ScComplexRefData& rRef = 
*(*pp)->GetDoubleRef();
-return rRef.Ref1.IsRelName() || 
rRef.Ref2.IsRelName();
-}
-default:
-;   // nothing
+// Skip (do not adjust) relative references resulting from
+// named expressions. Resolved expressions are only in RPN.
+switch ((*pp)->GetType())
+{
+case svSingleRef:
+return (*pp)->GetSingleRef()->IsRelName();
+case svDoubleRef:
+{
+const ScComplexRefData& rRef = 
*(*pp)->GetDoubleRef();
+return rRef.Ref1.IsRelName() || 
rRef.Ref2.IsRelName();
+}
+default:
+;   // nothing
+}
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-04-26 Thread Stephan Bergmann
 sc/source/ui/app/scmod.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 52bfe2cffb71ee83bab4b56d3f950721f7104ca6
Author: Stephan Bergmann 
Date:   Tue Jan 19 10:53:27 2016 +0100

-Werror=address (GCC 6)

"the compiler can assume that the address of ‘rItem’ will never be NULL"

Change-Id: I90a8a3074c2dab427b4bc6345ec4a824eb2ac249
(cherry picked from commit 8404dc3c76babbc9d0a165f4046a6e5e1be35fe5)
Signed-off-by: David Tardon 
Reviewed-on: https://gerrit.libreoffice.org/24411
Tested-by: Jenkins 

diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 8a376e7..9bdaacb 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -471,8 +471,9 @@ void ScModule::Execute( SfxRequest& rReq )
 case SID_PSZ_FUNCTION:
 if (pReqArgs)
 {
-const SfxUInt16Item& rItem = static_cast(pReqArgs->Get(SID_PSZ_FUNCTION));
-OSL_ENSURE(dynamic_cast( ) !=  
nullptr,"wrong Parameter");
+auto const & p = pReqArgs->Get(SID_PSZ_FUNCTION);
+OSL_ENSURE(dynamic_cast() !=  
nullptr,"wrong Parameter");
+const SfxUInt16Item& rItem = static_cast(p);
 
 ScAppOptions aNewOpts( GetAppOptions() );
 aNewOpts.SetStatusFunc( rItem.GetValue() );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-04-20 Thread Caolán McNamara
 sc/source/ui/view/gridwin4.cxx |   12 
 1 file changed, 12 insertions(+)

New commits:
commit e3d8431d00116e9aeb5570b15324a26258afba00
Author: Caolán McNamara 
Date:   Wed Apr 20 11:55:01 2016 +0100

Resolves: tdf#91778 drawing the background over an active cursor

will overwrite it, which means that when it toggles "off" afterwards, it 
uses
invert on the freshly drawn background which will visually make it appear 
"on"
and not off

Just explictly turn it off and restore it and avoid the whole potential
problem.

Change-Id: Ie21d77e9d704124011e43b42c98b26eaf208eef2
(cherry picked from commit 29a9f433c268414747d8ec7343fc2b5987971738)
Reviewed-on: https://gerrit.libreoffice.org/24259
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index e15cb1e..731c560 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -900,6 +900,14 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 aEnd.X() -= 2 * nLayoutSign;
 aEnd.Y() -= 2;
 
+// toggle the cursor off if its on to ensure the cursor invert
+// background logic remains valid after the background is cleared on
+// the next cursor flash
+vcl::Cursor* pCrsr = pEditView->GetCursor();
+const bool bVisCursor = pCrsr && pCrsr->IsVisible();
+if (bVisCursor)
+pCrsr->Hide();
+
 // set the correct mapmode
 Rectangle aBackground(aStart, aEnd);
 if (bIsTiledRendering)
@@ -916,6 +924,10 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 // paint the editeng text
 pEditView->Paint(rDevice.PixelToLogic(Rectangle(Point(nScrX, nScrY), 
Size(aOutputData.GetScrW(), aOutputData.GetScrH(, );
 rDevice.SetMapMode(MAP_PIXEL);
+
+// restore the cursor it it was originally visible
+if (bVisCursor)
+pCrsr->Show();
 }
 
 if (pViewData->HasEditView(eWhich))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-04-19 Thread Eike Rathke
 sc/source/core/data/document.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit 958cb598912b534a8bf7fa7a3bb657b65e4d13ed
Author: Eike Rathke 
Date:   Mon Apr 18 22:03:07 2016 +0200

Resolves: tdf#99322 re-establish group area listeners after update reference

Change-Id: If2ec5f938c7278ce817de3d89dc84cc0584507ac
(cherry picked from commit 44e2da58226448c5617eac08ca2ae3d9a9ad2afa)
Reviewed-on: https://gerrit.libreoffice.org/24225
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 69059b5..843de15 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2595,6 +2595,14 @@ void ScDocument::CopyBlockFromClip(
 SetInsertingFromOtherDoc( true);
 aRefCxt.meMode = URM_MOVE;
 UpdateReference(aRefCxt, rCxt.getUndoDoc(), false);
+
+// For URM_MOVE group listeners may have been removed,
+// re-establish them.
+/* TODO: actually only those in
+ * sc::RefUpdateContext::maRegroupCols are affected,
+ * come up with a start listeners that takes such. */
+StartNeededListeners();
+
 SetInsertingFromOtherDoc( bOldInserting);
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-04-18 Thread Michael Stahl
 sc/source/core/data/dpsave.cxx  |6 +++---
 sc/source/ui/unoobj/dapiuno.cxx |3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit dba0cc1edc6d778805ca8ed4b77800f1e9a95408
Author: Michael Stahl 
Date:   Wed Apr 13 16:39:38 2016 +0200

tdf#96996 sc: fix the data pilot

ScDPSaveData::GetInnermostDimension() should iterate in reverse (that
fixes the reported bug), and ScDataPilotFieldObj::setOrientation()
loop needs an early exit.

(regression from 37856f59d2351951b95cf5eb3a5e4f0c011a8762)

Change-Id: I7e0309385f3444bfd3ad21268cce4d25e60d7b05
(cherry picked from commit 470f16acc2a798f0ae1ebe9ce2080084ab167e80)
Reviewed-on: https://gerrit.libreoffice.org/24060
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index 82d810c..708c8b2 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -1043,10 +1043,10 @@ ScDPSaveDimension* 
ScDPSaveData::GetInnermostDimension(sal_uInt16 nOrientation)
 // return the innermost dimension for the given orientation,
 // excluding data layout dimension
 
-for (auto const& iter : m_DimList)
+for (auto iter = m_DimList.rbegin(); iter != m_DimList.rend(); ++iter)
 {
-if (iter->GetOrientation() == nOrientation && !iter->IsDataLayout())
-return &(*iter);
+if ((*iter)->GetOrientation() == nOrientation && 
!(*iter)->IsDataLayout())
+return iter->get();
 }
 
 return nullptr;
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 8958182..d5881de 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -2071,7 +2071,10 @@ void 
ScDataPilotFieldObj::setOrientation(DataPilotFieldOrientation eNew)
 if ( !it->IsDataLayout() && (it->GetName() == 
maFieldId.maFieldName) )
 {
 if ( it->GetOrientation() == 
DataPilotFieldOrientation_HIDDEN )
+{
 pNewDim = it.get(); // use this one
+break;
+}
 else
 ++nFound;   // count existing non-hidden 
occurrences
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-04-12 Thread Eike Rathke
 sc/source/core/data/document.cxx |   36 +++-
 1 file changed, 35 insertions(+), 1 deletion(-)

New commits:
commit 1345cea38ecb51655375e77f5aa77aa9461d240b
Author: Eike Rathke 
Date:   Thu Apr 7 10:51:51 2016 +0100

Resolves: tdf#97897 (re)broadcast if formula groups were split

DeleteSelection() and DeleteSelectionTab() remove listeners for split
formula groups, broadcast change after listeners of new groups have been
established.

Change-Id: I017e92b5cbc5f866768f3732e9997028c0c065fa
(cherry picked from commit 94a95dce43e07b40350ed849db148b2946e3fd5e)
Reviewed-on: https://gerrit.libreoffice.org/23894
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 138cb07..69059b5 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -1830,7 +1830,6 @@ void ScDocument::DeleteArea(
 {
 aRange.aStart.SetTab(i);
 aRange.aEnd.SetTab(i);
-
 SetDirty( aRange, true);
 }
 }
@@ -5717,6 +5716,21 @@ void ScDocument::DeleteSelection( InsertDeleteFlags 
nDelFlag, const ScMarkData&
 // Re-start listeners on those top bottom groups that have been split.
 SetNeedsListeningGroups(aGroupPos);
 StartNeededListeners();
+
+// If formula groups were split their listeners were destroyed and may
+// need to be notified now that they're restored,
+// ScTable::DeleteSelection() couldn't do that.
+if (!aGroupPos.empty())
+{
+ScRangeList aRangeList;
+rMark.FillRangeListWithMarks( , false);
+for (size_t i = 0; i < aRangeList.size(); ++i)
+{
+const ScRange* pRange = aRangeList[i];
+if (pRange)
+SetDirty( *pRange, true);
+}
+}
 }
 }
 
@@ -5758,6 +5772,26 @@ void ScDocument::DeleteSelectionTab(
 // Re-start listeners on those top bottom groups that have been 
split.
 SetNeedsListeningGroups(aGroupPos);
 StartNeededListeners();
+
+// If formula groups were split their listeners were destroyed and 
may
+// need to be notified now that they're restored,
+// ScTable::DeleteSelection() couldn't do that.
+if (!aGroupPos.empty())
+{
+ScRangeList aRangeList;
+rMark.FillRangeListWithMarks( , false);
+for (size_t i = 0; i < aRangeList.size(); ++i)
+{
+const ScRange* pRange = aRangeList[i];
+if (pRange && pRange->aStart.Tab() <= nTab && nTab <= 
pRange->aEnd.Tab())
+{
+ScRange aRange( *pRange);
+aRange.aStart.SetTab( nTab);
+aRange.aEnd.SetTab( nTab);
+SetDirty( aRange, true);
+}
+}
+}
 }
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-04-12 Thread Eike Rathke
 sc/source/core/data/document.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 95c9d125df7c1c3fe6400cf51f5b4ca9b91c8834
Author: Eike Rathke 
Date:   Wed Apr 6 12:43:16 2016 +0100

(re)broadcast if value replaces cell of grouped formulas, tdf#97897 related

Replacing a grouped formula cell with a different content may lead to
the remaining cells of the group not being recalculated if they listen
to a range that contains the current position. For example

A1: 1
A2: =SUM($A$1:$A1)  => 1
A3: =SUM($A$1:$A2)  => 2

Enter 2 in A2 => A3 should be 3 but is not recalculated.
Loading http://bugs.documentfoundation.org/attachment.cgi?id=122714 of
tdf#97897 exhibits that behavior.

Change-Id: I10b91e77549a7534143be3d6e3cc03026cdaa764
(cherry picked from commit ce28d83912d14bc81c455af64893842de78a8c8d)
Reviewed-on: https://gerrit.libreoffice.org/23855
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 0a31419..138cb07 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3270,6 +3270,11 @@ bool ScDocument::SetString( SCCOL nCol, SCROW nRow, 
SCTAB nTab, const OUString&
 
 SetNeedsListeningGroups(aGroupPos);
 StartNeededListeners();
+
+// Listeners may just have been setup that are affected by the current
+// position thus were not notified by a ScColumn::BroadcastNewCell()
+// during ScTable::SetString(), so do it here.
+Broadcast( ScHint( SC_HINT_DATACHANGED, aPos));
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-04-12 Thread Eike Rathke
 sc/source/core/tool/compiler.cxx |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit a4c6fc2c2641d2020cce626877749a22ca10be4b
Author: Eike Rathke 
Date:   Tue Apr 5 18:03:00 2016 +0100

Resolves: tdf#98990 accept R1C1 notation entire column/row references

... which consist of only C4 or C[3] without a range operator.

Change-Id: I1865f0ec4c4fec1101b93b6b40d6f26871a65f07
(cherry picked from commit 3c36ba50f65d663f35264f2a11c99c0ff98674a2)
Reviewed-on: https://gerrit.libreoffice.org/23842
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index aa9e1b9..5f258df 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3008,15 +3008,19 @@ bool ScCompiler::IsReference( const OUString& rName )
 }
 else
 {
-// Special treatment for the 'E:\[doc]Sheet1:Sheet3'!D5 Excel sickness,
-// mnRangeOpPosInSymbol did not catch the range operator as it is
-// within a quoted name.
 switch (pConv->meConv)
 {
 case FormulaGrammar::CONV_XL_A1:
-case FormulaGrammar::CONV_XL_R1C1:
 case FormulaGrammar::CONV_XL_OOX:
-if (rName[0] == '\'' && IsDoubleReference( rName))
+// Special treatment for the 'E:\[doc]Sheet1:Sheet3'!D5 Excel
+// sickness, mnRangeOpPosInSymbol did not catch the range
+// operator as it is within a quoted name.
+if (rName[0] != '\'')
+return false;   // Document name has to be single quoted.
+// fallthru
+case FormulaGrammar::CONV_XL_R1C1:
+// C2 or C[1] are valid entire column references.
+if (IsDoubleReference( rName))
 return true;
 break;
 default:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-04-12 Thread Markus Mohrhard
 sc/source/filter/inc/stylesbuffer.hxx |2 +-
 sc/source/filter/oox/stylesbuffer.cxx |   19 +++
 2 files changed, 4 insertions(+), 17 deletions(-)

New commits:
commit 3ced9d208d3eb8fefa4e5b3e06e2c3884eef591a
Author: Markus Mohrhard 
Date:   Sat Apr 9 09:36:45 2016 +0200

import all formatting properties for column style, tdf#96549

Change-Id: I782f3ea7cfa9af335bd117b9f4ad6ac9c719115b
Reviewed-on: https://gerrit.libreoffice.org/23932
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit e8322dffb4dfc7015ee0842f133b79080eb2b0d8)
Reviewed-on: https://gerrit.libreoffice.org/23943
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/source/filter/inc/stylesbuffer.hxx 
b/sc/source/filter/inc/stylesbuffer.hxx
index b140079..f8fc2fd 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -659,7 +659,7 @@ public:
 /** Writes all formatting attributes to the passed property set. */
 voidwriteToPropertySet( PropertySet& rPropSet ) const;
 
-void writeToDoc( ScDocumentImport& rDoc, const 
css::table::CellRangeAddress& rRange ) const;
+void writeToDoc( ScDocumentImport& rDoc, const 
css::table::CellRangeAddress& rRange );
 
 const ::ScPatternAttr& createPattern( bool bSkipPoolDefs = false );
 
diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index ce909ad..48fc501 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2252,7 +2252,7 @@ void Xf::writeToPropertySet( PropertySet& rPropSet ) const
 rPropSet.setProperties( aPropMap );
 }
 
-void Xf::writeToDoc( ScDocumentImport& rDoc, const table::CellRangeAddress& 
rRange ) const
+void Xf::writeToDoc( ScDocumentImport& rDoc, const table::CellRangeAddress& 
rRange )
 {
 const StylesBuffer& rStyles = getStyles();
 
@@ -2273,22 +2273,9 @@ void Xf::writeToDoc( ScDocumentImport& rDoc, const 
table::CellRangeAddress& rRan
 }
 }
 
-std::unique_ptr pAttr(new 
ScPatternAttr(rDoc.getDoc().GetPool()));
-
-{
-SvxRotateMode eRotateMode = SVX_ROTATE_MODE_STANDARD;
-
-if (maModel.mbBorderUsed && rStyles.hasBorder(maModel.mnBorderId) && 
maAlignment.getApiData().mnRotation)
-eRotateMode = SVX_ROTATE_MODE_BOTTOM;
-
-SvxRotateModeItem aItem(eRotateMode, ATTR_ROTATE_MODE);
-ScfTools::PutItem(pAttr->GetItemSet(), aItem, false);
-}
-
-// TODO : Move more properties from writeToPropertyMap().
-
+const ScPatternAttr& rAttr = createPattern();
 rDoc.getDoc().ApplyPatternAreaTab(
-rRange.StartColumn, rRange.StartRow, rRange.EndColumn, rRange.EndRow, 
rRange.Sheet, *pAttr);
+rRange.StartColumn, rRange.StartRow, rRange.EndColumn, rRange.EndRow, 
rRange.Sheet, rAttr);
 }
 
 const ::ScPatternAttr&
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-04-12 Thread Bjoern Michaelsen
 sc/source/ui/dbgui/csvcontrol.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 62fdce393276a8f5ad86a41dc49719c61581ce63
Author: Bjoern Michaelsen 
Date:   Tue Apr 12 12:20:07 2016 +0200

lp#1566050: prevent cyclic reference zombies

regression, likely from 2660d24a07866e083c5135ea263030f3e3a2e729:

1/ Since that change mxAccessible in ScCsvGrid holds a rtl::Reference on
a ScAccessibleCsvGrid
2/ Which in turn holds a VclPtr<> (aka a rtl::Reference with lipstick)
on the ScCsvControl

These are a circular references, making both of them live forever and
leak past the point where on LibreOffice close all of Vcl is long gone,
when these are dtored. Clearing mxAccessible on disposing should help.

Change-Id: Iebb2635ec4ea143e7f0dbfebad2e6141a68e72e8
Reviewed-on: https://gerrit.libreoffice.org/24021
Reviewed-by: Björn Michaelsen 
Tested-by: Björn Michaelsen 

diff --git a/sc/source/ui/dbgui/csvcontrol.cxx 
b/sc/source/ui/dbgui/csvcontrol.cxx
index 2fb1030..51ed04c 100644
--- a/sc/source/ui/dbgui/csvcontrol.cxx
+++ b/sc/source/ui/dbgui/csvcontrol.cxx
@@ -81,6 +81,7 @@ void ScCsvControl::dispose()
 {
 if( mxAccessible.is() )
 mxAccessible->dispose();
+mxAccessible = nullptr; // lp#1566050: prevent cyclic reference zombies
 Control::dispose();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-04-07 Thread Eike Rathke
 sc/source/core/data/document.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 24635317f09ecf48e5d800147b6a2b95963b69a7
Author: Eike Rathke 
Date:   Wed Apr 6 14:38:54 2016 +0100

(re)broadcast, same as in ScDocument::SetString(), tdf#97897 related

As with ce28d83912d14bc81c455af64893842de78a8c8d

Change-Id: I7cd30509138368d73b43c82d71d520d55417d416
(cherry picked from commit b6ba851c02570c17e0484c94065a2e72c5675e58)
Reviewed-on: https://gerrit.libreoffice.org/23871
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 074f5b7..0a31419 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3376,6 +3376,11 @@ void ScDocument::SetValue( const ScAddress& rPos, double 
fVal )
 
 SetNeedsListeningGroups(aGroupPos);
 StartNeededListeners();
+
+// Listeners may just have been setup that are affected by the current
+// position thus were not notified by a ScColumn::BroadcastNewCell()
+// during ScTable::SetValue(), so do it here.
+Broadcast( ScHint( SC_HINT_DATACHANGED, rPos));
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-03-31 Thread Markus Mohrhard
 sc/source/core/data/patattr.cxx |   54 +++-
 1 file changed, 42 insertions(+), 12 deletions(-)

New commits:
commit c1f94a5ea387551e9140cf43d4ed7ca5dcae8298
Author: Markus Mohrhard 
Date:   Wed Feb 3 20:28:40 2016 +0100

tdf#93300, handle hard formatting with cond format correct

For number formats we always applied the conditional format above the
hard formatting.

Now we handle styles, conditional formatting and hard formatting
correctly.

Reviewed-on: https://gerrit.libreoffice.org/22574
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit 2c728b0ae7f52691b1a3d5ab555225f5e8ac95a5)

 Conflicts:
sc/source/core/data/patattr.cxx

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

diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index ea53285..fe70300 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -1293,12 +1293,24 @@ bool ScPatternAttr::IsSymbolFont() const
 return false;
 }
 
+namespace {
+
+sal_uInt32 getNumberFormatKey(const SfxItemSet& rSet)
+{
+return static_cast(rSet.Get(ATTR_VALUE_FORMAT)).GetValue();
+}
+
+LanguageType getLanguageType(const SfxItemSet& rSet)
+{
+return static_cast(rSet.Get(ATTR_LANGUAGE_FORMAT)).GetLanguage();
+}
+
+}
+
 sal_uLong ScPatternAttr::GetNumberFormat( SvNumberFormatter* pFormatter ) const
 {
-sal_uLong nFormat =
-static_cast(().Get( ATTR_VALUE_FORMAT 
))->GetValue();
-LanguageType eLang =
-static_cast(().Get( 
ATTR_LANGUAGE_FORMAT ))->GetLanguage();
+sal_uLong nFormat = getNumberFormatKey(GetItemSet());
+LanguageType eLang = getLanguageType(GetItemSet());
 if ( nFormat < SV_COUNTRY_LANGUAGE_OFFSET && eLang == LANGUAGE_SYSTEM )
 ;   // it remains as it is
 else if ( pFormatter )
@@ -1311,19 +1323,37 @@ sal_uLong ScPatternAttr::GetNumberFormat( 
SvNumberFormatter* pFormatter ) const
 sal_uLong ScPatternAttr::GetNumberFormat( SvNumberFormatter* pFormatter,
 const SfxItemSet* pCondSet ) const
 {
-OSL_ENSURE(pFormatter,"GetNumberFormat without Formatter");
+assert(pFormatter);
+if (!pCondSet)
+return GetNumberFormat(pFormatter);
+
+/* In the case of a conditional format we need to overwrite a cell style
+ * but leave a hard cell formatting alone. So check first if the number
+ * format is set in the cell format, then the conditional format and
+ * finally in the style.
+ *
+ * The style is represented here if the name is empty.
+ */
 
 const SfxPoolItem* pFormItem;
-if ( !pCondSet || 
pCondSet->GetItemState(ATTR_VALUE_FORMAT,true,) != SfxItemState::SET )
-pFormItem = ().Get(ATTR_VALUE_FORMAT);
+sal_uLong nFormat = 0;
+if (GetItemSet().GetItemState(ATTR_VALUE_FORMAT, false, ) == 
SfxItemState::SET)
+nFormat = static_cast(pFormItem)->GetValue();
+else if (pCondSet->GetItemState(ATTR_VALUE_FORMAT, true, ) == 
SfxItemState::SET )
+nFormat = getNumberFormatKey(*pCondSet);
+else
+nFormat = getNumberFormatKey(GetItemSet());
 
 const SfxPoolItem* pLangItem;
-if ( !pCondSet || 
pCondSet->GetItemState(ATTR_LANGUAGE_FORMAT,true,) != 
SfxItemState::SET )
-pLangItem = ().Get(ATTR_LANGUAGE_FORMAT);
+LanguageType eLang;
+if (GetItemSet().GetItemState(ATTR_LANGUAGE_FORMAT, false, ) == 
SfxItemState::SET)
+eLang = static_cast(pLangItem)->GetLanguage();
+else if (pCondSet->GetItemState(ATTR_LANGUAGE_FORMAT, true, ) == 
SfxItemState::SET)
+eLang = getLanguageType(*pCondSet);
+else
+eLang = getLanguageType(GetItemSet());
 
-return pFormatter->GetFormatForLanguageIfBuiltIn(
-static_cast(pFormItem)->GetValue(),
-static_cast(pLangItem)->GetLanguage() );
+return pFormatter->GetFormatForLanguageIfBuiltIn(nFormat, eLang);
 }
 
 const SfxPoolItem& ScPatternAttr::GetItem( sal_uInt16 nWhich, const 
SfxItemSet& rItemSet, const SfxItemSet* pCondSet )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-03-31 Thread Arul Michael
 sc/source/core/data/column2.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 7a9a28857a4da8d2353c88ce90d8a60030d89e48
Author: Arul Michael 
Date:   Thu Mar 31 17:17:58 2016 +0530

tdf#92963 Pasting a whole row with data crashes all open LibO apps

 In ScColumn::GetNeededSize the memory pointed by rOptions.pPattern is 
freed and
new value is set again in ScFormulaCell::InterpretTail function in 
pDocument->SetNumberFormat
when pDocument->GetCondResult is called in column2.cxx:130.For fix setting 
the newly calculated
ScPatternAttr* value after the GetCondResult call.

Change-Id: I045404465b6dfa561b0821bb3b1875463aa7887a
Reviewed-on: https://gerrit.libreoffice.org/23688
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit 99bf0b931401f556033f67297aa9783c4cf19b00)
Reviewed-on: https://gerrit.libreoffice.org/23708

diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 01dde57..8c15aae 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -129,6 +129,13 @@ long ScColumn::GetNeededSize(
 //  conditional formatting
 const SfxItemSet* pCondSet = pDocument->GetCondResult( nCol, nRow, nTab );
 
+//The pPattern may change in GetCondResult
+if (aCell.meType == CELLTYPE_FORMULA)
+{
+pPattern = pAttrArray->GetPattern( nRow );
+if (ppPatternChange)
+*ppPatternChange = pPattern;
+}
 //  line break?
 
 const SfxPoolItem* pCondItem;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-03-29 Thread Markus Mohrhard
 sc/source/filter/excel/tokstack.cxx |   19 ++-
 sc/source/filter/inc/tokstack.hxx   |5 +++--
 2 files changed, 17 insertions(+), 7 deletions(-)

New commits:
commit dc609320c7594d8c9378c3c06b94935b2572fbdb
Author: Markus Mohrhard 
Date:   Sun Mar 13 19:15:16 2016 +0100

fix memory leak in array xls import

The ScMatrix instances are leaked because there is no DecRef called on
them when we Reset the TokenPool.

Reviewed-on: https://gerrit.libreoffice.org/23194
Reviewed-by: Kohei Yoshida 
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

Conflicts:
sc/source/filter/inc/tokstack.hxx

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

diff --git a/sc/source/filter/excel/tokstack.cxx 
b/sc/source/filter/excel/tokstack.cxx
index 1a8a399..b52b5ba 100644
--- a/sc/source/filter/excel/tokstack.cxx
+++ b/sc/source/filter/excel/tokstack.cxx
@@ -126,11 +126,7 @@ TokenPool::~TokenPool()
 delete ppP_Nlf[ n ];
 delete[] ppP_Nlf;
 
-for( n = 0 ; n < nP_Matrix ; n++ )
-{
-if( ppP_Matrix[ n ] )
-ppP_Matrix[ n ]->DecRef( );
-}
+ClearMatrix();
 delete[] ppP_Matrix;
 
 delete pScToken;
@@ -881,6 +877,7 @@ void TokenPool::Reset()
 maExtNames.clear();
 maExtCellRefs.clear();
 maExtAreaRefs.clear();
+ClearMatrix();
 }
 
 bool TokenPool::IsSingleOp( const TokenId& rId, const DefTokenId eId ) const
@@ -936,4 +933,16 @@ ScMatrix* TokenPool::GetMatrix( unsigned int n ) const
 return nullptr;
 }
 
+void TokenPool::ClearMatrix()
+{
+for(sal_uInt16 n = 0 ; n < nP_Matrix ; n++ )
+{
+if( ppP_Matrix[ n ] )
+{
+ppP_Matrix[ n ]->DecRef( );
+ppP_Matrix[n] = nullptr;
+}
+}
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/inc/tokstack.hxx 
b/sc/source/filter/inc/tokstack.hxx
index b103179..5b91bfb 100644
--- a/sc/source/filter/inc/tokstack.hxx
+++ b/sc/source/filter/inc/tokstack.hxx
@@ -187,8 +187,9 @@ private:
 boolGrowExt();
 boolGrowNlf();
 boolGrowMatrix();
-   boolGetElement( 
const sal_uInt16 nId );
-   boolGetElementRek( 
const sal_uInt16 nId );
+boolGetElement( const sal_uInt16 nId );
+boolGetElementRek( const sal_uInt16 nId );
+voidClearMatrix();
 public:
 TokenPool( svl::SharedStringPool& rSPool );
 ~TokenPool();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-03-24 Thread Markus Mohrhard
 sc/source/filter/excel/xilink.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit cb47752029f0a2b84ed9020a24eb65e11cd32a63
Author: Markus Mohrhard 
Date:   Thu Mar 24 12:42:52 2016 +0100

don't sanitize value to an insane value, tdf#97863

Change-Id: I0e4de6b676fb61536dadefc96a719cf50be128ed
Reviewed-on: https://gerrit.libreoffice.org/23486
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sc/source/filter/excel/xilink.cxx 
b/sc/source/filter/excel/xilink.cxx
index 7b7ec4b..ab9dca3 100644
--- a/sc/source/filter/excel/xilink.cxx
+++ b/sc/source/filter/excel/xilink.cxx
@@ -282,7 +282,10 @@ XclImpExtName::MOper::MOper(svl::SharedStringPool& rPool, 
XclImpStream& rStrm) :
 {
 SAL_WARN("sc", "Parsing error: " << nMaxRows <<
  " max possible rows, but " << nLastRow << " index claimed, 
truncating");
-nLastRow = nMaxRows-1;
+if (nMaxRows > 0)
+nLastRow = nMaxRows-1;
+else
+return;
 }
 
 mxCached->Resize(nLastCol+1, nLastRow+1);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-03-24 Thread Eike Rathke
 sc/source/core/data/formulacell.cxx |   47 +++-
 1 file changed, 46 insertions(+), 1 deletion(-)

New commits:
commit a5867a0d676981c27b36a4def9b423fabf6862e8
Author: Eike Rathke 
Date:   Tue Mar 22 17:16:07 2016 +0100

Resolves: tdf#98642 comparing RPN insufficient in shared formula detection

(cherry picked from commit d6b32653ad34f0879ad1ada421a3a2655dd766e1)

Backported.

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

diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index d9f48e1..eb24423 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3885,7 +3885,7 @@ ScFormulaCell::CompareState 
ScFormulaCell::CompareByTokenArray( ScFormulaCell& r
 break;
 case formula::svIndex:
 {
-if(pThisTok->GetIndex() != pOtherTok->GetIndex())
+if(pThisTok->GetIndex() != pOtherTok->GetIndex() || 
pThisTok->IsGlobal() != pOtherTok->IsGlobal())
 return NotEqual;
 }
 break;
@@ -3909,6 +3909,51 @@ ScFormulaCell::CompareState 
ScFormulaCell::CompareByTokenArray( ScFormulaCell& r
 }
 }
 
+// If still the same, check lexical names as different names may result in
+// identical RPN code.
+
+pThis = pCode->GetArray();
+nThisLen = pCode->GetLen();
+pOther = rOther.pCode->GetArray();
+nOtherLen = rOther.pCode->GetLen();
+
+if ( !pThis || !pOther )
+{
+// Error: no code for cells !"
+return NotEqual;
+}
+
+if ( nThisLen != nOtherLen )
+return NotEqual;
+
+for ( sal_uInt16 i = 0; i < nThisLen; i++ )
+{
+formula::FormulaToken *pThisTok = pThis[i];
+formula::FormulaToken *pOtherTok = pOther[i];
+
+if ( pThisTok->GetType() != pOtherTok->GetType() ||
+ pThisTok->GetOpCode() != pOtherTok->GetOpCode() ||
+ pThisTok->GetParamCount() != pOtherTok->GetParamCount() )
+{
+// Incompatible type, op-code or param counts.
+return NotEqual;
+}
+
+switch (pThisTok->GetType())
+{
+// All index tokens are names. Different categories already had
+// different OpCode values.
+case formula::svIndex:
+{
+if (pThisTok->GetIndex() != pOtherTok->GetIndex() || 
pThisTok->IsGlobal() != pOtherTok->IsGlobal())
+return NotEqual;
+}
+break;
+default:
+;
+}
+}
+
 return bInvariant ? EqualInvariant : EqualRelativeRef;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-03-23 Thread Eike Rathke
 sc/source/core/data/formulacell.cxx |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit c2728179ddd42793319988cc3e6014ee1971c1cf
Author: Eike Rathke 
Date:   Wed Mar 23 14:26:55 2016 +0100

add a recursion guard to lcl_FindRangeNamesInUse()

Change-Id: Ifbc02304f5a2e080db2d6645e2c7f825a2c56cb5
Reviewed-on: https://gerrit.libreoffice.org/23472
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 

diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index 8ab094c..d9f48e1 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3678,7 +3678,8 @@ void ScFormulaCell::UpdateGrow( const ScRange& rArea, 
SCCOL nGrowX, SCROW nGrowY
 StartListeningTo( pDocument ); // Listener as previous
 }
 
-static void lcl_FindRangeNamesInUse(std::set& rIndexes, 
ScTokenArray* pCode, ScRangeName* pNames)
+static void lcl_FindRangeNamesInUse(std::set& rIndexes, 
ScTokenArray* pCode, ScRangeName* pNames,
+int nRecursion)
 {
 for (FormulaToken* p = pCode->First(); p; p = pCode->Next())
 {
@@ -3687,16 +3688,19 @@ static void 
lcl_FindRangeNamesInUse(std::set& rIndexes, ScTokenArray
 sal_uInt16 nTokenIndex = p->GetIndex();
 rIndexes.insert( nTokenIndex );
 
-ScRangeData* pSubName = pNames->findByIndex(p->GetIndex());
-if (pSubName)
-lcl_FindRangeNamesInUse(rIndexes, pSubName->GetCode(), pNames);
+if (nRecursion < 126)   // whatever.. 42*3
+{
+ScRangeData* pSubName = pNames->findByIndex(p->GetIndex());
+if (pSubName)
+lcl_FindRangeNamesInUse(rIndexes, pSubName->GetCode(), 
pNames, nRecursion+1);
+}
 }
 }
 }
 
 void ScFormulaCell::FindRangeNamesInUse(std::set& rIndexes) const
 {
-lcl_FindRangeNamesInUse( rIndexes, pCode, pDocument->GetRangeName() );
+lcl_FindRangeNamesInUse( rIndexes, pCode, pDocument->GetRangeName(), 0);
 }
 
 void ScFormulaCell::SetChanged(bool b)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-03-21 Thread Eike Rathke
 sc/source/core/tool/rangenam.cxx |4 
 sc/source/core/tool/token.cxx|4 
 2 files changed, 8 insertions(+)

New commits:
commit 5e655ecfe007238080941077c6dc6187005e91fa
Author: Eike Rathke 
Date:   Mon Mar 21 18:50:00 2016 +0100

Resolves: tdf#93127 copying cells does not modify named expressions

Change-Id: Ic3d0b0a709ecfeade4b3a9c4be9e0c9cfd766103
(cherry picked from commit 7d267d3b168ba3b13763733e8c319a79d990773a)
Reviewed-on: https://gerrit.libreoffice.org/23409
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index a1e25ee..dd2db2b 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -729,6 +729,10 @@ ScRangeData* ScRangeName::findByIndex(sal_uInt16 i) const
 
 void ScRangeName::UpdateReference(sc::RefUpdateContext& rCxt, SCTAB nLocalTab )
 {
+if (rCxt.meMode == URM_COPY)
+// Copying cells does not modify named expressions.
+return;
+
 for (auto const& itr : m_Data)
 {
 itr.second->UpdateReference(rCxt, nLocalTab);
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 5c71a56..29e629b 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3474,6 +3474,10 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceInName(
 
 sc::RefUpdateResult aRes;
 
+if (rCxt.meMode == URM_COPY)
+// Copying cells does not modify named expressions.
+return aRes;
+
 TokenPointers aPtrs( pCode, nLen, pRPN, nRPN);
 for (size_t j=0; j<2; ++j)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-03-19 Thread Eike Rathke
 sc/source/core/data/formulacell.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 00b05b936b85e0db52f0cd616bda02224c64768b
Author: Eike Rathke 
Date:   Wed Mar 16 23:03:58 2016 +0100

ensure a correct index is assigned to a duplicated ScRangeData instance

ScRangeName::insert() assigns an index only if the passed ScRangeData
instance's index was 0. Duplicating an ScRangeData object duplicates
also the index, so effectively two instances with the same index could
be inserted to the named expressions collection, a following
ScRangeName::findByIndex() retrieved one of them by chance.

Change-Id: Ic141ffb1a683bda5907f4359167da84faf1649e1
(cherry picked from commit 336d816176650726f6d14539464d9fd28ddd032d)
Reviewed-on: https://gerrit.libreoffice.org/23323
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index 5fb2c7a..8ab094c 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -466,6 +466,7 @@ void adjustRangeName(formula::FormulaToken* pToken, 
ScDocument& rNewDoc, const S
 {
 bNewGlobal = bOldGlobal;
 pRangeData = new ScRangeData(*pOldRangeData, );
+pRangeData->SetIndex(0);// needed for insert to assign a new index
 ScTokenArray* pRangeNameToken = pRangeData->GetCode();
 if (rNewDoc.GetPool() != const_cast(pOldDoc)->GetPool())
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-03-15 Thread Eike Rathke
 sc/source/core/data/formulacell.cxx |   48 +---
 1 file changed, 29 insertions(+), 19 deletions(-)

New commits:
commit c56e92e4ed1f11de5c89b4a5eda6f91de3053941
Author: Eike Rathke 
Date:   Tue Mar 15 17:39:03 2016 +0100

Resolves: tdf#93196 add RecursionCounter guard also to 
InterpretFormulaGroup()

... same as for ScFormulaCell::InterpretTail()

Change-Id: I444f259fe4e86ed0638a04f1b5d9272edd182e2e
(cherry picked from commit 29ee431c1cf859c3d5a5041cff5cb04b89db27a0)
Reviewed-on: https://gerrit.libreoffice.org/23279
Tested-by: Jenkins 
Reviewed-by: David Tardon 

diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index 8b4a727..5fb2c7a 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1499,6 +1499,28 @@ bool ScFormulaCell::MarkUsedExternalReferences()
 return pCode && pDocument->MarkUsedExternalReferences(*pCode, aPos);
 }
 
+namespace {
+class RecursionCounter
+{
+ScRecursionHelper&  rRec;
+boolbStackedInIteration;
+public:
+RecursionCounter( ScRecursionHelper& r, ScFormulaCell* p ) : rRec(r)
+{
+bStackedInIteration = rRec.IsDoingIteration();
+if (bStackedInIteration)
+rRec.GetRecursionInIterationStack().push( p);
+rRec.IncRecursionCount();
+}
+~RecursionCounter()
+{
+rRec.DecRecursionCount();
+if (bStackedInIteration)
+rRec.GetRecursionInIterationStack().pop();
+}
+};
+}
+
 void ScFormulaCell::Interpret()
 {
 #if DEBUG_CALCULATION
@@ -1769,25 +1791,7 @@ void ScFormulaCell::Interpret()
 
 void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
 {
-class RecursionCounter
-{
-ScRecursionHelper&  rRec;
-boolbStackedInIteration;
-public:
-RecursionCounter( ScRecursionHelper& r, ScFormulaCell* p ) : rRec(r)
-{
-bStackedInIteration = rRec.IsDoingIteration();
-if (bStackedInIteration)
-rRec.GetRecursionInIterationStack().push( p);
-rRec.IncRecursionCount();
-}
-~RecursionCounter()
-{
-rRec.DecRecursionCount();
-if (bStackedInIteration)
-rRec.GetRecursionInIterationStack().pop();
-}
-} aRecursionCounter( pDocument->GetRecursionHelper(), this);
+RecursionCounter aRecursionCounter( pDocument->GetRecursionHelper(), this);
 nSeenInIteration = pDocument->GetRecursionHelper().GetIteration();
 if( !pCode->GetCodeLen() && !pCode->GetCodeError() )
 {
@@ -3969,6 +3973,12 @@ bool ScFormulaCell::InterpretFormulaGroup()
 if (!ScCalcConfig::isOpenCLEnabled() && 
!ScCalcConfig::isSwInterpreterEnabled())
 return false;
 
+// Guard against endless recursion of Interpret() calls, for this to work
+// ScFormulaCell::InterpretFormulaGroup() must never be called through
+// anything else than ScFormulaCell::Interpret(), same as
+// ScFormulaCell::InterpretTail()
+RecursionCounter aRecursionCounter( pDocument->GetRecursionHelper(), this);
+
 // TODO : Disable invariant formula group interpretation for now in order
 // to get implicit intersection to work.
 if (mxGroup->mbInvariant && false)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-03-09 Thread Eike Rathke
 sc/source/core/tool/interpr4.cxx |   14 ++
 1 file changed, 14 insertions(+)

New commits:
commit ac4560a37dacfa4fee60e36d1b3de7790b81dc20
Author: Eike Rathke 
Date:   Wed Mar 9 16:18:55 2016 +0100

Resolves: tdf#95226 second case, stack error count in JumpMatrix context

For the early bail out on errors to work correctly and not prematurely
end calculations the current error function needs to be stacked in
JumpMatrix context, otherwise we may end up with
((nErrorFunction=74)>=(nErrorFunctionCount=2)) or some such..

Change-Id: I3559e15180694961585db92f6aa98a46430ae372
(cherry picked from commit 62b40429946c0e5021912072dc79a60fc11fce06)
Reviewed-on: https://gerrit.libreoffice.org/23089
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index cc0b4bc..011d9c9 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -74,6 +74,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 using namespace formula;
@@ -3557,6 +3558,7 @@ StackVar ScInterpreter::Interpret()
 sal_uLong nRetIndexExpr = 0;
 sal_uInt16 nErrorFunction = 0;
 sal_uInt16 nErrorFunctionCount = 0;
+std::stack aErrorFunctionStack;
 sal_uInt16 nStackBase;
 
 nGlobalError = 0;
@@ -4089,7 +4091,19 @@ StackVar ScInterpreter::Interpret()
 else
 nLevel = 0;
 if ( nLevel == 1 || (nLevel == 2 && aCode.IsEndOfPath()) )
+{
+if (nLevel == 1)
+aErrorFunctionStack.push( nErrorFunction);
 bGotResult = JumpMatrix( nLevel );
+if (aErrorFunctionStack.empty())
+assert(!"ScInterpreter::Interpret - aErrorFunctionStack 
empty in JumpMatrix context");
+else
+{
+nErrorFunction = aErrorFunctionStack.top();
+if (bGotResult)
+aErrorFunctionStack.pop();
+}
+}
 else
 pJumpMatrix = nullptr;
 } while ( bGotResult );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-03-03 Thread Arul Michael
 sc/source/core/data/table3.cxx |   17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

New commits:
commit a6e7673aec0321ceb328de902d5ee0689df3abf7
Author: Arul Michael 
Date:   Mon Feb 22 09:53:31 2016 +0530

tdf#97215 Sorting with update reference causes crash

The memory of SvtBroadcaster* of a cell is freed in EndlisteningCell()
during SplitFormulaGroups call. The same memory address is assigned back
to the cell again when the contents are transferred back after sorting.
This is because the CreateSortinfoArray is done before
SplitformulaGroup. For fix getting mpbroadcaster from the Document
instead of SortinfoArray since we change the broadcaster in document
after creating the SortInfoArray.

Change-Id: Ic492d5019e26ff204307db4fefccc48ec99c0a6d
Reviewed-on: https://gerrit.libreoffice.org/22607
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit fca1147953989ef26e641e2ee9bb7e6390a69dd6)
Reviewed-on: https://gerrit.libreoffice.org/22877

diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index ee76080..2671fde 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -231,11 +231,10 @@ public:
 {
 ScRefCellValue maCell;
 const sc::CellTextAttr* mpAttr;
-const SvtBroadcaster* mpBroadcaster;
 const ScPostIt* mpNote;
 const ScPatternAttr* mpPattern;
 
-Cell() : mpAttr(nullptr), mpBroadcaster(nullptr), mpNote(nullptr), 
mpPattern(nullptr) {}
+Cell() : mpAttr(nullptr), mpNote(nullptr), mpPattern(nullptr) {}
 };
 
 struct Row
@@ -438,10 +437,8 @@ void initDataRows(
 {
 ScSortInfoArray::Row& rRow = *rRows[nRow-nRow1];
 ScSortInfoArray::Cell& rCell = rRow.maCells[nCol-nCol1];
-
 rCell.maCell = rCol.GetCellValue(aBlockPos, nRow);
 rCell.mpAttr = rCol.GetCellTextAttr(aBlockPos, nRow);
-rCell.mpBroadcaster = rCol.GetBroadcaster(aBlockPos, nRow);
 rCell.mpNote = rCol.GetCellNote(aBlockPos, nRow);
 
 if (!bUniformPattern && bPattern)
@@ -709,10 +706,11 @@ void fillSortedColumnArray(
 std::vector& rSortedCols,
 SortedRowFlags& rRowFlags,
 std::vector& rCellListeners,
-ScSortInfoArray* pArray, SCTAB nTab, SCCOL nCol1, SCCOL nCol2, ScProgress* 
pProgress )
+ScSortInfoArray* pArray, SCTAB nTab, SCCOL nCol1, SCCOL nCol2, ScProgress* 
pProgress, const ScTable* pTable )
 {
 SCROW nRow1 = pArray->GetStart();
 ScSortInfoArray::RowsType* pRows = pArray->GetDataRows();
+std::vector aOrderIndices = pArray->GetOrderIndices();
 
 size_t nColCount = nCol2 - nCol1 + 1;
 std::vector aSortedCols; // storage for 
copied cells.
@@ -795,10 +793,11 @@ void fillSortedColumnArray(
 // At this point each broadcaster instance is managed by 2
 // containers. We will release those in the original storage
 // below before transferring them to the document.
+const SvtBroadcaster* pBroadcaster = pTable->GetBroadcaster( 
nCol1 + j, aOrderIndices[i]);
 sc::BroadcasterStoreType& rBCStore = 
aSortedCols.at(j).get()->maBroadcasters;
-if (rCell.mpBroadcaster)
+if (pBroadcaster)
 // A const pointer would be implicitly converted to a bool 
type.
-
rBCStore.push_back(const_cast(rCell.mpBroadcaster));
+
rBCStore.push_back(const_cast(pBroadcaster));
 else
 rBCStore.push_back_empty();
 }
@@ -1091,7 +1090,7 @@ void ScTable::SortReorderByRow(
 // a copy before updating the document.
 std::vector aSortedCols; // storage for 
copied cells.
 SortedRowFlags aRowFlags;
-fillSortedColumnArray(aSortedCols, aRowFlags, aCellListeners, pArray, 
nTab, nCol1, nCol2, pProgress);
+fillSortedColumnArray(aSortedCols, aRowFlags, aCellListeners, pArray, 
nTab, nCol1, nCol2, pProgress, this);
 
 for (size_t i = 0, n = aSortedCols.size(); i < n; ++i)
 {
@@ -1277,7 +1276,7 @@ void ScTable::SortReorderByRowRefUpdate(
 std::vector aSortedCols; // storage for 
copied cells.
 SortedRowFlags aRowFlags;
 std::vector aListenersDummy;
-fillSortedColumnArray(aSortedCols, aRowFlags, aListenersDummy, pArray, 
nTab, nCol1, nCol2, pProgress);
+fillSortedColumnArray(aSortedCols, aRowFlags, aListenersDummy, pArray, 
nTab, nCol1, nCol2, pProgress, this);
 
 for (size_t i = 0, n = aSortedCols.size(); i < n; ++i)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org

[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-03-01 Thread Eike Rathke
 sc/source/core/data/document.cxx |   18 ++
 1 file changed, 18 insertions(+)

New commits:
commit 0a5d00507d08179d2511de0b5152e17a238f4a2d
Author: Eike Rathke 
Date:   Mon Feb 29 17:54:50 2016 +0100

fix the "group not recalculated after delete" second part of tdf#97897

If a formula cell group was split during deletion and the group also
listened into the range where a cell was deleted, the group wasn't
notified of the deletion.

Change-Id: I858f5d4c0b647636611133fc32f3df7fbdaf7288
(cherry picked from commit 164419bfe6270015ccf94183c0b6273da7730391)
Reviewed-on: https://gerrit.libreoffice.org/22783
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 5225443..074f5b7 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -1817,6 +1817,24 @@ void ScDocument::DeleteArea(
 // Re-start listeners on those top bottom groups that have been split.
 SetNeedsListeningGroups(aGroupPos);
 StartNeededListeners();
+
+// If formula groups were split their listeners were destroyed and may
+// need to be notified now that they're restored, ScTable::DeleteArea()
+// couldn't do that.
+if (!aGroupPos.empty())
+{
+ScRange aRange(nCol1, nRow1, 0, nCol2, nRow2, 0);
+for (SCTAB i = 0; i < static_cast(maTabs.size()); i++)
+{
+if (rMark.GetTableSelect(i))
+{
+aRange.aStart.SetTab(i);
+aRange.aEnd.SetTab(i);
+
+SetDirty( aRange, true);
+}
+}
+}
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-03-01 Thread Marco Cecchetti
 sc/source/core/inc/arraysumfunctor.hxx |7 +--
 sc/source/core/tool/scmatrix.cxx   |2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 9b7f72203f2b9f6b95d927c695f7f48b86b251ee
Author: Marco Cecchetti 
Date:   Mon Feb 29 22:18:23 2016 +0100

tdf#97369/#97587 - Further fix SUMming in the software interpreter

When SUMming in the software interpreter involved trailing empty
cells, code tried to read beyond numeric array limit.

Change-Id: I50c1148e7e79d02bedb02a771df172035112915c

diff --git a/sc/source/core/inc/arraysumfunctor.hxx 
b/sc/source/core/inc/arraysumfunctor.hxx
index 3955fd9..d94bf74 100644
--- a/sc/source/core/inc/arraysumfunctor.hxx
+++ b/sc/source/core/inc/arraysumfunctor.hxx
@@ -51,12 +51,15 @@ public:
 
 if (hasSSE2)
 {
-while (!isAligned(pCurrent))
+while ( i < mnSize && !isAligned(pCurrent))
 {
 fSum += *pCurrent++;
 i++;
 }
-fSum += executeSSE2(i, pCurrent);
+if( i < mnSize )
+{
+fSum += executeSSE2(i, pCurrent);
+}
 }
 else
 fSum += executeUnrolled(i, pCurrent);
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 6018ca1..e2dde4e 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -3401,7 +3401,7 @@ ScMatrix::IterateResult ScVectorRefMatrix::Sum(bool 
bTextAsZero) const
 {
 return ScMatrix::IterateResult(0.0, 0.0, 0);
 }
-else if (nDataSize > mpToken->GetArrayLength() + mnRowStart)
+else if (nDataSize > mpToken->GetArrayLength() - mnRowStart)
 {
 nDataSize = mpToken->GetArrayLength() - mnRowStart;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-02-29 Thread Katarina Behrens
 sc/source/ui/pagedlg/scuitphfedit.cxx |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 7eae3f0389503a39291d0d8dc746a2390588068e
Author: Katarina Behrens 
Date:   Sat Feb 27 16:51:50 2016 +0100

tdf#97963: Impose size limit on all 3 edit windows

Doing it for 1 window (tdf#90257) isn't enough, the dialog will grow
outta screen with large fonts not immediately, but on the next opening

Change-Id: I890ecd91a00efc4c7596b30a237f5abb4f87215a
Reviewed-on: https://gerrit.libreoffice.org/22739
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 
(cherry picked from commit 787e17d15a1cdb259b56f91bfda9af80b95167c3)
Reviewed-on: https://gerrit.libreoffice.org/22758
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/ui/pagedlg/scuitphfedit.cxx 
b/sc/source/ui/pagedlg/scuitphfedit.cxx
index be28c11..7e3840f 100644
--- a/sc/source/ui/pagedlg/scuitphfedit.cxx
+++ b/sc/source/ui/pagedlg/scuitphfedit.cxx
@@ -131,11 +131,15 @@ ScHFEditPage::ScHFEditPage( vcl::Window* 
pParent,
 m_pWndCenter->SetFont( aPatAttr );
 m_pWndRight->SetFont( aPatAttr );
 
-// Set size request of 1 widget, the other two will follow as they are
-// in the same grid
+// Set size request for all 3 widgets
 Size aSize = LogicToPixel(Size(80, 120), MAP_APPFONT);
-m_pWndLeft->set_width_request(aSize.Width());
-m_pWndLeft->set_height_request(aSize.Height());
+VclPtr aEditWindows[] = {m_pWndLeft, m_pWndCenter, 
m_pWndRight};
+
+for (auto  : aEditWindows)
+{
+pEditWindow->set_width_request(aSize.Width());
+pEditWindow->set_height_request(aSize.Height());
+}
 
 m_pWndLeft->SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) );
 m_pWndCenter->SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) 
);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-02-09 Thread Tor Lillqvist
 sc/source/core/tool/scmatrix.cxx |   11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit 8e0ed97101356ba537d0f85b2971bc22eabc633b
Author: Tor Lillqvist 
Date:   Fri Feb 5 15:01:48 2016 +0200

tdf#97369: Fix SUMming in the software interpreter

GetRefRowSize() is not what we want, but GetArrayLength(). I think. At
least helps in the sample document. (Need a hard recalc after loading
it, though, but I assume that is expected.)

Also, fix the handling of multiple columns in the area being summed.

Change-Id: I21477ca83042a40a300bc033e4a8b74ab5fc3015
Reviewed-on: https://gerrit.libreoffice.org/22153
Reviewed-by: Tor Lillqvist 
Tested-by: Tor Lillqvist 
Reviewed-on: https://gerrit.libreoffice.org/22200
Tested-by: Jenkins 
Reviewed-by: Jan Holesovsky 
Tested-by: Jan Holesovsky 

diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index d3816b5..6018ca1 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -3397,13 +3397,13 @@ ScMatrix::IterateResult ScVectorRefMatrix::Sum(bool 
bTextAsZero) const
 const std::vector& rArrays = mpToken->GetArrays();
 size_t nDataSize = mnRowSize;
 
-if (mnRowStart >= mpToken->GetRefRowSize())
+if (mnRowStart >= mpToken->GetArrayLength())
 {
 return ScMatrix::IterateResult(0.0, 0.0, 0);
 }
-else if (nDataSize > mpToken->GetRefRowSize() + mnRowStart)
+else if (nDataSize > mpToken->GetArrayLength() + mnRowStart)
 {
-nDataSize = mpToken->GetRefRowSize() - mnRowStart;
+nDataSize = mpToken->GetArrayLength() - mnRowStart;
 }
 
 double mfFirst = 0.0;
@@ -3434,11 +3434,10 @@ ScMatrix::IterateResult ScVectorRefMatrix::Sum(bool 
bTextAsZero) const
 }
 }
 p += i;
-nDataSize -= i;
-if (nDataSize == 0)
+if (i == nDataSize)
 continue;
 
-sc::ArraySumFunctor functor(p, nDataSize);
+sc::ArraySumFunctor functor(p, nDataSize-i);
 
 mfRest += functor();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-02-08 Thread Tor Lillqvist
 sc/source/core/inc/arraysumfunctor.hxx |   22 ++
 sc/source/core/tool/interpr6.cxx   |   10 ++
 2 files changed, 32 insertions(+)

New commits:
commit aa064e8209e57ac91f16305d38e657d12a42093f
Author: Tor Lillqvist 
Date:   Fri Feb 5 14:58:11 2016 +0200

tdf#97587: Treat plain NaNs as zero in the software interpreter for SUM

The NaNs that have been stored in the arrays by
ScColumn::FetchVectorRefArray() and other code correspond to empty
cells. For the purpose of SUM they should be treated as zero.

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

diff --git a/sc/source/core/inc/arraysumfunctor.hxx 
b/sc/source/core/inc/arraysumfunctor.hxx
index 200fdc6..3955fd9 100644
--- a/sc/source/core/inc/arraysumfunctor.hxx
+++ b/sc/source/core/inc/arraysumfunctor.hxx
@@ -12,6 +12,7 @@
 #define INCLUDED_SC_SOURCE_CORE_INC_ARRAYSUMFUNCTOR_HXX
 
 #include 
+#include 
 #include 
 
 #if defined(LO_SSE2_AVAILABLE)
@@ -65,6 +66,27 @@ public:
 for (; i < mnSize; ++i)
 fSum += mpArray[i];
 
+// If the sum is a NaN, some of the terms were empty cells, probably.
+// Re-calculate, carefully
+if (!rtl::math::isFinite(fSum))
+{
+sal_uInt32 nErr = reinterpret_cast< sal_math_Double * 
>()->nan_parts.fraction_lo;
+if (nErr & 0x)
+{
+fSum = 0;
+for (i = 0; i < mnSize; i++)
+{
+if (!rtl::math::isFinite(mpArray[i]))
+{
+nErr = reinterpret_cast< const sal_math_Double * 
>([i])->nan_parts.fraction_lo;
+if (!(nErr & 0x))
+fSum += mpArray[i]; // Let errors encoded as NaNs 
propagate ???
+}
+else
+fSum += mpArray[i];
+}
+}
+}
 return fSum;
 }
 
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index 5bf4533..e7e321b 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -412,6 +412,16 @@ void IterateMatrix(
 case ifSUM:
 {
 ScMatrix::IterateResult aRes = pMat->Sum(bTextAsZero);
+// If the first value is a NaN, it probably means it was an empty 
cell,
+// and should be treated as zero.
+if ( !rtl::math::isFinite(aRes.mfFirst) )
+{
+sal_uInt32 nErr = reinterpret_cast< sal_math_Double * 
>()->nan_parts.fraction_lo;
+if (nErr & 0x)
+{
+aRes.mfFirst = 0;
+}
+}
 if ( fMem )
 fRes += aRes.mfFirst + aRes.mfRest;
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-02-05 Thread Caolán McNamara
 sc/source/ui/app/inputwin.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 113f000d38c34dd4dda6903976f8febf6d95375c
Author: Caolán McNamara 
Date:   Fri Feb 5 14:03:44 2016 +

Resolves: tdf#97465 like scroll ignore wheel for sc input handler 
inputchanged

Change-Id: Ide7fe1388ffe6f85a1f459037316d03193470d8a
(cherry picked from commit e35f3b6a3357fc3832a9d68ed37ddb9b5320ef0a)

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 8fe0dc7..cd15f3d 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1609,6 +1609,10 @@ void ScTextWnd::Command( const CommandEvent& rCEvt )
 {
 //don't call InputChanged for CommandEventId::Wheel
 }
+else if ( nCommand == CommandEventId::Swipe )
+{
+//don't call InputChanged for CommandEventId::Swipe
+}
 else
 SC_MOD()->InputChanged( pEditView );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-02-02 Thread Eike Rathke
 sc/source/core/tool/token.cxx |  106 ++
 1 file changed, 97 insertions(+), 9 deletions(-)

New commits:
commit 7bf650756eec0213d72515c407e8ea998241
Author: Eike Rathke 
Date:   Tue Jan 26 16:10:06 2016 +0100

Resolves: tdf#93151 handle ExpandRefs and mnColDelta the same as mnRowDelta

Change-Id: I8cd00494fc63124443fc01582296ef17f4cd5e27
(cherry picked from commit 02e69f0c3acec2c2e81692bc53c4356591a84ba5)
Reviewed-on: https://gerrit.libreoffice.org/21812
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 05221e7..5c71a56 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3396,17 +3396,33 @@ bool adjustDoubleRefInName(
 ScComplexRefData& rRef, const sc::RefUpdateContext& rCxt, const ScAddress& 
rPos )
 {
 bool bRefChanged = false;
-if (rCxt.mnRowDelta > 0 && rCxt.mrDoc.IsExpandRefs() && 
!rRef.Ref1.IsRowRel() && !rRef.Ref2.IsRowRel())
+if (rCxt.mrDoc.IsExpandRefs())
 {
-// Check and see if we should expand the range at the top.
-ScRange aSelectedRange = getSelectedRange(rCxt);
-ScRange aAbs = rRef.toAbs(rPos);
-if (aSelectedRange.Intersects(aAbs))
+if (rCxt.mnRowDelta > 0 && !rRef.Ref1.IsRowRel() && 
!rRef.Ref2.IsRowRel())
 {
-// Selection intersects the referenced range. Only expand the
-// bottom position.
-rRef.IncEndRowSticky(rCxt.mnRowDelta, rPos);
-return true;
+// Check and see if we should expand the range at the top.
+ScRange aSelectedRange = getSelectedRange(rCxt);
+ScRange aAbs = rRef.toAbs(rPos);
+if (aSelectedRange.Intersects(aAbs))
+{
+// Selection intersects the referenced range. Only expand the
+// bottom position.
+rRef.IncEndRowSticky(rCxt.mnRowDelta, rPos);
+return true;
+}
+}
+if (rCxt.mnColDelta > 0 && !rRef.Ref1.IsColRel() && 
!rRef.Ref2.IsColRel())
+{
+// Check and see if we should expand the range at the left.
+ScRange aSelectedRange = getSelectedRange(rCxt);
+ScRange aAbs = rRef.toAbs(rPos);
+if (aSelectedRange.Intersects(aAbs))
+{
+// Selection intersects the referenced range. Only expand the
+// right position.
+rRef.IncEndColSticky(rCxt.mnColDelta, rPos);
+return true;
+}
 }
 }
 
@@ -3548,6 +3564,66 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceInName(
 
 aRes.mbReferenceModified = true;
 }
+else if (rCxt.mnColDelta < 0)
+{
+// column(s) deleted.
+
+if (rRef.IsEntireRow())
+// Rows of entire rows are not affected.
+break;
+
+if (rRef.Ref1.IsColRel() || rRef.Ref2.IsColRel())
+// Don't modify relative references in names.
+break;
+
+if (aAbs.aStart.Row() < rCxt.maRange.aStart.Row() 
|| rCxt.maRange.aEnd.Row() < aAbs.aEnd.Row())
+// row range of the reference is not entirely 
in the deleted row range.
+break;
+
+if (aAbs.aStart.Tab() > rCxt.maRange.aEnd.Tab() || 
aAbs.aEnd.Tab() < rCxt.maRange.aStart.Tab())
+// wrong tables
+break;
+
+ScRange aDeleted = rCxt.maRange;
+aDeleted.aStart.IncCol(rCxt.mnColDelta);
+
aDeleted.aEnd.SetCol(aDeleted.aStart.Col()-rCxt.mnColDelta-1);
+
+if (aAbs.aEnd.Col() < aDeleted.aStart.Col() || 
aDeleted.aEnd.Col() < aAbs.aStart.Col())
+// reference range doesn't intersect with the 
deleted range.
+break;
+
+if (aDeleted.aStart.Col() <= aAbs.aStart.Col() && 
aAbs.aEnd.Col() <= aDeleted.aEnd.Col())
+{
+// This reference is entirely deleted.
+rRef.Ref1.SetColDeleted(true);
+rRef.Ref2.SetColDeleted(true);
+aRes.mbReferenceModified = true;
+break;
+}
+
+if (aAbs.aStart.Col() < aDeleted.aStart.Col())
+{
+

[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-01-27 Thread Tor Lillqvist
 sc/source/core/data/formulacell.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 32333afd215ffcdc320845937dd524a08fe4f9b0
Author: Tor Lillqvist 
Date:   Wed Jan 27 15:14:39 2016 +0200

tdf#96222: Don't attempt to handle matrix formulas as formula groups

(Also known as array formulas.)

(cherry picked from commit aee3355a8a7a6b7749f2eddd74e9389fe5782186)
(cherry picked from commit 4d43f0c018c1f0fb12f55ebb16c074fb60a8aa73)

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

diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index e574af7..8b4a727 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3947,6 +3947,12 @@ bool ScFormulaCell::InterpretFormulaGroup()
 return false;
 }
 
+if (cMatrixFlag != MM_NONE)
+{
+mxGroup->meCalcState = sc::GroupCalcDisabled;
+return false;
+}
+
 switch (pCode->GetVectorState())
 {
 case FormulaVectorEnabled:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-01-26 Thread Takeshi Abe
 sc/source/ui/view/tabview3.cxx |   11 +++
 1 file changed, 11 insertions(+)

New commits:
commit c68b65ec5581bafc97155b9ac67f6b542044a171
Author: Takeshi Abe 
Date:   Wed Jan 20 22:13:12 2016 +0900

tdf#97247 Keep focus on merged cell at top-left corner

... when typing either UP or LEFT key.

Change-Id: I7bc0e7eb0cba322bcc26c35d0474ea558d3bdd6e
Reviewed-on: https://gerrit.libreoffice.org/21599
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit c13226bcc5b298dacfe32340711bdfd4d15d8b3b)
Reviewed-on: https://gerrit.libreoffice.org/21652
Tested-by: Jenkins 

diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 8e6d143..7e18b88 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1067,6 +1067,17 @@ void ScTabView::MoveCursorRel( SCsCOL nMovX, SCsROW 
nMovY, ScFollowMode eMode,
 nCurY = (nMovY != 0) ? nOldY+nMovY : (SCsROW) aViewData.GetOldCurY();
 }
 
+if (nMovX < 0 && nOldX == 0)
+{ // trying to go left from 1st column
+if (nMovY == 0) // done, because no vertical move is requested
+return;
+}
+if (nMovY < 0 && nOldY == 0)
+{ // trying to go up from 1st row
+if (nMovX == 0) // done, because no horizontal move is requested
+return;
+}
+
 aViewData.ResetOldCursor();
 
 if (nMovX != 0 && ValidColRow(nCurX,nCurY))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-01-25 Thread Yogesh
 sc/source/core/tool/sharedformula.cxx |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 509a189bf70370fbd09f3bb962f8b4e9eacbc6d1
Author: Yogesh 
Date:   Thu Jan 21 16:24:40 2016 +0530

tdf#96910 : Calc crashes while using "Insert Column Left" for large 
Documents

Change-Id: I6e813b7525a3d9b1db131db9f08fc20f7320345f
Reviewed-on: https://gerrit.libreoffice.org/21661
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 
(cherry picked from commit 208883398dcf9af6b88611097d1f75d5fbc9afad)
Reviewed-on: https://gerrit.libreoffice.org/21791
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/source/core/tool/sharedformula.cxx 
b/sc/source/core/tool/sharedformula.cxx
index 43b9872..62e031c 100644
--- a/sc/source/core/tool/sharedformula.cxx
+++ b/sc/source/core/tool/sharedformula.cxx
@@ -119,11 +119,13 @@ void 
SharedFormulaUtil::splitFormulaCellGroups(CellStoreType& rCells, std::vecto
 for (++it; it != itEnd; ++it)
 {
 nRow = *it;
-aPos = rCells.position(aPos.first, nRow);
-if (aPos.first == rCells.end())
-return;
-
-splitFormulaCellGroup(aPos, nullptr);
+if (ValidRow(nRow))
+{
+aPos = rCells.position(aPos.first, nRow);
+if (aPos.first == rCells.end())
+return;
+splitFormulaCellGroup(aPos, nullptr);
+}
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-01-25 Thread Tomaž Vajngerl
 sc/source/ui/StatisticsDialogs/RegressionDialog.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit f3dbf9cbba6e1d5917de9793a95eced4182777b8
Author: Tomaž Vajngerl 
Date:   Sun Jan 24 15:08:05 2016 +0100

tdf#74667 interchange slope and intercept for power regression

Change-Id: I9da7edeabcc9f963ac19d26114fa101d4b5ce98f
(cherry picked from commit 4d67b0baaa4f0fb009b9ee6fbcf4618abf009f53)
Reviewed-on: https://gerrit.libreoffice.org/21743
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx 
b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx
index ad092ee..84939a8 100644
--- a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx
@@ -53,21 +53,21 @@ namespace
 {
 "=SLOPE(%VARIABLE2_RANGE% ; %VARIABLE1_RANGE%)",
 "=SLOPE(%VARIABLE2_RANGE% ; LN(%VARIABLE1_RANGE%))",
-"=EXP(INTERCEPT(LN(%VARIABLE2_RANGE%) ; LN(%VARIABLE1_RANGE%)))"
+"=SLOPE(LN(%VARIABLE2_RANGE%) ; LN(%VARIABLE1_RANGE%))"
 };
 
 OUString constTemplatesINTERCEPT[] =
 {
 "=INTERCEPT(%VARIABLE2_RANGE% ; %VARIABLE1_RANGE%)",
 "=INTERCEPT(%VARIABLE2_RANGE% ; LN(%VARIABLE1_RANGE%))",
-"=SLOPE(LN(%VARIABLE2_RANGE%) ; LN(%VARIABLE1_RANGE%))"
+"=EXP(INTERCEPT(LN(%VARIABLE2_RANGE%) ; LN(%VARIABLE1_RANGE%)))"
 };
 
 OUString constRegressionFormula[] =
 {
 "=%A% * %ADDRESS% + %B%",
 "=%A% * LN(%ADDRESS%) + %B%",
-"=%A% * %ADDRESS% ^ %B%"
+"=%B% * %ADDRESS% ^ %A%"
 };
 
 } // end anonymous namespace
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-01-24 Thread Julien Nabet
 sc/source/core/data/conditio.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 64b23ff688fc4ba3fc0205094380f072fd98b5b5
Author: Julien Nabet 
Date:   Fri Jan 22 20:18:33 2016 +0100

tdf#97308: fix logic with conditional "ends with"

Change-Id: Ib9f9ed627dc37b11d8c3911aa4fe62141ff471c2
Reviewed-on: https://gerrit.libreoffice.org/21723
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 
(cherry picked from commit a0a4ea3c636fc18cca6a3b2f9391996fb909e81f)
Reviewed-on: https://gerrit.libreoffice.org/21730
Reviewed-by: Jochen Nitschke 
Reviewed-by: Katarina Behrens 

diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 6dd4c32..7bd9f5c 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1112,12 +1112,12 @@ bool ScConditionEntry::IsValid( double nArg, const 
ScAddress& rPos ) const
 {
 OUString aStr = OUString::number(nVal1);
 OUString aStr2 = OUString::number(nArg);
-bValid = !aStr2.endsWith(aStr);
+bValid = aStr2.endsWith(aStr);
 }
 else
 {
 OUString aStr2 = OUString::number(nArg);
-bValid = !aStr2.endsWith(aStrVal1);
+bValid = aStr2.endsWith(aStrVal1);
 }
 break;
 case SC_COND_CONTAINS_TEXT:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-01-20 Thread Stephan Bergmann
 sc/source/ui/dbgui/validate.cxx |5 +
 sc/source/ui/inc/validate.hxx   |2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit a6a65ecdef3a577b537b5d9fccb9d41e585b9f14
Author: Stephan Bergmann 
Date:   Tue Jan 19 10:58:44 2016 +0100

Make virtual ~ScValidationDlg non-inline

...otherwise, GCC 6 would aggressively inline ScValidationDlg destruction 
of the
VclPtr in ScValidityRefChildWin::ScValidityRefChildWin
(sc/source/ui/view/reffact.cxx, in sc library), checking whether the vtable
points at ~ScValidationDlg (instead of a derived class dtor) to directly 
inline
the ~ScValidationDlg code, which requires the ScValidateionDlg vtable (to 
store
it in the object's vtable during destruction), which requires the code of 
inline
virtual ScValidationDlg::dispose and ScValidationDlg::Close, which in turn 
need
the addresses of (non-inline) ScValidationDlg::RemoveRefDlg and
ScTPValidationValue::RemoveRefDlg, both defined in the scui library and not
exported from there.

Change-Id: I7eb96f42deb5edd844d91e999aa5511679302c01
(cherry picked from commit 8d1a24dae03690b576310e3539369916f31ac475)
Reviewed-on: https://gerrit.libreoffice.org/21637
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx
index 459c5d7..db73012 100644
--- a/sc/source/ui/dbgui/validate.cxx
+++ b/sc/source/ui/dbgui/validate.cxx
@@ -96,6 +96,11 @@ ScValidationDlg::ScValidationDlg(vcl::Window* pParent, const 
SfxItemSet* pArgSet
 get(m_pHBox, "refinputbox");
 }
 
+ScValidationDlg::~ScValidationDlg()
+{
+disposeOnce();
+}
+
 void ScTPValidationValue::SetReferenceHdl( const ScRange , ScDocument* 
pDoc )
 {
 if ( rRange.aStart != rRange.aEnd )
diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx
index d39b99b..1e785b7 100644
--- a/sc/source/ui/inc/validate.hxx
+++ b/sc/source/ui/inc/validate.hxx
@@ -182,7 +182,7 @@ class ScValidationDlg
 
 public:
 explicit ScValidationDlg( vcl::Window* pParent, const SfxItemSet* pArgSet, 
ScTabViewShell * pTabViewSh, SfxBindings *pB = nullptr );
-virtual ~ScValidationDlg() { disposeOnce(); }
+virtual ~ScValidationDlg();
 virtual voiddispose() override
 {
 if( m_bOwnRefHdlr )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-01-19 Thread Winfried Donkers
 sc/source/ui/app/inputhdl.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit e2b222cc98b1378b85d0c37eb9f5ef562247b3cf
Author: Winfried Donkers 
Date:   Mon Jan 18 12:27:49 2016 +0100

follow-up of tdf#89031

No function name hints or autocompletion when character right of caret is 
'$'

Change-Id: I4fcfa6e29e5671e97743c7fc520953721d0bda24
Reviewed-on: https://gerrit.libreoffice.org/21577
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit 1e2bcb3177d58e6f446296ae28fcff7f5da9b620)
Reviewed-on: https://gerrit.libreoffice.org/21601

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index a464c34..2395cba 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1060,7 +1060,8 @@ void ScInputHandler::UseFormulaData()
 if ( aParagraph.getLength() > aSel.nEndPos &&
  ( ScGlobal::pCharClass->isLetterNumeric( aParagraph, aSel.nEndPos 
) ||
aParagraph[ aSel.nEndPos ] == '_' ||
-   aParagraph[ aSel.nEndPos ] == '.'   ) )
+   aParagraph[ aSel.nEndPos ] == '.' ||
+   aParagraph[ aSel.nEndPos ] == '$'   ) )
 return;
 
 //  Is the cursor at the end of a word?
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-01-12 Thread Arul
 sc/source/core/data/column.cxx |   21 +++--
 1 file changed, 15 insertions(+), 6 deletions(-)

New commits:
commit e9e641b39a98df8c6aef8d2f12f4a589ed887612
Author: Arul 
Date:   Tue Jan 12 15:35:14 2016 +0530

tdf#90606 Crash when delete a large part of a column with shift cells left

skipping splitFormulaCellGroup() and joinFormulaCellAbove() for nEndRow 
equal
to MAXROW since nEndRow + 1 is not valid

Change-Id: Iabfcb33bf58d20331841ca386cca4a91fd6598bf
Reviewed-on: https://gerrit.libreoffice.org/21389
Reviewed-by: jan iversen 
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit 975ceab198a06558875006bbd9a4d0a2708e416e)
Reviewed-on: https://gerrit.libreoffice.org/21392

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index c09f096..8e835b9 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1909,14 +1909,20 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, 
ScColumn& rCol)
 // Split the formula grouping at the top and bottom boundaries.
 sc::CellStoreType::position_type aPos = maCells.position(nStartRow);
 sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr);
-aPos = maCells.position(aPos.first, nEndRow+1);
-sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr);
+if (ValidRow(nEndRow+1))
+{
+aPos = maCells.position(aPos.first, nEndRow+1);
+sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr);
+}
 
 // Do the same with the destination column.
 aPos = rCol.maCells.position(nStartRow);
 sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr);
-aPos = rCol.maCells.position(aPos.first, nEndRow+1);
-sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr);
+if (ValidRow(nEndRow+1))
+{
+aPos = rCol.maCells.position(aPos.first, nEndRow+1);
+sc::SharedFormulaUtil::splitFormulaCellGroup(aPos, nullptr);
+}
 
 // Move the broadcasters to the destination column.
 maBroadcasters.transfer(nStartRow, nEndRow, rCol.maBroadcasters, 
nStartRow);
@@ -1930,8 +1936,11 @@ void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, 
ScColumn& rCol)
 // Re-group transferred formula cells.
 aPos = rCol.maCells.position(nStartRow);
 sc::SharedFormulaUtil::joinFormulaCellAbove(aPos);
-aPos = rCol.maCells.position(aPos.first, nEndRow+1);
-sc::SharedFormulaUtil::joinFormulaCellAbove(aPos);
+if (ValidRow(nEndRow+1))
+{
+aPos = rCol.maCells.position(aPos.first, nEndRow+1);
+sc::SharedFormulaUtil::joinFormulaCellAbove(aPos);
+}
 
 CellStorageModified();
 rCol.CellStorageModified();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-01-07 Thread Eike Rathke
 sc/source/ui/undo/undoblk3.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 6384fc20aafa649604ae6e4ddb2f7a84b5471f81
Author: Eike Rathke 
Date:   Thu Jan 7 12:11:30 2016 +0100

Resolves: tdf#94208 broadcast fill undo (for deleted cells)

Change-Id: I0fb54956bffc77dad4236b326eee3af836017623
(cherry picked from commit ece5cc21aa7814be79016e0d285981c6ced4d9ee)
Reviewed-on: https://gerrit.libreoffice.org/21206
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index f7e0e28..bb90e11 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -541,6 +541,12 @@ void ScUndoAutoFill::Undo()
 rDoc.DeleteAreaTab( aWorkRange, InsertDeleteFlags::AUTOFILL );
 pUndoDoc->CopyToDocument( aWorkRange, InsertDeleteFlags::AUTOFILL, 
false,  );
 
+// Actually we'd only need to broadcast the cells inserted during
+// CopyToDocument(), as DeleteAreaTab() broadcasts deleted cells. For
+// this we'd need to either record the span sets or let
+// CopyToDocument() broadcast.
+BroadcastChanges( aWorkRange);
+
 rDoc.ExtendMerge( aWorkRange, true );
 pDocShell->PostPaint( aWorkRange, PAINT_GRID, nExtFlags );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2016-01-04 Thread Eike Rathke
 sc/source/core/tool/interpr2.cxx |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit dee3bcdb9e91f338b66872ae939bf790ab7bf061
Author: Eike Rathke 
Date:   Mon Jan 4 17:40:18 2016 +0100

correct WEEKNUM DayOfWeek handling, tdf#50950 follow-up, tdf#95419 related

Slight misinterpretation of the
{Sunday, Monday, Monday, Tuesday, ..., Sunday}
sequence defined in ODFF.

Change-Id: I09ac711adf8a52db1c9efbb1c67dc908b8e06618
(cherry picked from commit 7ea839ae3904d96dcea35a0339f3e6ee7d58bbaa)

diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index dbed2a7..1777230 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -220,15 +220,21 @@ void ScInterpreter::ScGetWeekOfYear()
 switch ( nFlag )
 {
 case   1 :
-case  11 :
+eFirstDayOfWeek = SUNDAY;
+nMinimumNumberOfDaysInWeek = 1;
+break;
 case   2 :
+eFirstDayOfWeek = MONDAY;
+nMinimumNumberOfDaysInWeek = 1;
+break;
+case  11 :
 case  12 :
 case  13 :
 case  14 :
 case  15 :
 case  16 :
 case  17 :
-eFirstDayOfWeek = (DayOfWeek) ( ( nFlag - 1 )  % 10 );
+eFirstDayOfWeek = static_cast( nFlag - 11 ); // 
MONDAY := 0
 nMinimumNumberOfDaysInWeek = 1; //the week containing January 
1 is week 1
 break;
 case  21 :
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2015-12-21 Thread Tomaž Vajngerl
 sc/source/filter/excel/xechart.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit f3f90b6490298fdf79d5f9e19c788f0b69e0818e
Author: Tomaž Vajngerl 
Date:   Sun Dec 20 22:13:19 2015 +0100

tdf#93949 ensure memory stream is properly flushed

Change-Id: I6d6a926f5d3fd62dd3b7b78a5721f6483b3b4ee7
(cherry picked from commit c6b11cf681f8e8d131031ea7e5d19c4b6473503a)
Reviewed-on: https://gerrit.libreoffice.org/20841
Reviewed-by: David Tardon 
Tested-by: David Tardon 

diff --git a/sc/source/filter/excel/xechart.cxx 
b/sc/source/filter/excel/xechart.cxx
index 83f2aa3..eac9364 100644
--- a/sc/source/filter/excel/xechart.cxx
+++ b/sc/source/filter/excel/xechart.cxx
@@ -720,6 +720,7 @@ void XclExpChEscherFormat::WriteBody( XclExpStream& rStrm )
 // write Escher property container via temporary memory stream
 SvMemoryStream aMemStrm;
 maData.mxEscherSet->Commit( aMemStrm );
+aMemStrm.Flush();
 aMemStrm.Seek( STREAM_SEEK_TO_BEGIN );
 rStrm.CopyFromStream( aMemStrm );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2015-12-18 Thread Caolán McNamara
 sc/source/core/tool/scmatrix.cxx |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit d86e429f339131e05081132a6ef6aae41e5f6811
Author: Caolán McNamara 
Date:   Fri Dec 18 16:29:21 2015 +

crashtesting: crash on converting ooo93489-1.ods to pdf

with --headless --convert-to pdf ooo93489-1.ods

probable regression from...

commit d4daad185e9583bedbb5a4eef1fd53e1f22e219b
Author: Jan Holesovsky 
Date:   Mon Nov 30 10:28:43 2015 +0100

sc interpreter: Move the code that can create a ScFullMatrix.

In that original code I see there was a check for "Data array is shorter 
than
the row size of the reference. Truncate it to the data" which doesn't exist
anymore. If I reintroduce that check here the crash is avoided.

Change-Id: I7c7a5979d9c14c133b05e89ce3794e6b739ca61c
Reviewed-on: https://gerrit.libreoffice.org/20794
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit ddeca090ba612cdd5a2d55785fb1c4b66b6bc0a5)
Reviewed-on: https://gerrit.libreoffice.org/20800

diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 42d25ba..d3816b5 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -2994,6 +2994,16 @@ void ScVectorRefMatrix::ensureFullMatrix()
 size_t nColSize = rArrays.size();
 mpFullMatrix.reset(new ScFullMatrix(nColSize, mnRowSize));
 
+size_t nRowSize = mnRowSize;
+size_t nRowEnd = mnRowStart + mnRowSize;
+size_t nDataRowEnd = mpToken->GetArrayLength();
+if (nRowEnd > nDataRowEnd)
+{
+// Data array is shorter than the row size of the reference. Truncate
+// it to the data.
+nRowSize -= nRowEnd - nDataRowEnd;
+}
+
 for (size_t nCol = 0; nCol < nColSize; ++nCol)
 {
 const formula::VectorRefArray& rArray = rArrays[nCol];
@@ -3006,14 +3016,14 @@ void ScVectorRefMatrix::ensureFullMatrix()
 pNums += mnRowStart;
 rtl_uString** pStrs = rArray.mpStringArray;
 pStrs += mnRowStart;
-fillMatrix(*mpFullMatrix, nCol, pNums, pStrs, mnRowSize);
+fillMatrix(*mpFullMatrix, nCol, pNums, pStrs, nRowSize);
 }
 else
 {
 // String cells only.
 rtl_uString** pStrs = rArray.mpStringArray;
 pStrs += mnRowStart;
-fillMatrix(*mpFullMatrix, nCol, pStrs, mnRowSize);
+fillMatrix(*mpFullMatrix, nCol, pStrs, nRowSize);
 }
 }
 else if (rArray.mpNumericArray)
@@ -3021,7 +3031,7 @@ void ScVectorRefMatrix::ensureFullMatrix()
 // Numeric cells only.
 const double* pNums = rArray.mpNumericArray;
 pNums += mnRowStart;
-fillMatrix(*mpFullMatrix, nCol, pNums, mnRowSize);
+fillMatrix(*mpFullMatrix, nCol, pNums, nRowSize);
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2015-12-12 Thread Dennis Francis
 sc/source/ui/view/cellsh2.cxx |   31 ---
 1 file changed, 24 insertions(+), 7 deletions(-)

New commits:
commit ca24070a7b765daaea46a88a500f1b6cb78cb1a1
Author: Dennis Francis 
Date:   Sat Nov 28 22:47:02 2015 +0530

tdf#73006 : Put results in correct cells after Text to Columns

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

diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index c2c19ba..354ae1f 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -70,7 +70,7 @@
 
 using namespace com::sun::star;
 
-static bool lcl_GetTextToColumnsRange( const ScViewData* pData, ScRange& 
rRange )
+static bool lcl_GetTextToColumnsRange( const ScViewData* pData, ScRange& 
rRange, bool bDoEmptyCheckOnly )
 {
 OSL_ENSURE( pData, "lcl_GetTextToColumnsRange: pData is null!" );
 
@@ -100,11 +100,28 @@ static bool lcl_GetTextToColumnsRange( const ScViewData* 
pData, ScRange& rRange
 const ScDocument* pDoc = pData->GetDocument();
 OSL_ENSURE( pDoc, "lcl_GetTextToColumnsRange: pDoc is null!" );
 
-if ( bRet && pDoc->IsBlockEmpty( rRange.aStart.Tab(), rRange.aStart.Col(),
- rRange.aStart.Row(), rRange.aEnd.Col(),
- rRange.aEnd.Row() ) )
+if ( bDoEmptyCheckOnly )
 {
-bRet = false;
+if ( bRet && pDoc->IsBlockEmpty( rRange.aStart.Tab(), 
rRange.aStart.Col(),
+ rRange.aStart.Row(), 
rRange.aEnd.Col(),
+ rRange.aEnd.Row() ) )
+{
+bRet = false;
+}
+}
+else if ( bRet )
+{
+rRange.PutInOrder();
+SCCOL nStartCol = rRange.aStart.Col(), nEndCol = rRange.aEnd.Col();
+SCROW nStartRow = rRange.aStart.Row(), nEndRow = rRange.aEnd.Row();
+bool bShrunk = false;
+pDoc->ShrinkToUsedDataArea( bShrunk, rRange.aStart.Tab(), nStartCol, 
nStartRow,
+   nEndCol, nEndRow, false, false, true );
+if ( bShrunk )
+{
+rRange.aStart.SetRow( nStartRow );
+rRange.aEnd.SetRow( nEndRow );
+}
 }
 
 return bRet;
@@ -957,7 +974,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
 OSL_ENSURE( pData, "ScCellShell::ExecuteDB: 
SID_TEXT_TO_COLUMNS - pData is null!" );
 ScRange aRange;
 
-if ( lcl_GetTextToColumnsRange( pData, aRange ) )
+if ( lcl_GetTextToColumnsRange( pData, aRange, false ) )
 {
 ScDocument* pDoc = pData->GetDocument();
 OSL_ENSURE( pDoc, "ScCellShell::ExecuteDB: 
SID_TEXT_TO_COLUMNS - pDoc is null!" );
@@ -1195,7 +1212,7 @@ void ScCellShell::GetDBState( SfxItemSet& rSet )
 case SID_TEXT_TO_COLUMNS:
 {
 ScRange aRange;
-if ( !lcl_GetTextToColumnsRange( pData, aRange ) )
+if ( !lcl_GetTextToColumnsRange( pData, aRange, true ) )
 {
 rSet.DisableItem( nWhich );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2015-12-10 Thread Katarina Behrens
 sc/source/ui/dbgui/PivotLayoutTreeList.cxx |   11 ---
 sc/source/ui/inc/PivotLayoutTreeList.hxx   |3 +++
 2 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit b6656993429cd18e8a31825de45c9515f93cd0cd
Author: Katarina Behrens 
Date:   Wed Nov 18 14:10:55 2015 +0100

tdf#93263: Take function mask from ScPivotField

and not from ScDPLabelData (that's what old code used to do as well).
Afaics ScDPLabelData.mnFuncMask member is never modified as the array
gets populated in ScDPObject::FillLabelDataForDimension. UI has thus
only its default value (PIVOT_FUNC_NONE) and so subtotals get reset
on every change.

ScPivotField however contains the right func mask, so take it from
there.

Change-Id: I862be121683aac079e788ce535f714ac8cdbcd0b
Reviewed-on: https://gerrit.libreoffice.org/20041
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit 0bfa6ddc99710c1e166140f97cf3212348d04d05)
Reviewed-on: https://gerrit.libreoffice.org/20626

diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx 
b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
index 82e5911..a4173e9 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
@@ -71,12 +71,15 @@ bool ScPivotLayoutTreeList::DoubleClickHdl()
 void ScPivotLayoutTreeList::FillFields(ScPivotFieldVector& rFieldVector)
 {
 Clear();
+maItemValues.clear();
 
 ScPivotFieldVector::iterator it;
 for (it = rFieldVector.begin(); it != rFieldVector.end(); ++it)
 {
 ScPivotField& rField = *it;
-ScItemValue* pItemValue = mpParent->GetItem(rField.nCol);
+OUString aLabel = mpParent->GetItem( rField.nCol )->maName;
+ScItemValue* pItemValue = new ScItemValue( aLabel, rField.nCol, 
rField.nFuncMask );
+maItemValues.push_back(std::unique_ptr(pItemValue));
 InsertEntry(pItemValue->maName, nullptr, false, TREELIST_APPEND, 
pItemValue);
 }
 }
@@ -98,8 +101,10 @@ void 
ScPivotLayoutTreeList::InsertEntryForSourceTarget(SvTreeListEntry* pSource,
 
 void ScPivotLayoutTreeList::InsertEntryForItem(ScItemValue* pItemValue, 
sal_uLong nPosition)
 {
-OUString rName = pItemValue->maName;
-InsertEntry(rName, nullptr, false, nPosition, pItemValue);
+ScItemValue *pListItemValue = new ScItemValue(pItemValue);
+maItemValues.push_back(std::unique_ptr(pListItemValue));
+OUString rName = pListItemValue->maName;
+InsertEntry(rName, nullptr, false, nPosition, pListItemValue);
 }
 
 void ScPivotLayoutTreeList::KeyInput(const KeyEvent& rKeyEvent)
diff --git a/sc/source/ui/inc/PivotLayoutTreeList.hxx 
b/sc/source/ui/inc/PivotLayoutTreeList.hxx
index 2ae1adb..60feb73 100644
--- a/sc/source/ui/inc/PivotLayoutTreeList.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeList.hxx
@@ -15,6 +15,9 @@
 
 class ScPivotLayoutTreeList : public ScPivotLayoutTreeListBase
 {
+private:
+std::vector maItemValues;
+
 public:
 ScPivotLayoutTreeList(vcl::Window* pParent, WinBits nBits);
 virtual ~ScPivotLayoutTreeList();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2015-12-08 Thread Yousuf Philips
 sc/source/ui/src/hdrcont.src |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1fcf968d71de1212bde327db0156f194d679cc65
Author: Yousuf Philips 
Date:   Mon Dec 7 19:06:08 2015 +0400

tdf#96202 Revert accelerator back to 'I'

Change-Id: Ie07d0b27c18a9cd66e6afd32163f773340967a6b
Reviewed-on: https://gerrit.libreoffice.org/20437
Tested-by: Jenkins 
Reviewed-by: Katarina Behrens 
(cherry picked from commit 14fb1d6421802be3b69ff50dcd9703c2596df4e3)
Reviewed-on: https://gerrit.libreoffice.org/20463
Reviewed-by: Samuel Mehrbrodt 
Tested-by: Samuel Mehrbrodt 

diff --git a/sc/source/ui/src/hdrcont.src b/sc/source/ui/src/hdrcont.src
index 0fa3d1d..33209ba 100644
--- a/sc/source/ui/src/hdrcont.src
+++ b/sc/source/ui/src/hdrcont.src
@@ -64,7 +64,7 @@ Menu RID_POPUP_ROWHEADER
 {
 Identifier = FID_INS_ROWS_BEFORE ;
 HelpId = CMD_FID_INS_ROWS_BEFORE ;
-Text [ en-US ] = "Insert Rows A~bove" ;
+Text [ en-US ] = "~Insert Rows Above" ;
 };
 MenuItem
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2015-12-01 Thread Eike Rathke
 sc/source/ui/docshell/docsh.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 63ada88a0fe28440c021141da911f69f7394250d
Author: Eike Rathke 
Date:   Tue Dec 1 21:24:27 2015 +0100

Resolves: tdf#95629 quote CSV also if cell contains embedded '\r' CR

Change-Id: I37fb62a53338a7edcac1c72153eefcee6096e6f9
(cherry picked from commit 129935443cfd9378e1263489fc4bf47aee1f1a46)

diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 5181bcc..562254d 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -1785,11 +1785,12 @@ sal_Int32 getTextSepPos(
 const StrT& rStr, const ScImportOptions& rAsciiOpt, const SepCharT& 
rTextSep, const SepCharT& rFieldSep, bool& rNeedQuotes)
 {
 // #i116636# quotes are needed if text delimiter (quote), field delimiter,
-// or LF is in the cell text.
+// or LF or CR is in the cell text.
 sal_Int32 nPos = rStr.indexOf(rTextSep);
 rNeedQuotes = rAsciiOpt.bQuoteAllText || (nPos >= 0) ||
 (rStr.indexOf(rFieldSep) >= 0) ||
-(rStr.indexOf('\n') >= 0);
+(rStr.indexOf('\n') >= 0) ||
+(rStr.indexOf('\r') >= 0);
 return nPos;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2015-11-30 Thread Eike Rathke
 sc/source/filter/excel/xestyle.cxx |8 
 sc/source/filter/excel/xetable.cxx |4 ++--
 sc/source/filter/inc/xestyle.hxx   |   12 ++--
 3 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 5659b30f1b59991cb9610e6bdea88a3de4c140b0
Author: Eike Rathke 
Date:   Mon Nov 30 16:07:46 2015 +0100

number format keys are sal_uInt32, so use it

Change-Id: I0adf5f443ed3348ca0b975bd64bd4a293ff30f79
(cherry picked from commit 2c1c6df24060a08f7b6c49874c0e8a86a32e1dfd)

diff --git a/sc/source/filter/excel/xestyle.cxx 
b/sc/source/filter/excel/xestyle.cxx
index 55ebdcf..3f82655 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -1373,7 +1373,7 @@ XclExpNumFmtBuffer::~XclExpNumFmtBuffer()
 {
 }
 
-sal_uInt16 XclExpNumFmtBuffer::Insert( sal_uLong nScNumFmt )
+sal_uInt16 XclExpNumFmtBuffer::Insert( sal_uInt32 nScNumFmt )
 {
 XclExpNumFmtVec::const_iterator aIt =
 ::std::find_if( maFormatMap.begin(), maFormatMap.end(), 
XclExpNumFmtPred( nScNumFmt ) );
@@ -1433,14 +1433,14 @@ void XclExpNumFmtBuffer::WriteFormatRecord( 
XclExpStream& rStrm, const XclExpNum
 
 namespace {
 
-OUString GetNumberFormatCode(XclRoot& rRoot, const sal_uInt16 nScNumFmt, 
SvNumberFormatter* pFormatter, NfKeywordTable* pKeywordTable)
+OUString GetNumberFormatCode(XclRoot& rRoot, const sal_uInt32 nScNumFmt, 
SvNumberFormatter* pFormatter, NfKeywordTable* pKeywordTable)
 {
 return rRoot.GetFormatter().GetFormatStringForExcel( nScNumFmt, 
*pKeywordTable, *pFormatter);
 }
 
 }
 
-OUString XclExpNumFmtBuffer::GetFormatCode( sal_uInt16 nScNumFmt )
+OUString XclExpNumFmtBuffer::GetFormatCode( sal_uInt32 nScNumFmt )
 {
 return GetNumberFormatCode( *this, nScNumFmt, mxFormatter.get(), 
mpKeywordTable.get() );
 }
@@ -3027,7 +3027,7 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
 const SfxPoolItem *pPoolItem = nullptr;
 if( rSet.GetItemState( ATTR_VALUE_FORMAT, true, 
 ) == SfxItemState::SET )
 {
-sal_uLong nScNumFmt = static_cast< const 
SfxUInt32Item* >(pPoolItem)->GetValue();
+sal_uInt32 nScNumFmt = static_cast< const 
SfxUInt32Item* >(pPoolItem)->GetValue();
 sal_Int32 nXclNumFmt = 
GetRoot().GetNumFmtBuffer().Insert(nScNumFmt);
 pNumFormat = new XclExpNumFmt( nScNumFmt, 
nXclNumFmt, GetNumberFormatCode( *this, nScNumFmt, mxFormatter.get(), 
mpKeywordTable.get() ));
 }
diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index 3c85323..866c9ab 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -821,12 +821,12 @@ XclExpFormulaCell::XclExpFormulaCell(
 XclExpNumFmtBuffer& rNumFmtBfr = rRoot.GetNumFmtBuffer();
 
 // current cell number format
-sal_uLong nScNumFmt = pPattern ?
+sal_uInt32 nScNumFmt = pPattern ?
 GETITEMVALUE( pPattern->GetItemSet(), SfxUInt32Item, 
ATTR_VALUE_FORMAT, sal_uLong ) :
 rNumFmtBfr.GetStandardFormat();
 
 // alternative number format passed to XF buffer
-sal_uLong nAltScNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND;
+sal_uInt32 nAltScNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND;
 /*  Xcl doesn't know Boolean number formats, we write
 "TRUE";"FALSE" (language dependent). Don't do it for automatic
 formula formats, because Excel gets them right. */
diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx
index 41e4d00..f2c4461 100644
--- a/sc/source/filter/inc/xestyle.hxx
+++ b/sc/source/filter/inc/xestyle.hxx
@@ -268,11 +268,11 @@ private:
 /** Stores a core number format index with corresponding Excel format index. */
 struct XclExpNumFmt
 {
-sal_uLong   mnScNumFmt; /// Core index of the number format.
+sal_uInt32  mnScNumFmt; /// Core index of the number format.
 sal_uInt16  mnXclNumFmt;/// Resulting Excel format index.
 OUStringmaNumFmtString; /// format string
 
-inline explicit XclExpNumFmt( sal_uLong nScNumFmt, sal_uInt16 
nXclNumFmt, const OUString& rFrmt ) :
+inline explicit XclExpNumFmt( sal_uInt32 nScNumFmt, sal_uInt16 
nXclNumFmt, const OUString& rFrmt ) :
 mnScNumFmt( nScNumFmt ), mnXclNumFmt( nXclNumFmt 
), maNumFmtString( rFrmt ) {}
 
 void SaveXml( XclExpXmlStream& rStrm );
@@ -289,12 +289,12 @@ public:
 virtual ~XclExpNumFmtBuffer();
 
 /** Returns the core index of the current standard number format. */
-inline sal_uLongGetStandardFormat() const { return mnStdFmt; }
+inline sal_uInt32   GetStandardFormat() const { return mnStdFmt; }
 
 /** Inserts a number format into the format buffer.
 @param nScNumFmt  The core index of the 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2015-11-30 Thread Noel Grandin
 sc/source/ui/formdlg/dwfunctr.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 3d5f762b49253f4758824e883d1a429f09001b99
Author: Noel Grandin 
Date:   Tue Dec 1 08:32:58 2015 +0200

tdf#95990 - Calc is crashed when you double click on function in Sideba

The problem arises because we can dispose ourselves like so:

/home/noel/libo3/sc/source/ui/formdlg/dwfunctr.cxx:176
/home/noel/libo3/vcl/source/outdev/outdev.cxx:202
(this=0x252c548) at /home/noel/libo3/include/vcl/vclptr.hxx:206
(this=0x252c4c0) at
/home/noel/libo3/sfx2/source/sidebar/SidebarPanelBase.cxx:85
(this=0x252c4c0) at /home/noel/libo3/cppuhelper/source/implbase.cxx:109

cppu::WeakComponentImplHelper5::dispose (this=0x252c4c0) at
/home/noel/libo3/include/cppuhelper/compbase5.hxx:60
at /home/noel/libo3/sfx2/source/sidebar/Panel.cxx:88
/home/noel/libo3/vcl/source/outdev/outdev.cxx:202
(this=0x21dbbd0) at /home/noel/libo3/include/vcl/vclptr.hxx:206
(this=0x23c9a10, rPanels=std::__debug::vector of length 1, capacity 1 =
{...}) at /home/noel/libo3/sfx2/source/sidebar/Deck.cxx:205
(this=0x2068b00, rDeckId="ScFunctionsDeck") at
/home/noel/libo3/sfx2/source/sidebar/SidebarController.cxx:631
(this=0x2068b00, rDeckId="ScFunctionsDeck", bForceCreate=false)
at /home/noel/libo3/sfx2/source/sidebar/SidebarController.cxx:566
(this=0x2068b00, rDeckDescriptor=..., rContext=...) at
/home/noel/libo3/sfx2/source/sidebar/SidebarController.cxx:690
sfx2::sidebar::SidebarController::UpdateConfigurations (this=0x2068b00)
at /home/noel/libo3/sfx2/source/sidebar/SidebarController.cxx:500
sfx2::sidebar::SidebarController::notifyContextChangeEvent
(this=0x2068b00, rEvent=...) at
/home/noel/libo3/sfx2/source/sidebar/SidebarController.cxx:275
namespace)::ContextChangeEventMultiplexer::BroadcastEventToSingleContainer
(this=0x207bad0, rEventObject=...,
rxEventFocus=uno::Reference to (ScTabViewObj *) 0x1d9d120) at

/home/noel/libo3/framework/source/services/ContextChangeEventMultiplexer.cxx:286
namespace)::ContextChangeEventMultiplexer::broadcastContextChangeEvent
(this=0x207bad0, rEventObject=...,
rxEventFocus=uno::Reference to (ScTabViewObj *) 0x1d9d120) at

/home/noel/libo3/framework/source/services/ContextChangeEventMultiplexer.cxx:265
sfx2::sidebar::ContextChangeBroadcaster::BroadcastContextChange
(this=0x23f0e50, rxFrame=uno::Reference to ((anonymous namespace)::Frame
*) 0x17d1798,
rsModuleName="com.sun.star.sheet.SpreadsheetDocument",
rsContextName="EditCell") at
/home/noel/libo3/sfx2/source/sidebar/ContextChangeBroadcaster.cxx:99
sfx2::sidebar::ContextChangeBroadcaster::Activate (this=0x23f0e50,
rxFrame=uno::Reference to ((anonymous namespace)::Frame *) 0x17d1798)
at
/home/noel/libo3/sfx2/source/sidebar/ContextChangeBroadcaster.cxx:51
(this=0x2190490, bIsActivated=true) at
/home/noel/libo3/sfx2/source/control/shell.cxx:729
/home/noel/libo3/sfx2/source/control/shell.cxx:378
pFrame=0x1d5dea0, bMDI=true) at
/home/noel/libo3/sfx2/source/control/shell.cxx:331
/home/noel/libo3/sfx2/source/control/dispatch.cxx:1503
/home/noel/libo3/sfx2/source/control/dispatch.cxx:158
rShell=...) at /home/noel/libo3/sfx2/source/view/viewsh.cxx:1420
(this=0x1d61fe0, eOST=OST_Editing, bForce=false) at
/home/noel/libo3/sc/source/ui/view/tabvwsh4.cxx:809
pView=0x1d685c0, bActive=true) at
/home/noel/libo3/sc/source/ui/view/tabvwsh4.cxx:753
rBC=..., rHint=...) at
/home/noel/libo3/sc/source/ui/view/tabvwsh5.cxx:195
pEditEngine=0x20570d0, rCursorPos=...) at
/home/noel/libo3/sc/source/ui/docshell/docsh3.cxx:78
eNewMode=SC_INPUT_TABLE, pInitText=0x0) at
/home/noel/libo3/sc/source/ui/app/inputhdl.cxx:2339
eMode=SC_INPUT_TABLE, pInitText=0x0) at
/home/noel/libo3/sc/source/ui/app/scmod.cxx:1404
/home/noel/libo3/sc/source/ui/formdlg/dwfunctr.cxx:826
(this=0x23d29a0) at
/home/noel/libo3/sc/source/ui/formdlg/dwfunctr.cxx:962
(instance=0x23d29a0, data=...) at
/home/noel/libo3/sc/source/ui/formdlg/dwfunctr.cxx:960
data=...) at /home/noel/libo3/include/tools/link.hxx:84
(__closure=0x7fff3ec0) at
/home/noel/libo3/vcl/source/control/lstbox.cxx:973
ListBox::DoubleClick():: >::_M_invoke(const std::_Any_data &)
(__functor=...) at /usr/include/c++/5/functional:1871
(this=0x7fff3ec0) at /usr/include/c++/5/functional:2271
Control::ImplCallEventListenersAndHandler(unsigned long,
std::function) (this=0x23e6260, nEvent=1109, callHandler=...)
at /home/noel/libo3/vcl/source/control/ctrl.cxx:333

[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

2015-11-26 Thread Eike Rathke
 sc/source/filter/excel/excdoc.cxx   |7 +++
 sc/source/filter/excel/xedbdata.cxx |   19 ---
 sc/source/filter/inc/xedbdata.hxx   |7 +++
 3 files changed, 18 insertions(+), 15 deletions(-)

New commits:
commit fa18c83e4e2bddf8f25e4dc3b93ba667ec2a8c11
Author: Eike Rathke 
Date:   Thu Nov 26 11:30:18 2015 +0100

TableRef: write  before , resolves tdf#96049

Excel expects this order, so let XclExpTables be managed as
XclExpRecordBase in the sheet's XclExpRecordList.

Change-Id: If2cefc255c74688661e861a26218564117b1e3ce
(cherry picked from commit 4112ecadd53f7ae48e007dd5024f077aca305062)

diff --git a/sc/source/filter/excel/excdoc.cxx 
b/sc/source/filter/excel/excdoc.cxx
index f5d5393..75a7677 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -678,6 +678,9 @@ void ExcTable::FillAsTableXml()
 if (pImgData)
 aRecList.AppendRecord(std::shared_ptr(pImgData));
 
+//  after  and before 
+aRecList.AppendRecord( GetTablesManager().GetTablesBySheet( mnScTab));
+
 aRecList.AppendRecord( xExtLst );
 }
 
@@ -744,10 +747,6 @@ void ExcTable::WriteXml( XclExpXmlStream& rStrm )
 if (pPT)
 pPT->SaveXml(rStrm);
 
-XclExpTables* pTables = GetTablesManager().GetTablesBySheet(mnScTab);
-if (pTables)
-pTables->SaveXml(rStrm);
-
 rStrm.GetCurrentStream()->endElement( XML_worksheet );
 rStrm.PopStream();
 }
diff --git a/sc/source/filter/excel/xedbdata.cxx 
b/sc/source/filter/excel/xedbdata.cxx
index 6613c37..5be286d 100644
--- a/sc/source/filter/excel/xedbdata.cxx
+++ b/sc/source/filter/excel/xedbdata.cxx
@@ -133,27 +133,32 @@ void XclExpTablesManager::Initialize()
 TablesMapType::iterator it = maTablesMap.find( nTab);
 if (it == maTablesMap.end())
 {
-XclExpTables* pNew;
+::std::shared_ptr< XclExpTables > pNew;
 switch( GetBiff() )
 {
 case EXC_BIFF5:
-pNew = new XclExpTablesImpl5( GetRoot());
+pNew.reset( new XclExpTablesImpl5( GetRoot()));
 break;
 case EXC_BIFF8:
-pNew = new XclExpTablesImpl8( GetRoot());
+pNew.reset( new XclExpTablesImpl8( GetRoot()));
 break;
 default:
 assert(!"Unknown BIFF type!");
 continue;   // for
 }
-it = maTablesMap.insert( nTab, pNew).first;
+::std::pair< TablesMapType::iterator, bool > ins( 
maTablesMap.insert( ::std::make_pair( nTab, pNew)));
+if (!ins.second)
+{
+assert(!"XclExpTablesManager::Initialize - XclExpTables insert 
failed");
+continue;   // for
+}
+it = ins.first;
 }
-XclExpTables* p = it->second;
-p->AppendTable( pDBData, ++nTableId);
+it->second->AppendTable( pDBData, ++nTableId);
 }
 }
 
-XclExpTables* XclExpTablesManager::GetTablesBySheet( SCTAB nTab )
+::std::shared_ptr< XclExpTables > XclExpTablesManager::GetTablesBySheet( SCTAB 
nTab )
 {
 TablesMapType::iterator it = maTablesMap.find(nTab);
 return it == maTablesMap.end() ? nullptr : it->second;
diff --git a/sc/source/filter/inc/xedbdata.hxx 
b/sc/source/filter/inc/xedbdata.hxx
index f5dd980..4b31ffe 100644
--- a/sc/source/filter/inc/xedbdata.hxx
+++ b/sc/source/filter/inc/xedbdata.hxx
@@ -22,7 +22,6 @@
 
 #include "xeroot.hxx"
 #include "xerecord.hxx"
-#include 
 
 class ScDBData;
 class XclExpTablesManagerImpl;
@@ -44,7 +43,7 @@ protected:
 Entry( const ScDBData* pData, sal_Int32 nTableId );
 };
 
-typedef std::vector TablesType;
+typedef ::std::vector TablesType;
 TablesType maTables;
 
 static void SaveTableXml( XclExpXmlStream& rStrm, const Entry& 
rEntry );
@@ -59,10 +58,10 @@ public:
 virtual ~XclExpTablesManager();
 
 voidInitialize();
-XclExpTables*   GetTablesBySheet( SCTAB nTab );
+::std::shared_ptr< XclExpTables > GetTablesBySheet( SCTAB nTab );
 
 private:
-typedef boost::ptr_map< SCTAB, XclExpTables > TablesMapType;
+typedef ::std::map< SCTAB, ::std::shared_ptr< XclExpTables > > 
TablesMapType;
 TablesMapType maTablesMap;
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits