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

2017-11-09 Thread Eike Rathke
 sc/source/core/data/column.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 7f1297d9b4f449eb9ada8008fb21b7046d1a8f19
Author: Eike Rathke 
Date:   Thu Nov 2 12:53:14 2017 +0100

Resolves: tdf#111428 swap ScColumn::mnBlkCountFormula

 This is a combination of 2 commits.

(cherry picked from commit 423df1fa929784c14e3a133c06468589fe9269cd)
(cherry picked from commit 911e2aff3cc37cb7410292728ffea05fffbfb0b3)

CellStoreEvent remembered the original ScColumn::mnBlkCountFormula,
hence after inserting a column to the left the quick check of
ScColumn::HasFormulaCell() whether there are any formula cells worked on
the swapped in count (originally the one to the right) that happens to
be empty in the scenario. Things worked correctly by accident if the
next column to the right already contained a formula cell.

c44fed96c49bea7365bf1200e06788860966795c

Change-Id: If993856ceee657736f516a81c293506041a6b7eb
Reviewed-on: https://gerrit.libreoffice.org/44210
Reviewed-by: Markus Mohrhard 
Tested-by: Eike Rathke 
Reviewed-on: https://gerrit.libreoffice.org/44493

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index ac65f8a1b7ca..d868333c8b7a 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1891,6 +1891,9 @@ void ScColumn::SwapCol(ScColumn& rCol)
 maCellTextAttrs.swap(rCol.maCellTextAttrs);
 maCellNotes.swap(rCol.maCellNotes);
 
+// Swap all CellStoreEvent mdds event_func related.
+std::swap( mnBlkCountFormula, rCol.mnBlkCountFormula);
+
 // notes update caption
 UpdateNoteCaptions(0, MAXROW);
 rCol.UpdateNoteCaptions(0, MAXROW);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-10-04 Thread Eike Rathke
 sc/source/filter/xml/xmlcelli.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 8d9b236dcb3fd0f7028e4d19ede04589cf85d760
Author: Eike Rathke 
Date:   Mon Oct 2 16:13:34 2017 +0200

Resolves: tdf#112780 no ResetDirty() after SetHybridEmptyDisplayedAsString()

Change-Id: Idea5c1bd8e8577eaf90fc47d39f88c79963c422b
(cherry picked from commit df778416981ab02d42182e5c2e46dc09ba2e2a3c)
Reviewed-on: https://gerrit.libreoffice.org/43048
Reviewed-by: Markus Mohrhard 
Tested-by: Eike Rathke 

diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index 8fd7edae9d15..7b5a35f838c0 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1012,8 +1012,13 @@ void 
ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
 {
 pFCell->SetHybridDouble(fValue);
 if (mbPossibleEmptyDisplay && fValue == 0.0)
+{
+// Needs to be recalculated to propagate, otherwise would be
+// propagated as empty string. So don't ResetDirty().
 pFCell->SetHybridEmptyDisplayedAsString();
-pFCell->ResetDirty();
+}
+else
+pFCell->ResetDirty();
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-10-01 Thread Eike Rathke
 sc/source/filter/oox/sheetdatabuffer.cxx |   19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

New commits:
commit d4dad2989071eb5a21d608aa5c3782a68fddf571
Author: Eike Rathke 
Date:   Sat Sep 30 20:31:34 2017 +0200

Resolves: tdf#100822 use sax::Converter::parseDateTime() for 'd' ISO 8601 
date

Instead of squeezing the string through the locale dependent
number parser (which should force '.' Time100SecSeparator for 'T'
ISO 8601 but apparently doesn't yet) that is a bottle neck anyway.

Change-Id: I70f74e680322a715c9cc658c8be033620d9798e3
(cherry picked from commit 5374c04a89e1720490a3625dfd95406c2d60c0cd)
Reviewed-on: https://gerrit.libreoffice.org/42971
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx 
b/sc/source/filter/oox/sheetdatabuffer.cxx
index 44a0e02fdeb3..f4a6d3cb704a 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -54,6 +54,7 @@
 #include "documentimport.hxx"
 #include "formulabuffer.hxx"
 #include 
+#include 
 
 namespace oox {
 namespace xls {
@@ -215,15 +216,17 @@ void SheetDataBuffer::setErrorCell( const CellModel& 
rModel, sal_uInt8 nErrorCod
 
 void SheetDataBuffer::setDateCell( const CellModel& rModel, const OUString& 
rDateString )
 {
-ScDocument& rDoc = getScDocument();
-SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
-
-double fValue = 0.0;
-sal_uInt32 nFormatIndex = 0;
-bool bValid = pFormatter->IsNumberFormat( rDateString, nFormatIndex, 
fValue );
+css::util::DateTime aDateTime;
+if (!sax::Converter::parseDateTime( aDateTime, nullptr, rDateString))
+{
+SAL_WARN("sc.filter", "SheetDataBuffer::setDateCell - could not parse: 
" << rDateString);
+// At least don't lose data.
+setStringCell( rModel, rDateString);
+return;
+}
 
-if(bValid)
-setValueCell( rModel, fValue );
+double fSerial = getUnitConverter().calcSerialFromDateTime( aDateTime);
+setValueCell( rModel, fSerial);
 }
 
 void SheetDataBuffer::createSharedFormula(const ScAddress& rAddr, const 
ApiTokenSequence& rTokens)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-09-29 Thread Eike Rathke
 sc/source/core/tool/interpr1.cxx |8 ++--
 sc/source/core/tool/scmatrix.cxx |8 
 2 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 149f28e9a5d66db18ffb36547b2ba394c303fc4d
Author: Eike Rathke 
Date:   Mon Sep 4 12:57:16 2017 +0200

Resolves: tdf#103734 propagate error from matrix to MIN()/MAX()

(cherry picked from commit 9e694c747954078442d47d3d7bd1d4db283b96ff)

 Conflicts:
sc/source/core/tool/interpr1.cxx

Backported.

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

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 22ae9153e5c9..16a902e21171 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -3510,7 +3510,9 @@ void ScInterpreter::ScMin( bool bTextAsZero )
 SetError(FormulaError::IllegalParameter);
 }
 }
-if ( nVal < nMin  )
+if (!rtl::math::isFinite(nVal))
+PushError( GetDoubleErrorValue( nVal));
+else if ( nVal < nMin  )
 PushDouble(0.0);
 else
 PushDouble(nMin);
@@ -3605,7 +3607,9 @@ void ScInterpreter::ScMax( bool bTextAsZero )
 SetError(FormulaError::IllegalParameter);
 }
 }
-if ( nVal > nMax  )
+if (!rtl::math::isFinite(nVal))
+PushError( GetDoubleErrorValue( nVal));
+else if ( nVal > nMax  )
 PushDouble(0.0);
 else
 PushDouble(nMax);
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 30fb6eb0b36f..ae64e61234af 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -1385,6 +1385,10 @@ struct MaxOp
 static double init() { return -std::numeric_limits::max(); }
 static double compare(double left, double right)
 {
+if (!rtl::math::isFinite(left))
+return left;
+if (!rtl::math::isFinite(right))
+return right;
 return std::max(left, right);
 }
 
@@ -1403,6 +1407,10 @@ struct MinOp
 static double init() { return std::numeric_limits::max(); }
 static double compare(double left, double right)
 {
+if (!rtl::math::isFinite(left))
+return left;
+if (!rtl::math::isFinite(right))
+return right;
 return std::min(left, right);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-09-29 Thread Eike Rathke
 sc/source/ui/app/inputhdl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f38e9f1d194e23e455c69e9417185986daeccc39
Author: Eike Rathke 
Date:   Wed Sep 27 18:58:07 2017 +0200

Resolves: tdf#112523 do not use anything Ascii in UI context

Change-Id: I0854f7b1e6e0bf51d8b4c7d846fad9b0ff25e763
(cherry picked from commit 86910087fa41956aad6a22943bfbeb158e205dcd)
Reviewed-on: https://gerrit.libreoffice.org/42872
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index e0712c4671f8..6b22c877f888 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1294,7 +1294,7 @@ namespace {
 
 bool needToExtendSelection(const OUString& rSelectedText, const OUString& 
rInsertText)
 {
-return !rInsertText.startsWithIgnoreAsciiCase(rSelectedText);
+return !ScGlobal::GetpTransliteration()->isMatch( rSelectedText, 
rInsertText);
 }
 
 void completeFunction( EditView* pView, const OUString& rInsert, bool& 
rParInserted )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-09-18 Thread Caolán McNamara
 sc/source/ui/docshell/impex.cxx |   10 ++
 1 file changed, 10 insertions(+)

New commits:
commit 51854f5432de42bcc1154469edb5395328870613
Author: Caolán McNamara 
Date:   Mon Sep 18 15:40:16 2017 +0100

ofz#3412 SYLK import: check ;X;Y;C;R col/row validity early

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

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 7aa39d385a9c..a65f985541e6 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1917,9 +1917,19 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm )
 {
 case 'X':
 nCol = static_cast(OUString(p).toInt32()) + 
nStartCol - 1;
+if (nCol < 0 || MAXCOL < nCol)
+{
+SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - 
;X invalid nCol=" << nCol);
+nCol = std::max( 0, std::min( 
nCol, MAXCOL));
+}
 break;
 case 'Y':
 nRow = OUString(p).toInt32() + nStartRow - 1;
+if (nRow < 0 || MAXROW < nRow)
+{
+SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - 
;Y invalid nRow=" << nRow);
+nRow = std::max( 0, std::min( 
nRow, MAXROW));
+}
 break;
 case 'P' :
 if ( bData )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-09-14 Thread Eike Rathke
 sc/source/ui/docshell/impex.cxx |   20 
 1 file changed, 20 insertions(+)

New commits:
commit c759f30a5220dfd29894e34ee16c3fe2bf415592
Author: Eike Rathke 
Date:   Thu Sep 14 14:30:08 2017 +0200

ofz#3362 SYLK import: check ;X;Y;C;R col/row validity early

Change-Id: I37d5ce67f975b6b89c4b8a9baefae2467da2eb84
(cherry picked from commit 34ac0f9a0376b43bcff78a49ccaf4caa34c8c990)
Reviewed-on: https://gerrit.libreoffice.org/42278
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 0f0db15d30dc..7aa39d385a9c 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1776,15 +1776,35 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm )
 {
 case 'X':
 nCol = static_cast(OUString(p).toInt32()) + 
nStartCol - 1;
+if (nCol < 0 || MAXCOL < nCol)
+{
+SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - 
;X invalid nCol=" << nCol);
+nCol = std::max( 0, std::min( 
nCol, MAXCOL));
+}
 break;
 case 'Y':
 nRow = OUString(p).toInt32() + nStartRow - 1;
+if (nRow < 0 || MAXROW < nRow)
+{
+SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - 
;Y invalid nRow=" << nRow);
+nRow = std::max( 0, std::min( 
nRow, MAXROW));
+}
 break;
 case 'C':
 nRefCol = 
static_cast(OUString(p).toInt32()) + nStartCol - 1;
+if (nRefCol < 0 || MAXCOL < nRefCol)
+{
+SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - 
;C invalid nRefCol=" << nRefCol);
+nRefCol = std::max( 0, std::min( 
nRefCol, MAXCOL));
+}
 break;
 case 'R':
 nRefRow = OUString(p).toInt32() + nStartRow - 1;
+if (nRefRow < 0 || MAXROW < nRefRow)
+{
+SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - 
;R invalid nRefRow=" << nRefRow);
+nRefRow = std::max( 0, std::min( 
nRefRow, MAXROW));
+}
 break;
 case 'K':
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-08-22 Thread Eike Rathke
 sc/source/core/tool/scmatrix.cxx |   17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 8d8044d25a6d112854655ef0ad51f1a904350f0f
Author: Eike Rathke 
Date:   Mon Aug 21 15:49:41 2017 +0200

Resolves: tdf#111943 really really limit the match, tdf#108292 follow-up

getRemainingCount() could deliver a wrapped around overflow value if mnIndex
was already greater than the end index, which could happen if when/for
non-matching larger block sizes were added, and if then a match was found
behind those blocks a non-requested/unexpected index was returned, which in
turn led to the assert() being hit in ScInterpreter::CalculateLookup(). In
non-debug could result in an invalid block position access.

This happened with the bug case document of tdf#111943 which in master can 
be
loaded.

Also, the start and end index are not dynamic and don't have to be 
recalculated
each time, so make them const; column argument values are unused after.

(cherry picked from commit 25b3806ac509006573e669acc33643af3bd77380)

Change-Id: Ic294cade4e8e7828bee394e5ade61d7127be6bbb
Reviewed-on: https://gerrit.libreoffice.org/41397
Tested-by: Jenkins 
Reviewed-by: Christian Lohmaier 

diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 1807a11c53cc..30fb6eb0b36f 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -1264,24 +1264,25 @@ template
 class WalkAndMatchElements : public 
std::unary_function
 {
 Type maMatchValue;
-MatrixImplType::size_pair_type maSize;
-size_t mnCol1;
-size_t mnCol2;
+const size_t mnStartIndex;
+const size_t mnStopIndex;
 size_t mnResult;
 size_t mnIndex;
 
 public:
 WalkAndMatchElements(Type aMatchValue, const 
MatrixImplType::size_pair_type& aSize, size_t nCol1, size_t nCol2) :
 maMatchValue(aMatchValue),
-maSize(aSize),
-mnCol1(nCol1),
-mnCol2(nCol2),
+mnStartIndex( nCol1 * aSize.row ),
+mnStopIndex( (nCol2 + 1) * aSize.row ),
 mnResult(ResultNotSet),
 mnIndex(0) {}
 
 size_t getMatching() const { return mnResult; }
 
-size_t getRemainingCount() const { return ((mnCol2 + 1) * maSize.row) - 
mnIndex; }
+size_t getRemainingCount() const
+{
+return mnIndex < mnStopIndex ? mnStopIndex - mnIndex : 0;
+}
 
 size_t compare(const MatrixImplType::element_block_node_type& node) const;
 
@@ -1292,7 +1293,7 @@ public:
 return;
 
 // limit lookup to the requested columns
-if ((mnCol1 * maSize.row) <= mnIndex && getRemainingCount() > 0)
+if (mnStartIndex <= mnIndex && getRemainingCount() > 0)
 {
 mnResult = compare(node);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-08-18 Thread Julien Nabet
 sc/source/core/tool/interpr7.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit fdaee404f3216441d6b78636c0defae580f26034
Author: Julien Nabet 
Date:   Sat Aug 12 12:34:46 2017 +0200

tdf#109104: respect RFC3986 for newlines in ScEncodeURL

Quotation of RFC3986:
A percent-encoded octet is encoded as a character
triplet, consisting of the percent character "%" followed by the two
hexadecimal digits representing that octet's numeric value
So test the length of the return of OString::number and add "0" if needed

ScEncodeURL was added with:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=25434372bf56e0ebdb7e7d47ab3c14c68211509f

Thank you to Bele (the bugtracker reporter) for code pointer!

Change-Id: I8df102eb38b31933c6ebb15bb25c125b423f722b
Reviewed-on: https://gerrit.libreoffice.org/41086
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
(cherry picked from commit dabba2e3368c2e2ae4ab03ddcfc667e13f89841d)
Reviewed-on: https://gerrit.libreoffice.org/41279

diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index b226717c2935..48a34b3ece36 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -325,7 +325,14 @@ void ScInterpreter::ScEncodeURL()
 else
 {
 aUrlBuf.append( '%' );
-aUrlBuf.append( OString::number( static_cast( c 
), 16 ).toAsciiUpperCase() );
+OString convertedChar = OString::number( static_cast( c ), 16 ).toAsciiUpperCase();
+// RFC 3986 indicates:
+// "A percent-encoded octet is encoded as a character triplet,
+// consisting of the percent character "%" followed by the two 
hexadecimal digits
+// representing that octet's numeric value"
+if (convertedChar.getLength() == 1)
+aUrlBuf.append("0");
+aUrlBuf.append(convertedChar);
 }
 }
 PushString( OUString::fromUtf8( aUrlBuf.makeStringAndClear() ) );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-08-01 Thread Caolán McNamara
 sc/source/ui/undo/undotab.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit def36294754a7263101b421166195eb1b95d6d6f
Author: Caolán McNamara 
Date:   Tue Aug 1 11:34:22 2017 +0100

Related: tdf#109856 redo 'insert multiple tabs after' inserts too many tabs

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

diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index 7245cc99a1f6..7a8311525e8a 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -226,7 +226,6 @@ void ScUndoInsertTables::Redo()
 
 pDocShell->SetInUndo( true );   //! BeginRedo
 bDrawIsInUndo = true;
-pViewShell->SetTabNo(nTab);
 pViewShell->InsertTables( aNameList, nTab, 
static_cast(aNameList.size()),false );
 
 bDrawIsInUndo = 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-3' - sc/source

2017-08-01 Thread Caolán McNamara
 sc/source/core/data/document.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b8db40fb2eb39c4330de475a7cc8155d16479218
Author: Caolán McNamara 
Date:   Tue Aug 1 09:16:28 2017 +0100

Resolves: tdf#109856 undo 'insert multiple tabs after' doesn't work

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

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 3b968eb79e02..54cb77bafedc 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -786,7 +786,7 @@ void ScDocument::ClearTabs()
 bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets )
 {
 bool bValid = false;
-if (ValidTab(nTab) && (nTab + nSheets) < static_cast(maTabs.size()))
+if (ValidTab(nTab) && (nTab + nSheets) <= 
static_cast(maTabs.size()))
 {
 if (maTabs[nTab])
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-07-28 Thread Caolán McNamara
 sc/source/ui/Accessibility/AccessibleDocument.cxx |   24 +++-
 sc/source/ui/inc/tabvwsh.hxx  |1 
 sc/source/ui/unoobj/viewuno.cxx   |   63 +++---
 3 files changed, 45 insertions(+), 43 deletions(-)

New commits:
commit 5e2ffa0b2eb7623d0c9ed37c30caea1452810646
Author: Caolán McNamara 
Date:   Thu Jul 27 15:41:16 2017 +0100

Resolves: tdf#106872 only request selected shapes

that way we can avoid the super slow code path for filtered
rows when we only care about selected shapes

Change-Id: I175fa841e406dbbe7075296f2e0a0e79fa115fb7
Reviewed-on: https://gerrit.libreoffice.org/40496
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
(cherry picked from commit 192d97cdf091af08a492416824918ea447bfb16f)

Related: tdf#106872 factor out getting selected shapes

Change-Id: I765c482a41e9681a1eb145c1833cc94f35a27db3
(cherry picked from commit 221dae68df80298e81e6e6549636f3528f5c8bc3)
Reviewed-on: https://gerrit.libreoffice.org/40519
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx 
b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 664f0cf951aa..611b3337f771 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -347,7 +347,7 @@ ScChildrenShapes::ScChildrenShapes(ScAccessibleDocument* 
pAccessibleDocument, Sc
 {
 if (mpAccessibleDocument)
 
xSelectionSupplier->addSelectionChangeListener(mpAccessibleDocument);
-uno::Reference xShapes 
(xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+uno::Reference 
xShapes(mpViewShell->getSelectedXShapes());
 if (xShapes.is())
 mnShapesSelected = xShapes->getCount();
 }
@@ -364,7 +364,7 @@ ScChildrenShapes::ScChildrenShapes(ScAccessibleDocument* 
pAccessibleDocument, Sc
 if (!xSelectionSupplier.is())
 throw uno::RuntimeException();
 
-uno::Reference 
xShapes(xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+uno::Reference 
xShapes(mpViewShell->getSelectedXShapes());
 if (xShapes.is())
 FindSelectedShapesChanges(xShapes, false);
 }
@@ -660,8 +660,8 @@ bool ScChildrenShapes::IsSelected(sal_Int32 nIndex,
 #if OSL_DEBUG_LEVEL > 0 // test whether it is truly selected by a slower method
 uno::Reference< drawing::XShape > xReturnShape;
 bool bDebugResult(false);
-uno::Reference xIndexAccess;
-xSelectionSupplier->getSelection() >>= xIndexAccess;
+uno::Reference 
xShapes(mpViewShell->getSelectedXShapes());
+uno::Reference xIndexAccess(xShapes, 
uno::UNO_QUERY);
 
 if (xIndexAccess.is())
 {
@@ -696,7 +696,7 @@ bool ScChildrenShapes::SelectionChanged()
 if (!xSelectionSupplier.is())
 throw uno::RuntimeException();
 
-uno::Reference 
xShapes(xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+uno::Reference 
xShapes(mpViewShell->getSelectedXShapes());
 
 bResult = FindSelectedShapesChanges(xShapes, true);
 
@@ -717,8 +717,7 @@ void ScChildrenShapes::Select(sal_Int32 nIndex)
 uno::Reference xShape;
 if (!IsSelected(nIndex, xShape) && maZOrderedShapes[nIndex]->bSelectable)
 {
-uno::Reference xShapes;
-xSelectionSupplier->getSelection() >>= xShapes;
+uno::Reference 
xShapes(mpViewShell->getSelectedXShapes());
 
 if (!xShapes.is())
 xShapes = drawing::ShapeCollection::create(
@@ -786,9 +785,8 @@ void ScChildrenShapes::SelectAll()
 
 void ScChildrenShapes::FillShapes(std::vector < uno::Reference < 
drawing::XShape > >& rShapes) const
 {
-uno::Reference xIndexAccess;
-xSelectionSupplier->getSelection() >>= xIndexAccess;
-
+uno::Reference 
xShapes(mpViewShell->getSelectedXShapes());
+uno::Reference xIndexAccess(xShapes, 
uno::UNO_QUERY);
 if (xIndexAccess.is())
 {
 sal_uInt32 nCount(xIndexAccess->getCount());
@@ -873,8 +871,7 @@ void ScChildrenShapes::Deselect(sal_Int32 nChildIndex)
 {
 if (xShape.is())
 {
-uno::Reference xShapes;
-xSelectionSupplier->getSelection() >>= xShapes;
+uno::Reference 
xShapes(mpViewShell->getSelectedXShapes());
 if (xShapes.is())
 xShapes->remove(xShape);
 
@@ -1260,7 +1257,8 @@ void ScChildrenShapes::AddShape(const 
uno::Reference& xShape, b
 if (!xSelectionSupplier.is())
 throw uno::RuntimeException();
 
-uno::Reference 
xEnumAcc(xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+uno::Reference 
xShapes(mpViewShell->getSelectedXShapes());
+uno::Reference xEnumAcc(xShapes, 
uno::UNO_QUERY);
 if (xEnumAcc.is())
 {
 

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

2017-07-28 Thread Caolán McNamara
 sc/source/core/tool/compiler.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit a9a1306266e2fc67e8ac3029584d7a264fe37ff0
Author: Caolán McNamara 
Date:   Fri Jul 28 11:53:46 2017 +0100

ofz: survive missing macro support

Change-Id: Ica9c66fe09f7340f76f62e536527dc63b3735d90
(cherry picked from commit aa529a1957fce324c500753039ae7766b8dcf6a6)
Reviewed-on: https://gerrit.libreoffice.org/40523
Reviewed-by: Eike Rathke 
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 b9b3a192a2ef..e0f67fc1b5ef 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3335,6 +3335,9 @@ bool ScCompiler::IsMacro( const OUString& rName )
 return false;
 }
 
+if (!pObj)
+return false;
+
 // ODFF recommends to store user-defined functions prefixed with "USER.",
 // use only unprefixed name if encountered. BASIC doesn't allow '.' in a
 // function name so a function "USER.FOO" could not exist, and macro check
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-07-27 Thread Caolán McNamara
 sc/source/ui/Accessibility/AccessibleDocument.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 09716380e12ac2b7119afff20033ce2e7929ebd8
Author: Caolán McNamara 
Date:   Thu Jul 27 15:07:06 2017 +0100

Related: tdf#106872 amount of a11y selection listeners constantly grows

so it gets progressively slower

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

diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx 
b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 79b1a48b6378..664f0cf951aa 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -394,6 +394,8 @@ ScChildrenShapes::~ScChildrenShapes()
 if (pDrawBC)
 EndListening(*pDrawBC);
 }
+if (mpAccessibleDocument && xSelectionSupplier.is())
+
xSelectionSupplier->removeSelectionChangeListener(mpAccessibleDocument);
 }
 
 void ScChildrenShapes::SetDrawBroadcaster()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-07-20 Thread Eike Rathke
 sc/source/ui/view/viewfunc.cxx |   26 ++
 1 file changed, 22 insertions(+), 4 deletions(-)

New commits:
commit c967cebeab0d5b343bd33d3a6f758aeaa40258f8
Author: Eike Rathke 
Date:   Mon Jul 17 11:36:29 2017 +0200

Resolves: tdf#75650 reset boolean number format to General for new formula

Change-Id: Iec2feefcbb5a92c64f182d93b4055fc009dbe1e5
(cherry picked from commit 1c1783864a356a4394f80dec28db939f4cf572cd)
Reviewed-on: https://gerrit.libreoffice.org/40053
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 1b5a9b210849..de4f1b23cc58 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -507,10 +507,11 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB 
nTab,
 {
 i = *itr;
 aPos.SetTab( i );
-sal_uLong nIndex = (sal_uLong) static_cast( 
pDoc->GetAttr(
-nCol, nRow, i, ATTR_VALUE_FORMAT ))->GetValue();
-if ( pFormatter->GetType( nIndex ) == 
css::util::NumberFormat::TEXT ||
- ( ( rString[0] == '+' || rString[0] == '-' ) && nError != 
FormulaError::NONE && rString == aFormula ) )
+const sal_uInt32 nIndex = static_cast( 
pDoc->GetAttr(
+nCol, nRow, i, ATTR_VALUE_FORMAT ))->GetValue();
+const sal_Int16 nType = pFormatter->GetType( nIndex);
+if (nType == css::util::NumberFormat::TEXT ||
+((rString[0] == '+' || rString[0] == '-') && nError != 
FormulaError::NONE && rString == aFormula))
 {
 if ( pData )
 {
@@ -530,6 +531,23 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB 
nTab,
 if(pCell->GetCode()->IsHyperLink())
 pCell->GetCode()->SetHyperLink(false);
 }
+if (nType == css::util::NumberFormat::LOGICAL)
+{
+// Reset to General so the actual format can be determined
+// after the cell has been interpreted. A sticky boolean
+// number format is highly likely unwanted.. see tdf#75650.
+// General of same locale as current number format.
+const SvNumberformat* pEntry = pFormatter->GetEntry( 
nIndex);
+const LanguageType nLang = (pEntry ? pEntry->GetLanguage() 
: ScGlobal::eLnge);
+const sal_uInt32 nFormat = pFormatter->GetStandardFormat( 
css::util::NumberFormat::NUMBER, nLang);
+ScPatternAttr aPattern( pDoc->GetPool());
+aPattern.GetItemSet().Put( SfxUInt32Item( 
ATTR_VALUE_FORMAT, nFormat));
+ScMarkData aMark;
+aMark.SelectTable( i, true);
+aMark.SetMarkArea( ScRange( ScAddress( nCol, nRow, i)));
+rFunc.ApplyAttributes( aMark, aPattern, false);
+bNumFmtChanged = true;
+}
 rFunc.SetFormulaCell(aPos, pCell, 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-3' - sc/source

2017-07-20 Thread Eike Rathke
 sc/source/core/data/document.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit c5917736e39ff1e5d6995f93e9108082a87d9e35
Author: Eike Rathke 
Date:   Thu Jul 6 17:06:14 2017 +0200

Blind fix tdf#108612 explicitly checking for and against clipboard document

 This is a combination of 2 commits.

Attempt to blind fix tdf#108612 explicitly checking for clipboard document

It seems that for some yet unknown reason in an (un)certain constellation
ScDocument::IsClipboardSource() returns true because ScModule::GetClipDoc()
does not return the clipboard document but the actual document instead, so
destroying the clipboard document executes 
ScDocument::ClosingClipboardSource()
and (or in earlier versions) ScDocument::ForgetNoteCaptions() on the actual
document instead.

Check also that ScDocument::bIsClip is set, hopefully curing the symptom, 
the
real cause is something else.

(cherry picked from commit d5020f35aec54f0241fa58557dc6caadc149f5a9)

Another attempt to blind fix tdf#108612

Oddly in that scenario on Windows there are two clipboard documents alive 
when
destroying one, so the destroyed one erroneously is said to be a clipboard
source and then detachs the comments' caption information.

There's no legit case where a clipboard document could actually be the real
original source of another clipboard document, so bail out if the caller
already is one.

(cherry picked from commit 52e09f2c03f7cc024b2973c4806283c324fc23df)

0f8d240d8ec13bf91b77176dc6439a541cf14eaa

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

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 931d44a550d1..3b968eb79e02 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2524,8 +2524,11 @@ void ScDocument::SetClipParam(const ScClipParam& rParam)
 
 bool ScDocument::IsClipboardSource() const
 {
+if (bIsClip)
+return false;
+
 ScDocument* pClipDoc = ScModule::GetClipDoc();
-return xPoolHelper.is() && pClipDoc && pClipDoc->xPoolHelper.is() &&
+return pClipDoc && pClipDoc->bIsClip && pClipDoc->xPoolHelper.is() && 
xPoolHelper.is() &&
 xPoolHelper->GetDocPool() == pClipDoc->xPoolHelper->GetDocPool();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-07-14 Thread Dennis Francis
 sc/source/core/data/formulacell.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 951af0302f60dfd5fc082552d85d8ddb522fc5a2
Author: Dennis Francis 
Date:   Thu Jul 13 11:35:41 2017 +0530

tdf#108758 : do not write to undo document when...

...updating references during a block move, for formula cells
that are in the target range of the move operation.

The fix is for formula cells that are not grouped. For the
grouped case, it was already doing correctly.

Added two unit tests in ucalc_formula.cxx for grouped formula
and non-grouped formula cases.

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

 Conflicts:
sc/qa/unit/ucalc.hxx
sc/qa/unit/ucalc_formula.cxx

Backported, excluding conflicting unit tests.

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

diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index b19bfba89bc9..381fb173d4b7 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3201,7 +3201,9 @@ bool ScFormulaCell::UpdateReferenceOnMove(
 aUndoPos = *pUndoCellPos;
 ScAddress aOldPos( aPos );
 
-if (rCxt.maRange.In(aPos))
+bool bCellInMoveTarget = rCxt.maRange.In(aPos);
+
+if ( bCellInMoveTarget )
 {
 // The cell is being moved or copied to a new position. I guess the
 // position has been updated prior to this call?  Determine
@@ -3290,7 +3292,7 @@ bool ScFormulaCell::UpdateReferenceOnMove(
  (bValChanged && bHasRelName ) || bOnRefMove)
 bNeedDirty = true;
 
-if (pUndoDoc && (bValChanged || bRefModified || bOnRefMove))
+if (pUndoDoc && !bCellInMoveTarget && (bValChanged || bRefModified || 
bOnRefMove))
 setOldCodeToUndo(pUndoDoc, aUndoPos, pOldCode.get(), eTempGrammar, 
cMatrixFlag);
 
 bValChanged = 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-3' - sc/source

2017-07-09 Thread Sean Stangl
 sc/source/filter/html/htmlexp.cxx |   15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

New commits:
commit 884979ebe7d464e8b29d331a58ddf943bc9030df
Author: Sean Stangl 
Date:   Sat Jul 8 22:33:48 2017 -0700

tdf#79304 - Handle CrossedOutItems in HTML export.

Change-Id: I766fedb34737a1a7815693bf496fa08c08f492b1
Reviewed-on: https://gerrit.libreoffice.org/39719
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 
(cherry picked from commit 2f2eba56d1f8ec5cdcadb4852e8856858477c008)
Reviewed-on: https://gerrit.libreoffice.org/39722
Tested-by: Jenkins 

diff --git a/sc/source/filter/html/htmlexp.cxx 
b/sc/source/filter/html/htmlexp.cxx
index 4177226146fc..c376672332bf 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -979,6 +980,9 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB 
nTab )
 const SvxUnderlineItem& rUnderlineItem = static_cast(
 pAttr->GetItem( ATTR_FONT_UNDERLINE, pCondItemSet ) );
 
+const SvxCrossedOutItem& rCrossedOutItem = static_cast(
+pAttr->GetItem( ATTR_FONT_CROSSEDOUT, pCondItemSet ) );
+
 const SvxColorItem& rColorItem = static_cast( 
pAttr->GetItem(
 ATTR_FONT_COLOR, pCondItemSet ) );
 
@@ -997,10 +1001,11 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, 
SCTAB nTab )
 else
 aBgColor = rBrushItem.GetColor();
 
-bool bBold  = ( WEIGHT_BOLD <= rWeightItem.GetWeight() );
-bool bItalic= ( ITALIC_NONE != rPostureItem.GetPosture() );
-bool bUnderline = ( LINESTYLE_NONE  != rUnderlineItem.GetLineStyle() );
-bool bSetFontColor  = ( COL_AUTO!= 
rColorItem.GetValue().GetColor() );  // default is AUTO now
+bool bBold  = ( WEIGHT_BOLD  <= rWeightItem.GetWeight() );
+bool bItalic= ( ITALIC_NONE  != rPostureItem.GetPosture() );
+bool bUnderline = ( LINESTYLE_NONE   != rUnderlineItem.GetLineStyle() 
);
+bool bCrossedOut= ( STRIKEOUT_SINGLE <= rCrossedOutItem.GetStrikeout() 
);
+bool bSetFontColor  = ( COL_AUTO != 
rColorItem.GetValue().GetColor() );  // default is AUTO now
 bool bSetFontName   = ( aHTMLStyle.aFontFamilyName  != 
rFontItem.GetFamilyName() );
 sal_uInt16 nSetFontSizeNumber = 0;
 sal_uInt32 nFontHeight = rFontHeightItem.GetHeight();
@@ -1102,6 +1107,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, 
SCTAB nTab )
 if ( bBold )TAG_ON( OOO_STRING_SVTOOLS_HTML_bold );
 if ( bItalic )  TAG_ON( OOO_STRING_SVTOOLS_HTML_italic );
 if ( bUnderline )   TAG_ON( OOO_STRING_SVTOOLS_HTML_underline );
+if ( bCrossedOut )  TAG_ON( OOO_STRING_SVTOOLS_HTML_strikethrough );
 
 if ( bSetFont )
 {
@@ -1199,6 +1205,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, 
SCTAB nTab )
 WriteGraphEntry( pGraphEntry );
 
 if ( bSetFont ) TAG_OFF( OOO_STRING_SVTOOLS_HTML_font );
+if ( bCrossedOut )  TAG_OFF( OOO_STRING_SVTOOLS_HTML_strikethrough );
 if ( bUnderline )   TAG_OFF( OOO_STRING_SVTOOLS_HTML_underline );
 if ( bItalic )  TAG_OFF( OOO_STRING_SVTOOLS_HTML_italic );
 if ( bBold )TAG_OFF( OOO_STRING_SVTOOLS_HTML_bold );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-07-03 Thread Markus Mohrhard
 sc/source/ui/docshell/docsh4.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 20ca5b5fae58ee46362fbd4c5f51ee21e89c3c35
Author: Markus Mohrhard 
Date:   Wed Jun 28 02:15:04 2017 +0200

handle SID_ENCRYPTIONDATA for shared password protected docs, tdf#56173

Change-Id: Iadfe880b7be3186410a08568844d8812f176005d
Reviewed-on: https://gerrit.libreoffice.org/39332
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit 669c12d59b6131f44945f166c77ae98df52ebb9e)
Reviewed-on: https://gerrit.libreoffice.org/39337
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 63a2db5e8f32..81dbf194d0c7 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -2400,6 +2400,13 @@ uno::Reference< frame::XModel > 
ScDocShell::LoadSharedDocument()
 aArgs[1].Name = "Password";
 aArgs[1].Value <<= pPasswordItem->GetValue();
 }
+const SfxUnoAnyItem* pEncryptionItem = 
SfxItemSet::GetItem(GetMedium()->GetItemSet(), 
SID_ENCRYPTIONDATA, false);
+if (pEncryptionItem)
+{
+aArgs.realloc(aArgs.getLength() + 1);
+aArgs[aArgs.getLength() - 1].Name = "EncryptionData";
+aArgs[aArgs.getLength() - 1].Value = 
pEncryptionItem->GetValue();
+}
 }
 
 xModel.set(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-07-03 Thread Markus Mohrhard
 sc/source/filter/oox/pagesettings.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ae56c986718871b6bf098162c2b8b4c44b82
Author: Markus Mohrhard 
Date:   Wed Jun 28 04:16:51 2017 +0200

always import page scaling, tdf#65848

Change-Id: If5bad2336443280dd33d750b1b2749a06f2b5101
Reviewed-on: https://gerrit.libreoffice.org/39334
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit fef72f9623bac7f9aa50b4f2606e6ec6282cfe1f)
Reviewed-on: https://gerrit.libreoffice.org/39340
Reviewed-by: Eike Rathke 

diff --git a/sc/source/filter/oox/pagesettings.cxx 
b/sc/source/filter/oox/pagesettings.cxx
index 5af216a589d4..a34aca50b88b 100644
--- a/sc/source/filter/oox/pagesettings.cxx
+++ b/sc/source/filter/oox/pagesettings.cxx
@@ -911,7 +911,7 @@ void PageSettingsConverter::writePageSettingsProperties(
 else
 {
 // scale may be 0 which indicates uninitialized
-sal_Int16 nScale = (rModel.mbValidSettings && (rModel.mnScale > 0)) ? 
getLimitedValue< sal_Int16, sal_Int32 >( rModel.mnScale, 10, 400 ) : 100;
+sal_Int16 nScale = (rModel.mnScale > 0) ? getLimitedValue< sal_Int16, 
sal_Int32 >( rModel.mnScale, 10, 400 ) : 100;
 rPropSet.setProperty( PROP_PageScale, nScale );
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-07-03 Thread Markus Mohrhard
 sc/source/core/data/documen7.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 6c60005326c4a84a91f6fc6de864a66e5e42b310
Author: Markus Mohrhard 
Date:   Fri Jun 30 13:59:57 2017 +0200

pBASM can be nullptr in copy docs, e.g. during insert sheet from doc

Found through 
http://crashreport.libreoffice.org/stats/crash_details/3bd264ba-ec12-476a-9bb4-e832caca3445

Change-Id: I0a4e6dddca61a2538c0fe6bbc51770a9886c464d
Reviewed-on: https://gerrit.libreoffice.org/39411
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
Reviewed-on: https://gerrit.libreoffice.org/39426
Reviewed-by: Eike Rathke 

diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 437cf4c815e6..58ce9827f2ca 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -558,6 +558,9 @@ void ScDocument::FinalTrackFormulas( sal_uInt32 nHintId )
  */
 void ScDocument::TrackFormulas( sal_uInt32 nHintId )
 {
+if (!pBASM)
+return;
+
 if (pBASM->IsInBulkBroadcast() && !IsFinalTrackFormulas() && nHintId == 
SC_HINT_DATACHANGED)
 {
 SetTrackFormulasPending();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-07-01 Thread Eike Rathke
 sc/source/core/tool/token.cxx |   59 ++
 1 file changed, 59 insertions(+)

New commits:
commit 777103737f9b20f680d9c9f3d0610e91383f7499
Author: Eike Rathke 
Date:   Wed Jun 21 19:42:36 2017 +0200

Resolves: tdf#108671 mark named expression single reference #REF! if deleted

Probably broken already since

commit f77c9d5b3cb65d9c2e2417f60bec1113feac50e1
Date:   Mon Jul 29 14:47:07 2013 -0400

Change-Id: If90a959d000a1bf5ab0804deb22d5cfad413ea5e
(cherry picked from commit 6580e171ad054dca38f55822e67a400191cecdf5)
Reviewed-on: https://gerrit.libreoffice.org/39072
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index bf25d135f728..584502f17c1f 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3640,6 +3640,65 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceInName(
 case svSingleRef:
 {
 ScSingleRefData& rRef = *p->GetSingleRef();
+if (rCxt.mnRowDelta < 0)
+{
+// row(s) deleted.
+
+if (rRef.IsRowRel())
+// Don't modify relative references in names.
+break;
+
+ScAddress aAbs = rRef.toAbs(rPos);
+
+if (aAbs.Col() < rCxt.maRange.aStart.Col() || 
rCxt.maRange.aEnd.Col() < aAbs.Col())
+// column of the reference is not in the 
deleted column range.
+break;
+
+if (aAbs.Tab() > rCxt.maRange.aEnd.Tab() || 
aAbs.Tab() < rCxt.maRange.aStart.Tab())
+// wrong tables
+break;
+
+const SCROW nDelStartRow = 
rCxt.maRange.aStart.Row() + rCxt.mnRowDelta;
+const SCROW nDelEndRow = nDelStartRow - 
rCxt.mnRowDelta - 1;
+
+if (nDelStartRow <= aAbs.Row() && aAbs.Row() <= 
nDelEndRow)
+{
+// This reference is deleted.
+rRef.SetRowDeleted(true);
+aRes.mbReferenceModified = true;
+break;
+}
+}
+else if (rCxt.mnColDelta < 0)
+{
+// column(s) deleted.
+
+if (rRef.IsColRel())
+// Don't modify relative references in names.
+break;
+
+ScAddress aAbs = rRef.toAbs(rPos);
+
+if (aAbs.Row() < rCxt.maRange.aStart.Row() || 
rCxt.maRange.aEnd.Row() < aAbs.Row())
+// row of the reference is not in the deleted 
row range.
+break;
+
+if (aAbs.Tab() > rCxt.maRange.aEnd.Tab() || 
aAbs.Tab() < rCxt.maRange.aStart.Tab())
+// wrong tables
+break;
+
+const SCCOL nDelStartCol = 
rCxt.maRange.aStart.Col() + rCxt.mnColDelta;
+const SCCOL nDelEndCol = nDelStartCol - 
rCxt.mnColDelta - 1;
+
+if (nDelStartCol <= aAbs.Col() && aAbs.Col() <= 
nDelEndCol)
+{
+// This reference is deleted.
+rRef.SetColDeleted(true);
+aRes.mbReferenceModified = true;
+break;
+}
+}
+
 if (adjustSingleRefInName(rRef, rCxt, rPos, nullptr))
 aRes.mbReferenceModified = 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-3' - sc/source

2017-06-24 Thread Julien Nabet
 sc/source/ui/docshell/docsh.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit e9cb227d3fd65ea46ffb926f2babb1926e5f2133
Author: Julien Nabet 
Date:   Fri Jun 23 23:55:50 2017 +0200

tdf#40713: dBASE, don't lose dbt file

if aDbtFile corresponds exactly to aTmpFile, we just have to return

Reviewed-on: https://gerrit.libreoffice.org/39189
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 
(cherry picked from commit 36d91a65ab2db0c4c81e09771f6b44e1905122a0)

Change-Id: I1dde8efbe01838dc94f6025d5b81f5aee01932ac
Reviewed-on: https://gerrit.libreoffice.org/39196
Reviewed-by: Lionel Elie Mamane 
Tested-by: Jenkins 

diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 9b12c99a25d5..f0214bd46cf5 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2394,6 +2394,12 @@ bool ScDocShell::ConvertTo( SfxMedium  )
 static_cast( 
rMed.GetItemSet()->GetItem( SID_FILE_NAME ) );
 INetURLObject aDbtFile( pNameItem->GetValue(), 
INetProtocol::File );
 aDbtFile.setExtension("dbt");
+
+// tdf#40713: don't lose dbt file
+// if aDbtFile corresponds exactly to aTmpFile, we just have 
to return
+if (aDbtFile.GetMainURL( 
INetURLObject::DecodeMechanism::DECODE_UNAMBIGUOUS ) == aTmpFile.GetMainURL( 
INetURLObject::DecodeMechanism::DECODE_UNAMBIGUOUS ))
+return bRet;
+
 if ( IsDocument( aDbtFile ) && !KillFile( aDbtFile ) )
 bRet = false;
 if ( bRet && !MoveFile( aTmpFile, aDbtFile ) )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-06-24 Thread Eike Rathke
 sc/source/core/tool/scmatrix.cxx |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit f8f29503cc4fda0a2f3750f82ac5d7f784bdf0f6
Author: Eike Rathke 
Date:   Wed Jun 21 23:42:25 2017 +0200

Resolves: tdf#108292 WalkAndMatchElements: really limit the match

... to the columns queried, not just when entering an mdds node. Otherwise 
it
would return an unexpected index, plus bailing out early spares unnecessary
comparisons for the rest of a node block.

Regression of

commit 3fed166279377f7ad702b8911899243b8adff3bf
Date:   Fri Aug 16 16:29:38 2013 +0200

that started to use

commit 7334f8db6f6004d48e2dbf014f27878a7ae21eb1
Date:   Fri Aug 16 16:29:27 2013 +0200

with its bad implementation.

Just that VLOOKUP on a matrix with a larger block of same typed data as the
query *and* a match in an excess column seems to be rare..

Change-Id: Ia4ef3fd56490de82910d5aa13a84be2de851f9b0
(cherry picked from commit d3b77628efc72d857c63c8fb91d7ed2b499ac860)
Reviewed-on: https://gerrit.libreoffice.org/39082
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 273a5fb6685e..1807a11c53cc 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -1281,6 +1281,8 @@ public:
 
 size_t getMatching() const { return mnResult; }
 
+size_t getRemainingCount() const { return ((mnCol2 + 1) * maSize.row) - 
mnIndex; }
+
 size_t compare(const MatrixImplType::element_block_node_type& node) const;
 
 void operator() (const MatrixImplType::element_block_node_type& node)
@@ -1290,7 +1292,7 @@ public:
 return;
 
 // limit lookup to the requested columns
-if ((mnCol1 * maSize.row) <= mnIndex && mnIndex < ((mnCol2 + 1) * 
maSize.row))
+if ((mnCol1 * maSize.row) <= mnIndex && getRemainingCount() > 0)
 {
 mnResult = compare(node);
 }
@@ -1311,7 +1313,8 @@ size_t WalkAndMatchElements::compare(const 
MatrixImplType::element_block
 
 block_type::const_iterator it = block_type::begin(*node.data);
 block_type::const_iterator itEnd = block_type::end(*node.data);
-for (; it != itEnd; ++it, nCount++)
+const size_t nRemaining = getRemainingCount();
+for (; it != itEnd && nCount < nRemaining; ++it, ++nCount)
 {
 if (*it == maMatchValue)
 {
@@ -1326,7 +1329,8 @@ size_t WalkAndMatchElements::compare(const 
MatrixImplType::element_block
 
 block_type::const_iterator it = block_type::begin(*node.data);
 block_type::const_iterator itEnd = block_type::end(*node.data);
-for (; it != itEnd; ++it, ++nCount)
+const size_t nRemaining = getRemainingCount();
+for (; it != itEnd && nCount < nRemaining; ++it, ++nCount)
 {
 if (int(*it) == maMatchValue)
 {
@@ -1356,7 +1360,8 @@ size_t 
WalkAndMatchElements::compare(const MatrixImplType::el
 
 block_type::const_iterator it = block_type::begin(*node.data);
 block_type::const_iterator itEnd = block_type::end(*node.data);
-for (; it != itEnd; ++it, ++nCount)
+const size_t nRemaining = getRemainingCount();
+for (; it != itEnd && nCount < nRemaining; ++it, ++nCount)
 {
 if (it->getDataIgnoreCase() == 
maMatchValue.getDataIgnoreCase())
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-06-15 Thread Eike Rathke
 sc/source/core/tool/interpr7.cxx |6 ++
 sc/source/ui/unoobj/funcuno.cxx  |2 ++
 2 files changed, 8 insertions(+)

New commits:
commit b85a1921585d70323c1c10ea6a7d29f1aa00ed25
Author: Eike Rathke 
Date:   Thu Jun 15 13:05:16 2017 +0200

Resolves: tdf#104989 a matrix/array formula cell needs to have dimensions

 This is a combination of 2 commits.

Resolves: tdf#104989 a matrix/array formula cell needs to have dimensions

Most spreadsheet functions don't need it, but some may.

(cherry picked from commit 033d018a3a1d345d61f3c4dc4da693cdd4004dea)

Ensure all cases push an error return, tdf#104989 related (not the cause)

A formula cell in matrix context could have no dimensions.. (which is the 
cause
but elsewhere).

(cherry picked from commit e6abe9c3d06d6776e05bef93b5e6f87b403ea967)

1a04f9808d8f5c802789e3db77052351b24c24c7

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

diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index 69eed575810b..b226717c2935 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -83,6 +83,11 @@ void ScInterpreter::ScFilterXML()
 
 }
 }
+if (!nMatCols || !nMatRows)
+{
+PushNoValue();
+return;
+}
 
 OUString aXPathExpression = GetString().getString();
 OUString aString = GetString().getString();
@@ -124,6 +129,7 @@ void ScInterpreter::ScFilterXML()
 switch(pXPathObj->type)
 {
 case XPATH_UNDEFINED:
+PushNoValue();
 break;
 case XPATH_NODESET:
 {
diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx
index 31f2e1eacb7b..e9dd22b0ba0a 100644
--- a/sc/source/ui/unoobj/funcuno.cxx
+++ b/sc/source/ui/unoobj/funcuno.cxx
@@ -611,6 +611,8 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const 
OUString& aName,
 pDoc, aFormulaPos, aTokenArr, formula::FormulaGrammar::GRAM_API,
 (sal_uInt8)(mbArray ? MM_FORMULA : MM_NONE) );
 pFormula = pDoc->SetFormulaCell(aFormulaPos, pFormula);
+if (mbArray && pFormula)
+pFormula->SetMatColsRows(1,1);  // the cell dimensions (only one 
cell)
 
 //  call GetMatrix before GetErrCode because GetMatrix always 
recalculates
 //  if there is no matrix result
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-06-12 Thread Julien Nabet
 sc/source/ui/unoobj/scdetect.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit d2353a5a8afa5aa0a760b0e6412c2f77aa3a6df6
Author: Julien Nabet 
Date:   Sun Jun 11 12:57:31 2017 +0200

tdf#106423: dbase file can have no records

Regression from 
https://cgit.freedesktop.org/libreoffice/core/commit/?id=4e3ff19b33c84557fd20e68960499933b4e52638
tdf#84834 sc: stricter type detection for dBASE files

Log test file from tdf#84834 still opens in Writer as expected

Change-Id: Ibf5a0f586e3a132455d2363e61e5cc7ea249002d
Reviewed-on: https://gerrit.libreoffice.org/38660
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
(cherry picked from commit 57ae8834c8313354477117b65d87c86407f6bf82)
Reviewed-on: https://gerrit.libreoffice.org/38692
Reviewed-by: Lionel Elie Mamane 

diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index 6e3318bdddc8..841191816e45 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -241,7 +241,8 @@ static bool lcl_MayBeDBase( SvStream& rStream )
 }
 
 // tdf#84834 sanity check of size
-if (0 == nRecords || nSize < nHeaderLen + nRecords * 
sal_uInt64(nRecordSize))
+// tdf#106423: a dbf file can have 0 record, so no need to check nRecords
+if (nSize < nHeaderLen + nRecords * sal_uInt64(nRecordSize))
 return false;
 
 // Last byte of header must be 0x0d, this is how it's specified.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-06-03 Thread Eike Rathke
 sc/source/core/data/table2.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 7821c84215be4f3e968f9a6afd8f8325992ef03c
Author: Eike Rathke 
Date:   Sat Jun 3 13:00:50 2017 +0200

sc::ColRowSpan::mnEnd is inclusive

Wrong since

commit 1e721077b43de84edab2a3ed2f316ddcbec6e3ec
Date:   Tue Oct 7 00:22:32 2014 +0900

and

commit 91502a72c12c559442e8bf77c27a516b49c2a68d
Date:   Thu Oct 9 14:44:27 2014 +0200

So HasAttribSelection() and HasSelectionMatrixFragment() did not query the
rightmost column of each marked range from ScMarkData.

Change-Id: Ie3aca26ee1b6c249c1135268dc0ad3ea053ea2b8
(cherry picked from commit 77d1e0c49adea959dd418de9b6cf9901e01be3ae)
Reviewed-on: https://gerrit.libreoffice.org/38371
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index a44ee8939730..7789b215504d 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1927,7 +1927,7 @@ bool ScTable::HasAttribSelection( const ScMarkData& 
rMark, HasAttrFlags nMask )
 
 for (sc::ColRowSpan & aSpan : aSpans)
 {
-for (SCCOLROW j = aSpan.mnStart; j < aSpan.mnEnd; ++j)
+for (SCCOLROW j = aSpan.mnStart; j <= aSpan.mnEnd; ++j)
 {
 if (aCol[j].HasAttribSelection(rMark, nMask))
   return true;
@@ -2209,7 +2209,7 @@ bool ScTable::HasSelectionMatrixFragment( const 
ScMarkData& rMark ) const
 
 for (sc::ColRowSpan & aSpan : aSpans)
 {
-for ( SCCOLROW j=aSpan.mnStart; j

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

2017-06-01 Thread Eike Rathke
 sc/source/filter/excel/xetable.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 190c0d9ed02a5ed0659b07955b839bb16b1ba638
Author: Eike Rathke 
Date:   Thu Jun 1 20:50:27 2017 +0200

Resolves: tdf#108279 dimension rows are 32-bit and don't wrap at 64k

Change-Id: I7bf7a149fb1db526ef62bea2f52b200cf5053cc2
(cherry picked from commit 259c2409310814ae62c8d0aefef19a71e8d88dbe)
Reviewed-on: https://gerrit.libreoffice.org/38331
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index 45db9a1c8693..29257f2df5ed 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -2309,7 +2309,7 @@ void XclExpRowBuffer::Finalize( XclExpDefaultRowData& 
rDefRowData, const ScfUInt
 // find used row range
 if( rRow->IsEnabled() )
 {
-sal_uInt16 nXclRow = rRow->GetXclRow();
+sal_uInt32 nXclRow = rRow->GetXclRow();
 nFirstUsedXclRow = ::std::min< sal_uInt32 >( nFirstUsedXclRow, 
nXclRow );
 nFirstFreeXclRow = ::std::max< sal_uInt32 >( nFirstFreeXclRow, 
nXclRow + 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-3' - sc/source

2017-05-29 Thread Tamás Zolnai
 sc/source/ui/view/gridwin4.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit d903fcf7582341ad4823aff999cbb9dc4d3d860d
Author: Tamás Zolnai 
Date:   Sat May 27 22:15:52 2017 +0200

tdf#107389: Wrong positioning of AutoFilter buttons in tiledrendering mode

Must be a regression from this commit:
9113f17e65b1dafbc178fd269e2967c1e2632f0e

Where the offset's and origin's meaning were changed, but
not all code path was updated accordingly.

Change-Id: Ib519303d5ca5ac7f13e74944e8147ea3220d7684
Reviewed-on: https://gerrit.libreoffice.org/38102
Tested-by: Jenkins 
Reviewed-by: Tamás Zolnai 
(cherry picked from commit ba5a9132375bcfedebd7c3d256161800da3b)
Reviewed-on: https://gerrit.libreoffice.org/38112
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index f449f7791f3a..cc8b0eeefe30 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -763,7 +763,10 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 {
 // Tiled offset nScrX, nScrY
 MapMode aMap( MapUnit::MapPixel );
-aMap.SetOrigin(Point(nScrX, nScrY));
+Point aOrigin = aOriginalMode.GetOrigin();
+aOrigin.setX(aOrigin.getX() / TWIPS_PER_PIXEL + nScrX);
+aOrigin.setY(aOrigin.getY() / TWIPS_PER_PIXEL + nScrY);
+aMap.SetOrigin(aOrigin);
 pContentDev->SetMapMode(aMap);
 }
 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-3' - sc/source

2017-05-29 Thread Markus Mohrhard
 sc/source/filter/orcus/orcusfiltersimpl.cxx |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit b1d039c2ce986424a8a7c6e9460924291318ceb7
Author: Markus Mohrhard 
Date:   Sat May 13 19:10:45 2017 +0200

import stream on the LibreOffice side, tdf#107827

This adds support for all LibreOffice content providers and non-ascii file 
names.

Change-Id: I0a0fd0ab0c78ef039679516e7a3e880929e8f725
Reviewed-on: https://gerrit.libreoffice.org/37578
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit 5e9178f765b327a8aba17476d135ba3b1f881bf7)
Reviewed-on: https://gerrit.libreoffice.org/37582
Reviewed-by: Eike Rathke 

diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx 
b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index b38926aa7a0d..b77ec878296c 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -88,14 +88,24 @@ bool ScOrcusFiltersImpl::importGnumeric(ScDocument& rDoc, 
SfxMedium& rMedium) co
 {
 ScOrcusFactory aFactory(rDoc);
 aFactory.setStatusIndicator(getStatusIndicator(rMedium));
-OString aSysPath = toSystemPath(rMedium.GetName());
-const char* path = aSysPath.getStr();
+SvStream* pStream = rMedium.GetInStream();
+pStream->Seek(0);
+static const size_t nReadBuffer = 1024*32;
+OStringBuffer aBuffer((int(nReadBuffer)));
+size_t nRead = 0;
+do
+{
+char pData[nReadBuffer];
+nRead = pStream->ReadBytes(pData, nReadBuffer);
+aBuffer.append(static_cast(pData), nRead);
+}
+while (nRead == nReadBuffer);
 
 try
 {
 rDoc.ClearTabs();
 orcus::orcus_gnumeric filter();
-filter.read_file(path);
+filter.read_stream(aBuffer.getStr(), aBuffer.getLength());
 }
 catch (const std::exception& e)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-05-29 Thread Eike Rathke
 sc/source/core/tool/interpr1.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit bcd3e9f29c458847df839724def86f4ebd388cdd
Author: Eike Rathke 
Date:   Tue May 23 14:01:41 2017 +0200

PushError() instead of SetError() so there's a result token

Change-Id: I8c2a7e01b04c26e008c8cbea9332f71d47293c75
(cherry picked from commit cd87661b4761ee9f512fc01f95d84f786c97bb66)
Reviewed-on: https://gerrit.libreoffice.org/37950
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index f005b26e4635..22ae9153e5c9 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5713,7 +5713,7 @@ void ScInterpreter::ScSumIfs()
 
 if (nParamCount < 3 || (nParamCount % 2 != 1))
 {
-SetError( FormulaError::ParameterExpected);
+PushError( FormulaError::ParameterExpected);
 return;
 }
 
@@ -5728,7 +5728,7 @@ void ScInterpreter::ScAverageIfs()
 
 if (nParamCount < 3 || (nParamCount % 2 != 1))
 {
-SetError( FormulaError::ParameterExpected);
+PushError( FormulaError::ParameterExpected);
 return;
 }
 
@@ -5743,7 +5743,7 @@ void ScInterpreter::ScCountIfs()
 
 if (nParamCount < 2 || (nParamCount % 2 != 0))
 {
-SetError( FormulaError::ParameterExpected);
+PushError( FormulaError::ParameterExpected);
 return;
 }
 
@@ -5758,7 +5758,7 @@ void ScInterpreter::ScMinIfs_MS()
 
 if (nParamCount < 3 || (nParamCount % 2 != 1))
 {
-SetError( FormulaError::ParameterExpected);
+PushError( FormulaError::ParameterExpected);
 return;
 }
 
@@ -5774,7 +5774,7 @@ void ScInterpreter::ScMaxIfs_MS()
 
 if (nParamCount < 3 || (nParamCount % 2 != 1))
 {
-SetError( FormulaError::ParameterExpected);
+PushError( FormulaError::ParameterExpected);
 return;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-05-26 Thread Justin Luth
 sc/source/ui/vba/vbarange.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit f82a36749a9df51d2344e4acb88f0e53b39f8e72
Author: Justin Luth 
Date:   Wed May 24 12:48:12 2017 +0300

tdf#108049 VBA exception avoided in ScVbaRange::setStyle

Change-Id: I5fc928373d70829b6e68d9000140a30f04179536
Reviewed-on: https://gerrit.libreoffice.org/37981
Tested-by: Jenkins 
Reviewed-by: Justin Luth 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit 4dc3e7d5e9044be66177e467d739bd8be7556783)
Reviewed-on: https://gerrit.libreoffice.org/38063
(cherry picked from commit bb9c240046955c432d963610d5dd99edcc6b43e6)
Reviewed-on: https://gerrit.libreoffice.org/38083
Tested-by: Justin Luth 

diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index af3a4e6c48e1..955d35a2c4e8 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -5270,7 +5270,8 @@ ScVbaRange::setStyle( const uno::Any& _style ) throw 
(uno::RuntimeException, std
 uno::Reference< beans::XPropertySet > xProps( mxRange, 
uno::UNO_QUERY_THROW );
 uno::Reference< excel::XStyle > xStyle;
 _style >>= xStyle;
-xProps->setPropertyValue( CELLSTYLE, uno::makeAny( xStyle->getName() ) );
+if ( xProps.is() && xStyle.is() )
+xProps->setPropertyValue( CELLSTYLE, uno::makeAny( xStyle->getName() ) 
);
 }
 
 uno::Reference< excel::XRange >
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-05-18 Thread Julien Nabet
 sc/source/ui/unoobj/condformatuno.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 5756d3d5bd2175335ac302aaa806fd5f2277f564
Author: Julien Nabet 
Date:   Thu May 18 00:03:32 2017 +0200

tdf#107920: Crash when using ScCompiler in condformat

Just call SetGrammar from ScCompiler object with grammar of document
See bt in https://bugs.documentfoundation.org/attachment.cgi?id=133382

Change-Id: Iedf4b88f2821bbcf728e4b1c023041fd6f10e5f3
Reviewed-on: https://gerrit.libreoffice.org/37739
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
(cherry picked from commit 63843a97262ccfa38d838a9cbbc3faadba8290a6)
Reviewed-on: https://gerrit.libreoffice.org/37756
Tested-by: Eike Rathke 

diff --git a/sc/source/ui/unoobj/condformatuno.cxx 
b/sc/source/ui/unoobj/condformatuno.cxx
index d64b71d9bedd..bfc003e94a05 100644
--- a/sc/source/ui/unoobj/condformatuno.cxx
+++ b/sc/source/ui/unoobj/condformatuno.cxx
@@ -745,6 +745,7 @@ void SAL_CALL ScConditionEntryObj::setPropertyValue(
 if ((aValue >>= aFormula) && !aFormula.isEmpty())
 {
 ScCompiler aComp(>GetDocument(), 
getCoreObject()->GetSrcPos());
+aComp.SetGrammar(mpDocShell->GetDocument().GetGrammar());
 std::unique_ptr 
pArr(aComp.CompileString(aFormula));
 getCoreObject()->SetFormula1(*pArr);
 }
@@ -756,6 +757,7 @@ void SAL_CALL ScConditionEntryObj::setPropertyValue(
 if ((aValue >>= aFormula) && !aFormula.isEmpty())
 {
 ScCompiler aComp(>GetDocument(), 
getCoreObject()->GetSrcPos());
+aComp.SetGrammar(mpDocShell->GetDocument().GetGrammar());
 std::unique_ptr 
pArr(aComp.CompileString(aFormula));
 getCoreObject()->SetFormula2(*pArr);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-05-17 Thread Julien Nabet
 sc/source/core/inc/interpre.hxx  |2 +-
 sc/source/core/tool/interpr1.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit f6d7bd1f525d3930c48b61abb2e91418f2c66ca5
Author: Julien Nabet 
Date:   Tue May 16 23:50:46 2017 +0200

tdf#107892: fix negative values case with maxifs

std::numeric_limits::min() returns positive value for float/double
so use std::numeric_limits::lowest()
(see 
http://stackoverflow.com/questions/17070351/why-does-numeric-limitsmin-return-a-negative-value-for-int-but-positive-values)

Change-Id: I0afce2d38c6936aeff26923182bcafd2f0008d9e
Reviewed-on: https://gerrit.libreoffice.org/37693
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
(cherry picked from commit 20d3a60b41bda2513723c145d919f584840b1056)
Reviewed-on: https://gerrit.libreoffice.org/37730

diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index fe860eba7120..636f2ecd62d1 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -69,7 +69,7 @@ struct ParamIfsResult
 double mfMem = 0.0;
 double mfCount = 0.0;
 double mfMin = std::numeric_limits::max();
-double mfMax = std::numeric_limits::min();
+double mfMax = std::numeric_limits::lowest();
 };
 
 }
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 9a02b624df22..f005b26e4635 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5780,7 +5780,7 @@ void ScInterpreter::ScMaxIfs_MS()
 
 sc::ParamIfsResult aRes;
 IterateParametersIfs(aRes);
-PushDouble((aRes.mfMax > std::numeric_limits::min()) ? aRes.mfMax 
: 0.0);
+PushDouble((aRes.mfMax > std::numeric_limits::lowest()) ? 
aRes.mfMax : 0.0);
 }
 
 void ScInterpreter::ScLookup()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-05-15 Thread frederic vroman
 sc/source/core/data/conditio.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 4366a6bcc175886680ff1b727207ed1ae4f97ce9
Author: frederic vroman 
Date:   Fri May 12 09:14:32 2017 +0200

tdf#82326 calc 32bits unable to open files with a lot of cond formatting

The code to build and compute formulas is using an fixed size array.
The size of this array has been changed from 512 to 8192 by commit
9c1ca6dca3b553c302a635357e33591605343b99

Since then, LO consumes a LOT of memory while opening scalc
files which are making extensive use of conditional formatting.

This is a silent issue when working with a 64bits versions of LO because
the memory is immediately released at the end of the load phase.
However, with 32bits versions, some files can not be opened anymore as it
can consume the full process memory space (2GB on windows).

The parser is creating ScCondtionEntry objects to store conditional 
formatting expressions
which are immediately compiled in the constructor. However the compile
method did not return a flattened token array.

Change-Id: Id290bc1f5838c246d4c2322b297b13307defaf88
Reviewed-on: https://gerrit.libreoffice.org/37527
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
(cherry picked from commit f566e2d579f5385b01d9b124e7055721313325c9)
Reviewed-on: https://gerrit.libreoffice.org/37644

diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index f4f0f116ba61..c970520f3377 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -389,7 +389,7 @@ void ScConditionEntry::Compile( const OUString& rExpr1, 
const OUString& rExpr2,
 //  temporary formula string as string tokens
 //TODO: merge with lcl_ScDocFunc_CreateTokenArrayXML
 pFormula1 = new ScTokenArray;
-pFormula1->AddStringXML( rExpr1 );
+pFormula1->AssignXMLString( rExpr1, rExprNmsp1 );
 // bRelRef1 is set when the formula is compiled again 
(CompileXML)
 }
 else
@@ -427,7 +427,7 @@ void ScConditionEntry::Compile( const OUString& rExpr1, 
const OUString& rExpr2,
 //  temporary formula string as string tokens
 //TODO: merge with lcl_ScDocFunc_CreateTokenArrayXML
 pFormula2 = new ScTokenArray;
-pFormula2->AddStringXML( rExpr2 );
+pFormula2->AssignXMLString( rExpr2, rExprNmsp2 );
 // bRelRef2 is set when the formula is compiled again 
(CompileXML)
 }
 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-3' - sc/source

2017-05-12 Thread Arul Michael
 sc/source/core/data/document.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit f55f0b57b1f206763e97065f6121fcb55c53e53d
Author: Arul Michael 
Date:   Thu Apr 27 10:32:10 2017 +0530

tdf#106051 Notify listeners on top and bottom of split formula group

Change-Id: Icecb59a476f57cee0c04c3e21d60e6c7fa12f65a
Reviewed-on: https://gerrit.libreoffice.org/37011
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 
(cherry picked from commit c882c60f54cc90740a674eed8c47bde0e9959652)
Reviewed-on: https://gerrit.libreoffice.org/37543

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 80fb075988b8..ee69a89cc3f8 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -5849,6 +5849,12 @@ void ScDocument::DeleteSelection( InsertDeleteFlags 
nDelFlag, const ScMarkData&
 if (pRange)
 SetDirty( *pRange, true);
 }
+//Notify listeners on top and bottom of the group that has been 
split
+for (size_t i = 0; i < aGroupPos.size(); ++i) {
+ScFormulaCell *pFormulaCell = GetFormulaCell(aGroupPos[i]);
+if (pFormulaCell)
+pFormulaCell->SetDirty(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-3' - sc/source

2017-05-11 Thread Julien Nabet
 sc/source/core/tool/autoform.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 9fd3f402e7a6dfe133433d05de7452f32e1c41ba
Author: Julien Nabet 
Date:   Mon May 8 01:10:13 2017 +0200

tdf#107572: retrieve Default autoformat

by fixing DefaultFirstEntry comparison operator.
From http://www.cplusplus.com/reference/map/map/key_comp/:
"...
Two keys are considered equivalent if key_comp returns false reflexively
(i.e., no matter the order in which the keys are passed as arguments).
..."

Certainly regression from:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=652158c3f2c9cd0d6f71ecd14bf5d5cc02a71b50
author  Julien Nabet   2015-09-15 19:41:48 (GMT)
committer   Julien Nabet   2015-09-30 12:11:35 
(GMT)
commit  652158c3f2c9cd0d6f71ecd14bf5d5cc02a71b50 (patch)
tree13ad29a110565f24e7010a68d902cadf1c441b62
parent  8727afe771a3e4d585e98ca9cceff2504e500bb0 (diff)
tdf#94173: Calc doesn't save your own created autoformat presets

This new patch has also been tested for tdf#94173

Change-Id: I60de5fffe39be9b3615c32a317611812b42bafc7
(cherry picked from commit 965494c544dd8f35ae83b7cf38549009da06c367)
Reviewed-on: https://gerrit.libreoffice.org/37487
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx
index 4966475d3180..9708daa13dcb 100644
--- a/sc/source/core/tool/autoform.cxx
+++ b/sc/source/core/tool/autoform.cxx
@@ -912,6 +912,8 @@ ScAutoFormat::ScAutoFormat() :
 bool DefaultFirstEntry::operator() (const OUString& left, const OUString& 
right) const
 {
 OUString aStrStandard(ScGlobal::GetRscString(STR_STYLENAME_STANDARD));
+if (ScGlobal::GetpTransliteration()->isEqual( left, right ) )
+return false;
 if ( ScGlobal::GetpTransliteration()->isEqual( left, aStrStandard ) )
 return true;
 if ( ScGlobal::GetpTransliteration()->isEqual( right, aStrStandard ) )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-05-10 Thread Kohei Yoshida
 sc/source/ui/view/gridwin.cxx  |   27 +--
 sc/source/ui/view/viewfunc.cxx |4 
 2 files changed, 25 insertions(+), 6 deletions(-)

New commits:
commit 5fa3a5cd075bfc6607c76b9be41310a24fec17f2
Author: Kohei Yoshida 
Date:   Fri May 5 17:53:02 2017 -0400

tdf#86001: Pass on the language info from the cell to the engine.

So that it can be used to set the correct language to use to check
spelling (or disable it altogether).

Reviewed-on: https://gerrit.libreoffice.org/37307
Tested-by: Jenkins 
Reviewed-by: Kohei Yoshida 
(cherry picked from commit eb35ead64b1371ea27420b57387ff1db0cbbbcf6)

 Conflicts:
sc/source/ui/view/gridwin.cxx

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

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 317d1941c1f0..3122880ccf7c 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -53,6 +54,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -5568,6 +5571,22 @@ bool ScGridWindow::ContinueOnlineSpelling()
 {
 ++nTextCellCount;
 
+// NB: For spell-checking, we currently only use the primary
+// language; not CJK nor CTL.
+const ScPatternAttr* pPattern = pDoc->GetPattern(nCol, nRow, nTab);
+LanguageType nCellLang =
+static_cast(pPattern->GetItem(ATTR_FONT_LANGUAGE)).GetValue();
+
+if (nCellLang == LANGUAGE_SYSTEM)
+nCellLang = 
Application::GetSettings().GetLanguageTag().getLanguageType();   // never use 
SYSTEM for spelling
+
+if (nCellLang == LANGUAGE_NONE)
+{
+// No need to spell check this cell.
+pCell = aIter.GetNext(nCol, nRow);
+continue;
+}
+
 if (!pEngine)
 {
 //  ScTabEditEngine is needed
@@ -5582,14 +5601,10 @@ bool ScGridWindow::ContinueOnlineSpelling()
 
 uno::Reference 
xXSpellChecker1(LinguMgr::GetSpellChecker());
 pEngine->SetSpeller(xXSpellChecker1);
+
pEngine->SetDefaultLanguage(ScGlobal::GetEditDefaultLanguage());
 }
 
-const ScPatternAttr* pPattern = pDoc->GetPattern(nCol, nRow, nTab);
-sal_uInt16 nCellLang =
-static_cast(pPattern->GetItem(ATTR_FONT_LANGUAGE)).GetValue();
-if (nCellLang == LANGUAGE_SYSTEM)
-nCellLang = 
Application::GetSettings().GetLanguageTag().getLanguageType();   // never use 
SYSTEM for spelling
-pEngine->SetDefaultLanguage(nCellLang);
+pEngine->SetDefaultItem(SvxLanguageItem(nCellLang, 
EE_CHAR_LANGUAGE));
 
 if (eType == CELLTYPE_STRING)
 pEngine->SetText(pCell->mpString->getString());
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 0228541fe286..1b5a9b210849 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -904,6 +904,10 @@ void ScViewFunc::ApplyAttributes( const SfxItemSet* 
pDialogSet,
 }
 }
 
+if (pDialogSet->HasItem(ATTR_FONT_LANGUAGE))
+// font language has changed.  Redo the online spelling.
+ResetAutoSpell();
+
 const SvxBoxItem* pOldOuter = static_cast 
(>Get( ATTR_BORDER ));
 const SvxBoxItem* pNewOuter = static_cast 
(>Get( ATTR_BORDER ));
 const SvxBoxInfoItem* pOldInner = static_cast 
(>Get( ATTR_BORDER_INNER ));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-05-02 Thread Eike Rathke
 sc/source/core/tool/parclass.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 9e76cc9da61dbe8ee5bbcac5c4378c5ba4fb4d21
Author: Eike Rathke 
Date:   Thu Apr 20 13:52:18 2017 +0200

Resolves: tdf#99625 add parameter classification for TEXTJOIN and CONCAT

So in array context the functions return a single string instead of an 
array of
identical strings.

Change-Id: Ia6ada10be4912745b60e281fac1736c560162d3a
(cherry picked from commit f0fef88b747cc4f4de7a5ccb93da9c062545dcfb)
Reviewed-on: https://gerrit.libreoffice.org/36742
Tested-by: Jenkins 
Reviewed-by: Christian Lohmaier 

diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx
index bd8ca5544a8d..66ca8e5c3a48 100644
--- a/sc/source/core/tool/parclass.cxx
+++ b/sc/source/core/tool/parclass.cxx
@@ -80,6 +80,7 @@ const ScParameterClassification::RawData 
ScParameterClassification::pRawData[] =
 { ocCell,{{ Value, Reference   
  }, 0 }},
 { ocColumn,  {{ Reference  
  }, 0 }},
 { ocColumns, {{ Reference  
  }, 1 }},
+{ ocConcat_MS,   {{ Reference  
  }, 1 }},
 { ocCorrel,  {{ ForceArray, ForceArray 
  }, 0 }},
 { ocCount,   {{ Reference  
  }, 1 }},
 { ocCount2,  {{ Reference  
  }, 1 }},
@@ -195,6 +196,7 @@ const ScParameterClassification::RawData 
ScParameterClassification::pRawData[] =
 { ocSumXMY2, {{ ForceArray, ForceArray 
  }, 0 }},
 { ocSheet,   {{ Reference  
  }, 0 }},
 { ocSheets,  {{ Reference  
  }, 1 }},
+{ ocTextJoin_MS, {{ Reference, Value, Reference
  }, 1 }},
 { ocTrend,   {{ Reference, Reference, Reference, Value 
  }, 0 }},
 { ocTrimMean,{{ Reference, Value   
  }, 0 }},
 { ocTTest,   {{ ForceArray, ForceArray, Value, Value   
  }, 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-3' - sc/source

2017-04-27 Thread Caolán McNamara
 sc/source/ui/formdlg/dwfunctr.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit f7f57148258ef407caa3ac81c108f6076caf9b2d
Author: Caolán McNamara 
Date:   Thu Apr 27 15:55:40 2017 +0100

Resolves: tdf#107241 don't let floating function description grow infinitely

Change-Id: Ief87c15c637d725d25416b64739fb3f5f07cded4
(cherry picked from commit e33447a24c6800bbd34ea1463ee823737bf555cd)
Reviewed-on: https://gerrit.libreoffice.org/37036
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/ui/formdlg/dwfunctr.cxx 
b/sc/source/ui/formdlg/dwfunctr.cxx
index 51ddbff61f48..25d2814ed66c 100644
--- a/sc/source/ui/formdlg/dwfunctr.cxx
+++ b/sc/source/ui/formdlg/dwfunctr.cxx
@@ -58,6 +58,7 @@ ScFunctionWin::ScFunctionWin(vcl::Window* pParent, const 
css::uno::Referenceset_height_request(10 * aFuncList->GetTextHeight());
 get(aInsertButton, "insert");
 get(aFiFuncDesc, "funcdesc");
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-04-27 Thread Eike Rathke
 sc/source/ui/view/viewfun4.cxx |   12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit ac15df592ea7acac7399c99f64539cab556d2fab
Author: Eike Rathke 
Date:   Wed Apr 19 11:14:42 2017 +0200

Resolves: tdf#102525 handle array/matrix formula in cycle cell reference 
types

(cherry picked from commit 6c73ca4671958cb066beecade5661e124c497e25)

 Conflicts:
sc/source/ui/view/viewfun4.cxx

keep the leading '=' equal character, tdf#102525 follow-up

So to feed it to the compiler again in case it's a "==" force-always 
formula,
which theoretically would also be valid in matrix mode.

(cherry picked from commit c15f497b9a3463c7eeca1e8cc2c6f46ca293b9af)

e694e12a3bc4581469b7ad9cc06a2a664d6f

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

diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 614e2d98caba..c8ff808cc534 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -248,9 +248,19 @@ void ScViewFunc::DoRefConversion()
 continue;
 
 ScFormulaCell* pCell = aIter.getFormulaCell();
+sal_uInt8 eMatrixMode = pCell->GetMatrixFlag();
+if (eMatrixMode == MM_REFERENCE)
+continue;
+
 OUString aOld;
 pCell->GetFormula(aOld);
 sal_Int32 nLen = aOld.getLength();
+if (eMatrixMode == MM_FORMULA)
+{
+assert(nLen >= 2 && aOld[0] == '{' && aOld[nLen-1] == '}');
+nLen -= 2;
+aOld = aOld.copy( 1, nLen);
+}
 ScRefFinder aFinder( aOld, aIter.GetPos(), pDoc, 
pDoc->GetAddressConvention() );
 aFinder.ToggleRel( 0, nLen );
 if (aFinder.GetFound())
@@ -262,7 +272,7 @@ void ScViewFunc::DoRefConversion()
 std::unique_ptr 
pArr(aComp.CompileString(aNew));
 ScFormulaCell* pNewCell =
 new ScFormulaCell(
-pDoc, aPos, *pArr, 
formula::FormulaGrammar::GRAM_DEFAULT, MM_NONE);
+pDoc, aPos, *pArr, 
formula::FormulaGrammar::GRAM_DEFAULT, eMatrixMode);
 
 pDoc->SetFormulaCell(aPos, pNewCell);
 bOk = 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-3' - sc/source

2017-04-25 Thread Kohei Yoshida
 sc/source/core/tool/formularesult.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit ee86d223b8e6b5d164e96e6169a9d1f145081a1e
Author: Kohei Yoshida 
Date:   Fri Apr 21 21:42:32 2017 -0400

tdf#107310: hybrid cell is a value cell as well as a string cell.

Else it would cause a legitimate calculation to fail with #VALUE!.

Change-Id: If8d4f40859d0c87b97afc952e4a3e4268450c40c
Reviewed-on: https://gerrit.libreoffice.org/36817
Tested-by: Jenkins 
Reviewed-by: Kohei Yoshida 
(cherry picked from commit 7c80ea40fab3cb8e8893d14e80e7bb7f63f0dbb0)
Reviewed-on: https://gerrit.libreoffice.org/36917
Reviewed-by: Eike Rathke 

diff --git a/sc/source/core/tool/formularesult.cxx 
b/sc/source/core/tool/formularesult.cxx
index 95b8ded0cca5..90becca556dc 100644
--- a/sc/source/core/tool/formularesult.cxx
+++ b/sc/source/core/tool/formularesult.cxx
@@ -294,6 +294,9 @@ inline bool isString( formula::StackVar sv )
 
 bool ScFormulaResult::IsValue() const
 {
+if (IsEmptyDisplayedAsString())
+return true;
+
 return isValue(GetCellResultType());
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-04-19 Thread Caolán McNamara
 sc/source/ui/condformat/condformatdlgentry.cxx |   22 +++---
 sc/source/ui/inc/condformatdlgentry.hxx|2 ++
 sc/uiconfig/scalc/ui/conditionalentry.ui   |   14 ++
 3 files changed, 27 insertions(+), 11 deletions(-)

New commits:
commit 4e40cf62a142813a2ffa0a64148c84c1b4e60be9
Author: Caolán McNamara 
Date:   Thu Mar 30 10:16:41 2017 +0100

Resolves: tdf#106838 icon set not visible in conditional formatting

Change-Id: Ibafaa487d39a69bc7c5c150361368614c0d9e004
(cherry picked from commit 1c2dd8dc14effe739bd826cf4fe77145d5b751bc)
Reviewed-on: https://gerrit.libreoffice.org/35899
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx 
b/sc/source/ui/condformat/condformatdlgentry.cxx
index f4273992e9f4..6ecfeb7a71df 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -1399,11 +1399,15 @@ 
ScIconSetFrmtDataEntry::ScIconSetFrmtDataEntry(vcl::Window* pParent, ScIconSetTy
 
 Size ScIconSetFrmtDataEntry::calculateRequisition() const
 {
+if (!maGrid) //during dispose
+return Size();
 return getLayoutRequisition(*maGrid);
 }
 
 void ScIconSetFrmtDataEntry::setAllocation(const Size )
 {
+if (!maGrid) //during dispose
+return;
 setLayoutPosSize(*maGrid, Point(0, 0), rAllocation);
 }
 
@@ -1471,6 +1475,7 @@ ScIconSetFrmtEntry::ScIconSetFrmtEntry(vcl::Window* 
pParent, ScDocument* pDoc, c
 {
 get(maLbColorFormat, "colorformat");
 get(maLbIconSetType, "iconsettype");
+get(maIconParent, "iconparent");
 
 Init();
 maLbColorFormat->SetSelectHdl( LINK( pParent, ScCondFormatList, 
ColFormatTypeHdl ) );
@@ -1485,12 +1490,9 @@ ScIconSetFrmtEntry::ScIconSetFrmtEntry(vcl::Window* 
pParent, ScDocument* pDoc, c
 for (size_t i = 0, n = pIconSetFormatData->m_Entries.size();
 i < n; ++i)
 {
-maEntries.push_back( VclPtr::Create(
-this, eType, pDoc, i, pIconSetFormatData->m_Entries[i].get()));
-Size aSize(maEntries[0]->get_preferred_size());
-Point aPos(0, LogicToPixel(Size(0, 35), 
MapMode(MapUnit::MapAppFont)).getHeight());
-aPos.Y() += aSize.Height() * i * 1.2;
-maEntries[i]->SetPosSizePixel(aPos, aSize);
+maEntries.push_back(VclPtr::Create(
+maIconParent, eType, pDoc, i, 
pIconSetFormatData->m_Entries[i].get()));
+maEntries[i]->set_grid_top_attach(i);
 }
 maEntries[0]->SetFirstEntry();
 }
@@ -1508,6 +1510,7 @@ void ScIconSetFrmtEntry::dispose()
 for (auto it = maEntries.begin(); it != maEntries.end(); ++it)
 it->disposeAndClear();
 maEntries.clear();
+maIconParent.clear();
 maLbColorFormat.clear();
 maLbIconSetType.clear();
 ScCondFrmtEntry::dispose();
@@ -1535,11 +1538,8 @@ IMPL_LINK_NOARG( ScIconSetFrmtEntry, IconSetTypeHdl, 
ListBox&, void )
 
 for(size_t i = 0; i < nElements; ++i)
 {
-maEntries.push_back( VclPtr::Create( this, 
static_cast(nPos), mpDoc, i ) );
-Size aSize(maEntries[0]->get_preferred_size());
-Point aPos(0, LogicToPixel(Size(0, 35), 
MapMode(MapUnit::MapAppFont)).getHeight());
-aPos.Y() += aSize.Height() * i * 1.2;
-maEntries[i]->SetPosSizePixel(aPos, aSize);
+
maEntries.push_back(VclPtr::Create(maIconParent, 
static_cast(nPos), mpDoc, i));
+maEntries[i]->set_grid_top_attach(i);
 maEntries[i]->Show();
 }
 maEntries[0]->SetFirstEntry();
diff --git a/sc/source/ui/inc/condformatdlgentry.hxx 
b/sc/source/ui/inc/condformatdlgentry.hxx
index f7d446ff474b..642e6ceae019 100644
--- a/sc/source/ui/inc/condformatdlgentry.hxx
+++ b/sc/source/ui/inc/condformatdlgentry.hxx
@@ -297,6 +297,8 @@ class ScIconSetFrmtEntry : public ScCondFrmtEntry
 // icon set ui elements
 VclPtr maLbIconSetType;
 
+VclPtr maIconParent;
+
 typedef std::vector 
ScIconSetFrmtDataEntriesType;
 ScIconSetFrmtDataEntriesType maEntries;
 
diff --git a/sc/uiconfig/scalc/ui/conditionalentry.ui 
b/sc/uiconfig/scalc/ui/conditionalentry.ui
index c5803074e635..88ec9b39069a 100644
--- a/sc/uiconfig/scalc/ui/conditionalentry.ui
+++ b/sc/uiconfig/scalc/ui/conditionalentry.ui
@@ -410,6 +410,20 @@
   
 
 
+  
+True
+False
+
+  
+
+  
+  
+0
+7
+3
+  
+
+
   
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-04-19 Thread Markus Mohrhard
 sc/source/core/data/document10.cxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit bbdaac9c5d03d59c55dc8ec1d9c34df502c11dea
Author: Markus Mohrhard 
Date:   Mon Apr 10 23:05:09 2017 +0200

call UpdateReference also for single cell copying, tdf#105245

 This is a combination of 2 commits.

call UpdateReference also for single cell copying, tdf#105245

Reviewed-on: https://gerrit.libreoffice.org/36393
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 
(cherry picked from commit cb57a432ba98ffe197c8fd2528e4b363c3285cc4)

only handling copy needed, cut bailed out, tdf#105245 follow-up

(cherry picked from commit 840ac578dc5c21731b927bad6113839c4c69c108)

946d9f09e7571d347111ad66326ab375d153e298

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

diff --git a/sc/source/core/data/document10.cxx 
b/sc/source/core/data/document10.cxx
index 89645388..c5bc3118a174 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -125,6 +125,15 @@ bool ScDocument::CopyOneCellFromClip(
 maTabs[i]->CopyOneCellFromClip(rCxt, nCol1, nRow1, nCol2, nRow2,  
aClipRange.aStart.Row(), pSrcTab);
 }
 
+sc::RefUpdateContext aRefCxt(*this);
+aRefCxt.maRange = ScRange(nCol1, nRow1, rCxt.getTabStart(), nCol2, nRow2, 
nTabEnd);
+aRefCxt.mnColDelta = nCol1 - aSrcPos.Col();
+aRefCxt.mnRowDelta = nRow1 - aSrcPos.Row();
+aRefCxt.mnTabDelta = rCxt.getTabStart() - aSrcPos.Tab();
+// Only Copy, for Cut we already bailed out early.
+aRefCxt.meMode = URM_COPY;
+UpdateReference(aRefCxt, rCxt.getUndoDoc(), false);
+
 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-3' - sc/source

2017-04-18 Thread Kohei Yoshida
 sc/source/core/tool/token.cxx |   10 ++
 sc/source/ui/docshell/docfunc.cxx |2 +-
 sc/source/ui/undo/undoblk.cxx |2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 856a2d868fedd010d58d6082d3cb4753a019408a
Author: Kohei Yoshida 
Date:   Wed Apr 5 21:09:59 2017 -0400

tdf#92650: handle overwritten references correctly in undo.

(cherry picked from commit de39b6ba3a9edd20a476937ef0c78920df2f5c6d)

 Conflicts:
sc/source/ui/docshell/docfunc.cxx

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

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 23f986981784..bf25d135f728 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3166,6 +3166,11 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove(
 aAbs = aErrorPos;
 aRes.mbReferenceModified = true;
 }
+else if (rCxt.maRange.In(aAbs))
+{
+// Referenced cell has been overwritten.
+aRes.mbValueChanged = true;
+}
 
 rRef.SetAddress(aAbs, rNewPos);
 rRef.SetFlag3D(aAbs.Tab() != rNewPos.Tab() || 
!rRef.IsTabRel());
@@ -3182,6 +3187,11 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove(
 aAbs = aErrorRange;
 aRes.mbReferenceModified = true;
 }
+else if (rCxt.maRange.In(aAbs))
+{
+// Referenced range has been entirely overwritten.
+aRes.mbValueChanged = true;
+}
 
 rRef.SetRange(aAbs, rNewPos);
 // Absolute sheet reference => set 3D flag.
diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index d84c47da3c90..7b01d94ab9a4 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -2826,7 +2826,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const 
ScAddress& rDestPos,
 ScDrawLayer::MoveCells() which may move away inserted objects to wrong
 positions (e.g. if source and destination range overlaps).*/
 rDoc.CopyFromClip( aPasteDest, aDestMark, InsertDeleteFlags::ALL & 
~(InsertDeleteFlags::OBJECTS),
-nullptr, pClipDoc, true, false, bIncludeFiltered );
+pUndoDoc, pClipDoc, true, false, bIncludeFiltered );
 
 // skipped rows and merged cells don't mix
 if ( !bIncludeFiltered && pClipDoc->HasClipFilteredRows() )
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 2c19695b6b86..6d0466dd1dd3 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1102,7 +1102,7 @@ bool ScUndoPaste::CanRepeat(SfxRepeatTarget& rTarget) 
const
 ScUndoDragDrop::ScUndoDragDrop( ScDocShell* pNewDocShell,
 const ScRange& rRange, ScAddress aNewDestPos, bool bNewCut,
 ScDocument* pUndoDocument, bool bScenario ) :
-ScMoveUndo( pNewDocShell, pUndoDocument, nullptr, SC_UNDO_REFFIRST ),
+ScMoveUndo( pNewDocShell, pUndoDocument, nullptr, SC_UNDO_REFLAST ),
 mnPaintExtFlags( 0 ),
 aSrcRange( rRange ),
 bCut( bNewCut ),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-04-18 Thread Markus Mohrhard
 sc/source/ui/view/viewfun2.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 7c1314bb1e63f9c3460175a8ee30422ebf3c4d37
Author: Markus Mohrhard 
Date:   Sat Apr 8 21:13:56 2017 +0200

actually show the newly selected cell, tdf#106194

Change-Id: I0c9f839cbe55f2670602567e61dc4aba77fbef61
Reviewed-on: https://gerrit.libreoffice.org/36303
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit dbc616c0021b86e6365930ba581818fea280d1a8)
Reviewed-on: https://gerrit.libreoffice.org/36386
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index ee8f6f7e854a..a1013b2ba896 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -1932,6 +1932,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* 
pSearchItem,
 ( nTab == nOldTab ) &&
 ( nCol != nOldCol || nRow != nOldRow ) )
 {
+AlignToCursor(nCol, nRow, SC_FOLLOW_JUMP);
 SetCursor( nCol, nRow, 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-3' - sc/source

2017-04-12 Thread Markus Mohrhard
 sc/source/ui/condformat/condformatdlg.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit dcd9eef1727efb7a909f8009fde4f34f26139522
Author: Markus Mohrhard 
Date:   Sun Apr 9 01:21:25 2017 +0200

don't replace content of formula field when selecting range, tdf#58635

Change-Id: I85953fdd7c2b7f193b2a815564526d985ae2bba4
Reviewed-on: https://gerrit.libreoffice.org/36309
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 
(cherry picked from commit 42aece949ec96c775b31216bddd723aa5321e966)
Reviewed-on: https://gerrit.libreoffice.org/36310
Tested-by: Jenkins 
Reviewed-by: Katarina Behrens 

diff --git a/sc/source/ui/condformat/condformatdlg.cxx 
b/sc/source/ui/condformat/condformatdlg.cxx
index b2c0a1c07dd8..9a416692a4fd 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -572,7 +572,10 @@ void ScCondFormatDlg::SetReference(const ScRange& rRef, 
ScDocument*)
 
 OUString aRefStr(rRef.Format(nFlags, mpViewData->GetDocument(),
 
ScAddress::Details(mpViewData->GetDocument()->GetAddressConvention(), 0, 0)));
-pEdit->SetRefString( aRefStr );
+if (pEdit != mpEdRange)
+pEdit->ReplaceSelected(aRefStr);
+else
+pEdit->SetRefString( aRefStr );
 updateTitle();
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-04-11 Thread Eike Rathke
 sc/source/ui/view/tabvwshf.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9826eb9b6bad6f21801dd8a0016bb770085a9072
Author: Eike Rathke 
Date:   Fri Apr 7 16:20:37 2017 +0200

out-of-bounds tab access when deleting second last sheet

Which in a debug build lead to STL assert
Error: attempt to subscript container with out-of-bounds index

Change-Id: I09fddbc9e4b214b0313c193f85830ed458d20c0e
(cherry picked from commit 0c55972d747511dbc711f3c9cbb4db5d8c5dc2ff)
Reviewed-on: https://gerrit.libreoffice.org/36274
Reviewed-by: Markus Mohrhard 
Tested-by: Jenkins 

diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index a62c76e2d6e3..35d89eb15acb 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -624,13 +624,13 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
 {
 TheTabs.push_back(i);
 bTabFlag = true;
-if (nNewTab == i)
+if (nNewTab == i && i+1 < nTabCount)
 nNewTab++;
 }
 if (!bTabFlag)
 nFirstTab = i;
 }
-if (nNewTab >= nTabCount)
+if (nNewTab >= nTabCount - 
static_cast(TheTabs.size()))
 nNewTab = nFirstTab;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-04-07 Thread Eike Rathke
 sc/source/filter/excel/xlformula.cxx |5 +
 sc/source/filter/oox/formulabase.cxx |4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 84c3729eb210ff255761c4613ba03c4fb5e949f8
Author: Eike Rathke 
Date:   Thu Apr 6 21:15:27 2017 +0200

Resolves: tdf#100011 (re-)add ocCeil and ocFloor .xls(x) export mappings

 This is a combination of 2 commits.

Resolves: tdf#100011 (re-)add ocCeil and ocFloor .xls(x) export mappings

... for CEILING and FLOOR that were lost when introducing CEILING.MATH
and FLOOR.MATH which are semantically identical, but the export needs a
distinct known mapping otherwise the function is stored as a macro call,
which Excel dislikes.

(cherry picked from commit ea01a08763e56a7de66f0c24655a627669c8a7f7)

these FUNCFLAG_EXPORTONLY need also FUNCFLAG_MACROCALL_NEW, tdf#100011 
related

Maybe one day we'll actually use these tables also for export
capabilities ...

(cherry picked from commit 4dd95cadcd330aee49b3c84d3e336b808217af46)

f3d55ec008e321d95b21e0d284c7d58d13a2399b

Change-Id: Id371c1732984a8e5567f74fd265b9aee88fb1898
Reviewed-on: https://gerrit.libreoffice.org/36233
Tested-by: Jenkins 
Reviewed-by: Bartosz Kosiorek 

diff --git a/sc/source/filter/excel/xlformula.cxx 
b/sc/source/filter/excel/xlformula.cxx
index f22a259693a9..7f83306dc659 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -408,6 +408,9 @@ static const XclFunctionInfo saFuncTable_Oox[] =
 #define EXC_FUNCENTRY_V_VR_IMPORT( opcode, minparam, maxparam, flags, 
asciiname ) \
 { opcode, NOID, minparam, maxparam, V, { VR },   
EXC_FUNCFLAG_IMPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }
 
+#define EXC_FUNCENTRY_V_RO_EXPORT( opcode, minparam, maxparam, flags, 
asciiname ) \
+{ opcode,  255, (minparam)+1, (maxparam)+1, V, { RO_E, RO }, 
EXC_FUNCFLAG_EXPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }
+
 #define EXC_FUNCENTRY_A_VR( opcode, minparam, maxparam, flags, asciiname ) \
 { opcode, NOID, minparam, maxparam, A, { VR },   
EXC_FUNCFLAG_IMPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }, \
 { opcode,  255, (minparam)+1, (maxparam)+1, A, { RO_E, RO }, 
EXC_FUNCFLAG_EXPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }
@@ -524,6 +527,7 @@ static const XclFunctionInfo saFuncTable_2013[] =
 EXC_FUNCENTRY_V_VR( ocBitRshift, 2,  2,  0,  "BITRSHIFT" ),
 EXC_FUNCENTRY_V_VR( ocBitXor,2,  2,  0,  "BITXOR" ),
 EXC_FUNCENTRY_V_VR( ocCeil_Math, 1,  3,  0,  "CEILING.MATH" ),
+EXC_FUNCENTRY_V_RO_EXPORT(  ocCeil,  1,  3,  0,  "CEILING.MATH" ),
 EXC_FUNCENTRY_V_VR( ocCombinA,   2,  2,  0,  "COMBINA" ),
 EXC_FUNCENTRY_V_VR_IMPORT(  ocCot,   1,  1,  0,  "COT" ),
 EXC_FUNCENTRY_V_VR_IMPORT(  ocCotHyp,1,  1,  0,  "COTH" ),
@@ -538,6 +542,7 @@ static const XclFunctionInfo saFuncTable_2013[] =
 EXC_FUNCENTRY_V_VR( ocNoName,3,  3,  0,  "FINV" ),
 EXC_FUNCENTRY_V_VR( ocFilterXML, 2,  2,  0,  "FILTERXML" ),
 EXC_FUNCENTRY_V_VR( ocFloor_Math,1,  3,  0,  "FLOOR.MATH" ),
+EXC_FUNCENTRY_V_RO_EXPORT(  ocFloor, 1,  3,  0,  "FLOOR.MATH" ),
 EXC_FUNCENTRY_V_RO( ocFormula,   1,  1,  0,  "FORMULATEXT" ),
 EXC_FUNCENTRY_V_VR( ocGamma, 1,  1,  0,  "GAMMA" ),
 EXC_FUNCENTRY_V_VR( ocGauss, 1,  1,  0,  "GAUSS" ),
diff --git a/sc/source/filter/oox/formulabase.cxx 
b/sc/source/filter/oox/formulabase.cxx
index 6247aaf3b89c..c7fba5d04508 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -785,7 +785,7 @@ static const FunctionData saFuncTable2013[] =
 { "BITRSHIFT",  "BITRSHIFT",NOID,   NOID,   2,  2, 
 V, { VR }, FUNCFLAG_MACROCALL_NEW },
 { "BITXOR", "BITXOR",   NOID,   NOID,   2,  2, 
 V, { VR }, FUNCFLAG_MACROCALL_NEW },
 { "COM.MICROSOFT.CEILING.MATH", "CEILING.MATH", NOID,   NOID,   1,  3, 
 V, { VR }, FUNCFLAG_MACROCALL_NEW },
-{ "CEILING","CEILING.MATH", NOID,   NOID,   1,  3, 
 V, { VR }, FUNCFLAG_EXPORTONLY },
+{ "CEILING","CEILING.MATH", NOID,   NOID,   1,  3, 
 V, { VR }, FUNCFLAG_EXPORTONLY | FUNCFLAG_MACROCALL_NEW },
 { "COMBINA","COMBINA",  NOID,   NOID,   2,  2, 
 V, { VR }, FUNCFLAG_MACROCALL_NEW },
 { "COT","COT",  NOID,   NOID,   1,  1, 
 V, { VR }, FUNCFLAG_MACROCALL_NEW },
 { "COTH",   "COTH", NOID,   NOID,   1,  1, 
 V, { VR }, FUNCFLAG_MACROCALL_NEW },
@@ -796,7 +796,7 @@ static const FunctionData saFuncTable2013[] =
 { "COM.MICROSOFT.ENCODEURL","ENCODEURL",NOID,  

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

2017-03-30 Thread Markus Mohrhard
 sc/source/ui/cctrl/checklistmenu.cxx |   10 ++
 sc/source/ui/inc/checklistmenu.hxx   |   13 -
 sc/source/ui/view/gridwin.cxx|   24 ++--
 sc/source/ui/view/gridwin2.cxx   |   14 +++---
 4 files changed, 35 insertions(+), 26 deletions(-)

New commits:
commit 99744cb30435f2158d29967b77d08d0e4f79492c
Author: Markus Mohrhard 
Date:   Sun Mar 26 22:50:18 2017 +0200

handle date autofilter entries correctly, tdf#106214

Change-Id: I8fd2896c8998e79794a0ccaae1c2442caf8b89ac
Reviewed-on: https://gerrit.libreoffice.org/35730
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit b3d498755238cb0d9a7a3e33b6070c1e4c0e3482)
Reviewed-on: https://gerrit.libreoffice.org/35733
Reviewed-by: Kohei Yoshida 

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index 226f029c6633..e73c229ff975 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -1916,12 +1916,14 @@ void ScCheckListMenuWindow::getResult(ResultType& 
rResult)
 if (aLabel.isEmpty())
 aLabel = ScGlobal::GetRscString(STR_EMPTYDATA);
 bool bState =  maChecks->IsChecked( aLabel,  maMembers[i].mpParent 
);
-OUString sName;
+ResultEntry aResultEntry;
+aResultEntry.bValid = bState;
 if ( maMembers[i].mbDate )
-sName = maMembers[i].maRealName;
+aResultEntry.aName = maMembers[i].maRealName;
 else
-sName = maMembers[i].maName;
-aResult.insert(ResultType::value_type(sName, bState));
+aResultEntry.aName = maMembers[i].maName;
+aResultEntry.bDate = maMembers[i].mbDate;
+aResult.insert(aResultEntry);
 }
 }
 rResult.swap(aResult);
diff --git a/sc/source/ui/inc/checklistmenu.hxx 
b/sc/source/ui/inc/checklistmenu.hxx
index 1ee9e7bdc102..d80e20b76d21 100644
--- a/sc/source/ui/inc/checklistmenu.hxx
+++ b/sc/source/ui/inc/checklistmenu.hxx
@@ -293,7 +293,18 @@ struct ScCheckListMember
 class ScCheckListMenuWindow : public ScMenuFloatingWindow
 {
 public:
-typedef std::unordered_map ResultType;
+struct ResultEntry
+{
+OUString aName;
+bool bValid;
+bool bDate;
+
+bool operator<(const ResultEntry& rhs) const
+{
+return aName < rhs.aName;
+}
+};
+typedef std::set ResultType;
 
 /**
  * Extended data that the client code may need to store.  Create a
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index aea4f5365f3b..317d1941c1f0 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -642,13 +642,16 @@ class AddItemToEntry : public 
std::unary_function
 public:
 AddItemToEntry(ScQueryEntry::QueryItemsType& rItems, 
svl::SharedStringPool& rPool) :
 mrItems(rItems), mrPool(rPool) {}
-void operator() (const OUString& rSelected)
+void operator() (const ScCheckListMenuWindow::ResultEntry& rEntry)
 {
-ScQueryEntry::Item aNew;
-aNew.maString = mrPool.intern(rSelected);
-aNew.meType = ScQueryEntry::ByString;
-aNew.mfVal = 0.0;
-mrItems.push_back(aNew);
+if (rEntry.bValid)
+{
+ScQueryEntry::Item aNew;
+aNew.maString = mrPool.intern(rEntry.aName);
+aNew.meType = rEntry.bDate ? ScQueryEntry::ByDate : 
ScQueryEntry::ByString;
+aNew.mfVal = 0.0;
+mrItems.push_back(aNew);
+}
 }
 };
 
@@ -852,17 +855,10 @@ void 
ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode)
 
 ScCheckListMenuWindow::ResultType aResult;
 mpAutoFilterPopup->getResult(aResult);
-std::vector aSelected;
-ScCheckListMenuWindow::ResultType::const_iterator itr = 
aResult.begin(), itrEnd = aResult.end();
-for (; itr != itrEnd; ++itr)
-{
-if (itr->second)
-aSelected.push_back(itr->first);
-}
 
 ScQueryEntry::QueryItemsType& rItems = pEntry->GetQueryItems();
 rItems.clear();
-std::for_each(aSelected.begin(), aSelected.end(), 
AddItemToEntry(rItems, rPool));
+std::for_each(aResult.begin(), aResult.end(), 
AddItemToEntry(rItems, rPool));
 }
 break;
 case Top10:
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index c2e34db084ea..ae9398ecb416 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -554,29 +554,29 @@ void ScGridWindow::UpdateDPFromFieldPopupMenu()
 

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

2017-03-23 Thread Vitaliy Anderson
 sc/source/ui/cctrl/checklistmenu.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 7dc991097833b0dc60941b388ac60c909529e239
Author: Vitaliy Anderson 
Date:   Thu Mar 9 23:18:09 2017 -0800

tdf#106047 Fix case-insensitive search in autofilter

Change-Id: I67899789b0a51a3a04c2085cbab8c0ed62903413
(cherry picked from commit b0240bf12a94e71d1e2ebe3922afc1a3de5cd933)
Reviewed-on: https://gerrit.libreoffice.org/35544
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index fd56093da389..226f029c6633 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -1215,7 +1215,7 @@ IMPL_LINK_NOARG(ScCheckListMenuWindow, TriStateHdl, 
Button*, void)
 IMPL_LINK_NOARG(ScCheckListMenuWindow, EdModifyHdl, Edit&, void)
 {
 OUString aSearchText = maEdSearch->GetText();
-aSearchText = aSearchText.toAsciiLowerCase();
+aSearchText = ScGlobal::pCharClass->lowercase( aSearchText );
 bool bSearchTextEmpty = aSearchText.isEmpty();
 size_t n = maMembers.size();
 size_t nSelCount = 0;
@@ -1234,10 +1234,10 @@ IMPL_LINK_NOARG(ScCheckListMenuWindow, EdModifyHdl, 
Edit&, void)
 if ( !bSearchTextEmpty )
 {
 if ( !bIsDate )
-bPartialMatch = ( aLabelDisp.toAsciiLowerCase().indexOf( 
aSearchText ) != -1 );
+bPartialMatch = ( ScGlobal::pCharClass->lowercase( aLabelDisp 
).indexOf( aSearchText ) != -1 );
 else if ( maMembers[i].meDatePartType == ScCheckListMember::DAY ) 
// Match with both numerical and text version of month
-bPartialMatch = bPartialMatch || ( OUString( 
maMembers[i].maRealName + maMembers[i].maDateParts[1] )
-   
.toAsciiLowerCase().indexOf( aSearchText ) != -1 );
+bPartialMatch = bPartialMatch || ( 
ScGlobal::pCharClass->lowercase( OUString( maMembers[i].maRealName + 
maMembers[i].maDateParts[1] ) )
+   .indexOf( aSearchText ) != 
-1 );
 else
 continue;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-03-21 Thread Kohei Yoshida
 sc/source/ui/vba/vbarange.cxx |   16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 5112b09445069015de6f82524ea9247a1d73f35e
Author: Kohei Yoshida 
Date:   Thu Mar 16 18:55:42 2017 -0400

tdf#104383: prevent crash during file load.

Apparently xView may be null sometimes.

Change-Id: Icef81159eeaf5c9bdb0a91e036019b820952d20b
(cherry picked from commit 273d7cec114ace96c5d891fdb24ddc36be3a2376)
Reviewed-on: https://gerrit.libreoffice.org/35520
Reviewed-by: Markus Mohrhard 
Tested-by: Jenkins 

diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index f68d5495a9d8..af3a4e6c48e1 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -4215,8 +4215,20 @@ ScVbaRange::ApplicationRange( const uno::Reference< 
uno::XComponentContext >& xC
 }
 }
 
-uno::Reference< sheet::XSpreadsheetView > xView( 
getCurrentExcelDoc(xContext)->getCurrentController(), uno::UNO_QUERY );
-uno::Reference< table::XCellRange > xSheetRange( xView->getActiveSheet(), 
uno::UNO_QUERY_THROW );
+uno::Reference xSheetRange;
+
+try
+{
+uno::Reference xView(
+getCurrentExcelDoc(xContext)->getCurrentController(), 
uno::UNO_QUERY_THROW);
+
+xSheetRange.set(xView->getActiveSheet(), uno::UNO_QUERY_THROW);
+}
+catch (const uno::Exception&)
+{
+return uno::Reference();
+}
+
 ScVbaRange* pRange = new ScVbaRange( excel::getUnoSheetModuleObj( 
xSheetRange ), xContext, xSheetRange );
 uno::Reference< excel::XRange > xVbSheetRange( pRange );
 return pRange->Range( Cell1, Cell2, 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-3' - sc/source

2017-03-17 Thread Markus Mohrhard
 sc/source/core/data/conditio.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 0ee960fb555deb0a91e8c0e81812ab888ff13c2f
Author: Markus Mohrhard 
Date:   Thu Mar 16 20:08:30 2017 +0100

the range should be updated after the references, tdf#104026

Change-Id: I2cb674b8b3bc64df031b473b337d266a2eaab43d
Reviewed-on: https://gerrit.libreoffice.org/35289
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit 3f0f35c89f3f64fcb110483fd562a59f729dc344)
Reviewed-on: https://gerrit.libreoffice.org/35297
Reviewed-by: Christian Lohmaier 

diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 6657dcf37608..f4f0f116ba61 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1926,13 +1926,13 @@ void ScConditionalFormat::CompileXML()
 
 void ScConditionalFormat::UpdateReference( sc::RefUpdateContext& rCxt, bool 
bCopyAsMove )
 {
+for(CondFormatContainer::iterator itr = maEntries.begin(); itr != 
maEntries.end(); ++itr)
+(*itr)->UpdateReference(rCxt);
+
 if (rCxt.meMode == URM_COPY && bCopyAsMove)
 maRanges.UpdateReference(URM_MOVE, pDoc, rCxt.maRange, 
rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta);
 else
 maRanges.UpdateReference(rCxt.meMode, pDoc, rCxt.maRange, 
rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta);
-
-for(CondFormatContainer::iterator itr = maEntries.begin(); itr != 
maEntries.end(); ++itr)
-(*itr)->UpdateReference(rCxt);
 }
 
 void ScConditionalFormat::InsertRow(SCTAB nTab, SCCOL nColStart, SCCOL 
nColEnd, SCROW nRowPos, SCSIZE nSize)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-03-17 Thread Eike Rathke
 sc/source/ui/docshell/docsh5.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit d846a0d7643cf32a43069d9beb3a419a5a4af9f4
Author: Eike Rathke 
Date:   Mon Mar 6 22:26:32 2017 +0100

Resolves: tdf#102777 broadcast SC_TAB_INSERTED when inserting scenario

So ScViewData::maTabData gets an entry added which deleting the scenario
can remove again.

(cherry picked from commit 4c8059a3e140171399ac85ceb882d23bb458599d)

Change-Id: I166baeff5408ef67faef41364515a13b8d4610bb
Reviewed-on: https://gerrit.libreoffice.org/34942
Tested-by: Jenkins 
Reviewed-by: Christian Lohmaier 

diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index d3437b8c5dcb..368042114ce8 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -824,6 +824,9 @@ SCTAB ScDocShell::MakeScenario( SCTAB nTab, const OUString& 
rName, const OUStrin
 PostPaintExtras();  // 
Tabellenreiter
 aModificator.SetDocumentModified();
 
+// A scenario tab is like a hidden sheet, broadcasting also
+// notifies ScTabViewShell to add an ScViewData::maTabData entry.
+Broadcast( ScTablesHint( SC_TAB_INSERTED, nNewTab ));
 SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) );
 
 return nNewTab;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-03-14 Thread Markus Mohrhard
 sc/source/ui/view/cellsh1.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit d9128bc895bfa9740cd85c766a10217e35aaa937
Author: Markus Mohrhard 
Date:   Mon Feb 13 19:27:57 2017 +0100

don't forget to set the managed flag, tdf#105544

Change-Id: I46d534a157b05ce22ba42e269ca8266e3403ecd2
Reviewed-on: https://gerrit.libreoffice.org/34229
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 
(cherry picked from commit 0b9e33cceb635cd3c173bd1f461af98cfd6f6ed2)
Reviewed-on: https://gerrit.libreoffice.org/35182
Tested-by: Jenkins 
Reviewed-by: Katarina Behrens 

diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index f17de35..2fa4fb6 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1947,6 +1947,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
 {
 const ScCondFormatDlgItem* pDlgItem = 
static_cast(pItem);
 nIndex = pDlgItem->GetIndex();
+bManaged = 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-3' - sc/source

2017-03-14 Thread Markus Mohrhard
 sc/source/filter/oox/condformatcontext.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit e237c0109c94da27715c115cecee69d382d6c183
Author: Markus Mohrhard 
Date:   Sat Feb 18 02:30:11 2017 +0100

fix conditional format import from XLSB, tdf#105486

Change-Id: I2b781f45221e434c8ec0ee079afb54c505faf2b5
Reviewed-on: https://gerrit.libreoffice.org/34396
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 
(cherry picked from commit aaea9beabcdfa16ffd36116591c5ebea25906b94)
Reviewed-on: https://gerrit.libreoffice.org/35154
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/filter/oox/condformatcontext.cxx 
b/sc/source/filter/oox/condformatcontext.cxx
index 79c92d2..4a87664 100644
--- a/sc/source/filter/oox/condformatcontext.cxx
+++ b/sc/source/filter/oox/condformatcontext.cxx
@@ -253,7 +253,9 @@ void CondFormatContext::onEndRecord()
 {
 case BIFF12_ID_CONDFORMATTING:
 if( mxCondFmt.get() )
-mxCondFmt->finalizeImport();
+{
+mxCondFmt->setReadyForFinalize();
+}
 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-3' - sc/source

2017-03-14 Thread Markus Mohrhard
 sc/source/core/tool/interpr4.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 20bcaeb0f8509e4b12d72d4612b5f3c9bfde3489
Author: Markus Mohrhard 
Date:   Mon Mar 13 12:45:07 2017 +0100

tdf#106456, don't try to use invalid ranges in external ref code

Change-Id: I38e622df87dd4b5e37dd248c5181978e13890fda
Reviewed-on: https://gerrit.libreoffice.org/35132
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit 951fcc6556346e19a028443c70dea27d0cbc9c36)
Reviewed-on: https://gerrit.libreoffice.org/35180
Reviewed-by: Eike Rathke 

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index f266491..7a0b08b 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1317,6 +1317,12 @@ void ScInterpreter::GetExternalDoubleRef(
 
 ScComplexRefData aData(rData);
 ScRange aRange = aData.toAbs(aPos);
+if (!ValidColRow(aRange.aStart.Col(), aRange.aStart.Row()) || 
!ValidColRow(aRange.aEnd.Col(), aRange.aEnd.Row()))
+{
+SetError(FormulaError::NoRef);
+return;
+}
+
 ScExternalRefCache::TokenArrayRef pArray = pRefMgr->getDoubleRefTokens(
 nFileId, rTabName, aRange, );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-03-13 Thread Eike Rathke
 sc/source/core/data/grouptokenconverter.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit b16868ab2f7f3f0e09d68faba75d16fff1d851c1
Author: Eike Rathke 
Date:   Fri Mar 10 18:32:27 2017 +0100

Resolves: tdf#106459 3D reference can't be handled as vector reference

Change-Id: Icba12a6218086079a7d5538f7263bccb1f2ee1b0
(cherry picked from commit ca1f051972946b24cb6658143fb0d0ac3587a988)
Reviewed-on: https://gerrit.libreoffice.org/35051
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/data/grouptokenconverter.cxx 
b/sc/source/core/data/grouptokenconverter.cxx
index 024a252..12751a1 100644
--- a/sc/source/core/data/grouptokenconverter.cxx
+++ b/sc/source/core/data/grouptokenconverter.cxx
@@ -169,6 +169,10 @@ bool ScGroupTokenConverter::convert( ScTokenArray& rCode, 
sc::FormulaLogger::Gro
 ScComplexRefData aRef = *p->GetDoubleRef();
 ScRange aAbs = aRef.toAbs(mrPos);
 
+// Multiple sheets not handled by vector/matrix.
+if (aRef.Ref1.Tab() != aRef.Ref2.Tab())
+return false;
+
 // Check for self reference.
 if (aRef.Ref1.IsRowRel())
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-03-10 Thread Katarina Behrens
 sc/source/ui/view/preview.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit acd58ceaa1d792d0a16c270c56ff727321fb2aac
Author: Katarina Behrens 
Date:   Wed Mar 1 17:45:16 2017 +0100

tdf#95612: Print preview: page numbering starts with 1 (not 0)

unless otherwise specified. It was okay for 1st page & broken
everywhere else. Possibly resolves tdf#95206 as well ...

Change-Id: Ie69f770a28dd69f90d4f04ad4fa9e701fa2d56e2
Reviewed-on: https://gerrit.libreoffice.org/34759
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 
(cherry picked from commit c07ac0d92ad830762906586164bab466a0f05531)
Reviewed-on: https://gerrit.libreoffice.org/34946

diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index 7099142..bf8115a 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -249,18 +249,18 @@ void ScPreview::CalcPages()
 while (nStart > static_cast(nPages.size()))
 nPages.push_back(0);
 while (nStart > static_cast(nFirstAttr.size()))
-nFirstAttr.push_back(0);
+nFirstAttr.push_back(1);
 
 for (SCTAB i=nStart; i

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

2017-03-07 Thread Jean-Sebastien Bevilacqua
 sc/source/core/data/column3.cxx |   69 +---
 1 file changed, 65 insertions(+), 4 deletions(-)

New commits:
commit 3e4db9f12046255dbcd968b28c670cb83cf83418
Author: Jean-Sebastien Bevilacqua 
Date:   Thu Feb 9 09:30:56 2017 +0100

tdf#101904 Fix Date deleting in SCalc

Introduction


In SCalc, when you want to clear contents, a dialog box asks you the
data type you want to delete. For example, if you select `Date & time`,
only cells of type `Datetime` should be deleted in the selected area.

Currently, this feature is not working for datetime type. To delete
datetime cells, you must select `Numbers` type. Datetime type is seen
as number.

Context of this fix
---

First, `DeleteAreaHandler::operator` function is called for each area
to delete. In this context, area has a special meaning. An area is a
group of consecutive cells (on column) of the same datatype (numeric,
formula...).

To locate area in the column, we use the `node.position` attribute which
contains the row index of the cell (remember area can be only on one column)
and `nDataSize` which contains the number of rows.

How this fix works
--

In `deleteNumeric` function, we loop through area rows to detect if cell
contains a numeric value or a datetime value. To optimize performance,
we don't delete cells one by one but we get a range of the same datatype.
As long as datatype stays the same, we add current cell to a "sub-area"
but as soon as datatype switches (datetime -> number or number -> datetime),
we delete this sub-area. Finally, at the end of `deleteNumeric` function,
we delete the last "sub-area".

Note


`deleteNumberOrDateTime` function deletes rows only if the corresponding
flag in the dialog box is setted: `mbNumeric` for `Numbers` and
`mbDateTime` for `Date & time`.

Change-Id: I24c0b3c0a6195211af71aa18d867df82109fa941
Reviewed-on: https://gerrit.libreoffice.org/34068
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit 4575d7cf657ae291c427c2318eb4600cec2f12b7)
Reviewed-on: https://gerrit.libreoffice.org/34956

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 3af350d..73da282 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -541,21 +541,33 @@ class DeleteAreaHandler
 bool mbNumeric:1;
 bool mbString:1;
 bool mbFormula:1;
+bool mbDateTime:1;
+ScColumn& mrCol;
 
 public:
-DeleteAreaHandler(ScDocument& rDoc, InsertDeleteFlags nDelFlag) :
+DeleteAreaHandler(ScDocument& rDoc, InsertDeleteFlags nDelFlag, ScColumn& 
rCol) :
 mrDoc(rDoc),
 mbNumeric(nDelFlag & InsertDeleteFlags::VALUE),
 mbString(nDelFlag & InsertDeleteFlags::STRING),
-mbFormula(nDelFlag & InsertDeleteFlags::FORMULA) {}
+mbFormula(nDelFlag & InsertDeleteFlags::FORMULA),
+mbDateTime(nDelFlag & InsertDeleteFlags::DATETIME),
+mrCol(rCol) {}
 
 void operator() (const sc::CellStoreType::value_type& node, size_t 
nOffset, size_t nDataSize)
 {
 switch (node.type)
 {
 case sc::element_type_numeric:
-if (!mbNumeric)
+// Numeric type target datetime and number, thus we have a 
dedicated function
+if (!mbNumeric && !mbDateTime)
 return;
+
+// If numeric and datetime selected, delete full range
+if (mbNumeric && mbDateTime)
+break;
+
+deleteNumeric(node, nOffset, nDataSize);
+return;
 break;
 case sc::element_type_string:
 case sc::element_type_edittext:
@@ -587,6 +599,55 @@ public:
 maDeleteRanges.set(nRow1, nRow2, true);
 }
 
+void deleteNumeric(const sc::CellStoreType::value_type& node, size_t 
nOffset, size_t nDataSize)
+{
+size_t nStart = node.position + nOffset;
+size_t nElements = 1;
+bool bLastTypeDateTime = isDateTime(nStart); // true = datetime, false 
= numeric
+size_t nCount = nStart + nDataSize;
+
+for (size_t i = nStart + 1; i < nCount; i++)
+{
+bool bIsDateTime = isDateTime(i);
+
+// same type as previous
+if (bIsDateTime == bLastTypeDateTime)
+{
+nElements++;
+}
+// type switching
+else
+{
+deleteNumberOrDateTime(nStart, nStart + nElements - 1, 
bLastTypeDateTime);
+nStart += nElements;
+nElements = 1;
+}
+
+bLastTypeDateTime = bIsDateTime;
+}

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

2017-03-07 Thread Tomaž Vajngerl
 sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c713f227cc34b841c06beca2e9eaa96653eac372
Author: Tomaž Vajngerl 
Date:   Thu Mar 2 09:30:21 2017 +0100

tdf#104117 set template parameter sal_Int64 for random

Change-Id: Ie8cef4375608df160b383ff74c32838f00e60aba
Reviewed-on: https://gerrit.libreoffice.org/34777
Tested-by: Jenkins 
Reviewed-by: Kohei Yoshida 
(cherry picked from commit 23672df737258391bd9533e61733c6cc70b9a5eb)
Reviewed-on: https://gerrit.libreoffice.org/34817
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx 
b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
index c59e9cc..56cd2e6 100644
--- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
@@ -223,7 +223,7 @@ void 
ScRandomNumberGeneratorDialog::SelectGeneratorAndGenerateNumbers()
 }
 case DIST_UNIFORM_INTEGER:
 {
-std::uniform_int_distribution<> distribution(parameterInteger1, 
parameterInteger2);
+std::uniform_int_distribution 
distribution(parameterInteger1, parameterInteger2);
 auto rng = std::bind(distribution, seed);
 GenerateNumbers(rng, STR_DISTRIBUTION_UNIFORM_INTEGER, 
aDecimalPlaces);
 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-3' - sc/source

2017-02-25 Thread Markus Mohrhard
 sc/source/core/data/document.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 96b7d1d5d6e97078508f9366b340c65ab0a0cc75
Author: Markus Mohrhard 
Date:   Fri Feb 24 23:10:57 2017 +0100

xPoolHelper is empty in a clipboard doc

Found by the crashreporter:

http://crashreport.libreoffice.org/stats/signature/ScDocument::IsClipboardSource()

Change-Id: I3fb030921b653396deb46a9e98d30d5df9c9ce15
(cherry picked from commit c63ff2a769f4601f67ffd13cb36df63c70fdd601)
Reviewed-on: https://gerrit.libreoffice.org/34641
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 27456da..80fb075 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2516,7 +2516,7 @@ void ScDocument::SetClipParam(const ScClipParam& rParam)
 bool ScDocument::IsClipboardSource() const
 {
 ScDocument* pClipDoc = ScModule::GetClipDoc();
-return pClipDoc && pClipDoc->xPoolHelper.is() &&
+return xPoolHelper.is() && pClipDoc && pClipDoc->xPoolHelper.is() &&
 xPoolHelper->GetDocPool() == pClipDoc->xPoolHelper->GetDocPool();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-24 Thread Caolán McNamara
 sc/source/ui/inc/tabview.hxx   |5 +
 sc/source/ui/view/tabview.cxx  |1 +
 sc/source/ui/view/tabview4.cxx |   26 ++
 3 files changed, 28 insertions(+), 4 deletions(-)

New commits:
commit 0acb7b80667b83ad05782dafa23721d0030c3b16
Author: Caolán McNamara 
Date:   Mon Feb 20 15:40:31 2017 +

Resolves: tdf#105854 retain popover if it has the same pos, size and 
settings

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

diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 948f599..0056063 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -20,6 +20,7 @@
 #define INCLUDED_SC_SOURCE_UI_INC_TABVIEW_HXX
 
 #include 
+#include 
 
 #include 
 
@@ -169,6 +170,10 @@ private:
 ScExtraEditViewManager aExtraEditViewManager;
 
 sal_uLong   nTipVisible;
+Rectangle   aTipRectangle;
+QuickHelpFlags  nTipAlign;
+OUStringsTipString;
+VclPtr sTopParent;
 
 longnPrevDragPos;
 
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 81ae3c7..e12b89a 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -210,6 +210,7 @@ ScTabView::ScTabView( vcl::Window* pParent, ScDocShell& 
rDocSh, ScTabViewShell*
 pTimerWindow( nullptr ),
 aExtraEditViewManager( pViewShell, pGridWin ),
 nTipVisible( 0 ),
+nTipAlign( QuickHelpFlags::NONE ),
 nPrevDragPos( 0 ),
 meBlockMode(None),
 nBlockStartX( 0 ),
diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index fbb40fa..772677c 100644
--- a/sc/source/ui/view/tabview4.cxx
+++ b/sc/source/ui/view/tabview4.cxx
@@ -41,6 +41,10 @@ void ScTabView::HideTip()
 vcl::Window* pWin = pGridWin[eWhich];
 Help::HidePopover(pWin, nTipVisible);
 nTipVisible = 0;
+aTipRectangle = Rectangle();
+nTipAlign = QuickHelpFlags::NONE;
+sTipString.clear();
+sTopParent.clear();
 }
 }
 
@@ -91,8 +95,15 @@ void ScTabView::ShowRefTip()
 
 //! Test, ob geaendert ??
 
-HideTip();
-nTipVisible = Help::ShowPopover(pWin, aRect, aHelp, nFlags);
+if (!nTipVisible || nFlags != nTipAlign || aRect != 
aTipRectangle || sTipString != aHelp || sTopParent != pWin)
+{
+HideTip();
+nTipVisible = Help::ShowPopover(pWin, aRect, aHelp, 
nFlags);
+aTipRectangle = aRect;
+nTipAlign = nFlags;
+sTipString = aHelp;
+sTopParent = pWin;
+}
 bDone = true;
 }
 }
@@ -278,8 +289,15 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB 
nCurZ )
 aPos = pWin->OutputToScreenPixel( aPos );
 Rectangle aRect( aPos, aPos );
 QuickHelpFlags nAlign = 
QuickHelpFlags::Left|QuickHelpFlags::Top;
-HideTip();
-nTipVisible = Help::ShowPopover(pWin, aRect, aHelpStr, nAlign);
+if (!nTipVisible || nAlign != nTipAlign || aRect != 
aTipRectangle || sTipString != aHelpStr || sTopParent != pWin)
+{
+HideTip();
+nTipVisible = Help::ShowPopover(pWin, aRect, aHelpStr, 
nAlign);
+aTipRectangle = aRect;
+nTipAlign = nAlign;
+sTipString = aHelpStr;
+sTopParent = pWin;
+}
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-23 Thread Eike Rathke
 sc/source/ui/undo/undoblk3.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 4ecdb497d540e69590476919f4cb1d02a8025c2e
Author: Eike Rathke 
Date:   Fri Feb 17 23:54:21 2017 +0100

Resolves: tdf#105667 forget target area's caption pointer in Merge Undo

It's the same that was copied to the Undo document, so don't delete the
caption.

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

diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 7d1f2d9..56a2b41 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -701,7 +701,13 @@ void ScUndoMerge::DoChange( bool bUndo ) const
 // undo -> copy back deleted contents
 if (bUndo && mpUndoDoc)
 {
-rDoc.DeleteAreaTab( aRange, 
InsertDeleteFlags::CONTENTS|InsertDeleteFlags::NOCAPTIONS );
+// If there are note captions to be deleted during Undo they were
+// kept or moved during the merge and copied to the Undo document
+// without cloning the caption. Forget the target area's caption
+// pointer that is identical to the one in the Undo document
+// instead of deleting it.
+rDoc.DeleteAreaTab( aRange,
+InsertDeleteFlags::CONTENTS | 
InsertDeleteFlags::NOCAPTIONS | InsertDeleteFlags::FORGETCAPTIONS );
 mpUndoDoc->CopyToDocument(aRange, 
InsertDeleteFlags::ALL|InsertDeleteFlags::NOCAPTIONS, false, rDoc);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-21 Thread Eike Rathke
 sc/source/ui/drawfunc/fuins2.cxx |   17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 69bc288b0aac0672cf560dec2c4c946e9620ea62
Author: Eike Rathke 
Date:   Mon Feb 20 22:26:40 2017 +0100

Resolves: tdf#106089 generate range string with current address convention

 This is a combination of 2 commits.

Resolves: tdf#106089 catch legal IllegalArgumentException on bad range 
string

... that for example doesn't match the document's current address 
convention.
Further work is need to make that actually fly, but at least don't terminate
the application but come up with a default Chart instead where the range 
can be
edited.

(cherry picked from commit 0200677891c6d592a12343f0d6f82c569cd7a9e0)

Related: tdf#106089 generate range string with current address convention

... so subsequent parsing actually works.

(cherry picked from commit 3ec3d7ead0f2e47a4e24ba0d6953fea0f49815ed)

47d661d24552104b56827248b4c5e6a6617c5d63

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

diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index 41610a0..9a9e132 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -114,7 +114,7 @@ void lcl_ChartInit( const uno::Reference < 
embed::XEmbeddedObject >& xObj, ScVie
 pDoc->LimitChartArea( nTab1, nCol1,nRow1, nCol2,nRow2 );
 
 ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
-aRangeString = aRange.Format(ScRefFlags::RANGE_ABS_3D, 
);
+aRangeString = aRange.Format(ScRefFlags::RANGE_ABS_3D, 
, rScDoc.GetAddressConvention());
 }
 }
 }
@@ -186,7 +186,20 @@ void lcl_ChartInit( const uno::Reference < 
embed::XEmbeddedObject >& xObj, ScVie
 aArgs[3] = beans::PropertyValue(
 OUString("DataRowSource"), -1,
 uno::makeAny( eDataRowSource ), 
beans::PropertyState_DIRECT_VALUE );
-xReceiver->setArguments( aArgs );
+
+try
+{
+xReceiver->setArguments( aArgs );
+}
+catch (const lang::IllegalArgumentException& e)
+{
+// Can happen for invalid aRangeString, in which case a Chart
+// will be created nevertheless and the range string can be
+// edited.
+SAL_WARN("sc.ui",
+"lcl_ChartInit - caught IllegalArgumentException with 
message \"" << e.Message << "\","
+" might be due to aRangeString: " << aRangeString);
+}
 
 // don't create chart listener here (range may be modified in 
chart dialog)
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-17 Thread Eike Rathke
 sc/source/core/data/dpoutput.cxx |  118 +++
 1 file changed, 71 insertions(+), 47 deletions(-)

New commits:
commit e38914af31b0150a383cc556e634da48eceb1dbc
Author: Eike Rathke 
Date:   Fri Feb 17 14:10:37 2017 +0100

Resolves: tdf#105858 check SC_DPOUT_MAXLEVELS to prevent crash

This is a combination of 2 commits.

Resolves: tdf#105858 check nDataCounthttps://gerrit.libreoffice.org/34369
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index 031aa12..6f1faf8 100644
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -344,9 +344,10 @@ void lcl_FillNumberFormats( sal_uInt32*& rFormats, long& 
rCount,
 
 OUString aDataNames[SC_DPOUT_MAXLEVELS];
 sal_uInt32 nDataFormats[SC_DPOUT_MAXLEVELS];
-long nDataCount = 0;
-long nDimCount = xDims->getCount();
-for (long nDim=0; nDimgetCount();
+sal_Int32 nDim = 0;
+for ( ; nDim < nDimCount && nDataCount < SC_DPOUT_MAXLEVELS; nDim++)
 {
 uno::Reference xDim =
 ScUnoHelpFunctions::AnyToInterface( xDims->getByIndex(nDim) );
@@ -369,6 +370,8 @@ void lcl_FillNumberFormats( sal_uInt32*& rFormats, long& 
rCount,
 }
 }
 }
+SAL_WARN_IF( nDim < nDimCount && nDataCount == SC_DPOUT_MAXLEVELS, 
"sc.core",
+"lcl_FillNumberFormats - may have lost an output level due to 
SC_DPOUT_MAXLEVELS=" << SC_DPOUT_MAXLEVELS);
 
 if (!nDataCount)
 return;
@@ -394,7 +397,7 @@ void lcl_FillNumberFormats( sal_uInt32*& rFormats, long& 
rCount,
 aName = pArray[nPos].Name;
 
 sal_uInt32 nFormat = 0;
-for (long i=0; igetResults();
+
pColFields[nColFieldCount].mnSrcNumFmt = nNumFmt;
+pColFields[nColFieldCount].maName  
= aName;
+
pColFields[nColFieldCount].maCaption= aCaption;
+pColFields[nColFieldCount].mfValue 
= fValue;
+
pColFields[nColFieldCount].mbHasHiddenMember = bHasHiddenMember;
+
pColFields[nColFieldCount].mbDataLayout = bIsDataLayout;
+if 
(!lcl_MemberEmpty(pColFields[nColFieldCount].aResult))
+++nColFieldCount;
+}
+else
+{
+SAL_WARN("sc.core","ScDPOutput - 
nColFieldCount already at SC_DPOUT_MAXLEVELS=" << SC_DPOUT_MAXLEVELS);
+}
+break;
 case sheet::DataPilotFieldOrientation_ROW:
-pRowFields[nRowFieldCount].nDim= 
nDim;
-pRowFields[nRowFieldCount].nHier   = 
nHierarchy;
-   

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

2017-02-16 Thread Kohei Yoshida
 sc/source/ui/view/viewfunc.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3b24499324a149626a6b57ea8ec32bf2a5f84152
Author: Kohei Yoshida 
Date:   Fri Feb 10 22:48:41 2017 -0500

tdf#95306: Be sure to specify the entire range.

Especially in presence of multiple disjointed selections.

Change-Id: I8e7779824109c30e69fd43a2448ae900beaf28d3
Reviewed-on: https://gerrit.libreoffice.org/34140
Tested-by: Jenkins 
Reviewed-by: Kohei Yoshida 
(cherry picked from commit 6d450aad0a8f82ee0320ffc3e76eefb43c16addb)
Reviewed-on: https://gerrit.libreoffice.org/34143
Reviewed-by: Christian Lohmaier 

diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index ef317d7..0228541 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1871,8 +1871,8 @@ void ScViewFunc::SetWidthOrHeight(
 return;
 }
 
-SCCOLROW nStart = rRanges[0].mnStart;
-SCCOLROW nEnd = rRanges[0].mnEnd;
+SCCOLROW nStart = rRanges.front().mnStart;
+SCCOLROW nEnd = rRanges.back().mnEnd;
 
 bool bFormula = false;
 if ( eMode == SC_SIZE_OPTIMAL )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-15 Thread Justin Luth
 sc/source/filter/excel/xetable.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit dccb8131161ebf7487c3e7fee41fb30aad37118a
Author: Justin Luth 
Date:   Wed Feb 8 19:32:14 2017 +0300

Optimize Excel GetOrCreateRow: compare to previous map entry

Follow-up patch to 09e9274fc080b471393b806617eb03124db67590 and
related to tdf#105840. Just keeping the non-dependent parts
separate, and building up to a solution for bug 105840.

Change-Id: I129e671f71de6abf876a82d4a6503695add85548
Reviewed-on: https://gerrit.libreoffice.org/34039
Reviewed-by: Justin Luth 
Tested-by: Justin Luth 
Reviewed-by: Bartosz Kosiorek 
Reviewed-on: https://gerrit.libreoffice.org/34276
Tested-by: Jenkins 

diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index 9f8eec1..b954c74 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -2381,9 +2381,11 @@ XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt32 
nXclRow, bool bRowAlwaysE
 if( !bFound || bFoundHigher )
 {
 size_t nFrom = 0;
+RowRef pPrevEntry = nullptr;
 if( itr != maRowMap.begin() )
 {
 --itr;
+pPrevEntry = itr->second;
 if( bFoundHigher )
 nFrom = nXclRow;
 else
@@ -2403,10 +2405,10 @@ XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt32 
nXclRow, bool bRowAlwaysE
 // not set, to correctly export the heights of rows with wrapped
 // texts.
 const sal_uInt16 nHeight = rDoc.GetRowHeight(nFrom, nScTab, false);
-if ( !nFrom || ( nFrom == nXclRow ) || bHidden ||
+if ( !pPrevEntry || ( nFrom == nXclRow ) || bHidden ||
  ( maOutlineBfr.IsCollapsed() ) ||
  ( maOutlineBfr.GetLevel() != 0 ) ||
- ( nHeight != rDoc.GetRowHeight(nFrom - 1, nScTab, false) ) )
+ ( nHeight != pPrevEntry->GetHeight() ) )
 {
 if( maOutlineBfr.GetLevel() > mnHighestOutlineLevel )
 {
@@ -2414,6 +2416,7 @@ XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt32 
nXclRow, bool bRowAlwaysE
 }
 RowRef p(new XclExpRow(GetRoot(), nFrom, maOutlineBfr, 
bRowAlwaysEmpty));
 maRowMap.insert(RowMap::value_type(nFrom, p));
+pPrevEntry = p;
 }
 ++nFrom;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-15 Thread Justin Luth
 sc/source/filter/excel/xetable.cxx |   37 +++--
 1 file changed, 27 insertions(+), 10 deletions(-)

New commits:
commit 854bae75ab891423182f11604aedc42c6bfa334e
Author: Justin Luth 
Date:   Wed Feb 8 19:08:07 2017 +0300

Optimize Excel GetOrCreateRow: reduce loops

for ( size_t nFrom = maRowMap.size(); nFrom <= nXclRow; ++nFrom )

This previous code worked best under the assumption
that every row is added to the map. However, the size of the
map actually has no correlation to the row numbers contained in it
when many rows are identical to each other (think silly formatting
and empty rows - related to tdf#105840)
Thus row 1,000,000 could occupy slot 2, and every access of that row
would then trigger nearly 1 million redundant loops.

Optimize:
-check to see if the row already exists - if so do nothing.
-existance of higher rows indicates there are no missing rows.
-build missing rows from the previously-mapped row.

Reviewed-on: https://gerrit.libreoffice.org/34038
Tested-by: Jenkins 
Reviewed-by: Bartosz Kosiorek 

Conflicts:

sc/source/filter/excel/xetable.cxx

Change-Id: Ib02520a1bf0f77b5ca0ec5ad3165ff7ea879515f
Reviewed-on: https://gerrit.libreoffice.org/34275
Tested-by: Jenkins 
Reviewed-by: Bartosz Kosiorek 

diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index fe39f238..9f8eec1 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -2374,22 +2374,39 @@ void XclExpRowBuffer::SaveXml( XclExpXmlStream& rStrm )
 
 XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt32 nXclRow, bool 
bRowAlwaysEmpty )
 {
-RowMap::iterator itr = maRowMap.begin();
-ScDocument& rDoc = GetRoot().GetDoc();
-SCTAB nScTab = GetRoot().GetCurrScTab();
-for ( size_t nFrom = maRowMap.size(); nFrom <= nXclRow; ++nFrom )
+RowMap::iterator itr = maRowMap.lower_bound( nXclRow );
+const bool bFound = itr != maRowMap.end();
+// bFoundHigher: nXclRow was identical to the previous entry, so not 
explicitly created earlier
+const bool bFoundHigher = bFound && itr != maRowMap.find( nXclRow );
+if( !bFound || bFoundHigher )
 {
-itr = maRowMap.find(nFrom);
-if ( itr == maRowMap.end() )
+size_t nFrom = 0;
+if( itr != maRowMap.begin() )
+{
+--itr;
+if( bFoundHigher )
+nFrom = nXclRow;
+else
+nFrom = itr->first + 1;
+}
+
+const ScDocument& rDoc = GetRoot().GetDoc();
+const SCTAB nScTab = GetRoot().GetCurrScTab();
+// create the missing rows first
+while( nFrom <= nXclRow )
 {
 // only create RowMap entries if it is first row in spreadsheet,
 // if it is the desired row, for rows that height differ from 
previous,
 // if row is collapsed, has outline level (tdf#100347), or row is 
hidden (tdf#98106).
-if ( !nFrom || ( nFrom == nXclRow ) ||
- ( rDoc.GetRowHeight(nFrom, nScTab, false) != 
rDoc.GetRowHeight(nFrom - 1, nScTab, false) ) ||
+const bool bHidden = rDoc.RowHidden(nFrom, nScTab);
+// Always get the actual row height even if the manual size flag is
+// not set, to correctly export the heights of rows with wrapped
+// texts.
+const sal_uInt16 nHeight = rDoc.GetRowHeight(nFrom, nScTab, false);
+if ( !nFrom || ( nFrom == nXclRow ) || bHidden ||
  ( maOutlineBfr.IsCollapsed() ) ||
  ( maOutlineBfr.GetLevel() != 0 ) ||
- ( rDoc.RowHidden(nFrom, nScTab) ) )
+ ( nHeight != rDoc.GetRowHeight(nFrom - 1, nScTab, false) ) )
 {
 if( maOutlineBfr.GetLevel() > mnHighestOutlineLevel )
 {
@@ -2398,11 +2415,11 @@ XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt32 
nXclRow, bool bRowAlwaysE
 RowRef p(new XclExpRow(GetRoot(), nFrom, maOutlineBfr, 
bRowAlwaysEmpty));
 maRowMap.insert(RowMap::value_type(nFrom, p));
 }
+++nFrom;
 }
 }
 itr = maRowMap.find(nXclRow);
 return *itr->second;
-
 }
 
 // Cell Table
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-14 Thread Kohei Yoshida
 sc/source/core/tool/token.cxx |   13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

New commits:
commit 68b53bb080a73027661260b9927245b64a940161
Author: Kohei Yoshida 
Date:   Wed Feb 8 21:43:01 2017 -0500

tdf#103890: Fix the logic on setting 3D flag on reference.

This is a backport commit that combines 3 original commits from the
master branch.

(cherry picked from commit bf8d4fb60da5e583b3a90639af45b901e19cb5aa)
(cherry picked from commit 6e1efe7b6bd16e3183cdb7c87d786cb714a61959)
(cherry picked from commit aeb465a458fc7ba02e3b1ca6b4193488defef511)

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

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 53f4dc4..77f5c36 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3123,8 +3123,6 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove(
 assert(!"can't move");
 }
 
-bool b3DFlag = rOldPos.Tab() != rNewPos.Tab() || rCxt.mnTabDelta;
-
 TokenPointers aPtrs( pCode, nLen, pRPN, nRPN);
 for (size_t j=0; j<2; ++j)
 {
@@ -3151,8 +3149,7 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove(
 }
 
 rRef.SetAddress(aAbs, rNewPos);
-if (b3DFlag)
-rRef.SetFlag3D(b3DFlag);
+rRef.SetFlag3D(aAbs.Tab() != rNewPos.Tab() || 
!rRef.IsTabRel());
 }
 break;
 case svDoubleRef:
@@ -3168,8 +3165,12 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove(
 }
 
 rRef.SetRange(aAbs, rNewPos);
-if (b3DFlag)
-rRef.Ref1.SetFlag3D(true);
+// Absolute sheet reference => set 3D flag.
+// More than one sheet referenced => has to have both 
3D flags.
+// If end part has 3D flag => start part must have it 
too.
+rRef.Ref2.SetFlag3D(aAbs.aStart.Tab() != 
aAbs.aEnd.Tab() || !rRef.Ref2.IsTabRel());
+rRef.Ref1.SetFlag3D(aAbs.aStart.Tab() != rNewPos.Tab() 
|| !rRef.Ref1.IsTabRel() ||
+rRef.Ref2.IsFlag3D());
 }
 break;
 case svExternalSingleRef:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-11 Thread Kohei Yoshida
 sc/source/core/data/table1.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 0d3b87795f14d826810deacb9f460011f88181dc
Author: Kohei Yoshida 
Date:   Sat Feb 11 13:38:58 2017 -0500

tdf#86470: Let's not forget to move onto the next column.

Change-Id: I451f521723458b5d6fe9d9fa8b41855fe17def64
Reviewed-on: https://gerrit.libreoffice.org/34159
Tested-by: Jenkins 
Reviewed-by: Kohei Yoshida 
(cherry picked from commit bcdde13996e3e33f9d4c41be25d062560c72636b)
Reviewed-on: https://gerrit.libreoffice.org/34163
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 7e1b403..7e54e1e 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1444,9 +1444,9 @@ bool ScTable::GetNextMarkedCell( SCCOL& rCol, SCROW& 
rRow, const ScMarkData& rMa
 ++it;
 if (it == rCells.end())
 {
-// No more block.
+// No more block.  Move on to the next column.
 rRow = MAXROW + 1;
-return false;
+continue;
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-08 Thread Kohei Yoshida
 sc/source/core/data/table3.cxx |   29 ++---
 1 file changed, 14 insertions(+), 15 deletions(-)

New commits:
commit 059f6f1916c17ee3d78b2b815d01b59d7abf3924
Author: Kohei Yoshida 
Date:   Mon Jan 30 22:01:45 2017 -0500

tdf#105629: Let's move the advanced-filter specific stuff ...

to the place where we actually parse the filtering rules for advanced
filter queries.

Change-Id: I87650227e15fa54303efd720530d31ecf9827226
Reviewed-on: https://gerrit.libreoffice.org/33816
Tested-by: Jenkins 
Reviewed-by: Kohei Yoshida 
(cherry picked from commit 42e472b5870278058537d43d03d457dc80b16166)
Reviewed-on: https://gerrit.libreoffice.org/33852
Reviewed-by: Markus Mohrhard 

diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index fcd6984..84601f8 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2889,26 +2889,15 @@ public:
 
 void operator() (ScQueryEntry::Item& rItem)
 {
-if (rItem.meType != ScQueryEntry::ByString && rItem.meType != 
ScQueryEntry::ByDate)
+// Double-check if the query by date is really appropriate.
+
+if (rItem.meType != ScQueryEntry::ByDate)
 return;
 
 sal_uInt32 nIndex = 0;
 bool bNumber = mrDoc.GetFormatTable()->
 IsNumberFormat(rItem.maString.getString(), nIndex, rItem.mfVal);
 
-// Advanced Filter creates only ByString queries that need to be
-// converted to ByValue if appropriate. rItem.mfVal now holds the value
-// if bNumber==true.
-
-if (rItem.meType == ScQueryEntry::ByString)
-{
-if (bNumber)
-rItem.meType = ScQueryEntry::ByValue;
-return;
-}
-
-// Double-check if the query by date is really appropriate.
-
 if (bNumber && ((nIndex % SV_COUNTRY_LANGUAGE_OFFSET) != 0))
 {
 const SvNumberformat* pEntry = 
mrDoc.GetFormatTable()->GetEntry(nIndex);
@@ -3273,12 +3262,22 @@ bool ScTable::CreateQueryParam(SCCOL nCol1, SCROW 
nRow1, SCCOL nCol2, SCROW nRow
 if (!bValid)
 bValid = CreateExcelQuery(nCol1, nRow1, nCol2, nRow2, rQueryParam);
 
+SvNumberFormatter* pFormatter = pDocument->GetFormatTable();
 nCount = rQueryParam.GetEntryCount();
+
 if (bValid)
 {
 //  bQueryByString must be set
 for (i=0; i < nCount; i++)
-rQueryParam.GetEntry(i).GetQueryItem().meType = 
ScQueryEntry::ByString;
+{
+ScQueryEntry::Item& rItem = rQueryParam.GetEntry(i).GetQueryItem();
+
+sal_uInt32 nIndex = 0;
+bool bNumber = pFormatter->IsNumberFormat(
+rItem.maString.getString(), nIndex, rItem.mfVal);
+
+rItem.meType = bNumber ? ScQueryEntry::ByValue : 
ScQueryEntry::ByString;
+}
 }
 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-3' - sc/source

2017-01-31 Thread Eike Rathke
 sc/source/ui/condformat/condformatdlg.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit d9423d80e7a2c8dc323027425780a17e76b6d0c6
Author: Eike Rathke 
Date:   Mon Jan 30 18:11:49 2017 +0100

Resolves: tdf#105410 do not crash on a deleted format

... if the last condition was deleted and the Manage list is to be
updated. The format is gone.

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

diff --git a/sc/source/ui/condformat/condformatdlg.cxx 
b/sc/source/ui/condformat/condformatdlg.cxx
index 37bf0b2..b2c0a1c 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -635,9 +635,12 @@ void ScCondFormatDlg::OkPressed()
 nKey = pList->getMaxKey() + 1;
 }
 
-pFormat->SetKey(nKey);
 pList->erase(nKey);
-pList->InsertNew(pFormat);
+if (pFormat)
+{
+pFormat->SetKey(nKey);
+pList->InsertNew(pFormat);
+}
 mpViewData->GetViewShell()->GetPool().Put(*mpDlgItem);
 
 SetDispatcherLock( 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-3' - sc/source

2017-01-27 Thread Eike Rathke
 sc/source/ui/unoobj/appluno.cxx |   14 --
 sc/source/ui/unoobj/confuno.cxx |   56 +---
 2 files changed, 53 insertions(+), 17 deletions(-)

New commits:
commit 739353bcb420c18df6116cd645cc2226782e13cc
Author: Eike Rathke 
Date:   Thu Jan 26 17:51:17 2017 +0100

dissolve LinkUpdateMode confusion, document::Settings vs 
XGlobalSheetSettings

This is a combination of 3 commits.

this is css::sheet::XGlobalSheetSettings attribute LinkUpdateMode

... and not css::document::Settings property LinkUpdateMode.
It directly maps to ScLkUpdMode, LM_UNKNOWN isn't documented as a valid 
input value.

(cherry picked from commit 109cff60a3a18b20b2e0efefd0d49f6eab9b52fd)

remove now unused header file

(cherry picked from commit d03cacfb7b9b126e375dfeaeed2fcd74d4fa48fb)

this is the css::document::Settings property LinkUpdateMode

... not the css::sheet::XGlobalSheetSettings attribute LinkUpdateMode.

(cherry picked from commit 32d90e643e4d9285366169301af4342d871c0d94)

7a9696f07c1a6e1deec342f224343bd938078c2c
039c8d39e89e693de1c5a1a4218c2fca70a6de9f

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

diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx
index 2845341..989e45d 100644
--- a/sc/source/ui/unoobj/appluno.cxx
+++ b/sc/source/ui/unoobj/appluno.cxx
@@ -36,7 +36,6 @@
 #include "sc.hrc"
 #include "unonames.hxx"
 #include "funcdesc.hxx"
-#include 
 #include 
 #include 
 
@@ -263,18 +262,17 @@ void SAL_CALL ScSpreadsheetSettings::setPropertyValue(
 }
 else if (aPropertyName == SC_UNONAME_LINKUPD)
 {
+// XXX NOTE: this is not css::document::Settings property
+// LinkUpdateMode but css::sheet::XGlobalSheetSettings attribute
+// LinkUpdateMode.
 sal_Int16 n;
-if (!(aValue >>= n) || n < css::document::LinkUpdateModes::NEVER
-|| n > css::document::LinkUpdateModes::GLOBAL_SETTING)
+if (!(aValue >>= n) || n < 0 || n >= ScLkUpdMode::LM_UNKNOWN)
 {
 throw css::lang::IllegalArgumentException(
-("LinkUpdateMode property value must be a SHORT with a value 
in"
- " the range of the css.document.LinkUpdateModes constants"),
+("LinkUpdateMode property value must be a SHORT with a value 
in the range of 0--2"
+ " as documented for css::sheet::XGlobalSheetSettings 
attribute LinkUpdateMode"),
 css::uno::Reference(), -1);
 }
-//TODO: ScLkUpdMode (LM_ALWAYS=0, LM_NEVER=1, LM_ON_DEMAND=2,
-// LM_UNKNOWN=3) does not match css.document.LinkUpdateModes (NEVER=0,
-// MANUAL=1, AUTO=2, GLOBAL_SETTINGS=3):
 aAppOpt.SetLinkMode( static_cast(n) );
 bSaveApp = true;
 }
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index 7377860..b7f0c32 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -30,6 +30,7 @@
 #include "sc.hrc"
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -158,18 +159,36 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue(
 aViewOpt.SetOption(VOPT_PAGEBREAKS, 
ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
 else if ( aPropertyName == SC_UNONAME_LINKUPD )
 {
+// XXX NOTE: this is the css::document::Settings property
+// LinkUpdateMode, not the css::sheet::XGlobalSheetSettings
+// attribute LinkUpdateMode.
 sal_Int16 n;
-//TODO: css.sheet.XGlobalSheetSettings LinkUpdateMode property is
-// documented to take values in the range 0--2 (always, never, on
-// demand), but appears to be routinely set to 3 here,
-// corresponding to ScLkUpdMode LM_UNKNOWN:
-if (!(aValue >>= n) || n < 0 || n > 3) {
+if (!(aValue >>= n) || n < css::document::LinkUpdateModes::NEVER ||
+n > css::document::LinkUpdateModes::GLOBAL_SETTING)
+{
 throw css::lang::IllegalArgumentException(
-("LinkUpdateMode property value must be a SHORT in the"
- " range 0--3"),
+("LinkUpdateMode property value must be a SHORT with a 
value in"
+ " the range of the css::document::LinkUpdateModes 
constants"),
 css::uno::Reference(), -1);
 }
-rDoc.SetLinkMode( static_cast(n) );
+ScLkUpdMode eMode;
+switch (n)
+{
+case css::document::LinkUpdateModes::NEVER:
+eMode = LM_NEVER;
+break;
+   

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

2017-01-27 Thread Eike Rathke
 sc/source/core/tool/interpr4.cxx |   51 ++-
 1 file changed, 45 insertions(+), 6 deletions(-)

New commits:
commit ea525e91338a164bbc76954869295f1e939095ae
Author: Eike Rathke 
Date:   Fri Jan 27 14:55:20 2017 +0100

Resolves: tdf#105558 accept numeric BASIC return types as numeric

... not only SbxINTEGER, SbxLONG, SbxSINGLE and SbxDOUBLE.

Change-Id: I75d892f5ae60ef1b18bd86e64777dea746e35a1f
(cherry picked from commit 9a283e44ca7de2f2fa276544b4d49cff495bd53d)
Reviewed-on: https://gerrit.libreoffice.org/33616
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 4c34994..f266491 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3122,6 +3122,34 @@ static bool lcl_setVBARange( ScRange& aRange, 
ScDocument* pDok, SbxVariable* pPa
 return bOk;
 }
 
+static bool lcl_isNumericResult( double& fVal, const SbxVariable* pVar )
+{
+switch (pVar->GetType())
+{
+case SbxINTEGER:
+case SbxLONG:
+case SbxSINGLE:
+case SbxDOUBLE:
+case SbxCURRENCY:
+case SbxDATE:
+case SbxUSHORT:
+case SbxULONG:
+case SbxINT:
+case SbxUINT:
+case SbxSALINT64:
+case SbxSALUINT64:
+case SbxDECIMAL:
+fVal = pVar->GetDouble();
+return true;
+case SbxBOOL:
+fVal = (pVar->GetBool() ? 1.0 : 0.0);
+return true;
+default:
+;   // nothing
+}
+return false;
+}
+
 #endif
 
 void ScInterpreter::ScMacro()
@@ -3341,6 +3369,7 @@ void ScInterpreter::ScMacro()
 pMacroMgr->AddDependentCell(pModule->GetName(), pMyFormulaCell);
 }
 
+double fVal;
 SbxDataType eResType = refRes->GetType();
 if( SbxBase::GetError() )
 {
@@ -3350,9 +3379,21 @@ void ScInterpreter::ScMacro()
 {
 PushNoValue();
 }
-else if( eResType >= SbxINTEGER && eResType <= SbxDOUBLE )
+else if (lcl_isNumericResult( fVal, refRes.get()))
 {
-PushDouble( refRes->GetDouble() );
+switch (eResType)
+{
+case SbxDATE:
+nFuncFmtType = css::util::NumberFormat::DATE;
+break;
+case SbxBOOL:
+nFuncFmtType = css::util::NumberFormat::LOGICAL;
+break;
+// Do not add SbxCURRENCY, we don't know which currency.
+default:
+;   // nothing
+}
+PushDouble( fVal );
 }
 else if ( eResType & SbxARRAY )
 {
@@ -3387,7 +3428,6 @@ void ScInterpreter::ScMacro()
 if ( pMat )
 {
 SbxVariable* pV;
-SbxDataType eType;
 for ( SCSIZE j=0; j < nR; j++ )
 {
 sal_Int32 nIdx[ 2 ];
@@ -3398,10 +3438,9 @@ void ScInterpreter::ScMacro()
 {
 nIdx[ nColIdx ] = nCs + static_cast(i);
 pV = pDimArray->Get32( nIdx );
-eType = pV->GetType();
-if ( eType >= SbxINTEGER && eType <= SbxDOUBLE )
+if ( lcl_isNumericResult( fVal, pV) )
 {
-pMat->PutDouble( pV->GetDouble(), i, j );
+pMat->PutDouble( fVal, i, j );
 }
 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-3' - sc/source

2017-01-27 Thread Caolán McNamara
 sc/source/ui/dbgui/PivotLayoutDialog.cxx|   17 +
 sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx  |   23 ---
 sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx |7 ---
 sc/source/ui/inc/PivotLayoutDialog.hxx  |5 ++---
 sc/source/ui/inc/PivotLayoutTreeListBase.hxx|3 ---
 5 files changed, 19 insertions(+), 36 deletions(-)

New commits:
commit 839d9fa764921258abd48336142a1383f95f5808
Author: Caolán McNamara 
Date:   Thu Jan 26 09:12:24 2017 +

Resolves: tdf#104153 crash on drag and drop pivot table field

This is a combination of 2 commits.

Resolves: tdf#104153 crash on drag and drop pivot table field

now though sometimes it doesn't get removed at all, so a band aid
for the moment

(cherry picked from commit 068edb65b1dce375223d8642a01b07db3948ac03)

Resolves: tdf#104153 lookup what listbox an entry is dragged from

so we can find where its been dragged from in order to remove it from that
source, rather than relying that it comes from the previously focused 
listbox

Reviewed-on: https://gerrit.libreoffice.org/33575
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit 011bae55cdd24a1d3e42f0aa2fcfd98d3ddc9b14)

e6aa1a311b46e5e9ee96cab05e0705b794b5eb0b

Change-Id: I6ccbbe51fe9250af0f85c30a9d253269a18df457
Reviewed-on: https://gerrit.libreoffice.org/33630
Reviewed-by: Eike Rathke 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx 
b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
index 312fdd3..5503c5e 100644
--- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
@@ -70,8 +70,6 @@ ScPivotLayoutDialog::ScPivotLayoutDialog(
 ScViewData* pViewData, const ScDPObject* 
pPivotTableObject, bool bNewPivotTable) :
 ScAnyRefDlg   (pSfxBindings, pChildWindow, pParent, 
"PivotTableLayout", "modules/scalc/ui/pivottablelayoutdialog.ui"),
 maPivotTableObject(*pPivotTableObject),
-mpPreviouslyFocusedListBox(nullptr),
-mpCurrentlyFocusedListBox(nullptr),
 mpViewData(pViewData),
 mpDocument(pViewData->GetDocument()),
 mbNewPivotTable   (bNewPivotTable),
@@ -189,8 +187,6 @@ ScPivotLayoutDialog::~ScPivotLayoutDialog()
 
 void ScPivotLayoutDialog::dispose()
 {
-mpPreviouslyFocusedListBox.clear();
-mpCurrentlyFocusedListBox.clear();
 mpListBoxField.clear();
 mpListBoxPage.clear();
 mpListBoxColumn.clear();
@@ -736,4 +732,17 @@ void ScPivotLayoutDialog::ToggleDestination()
 mpDestinationEdit->Enable(bSelection);
 }
 
+ScPivotLayoutTreeListBase* ScPivotLayoutDialog::FindListBoxFor(SvTreeListEntry 
*pEntry)
+{
+if (mpListBoxPage->HasEntry(pEntry))
+return mpListBoxPage.get();
+if (mpListBoxColumn->HasEntry(pEntry))
+return mpListBoxColumn.get();
+if (mpListBoxRow->HasEntry(pEntry))
+return mpListBoxRow.get();
+if (mpListBoxData->HasEntry(pEntry))
+return mpListBoxData.get();
+return nullptr;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx 
b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
index 7b72f7b..1fd79e9 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
@@ -119,27 +119,4 @@ void 
ScPivotLayoutTreeListBase::RemoveEntryForItem(ScItemValue* pItemValue)
 }
 }
 
-void ScPivotLayoutTreeListBase::GetFocus()
-{
-SvTreeListBox::GetFocus();
-
-if( GetGetFocusFlags() & GetFocusFlags::Mnemonic )
-{
-SvTreeListEntry* pEntry = 
mpParent->mpPreviouslyFocusedListBox->GetCurEntry();
-if (pEntry)
-InsertEntryForSourceTarget(pEntry, nullptr);
-
-if (mpParent->mpPreviouslyFocusedListBox != nullptr)
-mpParent->mpPreviouslyFocusedListBox->GrabFocus();
-}
-
-mpParent->mpCurrentlyFocusedListBox = this;
-}
-
-void ScPivotLayoutTreeListBase::LoseFocus()
-{
-SvTreeListBox::LoseFocus();
-if (mpParent)
-mpParent->mpPreviouslyFocusedListBox = this;
-}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx 
b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
index 3795601..9073faa 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
@@ -57,10 +57,11 @@ void 
ScPivotLayoutTreeListLabel::FillLabelFields(ScDPLabelDataVector& rLabelVect
 }
 }
 
-void ScPivotLayoutTreeListLabel::InsertEntryForSourceTarget(SvTreeListEntry* 
/*pSource*/, SvTreeListEntry* /*pTarget*/)
+void 

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

2017-01-25 Thread Eike Rathke
 sc/source/core/data/conditio.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f6587264b2c5b9191a4a7b547416c366db1c5607
Author: Eike Rathke 
Date:   Wed Jan 25 11:40:52 2017 +0100

Resolves: tdf#104675 ScConditionalFormat ranges needed to start listening

Conditional format manager dialog holds a cloned list of
ScConditionalFormat and sets that at the document on OK. The ranges of a
format need to be set before ScFormatEntry/ScConditionEntry are added to
start their listeners.

Change-Id: I903553b1f6a8298838ee8753315a6ea263b29b08
(cherry picked from commit 657eea01046c7f39ee8ca4545241372177385946)
Reviewed-on: https://gerrit.libreoffice.org/33525
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 0f8764b..6657dcf 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1776,6 +1776,7 @@ ScConditionalFormat* 
ScConditionalFormat::Clone(ScDocument* pNewDoc) const
 pNewDoc = pDoc;
 
 ScConditionalFormat* pNew = new ScConditionalFormat(nKey, pNewDoc);
+pNew->SetRange( maRanges ); // prerequisite for listeners
 
 for (CondFormatContainer::const_iterator itr = maEntries.begin(); itr != 
maEntries.end(); ++itr)
 {
@@ -1783,7 +1784,6 @@ ScConditionalFormat* 
ScConditionalFormat::Clone(ScDocument* pNewDoc) const
 pNew->maEntries.push_back( std::unique_ptr(pNewEntry) );
 pNewEntry->SetParent(pNew);
 }
-pNew->SetRange( maRanges );
 
 return pNew;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-25 Thread Eike Rathke
 sc/source/ui/view/cellsh1.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit f1705a22aa5f26f2590ee937f0e07201f8415696
Author: Eike Rathke 
Date:   Wed Jan 25 13:34:43 2017 +0100

Resolves: tdf#105351 pass matching index key to conditional format dialog

Change-Id: I9d872140755c4ec0ae67349530b00f339057a356
(cherry picked from commit 0367acdcc59e14b0b067976a08202e8afef0ecf3)
Reviewed-on: https://gerrit.libreoffice.org/33528
Reviewed-by: Markus Mohrhard 
Tested-by: Jenkins 

diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index f661f34..f17de35 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2004,6 +2004,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
 {
 // found a matching range, edit this conditional 
format
 bCondFormatDlg = true;
+nIndex = pCondFormat->GetKey();
 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-3' - sc/source

2017-01-25 Thread Eike Rathke
 sc/source/core/data/colorscale.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 56b76f27b1f9e8c9af005be0121f39ba4a073d8d
Author: Eike Rathke 
Date:   Tue Jan 24 21:23:22 2017 +0100

ScFormulaListener: do not start listening to clipboard or Undo docs

Change-Id: Ic00e30eccc64cc85ee877572ef8df042899f45f5
(cherry picked from commit 81845445de26111eb0b7e30f45b3708389fd76cf)
Reviewed-on: https://gerrit.libreoffice.org/33527
Reviewed-by: Markus Mohrhard 
Tested-by: Jenkins 

diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 5f87b32..cb7599e 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -36,7 +36,7 @@ ScFormulaListener::ScFormulaListener(ScDocument* pDoc):
 
 void ScFormulaListener::startListening(ScTokenArray* pArr, const ScRange& 
rRange)
 {
-if (!pArr)
+if (!pArr || mpDoc->IsClipOrUndo())
 return;
 
 pArr->Reset();
@@ -123,6 +123,9 @@ private:
 
 void ScFormulaListener::stopListening()
 {
+if (mpDoc->IsClipOrUndo())
+return;
+
 std::for_each(maCells.begin(), maCells.end(), StopListeningCell(mpDoc, 
this));
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-23 Thread Winfried Donkers
 sc/source/core/tool/interpr3.cxx |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 6db82982d65b2b15aa7cc2aab5e6219f2db15dd7
Author: Winfried Donkers 
Date:   Sun Jan 15 15:14:15 2017 +0100

tdf#105348 add check for divide by zero situation.

Reviewed-on: https://gerrit.libreoffice.org/33098
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
(cherry picked from commit 84e87423c182ec78aba4eb108355906a0d2f0096)

Backported, without test case document.

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

diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index c9e145d..77767f8 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -2695,8 +2695,14 @@ void ScInterpreter::ScTTest()
 PushNoValue();
 return;
 }
-fT = sqrt(fCount-1.0) * fabs(fSum1 - fSum2) /
- sqrt(fCount * fSumSqrD - (fSum1-fSum2)*(fSum1-fSum2));
+double fSumD = fSum1 - fSum2;
+double fDivider = (fCount*fSumSqrD - fSumD*fSumD);
+if ( fDivider == 0.0 )
+{
+PushError(FormulaError::DivisionByZero);
+return;
+}
+fT = fabs(fSumD) * sqrt((fCount-1.0) / fDivider);
 fF = fCount - 1.0;
 }
 else if (fTyp == 2.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-3' - sc/source

2017-01-23 Thread Caolán McNamara
 sc/source/ui/condformat/condformatdlg.cxx |   20 
 1 file changed, 12 insertions(+), 8 deletions(-)

New commits:
commit f3bc969dd5bb4a45946728806159e658056a2bca
Author: Caolán McNamara 
Date:   Mon Jan 23 20:44:38 2017 +

Resolves: tdf#105466 crash when changing conditional formatting condition

Change-Id: Id219a7935f83acf3924e60cb1bf02311dc5c4372
(cherry picked from commit 0b7c1dcd149cd98136e5ed3e8e0e70255d87cd16)
Reviewed-on: https://gerrit.libreoffice.org/33481
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/ui/condformat/condformatdlg.cxx 
b/sc/source/ui/condformat/condformatdlg.cxx
index 6cc1d1e..37bf0b2 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -187,10 +187,12 @@ void ScCondFormatList::RecalcAll()
 {
 sal_Int32 nTotalHeight = 0;
 sal_Int32 nIndex = 1;
-for(EntryContainer::iterator itr = maEntries.begin(); itr != 
maEntries.end(); ++itr)
+for (const auto& item : maEntries)
 {
-nTotalHeight += (*itr)->GetSizePixel().Height();
-(*itr)->SetIndex( nIndex );
+if (!item)
+continue;
+nTotalHeight += item->GetSizePixel().Height();
+item->SetIndex(nIndex);
 ++nIndex;
 }
 
@@ -212,17 +214,19 @@ void ScCondFormatList::RecalcAll()
 }
 
 Point aPoint(0,-1*mpScrollBar->GetThumbPos());
-for(EntryContainer::iterator itr = maEntries.begin(); itr != 
maEntries.end(); ++itr)
+for (const auto& item : maEntries)
 {
-(*itr)->SetPosPixel(aPoint);
-Size aSize = (*itr)->GetSizePixel();
+if (!item)
+continue;
+item->SetPosPixel(aPoint);
+Size aSize = item->GetSizePixel();
 if(mbHasScrollBar)
 aSize.Width() = aCtrlSize.Width() - nSrcBarSize;
 else
 aSize.Width() = aCtrlSize.Width();
-(*itr)->SetSizePixel(aSize);
+item->SetSizePixel(aSize);
 
-aPoint.Y() += (*itr)->GetSizePixel().Height();
+aPoint.Y() += item->GetSizePixel().Height();
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-23 Thread Caolán McNamara
 sc/source/ui/condformat/condformatdlg.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit cb65b1fa2ac641d0cb4c589db2f4b3a4df0d6b07
Author: Caolán McNamara 
Date:   Wed Jan 18 14:11:11 2017 +

Resolves: tdf#105411 remove from entries before dispose

cause on dispose all the state change callbacks are
called, and all of the conditional formatting code assumes
that if there's an entry in the entries, that its not an
empty disposed one

Change-Id: I50d85128ba884a0719959f2d6e7ae83d6fb3431c
(cherry picked from commit 2fb220093f7178f75ebd582bbcd956c1ee7e03db)
Reviewed-on: https://gerrit.libreoffice.org/33476
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/source/ui/condformat/condformatdlg.cxx 
b/sc/source/ui/condformat/condformatdlg.cxx
index b6e2191..6cc1d1e 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -376,10 +376,11 @@ IMPL_LINK_NOARG( ScCondFormatList, RemoveBtnHdl, Button*, 
void )
 {
 for(EntryContainer::iterator itr = maEntries.begin(); itr != 
maEntries.end(); ++itr)
 {
-if((*itr)->IsSelected())
+auto widget = *itr;
+if (widget->IsSelected())
 {
-itr->disposeAndClear();
 maEntries.erase(itr);
+widget.disposeAndClear();
 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-3' - sc/source

2017-01-23 Thread Caolán McNamara
 sc/source/filter/excel/xiescher.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f7e79ee29b290503f2fd866fbd8064e30e8fec73
Author: Caolán McNamara 
Date:   Sat Jan 21 16:07:46 2017 +

coverity#1399031 golden, Out-of-bounds read

There are 17 elements, so SAL_N_ELEMENTS(sppnPatterns) is 17 The largest 
valid
index is 16, not 17, so valid max index is out by one

Change-Id: Id20218a0e73cb9e502a631fa6bfbb3f0a22c4727
(cherry picked from commit 9ad08b403be9c6646cda9a379332545c3668975b)
Reviewed-on: https://gerrit.libreoffice.org/33400
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/filter/excel/xiescher.cxx 
b/sc/source/filter/excel/xiescher.cxx
index 9a1484d..0506ed4 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -701,7 +701,7 @@ void XclImpDrawObjBase::ConvertFillStyle( SdrObject& 
rSdrObj, const XclObjFillDa
 { 0x88, 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00 },
 { 0x80, 0x00, 0x08, 0x00, 0x80, 0x00, 0x08, 0x00 }
 };
-const sal_uInt8* const pnPattern = sppnPatterns[ ::std::min< 
size_t >( rFillData.mnPattern - 2, SAL_N_ELEMENTS( sppnPatterns ) ) ];
+const sal_uInt8* const pnPattern = 
sppnPatterns[std::min(rFillData.mnPattern - 2, 
SAL_N_ELEMENTS(sppnPatterns) - 1)];
 // create 2-colored 8x8 DIB
 SvMemoryStream aMemStrm;
 aMemStrm.WriteUInt32( 12 ).WriteInt16( 8 ).WriteInt16( 8 
).WriteUInt16( 1 ).WriteUInt16( 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-3' - sc/source

2017-01-22 Thread Eike Rathke
 sc/source/core/data/documen2.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit 9961508ef33d8cbb158ccb94fe23e99bcec7d3e2
Author: Eike Rathke 
Date:   Wed Jan 18 16:18:38 2017 +0100

tdf#104967 prevent crash when pasting notes originating from a closed 
document

This is only a workaround to prevent a crash, the actual note content is 
lost
when pasting, only a standard empty note caption will be pasted.

Change-Id: Ifaef5d30cc2024f3d03d6b2b4f56c5ccfbb67142
(cherry picked from commit cb566c056b0e8f9f73dac3cbaf497e102a247cb9)
Reviewed-on: https://gerrit.libreoffice.org/33273
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 766aa9f..f884bcd 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -373,6 +373,21 @@ ScDocument::~ScDocument()
 pRefreshTimerControl = nullptr;
 }
 
+if (IsClipboardSource())
+{
+// Notes copied to the clipboard have a raw SdrCaptionObj pointer
+// copied from this document, forget it as it references this
+// document's drawing layer pages and what not, which otherwise when
+// pasting to another document after this document was destructed would
+// attempt to access non-existing data.
+/* XXX this is only a workaround to prevent a crash, the actual note
+ * content is lost, only a standard empty note caption will be pasted.
+ * TODO: come up with a solution. */
+ScDocument* pClipDoc = ScModule::GetClipDoc();
+if (pClipDoc)
+pClipDoc->ForgetNoteCaptions( ScRangeList( ScRange( 0,0,0, MAXCOL, 
MAXROW, pClipDoc->GetTableCount()-1)));
+}
+
 mxFormulaParserPool.reset();
 // Destroy the external ref mgr instance here because it has a timer
 // which needs to be stopped before the app closes.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-22 Thread Eike Rathke
 sc/source/core/tool/interpr2.cxx |4 
 sc/source/core/tool/interpr4.cxx |   29 -
 2 files changed, 28 insertions(+), 5 deletions(-)

New commits:
commit f32deca421a7a48cb87249a87eee83f629f172a7
Author: Eike Rathke 
Date:   Fri Jan 20 23:21:47 2017 +0100

Resolves: tdf#105158 set date or time return type for DATEVALUE TIMEVALUE

... so adding/subtracting another date produces number of days instead of 
date,
and adding/subtracting a number produces date. But if used as the final
formula result force number type.

Change-Id: I046f5cc53d1fe8c9f6f71876787f2f19d24fe146
(cherry picked from commit b85ee27d9f8039a6442429587598426e73aeb1ba)
Reviewed-on: https://gerrit.libreoffice.org/33362
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 0e4245c..59e87b7 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -177,7 +177,10 @@ void ScInterpreter::ScGetDateValue()
 {
 short eType = pFormatter->GetType(nFIndex);
 if (eType == css::util::NumberFormat::DATE || eType == 
css::util::NumberFormat::DATETIME)
+{
+nFuncFmtType = css::util::NumberFormat::DATE;
 PushDouble(::rtl::math::approxFloor(fVal));
+}
 else
 PushIllegalArgument();
 }
@@ -937,6 +940,7 @@ void ScInterpreter::ScGetTimeValue()
 short eType = pFormatter->GetType(nFIndex);
 if (eType == css::util::NumberFormat::TIME || eType == 
css::util::NumberFormat::DATETIME)
 {
+nFuncFmtType = css::util::NumberFormat::TIME;
 double fDateVal = rtl::math::approxFloor(fVal);
 double fTimeVal = fVal - fDateVal;
 PushDouble(fTimeVal);
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 11a8870..4c34994 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3879,11 +3879,12 @@ StackVar ScInterpreter::Interpret()
 // so reassure exceptions are really off.
 SAL_MATH_FPEXCEPTIONS_OFF();
 
+OpCode eOp = ocNone;
 aCode.Reset();
 while( ( pCur = aCode.Next() ) != nullptr
 && (nGlobalError == FormulaError::NONE || nErrorFunction <= 
nErrorFunctionCount) )
 {
-OpCode eOp = pCur->GetOpCode();
+eOp = pCur->GetOpCode();
 cPar = pCur->GetByte();
 if ( eOp == ocPush )
 {
@@ -4454,6 +4455,21 @@ StackVar ScInterpreter::Interpret()
 
 // End: obtain result
 
+bool bForcedResultType;
+switch (eOp)
+{
+case ocGetDateValue:
+case ocGetTimeValue:
+// Force final result of DATEVALUE and TIMEVALUE to number type,
+// which so far was date or time for calculations.
+nRetTypeExpr = nFuncFmtType = css::util::NumberFormat::NUMBER;
+nRetIndexExpr = nFuncFmtIndex = 0;
+bForcedResultType = true;
+break;
+default:
+bForcedResultType = false;
+}
+
 if( sp )
 {
 pCur = pStack[ sp-1 ];
@@ -4476,9 +4492,12 @@ StackVar ScInterpreter::Interpret()
 if (pCur->GetDoubleType())
 {
 const double fVal = PopDouble();
-if (nCurFmtType != nFuncFmtType)
-nRetIndexExpr = 0;  // carry format index only 
for matching type
-nRetTypeExpr = nFuncFmtType = nCurFmtType;
+if (!bForcedResultType)
+{
+if (nCurFmtType != nFuncFmtType)
+nRetIndexExpr = 0;  // carry format index 
only for matching type
+nRetTypeExpr = nFuncFmtType = nCurFmtType;
+}
 PushTempToken( new FormulaDoubleToken( fVal));
 }
 if ( nFuncFmtType == 
css::util::NumberFormat::UNDEFINED )
@@ -4573,7 +4592,7 @@ StackVar ScInterpreter::Interpret()
 else
 SetError( FormulaError::NoCode);
 
-if( nRetTypeExpr != css::util::NumberFormat::UNDEFINED )
+if (bForcedResultType || nRetTypeExpr != 
css::util::NumberFormat::UNDEFINED)
 {
 nRetFmtType = nRetTypeExpr;
 nRetFmtIndex = nRetIndexExpr;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-13 Thread Jochen Nitschke
 sc/source/filter/excel/xelink.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e9c1b787b5b42837f0586add87f76e78b1eba529
Author: Jochen Nitschke 
Date:   Tue Jan 10 13:31:59 2017 +0100

fix interchanged parameters

first one found by cppcheck
> sc/source/filter/excel/xelink.cxx 637
> funcArgOrderDifferent
>  warning  Function 'InsertExtName' argument order different:
>  declaration 'rnExtSheet, rnExtName, rUrl, rName, rArray'
>  definition 'rnExtSheet, rnExtName, rName, rUrl, rArray'

Change-Id: I6b9bdbf58a8eb271e873bf8dfc30041a72419f59
Reviewed-on: https://gerrit.libreoffice.org/32927
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 
(cherry picked from commit ebadc6017827edef2bca7ed389d1af9ebffb96e9)
Reviewed-on: https://gerrit.libreoffice.org/32989
Reviewed-by: Eike Rathke 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sc/source/filter/excel/xelink.cxx 
b/sc/source/filter/excel/xelink.cxx
index 2bfe779..bd23511 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -2465,7 +2465,7 @@ bool XclExpLinkManagerImpl8::InsertDde(
 }
 
 bool XclExpLinkManagerImpl8::InsertExtName( sal_uInt16& rnExtSheet, 
sal_uInt16& rnExtName,
-const OUString& rName, const OUString& rUrl, const 
ScExternalRefCache::TokenArrayRef& rArray )
+const OUString& rUrl, const OUString& rName, const 
ScExternalRefCache::TokenArrayRef& rArray )
 {
 sal_uInt16 nSupbook;
 if( maSBBuffer.InsertExtName( nSupbook, rnExtName, rUrl, rName, rArray ) )
@@ -2612,7 +2612,7 @@ bool XclExpLinkManager::InsertDde(
 }
 
 bool XclExpLinkManager::InsertExtName(
-sal_uInt16& rnExtSheet, sal_uInt16& rnExtName, const OUString& rName, 
const OUString& rUrl,
+sal_uInt16& rnExtSheet, sal_uInt16& rnExtName, const OUString& rUrl, const 
OUString& rName,
 const ScExternalRefCache::TokenArrayRef& rArray )
 {
 return mxImpl->InsertExtName(rnExtSheet, rnExtName, rUrl, rName, rArray);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-06 Thread Eike Rathke
 sc/source/filter/xml/xmlcelli.cxx |   21 -
 1 file changed, 16 insertions(+), 5 deletions(-)

New commits:
commit cb7ab49dde0ae21c472300f126cce4555a3e0ae5
Author: Eike Rathke 
Date:   Fri Jan 6 18:28:42 2017 +0100

recognize the broken "Err:xxx" written by 5.2 and earlier, tdf#105024 
related

... and handle same as "#ERRxxx!" if present.

Change-Id: I1ebb31d628b080c52b450a8fe624c20e9e1188b7
(cherry picked from commit 75d963bc7bb87429f304d29138c27178880c039a)
Reviewed-on: https://gerrit.libreoffice.org/32793
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index 3b38ac4..8fd7eda 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1357,11 +1357,22 @@ void ScXMLTableRowCellContext::PutFormulaCell( const 
ScAddress& rCellPos )
 }
 else
 {
-OUString aFormulaNmsp = maFormula->second;
-if( eGrammar != formula::FormulaGrammar::GRAM_EXTERNAL )
-aFormulaNmsp.clear();
-pCode->AssignXMLString( aText, aFormulaNmsp );
-rDoc.getDoc().IncXMLImportedFormulaCount( aText.getLength() );
+// 5.2 and earlier wrote broken "Err:xxx" as formula to designate
+// an error formula cell.
+if (aText.startsWithIgnoreAsciiCase("Err:") && aText.getLength() 
<= 9 &&
+((nError =
+  GetScImport().GetFormulaErrorConstant( "#ERR" + 
aText.copy(4) + "!")) != FormulaError::NONE))
+{
+pCode->SetCodeError(nError);
+}
+else
+{
+OUString aFormulaNmsp = maFormula->second;
+if( eGrammar != formula::FormulaGrammar::GRAM_EXTERNAL )
+aFormulaNmsp.clear();
+pCode->AssignXMLString( aText, aFormulaNmsp );
+rDoc.getDoc().IncXMLImportedFormulaCount( aText.getLength() );
+}
 }
 
 ScFormulaCell* pNewCell = new ScFormulaCell(pDoc, rCellPos, pCode, 
eGrammar, MM_NONE);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-06 Thread Eike Rathke
 sc/source/core/data/formulacell.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 74c3abeb970015f72a081cbfea59007fd0cbb011
Author: Eike Rathke 
Date:   Fri Jan 6 16:55:32 2017 +0100

out of bounds string access

Change-Id: Iecbe24f90cefe34a447cd52a44967a4b09b4394b
(cherry picked from commit 00f17500520bcb2634146496adc8de9f4d28eea5)
Reviewed-on: https://gerrit.libreoffice.org/32787
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index 465f0b8..a3f14b4 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1355,7 +1355,7 @@ void ScFormulaCell::CompileXML( 
sc::CompileFormulaContext& rCxt, ScProgress& rPr
 {
 if ( !pCode->GetLen() )
 {
-if ( aFormula[0] == '=' )
+if ( !aFormula.isEmpty() && aFormula[0] == '=' )
 pCode->AddBad( aFormula.copy( 1 ) );
 else
 pCode->AddBad( aFormula );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-06 Thread Caolán McNamara
 sc/source/ui/condformat/condformatdlg.cxx |8 
 sc/source/ui/inc/condformatdlg.hxx|1 +
 2 files changed, 9 insertions(+)

New commits:
commit 9341c166d6b2971e637ba9d17f7be68f5bb852f3
Author: Caolán McNamara 
Date:   Fri Jan 6 16:18:37 2017 +

Resolves: tdf#105061 Only one text box shown in case of 'between'

non-layout ScCondFormatList widget not responding to layout child change

Change-Id: I7edd4fc54de9e71fb86b47a9b182bfc22fa4af25
(cherry picked from commit ac561ab34ea9d26243fe3791f624c440dcf7ae6d)

diff --git a/sc/source/ui/condformat/condformatdlg.cxx 
b/sc/source/ui/condformat/condformatdlg.cxx
index 22bd55a..b6e2191 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -157,6 +157,14 @@ void ScCondFormatList::Resize()
 RecalcAll();
 }
 
+void ScCondFormatList::queue_resize(StateChangedType eReason)
+{
+Control::queue_resize(eReason);
+if (!mpDialogParent) //detects that this is during dispose
+return;
+RecalcAll();
+}
+
 ScConditionalFormat* ScCondFormatList::GetConditionalFormat() const
 {
 if(maEntries.empty())
diff --git a/sc/source/ui/inc/condformatdlg.hxx 
b/sc/source/ui/inc/condformatdlg.hxx
index 62f3758..a79ae0d 100644
--- a/sc/source/ui/inc/condformatdlg.hxx
+++ b/sc/source/ui/inc/condformatdlg.hxx
@@ -66,6 +66,7 @@ public:
 condformat::dialog::ScCondFormatDialogType eType);
 
 virtual Size GetOptimalSize() const override;
+virtual void queue_resize(StateChangedType eReason = 
StateChangedType::Layout) override;
 virtual void Resize() override;
 
 ScConditionalFormat* GetConditionalFormat() const;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-05 Thread Eike Rathke
 sc/source/core/data/cellvalue.cxx   |3 +++
 sc/source/core/data/formulacell.cxx |   13 +
 2 files changed, 16 insertions(+)

New commits:
commit a34de7f0e4165db1a64be42044f9d5900d0d3da9
Author: Eike Rathke 
Date:   Thu Jan 5 16:37:07 2017 +0100

check token array code errors when testing for equality, tdf#105024 related

To not end up with a series of equal errors when importing individual error
cells and attempting to group them.

Change-Id: Idfcbb2e7077fc8799ef925c2c2e17188ac5e3b14
(cherry picked from commit 44021bd4018f4f97d9f0f6b6e1f0a256e8853537)
Reviewed-on: https://gerrit.libreoffice.org/32762
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/source/core/data/cellvalue.cxx 
b/sc/source/core/data/cellvalue.cxx
index 147ad51..efe66f7 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -63,6 +63,9 @@ bool equalsFormulaCells( const ScFormulaCell* p1, const 
ScFormulaCell* p2 )
 if (pCode1->GetLen() != pCode2->GetLen())
 return false;
 
+if (pCode1->GetCodeError() != pCode2->GetCodeError())
+return false;
+
 sal_uInt16 n = pCode1->GetLen();
 formula::FormulaToken** ppToken1 = pCode1->GetArray();
 formula::FormulaToken** ppToken2 = pCode2->GetArray();
diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index 6616439..465f0b8 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3844,6 +3844,13 @@ ScFormulaCell::CompareState 
ScFormulaCell::CompareByTokenArray( ScFormulaCell& r
 if ( nThisLen != nOtherLen )
 return NotEqual;
 
+// No tokens can be an error cell so check error code, otherwise we could
+// end up with a series of equal error values instead of individual error
+// values. Also if for any reason different errors are set even if all
+// tokens are equal, the cells are not equal.
+if (pCode->GetCodeError() != rOther.pCode->GetCodeError())
+return NotEqual;
+
 bool bInvariant = true;
 
 // check we are basically the same function
@@ -3930,6 +3937,12 @@ ScFormulaCell::CompareState 
ScFormulaCell::CompareByTokenArray( ScFormulaCell& r
 return NotEqual;
 }
 break;
+case formula::svError:
+{
+if (pThisTok->GetError() != pOtherTok->GetError())
+return NotEqual;
+}
+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-3' - sc/source

2017-01-05 Thread Eike Rathke
 sc/source/core/data/formulacell.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit d321ba87f5ab67f939034c59846d2a3d0ab7e9b4
Author: Eike Rathke 
Date:   Thu Jan 5 13:28:36 2017 +0100

tdf#105024 use context to generate "error only" formula string

The ScGlobal::GetErrorString() shortcut produced error constants in the
localized UI language, which was wrong anyway when storing ODFF. Use 
compiler
with context instead to generate the proper symbols.

However, this currently maps all not defined Err:xxx to #NULL! so to 
preserve
those additional work is needed.

Change-Id: I1de7621d6349d5b00a5aac1cedc9f265c78c7db1
(cherry picked from commit 896dd3962cd7e62bb2a9ebc6f97ff77936ec06a8)
Reviewed-on: https://gerrit.libreoffice.org/32752
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index f59ad09..6616439 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1042,7 +1042,10 @@ OUString ScFormulaCell::GetFormula( 
sc::CompileFormulaContext& rCxt ) const
 OUStringBuffer aBuf;
 if (pCode->GetCodeError() != FormulaError::NONE && !pCode->GetLen())
 {
-aBuf = OUStringBuffer( ScGlobal::GetErrorString( 
pCode->GetCodeError()));
+ScTokenArray aCode;
+aCode.AddToken( FormulaErrorToken( pCode->GetCodeError()));
+ScCompiler aComp(rCxt, aPos, aCode);
+aComp.CreateStringFromTokenArray(aBuf);
 return aBuf.makeStringAndClear();
 }
 else if( cMatrixFlag == MM_REFERENCE )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-05 Thread Caolán McNamara
 sc/source/ui/inc/navipi.hxx|8 
 sc/source/ui/navipi/navipi.cxx |2 ++
 2 files changed, 10 insertions(+)

New commits:
commit d4b57240aabece5550cc9ac448ff90301ed6ec3d
Author: Caolán McNamara 
Date:   Thu Jan 5 16:07:10 2017 +

Resolves: tdf#104919 crash with empty ScNavigatorDlg member

commit 292560a957498bed70b625c992ec6bcf631dceb3
Author: Noel Grandin 
Date:   Mon Oct 17 13:23:23 2016 +0200

loplugin:unusedmethods

detected the intended methods to do this were unused, so restore then, but 
hook
them up this time

Change-Id: I3b7e4a557696a91a70956487468b99fec6324a93
(cherry picked from commit f91dc0342de13e648dba5d9a93c01db23ae83533)

diff --git a/sc/source/ui/inc/navipi.hxx b/sc/source/ui/inc/navipi.hxx
index 7a21bf8..ac588dd 100644
--- a/sc/source/ui/inc/navipi.hxx
+++ b/sc/source/ui/inc/navipi.hxx
@@ -112,6 +112,10 @@ class ColumnEdit : public SpinField
 public:
 ColumnEdit(Window* pParent, WinBits nWinBits);
 ~ColumnEdit() override;
+void SetNavigatorDlg(ScNavigatorDlg *pNaviDlg)
+{
+xDlg = pNaviDlg;
+}
 SCCOL   GetCol() { return nCol; }
 voidSetCol( SCCOL nColNo );
 
@@ -140,6 +144,10 @@ class RowEdit : public NumericField
 public:
 RowEdit(Window* pParent, WinBits nWinBits);
 ~RowEdit() override;
+void SetNavigatorDlg(ScNavigatorDlg *pNaviDlg)
+{
+xDlg = pNaviDlg;
+}
 SCROW   GetRow() { return (SCROW)GetValue(); }
 voidSetRow(SCROW nRow) { SetValue(nRow); }
 
diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index e3782a5..4c5df44 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -451,7 +451,9 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, bool 
bSidebar, vcl::Window* pPar
 {
 get(aLbDocuments, "documents");
 get(aEdCol, "column");
+aEdCol->SetNavigatorDlg(this);
 get(aEdRow, "row");
+aEdRow->SetNavigatorDlg(this);
 get(aTbxCmd, "toolbox");
 aTbxCmd->SetSelectHdl(LINK(this, ScNavigatorDlg, ToolBoxSelectHdl));
 aTbxCmd->SetDropdownClickHdl(LINK(this, ScNavigatorDlg, 
ToolBoxDropdownClickHdl));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-04 Thread Winfried Donkers
 sc/source/core/tool/interpr3.cxx |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 1aa34bf14e86f3b684c56a9db8ebf1307413df5d
Author: Winfried Donkers 
Date:   Sat Dec 31 10:05:46 2016 +0100

tdf#104981 Fix deficiencies with PERCENTRANK functions.

Added constraint check for significance argument.
Replced inproper use of log() with log10().
Improved code efficiency a little bit.

Change-Id: Ie918857e6a04ea9fcf18410f789d7252f9c1cfc8
Reviewed-on: https://gerrit.libreoffice.org/32528
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
(cherry picked from commit facb4e69e4c75839df89969206403d2e97146dbd)
Reviewed-on: https://gerrit.libreoffice.org/32703

diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 5e73022..c9e145d 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -3508,6 +3508,11 @@ void ScInterpreter::ScPercentrank( bool bInclusive )
 if ( !MustHaveParamCount( nParamCount, 2, 3 ) )
 return;
 double fSignificance = ( nParamCount == 3 ? ::rtl::math::approxFloor( 
GetDouble() ) : 3.0 );
+if ( fSignificance < 1.0 )
+{
+PushIllegalArgument();
+return;
+}
 double fNum = GetDouble();
 vector aSortArray;
 GetSortArray( 1, aSortArray, nullptr, false, false );
@@ -3527,8 +3532,8 @@ void ScInterpreter::ScPercentrank( bool bInclusive )
 fRes = GetPercentrank( aSortArray, fNum, bInclusive );
 if ( fRes != 0.0 )
 {
-double fExp = ::rtl::math::approxFloor( log( fRes ) );
-fRes = ::rtl::math::round( fRes * pow( 10, -fExp + 
fSignificance - 1 ) ) / pow( 10, -fExp + fSignificance - 1 );
+double fExp = ::rtl::math::approxFloor( log10( fRes ) ) + 1.0 
- fSignificance;
+fRes = ::rtl::math::round( fRes * pow( 10, -fExp ) ) / pow( 
10, -fExp );
 }
 PushDouble( fRes );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-03 Thread Winfried Donkers
 sc/source/core/tool/interpr3.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit dd350f02992867aefcab88f332ff1c508b5924c9
Author: Winfried Donkers 
Date:   Sun Jan 1 11:57:34 2017 +0100

tdf#105026 Remove wrong constraint in PERMUTATIONA.

With permutations with repetitions, argument selection may
be larger than argument elements.
Probably inadvertently copied from PERMUT; has been there from
pre-git.

Change-Id: Icdee18eca647fb278f140630e45844684a1e3046
Reviewed-on: https://gerrit.libreoffice.org/32569
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
(cherry picked from commit 25625f18a282209235214674f2b81604ecd067ad)
Reviewed-on: https://gerrit.libreoffice.org/32704

diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 1b6a367..5e73022 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -1209,7 +1209,7 @@ void ScInterpreter::ScPermutationA()
 {
 double k = ::rtl::math::approxFloor(GetDouble());
 double n = ::rtl::math::approxFloor(GetDouble());
-if (n < 0.0 || k < 0.0 || k > n)
+if (n < 0.0 || k < 0.0)
 PushIllegalArgument();
 else
 PushDouble(pow(n,k));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-12-16 Thread Winfried Donkers
 sc/source/core/tool/interpr3.cxx |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 83675eeb30c92a17dd272894df34b89628de0142
Author: Winfried Donkers 
Date:   Mon Dec 12 16:09:04 2016 +0100

tdf#104581 handle constraints for NEGBINOMDIST in compliance with ODFF1.2.

Also changed varaiable names for easier understanding of their meaning.

Change-Id: I7c6f338c04898c7b07ebeb97fb331d51fa691f5b
Reviewed-on: https://gerrit.libreoffice.org/31910
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit 245b615400904274e264d5051baf63b3613db935)
Reviewed-on: https://gerrit.libreoffice.org/32087

diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index d05c34d..1b6a367 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -1493,17 +1493,17 @@ void ScInterpreter::ScNegBinomDist()
 {
 if ( MustHaveParamCount( GetByte(), 3 ) )
 {
-double p  = GetDouble();// p
-double r  = GetDouble();// r
-double x  = GetDouble();// x
-if (r < 0.0 || x < 0.0 || p < 0.0 || p > 1.0)
+double p = GetDouble();// probability
+double s = ::rtl::math::approxFloor(GetDouble());  // No of successes
+double f = ::rtl::math::approxFloor(GetDouble());  // No of failures
+if ((f + s) <= 1.0 || p < 0.0 || p > 1.0)
 PushIllegalArgument();
 else
 {
 double q = 1.0 - p;
-double fFactor = pow(p,r);
-for (double i = 0.0; i < x; i++)
-fFactor *= (i+r)/(i+1.0)*q;
+double fFactor = pow(p,s);
+for (double i = 0.0; i < f; i++)
+fFactor *= (i+s)/(i+1.0)*q;
 PushDouble(fFactor);
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-12-16 Thread Eike Rathke
 sc/source/core/data/drwlayer.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 3d4aec8c32bf7b95657c40485f093c8e4a36b77c
Author: Eike Rathke 
Date:   Fri Dec 16 00:18:52 2016 +0100

Resolves: tdf#103543 disable mass broadcasts from drawing objects' changes

Specifically the a11y listeners are nasty bottle necks. A11y will get
updated on paint/view. We're touching all objects on that drawing page
to reposition so interdependencies that need to be broadcasted should
not happen.

Change-Id: Ic80446e22422a3097281ba20eecf0a078ac6a7cb
(cherry picked from commit 6a334757082be4915e7e731ce4c1b0bd4641050d)
Reviewed-on: https://gerrit.libreoffice.org/32064
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index f2e93dd..d7a51a2 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -587,6 +587,9 @@ void ScDrawLayer::SetPageSize( sal_uInt16 nPageNo, const 
Size& rSize, bool bUpda
 
 bool bNegativePage = pDoc && pDoc->IsNegativePage( 
static_cast(nPageNo) );
 
+// Disable mass broadcasts from drawing objects' position changes.
+bool bWasLocked = isLocked();
+setLock(true);
 const size_t nCount = pPage->GetObjCount();
 for ( size_t i = 0; i < nCount; ++i )
 {
@@ -595,6 +598,7 @@ void ScDrawLayer::SetPageSize( sal_uInt16 nPageNo, const 
Size& rSize, bool bUpda
 if( pData )
 RecalcPos( pObj, *pData, bNegativePage, bUpdateNoteCaptionPos 
);
 }
+setLock(bWasLocked);
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-12-16 Thread Tamás Zolnai
 sc/source/ui/Accessibility/AccessibleDocument.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c869dac7c71395fd86a930c556893b6694a36e8a
Author: Tamás Zolnai 
Date:   Fri Dec 16 01:46:52 2016 +

tdf#71435: Accessible caret-moved events are missing when "freeze" is 
enabled

Two accessible document is created when "freeze" options is
enabled. meSplitPos identifies which accessible document handle
which part of the window. We should handle events only in that
accessible document which handles the active part.

Change-Id: Ic9674344951f620546dd272beaad796de611d258
Reviewed-on: https://gerrit.libreoffice.org/32065
Tested-by: Jenkins 
Reviewed-by: Tamás Zolnai 
(cherry picked from commit 06ea887f8ba34a628d7641eab210501f7bd2493d)
Reviewed-on: https://gerrit.libreoffice.org/32077
Tested-by: Tamás Zolnai 

diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx 
b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index f919af43..79b1a48 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -1581,7 +1581,7 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, 
const SfxHint& rHint )
 }
 else if ((rHint.GetId() == SC_HINT_ACC_ENTEREDITMODE)) // this event 
comes only on creating edit field of a cell
 {
-if (mpViewShell->GetViewData().HasEditView(meSplitPos))
+if (mpViewShell->GetViewData().GetEditActivePart() == meSplitPos)
 {
 ScViewData& rViewData = mpViewShell->GetViewData();
 const EditEngine* pEditEng = 
rViewData.GetEditView(meSplitPos)->GetEditEngine();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-12-12 Thread Winfried Donkers
 sc/source/core/tool/interpr3.cxx |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 5c20348e66b6c8fe88d204ba5b6f01b572334152
Author: Winfried Donkers 
Date:   Fri Dec 9 17:26:17 2016 +0100

tdf#104532 handle constraints for NEGBINOM.DIST correctly.

Also changed variable names for easier understanding of their meaning.

Change-Id: Iab558d7d1d9533f2a0c42e3d5f4acecead2e818e
Reviewed-on: https://gerrit.libreoffice.org/31807
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit ccbb0dd8788bf481f398782bf1519cd57c3b2bfb)
Reviewed-on: https://gerrit.libreoffice.org/31908

diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 66ca35c..d05c34d 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -1514,21 +1514,21 @@ void ScInterpreter::ScNegBinomDist_MS()
 if ( MustHaveParamCount( GetByte(), 4 ) )
 {
 bool bCumulative = GetBool();
-double p  = GetDouble();// p
-double r  = GetDouble();// r
-double x  = GetDouble();// x
-if ( r < 0.0 || x < 0.0 || p < 0.0 || p > 1.0 )
+double p = GetDouble();// probability
+double s = ::rtl::math::approxFloor(GetDouble());  // No of successes
+double f = ::rtl::math::approxFloor(GetDouble());  // No of failures
+if ( s < 1.0 || f < 0.0 || p < 0.0 || p > 1.0 )
 PushIllegalArgument();
 else
 {
 double q = 1.0 - p;
 if ( bCumulative )
-PushDouble( 1.0 - GetBetaDist( q, x + 1, r ) );
+PushDouble( 1.0 - GetBetaDist( q, f + 1, s ) );
 else
 {
-double fFactor = pow( p, r );
-for ( double i = 0.0; i < x; i++ )
-fFactor *= ( i + r ) / ( i + 1.0 ) * q;
+double fFactor = pow( p, s );
+for ( double i = 0.0; i < f; i++ )
+fFactor *= ( i + s ) / ( i + 1.0 ) * q;
 PushDouble( fFactor );
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-12-09 Thread Eike Rathke
 sc/source/filter/xml/xmlexprt.cxx |6 +++---
 sc/source/filter/xml/xmlexprt.hxx |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 1093721a260d25f986fd794acd914b8fb7bcf92a
Author: Eike Rathke 
Date:   Sat Dec 10 00:03:42 2016 +0100

rename to RegisterDefinedStyleNames() to clarify, tdf#104097 follow-up

Change-Id: Iecb64ab1e25913180bcb53a133f9dd6777ffb17b
(cherry picked from commit 7b1c8fa23342f847c7bbc99627dbb3fec0a57205)
Reviewed-on: https://gerrit.libreoffice.org/31825
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index b1ea373..2dca58b 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -1839,7 +1839,7 @@ const ScXMLEditAttributeMap& 
ScXMLExport::GetEditAttributeMap() const
 return *mpEditAttrMap;
 }
 
-void ScXMLExport::RegisterDefinedNames( uno::Reference< 
css::sheet::XSpreadsheetDocument > & xSpreadDoc )
+void ScXMLExport::RegisterDefinedStyleNames( uno::Reference< 
css::sheet::XSpreadsheetDocument > & xSpreadDoc )
 {
 ScFormatSaveData* pFormatData = 
ScModelObj::getImplementation(xSpreadDoc)->GetFormatSaveData();
 auto xAutoStylePool = GetAutoStylePool();
@@ -1946,7 +1946,7 @@ void ScXMLExport::ExportStyles_( bool bUsed )
 {
 Reference  xSpreadDoc( GetModel(), 
uno::UNO_QUERY );
 if (xSpreadDoc.is())
-RegisterDefinedNames( xSpreadDoc);
+RegisterDefinedStyleNames( xSpreadDoc);
 
 if (!pSharedData)
 {
@@ -2274,7 +2274,7 @@ void ScXMLExport::ExportAutoStyles_()
 if (getExportFlags() & SvXMLExportFlags::CONTENT)
 {
 // Reserve the loaded cell style names.
-RegisterDefinedNames( xSpreadDoc);
+RegisterDefinedStyleNames( xSpreadDoc);
 
 //  re-create automatic styles with old names from stored data
 ScSheetSaveData* pSheetData = 
ScModelObj::getImplementation(xSpreadDoc)->GetSheetSaveData();
diff --git a/sc/source/filter/xml/xmlexprt.hxx 
b/sc/source/filter/xml/xmlexprt.hxx
index fb14aa8..833163d 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -131,7 +131,7 @@ class ScXMLExport : public SvXMLExport
 sal_Int32   GetNumberFormatStyleIndex(sal_Int32 nNumFmt) const;
 voidCollectSharedData(SCTAB& nTableCount, sal_Int32& 
nShapesCount);
 voidCollectShapesAutoStyles(SCTAB nTableCount);
-voidRegisterDefinedNames( css::uno::Reference< 
css::sheet::XSpreadsheetDocument > & xSpreadDoc );
+voidRegisterDefinedStyleNames( css::uno::Reference< 
css::sheet::XSpreadsheetDocument > & xSpreadDoc );
 virtual void ExportFontDecls_() override;
 virtual void ExportStyles_( bool bUsed ) override;
 virtual void ExportAutoStyles_() override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-12-09 Thread Eike Rathke
 sc/source/filter/xml/xmlexprt.cxx |   24 
 sc/source/filter/xml/xmlexprt.hxx |1 +
 2 files changed, 17 insertions(+), 8 deletions(-)

New commits:
commit 1caf633196b43cb81c6f54ed85cf589acbbc89dc
Author: Eike Rathke 
Date:   Fri Dec 9 23:14:47 2016 +0100

Resolves: tdf#104097 register reserved cell style names for auto styles

SvXMLAutoStylePoolP_Impl re-starts with a clean
XMLAutoStyleFamily::maReservedNameSet, so reserving the names in
ScXMLExport::ExportStyles_() is not enough and needs to be redone in
ScXMLExport::ExportAutoStyles_()

In the bug scenario that lead to cell styles with duplicated names for
different styles of which when reloading only the first was taken.

Additionally, a style must be registered after 
SvXMLAutoStylePoolP::AddNamed()
to prevent duplicated styles with different names.

Change-Id: If3491eb89ab1741887d9a36ecf904a216fb1368e
(cherry picked from commit b579c928a8642bc5f455438c1fef01e8df7e195f)
Reviewed-on: https://gerrit.libreoffice.org/31812
Reviewed-by: Eike Rathke 
Tested-by: Jenkins 

diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index a3ec5b1..b1ea373 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -1839,6 +1839,16 @@ const ScXMLEditAttributeMap& 
ScXMLExport::GetEditAttributeMap() const
 return *mpEditAttrMap;
 }
 
+void ScXMLExport::RegisterDefinedNames( uno::Reference< 
css::sheet::XSpreadsheetDocument > & xSpreadDoc )
+{
+ScFormatSaveData* pFormatData = 
ScModelObj::getImplementation(xSpreadDoc)->GetFormatSaveData();
+auto xAutoStylePool = GetAutoStylePool();
+for (const auto& rFormatInfo : pFormatData->maIDToName)
+{
+xAutoStylePool->RegisterDefinedName(XML_STYLE_FAMILY_TABLE_CELL, 
rFormatInfo.second);
+}
+}
+
 void ScXMLExport::ExportContent_()
 {
 nCurrentTable = 0;
@@ -1936,14 +1946,7 @@ void ScXMLExport::ExportStyles_( bool bUsed )
 {
 Reference  xSpreadDoc( GetModel(), 
uno::UNO_QUERY );
 if (xSpreadDoc.is())
-{
-ScFormatSaveData* pFormatData = 
ScModelObj::getImplementation(xSpreadDoc)->GetFormatSaveData();
-auto aAutoStylePool = GetAutoStylePool();
-for (const auto& rFormatInfo : pFormatData->maIDToName)
-{
-aAutoStylePool->RegisterDefinedName(XML_STYLE_FAMILY_TABLE_CELL, 
rFormatInfo.second);
-}
-}
+RegisterDefinedNames( xSpreadDoc);
 
 if (!pSharedData)
 {
@@ -2099,6 +2102,8 @@ void ScXMLExport::AddStyleFromCells(const 
uno::Reference& x
 {
 sName = itr->second;
 bAdded = GetAutoStylePool()->AddNamed(sName, 
XML_STYLE_FAMILY_TABLE_CELL, sStyleName, aPropStates);
+if (bAdded)
+
GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TABLE_CELL, sName);
 }
 }
 bool bIsAutoStyle(true);
@@ -2268,6 +2273,9 @@ void ScXMLExport::ExportAutoStyles_()
 
 if (getExportFlags() & SvXMLExportFlags::CONTENT)
 {
+// Reserve the loaded cell style names.
+RegisterDefinedNames( xSpreadDoc);
+
 //  re-create automatic styles with old names from stored data
 ScSheetSaveData* pSheetData = 
ScModelObj::getImplementation(xSpreadDoc)->GetSheetSaveData();
 if (pSheetData && pDoc)
diff --git a/sc/source/filter/xml/xmlexprt.hxx 
b/sc/source/filter/xml/xmlexprt.hxx
index 33e926c..fb14aa8 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -131,6 +131,7 @@ class ScXMLExport : public SvXMLExport
 sal_Int32   GetNumberFormatStyleIndex(sal_Int32 nNumFmt) const;
 voidCollectSharedData(SCTAB& nTableCount, sal_Int32& 
nShapesCount);
 voidCollectShapesAutoStyles(SCTAB nTableCount);
+voidRegisterDefinedNames( css::uno::Reference< 
css::sheet::XSpreadsheetDocument > & xSpreadDoc );
 virtual void ExportFontDecls_() override;
 virtual void ExportStyles_( bool bUsed ) override;
 virtual void ExportAutoStyles_() override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   >