[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2022-04-13 Thread Caolán McNamara (via logerrit)
 sc/source/ui/docshell/impex.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f34a205e60846c91bcd22116c9e6e667ebb1e515
Author: Caolán McNamara 
AuthorDate: Tue Apr 12 12:26:54 2022 +0100
Commit: Xisco Fauli 
CommitDate: Wed Apr 13 10:29:52 2022 +0200

ofz#46352 assert on bad string offset

Change-Id: I60123fd0460b8038f08582a0bcbf2307af321df1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132862
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 260db563e203..a2360eb494c9 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -2206,7 +2206,7 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm )
 aFormats.push_back( nKey );
 }
 }
-else if( cTag == 'I' && *p == 'D' )
+else if (cTag == 'I' && *p == 'D' && aLine.getLength() > 4)
 {
 aLine = aLine.copy(4);
 if (aLine == "CALCOOO32")


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2022-03-21 Thread Eike Rathke (via logerrit)
 sc/source/ui/docshell/impex.cxx |   72 
 1 file changed, 44 insertions(+), 28 deletions(-)

New commits:
commit 479620d84a761297e013ca76fd429d938f3d2d8f
Author: Eike Rathke 
AuthorDate: Thu Mar 17 22:44:26 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Mar 21 10:50:21 2022 +0100

Resolves: tdf#148054 Advance offset for all columns, tdf#104927 regression

Regression from

commit 621c189173b35ac7f5ce4c578f57045479c63ab6
CommitDate: Sat Jan 9 05:13:55 2021 +0100

tdf#104927 consider character width for CSV import

that for fixed width introduced a visual count of character widths
for CJK IVS characters but did not advance the character offset
for skipped hidden columns.

Instead of having to ask bDetermineRange three times in the loop,
split off an extra loop for bDetermineRange, advancing the offset
then is straight forward and just only non-skipped columns are
extracted and written to document.

Change-Id: Ib6ab6b68c5fc0f6ff854d629d75742c39ed6ddf5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131722
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 6b768542ddd52573bbdb0e7b5b85ce5a9dd4551d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131606
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index b44e58b0e343..260db563e203 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1483,39 +1483,55 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm )
 bool bMultiLine = false;
 if ( bFixed ) //  Fixed line length
 {
-sal_Int32 nStartIdx = 0;
-// Yes, the check is nCol<=rDoc.MaxCol()+1, +1 because it is 
only an
-// overflow if there is really data following to be put behind
-// the last column, which doesn't happen if info is
-// SC_COL_SKIP.
-for ( i=0; i rDoc.MaxCol())
-bOverflowCol = true;// display warning on 
import
-else if (!bDetermineRange)
+const sal_uInt8 nFmt = pColFormat[i];
+if (nFmt != SC_COL_SKIP)// otherwise don't 
increment nCol either
 {
-sal_Int32 nNextIdx = nStartIdx;
-if ( i + 1 < nInfoCount )
-CountVisualWidth( aLine, nNextIdx, 
pColStart[i+1] - pColStart[i] );
+if (nCol > rDoc.MaxCol())
+bOverflowCol = true;// display warning on 
import
+++nCol;
+}
+}
+}
+else
+{
+sal_Int32 nStartIdx = 0;
+// Same maxcol+1 check reason as above.
+for (i=0; i < nInfoCount && nCol <= rDoc.MaxCol()+1; ++i)
+{
+sal_Int32 nNextIdx = nStartIdx;
+if (i + 1 < nInfoCount)
+CountVisualWidth( aLine, nNextIdx, pColStart[i+1] 
- pColStart[i] );
+else
+nNextIdx = nLineLen;
+sal_uInt8 nFmt = pColFormat[i];
+if (nFmt != SC_COL_SKIP)// otherwise don't 
increment nCol either
+{
+if (nCol > rDoc.MaxCol())
+bOverflowCol = true;// display warning on 
import
 else
-nNextIdx = nLineLen;
-
-bool bIsQuoted = false;
-aCell = lcl_GetFixed( aLine, nStartIdx, nNextIdx, 
bIsQuoted, bOverflowCell );
-if (bIsQuoted && bQuotedAsText)
-nFmt = SC_COL_TEXT;
-
-bMultiLine |= lcl_PutString(
-aDocImport, !mbOverwriting, nCol, nRow, nTab, 
aCell, nFmt,
-, bDetectNumFormat, 
bSkipEmptyCells, aTransliteration, aCalendar,
-pEnglishTransliteration.get(), 
pEnglishCalendar.get());
-
-nStartIdx = nNextIdx;
+{
+bool bIsQuoted = false;
+aCell = lcl_GetFixed( aLine, nStartIdx, 
nNextIdx, bIsQuoted, bOverflowCell );
+if (bIsQuoted && bQuotedAsText)
+nFmt = SC_COL_TEXT;
+
+bMultiLine |= lcl_PutString(
+aDocImport, !mbOverwriting, nCol, 
nRow, 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2022-03-08 Thread Luboš Luňák (via logerrit)
 sc/source/core/data/table3.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a03b08319f24c4a8570941460b91678a151ba5a2
Author: Luboš Luňák 
AuthorDate: Tue Mar 8 12:59:47 2022 +0100
Commit: Xisco Fauli 
CommitDate: Tue Mar 8 22:14:54 2022 +0100

proper columns range check (tdf#147830)

Change-Id: Ib23bc3f194fa418035e7c70a4f3e1b682f9c46b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131181
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 
(cherry picked from commit d032b81bbf2ca87114d15749d74166d0ba414972)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131195
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index d57f405111a8..deefa64ac345 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -3495,7 +3495,7 @@ bool ScTable::CreateExcelQuery(SCCOL nCol1, SCROW nRow1, 
SCCOL nCol2, SCROW nRow
 if (bValid)
 {
 sal_uLong nVisible = 0;
-for ( nCol=nCol1; nCol<=nCol2; nCol++ )
+for ( nCol=nCol1; nCol<=ClampToAllocatedColumns(nCol2); nCol++ )
 nVisible += aCol[nCol].VisibleCount( nRow1+1, nRow2 );
 
 if ( nVisible > SCSIZE_MAX / sizeof(void*) )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2022-02-28 Thread Caolán McNamara (via logerrit)
 sc/source/filter/lotus/op.cxx |   11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

New commits:
commit 4b6956ca146f25b746f63c176b377d3c15d204ff
Author: Caolán McNamara 
AuthorDate: Mon Feb 28 09:15:10 2022 +
Commit: Caolán McNamara 
CommitDate: Mon Feb 28 14:01:47 2022 +0100

ensure null terminator

LIBREOFFICE-WB8DT2Q9

Change-Id: I98529325bbd3ff475ba84b4991eb17240440df4b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130668
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index c886ace340f1..b10ba5709198 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -588,14 +588,9 @@ void OP_SheetName123(LotusContext& rContext, SvStream& 
rStream, sal_uInt16 nLeng
 sal_uInt16 nSheetNum(0);
 rStream.ReadUInt16(nSheetNum);
 
-::std::vector sSheetName;
-sSheetName.reserve(nLength-4);
-for (sal_uInt16 i = 4; i < nLength; ++i)
-{
-char c;
-rStream.ReadChar( c );
-sSheetName.push_back(c);
-}
+const size_t nStrLen = nLength - 4;
+std::vector sSheetName(nStrLen + 1);
+sSheetName[rStream.ReadBytes(sSheetName.data(), nStrLen)] = 0;
 
 if (!ValidTab(nSheetNum))
 return;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2022-02-17 Thread Luboš Luňák (via logerrit)
 sc/source/core/data/table2.cxx |   15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

New commits:
commit ada399e8a3c5d5f3c9425cae0da486fed90175e6
Author: Luboš Luňák 
AuthorDate: Wed Feb 16 09:54:54 2022 +0100
Commit: Xisco Fauli 
CommitDate: Thu Feb 17 10:29:36 2022 +0100

for unallocated columns check default column attributes (tdf#132057)

The problem was that this was returning false for the protected
attribute just because a column was not allocated, but the default
attributes had the flag set (so if the column had been allocated
first it would have the flag set too).

Change-Id: I2ef1ef40cafb7e8fc6f7b561c0a376af63f2ad26
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129984
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 
(cherry picked from commit a717029e217621482ef799731f945090c6d6be4b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130015
Reviewed-by: Xisco Fauli 
(cherry picked from commit 5bdf7c93abd15dc422586228186e822096ce1517)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130018

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 7ed03187b4b4..f5f4b8723ab1 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2211,15 +2211,12 @@ const ScPatternAttr* ScTable::GetMostUsedPattern( SCCOL 
nCol, SCROW nStartRow, S
 
 bool ScTable::HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, 
HasAttrFlags nMask ) const
 {
-if ( nCol1 >= aCol.size() )
- return false;
-if ( nCol2 >= aCol.size() )
- nCol2 = aCol.size() - 1; // Rows above range, doesn't contains flags
-
-bool bFound = false;
-for (SCCOL i=nCol1; i<=nCol2 && !bFound; i++)
-bFound |= aCol[i].HasAttrib( nRow1, nRow2, nMask );
-return bFound;
+for(SCCOL nCol = nCol1; nCol <= nCol2 && nCol < aCol.size(); ++nCol )
+if( aCol[nCol].HasAttrib( nRow1, nRow2, nMask ))
+return true;
+if( nCol2 >= aCol.size())
+ return aDefaultColAttrArray.HasAttrib( nRow1, nRow2, nMask );
+return false;
 }
 
 bool ScTable::HasAttribSelection( const ScMarkData& rMark, HasAttrFlags nMask 
) const


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2022-02-16 Thread Justin Luth (via logerrit)
 sc/source/core/data/table2.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 0b59601e415d186565278289e4d3613f727ef75c
Author: Justin Luth 
AuthorDate: Wed Feb 9 20:17:53 2022 +0200
Commit: Christian Lohmaier 
CommitDate: Wed Feb 16 21:21:44 2022 +0100

tdf#113785 sc: IsDataFiltered must be normalized

I can't believe this hasn't caused major issues
and has survived as a bug for so long.

Due to the way IsDataFiltered is coded,
it is required that the range is normalized
in order to get any kind of meaningful result,
so lets ensure that.

Change-Id: I2ede77f738fbaeb05a0f1425a2e88e59fca08e9e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129735
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit bda200a5e9c4592bd61b7924fa171ec3265bfd24)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129761
Reviewed-by: Eike Rathke 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130049
Reviewed-by: Christian Lohmaier 

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 95bef419c9a8..7ed03187b4b4 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -3665,6 +3665,8 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool 
bShow)
 
 bool ScTable::IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, 
SCROW nRowEnd) const
 {
+assert(nColStart <= nColEnd && nRowStart <= nRowEnd
+   && "range must be normalized to obtain a valid result");
 for (SCROW i = nRowStart; i <= nRowEnd; ++i)
 {
 if (RowHidden(i))
@@ -3680,8 +3682,9 @@ bool ScTable::IsDataFiltered(SCCOL nColStart, SCROW 
nRowStart, SCCOL nColEnd, SC
 
 bool ScTable::IsDataFiltered(const ScRange& rRange) const
 {
-return IsDataFiltered(rRange.aStart.Col(), rRange.aStart.Row(),
-rRange.aEnd.Col(), rRange.aEnd.Row());
+ScRange aNormalized(rRange.aStart, rRange.aEnd);
+return IsDataFiltered(aNormalized.aStart.Col(), aNormalized.aStart.Row(),
+  aNormalized.aEnd.Col(), aNormalized.aEnd.Row());
 }
 
 void ScTable::SetRowFlags( SCROW nRow, CRFlags nNewFlags )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2022-02-16 Thread Eike Rathke (via logerrit)
 sc/source/ui/docshell/impex.cxx |   37 ++---
 1 file changed, 34 insertions(+), 3 deletions(-)

New commits:
commit 1983ec4406da206fe73c4da7c325043b00ee
Author: Eike Rathke 
AuthorDate: Tue Feb 15 15:49:45 2022 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Feb 16 14:43:39 2022 +0100

Resolves: tdf#147421 Do not use OUString::replaceAll() to strip null-bytes

It reallocates and concatenates for each replacement so for
massive amounts takes ages.

Change-Id: Ibe1673fd4775c5b95833000669c1a24e718fd77c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129971
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 4b0c17609c2cca326bbcc9e8488a327a4a9ea952)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129945
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 875f051174d9..b44e58b0e343 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1631,10 +1631,41 @@ void ScImportExport::EmbeddedNullTreatment( OUString & 
rStr )
 
 // The normal case is no embedded NULL, check first before de-/allocating
 // ustring stuff.
-sal_Unicode cNull = 0;
-if (rStr.indexOf( cNull) >= 0)
+const sal_Unicode cNull = 0;
+sal_Int32 i;
+if ((i = rStr.indexOf( cNull)) >= 0)
 {
-rStr = rStr.replaceAll( std::u16string_view( , 1), "");
+// Do not use OUString::replaceAll(...,""), in case of repeated null
+// bytes that reallocates for each and for massive amounts takes
+// ~endless. See tdf#147421 with 3577016 trailing null-bytes.
+const sal_Int32 nLen = rStr.getLength();
+OUStringBuffer aBuf( nLen);
+sal_Int32 s = 0;
+sal_Unicode const * const p = rStr.getStr();
+do
+{
+// Append good substring.
+aBuf.append( p + s, i - s);
+// Skip all cNull.
+while (++i < nLen && *(p+i) == cNull)
+;
+// Find next cNull after good if characters left, else end.
+if (i < nLen)
+{
+s = i;
+i = rStr.indexOf( cNull, i);
+}
+else
+{
+s = nLen;
+}
+}
+while (0 <= i && i < nLen);
+// Append good trailing substring, if any.
+if (s < nLen)
+aBuf.append( p + s, nLen - s);
+
+rStr = aBuf.makeStringAndClear();
 }
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2022-02-16 Thread Justin Luth (via logerrit)
 sc/source/core/data/table4.cxx |   20 
 1 file changed, 16 insertions(+), 4 deletions(-)

New commits:
commit 99191703b528d8d7b0b9c5d84d76a6fdebbf5191
Author: Justin Luth 
AuthorDate: Wed Feb 9 14:33:05 2022 +0200
Commit: Eike Rathke 
CommitDate: Wed Feb 16 12:03:02 2022 +0100

tdf#113785 sc FillAutoSimple: also optimize in negative direction

By only coding the optimization for the downward autofill,
it totally broke an upward autofill.
So this patch simply fixes the LO 4.3ish regression
from commit a995462e6855061816c6529c366f20ace2b45868.

This fix means that the non-hidden cells get the auto-value
instead of being erased.

However, the hidden cells are still erased
(which is the topic of tdf#119957).

I'm not going to bother with a unit test for this
portion. If I can solve bug 119957 as well,
then the unit test for that can cover both situations.

Change-Id: If6320ccf87fa8893ca6766c265b7760cc46ed7d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129723
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 618084819babc839510860b74b36631749093c4c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129753
Reviewed-by: Xisco Fauli 
(cherry picked from commit f3035cdb6a8d3ef56180640ef9d04031012250b9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129760
Reviewed-by: Eike Rathke 

diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 0f1f7193fe59..73ad750d35c1 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1782,16 +1782,28 @@ void ScTable::FillAutoSimple(
 bool bIsOrdinalSuffix = false;
 
 bool bColHidden = false, bRowHidden = false;
+SCCOL nColHiddenFirst = rDocument.MaxCol();
 SCCOL nColHiddenLast = -1;
+SCROW nRowHiddenFirst = rDocument.MaxRow();
 SCROW nRowHiddenLast = -1;
 
 rInner = nIStart;
 while (true)// #i53728# with "for (;;)" old solaris/x86 compiler 
mis-optimizes
 {
-if (rCol > nColHiddenLast)
-bColHidden = ColHidden(rCol, nullptr, );
-if (rRow > nRowHiddenLast)
-bRowHidden = RowHidden(rRow, nullptr, );
+if (bPositive)
+{
+if (rCol > nColHiddenLast)
+bColHidden = ColHidden(rCol, nullptr, );
+if (rRow > nRowHiddenLast)
+bRowHidden = RowHidden(rRow, nullptr, );
+}
+else
+{
+if (rCol < nColHiddenFirst)
+bColHidden = ColHidden(rCol, );
+if (rRow < nRowHiddenFirst)
+bRowHidden = RowHidden(rRow, );
+}
 
 if (!bColHidden && !bRowHidden)
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2022-01-16 Thread Caolán McNamara (via logerrit)
 sc/source/ui/view/gridwin.cxx |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 2e02d78f92b06c72d515240cf83e1a8f224b0ae3
Author: Caolán McNamara 
AuthorDate: Fri Jan 14 12:50:15 2022 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Jan 16 22:01:06 2022 +0100

tdf#136481 show the focus rect for the case nothing is yet selected

but the cursor is at pos 0

Change-Id: I7c94480bffdced23fe89d4e3ba0e729742247130
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128414
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 4bdf28b404f90236d93ce207671f755a71f28496)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128430
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index ab7ed3fe45cf..e42a6eac94b8 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1296,12 +1296,16 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, 
SCROW nRow )
 {
 rFilterBox.grab_focus();
 
+if (rFilterBox.n_children())
+{
+if (nSelPos != -1)
+rFilterBox.set_cursor(nSelPos);
+else
+rFilterBox.set_cursor(0);
+}
 // Select only after GrabFocus, so that the focus rectangle gets 
correct
 if (nSelPos != -1)
-{
-rFilterBox.set_cursor(nSelPos);
 rFilterBox.select(nSelPos);
-}
 else
 rFilterBox.unselect_all();
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2022-01-13 Thread Andreas Heinisch (via logerrit)
 sc/source/ui/unoobj/cellsuno.cxx |   16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 5ee413d78cfc1cbfbe7c05f0c21c40ffb32f572a
Author: Andreas Heinisch 
AuthorDate: Tue Dec 28 19:55:29 2021 +0100
Commit: Xisco Fauli 
CommitDate: Thu Jan 13 09:48:37 2022 +0100

tdf#146454 - Check for multiline string in setDataArray

Check for a multiline string in the setDataArray function. If that is
the case, set a string or edit cell. Otherwise, just set a plain string in 
order to prevent performance issues due to the adjustments of the row height.

Regression from b9e2c5d2a36fbd189c20448cadf4212edf02914d

Change-Id: I9216b198b878fda5da29596d25504db853acd756
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127660
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 
(cherry picked from commit 2d11710df6d81c03007d136667a443e09cc70eed)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128332
Reviewed-by: Xisco Fauli 
(cherry picked from commit b1e2d386afc3174d79a11fcfe365bf3a51f0caef)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128333

diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 29d3b29086da..9d280b35213e 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1098,7 +1098,7 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, 
const ScRange& rRange,
 const uno::Sequence< uno::Sequence >& aData )
 {
 ScDocument& rDoc = rDocShell.GetDocument();
-ScDocFunc& rDocFunc = rDocShell.GetDocFunc();
+ScFieldEditEngine& rEngine = rDoc.GetEditEngine();
 SCTAB nTab = rRange.aStart.Tab();
 SCCOL nStartCol = rRange.aStart.Col();
 SCROW nStartRow = rRange.aStart.Row();
@@ -1175,7 +1175,19 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, 
const ScRange& rRange,
 rElement >>= aUStr;
 if ( !aUStr.isEmpty() )
 {
-rDocFunc.SetStringOrEditCell(aPos, aUStr, false);
+// tdf#146454 - check for a multiline string since 
setting an edit
+// or string cell is in magnitudes slower than 
setting a plain string
+if (ScStringUtil::isMultiline(aUStr))
+{
+rEngine.SetTextCurrentDefaults(aUStr);
+rDoc.SetEditText(aPos, 
rEngine.CreateTextObject());
+}
+else
+{
+ScSetStringParam aParam;
+aParam.setTextInput();
+rDoc.SetString(aPos, aUStr, );
+}
 }
 }
 break;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2022-01-10 Thread Mike Kaganski (via logerrit)
 sc/source/ui/unoobj/viewuno.cxx |   24 
 1 file changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 6f69c445719e7c100e2669dae1afc0b9a44267c5
Author: Mike Kaganski 
AuthorDate: Thu Jan 6 18:38:58 2022 +0300
Commit: Xisco Fauli 
CommitDate: Mon Jan 10 14:56:55 2022 +0100

tdf#146617: iterators may be invalidated during handler call

... when the handler decides to remove itself from listeners.

Change-Id: I1d5fe802f50d284bf70d747edaff0a19852c5a7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128054
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit e9dce4e8cbea04d6c6636a45f5a172e986714409)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128074
Reviewed-by: Michael Stahl 
(cherry picked from commit 6d8b019f8f72d9802d86ab0414c909db04fdc912)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128160
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index a758a9054600..2085d217a1f3 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -545,16 +545,16 @@ void ScTabViewObj::SheetChanged( bool bSameTabButMoved )
 uno::Reference< uno::XInterface > xSource(xView, uno::UNO_QUERY);
 aEvent.Source = xSource;
 aEvent.ActiveSheet = new ScTableSheetObj(pDocSh, rViewData.GetTabNo());
-for (auto it = aActivationListeners.begin(); it != 
aActivationListeners.end(); )
+// Listener's handler may remove it from the listeners list
+for (size_t i = aActivationListeners.size(); i > 0; --i)
 {
 try
 {
-(*it)->activeSpreadsheetChanged( aEvent );
-++it;
+aActivationListeners[i - 1]->activeSpreadsheetChanged( aEvent 
);
 }
 catch( uno::Exception& )
 {
-it = aActivationListeners.erase( it);
+aActivationListeners.erase(aActivationListeners.begin() + (i - 
1));
 }
 }
 }
@@ -1150,17 +1150,17 @@ bool ScTabViewObj::MousePressed( const awt::MouseEvent& 
e )
 aMouseEvent.Target = xTarget;
 aMouseEvent.Modifiers = e.Modifiers;
 
-for (auto it = aMouseClickHandlers.begin(); it != 
aMouseClickHandlers.end(); )
+// Listener's handler may remove it from the listeners list
+for (size_t i = aMouseClickHandlers.size(); i > 0; --i)
 {
 try
 {
-if (!(*it)->mousePressed( aMouseEvent ))
+if (!aMouseClickHandlers[i - 1]->mousePressed(aMouseEvent))
 bReturn = true;
-++it;
 }
 catch ( uno::Exception& )
 {
-it = aMouseClickHandlers.erase(it);
+aMouseClickHandlers.erase(aMouseClickHandlers.begin() + (i - 
1));
 }
 }
 }
@@ -1260,17 +1260,17 @@ bool ScTabViewObj::MouseReleased( const 
awt::MouseEvent& e )
 aMouseEvent.Target = xTarget;
 aMouseEvent.Modifiers = e.Modifiers;
 
-for (auto it = aMouseClickHandlers.begin(); it != 
aMouseClickHandlers.end(); )
+// Listener's handler may remove it from the listeners list
+for (size_t i = aMouseClickHandlers.size(); i > 0; --i)
 {
 try
 {
-if (!(*it)->mouseReleased( aMouseEvent ))
+if (!aMouseClickHandlers[i - 1]->mouseReleased( 
aMouseEvent ))
 bReturn = true;
-++it;
 }
 catch ( uno::Exception& )
 {
-it = aMouseClickHandlers.erase(it);
+aMouseClickHandlers.erase(aMouseClickHandlers.begin() + (i 
- 1));
 }
 }
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2022-01-09 Thread Caolán McNamara (via logerrit)
 sc/source/ui/optdlg/tpcalc.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit ea800e3bf861a6a6bf338e72cc55959d32b5af48
Author: Caolán McNamara 
AuthorDate: Wed Jan 5 21:09:13 2022 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Jan 9 17:42:31 2022 +0100

Resolves: tdf#146592 "Reset" to the current document properties

not those seen at the initial load of the TabPage

Change-Id: Ieba4c278a0a9b7fef3030d8462cb845c27dba9b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127961
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sc/source/ui/optdlg/tpcalc.cxx b/sc/source/ui/optdlg/tpcalc.cxx
index 92570ea9653f..53517d81a0f0 100644
--- a/sc/source/ui/optdlg/tpcalc.cxx
+++ b/sc/source/ui/optdlg/tpcalc.cxx
@@ -82,12 +82,16 @@ std::unique_ptr ScTpCalcOptions::Create( 
weld::Container* pPage, wel
 return std::make_unique( pPage, pController, *rAttrSet );
 }
 
-void ScTpCalcOptions::Reset( const SfxItemSet* /* rCoreAttrs */ )
+void ScTpCalcOptions::Reset(const SfxItemSet* rCoreAttrs)
 {
 sal_uInt16  d,m;
 sal_Int16   y;
 
-*pLocalOptions  = *pOldOptions;
+pOldOptions.reset(new ScDocOptions(
+static_cast(rCoreAttrs->Get(
+GetWhich(SID_SCDOCOPTIONS))).GetDocOptions()));
+
+*pLocalOptions = *pOldOptions;
 
 m_xBtnCase->set_active( !pLocalOptions->IsIgnoreCase() );
 m_xBtnCase->set_sensitive( 
!officecfg::Office::Calc::Calculate::Other::CaseSensitive::isReadOnly() );


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-12-26 Thread Eike Rathke (via logerrit)
 sc/source/core/tool/interpr1.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 07e58ea08758018906c08321591d264f85a24e66
Author: Eike Rathke 
AuthorDate: Sat Dec 25 19:38:14 2021 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Dec 26 09:01:39 2021 +0100

Related: tdf#146377 Let AND(), OR(), XOR() propagate the current error, if 
any

... instead of forcing Err:504

Change-Id: I7e91671ffc61bf82d9095378656b41981040f55e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127492
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 4674ff347cd2e71445503efdc0c110d094daa80b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127477
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 94923f75c255..cc710efc353e 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -1347,7 +1347,7 @@ void ScInterpreter::ScAnd()
 }
 break;
 default:
-Pop();
+PopError();
 SetError( FormulaError::IllegalParameter);
 }
 }
@@ -1446,7 +1446,7 @@ void ScInterpreter::ScOr()
 }
 break;
 default:
-Pop();
+PopError();
 SetError( FormulaError::IllegalParameter);
 }
 }
@@ -1548,7 +1548,7 @@ void ScInterpreter::ScXor()
 }
 break;
 default:
-Pop();
+PopError();
 SetError( FormulaError::IllegalParameter);
 }
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-12-21 Thread Caolán McNamara (via logerrit)
 sc/source/core/tool/compiler.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 95a01158e5021f2babc04a291523734a0a6d8f4d
Author: Caolán McNamara 
AuthorDate: Sat Dec 18 19:28:00 2021 +
Commit: Michael Stahl 
CommitDate: Tue Dec 21 11:11:07 2021 +0100

ofz#42605 Null-dereference

Change-Id: Ief752f20aa3e7672e4ed7f6cd1809ee56a096c43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127052
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 628465e0d085..cde3c16f4f4e 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4325,7 +4325,8 @@ bool ScCompiler::NextNewToken( bool bInArray )
  * handled by IsPredetectedReference(), this case here remains for
  * manual/API input. */
 OUString aBad( aFormula.copy( nSrcPos-1 ) );
-eLastOp = pArr->AddBad( aBad )->GetOpCode();
+const FormulaToken* pBadToken = pArr->AddBad(aBad);
+eLastOp = pBadToken ? pBadToken->GetOpCode() : ocNone;
 return false;
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-12-16 Thread Eike Rathke (via logerrit)
 sc/source/ui/xmlsource/xmlsourcedlg.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 262656092fda6398e6b028a92f2ac7222ce11d30
Author: Eike Rathke 
AuthorDate: Wed Dec 15 23:31:09 2021 +0100
Commit: Xisco Fauli 
CommitDate: Thu Dec 16 10:45:59 2021 +0100

Resolves: tdf#126565 RefEditModified() preset current sheet for address-only

Change-Id: Ifa662a9d55fae10e3e1e3e115c9c5eb10972cbbe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126899
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit ec4f8cd2172bf7b232961f31ebd22d7e13af261e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126883
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx 
b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index edc8ca3d5dcb..b65237ff575f 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -558,7 +558,9 @@ void ScXMLSourceDlg::RefEditModified()
 OUString aRefStr = mxRefEdit->GetText();
 
 // Check if the address is valid.
+// Preset current sheet in case only address was entered.
 ScAddress aLinkedPos;
+aLinkedPos.SetTab( ScDocShell::GetCurTab());
 ScRefFlags nRes = aLinkedPos.Parse(aRefStr, *mpDoc, 
mpDoc->GetAddressConvention());
 bool bValid = ( (nRes & ScRefFlags::VALID) == ScRefFlags::VALID );
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-12-09 Thread Justin Luth (via logerrit)
 sc/source/core/data/documen3.cxx |6 +++---
 sc/source/core/data/validat.cxx  |6 +++---
 sc/source/ui/app/inputhdl.cxx|4 ++--
 sc/source/ui/view/gridwin.cxx|4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 20c1ab5d85e3f24d4cdf6ab167ea6ce98e2586b4
Author: Justin Luth 
AuthorDate: Mon Dec 6 14:53:14 2021 +0200
Commit: Eike Rathke 
CommitDate: Fri Dec 10 02:57:53 2021 +0100

new ScTypedStrData: typically missed argument in CTOR, tdf#142910 follow-up

Pretty much any attempted use of eType was completely wrong and lost.

Regression from

commit f6b143a57d9bd8f5d7b29febcb4e01ee1eb2ff1d
CommitDate: Wed Jul 7 17:44:46 2021 +0200

tdf#142910 sc filter: fix "greater than" or "smaller than" etc

Most calls to this are missing the "rounded number" argument,
so the enumator is actually accepted as the double fRVal,
and the StringValue eType was left as the default value (Standard),
instead of the intended enumerator.

0.0 looks too much like 0, 0 to even notice in
casual code reading.

This had rendered the type mostly irrelevant.

Change-Id: If4fa69d4b3077981244a2c3a785f80b77f9f9501
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126453
Tested-by: Eike Rathke 
Reviewed-by: Eike Rathke 
(cherry picked from commit ac1ea5944a236efef75af7c85d0ffe10d374e7fa)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126591
Tested-by: Jenkins

diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 92c721fa48ca..a1e7a2d9e73b 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1669,7 +1669,7 @@ void ScDocument::GetFormulaEntries( ScTypedCaseStrSet& 
rStrings )
 if ( pRangeName )
 {
 for (const auto& rEntry : *pRangeName)
-rStrings.insert(ScTypedStrData(rEntry.second->GetName(), 0.0, 
ScTypedStrData::Name));
+rStrings.insert(ScTypedStrData(rEntry.second->GetName(), 0.0, 0.0, 
ScTypedStrData::Name));
 }
 
 // Database collection
@@ -1677,7 +1677,7 @@ void ScDocument::GetFormulaEntries( ScTypedCaseStrSet& 
rStrings )
 {
 const ScDBCollection::NamedDBs& rDBs = pDBCollection->getNamedDBs();
 for (const auto& rxDB : rDBs)
-rStrings.insert(ScTypedStrData(rxDB->GetName(), 0.0, 
ScTypedStrData::DbName));
+rStrings.insert(ScTypedStrData(rxDB->GetName(), 0.0, 0.0, 
ScTypedStrData::DbName));
 }
 
 // Content of name ranges
@@ -1700,7 +1700,7 @@ void ScDocument::GetFormulaEntries( ScTypedCaseStrSet& 
rStrings )
 continue;
 
 OUString aStr = aIter.getString();
-rStrings.insert(ScTypedStrData(aStr, 0.0, 
ScTypedStrData::Header));
+rStrings.insert(ScTypedStrData(aStr, 0.0, 0.0, 
ScTypedStrData::Header));
 }
 }
 }
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index d467db7ccf0f..6f578402309d 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -843,7 +843,7 @@ bool ScValidationData::GetSelectionFromFormula(
 }
 
 if( nullptr != pStrings )
