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

2024-05-24 Thread Henry Castro (via logerrit)
 sc/source/core/data/patattr.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit eb1064e121436df61a6fba827a8aa081022b16ca
Author: Henry Castro 
AuthorDate: Tue May 21 17:32:54 2024 -0400
Commit: Henry Castro 
CommitDate: Fri May 24 18:30:04 2024 +0200

lok: sc: fix print mode document back color

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

diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 34cfa1c52175..2de19a4d952b 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -509,7 +509,8 @@ void ScPatternAttr::fillColor(model::ComplexColor& 
rComplexColor, const SfxItemS
 if (pViewShell)
 {
 const ScViewRenderingOptions& rViewRenderingOptions = 
pViewShell->GetViewRenderingData();
-aBackColor = rViewRenderingOptions.GetDocColor();
+aBackColor = eAutoMode == SC_AUTOCOL_PRINT ? COL_WHITE 
:
+rViewRenderingOptions.GetDocColor();
 }
 }
 }


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

2024-05-21 Thread Pranam Lashkari (via logerrit)
 sc/source/core/data/table1.cxx |   27 ++-
 1 file changed, 26 insertions(+), 1 deletion(-)

New commits:
commit 6a2bb433a0367f91ac7e4867d3988a77db4b7ad6
Author: Pranam Lashkari 
AuthorDate: Tue May 21 05:56:18 2024 +0300
Commit: Pranam Lashkari 
CommitDate: Tue May 21 18:02:03 2024 +0200

sc: LOK: invalidate sheet geometry on row height changes

sometimes if undo/redeo affected row heights (i.e: undo an autofill)
sheet geometry was not updated in LOK

Change-Id: I995d23752712f6baf3c348f6fe5fb292f7c9043b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167878
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
(cherry picked from commit bb605f31f92eeeca292824931ef0e8d1db750702)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167829
Reviewed-by: Pranam Lashkari 

diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 9064c5241acf..a2a577bf4e60 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -48,6 +48,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -487,6 +488,18 @@ bool ScTable::SetOptimalHeight(
 
 mpRowHeights->enableTreeSearch(true);
 
+if (bChanged)
+{
+if (ScViewData* pViewData = ScDocShell::GetViewData())
+{
+ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
+pViewData->GetViewShell(),
+false /* bColsAffected */, true /* bRowsAffected */,
+true /* bSizes*/, false /* bHidden */, false /* bFiltered */,
+false /* bGroups */, nTab);
+}
+}
+
 return bChanged;
 }
 
@@ -508,10 +521,22 @@ void ScTable::SetOptimalHeightOnly(
 
 SetRowHeightOnlyFunc aFunc(this);
 
-SetOptimalHeightsToRows(rCxt, aFunc, pRowFlags.get(), nStartRow, nEndRow, 
true);
+bool bChanged = SetOptimalHeightsToRows(rCxt, aFunc, pRowFlags.get(), 
nStartRow, nEndRow, true);
 
 if ( pProgress != pOuterProgress )
 delete pProgress;
+
+if (bChanged)
+{
+if (ScViewData* pViewData = ScDocShell::GetViewData())
+{
+ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
+pViewData->GetViewShell(),
+false /* bColsAffected */, true /* bRowsAffected */,
+true /* bSizes*/, false /* bHidden */, false /* bFiltered */,
+false /* bGroups */, nTab);
+}
+}
 }
 
 bool ScTable::GetCellArea( SCCOL& rEndCol, SCROW& rEndRow )


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

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

New commits:
commit 6d2f14936040a60909ec0815f39b2622411bd4ee
Author: Pranam Lashkari 
AuthorDate: Fri May 10 02:02:18 2024 +0300
Commit: Pranam Lashkari 
CommitDate: Mon May 13 17:41:23 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 
(cherry picked from commit 726b133fd8c823c7f05a30c1995de26db372174d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167455
Reviewed-by: Pranam Lashkari 

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-23.05' - sc/source

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

New commits:
commit ca46dfb93b802ed4ee3210d0abc80ca37934a9e6
Author: Noel Grandin 
AuthorDate: Wed Apr 17 14:06:57 2024 +0200
Commit: Caolán McNamara 
CommitDate: Tue May 7 10:08:06 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 
(cherry picked from commit b684c805a70abd48ba1fda861b74fe2732dc988d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166899

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-23.05' - sc/source

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

New commits:
commit 6360a8e721555bf9deb6ee38829a22abe39863ab
Author: Miklos Vajna 
AuthorDate: Fri Mar 1 08:34:00 2024 +0100
Commit: Szymon Kłos 
CommitDate: Tue May 7 07:55:05 2024 +0200

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/+/167235
Tested-by: Jenkins CollaboraOffice 
Tested-by: Szymon Kłos 
Reviewed-by: Szymon Kłos 

diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index caefdfc0fed3..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)));
-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-23.05' - 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 7171c9e8f6fecedac29e89deaeb2afa4d67a2a17
Author: Pranam Lashkari 
AuthorDate: Fri Apr 26 23:51:14 2024 +0100
Commit: Szymon Kłos 
CommitDate: Mon Apr 29 19:07:31 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 
(cherry picked from commit 290d70a476bab7d100baa3568ec547633109033e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166835

diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx 
b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 126689d7bce8..f1f1224928a1 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -588,6 +588,9 @@ ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, 
const OUString& aDatNa
 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-23.05' - sc/source

2024-04-24 Thread Justin Luth (via logerrit)
 sc/source/filter/excel/xestream.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 1675c3e2f14c68873e63cb725e0dd6e4b70cb3c3
Author: Justin Luth 
AuthorDate: Thu Apr 18 17:30:06 2024 -0400
Commit: Miklos Vajna 
CommitDate: Wed Apr 24 09:11:59 2024 +0200

xlsx export: never export short-hand version of range address

If all the columns are in focus, LO was exporting
A10:XFD11 as 10:11.

Amazingly, we can't read that. Seriously?
Doesn't Microsoft ever export in shorthand?

I thought it would be helpful to find any instances
where LO is exporting shorthand, to verify that
we really do break import of round-tripped files.

I made a brief attempt at fixing the import,
but it will require lots of changes
and break lots of assumptions.
Obviously it can't be a hugely common problem
because I didn't find any bug reports about it...
I abandoned my attempt because it is too prone to disaster.

Change-Id: If59c316d0af466e5cf71ecc459bdf57bb2cd5144
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166269
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
(cherry picked from commit a29d91ac403f1ed431ca95b8b9c290bd354c3ae7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166515
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index d511c6daebe1..c856eebd5c9c 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -745,7 +745,8 @@ OString XclXmlUtils::ToOString( const ScDocument& rDoc, 
const ScRange& rRange, b
 OString XclXmlUtils::ToOString( const ScDocument& rDoc, const ScRangeList& 
rRangeList )
 {
 OUString s;
-rRangeList.Format(s, ScRefFlags::VALID, rDoc, FormulaGrammar::CONV_XL_OOX, 
' ');
+rRangeList.Format(s, ScRefFlags::VALID, rDoc, FormulaGrammar::CONV_XL_OOX, 
' ',
+  /*FullAddressNotation=*/true);
 return s.toUtf8();
 }
 


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

2024-04-22 Thread Justin Luth (via logerrit)
 sc/source/filter/excel/excrecds.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 6c82e96e849c4a312feaa6cba21093c48a0d9d46
Author: Justin Luth 
AuthorDate: Thu Apr 18 14:46:30 2024 -0400
Commit: Miklos Vajna 
CommitDate: Mon Apr 22 08:39:10 2024 +0200

xlsx export: fix corrupt file for Excel: protectedRange must have sqref

Excel refuses to open a file if there is no sqref specified

  


In this case, import failed to import sqref="10:131".

I don't see much point in trying to create a unit test for this.
(I assume protectedRange is simply round-tripped
because I doubt LO has working support for protectedRanges.)

commit 9cee6a45632623d3d7e5a574128940f96d8c926b
Author: Eike Rathke on Thu Mar 20 10:16:50 2014 +0100
added ScEnhancedProtection to ScTableProtection

Change-Id: I97ef1ee801898bdcace067d62890c4ce0e7cf1d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166265
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
Tested-by: Justin Luth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166344
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/filter/excel/excrecds.cxx 
b/sc/source/filter/excel/excrecds.cxx
index 3db3d653073c..0dfba784f97c 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -478,6 +478,9 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm 
)
 rWorksheet->startElement(XML_protectedRanges);
 for (const auto& rProt : rProts)
 {
+if (!rProt.maRangeList.is())
+continue; // Excel refuses to open if sqref is missing from a 
protectedRange
+
 SAL_WARN_IF( rProt.maSecurityDescriptorXML.isEmpty() && 
!rProt.maSecurityDescriptor.empty(),
 "sc.filter", "XclExpSheetProtection::SaveXml: losing BIFF 
security descriptor");
 rWorksheet->singleElement( XML_protectedRange,
@@ -492,7 +495,7 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm 
)
 XML_hashValue, rProt.maPasswordHash.maHashValue.isEmpty() ? 
nullptr : rProt.maPasswordHash.maHashValue.toUtf8().getStr(),
 XML_saltValue, rProt.maPasswordHash.maSaltValue.isEmpty() ? 
nullptr : rProt.maPasswordHash.maSaltValue.toUtf8().getStr(),
 XML_spinCount, rProt.maPasswordHash.mnSpinCount ? 
OString::number( rProt.maPasswordHash.mnSpinCount).getStr() : nullptr,
-XML_sqref, rProt.maRangeList.is() ? XclXmlUtils::ToOString( 
rStrm.GetRoot().GetDoc(), *rProt.maRangeList).getStr() : nullptr);
+XML_sqref, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(), 
*rProt.maRangeList).getStr());
 }
 rWorksheet->endElement( XML_protectedRanges);
 }


core.git: Branch 'distro/collabora/co-23.05' - 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 ebcca36a86ed07c388221d6e9895ef132e912d00
Author: Caolán McNamara 
AuthorDate: Mon Apr 8 22:07:11 2024 +0100
Commit: Miklos Vajna 
CommitDate: Fri Apr 12 13:35:45 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/+/165937
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index 3dcdb1a4998f..f66d53d7b1b0 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1058,7 +1058,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);
@@ -1067,7 +1067,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-23.05' - sc/source

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

New commits:
commit fc98c61cf83cac7fefdc8560ce5f1429539b1d25
Author: Caolán McNamara 
AuthorDate: Fri Apr 5 10:40:36 2024 +0100
Commit: Miklos Vajna 
CommitDate: Fri Apr 5 13:18: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 

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index e65b495993ef..3dcdb1a4998f 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -690,8 +690,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-23.05' - sc/source

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

New commits:
commit e386c96f1624bc453717c9a2457fd18664fea8d7
Author: Caolán McNamara 
AuthorDate: Wed Apr 3 14:09:53 2024 +0100
Commit: Miklos Vajna 
CommitDate: Fri Apr 5 08:57:24 2024 +0200

ofz#67815 overflowed short

Change-Id: Iee9a5caee53b522ed16d234c2bc06987264e23db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165751
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit c4f2a85bc5fa319a84474191275a2434dda1830b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165761
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index d1fcdf335a82..e65b495993ef 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -832,12 +832,12 @@ void ScHTMLLayoutParser::SetWidths()
 pWidths[nCol] = nW;
 }
 }
-for (SCCOL nCol = 1; nCol <= nColsPerRow; nCol++)
+for (int nCol = 1; nCol <= nColsPerRow; nCol++)
 {
 pOffsets[nCol] = pOffsets[nCol-1] + pWidths[nCol-1];
 }
 pLocalColOffset->clear();
-for (SCCOL nCol = 0; nCol <= nColsPerRow; nCol++)
+for (int nCol = 0; nCol <= nColsPerRow; nCol++)
 {
 MakeColNoRef( pLocalColOffset, pOffsets[nCol], 0, 0, 0 );
 }


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

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

New commits:
commit 1faaae3236ca0ab8a64be9b9216e21c53720eb32
Author: Caolán McNamara 
AuthorDate: Sat Mar 23 15:19:04 2024 +
Commit: Miklos Vajna 
CommitDate: Fri Apr 5 08:57:00 2024 +0200

ofz#67577 Integer-overflow

Change-Id: I3828bb76ab7808ac0717b33c231927730216b42b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165216
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 035f87f7ed8775c30c6f84d7d02bc72a66182c63)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165760
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index cde3c2836c6b..d1fcdf335a82 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -539,8 +539,20 @@ void ScHTMLLayoutParser::SkipLocked( ScEEParseEntry* pE, 
bool bJoin )
 // Or else this would create a wrong value at ScAddress (chance for an 
infinite loop)!
 bool bBadCol = false;
 bool bAgain;
-ScRange aRange( pE->nCol, pE->nRow, 0,
-pE->nCol + pE->nColOverlap - 1, pE->nRow + pE->nRowOverlap - 1, 0 );
+
+SCCOL nEndCol(0);
+SCROW nEndRow(0);
+bool bFail = o3tl::checked_add(pE->nCol, pE->nColOverlap - 1, 
nEndCol) ||
+ o3tl::checked_add(pE->nRow, pE->nRowOverlap - 1, 
nEndRow);
+
+if (bFail)
+{
+SAL_WARN("sc", "invalid range: " << pE->nCol << " " << pE->nColOverlap 
<<
+ " " << pE->nRow << " " << 
pE->nRowOverlap);
+return;
+}
+
+ScRange aRange(pE->nCol, pE->nRow, 0, nEndCol, nEndRow, 0);
 do
 {
 bAgain = false;


core.git: Branch 'distro/collabora/co-23.05' - 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 7a0af4a29467f2324ee477bb6d516006174fbbeb
Author: Caolán McNamara 
AuthorDate: Sat Mar 23 21:31:51 2024 +
Commit: Miklos Vajna 
CommitDate: Fri Apr 5 08:56:26 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/+/165759
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index f00e1f868bb6..cde3c2836c6b 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -725,7 +725,6 @@ sal_uInt16 ScHTMLLayoutParser::GetWidth( const 
ScEEParseEntry* pE )
 
 void ScHTMLLayoutParser::SetWidths()
 {
-SCCOL nCol;
 if ( !nTableWidth )
 nTableWidth = static_cast(aPageSize.Width());
 SCCOL nColsPerRow = nMaxCol - nColCntStart;
@@ -736,7 +735,7 @@ void ScHTMLLayoutParser::SetWidths()
 sal_uInt16 nWidth = nTableWidth / static_cast(nColsPerRow);
 sal_uInt16 nOff = nColOffsetStart;
 pLocalColOffset->clear();
-for ( nCol = 0; nCol <= nColsPerRow; ++nCol, nOff = nOff + nWidth )
+for (int nCol = 0; nCol <= nColsPerRow; ++nCol, nOff = nOff + nWidth)
 {
 MakeColNoRef( pLocalColOffset, nOff, 0, 0, 0 );
 }
@@ -766,7 +765,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 )
@@ -803,7 +802,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];
@@ -815,18 +814,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];
 }
 pLocalColOffset->clear();
-for ( nCol = 0; nCol <= nColsPerRow; nCol++ )
+for (SCCOL nCol = 0; nCol <= nColsPerRow; nCol++)
 {
 MakeColNoRef( pLocalColOffset, pOffsets[nCol], 0, 0, 0 );
 }
@@ -837,7 +836,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-23.05' - 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 d7f0ffaaae601ec514e722ff99c14d9bf6b999e5
Author: Caolán McNamara 
AuthorDate: Thu Mar 28 09:09:00 2024 +
Commit: Caolán McNamara 
CommitDate: Tue Apr 2 20:45:32 2024 +0200

ofz: negative column offset

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

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index c90cc1be4ad7..f00e1f868bb6 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -841,6 +841,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-23.05' - 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 17467f5956a13c5fcee27507ea60d15cdda473ed
Author: Caolán McNamara 
AuthorDate: Fri Mar 29 19:53:17 2024 +
Commit: Miklos Vajna 
CommitDate: Tue Apr 2 13:59:32 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/+/165481
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index 72487ec8b66e..c90cc1be4ad7 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1041,12 +1041,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-23.05' - sc/source

2024-03-25 Thread Caolán McNamara (via logerrit)
 sc/source/ui/undo/undotab.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2a8b6228468379a16970046b41c32e52b8609472
Author: Caolán McNamara 
AuthorDate: Fri Mar 1 16:24:42 2024 +
Commit: Caolán McNamara 
CommitDate: Mon Mar 25 13:22:28 2024 +0100

extractData passes ownership of buffer to caller

libreOfficeKitViewCallback doesn't free arg, so this leaks.

This trap is fixed in 24.04 onwards

Change-Id: I6a1674f3e28feb3d44ae05130e68ffb77feb9066
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164225
Tested-by: Jenkins CollaboraOffice 
Tested-by: Marco Cecchetti 
Reviewed-by: Marco Cecchetti 

diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index 7b87450fe354..fa1194c9cdc0 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -116,7 +116,7 @@ void lcl_UndoCommandResult(const ScTabViewShell* pViewShell,
 lcl_MakeJsonArray(aJson, *pOldTabs, "oldTabs");
 }
 
-pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_UNO_COMMAND_RESULT, 
aJson.extractData());
+pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_UNO_COMMAND_RESULT, 
aJson.extractAsOString().getStr());
 }
 }
 


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

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

New commits:
commit 0931b613c18e409964abe9da48552dda7d44c711
Author: Caolán McNamara 
AuthorDate: Sat Mar 23 15:40:26 2024 +
Commit: Miklos Vajna 
CommitDate: Mon Mar 25 08:55:16 2024 +0100

ofz#67540 negative offset

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

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index bb6f65c88a08..72487ec8b66e 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -835,19 +835,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-23.05' - sc/source

2024-03-25 Thread Aron Budea (via logerrit)
 sc/source/ui/view/gridwin.cxx  |2 --
 sc/source/ui/view/viewdata.cxx |   26 --
 2 files changed, 28 deletions(-)

New commits:
commit 8f695dd653031863673b099c14fa20841df2cd88
Author: Aron Budea 
AuthorDate: Mon Mar 25 14:55:29 2024 +1030
Commit: Aron Budea 
CommitDate: Mon Mar 25 08:20:41 2024 +0100

Revert "lok calc: show cell cursor on in place editing"

Causes calc/focus_spec.js to fail in COOL.
Or when clicking into formula bar, cell takes back focus.

This reverts commit cc88ad715f80b13efb29744673d044df9c16550c.

Change-Id: I9b43c5893a721fc4c42bf1e5f2ef0f514c127ee5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165263
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Aron Budea 

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index fbb6bceb0e5c..3cf47209647c 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -6107,8 +6107,6 @@ 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");
 SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_CELL_VIEW_CURSOR, 
"rectangle", "EMPTY");
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index c7bd25aabb51..c2ec647d203b 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -71,7 +71,6 @@
 
 #include 
 #include 
-#include 
 
 using namespace com::sun::star;
 
@@ -1519,22 +1518,6 @@ 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 )
@@ -1650,9 +1633,6 @@ 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
@@ -2141,9 +2121,6 @@ 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,
@@ -2257,9 +2234,6 @@ 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-23.05' - sc/source

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

New commits:
commit a6bc0272607590d1692db385be7f6fbfeb1a8fb4
Author: Marco Cecchetti 
AuthorDate: Mon Mar 11 22:21:13 2024 +0100
Commit: Tomaž Vajngerl 
CommitDate: Wed Mar 13 14:06:47 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 

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 9df5b7d8a2b6..c7bd25aabb51 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1752,7 +1752,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-23.05' - sc/source

2024-03-13 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 cc88ad715f80b13efb29744673d044df9c16550c
Author: Marco Cecchetti 
AuthorDate: Fri Feb 9 19:04:33 2024 +0100
Commit: Tomaž Vajngerl 
CommitDate: Wed Mar 13 14:06:04 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 

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 3cf47209647c..fbb6bceb0e5c 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -6107,6 +6107,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");
 SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_CELL_VIEW_CURSOR, 
"rectangle", "EMPTY");
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 130e12d2d080..9df5b7d8a2b6 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;
 
@@ -1518,6 +1519,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 )
@@ -1633,6 +1650,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
@@ -2119,6 +2139,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,
@@ -2232,6 +2255,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-23.05' - 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 c944a84a6f37140f2a800d58f8a6a339c66db1d3
Author: Mike Kaganski 
AuthorDate: Tue Mar 12 14:16:14 2024 +0100
Commit: Miklos Vajna 
CommitDate: Wed Mar 13 09:59:36 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/+/164731
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 b456f9ea1ab6..667abb4236c2 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-23.05' - sc/source

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

New commits:
commit 3980cd484b00737d2e954bc16a7df31c42481bf5
Author: Julien Nabet 
AuthorDate: Mon Mar 4 13:21:06 2024 +0100
Commit: Miklos Vajna 
CommitDate: Tue Mar 12 08:35:48 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 
(cherry picked from commit 18db9d334e1cafddeef53ddff435d6c059aaf803)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164676

diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 388a51758295..b261d8057e05 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-23.05' - sc/source

2024-03-07 Thread Mike Kaganski (via logerrit)
 sc/source/ui/app/inputhdl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a0ac242e3c93cbf57c3cb22f97140133a624b3f0
Author: Mike Kaganski 
AuthorDate: Wed Feb 28 17:47:04 2024 +0600
Commit: Miklos Vajna 
CommitDate: Fri Mar 8 08:38:29 2024 +0100

tdf#159938: only apply wrap when the content was modified

