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

2023-10-18 Thread Henry Castro (via logerrit)
 sc/source/ui/view/output2.cxx |   14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit c9319cdfa269ff3e043f012731406bf3fd4e1810
Author: Henry Castro 
AuthorDate: Wed Oct 11 08:59:59 2023 -0400
Commit: Henry Castro 
CommitDate: Wed Oct 18 18:17:51 2023 +0200

sc: ui: fix cell bidi layout strings

The default constructor OutputDevice set the
layout text to "vcl::text::ComplexTextLayoutFlags::BiDiRtl"
for all strings, however the each cell string can be
mixed LTR and RTL.

Set the defaults to auto detect the correct text layout mode.
.

Signed-off-by: Henry Castro 
Change-Id: I0c451e8014fd13490db4213adca3d83ea4572819
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157831
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
(cherry picked from commit f63e02b99691a0d8c8addba2518ecdf6b4319c52)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157952

diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 302f2db07a01..e944eb0e0a08 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1521,14 +1521,22 @@ tools::Rectangle ScOutputData::LayoutStrings(bool 
bPixelToLogic, bool bPaint, co
 {
 bool bOrigIsInLayoutStrings = mpDoc->IsInLayoutStrings();
 mpDoc->SetLayoutStrings(true);
-comphelper::ScopeGuard g([this, bOrigIsInLayoutStrings] {
-mpDoc->SetLayoutStrings(bOrigIsInLayoutStrings);
-});
 
 OSL_ENSURE( mpDev == mpRefDevice ||
 mpDev->GetMapMode().GetMapUnit() == 
mpRefDevice->GetMapMode().GetMapUnit(),
 "LayoutStrings: different MapUnits ?!?!" );
 
+vcl::text::ComplexTextLayoutFlags eTextLayout = mpDev->GetLayoutMode();
+comphelper::ScopeGuard g([this, bOrigIsInLayoutStrings, eTextLayout] {
+mpDoc->SetLayoutStrings(bOrigIsInLayoutStrings);
+
+if (mpDev->GetLayoutMode() != eTextLayout)
+mpDev->SetLayoutMode(eTextLayout);
+});
+
+if (mpDev->GetLayoutMode() != vcl::text::ComplexTextLayoutFlags::Default)
+mpDev->SetLayoutMode(vcl::text::ComplexTextLayoutFlags::Default);
+
 sc::IdleSwitch aIdleSwitch(*mpDoc, false);
 
 // Try to limit interpreting to only visible cells. Calling e.g. IsValue()


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

2023-08-14 Thread Henry Castro (via logerrit)
 sc/source/ui/inc/tabvwsh.hxx   |1 +
 sc/source/ui/view/tabvwsha.cxx |8 
 2 files changed, 9 insertions(+)

New commits:
commit 3089be0b87d02f363b97ccbb473d1798e202425c
Author: Henry Castro 
AuthorDate: Tue Jul 18 15:18:41 2023 -0400
Commit: Henry Castro 
CommitDate: Mon Aug 14 15:43:52 2023 +0200

tdf#155799: sc: add getter function "GetEditString"

Useful for QA test queries.
..

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

diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 2aba65effefa..2db85dfa543e 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -237,6 +237,7 @@ public:
 
 const ScInputHandler* GetInputHandler() const { return 
mpInputHandler.get(); }
 ScInputHandler* GetInputHandler() { return mpInputHandler.get(); }
+const OUString* GetEditString() const;
 voidUpdateInputHandler( bool bForce = false, bool bStopEditing 
= true );
 voidUpdateInputHandlerCellAdjust( SvxCellHorJustify eJust );
 boolTabKeyInput(const KeyEvent& rKEvt);
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 5ce345e97fea..f17a55237e4e 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -615,6 +615,14 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& 
rReq, const OString 
 });
 }
 
+const OUString* ScTabViewShell::GetEditString() const
+{
+if (mpInputHandler)
+return >GetEditString();
+
+return nullptr;
+}
+
 bool ScTabViewShell::IsRefInputMode() const
 {
 ScModule* pScMod = SC_MOD();


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.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 48e03dfb8398fa7dc881f039f9d56b729e95ca8d
Author: Henry Castro 
AuthorDate: Fri Aug 11 09:11:09 2023 -0400
Commit: Aron Budea 
CommitDate: Sat Aug 12 00:53:20 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 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155593
Tested-by: Aron Budea 
Reviewed-by: Aron Budea 

diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index 3ed71a5ef931..9ff3d41ef4df 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-22.05' - sc/source

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

New commits:
commit ee6d3d10ae7962d7eb6562e65abe9e1524a04e99
Author: Henry Castro 
AuthorDate: Tue Jul 18 15:09:18 2023 -0400
Commit: Henry Castro 
CommitDate: Fri Aug 11 19:18:02 2023 +0200

tdf#155799: sc: fix formula reference "key up"

When the formula reference mode is active and it process
the keyboard event UP, it should decrease -1 according
the merge attribute row, col span.

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

diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index d9fa2cb3f3d5..6c7cdadd4d48 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -197,6 +197,8 @@ void moveRefByCell(SCCOL& rNewX, SCROW& rNewY,
SCCOL nMovX, SCROW nMovY, SCTAB nRefTab,
const ScDocument& rDoc)
 {
+SCCOL nOldX = rNewX;
+SCROW nOldY = rNewY;
 bool bSelectLocked = true;
 bool bSelectUnlocked = true;
 const ScTableProtection* pTabProtection = rDoc.GetTabProtection(nRefTab);
@@ -223,6 +225,15 @@ void moveRefByCell(SCCOL& rNewX, SCROW& rNewY,
 }
 if (isCellQualified(, nTempX, rNewY, nRefTab, bSelectLocked, 
bSelectUnlocked))
 rNewX = nTempX;
+
+if (nMovX < 0 && rNewX > 0)
+{
+const ScMergeAttr* pMergeAttr = rDoc.GetAttr(rNewX, rNewY, 
nRefTab, ATTR_MERGE);
+if (pMergeAttr && pMergeAttr->IsMerged() &&
+nOldX >= rNewX &&
+nOldX <= rNewX + pMergeAttr->GetRowMerge() - 1)
+rNewX = rNewX - 1;
+}
 }
 
 if (nMovY)
@@ -239,6 +250,15 @@ void moveRefByCell(SCCOL& rNewX, SCROW& rNewY,
 }
 if (isCellQualified(, rNewX, nTempY, nRefTab, bSelectLocked, 
bSelectUnlocked))
 rNewY = nTempY;
+
+if (nMovY < 0 && rNewY > 0)
+{
+const ScMergeAttr* pMergeAttr = rDoc.GetAttr(rNewX, rNewY, 
nRefTab, ATTR_MERGE);
+if (pMergeAttr && pMergeAttr->IsMerged() &&
+nOldY >= rNewY &&
+nOldY <= rNewY + pMergeAttr->GetRowMerge() - 1)
+rNewY = rNewY - 1;
+}
 }
 
 rDoc.SkipOverlapped(rNewX, rNewY, nRefTab);


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

2023-08-11 Thread Henry Castro (via logerrit)
 sc/source/ui/view/tabview2.cxx |   97 +
 1 file changed, 52 insertions(+), 45 deletions(-)

New commits:
commit 9b15ae4336203ed67f5ef735396873ce940b4eef
Author: Henry Castro 
AuthorDate: Mon Jul 17 09:41:55 2023 -0400
Commit: Aron Budea 
CommitDate: Fri Aug 11 16:14:00 2023 +0200

tdf#155799: sc: abstraction "moveRefByCell"

...

Change-Id: Ib00e3cddcd4a5dc4ef3d74d3939cdf278f2cb44d
Signed-off-by: Henry Castro 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154998
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155565
Tested-by: Aron Budea 
Reviewed-by: Aron Budea 

diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index 6e5ee8527d54..d9fa2cb3f3d5 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -193,6 +193,57 @@ bool checkBoundary(const ScDocument* pDoc, SCCOL& rCol, 
SCROW& rRow)
 return bGood;
 }
 
+void moveRefByCell(SCCOL& rNewX, SCROW& rNewY,
+   SCCOL nMovX, SCROW nMovY, SCTAB nRefTab,
+   const ScDocument& rDoc)
+{
+bool bSelectLocked = true;
+bool bSelectUnlocked = true;
+const ScTableProtection* pTabProtection = rDoc.GetTabProtection(nRefTab);
+if (pTabProtection && pTabProtection->isProtected())
+{
+bSelectLocked   = 
pTabProtection->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
+bSelectUnlocked = 
pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
+}
+
+moveCursorByProtRule(rNewX, rNewY, nMovX, nMovY, nRefTab, );
+checkBoundary(, rNewX, rNewY);
+
+if (nMovX)
+{
+SCCOL nTempX = rNewX;
+while (rDoc.IsHorOverlapped(nTempX, rNewY, nRefTab))
+{
+if (nMovX > 0)
+++nTempX;
+else
+--nTempX;
+if (!checkBoundary(, nTempX, rNewY))
+break;
+}
+if (isCellQualified(, nTempX, rNewY, nRefTab, bSelectLocked, 
bSelectUnlocked))
+rNewX = nTempX;
+}
+
+if (nMovY)
+{
+SCROW nTempY = rNewY;
+while (rDoc.IsVerOverlapped(rNewX, nTempY, nRefTab))
+{
+if (nMovY > 0)
+++nTempY;
+else
+--nTempY;
+if (!checkBoundary(, rNewX, nTempY))
+break;
+}
+if (isCellQualified(, rNewX, nTempY, nRefTab, bSelectLocked, 
bSelectUnlocked))
+rNewY = nTempY;
+}
+
+rDoc.SkipOverlapped(rNewX, rNewY, nRefTab);
+}
+
 void moveCursorByMergedCell(SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW 
nMovY, SCCOL nStartX,
 SCROW nStartY, SCTAB nTab, const ScDocument* pDoc)
 {
@@ -952,51 +1003,7 @@ void ScTabView::ExpandBlock(SCCOL nMovX, SCROW nMovY, 
ScFollowMode eMode)
 SCROW nNewY = aViewData.GetRefEndY();
 SCTAB nRefTab = aViewData.GetRefEndZ();
 
-bool bSelectLocked = true;
-bool bSelectUnlocked = true;
-const ScTableProtection* pTabProtection = 
rDoc.GetTabProtection(nRefTab);
-if (pTabProtection && pTabProtection->isProtected())
-{
-bSelectLocked   = 
pTabProtection->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
-bSelectUnlocked = 
pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
-}
-
-moveCursorByProtRule(nNewX, nNewY, nMovX, nMovY, nRefTab, );
-checkBoundary(, nNewX, nNewY);
-
-if (nMovX)
-{
-SCCOL nTempX = nNewX;
-while (rDoc.IsHorOverlapped(nTempX, nNewY, nRefTab))
-{
-if (nMovX > 0)
-++nTempX;
-else
---nTempX;
-if (!checkBoundary(, nTempX, nNewY))
-break;
-}
-if (isCellQualified(, nTempX, nNewY, nRefTab, bSelectLocked, 
bSelectUnlocked))
-nNewX = nTempX;
-}
-
-if (nMovY)
-{
-SCROW nTempY = nNewY;
-while (rDoc.IsVerOverlapped(nNewX, nTempY, nRefTab))
-{
-if (nMovY > 0)
-++nTempY;
-else
---nTempY;
-if (!checkBoundary(, nNewX, nTempY))
-break;
-}
-if (isCellQualified(, nNewX, nTempY, nRefTab, bSelectLocked, 
bSelectUnlocked))
-nNewY = nTempY;
-}
-
-rDoc.SkipOverlapped(nNewX, nNewY, nRefTab);
+moveRefByCell(nNewX, nNewY, nMovX, nMovY, nRefTab, rDoc);
 UpdateRef(nNewX, nNewY, nRefTab);
 SCCOL nTargetCol = nNewX;
 SCROW nTargetRow = nNewY;


[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.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 c5779b506a701ff21d2d738439a8e4976e18833c
Author: Henry Castro 
AuthorDate: Thu Aug 10 15:14:18 2023 -0400
Commit: Aron Budea 
CommitDate: Fri Aug 11 16:13:00 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 
(cherry picked from commit edbf070a6bb6aacfb277140457cf21036b5239e9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155590
Tested-by: Aron Budea 
Reviewed-by: Aron Budea 

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 66eb92dd2efa..30e7c4482e1c 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -484,10 +484,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-22.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 35f64398806d6361d427a38446fd3da70eff4915
Author: Henry Castro 
AuthorDate: Wed Aug 9 16:48:42 2023 -0400
Commit: Aron Budea 
CommitDate: Thu Aug 10 16:52:08 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 
(cherry picked from commit ebd1a4d6fc3f9ba533a29fa54acf7b3b41c398d5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155485
Tested-by: Aron Budea 
Reviewed-by: Aron Budea 

diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index d2a65bac6df0..085708bafa67 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -2019,6 +2019,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) )


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

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

New commits:
commit db19cb262534c051cf4342055b50332d21e06aa8
Author: Henry Castro 
AuthorDate: Tue Jul 18 15:15:41 2023 -0400
Commit: Aron Budea 
CommitDate: Thu Aug 10 16:51:31 2023 +0200

tdf#155799: sc: fix "UpdateRef"" to update extended merged cells

Extend the merged cell if the current has the attribute "Merged".
...

Signed-off-by: Henry Castro 
Change-Id: Ia2d5983d89b8661abb683d10d4de8bd0c5adea7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154993
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153406
Tested-by: Aron Budea 
Reviewed-by: Aron Budea 

diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index 5238947a88f3..3ed71a5ef931 100644
--- a/sc/source/ui/view/tabview4.cxx
+++ b/sc/source/ui/view/tabview4.cxx
@@ -213,6 +213,9 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB 
nCurZ )
 rDoc.ExtendMerge( nStartX, nStartY, nEndX, nEndY, nTab );
 ScUpdateRect aRect( nStartX, nStartY, nEndX, nEndY );
 
+if (rDoc.HasAttrib(nCurX, nCurY, nCurZ, HasAttrFlags::Merged))
+rDoc.ExtendMerge(nStartX, nStartY, nCurX, nCurY, nCurZ);
+
 aViewData.SetRefEnd( nCurX, nCurY, nCurZ );
 
 nStartX = aViewData.GetRefStartX();


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

2023-08-04 Thread Henry Castro (via logerrit)
 sc/source/ui/inc/gridwin.hxx  |2 ++
 sc/source/ui/view/gridwin.cxx |   22 +-
 2 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit 5279aff5588941e1e131a703059e8148713d24ef
Author: Henry Castro 
AuthorDate: Wed Aug 2 16:54:12 2023 -0400
Commit: Henry Castro 
CommitDate: Fri Aug 4 16:07:47 2023 +0200

lok: sc: fire "hyperlink clicked" event

The client side has changed the behaviour when
the HYPERLINK formula is clicked, usually in desktop
is fired with Ctrl + Mouse Click, now it is fired
with Mouse Click.

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

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index b9bd9184e18b..c23c236717c2 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -505,6 +505,8 @@ protected:
 void ImpDestroyOverlayObjects();
 
 private:
+SCCOL m_nDownPosX;
+SCROW m_nDownPosY;
 
 #ifdef DBG_UTIL
 void dumpCellProperties();
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 266790951ded..7fb7c959ffba 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -398,7 +398,9 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, 
ScViewData& rData, ScSplitPos
 bIsInPaint( false ),
 bNeedsRepaint( false ),
 bAutoMarkVisible( false ),
-bListValButton( false )
+bListValButton( false ),
+m_nDownPosX( -1 ),
+m_nDownPosY( -1 )
 {
 set_id("grid_window");
 switch(eWhich)
@@ -1982,6 +1984,8 @@ void ScGridWindow::HandleMouseButtonDown( const 
MouseEvent& rMEvt, MouseEventSta
 SCROW nPosY;
 mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
 SCTAB nTab = mrViewData.GetTabNo();
+m_nDownPosX = nPosX;
+m_nDownPosY = nPosY;
 
 // FIXME: this is to limit the number of rows handled in the Online
 // to 1000; this will be removed again when the performance
@@ -2629,6 +2633,22 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& 
rMEvt )
 }
 mrViewData.GetViewShell()->SelectionChanged();
 
+if (bIsTiledRendering && !bRefMode && !bDouble)
+{
+OUString aName, aUrl, aTarget;
+ScTabViewShell* pViewShell = mrViewData.GetViewShell();
+if (pViewShell && nPosX == m_nDownPosX && nPosY == m_nDownPosY
+&& GetEditUrl(aPos, , , ))
+{
+OString aMsg(aUrl.toUtf8() + " coordinates: " +
+ pViewShell->GetViewData().describeCellCursorAt(nPosX, 
nPosY) + ", " +
+ OString::number(aPos.X() / 
pViewShell->GetViewData().GetPPTX()));
+
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, 
aMsg.getStr());
+}
+}
+
+m_nDownPosX = m_nDownPosY = -1;
+
 return;
 }
 


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

2023-07-10 Thread Szymon Kłos (via logerrit)
 sc/source/ui/view/viewfun3.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 73301ab652a848660147835b5fb7ecfc828091be
Author: Szymon Kłos 
AuthorDate: Mon Jul 10 11:27:17 2023 +0200
Commit: Henry Castro 
CommitDate: Mon Jul 10 14:39:10 2023 +0200

lok: copy simple selection even when filtered

when selected cells contain data filtered with autofilter
and regular cells after that - we get different type
of selection called SC_MARK_SIMPLE_FILTERED

allow copying that too

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

diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 5d36b74999e2..fd586c740c90 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -431,7 +431,8 @@ bool ScViewFunc::CopyToClipMultiRange( const ScDocument* 
pInputClipDoc, const Sc
 rtl::Reference ScViewFunc::CopyToTransferable()
 {
 ScRange aRange;
-if ( GetViewData().GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
+auto eMarkType = GetViewData().GetSimpleArea( aRange );
+if ( eMarkType == SC_MARK_SIMPLE || eMarkType == SC_MARK_SIMPLE_FILTERED )
 {
 ScDocument& rDoc = GetViewData().GetDocument();
 ScMarkData& rMark = GetViewData().GetMarkData();


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

2023-07-03 Thread Aron Budea (via logerrit)
 sc/source/ui/app/inputwin.cxx |6 --
 1 file changed, 6 deletions(-)

New commits:
commit 2418b8bac7ebca555d0c15ae63b92b7e474636c0
Author: Aron Budea 
AuthorDate: Mon Jul 3 23:53:56 2023 +0200
Commit: Aron Budea 
CommitDate: Tue Jul 4 01:23:45 2023 +0200

Fix build

sc/source/ui/app/inputwin.cxx: In member function ‘virtual bool 
ScTextWnd::Command(const CommandEvent&)’:
sc/source/ui/app/inputwin.cxx:1739:22: error: unused variable ‘pParaPoint’ 
[-Werror=unused-variable]
 1739 | const Point* pParaPoint = static_cast(rCEvt.GetEventData());
  |  ^~
sc/source/ui/app/inputwin.cxx:1740:15: error: unused variable 
‘aSelectionStartEnd’ [-Werror=unused-variable]
 1740 | Point aSelectionStartEnd = rCEvt.GetMousePosPixel();
  |   ^~

After ea846af14bffc9f48862c39e6232f188df4bbe62.

Change-Id: Ica1a1a8985a3fdfc2fbd38652f687bf0d8c5fc36
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153934
Tested-by: Aron Budea 
Reviewed-by: Aron Budea 

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index a413424a11c5..671e529e74ce 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1733,12 +1733,6 @@ bool ScTextWnd::Command( const CommandEvent& rCEvt )
 if (!m_xEditView)
 return true;
 
-// information about paragraph is in additional data
-// information about position in a paragraph in a Mouse Pos
-// see vcl/jsdialog/executor.cxx "textselection" event
-const Point* pParaPoint = static_cast(rCEvt.GetEventData());
-Point aSelectionStartEnd = rCEvt.GetMousePosPixel();
-
 sal_Int32 nParaStart, nParaEnd, nPosStart, nPosEnd;
 
 // We use IME - do not select anything, put cursor at the end


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

2023-07-02 Thread Szymon Kłos (via logerrit)
 sc/source/ui/app/inputwin.cxx |   21 -
 1 file changed, 4 insertions(+), 17 deletions(-)

New commits:
commit ea846af14bffc9f48862c39e6232f188df4bbe62
Author: Szymon Kłos 
AuthorDate: Wed Jun 28 17:13:03 2023 +0200
Commit: Szymon Kłos 
CommitDate: Mon Jul 3 07:34:54 2023 +0200

lok: formulabar: use IME also on desktop

this makes selection always on the end of content so
we can remove not matching last X chars and append new content
easily

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

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 85b9bff669d1..a413424a11c5 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1741,23 +1741,10 @@ bool ScTextWnd::Command( const CommandEvent& rCEvt )
 
 sal_Int32 nParaStart, nParaEnd, nPosStart, nPosEnd;
 
-ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
-if (pViewSh && pViewSh->isLOKMobilePhone())
-{
-// We use IME - do not select anything, put cursor at the end
-nParaStart = nParaEnd = 
m_xEditView->GetEditEngine()->GetParagraphCount() ?
-(m_xEditView->GetEditEngine()->GetParagraphCount() - 1) : 0;
-nPosStart = nPosEnd = 
m_xEditView->GetEditEngine()->GetTextLen(nParaStart);
-}
-else
-{
-nParaStart = pParaPoint ? pParaPoint->X() : 0;
-nParaEnd = pParaPoint ? pParaPoint->Y() : 0;
-nPosStart = m_xEditView->GetPosNoField(nParaStart, 
aSelectionStartEnd.X());
-nPosEnd = m_xEditView->GetPosNoField(nParaEnd, 
aSelectionStartEnd.Y());
-
-
-}
+// We use IME - do not select anything, put cursor at the end
+nParaStart = nParaEnd = 
m_xEditView->GetEditEngine()->GetParagraphCount() ?
+(m_xEditView->GetEditEngine()->GetParagraphCount() - 1) : 0;
+nPosStart = nPosEnd = 
m_xEditView->GetEditEngine()->GetTextLen(nParaStart);
 
 m_xEditView->SetSelection(ESelection(nParaStart, nPosStart, nParaEnd, 
nPosEnd));
 SC_MOD()->InputSelection( m_xEditView.get() );


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

2023-06-28 Thread Henry Castro (via logerrit)
 sc/source/filter/inc/condformatbuffer.hxx |2 ++
 sc/source/filter/oox/condformatbuffer.cxx |5 +
 sc/source/filter/oox/extlstcontext.cxx|2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit cffbf2f559cc2092de67b6c25b6ff8c01f863acf
Author: Henry Castro 
AuthorDate: Mon Jun 26 10:43:34 2023 -0400
Commit: Henry Castro 
CommitDate: Thu Jun 29 04:14:07 2023 +0200

sc: filter: oox: fix crash delete ScDatabarFormatData

Unfortunately, the instance of "ScDatabarFormatData" is
deleted before finalizeImport is called.

The "maEntries" is not usable, the global format buffer is
required to hold the reference.

 #1 0x7f2ef19081c0 in oox::xls::CondFormatBuffer::finalizeImport() 
co-23.05-asan/sc/source/filter/oox/condformatbuffer.cxx:1322:23
#2 0x7f2ef1ba in 
oox::xls::WorksheetGlobals::finalizeWorksheetImport() 
co-23.05-asan/sc/source/filter/oox/worksheethelper.cxx:942:22
#3 0x7f2ef58d030e in 
sax_fastparser::FastSaxParserImpl::parseStream(com::sun::star::xml::sax::InputSource
 const&) co-23.05-asan/sax/source/fastparser/fastparser.cxx:910:36
#4 0x7f2ef23f0e46 in 
oox::core::FastParser::parseStream(com::sun::star::xml::sax::InputSource 
const&, bool) co-23.05-asan/oox/source/core/fastparser.cxx:121:15
#5 0x7f2ef23f1544 in

Signed-off-by: Henry Castro 
Change-Id: Ieb3840cc10372867d5462a19d9efa9771f633437
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153622
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/filter/inc/condformatbuffer.hxx 
b/sc/source/filter/inc/condformatbuffer.hxx
index dfb665befe39..acd6f1b398b8 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -307,6 +307,7 @@ public:
 CondFormatRef   importCondFormatting( SequenceInputStream& rStrm );
 ExtCfDataBarRuleRef createExtCfDataBarRule(ScDataBarFormatData* pTarget);
 std::vector< std::unique_ptr >& importExtCondFormat();
+std::vector >& importExtFormatEntries();
 
 /** Converts an OOXML condition operator token to the API constant. */
 static sal_Int32convertToApiOperator( sal_Int32 nToken );
@@ -324,6 +325,7 @@ private:
 CondFormatVec   maCondFormats;  /// All conditional formatting in 
a sheet.
 ExtCfDataBarRuleVecmaCfRules;  /// All external 
conditional formatting rules in a sheet.
 std::vector< std::unique_ptr > maExtCondFormats;
+std::vector > maExtFormatEntries;
 sal_Int32 mnNonPrioritizedRuleNextPriority = 1048576;
 };
 
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index e8535c78755d..5e64e75b3899 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1353,6 +1353,11 @@ std::vector< std::unique_ptr >& 
CondFormatBuffer::importExtCond
 return maExtCondFormats;
 }
 
+std::vector >& 
CondFormatBuffer::importExtFormatEntries()
+{
+return maExtFormatEntries;
+}
+
 sal_Int32 CondFormatBuffer::convertToApiOperator( sal_Int32 nToken )
 {
 switch( nToken )
diff --git a/sc/source/filter/oox/extlstcontext.cxx 
b/sc/source/filter/oox/extlstcontext.cxx
index 945e6dbfd988..e12ac00938b7 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -174,7 +174,7 @@ ContextHandlerRef 
ExtConditionalFormattingContext::onCreateContext(sal_Int32 nEl
 {
 auto pFormat = 
std::make_unique(());
 pFormat->SetDataBarData(pInfo);
-maEntries.push_back(std::move(pFormat));
+
getCondFormats().importExtFormatEntries().push_back(std::move(pFormat));
 }
 }
 else


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

2023-06-28 Thread Noel Grandin (via logerrit)
 sc/source/filter/oox/commentsbuffer.cxx |   15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 2c09c15ffbc203c937594d5ec847d80e13045a96
Author: Noel Grandin 
AuthorDate: Sun Jun 4 18:53:36 2023 +0200
Commit: Caolán McNamara 
CommitDate: Wed Jun 28 17:32:28 2023 +0200

avoid some UNO querying

Change-Id: I5fa793ab979221252f66bdd38e6950c06a66b00a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152601
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153587
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/filter/oox/commentsbuffer.cxx 
b/sc/source/filter/oox/commentsbuffer.cxx
index 7dbd5c942e30..5f24cf4cdde2 100644
--- a/sc/source/filter/oox/commentsbuffer.cxx
+++ b/sc/source/filter/oox/commentsbuffer.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -162,12 +163,11 @@ void Comment::finalizeImport()
 ScPostIt* pPostIt = pDocShell->GetDocFunc().ImportNote( 
maModel.maRange.aStart, OUString( ' ' ) );
 SdrCaptionObj* pCaption = pPostIt->GetOrCreateCaption( 
maModel.maRange.aStart );
 
-Reference< XShape > xAnnoShape( pCaption->getUnoShape() ); // 
SvxShapeText
+rtl::Reference< SvxShapeText > xAnnoShape( 
dynamic_cast(pCaption->getUnoShape().get() ) ); // SvxShapeText
 // setting a property triggers expensive process, so set them all at 
once
-Reference< css::beans::XMultiPropertySet > 
xAnnoShapeMultiPropSet(xAnnoShape, UNO_QUERY_THROW);
 
 // Add shape formatting properties (autoFill, colHidden and rowHidden 
are dropped)
-xAnnoShapeMultiPropSet->setPropertyValues(
+static_cast(xAnnoShape.get())->setPropertyValues(
 Sequence { "TextFitToSize", "MoveProtect", 
"TextHorizontalAdjust", "TextVerticalAdjust" },
 Sequence { Any(maModel.mbAutoScale), Any(maModel.mbLocked),
 Any(lcl_ToHorizAlign( maModel.mnTHA )), Any(lcl_ToVertAlign( 
maModel.mnTVA )) });
@@ -188,7 +188,7 @@ void Comment::finalizeImport()
 
 // Setting comment text alignment
 const ::oox::vml::ClientData* xClientData = 
pVmlNoteShape->getClientData();
-xAnnoShapeMultiPropSet->setPropertyValues(
+static_cast(xAnnoShape.get())->setPropertyValues(
 Sequence { "TextVerticalAdjust", "ParaAdjust" },
 Sequence { Any(lcl_ToVertAlign( xClientData->mnTextVAlign 
)), Any(lcl_ToParaAlign( xClientData->mnTextHAlign )) });
 }
@@ -197,11 +197,10 @@ void Comment::finalizeImport()
 
 // insert text and convert text formatting
 maModel.mxText->finalizeImport(*this);
-Reference< XText > xAnnoText( xAnnoShape, UNO_QUERY_THROW );
-Reference< css::document::XActionLockable > xAnnoLock( xAnnoShape, 
UNO_QUERY_THROW );
-xAnnoLock->addActionLock();
+Reference< XText > xAnnoText( xAnnoShape );
+xAnnoShape->addActionLock();
 maModel.mxText->convert( xAnnoText );
-xAnnoLock->removeActionLock();
+xAnnoShape->removeActionLock();
 }
 catch( Exception& )
 {


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

2023-06-23 Thread Henry Castro (via logerrit)
 sc/source/ui/inc/select.hxx  |   10 -
 sc/source/ui/view/select.cxx |  266 +--
 2 files changed, 138 insertions(+), 138 deletions(-)

New commits:
commit 8276b9593a2a9e3a0d5aaeaadd64369667120303
Author: Henry Castro 
AuthorDate: Wed Jun 21 11:15:58 2023 -0400
Commit: Caolán McNamara 
CommitDate: Fri Jun 23 09:51:00 2023 +0200

sc: prefix m_* ScViewFunctionSet class members

..

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

diff --git a/sc/source/ui/inc/select.hxx b/sc/source/ui/inc/select.hxx
index ea3082f972c6..e1223f91e793 100644
--- a/sc/source/ui/inc/select.hxx
+++ b/sc/source/ui/inc/select.hxx
@@ -40,12 +40,12 @@ public:
 class ScViewFunctionSet : public FunctionSet// View (Gridwin / 
keyboard)
 {
 private:
-ScViewData* pViewData;
-ScViewSelectionEngine*  pEngine;
+ScViewData* m_pViewData;
+ScViewSelectionEngine*  m_pEngine;
 
-boolbAnchor;
-boolbStarted;
-ScAddress   aAnchorPos;
+boolm_bAnchor;
+boolm_bStarted;
+ScAddress   m_aAnchorPos;
 
 ScSplitPos  GetWhich() const;
 
diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx
index 3dbe74373237..dc85bb8ef041 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -44,27 +44,27 @@ static bool bDidSwitch = false;
 
 // View (Gridwin / keyboard)
 ScViewFunctionSet::ScViewFunctionSet( ScViewData* pNewViewData ) :
-pViewData( pNewViewData ),
-pEngine( nullptr ),
-bAnchor( false ),
-bStarted( false )
+m_pViewData( pNewViewData ),
+m_pEngine( nullptr ),
+m_bAnchor( false ),
+m_bStarted( false )
 {
-OSL_ENSURE(pViewData, "ViewData==0 at FunctionSet");
+OSL_ENSURE(m_pViewData, "ViewData==0 at FunctionSet");
 }
 
 ScSplitPos ScViewFunctionSet::GetWhich() const
 {
-if (pEngine)
-return pEngine->GetWhich();
+if (m_pEngine)
+return m_pEngine->GetWhich();
 else
-return pViewData->GetActivePart();
+return m_pViewData->GetActivePart();
 }
 
 sal_uLong ScViewFunctionSet::CalcUpdateInterval( const Size& rWinSize, const 
Point& rEffPos,
  bool bLeftScroll, bool 
bTopScroll, bool bRightScroll, bool bBottomScroll )
 {
 sal_uLong nUpdateInterval = SELENG_AUTOREPEAT_INTERVAL_MAX;
-vcl::Window* pWin = pEngine->GetWindow();
+vcl::Window* pWin = m_pEngine->GetWindow();
 tools::Rectangle aScrRect = pWin->GetDesktopRectPixel();
 Point aRootPos = pWin->OutputToAbsoluteScreenPixel(Point(0,0));
 if (bRightScroll)
@@ -124,7 +124,7 @@ sal_uLong ScViewFunctionSet::CalcUpdateInterval( const 
Size& rWinSize, const Poi
 }
 
 #ifdef _WIN32
-ScTabViewShell* pViewShell = pViewData->GetViewShell();
+ScTabViewShell* pViewShell = m_pViewData->GetViewShell();
 bool bRefMode = pViewShell && pViewShell->IsRefInputMode();
 if (bRefMode && nUpdateInterval < SC_SELENG_REFMODE_UPDATE_INTERVAL_MIN)
 // Lower the update interval during ref mode, because re-draw can be
@@ -139,25 +139,25 @@ sal_uLong ScViewFunctionSet::CalcUpdateInterval( const 
Size& rWinSize, const Poi
 
 void ScViewFunctionSet::SetSelectionEngine( ScViewSelectionEngine* pSelEngine )
 {
-pEngine = pSelEngine;
+m_pEngine = pSelEngine;
 }
 
 // Drag & Drop
 void ScViewFunctionSet::BeginDrag()
 {
-SCTAB nTab = pViewData->GetTabNo();
+SCTAB nTab = m_pViewData->GetTabNo();
 
 SCCOL nPosX;
 SCROW nPosY;
-if (pEngine)
+if (m_pEngine)
 {
-Point aMPos = pEngine->GetMousePosPixel();
-pViewData->GetPosFromPixel( aMPos.X(), aMPos.Y(), GetWhich(), nPosX, 
nPosY );
+Point aMPos = m_pEngine->GetMousePosPixel();
+m_pViewData->GetPosFromPixel( aMPos.X(), aMPos.Y(), GetWhich(), nPosX, 
nPosY );
 }
 else
 {
-nPosX = pViewData->GetCurX();
-nPosY = pViewData->GetCurY();
+nPosX = m_pViewData->GetCurX();
+nPosY = m_pViewData->GetCurY();
 }
 
 ScModule* pScMod = SC_MOD();
@@ -165,24 +165,24 @@ void ScViewFunctionSet::BeginDrag()
 if (bRefMode)
 return;
 
-pViewData->GetView()->FakeButtonUp( GetWhich() );   // ButtonUp is 
swallowed
+m_pViewData->GetView()->FakeButtonUp( GetWhich() );   // ButtonUp is 
swallowed
 
-ScMarkData& rMark = pViewData->GetMarkData();
+ScMarkData& rMark = m_pViewData->GetMarkData();
 rMark.MarkToSimple();
 if ( !rMark.IsMarked() || rMark.IsMultiMarked() )
 return;
 
 ScDocumentUniquePtr pClipDoc(new ScDocument( SCDOCMODE_CLIP ));
 // bApi = TRUE -> no error messages
-bool bCopied = pViewData->GetView()->CopyToClip( 

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

2023-06-20 Thread Henry Castro (via logerrit)
 sc/source/filter/oox/condformatbuffer.cxx |   17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit d17a3252804a1d37ffa19c35e425e6928348c564
Author: Henry Castro 
AuthorDate: Mon Jun 19 11:41:52 2023 -0400
Commit: Henry Castro 
CommitDate: Tue Jun 20 13:50:34 2023 +0200

sc: filter: oox: fix setting value to color scale

The COLORSCALE_VALUE setValue method reset the mpCell
that contains formula.

Signed-off-by: Henry Castro 
Change-Id: Idbbfcdc5bce78542ce671753d9a70dcd375e7966
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153293
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 7dfc73a4ca7c..e8535c78755d 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1463,16 +1463,17 @@ void ExtCfDataBarRule::finalizeImport()
 else if (maModel.maColorScaleType == "formula")
 pEntry->SetType(COLORSCALE_FORMULA);
 else if (maModel.maColorScaleType == "num")
-pEntry->SetType(COLORSCALE_VALUE);
-
-if (!maModel.msScaleTypeValue.isEmpty())
 {
-sal_Int32 nSize = 0;
-rtl_math_ConversionStatus eStatus = 
rtl_math_ConversionStatus_Ok;
-double fValue = 
rtl::math::stringToDouble(maModel.msScaleTypeValue, '.', '\0', , 
);
-if (eStatus == rtl_math_ConversionStatus_Ok && nSize == 
maModel.msScaleTypeValue.getLength())
+pEntry->SetType(COLORSCALE_VALUE);
+if (!maModel.msScaleTypeValue.isEmpty())
 {
-pEntry->SetValue(fValue);
+sal_Int32 nSize = 0;
+rtl_math_ConversionStatus eStatus = 
rtl_math_ConversionStatus_Ok;
+double fValue = 
rtl::math::stringToDouble(maModel.msScaleTypeValue, '.', '\0', , 
);
+if (eStatus == rtl_math_ConversionStatus_Ok && nSize == 
maModel.msScaleTypeValue.getLength())
+{
+pEntry->SetValue(fValue);
+}
 }
 }
 break;


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

2023-06-19 Thread Jaume Pujantell Traserra (via logerrit)
 sc/source/ui/app/inputhdl.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit e33b5cc2438429889514e0de5d3791d867549fd4
Author: Jaume Pujantell Traserra 
AuthorDate: Fri Jun 16 09:01:27 2023 +0200
Commit: Andras Timar 
CommitDate: Mon Jun 19 20:07:33 2023 +0200

fix crash on LOKIT spelling dialog

Update active view before trying to access it's selection.

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

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 1ea255f23207..66eb92dd2efa 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -4269,6 +4269,7 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* 
pState,
 
 if (comphelper::LibreOfficeKit::isActive() && 
pActiveViewSh)
 {
+UpdateActiveView();
 EditView* pActiveView = pTopView ? pTopView : 
pTableView;
 ESelection aSel = pActiveView ? 
pActiveView->GetSelection() : ESelection();
 


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

2023-06-15 Thread Caolán McNamara (via logerrit)
 sc/source/filter/oox/condformatbuffer.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 631f99be735735fd3422516441f18bff7782972c
Author: Caolán McNamara 
AuthorDate: Wed Jun 14 15:37:08 2023 +0100
Commit: Henry Castro 
CommitDate: Thu Jun 15 22:42:51 2023 +0200

cid#1532384 Out-of-bounds read

sizeof returns num of bytes, not num of elements

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

diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 568a4197b070..7dfc73a4ca7c 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -265,7 +265,7 @@ static ::Color IndexedColors[] = {
 else if (rAttribs.hasAttribute(XML_indexed))
 {
 sal_uInt32 nIndexed = rAttribs.getUnsigned(XML_indexed, 0);
-if (nIndexed < sizeof(IndexedColors))
+if (nIndexed < std::size(IndexedColors))
 nColor = IndexedColors[nIndexed];
 }
 


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

2023-05-22 Thread Henry Castro (via logerrit)
 sc/source/ui/view/viewdata.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2704871015233d632ccad8b6472ca52434f2ec1e
Author: Henry Castro 
AuthorDate: Fri May 19 15:22:59 2023 -0400
Commit: Szymon Kłos 
CommitDate: Mon May 22 08:59:40 2023 +0200

lok: sc: disable Value Highlighting

If the document is saved with the option:

View - Value Highlighting

The online client side does not have implemented yet, otherwise
will not paint the cell background.

Signed-off-by: Henry Castro 
Change-Id: I05b1a2ef63602a7bf34f717b87c304d00a8c8efc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152019
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index d55cd50c1384..9514c9cc7d12 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -3920,7 +3920,7 @@ void ScViewData::ReadUserDataSequence(const uno::Sequence 

 if ( rSetting.Value >>= nTemp16 )
 maOptions.SetObjMode(VOBJ_TYPE_DRAW, (nTemp16 == 1) ? 
VOBJ_MODE_HIDE : VOBJ_MODE_SHOW);
 }
-else if ( sName.compareToAscii( SC_UNO_VALUEHIGH ) == 0 )
+else if ( sName.compareToAscii( SC_UNO_VALUEHIGH ) == 0 && 
!comphelper::LibreOfficeKit::isActive())
 maOptions.SetOption(VOPT_SYNTAX, 
ScUnoHelpFunctions::GetBoolFromAny(rSetting.Value));
 else
 {


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

2023-05-17 Thread Henry Castro (via logerrit)
 sc/source/ui/view/viewdata.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 330cc89931778b5d2ad94c954e0cb879183bac63
Author: Henry Castro 
AuthorDate: Tue May 16 09:50:20 2023 -0400
Commit: Andras Timar 
CommitDate: Wed May 17 19:29:06 2023 +0200

lok: sc: reset RTL if it is changed

Reset the LOKSpecialFlags, otherwise the
selection engine select wrong lines.

Signed-off-by: Henry Castro 
Change-Id: I94e33cc3e293330d9a3480bd3838a20c1d94d15f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151841
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 26a765eaa73a..d55cd50c1384 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1622,8 +1622,8 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
 pEditView[eWhich]->SetLOKSpecialOutputArea(aPTwipsRect);
 }
 
-if (bLOKLayoutRTL)
-pEditView[eWhich]->SetLOKSpecialFlags(LOKSpecialFlags::LayoutRTL);
+if (bLOKActive && pEditView[eWhich]->HasLOKSpecialPositioning())
+pEditView[eWhich]->SetLOKSpecialFlags(bLOKLayoutRTL ? 
LOKSpecialFlags::LayoutRTL : LOKSpecialFlags::NONE);
 
 tools::Rectangle aOutputArea = pWin->PixelToLogic( aPixRect, 
GetLogicMode() );
 pEditView[eWhich]->SetOutputArea( aOutputArea );


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

2023-05-15 Thread Henry Castro (via logerrit)
 sc/source/filter/html/htmlexp.cxx |   23 ++-
 1 file changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 147327051c9d684be4539d490126aa55382421a6
Author: Henry Castro 
AuthorDate: Thu May 11 16:29:55 2023 -0400
Commit: Henry Castro 
CommitDate: Mon May 15 13:31:16 2023 +0200

sc: filter: html: fix missing color scale conditional format

When copying a range cell to an external application that request
html data, the color scale conditional format does not have an
associate a set attribute.

Signed-off-by: Henry Castro 
Change-Id: I82b466a2100abc5070e92f844dc706d9b015c2e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151687
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/filter/html/htmlexp.cxx 
b/sc/source/filter/html/htmlexp.cxx
index 2007613840e0..fe93eb3c752a 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -64,6 +64,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 #include 
@@ -881,10 +883,27 @@ void ScHTMLExport::WriteTables()
 
 void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, 
SCROW nRow, SCTAB nTab )
 {
+std::optional aColorScale;
 ScAddress aPos( nCol, nRow, nTab );
 ScRefCellValue aCell(*pDoc, aPos, rBlockPos);
 const ScPatternAttr* pAttr = pDoc->GetPattern( nCol, nRow, nTab );
 const SfxItemSet* pCondItemSet = pDoc->GetCondResult( nCol, nRow, nTab, 
 );
+if (!pCondItemSet)
+{
+ScConditionalFormatList* pCondList = pDoc->GetCondFormList(nTab);
+const ScCondFormatItem& rCondItem = pAttr->GetItem(ATTR_CONDITIONAL);
+const ScCondFormatIndexes& rCondIndex = rCondItem.GetCondFormatData();
+if (rCondIndex.size() > 0)
+{
+ScConditionalFormat* pCondFmt = 
pCondList->GetFormat(rCondIndex[0]);
+if (pCondFmt)
+{
+const ScColorScaleFormat* pEntry = dynamic_cast(pCondFmt->GetEntry(0));
+if (pEntry)
+aColorScale = pEntry->GetColor(aPos);
+}
+}
+}
 
 const ScMergeFlagAttr& rMergeFlagAttr = pAttr->GetItem( ATTR_MERGE_FLAG, 
pCondItemSet );
 if ( rMergeFlagAttr.IsOverlapped() )
@@ -1023,7 +1042,9 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& 
rBlockPos, SCCOL nCol, SC
 ATTR_BACKGROUND, pCondItemSet );
 
 Color aBgColor;
-if ( rBrushItem.GetColor().GetAlpha() == 0 )
+if ( aColorScale )
+aBgColor = *aColorScale;
+else if ( rBrushItem.GetColor().GetAlpha() == 0 )
 aBgColor = aHTMLStyle.aBackgroundColor; // No unwanted background color
 else
 aBgColor = rBrushItem.GetColor();


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

2023-05-13 Thread Dennis Francis (via logerrit)
 sc/source/core/data/validat.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit e848d91a1d060558e89029b6beecfa796105d962
Author: Dennis Francis 
AuthorDate: Wed May 3 13:00:09 2023 +0530
Commit: Andras Timar 
CommitDate: Sat May 13 13:55:55 2023 +0200

sc: use the current cell's numfmt to format...

to format the values in the validation list when the items are numbers.
This is better than applying no formatting since we lost track of the
source formatting when values are passed through a matrix.

Change-Id: I06432bd93ef8d01181dd16d2f5ee99eb0477c094
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151313
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Henry Castro 
(cherry picked from commit 2f6d1cefc184fda3ba292f1718b034202989d7b3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151521
Reviewed-by: Andras Timar 

diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 43ebb8faea58..01c864934821 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -764,6 +764,7 @@ bool ScValidationData::GetSelectionFromFormula(
 rMatch = -1;
 
 SvNumberFormatter* pFormatter = GetDocument()->GetFormatTable();
+sal_uInt32 nDestFormat = pDocument->GetNumberFormat(rPos.Col(), 
rPos.Row(), rPos.Tab());
 
 SCSIZE  nCol, nRow, nCols, nRows, n = 0;
 pValues->GetDimensions( nCols, nRows );
@@ -865,7 +866,7 @@ bool ScValidationData::GetSelectionFromFormula(
 }
 else
 {
-pFormatter->GetInputLineString( nMatVal.fVal, 0, 
aValStr );
+pFormatter->GetInputLineString( nMatVal.fVal, 
nDestFormat, aValStr );
 }
 }
 


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

2023-05-10 Thread Henry Castro (via logerrit)
 sc/source/filter/excel/xihelper.cxx  |6 ++
 sc/source/filter/inc/worksheethelper.hxx |4 +++-
 sc/source/filter/oox/sheetdatabuffer.cxx |4 +++-
 sc/source/filter/oox/worksheethelper.cxx |6 +-
 4 files changed, 17 insertions(+), 3 deletions(-)

New commits:
commit e069c7fcff114fd42eda5712fb38938eb17214a9
Author: Henry Castro 
AuthorDate: Tue Feb 28 09:50:28 2023 -0400
Commit: Henry Castro 
CommitDate: Wed May 10 22:56:04 2023 +0200

sc: filter: excel: import cell multi-line text

The excel document, if the cell has multi-line text and
the property wrap text is off, the paragraphs are rendered
all in a single line.

Signed-off-by: Henry Castro 
Change-Id: I3b5c82dde2616887e51ad6e3dfe91d100482f747
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151430
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/filter/excel/xihelper.cxx 
b/sc/source/filter/excel/xihelper.cxx
index ef38c5b65089..30436be24be2 100644
--- a/sc/source/filter/excel/xihelper.cxx
+++ b/sc/source/filter/excel/xihelper.cxx
@@ -238,10 +238,16 @@ void XclImpStringHelper::SetToDocument(
 const OUString& aStr = rString.GetText();
 if (aStr.indexOf('\n') != -1 || aStr.indexOf('\r') != -1)
 {
+const XclImpXFBuffer& rXFBuffer = rRoot.GetXFBuffer();
+const XclImpXF* pXF = rXFBuffer.GetXF( nXFIndex );
+bool bSingleLine = pXF ? !pXF->GetLineBreak() : false;
+
 // Multiline content.
 ScFieldEditEngine& rEngine = rDoc.getDoc().GetEditEngine();
+rEngine.SetSingleLine(bSingleLine);
 rEngine.SetTextCurrentDefaults(aStr);
 rDoc.setEditCell(rPos, rEngine.CreateTextObject());
+rEngine.SetSingleLine(false);
 }
 else
 {
diff --git a/sc/source/filter/inc/worksheethelper.hxx 
b/sc/source/filter/inc/worksheethelper.hxx
index 3a44dc2e105e..4081d248e32b 100644
--- a/sc/source/filter/inc/worksheethelper.hxx
+++ b/sc/source/filter/inc/worksheethelper.hxx
@@ -262,7 +262,9 @@ public:
 /** Inserts a rich-string cell directly into the Calc sheet. */
 void putRichString(
 const ScAddress& rAddress,
-RichString& rString, const oox::xls::Font* pFirstPortionFont );
+RichString& rString,
+const oox::xls::Font* pFirstPortionFont,
+bool bSingleLine = false);
 
 /** Inserts a formula cell directly into the Calc sheet. */
 void putFormulaTokens(
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx 
b/sc/source/filter/oox/sheetdatabuffer.cxx
index 014b0fc61ae3..40968812 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -120,6 +120,8 @@ void SheetDataBuffer::setStringCell( const CellModel& 
rModel, const RichStringRe
 {
 OSL_ENSURE( rxString, "SheetDataBuffer::setStringCell - missing rich 
string object" );
 const oox::xls::Font* pFirstPortionFont = getStyles().getFontFromCellXf( 
rModel.mnXfId ).get();
+const Xf* pXf = getStyles().getCellXf( rModel.mnXfId ).get();
+bool bSingleLine = pXf ? !rxString->isPreserveSpace() && 
!pXf->getAlignment().getModel().mbWrapText : false;
 OUString aText;
 if( rxString->extractPlainString( aText, pFirstPortionFont ) )
 {
@@ -127,7 +129,7 @@ void SheetDataBuffer::setStringCell( const CellModel& 
rModel, const RichStringRe
 }
 else
 {
-putRichString( rModel.maCellAddr, *rxString, pFirstPortionFont );
+putRichString( rModel.maCellAddr, *rxString, pFirstPortionFont, 
bSingleLine );
 setCellFormat( rModel );
 }
 }
diff --git a/sc/source/filter/oox/worksheethelper.cxx 
b/sc/source/filter/oox/worksheethelper.cxx
index a50f46d8662a..d62e7f14b283 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -1591,12 +1591,16 @@ void WorksheetHelper::setCellFormulaValue(
 getFormulaBuffer().setCellFormulaValue(rAddress, rValueStr, nCellType);
 }
 
-void WorksheetHelper::putRichString( const ScAddress& rAddress, RichString& 
rString, const oox::xls::Font* pFirstPortionFont )
+void WorksheetHelper::putRichString( const ScAddress& rAddress, RichString& 
rString, const oox::xls::Font* pFirstPortionFont, bool bSingleLine )
 {
 ScEditEngineDefaulter& rEE = getEditEngine();
 
+rEE.SetSingleLine(bSingleLine);
+
 // The cell will own the text object instance returned from convert().
 getDocImport().setEditCell(rAddress, rString.convert(rEE, 
pFirstPortionFont));
+
+rEE.SetSingleLine(false);
 }
 
 void WorksheetHelper::putFormulaTokens( const ScAddress& rAddress, const 
ApiTokenSequence& rTokens )


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

2023-05-10 Thread Henry Castro (via logerrit)
 sc/source/filter/inc/richstring.hxx|7 ++-
 sc/source/filter/oox/richstring.cxx|   12 +++-
 sc/source/filter/oox/richstringcontext.cxx |4 +++-
 3 files changed, 20 insertions(+), 3 deletions(-)

New commits:
commit 2dd86aa3f365057494bf41f4da7f2f410ea3bf2e
Author: Henry Castro 
AuthorDate: Tue May 9 17:43:48 2023 -0400
Commit: Henry Castro 
CommitDate: Wed May 10 22:55:39 2023 +0200

sc: filter: oox: fix preserve space, single line case

The unit test testPreserveTextWhitespace2XLSX fails
when a single line is enabled

Test name: ScExportTest::testPreserveTextWhitespace2XLSX
equality assertion failed
- Expected: 1
- Actual  : 0
- In <>, XPath '/x:sst/x:si[2]/x:r[1]/x:t' number of nodes is incorrect

In order to fix, the single line cell should not be enabled and
import the attribute:

abc

Signed-off-by: Henry Castro 
Change-Id: I380ba8726c03abc40bdc745ea74eceb80fec6e54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151599
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/filter/inc/richstring.hxx 
b/sc/source/filter/inc/richstring.hxx
index 1e3cf921b326..f7db427bd05d 100644
--- a/sc/source/filter/inc/richstring.hxx
+++ b/sc/source/filter/inc/richstring.hxx
@@ -208,7 +208,7 @@ class RichString
 public:
 
 /** Appends and returns an index of a portion object for a plain string (t 
element). */
-sal_Int32 importText();
+sal_Int32 importText(const AttributeList& rAttribs);
 /** Appends and returns an index of a portion object for a new formatting 
run (r element). */
 sal_Int32 importRun();
 /** Appends and returns a phonetic text object for a new phonetic run (rPh 
element). */
@@ -236,6 +236,10 @@ public:
 
 RichStringPortion& getPortion(sal_Int32 nPortionIdx) { return 
maTextPortions[nPortionIdx]; }
 
+voidsetAttributes(const AttributeList& rAttribs);
+
+boolisPreserveSpace() const { return mbPreserveSpace; }
+
 private:
 /** Creates, appends, and returns a new empty string portion. */
 sal_Int32 createPortion();
@@ -253,6 +257,7 @@ private:
 std::vector  maTextPortions; /// String portions with 
font data.
 std::unique_ptr mxPhonSettings; /// Phonetic settings 
for this string.
 PhoneticVector  maPhonPortions; /// Phonetic text portions.
+bool mbPreserveSpace = false;
 };
 
 typedef std::shared_ptr< RichString > RichStringRef;
diff --git a/sc/source/filter/oox/richstring.cxx 
b/sc/source/filter/oox/richstring.cxx
index 8ac24b0ccd01..9d0de6454299 100644
--- a/sc/source/filter/oox/richstring.cxx
+++ b/sc/source/filter/oox/richstring.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -403,8 +404,10 @@ void PhoneticPortionModelList::importPortions( 
SequenceInputStream& rStrm )
 }
 }
 
-sal_Int32 RichString::importText()
+sal_Int32 RichString::importText(const AttributeList& rAttribs)
 {
+setAttributes(rAttribs);
+
 return createPortion();
 }
 
@@ -413,6 +416,13 @@ sal_Int32 RichString::importRun()
 return createPortion();
 }
 
+void  RichString::setAttributes(const AttributeList& rAttribs)
+{
+auto aAttrSpace = rAttribs.getString(oox::NMSP_xml | oox::XML_space);
+if (aAttrSpace.has() && aAttrSpace.get() == "preserve")
+mbPreserveSpace = true;
+}
+
 RichStringPhoneticRef RichString::importPhoneticRun( const AttributeList& 
rAttribs )
 {
 RichStringPhoneticRef xPhonetic = createPhonetic();
diff --git a/sc/source/filter/oox/richstringcontext.cxx 
b/sc/source/filter/oox/richstringcontext.cxx
index 280ac293a390..0c83fff2e9f3 100644
--- a/sc/source/filter/oox/richstringcontext.cxx
+++ b/sc/source/filter/oox/richstringcontext.cxx
@@ -33,7 +33,7 @@ ContextHandlerRef RichStringContext::onCreateContext( 
sal_Int32 nElement, const
 switch( nElement )
 {
 case XLS_TOKEN( t ):
-mnPortionIdx = mxString->importText();
+mnPortionIdx = mxString->importText(rAttribs);
 return this;// collect text in onCharacters()
 case XLS_TOKEN( r ):
 mnPortionIdx = mxString->importRun();
@@ -57,6 +57,7 @@ ContextHandlerRef RichStringContext::onCreateContext( 
sal_Int32 nElement, const
 break;
 
 case XLS_TOKEN( t ):
+mxString->setAttributes(rAttribs);
 return this;// collect portion text in onCharacters()
 }
 break;
@@ -65,6 +66,7 @@ ContextHandlerRef RichStringContext::onCreateContext( 
sal_Int32 nElement, const
 switch( nElement )
 {
 case XLS_TOKEN( t ):
+mxString->setAttributes(rAttribs);
 return this;// collect phonetic text in onCharacters()
 }
 break;


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

2023-05-07 Thread Henry Castro (via logerrit)
 sc/source/filter/inc/xistyle.hxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 8093d66087c8cc829df628fcf7a5c963fdd87da7
Author: Henry Castro 
AuthorDate: Tue Feb 28 09:44:27 2023 -0400
Commit: Henry Castro 
CommitDate: Sun May 7 15:30:25 2023 +0200

sc: filter: excel: add getter function LineBreak

Signed-off-by: Henry Castro 
Change-Id: I17646ed53f663fd72a10437d7a3a4407df0c176e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151429
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx
index 1d0f0e04c5b1..b4e5250dc37f 100644
--- a/sc/source/filter/inc/xistyle.hxx
+++ b/sc/source/filter/inc/xistyle.hxx
@@ -387,6 +387,7 @@ public:
 /** Reads an XF record. */
 voidReadXF( XclImpStream& rStrm );
 
+bool GetLineBreak() const { return maAlignment.mbLineBreak; }
 sal_uInt8GetHorAlign() const { return maAlignment.mnHorAlign; }
 sal_uInt16   GetFontIndex() const { return mnXclFont; }
 


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

2023-05-03 Thread Henry Castro (via logerrit)
 sc/source/filter/inc/condformatbuffer.hxx  |3 +--
 sc/source/filter/oox/condformatbuffer.cxx  |2 +-
 sc/source/filter/oox/condformatcontext.cxx |5 +++--
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit f92f1d9972d57c7030e0e9548835d1747d5ebbf4
Author: Henry Castro 
AuthorDate: Fri Apr 14 14:26:32 2023 -0400
Commit: Henry Castro 
CommitDate: Wed May 3 15:16:25 2023 +0200

sc: filter: oxx: insert more rules same range

If there are rules with the same range to preserve
priority order.


 
  "GO"
 


 
  NOT(ISERROR(SEARCH("R",E11)))
 


 
  NOT(ISERROR(SEARCH("R",E11)))
 


Signed-off-by: Henry Castro 
Change-Id: Ibb98953f0a50140dbde4d52a79fde968095881d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150436
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 

diff --git a/sc/source/filter/inc/condformatbuffer.hxx 
b/sc/source/filter/inc/condformatbuffer.hxx
index 17ef8e7621be..dfb665befe39 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -168,7 +168,6 @@ public:
 
 /** Returns the priority of this rule. */
 sal_Int32getPriority() const { return maModel.mnPriority; }
-ColorScaleRule* getCurColorScale() const { return mpColor.get(); }
 
 ColorScaleRule* getColorScale();
 DataBarRule*getDataBar();
@@ -313,7 +312,7 @@ public:
 static sal_Int32convertToApiOperator( sal_Int32 nToken );
 static ScConditionMode convertToInternalOperator( sal_Int32 nToken );
 voidfinalizeImport();
-boolinsertColorScale(CondFormatRef const & xCondFmt, 
CondFormatRuleRef const & xRule);
+boolinsertRule(CondFormatRef const & xCondFmt, 
CondFormatRuleRef const & xRule);
 
 private:
 CondFormatRef   createCondFormat();
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 64180b16d390..568a4197b070 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1218,7 +1218,7 @@ void CondFormatBuffer::updateImport(const 
ScDataBarFormatData* pTarget)
 }
 }
 
-bool CondFormatBuffer::insertColorScale(CondFormatRef const & xCondFmt, 
CondFormatRuleRef const & xRule)
+bool CondFormatBuffer::insertRule(CondFormatRef const & xCondFmt, 
CondFormatRuleRef const & xRule)
 {
 CondFormatRef xFoundFmt;
 ScRangeList aRanges = xCondFmt->getRanges();
diff --git a/sc/source/filter/oox/condformatcontext.cxx 
b/sc/source/filter/oox/condformatcontext.cxx
index f2b5fc899813..e298538847e8 100644
--- a/sc/source/filter/oox/condformatcontext.cxx
+++ b/sc/source/filter/oox/condformatcontext.cxx
@@ -204,8 +204,9 @@ void CondFormatContext::onEndElement()
 case XLS_TOKEN( cfRule ):
 if (mxCondFmt && mxRule)
 {
-if (!mxRule->getCurColorScale() ||
-!getCondFormats().insertColorScale(mxCondFmt, mxRule))
+ScRangeList aRanges = mxCondFmt->getRanges();
+if ((aRanges.size() == 1 && aRanges.GetCellCount() == 1) ||
+!getCondFormats().insertRule(mxCondFmt, mxRule))
 mxCondFmt->insertRule(mxRule);
 }
 break;


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

2023-05-02 Thread Henry Castro (via logerrit)
 sc/source/ui/view/gridwin.cxx |   74 --
 1 file changed, 71 insertions(+), 3 deletions(-)

New commits:
commit cdf604f95c132f0f88ce31b002d47d1abd731d50
Author: Henry Castro 
AuthorDate: Thu Apr 27 17:05:09 2023 -0400
Commit: Henry Castro 
CommitDate: Tue May 2 21:04:44 2023 +0200

lok: sc: fix layout RTL mouse selection

If the Calc is in layout RTL, the edit view mouse
selection does not change.

Signed-off-by: Henry Castro 
Change-Id: I0bd2640dac3cdc96fa247c305c379b2d1a8564ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150757

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 47370ee4f4a4..266790951ded 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -48,6 +48,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -345,6 +346,18 @@ static bool lcl_GetHyperlinkCell(
 return bFound;
 }
 
+static void lcl_GetMirror(Point& rPoint, tools::Rectangle& rRect, const 
tools::Long nWidth)
+{
+tools::Long nLeft = rRect.Left();
+tools::Long nRight = rRect.Right();
+tools::Long nMirrorPX = o3tl::convert(nWidth, o3tl::Length::twip, 
o3tl::Length::px);
+tools::Long nMirrorMM = o3tl::convert(nWidth, o3tl::Length::twip, 
o3tl::Length::mm100);
+
+rPoint.setX(nMirrorPX - rPoint.X());
+rRect.SetLeft(nMirrorMM - nRight);
+rRect.SetRight(nMirrorMM - nLeft);
+}
+
 //  WB_DIALOGCONTROL needed for UNO-Controls
 ScGridWindow::ScGridWindow( vcl::Window* pParent, ScViewData& rData, 
ScSplitPos eWhichPos )
 :   DocWindow( pParent, WB_CLIPCHILDREN | WB_DIALOGCONTROL ),
@@ -1878,7 +1891,25 @@ void ScGridWindow::HandleMouseButtonDown( const 
MouseEvent& rMEvt, MouseEventSta
 
 pScMod->SetInputMode( SC_INPUT_TABLE );
 bEEMouse = true;
-pEditView->MouseButtonDown( rMEvt );
+
+if (comphelper::LibreOfficeKit::isActive() && 
rDoc.IsLayoutRTL(mrViewData.GetTabNo()))
+{
+Point aMouse = rMEvt.GetPosPixel();
+tools::Rectangle aOutputArea = pEditView->GetOutputArea();
+comphelper::ScopeGuard aOutputGuard(
+[pEditView, aOutputArea] {
+pEditView->SetOutputArea(aOutputArea);
+});
+
+lcl_GetMirror(aMouse, aOutputArea, 
mrViewData.getLOKVisibleArea().GetWidth());
+pEditView->SetOutputArea(aOutputArea);
+
+MouseEvent aEvent(aMouse, rMEvt.GetClicks(), rMEvt.GetMode(),
+  rMEvt.GetButtons(), rMEvt.GetModifier());
+pEditView->MouseButtonDown( aEvent );
+}
+else
+pEditView->MouseButtonDown( rMEvt );
 return;
 }
 }
@@ -2139,7 +2170,25 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& 
rMEvt )
 SCCOL   nEditCol;
 SCROW   nEditRow;
 mrViewData.GetEditView( eWhich, pEditView, nEditCol, nEditRow );
-pEditView->MouseButtonUp( rMEvt );
+
+if (comphelper::LibreOfficeKit::isActive() && 
rDoc.IsLayoutRTL(mrViewData.GetTabNo()))
+{
+Point aMouse = rMEvt.GetPosPixel();
+tools::Rectangle aOutputArea = pEditView->GetOutputArea();
+comphelper::ScopeGuard aOutputGuard(
+[pEditView, aOutputArea] {
+pEditView->SetOutputArea(aOutputArea);
+});
+
+lcl_GetMirror(aMouse, aOutputArea, 
mrViewData.getLOKVisibleArea().GetWidth());
+pEditView->SetOutputArea(aOutputArea);
+
+MouseEvent aEvent(aMouse, rMEvt.GetClicks(), rMEvt.GetMode(),
+  rMEvt.GetButtons(), rMEvt.GetModifier());
+pEditView->MouseButtonUp( aEvent );
+}
+else
+pEditView->MouseButtonUp( rMEvt );
 
 if ( rMEvt.IsMiddle() &&
  GetSettings().GetMouseSettings().GetMiddleButtonAction() == 
MouseMiddleButtonAction::PasteSelection )
@@ -2632,7 +2681,26 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt )
 SCCOL   nEditCol;
 SCROW   nEditRow;
 mrViewData.GetEditView( eWhich, pEditView, nEditCol, nEditRow );
-pEditView->MouseMove( rMEvt );
+
+if (comphelper::LibreOfficeKit::isActive() && 
mrViewData.GetDocument().IsLayoutRTL(mrViewData.GetTabNo()))
+{
+Point aMouse = rMEvt.GetPosPixel();
+tools::Rectangle aOutputArea = pEditView->GetOutputArea();
+comphelper::ScopeGuard aOutputGuard(
+[pEditView, aOutputArea] {
+pEditView->SetOutputArea(aOutputArea);
+});
+
+lcl_GetMirror(aMouse, aOutputArea, 
mrViewData.getLOKVisibleArea().GetWidth());
+pEditView->SetOutputArea(aOutputArea);
+
+MouseEvent aEvent(aMouse, rMEvt.GetClicks(), 

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

2023-05-02 Thread Henry Castro (via logerrit)
 sc/source/ui/view/gridwin4.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 3bfd42d57502c20da70e19a26fd4d14fe4e6daa6
Author: Henry Castro 
AuthorDate: Thu Apr 27 16:34:54 2023 -0400
Commit: Henry Castro 
CommitDate: Tue May 2 21:04:00 2023 +0200

lok: sc: restore edit output area

The edit view output area is modified after the draw,
restore it so the mouse can handle selection at layout RTL.

Signed-off-by: Henry Castro 
Change-Id: I94dd9db385a3a9c60f015027894338504b4ce533
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151146

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 88f8596aea30..ca08892ee21c 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -34,6 +34,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -1190,6 +1191,11 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 // Avoid sending wrong cursor/selection messages 
by the 'other' view, as the output-area is going
 // to be tweaked temporarily to match the current 
view's zoom.
 SuppressEditViewMessagesGuard 
aGuard(*pOtherEditView);
+comphelper::ScopeGuard aOutputGuard(
+[pOtherEditView, aOrigOutputArea, bLokRTL] {
+if (bLokRTL && aOrigOutputArea != 
pOtherEditView->GetOutputArea())
+
pOtherEditView->SetOutputArea(aOrigOutputArea);
+});
 
 aEditRect = rDevice.PixelToLogic(aEditRect);
 if (bIsTiledRendering)


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

2023-04-12 Thread Henry Castro (via logerrit)
 sc/source/filter/inc/condformatbuffer.hxx  |4 
 sc/source/filter/oox/condformatbuffer.cxx  |   25 +
 sc/source/filter/oox/condformatcontext.cxx |4 +++-
 3 files changed, 32 insertions(+), 1 deletion(-)

New commits:
commit 4319d8a5e478e08e308e80314fff245de123b45b
Author: Henry Castro 
AuthorDate: Tue Mar 28 18:03:21 2023 -0400
Commit: Andras Timar 
CommitDate: Wed Apr 12 18:55:50 2023 +0200

sc: filter: oox: fix conditional color scale same range

Otherwise, the condition color scale the priority order will be lost.


 
  
   
   
   
   
  
 



 
  
   
   
   
   
  
 


Signed-off-by: Henry Castro 
Change-Id: I33fa73bfe8f0bada1cf79bc07be2e43495a4290c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149721
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/sc/source/filter/inc/condformatbuffer.hxx 
b/sc/source/filter/inc/condformatbuffer.hxx
index 3af8f6f3e474..17ef8e7621be 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -148,6 +148,7 @@ private:
 /** Represents a single rule in a conditional formatting. */
 class CondFormatRule final : public WorksheetHelper
 {
+friend class CondFormatBuffer;
 public:
 explicitCondFormatRule( const CondFormat& rCondFormat, 
ScConditionalFormat* pFormat );
 
@@ -167,6 +168,7 @@ public:
 
 /** Returns the priority of this rule. */
 sal_Int32getPriority() const { return maModel.mnPriority; }
+ColorScaleRule* getCurColorScale() const { return mpColor.get(); }
 
 ColorScaleRule* getColorScale();
 DataBarRule*getDataBar();
@@ -311,6 +313,8 @@ public:
 static sal_Int32convertToApiOperator( sal_Int32 nToken );
 static ScConditionMode convertToInternalOperator( sal_Int32 nToken );
 voidfinalizeImport();
+boolinsertColorScale(CondFormatRef const & xCondFmt, 
CondFormatRuleRef const & xRule);
+
 private:
 CondFormatRef   createCondFormat();
 voidupdateImport(const ScDataBarFormatData* pTarget);
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 1b0cb2e5405e..64180b16d390 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1218,6 +1218,31 @@ void CondFormatBuffer::updateImport(const 
ScDataBarFormatData* pTarget)
 }
 }
 
+bool CondFormatBuffer::insertColorScale(CondFormatRef const & xCondFmt, 
CondFormatRuleRef const & xRule)
+{
+CondFormatRef xFoundFmt;
+ScRangeList aRanges = xCondFmt->getRanges();
+
+for (auto& rCondFmt : maCondFormats)
+{
+if (xCondFmt == rCondFmt)
+continue;
+
+if (aRanges == rCondFmt->getRanges())
+{
+xFoundFmt = rCondFmt;
+break;
+}
+}
+
+if (xFoundFmt)
+{
+xRule->mpFormat = xFoundFmt->mpFormat;
+xFoundFmt->insertRule(xRule);
+}
+
+return (bool)xFoundFmt;
+}
 
 void CondFormatBuffer::finalizeImport()
 {
diff --git a/sc/source/filter/oox/condformatcontext.cxx 
b/sc/source/filter/oox/condformatcontext.cxx
index ab72727d1429..f2b5fc899813 100644
--- a/sc/source/filter/oox/condformatcontext.cxx
+++ b/sc/source/filter/oox/condformatcontext.cxx
@@ -204,7 +204,9 @@ void CondFormatContext::onEndElement()
 case XLS_TOKEN( cfRule ):
 if (mxCondFmt && mxRule)
 {
-mxCondFmt->insertRule(mxRule);
+if (!mxRule->getCurColorScale() ||
+!getCondFormats().insertColorScale(mxCondFmt, mxRule))
+mxCondFmt->insertRule(mxRule);
 }
 break;
 }


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

2023-04-12 Thread Henry Castro (via logerrit)
 sc/source/filter/inc/condformatbuffer.hxx |1 +
 sc/source/filter/oox/condformatbuffer.cxx |   18 +++---
 2 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit b62e9fbf1ab54c9859852052aa94b332cd708ecd
Author: Henry Castro 
AuthorDate: Tue Mar 28 17:55:17 2023 -0400
Commit: Andras Timar 
CommitDate: Wed Apr 12 18:55:34 2023 +0200

sc: filter: oox: only insert conditional format if has items

Otherwise, the empty conditional format will exists.

Signed-off-by: Henry Castro 
Change-Id: I99d83bd50ce4c12ef9be6924cba31b8847c0ad07
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149720
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/sc/source/filter/inc/condformatbuffer.hxx 
b/sc/source/filter/inc/condformatbuffer.hxx
index 0ff7006ee439..3af8f6f3e474 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -201,6 +201,7 @@ class CondFormat final : public WorksheetHelper
 friend class CondFormatBuffer;
 public:
 explicitCondFormat( const WorksheetHelper& rHelper );
+~CondFormat();
 
 /** Imports settings from the conditionalFormatting element. */
 voidimportConditionalFormatting( const AttributeList& 
rAttribs );
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 6a9b80482f3a..1b0cb2e5405e 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1097,6 +1097,12 @@ CondFormat::CondFormat( const WorksheetHelper& rHelper ) 
:
 {
 }
 
+CondFormat::~CondFormat()
+{
+if (!mbReadyForFinalize && mpFormat)
+delete mpFormat;
+}
+
 void CondFormat::importConditionalFormatting( const AttributeList& rAttribs )
 {
 getAddressConverter().convertToCellRangeList( maModel.maRanges, 
rAttribs.getString( XML_sqref, OUString() ), getSheetIndex(), true );
@@ -1135,10 +1141,16 @@ void CondFormat::finalizeImport()
 ScDocument& rDoc = getScDocument();
 mpFormat->SetRange(maModel.maRanges);
 maRules.forEachMem( ::finalizeImport );
-SCTAB nTab = maModel.maRanges.GetTopLeftCorner().Tab();
-sal_Int32 nIndex = 
getScDocument().AddCondFormat(std::unique_ptr(mpFormat), 
nTab);
 
-rDoc.AddCondFormatData( maModel.maRanges, nTab, nIndex );
+if (mpFormat->size() > 0)
+{
+SCTAB nTab = maModel.maRanges.GetTopLeftCorner().Tab();
+sal_Int32 nIndex = 
getScDocument().AddCondFormat(std::unique_ptr(mpFormat), 
nTab);
+
+rDoc.AddCondFormatData( maModel.maRanges, nTab, nIndex );
+}
+else
+mbReadyForFinalize = false;
 }
 
 CondFormatRuleRef CondFormat::createRule()


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

2023-04-12 Thread Henry Castro (via logerrit)
 sc/source/filter/inc/condformatbuffer.hxx  |2 +-
 sc/source/filter/oox/condformatbuffer.cxx  |1 -
 sc/source/filter/oox/condformatcontext.cxx |6 ++
 3 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 550eb72343eaeacb8b3b80f12e3acb4d4a1431e5
Author: Henry Castro 
AuthorDate: Tue Mar 28 17:48:19 2023 -0400
Commit: Andras Timar 
CommitDate: Wed Apr 12 18:53:12 2023 +0200

sc: filter: oox: do not insert rule too early

The  tag is a good place to do a post check
the conditional format sanity.

Signed-off-by: Henry Castro 
Change-Id: Id6e99c81011040ec47034e993490fae5c71d7e04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149719
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/sc/source/filter/inc/condformatbuffer.hxx 
b/sc/source/filter/inc/condformatbuffer.hxx
index 61271c08441d..0ff7006ee439 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -219,9 +219,9 @@ public:
 const ScRangeList& getRanges() const { return maModel.maRanges; }
 
 voidsetReadyForFinalize() { mbReadyForFinalize = true; }
+voidinsertRule( CondFormatRuleRef const & xRule );
 private:
 CondFormatRuleRef   createRule();
-voidinsertRule( CondFormatRuleRef const & xRule );
 
 private:
 typedef RefMap< sal_Int32, CondFormatRule > CondFormatRuleMap;
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 01aa5a5e1c54..6a9b80482f3a 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1108,7 +1108,6 @@ CondFormatRuleRef CondFormat::importCfRule( const 
AttributeList& rAttribs )
 {
 CondFormatRuleRef xRule = createRule();
 xRule->importCfRule( rAttribs );
-insertRule( xRule );
 return xRule;
 }
 
diff --git a/sc/source/filter/oox/condformatcontext.cxx 
b/sc/source/filter/oox/condformatcontext.cxx
index 9c9a47065bac..ab72727d1429 100644
--- a/sc/source/filter/oox/condformatcontext.cxx
+++ b/sc/source/filter/oox/condformatcontext.cxx
@@ -201,6 +201,12 @@ void CondFormatContext::onEndElement()
 if(mxCondFmt)
 mxCondFmt->setReadyForFinalize();
 break;
+case XLS_TOKEN( cfRule ):
+if (mxCondFmt && mxRule)
+{
+mxCondFmt->insertRule(mxRule);
+}
+break;
 }
 }
 


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

2023-04-12 Thread Henry Castro (via logerrit)
 sc/source/filter/oox/condformatbuffer.cxx |   19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

New commits:
commit ceaa6002d1699e97cdf55449e20c8cfd0212f16a
Author: Henry Castro 
AuthorDate: Tue Mar 28 11:28:05 2023 -0400
Commit: Andras Timar 
CommitDate: Wed Apr 12 18:52:10 2023 +0200

sc: filter: oox: fix conditional color scale empty value \"\"

Signed-off-by: Henry Castro 
Change-Id: I115c3731db85267d115efd24739470bffaeace40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149718
Tested-by: Andras Timar 
Reviewed-by: Andras Timar 

diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 8f289d383f94..01aa5a5e1c54 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -114,15 +114,18 @@ void SetCfvoData( ColorScaleRuleModelEntry* pEntry, const 
AttributeList& rAttrib
 OUString aType = rAttribs.getString( XML_type, OUString() );
 OUString aVal = rAttribs.getString(XML_val, OUString());
 
-double nVal = 0.0;
-bool bVal = isValue(aVal, nVal);
-if( !bVal || aType == "formula" )
-{
-pEntry->maFormula = aVal;
-}
-else
+if (aVal != "\"\"")
 {
-pEntry->mnVal = nVal;
+double nVal = 0.0;
+bool bVal = isValue(aVal, nVal);
+if( !bVal || aType == "formula" )
+{
+pEntry->maFormula = aVal;
+}
+else
+{
+pEntry->mnVal = nVal;
+}
 }
 
 if (aType == "num")


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

2023-04-06 Thread Henry Castro (via logerrit)
Rebased ref, commits from common ancestor:
commit 27dc2814941423d202053cf65bbf755e403c6044
Author: Henry Castro 
AuthorDate: Tue Apr 4 16:18:24 2023 -0400
Commit: Andras Timar 
CommitDate: Thu Apr 6 15:59:05 2023 +0200

lok: sc: fix RTL auto fill rectangle

In the RTL case, the positive X axis is changed from
right to left, otherwise the auto fill rectangle overlay
will get negative coordinates.

Signed-off-by: Henry Castro 
Change-Id: If4918f02d185fc19e5ab4e8a273c443c69dc7206
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150034
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index e5e384fbdd23..47370ee4f4a4 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -6566,7 +6566,7 @@ void ScGridWindow::UpdateAutoFillOverlay()
 tools::Long nSizeYPix;
 mrViewData.GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix );
 
-if (bLayoutRTL)
+if (bLayoutRTL && !comphelper::LibreOfficeKit::isActive())
 aFillPos.AdjustX( -(nSizeXPix - 2 + (aFillHandleSize.Width() / 2)) );
 else
 aFillPos.AdjustX(nSizeXPix - (aFillHandleSize.Width() / 2) );


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

2023-04-05 Thread Henry Castro (via logerrit)
 sc/source/ui/view/gridwin.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit c6d039f754b5c3d0da7f5a41dbb3b56a2386a1f4
Author: Henry Castro 
AuthorDate: Tue Apr 4 16:18:24 2023 -0400
Commit: Andras Timar 
CommitDate: Wed Apr 5 18:49:19 2023 +0200

lok: sc: fix RTL auto fill rectangle

In the RTL case, the positive X axis is changed from
right to left, otherwise the auto fill rectangle overlay
will get negative coordinates.

Signed-off-by: Henry Castro 
Change-Id: If4918f02d185fc19e5ab4e8a273c443c69dc7206
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150034
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index e5e384fbdd23..ec019cc89b41 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -6567,6 +6567,7 @@ void ScGridWindow::UpdateAutoFillOverlay()
 mrViewData.GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix );
 
 if (bLayoutRTL)
+if (bLayoutRTL && !comphelper::LibreOfficeKit::isActive())
 aFillPos.AdjustX( -(nSizeXPix - 2 + (aFillHandleSize.Width() / 2)) );
 else
 aFillPos.AdjustX(nSizeXPix - (aFillHandleSize.Width() / 2) );


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

2023-03-23 Thread Henry Castro (via logerrit)
 sc/source/filter/inc/condformatbuffer.hxx |2 ++
 sc/source/filter/oox/condformatbuffer.cxx |   12 
 2 files changed, 14 insertions(+)

New commits:
commit e064a1ba02193e7f6572bed8e5844928af475cf6
Author: Henry Castro 
AuthorDate: Fri Mar 17 15:07:42 2023 -0400
Commit: Andras Timar 
CommitDate: Thu Mar 23 07:15:23 2023 +

sc: filter: oox: update databar format before clone

The ScDataBarFormatData should update from import (finalizeImport)
before cloning, otherwise it loose data.

Signed-off-by: Henry Castro 
Change-Id: I4af8b79e93eed8091bf01244bacac1d12e591c45
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149344
Tested-by: Andras Timar 
Reviewed-by: Andras Timar 

diff --git a/sc/source/filter/inc/condformatbuffer.hxx 
b/sc/source/filter/inc/condformatbuffer.hxx
index 8ccd7fc12e2c..61271c08441d 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -271,6 +271,7 @@ public:
 void importAxisColor(  const AttributeList& rAttribs );
 void importCfvo(  const AttributeList& rAttribs );
 ExCfRuleModel& getModel() { return maModel; }
+const ScDataBarFormatData* GetDataBarData() { return mpTarget; }
 };
 
 class ExtCfCondFormat
@@ -311,6 +312,7 @@ public:
 voidfinalizeImport();
 private:
 CondFormatRef   createCondFormat();
+voidupdateImport(const ScDataBarFormatData* pTarget);
 
 private:
 typedef RefVector< CondFormat > CondFormatVec;
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 9b2b10956256..8f289d383f94 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1195,6 +1195,16 @@ public:
 
 }
 
+void CondFormatBuffer::updateImport(const ScDataBarFormatData* pTarget)
+{
+for ( const auto& rRule : maCfRules )
+{
+if ( rRule && rRule->GetDataBarData() == pTarget )
+rRule->finalizeImport();
+}
+}
+
+
 void CondFormatBuffer::finalizeImport()
 {
 std::unordered_set aDoneExtCFs;
@@ -1222,6 +1232,8 @@ void CondFormatBuffer::finalizeImport()
 for (const auto& rxEntry : rEntries)
 {
 CondFormatRuleRef xRule = rCondFormat.createRule();
+if (ScDataBarFormat *pData = 
dynamic_cast(rxEntry.get()))
+updateImport(pData->GetDataBarData());
 ScFormatEntry* pNewEntry = rxEntry->Clone(pDoc);
 sal_Int32 nPriority = rPriorities[nEntryIdx];
 if (nPriority == -1)


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

2023-03-23 Thread Henry Castro (via logerrit)
 sc/source/filter/oox/extlstcontext.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 68f70bc79ef52dd3b17d451881829c88e666dd91
Author: Henry Castro 
AuthorDate: Fri Mar 17 11:03:36 2023 -0400
Commit: Andras Timar 
CommitDate: Thu Mar 23 07:11:52 2023 +

sc: filter: oox: add missing formula if it is a text ...

conditional format:


  NOT(ISERROR(SEARCH("Done",C1)))
  
  
   
  
  
   


   
  
 


Signed-off-by: Henry Castro 
Change-Id: I4da117a1a122b3895788645dcd5de3e36cdcad0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149343
Tested-by: Andras Timar 
Reviewed-by: Andras Timar 

diff --git a/sc/source/filter/oox/extlstcontext.cxx 
b/sc/source/filter/oox/extlstcontext.cxx
index f5bdc5ccef66..eb40c575f1b1 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -274,6 +274,12 @@ void ExtConditionalFormattingContext::onEndElement()
 break;
 case XLS14_TOKEN( cfRule ):
 {
+if (IsSpecificTextCondMode(maModel.eOperator) && nFormulaCount == 
1)
+{
+maModel.aFormula = aChars;
+maModel.eOperator = ScConditionMode::Direct;
+}
+
 getStyles().getExtDxfs().forEachMem( ::finalizeImport );
 maModel.aStyle = getStyles().createExtDxfStyle(rStyleIdx);
 rStyleIdx++;


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

2023-03-23 Thread Henry Castro (via logerrit)
 sc/source/filter/inc/condformatbuffer.hxx |1 +
 sc/source/filter/inc/extlstcontext.hxx|4 +++-
 sc/source/filter/oox/condformatbuffer.cxx |   13 +
 sc/source/filter/oox/extlstcontext.cxx|   28 
 4 files changed, 45 insertions(+), 1 deletion(-)

New commits:
commit 4e63c742bfc5d99623baa3fd8a8a53ec69cef67e
Author: Henry Castro 
AuthorDate: Fri Mar 17 10:47:31 2023 -0400
Commit: Andras Timar 
CommitDate: Thu Mar 23 07:11:34 2023 +

sc: filter: oox: Add a missing tag child of the parent tag "cfvo"


 
  0
 
 
  1
 
 
 
 
 
 


Signed-off-by: Henry Castro 
Change-Id: Ie98507e11a5cdeb0d1adc77a44fd79edb2f26d6a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149342
Tested-by: Andras Timar 
Reviewed-by: Andras Timar 

diff --git a/sc/source/filter/inc/condformatbuffer.hxx 
b/sc/source/filter/inc/condformatbuffer.hxx
index 43158e330c83..8ccd7fc12e2c 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -242,6 +242,7 @@ struct ExCfRuleModel
 ::Color mnNegativeColor;
 OUString maAxisPosition; // DataBar
 OUString maColorScaleType; // Cfvo
+OUString msScaleTypeValue; // Cfvo
 bool mbGradient; // DataBar
 bool mbIsLower; // Cfvo
 };
diff --git a/sc/source/filter/inc/extlstcontext.hxx 
b/sc/source/filter/inc/extlstcontext.hxx
index 8635c6029523..077ebdbebf8e 100644
--- a/sc/source/filter/inc/extlstcontext.hxx
+++ b/sc/source/filter/inc/extlstcontext.hxx
@@ -32,11 +32,13 @@ public:
 
 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 
nElement, const AttributeList& rAttribs ) override;
 virtual voidonStartElement( const AttributeList& rAttribs ) 
override;
+virtual voidonCharacters( const OUString& rChars ) override;
+virtual voidonEndElement() override;
 
 private:
 ScDataBarFormatData* mpTarget;
-
 bool mbFirstEntry;
+ExtCfDataBarRuleRef mpRule;
 };
 
 struct ExtCondFormatRuleModel
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 3e5569ce5b9e..9b2b10956256 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1411,6 +1411,19 @@ void ExtCfDataBarRule::finalizeImport()
 pEntry->SetType(COLORSCALE_PERCENT);
 else if (maModel.maColorScaleType == "formula")
 pEntry->SetType(COLORSCALE_FORMULA);
+else if (maModel.maColorScaleType == "num")
+pEntry->SetType(COLORSCALE_VALUE);
+
+if (!maModel.msScaleTypeValue.isEmpty())
+{
+sal_Int32 nSize = 0;
+rtl_math_ConversionStatus eStatus = 
rtl_math_ConversionStatus_Ok;
+double fValue = 
rtl::math::stringToDouble(maModel.msScaleTypeValue, '.', '\0', , 
);
+if (eStatus == rtl_math_ConversionStatus_Ok && nSize == 
maModel.msScaleTypeValue.getLength())
+{
+pEntry->SetValue(fValue);
+}
+}
 break;
 }
 case UNKNOWN: // nothing to do
diff --git a/sc/source/filter/oox/extlstcontext.cxx 
b/sc/source/filter/oox/extlstcontext.cxx
index eb470999f40f..f5bdc5ccef66 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -80,6 +80,7 @@ void ExtCfRuleContext::onStartElement( const AttributeList& 
rAttribs )
 xRule->importCfvo( rAttribs );
 xRule->getModel().mbIsLower = mbFirstEntry;
 mbFirstEntry = false;
+mpRule = xRule;
 break;
 }
 default:
@@ -87,6 +88,33 @@ void ExtCfRuleContext::onStartElement( const AttributeList& 
rAttribs )
 }
 }
 
+void ExtCfRuleContext::onCharacters( const OUString& rChars )
+{
+switch( getCurrentElement() )
+{
+case XM_TOKEN( f ):
+{
+if (mpRule)
+{
+mpRule->getModel().msScaleTypeValue = rChars;
+}
+}
+break;
+}
+}
+
+void ExtCfRuleContext::onEndElement()
+{
+switch( getCurrentElement() )
+{
+case XLS14_TOKEN( cfvo ):
+{
+mpRule.reset();
+break;
+}
+}
+}
+
 namespace {
 bool IsSpecificTextCondMode(ScConditionMode eMode)
 {


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

2023-03-23 Thread Henry Castro (via logerrit)
 sc/source/filter/oox/condformatbuffer.cxx |   76 ++
 1 file changed, 76 insertions(+)

New commits:
commit bda1d2e989e17917e37e188c6a2fa58808ea7cf1
Author: Henry Castro 
AuthorDate: Fri Mar 17 10:40:23 2023 -0400
Commit: Andras Timar 
CommitDate: Thu Mar 23 07:11:11 2023 +

sc: filter: oox: add missing attribute "indexed"


 
 
 
 
 


Signed-off-by: Henry Castro 
Change-Id: If7f6c8c902e4cd0d775f1014acad3dcd19f13f28
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149341
Tested-by: Andras Timar 
Reviewed-by: Andras Timar 

diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 9f7512d912e7..3e5569ce5b9e 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -168,6 +168,76 @@ void ColorScaleRule::importCfvo( const AttributeList& 
rAttribs )
 
 namespace {
 
+// 
https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.indexedcolors?view=openxml-2.8.1
+static ::Color IndexedColors[] = {
+0x,
+0x00FF,
+0x00FF,
+0xFF00,
+0x00FF,
+0x0000,
+0x00FF00FF,
+0x,
+0x,
+0x00FF,
+0x00FF,
+0xFF00,
+0x00FF,
+0x0000,
+0x00FF00FF,
+0x,
+0x0080,
+0x8000,
+0x0080,
+0x00808000,
+0x00800080,
+0x8080,
+0x00C0C0C0,
+0x00808080,
+0x00FF,
+0x00993366,
+0x00CC,
+0x00CC,
+0x00660066,
+0x00FF8080,
+0x66CC,
+0x00FF,
+0x0080,
+0x00FF00FF,
+0x0000,
+0x,
+0x00800080,
+0x0080,
+0x8080,
+0x00FF,
+0xCCFF,
+0x00CC,
+0x00CCFFCC,
+0x0099,
+0x0099CCFF,
+0x00FF99CC,
+0x00CC99FF,
+0x00FFCC99,
+0x003366FF,
+0x0033,
+0x0099CC00,
+0x00FFCC00,
+0x00FF9900,
+0x00FF6600,
+0x0099,
+0x00969696,
+0x3366,
+0x00339966,
+0x3300,
+0x0000,
+0x00993300,
+0x00993366,
+0x0099,
+0x0033,
+0x, // System Foreground ?
+0x, // System Background ?
+};
+
 ::Color importOOXColor(const AttributeList& rAttribs, const ThemeBuffer& 
rThemeBuffer, const GraphicHelper& rGraphicHelper)
 {
 ::Color nColor;
@@ -189,6 +259,12 @@ namespace {
 
 nColor = rThemeBuffer.getColorByIndex( nThemeIndex );
 }
+else if (rAttribs.hasAttribute(XML_indexed))
+{
+sal_uInt32 nIndexed = rAttribs.getUnsigned(XML_indexed, 0);
+if (nIndexed < sizeof(IndexedColors))
+nColor = IndexedColors[nIndexed];
+}
 
 ::Color aColor;
 double nTint = rAttribs.getDouble(XML_tint, 0.0);


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

2023-03-07 Thread Eike Rathke (via logerrit)
 sc/source/core/tool/interpr3.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3fdb1b5c534ece00b6417688c2109b7fe8376bbd
Author: Eike Rathke 
AuthorDate: Mon Feb 27 16:10:06 2023 +0100
Commit: Andras Timar 
CommitDate: Tue Mar 7 22:47:34 2023 +

Always push a result, even if it's only an error

PERCENTILE() and QUARTILE() if an error was passed as argument (or
an error encountered during obtaining arguments) omitted to push
an error result, only setting the error.

Fallout from

commit f336f63da900d76c2bf6e5690f1c8a7bd15a0aa2
CommitDate: Thu Mar 3 16:28:59 2016 +

tdf#94635 Add FORECAST.ETS functions to Calc

Change-Id: I23e276fb0ce735cfd6383cc963446499dcf819f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147922
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 64914560e279c71ff1233f4bab851e2a292797e6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147900
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit da8ca6920b78addc827171f53a42abdd59da9f9c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148326
Tested-by: Andras Timar 
Reviewed-by: Andras Timar 

diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 8d7ba5ea4952..885db473c9f8 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -3466,7 +3466,7 @@ void ScInterpreter::ScPercentile( bool bInclusive )
 GetNumberSequenceArray( 1, aArray, false );
 if ( aArray.empty() || nGlobalError != FormulaError::NONE )
 {
-SetError( FormulaError::NoValue );
+PushNoValue();
 return;
 }
 if ( bInclusive )
@@ -3489,7 +3489,7 @@ void ScInterpreter::ScQuartile( bool bInclusive )
 GetNumberSequenceArray( 1, aArray, false );
 if ( aArray.empty() || nGlobalError != FormulaError::NONE )
 {
-SetError( FormulaError::NoValue );
+PushNoValue();
 return;
 }
 if ( bInclusive )


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

2023-03-06 Thread Eike Rathke (via logerrit)
 sc/source/core/inc/interpre.hxx  |   12 
 sc/source/core/tool/interpr1.cxx |4 ++--
 2 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 35db27e97190d71e861895940ca3e6fdc57c66fa
Author: Eike Rathke 
AuthorDate: Fri Feb 17 12:03:54 2023 +0100
Commit: Andras Timar 
CommitDate: Mon Mar 6 23:10:35 2023 +

Stack check safety belt before fishing in muddy waters

Have it hit hard in debug builds.

Change-Id: I9ea54844a0661fd7a75616a2876983a74b2d5bad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147205
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 9d91fbba6f374fa1c10b38eae003da89bd4e6d4b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147902
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 322b2e32d5a0..2bad90aa12cb 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -231,6 +231,7 @@ private:
 inline bool MustHaveParamCount( short nAct, short nMust );
 inline bool MustHaveParamCount( short nAct, short nMust, short nMax );
 inline bool MustHaveParamCountMin( short nAct, short nMin );
+inline bool MustHaveParamCountMinWithStackCheck( short nAct, short nMin );
 void PushParameterExpected();
 void PushIllegalParameter();
 void PushIllegalArgument();
@@ -1082,6 +1083,17 @@ inline bool ScInterpreter::MustHaveParamCountMin( short 
nAct, short nMin )
 return false;
 }
 
+inline bool ScInterpreter::MustHaveParamCountMinWithStackCheck( short nAct, 
short nMin )
+{
+assert(sp >= nAct);
+if (sp < nAct)
+{
+PushParameterExpected();
+return false;
+}
+return MustHaveParamCountMin( nAct, nMin);
+}
+
 inline bool ScInterpreter::CheckStringPositionArgument( double & fVal )
 {
 if (!std::isfinite( fVal))
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 42d6dde67df2..27917500254a 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -7524,7 +7524,7 @@ void ScInterpreter::ScVLookup()
 void ScInterpreter::ScSubTotal()
 {
 sal_uInt8 nParamCount = GetByte();
-if ( !MustHaveParamCountMin( nParamCount, 2 ) )
+if ( !MustHaveParamCountMinWithStackCheck( nParamCount, 2 ) )
 return;
 
 // We must fish the 1st parameter deep from the stack! And push it on top.
@@ -7571,7 +7571,7 @@ void ScInterpreter::ScSubTotal()
 void ScInterpreter::ScAggregate()
 {
 sal_uInt8 nParamCount = GetByte();
-if ( !MustHaveParamCountMin( nParamCount, 3 ) )
+if ( !MustHaveParamCountMinWithStackCheck( nParamCount, 3 ) )
 return;
 
 const FormulaError nErr = nGlobalError;


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

2023-02-27 Thread Pranam Lashkari (via logerrit)
 sc/source/ui/attrdlg/attrdlg.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 300be323d3bc5b3f52394ee6924abf4e293bedb4
Author: Pranam Lashkari 
AuthorDate: Fri Feb 24 22:20:11 2023 +0530
Commit: Andras Timar 
CommitDate: Mon Feb 27 16:45:03 2023 +

sc: remove protect cell tab from cell format dialog

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

diff --git a/sc/source/ui/attrdlg/attrdlg.cxx b/sc/source/ui/attrdlg/attrdlg.cxx
index 4c761ef7b36f..66e19fcd4b15 100644
--- a/sc/source/ui/attrdlg/attrdlg.cxx
+++ b/sc/source/ui/attrdlg/attrdlg.cxx
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 ScAttrDlg::ScAttrDlg(weld::Window* pParent, const SfxItemSet* pCellAttrs)
 : SfxTabDialogController(pParent, "modules/scalc/ui/formatcellsdialog.ui",
@@ -57,7 +58,11 @@ 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 );
-AddTabPage( "cellprotection" ,  ScTabPageProtection::Create,nullptr );
+
+if (!comphelper::LibreOfficeKit::isActive())
+AddTabPage( "cellprotection" ,  ScTabPageProtection::Create,
nullptr );
+else
+RemoveTabPage( "cellprotection" );
 }
 
 ScAttrDlg::~ScAttrDlg()


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

2023-02-20 Thread Szymon Kłos (via logerrit)
 sc/source/ui/inc/tabview.hxx   |2 ++
 sc/source/ui/view/tabview2.cxx |9 +
 2 files changed, 11 insertions(+)

New commits:
commit cf10e88a7b0d6fb0f2e2ebe3d7079a405f86b379
Author: Szymon Kłos 
AuthorDate: Fri Feb 17 10:47:53 2023 +0100
Commit: Szymon Kłos 
CommitDate: Mon Feb 20 12:20:55 2023 +

lok: setup LOK notifier for invalid range error

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

diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 0bdc143d3e62..3bacff297714 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -252,6 +252,8 @@ private:
 
 voidPaintRangeFinderEntry (const ScRangeFindData* pData, SCTAB 
nTab);
 
+DECL_STATIC_LINK(ScTabView, InstallLOKNotifierHdl, void*, 
vcl::ILibreOfficeKitNotifier*);
+
 protected:
 voidUpdateHeaderWidth( const ScVSplitPos* pWhich = nullptr,
 const SCROW* pPosY = nullptr );
diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index 1c2cbd1389e6..226023b2914e 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -1443,6 +1443,11 @@ void ScTabView::MakeDrawLayer()
 }
 }
 
+IMPL_STATIC_LINK_NOARG(ScTabView, InstallLOKNotifierHdl, void*, 
vcl::ILibreOfficeKitNotifier*)
+{
+return GetpApp();
+}
+
 void ScTabView::ErrorMessage(TranslateId pGlobStrId)
 {
 if ( SC_MOD()->IsInExecuteDrop() )
@@ -1468,6 +1473,10 @@ void ScTabView::ErrorMessage(TranslateId pGlobStrId)
 m_xMessageBox.reset(Application::CreateMessageDialog(pParent,
  VclMessageType::Info, 
VclButtonsType::Ok,
  ScResId(pGlobStrId)));
+
+if (comphelper::LibreOfficeKit::isActive())
+m_xMessageBox->SetInstallLOKNotifierHdl(LINK(this, ScTabView, 
InstallLOKNotifierHdl));
+
 weld::Window* pGrabOnClose = bFocus ? pParent : nullptr;
 m_xMessageBox->runAsync(m_xMessageBox, [this, pGrabOnClose](sal_Int32 
/*nResult*/) {
 m_xMessageBox.reset();


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

2023-02-15 Thread Henry Castro (via logerrit)
 sc/source/ui/inc/output.hxx   |1 +
 sc/source/ui/view/output2.cxx |1 +
 2 files changed, 2 insertions(+)

New commits:
commit 4f52bed0624e53e3622e1007cfdef01415b8598a
Author: Henry Castro 
AuthorDate: Tue Jan 31 16:05:16 2023 -0400
Commit: Andras Timar 
CommitDate: Wed Feb 15 12:15:26 2023 +

sc: add parameter maString to DrawEditParam

It is used to cache the recently queried from
cell string.

Signed-off-by: Henry Castro 
Change-Id: I8d708e831a130464c690b3155056d9376df4aeb6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146423
Reviewed-by: Dennis Francis 
Tested-by: Andras Timar 

diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index d44f7052589b..b56437ae4a4e 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -140,6 +140,7 @@ private:
 const SfxItemSet*   mpOldPreviewFontSet;
 RowInfo*mpThisRowInfo;
 const std::vector* mpMisspellRanges;
+OUStringmaString;
 
 explicit DrawEditParam(const ScPatternAttr* pPattern, const 
SfxItemSet* pCondSet, bool bCellIsValue);
 
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index df447744e56e..d7ea8ca91008 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -4475,6 +4475,7 @@ void ScOutputData::DrawEdit(bool bPixelToLogic)
 aParam.mpOldCondSet = pOldCondSet;
 aParam.mpOldPreviewFontSet = pOldPreviewFontSet;
 aParam.mpThisRowInfo = pThisRowInfo;
+aParam.maString = aStr;
 if (mpSpellCheckCxt)
 aParam.mpMisspellRanges = 
mpSpellCheckCxt->getMisspellRanges(nCellX, nCellY);
 


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

2023-02-07 Thread Dennis Francis (via logerrit)
 sc/source/ui/view/gridwin4.cxx |   17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 2422fdacee313eb6fb9db0304dda5a7123aeb8f0
Author: Dennis Francis 
AuthorDate: Fri May 6 10:56:38 2022 +0530
Commit: Andras Timar 
CommitDate: Tue Feb 7 10:40:19 2023 +

lok: do not recreate lok-drawview for every tile paint

This lets the ScLOKDrawView live long enough for non-tile painting
related invocation of its methods and hopefully those of its member objects.

This is a blind fix for the following crash:

/opt/collaboraoffice/program/../program/libsclo.so
(anonymous 
namespace)::ScLOKProxyObjectContact::calculateGridOffsetForViewOjectContact(basegfx::B2DVector&,
 sdr::contact::ViewObjectContact const&) const
...
/opt/collaboraoffice/program/libmergedlo.so

SdrTextObj::NbcSetOutlinerParaObjectForText(std::unique_ptr >, SdrText*)

/home/collabora/jenkins/workspace/build_linux_co-2021_online_snapshot/svx/source/svdraw/svdotext.cxx:1379
/opt/collaboraoffice/program/libmergedlo.so
sdr::properties::TextProperties::ItemSetChanged(SfxItemSet const&)

/opt/rh/devtoolset-10/root/usr/include/c++/10/bits/unique_ptr.h:360
/opt/collaboraoffice/program/libmergedlo.so
sdr::properties::RectangleProperties::ItemSetChanged(SfxItemSet 
const&)

/home/collabora/jenkins/workspace/build_linux_co-2021_online_snapshot/svx/source/sdr/properties/rectangleproperties.cxx:54
/opt/collaboraoffice/program/libmergedlo.so
sdr::properties::DefaultProperties::SetObjectItem(SfxPoolItem 
const&)

/home/collabora/jenkins/workspace/build_linux_co-2021_online_snapshot/svx/source/sdr/properties/defaultproperties.cxx:120
/opt/collaboraoffice/program/libscfiltlo.so
XclTxo::XclTxo(XclExpRoot const&, EditTextObject const&, SdrObject*)

/home/collabora/jenkins/workspace/build_linux_co-2021_online_snapshot/include/svl/cenumitm.hxx:26
/opt/collaboraoffice/program/libscfiltlo.so
XclObjComment::XclObjComment(XclExpObjectManager&, tools::Rectangle 
const&, EditTextObject const&, SdrCaptionObj*, bool, ScAddress const&, 
tools::Rectangle const&, tools::Rectangle const&)

/opt/rh/devtoolset-10/root/usr/include/c++/10/bits/unique_ptr.h:179
/opt/collaboraoffice/program/libscfiltlo.so
XclExpNote::XclExpNote(XclExpRoot const&, ScAddress const&, 
ScPostIt const*, rtl::OUString const&)
/opt/rh/devtoolset-10/root/usr/include/c++/10/tuple:137
/opt/collaboraoffice/program/libscfiltlo.so
ExcTable::FillAsTableXml()

/home/collabora/jenkins/workspace/build_linux_co-2021_online_snapshot/include/rtl/ref.hxx:65
/opt/collaboraoffice/program/libscfiltlo.so
ExcDocument::ReadDoc()

/home/collabora/jenkins/workspace/build_linux_co-2021_online_snapshot/sc/source/filter/excel/excdoc.cxx:747
/opt/collaboraoffice/program/libscfiltlo.so
XclExpXmlStream::exportDocument()

/home/collabora/jenkins/workspace/build_linux_co-2021_online_snapshot/sc/source/filter/excel/xestream.cxx:1107
/opt/collaboraoffice/program/libooxlo.so

Change-Id: I248395cca1e2da37208fc449aca731175a5aa368
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133914
Tested-by: Andras Timar 
Reviewed-by: Andras Timar 
(cherry picked from commit c17c410706eab6e4d449b2a20a51bf3702329341)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143583
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 31022c43144d..88f8596aea30 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1656,13 +1656,16 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
 {
 bool bPrintTwipsMsgs = comphelper::LibreOfficeKit::isCompatFlagSet(
 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs);
-mpLOKDrawView.reset(bPrintTwipsMsgs ?
-new ScLOKDrawView(
-,
-mrViewData) :
-new FmFormView(
-*pModel,
-));
+if (!mpLOKDrawView)
+{
+mpLOKDrawView.reset(bPrintTwipsMsgs ?
+new ScLOKDrawView(
+,
+mrViewData) :
+new FmFormView(
+*pModel,
+));
+}
 
 mpLOKDrawView->SetNegativeX(bLayoutRTL);
 mpLOKDrawView->ShowSdrPage(mpLOKDrawView->GetModel()->GetPage(nTab));


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

2023-01-17 Thread Miklos Vajna (via logerrit)
 sc/source/ui/view/viewdata.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit de0c7c099710d966725b820c0781029ab80b3cd5
Author: Miklos Vajna 
AuthorDate: Fri Jan 13 08:56:29 2023 +0100
Commit: Miklos Vajna 
CommitDate: Tue Jan 17 10:58:49 2023 +

sc: fix crash in ScViewData::GetCurXForTab()

Crashreport signature:

program/libsclo.so
ScViewData::GetCurXForTab(short) const
sc/source/ui/view/viewdata.cxx:1431
program/libsclo.so
ScViewFunc::OnLOKInsertDeleteColumn(short, long)
sc/source/ui/view/viewfunc.cxx:1552
program/libsclo.so
ScDocFunc::InsertCells(ScRange const&, ScMarkData const*, 
InsCellCmd, bool, bool, bool)
source/ui/docshell/docfunc.cxx:2256
program/libsclo.so
ScViewFunc::InsertCells(InsCellCmd, bool, bool)
sc/source/ui/view/viewfunc.cxx:1658

Seeing that e.g. ScViewData::WriteUserDataSequence() already checks if
the pointer in maTabData is a nullptr, do the same here.

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

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 26387834f45a..1f2991e23fb3 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1425,7 +1425,7 @@ SCROW ScViewData::GetPosY( ScVSplitPos eWhich, SCTAB 
nForTab ) const
 
 SCCOL ScViewData::GetCurXForTab( SCTAB nTabIndex ) const
 {
-if (!ValidTab(nTabIndex) || (nTabIndex >= 
static_cast(maTabData.size(
+if (!ValidTab(nTabIndex) || (nTabIndex >= 
static_cast(maTabData.size())) || !maTabData[nTabIndex])
 return -1;
 
 return maTabData[nTabIndex]->nCurX;


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

2023-01-13 Thread Szymon Kłos (via logerrit)
 sc/source/ui/view/gridwin4.cxx |9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

New commits:
commit dbb8d805dbea42fa5955c2f9b54a1d476592df7d
Author: Szymon Kłos 
AuthorDate: Tue Jan 10 10:56:18 2023 +0100
Commit: Andras Timar 
CommitDate: Fri Jan 13 18:52:24 2023 +

lok: adjust paint rect for in-place editing

This allows to send correct cursor position (at the very end
of the cell) when typing numbers in LOK mode.

This fixes regression from:
commit  9257486636dfe95b73e5690462ba6e8408a12166
lok: sc: render expanded EditEngine when editing in-place

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

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 6fdd332092de..31022c43144d 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1174,7 +1174,9 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 // Get top-left offset because of margin and 
indent.
 lcl_GetEditAreaTLOffset(nOffsetX, nOffsetY, 
ScAddress(nCol1, nRow1, nTab), mrViewData, rDoc);
 aEditRect.AdjustLeft(nOffsetX + 1);
+aEditRect.AdjustRight(1);
 aEditRect.AdjustTop(nOffsetY + 1);
+aEditRect.AdjustBottom(1);
 
 // EditView has an 'output area' which is used to 
clip the 'paint area' we provide below.
 // So they need to be in the same 
coordinates/units. This is tied to the mapmode of the gridwin
@@ -1306,13 +1308,6 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 // paint the editeng text
 if (bIsTiledRendering)
 {
-tools::Rectangle aEditRect(aBackground);
-tools::Long nOffsetX = 0, nOffsetY = 0;
-// Get top-left offset because of margin and indent.
-lcl_GetEditAreaTLOffset(nOffsetX, nOffsetY, ScAddress(nCol1, 
nRow1, mrViewData.GetTabNo()), mrViewData, rDoc);
-aEditRect.AdjustLeft(nOffsetX + 1);
-aEditRect.AdjustTop(nOffsetY + 1);
-
 // EditView has an 'output area' which is used to clip the paint 
area we provide below.
 // So they need to be in the same coordinates/units. This is tied 
to the mapmode of the gridwin
 // attached to the EditView, so we have to change its mapmode too 
(temporarily). We save the


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

2023-01-10 Thread Henry Castro (via logerrit)
 sc/source/ui/docshell/docsh.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 579423bc8b608bdb189fcfb4f86a21ba904c43e5
Author: Henry Castro 
AuthorDate: Thu Jan 5 11:32:32 2023 -0400
Commit: Andras Timar 
CommitDate: Tue Jan 10 11:05:40 2023 +

lok: sc: avoid the shared spreadsheet dialog

It is not needed the LO core shared spreadsheet
because the online has collaborative functionality turns on
by default.

Signed-off-by: Henry Castro 
Change-Id: I57ab83eae2913522d55704ae5a115e30c9d10034
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145091
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 867bd443c47a..309455118827 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -729,7 +729,8 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& 
rHint )
 #endif
 
 #if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
-if ( IsDocShared() && !SC_MOD()->IsInSharedDocLoading() )
+if ( IsDocShared() && !SC_MOD()->IsInSharedDocLoading()
+ && !comphelper::LibreOfficeKit::isActive() )
 {
 ScAppOptions aAppOptions = SC_MOD()->GetAppOptions();
 if ( aAppOptions.GetShowSharedDocumentWarning() )


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

2023-01-10 Thread Paris Oplopoios (via logerrit)
 sc/source/filter/excel/xestream.cxx |   11 +++
 1 file changed, 11 insertions(+)

New commits:
commit 1ecf49085ae34561ddc9ef91ded4764fbe1f0732
Author: Paris Oplopoios 
AuthorDate: Wed Nov 9 13:43:46 2022 +0200
Commit: Andras Timar 
CommitDate: Tue Jan 10 08:12:41 2023 +

Get ScViewData through the current doc shell in headless mode

When using --convert-to, ScDocShell::GetViewData() would return nullptr
so we now get the ScViewData through an alternative route.

Change-Id: Ie71a4a1077b3c63c0aadd394fc0d966e679e8803
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142480
Tested-by: Jenkins
Reviewed-by: Jan Holesovsky 
(cherry picked from commit 95cb9a01bfacf7d9f03194b0710ca3c249bb62fb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142442
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index 315b905560f3..c201af071c21 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -53,6 +53,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -1045,6 +1046,16 @@ bool XclExpXmlStream::exportDocument()
 // Get the viewsettings before processing
 if( ScDocShell::GetViewData() )
 ScDocShell::GetViewData()->WriteExtOptions( mpRoot->GetExtDocOptions() 
);
+else
+{
+// Try to get ScViewData through the current ScDocShell
+ScTabViewShell* pTabViewShell = pShell->GetBestViewShell( false );
+if ( pTabViewShell )
+{
+ScViewData* pViewData = >GetViewData();
+pViewData->WriteExtOptions( mpRoot->GetExtDocOptions() );
+}
+}
 
 OUString const workbook = "xl/workbook.xml";
 const char* pWorkbookContentType = nullptr;


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

2023-01-07 Thread offtkp (via logerrit)
 sc/source/filter/excel/excrecds.cxx   |   54 ++
 sc/source/filter/inc/autofilterbuffer.hxx |1 
 sc/source/filter/inc/excrecds.hxx |5 ++
 sc/source/filter/oox/autofilterbuffer.cxx |   18 +-
 4 files changed, 70 insertions(+), 8 deletions(-)

New commits:
commit 12b76270cecfebe90eeb991f4046b2925236a4b5
Author: offtkp 
AuthorDate: Fri Nov 25 15:16:53 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sat Jan 7 12:07:53 2023 +

tdf#144786 Implement XML_hiddenButton functionality

Now hides autofilter button when there's an XML_hiddenButton=true
or a XML_showButton=false attribute

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

diff --git a/sc/source/filter/excel/excrecds.cxx 
b/sc/source/filter/excel/excrecds.cxx
index 570167b8014b..14ff3aff85b7 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -48,6 +48,8 @@
 
 #include 
 #include 
+#include 
+#include 
 
 using namespace ::oox;
 
@@ -604,11 +606,12 @@ void ExcFilterCondition::SaveText( XclExpStream& rStrm )
 }
 }
 
-XclExpAutofilter::XclExpAutofilter( const XclExpRoot& rRoot, sal_uInt16 nC ) :
+XclExpAutofilter::XclExpAutofilter( const XclExpRoot& rRoot, sal_uInt16 nC, 
bool bIsEmpty ) :
 XclExpRecord( EXC_ID_AUTOFILTER, 24 ),
 XclExpRoot( rRoot ),
-meType(FilterCondition),
+meType(bIsEmpty ? Empty : FilterCondition),
 nCol( nC ),
+bIsButtonHidden( false ),
 nFlags( 0 ),
 bHasBlankValue( false )
 {
@@ -819,10 +822,13 @@ void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm )
 
 sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
 
+std::optional sHiddenButtonValue;
+if (bIsButtonHidden)
+sHiddenButtonValue = "1";
+
 rWorksheet->startElement( XML_filterColumn,
-XML_colId, OString::number(nCol)
-// OOXTODO: XML_hiddenButton,   AutoFilter12 fHideArrow?
-// OOXTODO: XML_showButton
+XML_colId, OString::number(nCol),
+XML_hiddenButton, sHiddenButtonValue
 );
 
 switch (meType)
@@ -912,6 +918,8 @@ void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm )
 rWorksheet->endElement(XML_filters);
 }
 break;
+// Used for constructing an empty filterColumn element for exporting 
the XML_hiddenButton attribute
+case Empty: break;
 }
 rWorksheet->endElement( XML_filterColumn );
 }
@@ -972,6 +980,8 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& 
rRoot, SCTAB nTab, const
 boolbContLoop   = true;
 boolbHasOr  = false;
 SCCOLROW nFirstField = aParam.GetEntry( 0 ).nField;
+ScDocument& rDoc = rRoot.GetDoc();
+SCROW nRow = aRange.aStart.Row();
 
 // create AUTOFILTER records for filtered columns
 for( SCSIZE nEntry = 0; !bConflict && bContLoop && (nEntry < 
aParam.GetEntryCount()); nEntry++ )
@@ -981,7 +991,11 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& 
rRoot, SCTAB nTab, const
 bContLoop = rEntry.bDoQuery;
 if( bContLoop )
 {
-XclExpAutofilter* pFilter = GetByCol( 
static_cast(rEntry.nField) - aRange.aStart.Col() );
+SCCOL nCol = static_cast( rEntry.nField ) - 
aRange.aStart.Col();
+auto nFlag = rDoc.GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG 
)->GetValue();
+bool bIsButtonHidden = !( nFlag & ScMF::Auto );
+XclExpAutofilter* pFilter = GetByCol( nCol );
+pFilter->SetButtonHidden( bIsButtonHidden );
 
 if( nEntry > 0 )
 bHasOr |= (rEntry.eConnect == SC_OR);
@@ -995,6 +1009,34 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& 
rRoot, SCTAB nTab, const
 }
 }
 
+sal_uInt16 nColId = 0;
+for ( auto nCol = aRange.aStart.Col(); nCol <= aRange.aEnd.Col(); 
nCol++, nColId++ )
+{
+auto nFlag = rDoc.GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG 
)->GetValue();
+bool bIsButtonHidden = !( nFlag & ScMF::Auto );
+if ( bIsButtonHidden )
+{
+// Create filter column with hiddenButton=1 attribute if it 
doesn't exist
+XclExpAutofilterRef xFilter;
+bool bFilterFound = false;
+for( size_t nPos = 0, nSize = maFilterList.GetSize(); nPos < 
nSize; ++nPos )
+{
+xFilter = maFilterList.GetRecord( nPos );
+if( xFilter->GetCol() == static_cast(nCol) )
+{
+bFilterFound = true;
+break;
+}
+  

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

2023-01-01 Thread Noel Grandin (via logerrit)
 sc/source/core/tool/compiler.cxx |  225 +++
 1 file changed, 157 insertions(+), 68 deletions(-)

New commits:
commit 6bd6f01b31bfd0175670ed3848d4ae0ff9138194
Author: Noel Grandin 
AuthorDate: Wed Dec 28 17:30:12 2022 +0200
Commit: Dennis Francis 
CommitDate: Mon Jan 2 04:32:29 2023 +

optimise SUMPRODUCT(IF..) where we have entire column/row ranges

following the same pattern as for SUM, set those ranges to shrink to
available data.

Takes it from 3s to <500ms on my test spreadsheet.

Change-Id: I53ada996393a063b12ef7dd0f9bff40c90ecc8be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144850
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 9713a4aae980a52d08d38f5b12424aa5e33f9a75)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144901
Reviewed-by: Michael Meeks 
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Dennis Francis 

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index f1535a00fb9b..81c45db54b92 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -6452,89 +6452,178 @@ void ScCompiler::AnnotateTrimOnDoubleRefs()
 // OpCode of the "root" operator (which is already in RPN array).
 OpCode eOpCode = (*(pCode - 1))->GetOpCode();
 // eOpCode can be some operator which does not change with operands with 
or contains zero values.
-if (eOpCode != ocSum)
-return;
+if (eOpCode == ocSum)
+{
+FormulaToken** ppTok = pCode - 2; // exclude the root operator.
+// The following loop runs till a "pattern" is found or there is a 
mismatch
+// and marks the push DoubleRef arguments as trimmable when there is a 
match.
+// The pattern is
+// SUM(IF(=, ))
+// such that one of the operands of ocEqual is a double-ref.
+// Examples of formula that matches this are:
+//   SUM(IF(D:D=$A$1,F:F)*$H$1*2.3/$G$2)
+//   SUM((IF(D:D=$A$1,F:F)*$H$1*2.3/$G$2)*$H$2*5/$G$3)
+//   SUM(IF(E:E=16,F:F)*$H$1*100)
+bool bTillClose = true;
+bool bCloseTillIf = false;
+sal_Int16 nToksTillIf = 0;
+constexpr sal_Int16 MAXDIST_IF = 15;
+while (*ppTok)
+{
+FormulaToken* pTok = *ppTok;
+OpCode eCurrOp = pTok->GetOpCode();
+++nToksTillIf;
+
+// TODO : Is there a better way to handle this ?
+// ocIf is too far off from the sum opcode.
+if (nToksTillIf > MAXDIST_IF)
+return;
 
-FormulaToken** ppTok = pCode - 2; // exclude the root operator.
-// The following loop runs till a "pattern" is found or there is a mismatch
-// and marks the push DoubleRef arguments as trimmable when there is a 
match.
-// The pattern is
-// SUM(IF(=, ))
-// such that one of the operands of ocEqual is a double-ref.
-// Examples of formula that matches this are:
-//   SUM(IF(D:D=$A$1,F:F)*$H$1*2.3/$G$2)
-//   SUM((IF(D:D=$A$1,F:F)*$H$1*2.3/$G$2)*$H$2*5/$G$3)
-//   SUM(IF(E:E=16,F:F)*$H$1*100)
-bool bTillClose = true;
-bool bCloseTillIf = false;
-sal_Int16 nToksTillIf = 0;
-constexpr sal_Int16 MAXDIST_IF = 15;
-while (*ppTok)
-{
-FormulaToken* pTok = *ppTok;
-OpCode eCurrOp = pTok->GetOpCode();
-++nToksTillIf;
-
-// TODO : Is there a better way to handle this ?
-// ocIf is too far off from the sum opcode.
-if (nToksTillIf > MAXDIST_IF)
-return;
+switch (eCurrOp)
+{
+case ocDiv:
+case ocMul:
+if (!bTillClose)
+return;
+break;
+case ocPush:
 
-switch (eCurrOp)
-{
-case ocDiv:
-case ocMul:
-if (!bTillClose)
-return;
-break;
-case ocPush:
+break;
+case ocClose:
+if (bTillClose)
+{
+bTillClose = false;
+bCloseTillIf = true;
+}
+else
+return;
+break;
+case ocIf:
+{
+if (!bCloseTillIf)
+return;
 
-break;
-case ocClose:
-if (bTillClose)
-{
-bTillClose = false;
-bCloseTillIf = true;
-}
-else
+if (!pTok->IsInForceArray())
+return;
+
+const short nJumpCount = pTok->GetJump()[0];
+if (nJumpCount != 2) // Should have THEN but no ELSE.
+ 

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

2022-12-20 Thread Michael Meeks (via logerrit)
 sc/source/ui/unoobj/docuno.cxx |   11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 3d3f15040c7ed4f8d8e3fedf93b5042ae15b70c7
Author: Michael Meeks 
AuthorDate: Thu Dec 15 18:32:59 2022 +
Commit: Andras Timar 
CommitDate: Tue Dec 20 20:47:14 2022 +

lok: protect sc from null ScViewData.

Working hypothesis is this happens after a failed spreadsheet
load, or from a race during load.


ScModelObj::getPartInfo(int) sc/source/ui/unoobj/docuno.cxx:602
doc_getPartInfo desktop/source/lib/init.cxx:3531
...
KitSocketPoll::kitPoll(int)   coolforkit
SvpSalInstance::DoYield(bool, bool) vcl/headless/svpinst.cxx:492

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

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 4b6d5ff3a2a9..1b3c53213d3e 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -572,7 +572,10 @@ void ScModelObj::paintTile( VirtualDevice& rDevice,
 void ScModelObj::setPart( int nPart, bool /*bAllowChangeFocus*/ )
 {
 ScViewData* pViewData = ScDocShell::GetViewData();
-ScTabView* pTabView = pViewData->GetView();
+ScTabView* pTabView = nullptr;
+
+if (pViewData)
+pTabView = pViewData->GetView();
 
 if (pTabView)
 {
@@ -599,6 +602,8 @@ int ScModelObj::getPart()
 OUString ScModelObj::getPartInfo( int nPart )
 {
 ScViewData* pViewData = ScDocShell::GetViewData();
+if (!pViewData)
+return OUString();
 const bool bIsVisible = pViewData->GetDocument().IsVisible(nPart);
 //FIXME: Implement IsSelected().
 const bool bIsSelected = false; 
//pViewData->GetDocument()->IsSelected(nPart);
@@ -618,6 +623,8 @@ OUString ScModelObj::getPartName( int nPart )
 {
 OUString sTabName;
 ScViewData* pViewData = ScDocShell::GetViewData();
+if (!pViewData)
+return OUString();
 pViewData->GetDocument().GetName(nPart, sTabName);
 return sTabName;
 }
@@ -626,6 +633,8 @@ OUString ScModelObj::getPartHash( int nPart )
 {
 sal_Int64 nHashCode;
 ScViewData* pViewData = ScDocShell::GetViewData();
+if (!pViewData)
+return OUString();
 return (pViewData->GetDocument().GetHashCode(nPart, nHashCode) ? 
OUString::number(nHashCode) : OUString());
 }
 


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

2022-12-19 Thread Henry Castro (via logerrit)
 sc/source/ui/view/gridwin.cxx |   13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 3b288c71d6dcb09c083c7d4b0b32b2d1d78f9190
Author: Henry Castro 
AuthorDate: Wed Dec 14 11:40:16 2022 -0400
Commit: Michael Meeks 
CommitDate: Mon Dec 19 20:16:11 2022 +

lok:sc: do not generate extra mouseup events

In tiled rendering case, the client side always will
send the pair mousedown/mouseup events to server side,
it is not necessary to generate extra mouseup events
when the mouse tracking has ended, otherwise the selection
engine will receive two mouseup events and wrong selection
states.

Signed-off-by: Henry Castro 
Change-Id: I99983de9591e26f6e5327fff63c45e682cbf1999
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144168
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 93522adc4bdb..540dce9ba6cf 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2912,11 +2912,14 @@ void ScGridWindow::Tracking( const TrackingEvent& rTEvt 
)
 }
 else if ( rTEvt.IsTrackingEnded() )
 {
-// MouseButtonUp always with matching buttons (eg for test tool, # 
63148 #)
-// The tracking event will indicate if it was completed and not 
canceled.
-MouseEvent aUpEvt( rMEvt.GetPosPixel(), rMEvt.GetClicks(),
-rMEvt.GetMode(), nButtonDown, rMEvt.GetModifier() 
);
-MouseButtonUp( aUpEvt );
+if (!comphelper::LibreOfficeKit::isActive())
+{
+// MouseButtonUp always with matching buttons (eg for test tool, # 
63148 #)
+// The tracking event will indicate if it was completed and not 
canceled.
+MouseEvent aUpEvt( rMEvt.GetPosPixel(), rMEvt.GetClicks(),
+   rMEvt.GetMode(), nButtonDown, 
rMEvt.GetModifier() );
+MouseButtonUp( aUpEvt );
+}
 }
 else
 MouseMove( rMEvt );


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

2022-11-18 Thread Szymon Kłos (via logerrit)
 sc/source/ui/inc/delcodlg.hxx  |1 -
 sc/source/ui/miscdlgs/delcodlg.cxx |1 -
 vcl/jsdialog/enabled.cxx   |3 ++-
 3 files changed, 2 insertions(+), 3 deletions(-)

New commits:
commit f3af2b8d041232708cc2df56592c561e463a2362
Author: Szymon Kłos 
AuthorDate: Thu Nov 17 21:40:54 2022 +0100
Commit: Michael Meeks 
CommitDate: Fri Nov 18 11:48:39 2022 +0100

jsdialog: enable Delete content dialog

Dialog had unused m_xBtnOk which has defined standard
response in .ui file - no need to bind anything in the code.

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

diff --git a/sc/source/ui/inc/delcodlg.hxx b/sc/source/ui/inc/delcodlg.hxx
index c23deed4fcc6..7c49a79f9d33 100644
--- a/sc/source/ui/inc/delcodlg.hxx
+++ b/sc/source/ui/inc/delcodlg.hxx
@@ -35,7 +35,6 @@ private:
 std::unique_ptr m_xBtnDelNotes;
 std::unique_ptr m_xBtnDelAttrs;
 std::unique_ptr m_xBtnDelObjects;
-std::unique_ptr m_xBtnOk;
 
 static bool bPreviousAllCheck;
 static InsertDeleteFlags nPreviousChecks;
diff --git a/sc/source/ui/miscdlgs/delcodlg.cxx 
b/sc/source/ui/miscdlgs/delcodlg.cxx
index 9d804c252419..56334ba9ca9c 100644
--- a/sc/source/ui/miscdlgs/delcodlg.cxx
+++ b/sc/source/ui/miscdlgs/delcodlg.cxx
@@ -37,7 +37,6 @@ ScDeleteContentsDlg::ScDeleteContentsDlg(weld::Window* 
pParent)
 , m_xBtnDelNotes(m_xBuilder->weld_check_button("comments"))
 , m_xBtnDelAttrs(m_xBuilder->weld_check_button("formats"))
 , m_xBtnDelObjects(m_xBuilder->weld_check_button("objects"))
-, m_xBtnOk(m_xBuilder->weld_button("ok"))
 {
 m_xBtnDelAll->set_active( ScDeleteContentsDlg::bPreviousAllCheck );
 m_xBtnDelStrings->set_active( bool(InsertDeleteFlags::STRING & 
ScDeleteContentsDlg::nPreviousChecks) );
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index fd2afd7bbf68..249b18a05d67 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -74,7 +74,8 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"modules/swriter/ui/captionoptions.ui"
 || rUIFile == u"cui/ui/formatnumberdialog.ui"
 || rUIFile == u"cui/ui/password.ui"
-|| rUIFile == u"cui/ui/numberingformatpage.ui")
+|| rUIFile == u"cui/ui/numberingformatpage.ui"
+|| rUIFile == u"modules/scalc/ui/deletecontents.ui")
 {
 return true;
 }


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

2022-11-17 Thread Szymon Kłos (via logerrit)
 sc/source/ui/inc/inscldlg.hxx  |1 -
 sc/source/ui/miscdlgs/inscldlg.cxx |3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

New commits:
commit ed84eab299023d88a008e21ade8c0a6f38631a55
Author: Szymon Kłos 
AuthorDate: Wed Nov 2 18:40:09 2022 +0100
Commit: Michael Meeks 
CommitDate: Thu Nov 17 10:20:37 2022 +0100

Dont use equal name for label and widget

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

diff --git a/sc/source/ui/inc/inscldlg.hxx b/sc/source/ui/inc/inscldlg.hxx
index d159c65cd8ac..b44bfb60baa9 100644
--- a/sc/source/ui/inc/inscldlg.hxx
+++ b/sc/source/ui/inc/inscldlg.hxx
@@ -30,7 +30,6 @@ private:
 std::unique_ptr m_xBtnCellsRight;
 std::unique_ptr m_xBtnInsRow;
 std::unique_ptr m_xBtnInsCol;
-std::unique_ptr m_xLbCellsRight;
 
 public:
 ScInsertCellDlg(weld::Window* pParent, bool bDisallowCellMove);
diff --git a/sc/source/ui/miscdlgs/inscldlg.cxx 
b/sc/source/ui/miscdlgs/inscldlg.cxx
index ac97c6ac3578..e077724f4264 100644
--- a/sc/source/ui/miscdlgs/inscldlg.cxx
+++ b/sc/source/ui/miscdlgs/inscldlg.cxx
@@ -32,11 +32,10 @@ ScInsertCellDlg::ScInsertCellDlg(weld::Window* pParent, 
bool bDisallowCellMove)
 , m_xBtnCellsRight(m_xBuilder->weld_radio_button("right"))
 , m_xBtnInsRow(m_xBuilder->weld_radio_button("rows"))
 , m_xBtnInsCol(m_xBuilder->weld_radio_button("cols"))
-, m_xLbCellsRight(m_xBuilder->weld_label("right"))
 {
 const ScViewData* pViewData = ScDocShell::GetViewData();
 if (pViewData && 
pViewData->GetDocument().IsLayoutRTL(pViewData->GetTabNo()))
-m_xLbCellsRight->set_label(ScResId(SCSTR_INSERT_RTL));
+m_xBtnCellsRight->set_label(ScResId(SCSTR_INSERT_RTL));
 
 if (bDisallowCellMove)
 {


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

2022-11-14 Thread user (via logerrit)
 sc/source/ui/view/gridwin4.cxx |   12 
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit 142e56c21f711a8d5b015d964a7db7a9211a1294
Author: user 
AuthorDate: Thu Nov 10 21:27:36 2022 +0100
Commit: Gökay ŞATIR 
CommitDate: Mon Nov 14 09:11:22 2022 +0100

Revert "lok: respect zoom in calc tile rendering of EditView"

This reverts commit 7260b8724fafd41294761382f69ece7fe09588c4.
lok: respect zoom in calc tile rendering of EditView

Which was causing chart artifacts. Original issue which was
fixed by above change is no longer valid. Probably different
fix was made.

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

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 970a4591411f..6fdd332092de 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -749,8 +749,7 @@ void ScGridWindow::DrawContent(OutputDevice , const 
ScTableInfo& rTableI
 // the same as editeng and drawinglayer), and get rid of all the
 // SetMapMode's and other unnecessary fun we have with pixels
 // See also ScGridWindow::GetDrawMapMode() for the rest of this hack
-aDrawMode.SetOrigin(PixelToLogic(Point(tools::Long(nScrX / 
aOutputData.aZoomX),
-   tools::Long(nScrY / 
aOutputData.aZoomY)), aDrawMode));
+aDrawMode.SetOrigin(PixelToLogic(Point(nScrX, nScrY), aDrawMode));
 }
 tools::Rectangle aDrawingRectLogic;
 bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
@@ -1055,9 +1054,6 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 
 if (bIsTiledRendering)
 {
-const double fZoomX = static_cast(aOutputData.aZoomX);
-const double fZoomY = static_cast(aOutputData.aZoomY);
-
 Point aOrigin = aOriginalMode.GetOrigin();
 if (bLayoutRTL)
 aOrigin.setX(-o3tl::convert(aOrigin.getX(), 
o3tl::Length::twip, o3tl::Length::px)
@@ -1069,8 +1065,8 @@ 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 / fZoomX,
-aOrigin.getY() * twipFactor / fZoomY);
+aOrigin = Point(aOrigin.getX() * twipFactor,
+aOrigin.getY() * twipFactor);
 MapMode aNew = rDevice.GetMapMode();
 aNew.SetOrigin(aOrigin);
 rDevice.SetMapMode(aNew);
@@ -1657,7 +1653,7 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
  -nTopLeftTileRowOffset,
  nTopLeftTileCol, nTopLeftTileRow,
  nBottomRightTileCol, nBottomRightTileRow,
- fPPTX, fPPTY, , );
+ fPPTX, fPPTY, nullptr, nullptr);
 
 // setup the SdrPage so that drawinglayer works correctly
 ScDrawLayer* pModel = rDoc.GetDrawLayer();


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

2022-11-12 Thread Tomaž Vajngerl (via logerrit)
 sc/source/ui/view/output.cxx |   21 ++---
 1 file changed, 10 insertions(+), 11 deletions(-)

New commits:
commit 2f5b91c4fd99dd13dacfc9ee675ddd2f32cf7b8c
Author: Tomaž Vajngerl 
AuthorDate: Sun Feb 6 18:30:39 2022 +0900
Commit: Aron Budea 
CommitDate: Sat Nov 12 15:19:37 2022 +0100

sc: fix rendering of conditional formatting icon

The bWorksInPixels flag isn't needed as it means some rendering
information is in pixel instead of logic, but we render in logic,
not in pixels as it is falsely assumed. So don't take into account
the bWorksInPixels flag and just render in pixels when LOKit is
active.

Change-Id: I3703d459a2d1444c397f2d9e97af9f0d3010d544
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129546
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit d0a11f591a57754362bb86c4bb07869bc18e5f75)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142609
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Aron Budea 

diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 1b40ae0b4b62..d2a65bac6df0 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -910,7 +910,7 @@ const BitmapEx& getIcon(sc::IconSetBitmapMap & 
rIconSetBitmapMap, ScIconSetType
 }
 
 void drawIconSets(vcl::RenderContext& rRenderContext, const ScIconSetInfo* 
pOldIconSetInfo, const tools::Rectangle& rRect, tools::Long nOneX, tools::Long 
nOneY,
-sc::IconSetBitmapMap & rIconSetBitmapMap, bool bWorksInPixels)
+sc::IconSetBitmapMap & rIconSetBitmapMap)
 {
 ScIconSetType eType = pOldIconSetInfo->eIconSetType;
 sal_Int32 nIndex = pOldIconSetInfo->nIconIndex;
@@ -920,16 +920,15 @@ void drawIconSets(vcl::RenderContext& rRenderContext, 
const ScIconSetInfo* pOldI
 
 if (pOldIconSetInfo->mnHeight)
 {
-if (bWorksInPixels)
+if (comphelper::LibreOfficeKit::isActive())
 {
 aHeight = rRenderContext.LogicToPixel(Size(0, 
pOldIconSetInfo->mnHeight), MapMode(MapUnit::MapTwip)).Height();
-if (comphelper::LibreOfficeKit::isActive())
-{
-aHeight *= comphelper::LibreOfficeKit::getDPIScale();
-}
+aHeight *= comphelper::LibreOfficeKit::getDPIScale();
 }
 else
+{
 aHeight = o3tl::convert(pOldIconSetInfo->mnHeight, 
o3tl::Length::twip, o3tl::Length::mm100);
+}
 }
 
 Size aSize = rIcon.GetSizePixel();
@@ -945,7 +944,7 @@ void drawIconSets(vcl::RenderContext& rRenderContext, const 
ScIconSetInfo* pOldI
 void drawCells(vcl::RenderContext& rRenderContext, std::optional const 
& pColor, const SvxBrushItem* pBackground, std::optional& pOldColor, 
const SvxBrushItem*& pOldBackground,
 tools::Rectangle& rRect, tools::Long nPosX, tools::Long nLayoutSign, 
tools::Long nOneX, tools::Long nOneY, const ScDataBarInfo* pDataBarInfo, const 
ScDataBarInfo*& pOldDataBarInfo,
 const ScIconSetInfo* pIconSetInfo, const ScIconSetInfo*& 
pOldIconSetInfo,
-sc::IconSetBitmapMap & rIconSetBitmapMap, bool bWorksInPixels)
+sc::IconSetBitmapMap & rIconSetBitmapMap)
 {
 tools::Long nSignedOneX = nOneX * nLayoutSign;
 // need to paint if old color scale has been used and now
@@ -962,7 +961,7 @@ void drawCells(vcl::RenderContext& rRenderContext, 
std::optional const &
 if( pOldDataBarInfo )
 drawDataBars(rRenderContext, pOldDataBarInfo, rRect, nOneX, nOneY);
 if( pOldIconSetInfo )
-drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap, bWorksInPixels);
+drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap);
 
 rRect.SetLeft( nPosX - nSignedOneX );
 }
@@ -982,7 +981,7 @@ void drawCells(vcl::RenderContext& rRenderContext, 
std::optional const &
 if( pOldDataBarInfo )
 drawDataBars(rRenderContext, pOldDataBarInfo, rRect, nOneX, nOneY);
 if( pOldIconSetInfo )
-drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap, bWorksInPixels);
+drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap);
 
 rRect.SetLeft( nPosX - nSignedOneX );
 }
@@ -1166,7 +1165,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& 
rRenderContext)
 if (bWorksInPixels)
 nPosXLogic = rRenderContext.PixelToLogic(Point(nPosX, 
0)).X();
 
-drawCells(rRenderContext, pColor, pBackground, pOldColor, 
pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, 
pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo, 
mpDoc->GetIconSetBitmapMap(), bWorksInPixels);
+drawCells(rRenderContext, pColor, pBackground, pOldColor, 
pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, 

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

2022-11-12 Thread Tomaž Vajngerl (via logerrit)
 sc/source/ui/view/output.cxx |   25 ++---
 1 file changed, 18 insertions(+), 7 deletions(-)

New commits:
commit 3d86217598fd6507536d2c9998f9c404abae3d6a
Author: Tomaž Vajngerl 
AuthorDate: Mon Jan 10 14:54:31 2022 +0900
Commit: Aron Budea 
CommitDate: Sat Nov 12 15:19:17 2022 +0100

sc: fix cond. format icon size, when we work with pixels

This is the case when the device is bWorksInPixels is true, which
is the case when running LOKit.

Change-Id: Ibfced11bf614604521240908f4821fb9abfbf362
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128200
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit f2e1c6033890e513aa8e6b15dd6f26905d4622c8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142608
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Aron Budea 

diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 82126f68fe1d..1b40ae0b4b62 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -910,7 +910,7 @@ const BitmapEx& getIcon(sc::IconSetBitmapMap & 
rIconSetBitmapMap, ScIconSetType
 }
 
 void drawIconSets(vcl::RenderContext& rRenderContext, const ScIconSetInfo* 
pOldIconSetInfo, const tools::Rectangle& rRect, tools::Long nOneX, tools::Long 
nOneY,
-sc::IconSetBitmapMap & rIconSetBitmapMap)
+sc::IconSetBitmapMap & rIconSetBitmapMap, bool bWorksInPixels)
 {
 ScIconSetType eType = pOldIconSetInfo->eIconSetType;
 sal_Int32 nIndex = pOldIconSetInfo->nIconIndex;
@@ -919,7 +919,18 @@ void drawIconSets(vcl::RenderContext& rRenderContext, 
const ScIconSetInfo* pOldI
 tools::Long aHeight = o3tl::convert(10, o3tl::Length::pt, 
o3tl::Length::mm100);
 
 if (pOldIconSetInfo->mnHeight)
-aHeight = o3tl::convert(pOldIconSetInfo->mnHeight, o3tl::Length::twip, 
o3tl::Length::mm100);
+{
+if (bWorksInPixels)
+{
+aHeight = rRenderContext.LogicToPixel(Size(0, 
pOldIconSetInfo->mnHeight), MapMode(MapUnit::MapTwip)).Height();
+if (comphelper::LibreOfficeKit::isActive())
+{
+aHeight *= comphelper::LibreOfficeKit::getDPIScale();
+}
+}
+else
+aHeight = o3tl::convert(pOldIconSetInfo->mnHeight, 
o3tl::Length::twip, o3tl::Length::mm100);
+}
 
 Size aSize = rIcon.GetSizePixel();
 double fRatio = aSize.Width() / aSize.Height();
@@ -934,7 +945,7 @@ void drawIconSets(vcl::RenderContext& rRenderContext, const 
ScIconSetInfo* pOldI
 void drawCells(vcl::RenderContext& rRenderContext, std::optional const 
& pColor, const SvxBrushItem* pBackground, std::optional& pOldColor, 
const SvxBrushItem*& pOldBackground,
 tools::Rectangle& rRect, tools::Long nPosX, tools::Long nLayoutSign, 
tools::Long nOneX, tools::Long nOneY, const ScDataBarInfo* pDataBarInfo, const 
ScDataBarInfo*& pOldDataBarInfo,
 const ScIconSetInfo* pIconSetInfo, const ScIconSetInfo*& 
pOldIconSetInfo,
-sc::IconSetBitmapMap & rIconSetBitmapMap)
+sc::IconSetBitmapMap & rIconSetBitmapMap, bool bWorksInPixels)
 {
 tools::Long nSignedOneX = nOneX * nLayoutSign;
 // need to paint if old color scale has been used and now
@@ -951,7 +962,7 @@ void drawCells(vcl::RenderContext& rRenderContext, 
std::optional const &
 if( pOldDataBarInfo )
 drawDataBars(rRenderContext, pOldDataBarInfo, rRect, nOneX, nOneY);
 if( pOldIconSetInfo )
-drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap);
+drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap, bWorksInPixels);
 
 rRect.SetLeft( nPosX - nSignedOneX );
 }
@@ -971,7 +982,7 @@ void drawCells(vcl::RenderContext& rRenderContext, 
std::optional const &
 if( pOldDataBarInfo )
 drawDataBars(rRenderContext, pOldDataBarInfo, rRect, nOneX, nOneY);
 if( pOldIconSetInfo )
-drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap);
+drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, 
rIconSetBitmapMap, bWorksInPixels);
 
 rRect.SetLeft( nPosX - nSignedOneX );
 }
@@ -1155,7 +1166,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& 
rRenderContext)
 if (bWorksInPixels)
 nPosXLogic = rRenderContext.PixelToLogic(Point(nPosX, 
0)).X();
 
-drawCells(rRenderContext, pColor, pBackground, pOldColor, 
pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, 
pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo, 
mpDoc->GetIconSetBitmapMap());
+drawCells(rRenderContext, pColor, pBackground, pOldColor, 
pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, 
pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo, 
mpDoc->GetIconSetBitmapMap(), 

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

2022-11-08 Thread Jan Holesovsky (via logerrit)
 sc/source/ui/view/gridwin.cxx |   61 +-
 1 file changed, 2 insertions(+), 59 deletions(-)

New commits:
commit 657ddc1a8631418f39f587e448954ec47996cf75
Author: Jan Holesovsky 
AuthorDate: Mon Oct 24 16:27:17 2022 +0200
Commit: Gülşah Köse 
CommitDate: Tue Nov 8 16:04:45 2022 +0100

sc lok: Double-click should behave more like on desktop

When editing was introduced in Calc LibreOfficeKit, there were lots of
limitations.  Particularly the thinking was that it would be good if a
double-click into any text (even if spanning over more cells)
actually started editing that text.

These days, the LOK behaves much more consistently, so it is better to
behave as the LibreOffice on desktop (or other tools, like gdocs) do:

If the cell:

* Is empty

-> single click places the cell cursor
-> double click places the cell cursor & shows the text caret

* Is empty, but covered by text bleeding from other cell

-> same as if it was empty

* Isn't empty

-> single click places the cell cursor
-> double click places the cell cursor & places the text caret
   inside the text where the user clicked

+ this is actually different in gdocs - there the caret is
  placed at the end of the text; in LO it is where the user has
  double-clicked

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

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 32573c92b8a2..93522adc4bdb 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1809,49 +1809,6 @@ void ScGridWindow::HandleMouseButtonDown( const 
MouseEvent& rMEvt, MouseEventSta
 if ( !nButtonDown || !bDouble ) // single (first) click is 
always valid
 nButtonDown = rMEvt.GetButtons();   // set nButtonDown first, so 
StopMarking works
 
-// special handling of empty cells with tiled rendering
-if (bIsTiledRendering)
-{
-Point aPos(rMEvt.GetPosPixel());
-SCCOL nPosX, nNonEmptyX(0);
-SCROW nPosY;
-SCTAB nTab = mrViewData.GetTabNo();
-mrViewData.GetPosFromPixel(aPos.X(), aPos.Y(), eWhich, nPosX, nPosY);
-
-ScRefCellValue aCell(rDoc, ScAddress(nPosX, nPosY, nTab));
-bool bIsEmpty = aCell.isEmpty();
-bool bIsCoveredByText = bIsEmpty && IsCellCoveredByText(nPosX, nPosY, 
nTab, nNonEmptyX);
-
-if (bIsCoveredByText)
-{
-// if there's any text flowing to this cell, activate the
-// editengine, so that the text actually gets the events
-if (bDouble)
-{
-ScViewFunc* pView = mrViewData.GetView();
-
-pView->SetCursor(nNonEmptyX, nPosY);
-SC_MOD()->SetInputMode(SC_INPUT_TABLE);
-
-bEditMode = mrViewData.HasEditView(eWhich);
-assert(bEditMode);
-
-// synthesize the 1st click
-EditView* pEditView = mrViewData.GetEditView(eWhich);
-MouseEvent aEditEvt(rMEvt.GetPosPixel(), 1, 
MouseEventModifiers::SYNTHETIC, MOUSE_LEFT, 0);
-pEditView->MouseButtonDown(aEditEvt);
-pEditView->MouseButtonUp(aEditEvt);
-}
-}
-else if (bIsEmpty && bEditMode && bDouble)
-{
-// double-click in an empty cell: the entire cell is selected
-SetCellSelectionPixel(LOK_SETTEXTSELECTION_START, aPos.X(), 
aPos.Y());
-SetCellSelectionPixel(LOK_SETTEXTSELECTION_END, aPos.X(), 
aPos.Y());
-return;
-}
-}
-
 if ( ( bEditMode && mrViewData.GetActivePart() == eWhich ) || 
!bFormulaMode )
 GrabFocus();
 
@@ -2382,14 +2339,11 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& 
rMEvt )
 mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
 ScDPObject* pDPObj  = rDoc.GetDPAtCursor( nPosX, nPosY, nTab );
 
-bool bInDataPilotTable = (pDPObj != nullptr);
-
 // double click (only left button)
-// in the tiled rendering case, single click works this way too
 
 bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
 bool bDouble = ( rMEvt.GetClicks() == 2 && rMEvt.IsLeft() );
-if ((bDouble || (bIsTiledRendering && !bInDataPilotTable))
+if ( bDouble
 && !bRefMode
 && (nMouseStatus == SC_GM_DBLDOWN || (bIsTiledRendering && 
nMouseStatus != SC_GM_URLDOWN))
 && !pScMod->IsRefDialogOpen())
@@ -2449,19 +2403,8 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& 
rMEvt )
 bEditAllowed = false;
 }
 
-// We don't want to activate the edit view for a single click in tiled 
rendering
-   

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

2022-11-04 Thread Szymon Kłos (via logerrit)
 sc/source/ui/view/gridwin4.cxx |   85 +
 1 file changed, 69 insertions(+), 16 deletions(-)

New commits:
commit 9257486636dfe95b73e5690462ba6e8408a12166
Author: Szymon Kłos 
AuthorDate: Tue Oct 25 10:40:05 2022 +0200
Commit: Gökay ŞATIR 
CommitDate: Fri Nov 4 10:22:50 2022 +0100

lok: sc: render expanded EditEngine when editing in-place

It's regression from:
commit 5a0839e60ac75869ad49685ca74ad6c6b49ef925
sc: lok: fix offset edit output area

When we use two views and one is editing multiline cell
after pressing F2 (in in-place mode) by adding new lines
(ctrl + enter) - we need to expand rendering area and
show additional content (which covers next cells).

This patch makes possible to render expanded are in all the
views, not only for one used for rendering.

Change-Id: Ief2cd391a23e65b3eb7eaf89f2a9f6471b87299f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139924
Reviewed-by: Michael Meeks 
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Dennis Francis 

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index ddafacfac577..970a4591411f 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -654,6 +654,24 @@ private:
 const tools::Long mnTileDevOriginX;
 };
 
+namespace
+{
+int lcl_GetMultiLineHeight(EditEngine* pEditEngine)
+{
+int nHeight = 0;
+int nParagraphs = pEditEngine->GetParagraphCount();
+if (nParagraphs > 1 || (nParagraphs > 0 && pEditEngine->GetLineCount(0) > 
1))
+{
+for (int nPara = 0; nPara < nParagraphs; nPara++)
+{
+nHeight += pEditEngine->GetLineCount(nPara) * 
pEditEngine->GetLineHeight(nPara);
+}
+}
+
+return nHeight;
+}
+}
+
 void ScGridWindow::DrawContent(OutputDevice , const ScTableInfo& 
rTableInfo, ScOutputData& aOutputData,
 bool bLogicText)
 {
@@ -1070,7 +1088,7 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 }
 }
 
-// paint in-place editing on other views
+// paint in-place editing
 if (bIsTiledRendering)
 {
 ScTabViewShell* pThisViewShell = mrViewData.GetViewShell();
@@ -1078,7 +1096,8 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 
 while (pViewShell)
 {
-if (pViewShell != pThisViewShell && pViewShell->GetDocId() == 
pThisViewShell->GetDocId())
+bool bEnterLoop = bIsTiledRendering || pViewShell != 
pThisViewShell;
+if (bEnterLoop && pViewShell->GetDocId() == 
pThisViewShell->GetDocId())
 {
 ScTabViewShell* pTabViewShell = 
dynamic_cast(pViewShell);
 if (pTabViewShell)
@@ -1106,6 +1125,13 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 Point aStart = mrViewData.GetScrPos( nCol1, nRow1, 
eOtherWhich );
 Point aEnd = mrViewData.GetScrPos( nCol2+1, 
nRow2+1, eOtherWhich );
 
+if (bIsTiledRendering)
+{
+EditEngine* pEditEngine = 
pOtherEditView->GetEditEngine();
+if (pEditEngine)
+
aEnd.AdjustY(lcl_GetMultiLineHeight(pEditEngine));
+}
+
 if (bLokRTL)
 {
 // Transform the cell range X coordinates such 
that the edit cell area is
@@ -1145,6 +1171,7 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 
 // paint the background
 
rDevice.DrawRect(rDevice.PixelToLogic(aBackground));
+tools::Rectangle aBGAbs(aBackground);
 
 tools::Rectangle aEditRect(aBackground);
 tools::Long nOffsetX = 0, nOffsetY = 0;
@@ -1167,12 +1194,42 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 SuppressEditViewMessagesGuard 
aGuard(*pOtherEditView);
 
 aEditRect = rDevice.PixelToLogic(aEditRect);
-
aEditRect.Intersection(pOtherEditView->GetOutputArea());
+if (bIsTiledRendering)
+pOtherEditView->SetOutputArea(aEditRect);
+else
+
aEditRect.Intersection(pOtherEditView->GetOutputArea());
 pOtherEditView->Paint(aEditRect, );
 
+// EditView will do the cursor notifications 
correctly if we're in
+// print-twips messaging mode.
+if (bIsTiledRendering && 
!comphelper::LibreOfficeKit::isCompatFlagSet(
+

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

2022-11-02 Thread Michael Meeks (via logerrit)
 sc/source/ui/attrdlg/scdlgfact.cxx |   10 +++
 sc/source/ui/attrdlg/scdlgfact.hxx |   10 +--
 sc/source/ui/view/cellsh1.cxx  |  122 +
 vcl/jsdialog/enabled.cxx   |2 
 4 files changed, 89 insertions(+), 55 deletions(-)

New commits:
commit 66a95dec001c5db891f20ddd5005fcc496bef4f8
Author: Michael Meeks 
AuthorDate: Tue Nov 1 21:43:08 2022 +
Commit: Michael Meeks 
CommitDate: Wed Nov 2 16:48:14 2022 +0100

sc: make InsertCell and DeleteCell async.

Also enable for use with jsdialogs.

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

diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx 
b/sc/source/ui/attrdlg/scdlgfact.cxx
index ab8741a9e8d8..7cea4669e784 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -137,6 +137,11 @@ short AbstractScDeleteCellDlg_Impl::Execute()
 return m_xDlg->run();
 }
 
+bool AbstractScDeleteCellDlg_Impl::StartExecuteAsync(AsyncContext& rCtx)
+{
+return ScDeleteCellDlg::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
 //for dataform
 short AbstractScDataFormDlg_Impl::Execute()
 {
@@ -174,6 +179,11 @@ short AbstractScInsertCellDlg_Impl::Execute()
 return m_xDlg->run();
 }
 
+bool AbstractScInsertCellDlg_Impl::StartExecuteAsync(AsyncContext& rCtx)
+{
+return ScInsertCellDlg::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
 short AbstractScInsertContentsDlg_Impl::Execute()
 {
 return m_xDlg->run();
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx 
b/sc/source/ui/attrdlg/scdlgfact.hxx
index b3756bb075af..e13efe7b5c93 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -218,13 +218,14 @@ public:
 
 class AbstractScDeleteCellDlg_Impl : public AbstractScDeleteCellDlg
 {
-std::unique_ptr m_xDlg;
+std::shared_ptr m_xDlg;
 public:
 explicit AbstractScDeleteCellDlg_Impl(std::unique_ptr p)
 : m_xDlg(std::move(p))
 {
 }
-virtual short   Execute() override;
+virtual short Execute() override;
+virtual bool  StartExecuteAsync(AsyncContext& rCtx) override;
 virtual DelCellCmd GetDelCellCmd() const override;
 
 // screenshotting
@@ -299,13 +300,14 @@ public:
 
 class AbstractScInsertCellDlg_Impl : public AbstractScInsertCellDlg
 {
-std::unique_ptr m_xDlg;
+std::shared_ptr m_xDlg;
 public:
 explicit AbstractScInsertCellDlg_Impl(std::unique_ptr p)
 : m_xDlg(std::move(p))
 {
 }
-virtual short   Execute() override;
+virtual short Execute() override;
+virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext ) 
override;
 virtual InsCellCmd GetInsCellCmd() const override ;
 };
 
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index edd2dac01280..dd9726bc1ee0 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -168,6 +168,60 @@ void SetTabNoAndCursor( const ScViewData& rViewData, const 
OUString& rCellId )
 pTabViewShell->SetCursor(aFoundPos.Col(), aFoundPos.Row());
 }
 }
+
+void InsertCells(ScTabViewShell* pTabViewShell, SfxRequest , InsCellCmd 
eCmd)
+{
+if (eCmd!=INS_NONE)
+{
+pTabViewShell->InsertCells( eCmd );
+
+if( ! rReq.IsAPI() )
+{
+OUString aParam;
+
+switch( eCmd )
+{
+case INS_CELLSDOWN: aParam = "V"; break;
+case INS_CELLSRIGHT: aParam = ">"; break;
+case INS_INSROWS_BEFORE: aParam = "R"; break;
+case INS_INSCOLS_BEFORE: aParam = "C"; break;
+default:
+{
+// added to avoid warnings
+}
+}
+rReq.AppendItem( SfxStringItem( FID_INS_CELL, aParam ) );
+rReq.Done();
+}
+}
+}
+
+void DeleteCells(ScTabViewShell* pTabViewShell, SfxRequest , DelCellCmd 
eCmd)
+{
+if (eCmd != DelCellCmd::NONE )
+{
+pTabViewShell->DeleteCells( eCmd );
+
+if( ! rReq.IsAPI() )
+{
+OUString aParam;
+
+switch( eCmd )
+{
+case DelCellCmd::CellsUp: aParam = "U"; break;
+case DelCellCmd::CellsLeft: aParam = "L"; break;
+case DelCellCmd::Rows: aParam = "R"; break;
+case DelCellCmd::Cols: aParam = "C"; break;
+default:
+{
+// added to avoid warnings
+}
+}
+rReq.AppendItem( SfxStringItem( FID_DELETE_CELL, aParam ) );
+rReq.Done();
+}
+}
+}
 }
 
 void ScCellShell::ExecuteEdit( SfxRequest& rReq )
@@ -286,35 +340,19 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
 
 ScAbstractDialogFactory* pFact = 
ScAbstractDialogFactory::Create();
 
-ScopedVclPtr 

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

2022-09-17 Thread Noel Grandin (via logerrit)
 sc/source/core/data/conditio.cxx |   21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

New commits:
commit 13e05ec16bef58ae8bf8821ea420d0bc38b6ee32
Author: Noel Grandin 
AuthorDate: Fri Sep 16 15:29:34 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat Sep 17 19:52:38 2022 +0200

speed up large sheet with lots of conditions

shaves 10% off view load time

Change-Id: Iecb1274e35da2294f796376ebdc62eab509e5480
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140071
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit be89bc2194306c5eac0748abf09f396f7890563f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139988
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index bfd3b5cd8f99..bf78d7987b12 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -649,12 +649,15 @@ void ScConditionEntry::Interpret( const ScAddress& rPos )
 // Evaluate formulas
 bool bDirty = false; // 1 and 2 separate?
 
-std::unique_ptr pTemp1;
+std::optional oTemp;
 ScFormulaCell* pEff1 = pFCell1.get();
 if ( bRelRef1 )
 {
-pTemp1.reset(pFormula1 ? new ScFormulaCell(*mpDoc, rPos, *pFormula1) : 
new ScFormulaCell(*mpDoc, rPos));
-pEff1 = pTemp1.get();
+if (pFormula1)
+oTemp.emplace(*mpDoc, rPos, *pFormula1);
+else
+oTemp.emplace(*mpDoc, rPos);
+pEff1 = &*oTemp;
 pEff1->SetFreeFlying(true);
 }
 if ( pEff1 )
@@ -678,14 +681,16 @@ void ScConditionEntry::Interpret( const ScAddress& rPos )
 }
 }
 }
-pTemp1.reset();
+oTemp.reset();
 
-std::unique_ptr pTemp2;
 ScFormulaCell* pEff2 = pFCell2.get(); //@ 1!=2
 if ( bRelRef2 )
 {
-pTemp2.reset(pFormula2 ? new ScFormulaCell(*mpDoc, rPos, *pFormula2) : 
new ScFormulaCell(*mpDoc, rPos));
-pEff2 = pTemp2.get();
+if (pFormula2)
+oTemp.emplace(*mpDoc, rPos, *pFormula2);
+else
+oTemp.emplace(*mpDoc, rPos);
+pEff2 = &*oTemp;
 pEff2->SetFreeFlying(true);
 }
 if ( pEff2 )
@@ -708,7 +713,7 @@ void ScConditionEntry::Interpret( const ScAddress& rPos )
 }
 }
 }
-pTemp2.reset();
+oTemp.reset();
 
 // If IsRunning, the last values remain
 if (bDirty && !bFirstRun)


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

2022-08-17 Thread Caolán McNamara (via logerrit)
 sc/source/ui/view/viewfun2.cxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit b35b91c6fccf35b3e96371a5559096cbf117
Author: Caolán McNamara 
AuthorDate: Wed May 4 09:12:55 2022 +0100
Commit: Tomaž Vajngerl 
CommitDate: Wed Aug 17 14:00:16 2022 +0200

remove stray printf

not one of mine for a change

Change-Id: Iaa4151f8fcb0b31d98514075473d2768fbadd69c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133810
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 9ab58d8cd680217e5cc3d0f5daa7dfd89107ddec)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138405
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index c8f9e864cdfa..9dfdd8dad075 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -1438,8 +1438,6 @@ void ScViewFunc::FillSeries( FillDir eDir, FillCmd eCmd, 
FillDateCmd eDateCmd,
 void ScViewFunc::FillAuto( FillDir eDir, SCCOL nStartCol, SCROW nStartRow,
 SCCOL nEndCol, SCROW nEndRow, sal_uLong nCount )
 {
-printf ("FillAuto\n");
-
 SCTAB nTab = GetViewData().GetTabNo();
 ScRange aRange( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab );
 ScRange aSourceRange( aRange );


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

2022-08-11 Thread Szymon Kłos (via logerrit)
 sc/source/ui/inc/dbfunc.hxx  |5 ++
 sc/source/ui/view/dbfunc.cxx |   89 ++-
 2 files changed, 59 insertions(+), 35 deletions(-)

New commits:
commit 09ac0b5b1b88c3e438ce98f175aef8e46f14f3b2
Author: Szymon Kłos 
AuthorDate: Wed Aug 10 14:43:51 2022 +0200
Commit: Michael Meeks 
CommitDate: Thu Aug 11 18:38:34 2022 +0200

Make Autofilter MessageBoxes async

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

diff --git a/sc/source/ui/inc/dbfunc.hxx b/sc/source/ui/inc/dbfunc.hxx
index e953f4aefccb..4ab5688a2b0c 100644
--- a/sc/source/ui/inc/dbfunc.hxx
+++ b/sc/source/ui/inc/dbfunc.hxx
@@ -35,6 +35,11 @@ class SAL_DLLPUBLIC_RTTI ScDBFunc : public ScViewFunc
 {
 private:
 void GetSelectedMemberList(ScDPUniqueStringSet& rEntries, tools::Long& 
rDimension);
+static void ModifiedAutoFilter(ScDocShell* pDocSh);
+static void ApplyAutoFilter(ScDocShell* pDocSh, ScViewData* pViewData, 
ScDBData* pDBData,
+SCCOL nCol, SCROW nRow, SCTAB nTab, 
ScQueryParam aParam);
+
+DECL_STATIC_LINK(ScDBFunc, InstallLOKNotifierHdl, void*, 
vcl::ILibreOfficeKitNotifier*);
 
 public:
 ScDBFunc( vcl::Window* pParent, ScDocShell& rDocSh, 
ScTabViewShell* pViewShell );
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index 6cca326c45d3..c3f285125459 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -275,11 +275,11 @@ void ScDBFunc::Query( const ScQueryParam& rQueryParam, 
const ScRange* pAdvSource
 
 void ScDBFunc::ToggleAutoFilter()
 {
-ScDocShell* pDocSh = GetViewData().GetDocShell();
-ScDocShellModificator aModificator( *pDocSh );
+ScViewData* pViewData = ();
+ScDocShell* pDocSh = pViewData->GetDocShell();
 
 ScQueryParamaParam;
-ScDocument& rDoc= GetViewData().GetDocument();
+ScDocument& rDoc= pViewData->GetDocument();
 ScDBData*   pDBData = GetDBData(false, SC_DB_AUTOFILTER, 
ScGetDBSelection::RowDown);
 
 pDBData->SetByRow( true );  //! undo, retrieve beforehand ??
@@ -287,11 +287,10 @@ void ScDBFunc::ToggleAutoFilter()
 
 SCCOL  nCol;
 SCROW  nRow = aParam.nRow1;
-SCTAB  nTab = GetViewData().GetTabNo();
+SCTAB  nTab = pViewData->GetTabNo();
 ScMF   nFlag;
 bool   bHasAuto = true;
 bool   bHeader  = pDBData->HasHeader();
-bool   bPaint   = false;
 
 //! instead retrieve from DB-range?
 
@@ -316,7 +315,7 @@ void ScDBFunc::ToggleAutoFilter()
 // use a list action for the AutoFilter buttons (ScUndoAutoFilter) and 
the filter operation
 
 OUString aUndo = ScResId( STR_UNDO_QUERY );
-pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, 
GetViewData().GetViewShell()->GetViewShellId() );
+pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, 
pViewData->GetViewShell()->GetViewShellId() );
 
 ScRange aRange;
 pDBData->GetArea( aRange );
@@ -335,7 +334,7 @@ void ScDBFunc::ToggleAutoFilter()
 
 pDocSh->GetUndoManager()->LeaveListAction();
 
-bPaint = true;
+ScDBFunc::ModifiedAutoFilter(pDocSh);
 }
 else// show filter buttons
 {
@@ -345,50 +344,70 @@ void ScDBFunc::ToggleAutoFilter()
 {
 if (!bHeader)
 {
-std::unique_ptr 
xBox(Application::CreateMessageDialog(GetViewData().GetDialogParent(),
+std::shared_ptr 
xBox(Application::CreateMessageDialog(pViewData->GetDialogParent(),
   
VclMessageType::Question,
   
VclButtonsType::YesNo, ScResId(STR_MSSG_MAKEAUTOFILTER_0))); // header from 
first row?
 xBox->set_title(ScResId(STR_MSSG_DOSUBTOTALS_0)); // "StarCalc"
 xBox->set_default_response(RET_YES);
-if (xBox->run() == RET_YES)
-{
-pDBData->SetHeader( true ); //! Undo ??
-}
-}
-
-ScRange aRange;
-pDBData->GetArea( aRange );
-pDocSh->GetUndoManager()->AddUndoAction(
-std::make_unique( pDocSh, aRange, 
pDBData->GetName(), true ) );
-
-pDBData->SetAutoFilter(true);
+xBox->SetInstallLOKNotifierHdl(LINK(this, ScDBFunc, 
InstallLOKNotifierHdl));
+xBox->runAsync(xBox, [pDocSh, pViewData, pDBData, nCol, nRow, 
nTab, aParam] (sal_Int32 nResult) {
+if (nResult == RET_YES)
+{
+pDBData->SetHeader( true ); //! Undo ??
+}
 
-for (nCol=aParam.nCol1; nCol<=aParam.nCol2; nCol++)
-{
-nFlag = 

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

2022-08-02 Thread Noel Grandin (via logerrit)
 sc/source/ui/inc/undobase.hxx|5 +
 sc/source/ui/inc/undocell.hxx|   10 +-
 sc/source/ui/inc/undomanager.hxx |4 ++--
 sc/source/ui/undo/undobase.cxx   |   18 +-
 4 files changed, 25 insertions(+), 12 deletions(-)

New commits:
commit fba10e9cb3d81a5eeca78dbd55cb49acdaf62b5a
Author: Noel Grandin 
AuthorDate: Sat Jul 30 21:09:47 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Aug 2 09:24:57 2022 +0200

generalize the undo independence check

Change-Id: I441edbdf11ada1a0a724577a4f76ae8ae14177e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137683
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 41a513e5bbd253fad0ea78e297f4c1dd3c0837aa)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137607
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/ui/inc/undobase.hxx b/sc/source/ui/inc/undobase.hxx
index 4e07e6ae50fe..460702a5fbaa 100644
--- a/sc/source/ui/inc/undobase.hxx
+++ b/sc/source/ui/inc/undobase.hxx
@@ -25,6 +25,7 @@
 
 #include 
 #include 
+#include 
 
 class SdrUndoAction;
 class ScRefUndoData;
@@ -43,6 +44,8 @@ public:
 /// See SfxUndoAction::GetViewShellId().
 ViewShellId GetViewShellId() const override;
 
+virtual std::optional getAffectedRange() const { return 
std::nullopt; }
+
 protected:
 ScDocShell* pDocShell;
 std::unique_ptr
@@ -81,6 +84,8 @@ public:
  ScBlockUndoMode eBlockMode );
 virtual ~ScBlockUndo() override;
 
+virtual std::optional getAffectedRange() const override { return 
aBlockRange; }
+
 protected:
 ScRange aBlockRange;
 std::unique_ptr pDrawUndo;
diff --git a/sc/source/ui/inc/undocell.hxx b/sc/source/ui/inc/undocell.hxx
index f47aa6ca18bb..206ed7d31713 100644
--- a/sc/source/ui/inc/undocell.hxx
+++ b/sc/source/ui/inc/undocell.hxx
@@ -94,7 +94,7 @@ public:
 
 virtual OUString GetComment() const override;
 
-const ScAddress& GetPositionAddress() const { return maPos; }
+virtual std::optional getAffectedRange() const override { return 
maPos; }
 
 private:
 ValuesType maOldValues;
@@ -124,6 +124,8 @@ public:
 
 virtual OUString GetComment() const override;
 
+virtual std::optional getAffectedRange() const override { return 
aPos; }
+
 private:
 ScAddress   aPos;
 ScCellValue maOldCell;
@@ -146,6 +148,8 @@ public:
 virtual bool CanRepeat( SfxRepeatTarget& rTarget ) const override;
 virtual OUString GetComment() const override;
 
+virtual std::optional getAffectedRange() const override { return 
maPos; }
+
 private:
 void SetChangeTrack();
 void SetValue( const ScCellValue& rVal );
@@ -265,6 +269,8 @@ public:
 
 virtual OUString GetComment() const override;
 
+virtual std::optional getAffectedRange() const override { return 
maPos; }
+
 private:
 voidDoInsertNote( const ScNoteData& rNoteData );
 voidDoRemoveNote( const ScNoteData& rNoteData );
@@ -290,6 +296,8 @@ public:
 
 virtual OUString GetComment() const override;
 
+virtual std::optional getAffectedRange() const override { return 
maPos; }
+
 private:
 ScAddress   maPos;
 boolmbShown;
diff --git a/sc/source/ui/inc/undomanager.hxx b/sc/source/ui/inc/undomanager.hxx
index da254a02d294..585e32e5fee7 100644
--- a/sc/source/ui/inc/undomanager.hxx
+++ b/sc/source/ui/inc/undomanager.hxx
@@ -11,7 +11,7 @@
 #include 
 
 class SfxViewShell;
-class ScUndoEnterData;
+class ScSimpleUndo;
 
 class SC_DLLPUBLIC ScUndoManager : public SdrUndoManager
 {
@@ -30,7 +30,7 @@ public:
 
 private:
 static std::optional getAffectedRangeFromUndo(const 
SfxUndoAction*);
-static const ScUndoEnterData* getScUndoEnterData(const SfxUndoAction*);
+static const ScSimpleUndo* getScSimpleUndo(const SfxUndoAction*);
 };
 
 class ScUndoRedoContext final : public SfxUndoContext
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index 250c78619ef8..3a5fec1bf975 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -666,7 +666,7 @@ bool ScUndoManager::IsViewUndoActionIndependent(const 
SfxViewShell* pView) const
 
 for (size_t i = 0; i < GetRedoActionCount(); ++i)
 {
-auto pRedoAction = getScUndoEnterData(GetRedoAction(i));
+auto pRedoAction = getScSimpleUndo(GetRedoAction(i));
 if (!pRedoAction)
 {
 return false;
@@ -684,23 +684,23 @@ bool ScUndoManager::IsViewUndoActionIndependent(const 
SfxViewShell* pView) const
 
 std::optional ScUndoManager::getAffectedRangeFromUndo(const 
SfxUndoAction* pAction)
 {
-auto pTopScUndoEnterData = getScUndoEnterData(pAction);
-if (!pTopScUndoEnterData)
+auto pSimpleUndo = getScSimpleUndo(pAction);
+if (!pSimpleUndo)
 return std::nullopt;
-return pTopScUndoEnterData->GetPositionAddress();
+return pSimpleUndo->getAffectedRange();
 }
 

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

2022-07-28 Thread Heiko Tietze (via logerrit)
 sc/source/ui/dialogs/SparklineDialog.cxx |  133 ++--
 sc/source/ui/inc/SparklineDialog.hxx |   10 
 sc/uiconfig/scalc/ui/sparklinedialog.ui  | 1027 +++
 solenv/sanitizers/ui/modules/scalc.suppr |2 
 4 files changed, 460 insertions(+), 712 deletions(-)

New commits:
commit 35650b2325923062d92953cf8febe0745bbe1e49
Author: Heiko Tietze 
AuthorDate: Fri Apr 29 14:17:46 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Jul 28 16:28:50 2022 +0200

Resolves tdf#148568 - Rework the Sparklines dialog

* controls rearranged and variables renamed
* radiobuttons changed into comboboxes

Change-Id: Ifda426b5fa9596c2b23c335165785c0cb341433f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133636
Tested-by: Jenkins
Reviewed-by: Roman Kuznetsov 
(cherry picked from commit 0ba1d661430effda61d8a6fadff9527dc9562698)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137413
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sc/source/ui/dialogs/SparklineDialog.cxx 
b/sc/source/ui/dialogs/SparklineDialog.cxx
index 0c5be765ef3c..f27e0eb4a4a5 100644
--- a/sc/source/ui/dialogs/SparklineDialog.cxx
+++ b/sc/source/ui/dialogs/SparklineDialog.cxx
@@ -30,47 +30,43 @@ SparklineDialog::SparklineDialog(SfxBindings* pBindings, 
SfxChildWindow* pChildW
 , mbDialogLostFocus(false)
 , mxButtonOk(m_xBuilder->weld_button("ok"))
 , mxButtonCancel(m_xBuilder->weld_button("cancel"))
-, mxFrameData(m_xBuilder->weld_frame("frame-data"))
-, mxInputRangeLabel(m_xBuilder->weld_label("cell-range-label"))
-, mxInputRangeEdit(new 
formula::RefEdit(m_xBuilder->weld_entry("cell-range-edit")))
-, mxInputRangeButton(new 
formula::RefButton(m_xBuilder->weld_button("cell-range-button")))
-, mxOutputRangeLabel(m_xBuilder->weld_label("output-range-label"))
-, mxOutputRangeEdit(new 
formula::RefEdit(m_xBuilder->weld_entry("output-range-edit")))
-, mxOutputRangeButton(new 
formula::RefButton(m_xBuilder->weld_button("output-range-button")))
-, mxColorSeries(new 
ColorListBox(m_xBuilder->weld_menu_button("color-button-series"),
+, mxFrameData(m_xBuilder->weld_frame("frmData"))
+, mxInputRangeLabel(m_xBuilder->weld_label("lbInputRange"))
+, mxInputRangeEdit(new 
formula::RefEdit(m_xBuilder->weld_entry("edInputRange")))
+, mxInputRangeButton(new 
formula::RefButton(m_xBuilder->weld_button("btnInputRange")))
+, mxOutputRangeLabel(m_xBuilder->weld_label("lbOutputRange"))
+, mxOutputRangeEdit(new 
formula::RefEdit(m_xBuilder->weld_entry("edOutputRange")))
+, mxOutputRangeButton(new 
formula::RefButton(m_xBuilder->weld_button("btnOutputRange")))
+, mxColorSeries(new ColorListBox(m_xBuilder->weld_menu_button("colSeries"),
  [pWindow] { return pWindow; }))
-, mxColorNegative(new 
ColorListBox(m_xBuilder->weld_menu_button("color-button-negative"),
+, mxColorNegative(new 
ColorListBox(m_xBuilder->weld_menu_button("colNegative"),
[pWindow] { return pWindow; }))
-, mxColorMarker(new 
ColorListBox(m_xBuilder->weld_menu_button("color-button-marker"),
+, mxColorMarker(new ColorListBox(m_xBuilder->weld_menu_button("colMarker"),
  [pWindow] { return pWindow; }))
-, mxColorHigh(new 
ColorListBox(m_xBuilder->weld_menu_button("color-button-high"),
-   [pWindow] { return pWindow; }))
-, mxColorLow(new 
ColorListBox(m_xBuilder->weld_menu_button("color-button-low"),
-  [pWindow] { return pWindow; }))
-, mxColorFirst(new 
ColorListBox(m_xBuilder->weld_menu_button("color-button-first"),
-[pWindow] { return pWindow; }))
-, mxColorLast(new 
ColorListBox(m_xBuilder->weld_menu_button("color-button-last"),
-   [pWindow] { return pWindow; }))
-, mxCheckButtonNegative(m_xBuilder->weld_check_button("check-negative"))
-, mxCheckButtonMarker(m_xBuilder->weld_check_button("check-marker"))
-, mxCheckButtonHigh(m_xBuilder->weld_check_button("check-high"))
-, mxCheckButtonLow(m_xBuilder->weld_check_button("check-low"))
-, mxCheckButtonFirst(m_xBuilder->weld_check_button("check-first"))
-, mxCheckButtonLast(m_xBuilder->weld_check_button("check-last"))
-, mxSpinLineWidth(m_xBuilder->weld_spin_button("spin-line-width"))
-, mxRadioLine(m_xBuilder->weld_radio_button("line-radiobutton"))
-, mxRadioColumn(m_xBuilder->weld_radio_button("column-radiobutton"))
-, mxRadioStacked(m_xBuilder->weld_radio_button("stacked-radiobutton"))
-, 
mxCheckDisplayXAxis(m_xBuilder->weld_check_button("check-display-x-axis"))
-, 
mxCheckDisplayHidden(m_xBuilder->weld_check_button("check-display-hidden"))
-, mxCheckRightToLeft(m_xBuilder->weld_check_button("check-right-to-left"))
-, 

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

2022-07-28 Thread Heiko Tietze (via logerrit)
 sc/source/ui/sparklines/SparklineAttributes.cxx |   19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

New commits:
commit baa346fd5a9c4029bdcde665a5a969fee41d1749
Author: Heiko Tietze 
AuthorDate: Fri Apr 29 14:00:46 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Jul 28 16:28:25 2022 +0200

Use colors from standard palette for sparklines

Change-Id: I95cfb74efd5e28e048c8057a464a57c88aab7e7a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133634
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 
(cherry picked from commit ee1705a95bdfffbe0e36d449378be726733d7141)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137412
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sc/source/ui/sparklines/SparklineAttributes.cxx 
b/sc/source/ui/sparklines/SparklineAttributes.cxx
index 6cc15b478921..20b8bf6feee6 100644
--- a/sc/source/ui/sparklines/SparklineAttributes.cxx
+++ b/sc/source/ui/sparklines/SparklineAttributes.cxx
@@ -49,15 +49,18 @@ public:
 std::optional m_aManualMax;
 std::optional m_aManualMin;
 
+static constexpr ::Color COL_STANDARD_RED = 0xff;
+static constexpr ::Color COL_STANDARD_BLUE = 0x2a6099;
+
 Implementation()
-: m_aColorSeries(COL_BLUE)
-, m_aColorNegative(COL_RED)
-, m_aColorAxis(COL_RED)
-, m_aColorMarkers(COL_RED)
-, m_aColorFirst(COL_RED)
-, m_aColorLast(COL_RED)
-, m_aColorHigh(COL_RED)
-, m_aColorLow(COL_RED)
+: m_aColorSeries(COL_STANDARD_BLUE)
+, m_aColorNegative(COL_STANDARD_RED)
+, m_aColorAxis(COL_STANDARD_RED)
+, m_aColorMarkers(COL_STANDARD_RED)
+, m_aColorFirst(COL_STANDARD_RED)
+, m_aColorLast(COL_STANDARD_RED)
+, m_aColorHigh(COL_STANDARD_RED)
+, m_aColorLow(COL_STANDARD_RED)
 , m_eMinAxisType(AxisType::Individual)
 , m_eMaxAxisType(AxisType::Individual)
 , m_fLineWeight(0.75)


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

2022-07-25 Thread Szymon Kłos (via logerrit)
 sc/source/ui/view/tabvwsh4.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit a173b937aa8b8b67a423f23b05ddf02f83870034
Author: Szymon Kłos 
AuthorDate: Thu Jul 21 15:22:36 2022 +0200
Commit: Szymon Kłos 
CommitDate: Mon Jul 25 09:53:55 2022 +0200

lok: don't force formulabar update on every view switch

This will reduce number of messages and helps to avoid
selection change in other views when someone is editing
a multiline cell and other user is doing something else
at the same time (which triggers view switching to perform
operations as different user).

Change-Id: I8efc82be9793910c46bf6f33f7993e4c5734f9de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137304
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Rashesh Padia 
Reviewed-by: Szymon Kłos 

diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 10c80a66e31f..0cc350590919 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -157,7 +157,8 @@ void ScTabViewShell::Activate(bool bMDI)
 }
 }
 
-UpdateInputHandler( /*bForce=*/ true, /*bStopEditing=*/ 
!comphelper::LibreOfficeKit::isActive() );
+bool isLOK = comphelper::LibreOfficeKit::isActive();
+UpdateInputHandler( /*bForce=*/ !isLOK, /*bStopEditing=*/ !isLOK );
 
 if ( bFirstActivate )
 {


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

2022-07-21 Thread Szymon Kłos (via logerrit)
 sc/source/ui/view/tabview3.cxx |   44 +
 1 file changed, 32 insertions(+), 12 deletions(-)

New commits:
commit a6f2daef52ff2aa8af4e7f876ea5f3dd9beb4be1
Author: Szymon Kłos 
AuthorDate: Tue Jul 19 12:08:58 2022 +0200
Commit: Szymon Kłos 
CommitDate: Thu Jul 21 11:12:13 2022 +0200

MarkColumns should modify formula if editing is active

Change-Id: I2ad4df0e6ad87bdad689112683bd29babf127502
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137227
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mert Tumer 

diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 20954d8711cc..a658ac854375 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1630,12 +1630,22 @@ void ScTabView::MarkColumns(SCCOL nCol, sal_Int16 
nModifier)
 if ((nModifier & KEY_SHIFT) == KEY_SHIFT)
 bMoveIsShift = true;
 
-DoneBlockMode( nModifier != 0 );
-InitBlockMode( nStartCol, 0, nTab, true, true);
-MarkCursor( nCol, rDoc.MaxRow(), nTab );
-bMoveIsShift = false;
-SetCursor( nCol, 0 );
-SelectionChanged();
+if ( SC_MOD()->IsFormulaMode() )
+{
+DoneRefMode( nModifier != 0 );
+InitRefMode( nCol, 0, nTab, SC_REFTYPE_REF );
+UpdateRef( nCol, rDoc.MaxRow(), nTab );
+bMoveIsShift = false;
+}
+else
+{
+DoneBlockMode( nModifier != 0 );
+InitBlockMode( nStartCol, 0, nTab, true, true);
+MarkCursor( nCol, rDoc.MaxRow(), nTab );
+bMoveIsShift = false;
+SetCursor( nCol, 0 );
+SelectionChanged();
+}
 }
 
 void ScTabView::MarkRows(SCROW nRow, sal_Int16 nModifier)
@@ -1647,12 +1657,22 @@ void ScTabView::MarkRows(SCROW nRow, sal_Int16 
nModifier)
 if ((nModifier & KEY_SHIFT) == KEY_SHIFT)
 bMoveIsShift = true;
 
-DoneBlockMode( nModifier != 0 );
-InitBlockMode( 0, nStartRow, nTab, true, false, true );
-MarkCursor( rDoc.MaxCol(), nRow, nTab );
-bMoveIsShift = false;
-SetCursor( 0, nRow );
-SelectionChanged();
+if ( SC_MOD()->IsFormulaMode() )
+{
+DoneRefMode( nModifier != 0 );
+InitRefMode( 0, nRow, nTab, SC_REFTYPE_REF );
+UpdateRef( rDoc.MaxCol(), nRow, nTab );
+bMoveIsShift = false;
+}
+else
+{
+DoneBlockMode( nModifier != 0 );
+InitBlockMode( 0, nStartRow, nTab, true, false, true );
+MarkCursor( rDoc.MaxCol(), nRow, nTab );
+bMoveIsShift = false;
+SetCursor( 0, nRow );
+SelectionChanged();
+}
 }
 
 void ScTabView::MarkDataArea( bool bIncludeCursor )


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

2022-07-21 Thread Szymon Kłos (via logerrit)
 sc/source/ui/app/inputhdl.cxx |2 -
 sc/source/ui/app/inputwin.cxx |   45 --
 2 files changed, 36 insertions(+), 11 deletions(-)

New commits:
commit 3cb565539288596483817ecc01828db377190e26
Author: Szymon Kłos 
AuthorDate: Thu Jul 14 16:52:23 2022 +0200
Commit: Szymon Kłos 
CommitDate: Thu Jul 21 10:23:18 2022 +0200

lok: formulabar: handle mobile IME

Change-Id: I7cb69efaebb42020353133e590a161b2e4bc5210
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137086
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mert Tumer 

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 94e68ac4c00c..6eb949725c37 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -4125,7 +4125,7 @@ void ScInputHandler::InputCommand( const CommandEvent& 
rCEvt )
 {
 if (pTableView)
 pTableView->Command( rCEvt );
-if (pTopView && !comphelper::LibreOfficeKit::isActive())
+if (pTopView)
 pTopView->Command( rCEvt );
 
 if ( rCEvt.GetCommand() == CommandEventId::EndExtTextInput )
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 531d5c5d9a17..34d72d49481a 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -413,9 +413,18 @@ void ScInputWindow::StartFormula()
 EditView* pView = mxTextWindow->GetEditView();
 if (pView)
 {
+sal_Int32 nStartPara = 0, nEndPara = 0;
 if (comphelper::LibreOfficeKit::isActive())
+{
 TextGrabFocus();
-pView->SetSelection( ESelection(0, nStartPos, 0, nEndPos) );
+if (pViewSh && !pViewSh->isLOKDesktop())
+{
+nStartPara = nEndPara = 
pView->GetEditEngine()->GetParagraphCount() ?
+(pView->GetEditEngine()->GetParagraphCount() - 1) : 0;
+nStartPos = nEndPos = 
pView->GetEditEngine()->GetTextLen(nStartPara);
+}
+}
+pView->SetSelection(ESelection(nStartPara, nStartPos, nEndPara, 
nEndPos));
 pScMod->InputChanged(pView);
 SetOkCancelMode();
 pView->SetEditEngineUpdateLayout(true);
@@ -1729,10 +1738,26 @@ bool ScTextWnd::Command( const CommandEvent& rCEvt )
 // see vcl/jsdialog/executor.cxx "textselection" event
 const Point* pParaPoint = static_cast(rCEvt.GetEventData());
 Point aSelectionStartEnd = rCEvt.GetMousePosPixel();
-m_xEditView->SetSelection(
-ESelection((pParaPoint ? pParaPoint->X() : 0), 
aSelectionStartEnd.X(),
-   (pParaPoint ? pParaPoint->Y() : 0), 
aSelectionStartEnd.Y()));
 
+sal_Int32 nParaStart, nParaEnd, nPosStart, nPosEnd;
+
+ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
+if (pViewSh && pViewSh->isLOKMobilePhone())
+{
+// We use IME - do not select anything, put cursor at the end
+nParaStart = nParaEnd = 
m_xEditView->GetEditEngine()->GetParagraphCount() ?
+(m_xEditView->GetEditEngine()->GetParagraphCount() - 1) : 0;
+nPosStart = nPosEnd = 
m_xEditView->GetEditEngine()->GetTextLen(nParaStart);
+}
+else
+{
+nParaStart = pParaPoint ? pParaPoint->X() : 0;
+nParaEnd = pParaPoint ? pParaPoint->Y() : 0;
+nPosStart = aSelectionStartEnd.X();
+nPosEnd = aSelectionStartEnd.Y();
+}
+
+m_xEditView->SetSelection(ESelection(nParaStart, nPosStart, nParaEnd, 
nPosEnd));
 SC_MOD()->InputSelection( m_xEditView.get() );
 
 bConsumed = true;
@@ -1894,12 +1919,6 @@ static sal_Int32 findFirstNonMatchingChar(const 
OUString& rStr1, const OUString&
 
 void ScTextWnd::SetTextString( const OUString& rNewString )
 {
-if (comphelper::LibreOfficeKit::isActive())
-{
-ESelection aSel = m_xEditView ? m_xEditView->GetSelection() : 
ESelection();
-ScInputHandler::LOKSendFormulabarUpdate(SfxViewShell::Current(), 
rNewString, aSel);
-}
-
 // Ideally it would be best to create on demand the EditEngine/EditView 
here, but... for
 // the initialisation scenario where a cell is first clicked on we end up 
with the text in the
 // inputbar window scrolled to the bottom if we do that here ( because the 
tableview and topview
@@ -1974,6 +1993,12 @@ void ScTextWnd::SetTextString( const OUString& 
rNewString )
 bInputMode = false;
 }
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+ESelection aSel = m_xEditView ? m_xEditView->GetSelection() : 
ESelection();
+ScInputHandler::LOKSendFormulabarUpdate(SfxViewShell::Current(), 
rNewString, aSel);
+}
+
 SetScrollBarRange();
 DoScroll();
 }


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

2022-07-13 Thread Henry Castro (via logerrit)
 sc/source/ui/view/gridwin4.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 05dd16dd9d788372d4f0a585b3d64ce5b9207e0e
Author: Henry Castro 
AuthorDate: Mon Jul 4 14:57:18 2022 -0400
Commit: Henry Castro 
CommitDate: Wed Jul 13 17:05:42 2022 +0200

sc: lok: fix offset other edit view

Multiple view case.

Signed-off-by: Henry Castro 
Change-Id: I8049f2f36438e77beb5fe41399007ced0d500efa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136812
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Ashod Nakashian 
(cherry picked from commit 59bee366f9df6df26cc9b92b19997fc7f5112c7d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136917
Tested-by: Jenkins
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137029

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 3f7c08f401bd..d105a47a4483 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1166,8 +1166,9 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 // to be tweaked temporarily to match the current 
view's zoom.
 SuppressEditViewMessagesGuard 
aGuard(*pOtherEditView);
 
-
pOtherEditView->SetOutputArea(rDevice.PixelToLogic(aEditRect));
-
pOtherEditView->Paint(rDevice.PixelToLogic(aEditRect), );
+aEditRect = rDevice.PixelToLogic(aEditRect);
+
aEditRect.Intersection(pOtherEditView->GetOutputArea());
+pOtherEditView->Paint(aEditRect, );
 
 // Rollback the mapmode and 'output area'.
 rOtherWin.SetMapMode(aOrigMapMode);


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

2022-07-13 Thread Henry Castro (via logerrit)
 sc/source/ui/view/gridwin4.cxx |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 5a0839e60ac75869ad49685ca74ad6c6b49ef925
Author: Henry Castro 
AuthorDate: Wed Apr 20 08:14:39 2022 -0400
Commit: Henry Castro 
CommitDate: Wed Jul 13 17:05:07 2022 +0200

sc: lok: fix offset edit output area

When focus is received, the edit view output area
rectangle is calculated to draw the text, after
EditGrowX and EditGrowY checks, so intercept the
rectangle to not alter the text positions.

Change-Id: I1439fc3d436bd5f4d03b13bd6bb56a85012a2655
Signed-off-by: Henry Castro 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133214
Reviewed-by: Ashod Nakashian 
(cherry picked from commit 037ec953d230aef045034b59d8315e6c41dc6687)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136916
Tested-by: Jenkins
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137028

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index e51feeda0645..3f7c08f401bd 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1271,7 +1271,6 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 // So they need to be in the same coordinates/units. This is tied 
to the mapmode of the gridwin
 // attached to the EditView, so we have to change its mapmode too 
(temporarily). We save the
 // original mapmode and 'output area' and roll them back when we 
finish painting to rDevice.
-const tools::Rectangle 
aOrigOutputArea(pEditView->GetOutputArea()); // Not in pixels.
 const MapMode aOrigMapMode = GetMapMode();
 SetMapMode(rDevice.GetMapMode());
 
@@ -1280,8 +1279,9 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 // cursor-messaging done in the non print-twips mode)
 SuppressEditViewMessagesGuard aGuard(*pEditView);
 
-pEditView->SetOutputArea(rDevice.PixelToLogic(aEditRect));
-pEditView->Paint(rDevice.PixelToLogic(aEditRect), );
+aEditRect = rDevice.PixelToLogic(aEditRect);
+aEditRect.Intersection(pEditView->GetOutputArea());
+pEditView->Paint(aEditRect, );
 
 // EditView will do the cursor notifications correctly if we're in
 // print-twips messaging mode.
@@ -1311,7 +1311,6 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 
 // Rollback the mapmode and 'output area'.
 SetMapMode(aOrigMapMode);
-pEditView->SetOutputArea(aOrigOutputArea);
 }
 else
 {


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

2022-07-11 Thread Noel Grandin (via logerrit)
 sc/source/filter/inc/richstring.hxx|   15 ++---
 sc/source/filter/oox/commentsbuffer.cxx|4 +--
 sc/source/filter/oox/commentsfragment.cxx  |2 -
 sc/source/filter/oox/revisionfragment.cxx  |2 -
 sc/source/filter/oox/richstring.cxx|   27 +++--
 sc/source/filter/oox/richstringcontext.cxx |2 -
 sc/source/filter/oox/sharedstringsbuffer.cxx   |5 ++--
 sc/source/filter/oox/sharedstringsfragment.cxx |2 -
 sc/source/filter/oox/sheetdatacontext.cxx  |   16 +++---
 9 files changed, 36 insertions(+), 39 deletions(-)

New commits:
commit be198c259eb9f9097061be0a1b61359cd039369d
Author: Noel Grandin 
AuthorDate: Tue Jul 5 14:51:32 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon Jul 11 11:59:42 2022 +0200

compact the RichString class

Which reduces peak memory load from 495M to 455M when loading
a large spreadsheet

Change-Id: Iad78524bedf3db193820be2d507652abde59d67c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136827
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 9047c22d05df16b5488acfcc70c1b6f4dc8dd13b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136772
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/filter/inc/richstring.hxx 
b/sc/source/filter/inc/richstring.hxx
index fe0d0f2f527a..1e3cf921b326 100644
--- a/sc/source/filter/inc/richstring.hxx
+++ b/sc/source/filter/inc/richstring.hxx
@@ -144,10 +144,10 @@ private:
 };
 
 /** Contains text data and positioning information for a phonetic text 
portion. */
-class RichStringPhonetic : public WorkbookHelper
+class RichStringPhonetic
 {
 public:
-explicitRichStringPhonetic( const WorkbookHelper& rHelper );
+RichStringPhonetic();
 
 /** Sets text data for this phonetic portion. */
 voidsetText( const OUString& rText );
@@ -203,10 +203,9 @@ private:
 };
 
 /** Contains string data and a list of formatting runs for a rich formatted 
string. */
-class RichString : public WorkbookHelper
+class RichString
 {
 public:
-explicitRichString( const WorkbookHelper& rHelper );
 
 /** Appends and returns an index of a portion object for a plain string (t 
element). */
 sal_Int32 importText();
@@ -215,13 +214,13 @@ public:
 /** Appends and returns a phonetic text object for a new phonetic run (rPh 
element). */
 RichStringPhoneticRef importPhoneticRun( const AttributeList& rAttribs );
 /** Imports phonetic settings from the rPhoneticPr element. */
-voidimportPhoneticPr( const AttributeList& rAttribs );
+voidimportPhoneticPr( const AttributeList& rAttribs, const 
WorkbookHelper& rHelper );
 
 /** Imports a Unicode rich-string from the passed record stream. */
-voidimportString( SequenceInputStream& rStrm, bool bRich );
+voidimportString( SequenceInputStream& rStrm, bool bRich, 
const WorkbookHelper& rHelper );
 
 /** Final processing after import of all strings. */
-voidfinalizeImport();
+voidfinalizeImport(const WorkbookHelper& rHelper);
 
 /** Tries to extract a plain string from this object. Returns the string,
 if there is only one unformatted portion. */
@@ -252,7 +251,7 @@ private:
 typedef RefVector< RichStringPhonetic > PhoneticVector;
 
 std::vector  maTextPortions; /// String portions with 
font data.
-PhoneticSettingsmaPhonSettings; /// Phonetic settings for this string.
+std::unique_ptr mxPhonSettings; /// Phonetic settings 
for this string.
 PhoneticVector  maPhonPortions; /// Phonetic text portions.
 };
 
diff --git a/sc/source/filter/oox/commentsbuffer.cxx 
b/sc/source/filter/oox/commentsbuffer.cxx
index b4e6c7f48cb1..7dbd5c942e30 100644
--- a/sc/source/filter/oox/commentsbuffer.cxx
+++ b/sc/source/filter/oox/commentsbuffer.cxx
@@ -141,7 +141,7 @@ void Comment::importComment( SequenceInputStream& rStrm )
 
 RichStringRef const & Comment::createText()
 {
-maModel.mxText = std::make_shared( *this );
+maModel.mxText = std::make_shared();
 return maModel.mxText;
 }
 
@@ -196,7 +196,7 @@ void Comment::finalizeImport()
 pDocShell->GetDocFunc().ShowNote( maModel.maRange.aStart, bVisible 
);
 
 // insert text and convert text formatting
-maModel.mxText->finalizeImport();
+maModel.mxText->finalizeImport(*this);
 Reference< XText > xAnnoText( xAnnoShape, UNO_QUERY_THROW );
 Reference< css::document::XActionLockable > xAnnoLock( xAnnoShape, 
UNO_QUERY_THROW );
 xAnnoLock->addActionLock();
diff --git a/sc/source/filter/oox/commentsfragment.cxx 
b/sc/source/filter/oox/commentsfragment.cxx
index 0d6a8b27a870..a5d1da8dacc8 100644
--- a/sc/source/filter/oox/commentsfragment.cxx
+++ b/sc/source/filter/oox/commentsfragment.cxx
@@ -100,7 +100,7 @@ 

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

2022-07-08 Thread Szymon Kłos (via logerrit)
 sc/source/ui/dbgui/csvgrid.cxx |3 +++
 vcl/source/window/layout.cxx   |   16 ++--
 2 files changed, 5 insertions(+), 14 deletions(-)

New commits:
commit 77f4389f38feea54e6c777e86f7ee4a79331eb75
Author: Szymon Kłos 
AuthorDate: Fri Jul 1 11:29:28 2022 +0200
Commit: Szymon Kłos 
CommitDate: Fri Jul 8 13:35:51 2022 +0200

lok: allow shrinking too big widgets

This is followup for:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=2b58a0979f9206cfca6d78cb2f3d5e65cd735f8b
Add sanity check to avoid potential crash in the Collabora Online server

nExtraSpace can be negative for shrinking the widget - this is correct.
For example listbox can have many entries, in GetOptimalSize it returns
size required to show all of them, then here we calculate how much of
that size we can allow to be used. When we have too many entries we use
negative nExtraSpace.

The original problem is not that we get negative number but case when we
get value that is much bigger than size of a widget and it becomes
invisible.

So this reverts hack which makes impossible to shrink widget what causes
problems with listboxes in tunneled dialogs. Also it setups better
size request for csv import dialog grid widget - so we don't paint it
as 10px rectangle - what was workarounded by the previous patches.

Change-Id: I478660b12cf0b6a783c704201800018e9849cc23
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136728
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mert Tumer 

diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx
index aa6acd6ba9b2..0f98eb693875 100644
--- a/sc/source/ui/dbgui/csvgrid.cxx
+++ b/sc/source/ui/dbgui/csvgrid.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
 #include 
 #include 
 
@@ -107,6 +108,8 @@ void ScCsvGrid::SetDrawingArea(weld::DrawingArea* 
pDrawingArea)
 // the left edge will be lost. If this widget is smaller than the scrolling
 // window it is stretched to fit the parent and the problem doesn't arise.
 Size aInitialSize(10, 10);
+if (comphelper::LibreOfficeKit::isActive())
+aInitialSize = Size(-1, 150);
 ScCsvControl::SetDrawingArea(pDrawingArea);
 pDrawingArea->set_size_request(aInitialSize.Width(), 
aInitialSize.Height());
 SetOutputSizePixel(aInitialSize);
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index c38790b6b2df..6b11d72eae17 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -279,20 +279,8 @@ void VclBox::setAllocation(const Size )
 else if (nExpandChildren)
 {
 Size aRequisition = calculateRequisition();
-nExtraSpace = (getPrimaryDimension(rAllocation) - 
getPrimaryDimension(aRequisition)) / nExpandChildren;
-// In mobile, the screen size is small and extraSpace can become negative
-// Though the dialogs are rendered in javascript for LOK Android some widgets 
like weld::DrawingArea
-// is sent as bitmap but it is rendered from only the visible part
-// when it gets negative, it shrinks instead of expands and it becomes 
invisible
-
-if (nExtraSpace < 0)
-{
-SAL_WARN("vcl.layout", "nExtraSpace went negative for VclBox: " << 
GetHelpId());
-if (comphelper::LibreOfficeKit::isActive())
-{
-nExtraSpace = 0;
-}
-}
+tools::Long nPrimaryDimension = getPrimaryDimension(rAllocation);
+nExtraSpace = (nPrimaryDimension - getPrimaryDimension(aRequisition)) 
/ nExpandChildren;
 }
 
 //Split into those we pack from the start onwards, and those we pack from 
the end backwards


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

2022-07-07 Thread Michael Meeks (via logerrit)
 sc/source/ui/view/gridwin4.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 855f4a5f0f4721c80af0694421d20533833f6dd0
Author: Michael Meeks 
AuthorDate: Thu Jul 7 15:28:59 2022 +0100
Commit: Michael Meeks 
CommitDate: Thu Jul 7 20:25:06 2022 +0200

lok: skip app background rendering for lok case.

this is/was mis-placed and tends to make a mess of large sheets'
tiles close to the bottom at ~2^20 rows.

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

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 3677db7122bd..e51feeda0645 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -818,8 +818,8 @@ void ScGridWindow::DrawContent(OutputDevice , const 
ScTableInfo& rTableI
 }
 }
 
-// edge (area) (Pixel)
-if ( nX2==rDoc.MaxCol() || nY2==rDoc.MaxRow() )
+// app-background / document edge (area) (Pixel)
+if ( !bIsTiledRendering && ( nX2 == rDoc.MaxCol() || nY2 == rDoc.MaxRow() 
) )
 {
 // save MapMode and set to pixel
 MapMode aCurrentMapMode(pContentDev->GetMapMode());


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

2022-07-07 Thread Szymon Kłos (via logerrit)
 sc/source/ui/app/inputhdl.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit ada1f96be3680ae63c4241be064153a76d7c08a9
Author: Szymon Kłos 
AuthorDate: Wed Jul 6 18:08:16 2022 +0200
Commit: Gökay ŞATIR 
CommitDate: Thu Jul 7 14:13:16 2022 +0200

jsdialog: formulabar: dont send huge paragraph id when not found

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

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 0fb604520ac2..94e68ac4c00c 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -4258,6 +4258,14 @@ void ScInputHandler::NotifyChange( const 
ScInputHdlState* pState,
 {
 EditView* pActiveView = pTopView ? pTopView : 
pTableView;
 ESelection aSel = pActiveView ? 
pActiveView->GetSelection() : ESelection();
+
+// if we switched content completly - don't send huge 
numbers
+if (aSel.nStartPara == EE_PARA_NOT_FOUND)
+aSel.nStartPara = 0;
+
+if (aSel.nEndPara == EE_PARA_NOT_FOUND)
+aSel.nEndPara = 0;
+
 ScInputHandler::LOKSendFormulabarUpdate(pActiveViewSh, 
aString, aSel);
 // TODO: deprecated?
 
pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_FORMULA, 
aString.toUtf8().getStr());


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

2022-07-06 Thread Noel Grandin (via logerrit)
 sc/source/filter/inc/richstring.hxx|   29 +++
 sc/source/filter/inc/richstringcontext.hxx |2 -
 sc/source/filter/inc/worksheethelper.hxx   |2 -
 sc/source/filter/oox/richstring.cxx|   55 ++---
 sc/source/filter/oox/richstringcontext.cxx |   12 +++---
 sc/source/filter/oox/worksheethelper.cxx   |2 -
 6 files changed, 50 insertions(+), 52 deletions(-)

New commits:
commit 51e1f131ac30beab0c56d56004451688db44ca3d
Author: Noel Grandin 
AuthorDate: Tue Jul 5 14:07:20 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Jul 6 18:58:14 2022 +0200

compact the RichStringPortion class

Which reduces peak memory load from 548M to 495M when loading
a large spreadsheet

Change-Id: I74adfddd1722bba7a9dfae6dd0135e5f2b78b1a7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136826
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 16c722b2b13373d2206cb562ad8cf606efc48d35)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136771
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/filter/inc/richstring.hxx 
b/sc/source/filter/inc/richstring.hxx
index 71b393c1db41..fe0d0f2f527a 100644
--- a/sc/source/filter/inc/richstring.hxx
+++ b/sc/source/filter/inc/richstring.hxx
@@ -35,20 +35,20 @@ namespace oox { class SequenceInputStream; }
 namespace oox::xls {
 
 /** Contains text data and font attributes for a part of a rich formatted 
string. */
-class RichStringPortion : public WorkbookHelper
+class RichStringPortion
 {
 public:
-explicitRichStringPortion( const WorkbookHelper& rHelper );
+RichStringPortion();
 
 /** Sets text data for this portion. */
 voidsetText( const OUString& rText );
 /** Creates and returns a new font formatting object. */
-FontRef const & createFont();
+FontRef const & createFont(const WorkbookHelper& rHelper);
 /** Links this portion to a font object from the global font list. */
 voidsetFontId( sal_Int32 nFontId );
 
 /** Final processing after import of all strings. */
-voidfinalizeImport();
+voidfinalizeImport(const WorkbookHelper& rHelper);
 
 /** Returns the text data of this portion. */
 const OUString& getText() const { return maText; }
@@ -71,8 +71,6 @@ private:
 boolmbConverted;/// Without repeatedly convert
 };
 
-typedef std::shared_ptr< RichStringPortion > RichStringPortionRef;
-
 /** Represents a position in a rich-string containing current font identifier.
 
 This object stores the position of a formatted character in a rich-string
@@ -210,10 +208,10 @@ class RichString : public WorkbookHelper
 public:
 explicitRichString( const WorkbookHelper& rHelper );
 
-/** Appends and returns a portion object for a plain string (t element). */
-RichStringPortionRef importText();
-/** Appends and returns a portion object for a new formatting run (r 
element). */
-RichStringPortionRef importRun();
+/** Appends and returns an index of a portion object for a plain string (t 
element). */
+sal_Int32 importText();
+/** Appends and returns an index of a portion object for a new formatting 
run (r element). */
+sal_Int32 importRun();
 /** Appends and returns a phonetic text object for a new phonetic run (rPh 
element). */
 RichStringPhoneticRef importPhoneticRun( const AttributeList& rAttribs );
 /** Imports phonetic settings from the rPhoneticPr element. */
@@ -234,12 +232,14 @@ public:
 /** Converts the string and writes it into the passed XText, replace old 
contents of the text object,.
 @param rxText  The XText interface of the target object.
  */
-voidconvert( const css::uno::Reference< css::text::XText 
>& rxText ) const;
-std::unique_ptr convert( ScEditEngineDefaulter& rEE, const 
oox::xls::Font* pFont ) const;
+voidconvert( const css::uno::Reference< css::text::XText 
>& rxText );
+std::unique_ptr convert( ScEditEngineDefaulter& rEE, const 
oox::xls::Font* pFont );
+
+RichStringPortion& getPortion(sal_Int32 nPortionIdx) { return 
maTextPortions[nPortionIdx]; }
 
 private:
 /** Creates, appends, and returns a new empty string portion. */
-RichStringPortionRef createPortion();
+sal_Int32 createPortion();
 /** Creates, appends, and returns a new empty phonetic text portion. */
 RichStringPhoneticRef createPhonetic();
 
@@ -249,10 +249,9 @@ private:
 voidcreatePhoneticPortions( const OUString& rText, 
PhoneticPortionModelList& rPortions, sal_Int32 nBaseLen );
 
 private:
-typedef RefVector< RichStringPortion >  PortionVector;
 typedef RefVector< RichStringPhonetic > PhoneticVector;
 
-PortionVector   maTextPortions; /// String portions with font data.
+std::vector  maTextPortions; /// String portions 

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

2022-07-06 Thread Noel Grandin (via logerrit)
 sc/source/filter/inc/pivotcachebuffer.hxx |2 +-
 sc/source/filter/inc/sheetdatabuffer.hxx  |   20 
 sc/source/filter/inc/worksheethelper.hxx  |3 ---
 sc/source/filter/oox/pivotcachebuffer.cxx |7 +++
 sc/source/filter/oox/sheetdatabuffer.cxx  |   23 ---
 sc/source/filter/oox/sheetdatacontext.cxx |7 +--
 sc/source/filter/oox/worksheethelper.cxx  |8 
 7 files changed, 5 insertions(+), 65 deletions(-)

New commits:
commit 779f38adf952e816218e2dac26513e8ff106d651
Author: Noel Grandin 
AuthorDate: Tue Jul 5 12:08:07 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Jul 6 18:57:15 2022 +0200

remove span data storage from oox import

We are not using it,
and removing it reduces peak memory load from 648M to 548M when loading
a large spreadsheet

Change-Id: I683bfba6c8f151d8845bbd7d5f92cde2a9c17807
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136825
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 168f3572dc4c17910543ca0e93a0c5e04113fbf2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136770
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/filter/inc/pivotcachebuffer.hxx 
b/sc/source/filter/inc/pivotcachebuffer.hxx
index 5997d8db3d2c..e255c79eae15 100644
--- a/sc/source/filter/inc/pivotcachebuffer.hxx
+++ b/sc/source/filter/inc/pivotcachebuffer.hxx
@@ -409,7 +409,7 @@ private:
 /** Creates a dummy sheet that will be filled with the pivot cache data. */
 voidprepareSourceDataSheet();
 /** Checks, if the row index has changed since last call, and initializes 
the sheet data buffer. */
-voidupdateSourceDataRow( const WorksheetHelper& 
rSheetHelper, sal_Int32 nRow ) const;
+voidupdateSourceDataRow( sal_Int32 nRow ) const;
 
 private:
 typedef RefVector< PivotCacheField >PivotCacheFieldVector;
diff --git a/sc/source/filter/inc/sheetdatabuffer.hxx 
b/sc/source/filter/inc/sheetdatabuffer.hxx
index 940da26416fe..ac095cccdd26 100644
--- a/sc/source/filter/inc/sheetdatabuffer.hxx
+++ b/sc/source/filter/inc/sheetdatabuffer.hxx
@@ -73,22 +73,6 @@ struct DataTableModel
 explicitDataTableModel();
 };
 
-/** Manages all cell blocks currently in use. */
-class CellBlockBuffer : public WorksheetHelper
-{
-public:
-explicitCellBlockBuffer( const WorksheetHelper& rHelper );
-
-/** Sets column span information for a row. */
-voidsetColSpans( sal_Int32 nRow, const ValueRangeSet& 
rColSpans );
-
-private:
-typedef ::std::map< sal_Int32, ValueRangeVector >   ColSpanVectorMap;
-
-ColSpanVectorMapmaColSpans; /// Buffered column spans, 
mapped by row index.
-sal_Int32   mnCurrRow;  /// Current row index used for 
buffered cell import.
-};
-
 /** Manages the cell contents and cell formatting of a sheet.
  */
 class SheetDataBuffer : public WorksheetHelper
@@ -96,9 +80,6 @@ class SheetDataBuffer : public WorksheetHelper
 public:
 explicitSheetDataBuffer( const WorksheetHelper& rHelper );
 
-/** Sets column span information for a row. */
-voidsetColSpans( sal_Int32 nRow, const ValueRangeSet& 
rColSpans );
-
 /** Inserts a blank cell (with formatting) into the sheet. */
 voidsetBlankCell( const CellModel& rModel );
 /** Inserts a value cell into the sheet. */
@@ -224,7 +205,6 @@ private:
 typedef ::std::vector< MergedRange > MergedRangeVector;
 
 ColStyles   maStylesPerColumn;  /// Stores cell styles by 
column ( in row ranges )
-CellBlockBuffer maCellBlocks;   /// Manages all open cell 
blocks.
 ArrayFormulaVector  maArrayFormulas;/// All array formulas in the 
sheet.
 std::vector< TableOperation >
 maTableOperations;  /// All table operations in 
the sheet.
diff --git a/sc/source/filter/inc/worksheethelper.hxx 
b/sc/source/filter/inc/worksheethelper.hxx
index 7beacf7c2105..3aeb576f93de 100644
--- a/sc/source/filter/inc/worksheethelper.hxx
+++ b/sc/source/filter/inc/worksheethelper.hxx
@@ -85,7 +85,6 @@ struct ColumnModel
 struct RowModel
 {
 sal_Int32   mnRow;  /// 1-based (!) index of the 
described row.
-ValueRangeSet   maColSpans; /// 0-based (!) column ranges of 
used cells.
 double  mfHeight;   /// Row height in points.
 sal_Int32   mnXfId; /// Row default formatting (see 
mbIsFormatted).
 sal_Int32   mnLevel;/// Row outline level.
@@ -99,8 +98,6 @@ struct RowModel
 
 explicitRowModel();
 
-/** Inserts the passed column span into the row model. */
-voidinsertColSpan( const ValueRange& rColSpan );
 /** Returns true, if this entry can be merged with the passed row range 
(row 

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

2022-06-24 Thread Luboš Luňák (via logerrit)
 sc/source/core/data/queryevaluator.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 1e169f781248c14110488eb064571068ad3d0f81
Author: Luboš Luňák 
AuthorDate: Thu Jun 23 16:39:39 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri Jun 24 10:50:48 2022 +0200

handle nullptr SharedString in ScQueryEvaluator (tdf#149679)

This may be the case if the string comes from ScMatrix::Get()
for ScMatValType::Empty.

Change-Id: I35013449611bf7ffd1bc74e023d76597af010724
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136347
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 
(cherry picked from commit 9e170a35eebbe86e6137510bc8ea34e5a45dbd8d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136332
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/core/data/queryevaluator.cxx 
b/sc/source/core/data/queryevaluator.cxx
index 1e16398a4cfb..12e034da6fa0 100644
--- a/sc/source/core/data/queryevaluator.cxx
+++ b/sc/source/core/data/queryevaluator.cxx
@@ -481,8 +481,9 @@ std::pair 
ScQueryEvaluator::compareByString(const ScQueryEntry& rEnt
 const rtl_uString* pQuer = 
rItem.maString.getDataIgnoreCase();
 const rtl_uString* pCellStr = rSource.getDataIgnoreCase();
 
-assert(pQuer != nullptr);
 assert(pCellStr != nullptr);
+if (pQuer == nullptr)
+pQuer = 
svl::SharedString::getEmptyString().getDataIgnoreCase();
 
 const sal_Int32 nIndex
 = (rEntry.eOp == SC_ENDS_WITH || rEntry.eOp == 
SC_DOES_NOT_END_WITH)


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

2022-06-20 Thread Szymon Kłos (via logerrit)
 sc/source/ui/app/inputwin.cxx |9 ++--
 vcl/jsdialog/executor.cxx |   47 +++---
 2 files changed, 51 insertions(+), 5 deletions(-)

New commits:
commit 62e9828f97ac76fb6717fd50828d5da8375297b2
Author: Szymon Kłos 
AuthorDate: Wed Jun 15 10:02:59 2022 +0200
Commit: Szymon Kłos 
CommitDate: Mon Jun 20 18:11:20 2022 +0200

jsdialog: formulabar: handle multiline selection

it uses format: "start;end;startPara;endPara"

Change-Id: If3d36550f5e4a35fc04c72114c7719119b10da61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135866
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mert Tumer 

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 07344e1c0a19..531d5c5d9a17 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1724,9 +1724,14 @@ bool ScTextWnd::Command( const CommandEvent& rCEvt )
 if (!m_xEditView)
 return true;
 
+// information about paragraph is in additional data
+// information about position in a paragraph in a Mouse Pos
+// see vcl/jsdialog/executor.cxx "textselection" event
+const Point* pParaPoint = static_cast(rCEvt.GetEventData());
 Point aSelectionStartEnd = rCEvt.GetMousePosPixel();
-m_xEditView->SetSelection(ESelection(0, aSelectionStartEnd.X(),
-0, aSelectionStartEnd.Y()));
+m_xEditView->SetSelection(
+ESelection((pParaPoint ? pParaPoint->X() : 0), 
aSelectionStartEnd.X(),
+   (pParaPoint ? pParaPoint->Y() : 0), 
aSelectionStartEnd.Y()));
 
 SC_MOD()->InputSelection( m_xEditView.get() );
 
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 4e8324eb9379..2da2ab5b9608 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -216,13 +216,30 @@ bool ExecuteAction(const std::string& nWindowId, const 
OString& rWidget, StringM
 }
 else if (sAction == "textselection")
 {
-// start;end
 int nSeparatorPos = rData["data"].indexOf(';');
 if (nSeparatorPos <= 0)
 return true;
 
+int nSeparator2Pos = rData["data"].indexOf(';', 
nSeparatorPos + 1);
+int nSeparator3Pos = 0;
+
+if (nSeparator2Pos > 0)
+{
+// start;end;startPara;endPara
+nSeparator3Pos = rData["data"].indexOf(';', 
nSeparator2Pos + 1);
+if (nSeparator3Pos <= 0)
+return true;
+}
+else
+{
+// start;end
+nSeparator2Pos = 0;
+nSeparator3Pos = 0;
+}
+
 std::u16string_view aStartPos = rData["data"].subView(0, 
nSeparatorPos);
-std::u16string_view aEndPos = 
rData["data"].subView(nSeparatorPos + 1);
+std::u16string_view aEndPos = rData["data"].subView(
+nSeparatorPos + 1, nSeparator2Pos - nSeparatorPos + 1);
 
 if (aStartPos.empty() || aEndPos.empty())
 return true;
@@ -231,9 +248,33 @@ bool ExecuteAction(const std::string& nWindowId, const 
OString& rWidget, StringM
 OUStringToOString(aStartPos.data(), 
RTL_TEXTENCODING_ASCII_US).getStr());
 int nEnd = std::atoi(
 OUStringToOString(aEndPos.data(), 
RTL_TEXTENCODING_ASCII_US).getStr());
+int nStartPara = 0;
+int nEndPara = 0;
+
+// multiline case
+if (nSeparator2Pos && nSeparator3Pos)
+{
+std::u16string_view aStartPara = rData["data"].subView(
+nSeparator2Pos + 1, nSeparator3Pos - 
nSeparator2Pos + 1);
+std::u16string_view aEndPara = 
rData["data"].subView(nSeparator3Pos + 1);
+
+if (aStartPara.empty() || aEndPara.empty())
+return true;
+
+nStartPara = std::atoi(
+OUStringToOString(aStartPara.data(), 
RTL_TEXTENCODING_ASCII_US)
+.getStr());
+nEndPara = std::atoi(
+OUStringToOString(aEndPara.data(), 
RTL_TEXTENCODING_ASCII_US).getStr());
+}
+
+// pass information about paragraph number in the 
additional data
+// handled in sc/source/ui/app/inputwin.cxx
+Point* pParaPoint = new Point(nStartPara, nEndPara);
+const void* pCmdData = pParaPoint;
 
   

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

2022-06-20 Thread Szymon Kłos (via logerrit)
 sc/source/ui/app/inputhdl.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit d497d1f1dbeb6de31a9f981da5b887f3114b1a5b
Author: Szymon Kłos 
AuthorDate: Tue Jun 14 16:59:32 2022 +0200
Commit: Szymon Kłos 
CommitDate: Mon Jun 20 18:10:59 2022 +0200

jsdialog: formulabar: send also paragraph number for multiline formula

Change-Id: Ia146be83f0ac6f3fbc94d5a904b8067ac8b2a8d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135833
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mert Tumer 

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 72852aa79b58..b9401530180c 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1799,7 +1799,8 @@ void ScInputHandler::LOKSendFormulabarUpdate(const 
SfxViewShell* pActiveViewSh,
  const ESelection& rSelection)
 {
 OUString aSelection =
-OUString::number(rSelection.nStartPos) + ";" + 
OUString::number(rSelection.nEndPos);
+OUString::number(rSelection.nStartPos) + ";" + 
OUString::number(rSelection.nEndPos) + ";" +
+OUString::number(rSelection.nStartPara) + ";" + 
OUString::number(rSelection.nEndPara);
 
 std::unique_ptr pData = 
std::make_unique();
 (*pData)["action_type"] = "setText";


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

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

New commits:
commit cdb6f964f6bd7170f3f1d1e167c6558f75c77884
Author: Luboš Luňák 
AuthorDate: Wed Jun 15 09:29:20 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri Jun 17 14:31:05 2022 +0200

allocate column in ScTable::DeleteBeforeCopyFromClip() (tdf#149554)

Change-Id: I22607f1dd0ec1c083f6a52a2ecccb976fc133687
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135864
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 
(cherry picked from commit e445eac863ac616fb99c9d6bf5510b965fd15957)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135950
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/core/data/table7.cxx b/sc/source/core/data/table7.cxx
index f7576361c8a1..9af01cba748e 100644
--- a/sc/source/core/data/table7.cxx
+++ b/sc/source/core/data/table7.cxx
@@ -115,7 +115,7 @@ void ScTable::DeleteBeforeCopyFromClip(
 if (nClipCol > aClipRange.aEnd.Col())
 nClipCol = aClipRange.aStart.Col(); // loop through columns.
 
-const ScColumn& rClipCol = rClipTab.aCol[nClipCol];
+const ScColumn& rClipCol = 
const_cast(rClipTab).CreateColumnIfNotExists(nClipCol);
 aCol[nCol].DeleteBeforeCopyFromClip(rCxt, rClipCol, 
rBroadcastSpans);
 }
 }


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

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

New commits:
commit 232a982d0f0d9cee356bd4491c717463d718986d
Author: Luboš Luňák 
AuthorDate: Mon Jun 13 19:51:43 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri Jun 17 14:29:59 2022 +0200

allocate columns in ScTable::TransposeClip() (tdf#149554)

Change-Id: I2ae151ed9656884bca6963ba09bdf236e09096b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135774
Tested-by: Xisco Fauli 
Reviewed-by: Luboš Luňák 
(cherry picked from commit ef1be22efb3e1625da1683ea98392cc41657b1cd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135748
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index e42a6e69de4a..32c1e34bbff4 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -990,7 +990,7 @@ void ScTable::TransposeClip(SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
 {
 bool bWasCut = rDocument.IsCutMode();
 
-for (SCCOL nCol=nCol1; nCol<=nCol2; nCol++)
+for (SCCOL nCol : GetWritableColumnsRange(nCol1, nCol2))
 {
 std::vector aFilteredRows;
 


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

2022-06-17 Thread Luboš Luňák (via logerrit)
 sc/source/core/data/table1.cxx |   24 
 1 file changed, 12 insertions(+), 12 deletions(-)

New commits:
commit f4c43f8fc8c08f9ad0a63504a3067eca6b8b2c00
Author: Luboš Luňák 
AuthorDate: Fri Jun 10 17:39:46 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri Jun 17 14:27:46 2022 +0200

find last data row before searching for first data row

GetLastDataRow() is more efficient than iterating every cell
with HasDataAt(), so first reduce the row range from the end
(in case the whole range is empty cells it's just one call).

Change-Id: Idc494795f68492ed8b05b2cd575598a9c5868b7f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135605
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 
(cherry picked from commit 7689bf445264d1b54038ec0b8d134c26847af40f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135552
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index e65aa194f9f7..43dcd6abee20 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1118,6 +1118,18 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, 
SCCOL& rStartCol, SCROW& rS
 
 if (!bColumnsOnly)
 {
+while (rStartRow < rEndRow)
+{
+SCROW nLastDataRow = GetLastDataRow(rStartCol, rEndCol, rEndRow, 
pDataAreaExtras);
+if (0 <= nLastDataRow && nLastDataRow < rEndRow)
+{
+rEndRow = std::max( rStartRow, nLastDataRow);
+o_bShrunk = true;
+}
+else
+break;  // while
+}
+
 if (!bStickyTopRow)
 {
 while (rStartRow < rEndRow)
@@ -1137,18 +1149,6 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, 
SCCOL& rStartCol, SCROW& rS
 break;  // while
 }
 }
-
-while (rStartRow < rEndRow)
-{
-SCROW nLastDataRow = GetLastDataRow(rStartCol, rEndCol, rEndRow, 
pDataAreaExtras);
-if (0 <= nLastDataRow && nLastDataRow < rEndRow)
-{
-rEndRow = std::max( rStartRow, nLastDataRow);
-o_bShrunk = true;
-}
-else
-break;  // while
-}
 }
 
 return rStartCol != rEndCol || (bColumnsOnly ?


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

2022-05-17 Thread Szymon Kłos (via logerrit)
 sc/source/ui/view/gridwin4.cxx |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 63d7f270372c90a8e69f4ce6de48521cde6a784f
Author: Szymon Kłos 
AuthorDate: Fri May 13 17:06:19 2022 +0200
Commit: Szymon Kłos 
CommitDate: Tue May 17 15:43:40 2022 +0200

lok: respect zoom in calc tile rendering of EditView

Issue was that when using 150% zoom in LOK and editing
some textbox inside Calc spreadsheet - we didn't see
content of it (but tiles were invalidated).
In other view we have seen textbox in correct place
if zoom was 100%.

To fix that we need to pass zoom factor and use it.

Change-Id: Ib1cf49af02d0637e09ce68c5c2c41ffb3014c701
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134288
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mert Tumer 
Reviewed-by: Henry Castro 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134465
Reviewed-by: Szymon Kłos 

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index c13177e4247d..3677db7122bd 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -731,7 +731,8 @@ void ScGridWindow::DrawContent(OutputDevice , const 
ScTableInfo& rTableI
 // the same as editeng and drawinglayer), and get rid of all the
 // SetMapMode's and other unnecessary fun we have with pixels
 // See also ScGridWindow::GetDrawMapMode() for the rest of this hack
-aDrawMode.SetOrigin(PixelToLogic(Point(nScrX, nScrY), aDrawMode));
+aDrawMode.SetOrigin(PixelToLogic(Point(tools::Long(nScrX / 
aOutputData.aZoomX),
+   tools::Long(nScrY / 
aOutputData.aZoomY)), aDrawMode));
 }
 tools::Rectangle aDrawingRectLogic;
 bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
@@ -1036,6 +1037,9 @@ void ScGridWindow::DrawContent(OutputDevice , 
const ScTableInfo& rTableI
 
 if (bIsTiledRendering)
 {
+const double fZoomX = static_cast(aOutputData.aZoomX);
+const double fZoomY = static_cast(aOutputData.aZoomY);
+
 Point aOrigin = aOriginalMode.GetOrigin();
 if (bLayoutRTL)
 aOrigin.setX(-o3tl::convert(aOrigin.getX(), 
o3tl::Length::twip, o3tl::Length::px)
@@ -1047,8 +1051,8 @@ 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);
+aOrigin = Point(aOrigin.getX() * twipFactor / fZoomX,
+aOrigin.getY() * twipFactor / fZoomY);
 MapMode aNew = rDevice.GetMapMode();
 aNew.SetOrigin(aOrigin);
 rDevice.SetMapMode(aNew);
@@ -1600,7 +1604,7 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
  -nTopLeftTileRowOffset,
  nTopLeftTileCol, nTopLeftTileRow,
  nBottomRightTileCol, nBottomRightTileRow,
- fPPTX, fPPTY, nullptr, nullptr);
+ fPPTX, fPPTY, , );
 
 // setup the SdrPage so that drawinglayer works correctly
 ScDrawLayer* pModel = rDoc.GetDrawLayer();


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

2022-04-21 Thread rash419 (via logerrit)
 sc/source/ui/attrdlg/scdlgfact.cxx |7 ++
 sc/source/ui/attrdlg/scdlgfact.hxx |5 +
 sc/source/ui/view/cellsh3.cxx  |   96 +
 3 files changed, 65 insertions(+), 43 deletions(-)

New commits:
commit 7f7e81f70304d672b85fe457c126285a5abac103
Author: rash419 
AuthorDate: Tue Apr 12 20:00:13 2022 +0530
Commit: Gökay ŞATIR 
CommitDate: Thu Apr 21 18:28:28 2022 +0200

sc: convert optimal width/height and normal width/height dialog to async

Signed-off-by: rash419 
Change-Id: I96f6d90692d7767bdc276f753897bdc392c90411
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132919
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133127
Reviewed-by: Gökay ŞATIR 

diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx 
b/sc/source/ui/attrdlg/scdlgfact.cxx
index 9fbfccaa4d38..ab8741a9e8d8 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -194,6 +194,11 @@ short AbstractScMetricInputDlg_Impl::Execute()
 return m_xDlg->run();
 }
 
+bool AbstractScMetricInputDlg_Impl::StartExecuteAsync(AsyncContext& rCtx)
+{
+return ScMetricInputDlg::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
 short AbstractScMoveTableDlg_Impl::Execute()
 {
 return m_xDlg->run();
@@ -1112,7 +1117,7 @@ VclPtr 
ScAbstractDialogFactory_Impl::CreateScMetricInp
 tools::Long
nMaximum ,
 tools::Long
nMinimum )
 {
-return 
VclPtr::Create(std::make_unique(pParent,
 sDialogName, nCurrent ,nDefault, eFUnit,
+return 
VclPtr::Create(std::make_shared(pParent,
 sDialogName, nCurrent ,nDefault, eFUnit,
 nDecimals, nMaximum , nMinimum));
 }
 
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx 
b/sc/source/ui/attrdlg/scdlgfact.hxx
index fef206002dea..b3756bb075af 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -390,13 +390,14 @@ public:
 
 class AbstractScMetricInputDlg_Impl : public AbstractScMetricInputDlg
 {
-std::unique_ptr m_xDlg;
+std::shared_ptr m_xDlg;
 public:
-explicit AbstractScMetricInputDlg_Impl(std::unique_ptr p)
+explicit AbstractScMetricInputDlg_Impl(std::shared_ptr p)
 : m_xDlg(std::move(p))
 {
 }
 virtual short Execute() override;
+virtual bool StartExecuteAsync(AsyncContext& rCtx) override;
 virtual int GetInputValue() const override;
 };
 
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index f24c06e9a0d2..f5c1155ec218 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -687,21 +687,24 @@ void ScCellShell::Execute( SfxRequest& rReq )
 GetRowHeight( rData.GetCurY(),
   rData.GetTabNo() 
);
 ScAbstractDialogFactory* pFact = 
ScAbstractDialogFactory::Create();
-ScopedVclPtr 
pDlg(pFact->CreateScMetricInputDlg(
+VclPtr 
pDlg(pFact->CreateScMetricInputDlg(
 pTabViewShell->GetFrameWeld(), "RowHeightDialog",
 nCurHeight, ScGlobal::nStdRowHeight,
 eMetric, 2, MAX_ROW_HEIGHT));
 
-if ( pDlg->Execute() == RET_OK )
-{
-tools::Long nVal = pDlg->GetInputValue();
-pTabViewShell->SetMarkedWidthOrHeight( false, 
SC_SIZE_DIRECT, static_cast(nVal) );
-
-// #101390#; the value of the macro should be in HMM 
so use TwipsToEvenHMM to convert
-rReq.AppendItem( SfxUInt16Item( FID_ROW_HEIGHT, 
static_cast(TwipsToEvenHMM(nVal)) ) );
-rReq.Done();
+pDlg->StartExecuteAsync([pDlg, pTabViewShell](sal_Int32 
nResult){
+if (nResult == RET_OK)
+{
+SfxRequest pRequest(pTabViewShell->GetViewFrame(), 
FID_ROW_HEIGHT);
+tools::Long nVal = pDlg->GetInputValue();
+pTabViewShell->SetMarkedWidthOrHeight( false, 
SC_SIZE_DIRECT, static_cast(nVal) );
 
-}
+// #101390#; the value of the macro should be in 
HMM so use TwipsToEvenHMM to convert
+pRequest.AppendItem( SfxUInt16Item( 
FID_ROW_HEIGHT, static_cast(TwipsToEvenHMM(nVal)) ) );
+pRequest.Done();
+}
+pDlg->disposeOnce();
+});
 }
 }
 break;
@@ -725,20 +728,24 @@ void ScCellShell::Execute( SfxRequest& rReq )
 FieldUnit eMetric = 
SC_MOD()->GetAppOptions().GetAppMetric();
 

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

2022-04-12 Thread Julien Nabet (via logerrit)
 sc/source/ui/dialogs/SparklineDialog.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 92e35ec9c8ecb2ba93d050a2b5aa838d71c82321
Author: Julien Nabet 
AuthorDate: Sun Apr 10 10:21:59 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Wed Apr 13 01:35:21 2022 +0200

cid#1503834: copy-paste

Change-Id: Ibc5cf10d4daf809e89693ac9d3fb82188ba1b311
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132767
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
(cherry picked from commit c1285d4d033a13667a942145db77e3aa38d3f953)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132925
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sc/source/ui/dialogs/SparklineDialog.cxx 
b/sc/source/ui/dialogs/SparklineDialog.cxx
index 4a7fa320a38e..0c5be765ef3c 100644
--- a/sc/source/ui/dialogs/SparklineDialog.cxx
+++ b/sc/source/ui/dialogs/SparklineDialog.cxx
@@ -253,7 +253,7 @@ void SparklineDialog::setupValues()
 break;
 case sc::AxisType::Custom:
 mxComboMaxAxisType->set_active(2);
-if (maAttributes.getManualMin())
+if (maAttributes.getManualMax())
 
mxSpinCustomMax->GetFormatter().SetValue(*maAttributes.getManualMax());
 break;
 }


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

2022-04-11 Thread Szymon Kłos (via logerrit)
 sc/source/ui/cctrl/checklistmenu.cxx |   38 ---
 sc/source/ui/inc/checklistmenu.hxx   |3 --
 vcl/jsdialog/jsdialogbuilder.cxx |7 +-
 3 files changed, 2 insertions(+), 46 deletions(-)

New commits:
commit ace42fde4a7e15b9a6da8cbf40d34cd6141da781
Author: Szymon Kłos 
AuthorDate: Mon Apr 4 23:27:01 2022 +0200
Commit: Andras Timar 
CommitDate: Mon Apr 11 11:15:11 2022 +0200

jsdialog: autofilter: unify with regular popup

- remove special type "autofilter"
- now autofilter will be handled by dialog code in online

Change-Id: I3478c3e05ab2e83030a8d68632d0426a5cc0accd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132539
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mert Tumer 

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index f6778e32f85c..7c5da063116b 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -435,9 +435,6 @@ void ScCheckListMenuControl::StartPopupMode(weld::Widget* 
pParent, const tools::
 
 void ScCheckListMenuControl::terminateAllPopupMenus()
 {
-if (comphelper::LibreOfficeKit::isActive())
-NotifyCloseLOK();
-
 EndPopupMode();
 }
 
@@ -1400,27 +1397,11 @@ void ScCheckListMenuControl::launch(weld::Widget* 
pWidget, const tools::Rectangl
 StartPopupMode(pWidget, aRect);
 }
 
-void ScCheckListMenuControl::NotifyCloseLOK()
-{
-if (mpNotifier)
-{
-tools::JsonWriter aJsonWriter;
-aJsonWriter.put("jsontype", "autofilter");
-aJsonWriter.put("action", "close");
-
-const std::string message = aJsonWriter.extractAsStdString();
-mpNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, 
message.c_str());
-}
-}
-
 void ScCheckListMenuControl::close(bool bOK)
 {
 if (bOK && mxOKAction)
 mxOKAction->execute();
 EndPopupMode();
-
-if (comphelper::LibreOfficeKit::isActive())
-NotifyCloseLOK();
 }
 
 void ScCheckListMenuControl::setExtendedData(std::unique_ptr p)
@@ -1451,9 +1432,6 @@ IMPL_LINK_NOARG(ScCheckListMenuControl, PopupModeEndHdl, 
weld::Popover&, void)
 mxPopupEndAction->execute();
 
 DropPendingEvents();
-
-if (comphelper::LibreOfficeKit::isActive())
-NotifyCloseLOK();
 }
 
 int ScCheckListMenuControl::GetTextWidth(const OUString& rsName) const
@@ -1617,24 +1595,8 @@ void 
ScListSubMenuControl::setPopupStartAction(ScCheckListMenuControl::Action* p
 
 void ScListSubMenuControl::terminateAllPopupMenus()
 {
-if (comphelper::LibreOfficeKit::isActive())
-NotifyCloseLOK();
-
 EndPopupMode();
 mrParentControl.terminateAllPopupMenus();
 }
 
-void ScListSubMenuControl::NotifyCloseLOK()
-{
-if (mpNotifier)
-{
-tools::JsonWriter aJsonWriter;
-aJsonWriter.put("jsontype", "autofilter");
-aJsonWriter.put("action", "close");
-
-const std::string message = aJsonWriter.extractAsStdString();
-mpNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, 
message.c_str());
-}
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/checklistmenu.hxx 
b/sc/source/ui/inc/checklistmenu.hxx
index 8d135870d871..1108ca7705a8 100644
--- a/sc/source/ui/inc/checklistmenu.hxx
+++ b/sc/source/ui/inc/checklistmenu.hxx
@@ -227,8 +227,6 @@ private:
 
 void CreateDropDown();
 
-void NotifyCloseLOK();
-
 DECL_LINK(ButtonHdl, weld::Button&, void);
 DECL_LINK(TriStateHdl, weld::Toggleable&, void);
 
@@ -368,7 +366,6 @@ private:
 DECL_LINK(CheckToggledHdl, const weld::TreeView::iter_col&, void);
 DECL_LINK(MenuKeyInputHdl, const KeyEvent&, bool);
 
-void NotifyCloseLOK();
 void executeMenuItem(size_t nPos);
 void addItem(ScCheckListMenuControl::Action* pAction);
 };
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 1891e7f72c8e..408e7a9e53da 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -211,7 +211,7 @@ 
JSDialogNotifyIdle::generatePopupMessage(VclPtr pWindow, OUString s
 }
 }
 
-if (m_sTypeOfJSON == "autofilter")
+// try to get the position eg. for the autofilter
 {
 vcl::Window* pVclWindow = pWindow.get();
 DockingWindow* pDockingWindow = 
dynamic_cast(pVclWindow);
@@ -231,7 +231,7 @@ 
JSDialogNotifyIdle::generatePopupMessage(VclPtr pWindow, OUString s
 }
 }
 
-aJsonWriter->put("jsontype", (m_sTypeOfJSON == "autofilter") ? 
"autofilter" : "dialog");
+aJsonWriter->put("jsontype", "dialog");
 aJsonWriter->put("type", "modalpopup");
 aJsonWriter->put("cancellable", true);
 aJsonWriter->put("popupParent", sParentId);
@@ -500,9 +500,6 @@ JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, 
const OUString& rUIR
 , m_bIsNotebookbar(false)
 , m_aWindowToRelease(nullptr)
 {
-if (rUIFile == "modules/scalc/ui/filterdropdown.ui")

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/source vcl/inc vcl/jsdialog vcl/source

2022-04-11 Thread Szymon Kłos (via logerrit)
 sc/source/ui/cctrl/checklistmenu.cxx |4 -
 vcl/inc/jsdialog/jsdialogbuilder.hxx |5 --
 vcl/jsdialog/enabled.cxx |5 +-
 vcl/jsdialog/jsdialogbuilder.cxx |   78 ++-
 vcl/source/window/builder.cxx|6 --
 5 files changed, 27 insertions(+), 71 deletions(-)

New commits:
commit 479e379f7178444d69b4bb5090d8da25f090e061
Author: Szymon Kłos 
AuthorDate: Mon Apr 4 11:30:33 2022 +0200
Commit: Andras Timar 
CommitDate: Mon Apr 11 11:14:18 2022 +0200

jsdialog: reenable after welding, unify with dialogs

Change-Id: I4a589f68fcdaa1c62ac08bd6075071d0fed0b28b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132538
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mert Tumer 

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index 1a834a7aaccc..f6778e32f85c 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -321,10 +321,6 @@ void ScCheckListMenuControl::launchSubMenu()
 
 mxMenu->select(*mxScratchIter);
 pSubMenu->GrabFocus();
-
-// TODO: still needed?
-//if (comphelper::LibreOfficeKit::isActive())
-//jsdialog::SendFullUpdate(std::to_string(pSubMenu->GetLOKWindowId()), 
"toggle_all");
 }
 
 IMPL_LINK_NOARG(ScCheckListMenuControl, PostPopdownHdl, void*, void)
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index db010df11d21..077e49235168 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -243,8 +243,6 @@ public:
 JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const 
OUString& rUIFile,
   const css::uno::Reference& rFrame,
   sal_uInt64 nWindowId = 0);
-/// for autofilter dropdown
-JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const 
OUString& rUIFile);
 
 static std::unique_ptr
 CreateDialogBuilder(weld::Widget* pParent, const OUString& rUIRoot, const 
OUString& rUIFile);
@@ -252,9 +250,6 @@ public:
 CreateNotebookbarBuilder(vcl::Window* pParent, const OUString& rUIRoot, 
const OUString& rUIFile,
  const css::uno::Reference& 
rFrame,
  sal_uInt64 nWindowId = 0);
-static std::unique_ptr
-CreateAutofilterWindowBuilder(vcl::Window* pParent, const OUString& 
rUIRoot,
-  const OUString& rUIFile);
 static std::unique_ptr 
CreateSidebarBuilder(weld::Widget* pParent,
const 
OUString& rUIRoot,
const 
OUString& rUIFile,
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 99e20b17bb71..ddd7e3ce9ba0 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -90,8 +90,9 @@ bool isBuilderEnabledForPopup(std::u16string_view rUIFile)
 || rUIFile == u"svx/ui/floatinglineend.ui"
 || rUIFile == u"svx/ui/fontworkalignmentcontrol.ui"
 || rUIFile == u"svx/ui/fontworkcharacterspacingcontrol.ui"
-|| rUIFile == u"svx/ui/floatingareastyle.ui"
-|| rUIFile == u"modules/scalc/ui/filterlist.ui")
+|| rUIFile == u"svx/ui/floatingareastyle.ui" || rUIFile == 
u"modules/scalc/ui/filterlist.ui"
+|| rUIFile == u"modules/scalc/ui/filterdropdown.ui"
+|| rUIFile == u"modules/scalc/ui/filtersubdropdown.ui")
 return true;
 
 return false;
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 7ca9cceb16c9..1891e7f72c8e 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -137,26 +137,6 @@ std::unique_ptr 
JSDialogNotifyIdle::generateFullUpdate() cons
 aJsonWriter->put("id", m_aNotifierWindow->GetLOKWindowId());
 aJsonWriter->put("jsontype", m_sTypeOfJSON);
 
-if (m_sTypeOfJSON == "autofilter")
-{
-vcl::Window* pWindow = m_aContentWindow.get();
-DockingWindow* pDockingWindow = dynamic_cast(pWindow);
-while (pWindow && !pDockingWindow)
-{
-pWindow = pWindow->GetParent();
-pDockingWindow = dynamic_cast(pWindow);
-}
-
-if (pDockingWindow)
-{
-Point aPos = pDockingWindow->GetFloatingPos();
-aJsonWriter->put("posx", aPos.getX());
-aJsonWriter->put("posy", aPos.getY());
-if (!pDockingWindow->IsVisible())
-aJsonWriter->put("visible", "false");
-}
-}
-
 return aJsonWriter;
 }
 
@@ -231,7 +211,27 @@ 
JSDialogNotifyIdle::generatePopupMessage(VclPtr pWindow, OUString s
 }
 }
 
-aJsonWriter->put("jsontype", "dialog");
+if (m_sTypeOfJSON == "autofilter")
+{
+vcl::Window* pVclWindow = pWindow.get();
+DockingWindow* pDockingWindow = 
dynamic_cast(pVclWindow);
+   

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

2022-04-10 Thread Tomaž Vajngerl (via logerrit)
 sc/source/ui/inc/output.hxx|1 
 sc/source/ui/view/gridwin4.cxx |2 
 sc/source/ui/view/output.cxx   |  202 -
 3 files changed, 204 insertions(+), 1 deletion(-)

New commits:
commit 33e8e6495c8949da4a5219b987148124d0e29658
Author: Tomaž Vajngerl 
AuthorDate: Thu Feb 24 17:43:00 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sun Apr 10 15:32:14 2022 +0200

sc: initial code to draw sparkline into a cell

Change-Id: I82861f4210a24f57573f0ec96489e86ab168677b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131488
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit f2d07a3b17430d21d4567f7a01525a702544ed8d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132549
Tested-by: Tomaž Vajngerl 

diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index 61873156d264..d44f7052589b 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -382,6 +382,7 @@ public:
 
 voidDrawNoteMarks(vcl::RenderContext& rRenderContext);
 voidAddPDFNotes();
+voidDrawSparklines(vcl::RenderContext& rRenderContext);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 46525e96b164..c13177e4247d 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -901,6 +901,8 @@ void ScGridWindow::DrawContent(OutputDevice , const 
ScTableInfo& rTableI
 aOutputData.DrawShadow();
 aOutputData.DrawFrame(*pContentDev);
 
+aOutputData.DrawSparklines(*pContentDev);
+
 // Show Note Mark
 if ( rOpts.GetOption( VOPT_NOTES ) )
 aOutputData.DrawNoteMarks(*pContentDev);
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 9ee2b3b0cd3b..72c14d61ac31 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -39,6 +38,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -60,6 +63,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -2299,6 +2303,202 @@ void ScOutputData::DrawChangeTrack()
 }
 }
 
+namespace
+{
+
+/** Draw a line chart into the rectangle bounds */
+void drawLine(vcl::RenderContext& rRenderContext, tools::Rectangle const & 
rRectangle,
+std::vector const & rValues, double nMin, double nMax)
+{
+basegfx::B2DPolygon aPolygon;
+double numebrOfSteps = rValues.size() - 1;
+double xStep = 0;
+double nDelta = nMax - nMin;
+
+for (double aValue : rValues)
+{
+double nP = (aValue - nMin) / nDelta;
+double x = rRectangle.GetWidth() * (xStep / numebrOfSteps);
+double y = rRectangle.GetHeight() - rRectangle.GetHeight() * nP;
+
+aPolygon.append({ x, y } );
+xStep++;
+}
+
+basegfx::B2DHomMatrix aMatrix;
+aMatrix.translate(rRectangle.Left(), rRectangle.Top());
+aPolygon.transform(aMatrix);
+
+rRenderContext.DrawPolyLine(aPolygon);
+}
+
+/** Draw a column chart into the rectangle bounds */
+void drawColumn(vcl::RenderContext& rRenderContext, tools::Rectangle const & 
rRectangle,
+std::vector const & rValues, double nMin, double nMax)
+{
+basegfx::B2DPolygon aPolygon;
+
+double xStep = 0;
+double numberOfSteps = rValues.size();
+double nDelta = nMax - nMin;
+
+double nColumnSize = rRectangle.GetWidth() / numberOfSteps;
+
+double nZero = (0 - nMin) / nDelta;
+double nZeroPosition;
+if (nZero >= 0)
+nZeroPosition = rRectangle.GetHeight() - rRectangle.GetHeight() * 
nZero;
+else
+nZeroPosition = rRectangle.GetHeight();
+
+for (double aValue : rValues)
+{
+if (aValue != 0.0)
+{
+double nP = (aValue - nMin) / nDelta;
+double x = rRectangle.GetWidth() * (xStep / numberOfSteps);
+double y = rRectangle.GetHeight() - rRectangle.GetHeight() * nP;
+
+basegfx::B2DRectangle aRectangle(x, y, x + nColumnSize, 
nZeroPosition);
+aPolygon = basegfx::utils::createPolygonFromRect(aRectangle);
+
+basegfx::B2DHomMatrix aMatrix;
+aMatrix.translate(rRectangle.Left(), rRectangle.Top());
+aPolygon.transform(aMatrix);
+rRenderContext.DrawPolygon(aPolygon);
+}
+xStep++;
+}
+}
+
+void drawSparkline(sc::Sparkline* pSparkline, vcl::RenderContext& 
rRenderContext, ScDocument* pDocument,
+ tools::Rectangle const & rRectangle)
+{
+auto const & rRangeList = pSparkline->getInputRange();
+
+if (rRangeList.empty())
+return;
+
+auto pSparklineGroup = pSparkline->getSparklineGroup();
+
+rRenderContext.SetAntialiasing(AntialiasingFlags::Enable);
+
+

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

2022-04-05 Thread Szymon Kłos (via logerrit)
 sc/source/ui/cctrl/checklistmenu.cxx |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit b7b517109c65757c87aa70b3f49dda18dfd8c1f8
Author: Szymon Kłos 
AuthorDate: Mon Feb 28 19:34:22 2022 +0100
Commit: Szymon Kłos 
CommitDate: Tue Apr 5 09:10:46 2022 +0200

lok: run autofilter without timers

so we are sure we will get correct position

Change-Id: Idd218e19b8b3f3d6da67e325472e11b5661bc3b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130725
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mert Tumer 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131123
Reviewed-by: Szymon Kłos 

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index fee9b9049aed..1a834a7aaccc 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -269,7 +269,10 @@ void ScCheckListMenuControl::queueLaunchSubMenu(size_t 
nPos, ScListSubMenuContro
 
 maOpenTimer.mpSubMenu = pMenu;
 maOpenTimer.mnMenuPos = nPos;
-maOpenTimer.maTimer.Start();
+if (comphelper::LibreOfficeKit::isActive())
+maOpenTimer.maTimer.Invoke();
+else
+maOpenTimer.maTimer.Start();
 }
 
 void ScCheckListMenuControl::queueCloseSubMenu()
@@ -285,7 +288,11 @@ void ScCheckListMenuControl::queueCloseSubMenu()
 maCloseTimer.mnMenuPos = maOpenTimer.mnMenuPos;
 maOpenTimer.mpSubMenu = nullptr;
 maOpenTimer.mnMenuPos = MENU_NOT_SELECTED;
-maCloseTimer.maTimer.Start();
+
+if (comphelper::LibreOfficeKit::isActive())
+maCloseTimer.maTimer.Invoke();
+else
+maCloseTimer.maTimer.Start();
 }
 
 tools::Rectangle ScCheckListMenuControl::GetSubMenuParentRect()


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

2022-03-28 Thread Aron Budea (via logerrit)
 sc/source/ui/view/gridwin4.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit f0e209916df75c24984bf97b3b6d9391855eebc1
Author: Aron Budea 
AuthorDate: Thu Mar 24 22:02:17 2022 +0100
Commit: Aron Budea 
CommitDate: Mon Mar 28 16:55:47 2022 +0200

sc: fix crash in SdrPageView::GetPageWindow()

From crashreport:

SIG   Fatal signal received: SIGSEGV

SdrPageView::GetPageWindow(unsigned int) const
svx/source/svdraw/svdpagv.cxx:84
(anonymous 
namespace)::ScLOKProxyObjectContact::calculateGridOffsetForViewOjectContact(basegfx::B2DVector&,
 sdr::contact::ViewObjectContact const&) const
sc/source/ui/view/gridwin4.cxx:1397
sdr::contact::ViewObjectContact::getGridOffset() const
svx/source/sdr/contact/viewobjectcontact.cxx:463

sdr::contact::ViewObjectContact::getPrimitive2DSequence(sdr::contact::DisplayInfo
 const&) const
include/basegfx/tuple/b2dtuple.hxx:81
sdr::contact::ViewObjectContact::getObjectRange() const
svx/source/sdr/contact/viewobjectcontact.cxx:198

ScLOKProxyObjectContact::calculateGridOffsetForViewOjectContact()
didn't check if PageWindowCount() was non-zero.

Change-Id: I4a00b5b13a277d0805af3076150a952306908e53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132091
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 
(cherry picked from commit c8bfb498ca93b990069d7bcd09cb1240d8c8faee)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132053
Reviewed-by: Aron Budea 

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 7480fe0e515b..46525e96b164 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1434,7 +1434,9 @@ namespace
 if (!pPageView)
 return;
 
-SdrPageWindow* pSdrPageWindow = pPageView->GetPageWindow(0);
+SdrPageWindow* pSdrPageWindow = nullptr;
+if (pPageView->PageWindowCount() > 0)
+pSdrPageWindow = pPageView->GetPageWindow(0);
 if (!pSdrPageWindow)
 return;
 


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

2022-03-23 Thread Stephan Bergmann (via logerrit)
 sc/source/core/data/bcaslot.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 46edb26ddfa6e37da9a3be16bf2f25cbe4aff417
Author: Stephan Bergmann 
AuthorDate: Thu Feb 10 13:41:26 2022 +0100
Commit: Aron Budea 
CommitDate: Wed Mar 23 20:51:42 2022 +0100

-Werror=type-limits

> 
/home/tdf/lode/jenkins/workspace/lo_tb_master_linux_dbg/sc/source/core/data/bcaslot.cxx:647:25:
 error: comparison of unsigned expression >= 0 is always true 
[-Werror=type-limits]
>  assert(slot >= 0 && slot < mnBcaSlots);
> ~^~~~

(), where 
slot is of
type SCSIZE, which is a typedef for size_t (sc/inc/address.hxx)

Change-Id: I52cfa8b746791d4bd43be9a9d16cda992319c694
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129781
Reviewed-by: Julien Nabet 
Reviewed-by: Stephan Bergmann 
Tested-by: Jenkins
(cherry picked from commit 405a7a09558ad17642808cc3739ab202f86bea0c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131982
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Aron Budea 

diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx
index dbf9c8a59fff..4080c4507528 100644
--- a/sc/source/core/data/bcaslot.cxx
+++ b/sc/source/core/data/bcaslot.cxx
@@ -643,7 +643,7 @@ inline SCSIZE ScBroadcastAreaSlotMachine::ComputeSlotOffset(
 + static_cast(nRow - rSD.nStartRow) / rSD.nSliceRow
 + rSD.nCumulatedCol
 + static_cast(nCol - rSD.nStartCol) / rSD.nSliceCol * 
mnBcaSlotsCol;
-assert(slot >= 0 && slot < mnBcaSlots);
+assert(slot < mnBcaSlots);
 return slot;
 }
 }


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

2022-03-18 Thread Szymon Kłos (via logerrit)
 sc/source/ui/view/cellsh2.cxx |   49 ++
 1 file changed, 49 insertions(+)

New commits:
commit 845585103fbde57fe41a969168e3611ebf5efccb
Author: Szymon Kłos 
AuthorDate: Mon Mar 14 21:55:59 2022 +0100
Commit: Szymon Kłos 
CommitDate: Fri Mar 18 09:06:25 2022 +0100

tdf#147761 record sort command in macros

fixes regression introduced in:

commit  70b81e74d2a14308e1897d840c681404225d328a
author  Szymon Kłos  Tue Jul 21 11:40:22 2020 
+0200

SfxRequest's Done method records the action. It has to be called.

Change-Id: I32529fa11febca3d3829b4afd2cd4e6dd359bf74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131484
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 
(cherry picked from commit eca978841816f833616b4c2334e65aa976a9fb61)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131601
Tested-by: Szymon Kłos 

diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 0bed3b16141f..8ff829326597 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -526,6 +526,55 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
 // subtotal when needed new
 
 pTabViewShell->UISort( rOutParam );
+
+SfxViewFrame* pViewFrm = 
pTabViewShell->GetViewFrame();
+if (pViewFrm)
+{
+SfxRequest aRequest(pViewFrm, 
SID_SORT);
+
+if ( rOutParam.bInplace )
+{
+aRequest.AppendItem( SfxBoolItem( 
SID_SORT_BYROW,
+rOutParam.bByRow ) );
+aRequest.AppendItem( SfxBoolItem( 
SID_SORT_HASHEADER,
+rOutParam.bHasHeader ) );
+aRequest.AppendItem( SfxBoolItem( 
SID_SORT_CASESENS,
+rOutParam.bCaseSens ) );
+aRequest.AppendItem( SfxBoolItem( 
SID_SORT_NATURALSORT,
+rOutParam.bNaturalSort 
) );
+aRequest.AppendItem( SfxBoolItem( 
SID_SORT_INCCOMMENTS,
+
rOutParam.aDataAreaExtras.mbCellNotes ) );
+aRequest.AppendItem( SfxBoolItem( 
SID_SORT_INCIMAGES,
+
rOutParam.aDataAreaExtras.mbCellDrawObjects ) );
+aRequest.AppendItem( SfxBoolItem( 
SID_SORT_ATTRIBS,
+
rOutParam.aDataAreaExtras.mbCellFormats ) );
+sal_uInt16 nUser = 
rOutParam.bUserDef ? ( rOutParam.nUserIndex + 1 ) : 0;
+aRequest.AppendItem( 
SfxUInt16Item( SID_SORT_USERDEF, nUser ) );
+if ( 
rOutParam.maKeyState[0].bDoSort )
+{
+aRequest.AppendItem( 
SfxInt32Item( FN_PARAM_1,
+
rOutParam.maKeyState[0].nField + 1 ) );
+aRequest.AppendItem( 
SfxBoolItem( FN_PARAM_2,
+
rOutParam.maKeyState[0].bAscending ) );
+}
+if ( 
rOutParam.maKeyState[1].bDoSort )
+{
+aRequest.AppendItem( 
SfxInt32Item( FN_PARAM_3,
+
rOutParam.maKeyState[1].nField + 1 ) );
+aRequest.AppendItem( 
SfxBoolItem( FN_PARAM_4,
+
rOutParam.maKeyState[1].bAscending ) );
+}
+if ( 
rOutParam.maKeyState[2].bDoSort )
+{
+aRequest.AppendItem( 
SfxInt32Item( FN_PARAM_5,
+
rOutParam.maKeyState[2].nField + 1 ) );
+aRequest.AppendItem( 
SfxBoolItem( FN_PARAM_6,
+
rOutParam.maKeyState[2].bAscending ) );
+}
+}
+
+

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

2022-03-16 Thread Szymon Kłos (via logerrit)
 sc/source/ui/view/tabvwsh2.cxx |   11 +--
 svx/sdi/svx.sdi|2 +-
 2 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit c65ec2706aac6064d66715141c840b7a55811bb7
Author: Szymon Kłos 
AuthorDate: Wed Mar 9 21:32:35 2022 +0100
Commit: Szymon Kłos 
CommitDate: Wed Mar 16 12:06:26 2022 +0100

lok: insert textbox directly in Calc

Change-Id: I3ae00b255dfbaa34ab8d973356d12dfd0f71d345
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131267
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mert Tumer 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131641
Tested-by: Szymon Kłos 
Reviewed-by: Szymon Kłos 

diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx
index 98826e80d4d1..1c74f9767515 100644
--- a/sc/source/ui/view/tabvwsh2.cxx
+++ b/sc/source/ui/view/tabvwsh2.cxx
@@ -265,6 +265,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
 case SID_DRAW_TEXT_MARQUEE:
 case SID_DRAW_NOTEEDIT:
 pTabView->SetDrawFuncPtr(new FuText(*this, pWin, pView, pDoc, 
aNewReq));
+bCreateDirectly = comphelper::LibreOfficeKit::isActive();
 break;
 
 case SID_FM_CREATE_CONTROL:
@@ -335,7 +336,6 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
 }
 else
 {
-GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, 
SfxCallMode::ASYNCHRON);
 ScViewData& rViewData = GetViewData();
 tools::Long nLayoutSign = 
rViewData.GetDocument().IsLayoutRTL(rViewData.GetTabNo()) ? -1 : 1;
 aInsertPos = rViewData.getLOKVisibleArea().Center();
@@ -371,13 +371,20 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
 // insert into page
 pView->InsertObjectAtView(pObj.release(), *pPageView);
 
-if ( nNewId == SID_DRAW_CAPTION || nNewId == SID_DRAW_CAPTION_VERTICAL )
+switch ( nNewId )
 {
+case SID_DRAW_CAPTION:
+case SID_DRAW_CAPTION_VERTICAL:
+case SID_DRAW_TEXT:
+case SID_DRAW_TEXT_VERTICAL:
 //  use KeyInput to start edit mode (FuText is created).
 //  For FuText objects, edit mode is handled within 
CreateDefaultObject.
 //  KEY_F2 is handled in FuDraw::KeyInput.
 
 pFuActual->KeyInput( KeyEvent( 0, vcl::KeyCode( KEY_F2 ) ) );
+break;
+default:
+break;
 }
 }
 
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index f0314fe63360..d4a4d6eee905 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -8520,7 +8520,7 @@ SfxBoolItem Text SID_ATTR_CHAR
 
 
 SfxBoolItem DrawText SID_DRAW_TEXT
-
+(SfxBoolItem CreateDirectly FN_PARAM_1)
 [
 AutoUpdate = TRUE,
 FastCall = FALSE,


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

2022-03-14 Thread Szymon Kłos (via logerrit)
 sc/source/ui/view/gridwin.cxx  |8 +---
 sc/source/ui/view/gridwin2.cxx |3 ++-
 sc/source/ui/view/tabview3.cxx |4 +++-
 vcl/source/window/dockwin.cxx  |5 -
 4 files changed, 14 insertions(+), 6 deletions(-)

New commits:
commit 06de346ffb712e43c9e1b9527a08c42349e78598
Author: Szymon Kłos 
AuthorDate: Fri Feb 25 13:22:36 2022 +0100
Commit: Szymon Kłos 
CommitDate: Mon Mar 14 16:18:35 2022 +0100

lok: send logic autofilter position

we need to show popup relative to the grid window

Change-Id: Ib0cf66d2c0422b765a3b8035d5499b45e83f768d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130528
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mert Tumer 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131122
Tested-by: Szymon Kłos 
Reviewed-by: Szymon Kłos 

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index eced196db277..d050c59175fe 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -895,7 +895,7 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW 
nRow)
 nSizeX = nSizeX / fZoomX;
 nSizeY = nSizeY / fZoomY;
 }
-tools::Rectangle aCellRect(OutputToScreenPixel(aPos), Size(nSizeX, 
nSizeY));
+tools::Rectangle aCellRect(bLOKActive ? aPos : OutputToScreenPixel(aPos), 
Size(nSizeX, nSizeY));
 
 ScDBData* pDBData = rDoc.GetDBAtCursor(nCol, nRow, nTab, 
ScDBDataPortion::AREA);
 if (!pDBData)
@@ -1207,7 +1207,8 @@ void ScGridWindow::LaunchPageFieldMenu( SCCOL nCol, SCROW 
nRow )
 Point aScrPos;
 Size aScrSize;
 getCellGeometry(aScrPos, aScrSize, mrViewData, nCol, nRow, eWhich);
-DPLaunchFieldPopupMenu(OutputToScreenPixel(aScrPos), aScrSize, 
ScAddress(nCol-1, nRow, nTab), pDPObj);
+bool bLOK = comphelper::LibreOfficeKit::isActive();
+DPLaunchFieldPopupMenu(bLOK ? aScrPos : OutputToScreenPixel(aScrPos), 
aScrSize, ScAddress(nCol-1, nRow, nTab), pDPObj);
 }
 
 void ScGridWindow::LaunchDPFieldMenu( SCCOL nCol, SCROW nRow )
@@ -1220,7 +1221,8 @@ void ScGridWindow::LaunchDPFieldMenu( SCCOL nCol, SCROW 
nRow )
 Point aScrPos;
 Size aScrSize;
 getCellGeometry(aScrPos, aScrSize, mrViewData, nCol, nRow, eWhich);
-DPLaunchFieldPopupMenu(OutputToScreenPixel(aScrPos), aScrSize, 
ScAddress(nCol, nRow, nTab), pDPObj);
+bool bLOK = comphelper::LibreOfficeKit::isActive();
+DPLaunchFieldPopupMenu(bLOK ? aScrPos : OutputToScreenPixel(aScrPos), 
aScrSize, ScAddress(nCol, nRow, nTab), pDPObj);
 }
 
 void ScGridWindow::ShowFilterMenu(weld::Window* pParent, const 
tools::Rectangle& rCellRect, bool bLayoutRTL)
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index 7071bd384f4b..4e497e80d664 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -343,6 +343,7 @@ bool ScGridWindow::DPTestFieldPopupArrow(
 const MouseEvent& rMEvt, const ScAddress& rPos, const ScAddress& rDimPos, 
ScDPObject* pDPObj)
 {
 bool bLayoutRTL = mrViewData.GetDocument().IsLayoutRTL( 
mrViewData.GetTabNo() );
+bool bLOK = comphelper::LibreOfficeKit::isActive();
 
 // Get the geometry of the cell.
 Point aScrPos = mrViewData.GetScrPos(rPos.Col(), rPos.Row(), eWhich);
@@ -361,7 +362,7 @@ bool ScGridWindow::DPTestFieldPopupArrow(
 if (aRect.Contains(rMEvt.GetPosPixel()))
 {
 // Mouse cursor inside the popup arrow box.  Launch the field menu.
-DPLaunchFieldPopupMenu(OutputToScreenPixel(aScrPos), aScrSize, 
rDimPos, pDPObj);
+DPLaunchFieldPopupMenu(bLOK ? aScrPos : OutputToScreenPixel(aScrPos), 
aScrSize, rDimPos, pDPObj);
 return true;
 }
 
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index c2cd024fecac..3d9d0e3996be 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2618,7 +2618,9 @@ void ScTabView::DoDPFieldPopup(std::u16string_view 
rPivotTableName, sal_Int32 nD
 
 pDPObject->BuildAllDimensionMembers();
 
-Point aScreenPoint = pWin->OutputToScreenPixel(pWin->LogicToPixel(aPoint));
+Point aPos = pWin->LogicToPixel(aPoint);
+bool bLOK = comphelper::LibreOfficeKit::isActive();
+Point aScreenPoint = bLOK ? aPos : pWin->OutputToScreenPixel(aPos);
 Size aScreenSize = pWin->LogicToPixel(aSize);
 
 pWin->DPLaunchFieldPopupMenu(aScreenPoint, aScreenSize, nDimensionIndex, 
pDPObject);
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index 99c4f1bba398..f94a04cbb1d8 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -923,7 +924,9 @@ Point DockingWindow::GetFloatingPos() const
 aData.SetMask( WindowStateMask::Pos );
 pWrapper->mpFloatWin->GetWindowStateData( aData );
 Point aPos( aData.GetX(), aData.GetY() );
-aPos = 

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

2022-02-13 Thread Aron Budea (via logerrit)
 sc/source/filter/oox/workbookhelper.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 003c8b9f89be4f99c2f23cb1d49c08f8d9562221
Author: Aron Budea 
AuthorDate: Fri Oct 19 20:56:35 2018 +0200
Commit: Andras Timar 
CommitDate: Sun Feb 13 12:25:10 2022 +0100

[cp] Add another known good generator.

Change-Id: I05a9aff0d1bddf0efd2491f09fe0fbf7144e8b4d

diff --git a/sc/source/filter/oox/workbookhelper.cxx 
b/sc/source/filter/oox/workbookhelper.cxx
index 322986e9ba25..15d019dc8c05 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -554,7 +554,7 @@ void WorkbookGlobals::initialize()
 aCalcConfig.SetStringRefSyntax( formula::FormulaGrammar::CONV_XL_A1 ) ;
 mpDoc->SetCalcConfig(aCalcConfig);
 }
-else if (aGenerator.startsWithIgnoreAsciiCase("LibreOffice"))
+else if (aGenerator.startsWithIgnoreAsciiCase("LibreOffice") || 
aGenerator.startsWithIgnoreAsciiCase("Collabora"))
 {
 mbGeneratorKnownGood = true;
 }