-pEntry.reset(new ScTypedStrData( aValStr, 0.0, 
ScTypedStrData::Standard));
+pEntry.reset(new ScTypedStrData(aValStr, 0.0, 0.0, 
ScTypedStrData::Standard));
 
 if (!rCell.isEmpty() && rMatch < 0)
 aCondTokArr.AddString(rSPool.intern(aValStr));
@@ -880,7 +880,7 @@ bool ScValidationData::GetSelectionFromFormula(
 aCondTokArr.AddDouble( nMatVal.fVal );
 }
 if( nullptr != pStrings )
-pEntry.reset(new ScTypedStrData( aValStr, nMatVal.fVal, 
ScTypedStrData::Value));
+pEntry.reset(new ScTypedStrData(aValStr, nMatVal.fVal, 
nMatVal.fVal, ScTypedStrData::Value));
 }
 
 if (rMatch < 0 && !rCell.isEmpty() && IsEqualToTokenArray(rCell, 
rPos, aCondTokArr))
@@ -923,7 +923,7 @@ bool 
ScValidationData::FillSelectionList(std::vector& rStrColl,
 OUString aStr(pString);
 bool bIsValue = 
GetDocument()->GetFormatTable()->IsNumberFormat(aStr, nFormat, fValue);
 rStrColl.emplace_back(
-aStr, fValue, bIsValue ? ScTypedStrData::Value : 
ScTypedStrData::Standard);
+aStr, fValue, fValue, bIsValue ? ScTypedStrData::Value : 
ScTypedStrData::Standard);
 }
 bOk = aIt.Ok();
 
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index f3f672d23d42..7d16794db8b1 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -993,10 +993,10 @@ void ScInputHandler::GetFormulaData()
 maFormulaChar.insert( c );
 }
 OUString aFuncName = 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source sd/source

2021-12-02 Thread Gabor Kelemen (via logerrit)
 sc/source/ui/drawfunc/fuins1.cxx |4 +++-
 sd/source/ui/func/fuinsert.cxx   |4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 1e1b1d63028fd1328ed8cd72b5e2d6721bf08a73
Author: Gabor Kelemen 
AuthorDate: Tue Nov 30 11:15:08 2021 +0100
Commit: Xisco Fauli 
CommitDate: Thu Dec 2 10:06:56 2021 +0100

tdf#145819 Revert logic of the image-with-rotation dialog: sc & sd

Change-Id: I906e83ada98fd7a583872a2eaa76d7fd04a5401b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126110
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit 970cbb120a62e952e80348b8e94478600241273a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126144

diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 31b597e9ea19..5c7bac6ce2a6 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -113,7 +113,9 @@ static void lcl_InsertGraphic( const Graphic& rGraphic,
 if (aRotation)
 {
 std::unique_ptr 
xQueryBox(Application::CreateMessageDialog(nullptr, 
VclMessageType::Question,VclButtonsType::YesNo,ScResId(STR_QUERYROTATION)));
-if (xQueryBox->run() == RET_YES)
+// tdf#145819 Apply the rotation information if the user does NOT 
want to unrotate the image
+// If they chose Yes we ignore the rotation
+if (xQueryBox->run() == RET_NO)
 {
 GraphicNativeTransform aTransform( rGraphic1 );
 aTransform.rotate( aRotation );
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 01434b40f141..d51a580ff081 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -148,7 +148,9 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
 if (aRotation)
 {
 std::unique_ptr 
xQueryBox(Application::CreateMessageDialog(nullptr, 
VclMessageType::Question,VclButtonsType::YesNo,SdResId(STR_QUERYROTATION)));
-if (xQueryBox->run() == RET_YES)
+// tdf#145819 Apply the rotation information if the user does 
NOT want to unrotate the image
+// If they chose Yes we ignore the rotation
+if (xQueryBox->run() == RET_NO)
 {
 GraphicNativeTransform aTransform( aGraphic );
 aTransform.rotate( aRotation );


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-12-01 Thread Julien Nabet (via logerrit)
 sc/source/core/data/drwlayer.cxx |   16 
 1 file changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 788859c02f11d264ab04cec4a29a1bcaafc05c18
Author: Julien Nabet 
AuthorDate: Thu Nov 25 21:59:57 2021 +0100
Commit: Xisco Fauli 
CommitDate: Wed Dec 1 18:11:26 2021 +0100

tdf#144244: fix crash when FILESAVE a calc file after delete some columns

see bt here:
https://bugs.documentfoundation.org/attachment.cgi?id=176507

Regression from 3238606c8470f3eaeada3fc601e186ec5cfac925
tdf138138 Apply shape shift also to NoRotatedAnchor
The 'normal' anchor (as on screen) is connected to the snap rectangle,
the NoRotatedAnchor is connected to the logic rectangle. They differ,
if the shape is transformed, e.g. rotated. Error was, that values of
the 'normal' anchor were applied to NoRotatedAnchor instead of
calculating the shift of NoRotatedAnchor independently. The error
becomes only visible on save, because there the NoRotatedAnchor is
used. Effected shape types are legacy shapes, text boxes and
transformable OLEs.
I have not tested, whether this fix would work for LO 7.0 too.

Let's apply the same controls as we do with ScDrawObjData retrieved with 
GetObjDataTab

Change-Id: I73cb3dd3c47a7ec55667e498d4a62842ce63d861
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125852
Tested-by: Jenkins
Tested-by: Xisco Fauli 
Reviewed-by: Eike Rathke 
(cherry picked from commit 1d45f84bd08c8d196fcf3c9baaf2cad010884e5c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126140
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 1ead0b8fe872..ab70efe5a7ce 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -547,10 +547,18 @@ void ScDrawLayer::MoveCells( SCTAB nTab, SCCOL 
nCol1,SCROW nRow1, SCCOL nCol2,SC
 ScDrawObjData* pNoRotatedAnchor = GetNonRotatedObjData( pObj );
 if ( pNoRotatedAnchor )
 {
-pNoRotatedAnchor->maStart.IncCol(nDx);
-pNoRotatedAnchor->maStart.IncRow(nDy);
-pNoRotatedAnchor->maEnd.IncCol(nDx);
-pNoRotatedAnchor->maEnd.IncRow(nDy);
+const ScAddress aOldSttNoRotatedAnchor = 
pNoRotatedAnchor->maStart;
+const ScAddress aOldEndNoRotatedAnchor = 
pNoRotatedAnchor->maEnd;
+if ( aOldSttNoRotatedAnchor.IsValid() && IsInBlock( 
aOldSttNoRotatedAnchor, nCol1,nRow1, nCol2,nRow2 ) )
+{
+pNoRotatedAnchor->maStart.IncCol(nDx);
+pNoRotatedAnchor->maStart.IncRow(nDy);
+}
+if ( aOldEndNoRotatedAnchor.IsValid() && IsInBlock( 
aOldEndNoRotatedAnchor, nCol1,nRow1, nCol2,nRow2 ) )
+{
+pNoRotatedAnchor->maEnd.IncCol(nDx);
+pNoRotatedAnchor->maEnd.IncRow(nDy);
+}
 }
 
 AddCalcUndo( std::make_unique( pObj, aOldStt, 
aOldEnd, pData->maStart, pData->maEnd ) );


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-12-01 Thread Dennis Francis (via logerrit)
 sc/source/ui/view/output.cxx |   41 ++---
 1 file changed, 10 insertions(+), 31 deletions(-)

New commits:
commit 7174f9ac911461e68badeac0e39ca3c2fd1abcef
Author: Dennis Francis 
AuthorDate: Tue Nov 30 10:58:06 2021 +0530
Commit: Eike Rathke 
CommitDate: Wed Dec 1 16:59:09 2021 +0100

tdf#144107: fix incorrect conditioning on bGrid...

introduced in 3092322bb83998397b09d3f34b6d04b5e5c1da50

The intention was to avoid the default line drawing in the original else
branches to be conditional on bMergeCover. The previous patch used
'bGrid' as a surrogate for the original 'else' case - which is wrong.

Change-Id: I7c6b49fa9c21064312273b1051ffc7f81de3fef3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126076
Tested-by: Jenkins
Reviewed-by: Dennis Francis 
(cherry picked from commit 307c1f13821386687b8cf3c560ff2570b89ac3a9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126135
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 93b542b2c851..9a3174720dbe 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -291,7 +291,7 @@ void ScOutputData::SetSyntaxMode( bool bNewMode )
 void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, 
bool bPage, bool bMergeCover)
 {
 // bMergeCover : Draw lines in sheet bgcolor to cover lok client grid 
lines in merged cell areas.
-// (Used when scNoGridBackground is set in lok mode.)
+// When scNoGridBackground is set in lok mode, bMergeCover is set to true 
and bGrid to false.
 
 SCCOL nX;
 SCROW nY;
@@ -355,10 +355,7 @@ void ScOutputData::DrawGrid(vcl::RenderContext& 
rRenderContext, bool bGrid, bool
 tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
 tools::Long nSignedOneX = nOneX * nLayoutSign;
 
-if (bGrid)
-rRenderContext.SetLineColor(aGridColor);
-else if (bMergeCover)
-rRenderContext.SetLineColor(aSheetBGColor);
+rRenderContext.SetLineColor(bMergeCover ? aSheetBGColor : aGridColor);
 
 ScGridMerger aGrid(, nOneX, nOneY);
 
@@ -401,14 +398,9 @@ void ScOutputData::DrawGrid(vcl::RenderContext& 
rRenderContext, bool bGrid, bool
 aPageColor );
 bDashed = true;
 }
-else if (bGrid)
-{
-rRenderContext.SetLineColor( aGridColor );
-bDashed = false;
-}
-else if (bMergeCover)
+else
 {
-rRenderContext.SetLineColor(aSheetBGColor);
+rRenderContext.SetLineColor(bMergeCover ? 
aSheetBGColor : aGridColor);
 bDashed = false;
 }
 
@@ -466,18 +458,14 @@ void ScOutputData::DrawGrid(vcl::RenderContext& 
rRenderContext, bool bGrid, bool
 }
 }
 
-if (pThisRowInfo->bChanged && !bHOver && bGrid)
-{
-aGrid.AddVerLine(bWorksInPixels, 
nPosX-nSignedOneX, nPosY, nNextY-nOneY, bDashed);
-}
-else if (bHOver && bMergeCover)
+if ((pThisRowInfo->bChanged && !bHOver && 
!bMergeCover) || (bHOver && bMergeCover))
 {
 aGrid.AddVerLine(bWorksInPixels, 
nPosX-nSignedOneX, nPosY, nNextY-nOneY, bDashed);
 }
 nPosY = nNextY;
 }
 }
-else if (bGrid)
+else if (!bMergeCover)
 {
 aGrid.AddVerLine(bWorksInPixels, nPosX-nSignedOneX, nScrY, 
nScrY+nScrH-nOneY, bDashed);
 }
@@ -527,14 +515,9 @@ void ScOutputData::DrawGrid(vcl::RenderContext& 
rRenderContext, bool bGrid, bool
 aPageColor );
 bDashed = true;
 }
-else if (bGrid)
-{
-rRenderContext.SetLineColor( aGridColor );
-bDashed = false;
-}
-else if (bMergeCover)
+else
 {
-rRenderContext.SetLineColor(aSheetBGColor);
+rRenderContext.SetLineColor(bMergeCover ? 
aSheetBGColor : aGridColor);
 bDashed = false;
 }
 
@@ -581,11 +564,7 @@ void ScOutputData::DrawGrid(vcl::RenderContext& 
rRenderContext, bool bGrid, bool
 //! nVisY from Array ??
 }
 
-if (!bVOver && bGrid)
-{
-   

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source sc/uiconfig vcl/source

2021-11-28 Thread Caolán McNamara (via logerrit)
 sc/source/ui/cctrl/checklistmenu.cxx   |9 +++--
 sc/source/ui/inc/checklistmenu.hxx |2 +-
 sc/source/ui/view/gridwin.cxx  |6 +++---
 sc/uiconfig/scalc/ui/filterdropdown.ui |1 +
 vcl/source/treelist/treelistbox.cxx|5 +++--
 5 files changed, 15 insertions(+), 8 deletions(-)

New commits:
commit 2eefc29b53b01dc07eb62aeb42cd56f178370d1d
Author: Caolán McNamara 
AuthorDate: Sat Nov 27 16:49:46 2021 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Nov 28 18:43:18 2021 +0100

Resolves: tdf#144410 show submenu indicator for color filtering options

includes..

1) Related: tdf#144410 we don't want a gap in a multicol spanning separator

we would need another column to show a drop down indicator, and we don't
want the separators to have a visible gap in that case

Change-Id: Ib45b4cda41a09b631f3ea4d4427a8073a9e243d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125900
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

2) gtk[3|4] move the indicator to the edge

Change-Id: Ib92e8f1e35e6465b52a69f3a8513068668dc6953
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125951
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index 7e4f1b9fbfdc..6eca1fbbdf94 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -124,7 +124,7 @@ IMPL_LINK_NOARG(ScCheckListMenuControl, SelectHdl, 
weld::TreeView&, void)
 setSelectedMenuItem(nSelectedMenu, true);
 }
 
-void ScCheckListMenuControl::addMenuItem(const OUString& rText, Action* 
pAction)
+void ScCheckListMenuControl::addMenuItem(const OUString& rText, Action* 
pAction, bool bIndicateSubMenu)
 {
 MenuItemData aItem;
 aItem.mbEnabled = true;
@@ -134,7 +134,12 @@ void ScCheckListMenuControl::addMenuItem(const OUString& 
rText, Action* pAction)
 mxMenu->show();
 mxMenu->append_text(rText);
 if (mbCanHaveSubMenu)
-mxMenu->set_image(mxMenu->n_children() - 1, 
css::uno::Reference(), 1);
+{
+if (bIndicateSubMenu)
+mxMenu->set_image(mxMenu->n_children() - 1, *mxDropDown, 1);
+else
+mxMenu->set_image(mxMenu->n_children() - 1, 
css::uno::Reference(), 1);
+}
 }
 
 void ScCheckListMenuControl::addSeparator()
diff --git a/sc/source/ui/inc/checklistmenu.hxx 
b/sc/source/ui/inc/checklistmenu.hxx
index 427f29c3f7d3..1043fe771d6a 100644
--- a/sc/source/ui/inc/checklistmenu.hxx
+++ b/sc/source/ui/inc/checklistmenu.hxx
@@ -124,7 +124,7 @@ public:
bool bCanHaveSubMenu, bool bTreeMode, int nWidth);
 ~ScCheckListMenuControl();
 
-void addMenuItem(const OUString& rText, Action* pAction);
+void addMenuItem(const OUString& rText, Action* pAction, bool 
bIndicateSubMenu = false);
 void addSeparator();
 ScCheckListMenuWindow* addSubMenuItem(const OUString& rText, bool 
bEnabled);
 void resizeToFitMenuItems();
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 05d75755aecb..71b994c75d76 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -602,7 +602,7 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW 
nRow)
 pNotifier = SfxViewShell::Current();
 
 int nColWidth = ScViewData::ToPixel(rDoc.GetColWidth(nCol, nTab), 
mrViewData.GetPPTX());
-mpAutoFilterPopup.reset(VclPtr::Create(this, , 
false,
+mpAutoFilterPopup.reset(VclPtr::Create(this, , 
true,
   
aFilterEntries.mbHasDates, nColWidth,
   nullptr, 
pNotifier));
 ScCheckListMenuControl& rControl = mpAutoFilterPopup->get_widget();
@@ -746,9 +746,9 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW 
nRow)
 ScResId(SCSTR_FILTER_NOTEMPTY), new AutoFilterAction(this, 
AutoFilterMode::NonEmpty));
 rControl.addSeparator();
 rControl.addMenuItem(
-ScResId(SCSTR_FILTER_TEXT_COLOR), new AutoFilterAction(this, 
AutoFilterMode::TextColor));
+ScResId(SCSTR_FILTER_TEXT_COLOR), new AutoFilterAction(this, 
AutoFilterMode::TextColor), true);
 rControl.addMenuItem(
-ScResId(SCSTR_FILTER_BACKGROUND_COLOR), new AutoFilterAction(this, 
AutoFilterMode::BackgroundColor));
+ScResId(SCSTR_FILTER_BACKGROUND_COLOR), new AutoFilterAction(this, 
AutoFilterMode::BackgroundColor), true);
 rControl.addSeparator();
 rControl.addMenuItem(
 ScResId(SCSTR_STDFILTER), new AutoFilterAction(this, 
AutoFilterMode::Custom));
diff --git a/sc/uiconfig/scalc/ui/filterdropdown.ui 
b/sc/uiconfig/scalc/ui/filterdropdown.ui
index fccc56e8b5b3..6ad9f0ae6797 100644
--- a/sc/uiconfig/scalc/ui/filterdropdown.ui
+++ b/sc/uiconfig/scalc/ui/filterdropdown.ui
@@ -87,6 +87,7 @@
 
 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-11-27 Thread Eike Rathke (via logerrit)
 sc/source/ui/StatisticsDialogs/RegressionDialog.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit b129bc808fe846f729f511062e7cbedf24b9047e
Author: Eike Rathke 
AuthorDate: Fri Nov 26 18:11:31 2021 +0100
Commit: Caolán McNamara 
CommitDate: Sat Nov 27 17:28:46 2021 +0100

Regression Statistics: use cell reference, not fix row to calculate offset

The INDEX() offset was calculated with a fix row number derived
from the initial output position, like 35-ROW(). That fails if the
range later is moved or rows inserted/deleted.

Instead, use a cell reference of the cell's current column and
end row, like ROW($A$34)+1-ROW(). 34+1 to not have things shifted
if a row is inserted before 35.