Change-Id: I2f18739239401085a06bbdce6623a484c13d680b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164091
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit f0d8f72eb3447b705d1dcdc35a6f3c66a880ab7e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164110
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 48b0fa6b6296..ba13af9a70ea 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -3164,7 +3164,7 @@ void ScInputHandler::EnterHandler( ScEnterMode 
nBlockMode, bool bBeforeSavingInL
 lcl_RemoveTabs(aString);
 lcl_RemoveTabs(aPreAutoCorrectString);
 
-if (aString.indexOf('
') != -1)
+if (bModified && aString.indexOf('
') != -1)
 {
 // Cell contains line breaks, enable wrapping
 ScLineBreakCell aBreakItem(true);


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

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

New commits:
commit 46211c06f51f37eeaa61407c1e7681aeb7a9514f
Author: Marco Cecchetti 
AuthorDate: Thu Feb 29 16:09:14 2024 +0100
Commit: Caolán McNamara 
CommitDate: Thu Feb 29 21:18:44 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 

diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index a33be3301231..7b87450fe354 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.extractData());
+}
 }
 
 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-23.05' - 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 d6b18dc269625dede7c739770984cbe78c41d9a2
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:25 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/+/164093
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164150
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 47416cf3c361..48b0fa6b6296 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 
@@ -1298,7 +1299,13 @@ void ScInputHandler::ShowArgumentsTip( OUString& 
rSelText )
 
 const SfxViewShell* pViewShell = 
SfxViewShell::Current();
 if (comphelper::LibreOfficeKit::isActive() && 
pViewShell->isLOKDesktop())
-
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TOOLTIP, 
aNew.toUtf8().getStr());
+{
+tools::JsonWriter writer;
+writer.put("type", "formulausage");
+writer.put("text", aNew);
+OString sFunctionUsageTip = 
writer.extractAsOString();
+
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TOOLTIP, 
sFunctionUsageTip.getStr());
+}
 }
 }
 }
diff --git a/sw/source/uibase/docvw/edtwin2.cxx 
b/sw/source/uibase/docvw/edtwin2.cxx
index ec3b76324e79..f985e0483911 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -114,6 +114,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-23.05' - 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 83de0e875aec38000f427134950a49aefb9fa865
Author: Caolán McNamara 
AuthorDate: Wed Feb 28 12:04:28 2024 +
Commit: Caolán McNamara 
CommitDate: Wed Feb 28 17:13:16 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/+/164092
Reviewed-by: Szymon Kłos 
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 97b382d50349..d487afb9db03 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1541,9 +1541,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-23.05' - 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 73d3ee33f80c8e46a7002ec538eef23a69842135
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:35:22 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/+/163979
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 aede676ebdde..c03d36aab311 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -4451,7 +4451,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-23.05' - sc/source

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

New commits:
commit 41237d2910ef4a77387471affc3472300bc10836
Author: Szymon Kłos 
AuthorDate: Mon Feb 26 15:39:30 2024 +0100
Commit: Szymon Kłos 
CommitDate: Mon Feb 26 16:38:55 2024 +0100

lok: don't hide tooltim 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 

diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 2ff01b9f83e3..b83cbd27a31c 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-23.05' - sc/source

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

New commits:
commit c48151369f04c4f01dceb0ca31cf23287aa8d676
Author: Gülşah Köse 
AuthorDate: Mon Feb 19 16:00:25 2024 +0300
Commit: Gülşah Köse 
CommitDate: Fri Feb 23 11:29:03 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/+/163594
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 1f5ae2869c6e..aede676ebdde 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1113,6 +1113,12 @@ void ScInputHandler::HideTip()
 pTipVisibleParent = nullptr;
 }
 aManualTip.clear();
+
+const SfxViewShell* pViewShell = SfxViewShell::Current();
+if (comphelper::LibreOfficeKit::isActive() && pViewShell) {
+OUString sHideMsg = "hidetip";
+
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CALC_FUNCTION_LIST, 
sHideMsg.toUtf8().getStr());
+}
 }
 void ScInputHandler::HideTipBelow()
 {
@@ -1138,11 +1144,6 @@ bool lcl_hasSingleToken(std::u16string_view s, 
sal_Unicode c)
 
 void ScInputHandler::ShowArgumentsTip( OUString& rSelText )
 {
-if (comphelper::LibreOfficeKit::isActive())
-{
-return;
-}
-
 if ( !pActiveViewSh )
 return;
 
@@ -1286,6 +1287,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().getStr());
 }
 }
 }
@@ -1434,7 +1439,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);
@@ -1488,7 +1493,6 @@ void ScInputHandler::ShowFuncList( const ::std::vector< 
OUString > & rFuncStrVec
 OString s = aPayload.makeStringAndClear();
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CALC_FUNCTION_LIST, 
s.getStr());
 }
-// not tunnel tooltips in the lok case
 return;
 }
 


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

2024-02-22 Thread Stephan Bergmann (via logerrit)
 sc/source/core/tool/scmatrix.cxx |7 +++
 svl/source/misc/gridprinter.cxx  |7 +++
 sw/source/core/doc/doc.cxx   |   10 ++
 3 files changed, 24 insertions(+)

New commits:
commit 5d0e1414295d59605e17a1194bde43b46acd5d71
Author: Stephan Bergmann 
AuthorDate: Wed Aug 2 10:48:31 2023 +0200
Commit: Andras Timar 
CommitDate: Thu Feb 22 09:51:44 2024 +0100

Silence some bogus -Werror=array-bounds etc. with GCC 12 and -std=c++20

...as witnessed with patch set 1 of
 "Bump baseline to C++20",

> In file included from 
/opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/char_traits.h:46,
>  from 
/opt/rh/gcc-toolset-12/root/usr/include/c++/12/ios:40,
>  from 
/opt/rh/gcc-toolset-12/root/usr/include/c++/12/ostream:38,
>  from 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/include/rtl/ustring.hxx:34,
>  from 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/include/svl/gridprinter.hxx:13,
>  from 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/svl/source/misc/gridprinter.cxx:10:
> In function ‘constexpr decltype (::new(void*(0)) _Tp) 
std::construct_at(_Tp*, _Args&& ...) [with _Tp = long unsigned int; _Args = 
{const long unsigned int&}]’,
> inlined from ‘static constexpr void 
std::allocator_traits >::construct(allocator_type&, 
_Up*, _Args&& ...) [with _Up = long unsigned int; _Args = {const long unsigned 
int&}; _Tp = long unsigned int]’ at 
/opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/alloc_traits.h:518:21,
> inlined from ‘constexpr void std::vector<_Tp, 
_Alloc>::_M_realloc_insert(iterator, _Args&& ...) [with _Args = {const long 
unsigned int&}; _Tp = long unsigned int; _Alloc = std::allocator]’ at /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/vector.tcc:462:28,
> inlined from ‘constexpr void std::vector<_Tp, 
_Alloc>::push_back(const value_type&) [with _Tp = long unsigned int; _Alloc = 
std::allocator]’ at 
/opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/stl_vector.h:1287:21,
> inlined from ‘mdds::mtv::soa::multi_type_vector::iterator 
mdds::mtv::soa::multi_type_vector::set_cell_to_empty_block(size_type, 
size_type, const T&) [with T = rtl::OUString; Traits = 
mdds::multi_type_matrix::mtv_trait]’ at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/./multi_type_vector/soa/main_def.inl:2995:50,
> inlined from ‘mdds::mtv::soa::multi_type_vector::iterator 
mdds::mtv::soa::multi_type_vector::set_impl(size_type, size_type, const 
T&) [with T = rtl::OUString; Traits = 
mdds::multi_type_matrix::mtv_trait]’ at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/./multi_type_vector/soa/main_def.inl:1240:72,
> inlined from ‘mdds::mtv::soa::multi_type_vector::iterator 
mdds::mtv::soa::multi_type_vector::set(size_type, const T&) [with T = 
rtl::OUString; Traits = 
mdds::multi_type_matrix::mtv_trait]’ at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/./multi_type_vector/soa/main_def.inl:696:14,
> inlined from ‘void mdds::multi_type_matrix::set(size_type, 
size_type, const string_type&) [with Traits = svl::{anonymous}::matrix_traits]’ 
at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/multi_type_matrix_def.inl:356:5,
> inlined from ‘void svl::GridPrinter::set(size_t, size_t, const 
rtl::OUString&)’ at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/svl/source/misc/gridprinter.cxx:68:25:
> 
/opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/stl_construct.h:97:14: 
error: array subscript 0 is outside array bounds of ‘long unsigned int [0]’ 
[-Werror=array-bounds]
>97 | { return ::new((void*)__location) 
_Tp(std::forward<_Args>(__args)...); }
>   |  
^~~~

(), etc.

(The curly braces in sw/source/core/doc/doc.cxx had to be added to avoid an
ensuing bogus

> sw/source/core/doc/doc.cxx: In static member function ‘static void 
SwDoc::CalculatePagePairsForProspectPrinting(const SwRootFrame&, SwRenderData&, 
const SwPrintUIOptions&, sal_Int32)’:
> sw/source/core/doc/doc.cxx:1000:5: error: ‘else’ without a previous ‘if’
>  1000 | else
>   | ^~~~

)

Change-Id: I902f6d74d897b9bf281dc9c821aff30e7e72582a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155215
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sc/source/core/tool/scmatrix.cxx 

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

2024-02-18 Thread Noel Grandin (via logerrit)
 sc/source/filter/rtf/rtfparse.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 89cee35bac240a855a6f02a022e962bc0533554a
Author: Noel Grandin 
AuthorDate: Fri Feb 16 19:31:57 2024 +0200
Commit: Aron Budea 
CommitDate: Sun Feb 18 14:03:41 2024 +0100

tdf#101313 Copy-paste table from writer to calc

With Merged Cells from Writer to Calc,
Cells Placed in Wrong Position (Wrong cell offsets).

regression from
commit ed24564ce11683731b820c29d5a46e073ab7a2a7
Author: Noel Grandin 
Date:   Thu Jul 19 15:22:31 2012 +0200
SV_DECL_VARARR_SORT(ScRTFColTwips) o3tl::sorted_vector

Change-Id: I8c90c19f6a27a368fd5807b3eaab84ce820e26e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163518
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 4df426e429e1aed92f074d8acd3ba3a5ec335ba9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163533
(cherry picked from commit 034f6c29c309561e75719142c305245ac19f7ba9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163537
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Aron Budea 

diff --git a/sc/source/filter/rtf/rtfparse.cxx 
b/sc/source/filter/rtf/rtfparse.cxx
index b2d2b8c2521f..0617a86c62b1 100644
--- a/sc/source/filter/rtf/rtfparse.cxx
+++ b/sc/source/filter/rtf/rtfparse.cxx
@@ -101,8 +101,8 @@ inline void ScRTFParser::NextRow()
 
 bool ScRTFParser::SeekTwips( sal_uInt16 nTwips, SCCOL* pCol )
 {
-ScRTFColTwips::const_iterator it = aColTwips.find( nTwips );
-bool bFound = it != aColTwips.end();
+ScRTFColTwips::const_iterator it = aColTwips.lower_bound( nTwips );
+bool bFound = it != aColTwips.end() && *it == nTwips;
 sal_uInt16 nPos = it - aColTwips.begin();
 *pCol = static_cast(nPos);
 if ( bFound )


core.git: Branch 'distro/collabora/co-23.05' - 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 dd89169a16011a389190cff03f82da0d5f26a46c
Author: Caolán McNamara 
AuthorDate: Fri Feb 16 16:33:29 2024 +
Commit: Michael Meeks 
CommitDate: Fri Feb 16 21:52:48 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/+/163516
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 e38b5cd13002..dab5c2de145f 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -793,9 +793,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);
@@ -809,7 +819,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;
 
@@ -850,7 +860,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-23.05' - 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 74f477d8aa8af7d8b95e28a43c34f78befa09388
Author: Caolán McNamara 
AuthorDate: Thu Feb 15 21:36:46 2024 +
Commit: Miklos Vajna 
CommitDate: Fri Feb 16 16:46:17 2024 +0100

clarify that "twipFactor" converts from pixels to 100mm

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

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 1feb6bbff42a..0243b92a0a53 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,
@@ -1056,7 +1060,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();
@@ -1152,7 +1155,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 = Point((aOriginAbsPx.getX() * twipFactor) / 
static_cast(aDrawMode.GetScaleX()),
  (aOriginAbsPx.getY() * twipFactor) / 
static_cast(aDrawMode.GetScaleY()));
 


core.git: Branch 'distro/collabora/co-23.05' - 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 9f793970fd091d215d11fcfe2098b7a2792d57f0
Author: Hubert Figuière 
AuthorDate: Mon Feb 12 10:14:05 2024 -0500
Commit: Caolán McNamara 
CommitDate: Fri Feb 16 12:33:31 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/+/163387
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 734906e50176..aaf51915609b 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -395,6 +395,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 fe36ab3a5528..2ea10a592f1b 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -169,6 +169,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();
+

core.git: Branch 'distro/collabora/co-23.05' - 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 c55d3c857e35554f44c30d7e8bd7514dd6ad681f
Author: Caolán McNamara 
AuthorDate: Thu Feb 15 15:28:21 2024 +
Commit: Caolán McNamara 
CommitDate: Thu Feb 15 17:48:30 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/+/163446
Reviewed-by: Marco Cecchetti 
Tested-by: Marco Cecchetti 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 892ac654c477..1feb6bbff42a 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1113,8 +1113,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-23.05' - 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 db963d695dae5f9d4e3825a896f41bbdf9484bb2
Author: Hubert Figuière 
AuthorDate: Tue Feb 13 15:56:57 2024 -0500
Commit: Andras Timar 
CommitDate: Wed Feb 14 09:51:09 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/+/163325
Reviewed-by: Michael Meeks 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index cb13801b7b1e..832b2015c2b2 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -613,6 +613,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);
@@ -623,6 +624,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-23.05' - 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 eb6674aa7899e7b9542bcc9e1ca5cb5c4dfee843
Author: Hubert Figuière 
AuthorDate: Mon Feb 12 17:32:31 2024 -0500
Commit: Michael Meeks 
CommitDate: Tue Feb 13 10:51:32 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 

diff --git a/sc/source/ui/attrdlg/attrdlg.cxx b/sc/source/ui/attrdlg/attrdlg.cxx
index 1b2802c32461..3f307adddeb4 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-23.05' - sc/source

2024-02-12 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 85db2b8338392525bb138f41a3175203c703bf73
Author: Caolán McNamara 
AuthorDate: Mon Feb 12 15:55:22 2024 +
Commit: Miklos Vajna 
CommitDate: Tue Feb 13 08:16:08 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 

diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index 750fa3e01b18..71bb31545df4 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 b4a016d8fd68..be8f551fcab0 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -315,7 +315,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 abe93954f774..b5265299462a 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
 {
@@ -696,6 +697,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 tools::Long ScViewData::ToPixel( sal_uInt16 nTwips, double nFactor )
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 

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

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

New commits:
commit 45acfd71f033791b2d395d1958d6a5780b1696b6
Author: Caolán McNamara 
AuthorDate: Thu Feb 8 11:53:43 2024 +
Commit: Miklos Vajna 
CommitDate: Fri Feb 9 08:14:01 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/+/163116
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index aee46bad2ecc..40ab181626f7 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -7068,6 +7068,8 @@ void ScDocument::GetNotesInRange( const ScRangeList& 
rRangeList, std::vectorGetNotesInRange( rRange, rNotes );
 }
 }
@@ -7085,6 +7087,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-23.05' - 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 ee745444c6f88df8978b228c177670b1e358da67
Author: Henry Castro 
AuthorDate: Mon Feb 5 12:29:40 2024 -0400
Commit: Caolán McNamara 
CommitDate: Wed Feb 7 11:44:29 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/+/163030
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 3ec8dc5aeab7..a9637584f7df 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-23.05' - sc/source

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

New commits:
commit e0a1bf062cfe031a8ac9eba72e09a844353629f8
Author: Marco Cecchetti 
AuthorDate: Thu Feb 1 22:45:42 2024 +0100
Commit: Tomaž Vajngerl 
CommitDate: Fri Feb 2 06:36:48 2024 +0100

lok: calc: missing invalidation of position on undo a drag and drop

When undo/redo a drag and drop of a block of cells cached position was
not invalidated.

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

diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 2a92d87361fc..52e55973f345 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1350,6 +1350,13 @@ void ScUndoDragDrop::DoUndo( ScRange aRange )
 pDocShell->UpdatePaintExt(mnPaintExtFlags, aPaintRange);
 maPaintRanges.Join(aPaintRange);
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+ScTabViewShell* pTabViewShell = ScTabViewShell::GetActiveViewShell();
+pTabViewShell->OnLOKSetWidthOrHeight(aPaintRange.aStart.Col(), true);
+pTabViewShell->OnLOKSetWidthOrHeight(aPaintRange.aStart.Row(), false);
+}
+
 ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
 ScTabViewShell::GetActiveViewShell(),
 true /* bColumns */, true /* bRows */,
@@ -1505,6 +1512,18 @@ void ScUndoDragDrop::Redo()
 
 if (comphelper::LibreOfficeKit::isActive())
 {
+SCCOL nStartCol = aDestRange.aStart.Col();
+SCROW nStartRow = aDestRange.aStart.Row();
+if (bCut)
+{
+nStartCol = std::min(nStartCol, aSrcRange.aStart.Col());
+nStartRow = std::min(nStartRow, aSrcRange.aStart.Row());
+}
+
+ScTabViewShell* pTabViewShell = ScTabViewShell::GetActiveViewShell();
+pTabViewShell->OnLOKSetWidthOrHeight(nStartCol, true);
+pTabViewShell->OnLOKSetWidthOrHeight(nStartRow, false);
+
 SCTAB nStartTab = aDestRange.aStart.Tab();
 SCTAB nEndTab = aDestRange.aEnd.Tab();
 if (bCut)


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

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

New commits:
commit eb9bdb19a619b747b7ca64bb017a7409c7b84056
Author: codewithvk 
AuthorDate: Thu Jan 11 10:27:27 2024 +0530
Commit: Caolán McNamara 
CommitDate: Tue Jan 30 11:23:21 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 

diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index b5b4ffec6b75..4bcdcaab0b6f 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 bc27224324a8..503c96d29db1 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -113,6 +113,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)
@@ -337,7 +377,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,
  SCCOL nCol, SCROW nRow, const 
OUString& rType 

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

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

New commits:
commit 7556f924bc270497abe24f2e194fcc458b255781
Author: Marco Cecchetti 
AuthorDate: Tue Jan 23 17:34:20 2024 +0100
Commit: Marco Cecchetti 
CommitDate: Thu Jan 25 13:55:21 2024 +0100

lok: calc: rtl - misplaced caret

This is a workaround since text cursor is horizontally a few pixels
misplaced wrt text in the RTL case.
This issue is a regression from
https://gerrit.libreoffice.org/c/core/+/162196

Change-Id: Ia06ee223d01a7df8841bfaca3cad32af896871d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162563
Reviewed-by: Henry Castro 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 368d92320df0..63d279dd57d2 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1194,12 +1194,14 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 // same zoom level as view used for painting
 aNewOutputArea = rDevice.LogicToPixel(aOrigOutputAreaTw);
 }
+// a small workaround for getting text position matching 
cursor position horizontally.
+const tools::Long nCursorGapPx = 2;
 // Transform the cell range X coordinates such that the edit 
cell area is
 // horizontally mirrored w.r.t the (combined-)tile.
 aNewOutputArea = tools::Rectangle(
 pLokRTLCtxt->docToTilePos(aNewOutputArea.Left() - 
aOriginAbsPx.X()) + aOriginAbsPx.X(),
 aNewOutputArea.Top(),
-pLokRTLCtxt->docToTilePos(aNewOutputArea.Right() - 
aOriginAbsPx.X()) + aOriginAbsPx.X(),
+pLokRTLCtxt->docToTilePos(aNewOutputArea.Right() - 
aOriginAbsPx.X()) + aOriginAbsPx.X() + nCursorGapPx,
 aNewOutputArea.Bottom());
 aNewOutputArea.Normalize();
 }


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

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

New commits:
commit f245e2548be0ce8adcd71b5aa77dec50538997e0
Author: Caolán McNamara 
AuthorDate: Tue Jan 23 17:41:11 2024 +
Commit: Caolán McNamara 
CommitDate: Tue Jan 23 20:29:10 2024 +0100

complete filename isn't meaningful in this mode

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

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index d2b171dd76bb..3520872d7846 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -64,7 +64,7 @@
 #include 
 #include 
 #include 
-
+#include 
 #include 
 #include 
 #include 
@@ -2346,9 +2346,12 @@ void ScInterpreter::ScCell()
 const INetURLObject& rURLObj = 
pShell->GetMedium()->GetURLObject();
 OUString aTabName;
 mrDoc.GetName( nTab, aTabName );
-aFuncResult = "'"
-+ 
rURLObj.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous)
-+ "'#$" + aTabName;
+aFuncResult = "'";
+if (!comphelper::LibreOfficeKit::isActive())
+aFuncResult += 
rURLObj.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous);
+else
+aFuncResult += 
rURLObj.GetLastName(INetURLObject::DecodeMechanism::Unambiguous);
+aFuncResult += "'#$" + aTabName;
 }
 }
 }


core.git: Branch 'distro/collabora/co-23.05' - 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 f8d0fb5968f78b363dafe5a5b2f96cc98cd9dfe6
Author: Noel Grandin 
AuthorDate: Tue Jan 23 11:05:31 2024 +0200
Commit: Noel Grandin 
CommitDate: Tue Jan 23 11:03:45 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 

diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 193211b1f3ec..d53637456af1 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -1049,16 +1049,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-23.05' - sc/source

2024-01-23 Thread Marco Cecchetti (via logerrit)
 sc/source/ui/unoobj/docuno.cxx |7 ---
 sc/source/ui/view/tabview.cxx  |   10 ++
 sc/source/ui/view/tabview3.cxx |   13 +
 3 files changed, 23 insertions(+), 7 deletions(-)

New commits:
commit c146f376dec93a4e83a8b434af4f3d39f82b8e44
Author: Marco Cecchetti 
AuthorDate: Mon Jan 22 16:43:11 2024 +0100
Commit: Szymon Kłos 
CommitDate: Tue Jan 23 09:41:02 2024 +0100

