core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-05-10 Thread Pranam Lashkari (via logerrit)
 sc/source/ui/undo/undobase.cxx |   23 ---
 1 file changed, 16 insertions(+), 7 deletions(-)

New commits:
commit 726b133fd8c823c7f05a30c1995de26db372174d
Author: Pranam Lashkari 
AuthorDate: Fri May 10 02:02:18 2024 +0300
Commit: Caolán McNamara 
CommitDate: Fri May 10 11:09:13 2024 +0200

sc: undo: unify height adjust logic in undo with regular logic

in ScBlockUndo::AdjustHeight now we use device like 
ScViewFunc::SetWidthOrHeight
This provides unified behavior with user adjusting height or triggered it 
by undo

problem:
in online sometimes undoing would cause wrong selection due to incorrect 
height set
steps to reproduce(happened in certain files only):
1. autofill down a couple of cells
2. undo it
3. try to select the same cell again

cell selection will act like auto filled cells are merged cells

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

diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index c9a233604281..9c7f5571dd71 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 
 ScSimpleUndo::ScSimpleUndo( ScDocShell* pDocSh ) :
@@ -286,18 +287,26 @@ bool ScBlockUndo::AdjustHeight()
 {
 ScDocument& rDoc = pDocShell->GetDocument();
 
-ScopedVclPtrInstance< VirtualDevice > pVirtDev;
+ScSizeDeviceProvider aProv(pDocShell);
 Fraction aZoomX( 1, 1 );
 Fraction aZoomY = aZoomX;
 double nPPTX, nPPTY;
 ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
 if (pViewShell)
 {
-ScViewData& rData = pViewShell->GetViewData();
-nPPTX = rData.GetPPTX();
-nPPTY = rData.GetPPTY();
-aZoomX = rData.GetZoomX();
-aZoomY = rData.GetZoomY();
+if (aProv.IsPrinter())
+{
+nPPTX = aProv.GetPPTX();
+nPPTY = aProv.GetPPTY();
+}
+else
+{
+ScViewData& rData = pViewShell->GetViewData();
+nPPTX = rData.GetPPTX();
+nPPTY = rData.GetPPTY();
+aZoomX = rData.GetZoomX();
+aZoomY = rData.GetZoomY();
+}
 }
 else
 {
@@ -306,7 +315,7 @@ bool ScBlockUndo::AdjustHeight()
 nPPTY = ScGlobal::nScreenPPTY;
 }
 
-sc::RowHeightContext aCxt(rDoc.MaxRow(), nPPTX, nPPTY, aZoomX, aZoomY, 
pVirtDev);
+sc::RowHeightContext aCxt(rDoc.MaxRow(), nPPTX, nPPTY, aZoomX, aZoomY, 
aProv.GetDevice());
 bool bRet = rDoc.SetOptimalHeight(
 aCxt, aBlockRange.aStart.Row(), aBlockRange.aEnd.Row(), 
aBlockRange.aStart.Tab(), true);
 


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-05-07 Thread Szymon Kłos (via logerrit)
 sc/source/ui/docshell/docsh6.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 83269aa84a0af8b9a32424af6b01815aaad4f42a
Author: Szymon Kłos 
AuthorDate: Tue May 7 15:33:21 2024 +0200
Commit: Szymon Kłos 
CommitDate: Tue May 7 19:07:01 2024 +0200

lok: don't show separator conversion dialog

in online it is more likely that you run file not
created with your user locale. Don't show annoying
dialog about separator conversion in LOK as we didn't
show it before. Recently we enabled it and it become visible.

Change-Id: I5a37865dbe63bca0c55205b59be3a64ceb824b17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167281
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Gökay ŞATIR 

diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index 344b52953faf..0e147f14c3fe 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -496,7 +496,7 @@ void ScDocShell::CheckConfigOptions()
 pScMod->SetFormulaOptions(aNew);
 
 // Launch a nice warning dialog to let the users know of this change.
-ScTabViewShell* pViewShell = GetBestViewShell();
+ScTabViewShell* pViewShell = comphelper::LibreOfficeKit::isActive() ? 
nullptr : GetBestViewShell();
 if (pViewShell)
 {
 std::shared_ptr 
xInfoBox(Application::CreateMessageDialog(pViewShell->GetFrameWeld(),


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-05-07 Thread Caolán McNamara (via logerrit)
 sc/source/ui/app/inputhdl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit aaf24bbfeb7126ac7e3193653a53795e9b817e98
Author: Caolán McNamara 
AuthorDate: Sat May 4 21:20:04 2024 +0100
Commit: Miklos Vajna 
CommitDate: Tue May 7 08:41:07 2024 +0200

always check return of SfxViewShell::Current()

Change-Id: If8f50536295a44a4a8cf692d758ca03e726902e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167074
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index f76842429912..5b1d3cbdbced 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1292,7 +1292,7 @@ void ScInputHandler::ShowArgumentsTip( OUString& rSelText 
)
 }
 
 const SfxViewShell* pViewShell = 
SfxViewShell::Current();
-if (comphelper::LibreOfficeKit::isActive() && 
pViewShell->isLOKDesktop())
+if (comphelper::LibreOfficeKit::isActive() && 
pViewShell && pViewShell->isLOKDesktop())
 {
 tools::JsonWriter writer;
 writer.put("type", "formulausage");


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-04-29 Thread Pranam Lashkari (via logerrit)
 sc/source/ui/dbgui/scuiasciiopt.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 290d70a476bab7d100baa3568ec547633109033e
Author: Pranam Lashkari 
AuthorDate: Fri Apr 26 23:51:14 2024 +0100
Commit: Szymon Kłos 
CommitDate: Mon Apr 29 12:15:13 2024 +0200

LOK: hide cancel button in csv import dialog

it did not make any sense to have cancel button in this dialog
because it would not load file at all.
user can still use close button in title bar to close dialog

Change-Id: Id3ba3e4030553db18bdbd068d92b3395f4fb8c3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166764
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 

diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx 
b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 601323a6586d..b4b446ea7d58 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -605,6 +605,9 @@ ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, 
std::u16string_view aD
 mxCkbSkipEmptyCells->set_active(false);
 mxCkbSkipEmptyCells->hide();
 }
+
+if (comphelper::LibreOfficeKit::isActive())
+m_xBuilder->weld_button("cancel")->hide();
 m_xDialog->SetInstallLOKNotifierHdl(LINK(this, ScImportAsciiDlg, 
InstallLOKNotifierHdl));
 }
 


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-04-24 Thread Miklos Vajna (via logerrit)
 sc/source/core/data/column3.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 1f9f5e67a436d3bf2add9c28b09e34743dcac552
Author: Miklos Vajna 
AuthorDate: Wed Apr 24 09:37:35 2024 +0200
Commit: Caolán McNamara 
CommitDate: Wed Apr 24 10:37:25 2024 +0200

sc: fix crash in ScColumn::SetEditText()

Crashreport:

> SIG   Fatal signal received: SIGSEGV code: 128 for address: 0x0
> program/libsclo.so
>   ScColumn::SetEditText(int, std::unique_ptr >)
>   sc/source/core/data/column3.cxx:2362
> program/libsclo.so
>   ScTable::SetEditText(short, int, std::unique_ptr >)
>   
/opt/rh/devtoolset-12/root/usr/include/c++/12/bits/unique_ptr.h:395
> program/libsclo.so
>   ScDocument::SetEditText(ScAddress const&, 
std::unique_ptr >)
>   
/opt/rh/devtoolset-12/root/usr/include/c++/12/bits/unique_ptr.h:395
> program/libsclo.so
>   ScDocFunc::SetEditCell(ScAddress const&, EditTextObject const&, 
bool)
>   
/opt/rh/devtoolset-12/root/usr/include/c++/12/bits/unique_ptr.h:395
> program/libsclo.so
>   (anonymous 
namespace)::finalizeFormulaProcessing(std::shared_ptr<(anonymous 
namespace)::FormulaProcessingContext>)
>   sc/source/ui/view/viewfunc.cxx:565

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

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 911e59ac7613..fdb8f050b196 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2359,6 +2359,11 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const 
OUString& rString,
 
 void ScColumn::SetEditText( SCROW nRow, std::unique_ptr 
pEditText )
 {
+if (!pEditText)
+{
+return;
+}
+
 pEditText->NormalizeString(GetDoc().GetSharedStringPool());
 std::vector aNewSharedRows;
 sc::CellStoreType::iterator it = GetPositionToInsert(nRow, aNewSharedRows, 
false);


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-04-22 Thread Noel Grandin (via logerrit)
 sc/source/filter/oox/extlstcontext.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit b684c805a70abd48ba1fda861b74fe2732dc988d
Author: Noel Grandin 
AuthorDate: Wed Apr 17 14:06:57 2024 +0200
Commit: Noel Grandin 
CommitDate: Mon Apr 22 09:28:31 2024 +0200

tdf#160706 speed up loading conditional formatting rule in XLS

we only need to finalizeImport on the last ExtDxf we loaded, otherwise
we end up with an O(n^2) performance problem

Change-Id: I566ef43189a1bb7ac7c55e1bccf9445c9cea19b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166179
Tested-by: Noel Grandin 
Reviewed-by: Noel Grandin 
(cherry picked from commit 41895d8fb79001f29bdc0d2aac523eac22fd14c5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166100
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/filter/oox/extlstcontext.cxx 
b/sc/source/filter/oox/extlstcontext.cxx
index 58e4c7931729..d6af04240572 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -292,7 +292,8 @@ void ExtConditionalFormattingContext::onEndElement()
 maModel.eOperator = ScConditionMode::Direct;
 }
 
-getStyles().getExtDxfs().forEachMem( ::finalizeImport );
+if (Dxf* pDxf = getStyles().getExtDxfs().get(rStyleIdx).get())
+pDxf->finalizeImport();
 maModel.aStyle = getStyles().createExtDxfStyle(rStyleIdx);
 rStyleIdx++;
 nFormulaCount = 0;


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-04-12 Thread Caolán McNamara (via logerrit)
 sc/source/filter/html/htmlpars.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a95dd2a5768ac5d0886fd19f4f291bdf6d814d79
Author: Caolán McNamara 
AuthorDate: Mon Apr 8 22:07:11 2024 +0100
Commit: Caolán McNamara 
CommitDate: Fri Apr 12 15:12:25 2024 +0200

ofz#67906 Integer-overflow

Change-Id: I459bdeef6bb7577c5388202374c981c7b01fa137
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165899
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165935
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index d86ee8f4dfb8..b5af7d9f14ac 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1054,7 +1054,7 @@ void ScHTMLLayoutParser::TableDataOn( HtmlImportInfo* 
pInfo )
 case HtmlOptionId::COLSPAN:
 {
 sal_Int32 nColOverlap = rOption.GetString().toInt32();
-if (nColOverlap >= 0 && nColOverlap <= SCCOL_MAX)
+if (nColOverlap >= 0 && nColOverlap <= mpDoc->MaxCol())
 mxActEntry->nColOverlap = static_cast(nColOverlap);
 else
 SAL_WARN("sc", "ScHTMLLayoutParser::TableDataOn ignoring 
colspan: " << nColOverlap);
@@ -1063,7 +1063,7 @@ void ScHTMLLayoutParser::TableDataOn( HtmlImportInfo* 
pInfo )
 case HtmlOptionId::ROWSPAN:
 {
 sal_Int32 nRowOverlap = rOption.GetString().toInt32();
-if (nRowOverlap >= 0)
+if (nRowOverlap >= 0 && nRowOverlap <= mpDoc->MaxRow())
 mxActEntry->nRowOverlap = static_cast(nRowOverlap);
 else
 SAL_WARN("sc", "ScHTMLLayoutParser::TableDataOn ignoring 
rowspan: " << nRowOverlap);


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-04-07 Thread Caolán McNamara (via logerrit)
 sc/source/filter/html/htmlpars.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 4977f8bc199e1c7ce03c146fdcffa147f6c869e7
Author: Caolán McNamara 
AuthorDate: Fri Apr 5 10:40:36 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sun Apr 7 13:45:49 2024 +0200

ofz#67854 UNKNOWN READ

Change-Id: I37d2bc6153a8bf616d19105645f91b8519890e61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165830
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 
(cherry picked from commit fc98c61cf83cac7fefdc8560ce5f1429539b1d25)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165833
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index e1166542e2f5..d86ee8f4dfb8 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -686,8 +686,8 @@ void ScHTMLLayoutParser::Adjust()
 SkipLocked(pE.get(), false);
 if ( pE->nCol != nColBeforeSkip )
 {
-SCCOL nCount = static_cast(maColOffset.size());
-if ( nCount <= pE->nCol )
+size_t nCount = maColOffset.size();
+if ( nCount <= o3tl::make_unsigned(pE->nCol) )
 {
 pE->nOffset = static_cast(maColOffset[nCount-1]);
 MakeCol( , pE->nOffset, pE->nWidth, 
nOffsetTolerance, nOffsetTolerance );


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-04-05 Thread Caolán McNamara (via logerrit)
 sc/source/filter/html/htmlpars.cxx |   15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 4159c05e573e8d8a4e70a74d337662a5e32b93ee
Author: Caolán McNamara 
AuthorDate: Sat Mar 23 21:31:51 2024 +
Commit: Caolán McNamara 
CommitDate: Fri Apr 5 11:03:44 2024 +0200

ofz#67563 infinite loop

Change-Id: I1654d23fd8768a77d32fc3150a9d8554afa2e91f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165220
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit b866019e6ee82ce19dacd653861f8d2b701d2a8e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165716
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index 80277ae6b71b..2dd1de2c5693 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -721,7 +721,6 @@ sal_uInt16 ScHTMLLayoutParser::GetWidth( const 
ScEEParseEntry* pE )
 
 void ScHTMLLayoutParser::SetWidths()
 {
-SCCOL nCol;
 if ( !nTableWidth )
 nTableWidth = static_cast(aPageSize.Width());
 SCCOL nColsPerRow = nMaxCol - nColCntStart;
@@ -732,7 +731,7 @@ void ScHTMLLayoutParser::SetWidths()
 sal_uInt16 nWidth = nTableWidth / static_cast(nColsPerRow);
 sal_uInt16 nOff = nColOffsetStart;
 xLocalColOffset->clear();
-for ( nCol = 0; nCol <= nColsPerRow; ++nCol, nOff = nOff + nWidth )
+for (int nCol = 0; nCol <= nColsPerRow; ++nCol, nOff = nOff + nWidth)
 {
 MakeColNoRef( xLocalColOffset.get(), nOff, 0, 0, 0 );
 }
@@ -762,7 +761,7 @@ void ScHTMLLayoutParser::SetWidths()
 auto& pE = maList[ i ];
 if ( pE->nTab == nTable && pE->nWidth )
 {
-nCol = pE->nCol - nColCntStart;
+SCCOL nCol = pE->nCol - nColCntStart;
 if ( nCol < nColsPerRow )
 {
 if ( pE->nColOverlap == 1 )
@@ -799,7 +798,7 @@ void ScHTMLLayoutParser::SetWidths()
 }
 sal_uInt16 nWidths = 0;
 sal_uInt16 nUnknown = 0;
-for ( nCol = 0; nCol < nColsPerRow; nCol++ )
+for (SCCOL nCol = 0; nCol < nColsPerRow; nCol++)
 {
 if ( pWidths[nCol] )
 nWidths = nWidths + pWidths[nCol];
@@ -811,18 +810,18 @@ void ScHTMLLayoutParser::SetWidths()
 sal_uInt16 nW = ((nWidths < nTableWidth) ?
 ((nTableWidth - nWidths) / nUnknown) :
 (nTableWidth / nUnknown));
-for ( nCol = 0; nCol < nColsPerRow; nCol++ )
+for (SCCOL nCol = 0; nCol < nColsPerRow; nCol++)
 {
 if ( !pWidths[nCol] )
 pWidths[nCol] = nW;
 }
 }
-for ( nCol = 1; nCol <= nColsPerRow; nCol++ )
+for (SCCOL nCol = 1; nCol <= nColsPerRow; nCol++)
 {
 pOffsets[nCol] = pOffsets[nCol-1] + pWidths[nCol-1];
 }
 xLocalColOffset->clear();
-for ( nCol = 0; nCol <= nColsPerRow; nCol++ )
+for (SCCOL nCol = 0; nCol <= nColsPerRow; nCol++)
 {
 MakeColNoRef( xLocalColOffset.get(), pOffsets[nCol], 0, 0, 0 );
 }
@@ -833,7 +832,7 @@ void ScHTMLLayoutParser::SetWidths()
 auto& pE = maList[ i ];
 if (pE->nTab != nTable)
 continue;
-nCol = pE->nCol - nColCntStart;
+SCCOL nCol = pE->nCol - nColCntStart;
 OSL_ENSURE( nCol < nColsPerRow, 
"ScHTMLLayoutParser::SetWidths: column overflow" );
 if (nCol >= nColsPerRow)
 continue;


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-04-02 Thread Caolán McNamara (via logerrit)
 sc/source/filter/html/htmlpars.cxx |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 91dfd7aac814bb47f1bdfc30b882238b42993bf7
Author: Caolán McNamara 
AuthorDate: Fri Mar 29 19:53:17 2024 +
Commit: Caolán McNamara 
CommitDate: Tue Apr 2 20:46:01 2024 +0200

ofz#67708 ignore oversized colspans

that can't fit in SCCOL

ignore negative colspan and rowspans too

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

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index ede9eaf4912a..80277ae6b71b 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1042,12 +1042,20 @@ void ScHTMLLayoutParser::TableDataOn( HtmlImportInfo* 
pInfo )
 {
 case HtmlOptionId::COLSPAN:
 {
-mxActEntry->nColOverlap = 
static_cast(rOption.GetString().toInt32());
+sal_Int32 nColOverlap = rOption.GetString().toInt32();
+if (nColOverlap >= 0 && nColOverlap <= SCCOL_MAX)
+mxActEntry->nColOverlap = static_cast(nColOverlap);
+else
+SAL_WARN("sc", "ScHTMLLayoutParser::TableDataOn ignoring 
colspan: " << nColOverlap);
 }
 break;
 case HtmlOptionId::ROWSPAN:
 {
-mxActEntry->nRowOverlap = 
static_cast(rOption.GetString().toInt32());
+sal_Int32 nRowOverlap = rOption.GetString().toInt32();
+if (nRowOverlap >= 0)
+mxActEntry->nRowOverlap = static_cast(nRowOverlap);
+else
+SAL_WARN("sc", "ScHTMLLayoutParser::TableDataOn ignoring 
rowspan: " << nRowOverlap);
 }
 break;
 case HtmlOptionId::ALIGN:


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-04-02 Thread Caolán McNamara (via logerrit)
 sc/source/filter/html/htmlpars.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 01e4bcacbefe8c6a6ba4d7627dc7aab412218eb1
Author: Caolán McNamara 
AuthorDate: Thu Mar 28 09:09:00 2024 +
Commit: Caolán McNamara 
CommitDate: Tue Apr 2 20:45:44 2024 +0200

ofz: negative column offset

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

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index e5bcc4d2891b..ede9eaf4912a 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -837,6 +837,11 @@ void ScHTMLLayoutParser::SetWidths()
 OSL_ENSURE( nCol < nColsPerRow, 
"ScHTMLLayoutParser::SetWidths: column overflow" );
 if (nCol >= nColsPerRow)
 continue;
+if (nCol < 0)
+{
+SAL_WARN("sc", "negative offset: " << nCol);
+continue;
+}
 pE->nOffset = pOffsets[nCol];
 nCol = nCol + pE->nColOverlap;
 if ( nCol > nColsPerRow )


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-03-26 Thread Noel Grandin (via logerrit)
 sc/source/core/data/document.cxx |   45 +--
 1 file changed, 16 insertions(+), 29 deletions(-)

New commits:
commit 80404237d604597b1b48720d0598e4db06d2df09
Author: Noel Grandin 
AuthorDate: Tue Mar 26 15:16:07 2024 +0200
Commit: Caolán McNamara 
CommitDate: Tue Mar 26 20:56:16 2024 +0100

cool#8570 speed up ScDocument::GetColDefault

we can used an unordered_map here, we are sorting by pointer value. Also
reduce the number of erase/insert

Change-Id: Idb68f76e04248a0c808399bf9881afb5a8e01451
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165346
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 1fe764a4caa87de9136da77227b53bc87f4d9489)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165319
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 04b2151f4261..fe3858baae14 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -95,6 +95,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -150,23 +151,13 @@ void collectUIInformation(std::map&& 
aParameters, const OUSt
 
 struct ScDefaultAttr
 {
-const ScPatternAttr*pAttr;
-SCROW   nFirst;
-SCSIZE  nCount;
-explicit ScDefaultAttr(const ScPatternAttr* pPatAttr) : pAttr(pPatAttr), 
nFirst(0), nCount(0) {}
-};
-
-struct ScLessDefaultAttr
-{
-bool operator() (const ScDefaultAttr& rValue1, const ScDefaultAttr& 
rValue2) const
-{
-return rValue1.pAttr < rValue2.pAttr;
-}
+SCROW   nFirst { 0 };
+SCSIZE  nCount { 0 };
 };
 
 }
 
-typedef std::set  ScDefaultAttrSet;
+typedef std::unordered_map 
ScDefaultAttrMap;
 
 void ScDocument::MakeTable( SCTAB nTab,bool _bNeedsNameCheck )
 {
@@ -4676,40 +4667,36 @@ void ScDocument::GetColDefault( SCTAB nTab, SCCOL nCol, 
SCROW nLastRow, SCROW& n
 if (nEndRow >= nLastRow)
 return;
 
-ScDefaultAttrSet aSet;
-ScDefaultAttrSet::iterator aItr = aSet.end();
+ScDefaultAttrMap aMap;
 while (pAttr)
 {
-ScDefaultAttr aAttr(pAttr);
-aItr = aSet.find(aAttr);
-if (aItr == aSet.end())
+auto aItr = aMap.find(pAttr);
+if (aItr == aMap.end())
 {
+ScDefaultAttr aAttr;
 aAttr.nCount = static_cast(nEndRow - nStartRow + 1);
 aAttr.nFirst = nStartRow;
-aSet.insert(aAttr);
+aMap.insert({ pAttr, aAttr});
 }
 else
 {
-aAttr.nCount = aItr->nCount + static_cast(nEndRow - 
nStartRow + 1);
-aAttr.nFirst = aItr->nFirst;
-aSet.erase(aItr);
-aSet.insert(aAttr);
+aItr->second.nCount += static_cast(nEndRow - nStartRow + 
1);
 }
 pAttr = aDocAttrItr.GetNext(nColumn, nStartRow, nEndRow);
 }
-ScDefaultAttrSet::iterator aDefaultItr = aSet.begin();
-aItr = aDefaultItr;
+auto aDefaultItr = aMap.begin();
+auto aItr = aDefaultItr;
 ++aItr;
-while (aItr != aSet.end())
+while (aItr != aMap.end())
 {
 // for entries with equal count, use the one with the lowest start row,
 // don't use the random order of pointer comparisons
-if ( aItr->nCount > aDefaultItr->nCount ||
- ( aItr->nCount == aDefaultItr->nCount && aItr->nFirst < 
aDefaultItr->nFirst ) )
+if ( aItr->second.nCount > aDefaultItr->second.nCount ||
+ ( aItr->second.nCount == aDefaultItr->second.nCount && 
aItr->second.nFirst < aDefaultItr->second.nFirst ) )
 aDefaultItr = aItr;
 ++aItr;
 }
-nDefault = aDefaultItr->nFirst;
+nDefault = aDefaultItr->second.nFirst;
 }
 
 void ScDocument::StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, 
SCTAB nTab )


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-03-26 Thread Gökay Şatır (via logerrit)
 sc/source/ui/view/select.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 0cdafeb746196f9f1e9ad271a77f5911694ff07d
Author: Gökay Şatır 
AuthorDate: Fri Mar 15 17:24:53 2024 +0300
Commit: Michael Meeks 
CommitDate: Tue Mar 26 15:40:43 2024 +0100

Disable dragging in readonly view mode.

Signed-off-by: Gökay Şatır 
Change-Id: I962d68b85897c156bba6d1898cf78b5fcd85540a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164866
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 

diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx
index d972c9b4eb8d..7d744f32246c 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -145,6 +145,9 @@ void ScViewFunctionSet::SetSelectionEngine( 
ScViewSelectionEngine* pSelEngine )
 // Drag & Drop
 void ScViewFunctionSet::BeginDrag()
 {
+if (m_pViewData->GetViewShell()->IsLokReadOnlyView())
+return;
+
 SCTAB nTab = m_pViewData->GetTabNo();
 
 SCCOL nPosX;


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-03-24 Thread Caolán McNamara (via logerrit)
 sc/source/filter/html/htmlpars.cxx |   25 ++---
 1 file changed, 14 insertions(+), 11 deletions(-)

New commits:
commit f791b56325c8eac4ad321a3b927c9eb3f02baab0
Author: Caolán McNamara 
AuthorDate: Sat Mar 23 15:40:26 2024 +
Commit: Andras Timar 
CommitDate: Sun Mar 24 18:55:41 2024 +0100

ofz#67540 negative offset

Change-Id: I498985962feb7d77c1a71af7002a85aa02aa3e65
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165230
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index 830dac6f6615..9f15f1131b13 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -836,19 +836,22 @@ void ScHTMLLayoutParser::SetWidths()
 for ( size_t i = nFirstTableCell, nListSize = maList.size(); i < 
nListSize; ++i )
 {
 auto& pE = maList[ i ];
-if ( pE->nTab == nTable )
+if (pE->nTab != nTable)
+continue;
+nCol = pE->nCol - nColCntStart;
+OSL_ENSURE( nCol < nColsPerRow, 
"ScHTMLLayoutParser::SetWidths: column overflow" );
+if (nCol >= nColsPerRow)
+continue;
+pE->nOffset = pOffsets[nCol];
+nCol = nCol + pE->nColOverlap;
+if ( nCol > nColsPerRow )
+nCol = nColsPerRow;
+if (nCol < 0)
 {
-nCol = pE->nCol - nColCntStart;
-OSL_ENSURE( nCol < nColsPerRow, 
"ScHTMLLayoutParser::SetWidths: column overflow" );
-if ( nCol < nColsPerRow )
-{
-pE->nOffset = pOffsets[nCol];
-nCol = nCol + pE->nColOverlap;
-if ( nCol > nColsPerRow )
-nCol = nColsPerRow;
-pE->nWidth = pOffsets[nCol] - pE->nOffset;
-}
+SAL_WARN("sc", "negative offset: " << nCol);
+continue;
 }
+pE->nWidth = pOffsets[nCol] - pE->nOffset;
 }
 }
 }


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-03-20 Thread Marco Cecchetti (via logerrit)
 sc/source/ui/view/viewdata.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 2eb19d7f738d490a06233026716b369fb4aa4353
Author: Marco Cecchetti 
AuthorDate: Mon Mar 11 22:21:13 2024 +0100
Commit: Tomaž Vajngerl 
CommitDate: Wed Mar 20 11:04:51 2024 +0100

lok: calc: not possible to select the cell adjacent to the edited one

In the LOK case using the paper size for the printer case (wysiwyg)
can make the cell background and visible area larger than needed which
makes selecting the adjacent right cell impossible in some cases.

Change-Id: I20edd62645692f30e432b1064bb9c85b3396dc32
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164702
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit a6bc0272607590d1692db385be7f6fbfeb1a8fb4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164881

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 0fabcd4077d6..4d8542477fc7 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1754,7 +1754,9 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
 
 Size aPaperSize = pView->GetActiveWin()->PixelToLogic( Size( 
nSizeXPix, nSizeYPix ), GetLogicMode() );
 Size aPaperSizePTwips(nSizeXPTwips, nSizeYPTwips);
-if ( bBreak && !bAsianVertical && 
SC_MOD()->GetInputOptions().GetTextWysiwyg() )
+// In the LOK case the following code can make the cell background and 
visible area larger
+// than needed which makes selecting the adjacent right cell 
impossible in some cases.
+if ( bBreak && !bAsianVertical && 
SC_MOD()->GetInputOptions().GetTextWysiwyg() && !bLOKActive )
 {
 //  if text is formatted for printer, use the exact same paper 
width
 //  (and same line breaks) as for output.


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-03-20 Thread Marco Cecchetti (via logerrit)
 sc/source/ui/view/gridwin.cxx  |2 ++
 sc/source/ui/view/viewdata.cxx |   26 ++
 2 files changed, 28 insertions(+)

New commits:
commit 8f7dd2340b7cc593f1abfea7fbdc22e2d7ec6324
Author: Marco Cecchetti 
AuthorDate: Fri Feb 9 19:04:33 2024 +0100
Commit: Tomaž Vajngerl 
CommitDate: Wed Mar 20 11:04:29 2024 +0100

lok calc: show cell cursor on in place editing

On in place editing cell cursor overlay matches the output area.
In this way the user has a better guess about the edited area.

Change-Id: Iba3370d942a9deaedeed23298a7cb7a6c6c0f5f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164701
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit cc88ad715f80b13efb29744673d044df9c16550c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164880

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 88d64a526e9e..1a36f83d88a8 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -6179,6 +6179,8 @@ void ScGridWindow::UpdateAllOverlays()
 
 void ScGridWindow::DeleteCursorOverlay()
 {
+if (comphelper::LibreOfficeKit::isActive() && 
mrViewData.HasEditView(eWhich))
+return;
 ScTabViewShell* pViewShell = mrViewData.GetViewShell();
 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, 
"EMPTY"_ostr);
 SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_CELL_VIEW_CURSOR, 
"rectangle", "EMPTY"_ostr);
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 6db6fe8f04f5..0fabcd4077d6 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -71,6 +71,7 @@
 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 
@@ -1520,6 +1521,22 @@ tools::Rectangle ScViewData::GetEditArea( ScSplitPos 
eWhich, SCCOL nPosX, SCROW
 GetEditArea( pPattern, bForceToTop );
 }
 
+namespace {
+
+void notifyCellCursorAt(const ScTabViewShell* pViewShell, SCCOL nCol, SCROW 
nRow,
+const tools::Rectangle& rCursor)
+{
+std::stringstream ss;
+ss << rCursor.getX() << ", " << rCursor.getY() << ", " << 
rCursor.GetWidth() << ", "
+   << rCursor.GetHeight() << ", " << nCol << ", " << nRow;
+
+pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, 
ss.str().c_str());
+SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_CELL_VIEW_CURSOR, 
"rectangle",
+   ss.str().c_str());
+}
+
+}
+
 void ScViewData::SetEditEngine( ScSplitPos eWhich,
 ScEditEngineDefaulter* pNewEngine,
 vcl::Window* pWin, SCCOL nNewX, SCROW nNewY )
@@ -1635,6 +1652,9 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
 tools::Rectangle aOutputArea = pWin->PixelToLogic( aPixRect, 
GetLogicMode() );
 pEditView[eWhich]->SetOutputArea( aOutputArea );
 
+if (bLOKPrintTwips)
+notifyCellCursorAt(GetViewShell(), nNewX, nNewY, aPTwipsRect);
+
 if ( bActive && eWhich == GetActivePart() )
 {
 // keep the part that has the active edit view available after
@@ -2121,6 +2141,9 @@ void ScViewData::EditGrowX()
 
 pCurView->SetOutputArea(aArea);
 
+if (bLOKPrintTwips)
+notifyCellCursorAt(GetViewShell(), nEditCol, nEditRow, aAreaPTwips);
+
 //  In vertical mode, the whole text is moved to the next cell 
(right-aligned),
 //  so everything must be repainted. Otherwise, paint only the new area.
 //  If growing in centered alignment, if the cells left and right have 
different sizes,
@@ -2234,6 +2257,9 @@ void ScViewData::EditGrowY( bool bInitial )
 
 pCurView->SetOutputArea(aArea);
 
+if (bLOKPrintTwips)
+notifyCellCursorAt(GetViewShell(), nEditCol, nEditRow, aAreaPTwips);
+
 if (nEditEndRow >= nBottom || bMaxReached)
 {
 if (!(nControl & EVControlBits::AUTOSCROLL))


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-03-13 Thread Caolán McNamara (via logerrit)
 sc/source/core/inc/interpre.hxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 70f7c8c4cc7882faf6993c3ad9264943410f2f27
Author: Caolán McNamara 
AuthorDate: Tue Mar 12 13:08:09 2024 +
Commit: Miklos Vajna 
CommitDate: Wed Mar 13 09:59:16 2024 +0100

tdf#160056 don't need to create a boost::intrusive_ptr to do search

with more recent c++ versions we can elide that construction for the
purposes of this comparison

Change-Id: I6a88219ef4451d2775b3b7ab1d9cf8adfb53e04d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164686
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index ffaac09e1d89..f33f548640f2 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -132,6 +132,12 @@ struct FormulaTokenRef_less
 {
 bool operator () ( const formula::FormulaConstTokenRef& r1, const 
formula::FormulaConstTokenRef& r2 ) const
 { return r1.get() < r2.get(); }
+// So we don't have to create a FormulaConstTokenRef to search by 
formula::FormulaToken*
+using is_transparent = void;
+bool operator () ( const formula::FormulaToken* p1, const 
formula::FormulaConstTokenRef& r2 ) const
+{ return p1 < r2.get(); }
+bool operator () ( const formula::FormulaConstTokenRef& r1, const 
formula::FormulaToken* p2 ) const
+{ return r1.get() < p2; }
 };
 typedef ::std::map< const formula::FormulaConstTokenRef, 
formula::FormulaConstTokenRef, FormulaTokenRef_less> ScTokenMatrixMap;
 


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-03-13 Thread Mike Kaganski (via logerrit)
 sc/source/core/data/fillinfo.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 194f5afb0b080df677527d6766b93d3e752cb1f1
Author: Mike Kaganski 
AuthorDate: Tue Mar 12 14:16:14 2024 +0100
Commit: Miklos Vajna 
CommitDate: Wed Mar 13 08:49:19 2024 +0100

tdf#160117: check bAnyCondition

Commit edbc3a09edcf58a4738b4648811a065f3f55bc7c (sc: Don't end
handleConditionalFormat early, 2023-11-02) intended to allow to apply
several different categories of conditions to the same cell: e.g.,
color scale or databar, in addition to the normal style application
depending on a condition.

This change fixes a regression, when the found matching condition did
not stop search for the matching conditions to apply a style.

Change-Id: Ia4cf1dd35a964c6ca523050dc727184ca22a8dfd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164687
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 61580fcbd10bad2e0aab663d4c8fe43c1e01f92c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164732
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 4f643a04dae3..81186147a33e 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -296,7 +296,7 @@ bool handleConditionalFormat(ScConditionalFormatList& 
rCondFormList, const ScCon
 
 ScCondFormatData aData = pCondForm->GetData(
 pInfo->maCell, rAddr);
-if (!aData.aStyleName.isEmpty())
+if (!bAnyCondition && !aData.aStyleName.isEmpty())
 {
 SfxStyleSheetBase* pStyleSheet =
 pStlPool->Find( aData.aStyleName, SfxStyleFamily::Para );
@@ -337,7 +337,7 @@ bool handleConditionalFormat(ScConditionalFormatList& 
rCondFormList, const ScCon
 pTableInfo->addIconSetInfo(std::move(aData.pIconSet));
 }
 
-if (pInfo->mxColorScale && pInfo->pIconSet && pInfo->pDataBar)
+if (bAnyCondition && pInfo->mxColorScale && pInfo->pIconSet && 
pInfo->pDataBar)
 break;
 }
 


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-03-11 Thread Julien Nabet (via logerrit)
 sc/source/ui/docshell/docsh3.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 18db9d334e1cafddeef53ddff435d6c059aaf803
Author: Julien Nabet 
AuthorDate: Mon Mar 4 13:21:06 2024 +0100
Commit: Miklos Vajna 
CommitDate: Mon Mar 11 09:44:10 2024 +0100

tdf#159373: band-aid for crash in: ScTable::HasAttrib

band-aid because as Eike indicated in 
https://bugs.documentfoundation.org/show_bug.cgi?id=159373#c8
"Question remains why this PostPaint() is called at all for an invalid 
range.."

Change-Id: Ie44378119202addd8ddb46f0be4b0124be9fd48b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164354
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164586
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index b61f3c9a0f65..d935b1848c6c 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -118,6 +118,9 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, 
PaintPartFlags nPart, sa
 SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row();
 SCTAB nTab1 = rRange.aStart.Tab(), nTab2 = std::min(nMaxTab, 
rRange.aEnd.Tab());
 
+if (nTab1 < 0 || nTab2 < 0)
+continue;
+
 if (!m_pDocument->ValidCol(nCol1))
 {
 nMaxWidthAffectedHint = -1; // Hint no longer valid


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-03-07 Thread Miklos Vajna (via logerrit)
 sc/source/ui/docshell/docsh6.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit cb4eaee05d731f2f1c19b7b9c4f21157eeab042e
Author: Miklos Vajna 
AuthorDate: Fri Mar 1 08:34:00 2024 +0100
Commit: Andras Timar 
CommitDate: Thu Mar 7 16:23:55 2024 +0100

sc lok: make the formula separator warning dialog async

I'm not sure what exactly changed here, but recently online.git
unit-wopi-languages started to fail for me. First it was an assertion
failure:

/home/vmiklos/git/libreoffice/core/vcl/source/window/window.cxx:3186: void 
vcl::Window::SetLOKNotifier(const vcl::ILibreOfficeKitNotifier*, bool): 
Assertion `pNotifier' failed.

Once ScDocShell::CheckConfigOptions() is changed to pass in the view
shell explicitly, the next error is:

kit-26201-26149 2024-02-28 10:41:31.659255 +0100 [ kitbroker_002 ] ERR  
non-async dialog triggered

So convert it to async, similar to the chart2/ hunk of commit
4b33e878a446b0bcdb1d5f882a05a256967eea54 (Make format condition, chart
delete and pivot table error async, 2024-01-10).

Change-Id: I159278b24db0acd5fddb6f4d29dae9a35321e614
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164178
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164543
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index 1ea512d40f3b..344b52953faf 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -499,10 +499,10 @@ void ScDocShell::CheckConfigOptions()
 ScTabViewShell* pViewShell = GetBestViewShell();
 if (pViewShell)
 {
-std::unique_ptr 
xInfoBox(Application::CreateMessageDialog(pViewShell->GetFrameWeld(),
+std::shared_ptr 
xInfoBox(Application::CreateMessageDialog(pViewShell->GetFrameWeld(),
   
VclMessageType::Info, VclButtonsType::Ok,
-  
ScResId(STR_OPTIONS_WARN_SEPARATORS), GetpApp()));
-xInfoBox->run();
+  
ScResId(STR_OPTIONS_WARN_SEPARATORS), pViewShell));
+xInfoBox->runAsync(xInfoBox, [] (int) {});
 }
 
 // For now, this is the only option setting that could launch info


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-03-06 Thread Caolán McNamara (via logerrit)
 sc/source/core/inc/interpre.hxx  |6 +-
 sc/source/core/tool/interpr1.cxx |   30 ++
 2 files changed, 27 insertions(+), 9 deletions(-)

New commits:
commit 0cc4ed1a0323356cc91192a9097be0aa08857efd
Author: Caolán McNamara 
AuthorDate: Mon Mar 4 20:46:42 2024 +
Commit: Andras Timar 
CommitDate: Wed Mar 6 18:58:47 2024 +0100

tdf#160056 comphelper::rng takes a mutex for every random number

Change-Id: Ic4b50a9ea9e9eda62ca0877337462354b3fe3675
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164382
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 64b9a8ae5b2c..ffaac09e1d89 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -34,6 +34,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -180,6 +181,7 @@ private:
 
 ScCalcConfig maCalcConfig;
 formula::FormulaTokenIterator aCode;
+std::optional oRNG;
 ScAddress   aPos;
 ScTokenArray* pArr;
 ScInterpreterContext& mrContext;
@@ -497,6 +499,8 @@ private:
 // Returns true if last jump was executed and result matrix pushed.
 bool JumpMatrix( short nStackLevel );
 
+std::mt19937& GetRNG();
+
 double Compare( ScQueryOp eOp );
 /** @param pOptions
 NULL means case sensitivity document option is to be used!
@@ -521,7 +525,7 @@ private:
 void ScPi();
 void ScRandom();
 void ScRandbetween();
-void ScRandomImpl( const std::function& RandomFunc,
+void ScRandomImpl( const std::function& RandomFunc,
 double fFirst, double fLast );
 void ScTrue();
 void ScFalse();
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 8412c0355ed0..f5a69a0e7159 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -1737,7 +1737,7 @@ void ScInterpreter::ScPi()
 PushDouble(M_PI);
 }
 
-void ScInterpreter::ScRandomImpl( const std::function& RandomFunc,
+void ScInterpreter::ScRandomImpl( const std::function& RandomFunc,
 double fFirst, double fLast )
 {
 if (bMatrixFormula)
@@ -1764,7 +1764,7 @@ void ScInterpreter::ScRandomImpl( const 
std::functionPutDouble( RandomFunc( fFirst, fLast),
+pResMat->PutDouble( RandomFunc( GetRNG(), fFirst, fLast),
 static_cast(i), static_cast(j));
 }
 }
@@ -1794,15 +1794,28 @@ void ScInterpreter::ScRandomImpl( const 
std::function::max()));
+oRNG = std::mt19937(nSeed);
+}
+return *oRNG;
+}
+
 void ScInterpreter::ScRandom()
 {
-auto RandomFunc = []( double, double )
+auto RandomFunc = [](std::mt19937& rRNG, double, double)
 {
-return comphelper::rng::uniform_real_distribution();
+std::uniform_real_distribution dist(0.0, 1.0);
+return dist(rRNG);
 };
 ScRandomImpl( RandomFunc, 0.0, 0.0);
 }
@@ -1822,9 +1835,10 @@ void ScInterpreter::ScRandbetween()
 return;
 }
 fMax = std::nextafter( fMax+1, -DBL_MAX);
-auto RandomFunc = []( double fFirst, double fLast )
+auto RandomFunc = [](std::mt19937& rRNG, double fFirst, double fLast)
 {
-return floor( comphelper::rng::uniform_real_distribution( fFirst, 
fLast));
+std::uniform_real_distribution dist(fFirst, fLast);
+return floor(dist(rRNG));
 };
 ScRandomImpl( RandomFunc, fMin, fMax);
 }


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-03-06 Thread Gökay Şatır (via logerrit)
 sc/source/ui/docshell/docsh6.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7405a5eb7e727148d9b063f1f01d073565b9f092
Author: Gökay Şatır 
AuthorDate: Wed Mar 6 10:42:39 2024 +0300
Commit: Gökay ŞATIR 
CommitDate: Wed Mar 6 09:27:40 2024 +0100

Add notifier for mismatching locals or debug assertion is hit for nullptr.

Signed-off-by: Gökay Şatır 
Change-Id: I1a9413a7155d30a58673df39d7fab65cc0219ac8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164448
Reviewed-by: Szymon Kłos 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index caefdfc0fed3..1ea512d40f3b 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -501,7 +501,7 @@ void ScDocShell::CheckConfigOptions()
 {
 std::unique_ptr 
xInfoBox(Application::CreateMessageDialog(pViewShell->GetFrameWeld(),
   
VclMessageType::Info, VclButtonsType::Ok,
-  
ScResId(STR_OPTIONS_WARN_SEPARATORS)));
+  
ScResId(STR_OPTIONS_WARN_SEPARATORS), GetpApp()));
 xInfoBox->run();
 }
 


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-03-01 Thread Marco Cecchetti (via logerrit)
 sc/source/ui/undo/undotab.cxx |   48 ++
 1 file changed, 48 insertions(+)

New commits:
commit a0c9071c8f2e7d8aa255da21b5f6d85dbf5d34b5
Author: Marco Cecchetti 
AuthorDate: Thu Feb 29 16:09:14 2024 +0100
Commit: Caolán McNamara 
CommitDate: Fri Mar 1 18:18:24 2024 +0100

lok: calc: sheet position not restored on undo a tab insert/delete/move

Change-Id: I34158b267727048e703cf895cbc8e20b81da4944
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164166
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 46211c06f51f37eeaa61407c1e7681aeb7a9514f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164193

diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index 8c3cdc1dfdf3..20e40a416e7d 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -78,6 +78,46 @@ void lcl_OnTabsChanged(const ScTabViewShell* pViewShell, 
const ScDocument& rDoc,
 true /* bGroups */, nTabIndex);
 }
 }
+
+template
+void lcl_MakeJsonArray(tools::JsonWriter& rJson, const std::vector& v, 
const char *pArrayName)
+{
+if (!v.empty())
+{
+auto jsonArray = rJson.startArray(pArrayName);
+std::stringstream ss;
+for (std::size_t i = 0; i < v.size(); ++i)
+{
+SCTAB tabIndex = v[i];
+ss << tabIndex;
+if (i < v.size() - 1)
+ss << ",";
+ss << " ";
+}
+if (!ss.str().empty())
+rJson.putRaw(ss.str());
+}
+}
+
+void lcl_UndoCommandResult(const ScTabViewShell* pViewShell,
+   const char *pCmdName, const char *pCmdType,
+   const std::vector* pNewTabs,
+   const std::vector* pOldTabs = nullptr)
+{
+tools::JsonWriter aJson;
+aJson.put("commandName", pCmdName);
+aJson.put("success", true);
+{
+auto result = aJson.startNode("result");
+aJson.put("type", pCmdType);
+if (pNewTabs)
+lcl_MakeJsonArray(aJson, *pNewTabs, "newTabs");
+if (pOldTabs)
+lcl_MakeJsonArray(aJson, *pOldTabs, "oldTabs");
+}
+
+pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_UNO_COMMAND_RESULT, 
aJson.finishAndGetAsOString());
+}
 }
 
 ScUndoInsertTab::ScUndoInsertTab( ScDocShell* pNewDocShell,
@@ -141,6 +181,9 @@ void ScUndoInsertTab::Undo()
 {
 ScDocument& rDoc = pDocShell->GetDocument();
 lcl_OnTabsChanged(pViewShell, rDoc, nTab);
+std::vector aTabs{nTab};
+lcl_UndoCommandResult(pViewShell, ".uno:Undo", "ScUndoInsertTab", 
);
+
 }
 
 //  SetTabNo(...,sal_True) for all views to sync with drawing layer pages
@@ -171,6 +214,8 @@ void ScUndoInsertTab::Redo()
 {
 ScDocument& rDoc = pDocShell->GetDocument();
 lcl_OnTabsChanged(pViewShell, rDoc, nTab);
+std::vector aTabs{nTab};
+lcl_UndoCommandResult(pViewShell, ".uno:Redo", "ScUndoInsertTab", 
);
 }
 }
 
@@ -394,6 +439,7 @@ void ScUndoDeleteTab::Undo()
 if (comphelper::LibreOfficeKit::isActive() && !theTabs.empty())
 {
 lcl_OnTabsChanged(pViewShell, rDoc, theTabs[0]);
+lcl_UndoCommandResult(pViewShell, ".uno:Undo", "ScUndoDeleteTab", 
);
 }
 
 for(SCTAB nTab: theTabs)
@@ -432,6 +478,7 @@ void ScUndoDeleteTab::Redo()
 {
 ScDocument& rDoc = pDocShell->GetDocument();
 lcl_OnTabsChanged(pViewShell, rDoc, theTabs[0]);
+lcl_UndoCommandResult(pViewShell, ".uno:Redo", "ScUndoDeleteTab", 
);
 }
 
 //  SetTabNo(...,sal_True) for all views to sync with drawing layer pages
@@ -589,6 +636,7 @@ void ScUndoMoveTab::DoChange( bool bUndo ) const
 const auto oldTabsMinIt = std::min_element(mpOldTabs->begin(), 
mpOldTabs->end());
 SCTAB nTab = std::min(*newTabsMinIt, *oldTabsMinIt);
 lcl_OnTabsChanged(pViewShell, rDoc, nTab, true /* bInvalidateTiles */);
+lcl_UndoCommandResult(pViewShell, bUndo ? ".uno:Undo" : ".uno:Redo", 
"ScUndoMoveTab", mpOldTabs.get(), mpNewTabs.get());
 }
 
 SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScTablesChanged ) );// 
Navigator


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-03-01 Thread Marco Cecchetti (via logerrit)
 sc/source/ui/undo/undotab.cxx |   51 +++---
 1 file changed, 43 insertions(+), 8 deletions(-)

New commits:
commit fe0b935313b28003117a2d219fd2fe359947a11e
Author: Marco Cecchetti 
AuthorDate: Tue Feb 27 17:56:26 2024 +0100
Commit: Caolán McNamara 
CommitDate: Fri Mar 1 14:49:15 2024 +0100

lok: calc: sheet geometry not updated on undo a tab insert/delete/move

Change-Id: I1e12ca71771e746155afe48215ba2df4b35634d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164165
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 86e6d67220d6d3d93c5decf04195b7f5025984ae)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164192

diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index 670769e70ffc..8c3cdc1dfdf3 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -61,6 +61,24 @@ using namespace com::sun::star;
 using ::std::unique_ptr;
 using ::std::vector;
 
+namespace
+{
+void lcl_OnTabsChanged(const ScTabViewShell* pViewShell, const ScDocument& 
rDoc, SCTAB nTab, bool bInvalidateTiles = false)
+{
+for (SCTAB nTabIndex = nTab; nTabIndex < rDoc.GetTableCount(); ++nTabIndex)
+{
+if (!rDoc.IsVisible(nTabIndex))
+continue;
+if (bInvalidateTiles)
+pViewShell->libreOfficeKitViewInvalidateTilesCallback(nullptr, 
nTabIndex, 0);
+ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
+pViewShell,
+true /* bColsAffected */, true /* bRowsAffected */,
+true /* bSizes*/, true /* bHidden */, true /* bFiltered */,
+true /* bGroups */, nTabIndex);
+}
+}
+}
 
 ScUndoInsertTab::ScUndoInsertTab( ScDocShell* pNewDocShell,
   SCTAB nTabNum,
@@ -119,6 +137,12 @@ void ScUndoInsertTab::Undo()
 if ( pChangeTrack )
 pChangeTrack->Undo( nEndChangeAction, nEndChangeAction );
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+ScDocument& rDoc = pDocShell->GetDocument();
+lcl_OnTabsChanged(pViewShell, rDoc, nTab);
+}
+
 //  SetTabNo(...,sal_True) for all views to sync with drawing layer pages
 pDocShell->Broadcast( SfxHint( SfxHintId::ScForceSetTab ) );
 }
@@ -142,6 +166,12 @@ void ScUndoInsertTab::Redo()
 pDocShell->SetInUndo( false );  //! EndRedo
 
 SetChangeTrack();
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+ScDocument& rDoc = pDocShell->GetDocument();
+lcl_OnTabsChanged(pViewShell, rDoc, nTab);
+}
 }
 
 void ScUndoInsertTab::Repeat(SfxRepeatTarget& rTarget)
@@ -360,6 +390,12 @@ void ScUndoDeleteTab::Undo()
 if ( pChangeTrack )
 pChangeTrack->Undo( nStartChangeAction, nEndChangeAction );
 
+ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
+if (comphelper::LibreOfficeKit::isActive() && !theTabs.empty())
+{
+lcl_OnTabsChanged(pViewShell, rDoc, theTabs[0]);
+}
+
 for(SCTAB nTab: theTabs)
 {
 pDocShell->Broadcast( ScTablesHint( SC_TAB_INSERTED, nTab) );
@@ -373,7 +409,6 @@ void ScUndoDeleteTab::Undo()
 pDocShell->PostPaint(0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, 
PaintPartFlags::All );  // incl. extras
 
 // not ShowTable due to SetTabNo(..., sal_True):
-ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
 if (pViewShell)
 pViewShell->SetTabNo( lcl_GetVisibleTabBefore( rDoc, theTabs[0] ), 
true );
 }
@@ -393,6 +428,12 @@ void ScUndoDeleteTab::Redo()
 
 SetChangeTrack();
 
+if (comphelper::LibreOfficeKit::isActive() && !theTabs.empty())
+{
+ScDocument& rDoc = pDocShell->GetDocument();
+lcl_OnTabsChanged(pViewShell, rDoc, theTabs[0]);
+}
+
 //  SetTabNo(...,sal_True) for all views to sync with drawing layer pages
 pDocShell->Broadcast( SfxHint( SfxHintId::ScForceSetTab ) );
 }
@@ -544,16 +585,10 @@ void ScUndoMoveTab::DoChange( bool bUndo ) const
 
 if (comphelper::LibreOfficeKit::isActive() && !mpNewTabs->empty())
 {
-tools::Rectangle aRectangle(0, 0, 10, 10);
 const auto newTabsMinIt = std::min_element(mpNewTabs->begin(), 
mpNewTabs->end());
 const auto oldTabsMinIt = std::min_element(mpOldTabs->begin(), 
mpOldTabs->end());
 SCTAB nTab = std::min(*newTabsMinIt, *oldTabsMinIt);
-for (SCTAB nTabIndex = nTab; nTabIndex < rDoc.GetTableCount(); 
++nTabIndex)
-{
-if (!rDoc.IsVisible(nTabIndex))
-continue;
-pViewShell->libreOfficeKitViewInvalidateTilesCallback(, 
nTabIndex, 0);
-}
+lcl_OnTabsChanged(pViewShell, rDoc, nTab, true /* bInvalidateTiles */);
 }
 
 SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScTablesChanged ) );// 
Navigator


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-03-01 Thread Marco Cecchetti (via logerrit)
 sc/source/ui/undo/undotab.cxx  |   14 ++
 sc/source/ui/view/viewfun2.cxx |7 +++
 2 files changed, 21 insertions(+)

New commits:
commit 2b2ece61cc3b1115684d31fd3ce0decfe8672cd8
Author: Marco Cecchetti 
AuthorDate: Mon Feb 26 14:36:12 2024 +0100
Commit: Caolán McNamara 
CommitDate: Fri Mar 1 13:44:10 2024 +0100

lok: calc: tiles not invalidated on tab move

This patch fixes a regression started from
9f3ee2b2 "don't invalidate when switching tabs"

Change-Id: Icd560c73cff836b026b1ba69432bb712e36c035a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164164
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
(cherry picked from commit cf4630887adcf3e9d8b7a2452f097bb2f564fc5c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164129

diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index 4237aab46358..670769e70ffc 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -542,6 +542,20 @@ void ScUndoMoveTab::DoChange( bool bUndo ) const
 }
 }
 
+if (comphelper::LibreOfficeKit::isActive() && !mpNewTabs->empty())
+{
+tools::Rectangle aRectangle(0, 0, 10, 10);
+const auto newTabsMinIt = std::min_element(mpNewTabs->begin(), 
mpNewTabs->end());
+const auto oldTabsMinIt = std::min_element(mpOldTabs->begin(), 
mpOldTabs->end());
+SCTAB nTab = std::min(*newTabsMinIt, *oldTabsMinIt);
+for (SCTAB nTabIndex = nTab; nTabIndex < rDoc.GetTableCount(); 
++nTabIndex)
+{
+if (!rDoc.IsVisible(nTabIndex))
+continue;
+pViewShell->libreOfficeKitViewInvalidateTilesCallback(, 
nTabIndex, 0);
+}
+}
+
 SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScTablesChanged ) );// 
Navigator
 
 pDocShell->PostPaintGridAll();
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 50db721190c9..42b37f86ca62 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -91,6 +91,7 @@
 #include 
 
 #include 
+#include 
 
 using namespace com::sun::star;
 using ::editeng::SvxBorderLine;
@@ -3202,6 +3203,12 @@ void ScViewFunc::MoveTable(sal_uInt16 nDestDocNo, SCTAB 
nDestTab, bool bCopy,
 
 SCTAB nTab = GetViewData().GetTabNo();
 
+if (comphelper::LibreOfficeKit::isActive() && !pSrcTabs->empty())
+{
+ScModelObj* pModel = pDocShell->GetModel();
+SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel);
+}
+
 if (bUndo)
 {
 if (bCopy)


core.git: Branch 'distro/collabora/co-24.04' - sc/source sw/source

2024-02-29 Thread Gülşah Köse (via logerrit)
 sc/source/ui/app/inputhdl.cxx  |9 -
 sw/source/uibase/docvw/edtwin2.cxx |1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 3e42811c2935a6501d8a0383431b2f2154baf709
Author: Gülşah Köse 
AuthorDate: Wed Feb 28 15:05:06 2024 +0300
Commit: Gülşah Köse 
CommitDate: Thu Feb 29 19:53:38 2024 +0100

Online: Make tooltip message specific to function usage tooltip

Using same callback caused a regression about showing tooltip while
reviewing a change in writer. So we need a type to understand which
tooltip comes.

Signed-off-by: Gülşah Köse 
Change-Id: Iae26ff48f9c5c711af071fd66b5314e7bc96ff8b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164122
Reviewed-by: Szymon Kłos 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index d3c838c24322..5c6f73d5a6d6 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -58,6 +58,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1292,7 +1293,13 @@ void ScInputHandler::ShowArgumentsTip( OUString& 
rSelText )
 
 const SfxViewShell* pViewShell = 
SfxViewShell::Current();
 if (comphelper::LibreOfficeKit::isActive() && 
pViewShell->isLOKDesktop())
-
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TOOLTIP, aNew.toUtf8());
+{
+tools::JsonWriter writer;
+writer.put("type", "formulausage");
+writer.put("text", aNew);
+OString sFunctionUsageTip = 
writer.finishAndGetAsOString();
+
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TOOLTIP, sFunctionUsageTip);
+}
 }
 }
 }
diff --git a/sw/source/uibase/docvw/edtwin2.cxx 
b/sw/source/uibase/docvw/edtwin2.cxx
index b6dcfdbeb70e..07bf72ff4b99 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -315,6 +315,7 @@ static OString getTooltipPayload(const OUString& tooltip, 
const SwRect& rect)
 {
 tools::JsonWriter writer;
 {
+writer.put("type", "generaltooltip");
 writer.put("text", tooltip);
 writer.put("rectangle", rect.SVRect().toString());
 }


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-02-28 Thread Caolán McNamara (via logerrit)
 sc/source/ui/view/gridwin4.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit d0e2b97186925a687989d3a8c546d6dba98dc7ae
Author: Caolán McNamara 
AuthorDate: Wed Feb 28 12:04:28 2024 +
Commit: Caolán McNamara 
CommitDate: Wed Feb 28 16:18:52 2024 +0100

assertion fails on last rows selection / modification

Open Calc hello world spreadsheet
Click on cell in column H
Press ctrl + shift + down arrow to select and go to the end of sheet (cell 
H1048576)
Click on the H1048576 and type something, Save
Refresh browser / reload spreadsheet
try to select modified cell, remove content

Result: Crash

assert(nEndRow >= nStartRow);
nEndRow   = 1048575
nStartRow = 1048576

likely an assert since:

commit a86c00414a43c5d87981ffae1018cb242c5e5e1d
Date:   Fri Jan 19 14:27:10 2024 +0200

cool#6893 reduce allocation in ScGridWindow::PaintTile

but seems harmless for this specific example

Change-Id: I1d492c357a7a0a23b9f9cc974c4b9f684aba8648
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163987
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 9c93e137750c..bea61ba0bc7b 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1544,9 +1544,15 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
 nBottomRightTileCol++;
 nBottomRightTileRow++;
 
+if (nTopLeftTileCol > rDoc.MaxCol())
+nTopLeftTileCol = rDoc.MaxCol();
+
 if (nBottomRightTileCol > rDoc.MaxCol())
 nBottomRightTileCol = rDoc.MaxCol();
 
+if (nTopLeftTileRow > MAXTILEDROW)
+nTopLeftTileRow = MAXTILEDROW;
+
 if (nBottomRightTileRow > MAXTILEDROW)
 nBottomRightTileRow = MAXTILEDROW;
 


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-02-27 Thread Gülşah Köse (via logerrit)
 sc/source/ui/app/inputhdl.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit d52dfa7ecbf9cb50a4007b44af9cd23ad08c5d8e
Author: Gülşah Köse 
AuthorDate: Tue Feb 27 13:07:18 2024 +0300
Commit: Gülşah Köse 
CommitDate: Tue Feb 27 21:49:17 2024 +0100

Online: Prevent hiding tooltips due to other users action.

Other user's actions like reloading reopening or refreshing
document causes hiding other user function tooltips.

Signed-off-by: Gülşah Köse 
Change-Id: I0aeb0aeb98182398e4740c71cfd65c4df2c51ba6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163978
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 62a7d7b9bf09..5d45d930b3eb 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -4446,7 +4446,9 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* 
pState,
 pDelayTimer->Start();
 }
 
-HideTip();
+// Don't hide function tooltip in LOK, a remote user might be using tip.
+if (bStopEditing)
+HideTip();
 HideTipBelow();
 bInOwnChange = false;
 }


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-02-27 Thread Szymon Kłos (via logerrit)
 sc/source/ui/view/tabvwsh4.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 2a2a9c179801f3dff95ac44468b1d61795677090
Author: Szymon Kłos 
AuthorDate: Mon Feb 26 15:39:30 2024 +0100
Commit: Andras Timar 
CommitDate: Tue Feb 27 09:30:51 2024 +0100

lok: don't hide tooltip on every action

Signed-off-by: Szymon Kłos 
Change-Id: I62f69071a4857f7413a995da1ff9fc6ba2f942d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163947
Reviewed-by: Gülşah Köse 
Tested-by: Jenkins CollaboraOffice 
(cherry picked from commit 8b56971baa473547000eed4d4235977f5df0cfe5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163848

diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 7d20ed10a085..0afd430728de 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -268,7 +268,9 @@ void ScTabViewShell::Deactivate(bool bMDI)
 {
 HideNoteMarker();   // note marker
 
-if ( pHdl )
+// in LOK case this could be trigerred on every action from other view 
(doc_setView)
+// we don't want to hide tooltip only because other view did some 
action
+if ( pHdl && !comphelper::LibreOfficeKit::isActive() )
 pHdl->HideTip();// Hide formula auto input tip
 }
 }


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-02-23 Thread Gülşah Köse (via logerrit)
 sc/source/ui/app/inputhdl.cxx |   16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

New commits:
commit c86f6421524c187fa75a19c6e8ba09bd800d3518
Author: Gülşah Köse 
AuthorDate: Mon Feb 19 16:00:25 2024 +0300
Commit: Pedro Silva 
CommitDate: Fri Feb 23 10:07:26 2024 +0100

ONLINE: Add calc formula tooltip support.

Signed-off-by: Gülşah Köse 
Change-Id: I1f3c438f5152e2b372212d003c1ec4e74e4d3ff2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163721
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 9b45a88b1d31..62a7d7b9bf09 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1109,6 +1109,10 @@ void ScInputHandler::HideTip()
 pTipVisibleParent = nullptr;
 }
 aManualTip.clear();
+
+const SfxViewShell* pViewShell = SfxViewShell::Current();
+if (comphelper::LibreOfficeKit::isActive() && pViewShell)
+
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CALC_FUNCTION_LIST, 
"hidetip"_ostr);
 }
 void ScInputHandler::HideTipBelow()
 {
@@ -1134,11 +1138,6 @@ bool lcl_hasSingleToken(std::u16string_view s, 
sal_Unicode c)
 
 void ScInputHandler::ShowArgumentsTip( OUString& rSelText )
 {
-if (comphelper::LibreOfficeKit::isActive())
-{
-return;
-}
-
 if ( !pActiveViewSh )
 return;
 
@@ -1282,6 +1281,10 @@ void ScInputHandler::ShowArgumentsTip( OUString& 
rSelText )
 ShowTipBelow( aNew );
 bFound = true;
 }
+
+const SfxViewShell* pViewShell = 
SfxViewShell::Current();
+if (comphelper::LibreOfficeKit::isActive() && 
pViewShell->isLOKDesktop())
+
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TOOLTIP, aNew.toUtf8());
 }
 }
 }
@@ -1430,7 +1433,7 @@ void ScInputHandler::ShowFuncList( const ::std::vector< 
OUString > & rFuncStrVec
 const SfxViewShell* pViewShell = SfxViewShell::Current();
 if (comphelper::LibreOfficeKit::isActive())
 {
-if (rFuncStrVec.size() && pViewShell && pViewShell->isLOKMobilePhone())
+if (rFuncStrVec.size() && pViewShell)
 {
 auto aPos = pFormulaData->begin();
 sal_uInt32 nCurIndex = std::distance(aPos, miAutoPosFormula);
@@ -1483,7 +1486,6 @@ void ScInputHandler::ShowFuncList( const ::std::vector< 
OUString > & rFuncStrVec
 OString s = aPayload.makeStringAndClear();
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CALC_FUNCTION_LIST, s);
 }
-// not tunnel tooltips in the lok case
 return;
 }
 


core.git: Branch 'distro/collabora/co-24.04' - sc/source sd/source sw/source

2024-02-21 Thread Caolán McNamara (via logerrit)
 sc/source/ui/unoobj/docuno.cxx|   16 
 sd/source/ui/unoidl/unomodel.cxx  |   16 
 sw/source/uibase/uno/unotxdoc.cxx |   15 +++
 3 files changed, 47 insertions(+)

New commits:
commit e2ca1c82dbce30d625d33c0bd8c3c080294f93b8
Author: Caolán McNamara 
AuthorDate: Tue Feb 20 11:25:06 2024 +
Commit: Michael Meeks 
CommitDate: Wed Feb 21 11:23:04 2024 +0100

support possibility to set Theme early during initializeForTiledRendering

so we are already in the desired theme from the start

Change-Id: Ibaaf647612a0a61ce74fa4e4272d7084868a6ea3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163650
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index a6de0da0cc92..007e6735b96d 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -21,6 +21,8 @@
 
 #include 
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -1297,6 +1299,8 @@ void ScModelObj::initializeForTiledRendering(const 
css::uno::SequenceSetAppOptions(aAppOptions);
 
+OUString sThemeName;
+
 for (const beans::PropertyValue& rValue : rArguments)
 {
 if (rValue.Name == ".uno:SpellOnline" && rValue.Value.has())
@@ -1305,6 +1309,8 @@ void ScModelObj::initializeForTiledRendering(const 
css::uno::Sequence());
 GetDocument()->SetDocOptions(options);
 }
+else if (rValue.Name == ".uno:ChangeTheme" && 
rValue.Value.has())
+sThemeName = rValue.Value.get();
 }
 
 // show us the text exactly
@@ -1321,6 +1327,16 @@ void ScModelObj::initializeForTiledRendering(const 
css::uno::Sequencecommit();
+
+// if we know what theme the user wants, then we can dispatch that now 
early
+if (!sThemeName.isEmpty())
+{
+css::uno::Sequence 
aPropertyValues(comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(sThemeName) }
+}));
+comphelper::dispatchCommand(".uno:ChangeTheme", aPropertyValues);
+}
 }
 
 uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType )
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 69bdf8f8cf67..7e10b3a2a361 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -33,8 +33,10 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2575,6 +2577,8 @@ void 
SdXImpressDocument::initializeForTiledRendering(const css::uno::SequenceGetDrawView();
@@ -2586,6 +2590,8 @@ void 
SdXImpressDocument::initializeForTiledRendering(const css::uno::SequenceSetAuthor(rValue.Value.get());
 else if (rValue.Name == ".uno:SpellOnline" && 
rValue.Value.has())
 mpDoc->SetOnlineSpell(rValue.Value.get());
+else if (rValue.Name == ".uno:ChangeTheme" && 
rValue.Value.has())
+sThemeName = rValue.Value.get();
 }
 
 // Disable comments if requested
@@ -2627,6 +2633,16 @@ void 
SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence 
aPropertyValues(comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(sThemeName) }
+}));
+comphelper::dispatchCommand(".uno:ChangeTheme", aPropertyValues);
+}
 }
 
 void SdXImpressDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode)
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 1b7c933ec974..32b34017b660 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -19,6 +19,8 @@
 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -3639,6 +3641,7 @@ void SwXTextDocument::initializeForTiledRendering(const 
css::uno::SequenceGetRedlineAuthor(SW_MOD()->GetRedlineAuthor());
 OUString sAuthor;
 
@@ -3660,6 +3663,8 @@ void SwXTextDocument::initializeForTiledRendering(const 
css::uno::Sequence())
 aViewOption.SetOnlineSpell(rValue.Value.get());
+else if (rValue.Name == ".uno:ChangeTheme" && 
rValue.Value.has())
+sThemeName = rValue.Value.get();
 }
 
 if (!sAuthor.isEmpty() && sAuthor != sOrigAuthor)
@@ -3708,6 +3713,16 @@ void SwXTextDocument::initializeForTiledRendering(const 
css::uno::SequencebAFormatByInpDelSpacesAtSttEnd = false;
+
+// if we know what theme the user wants, then we can dispatch that now 
early
+if (!sThemeName.isEmpty())
+{
+css::uno::Sequence 
aPropertyValues(comphelper::InitPropertySequence(
+{
+{ "NewTheme", uno::Any(sThemeName) }
+}));
+comphelper::dispatchCommand(".uno:ChangeTheme", aPropertyValues);
+}
 }
 
 void SwXTextDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode)


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-02-16 Thread Caolán McNamara (via logerrit)
 sc/source/filter/oox/stylesbuffer.cxx |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit f170ba4c7d1764a0b0efaf3a40fcc5f20f3e060a
Author: Caolán McNamara 
AuthorDate: Fri Feb 16 16:33:29 2024 +
Commit: Michael Meeks 
CommitDate: Fri Feb 16 21:55:25 2024 +0100

for caching if a font has glyphs, strikethrough and underline don't matter

Those aren't part of the font. Likewise it's safe to assume these days
that if the glyph appears at one size it will exist at any size.

The same isn't through for Bold/Italic. A font like Freesans has,
or had at least, glyphs in one variant not in another. So don't treat
those properties the same.

Change-Id: Iccc291642dfe7e9d2cb06a241a575fd1e4a4bb9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163508
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 

diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index 2310f324e27a..e394ea476e78 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -794,9 +794,19 @@ void Font::finalizeImport()
 if( !maUsedFlags.mbNameUsed )
 return;
 
+// For caching if the font has glyphs then the underline and 
strike-through don't matter.
+// Those aren't differences in the actual font, so just zero those out for 
the cache.
+// The weight and pitch are different faces though, and there are some 
fonts with glyphs
+// missing in one or other variant.
+css::awt::FontDescriptor aGlyphDesc = maApiData.maDesc;
+aGlyphDesc.Strikeout = css::awt::FontStrikeout::NONE;
+aGlyphDesc.Underline = css::awt::FontUnderline::NONE;
+// Never seen that to be the case for font *sizes* however, so we can use 
a uniform 10pt size
+aGlyphDesc.Height = 200;
+
 bool bHasAsian(false), bHasCmplx(false), bHasLatin(false);
 FontClassificationMap& rFontClassificationCache = 
getFontClassificationCache();
-if (auto found = rFontClassificationCache.find(maApiData.maDesc); found != 
rFontClassificationCache.end())
+if (auto found = rFontClassificationCache.find(aGlyphDesc); found != 
rFontClassificationCache.end())
 {
 FontClassification eClassification = found->second;
 bHasAsian = bool(eClassification & FontClassification::Asian);
@@ -810,7 +820,7 @@ void Font::finalizeImport()
 if( !xDevice.is() )
 return;
 
-Reference< XFont2 > xFont( xDevice->getFont( maApiData.maDesc ), 
UNO_QUERY );
+Reference< XFont2 > xFont( xDevice->getFont(aGlyphDesc), UNO_QUERY );
 if( !xFont.is() )
 return;
 
@@ -851,7 +861,7 @@ void Font::finalizeImport()
 eClassification = eClassification | FontClassification::Cmplx;
 if (bHasLatin)
 eClassification = eClassification | FontClassification::Latin;
-rFontClassificationCache.emplace(maApiData.maDesc, eClassification);
+rFontClassificationCache.emplace(aGlyphDesc, eClassification);
 }
 
 lclSetFontName( maApiData.maLatinFont, maApiData.maDesc, bHasLatin );


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-02-16 Thread Caolán McNamara (via logerrit)
 sc/source/ui/view/gridwin4.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 0a3858e33ec3a21406cbf7986f149ae53202204e
Author: Caolán McNamara 
AuthorDate: Thu Feb 15 21:36:46 2024 +
Commit: Caolán McNamara 
CommitDate: Fri Feb 16 16:46:56 2024 +0100

clarify that "twipFactor" converts from pixels to 100mm

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

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 97fff9f65049..051cbc932209 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -659,6 +659,10 @@ Fraction GetZoom(const ScViewData& rViewData, int i)
 };
 return (rViewData.*GetZooms[i])();
 }
+
+// Multiplying by this is basically equivalent to o3tl::convert(foo, 
o3tl::Length::px, o3tl::Length::mm100)
+// Where there are 15 twips in an ideal pixel and 1 twip is 0.0017638889 cm
+constexpr double twipFactor = 15 * 1.7639; // 26.4585
 }
 
 void ScGridWindow::DrawContent(OutputDevice , const ScTableInfo& 
rTableInfo, ScOutputData& aOutputData,
@@ -1059,7 +1063,6 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 
 aOrigin.setY(o3tl::convert(aOrigin.getY(), o3tl::Length::twip, 
o3tl::Length::px)
  + aOutputData.nScrY);
-const double twipFactor = 15 * 1.7639; // 26.4585
 aOrigin = Point(aOrigin.getX() * twipFactor,
 aOrigin.getY() * twipFactor);
 MapMode aNew = rDevice.GetMapMode();
@@ -1155,7 +1158,6 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 rDevice.SetMapMode(aDrawMode);
 
 // keep into account the zoom factor
-static const double twipFactor = 15 * 1.7639; // 26.4585
 Point aNewOrigin((aOriginAbsPx.getX() * twipFactor) / 
static_cast(aDrawMode.GetScaleX()),
  (aOriginAbsPx.getY() * twipFactor) / 
static_cast(aDrawMode.GetScaleY()));
 


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-02-16 Thread Hubert Figuière (via logerrit)
 sc/source/ui/inc/tabvwsh.hxx   |3 
 sc/source/ui/view/tabvwsh3.cxx |  190 -
 2 files changed, 117 insertions(+), 76 deletions(-)

New commits:
commit cba33694c894ff49248cfb14c2218e4f34a35be0
Author: Hubert Figuière 
AuthorDate: Mon Feb 12 10:14:05 2024 -0500
Commit: Caolán McNamara 
CommitDate: Fri Feb 16 13:12:41 2024 +0100

calc: sheet protection dialog is async

Change-Id: I33930ae212a8b35a4430df3180f4ffcca86ff870
Signed-off-by: Hubert Figuière 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163495
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index fff123aa1bc6..b457e1167100 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -397,6 +397,9 @@ public:
 
 boolExecuteRetypePassDlg(ScPasswordHash eDesiredHash);
 
+voidFinishProtectTable();
+voidExecProtectTable( SfxRequest& rReq );
+
 using ScTabView::ShowCursor;
 
 bool IsActive() const { return bIsActive; }
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 208748b7110f..23e3eacfa901 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -170,6 +170,118 @@ namespace
 }
 }
 
+void ScTabViewShell::FinishProtectTable()
+{
+TabChanged();
+UpdateInputHandler(true);   // to immediately enable input again
+SelectionChanged();
+}
+
+void ScTabViewShell::ExecProtectTable( SfxRequest& rReq )
+{
+ScModule*   pScMod  = SC_MOD();
+const SfxItemSet*   pReqArgs= rReq.GetArgs();
+ScDocument& rDoc = GetViewData().GetDocument();
+SCTAB   nTab = GetViewData().GetTabNo();
+boolbOldProtection = rDoc.IsTabProtected(nTab);
+
+if( pReqArgs )
+{
+const SfxPoolItem* pItem;
+bool bNewProtection = !bOldProtection;
+if( pReqArgs->HasItem( FID_PROTECT_TABLE,  ) )
+bNewProtection = static_cast(pItem)->GetValue();
+if( bNewProtection == bOldProtection )
+{
+rReq.Ignore();
+return;
+}
+}
+
+if (bOldProtection)
+{
+// Unprotect a protected sheet.
+
+const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
+if (pProtect && pProtect->isProtectedWithPass())
+{
+std::shared_ptr xRequest;
+if (!pReqArgs)
+{
+xRequest = std::make_shared(rReq);
+rReq.Ignore(); // the 'old' request is not relevant any more
+}
+
+OUString aText( ScResId(SCSTR_PASSWORDOPT) );
+auto pDlg = std::make_shared(GetFrameWeld(), 
);
+pDlg->set_title(ScResId(SCSTR_UNPROTECTTAB));
+pDlg->SetMinLen(0);
+
pDlg->set_help_id(GetStaticInterface()->GetSlot(FID_PROTECT_TABLE)->GetCommand());
+pDlg->SetEditHelpId(HID_PASSWD_TABLE);
+
+pDlg->PreRun();
+
+weld::DialogController::runAsync(pDlg, [this, nTab, pDlg, 
xRequest](sal_Int32 response) {
+if (response == RET_OK)
+{
+OUString aPassword = pDlg->GetPassword();
+Unprotect(nTab, aPassword);
+}
+if (xRequest)
+{
+xRequest->AppendItem( SfxBoolItem(FID_PROTECT_TABLE, 
false) );
+xRequest->Done();
+}
+FinishProtectTable();
+});
+return;
+}
+else
+// this sheet is not password-protected.
+Unprotect(nTab, OUString());
+
+if (!pReqArgs)
+{
+rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, false) );
+rReq.Done();
+}
+}
+else
+{
+// Protect a current sheet.
+std::shared_ptr xRequest;
+if (!pReqArgs)
+{
+xRequest = std::make_shared(rReq);
+rReq.Ignore(); // the 'old' request is not relevant any more
+}
+
+auto pDlg = std::make_shared(GetFrameWeld());
+
+const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
+if (pProtect)
+pDlg->SetDialogData(*pProtect);
+weld::DialogController::runAsync(pDlg, [this, pDlg, pScMod, nTab, 
xRequest](sal_uInt32 nResult) {
+if (nResult == RET_OK)
+{
+pScMod->InputEnterHandler();
+
+ScTableProtection aNewProtect;
+pDlg->WriteData(aNewProtect);
+ProtectSheet(nTab, aNewProtect);
+if (xRequest)
+{
+xRequest->AppendItem( SfxBoolItem(FID_PROTECT_TABLE, true) 
);
+xRequest->Done();
+}
+}
+FinishProtectTable();
+});
+return;
+}
+

core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-02-15 Thread Caolán McNamara (via logerrit)
 sc/source/ui/view/gridwin4.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 6c36f5bfad2d446f87fb1de319a45a0ebc2905d0
Author: Caolán McNamara 
AuthorDate: Thu Feb 15 15:28:21 2024 +
Commit: Caolán McNamara 
CommitDate: Thu Feb 15 18:26:58 2024 +0100

kit: cell in editing mode shown with dark view bg in light view

open a calc doc in light mode (view 1) and again in another view (view
2) and toggle the second view to dark mode.

Now edit a cell in the dark mode view and in the light move view the
edited cell background is drawn as dark.

bisected this to:

commit f0adebce7a64b6c7dd57e10811cbe45767c6a540
Date:   Wed Dec 13 17:50:44 2023 +0100

lok: calc: fix for rendering issues on in place editing

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

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 4a9e92668b7e..97fff9f65049 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1116,8 +1116,11 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 Color aCellColor = pPattern->GetItem(ATTR_BACKGROUND).GetColor();
 if (aCellColor.IsTransparent())
 {
-const ScViewRenderingOptions& rViewRenderingOptions = 
pTabViewShell->GetViewRenderingData();
-aCellColor = rViewRenderingOptions.GetDocColor();
+if (ScTabViewShell* pCurrentViewShell = 
dynamic_cast(SfxViewShell::Current()))
+{
+const ScViewRenderingOptions& rViewRenderingOptions = 
pCurrentViewShell->GetViewRenderingData();
+aCellColor = rViewRenderingOptions.GetDocColor();
+}
 }
 rDevice.SetFillColor(aCellColor);
 pOtherEditView->SetBackgroundColor(aCellColor);


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-02-14 Thread Hubert Figuière (via logerrit)
 sc/source/ui/unoobj/docuno.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 3f7eb1423bdcc5d1506a87096d535d05a59fab00
Author: Hubert Figuière 
AuthorDate: Tue Feb 13 15:56:57 2024 -0500
Commit: Michael Meeks 
CommitDate: Wed Feb 14 10:16:12 2024 +0100

calc: getPartInfo() returns the sheet protected state

Change-Id: I67e2a26680895b5c76977109f4c3f9e1638a9f9e
Signed-off-by: Hubert Figuière 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163336
Tested-by: Michael Meeks 
Reviewed-by: Michael Meeks 

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index fbc33cff551d..a6de0da0cc92 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -614,6 +614,7 @@ OUString ScModelObj::getPartInfo( int nPart )
 return OUString();
 
 const bool bIsVisible = pViewData->GetDocument().IsVisible(nPart);
+const bool bIsProtected = pViewData->GetDocument().IsTabProtected(nPart);
 //FIXME: Implement IsSelected().
 const bool bIsSelected = false; 
//pViewData->GetDocument()->IsSelected(nPart);
 const bool bIsRTLLayout = pViewData->GetDocument().IsLayoutRTL(nPart);
@@ -624,6 +625,8 @@ OUString ScModelObj::getPartInfo( int nPart )
 OUString::number(static_cast(bIsSelected)) +
 "\", \"rtllayout\": \"" +
 OUString::number(static_cast(bIsRTLLayout)) +
+"\", \"protected\": \"" +
+OUString::number(static_cast(bIsProtected)) +
 "\" }";
 return aPartInfo;
 }


core.git: Branch 'distro/collabora/co-24.04' - sc/source vcl/jsdialog

2024-02-13 Thread Hubert Figuière (via logerrit)
 sc/source/ui/attrdlg/attrdlg.cxx |7 +--
 vcl/jsdialog/enabled.cxx |1 +
 2 files changed, 2 insertions(+), 6 deletions(-)

New commits:
commit 11ccb687f6739d58d5ad878aece31db330825d08
Author: Hubert Figuière 
AuthorDate: Mon Feb 12 17:32:31 2024 -0500
Commit: Michael Meeks 
CommitDate: Tue Feb 13 20:58:26 2024 +0100

sc: add back protect cell tab from cell format dialog

Also enable the tab in jsdialogs

Signed-off-by: Hubert Figuière 
Change-Id: I2c4eac029568cc0de4be5ebb6b0f4ae47f2da1a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163263
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 
(cherry picked from commit 6cda8155c66bfcd3ebda49ac8254d529629a300e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163287
Tested-by: Michael Meeks 

diff --git a/sc/source/ui/attrdlg/attrdlg.cxx b/sc/source/ui/attrdlg/attrdlg.cxx
index faa08bf3ca00..c0653ad4f1d0 100644
--- a/sc/source/ui/attrdlg/attrdlg.cxx
+++ b/sc/source/ui/attrdlg/attrdlg.cxx
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include 
-#include 
 
 ScAttrDlg::ScAttrDlg(weld::Window* pParent, const SfxItemSet* pCellAttrs)
 : SfxTabDialogController(pParent, "modules/scalc/ui/formatcellsdialog.ui",
@@ -58,11 +57,7 @@ ScAttrDlg::ScAttrDlg(weld::Window* pParent, const 
SfxItemSet* pCellAttrs)
 AddTabPage( "borders",  pFact->GetTabPageCreatorFunc( 
RID_SVXPAGE_BORDER ), nullptr );
 OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), 
"GetTabPageCreatorFunc fail!");
 AddTabPage( "background",  pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG 
), nullptr );
-
-if (!comphelper::LibreOfficeKit::isActive())
-AddTabPage( "cellprotection" ,  ScTabPageProtection::Create,
nullptr );
-else
-RemoveTabPage( "cellprotection" );
+AddTabPage( "cellprotection" ,  ScTabPageProtection::Create,nullptr );
 }
 
 ScAttrDlg::~ScAttrDlg()
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index beb12b5dd081..b04418257bff 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -97,6 +97,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 // scalc
 || rUIFile == u"modules/scalc/ui/advancedfilterdialog.ui"
 || rUIFile == u"modules/scalc/ui/analysisofvariancedialog.ui"
+|| rUIFile == u"modules/scalc/ui/cellprotectionpage.ui"
 || rUIFile == u"modules/scalc/ui/chardialog.ui"
 || rUIFile == u"modules/scalc/ui/chisquaretestdialog.ui"
 || rUIFile == u"modules/scalc/ui/colwidthdialog.ui"


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-02-13 Thread Caolán McNamara (via logerrit)
 sc/source/ui/docshell/docfunc.cxx |   24 +++-
 sc/source/ui/inc/docsh.hxx|2 +-
 sc/source/ui/inc/viewdata.hxx |3 +++
 sc/source/ui/view/tabview3.cxx|6 --
 sc/source/ui/view/viewfun3.cxx|4 ++--
 sc/source/ui/view/viewfunc.cxx|   32 +---
 6 files changed, 42 insertions(+), 29 deletions(-)

New commits:
commit 635cb75d0ef00784a1877b6b5e2f7f92ec0469be
Author: Caolán McNamara 
AuthorDate: Mon Feb 12 15:55:22 2024 +
Commit: Miklos Vajna 
CommitDate: Tue Feb 13 15:23:12 2024 +0100

pass width hint around as twips and convert to pixel at the end

reuse the device setup and twip calculation that GetOptimalColWidth uses
and convert to pixel at the end with ViewData::toPixel

Change-Id: Ie24a66dda2e642c23ae63ff915829dd910ee44dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163259
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 
(cherry picked from commit 85db2b8338392525bb138f41a3175203c703bf73)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163285
Tested-by: Miklos Vajna 

diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index 21aee819174b..565fa3c41dac 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -671,24 +671,22 @@ bool ScDocFunc::DeleteContents(
 return true;
 }
 
-tools::Long ScDocShell::GetPixelWidthHint(const ScAddress& rPos)
+tools::Long ScDocShell::GetTwipWidthHint(const ScAddress& rPos)
 {
 ScViewData* pViewData = GetViewData();
 if (!pViewData)
 return -1;
 
 ScSizeDeviceProvider aProv(this);
-OutputDevice* pDev = aProv.GetDevice(); // has pixel MapMode
-double nPPTX = aProv.GetPPTX();
-double nPPTY = aProv.GetPPTY();
+Fraction aZoomX, aZoomY;
+double nPPTX, nPPTY;
+pViewData->setupSizeDeviceProviderForColWidth(aProv, aZoomX, aZoomY, 
nPPTX, nPPTY);
 
 ScDocument& rDoc = GetDocument();
-Fraction aInvX(pViewData->GetZoomX().GetDenominator(),
-   pViewData->GetZoomX().GetNumerator());
-Fraction aInvY(pViewData->GetZoomY().GetDenominator(),
-   pViewData->GetZoomY().GetNumerator());
-return rDoc.GetNeededSize(rPos.Col(), rPos.Row(), rPos.Tab(), pDev,
-  nPPTX, nPPTY, aInvX, aInvY, true /*bWidth*/);
+tools::Long nWidth = rDoc.GetNeededSize(rPos.Col(), rPos.Row(), 
rPos.Tab(), aProv.GetDevice(),
+nPPTX, nPPTY, aZoomX, aZoomY, true 
/*bWidth*/);
+
+return (nWidth + 2) / nPPTX; // same as ScColumn::GetOptimalColWidth
 }
 
 bool ScDocFunc::DeleteCell(
@@ -739,7 +737,7 @@ bool ScDocFunc::DeleteCell(
 pDataSpans = sc::DocFuncUtil::getNonEmptyCellSpans(rDoc, rMark, rPos);
 }
 
-tools::Long nBefore(rDocShell.GetPixelWidthHint(rPos));
+tools::Long nBefore(rDocShell.GetTwipWidthHint(rPos));
 rDoc.DeleteArea(rPos.Col(), rPos.Row(), rPos.Col(), rPos.Row(), rMark, 
nFlags);
 
 if (bRecord)
@@ -854,9 +852,9 @@ bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const 
ScAddress& rPos, con
 aOldValues.push_back(aOldValue);
 }
 
-tools::Long nBefore(rDocShell.GetPixelWidthHint(rPos));
+tools::Long nBefore(rDocShell.GetTwipWidthHint(rPos));
 o_rbNumFmtSet = rDoc.SetString( rPos.Col(), rPos.Row(), rPos.Tab(), rText 
);
-tools::Long nAfter(rDocShell.GetPixelWidthHint(rPos));
+tools::Long nAfter(rDocShell.GetTwipWidthHint(rPos));
 
 if (bUndo)
 {
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index d476ce15222e..f35d8a1c9798 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -313,7 +313,7 @@ public:
 
 voidPostEditView( ScEditEngineDefaulter* pEditEngine, const 
ScAddress& rCursorPos );
 
-tools::Long GetPixelWidthHint(const ScAddress& rPos);
+tools::Long GetTwipWidthHint(const ScAddress& rPos);
 
 voidPostPaint( SCCOL nStartCol, SCROW nStartRow, SCTAB 
nStartTab,
 SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, 
PaintPartFlags nPart,
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 72386b2efa17..62231b116813 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -115,6 +115,7 @@ class ScExtDocOptions;
 class ScViewData;
 class ScMarkData;
 class ScGridWindow;
+class ScSizeDeviceProvider;
 
 class ScPositionHelper
 {
@@ -698,6 +699,8 @@ public:
 static void AddPixelsWhileBackward( tools::Long & rScrY, tools::Long 
nEndPixels,
 SCROW & rPosY, SCROW nStartRow, double 
nPPTY,
 const ScDocument * pDoc, SCTAB nTabNo );
+
+void setupSizeDeviceProviderForColWidth(ScSizeDeviceProvider& rProv, 
Fraction& rZoomX, Fraction& rZoomY, double& rPPTX, double );
 };
 
 inline 

core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-02-09 Thread Caolán McNamara (via logerrit)
 sc/source/core/data/document.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 6e916f361455807be495495822b2e42a11760132
Author: Caolán McNamara 
AuthorDate: Thu Feb 8 11:53:43 2024 +
Commit: Caolán McNamara 
CommitDate: Fri Feb 9 12:37:34 2024 +0100

calc null-deref

probably seen after a sheet was deleted

/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f259a642520]

/opt/collaboraoffice/program/../program/libsclo.so(+0x5b3db8)[0x7f25873b3db8]

/opt/collaboraoffice/program/../program/libsclo.so(+0x4964a1)[0x7f25872964a1]

this looks most likely:

005b3db0  ScTable::ContainsNotesInRange(ScRange const&) const
00496440  ScDocument::ContainsNotesInRange(ScRangeList const&) const

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

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 9b5feb687cb0..541934225036 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6901,6 +6901,8 @@ void ScDocument::GetNotesInRange( const ScRangeList& 
rRangeList, std::vectorGetNotesInRange( rRange, rNotes );
 }
 }
@@ -6919,6 +6921,8 @@ bool ScDocument::ContainsNotesInRange( const ScRangeList& 
rRangeList ) const
 const ScRange & rRange = rRangeList[i];
 for( SCTAB nTab = rRange.aStart.Tab(); nTab <= rRange.aEnd.Tab(); 
++nTab )
 {
+if (!maTabs[nTab])
+continue;
 bool bContainsNote = maTabs[nTab]->ContainsNotesInRange( rRange );
 if(bContainsNote)
 return true;


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-02-07 Thread Henry Castro (via logerrit)
 sc/source/core/data/table4.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 716a4da9ec2645515f6f956384b724ab0f9fbe5d
Author: Henry Castro 
AuthorDate: Mon Feb 5 12:29:40 2024 -0400
Commit: Caolán McNamara 
CommitDate: Wed Feb 7 12:09:14 2024 +0100

tdf#158440: do not extend transparent color

Avoid to extend the area of transparent colors.

Signed-off-by: Henry Castro 
Change-Id: Ie492e6fea2c3d8b785cfbb96fe7cfc31d87b9996
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163022
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 62b9dbb9e006..f8a03dd4c7ec 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1314,7 +1314,7 @@ void ScTable::GetBackColorArea(SCCOL& rStartCol, SCROW& 
/*rStartRow*/,
 const ScPatternAttr* pPattern = 
ColumnData(nCol).GetPattern(rEndRow + 1);
 const SvxBrushItem* pBackground = 
>GetItem(ATTR_BACKGROUND);
 if 
(!pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData().empty() ||
-pBackground != pDefBackground)
+(pBackground->GetColor() != COL_TRANSPARENT && pBackground 
!= pDefBackground))
 {
 bExtend = true;
 break;


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-01-30 Thread codewithvk (via logerrit)
 sc/source/ui/inc/viewfunc.hxx  |7 
 sc/source/ui/view/viewfunc.cxx |  402 -
 2 files changed, 246 insertions(+), 163 deletions(-)

New commits:
commit 79ff3aa89dbe85d4a648e5fa5953c172b9cd35b5
Author: codewithvk 
AuthorDate: Thu Jan 11 10:27:27 2024 +0530
Commit: Caolán McNamara 
CommitDate: Tue Jan 30 12:50:43 2024 +0100

Implement Async AutoCorrectQuery Dialogs for Formula Check in calc

Key changes include:

1. Decomposition into Four Methods: The core logic of formula processing 
`ScViewFunc::EnterData` has been divided into four distinct methods: 
`parseAndCorrectFormula`, `runAutoCorrectQueryAsync`, 
`finalizeFormulaProcessing`, and `performAutoFormatAndUpdate`. This modular 
approach improves code readability and maintainability.

2. Introduction of `FormulaProcessingContext` Struct: To manage the 
complexities of asynchronous behavior and parameter passing, a new struct 
`FormulaProcessingContext` has been introduced. It acts as a central state 
holder, ensuring parameter persistence throughout the asynchronous operations 
and avoiding scope-related errors.

3. Recursive Dependency and Loop Replacement: The methods 
`parseAndCorrectFormula` and `runAutoCorrectQueryAsync` are interdependent and 
recursively call each other. This recursive strategy effectively replaces the 
previous `do while` loop in the code, streamlining the process of formula 
correction.

4. Asynchronous Dialog Invocation: The `runAutoCorrectQueryAsync` method 
now handles the asynchronous triggering of AutoCorrectQuery dialogs. This 
change significantly improves the user experience by preventing UI freezes 
during formula processing.

Overall, this commit achieves the goal of making AutoCorrectQuery dialogs 
asynchronous while refactoring `ScViewFunc::EnterData` for better code 
structure and performance.

Signed-off-by: codewithvk 
Change-Id: If159b98d54c0eaed41789eca7913a929b1e19c1c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161906
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162741

diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index bf6a9a77269a..a49941e7052e 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -345,6 +345,10 @@ public:
 voidOnLOKInsertDeleteRow(SCROW nStartRow, tools::Long nOffset);
 voidOnLOKSetWidthOrHeight(SCCOLROW nStart, bool bWidth);
 
+boolTestFormatArea( SCCOL nCol, SCROW nRow, SCTAB nTab, bool 
bAttrChanged );
+voidDoAutoAttributes( SCCOL nCol, SCROW nRow, SCTAB nTab,
+bool bAttrChanged );
+
 // Internal helper functions
 protected:
 static void UpdateLineAttrs( ::editeng::SvxBorderLine&rLine,
@@ -372,9 +376,6 @@ private:
 sal_uInt16  GetOptimalColWidth( SCCOL nCol, SCTAB nTab, bool bFormula 
);
 
 voidStartFormatArea();
-boolTestFormatArea( SCCOL nCol, SCROW nRow, SCTAB nTab, bool 
bAttrChanged );
-voidDoAutoAttributes( SCCOL nCol, SCROW nRow, SCTAB nTab,
-bool bAttrChanged );
 
 voidMarkAndJumpToRanges(const ScRangeList& rRanges);
 voidCopyAutoSpellData( FillDir eDir, SCCOL nStartCol, SCROW 
nStartRow,
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 25633cae38f7..5d5d07b215c6 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -134,6 +134,46 @@ ScViewFunc::~ScViewFunc()
 {
 }
 
+struct FormulaProcessingContext
+{
+std::shared_ptr aPos;
+std::shared_ptr aComp;
+std::shared_ptr aModificator;
+std::shared_ptr pArr;
+std::shared_ptr pArrFirst;
+
+const EditTextObject* pData;
+ScMarkData aMark;
+ScViewFunc& rViewFunc;
+
+OUString aCorrectedFormula;
+OUString aFormula;
+OUString aString;
+
+SCCOL nCol;
+SCROW nRow;
+SCTAB nTab;
+
+bool bMatrixExpand;
+bool bNumFmtChanged;
+bool bRecord;
+
+ScViewData& GetViewData() const
+{
+return rViewFunc.GetViewData();
+}
+
+ScDocFunc& GetDocFunc() const
+{
+return GetViewData().GetDocFunc();
+}
+
+ScDocument& GetDoc() const
+{
+return GetViewData().GetDocument();
+}
+};
+
 namespace {
 
 void collectUIInformation(std::map&& aParameters, const 
OUString& rAction)
@@ -358,7 +398,7 @@ static bool lcl_AddFunction( ScAppOptions& rAppOpt, 
sal_uInt16 nOpCode )
 
 namespace HelperNotifyChanges
 {
-static void NotifyIfChangesListeners(const ScDocShell , 
ScMarkData& rMark,
+static void NotifyIfChangesListeners(const ScDocShell , const 
ScMarkData& rMark,
  

core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-01-23 Thread Caolán McNamara (via logerrit)
 sc/source/core/tool/interpr1.cxx |   17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

New commits:
commit d94a3ea01a49779b0423e764dd50e784ea75290c
Author: Caolán McNamara 
AuthorDate: Tue Jan 23 17:41:11 2024 +
Commit: Caolán McNamara 
CommitDate: Tue Jan 23 21:12:12 2024 +0100

complete filename isn't meaningful in this mode

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

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index e372228721e3..bd3157ffd562 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -65,7 +65,7 @@
 #include 
 #include 
 #include 
-
+#include 
 #include 
 #include 
 #include 
@@ -2357,15 +2357,20 @@ void ScInterpreter::ScCell()
 eConv == FormulaGrammar::CONV_XL_OOX)
 {
 // file name and table name: 
FILEPATH/[FILENAME]TABLE
-aFuncResult = rURLObj.GetPartBeforeLastName()
-+ "[" + 
rURLObj.GetLastName(INetURLObject::DecodeMechanism::Unambiguous)
-+ "]" + aTabName;
+if (!comphelper::LibreOfficeKit::isActive())
+aFuncResult = rURLObj.GetPartBeforeLastName()
+aFuncResult += "[" + 
rURLObj.GetLastName(INetURLObject::DecodeMechanism::Unambiguous) +
+   "]" + aTabName;
 }
 else
 {
 // file name and table name: 
'FILEPATH/FILENAME'#$TABLE
-aFuncResult = "'"
-+ 
rURLObj.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous)
+aFuncResult = "'";
+if (!comphelper::LibreOfficeKit::isActive())
+aFuncResult += 
rURLObj.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous);
+else
+aFuncResult += 
rURLObj.GetLastName(INetURLObject::DecodeMechanism::Unambiguous);
+aFuncResult += "'#$" + aTabName;
 + "'#$" + aTabName;
 }
 }


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-01-23 Thread Noel Grandin (via logerrit)
 sc/source/core/data/fillinfo.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 004bd92ef73260c9f88088ceee81c0de6e9b097e
Author: Noel Grandin 
AuthorDate: Tue Jan 23 11:05:31 2024 +0200
Commit: Noel Grandin 
CommitDate: Tue Jan 23 12:52:06 2024 +0100

we seem to need three extra rows in ScTableInfo

or we get lots of
   OSL_FAIL("FillInfo: Range too big" );
from initRowInfo()

regression from
commit a86c00414a43c5d87981ffae1018cb242c5e5e1d
Author: Noel Grandin 
Date:   Fri Jan 19 14:27:10 2024 +0200
cool#6893 reduce allocation in ScGridWindow::PaintTile

Change-Id: I44a925ffab756e52c49280b864a3d4190e9e9b49
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162431
Reviewed-by: Michael Meeks 
Tested-by: Jenkins CollaboraOffice 
(cherry picked from commit 3e865d91e1bb4396957b5feee3c4475838c70e8b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162388
Tested-by: Noel Grandin 
Reviewed-by: Noel Grandin 

diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index b2c0fc374b04..e9fef2c0cf08 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -1069,16 +1069,16 @@ void ScDocument::FillInfo(
 rArray.MirrorSelfX();
 }
 
-/// We seem to need to allocate two extra rows here, not sure why
+/// We seem to need to allocate three extra rows here, not sure why
 ///
 ScTableInfo::ScTableInfo(SCROW nStartRow, SCROW nEndRow)
 : mnArrCount(0)
-, mnArrCapacity(nEndRow - nStartRow + 3)
+, mnArrCapacity(nEndRow - nStartRow + 4)
 , mbPageMode(false)
 {
 assert(nStartRow >= 0);
 assert(nEndRow >= nStartRow);
-mpRowInfo.reset(new RowInfo[nEndRow - nStartRow + 3] {});
+mpRowInfo.reset(new RowInfo[nEndRow - nStartRow + 4] {});
 }
 
 ScTableInfo::~ScTableInfo()


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-01-22 Thread Caolán McNamara (via logerrit)
 sc/source/filter/inc/condformatbuffer.hxx |1 +
 sc/source/filter/oox/condformatbuffer.cxx |8 
 2 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 682e3f931180fdc5652fe89ea88f7474f6ace84c
Author: Caolán McNamara 
AuthorDate: Mon Jan 15 20:41:49 2024 +
Commit: Dennis Francis 
CommitDate: Tue Jan 23 03:50:41 2024 +0100

ofz#65809 Direct-leak

since:

commit c84a1928ea76cf175711942db9ca7bb2f0ec6f0b
Date:   Tue Oct 3 12:40:25 2023 +0530

sc: condfmt-perf: use a shared cache that...

mbReadyForFinalize gets set to true, but the mpFormat is never
set into the ScDocument, add a mbOwnsFormat to track successful
transfer of ownership.

Change-Id: I8f11c68a4253d1ad67ec96825d5036ad468562ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162136
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Dennis Francis 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162392
Reviewed-by: Caolán McNamara 
Tested-by: Dennis Francis 

diff --git a/sc/source/filter/inc/condformatbuffer.hxx 
b/sc/source/filter/inc/condformatbuffer.hxx
index 9c8896dbf22a..945a05d99e94 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -232,6 +232,7 @@ private:
 CondFormatRuleMap   maRules;/// Maps formatting rules by 
priority.
 ScConditionalFormat* mpFormat;
 boolmbReadyForFinalize;
+boolmbOwnsFormat;
 };
 
 struct ExCfRuleModel
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 649c2417f348..ebfe88ce8da6 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1095,13 +1095,14 @@ CondFormatModel::CondFormatModel() :
 CondFormat::CondFormat( const WorksheetHelper& rHelper ) :
 WorksheetHelper( rHelper ),
 mpFormat(nullptr),
-mbReadyForFinalize(false)
+mbReadyForFinalize(false),
+mbOwnsFormat(true)
 {
 }
 
 CondFormat::~CondFormat()
 {
-if (!mbReadyForFinalize && mpFormat)
+if (mbOwnsFormat)
 delete mpFormat;
 }
 
@@ -1147,12 +1148,11 @@ void CondFormat::finalizeImport()
 if (mpFormat->size() > 0)
 {
 SCTAB nTab = maModel.maRanges.GetTopLeftCorner().Tab();
+mbOwnsFormat = false; // ownership transferred to std::unique_ptr -> 
ScDocument
 sal_Int32 nIndex = 
getScDocument().AddCondFormat(std::unique_ptr(mpFormat), 
nTab);
 
 rDoc.AddCondFormatData( maModel.maRanges, nTab, nIndex );
 }
-else
-mbReadyForFinalize = false;
 }
 
 CondFormatRuleRef CondFormat::createRule()


core.git: Branch 'distro/collabora/co-24.04' - sc/source

2024-01-17 Thread Attila Szűcs (via logerrit)
 sc/source/ui/inc/content.hxx|2 ++
 sc/source/ui/navipi/content.cxx |   18 +-
 2 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit a9a578610f51f708725afa698a946b6837c0d9ef
Author: Attila Szűcs 
AuthorDate: Tue Nov 7 15:03:33 2023 +0100
Commit: Andras Timar 
CommitDate: Wed Jan 17 11:30:55 2024 +0100

SC navigator: fix changing language of contenttree

Save the actual language, when ScContentTree is created, and use
that language to localise its text.

Note: Saving language in ScContentTree::ScContentTree caused
problems, so it is better to save the language when this
tree is filled with text the first time.

In case of LOK, there can be separate views, with different
languages, that means there can be 2+ ScContentTrees, e.g. one
has text in English and the other in German.

When a new item is created that is listed in navigator, then every
ScContentTree is updated at once... but that would use the global
language, not the one what was used when the actual ScContentTree
was created.

Change-Id: I2dedf293e0ad9fb8f3cdd1090e1e1707a9f6cfa4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159077
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sc/source/ui/inc/content.hxx b/sc/source/ui/inc/content.hxx
index 2e8c6757e202..b57e49eb55f2 100644
--- a/sc/source/ui/inc/content.hxx
+++ b/sc/source/ui/inc/content.hxx
@@ -55,6 +55,8 @@ class ScContentTree
 
 o3tl::enumarray pPosList; // for the sequence
 
+std::unique_ptr m_pResLocaleForLOK; //it needed only in case 
of LOK
+
 ScDocShell* GetManualOrCurrent();
 
 voidInitRoot(ScContentId nType);
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 89d77642558a..d16f61411016 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -186,7 +186,23 @@ void ScContentTree::InitRoot( ScContentId nType )
 }
 
 auto const & aImage = aContentBmps[static_cast(nType) - 1];
-OUString aName(ScResId(SCSTR_CONTENT_ARY[static_cast(nType)]));
+
+OUString aName;
+if(comphelper::LibreOfficeKit::isActive())
+{
+//In case of LOK we may have many different ScContentTrees in 
different languages.
+//At creation time, we store what language we use, and then use it 
later too.
+//It does not work in the constructor, that is why it is here.
+if (!m_pResLocaleForLOK)
+{
+m_pResLocaleForLOK = 
std::make_unique(SC_MOD()->GetResLocale());
+}
+aName = Translate::get(SCSTR_CONTENT_ARY[static_cast(nType)], 
*m_pResLocaleForLOK);
+}
+else
+{
+aName = ScResId(SCSTR_CONTENT_ARY[static_cast(nType)]);
+}
 // back to the correct position:
 sal_uInt16 nPos = nRootType != ScContentId::ROOT ? 0 : pPosList[nType]-1;
 m_aRootNodes[nType] = m_xTreeView->make_iterator();