Change-Id: I11276c4acb35505576daa1a20ad49a4fcdbaba49
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125914
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 324e5c3942870749fae0e62c1c11a1400b772584)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125898
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx 
b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx
index 5a4002f97d62..153640d75920 100644
--- a/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/RegressionDialog.cxx
@@ -513,7 +513,12 @@ void 
ScRegressionDialog::WriteRegressionEstimatesWithCI(AddressWalkerWriter& rOu
 bool bTakeLogX)
 {
 rOutput.newLine();
-SCROW nLastRow = rOutput.current(0, 1 + mnNumIndependentVars).Row();
+ScAddress aEnd( rOutput.current(0, 1 + mnNumIndependentVars));
+ScRefFlags eAddrFlag = mbUse3DAddresses ? ScRefFlags::ADDR_ABS_3D : 
ScRefFlags::ADDR_ABS;
+aEnd.IncCol();
+const OUString aCoeffAddr( aEnd.Format( eAddrFlag, , 
mDocument.GetAddressConvention()));
+aEnd.IncCol();
+const OUString aStErrAddr( aEnd.Format( eAddrFlag, , 
mDocument.GetAddressConvention()));
 
 // Coefficients & Std.Errors ranges (column vectors) in this table (yet to 
populate).
 rTemplate.autoReplaceRange("%COEFFICIENTS_RANGE%",
@@ -553,9 +558,9 @@ void 
ScRegressionDialog::WriteRegressionEstimatesWithCI(AddressWalkerWriter& rOu
 {
 "",
 // This puts the coefficients in the reverse order compared to 
that in LINEST output.
-"=INDEX(%COEFFICIENTS_REV_RANGE%; 1 ; " + 
OUString::number(nLastRow + 2) + " - ROW())",
+"=INDEX(%COEFFICIENTS_REV_RANGE%; 1 ; ROW(" + aCoeffAddr + ")+1 - 
ROW())",
 // This puts the standard errors in the reverse order compared to 
that in LINEST output.
-"=INDEX(%SERRORSX_REV_RANGE%; 1 ; " + OUString::number(nLastRow + 
2) + " - ROW())",
+"=INDEX(%SERRORSX_REV_RANGE%; 1 ; ROW(" + aStErrAddr + ")+1 - 
ROW())",
 // t-Statistic
 "=%COEFFICIENTS_RANGE% / %SERRORSX_RANGE%",
 // p-Value


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-11-25 Thread Eike Rathke (via logerrit)
 sc/source/core/data/column4.cxx |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 2997c5c2604cd5054710ad35e1e0a9fd18f8ae79
Author: Eike Rathke 
AuthorDate: Wed Nov 24 21:23:51 2021 +0100
Commit: Mike Kaganski 
CommitDate: Thu Nov 25 13:34:45 2021 +0100

Resolves: tdf#128914 Create copies for non-shareable token arrays

Change-Id: I59fdcf48fb0da9d944b00a140e043e4ea5fb1ae5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125789
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 89c4bc5220810dc3684a473f87d001f2c55438a1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125725
Reviewed-by: Mike Kaganski 

diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 54213f2cd582..14781f74d22e 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -566,11 +566,15 @@ void ScColumn::CloneFormulaCell(
 
 ScAddress aPos(nCol, nRow1, nTab);
 
-if (nLen == 1)
+if (nLen == 1 || !rSrc.GetCode()->IsShareable())
 {
-// Single, ungrouped formula cell.
-ScFormulaCell* pCell = new ScFormulaCell(rSrc, rDocument, aPos);
-aFormulas.push_back(pCell);
+// Single, ungrouped formula cell, or create copies for
+// non-shareable token arrays.
+for (size_t i = 0; i < nLen; ++i, aPos.IncRow())
+{
+ScFormulaCell* pCell = new ScFormulaCell(rSrc, rDocument, 
aPos);
+aFormulas.push_back(pCell);
+}
 }
 else
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-11-24 Thread Eike Rathke (via logerrit)
 sc/source/core/tool/compiler.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 8b9c9af2996704abc6d5655f4eae1c645560f0a2
Author: Eike Rathke 
AuthorDate: Tue Nov 23 18:38:27 2021 +0100
Commit: Caolán McNamara 
CommitDate: Wed Nov 24 18:33:14 2021 +0100

Resolves: ofz#41299 Rewind also on last resort #REF! IsReference()

Otherwise for #ref!e:o NextNewToken() bailed out with an
uninitialized maRawToken.

Change-Id: I8b3b399a5a3636ccda3104ba2a5971e5e9a8fc02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125736
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 51a0a85247fab56040416e40b7c7d878689acb26)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125715
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 4ff62fc5862a..628465e0d085 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4378,6 +4378,8 @@ bool ScCompiler::NextNewToken( bool bInArray )
 
 OUString aUpper;
 
+Label_Rewind:
+
 do
 {
 const OUString aOrg( cSymbol );
@@ -4511,7 +4513,11 @@ bool ScCompiler::NextNewToken( bool bInArray )
 // and 2016 until 5.1.4
 OUString aErrRef( mxSymbols->getSymbol( ocErrRef));
 if (aUpper.indexOf( aErrRef) >= 0 && IsReference( aUpper, ))
+{
+if (mbRewind)
+goto Label_Rewind;
 return true;
+}
 
 if ( meExtendedErrorDetection != EXTENDED_ERROR_DETECTION_NONE )
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-11-18 Thread Caolán McNamara (via logerrit)
 sc/source/ui/cctrl/checklistmenu.cxx |9 -
 sc/source/ui/inc/checklistmenu.hxx   |5 +
 sc/source/ui/view/gridwin.cxx|6 +++---
 3 files changed, 16 insertions(+), 4 deletions(-)

New commits:
commit f0e816412c386de976228b2232c23c31fd7f2d2c
Author: Caolán McNamara 
AuthorDate: Wed Nov 17 15:20:33 2021 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Nov 18 09:59:10 2021 +0100

tdf#142420 color menu should be a child of the autofilter, not a sibling

which is why it doesn't appear at all under wayland. This should also
get it positioned better rather than using a fixed pixel offset.

Change-Id: I9a4193c27b4172469cea3d980c86cff9ca701ca2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125360
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index 9be4712ce2e0..7e4f1b9fbfdc 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -278,6 +278,13 @@ void ScCheckListMenuControl::queueCloseSubMenu()
 maCloseTimer.maTimer.Start();
 }
 
+tools::Rectangle ScCheckListMenuControl::GetSubMenuParentRect()
+{
+if (!mxMenu->get_selected(mxScratchIter.get()))
+return tools::Rectangle();
+return mxMenu->get_row_area(*mxScratchIter);
+}
+
 void ScCheckListMenuControl::launchSubMenu(bool bSetMenuPos)
 {
 ScCheckListMenuWindow* pSubMenu = maOpenTimer.mpSubMenu;
@@ -287,7 +294,7 @@ void ScCheckListMenuControl::launchSubMenu(bool bSetMenuPos)
 if (!mxMenu->get_selected(mxScratchIter.get()))
 return;
 
-tools::Rectangle aRect = mxMenu->get_row_area(*mxScratchIter);
+tools::Rectangle aRect = GetSubMenuParentRect();
 ScCheckListMenuControl& rSubMenuControl = pSubMenu->get_widget();
 rSubMenuControl.StartPopupMode(aRect, FloatWinPopupFlags::Right);
 if (bSetMenuPos)
diff --git a/sc/source/ui/inc/checklistmenu.hxx 
b/sc/source/ui/inc/checklistmenu.hxx
index 5bddd4490ae8..427f29c3f7d3 100644
--- a/sc/source/ui/inc/checklistmenu.hxx
+++ b/sc/source/ui/inc/checklistmenu.hxx
@@ -178,6 +178,11 @@ public:
  */
 void terminateAllPopupMenus();
 
+/**
+ * Get the area of the active row. Suitable as the parent rectangle
+ * argument for Executing a popup
+*/
+tools::Rectangle GetSubMenuParentRect();
 private:
 
 std::vector maMenuItems;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index e9f963dcaa06..05d75755aecb 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -961,9 +961,9 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode 
eMode)
 }
 i++;
 }
-Point pos(mpAutoFilterPopup->GetPosPixel());
-pos.Move(150, 0);
-sal_uInt16 nSelected = pColorMenu->Execute(this, pos);
+
+tools::Rectangle aRect = rControl.GetSubMenuParentRect();
+sal_uInt16 nSelected = pColorMenu->Execute(mpAutoFilterPopup, 
aRect, PopupMenuFlags::ExecuteRight);
 pColorMenu.disposeAndClear();
 rControl.terminateAllPopupMenus();
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-11-17 Thread Heiko Tietze (via logerrit)
 sc/source/ui/view/cellsh3.cxx |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit c6fb8ffc6a35d94002a2c5b5b36c228c161cde85
Author: Heiko Tietze 
AuthorDate: Tue Oct 19 10:40:41 2021 +0200
Commit: Xisco Fauli 
CommitDate: Wed Nov 17 11:34:23 2021 +0100

Resolves tdf#144247 - Change display precision of row height / column width

Use 2 digits by default but 4 in case of user-defined values
for row height and column width.

This partially reverts ad8edac43e73555bc2055514300c5b81a1bb04ea
as the optimal width is back to 2 digits

Change-Id: I4cb53071783c76d9fbea0cc2feaa0b860c73c647
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123802
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 
(cherry picked from commit e396017b598e6ef161e71f18638b4d94cd92e6ee)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125349
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index b98440d9e552..0bf79d6d108b 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -699,7 +699,9 @@ void ScCellShell::Execute( SfxRequest& rReq )
 ScopedVclPtr 
pDlg(pFact->CreateScMetricInputDlg(
 pTabViewShell->GetFrameWeld(), "RowHeightDialog",
 nCurHeight, ScGlobal::nStdRowHeight,
-eMetric, 4, MAX_ROW_HEIGHT));
+eMetric,
+nCurHeight == ScGlobal::nStdRowHeight ? 2 : 4, //use 4 
digits for user-defined values
+MAX_ROW_HEIGHT));
 
 if ( pDlg->Execute() == RET_OK )
 {
@@ -736,7 +738,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
 ScAbstractDialogFactory* pFact = 
ScAbstractDialogFactory::Create();
 ScopedVclPtr 
pDlg(pFact->CreateScMetricInputDlg(
 pTabViewShell->GetFrameWeld(), 
"OptimalRowHeightDialog",
-ScGlobal::nLastRowHeightExtra, 0, eMetric, 4, 
MAX_EXTRA_HEIGHT));
+ScGlobal::nLastRowHeightExtra, 0, eMetric, 2, 
MAX_EXTRA_HEIGHT));
 if ( pDlg->Execute() == RET_OK )
 {
 tools::Long nVal = pDlg->GetInputValue();
@@ -797,7 +799,9 @@ void ScCellShell::Execute( SfxRequest& rReq )
 ScAbstractDialogFactory* pFact = 
ScAbstractDialogFactory::Create();
 ScopedVclPtr 
pDlg(pFact->CreateScMetricInputDlg(
 pTabViewShell->GetFrameWeld(), "ColWidthDialog", 
nCurHeight,
-STD_COL_WIDTH, eMetric, 4, MAX_COL_WIDTH));
+STD_COL_WIDTH, eMetric,
+nCurHeight == STD_COL_WIDTH ? 2 : 4, //use 4 digits 
for user-defined values
+MAX_COL_WIDTH));
 if ( pDlg->Execute() == RET_OK )
 {
 tools::Long nVal = pDlg->GetInputValue();
@@ -833,7 +837,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
 ScAbstractDialogFactory* pFact = 
ScAbstractDialogFactory::Create();
 ScopedVclPtr 
pDlg(pFact->CreateScMetricInputDlg(
 pTabViewShell->GetFrameWeld(), "OptimalColWidthDialog",
-ScGlobal::nLastColWidthExtra, STD_EXTRA_WIDTH, 
eMetric, 4, MAX_EXTRA_WIDTH));
+ScGlobal::nLastColWidthExtra, STD_EXTRA_WIDTH, 
eMetric, 2, MAX_EXTRA_WIDTH));
 if ( pDlg->Execute() == RET_OK )
 {
 tools::Long nVal = pDlg->GetInputValue();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-11-14 Thread Caolán McNamara (via logerrit)
 sc/source/ui/cctrl/checklistmenu.cxx |4 +++-
 sc/source/ui/inc/checklistmenu.hxx   |3 ++-
 sc/source/ui/view/gridwin.cxx|8 ++--
 sc/source/ui/view/gridwin2.cxx   |6 --
 4 files changed, 15 insertions(+), 6 deletions(-)

New commits:
commit ecb15ba80cd85e40da5d2d48a394d4cbc9a43bba
Author: Caolán McNamara 
AuthorDate: Fri Nov 12 15:39:49 2021 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Nov 14 20:40:48 2021 +0100

Resolves: tdf#145645 pivot table popups don't dismiss when item activated

Change-Id: I5a68a08600b7792d924ec77694a60651df5d9c83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124983
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index 95ab21cb74ae..9be4712ce2e0 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -197,7 +197,9 @@ void ScCheckListMenuControl::executeMenuItem(size_t nPos)
 // no action is defined.
 return;
 
-maMenuItems[nPos].mxAction->execute();
+const bool bClosePopup = maMenuItems[nPos].mxAction->execute();
+if (bClosePopup)
+terminateAllPopupMenus();
 }
 
 void ScCheckListMenuControl::setSelectedMenuItem(size_t nPos, bool 
bSubMenuTimer)
diff --git a/sc/source/ui/inc/checklistmenu.hxx 
b/sc/source/ui/inc/checklistmenu.hxx
index 7ebb95fb0caf..5bddd4490ae8 100644
--- a/sc/source/ui/inc/checklistmenu.hxx
+++ b/sc/source/ui/inc/checklistmenu.hxx
@@ -63,7 +63,8 @@ public:
 {
 public:
 virtual ~Action() {}
-virtual void execute() = 0;
+// return true to dismiss the popup
+virtual bool execute() = 0;
 };
 
 struct ResultEntry
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index c5382ef2747b..e9f963dcaa06 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -509,9 +509,12 @@ class AutoFilterAction : public 
ScCheckListMenuControl::Action
 public:
 AutoFilterAction(ScGridWindow* p, ScGridWindow::AutoFilterMode eMode) :
 mpWindow(p), meMode(eMode) {}
-virtual void execute() override
+virtual bool execute() override
 {
 mpWindow->UpdateAutoFilterFromMenu(meMode);
+// RefreshAutoFilterButton manually closes the popup so return
+// false to not attempt a second close
+return false;
 }
 };
 
@@ -522,9 +525,10 @@ class AutoFilterPopupEndAction : public 
ScCheckListMenuControl::Action
 public:
 AutoFilterPopupEndAction(ScGridWindow* p, const ScAddress& rPos) :
 mpWindow(p), maPos(rPos) {}
-virtual void execute() override
+virtual bool execute() override
 {
 mpWindow->RefreshAutoFilterButton(maPos);
+return false; // this is called after the popup has been closed
 }
 };
 
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index bf1b7597b185..ffe76e677349 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -383,9 +383,10 @@ public:
 explicit DPFieldPopupOKAction(ScGridWindow* p) :
 mpGridWindow(p) {}
 
-virtual void execute() override
+virtual bool execute() override
 {
 mpGridWindow->UpdateDPFromFieldPopupMenu();
+return true;
 }
 private:
 VclPtr mpGridWindow;
@@ -405,7 +406,7 @@ public:
 , mpViewShell(pViewShell)
 {}
 
-virtual void execute() override
+virtual bool execute() override
 {
 switch (meType)
 {
@@ -421,6 +422,7 @@ public:
 default:
 ;
 }
+return true;
 }
 
 private:


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-11-14 Thread Eike Rathke (via logerrit)
 sc/source/core/tool/token.cxx |  200 ++
 1 file changed, 106 insertions(+), 94 deletions(-)

New commits:
commit d1635040cc4f017855f0c7805487b5b1065a7cdd
Author: Eike Rathke 
AuthorDate: Fri Nov 12 21:59:14 2021 +0100
Commit: Caolán McNamara 
CommitDate: Sun Nov 14 17:49:24 2021 +0100

Resolves: tdf#145640 MoveReference...Reorder() there are RPN tokens as well