lok: calc: GridWindow size not updated for some view

The grid window size was updated for the view used for painting and
not for other views with the same zoom level. In fact the grid window
size was updated in ScModelObj::paintTile only. Now the required
updating is performed in lcl_ExtendTiledDimension and
ScTabView::SetCursor, too.
In order to get this working it has been neede to revert changes in
`ScModelObj::setClientVisibleArea` introduced by
https://gerrit.libreoffice.org/c/core/+/161907

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

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 6b4b8b9734f0..cb13801b7b1e 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1169,13 +1169,6 @@ void ScModelObj::setClientVisibleArea(const 
tools::Rectangle& rRectangle)
 if (pTabView)
 pTabView->extendTiledAreaIfNeeded();
 }
-
-// Set the GridWindow size to the client area size, so that the logic in 
GridWindow works correctly
-// for the current view and doesn't cause any unexpected behaviour related 
to window size and checks if we are
-// outside of the window.
-
-ScGridWindow* pGridWindow = pViewData->GetActiveWin();
-pGridWindow->SetOutputSizePixel(Size(rRectangle.GetWidth() * 
pViewData->GetPPTX(), rRectangle.GetHeight() * pViewData->GetPPTY()));
 }
 
 void ScModelObj::setOutlineState(bool bColumn, int nLevel, int nIndex, bool 
bHidden)
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 2dcc360a8bef..05e08345075a 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2678,6 +2678,16 @@ void lcl_ExtendTiledDimension(bool bColumn, const 
SCCOLROW nEnd, const SCCOLROW
 if (!pDocSh)
 return;
 
+if (pModelObj)
+{
+ScGridWindow* pGridWindow = rViewData.GetActiveWin();
+if (pGridWindow)
+{
+Size aNewSizePx(aNewSize.Width() * rViewData.GetPPTX(), 
aNewSize.Height() * rViewData.GetPPTY());
+pGridWindow->SetOutputSizePixel(aNewSizePx);
+}
+}
+
 // New area extended to the right/bottom of the sheet after last col/row
 // excluding overlapping area with aNewArea
 tools::Rectangle aNewArea = bColumn ?
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index db171a96e3b1..f30de4e3d121 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -418,9 +418,22 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool 
bNew )
 if (pModelObj)
 aNewSize = pModelObj->getDocumentSize();
 
+if (aOldSize == aNewSize)
+return;
+
 if (!pDocSh)
 return;
 
+if (pModelObj)
+{
+ScGridWindow* pGridWindow = aViewData.GetActiveWin();
+if (pGridWindow)
+{
+Size aNewSizePx(aNewSize.Width() * aViewData.GetPPTX(), 
aNewSize.Height() * aViewData.GetPPTY());
+pGridWindow->SetOutputSizePixel(aNewSizePx);
+}
+}
+
 // New area extended to the right of the sheet after last column
 // including overlapping area with aNewRowArea
 tools::Rectangle aNewColArea(aOldSize.getWidth(), 0, aNewSize.getWidth(), 
aNewSize.getHeight());


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

2024-01-17 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 04918259b55f97c338e95bf9a28f0279ef2168ae
Author: Caolán McNamara 
AuthorDate: Mon Jan 15 20:41:49 2024 +
Commit: Dennis Francis 
CommitDate: Wed Jan 17 13:48:27 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 

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 b9f7bceec0e9..b065d96f00b7 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-23.05' - sc/source

2024-01-16 Thread Gökay Şatır (via logerrit)
 sc/source/ui/unoobj/docuno.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 322669725b771f5fa2b3c10c5fb73238ca3713f6
Author: Gökay Şatır 
AuthorDate: Tue Jan 16 18:22:12 2024 +0300
Commit: Szymon Kłos 
CommitDate: Tue Jan 16 18:40:09 2024 +0100

Readonly Hyperlink Info - normalize the clicked coordinates.

So the Online side can send the info in twips.

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

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 593ff4bba5a6..75f869ea9a53 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -898,7 +898,7 @@ OUString ScModelObj::hyperlinkInfoAtPosition(int x, int y)
 ScGridWindow* pGridWindow = pViewData->GetActiveWin();
 if (pGridWindow)
 {
-const Point point(x, y);
+const Point point(x * pViewData->GetPPTX(), y * 
pViewData->GetPPTY());
 OUString name;
 OUString url;
 pGridWindow->GetEditUrl(point, , );


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

2024-01-16 Thread Gökay Şatır (via logerrit)
 sc/source/ui/inc/gridwin.hxx   |5 ++---
 sc/source/ui/unoobj/docuno.cxx |   16 ++--
 2 files changed, 16 insertions(+), 5 deletions(-)

New commits:
commit be01dd78c47b51b19603a6259504e29b11979b0b
Author: Gökay Şatır 
AuthorDate: Mon Jan 15 17:17:33 2024 +0300
Commit: Miklos Vajna 
CommitDate: Tue Jan 16 09:01:35 2024 +0100

Implement hyperlinkInfoAtPosition function for Calc.

Move getEditURL function to public.
When in readonly mode, we need a way to get the hyperlink info (if any) 
when user
clicks on a certain coordinate.

Signed-off-by: Gökay Şatır 
Change-Id: I2329b3569cfdca91f64cbdb46f43a3a9c34706c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162111
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 8d5dcc08696f..773cb3a1eac3 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -291,9 +291,6 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public 
vcl::DocWindow, public DropTarget
 voidDrawHiddenIndicator( SCCOL nX1, SCROW nY1, SCCOL nX2, 
SCROW nY2, vcl::RenderContext& rRenderContext);
 voidDrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW 
nY2, vcl::RenderContext& rRenderContext);
 
-boolGetEditUrl( const Point& rPos,
-OUString* pName=nullptr, OUString* 
pUrl=nullptr, OUString* pTarget=nullptr );
-
 boolHitRangeFinder( const Point& rMouse, RfCorner& rCorner, 
sal_uInt16* pIndex,
 SCCOL* pAddX, SCROW* pAddY );
 
@@ -390,6 +387,8 @@ public:
 /// Get the cell selection, coordinates are in logic units.
 void GetCellSelection(std::vector& rLogicRects);
 
+bool GetEditUrl( const Point& rPos, OUString* pName=nullptr, OUString* 
pUrl=nullptr, OUString* pTarget=nullptr );
+
 virtual css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessible() override;
 
 voidFakeButtonUp();
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 83db29153bca..593ff4bba5a6 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -891,9 +891,21 @@ void ScModelObj::setTextSelection(int nType, int nX, int 
nY)
 }
 }
 
-OUString ScModelObj::hyperlinkInfoAtPosition(int /*x*/, int /*y*/)
+OUString ScModelObj::hyperlinkInfoAtPosition(int x, int y)
 {
-// To be implemented..
+if (ScViewData* pViewData = ScDocShell::GetViewData())
+{
+ScGridWindow* pGridWindow = pViewData->GetActiveWin();
+if (pGridWindow)
+{
+const Point point(x, y);
+OUString name;
+OUString url;
+pGridWindow->GetEditUrl(point, , );
+return url;
+}
+}
+
 return OUString();
 }
 


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

2024-01-11 Thread Tomaž Vajngerl (via logerrit)
 sc/source/ui/view/gridwin.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ffbf4dc7339572b7cab4405222ac93fb03ec6d51
Author: Tomaž Vajngerl 
AuthorDate: Thu Jan 11 13:25:16 2024 +0900
Commit: Miklos Vajna 
CommitDate: Thu Jan 11 11:36:41 2024 +0100

sc: don't stop if we can't cast one view to ScTabViewShell

Probably the intention here was to skip the view if we can't
cast it to ScTabViewShell and not stop updating all the other
views when we can't cast.

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

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index f4a1d6e6f5dd..9bd88d69d10d 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -6304,7 +6304,7 @@ void ScGridWindow::updateOtherKitSelections() const
 {
 auto pOther = dynamic_cast(it);
 if (!pOther)
-return;
+continue;
 
 // Fetch pixels & convert for each view separately.
 tools::Rectangle aBoundingBox;


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

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

New commits:
commit 2ca20f147b5963928643ffe0e9b892d6466e7ea9
Author: Caolán McNamara 
AuthorDate: Mon Jan 8 16:27:30 2024 +
Commit: Andras Timar 
CommitDate: Wed Jan 10 15:25:08 2024 +0100

WaE: unused variable 'pCondFormat' [-Werror,-Wunused-variable] with NDEBUG

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

diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index a4bc6dba15d5..9a0542355497 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2199,7 +2199,6 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
 }
 
 // try to find an existing conditional format
-const ScConditionalFormat* pCondFormat = nullptr;
 const ScPatternAttr* pPattern = rDoc.GetPattern(aPos.Col(), 
aPos.Row(), aPos.Tab());
 ScConditionalFormatList* pList = 
rDoc.GetCondFormList(aPos.Tab());
 const ScCondFormatIndexes& rCondFormats = 
pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData();
@@ -2211,7 +2210,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
 for (const auto& rCondFormat : rCondFormats)
 {
 // check if at least one existing conditional format 
has the same range
-pCondFormat = pList->GetFormat(rCondFormat);
+const ScConditionalFormat* pCondFormat = 
pList->GetFormat(rCondFormat);
 if(!pCondFormat)
 continue;
 
@@ -2428,8 +2427,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
 else
 {
 // define an overlapping conditional format
-const ScConditionalFormat* pCondFormat = 
pInnerList->GetFormat(rInnerCondFormats[0]);
-assert(pCondFormat);
+
assert(pInnerList->GetFormat(rInnerCondFormats[0]));
 bNewCondFormatDlg = true;
 }
 


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

2024-01-09 Thread Caolán McNamara (via logerrit)
 sc/source/core/data/column2.cxx |2 ++
 sc/source/ui/view/output2.cxx   |4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 606537da38eca6077a0c6ec7d82ca31c92b7e3a6
Author: Caolán McNamara 
AuthorDate: Fri Jan 5 13:23:31 2024 +
Commit: Tomaž Vajngerl 
CommitDate: Wed Jan 10 05:17:33 2024 +0100

Resolves: tdf#158997 optimal col width too narrow to render text

optimal is measured with kerning on, while text is rendered with
kerning off

possibly a problem since:

commit 36eed54d3dfed6551fd2ad944feff7e217c56e82
Date:   Tue Jul 3 15:00:26 2018 +0200

Resolves: tdf#118221 whole cell kerning default is off

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

diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 3abb568befbc..f4b0ce18410f 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -283,6 +283,7 @@ tools::Long ScColumn::GetNeededSize(
 {
 Fraction aFontZoom = ( eOrient == SvxCellOrientation::Standard ) ? 
rZoomX : rZoomY;
 vcl::Font aFont;
+aFont.SetKerning(FontKerning::NONE); // like 
ScDrawStringsVars::SetPattern
 // font color doesn't matter here
 pPattern->fillFontOnly(aFont, pDev, , pCondSet, nScript);
 pDev->SetFont(aFont);
@@ -754,6 +755,7 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
 SCROW nRow = 0;
 const ScPatternAttr* pPattern = GetPattern( nRow );
 vcl::Font aFont;
+aFont.SetKerning(FontKerning::NONE); // like 
ScDrawStringsVars::SetPattern
 // font color doesn't matter here
 pPattern->fillFontOnly(aFont, pDev, );
 pDev->SetFont(aFont);
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 9b325a5dbe82..8f59a529fa93 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -407,7 +407,9 @@ void ScDrawStringsVars::SetPattern(
 
 // There is no cell attribute for kerning, default is kerning OFF, all
 // kerning is stored at an EditText object that is drawn using EditEngine.
-aFont.SetKerning( FontKerning::NONE);
+// See also matching kerning cases in ScColumn::GetNeededSize and
+// ScColumn::GetOptimalColWidth.
+aFont.SetKerning(FontKerning::NONE);
 
 pDev->SetFont( aFont );
 if ( pFmtDevice != pDev )


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

2024-01-08 Thread Caolán McNamara (via logerrit)
 sc/source/core/tool/inputopt.cxx |1 +
 sc/source/ui/view/tabvwsh4.cxx   |1 +
 2 files changed, 2 insertions(+)

New commits:
commit c274dcc2ef08eb78354c4a234015d0a32aeb6706
Author: Caolán McNamara 
AuthorDate: Fri Jan 5 16:42:03 2024 +
Commit: Skyler Grey 
CommitDate: Mon Jan 8 16:40:59 2024 +0100

uninitialized class members

since:

commit 284f2759dedbc2375abdbaab5258efda4a52b8f5
Date:   Mon Dec 4 14:08:09 2023 +

calc: Add option to keep edit mode on enter/tab

Change-Id: I47431f9096e12fe84ad13a139fba60ddd88793d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161695
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Skyler Grey 

diff --git a/sc/source/core/tool/inputopt.cxx b/sc/source/core/tool/inputopt.cxx
index 13781040ee22..08d4feff60dc 100644
--- a/sc/source/core/tool/inputopt.cxx
+++ b/sc/source/core/tool/inputopt.cxx
@@ -32,6 +32,7 @@ using namespace com::sun::star::uno;
 ScInputOptions::ScInputOptions()
 : nMoveDir(DIR_BOTTOM)
 , bMoveSelection(true)
+, bMoveKeepEdit(false)
 , bEnterEdit(false)
 , bExtendFormat(false)
 , bRangeFinder(true)
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 071017d5da43..2ff01b9f83e3 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1711,6 +1711,7 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame,
 bForceFocusOnCurCell(false),
 bInPrepareClose(false),
 bInDispose(false),
+bMoveKeepEdit(false),
 nCurRefDlgId(0),
 mbInSwitch(false),
 m_pDragData(new ScDragData)


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

2024-01-08 Thread Tomaž Vajngerl (via logerrit)
 sc/source/ui/view/viewdata.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 1380a8290b799f44ef767e2fb6813e3cd387ff6c
Author: Tomaž Vajngerl 
AuthorDate: Fri Jan 5 21:05:50 2024 +0900
Commit: Miklos Vajna 
CommitDate: Mon Jan 8 11:05:12 2024 +0100

sc: LOK work-around for mouse click selecting the wrong cell

Don't increase the cell selection if we detect the mouse click
was out of the screen (grid window) area. Only do this when LOK
is enabled.

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

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 57ef3e5487d0..8fc254aa8fce 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -2849,15 +2849,19 @@ void ScViewData::GetPosFromPixel( tools::Long nClickX, 
tools::Long nClickY, ScSp
 }
 }
 
+bool bLOK = comphelper::LibreOfficeKit::isActive();
 //  cells too big?
-if ( rPosX == nStartPosX && nClickX > 0 )
+// Work-around this for LOK, because the screen size is in not set 
correctly
+// for all views and we will geturn the wrong position in case we send a 
click
+// that is outside the set screen grid area
+if (rPosX == nStartPosX && nClickX > 0 && !bLOK)
 {
  if (pView)
 aScrSize.setWidth( pView->GetGridWidth(eHWhich) );
  if ( nClickX > aScrSize.Width() )
 ++rPosX;
 }
-if ( rPosY == nStartPosY && nClickY > 0 )
+if (rPosY == nStartPosY && nClickY > 0 && !bLOK)
 {
 if (pView)
 aScrSize.setHeight( pView->GetGridHeight(eVWhich) );


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

2024-01-05 Thread Andras Timar (via logerrit)
 sc/source/ui/view/editsh.cxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit efbe82fd2515c58a5504c18176def3e7caaefdd1
Author: Andras Timar 
AuthorDate: Fri Jan 5 14:44:21 2024 +0100
Commit: Andras Timar 
CommitDate: Fri Jan 5 18:42:07 2024 +0100

LOK: disallow entering multiple hyperlinks in spreadsheet cells

This is for UX consistency. Previously it was allowed to enter
multiple hyperlinks in spreadsheet cells when the spreadsheet
was in OpenDocument format. Only in case of XLS/XLSX it was
not possible. But we got a feedback that it is desirable to have
a similar user experience for all spreadsheet file formats in
Online. In LibreOffice nothing changes, it works according to the
setting in Options - LibreOffice Calc - Compatibility - Hyperlinks.

Change-Id: I7eece4307289711e9c925c05085497afaafe600e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161667
Reviewed-by: Attila Szűcs 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 42e78e153669..2850164ee085 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -572,8 +573,9 @@ void ScEditShell::Execute( SfxRequest& rReq )
 SvxLinkInsertMode eMode = pHyper->GetInsertMode();
 
 bool bCellLinksOnly
-= 
SC_MOD()->GetAppOptions().GetLinksInsertedLikeMSExcel()
-  && 
rViewData.GetSfxDocShell()->GetMedium()->GetFilter()->IsMSOFormat();
+= 
(SC_MOD()->GetAppOptions().GetLinksInsertedLikeMSExcel()
+  && 
rViewData.GetSfxDocShell()->GetMedium()->GetFilter()->IsMSOFormat())
+  || comphelper::LibreOfficeKit::isActive();
 
 bool bDone = false;
 if ( (eMode == HLINK_DEFAULT || eMode == HLINK_FIELD) && 
!bCellLinksOnly )
@@ -784,8 +786,9 @@ void ScEditShell::GetState( SfxItemSet& rSet )
 {
 SvxHyperlinkItem aHLinkItem;
 bool bCellLinksOnly
-= 
SC_MOD()->GetAppOptions().GetLinksInsertedLikeMSExcel()
-  && 
rViewData.GetSfxDocShell()->GetMedium()->GetFilter()->IsMSOFormat();
+= 
(SC_MOD()->GetAppOptions().GetLinksInsertedLikeMSExcel()
+  && 
rViewData.GetSfxDocShell()->GetMedium()->GetFilter()->IsMSOFormat())
+  || comphelper::LibreOfficeKit::isActive();
 const SvxURLField* pURLField = GetURLField();
 if (!bCellLinksOnly)
 {


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

2024-01-04 Thread Gülşah Köse (via logerrit)
 sc/source/core/data/document.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 59b3cf0cc098cefb5aa509f28e0b640f9d6679f4
Author: Gülşah Köse 
AuthorDate: Thu Dec 14 12:07:48 2023 +0300
Commit: Gülşah Köse 
CommitDate: Thu Jan 4 12:03:10 2024 +0100

ONLINE: Exit cell edit mode before add a new sheet

Prevents to move last edited cell to new sheet.

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

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index e07dcf146640..aee46bad2ecc 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -507,6 +507,11 @@ void ScDocument::InvalidateStreamOnSave()
 bool ScDocument::InsertTab(
 SCTAB nPos, const OUString& rName, bool bExternalDocument, bool 
bUndoDeleteTab )
 {
+// auto-accept any in-process input to prevent move the cell into next 
sheet in online.
+if (comphelper::LibreOfficeKit::isActive())
+if (!SC_MOD()->IsFormulaMode())
+SC_MOD()->InputEnterHandler();
+
 SCTAB   nTabCount = static_cast(maTabs.size());
 boolbValid = ValidTab(nTabCount);
 if ( !bExternalDocument )   // else test rName == "'Doc'!Tab" first


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

2023-12-31 Thread Mike Kaganski (via logerrit)
 sc/source/core/data/attarray.cxx |1 +
 sc/source/ui/view/viewfunc.cxx   |1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 15fd6de056a1389702a1d3be9ffd3fdd5a0795de
Author: Mike Kaganski 
AuthorDate: Sat Dec 30 18:37:58 2023 +0600
Commit: Noel Grandin 
CommitDate: Sun Dec 31 13:06:24 2023 +0100

tdf#158254: don't shrink to data area when applying to entire sheet

Commit ac859a4c6a7fce4efee9cdd45821a0c9e40e9e9a (tdf#147842 shrink
selection to data area when applying to entire sheet, 2022-10-18)
tried to workaround the problem of applying to the massive amount
of columns. This caused regressions, where it was impossible to pre-
format entire rows.

This change removes the call to ShrinkToDataArea from
ScViewFunc::ApplySelectionPattern (it is used elsewhere, so the
commit is not reverted completely).

Instead, it addresses the bottleneck in the bugdoc in tdf#147842,
which is ScAttrArray::RemoveCellCharAttribs: since the document
had hidden rows, selecting all made multi-selection split into
separate stripes, and the fulction was called repeatedly, and
itself called ScEditUtil::RemoveCharAttribs for every cell in
~ 1000 columns * 100 rows, even though most of the cells in
that range were empty - so no char attribs could exist. Asking
for the last used row (the same as done in ShrinkToDataArea)
makes the operation fast again, and keeps assigning the format
to the entire range.

Change-Id: I9635ea1a392b3a1e048c0888f4786a3628675fc9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161442
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 
(cherry picked from commit 46b06663ae767d3423f2135fa91800cfa304877b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161412
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Noel Grandin 

diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 406525e862c8..c799bf8c7530 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -400,6 +400,7 @@ void ScAttrArray::RemoveCellCharAttribs( SCROW nStartRow, 
SCROW nEndRow,
 // cache mdds position, this doesn't modify the mdds container, just 
EditTextObject's
 sc::ColumnBlockPosition blockPos;
 rDocument.InitColumnBlockPosition( blockPos, nTab, nCol );
+nEndRow = rDocument.GetLastDataRow(nTab, nCol, nCol, nEndRow);
 for (SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow)
 {
 ScAddress aPos(nCol, nRow, nTab);
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 15076f04a958..86ec365d2a2b 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1230,7 +1230,6 @@ void ScViewFunc::ApplySelectionPattern( const 
ScPatternAttr& rAttr, bool bCursor
 ScDocShell* pDocSh  = rViewData.GetDocShell();
 ScDocument& rDoc= pDocSh->GetDocument();
 ScMarkData aFuncMark( rViewData.GetMarkData() );   // local copy for 
UnmarkFiltered
-ShrinkToDataArea( aFuncMark, rDoc );
 ScViewUtil::UnmarkFiltered( aFuncMark, rDoc );
 
 bool bRecord = true;


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

2023-12-20 Thread Caolán McNamara (via logerrit)
 sc/source/ui/inc/gridwin.hxx  |2 ++
 sc/source/ui/view/gridwin.cxx |6 ++
 2 files changed, 8 insertions(+)

New commits:
commit d48805607da304df0e59a8f7d3f45bed4cf9cc3b
Author: Caolán McNamara 
AuthorDate: Tue Dec 19 15:37:08 2023 +
Commit: Miklos Vajna 
CommitDate: Wed Dec 20 11:36:00 2023 +0100

split ScGridWindow::UpdateFormulas into two parts

a) figures out what might need to redraw
b) triggers redraws on that

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

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 048d2d3d9359..8d5dcc08696f 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -320,6 +320,8 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public 
vcl::DocWindow, public DropTarget
 voidSetupInitialPageBreaks(const ScDocument& rDoc, SCTAB nTab);
 DECL_DLLPRIVATE_LINK(InitiatePageBreaksTimer, Timer*, void);
 
+voidUpdateFormulaRange(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW 
nY2);
+
 protected:
 virtual voidPrePaint(vcl::RenderContext& rRenderContext) override;
 virtual voidPaint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle& rRect) override;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 93e9033d97d6..4594e458815e 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5021,6 +5021,7 @@ void ScGridWindow::UpdateFormulas(SCCOL nX1, SCROW nY1, 
SCCOL nX2, SCROW nY2)
 if ( comphelper::LibreOfficeKit::isActive() )
 {
 ScTabViewShell* pViewShell = mrViewData.GetViewShell();
+
 if (nX1 < 0)
 nX1 = pViewShell->GetLOKStartHeaderCol() + 1;
 if (nY1 < 0)
@@ -5040,6 +5041,11 @@ void ScGridWindow::UpdateFormulas(SCCOL nX1, SCROW nY1, 
SCCOL nX2, SCROW nY2)
 nY2 = nY1 + mrViewData.VisibleCellsY( eVWhich );
 }
 
+UpdateFormulaRange(nX1, nY1, nX2, nY2);
+}
+
+void ScGridWindow::UpdateFormulaRange(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW 
nY2)
+{
 if (nX2 < nX1) nX2 = nX1;
 if (nY2 < nY1) nY2 = nY1;
 


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

2023-12-14 Thread Caolán McNamara (via logerrit)
 sc/source/core/data/dociter.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d613b9d473eedc46a9930f3db75c8ef7bb5d0985
Author: Caolán McNamara 
AuthorDate: Thu Dec 14 16:46:55 2023 +
Commit: Noel Grandin 
CommitDate: Fri Dec 15 07:31:06 2023 +0100

Related: cool#6893 ScFormulaGroupIterator::next creates columns

that didn't exist before. Lots of time spent in ScColContainer::resize
on getting document statistics.

ScColContainer: :resize
ScTable: :CreateColumnIfNotExistsImpl
ScTable: :FetchColumn
ScFormulaGroupIterator: :next
ScDocument: :GetFormulaGroupCount
ScDocument: :GetDocStat
Change-Id: I52d4ab052e21215eb650bdccf4abc056ee2dd405
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160797
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Noel Grandin 

diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index fd4fa7afe42f..29bac008a3e4 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -802,7 +802,7 @@ sc::FormulaGroupEntry* ScFormulaGroupIterator::next()
 return nullptr;
 }
 ScTable *pTab = mrDoc.FetchTable(mnTab);
-ScColumn *pCol = pTab ? pTab->FetchColumn(mnCol) : nullptr;
+ScColumn *pCol = (pTab && pTab->IsColValid(mnCol)) ? 
pTab->FetchColumn(mnCol) : nullptr;
 if (pCol)
 {
 mbNullCol = false;


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

2023-12-12 Thread Caolán McNamara (via logerrit)
 sc/source/ui/view/cellsh1.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5b3af42f2a7e5b4330dfa88c912f1dd75f35b18a
Author: Caolán McNamara 
AuthorDate: Tue Dec 12 16:40:31 2023 +
Commit: Miklos Vajna 
CommitDate: Wed Dec 13 08:10:39 2023 +0100

add a notifier for the "Edit Existing Cond Formats" warning dialog

otherwise in --enable-dbgutil this assert with:

vcl::Window::SetLOKNotifier(vcl::Window * const this, const 
vcl::ILibreOfficeKitNotifier * pNotifier, bool bParent) 
(vcl/source/window/window.cxx:3193)
libmergedlo.so!Dialog::ImplStartExecute(Dialog * const this) 
(vcl/source/window/dialog.cxx:940)
libmergedlo.so!Dialog::StartExecuteAsync(Dialog * const this, 
VclAbstractDialog::AsyncContext & rCtx) (vcl/source/window/dialog.cxx:)
...
libsclo.so!ScCellShell::ExecuteEdit(ScCellShell * const this, SfxRequest & 
rReq) (sc/source/ui/view/cellsh1.cxx:2352)

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

diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index f1d1cca78e20..aaeb5d8e644e 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2347,7 +2347,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
 {
 std::unique_ptr 
xQueryBox(Application::CreateMessageDialog(pTabViewShell->GetFrameWeld(),

VclMessageType::Question, VclButtonsType::YesNo,
-   
ScResId(STR_EDIT_EXISTING_COND_FORMATS)));
+   
ScResId(STR_EDIT_EXISTING_COND_FORMATS), pTabViewShell));
 xQueryBox->set_default_response(RET_YES);
 bool bEditExisting = xQueryBox->run() == RET_YES;
 if (bEditExisting)


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

2023-12-07 Thread Caolán McNamara (via logerrit)
 sc/source/filter/xml/xmlexprt.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit eec05aa9cf4a283efa3be76ecf18aa77f714d26e
Author: Caolán McNamara 
AuthorDate: Thu Dec 7 12:30:37 2023 +
Commit: Tomaž Vajngerl 
CommitDate: Fri Dec 8 07:20:38 2023 +0100

busy loop seen on ods export attempt

ScXMLExport::ExportFormatRanges cannot advance because nMaxCols is 0
so busy loop and no progression

In ScRowFormatRanges::GetMaxRows, aRowFormatRanges is empty which is why
nMaxCols is 0

In ScFormatRangeStyles::GetFormatRanges aTables appears to be 30 empty
items.

But why it is empty can't be seen from the bt.

Force this to be an assert to ensure crashtesting can flush out this
case, rather than letting it get killed off as a timeout.

Set this case as an error and break so failure results in an error
message of failure to save instead of a hang.

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

diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index 4a9b9db6662a..6b5a0592a195 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -1565,7 +1565,13 @@ void ScXMLExport::ExportFormatRanges(const sal_Int32 
nStartCol, const sal_Int32
 pRowFormatRanges->Clear();
 pCellStyles->GetFormatRanges(0, 
pSharedData->GetLastColumn(nSheet), nStartRow + nRows, nSheet, 
pRowFormatRanges.get());
 sal_Int32 nMaxRows = pRowFormatRanges->GetMaxRows();
-OSL_ENSURE(nMaxRows, "something went wrong");
+assert(nMaxRows && "ScXMLExport::ExportFormatRanges cannot 
make progress with zero rows, something went wrong");
+if (!nMaxRows)
+{
+uno::Sequence aEmptySeq;
+SetError(XMLERROR_CANCEL|XMLERROR_FLAG_SEVERE, aEmptySeq);
+break;
+}
 if (nMaxRows >= nTotalRows - nRows)
 {
 OpenRow(nSheet, nStartRow + nRows, nTotalRows - nRows, 
aRowAttr);


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-12-04 Thread Aron Budea (via logerrit)
 sc/source/ui/docshell/docfunc.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 67cdcf1ab2d2977fa79f9ecd7935ad8f3a8b4377
Author: Aron Budea 
AuthorDate: Sun Dec 3 19:33:28 2023 +1030
Commit: Caolán McNamara 
CommitDate: Mon Dec 4 20:11:49 2023 +0100

sc SetLayoutRTL: Only call PostPaint for current tab

...instead of the usual 0-, a layout change of the current
sheet should have no effect on others.

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

diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index be844634ea25..12ff9a0f9908 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -3485,7 +3485,7 @@ bool ScDocFunc::SetLayoutRTL( SCTAB nTab, bool bRTL )
 rDocShell.GetUndoManager()->AddUndoAction( 
std::make_unique( , nTab, bRTL ) );
 }
 
-rDocShell.PostPaint( 0,0,0,rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, 
PaintPartFlags::All );
+rDocShell.PostPaint( 0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab, 
PaintPartFlags::All );
 aModificator.SetDocumentModified();
 
 SfxBindings* pBindings = rDocShell.GetViewBindings();


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-12-04 Thread Aron Budea (via logerrit)
 sc/source/ui/docshell/docsh3.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 4d30910523bccb3b965f254401e6341af2ee8704
Author: Aron Budea 
AuthorDate: Sun Dec 3 19:22:17 2023 +1030
Commit: Caolán McNamara 
CommitDate: Mon Dec 4 20:09:29 2023 +0100

lok: Notify all tabs in the range

34d5abf464dfbf4bdc36f6b87e606c84a1f4d99d restricted this to the
first tab, but PostPaint(...) is sometimes called with a
0.. tab range, even if the change only affected somewhere
in between.

In addition, restrict range end to the last actual tab in the
spreadsheet.

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

diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 8b24cf81d727..0e2efa7f09fc 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -110,12 +110,13 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, 
PaintPartFlags nPart, sa
 {
 ScRangeList aPaintRanges;
 std::set aTabsInvalidated;
+const SCTAB nMaxTab = m_pDocument->GetTableCount() - 1;
 for (size_t i = 0, n = rRanges.size(); i < n; ++i)
 {
 const ScRange& rRange = rRanges[i];
 SCCOL nCol1 = rRange.aStart.Col(), nCol2 = rRange.aEnd.Col();
 SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row();
-SCTAB nTab1 = rRange.aStart.Tab(), nTab2 = rRange.aEnd.Tab();
+SCTAB nTab1 = rRange.aStart.Tab(), nTab2 = std::min(nMaxTab, 
rRange.aEnd.Tab());
 
 if (!m_pDocument->ValidCol(nCol1)) nCol1 = m_pDocument->MaxCol();
 if (!m_pDocument->ValidRow(nRow1)) nRow1 = m_pDocument->MaxRow();
@@ -168,7 +169,8 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, 
PaintPartFlags nPart, sa
 }
 }
 aPaintRanges.push_back(ScRange(nCol1, nRow1, nTab1, nCol2, nRow2, 
nTab2));
-aTabsInvalidated.insert(nTab1);
+for (auto nTabNum = nTab1; nTabNum <= nTab2; ++nTabNum)
+aTabsInvalidated.insert(nTabNum);
 }
 
 Broadcast(ScPaintHint(aPaintRanges.Combine(), nPart));


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-12-03 Thread Darshan11 (via logerrit)
 sc/source/ui/cctrl/checklistmenu.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 5788f736578dc22bc9bcd46a6e75233237b82af2
Author: Darshan11 
AuthorDate: Wed Nov 29 17:02:44 2023 +0530
Commit: Szymon Kłos 
CommitDate: Sun Dec 3 19:17:46 2023 +0100

Disable Select/Unselect-current Filter Checkboxes in Calc

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

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index a913bcfe55ef..1cb1565ab482 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -619,6 +619,11 @@ 
ScCheckListMenuControl::ScCheckListMenuControl(weld::Widget* pParent, ScViewData
 // bulk_insert_for_each
 mxTreeChecks->set_size_request(mnCheckWidthReq, nChecksHeight);
 mxListChecks->set_size_request(mnCheckWidthReq, nChecksHeight);
+if (comphelper::LibreOfficeKit::isActive())
+{
+mxBtnSelectSingle->hide();
+mxBtnUnselectSingle->hide();
+}
 }
 
 void ScCheckListMenuControl::GrabFocus()


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-11-28 Thread Szymon Kłos (via logerrit)
 sc/source/core/tool/webservicelink.cxx   |8 
 sc/source/ui/docshell/externalrefmgr.cxx |6 ++
 2 files changed, 14 insertions(+)

New commits:
commit 42109bda9972738b6e7a4448127458c7d24be4dc
Author: Szymon Kłos 
AuthorDate: Mon Nov 27 09:56:27 2023 +0100
Commit: Szymon Kłos 
CommitDate: Tue Nov 28 11:20:45 2023 +0100

lok: Block requests to load external references

- currently in LOK case we don't open multiple files in
  one "environment"
- currently it opens import dialog which is synchronous - and that
  blocks whole app

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

diff --git a/sc/source/core/tool/webservicelink.cxx 
b/sc/source/core/tool/webservicelink.cxx
index b61907471e54..156048430636 100644
--- a/sc/source/core/tool/webservicelink.cxx
+++ b/sc/source/core/tool/webservicelink.cxx
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -36,6 +37,13 @@ sfx2::SvBaseLink::UpdateResult 
ScWebServiceLink::DataChanged(const OUString&, co
 aResult.clear();
 bHasResult = false;
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+SAL_WARN("sc.ui", "ScWebServiceLink::DataChanged: blocked access to 
external file: \""
+  << aURL << "\"");
+return ERROR_GENERAL;
+}
+
 css::uno::Reference xFileAccess
 = 
css::ucb::SimpleFileAccess::create(comphelper::getProcessComponentContext());
 if (!xFileAccess.is())
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx 
b/sc/source/ui/docshell/externalrefmgr.cxx
index 0653d4609aee..0b8215cd3edc 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2537,6 +2537,12 @@ SfxObjectShellRef 
ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
 if (!isFileLoadable(aFile))
 return nullptr;
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+SAL_WARN( "sc.ui", "ScExternalRefManager::loadSrcDocument: blocked 
access to external file: \"" << aFile << "\"");
+return nullptr;
+}
+
 OUString aOptions = pFileData->maFilterOptions;
 if ( !pFileData->maFilterName.isEmpty() )
 rFilter = pFileData->maFilterName;  // don't overwrite stored 
filter with guessed filter


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-11-27 Thread Caolán McNamara (via logerrit)
 sc/source/core/tool/viewopti.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit c2d44cb8544fdc696b271e2c1920c6ef5d5770cf
Author: Caolán McNamara 
AuthorDate: Mon Nov 27 14:38:19 2023 +
Commit: Miklos Vajna 
CommitDate: Tue Nov 28 08:26:23 2023 +0100

ScViewOptions::operator== doesn't compare sColorSchemeName

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

diff --git a/sc/source/core/tool/viewopti.cxx b/sc/source/core/tool/viewopti.cxx
index 46f3d13227e8..849d15d2412e 100644
--- a/sc/source/core/tool/viewopti.cxx
+++ b/sc/source/core/tool/viewopti.cxx
@@ -140,6 +140,7 @@ bool ScViewOptions::operator==( const ScViewOptions& rOpt ) 
const
 bEqual = bEqual && (aGridCol   == rOpt.aGridCol);
 bEqual = bEqual && (aGridColName   == rOpt.aGridColName);
 bEqual = bEqual && (aGridOpt   == rOpt.aGridOpt);
+bEqual = bEqual && (sColorSchemeName == rOpt.sColorSchemeName);
 bEqual = bEqual && (aDocCol== rOpt.aDocCol);
 
 return bEqual;


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-11-22 Thread offtkp (via logerrit)
 sc/source/ui/app/inputhdl.cxx |   12 
 1 file changed, 12 insertions(+)

New commits:
commit 1482ae614645599bebedec7c0467333bd324
Author: offtkp 
AuthorDate: Wed Nov 22 17:00:53 2023 +0200
Commit: Paris Oplopoios 
CommitDate: Wed Nov 22 17:05:46 2023 +0100

sc: Enable text wrapping when inputting line breaks in cell

In Excel, when typing new lines in a cell or pasting text with new lines
and then clicking out of the cell, wrap text is enabled, which actually
shows the contents on the new line instead of on the same line

Change-Id: I113aceab33380a5deb536f57969c3fc90825146b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159821
Tested-by: Paris Oplopoios 
Reviewed-by: Paris Oplopoios 

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 7aa1ebf218be..1153a7dc03d4 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -47,6 +47,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -3144,6 +3145,17 @@ void ScInputHandler::EnterHandler( ScEnterMode 
nBlockMode, bool bBeforeSavingInL
 lcl_RemoveTabs(aString);
 lcl_RemoveTabs(aPreAutoCorrectString);
 
+if (aString.indexOf('\n') != -1)
+{
+// Cell contains line breaks, enable wrapping
+ScLineBreakCell aBreakItem(true);
+pActiveViewSh->ApplyAttr(aBreakItem);
+
+SfxViewFrame* pViewFrm = SfxViewFrame::Current();
+if (pViewFrm)
+pViewFrm->GetBindings().Invalidate(SID_ATTR_ALIGN_LINEBREAK);
+}
+
 // Test if valid (always with simple string)
 if (bModified && nValidation && pActiveViewSh)
 {


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-11-18 Thread Michael Meeks (via logerrit)
 sc/source/ui/inc/viewfunc.hxx  |3 -
 sc/source/ui/undo/undoblk3.cxx |3 -
 sc/source/ui/view/cellsh3.cxx  |8 ---
 sc/source/ui/view/viewfun2.cxx |   96 +++--
 4 files changed, 60 insertions(+), 50 deletions(-)

New commits:
commit 5c77b34a2004a2f6e7cab7a81b111ba22c2b96ba
Author: Michael Meeks 
AuthorDate: Thu Nov 16 19:28:21 2023 +
Commit: Tomaž Vajngerl 
CommitDate: Sun Nov 19 02:18:27 2023 +0100

lok: async calc merge-cells popup dialog.

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

diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 0d8d7515441a..a62406020de5 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -236,7 +236,8 @@ public:
 boolTestMergeCells();
 boolTestRemoveMerge();
 
-boolMergeCells( bool bApi, bool& rDoContents, bool bCenter );
+voidMergeCells( bool bApi, bool bDoContents, bool bCenter,
+const sal_uInt16 nSlot );
 boolRemoveMerge();
 
 SC_DLLPUBLIC void
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index f614e0ff0b4a..43363fd6722c 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -755,8 +755,7 @@ void ScUndoMerge::Repeat(SfxRepeatTarget& rTarget)
 if (auto pViewTarget = dynamic_cast( ))
 {
 ScTabViewShell& rViewShell = *pViewTarget->GetViewShell();
-bool bCont = false;
-rViewShell.MergeCells( false, bCont, false );
+rViewShell.MergeCells( false, false, false, 0 );
 }
 }
 
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 72c7d94ff625..dab2ee7b6a3f 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -944,13 +944,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
 bMoveContents = static_cast(pItem)->GetValue();
 }
 
-if (pTabViewShell->MergeCells( bApi, bMoveContents, 
bCenter ))
-{
-if (!bApi && bMoveContents) // "yes" 
clicked in dialog
-rReq.AppendItem( SfxBoolItem( nSlot, bMoveContents 
) );
-rBindings.Invalidate( nSlot );
-rReq.Done();
-}
+pTabViewShell->MergeCells( bApi, bMoveContents, bCenter, 
nSlot );
 }
 else
 {
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 884722204f0a..45aeb2a3cdce 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -20,6 +20,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1178,7 +1179,8 @@ bool ScViewFunc::TestMergeCells()   // pre-test 
(for menu)
 return false;
 }
 
-bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bCenter )
+void ScViewFunc::MergeCells( bool bApi, bool bDoContents, bool bCenter,
+ const sal_uInt16 nSlot )
 {
 //  Editable- and Being-Nested- test must be at the beginning (in DocFunc 
too),
 //  so that the Contents-QueryBox won't appear
@@ -1186,7 +1188,7 @@ bool ScViewFunc::MergeCells( bool bApi, bool& 
rDoContents, bool bCenter )
 if (!aTester.IsEditable())
 {
 ErrorMessage(aTester.GetMessageId());
-return false;
+return;
 }
 
 ScMarkData& rMark = GetViewData().GetMarkData();
@@ -1194,7 +1196,7 @@ bool ScViewFunc::MergeCells( bool bApi, bool& 
rDoContents, bool bCenter )
 if (!rMark.IsMarked())
 {
 ErrorMessage(STR_NOMULTISELECT);
-return false;
+return;
 }
 
 ScDocShell* pDocSh = GetViewData().GetDocShell();
@@ -1210,14 +1212,14 @@ bool ScViewFunc::MergeCells( bool bApi, bool& 
rDoContents, bool bCenter )
 if ( nStartCol == nEndCol && nStartRow == nEndRow )
 {
 // nothing to do
-return true;
+return;
 }
 
 if ( rDoc.HasAttrib( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, 
nEndTab,
 HasAttrFlags::Merged | HasAttrFlags::Overlapped ) )
 {   // "Don't nest merging  !"
 ErrorMessage(STR_MSSG_MERGECELLS_0);
-return false;
+return;
 }
 
 // Check for the contents of all selected tables.
@@ -1240,7 +1242,7 @@ bool ScViewFunc::MergeCells( bool bApi, bool& 
rDoContents, bool bCenter )
 {
 // this range contains only one data cell.
 if (nStartCol != aState.mnCol1 || nStartRow != aState.mnRow1)
-rDoContents = true; // move the value to the top-left.
+bDoContents = true; // move the 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-11-17 Thread Caolán McNamara (via logerrit)
 sc/source/ui/app/inputhdl.cxx |   45 ++
 sc/source/ui/app/inputwin.cxx |   12 +++
 sc/source/ui/inc/inputhdl.hxx |2 -
 sc/source/ui/inc/tabvwsh.hxx  |   20 +-
 4 files changed, 60 insertions(+), 19 deletions(-)

New commits:
commit da3fbd8f6d69a248e30cfa76a4ec59a919ea91c0
Author: Caolán McNamara 
AuthorDate: Tue Nov 14 17:24:18 2023 +
Commit: Miklos Vajna 
CommitDate: Fri Nov 17 12:05:16 2023 +0100

merge duplicate formula bar updates in close time proximity

We get three updates per keystroke, StartExtTextInput, ExtTextInput and
PostExtTextInput.  Skip duplicate updates. Be conservative and don't
skip duplicates that are 5+ seconds apart.

Change-Id: I501bff4193528fa9263d296700d64e2f60b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159424
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 a816210ea6a3..7aa1ebf218be 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1811,8 +1811,7 @@ void ScInputHandler::LOKPasteFunctionData(const OUString& 
rFunctionName)
 }
 }
 
-void ScInputHandler::LOKSendFormulabarUpdate(EditView* pActiveView,
- const SfxViewShell* pActiveViewSh,
+void ScTabViewShell::LOKSendFormulabarUpdate(EditView* pActiveView,
  const OUString& rText,
  const ESelection& rSelection)
 {
@@ -1829,13 +1828,35 @@ void ScInputHandler::LOKSendFormulabarUpdate(EditView* 
pActiveView,
 OUString::number(rSelection.nStartPara) + ";" + 
OUString::number(rSelection.nEndPara);
 }
 
+sal_uInt64 nCurrentShellId = reinterpret_cast(this);
+
+// We can get three updates per keystroke, StartExtTextInput, ExtTextInput 
and PostExtTextInput
+// Skip duplicate updates. Be conservative and don't skip duplicates that 
are 5+ seconds
+// apart.
+std::chrono::steady_clock::time_point now = 
std::chrono::steady_clock::now();
+if (maSendFormulabarUpdate.m_nShellId == nCurrentShellId &&
+maSendFormulabarUpdate.m_aText == rText &&
+maSendFormulabarUpdate.m_aSelection == aSelection &&
+std::chrono::duration_cast(
+now - maSendFormulabarUpdate.m_nTimeStamp) < 
std::chrono::seconds(5))
+{
+return;
+}
+
+maSendFormulabarUpdate.m_nShellId = nCurrentShellId;
+maSendFormulabarUpdate.m_aText = rText;
+maSendFormulabarUpdate.m_aSelection = aSelection;
+maSendFormulabarUpdate.m_nTimeStamp = now;
+maSendFormulabarUpdate.Send();
+}
+
+void ScTabViewShell::SendFormulabarUpdate::Send()
+{
 std::unique_ptr pData = 
std::make_unique();
 (*pData)["action_type"] = "setText";
-(*pData)["text"] = rText;
-(*pData)["selection"] = aSelection;
-
-sal_uInt64 nCurrentShellId = reinterpret_cast(pActiveViewSh);
-std::string sWindowId = std::to_string(nCurrentShellId) + "formulabar";
+(*pData)["text"] = m_aText;
+(*pData)["selection"] = m_aSelection;
+std::string sWindowId = std::to_string(m_nShellId) + "formulabar";
 jsdialog::SendAction(sWindowId, "sc_input_window", std::move(pData));
 }
 
@@ -2820,9 +2841,9 @@ void ScInputHandler::DataChanged( bool bFromTopNotify, 
bool bSetModified )
 if (pActiveView)
 aSel = pActiveView->GetSelection();
 
-ScInputHandler::LOKSendFormulabarUpdate(pActiveView, pActiveViewSh,
-
ScEditUtil::GetMultilineString(*mpEditEngine),
-aSel);
+pActiveViewSh->LOKSendFormulabarUpdate(pActiveView,
+   
ScEditUtil::GetMultilineString(*mpEditEngine),
+   aSel);
 }
 
 UpdateFormulaMode();
@@ -4299,7 +4320,7 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* 
pState,
 if (aSel.nEndPara == EE_PARA_NOT_FOUND)
 aSel.nEndPara = 0;
 
-ScInputHandler::LOKSendFormulabarUpdate(pActiveView, 
pActiveViewSh, aString, aSel);
+pActiveViewSh->LOKSendFormulabarUpdate(pActiveView, 
aString, aSel);
 // TODO: deprecated?
 
pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_FORMULA, 
aString.toUtf8().getStr());
 }
@@ -4463,7 +4484,7 @@ void ScInputHandler::InputSelection( const EditView* 
pView )
 {
 EditView* pActiveView = pTopView ? pTopView : pTableView;
 ESelection aSel = pActiveView ? pActiveView->GetSelection() : 
ESelection();
-ScInputHandler::LOKSendFormulabarUpdate(pActiveView, pActiveViewSh, 
GetEditString(), aSel);
+

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-11-15 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 3dff3a50dfda011c8bfb5502f6a8d1e7f8b95d59
Author: Attila Szűcs 
AuthorDate: Tue Nov 7 15:03:33 2023 +0100
Commit: Tomaž Vajngerl 
CommitDate: Thu Nov 16 04:02:36 2023 +0100

SC navigator: fix changing language of contenttree

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

Note: Saving language in ScContentTree::ScContentTree caused
problems, so it replaced into where this tree filled with text at
the first time.

In case of LOK, there can be seapate views, with different
languages, that means there can be 2+ ScContentTree, one have text
in English and the other in German.

When new item is created that is listed in navigator, then every
ScContentTree is updated at once... but that would use the global
laguage, 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 9cd7e977319d..3f179860cce7 100644
--- a/sc/source/ui/inc/content.hxx
+++ b/sc/source/ui/inc/content.hxx
@@ -59,6 +59,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 1387abd44346..7c3d2b7d022b 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -188,7 +188,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 languaged ScContentTree
+//At creation time, we store what language we use, and then use it 
later too.
+//It 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();


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-11-03 Thread Caolán McNamara (via logerrit)
 sc/source/ui/app/inputhdl.cxx |   28 +++-
 sc/source/ui/app/inputwin.cxx |   28 ++--
 sc/source/ui/inc/inputwin.hxx |   10 +-
 3 files changed, 38 insertions(+), 28 deletions(-)

New commits:
commit 97b8b9685c2df242608a429ab8526b14ea60ad6f
Author: Caolán McNamara 
AuthorDate: Fri Nov 3 11:46:32 2023 +
Commit: Caolán McNamara 
CommitDate: Fri Nov 3 14:43:14 2023 +0100

reduce jsdialog formulabar updates from 6 to 3 per keystroke

SetTextString will emit one, so skip doing that if we are going to be
followed by another emission that will override the earlier one.

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

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index b90b1b100be4..a816210ea6a3 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2611,7 +2611,7 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool 
bFromCommand, bool bIn
 aStr = aStr.copy(1, aStr.getLength() -2);
 mpEditEngine->SetTextCurrentDefaults(aStr);
 if ( pInputWin )
-pInputWin->SetTextString(aStr);
+pInputWin->SetTextString(aStr, true);
 }
 
 UpdateAdjust( cTyped );
@@ -2706,7 +2706,7 @@ IMPL_LINK_NOARG(ScInputHandler, ModifyHdl, 
LinkParamNone*, void)
 // wrapped by DataChanging/DataChanged calls (like Drag)
 OUString aText(ScEditUtil::GetMultilineString(*mpEditEngine));
 lcl_RemoveTabs(aText);
-pInputWin->SetTextString(aText);
+pInputWin->SetTextString(aText, true);
 }
 }
 
@@ -2753,6 +2753,8 @@ void ScInputHandler::DataChanged( bool bFromTopNotify, 
bool bSetModified )
 
 UpdateParenthesis(); // Highlight parentheses anew
 
+const bool bUpdateKit = comphelper::LibreOfficeKit::isActive() && 
pActiveViewSh && pInputWin;
+
 if (eMode==SC_INPUT_TYPE || eMode==SC_INPUT_TABLE)
 {
 OUString aText;
@@ -2762,8 +2764,11 @@ void ScInputHandler::DataChanged( bool bFromTopNotify, 
bool bSetModified )
 aText = GetEditText(mpEditEngine.get());
 lcl_RemoveTabs(aText);
 
-if ( pInputWin )
-pInputWin->SetTextString( aText );
+if (pInputWin)
+{
+// If we will end up updating LoKit at the end, we can skip it here
+pInputWin->SetTextString(aText, !bUpdateKit);
+}
 
 if (comphelper::LibreOfficeKit::isActive())
 {
@@ -2809,7 +2814,7 @@ void ScInputHandler::DataChanged( bool bFromTopNotify, 
bool bSetModified )
 }
 }
 
-if (comphelper::LibreOfficeKit::isActive() && pActiveViewSh && pInputWin)
+if (bUpdateKit)
 {
 UpdateActiveView();
 if (pActiveView)
@@ -4273,10 +4278,15 @@ void ScInputHandler::NotifyChange( const 
ScInputHdlState* pState,
 bTextValid = true;  //! To begin with 
remember as a string
 }
 
-if ( pInputWin )
-pInputWin->SetTextString(aString);
+const bool bUpdateKit = 
comphelper::LibreOfficeKit::isActive() && pActiveViewSh;
 
-if (comphelper::LibreOfficeKit::isActive() && 
pActiveViewSh)
+if (pInputWin)
+{
+// If we will end up updating LoKit after this, we can 
skip it here
+pInputWin->SetTextString(aString, !bUpdateKit);
+}
+
+if (bUpdateKit)
 {
 UpdateActiveView();
 EditView* pActiveView = pTopView ? pTopView : 
pTableView;
@@ -4432,7 +4442,7 @@ IMPL_LINK_NOARG( ScInputHandler, DelayTimer, Timer*, void 
)
 if ( pInputWin )
 {
 pInputWin->SetPosString( OUString() );
-pInputWin->SetTextString( OUString() );
+pInputWin->SetTextString(OUString(), true);
 pInputWin->Disable();
 }
 
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 5667766b827f..7d9890c5858d 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -259,14 +259,14 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, const 
SfxBindings* pBind ) :
 // Switch over while the Function AutoPilot is active
 // -> show content of the Function AutoPilot again
 // Also show selection (remember at the InputHdl)
-mxTextWindow->SetTextString( pInputHdl->GetFormString() );
+mxTextWindow->SetTextString(pInputHdl->GetFormString(), true);
 }
 else if (pInputHdl && pInputHdl->IsInputMode())
 {
 // If the input row was hidden while editing 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-11-01 Thread offtkp (via logerrit)
 sc/source/core/data/fillinfo.cxx |   14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

New commits:
commit cb53d9731a8dcb51596b4181b8fefd462854d984
Author: offtkp 
AuthorDate: Wed Nov 1 18:52:35 2023 +0200
Commit: Paris Oplopoios 
CommitDate: Wed Nov 1 20:28:46 2023 +0100

sc: Don't end handleConditionalFormat early

handleConditionalFormat would exit the conditional format searching loop
which meant that cells with overlapping conditional formatting rules
would not get properly rendered

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

diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 7c95701e9705..2dc9d5960128 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -287,7 +287,6 @@ bool handleConditionalFormat(ScConditionalFormatList& 
rCondFormList, const ScCon
 ScCellInfo* pInfo, ScTableInfo* pTableInfo, ScStyleSheetPool* pStlPool,
 const ScAddress& rAddr, bool& bHidden, bool& bHideFormula, bool 
bTabProtect)
 {
-bool bFound = false;
 bool bAnyCondition = false;
 for(const auto& rCondFormat : rCondFormats)
 {
@@ -317,33 +316,28 @@ bool handleConditionalFormat(ScConditionalFormatList& 
rCondFormList, const ScCon
 bHideFormula = pProtAttr->GetHideFormula();
 
 }
-bFound = true;
-
 }
 // if style is not there, treat like no condition
 }
 
-if(aData.mxColorScale)
+if(aData.mxColorScale && !pInfo->mxColorScale)
 {
 pInfo->mxColorScale = aData.mxColorScale;
-bFound = true;
 }
 
-if(aData.pDataBar)
+if(aData.pDataBar && !pInfo->pDataBar)
 {
 pInfo->pDataBar = aData.pDataBar.get();
 pTableInfo->addDataBarInfo(std::move(aData.pDataBar));
-bFound = true;
 }
 
-if(aData.pIconSet)
+if(aData.pIconSet && !pInfo->pIconSet)
 {
 pInfo->pIconSet = aData.pIconSet.get();
 pTableInfo->addIconSetInfo(std::move(aData.pIconSet));
-bFound = true;
 }
 
-if (bFound)
+if (pInfo->mxColorScale && pInfo->pIconSet && pInfo->pDataBar)
 break;
 }
 


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-11-01 Thread offtkp (via logerrit)
 sc/source/core/data/colorscale.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d66079dfec125e79d9c367cba90b04ee32c07cb3
Author: offtkp 
AuthorDate: Wed Nov 1 19:14:44 2023 +0200
Commit: Paris Oplopoios 
CommitDate: Wed Nov 1 19:43:56 2023 +0100

sc: Fix conditional formatting icon set order for smilies

The order of these icon sets was not consistent with other icon sets
(traffic lights, flags, circles) and Excel

Change-Id: I5cbc2ff96118530420341f6994310f946717e0d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158771
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 

diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 4e61dbdbc228..97cc50f73829 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -1337,11 +1337,11 @@ constexpr rtl::OUStringConstExpr a3Flags[] = {
 };
 
 constexpr rtl::OUStringConstExpr a3Smilies[] = {
-BMP_ICON_SET_POSITIVE_YELLOW_SMILIE, BMP_ICON_SET_NEUTRAL_YELLOW_SMILIE, 
BMP_ICON_SET_NEGATIVE_YELLOW_SMILIE
+BMP_ICON_SET_NEGATIVE_YELLOW_SMILIE, BMP_ICON_SET_NEUTRAL_YELLOW_SMILIE, 
BMP_ICON_SET_POSITIVE_YELLOW_SMILIE
 };
 
 constexpr rtl::OUStringConstExpr a3ColorSmilies[] = {
-BMP_ICON_SET_POSITIVE_GREEN_SMILIE, BMP_ICON_SET_NEUTRAL_YELLOW_SMILIE, 
BMP_ICON_SET_NEGATIVE_RED_SMILIE
+BMP_ICON_SET_NEGATIVE_RED_SMILIE, BMP_ICON_SET_NEUTRAL_YELLOW_SMILIE, 
BMP_ICON_SET_POSITIVE_GREEN_SMILIE
 };
 
 constexpr rtl::OUStringConstExpr a3Stars[] = {


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source sc/uiconfig

2023-10-31 Thread Szymon Kłos (via logerrit)
 sc/source/ui/condformat/condformateasydlg.cxx |8 ++--
 sc/source/ui/inc/condformateasydlg.hxx|4 ++--
 sc/uiconfig/scalc/ui/conditionaleasydialog.ui |4 ++--
 3 files changed, 6 insertions(+), 10 deletions(-)

New commits:
commit 2b8df39aea832d0521bf0d3c6b543a81709c382f
Author: Szymon Kłos 
AuthorDate: Fri Oct 27 13:02:29 2023 +0200
Commit: Szymon Kłos 
CommitDate: Tue Oct 31 08:34:53 2023 +0100

Allow to enter text in simple conditional formatting dialog

We have rules for test values like: "contains text".
Better to use formatter which will be used only when needed.
But it is possible to use Less or Greater even for text
using the lexicographic order.

Strings in quotes are interpreted as text.
Strings without quotes are interpreted as refs to columns/rows/ranges.

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

diff --git a/sc/source/ui/condformat/condformateasydlg.cxx 
b/sc/source/ui/condformat/condformateasydlg.cxx
index 7e07b1a1dc19..d707b7c9f88d 100644
--- a/sc/source/ui/condformat/condformateasydlg.cxx
+++ b/sc/source/ui/condformat/condformateasydlg.cxx
@@ -64,8 +64,8 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
 "modules/scalc/ui/conditionaleasydialog.ui", 
"CondFormatEasyDlg")
 , mpViewData(pViewData)
 , mpDocument(>GetDocument())
-, mxNumberEntry(m_xBuilder->weld_spin_button("entryNumber"))
-, mxNumberEntry2(m_xBuilder->weld_spin_button("entryNumber2"))
+, mxNumberEntry(m_xBuilder->weld_entry("entryNumber"))
+, mxNumberEntry2(m_xBuilder->weld_entry("entryNumber2"))
 , mxRangeEntry(new formula::RefEdit(m_xBuilder->weld_entry("entryRange")))
 , mxButtonRangeEdit(new 
formula::RefButton(m_xBuilder->weld_button("rbassign")))
 , mxStyles(m_xBuilder->weld_combo_box("themeCombo"))
@@ -92,10 +92,6 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
 meMode = *pCurrentMode;
 }
 mxNumberEntry2->hide();
-mxNumberEntry->set_range(SAL_MIN_INT64, SAL_MAX_INT64);
-mxNumberEntry2->set_range(SAL_MIN_INT64, SAL_MAX_INT64);
-mxNumberEntry->set_increments(1, 0);
-mxNumberEntry2->set_increments(1, 0);
 switch (meMode)
 {
 case ScConditionMode::Equal:
diff --git a/sc/source/ui/inc/condformateasydlg.hxx 
b/sc/source/ui/inc/condformateasydlg.hxx
index 9ca15a11bda9..6d6af1041b49 100644
--- a/sc/source/ui/inc/condformateasydlg.hxx
+++ b/sc/source/ui/inc/condformateasydlg.hxx
@@ -42,8 +42,8 @@ private:
 ScAddress maPosition;
 ScTabViewShell* mpTabViewShell;
 
-std::unique_ptr mxNumberEntry;
-std::unique_ptr mxNumberEntry2;
+std::unique_ptr mxNumberEntry;
+std::unique_ptr mxNumberEntry2;
 std::unique_ptr mxRangeEntry;
 std::unique_ptr mxButtonRangeEdit;
 std::unique_ptr mxStyles;
diff --git a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui 
b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
index 2bee383956a9..077610196356 100644
--- a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
+++ b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
@@ -90,7 +90,7 @@
 False
 12
 
-  
+  
 True
 True
 
@@ -104,7 +104,7 @@
   
 
 
-  
+  
 True
 True
 


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source sc/uiconfig

2023-10-28 Thread Paris Oplopoios (via logerrit)
 sc/source/ui/condformat/condformateasydlg.cxx |2 +
 sc/source/ui/inc/condformateasydlg.hxx|1 
 sc/uiconfig/scalc/ui/conditionaleasydialog.ui |   29 +-
 3 files changed, 31 insertions(+), 1 deletion(-)

New commits:
commit 1373bacdb99caec73b1a534e534c758c26982324
Author: Paris Oplopoios 
AuthorDate: Fri Oct 27 13:12:19 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Sat Oct 28 22:36:19 2023 +0200

tdf#157930 Add button to switch to range view in condformateasydlg

Add a button that minimizes the dialog to make it easier to choose the
conditional formatting range in the condformateasydlg. Also added more
spacing.

Change-Id: Ibf90e1d44caf2ab7a5c7bdb0bb2fa6c11d58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158532
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 

diff --git a/sc/source/ui/condformat/condformateasydlg.cxx 
b/sc/source/ui/condformat/condformateasydlg.cxx
index 8ddb297269dc..41b8a31eafd3 100644
--- a/sc/source/ui/condformat/condformateasydlg.cxx
+++ b/sc/source/ui/condformat/condformateasydlg.cxx
@@ -60,11 +60,13 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
 , mxNumberEntry(m_xBuilder->weld_spin_button("entryNumber"))
 , mxNumberEntry2(m_xBuilder->weld_spin_button("entryNumber2"))
 , mxRangeEntry(new formula::RefEdit(m_xBuilder->weld_entry("entryRange")))
+, mxButtonRangeEdit(new 
formula::RefButton(m_xBuilder->weld_button("rbassign")))
 , mxStyles(m_xBuilder->weld_combo_box("themeCombo"))
 , mxDescription(m_xBuilder->weld_label("description"))
 , mxButtonOk(m_xBuilder->weld_button("ok"))
 , mxButtonCancel(m_xBuilder->weld_button("cancel"))
 {
+mxButtonRangeEdit->SetReferences(this, mxRangeEntry.get());
 mpTabViewShell = GetTabViewShell(pBindings);
 if (!mpTabViewShell)
 mpTabViewShell = 
dynamic_cast(SfxViewShell::Current());
diff --git a/sc/source/ui/inc/condformateasydlg.hxx 
b/sc/source/ui/inc/condformateasydlg.hxx
index 001414396522..856e5fe9463f 100644
--- a/sc/source/ui/inc/condformateasydlg.hxx
+++ b/sc/source/ui/inc/condformateasydlg.hxx
@@ -43,6 +43,7 @@ private:
 std::unique_ptr mxNumberEntry;
 std::unique_ptr mxNumberEntry2;
 std::unique_ptr mxRangeEntry;
+std::unique_ptr mxButtonRangeEdit;
 std::unique_ptr mxStyles;
 std::unique_ptr mxDescription;
 std::unique_ptr mxButtonOk;
diff --git a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui 
b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
index 8f3da05b2ce8..2bee383956a9 100644
--- a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
+++ b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
@@ -68,7 +68,7 @@
 True
 False
 vertical
-12
+24
 
   
 True
@@ -79,6 +79,10 @@
   
 True
 False
+12
+12
+6
+6
 12
 
   
@@ -191,6 +195,11 @@
   
 True
 False
+12
+12
+6
+6
+12
 
   
 True
@@ -205,6 +214,24 @@
 0
   
 
+
+  
+True
+True
+True
+center
+
+  
+Click 
the Shrink icon to reduce the dialog to the size of the input field. It is then 
easier to mark the required reference in the sheet. The icons then 
automatically convert to the Maximize icon. Click it to restore the dialog to 
its original size.
+  
+
+  
+  
+False
+True
+1
+  
+
   
 
 


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-10-28 Thread Paris Oplopoios (via logerrit)
 sc/source/filter/excel/xecontent.cxx |   17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit a63bd448c84c8b337b099d3b0c027f40516bc603
Author: Paris Oplopoios 
AuthorDate: Thu Oct 26 12:35:23 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Sat Oct 28 22:26:11 2023 +0200

sc: Export conditional formatting expression correctly for text rules

Text rules like BeginsWith would discard the expression if it was a
number when exporting, which is not what is supposed to happen - as
something like a conditional formatting rule BeginsWith "1" should be
valid.

Change-Id: I2d53754c462403f20b1991fa201184fcab3616a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158440
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Paris Oplopoios 

diff --git a/sc/source/filter/excel/xecontent.cxx 
b/sc/source/filter/excel/xecontent.cxx
index 316fe673c359..71bf09cc84f5 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1057,7 +1057,22 @@ void XclExpCFImpl::SaveXml( XclExpXmlStream& rStrm )
 // the token array for that
 std::unique_ptr 
pTokenArray(mrFormatEntry.CreateFlatCopiedTokenArray(0));
 if(pTokenArray->GetLen())
-aText = 
pTokenArray->FirstToken()->GetString().getString().toUtf8();
+{
+formula::StackVar eType = pTokenArray->FirstToken()->GetType();
+switch (eType)
+{
+case formula::svDouble:
+{
+aText = 
OString::number(pTokenArray->FirstToken()->GetDouble());
+break;
+}
+default:
+{
+aText = 
pTokenArray->FirstToken()->GetString().getString().toUtf8();
+break;
+}
+}
+}
 }
 
 sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-10-28 Thread Caolán McNamara (via logerrit)
 sc/source/ui/inc/viewdata.hxx  |1 +
 sc/source/ui/view/viewdata.cxx |   33 +
 2 files changed, 18 insertions(+), 16 deletions(-)

New commits:
commit 396f56a2e7f6d818846c1d97d2d008b279e746e1
Author: Caolán McNamara 
AuthorDate: Thu Oct 26 12:47:21 2023 +0100
Commit: Tomaž Vajngerl 
CommitDate: Sat Oct 28 13:28:18 2023 +0200

null-deref seen in ScTabView::UpdateEditView

 #0  0x7f2bcc41df63 in ScViewData::GetCurYForTab 
(this=this@entry=0x3502d0b8, nTabIndex=nTabIndex@entry=6)
 at libreoffice/sc/source/ui/view/viewdata.cxx:1443
 #1  0x7f2bcc3ebf02 in ScTabView::UpdateEditView 
(this=this@entry=0x3502d0b0) at libreoffice/sc/source/ui/view/tabview3.cxx:2185
 #2  0x7f2bcc3ec636 in ScTabView::UpdateFormulas 
(this=this@entry=0x3502d0b0, nStartCol=nStartCol@entry=-1, 
nStartRow=nStartRow@entry=-1, nEndCol=nEndCol@entry=-1,
 nEndRow=nEndRow@entry=-1) at 
libreoffice/sc/source/ui/view/tabview3.cxx:2327
 #3  0x7f2bcc40735c in ScTabViewShell::Notify (this=0x3502cf20, 
rBC=..., rHint=...) at libreoffice/sc/source/ui/view/tabvwsh5.cxx:216
 #4  0x7f2bdc1885a9 in SfxBroadcaster::Broadcast 
(this=this@entry=0x31e31430, rHint=...)
 at libreoffice/svl/source/notify/SfxBroadcaster.cxx:40
 #5  0x7f2bcc022e6d in ScDocShell::PostDataChanged 
(this=this@entry=0x31e31430) at libreoffice/sc/source/ui/docshell/docsh3.cxx:95
 #6  0x7f2bcc0101aa in ScDocShell::SetDocumentModified 
(this=0x31e31430) at libreoffice/sc/source/ui/docshell/docsh.cxx:3015
 #7  0x7f2bcc010df3 in ScDocShellModificator::SetDocumentModified 
(this=this@entry=0x7fff2d168da0)
 at libreoffice/sc/source/ui/docshell/docsh.cxx:3330
 #8  0x7f2bcc040c1a in ScDocShell::MoveTable 
(this=this@entry=0x31e31430, nSrcTab=, nDestTab=, 
bCopy=bCopy@entry=false, bRecord=bRecord@entry=false)
 at libreoffice/sc/source/ui/docshell/docsh5.cxx:1010
 #9  0x7f2bcc441a41 in ScViewFunc::MoveTable 
(this=this@entry=0x333d0fe0, nDestDocNo=nDestDocNo@entry=0, 
nDestTab=nDestTab@entry=7, bCopy=bCopy@entry=false,
 pNewTabName=pNewTabName@entry=0x7fff2d169068) at 
libreoffice/sc/source/ui/view/viewfun2.cxx:3117
 #10 0x7f2bcc418459 in ScTabViewShell::ExecuteTable (this=0x333d0e50, 
rReq=...) at libreoffice/sc/source/ui/view/tabvwshf.cxx:593
 #11 0x7f2bdbd3d96f in SfxDispatcher::Call_Impl 
(this=this@entry=0x33379ed0, rShell=..., rSlot=..., rReq=..., 
bRecord=)
 at libreoffice/sfx2/source/control/dispatch.cxx:254
 #12 0x7f2bdbd427ee in SfxDispatcher::Execute_ 
(this=this@entry=0x33379ed0, rShell=..., rSlot=..., rReq=..., 
eCallMode=eCallMode@entry=SfxCallMode::RECORD)
 at libreoffice/sfx2/source/control/dispatch.cxx:753
 #13 0x7f2bdbd45a33 in SfxDispatcher::Execute (this=0x33379ed0, 
nSlot=, nCall=nCall@entry=SfxCallMode::RECORD, 
pArgs=pArgs@entry=0x7fff2d1694a0,
 pInternalArgs=pInternalArgs@entry=0x7fff2d169460, nModi=nModi@entry=0) 
at libreoffice/sfx2/source/control/dispatch.cxx:813
 #14 0x7f2bdbd83c0f in SfxDispatchController_Impl::dispatch 
(this=, aURL=..., aArgs=..., rListener=...)

we have nulls in here for hidden sheets

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

diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 34bc8c49c4f6..abe93954f774 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -343,6 +343,7 @@ private:
 SAL_DLLPRIVATE void  CreateSelectedTabData();
 SAL_DLLPRIVATE void  EnsureTabDataSize(size_t nSize);
 SAL_DLLPRIVATE void  UpdateCurrentTab();
+SAL_DLLPRIVATE ScViewDataTable* FetchTableData(SCTAB) const;
 
 ScViewData(ScDocument* pDoc, ScDocShell* pDocSh, ScTabViewShell* pViewSh);
 
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index e400f1b314ff..57ef3e5487d0 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1427,36 +1427,37 @@ SCROW ScViewData::GetPosY( ScVSplitPos eWhich, SCTAB 
nForTab ) const
 return maTabData[nForTab]->nPosY[eWhich];
 }
 
-SCCOL ScViewData::GetCurXForTab( SCTAB nTabIndex ) const
+ScViewDataTable* ScViewData::FetchTableData(SCTAB nTabIndex) const
 {
-if (!ValidTab(nTabIndex) || (nTabIndex >= 
static_cast(maTabData.size())) || !maTabData[nTabIndex])
-return -1;
+if (!ValidTab(nTabIndex) || (nTabIndex >= 
static_cast(maTabData.size(
+return nullptr;
+ScViewDataTable* pRet = maTabData[nTabIndex].get();
+SAL_WARN_IF(!pRet, "sc.viewdata", "ScViewData::FetchTableData: hidden 
sheet = " << nTabIndex);
+return pRet;
+}
 
-return maTabData[nTabIndex]->nCurX;
+SCCOL ScViewData::GetCurXForTab( SCTAB nTabIndex ) const
+{
+ScViewDataTable* 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-10-27 Thread Caolán McNamara (via logerrit)
 sc/source/ui/docshell/docsh4.cxx |   46 ++-
 1 file changed, 22 insertions(+), 24 deletions(-)

New commits:
commit 9c5f72071ea7f268cfbd5c7f76f8a6c3c970887b
Author: Caolán McNamara 
AuthorDate: Fri Oct 27 12:04:29 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Oct 27 17:47:31 2023 +0200

calc comment boost::property_tree::ptree use quotes comment id numbers

which does not conform to JSON standard and means that added/deleted
comment ids are strings and not numbers as created by the related
getPostIts

found during: https://github.com/CollaboraOnline/online/issues/7334
where if the regular updating of comments via getPostIts doesn't happen
then deleting/adding comments doesn't appear to work

boost bug report found as:
https://svn.boost.org/trac/boost/ticket/9721
https://marc.info/?l=boost-bugs=139351272302586=2

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

diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index ceef6e3009f5..5c1f6b0505f7 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -19,8 +19,6 @@
 
 #include 
 
-#include 
-
 #include 
 
 using namespace ::com::sun::star;
@@ -55,6 +53,7 @@ using namespace ::com::sun::star;
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2531,32 +2530,31 @@ void 
ScDocShell::LOKCommentNotify(LOKCommentNotificationType nType, const ScDocu
  comphelper::LibreOfficeKit::isTiledAnnotations() )
 return;
 
-boost::property_tree::ptree aAnnotation;
-aAnnotation.put("action", (nType == LOKCommentNotificationType::Add ? 
"Add" :
-   (nType == LOKCommentNotificationType::Remove ? 
"Remove" :
-(nType == LOKCommentNotificationType::Modify ? 
"Modify" : "???";
+tools::JsonWriter aAnnotation;
+{
+auto commentNode = aAnnotation.startNode("comment");
+aAnnotation.put("action", (nType == LOKCommentNotificationType::Add ? 
"Add" :
+   (nType == 
LOKCommentNotificationType::Remove ? "Remove" :
+(nType == 
LOKCommentNotificationType::Modify ? "Modify" : "???";
 
-assert(pNote);
-aAnnotation.put("id", pNote->GetId());
-aAnnotation.put("tab", rPos.Tab());
+assert(pNote);
+aAnnotation.put("id", pNote->GetId());
+aAnnotation.put("tab", rPos.Tab());
 
-if (nType != LOKCommentNotificationType::Remove)
-{
-aAnnotation.put("author", pNote->GetAuthor());
-aAnnotation.put("dateTime", pNote->GetDate());
-aAnnotation.put("text", pNote->GetText());
-
-// Calculating the cell cursor position
-ScViewData* pViewData = GetViewData();
-if (pViewData && pViewData->GetActiveWin())
-aAnnotation.put("cellRange", 
ScPostIt::NoteRangeToJsonString(*pDocument, rPos));
+if (nType != LOKCommentNotificationType::Remove)
+{
+aAnnotation.put("author", pNote->GetAuthor());
+aAnnotation.put("dateTime", pNote->GetDate());
+aAnnotation.put("text", pNote->GetText());
+
+// Calculating the cell cursor position
+ScViewData* pViewData = GetViewData();
+if (pViewData && pViewData->GetActiveWin())
+aAnnotation.put("cellRange", 
ScPostIt::NoteRangeToJsonString(*pDocument, rPos));
+}
 }
 
-boost::property_tree::ptree aTree;
-aTree.add_child("comment", aAnnotation);
-std::stringstream aStream;
-boost::property_tree::write_json(aStream, aTree);
-std::string aPayload = aStream.str();
+std::string aPayload(aAnnotation.extractAsStdString());
 
 ScViewData* pViewData = GetViewData();
 SfxViewShell* pThisViewShell = ( pViewData ? pViewData->GetViewShell() : 
nullptr );


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-10-24 Thread Noel Grandin (via logerrit)
 sc/source/core/data/column2.cxx |4 
 sc/source/ui/view/output2.cxx   |   14 +-
 2 files changed, 13 insertions(+), 5 deletions(-)

New commits:
commit 18c2358d3b0658b20daa045a8950cb2bfb15bd7b
Author: Noel Grandin 
AuthorDate: Sun Oct 22 21:25:15 2023 +0200
Commit: Caolán McNamara 
CommitDate: Tue Oct 24 12:54:10 2023 +0200

cool#7332 calc perf: GetEmptyLinesInBlock

reuse existing method to find area of sheet which contains data - this 
method already caches the necessary data.

Also add a shortcut for the common case in ScColumn::IsEmptyData to avoid 
performing more expensive lookup operation.


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

diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index e01a3458f6fc..3abb568befbc 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1318,6 +1318,10 @@ bool ScColumn::HasVisibleDataAt(SCROW nRow) const
 
 bool ScColumn::IsEmptyData(SCROW nStartRow, SCROW nEndRow) const
 {
+// simple case
+if (maCells.block_size() == 1 && maCells.begin()->type == 
sc::element_type_empty)
+return true;
+
 std::pair aPos = 
maCells.position(nStartRow);
 sc::CellStoreType::const_iterator it = aPos.first;
 if (it == maCells.end())
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 3887f19b3d5c..9b325a5dbe82 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1517,8 +1517,11 @@ tools::Rectangle ScOutputData::LayoutStrings(bool 
bPixelToLogic, bool bPaint, co
 
 SCCOL nLastContentCol = mpDoc->MaxCol();
 if ( nX2 < mpDoc->MaxCol() )
-nLastContentCol = sal::static_int_cast(
-nLastContentCol - mpDoc->GetEmptyLinesInBlock( nX2+1, nY1, nTab, 
mpDoc->MaxCol(), nY2, nTab, DIR_RIGHT ) );
+{
+SCROW nEndRow;
+mpDoc->GetCellArea(nTab, nLastContentCol, nEndRow);
+}
+
 SCCOL nLoopStartX = nX1;
 if ( nX1 > 0 )
 --nLoopStartX;  // start before nX1 for rest of long text to 
the left
@@ -4319,11 +4322,12 @@ void ScOutputData::DrawEdit(bool bPixelToLogic)
 }
 tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
 
-//! store nLastContentCol as member!
 SCCOL nLastContentCol = mpDoc->MaxCol();
 if ( nX2 < mpDoc->MaxCol() )
-nLastContentCol = sal::static_int_cast(
-nLastContentCol - mpDoc->GetEmptyLinesInBlock( nX2+1, nY1, nTab, 
mpDoc->MaxCol(), nY2, nTab, DIR_RIGHT ) );
+{
+SCROW nEndRow;
+mpDoc->GetCellArea(nTab, nLastContentCol, nEndRow);
+}
 
 tools::Long nRowPosY = nScrY;
 for (SCSIZE nArrY=0; nArrY+1

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-10-20 Thread Michael Meeks (via logerrit)
 sc/source/core/data/column4.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 00563949554ca52f7316e9c8769b4567d8875c88
Author: Michael Meeks 
AuthorDate: Thu Oct 19 15:15:33 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Oct 20 11:26:58 2023 +0200

sc: perf: avoid construction of collector for empty note columns.

It is extremely common to have empty note columns; so shorten this
path profile in: cool#7334

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

diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 49420642bf5f..aeb38e00150a 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -860,7 +860,9 @@ public:
 
 void ScColumn::GetAllNoteEntries( std::vector& rNotes ) const
 {
-std::for_each(maCellNotes.begin(), maCellNotes.end(), 
NoteEntryCollector(rNotes, nTab, nCol, 0, GetDoc().MaxRow()));
+if (HasCellNotes())
+std::for_each(maCellNotes.begin(), maCellNotes.end(),
+  NoteEntryCollector(rNotes, nTab, nCol, 0, 
GetDoc().MaxRow()));
 }
 
 void ScColumn::GetNotesInRange(SCROW nStartRow, SCROW nEndRow,


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-10-13 Thread Noel Grandin (via logerrit)
 sc/source/ui/view/output2.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 5da82a87517819c4d3c3a87c09934ecdc51fc855
Author: Noel Grandin 
AuthorDate: Fri Oct 13 08:18:46 2023 +0200
Commit: Caolán McNamara 
CommitDate: Fri Oct 13 13:30:22 2023 +0200

cool#6893 disable undo for editengine when rendering cell text

We don't need undo functionality when performing pure cell text
rendering, shaves some CPU time off

Change-Id: Icfc688122af7e77c874dd984555b2b0951e9e134
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157882
Reviewed-by: Michael Meeks 
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 8543f2f517c7..3887f19b3d5c 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -2168,6 +2168,7 @@ std::unique_ptr 
ScOutputData::CreateOutputEditEngine()
 {
 std::unique_ptr pEngine(new ScFieldEditEngine(mpDoc, 
mpDoc->GetEnginePool()));
 pEngine->SetUpdateLayout( false );
+pEngine->EnableUndo( false ); // dont need undo for painting purposes
 // a RefDevice always has to be set, otherwise EditEngine would create a 
VirtualDevice
 pEngine->SetRefDevice( pFmtDevice );
 EEControlBits nCtrl = pEngine->GetControlWord();


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-10-06 Thread Caolán McNamara (via logerrit)
 sc/source/ui/navipi/navipi.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 140d02bb818c47795dcb89845150ce2b10194dc3
Author: Caolán McNamara 
AuthorDate: Fri Oct 6 13:01:12 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Oct 6 18:01:09 2023 +0200

cool#7373 the document doesn't change in online

the navigator always looks at the same document

calc should do like writer and have the navigator listen to just
the initial document until that dies. This is the safest option
to take for the scenario in question though.

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

diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index 037bc9b0836c..83a099659472 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -490,6 +490,11 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
 {
 if (rHint.GetId() == SfxHintId::ThisIsAnSfxEventHint)
 {
+// This is for when the document might change and the navigator
+// wants to update for the new document, which isn't a scenario
+// that happens in online.
+if (comphelper::LibreOfficeKit::isActive())
+return;
 const SfxEventHint& rEventHint = static_cast(rHint);
 if (rEventHint.GetEventId() == SfxEventHintId::ActivateDoc)
 {


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-10-05 Thread Caolán McNamara (via logerrit)
 sc/source/filter/xml/XMLExportIterator.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 70a13bda1fa686a3d615085bc6070c8032968d63
Author: Caolán McNamara 
AuthorDate: Thu Oct 5 14:27:45 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Oct 5 17:43:30 2023 +0200

ubsan error seen export to ods

sc/source/filter/xml/XMLExportIterator.cxx:722:30: runtime error: load of 
value 5, which is not a valid value for type 'bool'

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

diff --git a/sc/source/filter/xml/XMLExportIterator.cxx 
b/sc/source/filter/xml/XMLExportIterator.cxx
index 6d8c408f19ec..bff7e8498642 100644
--- a/sc/source/filter/xml/XMLExportIterator.cxx
+++ b/sc/source/filter/xml/XMLExportIterator.cxx
@@ -712,7 +712,7 @@ bool ScMyNotEmptyCellsIterator::GetNext(ScMyCell& aCell, 
ScFormatRangeStyles* pC
 pDetectiveOp->SetCellData( aCell );
 
 HasAnnotation( aCell );
-bool bIsAutoStyle;
+bool bIsAutoStyle(false);
 // Ranges before the previous cell are not needed by 
ExportFormatRanges anymore and can be removed
 SCROW nRemoveBeforeRow = aLastAddress.Row();
 aCell.nStyleIndex = 
pCellStyles->GetStyleNameIndex(aCell.maCellAddress.Tab(),


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-09-27 Thread Caolán McNamara (via logerrit)
 sc/source/core/tool/numformat.cxx |   35 ++-
 1 file changed, 18 insertions(+), 17 deletions(-)

New commits:
commit f1e7d9726b09aeb8f0aece65a98298f4ef9022ed
Author: Caolán McNamara 
AuthorDate: Tue Sep 26 21:09:02 2023 +0100
Commit: Noel Grandin 
CommitDate: Wed Sep 27 14:00:33 2023 +0200

perf: NumFmtUtil::isLatinScript doesn't need to copy OUString

the original const OUString& from LocaleDataWrapper::getNumDecimalSep is
sufficient

aDecSep OUString dtor appeared as 2% of a sampled session

Change-Id: Ib9408b32443eb6ba66a9dfc32a9179941c67bdf9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157299
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Noel Grandin 

diff --git a/sc/source/core/tool/numformat.cxx 
b/sc/source/core/tool/numformat.cxx
index 8b8512339d43..c69da6de4e3b 100644
--- a/sc/source/core/tool/numformat.cxx
+++ b/sc/source/core/tool/numformat.cxx
@@ -27,6 +27,23 @@
 #include 
 #include 
 
+namespace
+{
+const OUString& getNumDecimalSep(const SvNumberformat& rFormat)
+{
+LanguageType nFormatLang = rFormat.GetLanguage();
+if (nFormatLang == LANGUAGE_SYSTEM)
+return ScGlobal::getLocaleData().getNumDecimalSep();
+// LocaleDataWrapper can be expensive to construct, so cache the 
result for
+// repeated calls
+static std::optional localeCache;
+if (!localeCache || localeCache->getLanguageTag().getLanguageType() != 
nFormatLang)
+localeCache.emplace(
+comphelper::getProcessComponentContext(), 
LanguageTag(nFormatLang));
+return localeCache->getNumDecimalSep();
+}
+}
+
 namespace sc {
 
 bool NumFmtUtil::isLatinScript( const ScPatternAttr& rPat, ScDocument& rDoc )
@@ -45,23 +62,7 @@ bool NumFmtUtil::isLatinScript( sal_uLong nFormat, 
ScDocument& rDoc )
 
 // The standard format is all-latin if the decimal separator doesn't
 // have a different script type
-
-OUString aDecSep;
-LanguageType nFormatLang = pFormat->GetLanguage();
-if (nFormatLang == LANGUAGE_SYSTEM)
-aDecSep = ScGlobal::getLocaleData().getNumDecimalSep();
-else
-{
-// LocaleDataWrapper can be expensive to construct, so cache the 
result for
-// repeated calls
-static std::optional localeCache;
-if (!localeCache || localeCache->getLanguageTag().getLanguageType() != 
nFormatLang)
-localeCache.emplace(
-comphelper::getProcessComponentContext(), 
LanguageTag(nFormatLang));
-aDecSep = localeCache->getNumDecimalSep();
-}
-
-SvtScriptType nScript = rDoc.GetStringScriptType(aDecSep);
+SvtScriptType nScript = 
rDoc.GetStringScriptType(getNumDecimalSep(*pFormat));
 return (nScript == SvtScriptType::NONE || nScript == SvtScriptType::LATIN);
 }
 


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-09-27 Thread Noel Grandin (via logerrit)
 sc/source/core/tool/numformat.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 79e723cde11d2eba6d45d6c89a3d3109062e675c
Author: Noel Grandin 
AuthorDate: Tue Jun 13 22:04:09 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Sep 27 08:00:21 2023 +0200

tdf#151946 cache LocaleDataWrapper

because it is a little more expensive these days to create it, since I
made it an immutable type (which is also why we can safely cache it)

Reduces load time from 7s to 1.5s for me

Change-Id: I583381f0ee5494b8edf746b2329ac5751a9e5d86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153006
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157301
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/core/tool/numformat.cxx 
b/sc/source/core/tool/numformat.cxx
index 8240c1ac6e4f..8b8512339d43 100644
--- a/sc/source/core/tool/numformat.cxx
+++ b/sc/source/core/tool/numformat.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace sc {
 
@@ -51,9 +52,13 @@ bool NumFmtUtil::isLatinScript( sal_uLong nFormat, 
ScDocument& rDoc )
 aDecSep = ScGlobal::getLocaleData().getNumDecimalSep();
 else
 {
-LocaleDataWrapper aLocaleData(
-comphelper::getProcessComponentContext(), 
LanguageTag(nFormatLang));
-aDecSep = aLocaleData.getNumDecimalSep();
+// LocaleDataWrapper can be expensive to construct, so cache the 
result for
+// repeated calls
+static std::optional localeCache;
+if (!localeCache || localeCache->getLanguageTag().getLanguageType() != 
nFormatLang)
+localeCache.emplace(
+comphelper::getProcessComponentContext(), 
LanguageTag(nFormatLang));
+aDecSep = localeCache->getNumDecimalSep();
 }
 
 SvtScriptType nScript = rDoc.GetStringScriptType(aDecSep);


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-09-13 Thread Tomaž Vajngerl (via logerrit)
 sc/source/filter/oox/sheetdatacontext.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c148e51c446855cc751e955652081578f57e63d3
Author: Tomaž Vajngerl 
AuthorDate: Tue Sep 12 14:34:03 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed Sep 13 08:09:57 2023 +0200

sc: row import - default style index is 0 and not -1

When importing CT_Row structure, the style index is 0 by default
and not -1. The effect of this is that the style is not applied
for the rows, because the index is -1. With the change to 0, the
style applied is the first style, which is the correct behaviour
and this fixes the issue with the test document.

Change-Id: If5ab571e8dd7ec1319e7cb4d26ba006ca827eca6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156845
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 2412ae8d8854a96bd3dc423e199c6356355cde83)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156748
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/filter/oox/sheetdatacontext.cxx 
b/sc/source/filter/oox/sheetdatacontext.cxx
index bc5855e9f4b7..19ad0a2a3465 100644
--- a/sc/source/filter/oox/sheetdatacontext.cxx
+++ b/sc/source/filter/oox/sheetdatacontext.cxx
@@ -279,7 +279,7 @@ void SheetDataContext::importRow( const AttributeList& 
rAttribs )
 mnCol = -1;
 
 aModel.mfHeight   = rAttribs.getDouble( XML_ht, -1.0 );
-aModel.mnXfId = rAttribs.getInteger( XML_s, -1 );
+aModel.mnXfId = rAttribs.getInteger(XML_s, 0); // default style index is 0
 aModel.mnLevel= rAttribs.getInteger( XML_outlineLevel, 0 );
 aModel.mbCustomHeight = rAttribs.getBool( XML_customHeight, false );
 aModel.mbCustomFormat = rAttribs.getBool( XML_customFormat, false );


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-09-12 Thread Dennis Francis (via logerrit)
 sc/source/ui/dbgui/pvfundlg.cxx |   18 +++---
 sc/source/ui/inc/pvfundlg.hxx   |1 -
 2 files changed, 3 insertions(+), 16 deletions(-)

New commits:
commit 88afeef7cf58863707ea9fe404fdc3942e74e55b
Author: Dennis Francis 
AuthorDate: Mon Sep 11 17:49:32 2023 +0530
Commit: Dennis Francis 
CommitDate: Tue Sep 12 16:09:00 2023 +0200

sc:pivot allow sort by selection in non-manual mode

Otherwise it is currently impossible to sort a field by its data
summarization values.

The RadioClickHdl is now doing nothing hence is removed with this
change.

Change-Id: I76064ce05e5b996ad96f596524be351708ef35e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156823
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Dennis Francis 

diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx
index f74bb4b7391d..7f97e2576795 100644
--- a/sc/source/ui/dbgui/pvfundlg.cxx
+++ b/sc/source/ui/dbgui/pvfundlg.cxx
@@ -703,9 +703,11 @@ void ScDPSubtotalOptDlg::FillLabelData( ScDPLabelData& 
rLabelData ) const
 {
 rLabelData.maSortInfo.Field =
 ScDPUtil::createDuplicateDimensionName(aFieldName.maName, 
aFieldName.mnDupCount);
-rLabelData.maSortInfo.IsAscending = m_xRbSortAsc->get_active();
 }
 
+if (rLabelData.maSortInfo.Mode != DataPilotFieldSortMode::MANUAL)
+rLabelData.maSortInfo.IsAscending = m_xRbSortAsc->get_active();
+
 // *** LAYOUT MODE ***
 
 rLabelData.maLayoutInfo.LayoutMode = 
ToDataPilotFieldLayoutMode(m_xLbLayout->get_active());
@@ -769,11 +771,6 @@ void ScDPSubtotalOptDlg::Init( const ScDPNameVec& 
rDataFields, bool bEnableLayou
 }
 m_xLbSortBy->set_active(nSortPos);
 
-// sorting mode
-m_xRbSortAsc->connect_toggled( LINK( this, ScDPSubtotalOptDlg, 
RadioClickHdl ) );
-m_xRbSortDesc->connect_toggled( LINK( this, ScDPSubtotalOptDlg, 
RadioClickHdl ) );
-m_xRbSortMan->connect_toggled( LINK( this, ScDPSubtotalOptDlg, 
RadioClickHdl ) );
-
 weld::RadioButton* pRBtn = nullptr;
 switch( nSortMode )
 {
@@ -785,7 +782,6 @@ void ScDPSubtotalOptDlg::Init( const ScDPNameVec& 
rDataFields, bool bEnableLayou
 pRBtn = maLabelData.maSortInfo.IsAscending ? m_xRbSortAsc.get() : 
m_xRbSortDesc.get();
 }
 pRBtn->set_active(true);
-RadioClickHdl(*pRBtn);
 
 // *** LAYOUT MODE ***
 
@@ -879,14 +875,6 @@ IMPL_LINK(ScDPSubtotalOptDlg, ButtonClicked, 
weld::Button&, rButton, void)
 response(RET_CANCEL);
 }
 
-IMPL_LINK(ScDPSubtotalOptDlg, RadioClickHdl, weld::Toggleable&, rBtn, void)
-{
-if (!rBtn.get_active())
-return;
-
-m_xLbSortBy->set_sensitive(m_xRbSortMan->get_active());
-}
-
 IMPL_LINK(ScDPSubtotalOptDlg, CheckHdl, weld::Toggleable&, rCBox, void)
 {
 if ( == m_xCbShow.get())
diff --git a/sc/source/ui/inc/pvfundlg.hxx b/sc/source/ui/inc/pvfundlg.hxx
index f5f140c54cdf..146048cfedbf 100644
--- a/sc/source/ui/inc/pvfundlg.hxx
+++ b/sc/source/ui/inc/pvfundlg.hxx
@@ -150,7 +150,6 @@ private:
 /** Searches for a listbox entry, starts search at specified position. */
 sal_Int32 FindListBoxEntry( const weld::ComboBox& rLBox, 
std::u16string_view rEntry, sal_Int32 nStartPos ) const;
 
-DECL_LINK( RadioClickHdl, weld::Toggleable&, void );
 DECL_LINK( CheckHdl, weld::Toggleable&, void );
 DECL_LINK( SelectHdl, weld::ComboBox&, void );
 DECL_LINK( ButtonClicked, weld::Button&, void );


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-09-05 Thread Aron Budea (via logerrit)
 sc/source/ui/view/tabview2.cxx |   10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

New commits:
commit 8f822b7032c98d37bd0cb7cb010f0375444f4f31
Author: Aron Budea 
AuthorDate: Mon Sep 4 03:15:13 2023 +0200
Commit: Aron Budea 
CommitDate: Tue Sep 5 11:14:00 2023 +0200

sc: ui: view: Use conditional assignment

Change-Id: I51ba012079a955c139a0c55f12a4b141ba536aa6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156502
Tested-by: Jenkins
Reviewed-by: Henry Castro 
(cherry picked from commit 4d8cff696cfdb23733b0e91348b28a83f1c3bedc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156538
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Aron Budea 

diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index 308e734f95a0..d2293ff94f36 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -217,10 +217,7 @@ void moveRefByCell(SCCOL& rNewX, SCROW& rNewY,
 SCCOL nTempX = rNewX;
 while (rDoc.IsHorOverlapped(nTempX, rNewY, nRefTab))
 {
-if (nMovX > 0)
-++nTempX;
-else
---nTempX;
+nTempX = (nMovX > 0) ? nTempX + 1 : nTempX - 1;
 if (!checkBoundary(, nTempX, rNewY))
 break;
 }
@@ -242,10 +239,7 @@ void moveRefByCell(SCCOL& rNewX, SCROW& rNewY,
 SCROW nTempY = rNewY;
 while (rDoc.IsVerOverlapped(rNewX, nTempY, nRefTab))
 {
-if (nMovY > 0)
-++nTempY;
-else
---nTempY;
+nTempY = (nMovY > 0) ? nTempY + 1 : nTempY - 1;
 if (!checkBoundary(, rNewX, nTempY))
 break;
 }


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-08-30 Thread Michael Meeks (via logerrit)
 sc/source/ui/app/inputwin.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 2721148fe36aaab9c2eed6c52a4afde7a868e29d
Author: Michael Meeks 
AuthorDate: Tue Aug 29 22:08:42 2023 +0100
Commit: Caolán McNamara 
CommitDate: Wed Aug 30 10:29:52 2023 +0200

lok: avoid forcing expensive re-layout of the calc input bar.

This occured on doc_setView and was unreasonably expensive - loading and
de-compressing new PNGs as multiple users typed, re-sizing and
re-rendering a toolbar that is not visible -> do nothing here.

cf. cool#6893.

Change-Id: I1980a3a4516fb2aa629da85de9d4628f29de5af7
Signed-off-by: Michael Meeks 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156219
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 07a4cd93a836..1afa94c23822 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1104,6 +1104,10 @@ void ScInputBarGroup::NumLinesChanged()
 
 void ScInputBarGroup::TriggerToolboxLayout()
 {
+// layout changes are expensive and un-necessary.
+if (comphelper::LibreOfficeKit::isActive())
+return;
+
 vcl::Window *w=GetParent();
 ScInputWindow  = dynamic_cast(*w);
 SfxViewFrame* pViewFrm = SfxViewFrame::Current();


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-08-28 Thread Tomaž Vajngerl (via logerrit)
 sc/source/filter/excel/xestyle.cxx  |   96 ++--
 sc/source/filter/inc/export/ExportTools.hxx |   38 +++
 2 files changed, 59 insertions(+), 75 deletions(-)

New commits:
commit 2f9385f184f39d70d55c301a1173dc5eedd60979
Author: Tomaž Vajngerl 
AuthorDate: Sat Jul 29 15:42:32 2023 +0200
Commit: Mike Kaganski 
CommitDate: Mon Aug 28 12:40:43 2023 +0200

sc: remove code duplication at OOXML export of ComplexColor

This removes the code duplication when exporting the ComplexColor
to OOXML. Now we use a common oox::xls::writeComplexColor function
which writes a ComplexColor to the stream.

Change-Id: I4e7bb1f8427409d09550c71894c327dba5096bec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155110
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit fc996d8d195263f09d8aaf65deaf9d42f7413be8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156103
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mike Kaganski 

diff --git a/sc/source/filter/excel/xestyle.cxx 
b/sc/source/filter/excel/xestyle.cxx
index 403121ffec37..50db4781f1d4 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -49,6 +49,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1852,29 +1853,17 @@ static void lcl_WriteBorder(XclExpXmlStream& rStrm, 
sal_Int32 nElement, sal_uInt
 if( nLineStyle == EXC_LINE_NONE )
 {
 rStyleSheet->singleElement(nElement);
-}
-else if (rComplexColor.isValidSchemeType())
-{
-rStyleSheet->startElement(nElement, XML_style, 
ToLineStyle(nLineStyle));
-
-sal_Int32 nTheme = 
oox::convertThemeColorTypeToExcelThemeNumber(rComplexColor.getSchemeType());
-double fTintShade = 
oox::convertColorTransformsToTintOrShade(rComplexColor);
-rStyleSheet->singleElement(XML_color,
-XML_theme, OString::number(nTheme),
-XML_tint, 
sax_fastparser::UseIf(OString::number(fTintShade), fTintShade != 0.0));
-
-rStyleSheet->endElement(nElement);
+return;
 }
 else if (rColor == Color(0, 0, 0))
 {
 rStyleSheet->singleElement(nElement, XML_style, 
ToLineStyle(nLineStyle));
+return;
 }
-else
-{
-rStyleSheet->startElement(nElement, XML_style, 
ToLineStyle(nLineStyle));
-rStyleSheet->singleElement(XML_color, XML_rgb, 
XclXmlUtils::ToOString(rColor));
-rStyleSheet->endElement( nElement );
-}
+
+rStyleSheet->startElement(nElement, XML_style, ToLineStyle(nLineStyle));
+oox::xls::writeComplexColor(rStyleSheet, XML_color, rComplexColor, rColor);
+rStyleSheet->endElement(nElement);
 }
 
 void XclExpCellBorder::SaveXml(XclExpXmlStream& rStream) const
@@ -2004,62 +1993,27 @@ void XclExpCellArea::SaveXml( XclExpXmlStream& rStrm ) 
const
 
 if (maForeColor != COL_TRANSPARENT || maBackColor != COL_TRANSPARENT)
 {
-if (maForegroundComplexColor.isValidSchemeType())
-{
-sal_Int32 nTheme = 
oox::convertThemeColorTypeToExcelThemeNumber(maForegroundComplexColor.getSchemeType());
-double fTintShade = 
oox::convertColorTransformsToTintOrShade(maForegroundComplexColor);
-rStyleSheet->singleElement(XML_fgColor,
-XML_theme, OString::number(nTheme),
-XML_tint, 
sax_fastparser::UseIf(OString::number(fTintShade), fTintShade != 0.0));
-}
-else if (maForeColor != COL_TRANSPARENT)
-{
-rStyleSheet->singleElement(XML_fgColor, XML_rgb, 
XclXmlUtils::ToOString(maForeColor));
-}
-
-if (maBackgroundComplexColor.isValidSchemeType())
-{
-sal_Int32 nTheme = 
oox::convertThemeColorTypeToExcelThemeNumber(maBackgroundComplexColor.getSchemeType());
-double fTintShade = 
oox::convertColorTransformsToTintOrShade(maBackgroundComplexColor);
-rStyleSheet->singleElement(XML_bgColor,
-XML_theme, OString::number(nTheme),
-XML_tint, 
sax_fastparser::UseIf(OString::number(fTintShade), fTintShade != 0.0));
-}
-else if (maBackColor != COL_TRANSPARENT)
-{
-rStyleSheet->singleElement(XML_bgColor, XML_rgb, 
XclXmlUtils::ToOString(maBackColor));
-}
+oox::xls::writeComplexColor(rStyleSheet, XML_fgColor, 
maForegroundComplexColor, maForeColor);
+oox::xls::writeComplexColor(rStyleSheet, XML_bgColor, 
maBackgroundComplexColor, maBackColor);
 }
 else
 {
-if (maForegroundComplexColor.isValidSchemeType())
-{
-sal_Int32 nTheme = 
oox::convertThemeColorTypeToExcelThemeNumber(maForegroundComplexColor.getSchemeType());
-double fTintShade = 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-08-28 Thread Tomaž Vajngerl (via logerrit)
 sc/source/filter/inc/stylesbuffer.hxx  |   18 +-
 sc/source/filter/inc/viewsettings.hxx  |2 +-
 sc/source/filter/inc/worksheetsettings.hxx |4 ++--
 sc/source/filter/oox/stylesbuffer.cxx  |   27 +++
 4 files changed, 27 insertions(+), 24 deletions(-)

New commits:
commit fb1660e1360c5331b3e7a7411eb07f45951a8cd7
Author: Tomaž Vajngerl 
AuthorDate: Fri Jul 28 17:01:42 2023 +0200
Commit: Mike Kaganski 
CommitDate: Mon Aug 28 12:40:26 2023 +0200

sc: rename oox::xls::Color to oox::xls::XlsColor

It's annoying that the class name is so similar to the commonly
used class Color, even when it is in its own namespace. To avoid
unneccesary conflicts and confusion, it was renamed.

(Similar would be also good for oox::drawingml::Color)

Change-Id: I68dcaf951b7faf089cb2b13d94576007f40c441e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155109
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 7f265875ef784d717f5a534bdca2cd36fdce7ecb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156102
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mike Kaganski 

diff --git a/sc/source/filter/inc/stylesbuffer.hxx 
b/sc/source/filter/inc/stylesbuffer.hxx
index b454f8bb3f39..c462da48ee20 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -85,7 +85,7 @@ public:
 virtual ::Color getPaletteColor( sal_Int32 nPaletteIdx ) const 
override;
 };
 
-class Color : public ::oox::drawingml::Color
+class XlsColor : public ::oox::drawingml::Color
 {
 public:
 /** Sets the color to automatic. */
@@ -109,7 +109,7 @@ public:
 bool isAuto() const { return isPlaceHolder(); }
 };
 
-SequenceInputStream& operator>>( SequenceInputStream& rStrm, Color& orColor );
+SequenceInputStream& operator>>( SequenceInputStream& rStrm, XlsColor& orColor 
);
 
 /** Stores all colors of the color palette. */
 class ColorPalette : public WorkbookHelper
@@ -138,8 +138,8 @@ private:
 /** Contains all XML font attributes, e.g. from a font or rPr element. */
 struct FontModel
 {
-OUString maName; /// Font name.
-Color   maColor;/// Font color.
+OUString maName;  /// Font name.
+XlsColor maColor; /// Font color.
 sal_Int32   mnScheme;   /// Major/minor scheme font.
 sal_Int32   mnFamily;   /// Font family.
 sal_Int32   mnCharSet;  /// Windows font character set.
@@ -380,7 +380,7 @@ private:
 /** Contains XML attributes of a single border line. */
 struct BorderLineModel
 {
-Color   maColor;/// Borderline color.
+XlsColor maColor; /// Borderline color.
 sal_Int32   mnStyle;/// Border line style.
 boolmbUsed; /// True = line format used.
 
@@ -473,9 +473,9 @@ typedef std::shared_ptr< Border > BorderRef;
 /** Contains XML pattern fill attributes from the patternFill element. */
 struct PatternFillModel
 {
-Color   maPatternColor; /// Pattern foreground color.
-Color   maFilterPatternColor; /// Pattern foreground for color 
filter.
-Color   maFillColor;/// Background fill color.
+XlsColor maPatternColor; /// Pattern foreground color.
+XlsColor maFilterPatternColor; /// Pattern foreground for color filter.
+XlsColor maFillColor;/// Background fill color.
 sal_Int32   mnPattern;  /// Pattern identifier (e.g. 
solid).
 boolmbPattColorUsed;/// True = pattern foreground 
color used.
 boolmbFillColorUsed;/// True = background fill color 
used.
@@ -490,7 +490,7 @@ struct PatternFillModel
 /** Contains XML gradient fill attributes from the gradientFill element. */
 struct GradientFillModel
 {
-typedef ::std::map< double, Color > ColorMap;
+typedef ::std::map ColorMap;
 
 sal_Int32   mnType; /// Gradient type, linear or path.
 double  mfAngle;/// Rotation angle for type linear.
diff --git a/sc/source/filter/inc/viewsettings.hxx 
b/sc/source/filter/inc/viewsettings.hxx
index 2382f5b54112..70797967afd1 100644
--- a/sc/source/filter/inc/viewsettings.hxx
+++ b/sc/source/filter/inc/viewsettings.hxx
@@ -42,7 +42,7 @@ struct SheetViewModel
 typedef RefMap< sal_Int32, PaneSelectionModel > PaneSelectionModelMap;
 
 PaneSelectionModelMap maPaneSelMap; /// Selections of all 
panes.
-Color   maGridColor;/// Grid color.
+XlsColor maGridColor; /// Grid color.
 ScAddress   maFirstPos;/// First visible cell.
 ScAddress   maSecondPos;   /// First visible cell in additional 
panes.
 sal_Int32   mnWorkbookViewId;   /// Index into list of 

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-08-25 Thread Tomaž Vajngerl (via logerrit)
 sc/source/ui/theme/ThemeColorChanger.cxx |   13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 468d6d6af6249a67aed206b3d1b4614433fbbcc2
Author: Tomaž Vajngerl 
AuthorDate: Tue Jul 4 00:44:15 2023 +0900
Commit: Miklos Vajna 
CommitDate: Fri Aug 25 10:33:36 2023 +0200

sc: change theme color for SdrObjects

Change-Id: I318821c843fe937b7011f1674809f8c78df24a2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153938
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 30ee52e6c284be1095fdf278439b4c0a7c5982f0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156076
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/ui/theme/ThemeColorChanger.cxx 
b/sc/source/ui/theme/ThemeColorChanger.cxx
index a245f7b0c1c0..8eaa6ed0fcb6 100644
--- a/sc/source/ui/theme/ThemeColorChanger.cxx
+++ b/sc/source/ui/theme/ThemeColorChanger.cxx
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -129,9 +130,9 @@ void 
ThemeColorChanger::apply(std::shared_ptr const& pColorSet)
 pStyle = static_cast(pPool->Next());
 }
 
-// Change Cell / Text attributes
 for (SCTAB nTab = 0; nTab < rDocument.GetTableCount(); nTab++)
 {
+// Change Cell / Text attributes
 ScDocAttrIterator aAttributeIterator(rDocument, nTab, 0, 0, 
rDocument.MaxCol(),
  rDocument.MaxRow());
 SCCOL nCol = 0;
@@ -144,6 +145,16 @@ void 
ThemeColorChanger::apply(std::shared_ptr const& pColorSet)
 auto& rItemSet = pNonConstPattern->GetItemSet();
 changeCellItems(rItemSet, *pColorSet);
 }
+
+// Change all SdrObjects
+SdrPage* pPage = 
rDocument.GetDrawLayer()->GetPage(static_cast(nTab));
+SdrObjListIter aIter(pPage, SdrIterMode::DeepNoGroups);
+SdrObject* pObject = aIter.Next();
+while (pObject)
+{
+svx::theme::updateSdrObject(*pColorSet, pObject);
+pObject = aIter.Next();
+}
 }
 }
 


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-08-25 Thread Tomaž Vajngerl (via logerrit)
 sc/source/ui/drawfunc/drawsh.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 59bf914bf96b27f5aa4cb26c652ee0ba702fd45b
Author: Tomaž Vajngerl 
AuthorDate: Tue Jul 4 00:38:01 2023 +0900
Commit: Miklos Vajna 
CommitDate: Fri Aug 25 10:32:53 2023 +0200

sc: fix failed assert in when setting a color on a shape

When setting a color with a colorpicker, and assert failed,
because it's not possible to clone a SfxItemSet by value - use
a plane Clone instead, which clones into a SfxItemSet.

Change-Id: I8780ed42d3807e9802d3f4fa1d68e16bd5d5a5e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153937
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 548e5b6d825606bd218ef18591df642872e6acd0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156070
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 60570c9cb669..652e25083090 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -289,9 +289,9 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
 
 if( pView->AreObjectsMarked() )
 {
-SfxItemSet aNewArgs = rReq.GetArgs()->CloneAsValue();
-lcl_convertStringArguments( rReq.GetSlot(), aNewArgs );
-pView->SetAttrToMarked( aNewArgs, false );
+std::unique_ptr aNewArgs = 
rReq.GetArgs()->Clone();
+lcl_convertStringArguments(rReq.GetSlot(), *aNewArgs);
+pView->SetAttrToMarked(*aNewArgs, false);
 }
 else
 pView->SetDefaultAttr( *rReq.GetArgs(), false);


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-08-25 Thread Tomaž Vajngerl (via logerrit)
 sc/source/filter/excel/excdoc.cxx |   26 ++
 sc/source/filter/oox/workbookfragment.cxx |8 
 2 files changed, 34 insertions(+)

New commits:
commit 4d9bd4dbc1261d21e10f81942b2fcf9e4b283f38
Author: Tomaž Vajngerl 
AuthorDate: Fri Jun 30 00:47:27 2023 +0900
Commit: Miklos Vajna 
CommitDate: Fri Aug 25 10:30:34 2023 +0200

sc: OOXML import and export the model::Theme properly

Change-Id: I76fc928a53d007a9f5e9174167e0594208a4b47a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153784
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 9a6cdc8a90cd32e8d9ecdae6fb6684cfa8aadbab)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156068
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/filter/excel/excdoc.cxx 
b/sc/source/filter/excel/excdoc.cxx
index c01dde32981c..cdee12a7c11c 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -53,6 +53,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 #include 
 
 using namespace oox;
@@ -861,6 +865,28 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm )
 {
 InitializeSave();
 
+auto* pDrawLayer = GetDoc().GetDrawLayer();
+if (pDrawLayer)
+{
+SdrPage* pPage = pDrawLayer->GetPage(0);
+if (pPage)
+{
+std::shared_ptr pTheme = 
pPage->getSdrPageProperties().GetTheme();
+if (pTheme)
+{
+OUString sThemeRelationshipPath = "theme/theme1.xml";
+OUString sThemeDocumentPath = "xl/" + 
sThemeRelationshipPath;
+
+oox::ThemeExport aThemeExport(, 
oox::drawingml::DOCUMENT_XLSX);
+aThemeExport.write(sThemeDocumentPath, *pTheme);
+
+
rStrm.addRelation(rStrm.GetCurrentStream()->getOutputStream(),
+  
oox::getRelationship(Relationship::THEME),
+  sThemeRelationshipPath);
+}
+}
+}
+
 aHeader.WriteXml( rStrm );
 
 for( size_t nTab = 0, nTabCount = maTableList.GetSize(); nTab < 
nTabCount; ++nTab )
diff --git a/sc/source/filter/oox/workbookfragment.cxx 
b/sc/source/filter/oox/workbookfragment.cxx
index b86c15def16b..08df44404eb4 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -64,6 +64,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -486,6 +487,12 @@ void WorkbookFragment::finalizeImport()
 // load all worksheets
 importSheetFragments(*this, aSheetFragments);
 
+SdrPage* pPage = pModel->GetPage(0);
+if (pPage && pTheme && !pTheme->GetName().isEmpty())
+{
+pPage->getSdrPageProperties().SetTheme(pTheme);
+}
+
 // assumes getTables().finalizeImport ( which creates the DatabaseRanges )
 // has been called already
 getTables().applyAutoFilters();
@@ -512,6 +519,7 @@ void WorkbookFragment::finalizeImport()
 rxSheetGlob.reset();
 }
 
+
 getDocImport().finalize();
 
 recalcFormulaCells();


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-08-24 Thread Tomaž Vajngerl (via logerrit)
 sc/source/ui/theme/ThemeColorChanger.cxx |   36 +++
 1 file changed, 36 insertions(+)

New commits:
commit 50e0a91c6907bab1a82e66bbc24e55621e673088
Author: Tomaž Vajngerl 
AuthorDate: Fri Jun 23 13:49:24 2023 +0900
Commit: Miklos Vajna 
CommitDate: Thu Aug 24 16:42:27 2023 +0200

sc: ThemeColorChanger - change theme color for borders

Change-Id: Id6b08ad48b496d2f1138aeea8d024a5f61bee633
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153500
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 95d199e3d1a04a469e1d22896ffd967c7a06c3f0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156027
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/ui/theme/ThemeColorChanger.cxx 
b/sc/source/ui/theme/ThemeColorChanger.cxx
index 2211aa67b554..a245f7b0c1c0 100644
--- a/sc/source/ui/theme/ThemeColorChanger.cxx
+++ b/sc/source/ui/theme/ThemeColorChanger.cxx
@@ -16,6 +16,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -35,6 +37,26 @@ ThemeColorChanger::~ThemeColorChanger() = default;
 
 namespace
 {
+bool changeBorderLine(editeng::SvxBorderLine* pBorderLine, model::ColorSet 
const& rColorSet)
+{
+if (!pBorderLine)
+return false;
+
+model::ComplexColor const& rComplexColor = pBorderLine->getComplexColor();
+if (rComplexColor.meType == model::ColorType::Scheme)
+{
+auto eThemeType = rComplexColor.meSchemeType;
+
+if (eThemeType != model::ThemeColorType::Unknown)
+{
+Color aColor = rColorSet.resolveColor(rComplexColor);
+pBorderLine->SetColor(aColor);
+return true;
+}
+}
+return false;
+}
+
 void changeCellItems(SfxItemSet& rItemSet, model::ColorSet const& rColorSet)
 {
 const SfxPoolItem* pItem = nullptr;
@@ -75,6 +97,20 @@ void changeCellItems(SfxItemSet& rItemSet, model::ColorSet 
const& rColorSet)
 }
 }
 }
+if (rItemSet.HasItem(ATTR_BORDER, ))
+{
+auto const* pBoxItem = static_cast(pItem);
+SvxBoxItem rNewItem(*pBoxItem);
+bool bChanged = false;
+
+bChanged = changeBorderLine(rNewItem.GetBottom(), rColorSet) || 
bChanged;
+bChanged = changeBorderLine(rNewItem.GetTop(), rColorSet) || bChanged;
+bChanged = changeBorderLine(rNewItem.GetLeft(), rColorSet) || bChanged;
+bChanged = changeBorderLine(rNewItem.GetRight(), rColorSet) || 
bChanged;
+
+if (bChanged)
+rItemSet.Put(rNewItem);
+}
 }
 } // end anonymous ns
 


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-08-12 Thread Caolán McNamara (via logerrit)
 sc/source/filter/inc/workbookhelper.hxx |   48 +++
 sc/source/filter/oox/stylesbuffer.cxx   |   97 +++-
 sc/source/filter/oox/workbookhelper.cxx |8 ++
 3 files changed, 115 insertions(+), 38 deletions(-)

New commits:
commit bf2734bbe3c35b0ecbf1a24a77824ffd61a71f3f
Author: Caolán McNamara 
AuthorDate: Thu Aug 10 21:49:59 2023 +0100
Commit: Noel Grandin 
CommitDate: Sat Aug 12 22:00:09 2023 +0200

xlsx with a lot of comments repeatedly calls OutputDevice::HasGlyphs

on the same font over and over again getting the same results

Change-Id: I0c301e3fd4c1838645c25d4f6f7b330acc988135
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155569
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit e3caea16a9a1ac6749f38cfdbf463184f64e64df)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155592
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Noel Grandin 

diff --git a/sc/source/filter/inc/workbookhelper.hxx 
b/sc/source/filter/inc/workbookhelper.hxx
index 0234c50252ff..ba046e40dab9 100644
--- a/sc/source/filter/inc/workbookhelper.hxx
+++ b/sc/source/filter/inc/workbookhelper.hxx
@@ -21,10 +21,14 @@
 
 #include 
 #include 
+#include 
 
+#include 
 #include 
 #include 
 
+#include 
+
 namespace oox::drawingml::chart { class ChartConverter; }
 namespace rtl { template  class Reference; }
 
@@ -57,6 +61,22 @@ class ScRangeData;
 
 namespace oox::xls {
 
+enum class FontClassification : sal_uInt8
+{
+None= 0x,
+Asian   = 0x0001,
+Cmplx   = 0x0002,
+Latin   = 0x0004
+};
+
+}
+
+namespace o3tl {
+template<> struct typed_flags : 
is_typed_flags {};
+}
+
+namespace oox::xls {
+
 class ExcelFilter;
 
 /** Functor for case-insensitive string comparison, usable in maps etc. */
@@ -87,6 +107,32 @@ class FormulaBuffer;
 class WorkbookGlobals;
 typedef std::shared_ptr< WorkbookGlobals > WorkbookGlobalsRef;
 
+struct FontDescriptorHash
+{
+size_t operator()( const css::awt::FontDescriptor& rKey) const
+{
+std::size_t seed = rKey.Name.hashCode();
+o3tl::hash_combine(seed, rKey.Height);
+o3tl::hash_combine(seed, rKey.Width);
+o3tl::hash_combine(seed, rKey.StyleName.hashCode());
+o3tl::hash_combine(seed, rKey.Family);
+o3tl::hash_combine(seed, rKey.CharSet);
+o3tl::hash_combine(seed, rKey.Pitch);
+o3tl::hash_combine(seed, rKey.CharacterWidth);
+o3tl::hash_combine(seed, rKey.Weight);
+o3tl::hash_combine(seed, rKey.Slant);
+o3tl::hash_combine(seed, rKey.Underline);
+o3tl::hash_combine(seed, rKey.Strikeout);
+o3tl::hash_combine(seed, rKey.Orientation);
+o3tl::hash_combine(seed, rKey.Kerning);
+o3tl::hash_combine(seed, rKey.WordLineMode);
+o3tl::hash_combine(seed, rKey.Type);
+return seed;
+}
+};
+
+typedef std::unordered_map FontClassificationMap;
+
 /** Helper class to provide access to global workbook data.
 
 All classes derived from this helper class will have access to a singleton
@@ -233,6 +279,8 @@ public:
 PivotCacheBuffer&   getPivotCaches() const;
 /** Returns the collection of pivot tables. */
 PivotTableBuffer&   getPivotTables() const;
+/** Shared cache of Font Classifications to avoid repeated lookups */
+FontClassificationMap& getFontClassificationCache() const;
 
 // converters -
 
diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index e0c99ccb7a65..47dd75f34425 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -790,44 +790,65 @@ void Font::finalizeImport()
 if( !maUsedFlags.mbNameUsed )
 return;
 
-PropertySet aDocProps( getDocument() );
-Reference< XDevice > xDevice( aDocProps.getAnyProperty( 
PROP_ReferenceDevice ), UNO_QUERY );
-if( !xDevice.is() )
-return;
-
-Reference< XFont2 > xFont( xDevice->getFont( maApiData.maDesc ), UNO_QUERY 
);
-if( !xFont.is() )
-return;
-
-// #91658# CJK fonts
-bool bHasAsian =
-xFont->hasGlyphs( OUString( u'\x3041' ) ) ||// 3040-309F: Hiragana
-xFont->hasGlyphs( OUString( u'\x30A1' ) ) ||// 30A0-30FF: Katakana
-xFont->hasGlyphs( OUString( u'\x3111' ) ) ||// 3100-312F: Bopomofo
-xFont->hasGlyphs( OUString( u'\x3131' ) ) ||// 3130-318F: Hangul 
Compatibility Jamo
-xFont->hasGlyphs( OUString( u'\x3301' ) ) ||// 3300-33FF: CJK 
Compatibility
-xFont->hasGlyphs( OUString( u'\x3401' ) ) ||// 3400-4DBF: CJK 
Unified Ideographs Extension A
-xFont->hasGlyphs( OUString( u'\x4E01' ) ) ||// 4E00-9FFF: CJK 
Unified Ideographs
-xFont->hasGlyphs( OUString( u'\x7E01' ) ) ||// 4E00-9FFF: CJK 
Unified Ideographs
-

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-08-11 Thread Henry Castro (via logerrit)
 sc/source/ui/view/tabview4.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit eee7a3c165aaa60e70d0bab9ab29fab71078abbe
Author: Henry Castro 
AuthorDate: Fri Aug 11 09:11:09 2023 -0400
Commit: Henry Castro 
CommitDate: Fri Aug 11 16:21:54 2023 +0200

tdf#155799: sc: fix input formula reference

If the start point reference mark is selected
with mouse direction up, it should extend to show
the correct input formula reference.

Signed-off-by: Henry Castro 
Change-Id: I41f2ea52bf7de341eccadfba80e91fd76a6fd2de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155618
Reviewed-by: Tomaž Vajngerl 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index 442ef9a79654..a7de6bdf67d2 100644
--- a/sc/source/ui/view/tabview4.cxx
+++ b/sc/source/ui/view/tabview4.cxx
@@ -229,9 +229,13 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB 
nCurZ )
 ScRefType eType = aViewData.GetRefType();
 if ( eType == SC_REFTYPE_REF )
 {
+if ((nStartX > nEndX || nStartY > nEndY) &&
+rDoc.HasAttrib(nStartX, nStartY, nTab, HasAttrFlags::Merged))
+rDoc.ExtendMerge( nStartX, nStartY, nStartX, nStartY, nTab );
+
 ScRange aRef(
-aViewData.GetRefStartX(), aViewData.GetRefStartY(), 
aViewData.GetRefStartZ(),
-aViewData.GetRefEndX(), aViewData.GetRefEndY(), 
aViewData.GetRefEndZ() );
+nStartX, nStartY, aViewData.GetRefStartZ(),
+nEndX, nEndY, aViewData.GetRefEndZ() );
 SC_MOD()->SetReference( aRef, rDoc,  );
 ShowRefTip();
 }


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-08-11 Thread Tomaž Vajngerl (via logerrit)
 sc/source/ui/theme/ThemeColorChanger.cxx |   25 ++---
 1 file changed, 22 insertions(+), 3 deletions(-)

New commits:
commit 9533d56cb31e49410f3023da1076dafad2786f7b
Author: Tomaž Vajngerl 
AuthorDate: Thu May 11 23:02:08 2023 +0900
Commit: Miklos Vajna 
CommitDate: Fri Aug 11 09:09:21 2023 +0200

sc: change text and background theme colors for direct attributes

Change-Id: Ia1ef2d151476bb627a0cb999135f6add827fb341
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151675
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 17bc0f05908769f024f3aa49554b96388dd49e96)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155543
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sc/source/ui/theme/ThemeColorChanger.cxx 
b/sc/source/ui/theme/ThemeColorChanger.cxx
index 870ef5b15cb8..2211aa67b554 100644
--- a/sc/source/ui/theme/ThemeColorChanger.cxx
+++ b/sc/source/ui/theme/ThemeColorChanger.cxx
@@ -21,6 +21,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace sc
 {
@@ -33,10 +35,9 @@ ThemeColorChanger::~ThemeColorChanger() = default;
 
 namespace
 {
-void paragraphStyleChange(ScStyleSheet* pStyle, model::ColorSet const& 
rColorSet)
+void changeCellItems(SfxItemSet& rItemSet, model::ColorSet const& rColorSet)
 {
 const SfxPoolItem* pItem = nullptr;
-auto& rItemSet = pStyle->GetItemSet();
 
 if (rItemSet.HasItem(ATTR_FONT_COLOR, ))
 {
@@ -87,9 +88,27 @@ void 
ThemeColorChanger::apply(std::shared_ptr const& pColorSet)
 pStyle = static_cast(pPool->First(SfxStyleFamily::Para));
 while (pStyle)
 {
-paragraphStyleChange(pStyle, *pColorSet);
+auto& rItemSet = pStyle->GetItemSet();
+changeCellItems(rItemSet, *pColorSet);
 pStyle = static_cast(pPool->Next());
 }
+
+// Change Cell / Text attributes
+for (SCTAB nTab = 0; nTab < rDocument.GetTableCount(); nTab++)
+{
+ScDocAttrIterator aAttributeIterator(rDocument, nTab, 0, 0, 
rDocument.MaxCol(),
+ rDocument.MaxRow());
+SCCOL nCol = 0;
+SCROW nRow1 = 0;
+SCROW nRow2 = 0;
+
+while (const ScPatternAttr* pPattern = 
aAttributeIterator.GetNext(nCol, nRow1, nRow2))
+{
+auto* pNonConstPattern = const_cast(pPattern);
+auto& rItemSet = pNonConstPattern->GetItemSet();
+changeCellItems(rItemSet, *pColorSet);
+}
+}
 }
 
 } // end sw namespace


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-08-11 Thread Henry Castro (via logerrit)
 sc/source/ui/app/inputhdl.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit edbf070a6bb6aacfb277140457cf21036b5239e9
Author: Henry Castro 
AuthorDate: Thu Aug 10 15:14:18 2023 -0400
Commit: Tomaž Vajngerl 
CommitDate: Fri Aug 11 08:49:43 2023 +0200

tdf#155799: lok: sc: fix extend reference mark

In the tiled rendering case, the server sends a reference
coordinates to client side, so extend the range end point
reference if merged cells.

Signed-off-by: Henry Castro 
Change-Id: Ie9611aea3f6645a6cf45514939ae6364afac0b1c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155564
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 6b7cc1935578..b90b1b100be4 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -494,10 +494,15 @@ ReferenceMark ScInputHandler::GetReferenceMark( const 
ScViewData& rViewData, ScD
 {
 SCCOL nCol1 = nX1, nCol2 = nX2;
 SCROW nRow1 = nY1, nRow2 = nY2;
+ScDocument& rDoc = pDocSh->GetDocument();
+
 PutInOrder(nCol1, nCol2);
 PutInOrder(nRow1, nRow2);
+
 if (nCol1 == nCol2 && nRow1 == nRow2)
-pDocSh->GetDocument().ExtendMerge(nCol1, nRow1, nCol2, nRow2, 
nTab);
+rDoc.ExtendMerge(nCol1, nRow1, nCol2, nRow2, nTab);
+else if (rDoc.HasAttrib(nCol2, nRow2, nTab, HasAttrFlags::Merged))
+rDoc.ExtendMerge(nCol2, nRow2, nCol2, nRow2, nTab);
 
 Point aTopLeft = rViewData.GetPrintTwipsPos(nCol1, nRow1);
 Point aBottomRight = rViewData.GetPrintTwipsPos(nCol2 + 1, nRow2 + 1);


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/source

2023-08-10 Thread Henry Castro (via logerrit)
 sc/source/ui/view/output.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit ebd1a4d6fc3f9ba533a29fa54acf7b3b41c398d5
Author: Henry Castro 
AuthorDate: Wed Aug 9 16:48:42 2023 -0400
Commit: Tomaž Vajngerl 
CommitDate: Thu Aug 10 10:08:47 2023 +0200

tdf#155799: sc: fix paint the reference mark

If a reference mark is initiated with the first click,
the initial range points are the same and extended
if merged cells, but if the user drag more cells
the Range end has to extend if merged cells

Signed-off-by: Henry Castro 
Change-Id: Ife7c4514a9303226b73bff61bd0df689f81af42f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155533
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 51bf2151cd9f..14419a362682 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -2011,6 +2011,8 @@ void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW 
nRefStartY,
 
 if ( nRefStartX == nRefEndX && nRefStartY == nRefEndY )
 mpDoc->ExtendMerge( nRefStartX, nRefStartY, nRefEndX, nRefEndY, nTab );
+else if (mpDoc->HasAttrib(nRefEndX, nRefEndY, nTab, HasAttrFlags::Merged))
+mpDoc->ExtendMerge(nRefEndX, nRefEndY, nRefEndX, nRefEndY, nTab);
 
 if ( !(nRefStartX <= nVisX2 && nRefEndX >= nVisX1 &&
  nRefStartY <= nVisY2 && nRefEndY >= nVisY1) )


  1   2   >