Change-Id: I03fdf8f9d94e7a499e995b900bba564cd054bd2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125123
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 79589afe173ba8f17bfbbc6b38f0dfbc5fd9e0c9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124985
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index d8579a8a834e..75d0795182d0 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -3424,126 +3424,138 @@ sc::RefUpdateResult 
ScTokenArray::AdjustReferenceOnMove(
 void ScTokenArray::MoveReferenceColReorder(
 const ScAddress& rPos, SCTAB nTab, SCROW nRow1, SCROW nRow2, const 
sc::ColRowReorderMapType& rColMap )
 {
-FormulaToken** p = pCode.get();
-FormulaToken** pEnd = p + static_cast(nLen);
-for (; p != pEnd; ++p)
+TokenPointers aPtrs( pCode.get(), nLen, pRPN, nRPN);
+for (size_t j=0; j<2; ++j)
 {
-switch ((*p)->GetType())
+FormulaToken** pp = aPtrs.maPointerRange[j].mpStart;
+FormulaToken** pEnd = aPtrs.maPointerRange[j].mpStop;
+for (; pp != pEnd; ++pp)
 {
-case svSingleRef:
-{
-formula::FormulaToken* pToken = *p;
-ScSingleRefData& rRef = *pToken->GetSingleRef();
-ScAddress aAbs = rRef.toAbs(*mxSheetLimits, rPos);
+FormulaToken* p = aPtrs.getHandledToken(j,pp);
+if (!p)
+continue;
 
-if (aAbs.Tab() == nTab && nRow1 <= aAbs.Row() && aAbs.Row() <= 
nRow2)
-{
-// Inside reordered row range.
-sc::ColRowReorderMapType::const_iterator it = 
rColMap.find(aAbs.Col());
-if (it != rColMap.end())
+switch (p->GetType())
+{
+case svSingleRef:
 {
-// This column is reordered.
-SCCOL nNewCol = it->second;
-aAbs.SetCol(nNewCol);
-rRef.SetAddress(*mxSheetLimits, aAbs, rPos);
+ScSingleRefData& rRef = *p->GetSingleRef();
+ScAddress aAbs = rRef.toAbs(*mxSheetLimits, rPos);
+
+if (aAbs.Tab() == nTab && nRow1 <= aAbs.Row() && 
aAbs.Row() <= nRow2)
+{
+// Inside reordered row range.
+sc::ColRowReorderMapType::const_iterator it = 
rColMap.find(aAbs.Col());
+if (it != rColMap.end())
+{
+// This column is reordered.
+SCCOL nNewCol = it->second;
+aAbs.SetCol(nNewCol);
+rRef.SetAddress(*mxSheetLimits, aAbs, rPos);
+}
+}
 }
-}
-}
-break;
-case svDoubleRef:
-{
-formula::FormulaToken* pToken = *p;
-ScComplexRefData& rRef = *pToken->GetDoubleRef();
-ScRange aAbs = rRef.toAbs(*mxSheetLimits, rPos);
+break;
+case svDoubleRef:
+{
+ScComplexRefData& rRef = *p->GetDoubleRef();
+ScRange aAbs = rRef.toAbs(*mxSheetLimits, rPos);
 
-if (aAbs.aStart.Tab() != aAbs.aEnd.Tab())
-// Must be a single-sheet reference.
-break;
+if (aAbs.aStart.Tab() != aAbs.aEnd.Tab())
+// Must be a single-sheet reference.
+break;
 
-if (aAbs.aStart.Col() != aAbs.aEnd.Col())
-// Whole range must fit in a single column.
-break;
+if (aAbs.aStart.Col() != aAbs.aEnd.Col())
+// Whole range must fit in a single column.
+break;
 
-if (aAbs.aStart.Tab() == nTab && nRow1 <= aAbs.aStart.Row() && 
aAbs.aEnd.Row() <= nRow2)
-{
-// Inside reordered row range.
-sc::ColRowReorderMapType::const_iterator it = 
rColMap.find(aAbs.aStart.Col());
-if (it != rColMap.end())
-{
-// This column is 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-11-11 Thread Justin Luth (via logerrit)
 sc/source/ui/StatisticsDialogs/SamplingDialog.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 62d82a9a4108f715cf1a2bf15205adc28e9fd31a
Author: Justin Luth 
AuthorDate: Wed Nov 10 09:15:58 2021 +0200
Commit: Xisco Fauli 
CommitDate: Thu Nov 11 16:27:15 2021 +0100

tdf#142986 sc sampling: allow more than default (100) samples

The default maximum for a spinbutton must be 100.
For some reason, the previous setMax to maxint was removed
in LO 6.3 in commit 2c5c20b19c349a4b7f6d78d69d8d57f9af5c351c.

Change-Id: I846c1ce037db6ef3b8d48975e24b748cad0394d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124948
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Eike Rathke 
(cherry picked from commit eb50d356ffbe5bd2e3de9ac574ddf28ce4e034ad)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124972

diff --git a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx 
b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
index 608ba1a30fa1..fad4ac6d05a5 100644
--- a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
@@ -87,7 +87,9 @@ void ScSamplingDialog::Init()
 mxOutputRangeEdit->SetModifyHdl( aLink2);
 
 mxSampleSize->connect_value_changed( LINK( this, ScSamplingDialog, 
SamplingSizeValueModified ));
+mxSampleSize->set_range(1, SAL_MAX_INT32);
 mxPeriod->connect_value_changed( LINK( this, ScSamplingDialog, 
PeriodValueModified ));
+mxPeriod->set_range(1, SAL_MAX_INT32);
 
 mxPeriodicMethodRadio->connect_toggled( LINK( this, ScSamplingDialog, 
ToggleSamplingMethod ) );
 mxRandomMethodRadio->connect_toggled( LINK( this, ScSamplingDialog, 
ToggleSamplingMethod ) );


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-11-09 Thread Andreas Heinisch (via logerrit)
 sc/source/ui/unoobj/cellsuno.cxx |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit bc412136e4325b9b615afdd864c61488fd1ffdcc
Author: Andreas Heinisch 
AuthorDate: Thu Nov 4 11:50:51 2021 +0100
Commit: Xisco Fauli 
CommitDate: Tue Nov 9 13:49:27 2021 +0100

tdf#142033 - Handle embedded newline set via SetDataArray

Change-Id: I798f9a2a2ce599ba8ca3ef1f5ae91801d8f1b138
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124681
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit b9e2c5d2a36fbd189c20448cadf4212edf02914d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124858
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 1922781652d5..29d3b29086da 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1098,6 +1098,7 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, 
const ScRange& rRange,
 const uno::Sequence< uno::Sequence >& aData )
 {
 ScDocument& rDoc = rDocShell.GetDocument();
+ScDocFunc& rDocFunc = rDocShell.GetDocFunc();
 SCTAB nTab = rRange.aStart.Tab();
 SCCOL nStartCol = rRange.aStart.Col();
 SCROW nStartRow = rRange.aStart.Row();
@@ -1174,9 +1175,7 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, 
const ScRange& rRange,
 rElement >>= aUStr;
 if ( !aUStr.isEmpty() )
 {
-ScSetStringParam aParam;
-aParam.setTextInput();
-rDoc.SetString(aPos, aUStr, );
+rDocFunc.SetStringOrEditCell(aPos, aUStr, false);
 }
 }
 break;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-11-02 Thread Caolán McNamara (via logerrit)
 sc/source/ui/app/inputwin.cxx |9 +
 sc/source/ui/inc/inputwin.hxx |1 +
 2 files changed, 10 insertions(+)

New commits:
commit b3be435a61d9367dcaef8347f77b92c9ea0a94d9
Author: Caolán McNamara 
AuthorDate: Mon Nov 1 12:59:01 2021 +
Commit: Xisco Fauli 
CommitDate: Tue Nov 2 11:39:53 2021 +0100

multiline calc inputbar not redrawing and adjusting scrollbar on delete of 
text

backspace is ok, but with delete when a line is deleted the scrolled up
lines are visually duplicated at the bottom

Change-Id: I22e91aa3c3213876d36c593cae7989e8913bffc3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124471
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 862d729edffd..5a9a59659b12 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1556,6 +1556,7 @@ void ScTextWnd::InitEditEngine()
 lcl_ModifyRTLVisArea( m_xEditView.get() );
 
 m_xEditEngine->SetModifyHdl(LINK(this, ScTextWnd, ModifyHdl));
+m_xEditEngine->SetStatusEventHdl(LINK(this, ScTextWnd, EditStatusHdl));
 
 if (!maAccTextDatas.empty())
 maAccTextDatas.back()->StartEdit();
@@ -1831,6 +1832,13 @@ IMPL_LINK_NOARG(ScTextWnd, ModifyHdl, LinkParamNone*, 
void)
 }
 }
 
+IMPL_LINK_NOARG(ScTextWnd, EditStatusHdl, EditStatus&, void)
+{
+SetScrollBarRange();
+DoScroll();
+Invalidate();
+}
+
 void ScTextWnd::StopEditEngine( bool bAll )
 {
 if (!m_xEditEngine)
@@ -1848,6 +1856,7 @@ void ScTextWnd::StopEditEngine( bool bAll )
 aString = m_xEditEngine->GetText();
 bIsInsertMode = m_xEditView->IsInsertMode();
 bool bSelection = m_xEditView->HasSelection();
+m_xEditEngine->SetStatusEventHdl(Link());
 m_xEditEngine->SetModifyHdl(Link());
 m_xEditView.reset();
 m_xEditEngine.reset();
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index 86cc6594910c..6a746cf9fe83 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -111,6 +111,7 @@ public:
 void DoScroll();
 
 DECL_LINK(ModifyHdl, LinkParamNone*, void);
+DECL_LINK(EditStatusHdl, EditStatus&, void);
 
 protected:
 virtual voidPaint( vcl::RenderContext& rRenderContext, const 
tools::Rectangle& rRect ) override;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-11-01 Thread Kevin Suo (via logerrit)
 sc/source/filter/orcus/interface.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 836e37bac767ce6eea4b0e0c9342976e8238cc46
Author: Kevin Suo 
AuthorDate: Mon Nov 1 14:15:19 2021 +0800
Commit: Caolán McNamara 
CommitDate: Mon Nov 1 17:20:38 2021 +0100

tdf#138475: also set font size/weight/posture for CJK/CTL languages...

when parsing the default Calc styles.

As an initial matter, orcus currently does not support XML_font_size_asian,
XML_font_size_complex, XML_font_weight_asian, XML_font_weight_complex etc 
in:

https://gitlab.com/orcus/orcus/-/blob/master/src/liborcus/odf_styles_context.cpp#L128

While this need to be improved by Orcus, actually in Calc we provide
the default font attributes in sc/res/xml/styles.xml and it makes no
sense to set different font size/weight/posture for each language type.
As a result we apply the same font attributes of latin to all these
languages.

Change-Id: I1b105fecce45aa22c6b72e15305e25dc6669d2cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124536
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 3b977328dfbe613d925dc52c22e36b7e15a34ada)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124472
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/filter/orcus/interface.cxx 
b/sc/source/filter/orcus/interface.cxx
index 35fb72548a4c..78b9563bc842 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -1360,9 +1360,13 @@ void ScOrcusStyles::font::applyToItemSet(SfxItemSet& 
rSet) const
 {
 FontItalic eItalic = mbItalic ? ITALIC_NORMAL : ITALIC_NONE;
 rSet.Put(SvxPostureItem(eItalic, ATTR_FONT_POSTURE));
+rSet.Put(SvxPostureItem(eItalic, ATTR_CJK_FONT_POSTURE));
+rSet.Put(SvxPostureItem(eItalic, ATTR_CTL_FONT_POSTURE));
 
 FontWeight eWeight = mbBold ? WEIGHT_BOLD : WEIGHT_NORMAL;
 rSet.Put(SvxWeightItem(eWeight, ATTR_FONT_WEIGHT));
+rSet.Put(SvxWeightItem(eWeight, ATTR_CJK_FONT_WEIGHT));
+rSet.Put(SvxWeightItem(eWeight, ATTR_CTL_FONT_WEIGHT));
 
 rSet.Put( SvxColorItem(maColor, ATTR_FONT_COLOR));
 
@@ -1370,6 +1374,8 @@ void ScOrcusStyles::font::applyToItemSet(SfxItemSet& 
rSet) const
 rSet.Put( SvxFontItem( FAMILY_DONTKNOW, maName, maName, 
PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, ATTR_FONT ));
 
 rSet.Put( SvxFontHeightItem (translateToInternal(mnSize, 
orcus::length_unit_t::point), 100, ATTR_FONT_HEIGHT));
+rSet.Put( SvxFontHeightItem (translateToInternal(mnSize, 
orcus::length_unit_t::point), 100, ATTR_CJK_FONT_HEIGHT));
+rSet.Put( SvxFontHeightItem (translateToInternal(mnSize, 
orcus::length_unit_t::point), 100, ATTR_CTL_FONT_HEIGHT));
 }
 
 if (mbHasUnderlineAttr)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-10-20 Thread Eike Rathke (via logerrit)
 sc/source/core/tool/interpr8.cxx |   15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

New commits:
commit fb2b0e1836431f9c16d7125dfd3f596436899134
Author: Eike Rathke 
AuthorDate: Wed Oct 20 13:41:03 2021 +0200
Commit: Xisco Fauli 
CommitDate: Wed Oct 20 18:27:16 2021 +0200

Resolves: tdf#145235 TEXTJOIN() clear last string also for referenced empty

Change-Id: If6d20a1629e001708c700c5c25bef8a75fa34e25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123889
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit f4f2c94513e7d06691a73d9f12707c33d131d537)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123864
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx
index 64bb3d1d8a8e..05b9101eda31 100644
--- a/sc/source/core/tool/interpr8.cxx
+++ b/sc/source/core/tool/interpr8.cxx
@@ -1742,17 +1742,14 @@ void ScInterpreter::ScTextJoin_MS()
 aAdr.SetRow( nRow );
 aAdr.SetCol( nCol );
 ScRefCellValue aCell( mrDoc, aAdr );
-if ( !aCell.isEmpty() )
+if (aCell.hasEmptyValue())
+aStr.clear();
+else
 {
-if ( !aCell.hasEmptyValue() )
-{
-svl::SharedString aSS;
-GetCellString( aSS, aCell);
-aStr = aSS.getString();
-}
+svl::SharedString aSS;
+GetCellString( aSS, aCell);
+aStr = aSS.getString();
 }
-else
-aStr.clear();
 if ( !aStr.isEmpty() || !bSkipEmpty )
 {
 if ( !bFirst )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-10-20 Thread Kevin Suo (via logerrit)
 sc/source/filter/html/htmlpars.cxx |   96 -
 sc/source/filter/inc/htmlpars.hxx  |2 
 2 files changed, 55 insertions(+), 43 deletions(-)

New commits:
commit a25f615a103f6ed3c2d4c35d2eacdd828b75854e
Author: Kevin Suo 
AuthorDate: Sat Oct 16 11:07:13 2021 +0800
Commit: Noel Grandin 
CommitDate: Wed Oct 20 08:35:45 2021 +0200

tdf#96499 sc htmlimport: fix broken CSSHandler so that...

...ScHTMLStyles can handle those MSO-Number-Formats again.

The CSSHandler was added by the following commit, after which the
sc htmlimport can parse the CSS stylesheets and set number formats
of table cells accordingly:

commit 24d8e4eaf4543c5b39b9e816d8514525b098827d
Author: Kohei Yoshida
Date:   Thu Jul 28 00:46:55 2011 -0400
Parse CSS in the 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-10-16 Thread Eike Rathke (via logerrit)
 sc/source/core/data/formulacell.cxx |7 +++
 sc/source/core/tool/interpr5.cxx|   19 +++
 2 files changed, 26 insertions(+)

New commits:
commit 54a9b7c1db72459f95ed334de34a0e2289329bd2
Author: Eike Rathke 
AuthorDate: Fri Oct 15 21:56:34 2021 +0200
Commit: Caolán McNamara 
CommitDate: Sat Oct 16 20:12:15 2021 +0200

Resolves: tdf#145085 HYPERLINK() do not force a 2nd row URL cell in array 
mode

... but fake a 1-row result dimension instead.

However, keep the behaviour that if a 2-rows array was entered the
2nd row displays the URL and not the repeated cell text.

Change-Id: I4800715a4028c647b763c6d729759ff4c099748f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123680
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 459f9de8a87373c826eadab142850cc3fa578fca)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123635
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index 0b8dfd9c6f9d..5250e5e9c59a 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1101,6 +1101,13 @@ void ScFormulaCell::GetResultDimensions( SCSIZE& rCols, 
SCSIZE& rRows )
 if (pMat)
 {
 pMat->GetDimensions( rCols, rRows );
+if (pCode->IsHyperLink())
+{
+// Row 2 element is the URL that is not to be displayed and the
+// result dimension not to be extended.
+assert(rRows == 2);
+rRows = 1;
+}
 return;
 }
 }
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 1e16518ae8da..2c79e14a6a95 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -3239,6 +3239,25 @@ void ScInterpreter::ScMatRef()
 pMat->GetDimensions( nCols, nRows );
 SCSIZE nC = static_cast(aPos.Col() - aAdr.Col());
 SCSIZE nR = static_cast(aPos.Row() - aAdr.Row());
+#if 0
+// XXX: this could be an additional change for tdf#145085 to not
+// display the URL in a voluntary entered 2-rows array context.
+// However, that might as well be used on purpose to implement a check
+// on the URL, which existing documents may have done, the more that
+// before the accompanying change of
+// ScFormulaCell::GetResultDimensions() the cell array was forced to
+// two rows. Do not change without compelling reason. Note that this
+// repeating top cell is what Excel implements, but it has no
+// additional value so probably isn't used there. Exporting to and
+// using in Excel though will lose this capability.
+if (aCell.mpFormula->GetCode()->IsHyperLink())
+{
+// Row 2 element is the URL that is not to be displayed, fake a
+// 1-row cell-text-only matrix that is repeated.
+assert(nRows == 2);
+nR = 0;
+}
+#endif
 if ((nCols <= nC && nCols != 1) || (nRows <= nR && nRows != 1))
 PushNA();
 else


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-10-08 Thread Julien Nabet (via logerrit)
 sc/source/ui/docshell/externalrefmgr.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 908e0bfe2c74a4f2fcdef0784794c236fd6bc4e9
Author: Julien Nabet 
AuthorDate: Thu Oct 7 21:22:08 2021 +0200
Commit: Eike Rathke 
CommitDate: Fri Oct 8 23:25:08 2021 +0200

Fix iteration in sc/source/ui/docshell/externalrefmgr.cxx

Like this since 2012 with:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=63ade823e2d854b60df76790e3628a5ab78f653a
commit  63ade823e2d854b60df76790e3628a5ab78f653a (patch)
tree69283e660118fb534f50ea1be7ba17b24c7b1c20
parent  51caf9b45403b92deadf934347f2d6f9ffecdf08 (diff)
remove entry from unsaved ref container if doc is saved

Change-Id: I4845c2c6b9ffd7b9f6b14276e1ca97817d584913
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123233
Reviewed-by: Julien Nabet 
(cherry picked from commit 09d544d0c025ebbc9b0cbd77043ce4e8b4ab6be3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123167
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/docshell/externalrefmgr.cxx 
b/sc/source/ui/docshell/externalrefmgr.cxx
index f7e3822b77d7..e44c8a3c73ce 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -3189,8 +3189,10 @@ void 
ScExternalRefManager::transformUnsavedRefToSavedRef( SfxObjectShell* pShell
 OUString aFileURL = 
pShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
 switchSrcFile(itr->first, aFileURL, OUString());
 EndListening(*pShell);
-maUnsavedDocShells.erase(itr++);
+itr = maUnsavedDocShells.erase(itr);
 }
+else
+++itr;
 }
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-10-08 Thread Eike Rathke (via logerrit)
 sc/source/core/data/documen5.cxx |4 ++--
 sc/source/ui/docshell/docsh4.cxx |4 ++--
 sc/source/ui/unoobj/chartuno.cxx |6 --
 sc/source/ui/view/gridwin.cxx|3 ++-
 4 files changed, 10 insertions(+), 7 deletions(-)

New commits:
commit cf4dbb7c1287d5b3fe7870fc0aaa172a5d444515
Author: Eike Rathke 
AuthorDate: Wed Oct 6 18:57:36 2021 +0200
Commit: Xisco Fauli 
CommitDate: Fri Oct 8 16:15:11 2021 +0200

Resolves: tdf#144970 Chart CellRangeRepresentation expects UI representation

 This is a combination of 3 commits.

Resolves: tdf#144970 Chart CellRangeRepresentation expects UI representation

sc/source/ui/unoobj/chart2uno.cxx
ScChart2DataProvider::createDataSource() calls
ScRefTokenHelper::compileRangeRepresentation() with the
CellRangeRepresentation property's string value and the document's
grammar (and also other places calling
ScRefTokenHelper::compileRangeRepresentation() in Chart context do, like
ScChart2DataProvider::detectArguments()), so let
ScChartsObj::addNewByName() generate that from the
Sequence.

Also let ScChartObj::GetData_Impl() parse a CellRangeRepresentation
value with the current address convention.

This is congruent with
offapi/com/sun/star/chart2/data/TabularDataProviderArguments.idl that
for CellRangeRepresentation says "The representation string is of a form
that may be used in the user interface.  Example for OOo Calc:
"$Sheet1.$A$1:$D$7"", which is Calc A1 but agnostic about Excel A1 and
R1C1 address syntax. TabularDataProviderArguments is mentioned in
offapi/com/sun/star/chart2/data/XDataProvider.idl at createDataSource().

-Id: Ie89d9aa3d5bc3eda9a65932a445ee8a1b4b266f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123188
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 34b01c95d4cab81cb614b67c47b004ac86d266f1)

Related: tdf#144970 == ScRefFlags::ZERO is not a replacement for != 0 ...

It still worked by chance because if (!bValid) the string is
parsed with ScRangeList, which does deliver a result.
That will have to be adapted to the then expected UI
representation though in which case it wouldn't work.

Fallout from

commit 51d0b4037b36a4a74c9181b95edb18017542ab79
CommitDate: Sat Mar 12 00:21:29 2016 +

tdf#84938 Change defines to typed_flags

-Id: I9612b34829c12e59d4b390c6aa035aca84e87c73
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123194
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 14f81ca6ad289bf86781f642aa129b33151247cf)

Related: tdf#144970 Make Drag of Chart range work with UI 
representation

Drag of cell range onto an existing Chart worked with Calc A1
but not Excel A1 or R1C1 address syntax conventions.

-Id: I1cd1a134f284ef5b28237589c544f93cb4aca841
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123197
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 852292feee08b4d256f8255926e1f84b4c6fd4b6)

Change-Id: Ie89d9aa3d5bc3eda9a65932a445ee8a1b4b266f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123211
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index 1933601aa7db..d19fed5a8075 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -229,7 +229,7 @@ void ScDocument::GetOldChartParameters( std::u16string_view 
rName,
 OUString aRangesStr;
 lcl_GetChartParameters( xChartDoc, aRangesStr, 
eDataRowSource, bHasCategories, bFirstCellAsLabel );
 
-rRanges.Parse( aRangesStr, *this );
+rRanges.Parse( aRangesStr, *this, GetAddressConvention());
 if ( eDataRowSource == chart::ChartDataRowSource_COLUMNS )
 {
 rRowHeaders = bHasCategories;
@@ -285,7 +285,7 @@ void ScDocument::UpdateChartArea( const OUString& 
rChartName,
 // append to old ranges, keep other settings
 
 aNewRanges = new ScRangeList;
-aNewRanges->Parse( aRangesStr, *this );
+aNewRanges->Parse( aRangesStr, *this, 
GetAddressConvention());
 
 for ( size_t nAdd = 0, nAddCount = rNewList->size(); 
nAdd < nAddCount; ++nAdd )
 aNewRanges->push_back( (*rNewList)[nAdd] );
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 85ee0a42ff2d..432776b6a7ee 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -380,11 +380,11 @@ void ScDocShell::Execute( SfxRequest& rReq )
 }
 
 ScAddress::Details 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-10-01 Thread Vasily Melenchuk (via logerrit)
 sc/source/ui/view/gridwin.cxx |   21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

New commits:
commit e8998c6d12773e7b3196ea151c4f617ec5dab1a4
Author: Vasily Melenchuk 
AuthorDate: Thu Sep 30 14:10:12 2021 +0200
Commit: Xisco Fauli 
CommitDate: Fri Oct 1 16:35:49 2021 +0200

sc: colorfilter dangling pointer fixed

Upper call to aParam.RemoveAllEntriesByField can invalidate
pEntry, making further calls to pEntry->SetQueryBy* illegal.

Anyway at this branch we are disabling color filter, so this
is not required.

Change-Id: Ia595649975b659d28056ba3f3658c306e63088f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122822
Tested-by: Jenkins
Reviewed-by: Vasily Melenchuk 
(cherry picked from commit bf4cb13c7b3b57980d8e052c1b06afc3f21b96f2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122865
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 9edc1d29af64..a0f854a6394f 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -970,6 +970,7 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode 
eMode)
 if (nSelected == nActive)
 {
 aParam.RemoveAllEntriesByField(rPos.Col());
+pEntry = nullptr;   // invalidated by 
RemoveAllEntriesByField call
 
 // tdf#46184 reset filter options to default values
 aParam.eSearchType = utl::SearchParam::SearchType::Normal;
@@ -977,16 +978,18 @@ void 
ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode)
 aParam.bDuplicate = true;
 aParam.bInplace = true;
 }
-
-// Get selected color from set
-std::set::iterator it = aColors.begin();
-std::advance(it, nSelected - 1);
-Color selectedColor = *it;
-
-if (eMode == AutoFilterMode::TextColor)
-pEntry->SetQueryByTextColor(selectedColor);
 else
-pEntry->SetQueryByBackgroundColor(selectedColor);
+{
+// Get selected color from set
+std::set::iterator it = aColors.begin();
+std::advance(it, nSelected - 1);
+Color selectedColor = *it;
+
+if (eMode == AutoFilterMode::TextColor)
+pEntry->SetQueryByTextColor(selectedColor);
+else
+pEntry->SetQueryByBackgroundColor(selectedColor);
+}
 }
 
 break;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-09-24 Thread Samuel Mehrbrodt (via logerrit)
 sc/source/ui/view/gridwin.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit fde8d9247d80480e2c5a3c877742c851c07ed47e
Author: Samuel Mehrbrodt 
AuthorDate: Tue Sep 21 16:28:30 2021 +0200
Commit: Xisco Fauli 
CommitDate: Fri Sep 24 18:31:13 2021 +0200

Fix color filter popup position

popup was wrongly placed when dropdown was not in the first column

Change-Id: Id7170df233148564cba2fe2d498194b9e2b0161f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122396
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit e752ce56b51c832dbea1e7f20e3b6671d99df990)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122582
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 40efbbb5e6e3..9edc1d29af64 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -957,7 +957,8 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode 
eMode)
 }
 i++;
 }
-Point pos(mpAutoFilterPopup->GetSizePixel().getWidth(), 150);
+Point pos(mpAutoFilterPopup->GetPosPixel());
+pos.Move(150, 0);
 sal_uInt16 nSelected = pColorMenu->Execute(this, pos);
 pColorMenu.disposeAndClear();
 rControl.terminateAllPopupMenus();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-09-24 Thread Samuel Mehrbrodt (via logerrit)
 sc/source/core/data/column3.cxx |   14 ++
 sc/source/core/data/table3.cxx  |   16 +++-
 2 files changed, 25 insertions(+), 5 deletions(-)

New commits:
commit 2391d8073624004e0cd657ab07ff947f6a9ef0c7
Author: Samuel Mehrbrodt 
AuthorDate: Tue Aug 31 10:49:51 2021 +0200
Commit: Xisco Fauli 
CommitDate: Fri Sep 24 14:21:14 2021 +0200

tdf#142579 Consider cond. format background colors in color filter

In addition to color scale, consider background colors set by a
conditional style.

Change-Id: I203c4a5ae87aa7b47c2caafcac703b0a0c1a677c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121474
Tested-by: Samuel Mehrbrodt 
Reviewed-by: Samuel Mehrbrodt 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122467
Tested-by: Jenkins

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 6532996d7b71..9f9c697e709e 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2435,9 +2435,12 @@ class FilterEntriesHandler
 // Colors
 ScAddress aPos(rColumn.GetCol(), nRow, rColumn.GetTab());
 
-// Text color
+Color backgroundColor;
+bool bHasConditionalBackgroundColor = false;
+
 Color textColor;
 bool bHasConditionalTextColor = false;
+// Check text & background color from cond. formatting
 const ScPatternAttr* pPattern
 = mrColumn.GetDoc().GetPattern(aPos.Col(), aPos.Row(), aPos.Tab());
 if (pPattern)
@@ -2449,8 +2452,13 @@ class FilterEntriesHandler
 const SvxColorItem* pColor = 
>GetItem(ATTR_FONT_COLOR, pCondSet);
 textColor = pColor->GetValue();
 bHasConditionalTextColor = true;
+
+const SvxBrushItem* pBackgroundColor = 
>GetItem(ATTR_BACKGROUND, pCondSet);
+backgroundColor = pBackgroundColor->GetColor();
+bHasConditionalBackgroundColor = true;
 }
 }
+
 if (!bHasConditionalTextColor)
 {
 const SvxColorItem* pColor = rColumn.GetDoc().GetAttr(aPos, 
ATTR_FONT_COLOR);
@@ -2459,9 +2467,7 @@ class FilterEntriesHandler
 if (textColor != COL_AUTO)
 mrFilterEntries.addTextColor(textColor);
 
-// Background color
-Color backgroundColor;
-bool bHasConditionalBackgroundColor = false;
+// Color scale needs a different handling
 ScConditionalFormat* pCondFormat
 = rColumn.GetDoc().GetCondFormat(aPos.Col(), aPos.Row(), 
aPos.Tab());
 if (pCondFormat)
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 553223c685e9..554b69b90203 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2850,9 +2850,23 @@ public:
 {
 ScAddress aPos(nCol, nRow, nTab);
 Color color;
+
 // Background color can be set via conditional formatting - check that 
first
-ScConditionalFormat* pCondFormat = mrDoc.GetCondFormat(nCol, nRow, 
nTab);
 bool bHasConditionalColor = false;
+const ScPatternAttr* pPattern = mrDoc.GetPattern(nCol, nRow, nTab);
+if (pPattern)
+{
+if 
(!pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData().empty())
+{
+const SfxItemSet* pCondSet
+= mrDoc.GetCondResult(nCol, nRow, nTab);
+const SvxBrushItem* pBackgroundColor = 
>GetItem(ATTR_BACKGROUND, pCondSet);
+color = pBackgroundColor->GetColor();
+bHasConditionalColor = true;
+}
+}
+
+ScConditionalFormat* pCondFormat = mrDoc.GetCondFormat(nCol, nRow, 
nTab);
 if (pCondFormat)
 {
 for (size_t i = 0; i < pCondFormat->size(); i++)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-09-24 Thread Samuel Mehrbrodt (via logerrit)
 sc/source/core/data/column3.cxx |   34 +++---
 sc/source/core/data/table3.cxx  |   24 ++--
 2 files changed, 49 insertions(+), 9 deletions(-)

New commits:
commit 52596dedfe629a008e198d023ffcae45a8a791ee
Author: Samuel Mehrbrodt 
AuthorDate: Mon Aug 30 16:01:02 2021 +0200
Commit: Xisco Fauli 
CommitDate: Fri Sep 24 14:20:48 2021 +0200

tdf#142580 Consider cond. format text colors in color filter

When using a conditional style to override the text color in conditional 
formatting,
the color from the style overrides directly applied text color.
Consider this in the color filter.

Change-Id: Ieaa1c475d87866de1e2d497127be9d06d1f3d3f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121311
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122466

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 905fa65a0f08..6532996d7b71 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -2433,14 +2434,34 @@ class FilterEntriesHandler
 
 // Colors
 ScAddress aPos(rColumn.GetCol(), nRow, rColumn.GetTab());
-const SvxColorItem* pColor = rColumn.GetDoc().GetAttr(aPos, 
ATTR_FONT_COLOR);
-Color textColor = pColor->GetValue();
+
+// Text color
+Color textColor;
+bool bHasConditionalTextColor = false;
+const ScPatternAttr* pPattern
+= mrColumn.GetDoc().GetPattern(aPos.Col(), aPos.Row(), aPos.Tab());
+if (pPattern)
+{
+if 
(!pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData().empty())
+{
+const SfxItemSet* pCondSet
+= mrColumn.GetDoc().GetCondResult(aPos.Col(), aPos.Row(), 
aPos.Tab());
+const SvxColorItem* pColor = 
>GetItem(ATTR_FONT_COLOR, pCondSet);
+textColor = pColor->GetValue();
+bHasConditionalTextColor = true;
+}
+}
+if (!bHasConditionalTextColor)
+{
+const SvxColorItem* pColor = rColumn.GetDoc().GetAttr(aPos, 
ATTR_FONT_COLOR);
+textColor = pColor->GetValue();
+}
 if (textColor != COL_AUTO)
 mrFilterEntries.addTextColor(textColor);
 
-// Background color can be set via conditional formatting - check that 
first
+// Background color
 Color backgroundColor;
-bool bHasConditionalColor = false;
+bool bHasConditionalBackgroundColor = false;
 ScConditionalFormat* pCondFormat
 = rColumn.GetDoc().GetCondFormat(aPos.Col(), aPos.Row(), 
aPos.Tab());
 if (pCondFormat)
@@ -2453,12 +2474,11 @@ class FilterEntriesHandler
 const ScColorScaleFormat* pColFormat
 = static_cast(aEntry);
 backgroundColor = *(pColFormat->GetColor(aPos));
-bHasConditionalColor = true;
+bHasConditionalBackgroundColor = true;
 }
 }
 }
-
-if (!bHasConditionalColor)
+if (!bHasConditionalBackgroundColor)
 {
 const SvxBrushItem* pBrush = rColumn.GetDoc().GetAttr(aPos, 
ATTR_BACKGROUND);
 backgroundColor = pBrush->GetColor();
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index d41c53a08532..553223c685e9 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2819,8 +2819,28 @@ public:
  const ScQueryEntry::Item& rItem)
 {
 ScAddress aPos(nCol, nRow, nTab);
-const SvxColorItem* pColor = mrDoc.GetAttr(aPos, ATTR_FONT_COLOR);
-Color color = pColor->GetValue();
+Color color;
+bool bHasConditionalColor = false;
+// Text color can be set via conditional formatting - check that first
+const ScPatternAttr* pPattern = mrDoc.GetPattern(nCol, nRow, nTab);
+if (pPattern)
+{
+if 
(!pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData().empty())
+{
+const SfxItemSet* pCondSet
+= mrDoc.GetCondResult(nCol, nRow, nTab);
+const SvxColorItem* pColor = 
>GetItem(ATTR_FONT_COLOR, pCondSet);
+color = pColor->GetValue();
+bHasConditionalColor = true;
+}
+}
+
+if (!bHasConditionalColor)
+{
+const SvxColorItem* pColor = mrDoc.GetAttr(aPos, ATTR_FONT_COLOR);
+color = pColor->GetValue();
+}
+
 bool bMatch = rItem.maColor == color;
 return std::pair(bMatch, false);
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-09-24 Thread Samuel Mehrbrodt (via logerrit)
 sc/source/core/data/column3.cxx |   29 +++--
 sc/source/core/data/table3.cxx  |   29 +++--
 2 files changed, 54 insertions(+), 4 deletions(-)

New commits:
commit 63b004d4cab295c708686989869c9033ec91e449
Author: Samuel Mehrbrodt 
AuthorDate: Thu Aug 26 10:54:23 2021 +0200
Commit: Xisco Fauli 
CommitDate: Fri Sep 24 14:20:28 2021 +0200

tdf#142579 Consider color scale background colors in color filter

When using a color scale in conditional formatting, the color from the color
scale overrides the cell background color.
Consider this in the color filter.

Change-Id: Ifbefedbf1152165b65f8fbc3eeff29ffccf29898
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121074
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122465

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 49c646073e27..905fa65a0f08 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -44,6 +44,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 
@@ -2436,8 +2438,31 @@ class FilterEntriesHandler
 if (textColor != COL_AUTO)
 mrFilterEntries.addTextColor(textColor);
 
-const SvxBrushItem* pBrush = rColumn.GetDoc().GetAttr(aPos, 
ATTR_BACKGROUND);
-Color backgroundColor = pBrush->GetColor();
+// Background color can be set via conditional formatting - check that 
first
+Color backgroundColor;
+bool bHasConditionalColor = false;
+ScConditionalFormat* pCondFormat
+= rColumn.GetDoc().GetCondFormat(aPos.Col(), aPos.Row(), 
aPos.Tab());
+if (pCondFormat)
+{
+for (size_t i = 0; i < pCondFormat->size(); i++)
+{
+auto aEntry = pCondFormat->GetEntry(i);
+if (aEntry->GetType() == ScFormatEntry::Type::Colorscale)
+{
+const ScColorScaleFormat* pColFormat
+= static_cast(aEntry);
+backgroundColor = *(pColFormat->GetColor(aPos));
+bHasConditionalColor = true;
+}
+}
+}
+
+if (!bHasConditionalColor)
+{
+const SvxBrushItem* pBrush = rColumn.GetDoc().GetAttr(aPos, 
ATTR_BACKGROUND);
+backgroundColor = pBrush->GetColor();
+}
 if (backgroundColor != COL_AUTO)
 mrFilterEntries.addBackgroundColor(backgroundColor);
 
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 5caea5500fda..d41c53a08532 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -67,6 +67,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -2827,8 +2829,31 @@ public:
const ScQueryEntry::Item& 
rItem)
 {
 ScAddress aPos(nCol, nRow, nTab);
-const SvxBrushItem* pBrush = mrDoc.GetAttr(aPos, ATTR_BACKGROUND);
-Color color = pBrush->GetColor();
+Color color;
+// Background color can be set via conditional formatting - check that 
first
+ScConditionalFormat* pCondFormat = mrDoc.GetCondFormat(nCol, nRow, 
nTab);
+bool bHasConditionalColor = false;
+if (pCondFormat)
+{
+for (size_t i = 0; i < pCondFormat->size(); i++)
+{
+auto aEntry = pCondFormat->GetEntry(i);
+if (aEntry->GetType() == ScFormatEntry::Type::Colorscale)
+{
+const ScColorScaleFormat* pColFormat
+= static_cast(aEntry);
+color = *(pColFormat->GetColor(aPos));
+bHasConditionalColor = true;
+}
+}
+}
+
+if (!bHasConditionalColor)
+{
+const SvxBrushItem* pBrush = mrDoc.GetAttr(aPos, ATTR_BACKGROUND);
+color = pBrush->GetColor();
+}
+
 bool bMatch = rItem.maColor == color;
 return std::pair(bMatch, false);
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-09-13 Thread Stephan Bergmann (via logerrit)
 sc/source/ui/docshell/impex.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 141c6f932ed6eb52b3da99143520f058bb3b4a99
Author: Stephan Bergmann 
AuthorDate: Mon Sep 13 16:22:14 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Sep 14 07:57:02 2021 +0200

tdf#144106 Don't proceed ptrim_i past ptrim_f

...which would cause p2 - p1 to be negative in lcl_appendLineData and thus
construction of a std::u16string_view with a huge positive length of type
size_t.  In 64-bit builds where size_t is 64-bit, that would then cause
termination due to an uncaught std::bad_alloc.  But in (implicitly)
--disable-assert-always-abort 32-bit builds where size_t is 32-bit, this 
would
silently have worked before 1efec9ec21dba32335e311d367b636538e219621 
"Tighten
rtl_{string,uString}_newFromStr_WithLength implementation", when the huge
positive size_t value was cast back to a negative sal_Int32 that was 
gracefully
handled by rtl_uString_newFromStr_WithLength.

Change-Id: I3b95a9fce62b99ffc150f76a1c6ccddcdacdae0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122038
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 
(cherry picked from commit 4a4be7a1edead11b48e1a8598e52a3246e6744bb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122064
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index f271a70feee9..875f051174d9 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1688,7 +1688,7 @@ const sal_Unicode* 
ScImportExport::ScanNextFieldFromString( const sal_Unicode* p
 const sal_Unicode* ptrim_f = p;  // [ptrim_i,ptrim_f) is cell data 
after trimming
 if ( bRemoveSpace )
 {
-while ( *ptrim_i == cBlank )
+while ( ptrim_i < ptrim_f && *ptrim_i == cBlank )
 ++ptrim_i;
 while ( ptrim_f > ptrim_i && ( *(ptrim_f - 1) == cBlank ) )
 --ptrim_f;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-09-13 Thread Luboš Luňák (via logerrit)
 sc/source/core/data/table3.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 877aa28e981349480844a995334367dd9c3ab72b
Author: Luboš Luňák 
AuthorDate: Thu Sep 9 16:18:02 2021 +0200
Commit: Caolán McNamara 
CommitDate: Mon Sep 13 21:31:26 2021 +0200

do not intern a temporary cell error string

Interning is way more work than a simple text comparison done once.

Change-Id: If18c478fc62d1fb09ce2141fdb77b46a6bc46c08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121855
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 
(cherry picked from commit d0316985db22efd6708dffa173eaabb430f6b9a8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121985
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 48c05bcaa40d..20e16b455c29 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2433,8 +2433,8 @@ public:
 if (rCell.meType == CELLTYPE_FORMULA && 
rCell.mpFormula->GetErrCode() != FormulaError::NONE)
 {
 // Error cell is evaluated as string (for now).
-const svl::SharedString aCellStr = 
mrStrPool.intern(ScGlobal::GetErrorString(rCell.mpFormula->GetErrCode()));
-return compareByStringComparator(rEntry, rItem, , 
nullptr);
+const OUString aCellStr = 
ScGlobal::GetErrorString(rCell.mpFormula->GetErrCode());
+return compareByStringComparator(rEntry, rItem, nullptr, 
);
 }
 else if (rCell.meType == CELLTYPE_STRING)
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-09-12 Thread Noel Grandin (via logerrit)
 sc/source/core/data/attarray.cxx |   12 
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit e7a9929f873d6708c9a0c7081b492d8f8d969b8e
Author: Noel Grandin 
AuthorDate: Sat Sep 11 20:39:26 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Sep 12 17:29:33 2021 +0200

tdf#144085 XUsedAreaCursor broken: the methods don't accept formatted cells 
as used

This reverts
commit 61386aa03cd166473a58dbb4be0dd5e0ce82195c.
tdf#79049 speed up OOXML workbook load (3)

which caused this problem

Change-Id: I19a9cf75e8b2d3b5f87e1bd324c42a1dbae8ee63
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121973
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit d8b765e6c45792bff5717cd0e0d9d42311c33461)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121977

diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 41fb51471c43..6ef3b426dda8 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1957,21 +1957,17 @@ bool ScAttrArray::GetLastVisibleAttr( SCROW& rLastRow, 
SCROW nLastData ) const
 Search( nLastData, nPos );
 while ( nPos < mvData.size() )
 {
-SCROW nAttrStartRow = ( nPos > 0 ) ? ( mvData[nPos-1].nEndRow + 1 ) : 
0;
-if ( nAttrStartRow <= nLastData )
-nAttrStartRow = nLastData + 1;
 // find range of visually equal formats
 SCSIZE nEndPos = nPos;
 while ( nEndPos < mvData.size()-1 &&
 mvData[nEndPos].pPattern->IsVisibleEqual( 
*mvData[nEndPos+1].pPattern))
-{
-if ( (mvData[nEndPos].nEndRow + 1 - nAttrStartRow) >= 
SC_VISATTR_STOP )
-return false; // ignore this range and below
 ++nEndPos;
-}
+SCROW nAttrStartRow = ( nPos > 0 ) ? ( mvData[nPos-1].nEndRow + 1 ) : 
0;
+if ( nAttrStartRow <= nLastData )
+nAttrStartRow = nLastData + 1;
 SCROW nAttrSize = mvData[nEndPos].nEndRow + 1 - nAttrStartRow;
 if ( nAttrSize >= SC_VISATTR_STOP )
-return false; // ignore this range and below
+break;  // while, ignore this range and below
 else if ( mvData[nEndPos].pPattern->IsVisible() )
 {
 rLastRow = mvData[nEndPos].nEndRow;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-08-31 Thread Xisco Fauli (via logerrit)
 sc/source/filter/xml/xmlexprt.cxx |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit aecdbb01ea6d89d1e3e25707b0dcd2bedaeb64a6
Author: Xisco Fauli 
AuthorDate: Thu Aug 26 19:10:58 2021 +0200
Commit: Xisco Fauli 
CommitDate: Tue Aug 31 13:45:33 2021 +0200

tdf#143940: the style index might be -1

Similar to 52aebe6986bcec07071adb3f94d6c09fea147044
< tdf#138466 Crash when creating different scenarios >

ExportColumns calls GetStyleNameIndex which might return -1
so check the index is different than -1 as it's already done
when calling ScFormatRangeStyles::GetStyleNameByIndex

Also move fix for tdf#138466 down the stack to be consistent

Debug builds will still assert, see coverity#1438402

Since 5e777f23fd0118f6649f0d9e30eb77a72f1099e4
< loplugin:useuniqueptr in ScColumnRowStylesBase >
where the nIndex < 0 check in
ScColumnRowStylesBase::GetStyleNameByIndex was removed

Change-Id: I084bfa04c39f37cb325c3b3df76801b3abdea994
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121128
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 7246759822aff30e4e4e1bca7949eae3b0d960ef)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121068
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index 497daf4a49e3..affd763e80ad 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -737,7 +737,9 @@ void ScXMLExport::WriteSingleColumn(const sal_Int32 
nRepeatColumns, const sal_In
 const sal_Int32 nIndex, const bool bIsAutoStyle, const bool bIsVisible)
 {
 CheckAttrList();
-AddAttribute(sAttrStyleName, 
pColumnStyles->GetStyleNameByIndex(nStyleIndex));
+// tdf#138466
+if (nStyleIndex != -1)
+AddAttribute(sAttrStyleName, 
pColumnStyles->GetStyleNameByIndex(nStyleIndex));
 if (!bIsVisible)
 AddAttribute(XML_NAMESPACE_TABLE, XML_VISIBILITY, XML_COLLAPSE);
 if (nRepeatColumns > 1)
@@ -870,9 +872,7 @@ void ScXMLExport::ExportColumns(const sal_Int32 nTable, 
const ScRange& aColumnHe
 nColsRepeated = 1;
 }
 }
-// tdf#138466
-if (nPrevIndex != -1)
-WriteColumn(nPrevColumn, nColsRepeated, nPrevIndex, bPrevIsVisible);
+WriteColumn(nPrevColumn, nColsRepeated, nPrevIndex, bPrevIsVisible);
 if (!bIsClosed)
 CloseHeaderColumn();
 if (pGroupColumns->IsGroupEnd(nColumn - 1))
@@ -1351,7 +1351,9 @@ void ScXMLExport::WriteRowStartTag(
 const sal_Int32 nIndex, const sal_Int32 nEqualRows,
 bool bHidden, bool bFiltered)
 {
-AddAttribute(sAttrStyleName, pRowStyles->GetStyleNameByIndex(nIndex));
+// tdf#143940
+if (nIndex != -1)
+AddAttribute(sAttrStyleName, pRowStyles->GetStyleNameByIndex(nIndex));
 if (bHidden)
 {
 if (bFiltered)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-08-31 Thread Caolán McNamara (via logerrit)
 sc/source/filter/lotus/lotimpop.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 406c40a21537e5f3a4050e4ad1fcac2465d3c4c2
Author: Caolán McNamara 
AuthorDate: Sat Aug 28 09:56:52 2021 +0100
Commit: Caolán McNamara 
CommitDate: Tue Aug 31 13:12:44 2021 +0200

ofz: MemorySanitizer: use-of-uninitialized-value

Change-Id: I649e8b8fa0d1752f0f4b0b6b688cea8ae945bb87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121153
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/filter/lotus/lotimpop.cxx 
b/sc/source/filter/lotus/lotimpop.cxx
index cb74275221ca..38a0337a9d25 100644
--- a/sc/source/filter/lotus/lotimpop.cxx
+++ b/sc/source/filter/lotus/lotimpop.cxx
@@ -69,6 +69,9 @@ void ImportLotus::Bof()
 Skip( 1 );
 Read( nFlags );
 
+if (!pIn->good())
+return;
+
 if( nFileSub == 0x0004 )
 {
 if( nFileCode == 0x1000 )
@@ -84,7 +87,7 @@ void ImportLotus::Bof()
 
 bool ImportLotus::BofFm3()
 {
-sal_uInt16  nFileCode, nFileSub;
+sal_uInt16 nFileCode(0), nFileSub(0);
 
 Read( nFileCode );
 Read( nFileSub );


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-08-30 Thread Caolán McNamara (via logerrit)
 sc/source/filter/xml/XMLConverter.hxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit 243d2f3e93b172488ea8309517773a9dfa73d646
Author: Caolán McNamara 
AuthorDate: Sat Aug 28 10:07:49 2021 +0100
Commit: Michael Stahl 
CommitDate: Mon Aug 30 11:48:33 2021 +0200

ofz: MemorySanitizer: use-of-uninitialized-value

Change-Id: I136816837eddcb1bf81c23b6f4fcfa65e9335629
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121155
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sc/source/filter/xml/XMLConverter.hxx 
b/sc/source/filter/xml/XMLConverter.hxx
index 52d0f2ba77cc..76e0fcad8c11 100644
--- a/sc/source/filter/xml/XMLConverter.hxx
+++ b/sc/source/filter/xml/XMLConverter.hxx
@@ -127,6 +127,14 @@ struct ScXMLConditionParseResult
 OUStringmaOperand1; /// First operand of the token or 
comparison value.
 OUStringmaOperand2; /// Second operand of 'between' 
conditions.
 sal_Int32   mnEndIndex; /// Index of first character 
following the condition.
+
+ScXMLConditionParseResult()
+: meToken(XML_COND_INVALID)
+, meValidation(css::sheet::ValidationType_ANY)
+, meOperator(css::sheet::ConditionOperator_NONE)
+, mnEndIndex(-1)
+{
+}
 };
 
 namespace ScXMLConditionHelper


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-08-25 Thread Caolán McNamara (via logerrit)
 sc/source/filter/excel/xistream.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit ce215eb1e7418ce056f0bfc0ae40d614ac5dbf5e
Author: Caolán McNamara 
AuthorDate: Mon Aug 23 19:55:59 2021 +0100
Commit: Michael Stahl 
CommitDate: Wed Aug 25 14:57:24 2021 +0200

ofz: MemorySanitizer: use-of-uninitialized-value

Change-Id: Ia7ceb0278117df6e140c04232bcfd366fbba3dd0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120919
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 763996f29aef31f95c438738d081d9b361db36e3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120979
Reviewed-by: Michael Stahl 

diff --git a/sc/source/filter/excel/xistream.cxx 
b/sc/source/filter/excel/xistream.cxx
index df5500cc376d..702ae253e143 100644
--- a/sc/source/filter/excel/xistream.cxx
+++ b/sc/source/filter/excel/xistream.cxx
@@ -389,10 +389,10 @@ XclBiff XclImpStream::DetectBiffVersion( SvStream& rStrm )
 XclBiff eBiff = EXC_BIFF_UNKNOWN;
 
 rStrm.Seek( STREAM_SEEK_TO_BEGIN );
-sal_uInt16 nBofId, nBofSize;
+sal_uInt16 nBofId(0), nBofSize(0);
 rStrm.ReadUInt16( nBofId ).ReadUInt16( nBofSize );
 
-if( (4 <= nBofSize) && (nBofSize <= 16) ) switch( nBofId )
+if (rStrm.good() && 4 <= nBofSize && nBofSize <= 16) switch( nBofId )
 {
 case EXC_ID2_BOF:
 eBiff = EXC_BIFF2;
@@ -405,7 +405,7 @@ XclBiff XclImpStream::DetectBiffVersion( SvStream& rStrm )
 break;
 case EXC_ID5_BOF:
 {
-sal_uInt16 nVersion;
+sal_uInt16 nVersion(0);
 rStrm.ReadUInt16( nVersion );
 // #i23425# #i44031# #i62752# there are some *really* broken 
documents out there...
 switch( nVersion & 0xFF00 )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-08-23 Thread Mike Kaganski (via logerrit)
 sc/source/core/data/table2.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 33cc23a3ff69ca7316802545fcbc34d791387e89
Author: Mike Kaganski 
AuthorDate: Mon Aug 23 12:28:18 2021 +0200
Commit: Xisco Fauli 
CommitDate: Mon Aug 23 16:37:59 2021 +0200

tdf#144022: make sure to create missing columns if needed

Change-Id: I1a0771fbe8023859ab29d8114303b62f6a3d539c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120731
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 23c1ec0d498124fbe275145d236db455f83cd850)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120872
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 69bfec7ed100..95bef419c9a8 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -3046,20 +3046,20 @@ bool ScTable::RemoveFlags( SCCOL nStartCol, SCROW 
nStartRow, SCCOL nEndCol, SCRO
 void ScTable::SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr )
 {
 if (ValidColRow(rPos.Col(),rPos.Row()))
-aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr );
+CreateColumnIfNotExists(rPos.Col()).SetPattern(rPos.Row(), rAttr);
 }
 
 const ScPatternAttr* ScTable::SetPattern( SCCOL nCol, SCROW nRow, 
std::unique_ptr pAttr )
 {
 if (ValidColRow(nCol,nRow))
-return aCol[nCol].SetPattern( nRow, std::move(pAttr) );
+return CreateColumnIfNotExists(nCol).SetPattern(nRow, 
std::move(pAttr));
 return nullptr;
 }
 
 void ScTable::SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr )
 {
 if (ValidColRow(nCol,nRow))
-aCol[nCol].SetPattern( nRow, rAttr );
+CreateColumnIfNotExists(nCol).SetPattern(nRow, rAttr);
 }
 
 void ScTable::ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-08-20 Thread Eike Rathke (via logerrit)
 sc/source/ui/dbgui/scuiasciiopt.cxx |   40 
 sc/source/ui/docshell/impex.cxx |   50 
 sc/source/ui/inc/impex.hxx  |   18 ++--
 sc/source/ui/inc/scuiasciiopt.hxx   |2 -
 4 files changed, 85 insertions(+), 25 deletions(-)

New commits:
commit 8bcfa0829bc5741141d1c491a527bc53b51b4f33
Author: Eike Rathke 
AuthorDate: Wed Aug 18 19:05:08 2021 +0200
Commit: Caolán McNamara 
CommitDate: Fri Aug 20 09:49:08 2021 +0200

Resolves: tdf#102846 CSV: Detect separator, limit preview line 
concatenations

In CSV import preview, if a line starts with a quote character and
none of the remembered last field separators used occur in data in
conjunction with a closing quote, then reading data tried to
concatenate line by line to form a data field to be presented in
the preview, worst case the entire file..

For the preview, detect one possible not yet selected separator if
used with a quoted field (similar to commit
c807e7ea7a0725a4d8375eda07d6f70870e0d50a for tdf#56910 space
separator) and limit the number of source lines that are tried to
be concatenated if no separator was encountered after a possibly
closing field quote.

Change-Id: Iefd37a8301161e72cb607cea88d4faadad47b4ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120690
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit ff62e0165a0add7c7e3cb606df5b24b20c822d8a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120717
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx 
b/sc/source/ui/dbgui/scuiasciiopt.cxx
index b66403492961..a95d8bdfff7a 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -44,6 +44,14 @@
 //! TODO make dynamic
 const SCSIZE ASCIIDLG_MAXROWS= MAXROWCOUNT;
 
+// Maximum number of source lines to concatenate while generating the preview
+// for one logical line. This may result in a wrong preview if the actual
+// number of embedded line feeds is greater, but a number too high would take
+// too much time (loop excessively if unlimited and large data) if none of the
+// selected separators are actually used in data but a field at start of line
+// is quoted.
+constexpr sal_uInt32 kMaxEmbeddedLinefeeds = 500;
+
 using namespace com::sun::star::uno;
 
 namespace {
@@ -293,7 +301,7 @@ ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, 
const OUString& aDatNa
 , mnRowPosCount(0)
 , mcTextSep(ScAsciiOptions::cDefaultTextSep)
 , meCall(eCall)
-, mbDetectSpaceSep(eCall != SC_TEXTTOCOLUMNS)
+, mbDetectSep(eCall != SC_TEXTTOCOLUMNS)
 , mxFtCharSet(m_xBuilder->weld_label("textcharset"))
 , mxLbCharSet(new 
SvxTextEncodingBox(m_xBuilder->weld_combo_box("charset")))
 , mxFtCustomLang(m_xBuilder->weld_label("textlanguage"))
@@ -579,7 +587,7 @@ bool ScImportAsciiDlg::GetLine( sal_uLong nLine, OUString 
, sal_Unicode& r
 break;
 }
 rText = ReadCsvLine(*mpDatStream, !bFixed, maFieldSeparators,
-mcTextSep, rcDetectSep);
+mcTextSep, rcDetectSep, kMaxEmbeddedLinefeeds);
 mnStreamPos = mpDatStream->Tell();
 mpRowPosArray[++mnRowPosCount] = mnStreamPos;
 } while (nLine >= mnRowPosCount && mpDatStream->good());
@@ -594,7 +602,7 @@ bool ScImportAsciiDlg::GetLine( sal_uLong nLine, OUString 
, sal_Unicode& r
 else
 {
 Seek( mpRowPosArray[nLine]);
-rText = ReadCsvLine(*mpDatStream, !bFixed, maFieldSeparators, 
mcTextSep, rcDetectSep);
+rText = ReadCsvLine(*mpDatStream, !bFixed, maFieldSeparators, 
mcTextSep, rcDetectSep, kMaxEmbeddedLinefeeds);
 mnStreamPos = mpDatStream->Tell();
 }
 
@@ -793,7 +801,11 @@ IMPL_LINK_NOARG(ScImportAsciiDlg, UpdateTextHdl, 
ScCsvTableBox&, void)
 // when the dialog wasn't already presented to the user.
 // As a side effect this has the benefit that the check is only done on the
 // first set of visible lines.
-sal_Unicode cDetectSep = (mbDetectSpaceSep && !mxRbFixed->get_active() && 
!mxCkbSpace->get_active() ? 0 : 0x);
+sal_Unicode cDetectSep = ((mbDetectSep && !mxRbFixed->get_active()
+&& (!mxCkbTab->get_active() || !mxCkbSemicolon->get_active()
+|| !mxCkbComma->get_active() || 
!mxCkbSpace->get_active())) ? 0 : 0x);
+if (cDetectSep == 0x)
+mbDetectSep = false;
 
 sal_Int32 nBaseLine = mxTableBox->GetGrid().GetFirstVisLine();
 sal_Int32 nRead = mxTableBox->GetGrid().GetVisLineCount();
@@ -813,16 +825,22 @@ IMPL_LINK_NOARG(ScImportAsciiDlg, UpdateTextHdl, 
ScCsvTableBox&, void)
 for (; i < CSV_PREVIEW_LINES; i++)
 maPreviewLine[i].clear();
 
-if (mbDetectSpaceSep)
+if (mbDetectSep)
 {
-mbDetectSpaceSep = false;
-if (cDetectSep == ' 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-08-17 Thread Eike Rathke (via logerrit)
 sc/source/ui/docshell/impex.cxx |   11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit d6808f6ba03f74f99759e8d59ac0a04fcc9c6dd8
Author: Eike Rathke 
AuthorDate: Mon Aug 16 21:46:44 2021 +0200
Commit: Caolán McNamara 
CommitDate: Tue Aug 17 10:51:59 2021 +0200

Resolves: tdf#96561 Include embedded null-characters while assembling CSV 
line

... instead of prematurely ending analysis and skipping the
remainder that is still part of data read.

Change-Id: I8f34bc9672e37f9c1c1ae81ddeba464360add7c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120555
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 7bd03074ae7362d8fffe5182529626a0b43a0ed1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120451
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 380bd875fadc..6297fba3a1a7 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -2515,8 +2515,17 @@ Label_RetryWithNewSep:
 while (!rStream.eof() && aStr.getLength() < nArbitraryLineLengthLimit)
 {
 const sal_Unicode * p = aStr.getStr() + nLastOffset;
-while (*p)
+const sal_Unicode * const pStop = aStr.getStr() + aStr.getLength();
+while (p < pStop)
 {
+if (!*p)
+{
+// Skip embedded null-characters. They don't change
+// anything and are handled at a higher level.
+++p;
+continue;
+}
+
 if (nQuotes)
 {
 if (*p == cFieldQuote)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-08-16 Thread Julien Nabet (via logerrit)
 sc/source/core/data/table2.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit ab6c339faa15bf324f1161678717f02dbf8c19f6
Author: Julien Nabet 
AuthorDate: Mon Aug 16 18:05:12 2021 +0200
Commit: Christian Lohmaier 
CommitDate: Mon Aug 16 21:57:02 2021 +0200

tdf#143896: FILESAVE XLS(X) 1001+ rows are lost after saving new file

Regression from:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=2bf3e0d00e3bccb5b250642ee0d3fdbe6cae8ecc
tdf#104502 sc: skip hidden columns at printing pages
Page calculation counted the hidden columns, resulted
printing blank pages by accident.

Extend GetPrintArea() and GetTableArea() to count pages
without the hidden columns, too.

Change-Id: I77e7d6d893967a3ddac4c7c4e225769b38b44649
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120449
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index af36f60f0d9e..69bfec7ed100 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1525,6 +1525,7 @@ void ScTable::CopyUpdated( const ScTable* pPosTab, 
ScTable* pDestTab ) const
 void ScTable::InvalidateTableArea()
 {
 bTableAreaValid = false;
+bTableAreaVisibleValid = false;
 }
 
 void ScTable::InvalidatePageBreaks()


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-08-13 Thread Noel Grandin (via logerrit)
 sc/source/ui/miscdlgs/optsolver.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit da1c79205777357d2b22626b4985dfcd7e014236
Author: Noel Grandin 
AuthorDate: Sun Aug 8 18:34:35 2021 +0200
Commit: Caolán McNamara 
CommitDate: Fri Aug 13 15:54:45 2021 +0200

tdf#143534 Crash in Calc NLP Solver

prevent dialog from being deleted out from underneath
the code handling the dialog.

Change-Id: Ib1ef05f897901089708188820a3330dbeabc24c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120175
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit ec867a13baaa43791d8bacf4e8c1b96aadb6aa8a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120233
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/miscdlgs/optsolver.cxx 
b/sc/source/ui/miscdlgs/optsolver.cxx
index 3476efaa456b..445c43ab7aba 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -507,6 +507,7 @@ bool ScOptSolverDlg::IsRefInputMode() const
 
 IMPL_LINK(ScOptSolverDlg, BtnHdl, weld::Button&, rBtn, void)
 {
+auto xKeepAlive = shared_from_this();
 if ( == m_xBtnSolve.get() ||  == m_xBtnClose.get())
 {
 bool bSolve = (  == m_xBtnSolve.get() );


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-08-10 Thread Mike Kaganski (via logerrit)
 sc/source/core/data/drwlayer.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 99420dc0b80df22d12519efca05803898fbfcfbd
Author: Mike Kaganski 
AuthorDate: Fri Jul 23 17:48:00 2021 +0200
Commit: Michael Stahl 
CommitDate: Tue Aug 10 19:33:11 2021 +0200

tdf#143515: avoid memory leak in ScDrawLayer::DeleteObjectsInArea

... and in ScDrawLayer::DeleteObjectsInSelection.
We are calling SdrObjList::RemoveObject, which orphans the object.
Let the undo object own the SdrObject, and dispose it when needed.

Was that way ever since d0484bcdcbffd42d242647a2fdc1a203d176b775
"initial import".

Change-Id: I5f2cb9d8ed0e02d45d2699af4a228c7fd097008c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119435
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120223
Reviewed-by: Michael Stahl 

diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 5b70046e4448..1ead0b8fe872 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1598,7 +1598,7 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL 
nCol1,SCROW nRow1,
 
 if (bRecording)
 for (auto p : ppObj)
-AddCalcUndo(std::make_unique(*p));
+AddCalcUndo(std::make_unique(*p));
 
 for (auto p : ppObj)
 pPage->RemoveObject(p->GetOrdNum());
@@ -1668,7 +1668,7 @@ void ScDrawLayer::DeleteObjectsInSelection( const 
ScMarkData& rMark )
 
 if (bRecording)
 for (auto p : ppObj)
-AddCalcUndo(std::make_unique(*p));
+AddCalcUndo(std::make_unique(*p));
 
 for (auto p : ppObj)
 pPage->RemoveObject(p->GetOrdNum());


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-08-10 Thread Mike Kaganski (via logerrit)
 sc/source/core/data/drwlayer.cxx |   32 
 1 file changed, 16 insertions(+), 16 deletions(-)

New commits:
commit 2e5635122b9c59b2f67cd4949f5e259cff2993d5
Author: Mike Kaganski 
AuthorDate: Fri Jul 23 16:55:04 2021 +0200
Commit: Michael Stahl 
CommitDate: Tue Aug 10 19:32:45 2021 +0200

Use vector instead of unique_ptr

Change-Id: Iea1fb26d9e176283a96d6f0d18dae5b58e55602e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119432
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120222
Reviewed-by: Michael Stahl 

diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 27d00144a52d..5b70046e4448 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1550,7 +1550,6 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL 
nCol1,SCROW nRow1,
 if (!nObjCount)
 return;
 
-size_t nDelCount = 0;
 tools::Rectangle aDelRect = pDoc->GetMMRect( nCol1, nRow1, nCol2, nRow2, 
nTab );
 tools::Rectangle aDelCircle = pDoc->GetMMRect( nCol1, nRow1, nCol2, nRow2, 
nTab );
 aDelCircle.AdjustLeft(-250);
@@ -1558,7 +1557,8 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL 
nCol1,SCROW nRow1,
 aDelCircle.AdjustTop(-70);
 aDelCircle.AdjustBottom(70);
 
-std::unique_ptr ppObj(new SdrObject*[nObjCount]);
+std::vector ppObj;
+ppObj.reserve(nObjCount);
 
 SdrObjListIter aIter( pPage, SdrIterMode::Flat );
 SdrObject* pObject = aIter.Next();
@@ -1574,7 +1574,7 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL 
nCol1,SCROW nRow1,
 {
 aObjRect = pObject->GetLogicRect();
 if(aDelCircle.IsInside(aObjRect))
-   ppObj[nDelCount++] = pObject;
+   ppObj.push_back(pObject);
 }
 else
 {
@@ -1585,10 +1585,10 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, 
SCCOL nCol1,SCROW nRow1,
 {
 ScAnchorType aAnchorType = 
ScDrawLayer::GetAnchorType(*pObject);
 if (aAnchorType == SCA_CELL || aAnchorType == 
SCA_CELL_RESIZE)
-ppObj[nDelCount++] = pObject;
+ppObj.push_back(pObject);
 }
 else
-ppObj[nDelCount++] = pObject;
+ppObj.push_back(pObject);
 }
 }
 }
@@ -1597,11 +1597,11 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, 
SCCOL nCol1,SCROW nRow1,
 }
 
 if (bRecording)
-for (size_t i=1; i<=nDelCount; ++i)
-AddCalcUndo( std::make_unique( 
*ppObj[nDelCount-i] ) );
+for (auto p : ppObj)
+AddCalcUndo(std::make_unique(*p));
 
-for (size_t i=1; i<=nDelCount; ++i)
-pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
+for (auto p : ppObj)
+pPage->RemoveObject(p->GetOrdNum());
 }
 
 void ScDrawLayer::DeleteObjectsInSelection( const ScMarkData& rMark )
@@ -1629,13 +1629,13 @@ void ScDrawLayer::DeleteObjectsInSelection( const 
ScMarkData& rMark )
 const size_t nObjCount = pPage->GetObjCount();
 if (nObjCount)
 {
-size_t nDelCount = 0;
 //  Rectangle around the whole selection
 tools::Rectangle aMarkBound = pDoc->GetMMRect(
 aMarkRange.aStart.Col(), aMarkRange.aStart.Row(),
 aMarkRange.aEnd.Col(), aMarkRange.aEnd.Row(), nTab 
);
 
-std::unique_ptr ppObj(new SdrObject*[nObjCount]);
+std::vector ppObj;
+ppObj.reserve(nObjCount);
 
 SdrObjListIter aIter( pPage, SdrIterMode::Flat );
 SdrObject* pObject = aIter.Next();
@@ -1657,7 +1657,7 @@ void ScDrawLayer::DeleteObjectsInSelection( const 
ScMarkData& rMark )
  
pObjData->maStart.Row()));
 if (bObjectInMarkArea || bObjectAnchoredToMarkedCell)
 {
-ppObj[nDelCount++] = pObject;
+ppObj.push_back(pObject);
 }
 }
 
@@ -1667,11 +1667,11 @@ void ScDrawLayer::DeleteObjectsInSelection( const 
ScMarkData& rMark )
 //  Delete objects (backwards)
 
 if (bRecording)
-for (size_t i=1; i<=nDelCount; ++i)
-AddCalcUndo( std::make_unique( 
*ppObj[nDelCount-i] ) );
+for (auto p : ppObj)
+AddCalcUndo(std::make_unique(*p));
 
-for (size_t i=1; i<=nDelCount; ++i)
-pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
+ 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-08-09 Thread Tünde Tóth (via logerrit)
 sc/source/ui/dbgui/dbnamdlg.cxx |8 ++--
 sc/source/ui/inc/dbnamdlg.hxx   |1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit d366fc7861a4226d053beb4b21ba665d7c7660f5
Author: Tünde Tóth 
AuthorDate: Thu Jul 29 10:00:06 2021 +0200
Commit: Xisco Fauli 
CommitDate: Mon Aug 9 21:56:54 2021 +0200

tdf#115520 sc UI: Define Database Range dialog disappeared

if the name of the database range was invalid.

Change-Id: If0eb08d35b2187f04ef93136acd6f7eafa3b588a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119652
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit a07351e8181353c0c0b6df5d2ccbad4615c6706b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120234
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx
index 4939663f29b4..1043e899af6d 100644
--- a/sc/source/ui/dbgui/dbnamdlg.cxx
+++ b/sc/source/ui/dbgui/dbnamdlg.cxx
@@ -249,6 +249,7 @@ void ScDbNameDlg::Init()
 bSaved = true;
 xSaveObj->Save();
 NameModifyHdl( *m_xEdName );
+bInvalid = false;
 }
 
 void ScDbNameDlg::SetInfoStrings( const ScDBData* pDBData )
@@ -376,17 +377,18 @@ bool ScDbNameDlg::IsRefInputMode() const
 
 IMPL_LINK_NOARG(ScDbNameDlg, OkBtnHdl, weld::Button&, void)
 {
+bInvalid = false;
 AddBtnHdl(*m_xBtnAdd);
 
 // Pass the changes and the remove list to the view: both are
 // transferred as a reference only, so that no dead memory can
 // be created at this point:
+if (!bInvalid)
 {
 ScDBDocFunc aFunc(*m_rViewData.GetDocShell());
 aFunc.ModifyAllDBData(aLocalDbCol, aRemoveList);
+response(RET_OK);
 }
-
-response(RET_OK);
 }
 
 IMPL_LINK_NOARG(ScDbNameDlg, CancelBtnHdl, weld::Button&, void)
@@ -469,6 +471,7 @@ IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl, weld::Button&, void)
 ERRORBOX(m_xDialog.get(), aStrInvalid);
 m_xEdAssign->SelectAll();
 m_xEdAssign->GrabFocus();
+bInvalid = true;
 }
 }
 else
@@ -476,6 +479,7 @@ IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl, weld::Button&, void)
 ERRORBOX(m_xDialog.get(), ScResId(STR_INVALIDNAME));
 m_xEdName->select_entry_region(0, -1);
 m_xEdName->grab_focus();
+bInvalid = true;
 }
 }
 
diff --git a/sc/source/ui/inc/dbnamdlg.hxx b/sc/source/ui/inc/dbnamdlg.hxx
index 01dc0aab66a9..4958f121d821 100644
--- a/sc/source/ui/inc/dbnamdlg.hxx
+++ b/sc/source/ui/inc/dbnamdlg.hxx
@@ -41,6 +41,7 @@ public:
 
 private:
 boolbSaved;
+boolbInvalid;
 
 OUStringaStrAdd;
 OUStringaStrModify;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-08-08 Thread Eike Rathke (via logerrit)
 sc/source/core/data/table6.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit b8fc2696e72f8941ad8032d8534a983a81e98a9b
Author: Eike Rathke 
AuthorDate: Sun Aug 8 18:39:39 2021 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Aug 8 22:49:43 2021 +0200

Resolves: tdf#143759 Limit empty search's empty column to actual search 
range

... instead of the non-/filtered last row.

Change-Id: I9b941af688a8083d472a793a6bc6b6dbb7b916ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120176
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 15960931988cfd898e14a12d6b9cddaf6d8b0ade)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120134
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index b52247f35e14..fca6dea1c61b 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -1081,10 +1081,14 @@ bool ScTable::SearchRangeForAllEmptyCells(
 if (aCol[nCol].IsEmptyData())
 {
 // The entire column is empty.
-for (SCROW nRow = rRange.aStart.Row(); nRow <= rRange.aEnd.Row(); 
++nRow)
+const SCROW nEndRow = rRange.aEnd.Row();
+for (SCROW nRow = rRange.aStart.Row(); nRow <= nEndRow; ++nRow)
 {
 SCROW nLastRow;
-if (!RowFiltered(nRow, nullptr, ))
+const bool bFiltered = RowFiltered(nRow, nullptr, );
+if (nLastRow > nEndRow)
+nLastRow = nEndRow;
+if (!bFiltered)
 {
 rMatchedRanges.Join(ScRange(nCol, nRow, nTab, nCol, 
nLastRow, nTab));
 if (bReplace)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-08-03 Thread Eike Rathke (via logerrit)
 sc/source/filter/oox/excelfilter.cxx |8 ++-
 sc/source/filter/xml/xmlimprt.cxx|3 +
 sc/source/ui/docshell/arealink.cxx   |3 +
 sc/source/ui/docshell/docsh.cxx  |   25 +
 sc/source/ui/docshell/docsh4.cxx |   90 +--
 sc/source/ui/inc/docsh.hxx   |1 
 6 files changed, 71 insertions(+), 59 deletions(-)

New commits:
commit b6cd39b8adf8148c20ccdfe49841431bd1b9c3a1
Author: Eike Rathke 
AuthorDate: Sun Aug 1 21:40:15 2021 +0200
Commit: Caolán McNamara 
CommitDate: Tue Aug 3 12:39:35 2021 +0200

Consolidate link update handling

Have it at one central place and identical for all document
loading paths.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119835
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 55abc3eb93fb8314b413453e384261cb00fde087)

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

Change-Id: Ib00153a9f5831e223d0129df0538353a7e20961e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119836
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/filter/oox/excelfilter.cxx 
b/sc/source/filter/oox/excelfilter.cxx
index b5d01215baf8..e5815200e063 100644
--- a/sc/source/filter/oox/excelfilter.cxx
+++ b/sc/source/filter/oox/excelfilter.cxx
@@ -109,14 +109,18 @@ bool ExcelFilter::importDocument()
 if (xBookGlob)
 {
 rtl::Reference xWorkbookFragment( new 
WorkbookFragment(*xBookGlob, aWorkbookPath));
+
+const WorkbookFragment* pWF = static_cast(xWorkbookFragment.get());
+const ScDocument& rDoc = pWF->getScDocument();
+if (ScDocShell* pDocSh = 
static_cast(rDoc.GetDocumentShell()))
+pDocSh->SetInitialLinkUpdate( pDocSh->GetMedium());
+
 bool bRet = importFragment( xWorkbookFragment);
 if (bRet)
 {
-const WorkbookFragment* pWF = static_cast(xWorkbookFragment.get());
 const AddressConverter& rAC = pWF->getAddressConverter();
 if (rAC.isTabOverflow() || rAC.isColOverflow() || 
rAC.isRowOverflow())
 {
-const ScDocument& rDoc = pWF->getScDocument();
 if (rDoc.IsUserInteractionEnabled())
 {
 // Show data loss warning.
diff --git a/sc/source/filter/xml/xmlimprt.cxx 
b/sc/source/filter/xml/xmlimprt.cxx
index 968ebb0cdbfe..99d33d2416db 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -1138,6 +1138,9 @@ void SAL_CALL ScXMLImport::setTargetDocument( const 
css::uno::Reference< css::la
 if (!pDoc)
 throw lang::IllegalArgumentException();
 
+if (ScDocShell* pDocSh = 
static_cast(pDoc->GetDocumentShell()))
+pDocSh->SetInitialLinkUpdate( pDocSh->GetMedium());
+
 mpDocImport.reset(new ScDocumentImport(*pDoc));
 mpComp.reset(new ScCompiler(*pDoc, ScAddress(), 
formula::FormulaGrammar::GRAM_ODFF));
 
diff --git a/sc/source/ui/docshell/arealink.cxx 
b/sc/source/ui/docshell/arealink.cxx
index 2b66e13e2327..e44e364c461a 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -226,6 +226,9 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const 
OUString& rNewFilter,
 if (rNewFile.isEmpty() || rNewFilter.isEmpty())
 return false;
 
+if (!m_pDocSh->GetEmbeddedObjectContainer().getUserAllowsLinkUpdate())
+return false;
+
 OUString aNewUrl( ScGlobal::GetAbsDocName( rNewFile, m_pDocSh ) );
 bool bNewUrlName = (aNewUrl != aFileName);
 
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 29435d90a2f4..8e2c3c45218f 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -586,21 +586,7 @@ bool ScDocShell::Load( SfxMedium& rMedium )
 bool bRet = SfxObjectShell::Load(rMedium);
 if (bRet)
 {
-if (GetMedium())
-{
-const SfxUInt16Item* pUpdateDocItem = 
SfxItemSet::GetItem(rMedium.GetItemSet(), SID_UPDATEDOCMODE, 
false);
-m_nCanUpdate = pUpdateDocItem ? pUpdateDocItem->GetValue() : 
css::document::UpdateDocMode::NO_UPDATE;
-}
-
-// GetLinkUpdateModeState() evaluates m_nCanUpdate so that must have
-// been set first. Do not override an already forbidden LinkUpdate (the
-// default is allow).
-comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = 
getEmbeddedObjectContainer();
-if (rEmbeddedObjectContainer.getUserAllowsLinkUpdate())
-{
-// For anything else than LM_ALWAYS we need user confirmation.
-rEmbeddedObjectContainer.setUserAllowsLinkUpdate( 
GetLinkUpdateModeState() == LM_ALWAYS);
-}
+SetInitialLinkUpdate();
 
 {
 //  prepare a valid document for XML filter
@@ -1090,11 +1076,7 @@ bool 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source sw/source

2021-07-22 Thread Mike Kaganski (via logerrit)
 sc/source/ui/drawfunc/drawsh2.cxx   |4 ++--
 sw/source/uibase/shells/drawdlg.cxx |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 06f7757bd377c6dbeada7941249371ab5b31bbad
Author: Mike Kaganski 
AuthorDate: Thu Jul 22 00:56:07 2021 +0300
Commit: Michael Stahl 
CommitDate: Thu Jul 22 10:56:29 2021 +0200

Dereferencing uninitialized pointer

SfxItemSet::GetItemState returns SfxItemState::DEFAULT without
resetting the passed pointer.

Regression after commit dd5bf12193471f064bf7f581dd1b21783390e735.

Change-Id: I1e427a05f8e5b375f50d81b51d32e78fca83eb42
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119348
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 0d4cbdbc9cd4ab06056cec66cffd292b41615b6e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119259
Reviewed-by: Michael Stahl 

diff --git a/sc/source/ui/drawfunc/drawsh2.cxx 
b/sc/source/ui/drawfunc/drawsh2.cxx
index 82609b657959..889c7efd33b3 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -390,13 +390,13 @@ void ScDrawShell::GetDrawAttrState( SfxItemSet& rSet )
 if( bHasMarked )
 {
 SfxAllItemSet aSet(pDrView->GetAttrFromMarked(false));
-if (const SfxPoolItem * pItem;
+if (const SfxPoolItem* pItem = nullptr;
 aSet.GetItemState(SDRATTR_TEXTCOLUMNS_NUMBER, false, ) >= 
SfxItemState::DEFAULT
 && pItem)
 {
 aSet.Put(pItem->CloneSetWhich(SID_ATTR_TEXTCOLUMNS_NUMBER));
 }
-if (const SfxPoolItem * pItem;
+if (const SfxPoolItem* pItem = nullptr;
 aSet.GetItemState(SDRATTR_TEXTCOLUMNS_SPACING, false, ) >= 
SfxItemState::DEFAULT
 && pItem)
 {
diff --git a/sw/source/uibase/shells/drawdlg.cxx 
b/sw/source/uibase/shells/drawdlg.cxx
index b18ce9327b68..9922e9d79fa8 100644
--- a/sw/source/uibase/shells/drawdlg.cxx
+++ b/sw/source/uibase/shells/drawdlg.cxx
@@ -371,14 +371,14 @@ void SwDrawShell::GetDrawAttrState(SfxItemSet& rSet)
 SfxItemSet aSet(rSet);
 aSet.MergeRange(SDRATTR_TEXTCOLUMNS_NUMBER, 
SDRATTR_TEXTCOLUMNS_SPACING);
 pSdrView->GetAttributes(aSet);
-if (const SfxPoolItem * pItem;
+if (const SfxPoolItem* pItem = nullptr;
 aSet.GetItemState(SDRATTR_TEXTCOLUMNS_NUMBER, false, )
 >= SfxItemState::DEFAULT
 && pItem)
 {
 aSet.Put(pItem->CloneSetWhich(SID_ATTR_TEXTCOLUMNS_NUMBER));
 }
-if (const SfxPoolItem * pItem;
+if (const SfxPoolItem* pItem = nullptr;
 aSet.GetItemState(SDRATTR_TEXTCOLUMNS_SPACING, false, )
 >= SfxItemState::DEFAULT
 && pItem)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-07-20 Thread Tünde Tóth (via logerrit)
 sc/source/ui/docshell/dbdocfun.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit aab72a3f9a8d51403428098c7a4324b41236c5e6
Author: Tünde Tóth 
AuthorDate: Tue Jul 6 13:58:13 2021 +0200
Commit: László Németh 
CommitDate: Tue Jul 20 16:00:05 2021 +0200

tdf#123598 sc UI: don't show autofilter dropdown arrows

on the result area when the "Copy results to:" option is true.

Change-Id: I3da4a1098d8c7c0be6604451b7485312043c5ede
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118484
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 15684e5d595289e0a94efd80bbe203ca133845f2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119188
Tested-by: Jenkins

diff --git a/sc/source/ui/docshell/dbdocfun.cxx 
b/sc/source/ui/docshell/dbdocfun.cxx
index a02d26bb0659..3cdee27ffb1d 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -987,6 +987,10 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& 
rQueryParam,
 }
 if (bDoSize)
 nEndY = rDoc.MaxRow();
+
+// remove AutoFilter button flags
+rDocShell.DBAreaDeleted(nDestTab, aLocalParam.nCol1, 
aLocalParam.nRow1, aLocalParam.nCol2);
+
 rDocShell.PostPaint(
 ScRange(aLocalParam.nCol1, aLocalParam.nRow1, nDestTab, nEndX, 
nEndY, nDestTab),
 PaintPartFlags::Grid);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-07-14 Thread Caolán McNamara (via logerrit)
 sc/source/ui/cctrl/checklistmenu.cxx |   13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 636742269af45ea82f5d5ebf25a04dc8e152ed34
Author: Caolán McNamara 
AuthorDate: Mon Jul 12 17:34:11 2021 +0100
Commit: Eike Rathke 
CommitDate: Wed Jul 14 09:15:18 2021 +0200

move freeze/thaw so we don't select while frozen

Change-Id: I4f4b3e5ac3e7e842726780f9c773389f7c39ce7f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118793
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index 275873be1f32..95ab21cb74ae 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -704,12 +704,12 @@ IMPL_LINK_NOARG(ScCheckListMenuControl, EdModifyHdl, 
weld::Entry&, void)
 size_t n = maMembers.size();
 size_t nSelCount = 0;
 
-mpChecks->freeze();
-
 // This branch is the general case, the other is an optimized variant of
 // this one where we can take advantage of knowing we have no hierarchy
 if (mbHasDates)
 {
+mpChecks->freeze();
+
 bool bSomeDateDeletes = false;
 
 for (size_t i = 0; i < n; ++i)
@@ -768,13 +768,19 @@ IMPL_LINK_NOARG(ScCheckListMenuControl, EdModifyHdl, 
weld::Entry&, void)
 updateMemberParents(nullptr, i);
 }
 }
+
+mpChecks->thaw();
 }
 else
 {
+mpChecks->freeze();
+
 // when there are a lot of rows, it is cheaper to simply clear the 
tree and either
 // re-initialise or just insert the filtered lines
 mpChecks->clear();
 
+mpChecks->thaw();
+
 if (bSearchTextEmpty)
 nSelCount = initMembers();
 else
@@ -807,9 +813,6 @@ IMPL_LINK_NOARG(ScCheckListMenuControl, EdModifyHdl, 
weld::Entry&, void)
 }
 }
 
-
-mpChecks->thaw();
-
 if ( nSelCount == n )
 mxChkToggleAll->set_state( TRISTATE_TRUE );
 else if ( nSelCount == 0 )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-07-13 Thread Tünde Tóth (via logerrit)
 sc/source/ui/view/gridwin4.cxx |   26 --
 1 file changed, 12 insertions(+), 14 deletions(-)

New commits:
commit 7f9fde0132b326d5ff3335aae6985e71a8ccaf6d
Author: Tünde Tóth 
AuthorDate: Fri Jul 2 09:51:53 2021 +0200
Commit: László Németh 
CommitDate: Tue Jul 13 19:17:07 2021 +0200

tdf#143101 sc UI: fix highlight of standard filter with logical OR

The autofilter dropdown button didn't indicate that
a standard filter in effect, when the criteria
connected by a logical OR.

Change-Id: I8f802ee3d0d03d654278693f0dcd06d7c3b67ba9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118274
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 1115d4d5ac63394ca0f3f1b75dc81916cdbeebe9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118805
Tested-by: Jenkins

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index f1e53ed61cb8..b17e34c8586c 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1922,25 +1922,23 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, 
const ScTableInfo& rTabInfo
 
 //  pQueryParam can only include MAXQUERY entries
 
-bool bSimpleQuery = true;
-bool bColumnFound = false;
-if (!pQueryParam->bInplace)
-bSimpleQuery = false;
-SCSIZE nCount = pQueryParam->GetEntryCount();
-for (nQuery = 0; nQuery < nCount && bSimpleQuery; ++nQuery)
-if (pQueryParam->GetEntry(nQuery).bDoQuery)
+bool bArrowState = false;
+if (pQueryParam->bInplace)
+{
+SCSIZE nCount = pQueryParam->GetEntryCount();
+for (nQuery = 0; nQuery < nCount; ++nQuery)
 {
 //  Do no restrict to EQUAL here
 //  (Column head should become blue also when ">1")
-
-if (pQueryParam->GetEntry(nQuery).nField == nCol)
-bColumnFound = true;
-if (nQuery > 0)
-if (pQueryParam->GetEntry(nQuery).eConnect != 
SC_AND)
-bSimpleQuery = false;
+const ScQueryEntry& rEntry = 
pQueryParam->GetEntry(nQuery);
+if (rEntry.bDoQuery && rEntry.nField == nCol)
+{
+bArrowState = true;
+break;
+}
 }
+}
 
-bool bArrowState = bSimpleQuery && bColumnFound;
 tools::LongnSizeX;
 tools::LongnSizeY;
 SCCOL nStartCol= nCol;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-07-06 Thread Noel Grandin (via logerrit)
 sc/source/ui/inc/printfun.hxx  |   14 ++---
 sc/source/ui/view/printfun.cxx |  112 -
 2 files changed, 75 insertions(+), 51 deletions(-)

New commits:
commit 0f24214e1a3ac9418de8ef3a137e92d79bb22099
Author: Noel Grandin 
AuthorDate: Sun Jul 4 21:33:21 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 6 10:18:51 2021 +0200

speed up exporting very large spreadsheets to pdf(2)

e.g. the one in tdf#102216

instead of copying the data we want back and forth, just share it via
shared_ptr.

takes it from 6min28s to 1m21

Change-Id: I44d174264baa875e1922d1d46ee07de0e8cbaf0b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118383
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 580b5f6a3bf671f6590f40795d7cb9e46d52cf9f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118424

diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx
index 1a5eddea03cd..9ad5c27e547b 100644
--- a/sc/source/ui/inc/printfun.hxx
+++ b/sc/source/ui/inc/printfun.hxx
@@ -123,9 +123,10 @@ class PrintPageRanges
 public:
 PrintPageRanges();
 
-std::vector m_aPageEndX;
-std::vector m_aPageEndY;
-std::map m_aPageRows;
+// use shared_ptr to avoid copying this (potentially large) data back and 
forth
+std::shared_ptr> m_xPageEndX;
+std::shared_ptr> m_xPageEndY;
+std::shared_ptr> m_xPageRows;
 
 size_t m_nPagesX;
 size_t m_nPagesY;
@@ -165,9 +166,10 @@ struct ScPrintState //  Save 
Variables from ScPrintFunc
 bool bSavedStateRanges;
 sc::PrintPageRangesInput aPrintPageRangesInput;
 size_t nTotalY;
-std::vector aPageEndX;
-std::vector aPageEndY;
-std::map aPageRows;
+// use shared_ptr to avoid copying this (potentially large) map back and 
forth
+std::shared_ptr> xPageEndX;
+std::shared_ptr> xPageEndY;
+std::shared_ptr> xPageRows;
 
 ScPrintState()
 : nPrintTab(0)
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 77d58b12a7a2..950fa944a183 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -219,6 +219,9 @@ ScPrintFunc::ScPrintFunc( ScDocShell* pShell, SfxPrinter* 
pNewPrinter, SCTAB nTa
 {
 pDev = pPrinter.get();
 aSrcOffset = pPrinter->PixelToLogic(pPrinter->GetPageOffsetPixel(), 
MapMode(MapUnit::Map100thMM));
+m_aRanges.m_xPageEndX = std::make_shared>();
+m_aRanges.m_xPageEndY = std::make_shared>();
+m_aRanges.m_xPageRows = std::make_shared>();
 Construct( pOptions );
 }
 
@@ -255,11 +258,17 @@ ScPrintFunc::ScPrintFunc(ScDocShell* pShell, SfxPrinter* 
pNewPrinter,
 if (rState.bSavedStateRanges)
 {
 m_aRanges.m_nTotalY = rState.nTotalY;
-m_aRanges.m_aPageEndX = rState.aPageEndX;
-m_aRanges.m_aPageEndY = rState.aPageEndY;
-m_aRanges.m_aPageRows = rState.aPageRows;
+m_aRanges.m_xPageEndX = rState.xPageEndX;
+m_aRanges.m_xPageEndY = rState.xPageEndY;
+m_aRanges.m_xPageRows = rState.xPageRows;
 m_aRanges.m_aInput = rState.aPrintPageRangesInput;
 }
+else
+{
+m_aRanges.m_xPageEndX = std::make_shared>();
+m_aRanges.m_xPageEndY = std::make_shared>();
+m_aRanges.m_xPageRows = std::make_shared>();
+}
 
 aSrcOffset = pPrinter->PixelToLogic(pPrinter->GetPageOffsetPixel(), 
MapMode(MapUnit::Map100thMM));
 Construct( pOptions );
@@ -287,6 +296,9 @@ ScPrintFunc::ScPrintFunc( OutputDevice* pOutDev, 
ScDocShell* pShell, SCTAB nTab,
 pPageData   ( nullptr )
 {
 pDev = pOutDev;
+m_aRanges.m_xPageEndX = std::make_shared>();
+m_aRanges.m_xPageEndY = std::make_shared>();
+m_aRanges.m_xPageRows = std::make_shared>();
 Construct( pOptions );
 }
 
@@ -323,11 +335,17 @@ ScPrintFunc::ScPrintFunc( OutputDevice* pOutDev, 
ScDocShell* pShell,
 if (rState.bSavedStateRanges)
 {
 m_aRanges.m_nTotalY = rState.nTotalY;
-m_aRanges.m_aPageEndX = rState.aPageEndX;
-m_aRanges.m_aPageEndY = rState.aPageEndY;
-m_aRanges.m_aPageRows = rState.aPageRows;
+m_aRanges.m_xPageEndX = rState.xPageEndX;
+m_aRanges.m_xPageEndY = rState.xPageEndY;
+m_aRanges.m_xPageRows = rState.xPageRows;
 m_aRanges.m_aInput = rState.aPrintPageRangesInput;
 }
+else
+{
+m_aRanges.m_xPageEndX = std::make_shared>();
+m_aRanges.m_xPageEndY = std::make_shared>();
+m_aRanges.m_xPageRows = std::make_shared>();
+}
 
 Construct( pOptions );
 }
@@ -351,9 +369,9 @@ void ScPrintFunc::GetPrintState(ScPrintState& rState,  bool 
bSavePageRanges)
 {
 rState.bSavedStateRanges = true;
 rState.nTotalY = m_aRanges.m_nTotalY;
-rState.aPageEndX = m_aRanges.m_aPageEndX;
-rState.aPageEndY = m_aRanges.m_aPageEndY;
-rState.aPageRows = m_aRanges.m_aPageRows;
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-07-05 Thread Noel Grandin (via logerrit)
 sc/source/ui/inc/printfun.hxx  |5 +++--
 sc/source/ui/view/printfun.cxx |   16 
 2 files changed, 3 insertions(+), 18 deletions(-)

New commits:
commit ca499d820321f938cd731a3a1616dae7180de26b
Author: Noel Grandin 
AuthorDate: Sun Jul 4 21:22:04 2021 +0200
Commit: Xisco Fauli 
CommitDate: Mon Jul 5 14:15:00 2021 +0200

speed up exporting very large spreadsheets to pdf

e.g. the one in tdf#102216
takes it from 27m16s to 6min28s

Change-Id: If6cf7dd49cb43f1749da29da91dab6646d4a0626
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118382
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 8de4f0d77073a2a3850bbcdd09aa7f68c223da01)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118419
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx
index e9721837a57f..1a5eddea03cd 100644
--- a/sc/source/ui/inc/printfun.hxx
+++ b/sc/source/ui/inc/printfun.hxx
@@ -20,6 +20,7 @@
 #pragma once
 
 #include 
+#include 
 #include 
 #include 
 
@@ -124,7 +125,7 @@ public:
 
 std::vector m_aPageEndX;
 std::vector m_aPageEndY;
-std::vector m_aPageRows;
+std::map m_aPageRows;
 
 size_t m_nPagesX;
 size_t m_nPagesY;
@@ -166,7 +167,7 @@ struct ScPrintState //  Save 
Variables from ScPrintFunc
 size_t nTotalY;
 std::vector aPageEndX;
 std::vector aPageEndY;
-std::vector aPageRows;
+std::map aPageRows;
 
 ScPrintState()
 : nPrintTab(0)
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index f099247cc2c6..77d58b12a7a2 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -2482,10 +2482,7 @@ tools::Long ScPrintFunc::CountPages()
  // sets also nPag
 CalcZoom(i);
 if ( aTableParam.bSkipEmpty )
 for (nY=0; nY< m_aRanges.m_nPagesY; nY++)
-{
-OSL_ENSURE(nY < m_aRanges.m_aPageRows.size(), "vector 
access error for aPageRows");
 nPages += m_aRanges.m_aPageRows[nY].CountVisible();
-}
 else
 nPages += static_cast(m_aRanges.m_nPagesX) * 
m_aRanges.m_nPagesY;
 if ( pPageData )
@@ -2497,10 +2494,7 @@ tools::Long ScPrintFunc::CountPages()
  // sets also nPag
 CalcZoom(RANGENO_NORANGE);  // calculate Zoom
 if ( aTableParam.bSkipEmpty )
 for (nY=0; nY(m_aRanges.m_nPagesX) * 
m_aRanges.m_nPagesY;
 if ( pPageData )
@@ -2695,7 +2689,6 @@ tools::Long ScPrintFunc::DoPrint( const MultiSelection& 
rPageRanges,
 nX2 = m_aRanges.m_aPageEndX[nCountX];
 for (nCountY=0; nCountYhttps://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-07-01 Thread Eike Rathke (via logerrit)
 sc/source/core/tool/compiler.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit c28ef94db9e4ba0a89ae66b0a38b27fbbb84e74e
Author: Eike Rathke 
AuthorDate: Thu Jul 1 15:46:01 2021 +0200
Commit: Eike Rathke 
CommitDate: Thu Jul 1 18:24:20 2021 +0200

Resolves: tdf#138432 Use locale's CharClass to parse numeric i18n context

Change-Id: I1828f1b6f93228cd517a6a7bd9ae36584bd801a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118226
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit d703131d063c41b8baca01830c4c9806f99ab7d2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118185

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 76a60156fd16..0d1dc9d52aa6 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2746,6 +2746,10 @@ Label_MaskStateMachine:
 cGroupSep != cArrayColSep && cGroupSep != cArrayRowSep &&
 cGroupSep != cDecSep && cGroupSep != cDecSepAlt &&
 cGroupSep != cSheetPrefix && cGroupSep != cSheetSep);
+// If a numeric context triggered bi18n then use the default locale's
+// CharClass, this may accept group separator as well.
+const CharClass* pMyCharClass = (ScGlobal::getCharClassPtr()->isDigit( 
OUString(pStart[nSrcPos]), 0) ?
+ScGlobal::getCharClassPtr() : pCharClass);
 OUStringBuffer aSymbol;
 mnRangeOpPosInSymbol = -1;
 FormulaError nErr = FormulaError::NONE;
@@ -2756,7 +2760,7 @@ Label_MaskStateMachine:
 if ( pStart[nSrcPos] == cSheetPrefix && pStart[nSrcPos+1] == '\'' )
 aSymbol.append(pStart[nSrcPos++]);
 
-ParseResult aRes = pConv->parseAnyToken( aFormula, nSrcPos, 
pCharClass, bGroupSeparator);
+ParseResult aRes = pConv->parseAnyToken( aFormula, nSrcPos, 
pMyCharClass, bGroupSeparator);
 
 if ( !aRes.TokenType )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-07-01 Thread László Németh (via logerrit)
 sc/source/ui/pagedlg/tphf.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 43b7bde9d798e901de387b1ebefbd952f6f87834
Author: László Németh 
AuthorDate: Thu Jul 1 13:15:35 2021 +0200
Commit: László Németh 
CommitDate: Thu Jul 1 16:36:20 2021 +0200

sc: VclPtr, missing dispose (Page Style->Edit...->Header)

Test under Linux:

1) Open Format->Page Style;

2) disable checkbox "Same content on left and right pages";

3) click on the button "Edit..." to open the Header dialog;

4) click on "Ok".

Change-Id: I2ce403a7a37d71f8f6510b6ad00028bc9f7fc5a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118221
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 5976b54198d24dcf1d8d1684da4da2cf334abe5d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118181

diff --git a/sc/source/ui/pagedlg/tphf.cxx b/sc/source/ui/pagedlg/tphf.cxx
index 2a8af81e01ec..406e23ed24bc 100644
--- a/sc/source/ui/pagedlg/tphf.cxx
+++ b/sc/source/ui/pagedlg/tphf.cxx
@@ -165,6 +165,8 @@ IMPL_LINK_NOARG(ScHFPage, BtnHdl, weld::Button&, void)
 {
 aDataSet.Put( *pDlg->GetOutputItemSet() );
 }
+
+pDlg->disposeOnce();
 });
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-06-30 Thread Andreas Heinisch (via logerrit)
 sc/source/ui/unoobj/filtuno.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 8b496beb74255d619a8de72a07860d1a77c4f79a
Author: Andreas Heinisch 
AuthorDate: Wed Jun 30 10:37:08 2021 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jun 30 20:58:42 2021 +0200

tdf#132421 - don't URL encode filename for the import ASCII dialog title

Change-Id: Ia2cb7b6b355f640a525c41606da25ba35771499b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118148
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 
(cherry picked from commit 6e8c9047f4bf6194bd1423422bd2dc9f92c50725)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118109
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx
index 1e6119ecb36d..fbea6e78aa19 100644
--- a/sc/source/ui/unoobj/filtuno.cxx
+++ b/sc/source/ui/unoobj/filtuno.cxx
@@ -182,7 +182,8 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute()
 //  ascii import is special...
 
 INetURLObject aURL( aFileName );
-OUString aPrivDatName(aURL.getName());
+// tdf#132421 - don't URL encode filename for the import ASCII dialog 
title
+OUString 
aPrivDatName(aURL.GetLastName(INetURLObject::DecodeMechanism::Unambiguous));
 std::unique_ptr pInStream;
 if ( xInputStream.is() )
 pInStream = utl::UcbStreamHelper::CreateStream( xInputStream );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-06-29 Thread Eike Rathke (via logerrit)
 sc/source/ui/view/gridwin.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 293f70b39602231198041812fededcc21d89f145
Author: Eike Rathke 
AuthorDate: Tue Jun 29 14:31:19 2021 +0200
Commit: Eike Rathke 
CommitDate: Tue Jun 29 20:00:32 2021 +0200

maShowPageBreaksTimer.Stop() in ScGridWindow::dispose(), tdf#124983 
follow-up

Stop this timer when the ScGridWindow is to be deleted, together
with the underlying document. See
https://gerrit.libreoffice.org/c/core/+/90101
comments from Miklos Vajna on 2021-06-29 14:08/14:10 CEST

Change-Id: Ia1f39c406d391abd78a57c1d92616dbff788ec63
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118112
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 3d7007ef8784e92bb56a91c40e7bdff812251677)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118098

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index c2c115c4371c..19cac6db8737 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -437,6 +437,8 @@ ScGridWindow::~ScGridWindow()
 
 void ScGridWindow::dispose()
 {
+maShowPageBreaksTimer.Stop();
+
 ImpDestroyOverlayObjects();
 
 mpFilterBox.reset();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-06-28 Thread Eike Rathke (via logerrit)
 sc/source/ui/inc/gridwin.hxx   |6 +++
 sc/source/ui/view/gridwin.cxx  |4 ++
 sc/source/ui/view/gridwin4.cxx |   62 +
 sc/source/ui/view/tabview5.cxx |7 
 4 files changed, 79 insertions(+)

New commits:
commit 6e88f3c8eb8d07bfdf8ade18230de7114c5ab362
Author: Eike Rathke 
AuthorDate: Mon Jun 28 17:03:04 2021 +0200
Commit: Eike Rathke 
CommitDate: Mon Jun 28 20:20:35 2021 +0200

Revert "Revert "tdf#124983 In calc make printable page borders initially 
visible""

This reverts commit 0be41797787622ebb5320acb6ec6cb65a7c8cdd4.

Reason for revert: it turned out that the observed heap corruption on 
Windows (see late https://gerrit.libreoffice.org/c/core/+/90101 comments) was 
not due to this change, so the precautionary revert can be reverted again.

Change-Id: I7a343f889fda601939381a8691e82dca147a40c3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117987
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 09e46d7a4e21..daf6c35b652c 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -309,6 +309,10 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public 
vcl::Window, public DropTargetHel
 voidInvalidateLOKViewCursor(const tools::Rectangle& 
rCursorRect,
 const Fraction aScaleX, const 
Fraction aScaleY);
 
+Timer   maShowPageBreaksTimer;
+boolbInitialPageBreaks;
+voidSetupInitialPageBreaks(ScDocument& rDoc, SCTAB nTab, bool 
bSetup);
+DECL_LINK(InitiatePageBreaksTimer, Timer*, void);
 protected:
 virtual voidPrePaint(vcl::RenderContext& rRenderContext) override;
 virtual voidPaint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle& rRect) override;
@@ -490,6 +494,8 @@ public:
 void updateLOKValListButton(bool bVisible, const ScAddress& rPos) const;
 void updateLOKInputHelp(const OUString& title, const OUString& content) 
const;
 
+void initiatePageBreaks();
+
 protected:
 void ImpCreateOverlayObjects();
 void ImpDestroyOverlayObjects();
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index b6412ae36fbb..c2c115c4371c 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -424,6 +424,10 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, 
ScViewData& rData, ScSplitPos
 
 GetOutDev()->SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() );
 EnableRTL( false );
+
+bInitialPageBreaks = true;
+maShowPageBreaksTimer.SetInvokeHandler(LINK(this, ScGridWindow, 
InitiatePageBreaksTimer));
+maShowPageBreaksTimer.SetTimeout(1);
 }
 
 ScGridWindow::~ScGridWindow()
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 9c1ff475449a..f1e53ed61cb8 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -76,6 +76,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 static void lcl_LimitRect( tools::Rectangle& rRect, const tools::Rectangle& 
rVisible )
 {
@@ -1267,6 +1270,30 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 
 if (mpNoteMarker)
 mpNoteMarker->Draw(); // Above the cursor, in drawing map mode
+
+SetupInitialPageBreaks(rDoc, nTab, bPage&& bInitialPageBreaks);
+}
+
+
+void ScGridWindow::SetupInitialPageBreaks(ScDocument& rDoc, SCTAB nTab, bool 
bSetup)
+{
+// tdf#124983, if option LibreOfficeDev Calc/View/Visual Aids/Page breaks
+// is enabled, breaks should be visible. If the document is opened the 
first
+// time, the breaks are not calculated yet, so for this initialization
+// a timer will be triggered here.
+if (bSetup)
+{
+std::set aColBreaks;
+std::set aRowBreaks;
+rDoc.GetAllColBreaks(aColBreaks, nTab, true, false);
+rDoc.GetAllRowBreaks(aRowBreaks, nTab, true, false);
+if (aColBreaks.size() == 0 || aRowBreaks.size() == 0)
+{
+maShowPageBreaksTimer.SetPriority(TaskPriority::DEFAULT_IDLE);
+maShowPageBreaksTimer.Start();
+bInitialPageBreaks = false;
+}
+}
 }
 
 namespace
@@ -2316,4 +2343,39 @@ void ScGridWindow::DataChanged( const DataChangedEvent& 
rDCEvt )
 Invalidate();
 }
 
+void ScGridWindow::initiatePageBreaks()
+{
+bInitialPageBreaks = true;
+}
+
+IMPL_LINK(ScGridWindow, InitiatePageBreaksTimer, Timer*, pTimer, void)
+{
+if (pTimer == )
+{
+ScDocument& rDoc = mrViewData.GetDocument();
+const ScViewOptions& rOpts = mrViewData.GetOptions();
+bool bPage = rOpts.GetOption(VOPT_PAGEBREAKS);
+ScDocShell* pDocSh = mrViewData.GetDocShell();
+bool bModified = pDocSh->IsModified();
+// tdf#124983, if option LibreOfficeDev Calc/View/Visual Aids/Page 
breaks
+// is enabled, breaks should 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-06-28 Thread Andreas Heinisch (via logerrit)
 sc/source/ui/dbgui/scuiasciiopt.cxx |   10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

New commits:
commit d043e092d9115629f1394ae0b6c25d899460f127
Author: Andreas Heinisch 
AuthorDate: Thu Jun 24 10:19:16 2021 +0200
Commit: Xisco Fauli 
CommitDate: Mon Jun 28 10:11:24 2021 +0200

tdf#58250 - Show custom unicode separator in the csv import dialog

Change-Id: I5924ba3c5b0b96a744e2c2e63632b383b371e485
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117766
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 
(cherry picked from commit 8712d2cb78808bd17399605a70862d7920e63c9a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117858
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx 
b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 6757aab5572a..b66403492961 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -644,13 +644,9 @@ void ScImportAsciiDlg::SaveParameters()
 
 void ScImportAsciiDlg::SetSeparators()
 {
-OString sString(OUStringToOString(maFieldSeparators,
-RTL_TEXTENCODING_MS_1252));
-const char *aSep = sString.getStr();
-sal_Int32 len = maFieldSeparators.getLength();
-for (int i = 0; i < len; ++i)
+for (sal_Int32 i = 0; i < maFieldSeparators.getLength(); ++i)
 {
-switch( aSep[i] )
+switch (maFieldSeparators[i])
 {
 case '\t':  mxCkbTab->set_active(true);break;
 case ';':   mxCkbSemicolon->set_active(true);  break;
@@ -658,7 +654,7 @@ void ScImportAsciiDlg::SetSeparators()
 case ' ':   mxCkbSpace->set_active(true);  break;
 default:
 mxCkbOther->set_active(true);
-mxEdOther->set_text(mxEdOther->get_text() + 
OUStringChar(aSep[i]));
+mxEdOther->set_text(mxEdOther->get_text() + 
OUStringChar(maFieldSeparators[i]));
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-06-24 Thread Andreas Heinisch (via logerrit)
 sc/source/ui/dbgui/scuiasciiopt.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 14af6ffe303090eecd2b42b09da42e5a748cbb9d
Author: Andreas Heinisch 
AuthorDate: Wed Jun 23 23:11:54 2021 +0200
Commit: Xisco Fauli 
CommitDate: Thu Jun 24 17:23:58 2021 +0200

tdf#69207 - Use selected text delimiter to parse the provided csv data

Change-Id: Ie260cb57956cd450398746c7f51629d37d14a324
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117750
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 
(cherry picked from commit 6d30c51f1f69d8c31b30b4e08a97222363852b17)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117724
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx 
b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 93032a5d913e..6757aab5572a 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -435,6 +435,8 @@ ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, 
const OUString& aDatNa
 // *** Separator characters ***
 lcl_FillCombo( *mxCbTextSep, gaTextSepList, mcTextSep );
 mxCbTextSep->set_entry_text(sTextSeparators);
+// tdf#69207 - use selected text delimiter to parse the provided data
+mcTextSep = lcl_CharFromCombo(*mxCbTextSep, gaTextSepList);
 
 Link aSeparatorClickHdl =LINK( this, 
ScImportAsciiDlg, SeparatorClickHdl );
 mxCbTextSep->connect_changed( LINK( this, ScImportAsciiDlg, 
SeparatorComboBoxHdl ) );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-06-24 Thread Eike Rathke (via logerrit)
 sc/source/ui/inc/gridwin.hxx   |6 ---
 sc/source/ui/view/gridwin.cxx  |4 --
 sc/source/ui/view/gridwin4.cxx |   62 -
 sc/source/ui/view/tabview5.cxx |7 
 4 files changed, 79 deletions(-)

New commits:
commit 0be41797787622ebb5320acb6ec6cb65a7c8cdd4
Author: Eike Rathke 
AuthorDate: Thu Jun 24 11:49:05 2021 +0200
Commit: Eike Rathke 
CommitDate: Thu Jun 24 16:04:02 2021 +0200

Revert "tdf#124983 In calc make printable page borders initially visible"

This reverts commit ff3f749cd08851ee4eb0991eabee0327ca081a45.

Reason for revert: reportedly causes crashes and heap corruption on 
Windows, see discussion in https://gerrit.libreoffice.org/c/core/+/90101

Change-Id: I84429b55b5fa2b26afd21ef104606ae2f30aad5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117727
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index daf6c35b652c..09e46d7a4e21 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -309,10 +309,6 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public 
vcl::Window, public DropTargetHel
 voidInvalidateLOKViewCursor(const tools::Rectangle& 
rCursorRect,
 const Fraction aScaleX, const 
Fraction aScaleY);
 
-Timer   maShowPageBreaksTimer;
-boolbInitialPageBreaks;
-voidSetupInitialPageBreaks(ScDocument& rDoc, SCTAB nTab, bool 
bSetup);
-DECL_LINK(InitiatePageBreaksTimer, Timer*, void);
 protected:
 virtual voidPrePaint(vcl::RenderContext& rRenderContext) override;
 virtual voidPaint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle& rRect) override;
@@ -494,8 +490,6 @@ public:
 void updateLOKValListButton(bool bVisible, const ScAddress& rPos) const;
 void updateLOKInputHelp(const OUString& title, const OUString& content) 
const;
 
-void initiatePageBreaks();
-
 protected:
 void ImpCreateOverlayObjects();
 void ImpDestroyOverlayObjects();
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index c2c115c4371c..b6412ae36fbb 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -424,10 +424,6 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, 
ScViewData& rData, ScSplitPos
 
 GetOutDev()->SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() );
 EnableRTL( false );
-
-bInitialPageBreaks = true;
-maShowPageBreaksTimer.SetInvokeHandler(LINK(this, ScGridWindow, 
InitiatePageBreaksTimer));
-maShowPageBreaksTimer.SetTimeout(1);
 }
 
 ScGridWindow::~ScGridWindow()
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index f1e53ed61cb8..9c1ff475449a 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -76,9 +76,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
 
 static void lcl_LimitRect( tools::Rectangle& rRect, const tools::Rectangle& 
rVisible )
 {
@@ -1270,30 +1267,6 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 
 if (mpNoteMarker)
 mpNoteMarker->Draw(); // Above the cursor, in drawing map mode
-
-SetupInitialPageBreaks(rDoc, nTab, bPage&& bInitialPageBreaks);
-}
-
-
-void ScGridWindow::SetupInitialPageBreaks(ScDocument& rDoc, SCTAB nTab, bool 
bSetup)
-{
-// tdf#124983, if option LibreOfficeDev Calc/View/Visual Aids/Page breaks
-// is enabled, breaks should be visible. If the document is opened the 
first
-// time, the breaks are not calculated yet, so for this initialization
-// a timer will be triggered here.
-if (bSetup)
-{
-std::set aColBreaks;
-std::set aRowBreaks;
-rDoc.GetAllColBreaks(aColBreaks, nTab, true, false);
-rDoc.GetAllRowBreaks(aRowBreaks, nTab, true, false);
-if (aColBreaks.size() == 0 || aRowBreaks.size() == 0)
-{
-maShowPageBreaksTimer.SetPriority(TaskPriority::DEFAULT_IDLE);
-maShowPageBreaksTimer.Start();
-bInitialPageBreaks = false;
-}
-}
 }
 
 namespace
@@ -2343,39 +2316,4 @@ void ScGridWindow::DataChanged( const DataChangedEvent& 
rDCEvt )
 Invalidate();
 }
 
-void ScGridWindow::initiatePageBreaks()
-{
-bInitialPageBreaks = true;
-}
-
-IMPL_LINK(ScGridWindow, InitiatePageBreaksTimer, Timer*, pTimer, void)
-{
-if (pTimer == )
-{
-ScDocument& rDoc = mrViewData.GetDocument();
-const ScViewOptions& rOpts = mrViewData.GetOptions();
-bool bPage = rOpts.GetOption(VOPT_PAGEBREAKS);
-ScDocShell* pDocSh = mrViewData.GetDocShell();
-bool bModified = pDocSh->IsModified();
-// tdf#124983, if option LibreOfficeDev Calc/View/Visual Aids/Page 
breaks
-// is enabled, breaks should be visible. If the document is opened the 
first
-// time or a tab is activated the 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-06-23 Thread Eike Rathke (via logerrit)
 sc/source/ui/docshell/impex.cxx |   32 +++-
 1 file changed, 31 insertions(+), 1 deletion(-)

New commits:
commit 4b6c1190f0cde3bc74925bcfa644f24101c6c98f
Author: Eike Rathke 
AuthorDate: Wed Jun 23 19:41:46 2021 +0200
Commit: Eike Rathke 
CommitDate: Wed Jun 23 21:26:23 2021 +0200

Resolves: tdf#143008 Evaluate AM/PM for type date+time text-to-column and 
CSV

Change-Id: Ib760b9a103ab4b8ce7f5a158b09fbe11c6617f2a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117747
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit d81775f5b12080676ebaf659c5a4c10d64a9074b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117719

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index b1a553a2ac10..380bd875fadc 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1068,7 +1068,7 @@ static bool lcl_PutString(
 else if ( nColFormat != SC_COL_STANDARD ) // Datumformats
 {
 const sal_uInt16 nMaxNumberParts = 7; // Y-M-D h:m:s.t
-sal_Int32 nLen = rStr.getLength();
+const sal_Int32 nLen = rStr.getLength();
 sal_Int32 nStart[nMaxNumberParts];
 sal_Int32 nEnd[nMaxNumberParts];
 
@@ -1225,6 +1225,36 @@ static bool lcl_PutString(
 if (eStatus == rtl_math_ConversionStatus_Ok)
 fFrac = fV / 86400.0;
 }
+sal_Int32 nPos;
+if (nFound > 3 && 1 <= nHour && nHour <= 12  // nHour 0 and 
>=13 can't be AM/PM
+&& (nPos = nEnd[nFound-1] + 1) < nLen)
+{
+// Dreaded AM/PM may be following.
+while (nPos < nLen && rStr[nPos] == ' ')
+++nPos;
+if (nPos < nLen)
+{
+sal_Int32 nStop = nPos;
+while (nStop < nLen && rStr[nStop] != ' ')
+++nStop;
+OUString aAmPm = rStr.copy( nPos, nStop - nPos);
+// For AM only 12 needs to be treated, whereas for PM
+// it must not. Check both, locale and second/English
+// strings.
+if (nHour == 12 &&
+(rTransliteration.isEqual( aAmPm, 
pFormatter->GetLocaleData()->getTimeAM()) ||
+ (pSecondTransliteration && 
pSecondTransliteration->isEqual( aAmPm, "AM"
+{
+nHour = 0;
+}
+else if (nHour < 12 &&
+(rTransliteration.isEqual( aAmPm, 
pFormatter->GetLocaleData()->getTimePM()) ||
+ (pSecondTransliteration && 
pSecondTransliteration->isEqual( aAmPm, "PM"
+{
+nHour += 12;
+}
+}
+}
 pCalendar->setValue( i18n::CalendarFieldIndex::HOUR, nHour );
 pCalendar->setValue( i18n::CalendarFieldIndex::MINUTE, nMinute 
);
 pCalendar->setValue( i18n::CalendarFieldIndex::SECOND, nSecond 
);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-06-23 Thread Ilhan Yesil (via logerrit)
 sc/source/ui/inc/gridwin.hxx   |6 +++
 sc/source/ui/view/gridwin.cxx  |4 ++
 sc/source/ui/view/gridwin4.cxx |   62 +
 sc/source/ui/view/tabview5.cxx |7 
 4 files changed, 79 insertions(+)

New commits:
commit ff3f749cd08851ee4eb0991eabee0327ca081a45
Author: Ilhan Yesil 
AuthorDate: Fri Mar 6 13:40:59 2020 +0100
Commit: Eike Rathke 
CommitDate: Wed Jun 23 19:45:15 2021 +0200

tdf#124983 In calc make printable page borders initially visible

If option "LibreOfficeDev Calc/View/Page breaks"
is enabled, breaks should be visible. But if the document
is opened the first time or a tab is opened the first time,
the breaks are not calculated yet and therefore not visible.
To avoid calculations during the load of the document, a
timer will be triggered to calculate the breaks after loading
is finished.

Change-Id: I87219c62e20882b19d36042692efd2e6a8d8190a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90101
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 86e300df241312f6152da1cfa3cb2b8c668d1df5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117718

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 09e46d7a4e21..daf6c35b652c 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -309,6 +309,10 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public 
vcl::Window, public DropTargetHel
 voidInvalidateLOKViewCursor(const tools::Rectangle& 
rCursorRect,
 const Fraction aScaleX, const 
Fraction aScaleY);
 
+Timer   maShowPageBreaksTimer;
+boolbInitialPageBreaks;
+voidSetupInitialPageBreaks(ScDocument& rDoc, SCTAB nTab, bool 
bSetup);
+DECL_LINK(InitiatePageBreaksTimer, Timer*, void);
 protected:
 virtual voidPrePaint(vcl::RenderContext& rRenderContext) override;
 virtual voidPaint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle& rRect) override;
@@ -490,6 +494,8 @@ public:
 void updateLOKValListButton(bool bVisible, const ScAddress& rPos) const;
 void updateLOKInputHelp(const OUString& title, const OUString& content) 
const;
 
+void initiatePageBreaks();
+
 protected:
 void ImpCreateOverlayObjects();
 void ImpDestroyOverlayObjects();
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index b6412ae36fbb..c2c115c4371c 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -424,6 +424,10 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, 
ScViewData& rData, ScSplitPos
 
 GetOutDev()->SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() );
 EnableRTL( false );
+
+bInitialPageBreaks = true;
+maShowPageBreaksTimer.SetInvokeHandler(LINK(this, ScGridWindow, 
InitiatePageBreaksTimer));
+maShowPageBreaksTimer.SetTimeout(1);
 }
 
 ScGridWindow::~ScGridWindow()
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 9c1ff475449a..f1e53ed61cb8 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -76,6 +76,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 static void lcl_LimitRect( tools::Rectangle& rRect, const tools::Rectangle& 
rVisible )
 {
@@ -1267,6 +1270,30 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 
 if (mpNoteMarker)
 mpNoteMarker->Draw(); // Above the cursor, in drawing map mode
+
+SetupInitialPageBreaks(rDoc, nTab, bPage&& bInitialPageBreaks);
+}
+
+
+void ScGridWindow::SetupInitialPageBreaks(ScDocument& rDoc, SCTAB nTab, bool 
bSetup)
+{
+// tdf#124983, if option LibreOfficeDev Calc/View/Visual Aids/Page breaks
+// is enabled, breaks should be visible. If the document is opened the 
first
+// time, the breaks are not calculated yet, so for this initialization
+// a timer will be triggered here.
+if (bSetup)
+{
+std::set aColBreaks;
+std::set aRowBreaks;
+rDoc.GetAllColBreaks(aColBreaks, nTab, true, false);
+rDoc.GetAllRowBreaks(aRowBreaks, nTab, true, false);
+if (aColBreaks.size() == 0 || aRowBreaks.size() == 0)
+{
+maShowPageBreaksTimer.SetPriority(TaskPriority::DEFAULT_IDLE);
+maShowPageBreaksTimer.Start();
+bInitialPageBreaks = false;
+}
+}
 }
 
 namespace
@@ -2316,4 +2343,39 @@ void ScGridWindow::DataChanged( const DataChangedEvent& 
rDCEvt )
 Invalidate();
 }
 
+void ScGridWindow::initiatePageBreaks()
+{
+bInitialPageBreaks = true;
+}
+
+IMPL_LINK(ScGridWindow, InitiatePageBreaksTimer, Timer*, pTimer, void)
+{
+if (pTimer == )
+{
+ScDocument& rDoc = mrViewData.GetDocument();
+const ScViewOptions& rOpts = mrViewData.GetOptions();
+bool bPage = rOpts.GetOption(VOPT_PAGEBREAKS);
+ScDocShell* 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source sd/source

2021-06-22 Thread Caolán McNamara (via logerrit)
 sc/source/ui/inc/editsh.hxx|   12 
 sc/source/ui/inc/tabvwsh.hxx   |6 ++
 sc/source/ui/view/editsh.cxx   |   23 ++-
 sc/source/ui/view/gridwin.cxx  |   14 ++
 sc/source/ui/view/tabvwshe.cxx |   20 
 sd/source/ui/inc/DrawViewShell.hxx |5 -
 sd/source/ui/view/drviews4.cxx |7 ++-
 sd/source/ui/view/drviews7.cxx |2 +-
 8 files changed, 85 insertions(+), 4 deletions(-)

New commits:
commit 66e234549a15cad1b5b61661fb28c7f827ed6e8b
Author: Caolán McNamara 
AuthorDate: Tue Jun 22 11:52:53 2021 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jun 22 15:29:02 2021 +0200

Resolves: tdf#140361 use the DisableEditHyperlink state as of menu launch 
time

at context menu popup time set if the EditHyperlink entry should be
disabled and use that state if queried about it if EditHyperlink is
dispatched from the menu. So ignoring where the mouse currently happens
to be when the menu was dismissed.

The dispatch is done async, if at all, so also trigger an async Query
with Invalidate so at least one Query is ensured to reset the stored
state

similar to tdf#137445 which was for impress/draw

Change-Id: I43a144f1ac0a4db89cc5ab0ebeeae744719f5958
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117636
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/inc/editsh.hxx b/sc/source/ui/inc/editsh.hxx
index fe56777fbb84..5fb8a3c9ade8 100644
--- a/sc/source/ui/inc/editsh.hxx
+++ b/sc/source/ui/inc/editsh.hxx
@@ -42,6 +42,12 @@ private:
 boolbPastePossible;
 boolbIsInsertMode;
 
+// tdf#140361 at context menu popup time set if the EditHyperlink entry
+// should be disabled and use that state if queried about it if
+// EditHyperlink is dispatched from the menu. So ignoring where the mouse
+// currently happens to be when the menu was dismissed.
+std::optional moAtContextMenu_DisableEditHyperlink;
+
 const SvxURLField* GetURLField();
 ScInputHandler* GetMyInputHdl();
 
@@ -73,6 +79,12 @@ public:
 voidGetUndoState(SfxItemSet );
 
 OUString GetSelectionText( bool bWholeWord );
+
+/// return true if "Edit Hyperlink" in context menu should be disabled
+bool ShouldDisableEditHyperlink() const;
+/// force "Edit Hyperlink" to true, with the expectation that 
SID_EDIT_HYPERLINK is
+/// later Invalidated to reset it back to its natural value
+void EnableEditHyperlink();
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 7a5ddf472803..77afb12cd71f 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -399,6 +399,12 @@ public:
 void ClearFormEditData();
 ScFormEditData* GetFormEditData() { return mpFormEditData.get(); }
 
+/// return true if "Edit Hyperlink" in context menu should be disabled
+bool ShouldDisableEditHyperlink() const;
+/// force "Edit Hyperlink" to true, with the expectation that 
SID_EDIT_HYPERLINK is
+/// later Invalidated to reset it back to its natural value
+void EnableEditHyperlink();
+
 virtual tools::Rectangle getLOKVisibleArea() const override;
 };
 
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 451b73a9a208..72abdacd72b8 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -712,6 +712,16 @@ static void lcl_DisableAll( SfxItemSet& rSet )// 
disable all slots
 }
 }
 
+bool ScEditShell::ShouldDisableEditHyperlink() const
+{
+return !rViewData.HasEditView(rViewData.GetActivePart()) || 
!URLFieldHelper::IsCursorAtURLField(*pEditView);
+}
+
+void ScEditShell::EnableEditHyperlink()
+{
+moAtContextMenu_DisableEditHyperlink = false;
+}
+
 void ScEditShell::GetState( SfxItemSet& rSet )
 {
 // When deactivating the view, edit mode is stopped, but the EditShell is 
left active
@@ -777,7 +787,18 @@ void ScEditShell::GetState( SfxItemSet& rSet )
 case SID_COPY_HYPERLINK_LOCATION:
 case SID_REMOVE_HYPERLINK:
 {
-if (!URLFieldHelper::IsCursorAtURLField(*pEditView))
+bool bDisableEditHyperlink;
+if (!moAtContextMenu_DisableEditHyperlink)
+bDisableEditHyperlink = ShouldDisableEditHyperlink();
+else
+{
+// tdf#140361 if a popup menu was active, use the 
state as of when the popup was launched and then drop
+// moAtContextMenu_DisableEditHyperlink
+bDisableEditHyperlink = 
*moAtContextMenu_DisableEditHyperlink;
+moAtContextMenu_DisableEditHyperlink.reset();
+}
+
+if (bDisableEditHyperlink)
 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-06-22 Thread Julien Nabet (via logerrit)
 sc/source/core/data/table7.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit bb59b4165456d13eda800098be8b875d93b093d3
Author: Julien Nabet 
AuthorDate: Sat Jun 19 13:51:28 2021 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jun 22 14:45:12 2021 +0200

tdf#142932: fix crash when pasting cells with comments+"skip empty cells"

See bt here:
https://bugs.documentfoundation.org/attachment.cgi?id=173011

4  0x7fc4b0cdbb3d in ScColContainer::operator[](unsigned long) 
(this=0x872e1e0, nIndex=64) at sc/inc/colcontainer.hxx:43
5  0x7fc4b120d82b in 
ScTable::DeleteBeforeCopyFromClip(sc::CopyFromClipContext&, ScTable const&, 
sc::ColumnSpanSet&) (this=0x872e1e0, rCxt=..., rClipTab=..., 
rBroadcastSpans=...)
   at sc/source/core/data/table7.cxx:118
6  0x7fc4b0e42939 in 
ScDocument::DeleteBeforeCopyFromClip(sc::CopyFromClipContext&, ScMarkData 
const&, sc::ColumnSpanSet&) (this=0x3bffa60, rCxt=..., rMark=..., 
rBroadcastSpans=...)
   at sc/source/core/data/document10.cxx:75
7  0x7fc4b0e0b67b in ScDocument::CopyFromClip(ScRange const&, 
ScMarkData const&, InsertDeleteFlags, ScDocument*, ScDocument*, bool, bool, 
bool, bool, ScRangeList const*)
   (this=0x3bffa60, rDestRange=..., rMark=..., nInsFlag=7, pRefUndoDoc=0x0, 
pClipDoc=0x7d3bb40, bResetCut=true, bAsLink=false, bIncludeFiltered=false, 
bSkipAttrForEmpty=true, pDestRanges=0x7fff4a3da4b0)
   at sc/source/core/data/document.cxx:2916
8  0x7fc4b2412dc3 in ScViewFunc::PasteFromClip(InsertDeleteFlags, 
ScDocument*, ScPasteFunc, bool, bool, bool, InsCellCmd, InsertDeleteFlags, 
bool) (this=
   0x41a29e0, nFlags=7, pClipDoc=0x7d3bb40, nFunction=ScPasteFunc::NONE, 
bSkipEmpty=true, bTranspose=false, bAsLink=false, eMoveMode=INS_NONE, 
nUndoExtraFlags=InsertDeleteFlags::NONE, bAllowDialogs=true)
   at sc/source/ui/view/viewfun3.cxx:1312

Change-Id: Ic119cb5d414a35a9ba18b0564d7adf83154eb9d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117497
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit a6d269ed9478b20f611912bf9711c2683e7bc924)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117632
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/core/data/table7.cxx b/sc/source/core/data/table7.cxx
index 6ec79a90fd98..2ab726ed6a98 100644
--- a/sc/source/core/data/table7.cxx
+++ b/sc/source/core/data/table7.cxx
@@ -109,7 +109,8 @@ void ScTable::DeleteBeforeCopyFromClip(
 ScRange aClipRange = rCxt.getClipDoc()->GetClipParam().getWholeRange();
 SCCOL nClipCol = aClipRange.aStart.Col();
 {
-for (SCCOL nCol = aRange.mnCol1; nCol <= aRange.mnCol2; ++nCol, 
++nClipCol)
+const SCCOL nMaxCol2 = std::min( aRange.mnCol2, aCol.size() - 1 
);
+for (SCCOL nCol = aRange.mnCol1; nCol <= nMaxCol2; ++nCol, ++nClipCol)
 {
 if (nClipCol > aClipRange.aEnd.Col())
 nClipCol = aClipRange.aStart.Col(); // loop through columns.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits