[Libreoffice-commits] core.git: sc/inc sc/source

2023-12-05 Thread Henry Castro (via logerrit)
 sc/inc/globstr.hrc |1 +
 sc/source/ui/view/viewfunc.cxx |5 +
 2 files changed, 6 insertions(+)

New commits:
commit fd11b63244f784b336690d9096cd3f820cdbb9ee
Author: Henry Castro 
AuthorDate: Mon Dec 4 10:33:01 2023 -0400
Commit: Caolán McNamara 
CommitDate: Tue Dec 5 12:59:14 2023 +0100

sc: show a message dialog if insert cells fail

Use case, go to the max row and insert a row.

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

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index e8e45fc01b2e..8b07dc508edd 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -566,6 +566,7 @@
 #define STR_UNDO_EDIT_SPARKLINE NC_("STR_UNDO_EDIT_SPARKLINE", 
"Edit Sparkline")
 #define STR_UNDO_THEME_CHANGE   NC_("STR_UNDO_THEME_CHANGE", 
"Theme Change")
 #define STR_UNDO_THEME_COLOR_CHANGE 
NC_("STR_UNDO_THEME_COLOR_CHANGE", "Theme Color Change")
+#define STR_ERR_INSERT_CELLSNC_("STR_ERR_INSERT_CELLS", 
"Failed to insert cells")
 
 #endif
 
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 98d2a1ebbe42..0b8b0865f0fc 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1786,6 +1786,11 @@ bool ScViewFunc::InsertCells( InsCellCmd eCmd, bool 
bRecord, bool bPartOfPaste )
 true /* 
bGroups */, GetViewData().GetTabNo());
 }
 }
+else
+{
+ErrorMessage(STR_ERR_INSERT_CELLS);
+}
+
 OUString aStartAddress =  aRange.aStart.GetColRowString();
 OUString aEndAddress = aRange.aEnd.GetColRowString();
 collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}}, 
"INSERT_CELLS");


[Libreoffice-commits] core.git: sc/inc sc/source

2023-11-29 Thread Henry Castro (via logerrit)
 sc/inc/column.hxx   |2 +
 sc/source/core/data/column3.cxx |   60 
 sc/source/core/data/table3.cxx  |6 
 3 files changed, 68 insertions(+)

New commits:
commit 8b2369236dea7d6863c2df3d4ce5e356c9c8010c
Author: Henry Castro 
AuthorDate: Thu Nov 23 11:49:15 2023 -0400
Commit: Henry Castro 
CommitDate: Wed Nov 29 12:05:25 2023 +0100

sc: fix back color filter entries

The function "GetFilterEntries" iterates only that contains cell
data value entries, the background color filter feature requires
to iterate background color attribute which is not stored in multi
type vector cells.

Signed-off-by: Henry Castro 
Change-Id: I372db48d2399f62712f642eefdbfea8885b09f58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159864
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 826eae46095b2184554565bab1792e96964a720f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159905
Tested-by: Jenkins

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 26ef79da2e6d..cefd03fd388e 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -599,6 +599,8 @@ public:
 sc::ColumnBlockConstPosition& rBlockPos, SCROW nStartRow, SCROW 
nEndRow,
 ScFilterEntries& rFilterEntries, bool bFiltering, bool bFilteredRow );
 
+void GetBackColorFilterEntries(SCROW nRow1, SCROW nRow2, ScFilterEntries& 
rFilterEntries );
+
 bool GetDataEntries( SCROW nRow, std::set& rStrings) const;
 
 void UpdateInsertTabAbs(SCTAB nNewPos);
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 054e334edb06..a0b0c639a003 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2701,6 +2701,66 @@ void ScColumn::GetFilterEntries(
 sc::ParseAll(rBlockPos.miCellPos, maCells, nStartRow, nEndRow, aFunc, 
aFunc);
 }
 
+void ScColumn::GetBackColorFilterEntries(SCROW nRow1, SCROW nRow2, 
ScFilterEntries& rFilterEntries)
+{
+Color aBackColor;
+bool bCondBackColor = false;
+ScAddress aCell(GetCol(), 0, GetTab());
+ScConditionalFormat* pCondFormat = nullptr;
+
+const SfxItemSet* pCondSet = nullptr;
+const SvxBrushItem* pBrush = nullptr;
+const ScPatternAttr* pPattern = nullptr;
+const ScColorScaleFormat* pColFormat = nullptr;
+
+if (!GetDoc().ValidRow(nRow1) || !GetDoc().ValidRow(nRow2))
+return;
+
+while (nRow1 <= nRow2)
+{
+aCell.SetRow(nRow1);
+pPattern = GetDoc().GetPattern(aCell.Col(), aCell.Row(), aCell.Tab());
+if (pPattern)
+{
+if 
(!pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData().empty())
+{
+pCondSet = GetDoc().GetCondResult(GetCol(), nRow1, GetTab());
+pBrush = >GetItem(ATTR_BACKGROUND, pCondSet);
+aBackColor = pBrush->GetColor();
+bCondBackColor = true;
+}
+}
+
+pCondFormat = GetDoc().GetCondFormat(aCell.Col(), aCell.Row(), 
aCell.Tab());
+if (pCondFormat)
+{
+for (size_t nFormat = 0; nFormat < pCondFormat->size(); nFormat++)
+{
+auto aEntry = pCondFormat->GetEntry(nFormat);
+if (aEntry->GetType() == ScFormatEntry::Type::Colorscale)
+{
+pColFormat = static_cast(aEntry);
+std::optional oColor = pColFormat->GetColor(aCell);
+if (oColor)
+{
+aBackColor = *oColor;
+bCondBackColor = true;
+}
+}
+}
+}
+
+if (!bCondBackColor)
+{
+pBrush = GetDoc().GetAttr(aCell, ATTR_BACKGROUND);
+aBackColor = pBrush->GetColor();
+}
+
+rFilterEntries.addBackgroundColor(aBackColor);
+nRow1++;
+}
+}
+
 namespace {
 
 /**
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 71cf80bcef38..359cc5dcc4f5 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -3018,6 +3018,12 @@ void ScTable::GetFilterEntries( SCCOL nCol, SCROW nRow1, 
SCROW nRow2, ScFilterEn
 sc::ColumnBlockConstPosition aBlockPos;
 aCol[nCol].InitBlockPosition(aBlockPos);
 aCol[nCol].GetFilterEntries(aBlockPos, nRow1, nRow2, rFilterEntries, 
bFiltering, false /*bFilteredRow*/);
+
+SCROW nLastRow = aBlockPos.miCellPos->position;
+if (nLastRow < nRow2)
+{
+aCol[nCol].GetBackColorFilterEntries(nLastRow, nRow2, rFilterEntries);
+}
 }
 
 void ScTable::GetFilteredFilterEntries(


[Libreoffice-commits] core.git: sc/inc sc/source svl/source

2023-11-19 Thread Armin Le Grand (allotropia) (via logerrit)
 sc/inc/patattr.hxx   |6 -
 sc/source/core/data/attarray.cxx |   13 +++
 sc/source/core/data/global.cxx   |   12 +++
 sc/source/core/data/patattr.cxx  |  128 +++
 svl/source/items/itemset.cxx |  108 
 5 files changed, 152 insertions(+), 115 deletions(-)

New commits:
commit f566a73adcf170d103b0561c7ea2871596af7142
Author: Armin Le Grand (allotropia) 
AuthorDate: Fri Nov 17 17:17:23 2023 +0100
Commit: Armin Le Grand 
CommitDate: Sun Nov 19 12:57:54 2023 +0100

Fix performance regression with ScPatternAttr/SC

Due to the paradigm item change the test
  make CppunitTest_sc_tablesheetobj
with CPPUNIT_TEST_NAME
  sc_apitest::ScTableSheetObj::testSheetCellRangeProperties
got much slower. Unfortunately it did not break, so got unnoted.

I took a look now. First I intended to add some hashing in an
std::unordered_set using that hash values at ScPatternAttr, but
that is not even possible due to other data in that item that needs
to be compared. I had the impression that it was 'somehow' hashed
before, but after debugging the version before that change I
noted that also the list of existing items was linearly compared
to the new entry, using the operator==.
Thus the problem was not due to not hashing, but due to the
ScPatternAttr::operator==. That uses the hash (not changed),
but no longer finds equal entries.
This is because the hash code is made up from the SfxPoolItemPtrs
in the SfxItemSet, so when all are equal we can be sure the SfxItemSet
content is equal.
To use this the other way around is *not* correct: Even with
not all ptrs equal the SfxItemSets can still be equal, simply
by one SfxItemSet using another, but identical incarnation of
an item. Thuis means that ScPatternAttr::operator== does not
detect all cases of equality.
This worked in most cases before since most items were
'pooled' and thus much effort was used to ensure their uniqueness,
but even before the paradigm item change an item type could be
flagged as non-poolable. In that case, this already could fail
but with no too bad consequences (just one more copy of
an ScPatternAttr would stay).
So I fixed that mainly in adapting and optimizing
ScPatternAttr::operator==. The results are (same machine, same
compiler, dbg version, metioned test):

Version before item paradigm change:
user0m50,778s

Version after item paradigm change:
user20m13,944s

Version with memcmp:
user0m48,845s

Version with hash:
user0m48,710s

Since that hash does nothing else than to buffer the comparison of
those item pointers I just tried to use memcmp instead, as is already
used in other places (same file, ScPatternAttr::FastEqualPatternSets,
also SfxItemSet::operator==). As can be seen above it makes practically
no difference (memcomp even slightly faster).
Since that hash is only used in ScPatternAttr::operator== and is same
speed (memcomp linearly compares 56 SfxPoolItem ptrs) I decided to
remove it. It needs quite some spaces to be reset and re-calculated
which are not needed anymore. The calculation is based on dividing
the number of items by 4, so we are good with 56, but if someone has/
will adapt the items used by ScPatternAttr it is easy to forget to
adapt this, and not easy to change the alghorithm  when it's not a
multiple of 4.

I also optimized/overhauled SfxItemSet::operator== (or better: the
SfxItemSet::Equals used by it). It is now better readable, too.

I also adapted ScAttrArray::AddCondFormat to not always incarnate/
delete ScPatternAttr instances, only when needed. This also helps
a bit and could be done in more places.

All in all it is really necessary to cleanup SC's usage of
ScPatternAttr - there are quite some possibilities to make that
cleaner and faster. In principle it's a huge 'compromize' to use
item functionailty to have a possibly 'cheap' maximum shared
SfxItemSet at a Cell.

Decided to make SfxItemSet::operator== even faster for the case
of unequal ranges by iterating over ranges of local SfxItemSet
and incremented offset. Still accesses to 2nd SfxItemSet will be
the expensive ones using the iterated WhichID.

Added two more things to SfxItemSet::operator==: We can return
early when both have no items set. For the unequal-ranges compare
I added an early-exit when Count() items were compared.

Looked at the errors that indeed do trigger the assert in
ScPatternAttr::operator== and hint to incarnations of ScPatternAttr
that do not use the needed range ATTR_PATTERN_START, ATTR_PATTERN_END.
Hunted down to come from ScViewFunc::ApplyAttributes and there from
some Dialogs, so seems some SC 

[Libreoffice-commits] core.git: sc/inc sc/source

2023-11-11 Thread Henry Castro (via logerrit)
 sc/inc/dbdata.hxx|1 +
 sc/inc/document.hxx  |7 +++
 sc/inc/table.hxx |3 +++
 sc/source/core/data/document.cxx |7 +++
 sc/source/core/data/table4.cxx   |   34 ++
 sc/source/core/tool/dbdata.cxx   |   17 +
 sc/source/ui/view/gridwin.cxx|1 +
 sc/source/ui/view/tabvwshc.cxx   |1 +
 8 files changed, 71 insertions(+)

New commits:
commit 4abe6c83e76f825319e8b2a0c0b8b8e92177da65
Author: Henry Castro 
AuthorDate: Mon Nov 6 07:18:48 2023 -0400
Commit: Caolán McNamara 
CommitDate: Sat Nov 11 20:27:29 2023 +0100

sc: extend backcolor area

If the filter background color is selected,
the automatic selection area should include,
the attribute of background cell color too.

Signed-off-by: Henry Castro 
Change-Id: I341c602247e7f71e3c9665e1b594177d8f5553b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158991
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit 768433f07873eb608837630f85e7e1b375239fca)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159238
Tested-by: Jenkins

diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index 482c55bc6aa4..df235ec52619 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -221,6 +221,7 @@ public:
 SCCOL nDx, SCROW nDy, SCTAB nDz);
 
 void ExtendDataArea(const ScDocument& rDoc);
+void ExtendBackColorArea(const ScDocument& rDoc);
 void CalcSaveFilteredCount(SCSIZE nNonFilteredRowCount);
 void GetFilterSelCount(SCSIZE& nSelected, SCSIZE& nTotal);
 
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 1cff7a3ce4e4..11b65e9262c0 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1512,6 +1512,13 @@ public:
  SCCOL& rEndCol, SCROW& rEndRow,
  bool bIncludeOld, bool bOnlyDown 
) const;
 
+/**
+ * Return the extended area containing at least all contiguous cells
+ * having background color.
+ */
+SC_DLLPUBLIC void GetBackColorArea( SCTAB nTab, SCCOL& rStartCol, SCROW& 
rStartRow,
+SCCOL& rEndCol, SCROW& rEndRow ) const;
+
 /**
  * Returns true if there is a non-empty subrange in the range given as 
input.
  * In that case it also modifies rRange to largest subrange that does not
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 68b4c614c68b..8907bde5a150 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -641,6 +641,9 @@ public:
 voidGetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& 
rEndCol, SCROW& rEndRow,
  bool bIncludeOld, bool bOnlyDown ) const;
 
+voidGetBackColorArea( SCCOL& rStartCol, SCROW& rStartRow,
+  SCCOL& rEndCol, SCROW& rEndRow ) const;
+
 boolGetDataAreaSubrange( ScRange& rRange ) const;
 
 boolShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, 
SCROW& rStartRow,
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 6225e92781b9..0b4ae5ca0da8 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -1081,6 +1081,13 @@ void ScDocument::GetDataArea( SCTAB nTab, SCCOL& 
rStartCol, SCROW& rStartRow,
 pTable->GetDataArea( rStartCol, rStartRow, rEndCol, rEndRow, 
bIncludeOld, bOnlyDown );
 }
 
+void ScDocument::GetBackColorArea( SCTAB nTab, SCCOL& rStartCol, SCROW& 
rStartRow,
+   SCCOL& rEndCol, SCROW& rEndRow ) const
+{
+if (ValidTab(nTab) && nTab < static_cast (maTabs.size()) && 
maTabs[nTab])
+maTabs[nTab]->GetBackColorArea( rStartCol, rStartRow, rEndCol, rEndRow 
);
+}
+
 bool ScDocument::GetDataAreaSubrange(ScRange& rRange) const
 {
 SCTAB nTab = rRange.aStart.Tab();
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index d8a4cf584132..62b9dbb9e006 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1293,6 +1294,39 @@ void  ScTable::FillSparkline(bool bVertical, SCCOLROW 
nFixed,
 }
 }
 
+void ScTable::GetBackColorArea(SCCOL& rStartCol, SCROW& /*rStartRow*/,
+   SCCOL& rEndCol, SCROW& rEndRow ) const
+{
+bool bExtend;
+const SvxBrushItem* pDefBackground = 
()->GetDefaultItem(ATTR_BACKGROUND);
+
+rStartCol = std::min(rStartCol, aCol.size() - 1);
+rEndCol = std::min(rEndCol, aCol.size() - 1);
+
+do
+{
+bExtend = false;
+
+if (rEndRow < rDocument.MaxRow())
+{
+for (SCCOL nCol = rStartCol; nCol <= rEndCol; ++nCol)
+{
+const ScPatternAttr* pPattern = 

[Libreoffice-commits] core.git: sc/inc sc/source

2023-11-10 Thread Andreas Heinisch (via logerrit)
 sc/inc/viewopti.hxx|2 ++
 sc/source/core/tool/viewopti.cxx   |1 +
 sc/source/ui/inc/mvtabdlg.hxx  |3 ---
 sc/source/ui/miscdlgs/mvtabdlg.cxx |   16 ++--
 4 files changed, 13 insertions(+), 9 deletions(-)

New commits:
commit bb79936ec808712f53bc48663a485875571ba643
Author: Andreas Heinisch 
AuthorDate: Fri Nov 10 12:00:46 2023 +0100
Commit: Andreas Heinisch 
CommitDate: Fri Nov 10 16:59:29 2023 +0100

tdf#96854 - De-static-ize last used option for copy/move sheet

Change-Id: Iafb12b51f166f9485f1658c406a98e5db5b246ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159292
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx
index 489a3e8c81da..beb0530e88a5 100644
--- a/sc/inc/viewopti.hxx
+++ b/sc/inc/viewopti.hxx
@@ -45,6 +45,8 @@ enum ScViewOption
 VOPT_ANCHOR,
 VOPT_PAGEBREAKS,
 VOPT_SUMMARY,
+// tdf#96854 - move/copy sheet dialog: last used option for action (true: 
copy, false: move)
+VOPT_COPY_SHEET,
 VOPT_THEMEDCURSOR,
 };
 
diff --git a/sc/source/core/tool/viewopti.cxx b/sc/source/core/tool/viewopti.cxx
index 80d8915effb9..a91f0cef8bf9 100644
--- a/sc/source/core/tool/viewopti.cxx
+++ b/sc/source/core/tool/viewopti.cxx
@@ -107,6 +107,7 @@ void ScViewOptions::SetDefaults()
 aOptArr[ VOPT_ANCHOR   ] = true;
 aOptArr[ VOPT_PAGEBREAKS   ] = true;
 aOptArr[ VOPT_SUMMARY  ] = true;
+aOptArr[ VOPT_COPY_SHEET   ] = false;
 aOptArr[ VOPT_THEMEDCURSOR ] = false;
 
 aModeArr[VOBJ_TYPE_OLE ]  = VOBJ_MODE_SHOW;
diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx
index 665d3cd46085..c6e89ab9fed0 100644
--- a/sc/source/ui/inc/mvtabdlg.hxx
+++ b/sc/source/ui/inc/mvtabdlg.hxx
@@ -61,9 +61,6 @@ private:
 boolbRenameTable:1;
 boolmbEverEdited:1;
 
-// tdf#96854 - remember last used option for copy/move sheet
-static bool mbRememeberedCopy;
-
 std::unique_ptr m_xBtnMove;
 std::unique_ptr m_xBtnCopy;
 std::unique_ptr m_xFtDoc;
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx 
b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index 12c4e4d54bcc..afacdc48b46e 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -26,9 +26,7 @@
 #include 
 #include 
 #include 
-
-// tdf#96854 - remember last used option for copy/move sheet
-bool ScMoveTableDlg::mbRememeberedCopy = false;
+#include 
 
 ScMoveTableDlg::ScMoveTableDlg(weld::Window* pParent, OUString aDefault)
 : GenericDialogController(pParent, "modules/scalc/ui/movecopysheet.ui", 
"MoveCopySheetDialog")
@@ -193,8 +191,11 @@ void ScMoveTableDlg::Init()
 m_xEdTabName->connect_changed(LINK(this, ScMoveTableDlg, CheckNameHdl));
 
 // tdf#96854 - remember last used option for copy/move sheet
-m_xBtnMove->set_active(!mbRememeberedCopy);
-m_xBtnCopy->set_active(mbRememeberedCopy);
+const bool bIsCopyActive
+= 
ScTabViewShell::GetActiveViewShell()->GetViewData().GetOptions().GetOption(
+VOPT_COPY_SHEET);
+m_xBtnMove->set_active(!bIsCopyActive);
+m_xBtnCopy->set_active(bIsCopyActive);
 m_xEdTabName->set_sensitive(false);
 m_xFtWarn->hide();
 InitDocListBox();
@@ -250,7 +251,10 @@ void ScMoveTableDlg::SetOkBtnLabel()
 // tdf#139464 Write "Copy" or "Move" on OK button
 m_xBtnOk->set_label(bIsCopyActive ? m_xBtnCopy->get_label() : 
m_xBtnMove->get_label());
 // tdf#96854 - remember last used option for copy/move sheet
-mbRememeberedCopy = bIsCopyActive;
+ScTabViewShell* pScViewShell = ScTabViewShell::GetActiveViewShell();
+ScViewOptions aViewOpt(pScViewShell->GetViewData().GetOptions());
+aViewOpt.SetOption(VOPT_COPY_SHEET, bIsCopyActive);
+pScViewShell->GetViewData().SetOptions(aViewOpt);
 }
 
 // Handler:


[Libreoffice-commits] core.git: sc/inc sc/source

2023-11-09 Thread Noel Grandin (via logerrit)
 sc/inc/compiler.hxx  |4 ++--
 sc/source/core/tool/compiler.cxx |6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 4d263b48a1353804816a55433f2ee90e96be1e32
Author: Noel Grandin 
AuthorDate: Wed Nov 8 13:32:17 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 9 17:53:14 2023 +0100

loplugin:fieldcast in ScCompiler::TableRefEntry

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

diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index fbf5073743e1..9cff881db62d 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -307,9 +307,9 @@ private:
 
 struct TableRefEntry
 {
-ScTokenRef  mxToken;
+boost::intrusive_ptr mxToken;
 sal_uInt16  mnLevel;
-TableRefEntry( formula::FormulaToken* p ) : mxToken(p), mnLevel(0) {}
+TableRefEntry( ScTableRefToken* p ) : mxToken(p), mnLevel(0) {}
 };
 std::vector maTableRefs; /// "stack" of currently 
active ocTableRef tokens
 
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 2a5491f4666b..63b1f0969225 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3999,7 +3999,7 @@ bool ScCompiler::ParseTableRefItem( const OUString& rName 
)
 {
 // Only called when there actually is a current TableRef, hence
 // accessing maTableRefs.back() is safe.
-ScTableRefToken* p = 
dynamic_cast(maTableRefs.back().mxToken.get());
+ScTableRefToken* p = maTableRefs.back().mxToken.get();
 assert(p);  // not a ScTableRefToken can't be
 
 switch ((*iLook).second)
@@ -4067,7 +4067,7 @@ bool ScCompiler::ParseTableRefColumn( const OUString& 
rName )
 {
 // Only called when there actually is a current TableRef, hence
 // accessing maTableRefs.back() is safe.
-ScTableRefToken* p = 
dynamic_cast(maTableRefs.back().mxToken.get());
+ScTableRefToken* p = maTableRefs.back().mxToken.get();
 assert(p);  // not a ScTableRefToken can't be
 
 ScDBData* pDBData = rDoc.GetDBCollection()->getNamedDBs().findByIndex( 
p->GetIndex());
@@ -4918,7 +4918,7 @@ std::unique_ptr ScCompiler::CompileString( 
const OUString& rFormul
 const FormulaToken* pPrev = pArr->PeekPrev( nIdx);
 if (pPrev && pPrev->GetOpCode() == ocDBArea)
 {
-FormulaToken* pTableRefToken = new ScTableRefToken( 
pPrev->GetIndex(), ScTableRefToken::TABLE);
+ScTableRefToken* pTableRefToken = new ScTableRefToken( 
pPrev->GetIndex(), ScTableRefToken::TABLE);
 maTableRefs.emplace_back( pTableRefToken);
 // pPrev may be dead hereafter.
 static_cast(pArr)->ReplaceToken( nIdx, 
pTableRefToken,


[Libreoffice-commits] core.git: sc/inc sc/source

2023-11-01 Thread Noel Grandin (via logerrit)
 sc/inc/postit.hxx   |2 +-
 sc/source/core/data/postit.cxx  |4 ++--
 sc/source/filter/excel/xiescher.cxx |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 35975f9ea30e9ec8ac9276f90874ffe272001038
Author: Noel Grandin 
AuthorDate: Wed Nov 1 10:39:45 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 1 13:09:25 2023 +0100

pass SfxItemSet by const & to CreateNoteFromObjectData

Because in an upcoming patch the CloneAsValue() call in
XclImpNoteObj::DoPreProcessSdrObj will stop working, because the
underlying SfxItemSet will no longer be an SfxAllItemSet

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

diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index df114eaf64a5..5e7f6f81d16f 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -246,7 +246,7 @@ public:
  */
 static ScPostIt*CreateNoteFromObjectData(
 ScDocument& rDoc, const ScAddress& rPos,
-SfxItemSet&& oItemSet, const OUString& rStyleName,
+const SfxItemSet& rItemSet, const OUString& 
rStyleName,
 const OutlinerParaObject& rOutlinerObj,
 const tools::Rectangle& rCaptionRect, bool bShown 
);
 
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index e46836f12e53..fa84f0212b81 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -957,14 +957,14 @@ ScNoteData ScNoteUtil::CreateNoteData(ScDocument& rDoc, 
const ScAddress& rPos,
 }
 
 ScPostIt* ScNoteUtil::CreateNoteFromObjectData(
-ScDocument& rDoc, const ScAddress& rPos, SfxItemSet&& rItemSet, const 
OUString& rStyleName,
+ScDocument& rDoc, const ScAddress& rPos, const SfxItemSet& rItemSet, 
const OUString& rStyleName,
 const OutlinerParaObject& rOutlinerObj, const tools::Rectangle& 
rCaptionRect,
 bool bShown )
 {
 ScNoteData aNoteData(CreateNoteData(rDoc, rPos, rCaptionRect, bShown));
 ScCaptionInitData& rInitData = *aNoteData.mxInitData;
 rInitData.mxOutlinerObj = rOutlinerObj;
-rInitData.moItemSet.emplace(std::move(rItemSet));
+rInitData.moItemSet.emplace(rItemSet);
 rInitData.maStyleName = 
ScStyleNameConversion::ProgrammaticToDisplayName(rStyleName, 
SfxStyleFamily::Frame);
 
 return InsertNote(rDoc, rPos, std::move(aNoteData), 
/*bAlwaysCreateCaption*/false, 0/*nPostItId*/);
diff --git a/sc/source/filter/excel/xiescher.cxx 
b/sc/source/filter/excel/xiescher.cxx
index 3f5969cead78..62e35213a045 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -1876,7 +1876,7 @@ void XclImpNoteObj::DoPreProcessSdrObj( 
XclImpDffConverter& rDffConv, SdrObject&
 // create cell note with all data from drawing object
 ScNoteUtil::CreateNoteFromObjectData(
 GetDoc(), maScPos,
-rSdrObj.GetMergedItemSet().CloneAsValue(), // new 
object on heap expected
+rSdrObj.GetMergedItemSet(),
 OUString(), *pOutlinerObj,
 rSdrObj.GetLogicRect(),
 ::get_flag( mnNoteFlags, EXC_NOTE_VISIBLE ) );


[Libreoffice-commits] core.git: sc/inc sc/source

2023-10-31 Thread Caolán McNamara (via logerrit)
 sc/inc/column.hxx  |2 +-
 sc/source/core/data/column.cxx |   28 ++--
 sc/source/core/data/table2.cxx |2 +-
 3 files changed, 24 insertions(+), 8 deletions(-)

New commits:
commit c15c1d87fceb782d76b5984f576d03a63c609ae5
Author: Caolán McNamara 
AuthorDate: Tue Oct 31 11:33:56 2023 +
Commit: Caolán McNamara 
CommitDate: Tue Oct 31 17:15:30 2023 +0100

tell client when the cell for the comment changed

when a row/column is inserted/deleted, etc the cell the comments are
associated with changes, so broadcast that change to the clients.

https://github.com/CollaboraOnline/online/issues/7334

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

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 0f30f64cb672..26ef79da2e6d 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -714,7 +714,7 @@ public:
 void DuplicateNotes(SCROW nStartRow, size_t nDataSize, ScColumn& rDestCol,
 sc::ColumnBlockPosition& rDestBlockPos, bool 
bCloneCaption, SCROW nRowOffsetDest = 0) const;
 
-void UpdateNoteCaptions( SCROW nRow1, SCROW nRow2 );
+void UpdateNoteCaptions( SCROW nRow1, SCROW nRow2, bool bAddressChanged = 
true );
 
 void UpdateDrawObjects( std::vector>& pObjects, 
SCROW nRowStart, SCROW nRowEnd );
 void UpdateDrawObjectsForRow( std::vector& pObjects, SCCOL 
nTargetCol, SCROW nTargetRow );
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index fea2f84e5be0..7ffd5ae9c735 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1808,22 +1809,37 @@ void resetColumnPosition(sc::CellStoreType& rCells, 
SCCOL nCol)
 
 class NoteCaptionUpdater
 {
-SCCOL mnCol;
-SCTAB mnTab;
+const ScDocument& m_rDocument;
+const ScAddress m_aAddress; // 'incomplete' address consisting of tab, 
column
+bool m_bAddressChanged;  // false if the cell anchor address is unchanged
 public:
-NoteCaptionUpdater( SCCOL nCol, SCTAB nTab ) : mnCol(nCol), mnTab(nTab) {}
+NoteCaptionUpdater(const ScDocument& rDocument, const ScAddress& rPos, 
bool bAddressChanged)
+: m_rDocument(rDocument)
+, m_aAddress(rPos)
+, m_bAddressChanged(bAddressChanged)
+{
+}
 
 void operator() ( size_t nRow, ScPostIt* p )
 {
-p->UpdateCaptionPos(ScAddress(mnCol,nRow,mnTab));
+// Create a 'complete' address object
+ScAddress aAddr(m_aAddress);
+aAddr.SetRow(nRow);
+
+p->UpdateCaptionPos(aAddr);
+
+// Notify our LOK clients
+if (m_bAddressChanged)
+ScDocShell::LOKCommentNotify(LOKCommentNotificationType::Modify, 
m_rDocument, aAddr, p);
 }
 };
 
 }
 
-void ScColumn::UpdateNoteCaptions( SCROW nRow1, SCROW nRow2 )
+void ScColumn::UpdateNoteCaptions( SCROW nRow1, SCROW nRow2, bool 
bAddressChanged )
 {
-NoteCaptionUpdater aFunc(nCol, nTab);
+ScAddress aAddr(nCol, 0, nTab);
+NoteCaptionUpdater aFunc(GetDoc(), aAddr, bAddressChanged);
 sc::ProcessNote(maCellNotes.begin(), maCellNotes, nRow1, nRow2, aFunc);
 }
 
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 31a0d6f1dd1e..978bd00ecbac 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1491,7 +1491,7 @@ void ScTable::CopyCaptionsToTable( SCCOL nCol1, SCROW 
nRow1, SCCOL nCol2, SCROW
 for (SCCOL i = nCol1; i <= nCol2; i++)
 {
 aCol[i].CopyCellNotesToDocument(nRow1, nRow2, 
pDestTab->CreateColumnIfNotExists(i), bCloneCaption);
-pDestTab->aCol[i].UpdateNoteCaptions(nRow1, nRow2);
+pDestTab->aCol[i].UpdateNoteCaptions(nRow1, nRow2, false /* address 
unchanged from initial create */);
 }
 }
 


[Libreoffice-commits] core.git: sc/inc sc/source

2023-10-27 Thread Szymon Kłos (via logerrit)
 sc/inc/strings.hrc|   15 +++
 sc/source/ui/condformat/condformateasydlg.cxx |   54 +++---
 sc/source/ui/inc/condformateasydlg.hxx|2 
 3 files changed, 65 insertions(+), 6 deletions(-)

New commits:
commit 47ee01c28701e22e55a9ef7d66e0836c5a0a5899
Author: Szymon Kłos 
AuthorDate: Fri Oct 27 11:53:57 2023 +0200
Commit: Szymon Kłos 
CommitDate: Fri Oct 27 22:21:03 2023 +0200

Make simple conditional formatting dialog translated

Followup for commit a9f6f63d21e368fe6bcc9080fd1ba23b0e52
sc: Add easy to use conditional formatting menu

- make strings translated
- add more conditions
- TODO: add other missing conditions

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

diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc
index 74c15b5b698b..d58777176e52 100644
--- a/sc/inc/strings.hrc
+++ b/sc/inc/strings.hrc
@@ -396,4 +396,19 @@
 #define STR_A11Y_DESC_USERDEF   
NC_("subtotaloptionspage|extended_tip|lbuserdef", "Uses a custom sorting order 
that you defined in the Options dialog box at %PRODUCTNAME Calc - Sort Lists.")
 #define STR_A11Y_DESC_ANNOT NC_("extended_tip|annot", 
"Specifies that a small rectangle in the top right corner of the cell indicates 
that a comment exists. The comment will be shown only when you enable tips 
under %PRODUCTNAME - General in the Options dialog box.")
 
+// Simple conditional formatting dialog
+#define STR_CONDITION_EQUAL NC_("STR_CONDITION_EQUAL", 
"equal to")
+#define STR_CONDITION_LESS  NC_("STR_CONDITION_LESS", 
"less than")
+#define STR_CONDITION_GREATER   
NC_("STR_CONDITION_GREATER", "greater than")
+#define STR_CONDITION_EQLESS
NC_("STR_CONDITION_EQLESS", "equal or less than")
+#define STR_CONDITION_EQGREATER 
NC_("STR_CONDITION_EQGREATER", "equal or greater than")
+#define STR_CONDITION_NOT_EQUAL 
NC_("STR_CONDITION_NOT_EQUAL", "not equal to")
+
+#define STR_CONDITION_BETWEEN   
NC_("STR_CONDITION_BETWEEN", "between")
+
+#define STR_CONDITION_ERROR NC_("STR_CONDITION_ERROR", 
"with error ")
+#define STR_CONDITION_NOERROR   
NC_("STR_CONDITION_NOERROR", "without error ")
+#define STR_CONDITION_CONTAINS_TEXT 
NC_("STR_CONDITION_CONTAINS_TEXT", "containing text")
+#define STR_CONDITION_NOT_CONTAINS_TEXT 
NC_("STR_CONDITION_NOT_CONTAINS_TEXT", "not containing text")
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/condformat/condformateasydlg.cxx 
b/sc/source/ui/condformat/condformateasydlg.cxx
index 8ddb297269dc..c371861ac355 100644
--- a/sc/source/ui/condformat/condformateasydlg.cxx
+++ b/sc/source/ui/condformat/condformateasydlg.cxx
@@ -3,7 +3,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 namespace
 {
@@ -49,6 +51,11 @@ ScTabViewShell* GetTabViewShell(const SfxBindings* pBindings)
 
 namespace sc
 {
+void ConditionalFormatEasyDialog::SetDescription(std::u16string_view 
rCondition)
+{
+mxDescription->set_label(mxDescription->get_label() + ": " + rCondition);
+}
+
 ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* 
pBindings,
  SfxChildWindow* 
pChildWindow,
  weld::Window* pParent,
@@ -89,19 +96,54 @@ 
ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings,
 mxNumberEntry2->set_increments(1, 0);
 switch (meMode)
 {
-case ScConditionMode::Greater:
-mxDescription->set_label(mxDescription->get_label() + " greater 
than ");
+case ScConditionMode::Equal:
+SetDescription(ScResId(STR_CONDITION_EQUAL));
 break;
 case ScConditionMode::Less:
-mxDescription->set_label(mxDescription->get_label() + " less than 
");
+SetDescription(ScResId(STR_CONDITION_LESS));
 break;
-case ScConditionMode::Equal:
-mxDescription->set_label(mxDescription->get_label() + " equal to 
");
+case ScConditionMode::Greater:
+SetDescription(ScResId(STR_CONDITION_GREATER));
+break;
+case ScConditionMode::EqLess:
+SetDescription(ScResId(STR_CONDITION_EQLESS));
+break;
+case ScConditionMode::EqGreater:
+SetDescription(ScResId(STR_CONDITION_EQGREATER));
+break;
+case ScConditionMode::NotEqual:
+SetDescription(ScResId(STR_CONDITION_NOT_EQUAL));
 break;
 case ScConditionMode::Between:
-

[Libreoffice-commits] core.git: sc/inc sc/source

2023-10-18 Thread Laurent Balland (via logerrit)
 sc/inc/globstr.hrc |   14 
+-
 sc/inc/strings.hrc |2 -
 sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx |2 -
 sc/source/ui/view/cellsh.cxx   |   12 
 4 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit 9a0018a356c89baf600a72eed8ee4ac927815b9b
Author: Laurent Balland 
AuthorDate: Wed Feb 22 23:01:01 2023 +0100
Commit: Laurent Balland 
CommitDate: Wed Oct 18 17:03:07 2023 +0200

Replace $baz by %foo for sanity checks

Tools for sanity-checks like
https://docs.weblate.org/en/latest/user/checks.html#percent-placeholders
looks for percent instead of dollar
Try to align with %1 as suggested by Chistian Lohmaier

Change-Id: I97d353f452316b939f2eaf7d30e68b9aab9f83e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147493
Tested-by: Jenkins
Reviewed-by: Laurent Balland 

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 2b949cba8264..e8e45fc01b2e 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -157,14 +157,14 @@
 #define STR_PIVOT_GROUP NC_("STR_PIVOT_GROUP", "Group")
 #define STR_PIVOT_ROW_LABELSNC_("STR_PIVOT_ROW_LABELS", 
"Row Labels")
 #define STR_PIVOT_COL_LABELSNC_("STR_PIVOT_COL_LABELS", 
"Column Labels")
-/* To translators: $1 == will be replaced by STR_SELCOUNT_ROWARG, and $2 by 
STR_SELCOUNT_COLARG
+/* %1 will be replaced by STR_SELCOUNT_ROWARG, and %2 by STR_SELCOUNT_COLARG
e.g. Selected: 1 row, 2 columns */
-#define STR_SELCOUNTNC_("STR_SELCOUNT", "Selected: 
$1, $2")
-// To translators: STR_SELCOUNT_ROWARG is $1 of STR_SELCOUNT. $1 of 
STR_SELCOUNT_ROWARG is number of rows
-#define STR_SELCOUNT_ROWARG NNC_("STR_SELCOUNT_ROWARG", 
"$1 row", "$1 rows")
-// To translators: STR_SELCOUNT_COLARG is $1 of STR_SELCOUNT. $1 of 
STR_SELCOUNT_ROWARG is number of columns
-#define STR_SELCOUNT_COLARG NNC_("STR_SELCOUNT_COLARG", 
"$1 column", "$1 columns")
-#define STR_FILTER_SELCOUNT NC_("STR_FILTER_SELCOUNT", "$1 
of $2 records found")
+#define STR_SELCOUNTNC_("STR_SELCOUNT", "Selected: 
%1, %2")
+// STR_SELCOUNT_ROWARG is %1 of STR_SELCOUNT. %d of STR_SELCOUNT_ROWARG is 
number of rows
+#define STR_SELCOUNT_ROWARG NNC_("STR_SELCOUNT_ROWARG", 
"%d row", "%d rows")
+// STR_SELCOUNT_COLARG is %2 of STR_SELCOUNT. %d of STR_SELCOUNT_ROWARG is 
number of columns
+#define STR_SELCOUNT_COLARG NNC_("STR_SELCOUNT_COLARG", 
"%d column", "%d columns")
+#define STR_FILTER_SELCOUNT NC_("STR_FILTER_SELCOUNT", "%1 
of %2 records found")
 #define STR_COLUMN  NC_("STR_COLUMN", "Column")
 #define STR_ROW NC_("STR_ROW", "Row")
 #define STR_PAGENC_("STR_PAGE", "Page")
diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc
index b40ed197be4b..74c15b5b698b 100644
--- a/sc/inc/strings.hrc
+++ b/sc/inc/strings.hrc
@@ -259,7 +259,7 @@
 #define STRID_CALC_FIRST_QUARTILE   
NC_("STRID_CALC_FIRST_QUARTILE", "First Quartile")
 #define STRID_CALC_THIRD_QUARTILE   
NC_("STRID_CALC_THIRD_QUARTILE", "Third Quartile")
 /* RandomNumberGeneratorDialog */
-#define STR_UNDO_DISTRIBUTION_TEMPLATE  
NC_("STR_UNDO_DISTRIBUTION_TEMPLATE", "Random ($(DISTRIBUTION))")
+#define STR_UNDO_DISTRIBUTION_TEMPLATE  
NC_("STR_UNDO_DISTRIBUTION_TEMPLATE", "Random (%1)")
 #define STR_DISTRIBUTION_UNIFORM_REAL   
NC_("STR_DISTRIBUTION_UNIFORM_REAL", "Uniform")
 #define STR_DISTRIBUTION_UNIFORM_INTEGER
NC_("STR_DISTRIBUTION_UNIFORM_INTEGER", "Uniform Integer")
 #define STR_DISTRIBUTION_NORMAL 
NC_("STR_DISTRIBUTION_NORMAL", "Normal")
diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx 
b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
index 2490ebf47301..38894160eff1 100644
--- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
@@ -262,7 +262,7 @@ void ScRandomNumberGeneratorDialog::GenerateNumbers(RNG& 
randomGenerator, Transl
 {
 OUString aUndo = ScResId(STR_UNDO_DISTRIBUTION_TEMPLATE);
 OUString aDistributionName = ScResId(pDistributionStringId);
-aUndo = aUndo.replaceAll("$(DISTRIBUTION)",  aDistributionName);
+aUndo = aUndo.replaceAll("%1",  aDistributionName);
 
 ScDocShell* pDocShell = mrViewData.GetDocShell();
 SfxUndoManager* pUndoManager = pDocShell->GetUndoManager();
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 34c87d0e61c6..1a866df3c881 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ 

[Libreoffice-commits] core.git: sc/inc

2023-10-16 Thread Eike Rathke (via logerrit)
 sc/inc/kahan.hxx |7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

New commits:
commit c25eaf109a64ae90473b09134540832dafa936c3
Author: Eike Rathke 
AuthorDate: Sun Oct 15 23:51:04 2023 +0200
Commit: Eike Rathke 
CommitDate: Mon Oct 16 10:54:04 2023 +0200

Factor out an occurrence of sumNeumaierNormal()

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

diff --git a/sc/inc/kahan.hxx b/sc/inc/kahan.hxx
index 03b05c25aa6b..c2560635fbdf 100644
--- a/sc/inc/kahan.hxx
+++ b/sc/inc/kahan.hxx
@@ -91,12 +91,7 @@ public:
 return;
 }
 
-double t = m_fSum + m_fMem;
-if (std::abs(m_fSum) >= std::abs(m_fMem))
-m_fError += (m_fSum - t) + m_fMem;
-else
-m_fError += (m_fMem - t) + m_fSum;
-m_fSum = t;
+sumNeumaierNormal(m_fSum, m_fError, m_fMem);
 m_fMem = x_i;
 }
 


[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-10-15 Thread Eike Rathke (via logerrit)
 sc/inc/arraysumfunctor.hxx   |   17 -
 sc/inc/kahan.hxx |   66 +--
 sc/qa/unit/ucalc_formula2.cxx|3 +
 sc/source/core/tool/arraysum.hxx |   36 ---
 sc/source/core/tool/arraysumSSE2.cxx |6 +--
 5 files changed, 52 insertions(+), 76 deletions(-)

New commits:
commit 361c4f008e48b08df635839d2e5dcad7389df44a
Author: Eike Rathke 
AuthorDate: Sun Oct 15 17:29:01 2023 +0200
Commit: Eike Rathke 
CommitDate: Sun Oct 15 18:46:01 2023 +0200

Follow-up: tdf#156985 Use SC_USE_SSE2 to determine which KahanSum::add() to 
use

Also, the CPU identifier for MSVC WIN32 is not X86 but INTEL, so
actually use SSE2 there as well, which was the cause of things
failing on that platform.

For other platforms than Intel x86/x86_64 SSE2 is not defined, so
exclude the new unit test based on that and live on with the old
slightly off value. Experiments did not yield any solution that
works, even using plain sumNeumaierNormal() (similar to SSE2) in
the executeUnrolled() case instead of KahanSum with its m_fMem did
not help, nor trying to add the internal values in different
orders or with long double, au contraire the error was slightly
larger.

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

diff --git a/sc/inc/arraysumfunctor.hxx b/sc/inc/arraysumfunctor.hxx
index c261c120addf..c1eabb220e27 100644
--- a/sc/inc/arraysumfunctor.hxx
+++ b/sc/inc/arraysumfunctor.hxx
@@ -12,29 +12,12 @@
 
 #include 
 #include "kahan.hxx"
-#include "arraysumfunctor.hxx"
 #include 
 
 namespace sc::op
 {
-// Checkout available optimization options.
-// Note that it turned out to be problematic to support CPU-specific code
-// that's not guaranteed to be available on that specific platform (see
-// git history). SSE2 is guaranteed on x86_64 and it is our baseline 
requirement
-// for x86 on Windows, so SSE2 use is hardcoded on those platforms.
-// Whenever we raise baseline to e.g. AVX, this may get
-// replaced with AVX code (get it from git history).
-// Do it similarly with other platforms.
-#if defined(X86_64) || (defined(X86) && defined(_WIN32))
-#define SC_USE_SSE2 1
-KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent);
-#else
-#define SC_USE_SSE2 0
-#endif
-
 /**
   * If no boosts available, Unrolled KahanSum.
-  * Most likely to use on android.
   */
 static inline KahanSum executeUnrolled(size_t& i, size_t nSize, const double* 
pCurrent)
 {
diff --git a/sc/inc/kahan.hxx b/sc/inc/kahan.hxx
index ac97ae4394fa..03b05c25aa6b 100644
--- a/sc/inc/kahan.hxx
+++ b/sc/inc/kahan.hxx
@@ -12,6 +12,26 @@
 #include 
 #include 
 
+class KahanSum;
+namespace sc::op
+{
+// Checkout available optimization options.
+// Note that it turned out to be problematic to support CPU-specific code
+// that's not guaranteed to be available on that specific platform (see
+// git commit 2d36e7f5186ba5215f2b228b98c24520bd4f2882). SSE2 is guaranteed on
+// x86_64 and it is our baseline requirement for x86 on Windows, so SSE2 use is
+// hardcoded on those platforms.
+// Whenever we raise baseline to e.g. AVX, this may get
+// replaced with AVX code (get it from mentioned git commit).
+// Do it similarly with other platforms.
+#if defined(X86_64) || (defined(INTEL) && defined(_WIN32))
+#define SC_USE_SSE2 1
+KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent);
+#else
+#define SC_USE_SSE2 0
+#endif
+}
+
 /**
   * This class provides LO with Kahan summation algorithm
   * About this algorithm: 
https://en.wikipedia.org/wiki/Kahan_summation_algorithm
@@ -41,6 +61,21 @@ public:
 constexpr KahanSum(const KahanSum& fSum) = default;
 
 public:
+/**
+  * Performs one step of the Neumaier sum of doubles.
+  * Overwrites the summand and error.
+  * T could be double or long double.
+  */
+template  static inline void sumNeumaierNormal(T& sum, T& err, 
const double& value)
+{
+T t = sum + value;
+if (std::abs(sum) >= std::abs(value))
+err += (sum - t) + value;
+else
+err += (value - t) + sum;
+sum = t;
+}
+
 /**
   * Adds a value to the sum using Kahan summation.
   * @param x_i
@@ -71,32 +106,27 @@ public:
   */
 inline void add(const KahanSum& fSum)
 {
-#ifdef _WIN32
-// For some odd unknown reason WIN32 fails badly with the
-// sum+compensation value. Continue keeping the old though slightly off
-// (see tdf#156985) explicit addition of the compensation value.
-add(fSum.m_fSum);
-add(fSum.m_fError);
-#else
+#if SC_USE_SSE2
 add(fSum.m_fSum + fSum.m_fError);
-#endif
 add(fSum.m_fMem);
+#else
+// Without SSE2 the sum+compensation value fails badly. Continue
+// keeping the old 

[Libreoffice-commits] core.git: sc/inc sc/source

2023-10-12 Thread Noel Grandin (via logerrit)
 sc/inc/broadcast.hxx  |   15 ---
 sc/source/core/data/broadcast.cxx |   33 ++---
 2 files changed, 14 insertions(+), 34 deletions(-)

New commits:
commit b9b57133125179a88f7f68e14ef6cde85ed1
Author: Noel Grandin 
AuthorDate: Wed Oct 11 11:39:22 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Oct 12 08:54:26 2023 +0200

no need for these enums in BroadcasterState

the std::variant already knows which alternative it stores

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

diff --git a/sc/inc/broadcast.hxx b/sc/inc/broadcast.hxx
index b095f819acb7..55b1e64f0c9a 100644
--- a/sc/inc/broadcast.hxx
+++ b/sc/inc/broadcast.hxx
@@ -24,24 +24,10 @@ class FormulaGroupAreaListener;
 
 struct BroadcasterState
 {
-enum class CellListenerType
-{
-FormulaCell,
-Generic,
-};
-
-enum class AreaListenerType
-{
-FormulaCell,
-FormulaGroup,
-Generic,
-};
-
 struct CellListener
 {
 using DataType = std::variant;
 
-CellListenerType eType;
 DataType pData;
 
 CellListener(const ScFormulaCell* p);
@@ -53,7 +39,6 @@ struct BroadcasterState
 using DataType = std::variant;
 
-AreaListenerType eType;
 DataType pData;
 
 AreaListener(const ScFormulaCell* p);
diff --git a/sc/source/core/data/broadcast.cxx 
b/sc/source/core/data/broadcast.cxx
index c0cd0c29edca..d76591692f15 100644
--- a/sc/source/core/data/broadcast.cxx
+++ b/sc/source/core/data/broadcast.cxx
@@ -14,32 +14,27 @@
 namespace sc
 {
 BroadcasterState::CellListener::CellListener(const ScFormulaCell* p)
-: eType(CellListenerType::FormulaCell)
-, pData(p)
+: pData(p)
 {
 }
 
 BroadcasterState::CellListener::CellListener(const SvtListener* p)
-: eType(CellListenerType::Generic)
-, pData(p)
+: pData(p)
 {
 }
 
 BroadcasterState::AreaListener::AreaListener(const ScFormulaCell* p)
-: eType(AreaListenerType::FormulaCell)
-, pData(p)
+: pData(p)
 {
 }
 
 BroadcasterState::AreaListener::AreaListener(const 
sc::FormulaGroupAreaListener* p)
-: eType(AreaListenerType::FormulaGroup)
-, pData(p)
+: pData(p)
 {
 }
 
 BroadcasterState::AreaListener::AreaListener(const SvtListener* p)
-: eType(AreaListenerType::Generic)
-, pData(p)
+: pData(p)
 {
 }
 
@@ -52,7 +47,7 @@ bool BroadcasterState::hasFormulaCellListener(const 
ScAddress& rBroadcasterPos,
 
 for (const auto& rLis : it->second)
 {
-if (rLis.eType == CellListenerType::FormulaCell)
+if (rLis.pData.index() == 0)
 {
 auto pFC = std::get(rLis.pData);
 if (pFC->aPos == rFormulaPos)
@@ -72,7 +67,7 @@ bool BroadcasterState::hasFormulaCellListener(const ScRange& 
rBroadcasterRange,
 
 for (const auto& rLis : it->second)
 {
-if (rLis.eType == AreaListenerType::FormulaCell)
+if (rLis.pData.index() == 0)
 {
 auto pFC = std::get(rLis.pData);
 if (pFC->aPos == rFormulaPos)
@@ -99,16 +94,16 @@ void BroadcasterState::dump(std::ostream& rStrm, const 
ScDocument* pDoc) const
 
 for (const auto& rLis : rListeners)
 {
-switch (rLis.eType)
+switch (rLis.pData.index())
 {
-case BroadcasterState::CellListenerType::FormulaCell:
+case 0:
 {
 auto* pFC = std::get(rLis.pData);
 rStrm << "  - type: formula-cell\n";
 rStrm << "position: " << pFC->aPos.Format(nPosFlags, 
pDoc) << std::endl;
 break;
 }
-case BroadcasterState::CellListenerType::Generic:
+case 1:
 {
 rStrm << "  - type: unknown" << std::endl;
 break;
@@ -127,16 +122,16 @@ void BroadcasterState::dump(std::ostream& rStrm, const 
ScDocument* pDoc) const
 
 for (const auto& rLis : rListeners)
 {
-switch (rLis.eType)
+switch (rLis.pData.index())
 {
-case BroadcasterState::AreaListenerType::FormulaCell:
+case 0:
 {
 auto* pFC = std::get(rLis.pData);
 rStrm << "  - type: formula-cell\n";
 rStrm << "position: " << pFC->aPos.Format(nPosFlags, 
pDoc) << std::endl;
 break;
 }
-case BroadcasterState::AreaListenerType::FormulaGroup:
+case 1:
 {
 auto* pFGL = std::get(rLis.pData);
 
@@ -150,7 +145,7 @@ void BroadcasterState::dump(std::ostream& rStrm, const 
ScDocument* pDoc) const
 }
 break;
 }
- 

[Libreoffice-commits] core.git: sc/inc sc/source

2023-10-10 Thread Noel Grandin (via logerrit)
 sc/inc/attarray.hxx  |2 +-
 sc/source/core/data/attarray.cxx |9 ++---
 2 files changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 6c247c2c867281181d3d35157bca5e72a3c0bca8
Author: Noel Grandin 
AuthorDate: Tue Oct 10 12:55:20 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Oct 11 07:28:20 2023 +0200

cool#7330 calc perf: PaintTile's FillInfo

try to spend a little less time here, when searching twice, we can use
the index result of the first search as a hint

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

diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index cbc8f7cfe2f9..521f3b7bb1d6 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -183,7 +183,7 @@ public:
 boolApplyFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags );
 boolRemoveFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags );
 
-boolSearch( SCROW nRow, SCSIZE& nIndex ) const;
+boolSearch( SCROW nRow, SCSIZE& nIndex, std::optional 
nIndexHint = {} ) const;
 
 boolHasAttrib( SCROW nRow1, SCROW nRow2, HasAttrFlags nMask ) const;
 boolHasAttrib( SCROW nRow, HasAttrFlags nMask, SCROW* nStartRow = 
nullptr, SCROW* nEndRow = nullptr ) const;
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 2efd31c7675f..b6d062b93d66 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -190,9 +190,11 @@ bool ScAttrArray::Concat(SCSIZE nPos)
  *
  * Iterative implementation of Binary Search
  * The same implementation was used inside ScMarkArray::Search().
+ *
+ * @param oIndexHint, hint for the start of the search, useful when searching 
twice for successive values
  */
 
-bool ScAttrArray::Search( SCROW nRow, SCSIZE& nIndex ) const
+bool ScAttrArray::Search( SCROW nRow, SCSIZE& nIndex, std::optional 
oIndexHint ) const
 {
 /*auto it = std::lower_bound(mvData.begin(), mvData.end(), nRow,
 [] (const ScAttrEntry , SCROW nRow)
@@ -209,7 +211,8 @@ bool ScAttrArray::Search( SCROW nRow, SCSIZE& nIndex ) const
 
 tools::Long nHi = static_cast(mvData.size()) - 1;
 tools::Long i = 0;
-tools::Long nLo = 0;
+assert((!oIndexHint || *oIndexHint <= nHi) && "bad index hint");
+tools::Long nLo = oIndexHint ? *oIndexHint : 0;
 
 while ( nLo <= nHi )
 {
@@ -1405,7 +1408,7 @@ bool ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, 
HasAttrFlags nMask ) cons
 SCSIZE nEndIndex;
 Search( nRow1, nStartIndex );
 if (nRow1 != nRow2)
-Search( nRow2, nEndIndex );
+Search( nRow2, nEndIndex, /*hint*/nStartIndex );
 else
 nEndIndex = nStartIndex;
 bool bFound = false;


[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-10-10 Thread Rafael Lima (via logerrit)
 sc/inc/table.hxx  |4 
 sc/qa/unit/data/ods/tdf156815.ods |binary
 sc/qa/unit/ucalc_solver.cxx   |   33 +
 sc/source/core/data/document.cxx  |5 +
 sc/source/ui/inc/docfunc.hxx  |2 +-
 5 files changed, 43 insertions(+), 1 deletion(-)

New commits:
commit cb46ad4c4602fbb6aeab482e9370e31495e12cfe
Author: Rafael Lima 
AuthorDate: Tue Sep 12 19:17:47 2023 +0200
Commit: Tomaž Vajngerl 
CommitDate: Wed Oct 11 00:05:52 2023 +0200

tdf#156815 Reset solver settings when a sheet is renamed

When a sheet is renamed, the SolverSettings object needs to be reset so 
that the updated references of the named ranges are reloaded the next time the 
Solver dialog is opened.

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

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 34e0f9d27784..68b4c614c68b 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -451,6 +451,10 @@ public:
 
 SC_DLLPUBLIC std::shared_ptr GetSolverSettings();
 
+// tdf#156815 Sets the solver settings object to nullptr to force 
reloading Solver settings the
+// next time the dialog is opened. This is required when sheets are renamed
+void ResetSolverSettings() { m_pSolverSettings.reset(); }
+
 /**
  * Takes ownership of pCell
  *
diff --git a/sc/qa/unit/data/ods/tdf156815.ods 
b/sc/qa/unit/data/ods/tdf156815.ods
new file mode 100644
index ..cc797ee8619b
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf156815.ods differ
diff --git a/sc/qa/unit/ucalc_solver.cxx b/sc/qa/unit/ucalc_solver.cxx
index 7a8d76cc7534..47770ec0c0e5 100644
--- a/sc/qa/unit/ucalc_solver.cxx
+++ b/sc/qa/unit/ucalc_solver.cxx
@@ -10,6 +10,7 @@
 #include 
 #include "helper/qahelper.hxx"
 #include 
+#include 
 #include 
 #include 
 
@@ -130,4 +131,36 @@ CPPUNIT_TEST_FIXTURE(SolverTest, testSingleModel)
 TestConstraintsModelA(pSettings.get());
 }
 
+// Tests if references remain valid after a sheet is renamed
+CPPUNIT_TEST_FIXTURE(SolverTest, tdf156815)
+{
+createScDoc("ods/tdf156815.ods");
+ScDocument* pDoc = getScDoc();
+ScTable* pTable = pDoc->FetchTable(0);
+std::shared_ptr pSettings = 
pTable->GetSolverSettings();
+CPPUNIT_ASSERT(pSettings);
+
+// Check current values in the solver model
+CPPUNIT_ASSERT_EQUAL(OUString("$Sheet2.$A$1"), 
pSettings->GetParameter(SP_OBJ_CELL));
+CPPUNIT_ASSERT_EQUAL(OUString("$Sheet2.$A$3:$B$3"), 
pSettings->GetParameter(SP_VAR_CELLS));
+
+std::vector aConstraints = pSettings->GetConstraints();
+CPPUNIT_ASSERT_EQUAL(OUString("$Sheet2.$A$2"), aConstraints[0].aLeftStr);
+CPPUNIT_ASSERT_EQUAL(OUString("$Sheet2.$B$2"), aConstraints[0].aRightStr);
+
+// Rename Sheet2 to NewName
+ScDocFunc& rDocFunc = getScDocShell()->GetDocFunc();
+rDocFunc.RenameTable(1, "NewName", false, true);
+
+// Check whether the ranges where updated
+pSettings = pTable->GetSolverSettings();
+CPPUNIT_ASSERT(pSettings);
+CPPUNIT_ASSERT_EQUAL(OUString("$NewName.$A$1"), 
pSettings->GetParameter(SP_OBJ_CELL));
+CPPUNIT_ASSERT_EQUAL(OUString("$NewName.$A$3:$B$3"), 
pSettings->GetParameter(SP_VAR_CELLS));
+
+aConstraints = pSettings->GetConstraints();
+CPPUNIT_ASSERT_EQUAL(OUString("$NewName.$A$2"), aConstraints[0].aLeftStr);
+CPPUNIT_ASSERT_EQUAL(OUString("$NewName.$B$2"), aConstraints[0].aRightStr);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 0880fdf8a857..8996577b588e 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -865,7 +865,12 @@ bool ScDocument::RenameTab( SCTAB nTab, const OUString& 
rName, bool bExternalDoc
 for (const auto& pTable : maTabs)
 {
 if (pTable)
+{
 pTable->SetStreamValid( false );
+// tdf#156815 Reset solver settings so next time they're 
loaded they come with
+// the updated sheet name
+pTable->ResetSolverSettings();
+}
 }
 
 if (comphelper::LibreOfficeKit::isActive() && GetDrawLayer())
diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx
index 6419e285d5b7..aa9755566ef3 100644
--- a/sc/source/ui/inc/docfunc.hxx
+++ b/sc/source/ui/inc/docfunc.hxx
@@ -147,7 +147,7 @@ public:
bool bCut, bool bRecord, bool bPaint, 
bool bApi );
 
 SC_DLLPUBLIC bool InsertTable( SCTAB nTab, const OUString& rName, bool 
bRecord, bool bApi );
-boolRenameTable( SCTAB nTab, const OUString& rName, bool 
bRecord, bool bApi );
+SC_DLLPUBLIC bool RenameTable( SCTAB nTab, const OUString& rName, bool 
bRecord, bool bApi );
 boolDeleteTable( SCTAB 

[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-10-09 Thread Rafael Lima (via logerrit)
 sc/inc/document.hxx|2 ++
 sc/inc/table.hxx   |4 
 sc/qa/unit/data/ods/tdf157318.ods  |binary
 sc/qa/unit/subsequent_export_test4.cxx |   23 +--
 sc/source/core/data/document.cxx   |6 ++
 sc/source/core/data/table1.cxx |   20 
 sc/source/filter/excel/xename.cxx  |5 -
 sc/source/ui/view/viewfun2.cxx |3 +++
 8 files changed, 56 insertions(+), 7 deletions(-)

New commits:
commit 2705c53c9d444eb5a8126d97b3e1fc4ff010b9c0
Author: Rafael Lima 
AuthorDate: Mon Oct 2 00:13:57 2023 +0200
Commit: László Németh 
CommitDate: Mon Oct 9 16:06:32 2023 +0200

tdf#100034 tdf#157318 XLSX export: fix lost named ranges associated to 
sheets

The original fix for tdf#100034 (see commit [1]) consisted of explicitly 
not exporting to XLSX named ranges that are not built-in. This has a 
side-effect that user-defined named ranges associated with sheets are also not 
exported to XLSX. Hence, if the user creates a named range linked to a sheet 
and saves the file to XLSX, the named range is not exported (which is the issue 
reported in tdf#157318).

This patch implements a new fix for tdf#100034, reverting the previous
fix. When the Print Ranges are cleared by the user, the associated named
ranges are also cleared, thus fixing the original problem.

This new fix has the advantage that user-defined named ranges linked to 
sheets are again exported to XLSX files.

Regression from commit 639519dc2bad058197b6ff73c9e3df622f979f97
"tdf#100034: Fix to persistently remove print-range".

References:
[1] 639519dc2bad058197b6ff73c9e3df622f979f97

Change-Id: Ic3b84365a6086e96f60b222cd6337991ac90f483
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157455
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index f473034ea039..70a4827ce87f 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2118,6 +2118,8 @@ public:
 SC_DLLPUBLIC voidClearPrintRanges( SCTAB nTab );
 /** Adds a new print ranges. */
 SC_DLLPUBLIC voidAddPrintRange( SCTAB nTab, const ScRange& 
rNew );
+// Removes all named ranges used for print ranges in a given tab
+SC_DLLPUBLIC voidClearPrintNamedRanges( SCTAB nTab );
 /** Marks the specified sheet to be printed completely. Deletes old print 
ranges on the sheet! */
 SC_DLLPUBLIC voidSetPrintEntireSheet( SCTAB nTab );
 SC_DLLPUBLIC voidSetRepeatColRange( SCTAB nTab, 
std::optional oNew );
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 615a2f03e5cd..34e0f9d27784 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -833,6 +833,10 @@ public:
 voidClearPrintRanges();
 /** Adds a new print ranges. */
 voidAddPrintRange( const ScRange& rNew );
+
+// Removes all named ranges used for print ranges
+voidClearPrintNamedRanges();
+
 /** Marks the specified sheet to be printed completely. Deletes old print 
ranges! */
 voidSetPrintEntireSheet();
 
diff --git a/sc/qa/unit/data/ods/tdf157318.ods 
b/sc/qa/unit/data/ods/tdf157318.ods
new file mode 100644
index ..6d17dc1ceb48
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf157318.ods differ
diff --git a/sc/qa/unit/subsequent_export_test4.cxx 
b/sc/qa/unit/subsequent_export_test4.cxx
index 357ac567575f..77750a206622 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -1725,8 +1725,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf100034)
 createScDoc("xlsx/tdf100034.xlsx");
 ScDocument* pDoc = getScDoc();
 
-// Clear print ranges
-pDoc->ClearPrintRanges(0);
+// Clear print ranges (Format - Print Ranges - Clear)
+dispatchCommand(mxComponent, ".uno:DeletePrintArea", {});
 
 // Save and load back
 saveAndReload("Calc Office Open XML");
@@ -1736,6 +1736,25 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf100034)
 CPPUNIT_ASSERT_EQUAL(static_cast(0), 
pDoc->GetPrintRangeCount(0));
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf157318)
+{
+// This document has 2 named ranges; Test1 is global; Test2 is linked to 
Sheet1)
+createScDoc("ods/tdf157318.ods");
+ScDocument* pDoc = getScDoc();
+
+// Save as XLSX and load back
+saveAndReload("Calc Office Open XML");
+pDoc = getScDoc();
+
+// Check if there is one global named range
+CPPUNIT_ASSERT_EQUAL(static_cast(1),
+ 
static_cast(pDoc->GetRangeName()->size()));
+
+// Check if there is one named range in the first sheet
+CPPUNIT_ASSERT_EQUAL(static_cast(1),
+ 
static_cast(pDoc->GetRangeName(0)->size()));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git 

[Libreoffice-commits] core.git: sc/inc sc/source

2023-10-06 Thread Caolán McNamara (via logerrit)
 sc/inc/document.hxx|4 ++--
 sc/source/ui/view/viewfun3.cxx |3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 48c0ada1745be2cd817d5bd8a912530028fa8419
Author: Caolán McNamara 
AuthorDate: Thu Oct 5 14:12:51 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Oct 6 09:29:33 2023 +0200

crash copying text + chart to clipboard with InputOptions::TextWysiwyg

of true, the mxPoolHelper is still null when trying to create a
Printer to use as a reference device

 #3  0x7f6d5e81ee6e in ScDocShell::GetRefDevice 
(this=this@entry=0x4697e6e0) at libreoffice/sc/source/ui/docshell/docsh3.cxx:471
 #4  0x7f6d5e823439 in ScDocShell::UpdateFontList 
(this=this@entry=0x4697e6e0) at libreoffice/sc/source/ui/docshell/docsh3.cxx:462
 #5  0x7f6d5e81dd6c in ScDocShell::InitItems 
(this=this@entry=0x4697e6e0) at libreoffice/sc/source/ui/docshell/docsh2.cxx:98
 #6  0x7f6d5e81e80b in ScDocShell::InitNew (this=0x4697e6e0, xStor=...) 
at libreoffice/sc/source/ui/docshell/docsh2.cxx:83
 #7  0x7f6d6e2ce99d in SfxObjectShell::DoInitNew 
(this=this@entry=0x4697e6e0) at libreoffice/sfx2/source/doc/objstor.cxx:470
 #8  0x7f6d5e768daf in ScTransferObj::SetDrawClipDoc 
(bAnyOle=, pDoc=std::shared_ptr (use count 2, weak 
count 0) = {...})
 at libreoffice/sc/source/ui/app/transobj.cxx:821
 #9  0x7f6d5ec4735a in ScViewFunc::CopyToClipSingleRange 
(this=0x37a257a0, pClipDoc=, rRanges=..., bCut=, 
bIncludeObjects=)
 at libreoffice/sc/source/ui/view/viewfun3.cxx:248
 #10 0x7f6d5ec48ab0 in ScViewFunc::CopyToClip 
(this=this@entry=0x37a257a0, pClipDoc=pClipDoc@entry=0x0, rRanges=..., 
bCut=bCut@entry=false, bApi=bApi@entry=false,
 bIncludeObjects=bIncludeObjects@entry=true, bStopEdit=true) at 
libreoffice/sc/source/ui/view/viewfun3.cxx:212
 #11 0x7f6d5ec48dc3 in ScViewFunc::CopyToClip 
(this=this@entry=0x37a257a0, pClipDoc=pClipDoc@entry=0x0, 
bCut=bCut@entry=false, bApi=bApi@entry=false,
 bIncludeObjects=bIncludeObjects@entry=true, 
bStopEdit=bStopEdit@entry=true) at 
libreoffice/sc/source/ui/view/viewfun3.cxx:178
 #12 0x7f6d5eb0eada in ScCellShell::ExecuteEdit (this=0x35c3d240, 
rReq=...) at libreoffice/sc/source/ui/view/cellsh1.cxx:1369

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

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index dbaf26c4e33d..f473034ea039 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2695,6 +2695,8 @@ public:
 const ScTable* FetchTable( SCTAB nTab ) const;
 
 ScRefCellValue GetRefCellValue( const ScAddress& rPos );
+
+void SharePooledResources( const ScDocument* pSrcDoc );
 private:
 ScRefCellValue GetRefCellValue( const ScAddress& rPos, 
sc::ColumnBlockPosition& rBlockPos );
 
@@ -2704,8 +2706,6 @@ private:
 SCSIZE GetPatternCount( SCTAB nTab, SCCOL nCol, SCROW nRow1, SCROW nRow2 ) 
const;
 void   ReservePatternCount( SCTAB nTab, SCCOL nCol, SCSIZE nReserve );
 
-void SharePooledResources( const ScDocument* pSrcDoc );
-
 void EndListeningIntersectedGroup(
 sc::EndListeningContext& rCxt, const ScAddress& rPos, 
std::vector* pGroupPos );
 
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 7a6403237b89..8aea1ebbd66d 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -242,6 +242,9 @@ bool ScViewFunc::CopyToClipSingleRange( ScDocument* 
pClipDoc, const ScRangeList&
 if ( pSysClipDoc && bIncludeObjects )
 {
 bool bAnyOle = rDoc.HasOLEObjectsInArea( aRange );
+// There are optional paths (e.g. bAnyOle and 
InputOptions().GetTextWysiwyg true)
+// which dereference pSysClipDoc->mxPoolHelper so ensure that is set 
here.
+pSysClipDoc->SharePooledResources();
 // Update ScGlobal::xDrawClipDocShellRef.
 ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( 
bAnyOle, pSysClipDoc ) );
 }


[Libreoffice-commits] core.git: sc/inc

2023-09-19 Thread Andrea Gelmini (via logerrit)
 sc/inc/conditio.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 211c4df7656bc81617e98ec89466c12f998a6130
Author: Andrea Gelmini 
AuthorDate: Mon Sep 18 19:25:18 2023 +0200
Commit: Julien Nabet 
CommitDate: Wed Sep 20 07:28:23 2023 +0200

Fix typo

Change-Id: I1d248f2980292cdbb9f2c3275c4f371b75f1a2f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157028
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 8e5af1dd3c3c..c3ef00e5cf93 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -614,7 +614,7 @@ class RepaintInIdle final : public Idle
 
 public:
 RepaintInIdle(ScConditionalFormat* pCondFormat)
-: Idle("Contitional Format Repaint Idle")
+: Idle("Conditional Format Repaint Idle")
 , mpCondFormat(pCondFormat)
 {}
 


[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-09-18 Thread Szymon Kłos (via logerrit)
 sc/inc/conditio.hxx |   20 
 sc/qa/unit/subsequent_filters_test3.cxx |5 +
 sc/source/core/data/conditio.cxx|   15 ++-
 3 files changed, 35 insertions(+), 5 deletions(-)

New commits:
commit cea900fe9864bbc5314415cb369fc7b6111cd050
Author: Szymon Kłos 
AuthorDate: Wed Sep 13 14:57:23 2023 +0200
Commit: Caolán McNamara 
CommitDate: Mon Sep 18 17:45:47 2023 +0200

Schedule conditional formating repaint after filtering is completed

When we have sheet with lots of data with applied conditional formatting
and that data is used with autofilter feature - filtering is very slow.
That was caused by repaints synchronously called on every row show/hide.

ScConditionalFormat::DoRepaint()   called by ScFormulaListener callback
...
ScDocument::Broadcast
ScColumn::BroadcastRows
ScTable::SetRowHidden
ScTable::DBShowRows

This patch schedules repaint in the Idle so we do that after all changes
are already applied.

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

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 47f5fdb3addb..8e5af1dd3c3c 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -40,6 +40,7 @@
 #include 
 #include 
 
+class RepaintInIdle;
 class ScFormulaCell;
 class ScTokenArray;
 struct ScRefCellValue;
@@ -442,6 +443,8 @@ private:
 };
 
 mutable std::unique_ptr mpCache;
+
+std::unique_ptr mpRepaintTask;
 };
 
 //  single condition entry for conditional formatting
@@ -605,6 +608,23 @@ public:
 void CalcAll();
 };
 
+class RepaintInIdle final : public Idle
+{
+ScConditionalFormat* mpCondFormat;
+
+public:
+RepaintInIdle(ScConditionalFormat* pCondFormat)
+: Idle("Contitional Format Repaint Idle")
+, mpCondFormat(pCondFormat)
+{}
+
+void Invoke() override
+{
+if (mpCondFormat)
+mpCondFormat->DoRepaint();
+}
+};
+
 struct CompareScConditionalFormat
 {
 using is_transparent = void;
diff --git a/sc/qa/unit/subsequent_filters_test3.cxx 
b/sc/qa/unit/subsequent_filters_test3.cxx
index ff19d3d55c3c..3a46b9926bf6 100644
--- a/sc/qa/unit/subsequent_filters_test3.cxx
+++ b/sc/qa/unit/subsequent_filters_test3.cxx
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -419,6 +420,8 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, 
testCondFormatFormulaListenerXLSX)
 pDoc->SetDocVisible(true);
 pDoc->SetValue(0, 0, 0, 2.0);
 
+Scheduler::ProcessEventsToIdle();
+
 CPPUNIT_ASSERT(aListener.mbCalled);
 }
 
@@ -439,6 +442,8 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf131471)
 pDoc->SetDocVisible(true);
 pDoc->SetValue(0, 0, 0, 1.0);
 
+Scheduler::ProcessEventsToIdle();
+
 CPPUNIT_ASSERT(aListener.mbCalled);
 }
 
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index b70f9579d0e8..93094e929bf4 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -160,12 +160,13 @@ void ScConditionEntry::StartListening()
 if (!pCondFormat)
 return;
 
+mpRepaintTask = std::make_unique(pCondFormat);
 const ScRangeList& rRanges = pCondFormat->GetRange();
 mpListener->stopListening();
 start_listen_to(*mpListener, pFormula1.get(), rRanges);
 start_listen_to(*mpListener, pFormula2.get(), rRanges);
 
-mpListener->setCallback([&]() { pCondFormat->DoRepaint();});
+mpListener->setCallback([&]() { mpRepaintTask->Start();});
 }
 
 void ScConditionEntry::SetParent(ScConditionalFormat* pParent)
@@ -195,7 +196,8 @@ ScConditionEntry::ScConditionEntry( const ScConditionEntry& 
r ) :
 bFirstRun(true),
 mpListener(new ScFormulaListener(*r.mpDoc)),
 eConditionType( r.eConditionType ),
-pCondFormat(r.pCondFormat)
+pCondFormat(r.pCondFormat),
+mpRepaintTask()
 {
 // ScTokenArray copy ctor creates a flat copy
 if (r.pFormula1)
@@ -228,7 +230,8 @@ ScConditionEntry::ScConditionEntry( ScDocument& rDocument, 
const ScConditionEntr
 bFirstRun(true),
 mpListener(new ScFormulaListener(rDocument)),
 eConditionType( r.eConditionType),
-pCondFormat(r.pCondFormat)
+pCondFormat(r.pCondFormat),
+mpRepaintTask()
 {
 // Real copy of the formulas (for Ref Undo)
 if (r.pFormula1)
@@ -262,7 +265,8 @@ ScConditionEntry::ScConditionEntry( ScConditionMode eOper,
 bFirstRun(true),
 mpListener(new ScFormulaListener(rDocument)),
 eConditionType(eType),
-pCondFormat(nullptr)
+pCondFormat(nullptr),
+mpRepaintTask()
 {
 Compile( rExpr1, rExpr2, rExprNmsp1, rExprNmsp2, eGrammar1, eGrammar2, 
false );
 
@@ -287,7 +291,8 @@ ScConditionEntry::ScConditionEntry( ScConditionMode eOper,
 bFirstRun(true),
 mpListener(new ScFormulaListener(rDocument)),
 

[Libreoffice-commits] core.git: sc/inc sc/source

2023-09-15 Thread Noel Grandin (via logerrit)
 sc/inc/arealink.hxx  |2 
 sc/inc/document.hxx  |8 +-
 sc/inc/tablink.hxx   |2 
 sc/source/core/data/SolverSettings.cxx   |2 
 sc/source/core/data/attarray.cxx |1 
 sc/source/core/data/bcaslot.cxx  |3 
 sc/source/core/data/dociter.cxx  |1 
 sc/source/core/data/documen2.cxx |4 -
 sc/source/core/data/documen3.cxx |1 
 sc/source/core/data/documen4.cxx |1 
 sc/source/core/data/documen5.cxx |3 
 sc/source/core/data/documen8.cxx |5 -
 sc/source/core/data/documen9.cxx |3 
 sc/source/core/data/document.cxx |   10 +-
 sc/source/core/data/document10.cxx   |2 
 sc/source/core/data/drwlayer.cxx |5 -
 sc/source/core/data/simpleformulacalc.cxx|1 
 sc/source/core/data/table1.cxx   |1 
 sc/source/core/data/table2.cxx   |4 -
 sc/source/core/data/validat.cxx  |5 -
 sc/source/core/tool/addinlis.cxx |1 
 sc/source/core/tool/address.cxx  |1 
 sc/source/core/tool/adiasync.cxx |1 
 sc/source/core/tool/chgtrack.cxx |3 
 sc/source/core/tool/compiler.cxx |3 
 sc/source/core/tool/detfunc.cxx  |2 
 sc/source/core/tool/editutil.cxx |3 
 sc/source/core/tool/formulalogger.cxx|3 
 sc/source/core/tool/formulaparserpool.cxx|5 -
 sc/source/core/tool/interpr1.cxx |3 
 sc/source/core/tool/interpr2.cxx |3 
 sc/source/core/tool/interpr4.cxx |5 -
 sc/source/core/tool/progress.cxx |1 
 sc/source/filter/dif/difexp.cxx  |1 
 sc/source/filter/dif/difimp.cxx  |1 
 sc/source/filter/excel/excdoc.cxx|7 +
 sc/source/filter/excel/excform8.cxx  |1 
 sc/source/filter/excel/excimp8.cxx   |7 +
 sc/source/filter/excel/expop2.cxx|6 -
 sc/source/filter/excel/impop.cxx |5 -
 sc/source/filter/excel/namebuff.cxx  |1 
 sc/source/filter/excel/read.cxx  |1 
 sc/source/filter/excel/xecontent.cxx |3 
 sc/source/filter/excel/xehelper.cxx  |1 
 sc/source/filter/excel/xeroot.cxx|3 
 sc/source/filter/excel/xichart.cxx   |5 -
 sc/source/filter/excel/xicontent.cxx |1 
 sc/source/filter/excel/xiescher.cxx  |   15 ++-
 sc/source/filter/excel/xilink.cxx|1 
 sc/source/filter/excel/xistyle.cxx   |   11 +-
 sc/source/filter/excel/xlroot.cxx|7 +
 sc/source/filter/html/htmlexp.cxx|3 
 sc/source/filter/html/htmlpars.cxx   |   13 +--
 sc/source/filter/inc/xlroot.hxx  |3 
 sc/source/filter/lotus/filter.cxx|1 
 sc/source/filter/lotus/lotread.cxx   |1 
 sc/source/filter/oox/excelfilter.cxx |2 
 sc/source/filter/oox/workbookhelper.cxx  |2 
 sc/source/filter/rtf/eeimpars.cxx|1 
 sc/source/filter/xcl97/xcl97esc.cxx  |1 
 sc/source/filter/xml/XMLTableSourceContext.cxx   |1 
 sc/source/filter/xml/xmlcelli.cxx|1 
 sc/source/filter/xml/xmlimprt.cxx|4 -
 sc/source/filter/xml/xmlwrap.cxx |4 -
 sc/source/ui/Accessibility/AccessibleCellBase.cxx|   42 +--
 sc/source/ui/Accessibility/AccessibleDocument.cxx|2 
 sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx |2 
 sc/source/ui/Accessibility/AccessibleEditObject.cxx  |8 +-
 sc/source/ui/Accessibility/AccessibleText.cxx|8 +-
 sc/source/ui/app/inputhdl.cxx|2 
 sc/source/ui/dataprovider/csvdataprovider.cxx   

[Libreoffice-commits] core.git: sc/inc sc/source

2023-09-08 Thread Noel Grandin (via logerrit)
 sc/inc/miscuno.hxx   |8 
 sc/source/core/data/dpoutput.cxx |2 +-
 2 files changed, 1 insertion(+), 9 deletions(-)

New commits:
commit 7585667c83578e7f073409b2b94a4d34e7124115
Author: Noel Grandin 
AuthorDate: Fri Sep 8 11:30:25 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 8 13:12:05 2023 +0200

replace ScUnoHelpFunctions::VectorToSequence..

with the more standard comphelper::containerToSequence

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

diff --git a/sc/inc/miscuno.hxx b/sc/inc/miscuno.hxx
index 1a17e7afe7ea..362212c1564b 100644
--- a/sc/inc/miscuno.hxx
+++ b/sc/inc/miscuno.hxx
@@ -195,14 +195,6 @@ public:
 SetOptionalPropertyValue(rPropSet, rPropName, any);
 }
 
-template
-static css::uno::Sequence VectorToSequence( const 
std::vector& rVector )
-{
-if (rVector.empty())
-return css::uno::Sequence();
-
-return css::uno::Sequence([0], 
static_cast(rVector.size()));
-}
 private:
 static sal_Int32GetEnumPropertyImpl( const css::uno::Reference< 
css::beans::XPropertySet>& xProp,
 const OUString& rName, sal_Int32 
nDefault );
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index c964dda14c7a..c74f43d10bd7 100644
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -501,7 +501,7 @@ uno::Sequence 
getVisiblePageMembersAsResults( const uno::Re
 // All members are visible.  Return empty result.
 return uno::Sequence();
 
-return ScUnoHelpFunctions::VectorToSequence(aRes);
+return comphelper::containerToSequence(aRes);
 }
 
 }


[Libreoffice-commits] core.git: sc/inc sc/source

2023-09-07 Thread Szymon Kłos (via logerrit)
 sc/inc/document.hxx   |2 +-
 sc/source/core/data/documen8.cxx  |4 ++--
 sc/source/filter/excel/xlroot.cxx |9 ++---
 sc/source/filter/inc/xlroot.hxx   |2 +-
 4 files changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 2c3b690a900082a242e1a6494ac35338f5e8aad4
Author: Szymon Kłos 
AuthorDate: Tue Sep 5 16:58:22 2023 +0200
Commit: Szymon Kłos 
CommitDate: Thu Sep 7 12:41:50 2023 +0200

lok: save to xlsx changes column size

When xlsx spreadsheet was opened in LOK on
every save default column width was decreased.
This doesn't happen in non-LOK case.

Column width in Excel are defined by double value
which specifies number of '0' characters which fit
into the column.

On export we use mnCharWidth from XclRootData to
convert Calc twips size to number of characters.
In LOK case it was 102 while in non-lok case 101.

It was caused by different Reference Device used in
ScDocument::GetRefDevice() because in LOK case we
are in WYSWIG mode as introduced in
ScModelObj::initializeForTiledRendering in commit c25062f:
sc tiled rendering: Don't adjust the text width according to printer.

Let's use for export purpose the GetVirtualDevice_100th_mm()

Change-Id: I6709194d7924e8c7e0aaa75ff3901afbcc1f8c11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156576
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 29f72210e92e0152d52b3a1d0253fbb5d8e2dead)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156604
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 5e9163b28fd4..94ff88b23d17 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2186,7 +2186,7 @@ public:
 SfxPrinter* GetPrinter( bool bCreateIfNotExist = true );
 voidSetPrinter( VclPtr const & 
pNewPrinter );
 VirtualDevice*  GetVirtualDevice_100th_mm();
-SC_DLLPUBLIC OutputDevice*  GetRefDevice(); // WYSIWYG: Printer, otherwise 
VirtualDevice...
+SC_DLLPUBLIC OutputDevice*  GetRefDevice(bool bForceVirtDev = false); // 
WYSIWYG: Printer, otherwise VirtualDevice...
 
 boolGetNextSpellingCell( SCCOL& nCol, SCROW& nRow, SCTAB nTab,
  bool bInSel, const ScMarkData& rMark) 
const;
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 3d4d2ecc4b47..d77cb2204b60 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -196,11 +196,11 @@ VirtualDevice* ScDocument::GetVirtualDevice_100th_mm()
 return mpVirtualDevice_100th_mm;
 }
 
-OutputDevice* ScDocument::GetRefDevice()
+OutputDevice* ScDocument::GetRefDevice(bool bForceVirtDev)
 {
 // Create printer like ref device, see Writer...
 OutputDevice* pRefDevice = nullptr;
-if ( SC_MOD()->GetInputOptions().GetTextWysiwyg() )
+if ( !bForceVirtDev && SC_MOD()->GetInputOptions().GetTextWysiwyg() )
 pRefDevice = GetPrinter();
 else
 pRefDevice = GetVirtualDevice_100th_mm();
diff --git a/sc/source/filter/excel/xlroot.cxx 
b/sc/source/filter/excel/xlroot.cxx
index 587b7cff6612..0b61f9e17e7d 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -37,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -207,7 +209,8 @@ void XclRoot::SetTextEncoding( rtl_TextEncoding eTextEnc )
 void XclRoot::SetCharWidth( const XclFontData& rFontData )
 {
 mrData.mnCharWidth = 0;
-if( OutputDevice* pPrinter = GetPrinter() )
+bool bIsLOK = comphelper::LibreOfficeKit::isActive();
+if( OutputDevice* pPrinter = GetPrinter( bIsLOK ) )
 {
 vcl::Font aFont( rFontData.maName, Size( 0, rFontData.mnHeight ) );
 aFont.SetFamily( rFontData.GetScFamily( GetTextEncoding() ) );
@@ -298,9 +301,9 @@ ScModelObj* XclRoot::GetDocModelObj() const
 return pDocShell ? comphelper::getFromUnoTunnel( 
pDocShell->GetModel() ) : nullptr;
 }
 
-OutputDevice* XclRoot::GetPrinter() const
+OutputDevice* XclRoot::GetPrinter(bool bForceVirtDev) const
 {
-return GetDoc().GetRefDevice();
+return GetDoc().GetRefDevice(bForceVirtDev);
 }
 
 ScStyleSheetPool& XclRoot::GetStyleSheetPool() const
diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx
index 10b4554e155f..3085ee8c8516 100644
--- a/sc/source/filter/inc/xlroot.hxx
+++ b/sc/source/filter/inc/xlroot.hxx
@@ -204,7 +204,7 @@ public:
 /** Returns the object model of the Calc document. */
 ScModelObj* GetDocModelObj() const;
 /** Returns pointer to the printer of the Calc document. */
-OutputDevice*   GetPrinter() const;
+OutputDevice*   

[Libreoffice-commits] core.git: sc/inc

2023-09-01 Thread Eike Rathke (via logerrit)
 sc/inc/kahan.hxx |   11 +++
 1 file changed, 11 insertions(+)

New commits:
commit 1f8cc7644293e62ad6430bbeec243d3283e478d7
Author: Eike Rathke 
AuthorDate: Fri Sep 1 15:20:28 2023 +0200
Commit: Eike Rathke 
CommitDate: Fri Sep 1 18:07:21 2023 +0200

Resolves: tdf#156985 Treat adding two KahanSum differently

When summing mixed formula cells and numeric cells, cell type runs are
summed using KahanSum that when switching cell types are added. Using
add() to explicitly add the rhs m_fError compensation value separately
may had lead to effectively cancelling out the relation of sum and
error, living on with an unrelated error value. Instead, add a "final"
rhs sum+compensation.

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

diff --git a/sc/inc/kahan.hxx b/sc/inc/kahan.hxx
index 6c84f6eeef2e..ac97ae4394fa 100644
--- a/sc/inc/kahan.hxx
+++ b/sc/inc/kahan.hxx
@@ -71,8 +71,15 @@ public:
   */
 inline void add(const KahanSum& fSum)
 {
+#ifdef _WIN32
+// For some odd unknown reason WIN32 fails badly with the
+// sum+compensation value. Continue keeping the old though slightly off
+// (see tdf#156985) explicit addition of the compensation value.
 add(fSum.m_fSum);
 add(fSum.m_fError);
+#else
+add(fSum.m_fSum + fSum.m_fError);
+#endif
 add(fSum.m_fMem);
 }
 
@@ -82,8 +89,12 @@ public:
   */
 inline void subtract(const KahanSum& fSum)
 {
+#ifdef _WIN32
 add(-fSum.m_fSum);
 add(-fSum.m_fError);
+#else
+add(-(fSum.m_fSum + fSum.m_fError));
+#endif
 add(-fSum.m_fMem);
 }
 


[Libreoffice-commits] core.git: sc/inc sc/source

2023-08-15 Thread Noel Grandin (via logerrit)
 sc/inc/sheetdata.hxx   |   18 +-
 sc/source/filter/xml/sheetdata.cxx |   14 +++---
 sc/source/filter/xml/xmlbodyi.cxx  |6 +++---
 sc/source/filter/xml/xmlexprt.cxx  |   26 +-
 sc/source/filter/xml/xmlexprt.hxx  |4 ++--
 sc/source/filter/xml/xmlimprt.cxx  |6 +++---
 sc/source/filter/xml/xmlimprt.hxx  |2 +-
 sc/source/filter/xml/xmltabi.hxx   |2 +-
 8 files changed, 39 insertions(+), 39 deletions(-)

New commits:
commit 3039737af6d6e539c652f0d4b25303c30713836e
Author: Noel Grandin 
AuthorDate: Mon Aug 14 19:33:06 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Aug 15 09:36:14 2023 +0200

use sal_uInt64 when dealing with stream position

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

diff --git a/sc/inc/sheetdata.hxx b/sc/inc/sheetdata.hxx
index 55dba5a28234..5d27c55f902d 100644
--- a/sc/inc/sheetdata.hxx
+++ b/sc/inc/sheetdata.hxx
@@ -32,8 +32,8 @@ enum class XmlStyleFamily;
 
 struct ScStreamEntry
 {
-sal_Int32   mnStartOffset;
-sal_Int32   mnEndOffset;
+sal_Int64   mnStartOffset;
+sal_Int64   mnEndOffset;
 
 ScStreamEntry() :
 mnStartOffset(-1),
@@ -41,7 +41,7 @@ struct ScStreamEntry
 {
 }
 
-ScStreamEntry( sal_Int32 nStart, sal_Int32 nEnd ) :
+ScStreamEntry( sal_Int64 nStart, sal_Int64 nEnd ) :
 mnStartOffset(nStart),
 mnEndOffset(nEnd)
 {
@@ -119,7 +119,7 @@ class ScSheetSaveData
 std::vector maStreamEntries;
 std::vector maSaveEntries;
 SCTAB   mnStartTab;
-sal_Int32   mnStartOffset;
+sal_Int64   mnStartOffset;
 
 ScNoteStyleEntrymaPreviousNote;
 
@@ -142,17 +142,17 @@ public:
 voidBlockSheet( SCTAB nTab );
 boolIsSheetBlocked( SCTAB nTab ) const;
 
-voidAddStreamPos( SCTAB nTab, sal_Int32 nStartOffset, sal_Int32 
nEndOffset );
-voidGetStreamPos( SCTAB nTab, sal_Int32& rStartOffset, sal_Int32& 
rEndOffset ) const;
+voidAddStreamPos( SCTAB nTab, sal_Int64 nStartOffset, sal_Int64 
nEndOffset );
+voidGetStreamPos( SCTAB nTab, sal_Int64& rStartOffset, sal_Int64& 
rEndOffset ) const;
 boolHasStreamPos( SCTAB nTab ) const;
 
-voidStartStreamPos( SCTAB nTab, sal_Int32 nStartOffset );
-voidEndStreamPos( sal_Int32 nEndOffset );
+voidStartStreamPos( SCTAB nTab, sal_Int64 nStartOffset );
+voidEndStreamPos( sal_Int64 nEndOffset );
 
 boolHasStartPos() const { return mnStartTab >= 0; }
 
 voidResetSaveEntries();
-voidAddSavePos( SCTAB nTab, sal_Int32 nStartOffset, sal_Int32 
nEndOffset );
+voidAddSavePos( SCTAB nTab, sal_Int64 nStartOffset, sal_Int64 
nEndOffset );
 voidUseSaveEntries();
 
 voidStoreInitialNamespaces( const SvXMLNamespaceMap& rNamespaces );
diff --git a/sc/source/filter/xml/sheetdata.cxx 
b/sc/source/filter/xml/sheetdata.cxx
index bfd9abe5e598..4f62181e7d73 100644
--- a/sc/source/filter/xml/sheetdata.cxx
+++ b/sc/source/filter/xml/sheetdata.cxx
@@ -105,7 +105,7 @@ bool ScSheetSaveData::IsSheetBlocked( SCTAB nTab ) const
 return false;
 }
 
-void ScSheetSaveData::AddStreamPos( SCTAB nTab, sal_Int32 nStartOffset, 
sal_Int32 nEndOffset )
+void ScSheetSaveData::AddStreamPos( SCTAB nTab, sal_Int64 nStartOffset, 
sal_Int64 nEndOffset )
 {
 if ( nTab >= static_cast(maStreamEntries.size()) )
 maStreamEntries.resize( nTab + 1 );
@@ -113,7 +113,7 @@ void ScSheetSaveData::AddStreamPos( SCTAB nTab, sal_Int32 
nStartOffset, sal_Int3
 maStreamEntries[nTab] = ScStreamEntry( nStartOffset, nEndOffset );
 }
 
-void ScSheetSaveData::StartStreamPos( SCTAB nTab, sal_Int32 nStartOffset )
+void ScSheetSaveData::StartStreamPos( SCTAB nTab, sal_Int64 nStartOffset )
 {
 OSL_ENSURE( mnStartTab < 0, "StartStreamPos without EndStreamPos" );
 
@@ -121,7 +121,7 @@ void ScSheetSaveData::StartStreamPos( SCTAB nTab, sal_Int32 
nStartOffset )
 mnStartOffset = nStartOffset;
 }
 
-void ScSheetSaveData::EndStreamPos( sal_Int32 nEndOffset )
+void ScSheetSaveData::EndStreamPos( sal_Int64 nEndOffset )
 {
 if ( mnStartTab >= 0 )
 {
@@ -131,7 +131,7 @@ void ScSheetSaveData::EndStreamPos( sal_Int32 nEndOffset )
 }
 }
 
-void ScSheetSaveData::GetStreamPos( SCTAB nTab, sal_Int32& rStartOffset, 
sal_Int32& rEndOffset ) const
+void ScSheetSaveData::GetStreamPos( SCTAB nTab, sal_Int64& rStartOffset, 
sal_Int64& rEndOffset ) const
 {
 if ( nTab < static_cast(maStreamEntries.size()) )
 {
@@ -145,8 +145,8 @@ void ScSheetSaveData::GetStreamPos( SCTAB nTab, sal_Int32& 
rStartOffset, sal_Int
 
 bool ScSheetSaveData::HasStreamPos( SCTAB nTab ) const
 {
-sal_Int32 nStartOffset = 

[Libreoffice-commits] core.git: sc/inc sc/source

2023-08-14 Thread Caolán McNamara (via logerrit)
 sc/inc/column.hxx   |3 ++-
 sc/inc/document.hxx |3 ++-
 sc/inc/formulacell.hxx  |4 +++-
 sc/inc/table.hxx|3 ++-
 sc/source/core/data/column4.cxx |   10 ++
 sc/source/core/data/document.cxx|   12 ++--
 sc/source/core/data/formulacell.cxx |   34 +++---
 sc/source/core/data/table1.cxx  |4 ++--
 8 files changed, 54 insertions(+), 19 deletions(-)

New commits:
commit 4403b4e6bac19d89afded080d80de049aaa294ca
Author: Caolán McNamara 
AuthorDate: Tue Aug 8 17:02:40 2023 +0100
Commit: Caolán McNamara 
CommitDate: Mon Aug 14 10:32:16 2023 +0200

tdf#156677 if CheckComputeDependencies failed in expanded range...

it may have left a cell the original range needed in a dirty state,
leading to an assert when the threaded calculation is attempted which
would not have happened if the attempt to expand the range wasn't
attempted.

seen in crashtesting example: forum-mso-en4-784502.xlsx

to reproduce this, load sample document

after it has loaded:

(gdb) break column4.cxx:1946
(gdb) break column4.cxx:1966

data, recalculate, recalculate hard,

the first time breakpoint #1 gets hit:

at column4.cxx:1946 NeedsInterpret is true, so cell
{nRow = 1, nCol = 0, nTab = 3 } was dirty and is set
not-dirty by Interpret. mxGroup->mbPartOfCycle is false
so this returns successfully to allow threading.

the bt to there was:

 #0  lcl_EvalDirty(mdds::mtv::soa::multi_type_vector&, 
int, int, ScDocument&, boost::intrusive_ptr const&, bool, 
bool, bool&, bool&)
 (rCells=..., nRow1=1, nRow2=4, rDoc=..., mxGroup=..., 
bThreadingDepEval=true, bSkipRunning=false, bIsDirty=@0x7fff4a16: true, 
bAllowThreading=@0x7fff4a17: true)
 at sc/source/core/data/column4.cxx:1963
 #1  0x7fff9eef70d1 in ScColumn::HandleRefArrayForParallelism(int, int, 
boost::intrusive_ptr const&) (this=0x15ee480, nRow1=1, 
nRow2=4, mxGroup=...)
 at sc/source/core/data/column4.cxx:2012
 #2  0x7fff9f8a in ScTable::HandleRefArrayForParallelism(short, 
int, int, boost::intrusive_ptr const&)
 (this=0x1eebda0, nCol=0, nRow1=1, nRow2=4, mxGroup=...) at 
sc/source/core/data/table1.cxx:2567
 #3  0x7fff9f06b691 in 
ScDocument::HandleRefArrayForParallelism(ScAddress const&, int, 
boost::intrusive_ptr const&)
 (this=0x1ba9a40, rPos=..., nLength=4, mxGroup=...) at 
sc/source/core/data/document.cxx:1792
 #4  0x7fff9f3018f7 in (anonymous 
namespace)::ScDependantsCalculator::DoIt() (this=0x7fff4eb8) at 
sc/source/core/data/formulacell.cxx:4585
 #5  0x7fff9f30085a in 
ScFormulaCell::CheckComputeDependencies(sc::FormulaLogger::GroupScope&, bool, 
int, int, bool)
 (this=0x2142cf0, rScope=..., fromFirstRow=false, nStartOffset=0, 
nEndOffset=3, bCalcDependencyOnly=false) at 
sc/source/core/data/formulacell.cxx:4720
 #6  0x7fff9f2ff392 in 
ScFormulaCell::InterpretFormulaGroupThreading(sc::FormulaLogger::GroupScope&, 
bool&, bool&, int, int)
 (this=0x2142cf0, aScope=..., bDependencyComputed=@0x7fff56d7: 
false, bDependencyCheckFailed=@0x7fff56d6: false, nStartOffset=0, 
nEndOffset=3)
 at sc/source/core/data/formulacell.cxx:4829

so the CheckComputeDependencies at the start of
ScFormulaCell::InterpretFormulaGroupThreading is successful for aPos of
{nRow = 1, nCol = 1, nTab = 3 } and the cell is not dirty at that point

*however* in the following loop of
for (SCCOL nCurrCol = nColStart; nCurrCol <= nColEnd; ++nCurrCol)
in InterpretFormulaGroupThreading, CheckComputeDependencies for
column 3 is called and the breakpoint #2 is hit, in this case
mxGroup->mbPartOfCycle is true and the {nRow = 1, nCol = 0, nTab = 3 }
cell is set dirty again.

so later during the threaded calculation the cell is found dirty and the
ScFormulaCell::MaybeInterpret() asserts that
!rDocument.IsThreadedGroupCalcInProgress()

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

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index fe3b84842af2..0f30f64cb672 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -648,7 +648,8 @@ public:
 bool ResolveStaticReference( ScMatrix& rMat, SCCOL nMatCol, SCROW nRow1, 
SCROW nRow2 );
 void FillMatrix( ScMatrix& rMat, size_t nMatCol, SCROW nRow1, SCROW nRow2, 
svl::SharedStringPool* pPool ) const;
 formula::VectorRefArray FetchVectorRefArray( SCROW nRow1, SCROW nRow2 );
-bool HandleRefArrayForParallelism( SCROW nRow1, SCROW nRow2, const 
ScFormulaCellGroupRef& mxGroup );
+bool HandleRefArrayForParallelism( SCROW nRow1, SCROW nRow2,
+   const 

[Libreoffice-commits] core.git: sc/inc sc/source

2023-08-13 Thread Caolán McNamara (via logerrit)
 sc/inc/postit.hxx   |   20 --
 sc/source/core/data/postit.cxx  |   52 -
 sc/source/filter/inc/richstring.hxx |3 +
 sc/source/filter/oox/commentsbuffer.cxx |   94 +---
 sc/source/filter/oox/richstring.cxx |   14 +++-
 sc/source/ui/docshell/docfunc.cxx   |9 +--
 sc/source/ui/inc/docfunc.hxx|   10 ++-
 7 files changed, 126 insertions(+), 76 deletions(-)

New commits:
commit 2bda87fd8758448267c447ba26f1932325a1338d
Author: Caolán McNamara 
AuthorDate: Fri Aug 11 13:29:23 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sun Aug 13 18:13:20 2023 +0200

defer turning xlsx notes into SdrCaptions until activated

to improve import performance

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

diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index c2a5cc9a60ad..df114eaf64a5 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -174,12 +174,20 @@ private:
 sal_uInt32  mnPostItId;
 };
 
+class GenerateNoteCaption
+{
+public:
+virtual void Generate(SdrCaptionObj& rCaptionObj) = 0;
+virtual OUString GetSimpleText() const = 0;
+virtual ~GenerateNoteCaption() {};
+};
+
 class SC_DLLPUBLIC ScNoteUtil
 {
 static ScPostIt* InsertNote(ScDocument& rDoc, const ScAddress& rPos, 
ScNoteData&& rNoteData,
 bool bAlwaysCreateCaption, sal_uInt32 
nPostItId);
 
-static ScNoteData CreateNoteData(ScDocument& rDoc, const ScAddress& rPos, 
const OutlinerParaObject& rOutlinerObj,
+static ScNoteData CreateNoteData(ScDocument& rDoc, const ScAddress& rPos,
  const tools::Rectangle& rCaptionRect, 
bool bShown);
 public:
 
@@ -242,13 +250,11 @@ public:
 const OutlinerParaObject& rOutlinerObj,
 const tools::Rectangle& rCaptionRect, bool bShown 
);
 
-// similar to above, except rPropertyNames/rPropertyValues contain the
-// uno properties for the caption object formatting.
-static ScPostIt*CreateNoteFromObjectProperties(
+// similar to above, except xGenerator is a functor to apply import
+// properties to the caption object to finalize it on demand
+static ScPostIt*CreateNoteFromGenerator(
 ScDocument& rDoc, const ScAddress& rPos,
-const css::uno::Sequence& rPropertyNames,
-const css::uno::Sequence& 
rPropertyValues,
-const OutlinerParaObject& rOutlinerObj,
+std::unique_ptr xGenerator,
 const tools::Rectangle& rCaptionRect, bool bShown 
);
 
 /** Creates a cell note based on the passed string and inserts it into the
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index cdcc03e4999d..b631d7659d99 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -424,15 +424,11 @@ ScNoteCaptionCreator::ScNoteCaptionCreator( ScDocument& 
rDoc, const ScAddress& r
 
 } // namespace
 
-
 struct ScCaptionInitData
 {
 std::optional< SfxItemSet > moItemSet;  /// Caption object formatting.
-
-uno::Sequence maPropertyNames; /// Alternative import filter 
Caption object formatting property names
-uno::Sequence maPropertyValues; /// Alternative import filter 
Caption object formatting property values
-
 std::optional< OutlinerParaObject > mxOutlinerObj; /// Text object with 
all text portion formatting.
+std::unique_ptr< GenerateNoteCaption > mxGenerator; /// Operator to 
generate Caption Object from import data
 OUStringmaStyleName;/// Drawing style associated with 
the caption object.
 OUStringmaSimpleText;   /// Simple text without formatting.
 Point   maCaptionOffset;/// Caption position relative to 
cell corner.
@@ -658,13 +654,18 @@ void ScPostIt::CreateCaptionFromInitData( const 
ScAddress& rPos ) const
 bool bWasLocked = 
maNoteData.mxCaption->getSdrModelFromSdrObject().isLocked();
 maNoteData.mxCaption->getSdrModelFromSdrObject().setLock(true);
 
-// transfer ownership of outliner object to caption, or set simple text
-OSL_ENSURE( xInitData->mxOutlinerObj || !xInitData->maSimpleText.isEmpty(),
-"ScPostIt::CreateCaptionFromInitData - need either outliner para 
object or simple text" );
-if (xInitData->mxOutlinerObj)
-maNoteData.mxCaption->SetOutlinerParaObject( 
std::move(xInitData->mxOutlinerObj) );
+if (xInitData->mxGenerator)
+xInitData->mxGenerator->Generate(*maNoteData.mxCaption);
 else
-maNoteData.mxCaption->SetText( xInitData->maSimpleText );
+{
+// transfer ownership of outliner object to caption, or set simple text
+  

[Libreoffice-commits] core.git: sc/inc sc/source

2023-08-12 Thread Caolán McNamara (via logerrit)
 sc/inc/postit.hxx  |9 +
 sc/source/core/data/postit.cxx |   27 +++
 2 files changed, 36 insertions(+)

New commits:
commit 3cc72a1880d1fe2507892eabeb979aa0938dadc5
Author: Caolán McNamara 
AuthorDate: Fri Aug 11 13:14:36 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sat Aug 12 17:22:21 2023 +0200

add a CreateNoteFromObjectProperties

which an importer can use to insert a note and defer instantiating an
SdrCaption until the user activates it

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

diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index c6ac3b5a4bd4..c2a5cc9a60ad 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -242,6 +242,15 @@ public:
 const OutlinerParaObject& rOutlinerObj,
 const tools::Rectangle& rCaptionRect, bool bShown 
);
 
+// similar to above, except rPropertyNames/rPropertyValues contain the
+// uno properties for the caption object formatting.
+static ScPostIt*CreateNoteFromObjectProperties(
+ScDocument& rDoc, const ScAddress& rPos,
+const css::uno::Sequence& rPropertyNames,
+const css::uno::Sequence& 
rPropertyValues,
+const OutlinerParaObject& rOutlinerObj,
+const tools::Rectangle& rCaptionRect, bool bShown 
);
+
 /** Creates a cell note based on the passed string and inserts it into the
 document.
 
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 378323338eb1..cdcc03e4999d 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -427,6 +428,10 @@ ScNoteCaptionCreator::ScNoteCaptionCreator( ScDocument& 
rDoc, const ScAddress& r
 struct ScCaptionInitData
 {
 std::optional< SfxItemSet > moItemSet;  /// Caption object formatting.
+
+uno::Sequence maPropertyNames; /// Alternative import filter 
Caption object formatting property names
+uno::Sequence maPropertyValues; /// Alternative import filter 
Caption object formatting property values
+
 std::optional< OutlinerParaObject > mxOutlinerObj; /// Text object with 
all text portion formatting.
 OUStringmaStyleName;/// Drawing style associated with 
the caption object.
 OUStringmaSimpleText;   /// Simple text without formatting.
@@ -679,6 +684,13 @@ void ScPostIt::CreateCaptionFromInitData( const ScAddress& 
rPos ) const
 ScCaptionUtil::SetExtraItems(*maNoteData.mxCaption, 
*xInitData->moItemSet);
 }
 
+if (xInitData->maPropertyNames.getLength())
+{
+rtl::Reference 
xAnnoShape(dynamic_cast(maNoteData.mxCaption->getUnoShape().get()));
 // SvxShapeText
+assert(xAnnoShape && "will not be null");
+
static_cast(xAnnoShape.get())->setPropertyValues(xInitData->maPropertyNames,
 xInitData->maPropertyValues);
+}
+
 // set position and size of the caption object
 if( xInitData->mbDefaultPosSize )
 {
@@ -964,6 +976,21 @@ ScPostIt* ScNoteUtil::CreateNoteFromObjectData(
 return InsertNote(rDoc, rPos, std::move(aNoteData), 
/*bAlwaysCreateCaption*/false, 0/*nPostItId*/);
 }
 
+ScPostIt* ScNoteUtil::CreateNoteFromObjectProperties(
+ScDocument& rDoc, const ScAddress& rPos,
+const uno::Sequence& rPropertyNames,
+const uno::Sequence& rPropertyValues,
+const OutlinerParaObject& rOutlinerObj, const tools::Rectangle& 
rCaptionRect,
+bool bShown )
+{
+ScNoteData aNoteData(CreateNoteData(rDoc, rPos, rOutlinerObj, 
rCaptionRect, bShown));
+ScCaptionInitData& rInitData = *aNoteData.mxInitData;
+rInitData.maPropertyNames = rPropertyNames;
+rInitData.maPropertyValues = rPropertyValues;
+
+return InsertNote(rDoc, rPos, std::move(aNoteData), 
/*bAlwaysCreateCaption*/false, 0/*nPostItId*/);
+}
+
 ScPostIt* ScNoteUtil::InsertNote(ScDocument& rDoc, const ScAddress& rPos, 
ScNoteData&& rNoteData,
  bool bAlwaysCreateCaption, sal_uInt32 
nPostItId)
 {


[Libreoffice-commits] core.git: sc/inc sc/source sc/uiconfig

2023-07-25 Thread Laurent Balland (via logerrit)
 sc/inc/filter.hxx |6 ++-
 sc/inc/scabstdlg.hxx  |1 
 sc/source/filter/html/htmlimp.cxx |9 +++--
 sc/source/filter/inc/eeimport.hxx |3 +
 sc/source/filter/inc/ftools.hxx   |2 -
 sc/source/filter/inc/htmlimp.hxx  |3 +
 sc/source/filter/rtf/eeimpars.cxx |7 +++-
 sc/source/ui/attrdlg/scdlgfact.cxx|5 +++
 sc/source/ui/attrdlg/scdlgfact.hxx|1 
 sc/source/ui/dbgui/textimportoptions.cxx  |   36 +++---
 sc/source/ui/docshell/docsh.cxx   |9 +++--
 sc/source/ui/docshell/impex.cxx   |3 +
 sc/source/ui/inc/textimportoptions.hxx|8 +++--
 sc/source/ui/unoobj/filtuno.cxx   |2 +
 sc/source/ui/view/viewfun5.cxx|4 ++
 sc/uiconfig/scalc/ui/textimportoptions.ui |   47 --
 16 files changed, 114 insertions(+), 32 deletions(-)

New commits:
commit 5ae709d8519dd6d0de265d516c6158ccbdf4882e
Author: Laurent Balland 
AuthorDate: Sun Jun 4 19:03:16 2023 +0200
Commit: Laurent Balland 
CommitDate: Tue Jul 25 21:44:36 2023 +0200

follow tdf#154131 Treat also HMTL import

Add Detect numbers in scientific notation option to HTML paste
Still need some qa tests

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

diff --git a/sc/inc/filter.hxx b/sc/inc/filter.hxx
index 7a71b89c503e..6bceb74b69d0 100644
--- a/sc/inc/filter.hxx
+++ b/sc/inc/filter.hxx
@@ -50,7 +50,8 @@ class ScEEAbsImport {
 virtual ScRange GetRange() = 0;
 virtual voidWriteToDocument(
 bool bSizeColsRows = false, double nOutputFactor = 1.0,
-SvNumberFormatter* pFormatter = nullptr, bool bConvertDate = true ) = 
0;
+SvNumberFormatter* pFormatter = nullptr, bool bConvertDate = true,
+bool bConvertScientific = true ) = 0;
 };
 
 class SAL_DLLPUBLIC_RTTI ScFormatFilterPlugin {
@@ -67,7 +68,8 @@ class SAL_DLLPUBLIC_RTTI ScFormatFilterPlugin {
  const rtl_TextEncoding eSrc ) = 0;
 virtual ErrCode ScImportRTF( SvStream&, const OUString& rBaseURL, 
ScDocument*, ScRange& rRange ) = 0;
 virtual ErrCode ScImportHTML( SvStream&, const OUString& rBaseURL, 
ScDocument*, ScRange& rRange, double nOutputFactor,
-   bool bCalcWidthHeight, SvNumberFormatter* 
pFormatter, bool bConvertDate ) = 0;
+   bool bCalcWidthHeight, SvNumberFormatter* 
pFormatter, bool bConvertDate,
+   bool bConvertScientific ) = 0;
 
 // various import helpers
 virtual std::unique_ptr CreateRTFImport( ScDocument* pDoc, 
const ScRange& rRange ) = 0;
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index a06a435e7d5e..7a94af5f6fe9 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -394,6 +394,7 @@ protected:
 public:
 virtual LanguageType GetLanguageType() const = 0;
 virtual bool IsDateConversionSet() const = 0;
+virtual bool IsScientificConversionSet() const = 0;
 virtual bool IsKeepAskingSet() const = 0;
 };
 
diff --git a/sc/source/filter/html/htmlimp.cxx 
b/sc/source/filter/html/htmlimp.cxx
index 12e98a9ef018..3168a02fc4eb 100644
--- a/sc/source/filter/html/htmlimp.cxx
+++ b/sc/source/filter/html/htmlimp.cxx
@@ -45,13 +45,13 @@
 
 ErrCode ScFormatFilterPluginImpl::ScImportHTML( SvStream , const 
OUString& rBaseURL, ScDocument *pDoc,
 ScRange& rRange, double nOutputFactor, bool bCalcWidthHeight, 
SvNumberFormatter* pFormatter,
-bool bConvertDate )
+bool bConvertDate, bool bConvertScientific )
 {
 ScHTMLImport aImp( pDoc, rBaseURL, rRange, bCalcWidthHeight );
 ErrCode nErr = aImp.Read( rStream, rBaseURL );
 ScRange aR = aImp.GetRange();
 rRange.aEnd = aR.aEnd;
-aImp.WriteToDocument( true, nOutputFactor, pFormatter, bConvertDate );
+aImp.WriteToDocument( true, nOutputFactor, pFormatter, bConvertDate, 
bConvertScientific );
 return nErr;
 }
 
@@ -112,9 +112,10 @@ void ScHTMLImport::InsertRangeName( ScDocument& rDoc, 
const OUString& rName, con
 }
 
 void ScHTMLImport::WriteToDocument(
-bool bSizeColsRows, double nOutputFactor, SvNumberFormatter* pFormatter, 
bool bConvertDate )
+bool bSizeColsRows, double nOutputFactor, SvNumberFormatter* pFormatter, 
bool bConvertDate,
+bool bConvertScientific )
 {
-ScEEImport::WriteToDocument( bSizeColsRows, nOutputFactor, pFormatter, 
bConvertDate );
+ScEEImport::WriteToDocument( bSizeColsRows, nOutputFactor, pFormatter, 
bConvertDate, bConvertScientific );
 
 const ScHTMLParser* pParser = static_cast(mpParser.get());
 const ScHTMLTable* pGlobTable = pParser->GetGlobalTable();
diff --git a/sc/source/filter/inc/eeimport.hxx 
b/sc/source/filter/inc/eeimport.hxx
index d4ddc31f40c2..0d0466eb8909 100644
--- 

[Libreoffice-commits] core.git: sc/inc sc/source

2023-07-24 Thread Czeber László Ádám (via logerrit)
 sc/inc/attarray.hxx  |2 -
 sc/inc/column.hxx|6 ++--
 sc/source/core/data/attarray.cxx |   56 +++
 sc/source/core/data/table1.cxx   |   12 ++--
 4 files changed, 47 insertions(+), 29 deletions(-)

New commits:
commit 87ca7d2f146be2c309fc6fd36f9154f3ea4e4bd8
Author: Czeber László Ádám 
AuthorDate: Mon Jun 19 11:02:23 2023 +0200
Commit: Eike Rathke 
CommitDate: Tue Jul 25 00:32:30 2023 +0200

tdf#93315 sc: Only 84 empty row show in the Print Preview

Change in Calc behaviour, dropping the 84 line limit.
This way, if all rows or columns are bordered, only up to the last
cell containing data is displayed in the Print Preview. In other
cases, all bordered cells are visible.

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

diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 868118796560..cbc8f7cfe2f9 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -203,7 +203,7 @@ public:
 boolIsEmpty() const;
 
 boolGetFirstVisibleAttr( SCROW& rFirstRow ) const;
-boolGetLastVisibleAttr( SCROW& rLastRow, SCROW nLastData ) const;
+boolGetLastVisibleAttr( SCROW& rLastRow, SCROW nLastData, bool 
bSkipEmpty ) const;
 boolHasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
 boolIsVisibleEqual( const ScAttrArray& rOther,
 SCROW nStartRow, SCROW nEndRow ) const;
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 4b64537e1705..fe3b84842af2 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -313,7 +313,7 @@ public:
 boolHasSelectionMatrixFragment(const ScMarkData& rMark, const 
ScRangeList& rRangeList) const;
 
 boolGetFirstVisibleAttr( SCROW& rFirstRow ) const;
-boolGetLastVisibleAttr( SCROW& rLastRow ) const;
+boolGetLastVisibleAttr( SCROW& rLastRow, bool bSkipEmpty ) const;
 boolHasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
 boolIsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW 
nEndRow ) const;
 
@@ -890,11 +890,11 @@ inline bool ScColumn::GetFirstVisibleAttr( SCROW& 
rFirstRow ) const
 return pAttrArray->GetFirstVisibleAttr( rFirstRow );
 }
 
-inline bool ScColumn::GetLastVisibleAttr( SCROW& rLastRow ) const
+inline bool ScColumn::GetLastVisibleAttr( SCROW& rLastRow, bool bSkipEmpty ) 
const
 {
 // row of last cell is needed
 SCROW nLastData = GetLastDataPos();// always including notes, 0 if none
-return pAttrArray->GetLastVisibleAttr( rLastRow, nLastData );
+return pAttrArray->GetLastVisibleAttr( rLastRow, nLastData, bSkipEmpty );
 }
 
 inline bool ScColumn::HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 87fa2c11ccf1..02b6b9d793ed 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1942,7 +1942,7 @@ bool ScAttrArray::GetFirstVisibleAttr( SCROW& rFirstRow ) 
const
 
 const SCROW SC_VISATTR_STOP = 84;
 
-bool ScAttrArray::GetLastVisibleAttr( SCROW& rLastRow, SCROW nLastData ) const
+bool ScAttrArray::GetLastVisibleAttr( SCROW& rLastRow, SCROW nLastData, bool 
bSkipEmpty ) const
 {
 if ( mvData.empty() )
 {
@@ -1971,31 +1971,43 @@ bool ScAttrArray::GetLastVisibleAttr( SCROW& rLastRow, 
SCROW nLastData ) const
 rLastRow = nLastData;
 return false;
 }
-
-// Find a run below last data row.
+// tdf#93315: If "Suppress output of empty pages" in Calc Options is not 
checked, show empty
+// (containing only empty data cells) page in the document
 bool bFound = false;
-Search( nLastData, nPos );
-while ( nPos < mvData.size() )
+if (bSkipEmpty)
+{
+Search( nLastData, nPos );
+while ( nPos < mvData.size() )
+{
+// find range of visually equal formats
+SCSIZE nEndPos = nPos;
+while ( nEndPos < mvData.size()-1 &&
+
mvData[nEndPos].pPattern->IsVisibleEqual(*mvData[nEndPos+1].pPattern))
+++nEndPos;
+SCROW nAttrStartRow = ( nPos > 0 ) ? ( mvData[nPos-1].nEndRow + 1) 
: 0;
+if ( nAttrStartRow <= nLastData )
+nAttrStartRow = nLastData + 1;
+SCROW nAttrSize = mvData[nEndPos].nEndRow + 1 - nAttrStartRow;
+if ( nAttrSize >= SC_VISATTR_STOP )
+break;  // while, ignore this range and below
+else if ( mvData[nEndPos].pPattern->IsVisible() )
+{
+rLastRow = mvData[nEndPos].nEndRow;
+bFound = true;
+}
+nPos = nEndPos + 1;
+}
+}
+else
 {
-// find range of visually equal formats
-SCSIZE nEndPos = nPos;
-while ( nEndPos < 

[Libreoffice-commits] core.git: sc/inc sc/source

2023-07-12 Thread Tomaž Vajngerl (via logerrit)
 sc/inc/document.hxx |1 
 sc/source/core/data/documen2.cxx|   93 -
 sc/source/core/data/documen3.cxx|  312 ++
 sc/source/core/data/documen4.cxx|   63 -
 sc/source/core/data/documen5.cxx|8 
 sc/source/core/data/documen6.cxx|2 
 sc/source/core/data/documen7.cxx|   24 
 sc/source/core/data/documen8.cxx|4 
 sc/source/core/data/documen9.cxx|   16 
 sc/source/core/data/document.cxx| 1793 
 sc/source/core/data/document10.cxx  |2 
 sc/source/core/data/formulacell.cxx |2 
 12 files changed, 1056 insertions(+), 1264 deletions(-)

New commits:
commit 3cc198a0706b25c42cc8dae7e25635cbd911ac02
Author: Tomaž Vajngerl 
AuthorDate: Sun Jul 9 00:41:12 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Thu Jul 13 07:25:42 2023 +0200

sc: remove duplicated table validity checks and other duplications

Remove the duplicated table validity checks and replace them with
FetchTable(..) call, which returns nullptr if the table is not
valid and available, or the table itself. This simpifies the code
all around.

When only the check if the table is available is needed, use
HasTable(..) in those cases.

The call TableExists(..) is identical to HasTable(..) and has been
removed.

Finally use GetTableCount(), which return a SCTAB type for the number
of tables is used instead of static_cast(maTabs.size())
that was used all over the code.

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

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 27499ca9f105..157a49099184 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2620,7 +2620,6 @@ public:
 voidConvertFormulaToValue( const ScRange& rRange, 
sc::TableValues* pUndo );
 voidSwapNonEmpty( sc::TableValues& rValues );
 voidfinalizeOutlineImport();
-boolTableExists( SCTAB nTab ) const;
 
 // Returns the given column range, first allocating all the columns if 
necessary.
 SC_DLLPUBLIC ScColumnsRange GetWritableColumnsRange(SCTAB nTab, SCCOL 
nColBegin, SCCOL nColEnd);
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index e5d5df5a94cb..42f971c82cfb 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -528,19 +528,19 @@ void ScDocument::ResetClip( ScDocument* pSourceDoc, const 
ScMarkData* pMarks )
 {
 InitClipPtrs(pSourceDoc);
 
-for (SCTAB i = 0; i < static_cast(pSourceDoc->maTabs.size()); 
i++)
+for (SCTAB i = 0; i < pSourceDoc->GetTableCount(); i++)
 if (pSourceDoc->maTabs[i])
 if (!pMarks || pMarks->GetTableSelect(i))
 {
 OUString aString = pSourceDoc->maTabs[i]->GetName();
-if ( i < static_cast(maTabs.size()) )
+if (i < GetTableCount())
 {
 maTabs[i].reset( new ScTable(*this, i, aString) );
 
 }
 else
 {
-if( i > static_cast(maTabs.size()) )
+if (i > GetTableCount())
 {
 maTabs.resize(i);
 }
@@ -560,12 +560,12 @@ void ScDocument::ResetClip( ScDocument* pSourceDoc, SCTAB 
nTab )
 if (bIsClip)
 {
 InitClipPtrs(pSourceDoc);
-if (nTab >= static_cast(maTabs.size()))
+if (nTab >= GetTableCount())
 {
 maTabs.resize(nTab+1);
 }
 maTabs[nTab].reset( new ScTable(*this, nTab, "baeh") );
-if (nTab < static_cast(pSourceDoc->maTabs.size()) && 
pSourceDoc->maTabs[nTab])
+if (nTab < pSourceDoc->GetTableCount() && pSourceDoc->maTabs[nTab])
 maTabs[nTab]->SetLayoutRTL( 
pSourceDoc->maTabs[nTab]->IsLayoutRTL() );
 }
 else
@@ -577,7 +577,7 @@ void ScDocument::ResetClip( ScDocument* pSourceDoc, SCTAB 
nTab )
 void ScDocument::EnsureTable( SCTAB nTab )
 {
 bool bExtras = !bIsUndo;// Column-Widths, Row-Heights, Flags
-if (o3tl::make_unsigned(nTab) >= maTabs.size())
+if (nTab >= GetTableCount())
 maTabs.resize(nTab+1);
 
 if (!maTabs[nTab])
@@ -586,18 +586,16 @@ void ScDocument::EnsureTable( SCTAB nTab )
 
 ScRefCellValue ScDocument::GetRefCellValue( const ScAddress& rPos )
 {
-if (!TableExists(rPos.Tab()))
-return ScRefCellValue(); // empty
-
-return maTabs[rPos.Tab()]->GetRefCellValue(rPos.Col(), rPos.Row());
+if (ScTable* pTable = FetchTable(rPos.Tab()))
+return pTable->GetRefCellValue(rPos.Col(), rPos.Row());
+return ScRefCellValue(); // empty
 }
 
 ScRefCellValue ScDocument::GetRefCellValue( const 

[Libreoffice-commits] core.git: sc/inc sc/Library_sc.mk sc/source

2023-07-11 Thread Tomaž Vajngerl (via logerrit)
 sc/Library_sc.mk  |1 
 sc/inc/globstr.hrc|2 
 sc/source/ui/inc/undo/UndoThemeChange.hxx |   36 +
 sc/source/ui/theme/ThemeColorChanger.cxx  |  209 +-
 sc/source/ui/undo/UndoThemeChange.cxx |   75 ++
 5 files changed, 293 insertions(+), 30 deletions(-)

New commits:
commit 6f77ed620bbff11a1232b593be97e7d6f29aa8ac
Author: Tomaž Vajngerl 
AuthorDate: Tue Jul 11 16:02:02 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Wed Jul 12 04:04:45 2023 +0200

sc: Theme color change undo/redo - styles and direct format

This adds the code for undo/redo for change of theme colors in
styles and direct formatting.

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

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 75e9a1743d12..2b4082d3688e 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -569,6 +569,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/ui/undo/UndoUngroupSparklines \
 sc/source/ui/undo/UndoGroupSparklines \
 sc/source/ui/undo/UndoEditSparkline \
+sc/source/ui/undo/UndoThemeChange \
 sc/source/ui/unoobj/ChartRangeSelectionListener \
 sc/source/ui/unoobj/addruno \
 sc/source/ui/unoobj/afmtuno \
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 600cf9354fc0..5e6880d973d1 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -564,6 +564,8 @@
 #define STR_UNDO_GROUP_SPARKLINES   
NC_("STR_UNDO_GROUP_SPARKLINES", "Group Sparklines")
 #define STR_UNDO_UNGROUP_SPARKLINES 
NC_("STR_UNDO_UNGROUP_SPARKLINES", "Ungroup Sparklines")
 #define STR_UNDO_EDIT_SPARKLINE NC_("STR_UNDO_EDIT_SPARKLINE", 
"Edit Sparkline")
+#define STR_UNDO_THEME_CHANGE   NC_("STR_UNDO_THEME_CHANGE", 
"Theme Change")
+#define STR_UNDO_THEME_COLOR_CHANGE 
NC_("STR_UNDO_THEME_COLOR_CHANGE", "Theme Color Change")
 
 #endif
 
diff --git a/sc/source/ui/inc/undo/UndoThemeChange.hxx 
b/sc/source/ui/inc/undo/UndoThemeChange.hxx
new file mode 100644
index ..6c0558df8a7f
--- /dev/null
+++ b/sc/source/ui/inc/undo/UndoThemeChange.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include 
+
+namespace sc
+{
+class UndoThemeChange : public ScSimpleUndo
+{
+private:
+std::shared_ptr mpOldColorSet;
+std::shared_ptr mpNewColorSet;
+
+public:
+UndoThemeChange(ScDocShell& rDocShell, std::shared_ptr 
const& pOldColorSet,
+std::shared_ptr const& pNewColorSet);
+virtual ~UndoThemeChange() override;
+
+void Undo() override;
+void Redo() override;
+bool CanRepeat(SfxRepeatTarget& rTarget) const override;
+void Repeat(SfxRepeatTarget& rTarget) override;
+OUString GetComment() const override;
+};
+
+} // namespace sc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/theme/ThemeColorChanger.cxx 
b/sc/source/ui/theme/ThemeColorChanger.cxx
index 8eaa6ed0fcb6..66683adbd682 100644
--- a/sc/source/ui/theme/ThemeColorChanger.cxx
+++ b/sc/source/ui/theme/ThemeColorChanger.cxx
@@ -20,12 +20,20 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+
+#include 
 
 namespace sc
 {
@@ -58,10 +66,10 @@ bool changeBorderLine(editeng::SvxBorderLine* pBorderLine, 
model::ColorSet const
 return false;
 }
 
-void changeCellItems(SfxItemSet& rItemSet, model::ColorSet const& rColorSet)
+bool changeCellItems(SfxItemSet& rItemSet, model::ColorSet const& rColorSet)
 {
 const SfxPoolItem* pItem = nullptr;
-
+bool bChanged = false;
 if (rItemSet.HasItem(ATTR_FONT_COLOR, ))
 {
 auto const* pColorItem = static_cast(pItem);
@@ -77,6 +85,7 @@ void changeCellItems(SfxItemSet& rItemSet, model::ColorSet 
const& rColorSet)
 SvxColorItem aColorItem(*pColorItem);
 aColorItem.setColor(aColor);
 rItemSet.Put(aColorItem);
+bChanged = true;
 }
 }
 }
@@ -95,6 +104,7 @@ void changeCellItems(SfxItemSet& rItemSet, model::ColorSet 
const& rColorSet)
 SvxBrushItem aNewBrushItem(*pBrushItem);
 aNewBrushItem.SetColor(aColor);
 rItemSet.Put(aNewBrushItem);
+bChanged = true;
 }
 }
 }
@@ -102,60 +112,199 @@ void changeCellItems(SfxItemSet& rItemSet, 
model::ColorSet const& rColorSet)
 {
 

[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-07-11 Thread Justin Luth (via logerrit)
 sc/inc/dociter.hxx  |4 ++--
 sc/qa/unit/subsequent_filters_test2.cxx |7 ---
 sc/source/core/data/dociter.cxx |   11 +++
 sc/source/filter/oox/workbookhelper.cxx |1 +
 sc/source/ui/docshell/docsh5.cxx|   10 ++
 sc/source/ui/inc/docsh.hxx  |1 +
 6 files changed, 21 insertions(+), 13 deletions(-)

New commits:
commit d15c4caabaa21e0efe3a08ffbe145390e802bab9
Author: Justin Luth 
AuthorDate: Tue Sep 20 08:14:41 2022 -0400
Commit: Justin Luth 
CommitDate: Tue Jul 11 19:38:07 2023 +0200

tdf#123026 xlsx import: recalc optimal row height on import

This patch depends on the previous patch for this bug report,
which allows each sheet to hold its own default row height.

The given height for the row might not be enough to fit
the content. If the row is set to use optimal height,
that will be corrected as soon as the row is edited.

Obviously, it should not require an edit to be correct
on FILEOPEN, so this patch recalculates after loading the document.

This might have a very negative effect on the time needed
to open a file. I couldn't duplicate the XLS method
because Library_scfilt.mk doesn't link to ScSizeDeviceProvider.
The existing UpdateAllRowHeights wasn't designed to
allow any performance improvements, so I made a new one.
The new one is based on the newer ScDocRowHeightUpdater
class - so perhaps the older method can be phased out.
This new UpdateAllRowHeights could replace the
XLS bSetRowHeights clause - with hopefully some performance
benefit.

I'm not sure I'm ready for the regression hate
that would come from the inevitable performance implications.

Testing however doesn't suggest a huge slowdown. I tested with
time make sc.check
before the fix I was getting 16m 4s +- 10s
after the fix I was getting 16m 25s +- 10s

Specific test showing the need for these patches:
make CppunitTest_sc_subsequent_filters_test2 \
CPPUNIT_TEST_NAME=testTdf123026_optimalRowHeight

Impacted unit tests (without the previous patch)
are documented in earlier patchsets.

make CppunitTest_sc_subsequent_export_test \
CPPUNIT_TEST_NAME=testMiscRowHeightExport

make CppunitTest_sc_subsequent_export_test2

make CppunitTest_sc_jumbosheets_test CPPUNIT_TEST_NAME=testTdf134553

Change-Id: I6d020c1a5137dd4f05e20e82b1764a102b7f56d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140260
Reviewed-by: Justin Luth 
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index b73d175a000f..6be5a77e5e5b 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -457,10 +457,10 @@ public:
 ScDocument& rDoc, OutputDevice* pOutDev, double fPPTX, double fPPTY,
 const ::std::vector* pTabRangesArray);
 
-void update();
+void update(const bool bOnlyUsedRows = false);
 
 private:
-void updateAll();
+void updateAll(const bool bOnlyUsedRows);
 
 private:
 ScDocument& mrDoc;
diff --git a/sc/qa/unit/subsequent_filters_test2.cxx 
b/sc/qa/unit/subsequent_filters_test2.cxx
index d5ce977b3a4e..790ab5c99057 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -148,13 +148,6 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest2, 
testOptimalHeightReset)
 CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testTdf123026_optimalRowHeight)
 {
 createScDoc("xlsx/tdf123026_optimalRowHeight.xlsx");
-
-dispatchCommand(mxComponent, ".uno:SelectColumn", {});
-dispatchCommand(
-mxComponent, ".uno:SetOptimalRowHeight",
-comphelper::InitPropertySequence({ { "aExtraHeight", 
uno::Any(sal_uInt16(0)) } }));
-Scheduler::ProcessEventsToIdle();
-
 SCTAB nTab = 0;
 SCROW nRow = 4;
 int nHeight = convertTwipToMm100(getScDoc()->GetRowHeight(nRow, nTab, 
false));
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index fd4fa7afe42f..267d814daf76 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1615,12 +1615,12 @@ 
ScDocRowHeightUpdater::ScDocRowHeightUpdater(ScDocument& rDoc, OutputDevice* pOu
 {
 }
 
-void ScDocRowHeightUpdater::update()
+void ScDocRowHeightUpdater::update(const bool bOnlyUsedRows)
 {
 if (!mpTabRangesArray || mpTabRangesArray->empty())
 {
 // No ranges defined. Update all rows in all tables.
-updateAll();
+updateAll(bOnlyUsedRows);
 return;
 }
 
@@ -1668,7 +1668,7 @@ void ScDocRowHeightUpdater::update()
 }
 }
 
-void ScDocRowHeightUpdater::updateAll()
+void ScDocRowHeightUpdater::updateAll(const bool bOnlyUsedRows)
 {
 sal_uInt64 nCellCount = 0;
 for (SCTAB nTab = 0; nTab < mrDoc.GetTableCount(); ++nTab)
@@ -1689,7 +1689,10 @@ void ScDocRowHeightUpdater::updateAll()
 if (!ValidTab(nTab) || 

[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-06-27 Thread Tomaž Vajngerl (via logerrit)
 sc/inc/CommonProperties.hxx   |   14 
 sc/inc/unonames.hxx   |5 +++
 sc/qa/extras/scstyleobj.cxx   |4 ++
 sc/qa/extras/sctablecolumnobj.cxx |4 ++
 sc/qa/extras/sctablerowobj.cxx|4 ++
 sc/source/filter/inc/stylesbuffer.hxx |4 ++
 sc/source/filter/oox/stylesbuffer.cxx |   11 ++
 sc/source/ui/unoobj/cellsuno.cxx  |   54 +++---
 sc/source/ui/unoobj/styleuno.cxx  |9 -
 9 files changed, 52 insertions(+), 57 deletions(-)

New commits:
commit 28e9f2bc390e10339859306ad5f733d377134ca8
Author: Tomaž Vajngerl 
AuthorDate: Fri Jun 23 20:03:27 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Tue Jun 27 11:07:49 2023 +0200

sc: import and prop. theme color support for cell borders

Adds import for theme colors for cell borders and UNO properties
for the cell border theme (complex) colors.

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

diff --git a/sc/inc/CommonProperties.hxx b/sc/inc/CommonProperties.hxx
index 2c7d1e0a080b..4a2931753c79 100644
--- a/sc/inc/CommonProperties.hxx
+++ b/sc/inc/CommonProperties.hxx
@@ -17,4 +17,18 @@
 { SC_UNONAME_CCOLOR, ATTR_FONT_COLOR, cppu::UnoType::get(), 0, 
MID_COLOR_RGB }, \
 { SC_UNONAME_CHAR_COMPLEX_COLOR, ATTR_FONT_COLOR, 
cppu::UnoType::get(), 0, MID_COMPLEX_COLOR }, \
 
+#define CELL_BORDER_PROPERTIES \
+{ SC_UNONAME_BOTTBORDER, ATTR_BORDER, 
cppu::UnoType::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS }, \
+{ SC_UNONAME_BOTTBORDER2, ATTR_BORDER, 
cppu::UnoType::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS }, \
+{ SC_UNONAME_LEFTBORDER, ATTR_BORDER, 
cppu::UnoType::get(), 0, LEFT_BORDER | CONVERT_TWIPS }, \
+{ SC_UNONAME_LEFTBORDER2, ATTR_BORDER, 
cppu::UnoType::get(), 0, LEFT_BORDER | CONVERT_TWIPS }, \
+{ SC_UNONAME_RIGHTBORDER, ATTR_BORDER, 
cppu::UnoType::get(), 0, RIGHT_BORDER | CONVERT_TWIPS }, \
+{ SC_UNONAME_RIGHTBORDER2, ATTR_BORDER, 
cppu::UnoType::get(), 0, RIGHT_BORDER | CONVERT_TWIPS }, \
+{ SC_UNONAME_TOPBORDER, ATTR_BORDER, 
cppu::UnoType::get(), 0, TOP_BORDER | CONVERT_TWIPS }, \
+{ SC_UNONAME_TOPBORDER2, ATTR_BORDER, 
cppu::UnoType::get(), 0, TOP_BORDER | CONVERT_TWIPS }, \
+{ SC_UNONAME_BOTTOM_BORDER_COMPLEX_COLOR, ATTR_BORDER, 
cppu::UnoType::get(), 0, MID_BORDER_BOTTOM_COLOR }, \
+{ SC_UNONAME_LEFT_BORDER_COMPLEX_COLOR, ATTR_BORDER, 
cppu::UnoType::get(), 0, MID_BORDER_LEFT_COLOR }, \
+{ SC_UNONAME_RIGHT_BORDER_COMPLEX_COLOR, ATTR_BORDER, 
cppu::UnoType::get(), 0, MID_BORDER_RIGHT_COLOR }, \
+{ SC_UNONAME_TOP_BORDER_COMPLEX_COLOR, ATTR_BORDER, 
cppu::UnoType::get(), 0, MID_BORDER_TOP_COLOR }, \
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index 7a7396a358e4..522582a36fb5 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -133,6 +133,11 @@ inline constexpr OUStringLiteral SC_UNONAME_LEFTBORDER2
  = u"LeftBorder2";
 inline constexpr OUStringLiteral SC_UNONAME_RIGHTBORDER2 = u"RightBorder2";
 inline constexpr OUStringLiteral SC_UNONAME_TOPBORDER2   = u"TopBorder2";
 
+inline constexpr OUStringLiteral SC_UNONAME_BOTTOM_BORDER_COMPLEX_COLOR = 
u"BottomBorderComplexColor";
+inline constexpr OUStringLiteral SC_UNONAME_LEFT_BORDER_COMPLEX_COLOR = 
u"LeftBorderComplexColor";
+inline constexpr OUStringLiteral SC_UNONAME_RIGHT_BORDER_COMPLEX_COLOR = 
u"RightBorderComplexColor";
+inline constexpr OUStringLiteral SC_UNONAME_TOP_BORDER_COMPLEX_COLOR = 
u"TopBorderComplexColor";
+
 inline constexpr OUStringLiteral SC_UNONAME_DIAGONAL_TLBR= u"DiagonalTLBR";
 inline constexpr OUStringLiteral SC_UNONAME_DIAGONAL_BLTR= u"DiagonalBLTR";
 
diff --git a/sc/qa/extras/scstyleobj.cxx b/sc/qa/extras/scstyleobj.cxx
index 813a59db944b..12b3b0ebde8d 100644
--- a/sc/qa/extras/scstyleobj.cxx
+++ b/sc/qa/extras/scstyleobj.cxx
@@ -61,6 +61,7 @@ ScStyleObj::ScStyleObj()
 , XNamed("ScStyleObj")
 , XPropertySet({ "BottomBorder",
  "BottomBorder2",
+ "BottomBorderComplexColor",
  "CellProtection",
  "CharLocale",
  "CharLocaleAsian",
@@ -75,14 +76,17 @@ ScStyleObj::ScStyleObj()
  "HoriJustify",
  "LeftBorder",
  "LeftBorder2",
+ "LeftBorderComplexColor",
  "NumberFormat",
  "Orientation",
  "RightBorder",
  "RightBorder2",
+ "RightBorderComplexColor",
  "ShadowFormat",
  "TableBorder",
  "TopBorder",
  "TopBorder2",
+ "TopBorderComplexColor",
  "UserDefinedAttributes",
   

[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-06-26 Thread Justin Luth (via logerrit)
 sc/inc/document.hxx  |1 
 sc/inc/table.hxx |   11 +++
 sc/qa/unit/data/xlsx/tdf123026_optimalRowHeight.xlsx |binary
 sc/qa/unit/subsequent_filters_test2.cxx  |   20 +
 sc/source/core/data/column2.cxx  |   28 ---
 sc/source/core/data/document.cxx |9 ++
 sc/source/core/data/fillinfo.cxx |4 +-
 sc/source/core/data/table1.cxx   |6 ++--
 sc/source/core/data/table2.cxx   |   16 +-
 sc/source/core/data/table7.cxx   |2 -
 sc/source/filter/oox/worksheethelper.cxx |6 
 sc/source/ui/view/cellsh3.cxx|4 +-
 sc/source/ui/view/viewdata.cxx   |3 +-
 sc/source/ui/view/viewfunc.cxx   |   10 +++---
 14 files changed, 90 insertions(+), 30 deletions(-)

New commits:
commit b0f55a04f081ff7f566c3ba5b6d6d6be3675e0f7
Author: Justin Luth 
AuthorDate: Mon Jun 12 11:15:09 2023 -0400
Commit: Justin Luth 
CommitDate: Tue Jun 27 02:27:58 2023 +0200

tdf#123026 sc xlsx: provide per-sheet optimal row height setting

This patch is a pre-requisite for a follow-up patch
which will run SetOptimalRowHeight on all un-sized rows
on FILEOPEN.

XLSX sheets can provide a default height for all rows on that sheet.
That imported/round-tripped well.
However, if Calc optimizes these rows, the undefined rows likely
will change height - since the default XLSX row height tends to be
300 twips, while Calc uses 256 (in ScGlobal::nStdRowHeight).

This patch allows a sheet to define its optimal row height,
so that running .uno:SetOptimalRowHeight doesn't change
any row heights, and doesn't cause all kinds of new row definitions.

make CppunitTest_sc_subsequent_filters_test2 \
CPPUNIT_TEST_NAME=testTdf123026_optimalRowHeight

Change-Id: I35008107d71f66375c7e9469e559f3836cf14df5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152909
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Dennis Francis 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 300d6f7817e0..27499ca9f105 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -990,6 +990,7 @@ public:
 boolIsStreamValidLocked() const { return 
mbStreamValidLocked; }
 boolIsPendingRowHeights( SCTAB nTab ) const;
 voidSetPendingRowHeights( SCTAB nTab, bool bSet );
+sal_uInt16 GetSheetOptimalMinRowHeight(SCTAB nTab) const;
 SC_DLLPUBLIC void   SetLayoutRTL( SCTAB nTab, bool bRTL, 
ScObjectHandling eObjectHandling = ScObjectHandling::RecalcPosMode);
 SC_DLLPUBLIC bool   IsLayoutRTL( SCTAB nTab ) const;
 SC_DLLPUBLIC bool   IsNegativePage( SCTAB nTab ) const;
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 0662053cb89c..1a62a7e56321 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -186,6 +186,9 @@ private:
 SCCOL   mnEndCol;
 SCROW   mnEndRow;
 
+// Standard row height for this sheet - benefits XLSX because default 
height defined per sheet
+sal_uInt16 mnOptimalMinRowHeight; // in Twips
+
 std::unique_ptr pTabProtection;
 
 std::unique_ptr> mpColWidth;
@@ -873,6 +876,14 @@ public:
 // nPPT to test for modification
 voidSetManualHeight( SCROW nStartRow, SCROW nEndRow, bool bManual 
);
 
+sal_uInt16 GetOptimalMinRowHeight() const
+{
+if (!mnOptimalMinRowHeight)
+return ScGlobal::nStdRowHeight;
+return mnOptimalMinRowHeight;
+};
+void SetOptimalMinRowHeight(sal_uInt16 nSet) { mnOptimalMinRowHeight = 
nSet; }
+
 sal_uInt16  GetColWidth( SCCOL nCol, bool bHiddenAsZero = true ) const;
 tools::Long GetColWidth( SCCOL nStartCol, SCCOL nEndCol ) const;
 sal_uInt16 GetRowHeight( SCROW nRow, SCROW* pStartRow, SCROW* pEndRow, 
bool bHiddenAsZero = true ) const;
diff --git a/sc/qa/unit/data/xlsx/tdf123026_optimalRowHeight.xlsx 
b/sc/qa/unit/data/xlsx/tdf123026_optimalRowHeight.xlsx
new file mode 100644
index ..d4ea71e1a663
Binary files /dev/null and 
b/sc/qa/unit/data/xlsx/tdf123026_optimalRowHeight.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters_test2.cxx 
b/sc/qa/unit/subsequent_filters_test2.cxx
index a0a4a92d299b..d5ce977b3a4e 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -44,8 +44,10 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
+#include 
 #include "helper/qahelper.hxx"
 
 using namespace ::com::sun::star;
@@ -143,6 +145,24 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest2, 
testOptimalHeightReset)
 CPPUNIT_ASSERT_EQUAL(nOptimalHeight, nHeight);
 }
 

[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-06-25 Thread Noel Grandin (via logerrit)
 sc/inc/patattr.hxx   |   16 
 sc/qa/unit/helper/qahelper.cxx   |4 ++--
 sc/source/core/data/patattr.cxx  |   18 +-
 sc/source/filter/excel/xecontent.cxx |2 +-
 sc/source/filter/excel/xehelper.cxx  |6 +++---
 sc/source/filter/excel/xestyle.cxx   |2 +-
 sc/source/ui/view/output2.cxx|6 +++---
 sc/source/ui/view/printfun.cxx   |4 ++--
 8 files changed, 29 insertions(+), 29 deletions(-)

New commits:
commit f55792eed4d2e0f6891a2bdd8639f8e962d95c5b
Author: Noel Grandin 
AuthorDate: Sun Jun 25 15:41:37 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Jun 26 07:53:06 2023 +0200

convert ScAutoFontColorMode to scoped enum

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

diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx
index 4d7df0c6ac23..1df3a31d6fac 100644
--- a/sc/inc/patattr.hxx
+++ b/sc/inc/patattr.hxx
@@ -39,15 +39,15 @@ enum class ScRotateDir : sal_uInt8;
 
 ///  how to treat COL_AUTO in GetFont:
 
-enum ScAutoFontColorMode
+enum class ScAutoFontColorMode
 {
-SC_AUTOCOL_RAW, ///< COL_AUTO is returned
-SC_AUTOCOL_BLACK,   ///< always use black
-SC_AUTOCOL_PRINT,   ///< black or white, depending on background
-SC_AUTOCOL_DISPLAY, ///< from style settings, or black/white if needed
-SC_AUTOCOL_IGNOREFONT,  ///< like DISPLAY, but ignore stored font color 
(assume COL_AUTO)
-SC_AUTOCOL_IGNOREBACK,  ///< like DISPLAY, but ignore stored background 
color (use configured color)
-SC_AUTOCOL_IGNOREALL///< like DISPLAY, but ignore stored font and 
background colors
+Raw, ///< COL_AUTO is returned
+Black,   ///< always use black
+Print,   ///< black or white, depending on background
+Display, ///< from style settings, or black/white if needed
+IgnoreFont,  ///< like DISPLAY, but ignore stored font color (assume 
COL_AUTO)
+IgnoreBack,  ///< like DISPLAY, but ignore stored background color (use 
configured color)
+IgnoreAll///< like DISPLAY, but ignore stored font and background 
colors
 };
 
 class SC_DLLPUBLIC ScPatternAttr final : public SfxSetItem
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index efb2e68c4fbc..890a330f147d 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -179,7 +179,7 @@ void ScModelTestBase::testFormats(ScDocument* 
pDoc,std::u16string_view sFormat)
 Color aColor;
 
 pPattern->fillFontOnly(aFont);
-pPattern->fillColor(aColor, SC_AUTOCOL_RAW);
+pPattern->fillColor(aColor, ScAutoFontColorMode::Raw);
 CPPUNIT_ASSERT_EQUAL_MESSAGE("font size should be 10", tools::Long(200), 
aFont.GetFontSize().getHeight());
 CPPUNIT_ASSERT_EQUAL_MESSAGE("font color should be black", COL_AUTO, 
aColor);
 pPattern = pDoc->GetPattern(0,1,1);
@@ -193,7 +193,7 @@ void ScModelTestBase::testFormats(ScDocument* 
pDoc,std::u16string_view sFormat)
 CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, 
aFont.GetWeight());
 pPattern = pDoc->GetPattern(1,0,1);
 pPattern->fillFontOnly(aFont);
-pPattern->fillColor(aColor, SC_AUTOCOL_RAW);
+pPattern->fillColor(aColor, ScAutoFontColorMode::Raw);
 CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be blue", COL_BLUE, aColor);
 pPattern = pDoc->GetPattern(1,1,1);
 pPattern->fillFontOnly(aFont);
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 199d41ab25f1..1bb2e50daf4d 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -448,11 +448,11 @@ void ScPatternAttr::fillColor(Color& rColor, const 
SfxItemSet& rItemSet, ScAutoF
 aColor = pColorItem->GetValue();
 
 
-if ((aColor == COL_AUTO && eAutoMode != SC_AUTOCOL_RAW)
-|| eAutoMode == SC_AUTOCOL_IGNOREFONT
-|| eAutoMode == SC_AUTOCOL_IGNOREALL)
+if ((aColor == COL_AUTO && eAutoMode != ScAutoFontColorMode::Raw)
+|| eAutoMode == ScAutoFontColorMode::IgnoreFont
+|| eAutoMode == ScAutoFontColorMode::IgnoreAll)
 {
-if ( eAutoMode == SC_AUTOCOL_BLACK )
+if ( eAutoMode == ScAutoFontColorMode::Black )
 aColor = COL_BLACK;
 else
 {
@@ -472,12 +472,12 @@ void ScPatternAttr::fillColor(Color& rColor, const 
SfxItemSet& rItemSet, ScAutoF
 
 //  if background color attribute is transparent, use window color 
for brightness comparisons
 if (aBackColor == COL_TRANSPARENT
-|| eAutoMode == SC_AUTOCOL_IGNOREBACK
-|| eAutoMode == SC_AUTOCOL_IGNOREALL)
+|| eAutoMode == ScAutoFontColorMode::IgnoreBack
+|| eAutoMode == ScAutoFontColorMode::IgnoreAll)
 {
 if (!comphelper::LibreOfficeKit::isActive())
 {
-  

[Libreoffice-commits] core.git: sc/inc sc/source solenv/clang-format

2023-06-25 Thread Tomaž Vajngerl (via logerrit)
 sc/inc/CommonProperties.hxx  |   20 
 sc/source/ui/unoobj/cellsuno.cxx |   37 +
 sc/source/ui/unoobj/styleuno.cxx |7 +++
 solenv/clang-format/excludelist  |1 +
 4 files changed, 37 insertions(+), 28 deletions(-)

New commits:
commit bcd3ca80cd1f59c4b94660daa8c3e66944caf58f
Author: Tomaž Vajngerl 
AuthorDate: Fri Jun 23 17:13:44 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sun Jun 25 17:36:00 2023 +0200

sc: simplify and fix prop. mapping for cell BG and char theme color

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

diff --git a/sc/inc/CommonProperties.hxx b/sc/inc/CommonProperties.hxx
new file mode 100644
index ..2c7d1e0a080b
--- /dev/null
+++ b/sc/inc/CommonProperties.hxx
@@ -0,0 +1,20 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#define CELL_BACKGROUND_COLOR_PROPERTIES \
+{ SC_UNONAME_CELLBACK, ATTR_BACKGROUND, cppu::UnoType::get(), 
0, MID_BACK_COLOR }, \
+{ SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR, ATTR_BACKGROUND, 
cppu::UnoType::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
}, \
+
+#define CHAR_COLOR_PROPERTIES \
+{ SC_UNONAME_CCOLOR, ATTR_FONT_COLOR, cppu::UnoType::get(), 0, 
MID_COLOR_RGB }, \
+{ SC_UNONAME_CHAR_COMPLEX_COLOR, ATTR_FONT_COLOR, 
cppu::UnoType::get(), 0, MID_COMPLEX_COLOR }, \
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 371ea346d364..d6a836fdc8d9 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -137,6 +137,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -156,12 +157,10 @@ static const SfxItemPropertySet* lcl_GetCellsPropertySet()
 { SC_UNONAME_ASIANVERT,ATTR_VERTICAL_ASIAN,cppu::UnoType::get(), 
 0, 0 },
 { SC_UNONAME_BOTTBORDER,ATTR_BORDER,   
::cppu::UnoType::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
 { SC_UNONAME_BOTTBORDER2,ATTR_BORDER,  
::cppu::UnoType::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
-{ SC_UNONAME_CELLBACK, ATTR_BACKGROUND,
cppu::UnoType::get(),0, MID_BACK_COLOR },
-{ SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR, ATTR_BACKGROUND, 
cppu::UnoType::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
+CELL_BACKGROUND_COLOR_PROPERTIES
 { SC_UNONAME_CELLPRO,  ATTR_PROTECTION,
cppu::UnoType::get(), 0, 0 },
 { SC_UNONAME_CELLSTYL, 
SC_WID_UNO_CELLSTYL,cppu::UnoType::get(),0, 0 },
-{ SC_UNONAME_CCOLOR,   ATTR_FONT_COLOR,
cppu::UnoType::get(),0, 0 },
-{ SC_UNONAME_CHAR_COMPLEX_COLOR,   ATTR_FONT_COLOR, 
cppu::UnoType::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
+CHAR_COLOR_PROPERTIES
 { SC_UNONAME_COUTL,ATTR_FONT_CONTOUR,  cppu::UnoType::get(), 
 0, 0 },
 { SC_UNONAME_CCROSS,   
ATTR_FONT_CROSSEDOUT,cppu::UnoType::get(), 0, 
MID_CROSSED_OUT },
 { SC_UNONAME_CEMPHAS,  
ATTR_FONT_EMPHASISMARK,cppu::UnoType::get(), 0, MID_EMPHASIS 
},
@@ -267,12 +266,10 @@ static const SfxItemPropertySet* lcl_GetRangePropertySet()
 { SC_UNONAME_ASIANVERT,ATTR_VERTICAL_ASIAN,cppu::UnoType::get(), 
 0, 0 },
 { SC_UNONAME_BOTTBORDER,ATTR_BORDER,   
::cppu::UnoType::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
 { SC_UNONAME_BOTTBORDER2,ATTR_BORDER,  
::cppu::UnoType::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
-{ SC_UNONAME_CELLBACK, ATTR_BACKGROUND,
cppu::UnoType::get(),0, MID_BACK_COLOR },
-{ SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR, ATTR_BACKGROUND, 
cppu::UnoType::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
+CELL_BACKGROUND_COLOR_PROPERTIES
 { SC_UNONAME_CELLPRO,  ATTR_PROTECTION,
cppu::UnoType::get(), 0, 0 },
 { SC_UNONAME_CELLSTYL, 
SC_WID_UNO_CELLSTYL,cppu::UnoType::get(),0, 0 },
-{ SC_UNONAME_CCOLOR,   ATTR_FONT_COLOR,
cppu::UnoType::get(),0, 0 },
-{ SC_UNONAME_CHAR_COMPLEX_COLOR,   ATTR_FONT_COLOR, 
cppu::UnoType::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
+CHAR_COLOR_PROPERTIES
 { SC_UNONAME_COUTL,ATTR_FONT_CONTOUR,  cppu::UnoType::get(), 
 0, 0 },
 { SC_UNONAME_CCROSS,   
ATTR_FONT_CROSSEDOUT,cppu::UnoType::get(), 0, 
MID_CROSSED_OUT },
 { SC_UNONAME_CEMPHAS,  
ATTR_FONT_EMPHASISMARK,cppu::UnoType::get(), 0, MID_EMPHASIS 
},
@@ -379,12 +376,10 @@ 

[Libreoffice-commits] core.git: sc/inc sc/source

2023-06-23 Thread Noel Grandin (via logerrit)
 sc/inc/patattr.hxx  |4 +++-
 sc/source/core/data/patattr.cxx |   14 ++
 2 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 8ec8d592e31aebe19075e9f89c4c2c7abcf8d420
Author: Noel Grandin 
AuthorDate: Thu Jun 22 09:38:50 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jun 23 10:36:53 2023 +0200

Speed up scrolling through large document with lots of patterns

Cache visibility for use in ScPatternAttr::IsVisible

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

diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx
index ba15cfb1dd27..4d7df0c6ac23 100644
--- a/sc/inc/patattr.hxx
+++ b/sc/inc/patattr.hxx
@@ -54,6 +54,7 @@ class SC_DLLPUBLIC ScPatternAttr final : public SfxSetItem
 {
 std::optional  pName;
 mutable std::optional mxHashCode;
+mutable std::optional mxVisible;
 ScStyleSheet*  pStyle;
 sal_uInt64 mnKey;
 public:
@@ -184,11 +185,12 @@ public:
 // TODO: tdf#135215: This is a band-aid to detect changes and invalidate 
the hash,
 // a proper way would be probably to override SfxItemSet::Changed(), but 
6cb400f41df0dd10
 // hardcoded SfxSetItem to contain SfxItemSet.
-SfxItemSet& GetItemSet() { mxHashCode.reset(); return 
SfxSetItem::GetItemSet(); }
+SfxItemSet& GetItemSet() { mxHashCode.reset(); mxVisible.reset(); return 
SfxSetItem::GetItemSet(); }
 using SfxSetItem::GetItemSet;
 
 private:
 voidCalcHashCode() const;
+boolCalcVisible() const;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 706ab6ae5c19..199d41ab25f1 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -981,6 +981,7 @@ void ScPatternAttr::GetFromEditItemSet( const SfxItemSet* 
pEditSet )
 return;
 GetFromEditItemSet( GetItemSet(), *pEditSet );
 mxHashCode.reset();
+mxVisible.reset();
 }
 
 void ScPatternAttr::FillEditParaItems( SfxItemSet* pEditSet ) const
@@ -1024,6 +1025,7 @@ void ScPatternAttr::DeleteUnchanged( const ScPatternAttr* 
pOldAttrs )
 {
 rThisSet.ClearItem( nSubWhich );
 mxHashCode.reset();
+mxVisible.reset();
 }
 }
 else if ( eOldState != SfxItemState::DONTCARE )
@@ -1033,6 +1035,7 @@ void ScPatternAttr::DeleteUnchanged( const ScPatternAttr* 
pOldAttrs )
 {
 rThisSet.ClearItem( nSubWhich );
 mxHashCode.reset();
+mxVisible.reset();
 }
 }
 }
@@ -1054,6 +1057,7 @@ void ScPatternAttr::ClearItems( const sal_uInt16* pWhich )
 for (sal_uInt16 i=0; pWhich[i]; i++)
 rSet.ClearItem(pWhich[i]);
 mxHashCode.reset();
+mxVisible.reset();
 }
 
 static SfxStyleSheetBase* lcl_CopyStyleToPool
@@ -1189,6 +1193,13 @@ ScPatternAttr* ScPatternAttr::PutInPool( ScDocument* 
pDestDoc, ScDocument* pSrcD
 }
 
 bool ScPatternAttr::IsVisible() const
+{
+if (!mxVisible)
+mxVisible = CalcVisible();
+return *mxVisible;
+}
+
+bool ScPatternAttr::CalcVisible() const
 {
 const SfxItemSet& rSet = GetItemSet();
 
@@ -1312,6 +1323,7 @@ void ScPatternAttr::SetStyleSheet( ScStyleSheet* 
pNewStyle, bool bClearDirectFor
 pStyle = nullptr;
 }
 mxHashCode.reset();
+mxVisible.reset();
 }
 
 void ScPatternAttr::UpdateStyleSheet(const ScDocument& rDoc)
@@ -1338,6 +1350,7 @@ void ScPatternAttr::UpdateStyleSheet(const ScDocument& 
rDoc)
 else
 pStyle = nullptr;
 mxHashCode.reset();
+mxVisible.reset();
 }
 
 void ScPatternAttr::StyleToName()
@@ -1350,6 +1363,7 @@ void ScPatternAttr::StyleToName()
 pStyle = nullptr;
 GetItemSet().SetParent( nullptr );
 mxHashCode.reset();
+mxVisible.reset();
 }
 }
 


[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-06-21 Thread Tomaž Vajngerl (via logerrit)
 sc/inc/patattr.hxx |   50 +---
 sc/qa/unit/helper/qahelper.cxx |   26 
 sc/qa/unit/subsequent_export_test4.cxx |4 -
 sc/qa/unit/ucalc.cxx   |2 
 sc/qa/unit/uicalc/uicalc.cxx   |   10 +--
 sc/qa/unit/uicalc/uicalc2.cxx  |   10 +--
 sc/source/core/data/column2.cxx|6 -
 sc/source/core/data/global.cxx |2 
 sc/source/core/data/patattr.cxx|  103 +++--
 sc/source/core/tool/editutil.cxx   |2 
 sc/source/core/tool/interpr1.cxx   |4 -
 sc/source/filter/excel/xecontent.cxx   |8 +-
 sc/source/filter/excel/xehelper.cxx|   23 ---
 sc/source/filter/excel/xestyle.cxx |   16 ++---
 sc/source/filter/excel/xlstyle.cxx |   18 ++---
 sc/source/filter/inc/xestyle.hxx   |   18 ++---
 sc/source/filter/inc/xlstyle.hxx   |8 +-
 sc/source/ui/cctrl/dpcontrol.cxx   |5 -
 sc/source/ui/docshell/docsh3.cxx   |4 -
 sc/source/ui/vba/vbarange.cxx  |4 -
 sc/source/ui/view/cellsh1.cxx  |8 +-
 sc/source/ui/view/gridwin4.cxx |6 -
 sc/source/ui/view/output2.cxx  |   12 +--
 sc/source/ui/view/printfun.cxx |8 +-
 24 files changed, 210 insertions(+), 147 deletions(-)

New commits:
commit 3537cef02c25c2c2459d7900eed13eeec533b7ae
Author: Tomaž Vajngerl 
AuthorDate: Tue May 16 22:10:10 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Thu Jun 22 02:21:15 2023 +0200

sc: factor out color from setting vcl::Font from a ItemSet

vcl::Font color parameter is deprecated so we need to handle the
color separately from font data. This refactors GetFont into 2
separate functions - fillFontOnly and fillColor, where fillFont
now does the same as previously GetFont function did.
All GetFont calls have been changed depending on if we need only
the font data or also color - where the color is now treated in
a different call. There are a couple of calls where fillFont was
used, because to change that needs a more complex refactoring.

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

diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx
index 49cae62994b4..ba15cfb1dd27 100644
--- a/sc/inc/patattr.hxx
+++ b/sc/inc/patattr.hxx
@@ -92,23 +92,55 @@ public:
 SvxCellOrientation  GetCellOrientation( const SfxItemSet* pCondSet = 
nullptr ) const;
 
 /** Static helper function to fill a font object from the passed item set. 
*/
-static void GetFont( vcl::Font& rFont, const SfxItemSet& 
rItemSet,
+static void fillFontOnly(vcl::Font& rFont, const SfxItemSet& rItemSet,
+const OutputDevice* pOutDev = nullptr,
+const Fraction* pScale = nullptr,
+const SfxItemSet* pCondSet = nullptr,
+SvtScriptType nScript = 
SvtScriptType::NONE);
+
+static void fillFont( vcl::Font& rFont, const SfxItemSet& rItemSet,
 ScAutoFontColorMode eAutoMode,
 const OutputDevice* pOutDev = nullptr,
 const Fraction* pScale = nullptr,
 const SfxItemSet* pCondSet = nullptr,
 SvtScriptType nScript = 
SvtScriptType::NONE, const Color* pBackConfigColor = nullptr,
-const Color* pTextConfigColor = 
nullptr );
+const Color* pTextConfigColor = 
nullptr);
+
+static void fillColor(Color& rColor, const SfxItemSet& rItemSet, 
ScAutoFontColorMode eAutoMode, const SfxItemSet* pCondSet = nullptr,
+const Color* pBackConfigColor = nullptr, const 
Color* pTextConfigColor = nullptr);
+
 
 static ScDxfFontGetDxfFont(const SfxItemSet& rSet, SvtScriptType 
nScript);
+
+void fillColor(Color& rColor,
+ScAutoFontColorMode eAutoMode,
+const SfxItemSet* pCondSet = nullptr,
+const Color* pBackConfigColor = nullptr,
+const Color* pTextConfigColor = nullptr) const
+{
+fillColor(rColor, GetItemSet(), eAutoMode, pCondSet, pBackConfigColor, 
pTextConfigColor);
+}
+
+void fillFontOnly(vcl::Font& rFont,
+const OutputDevice* pOutDev = nullptr,
+const Fraction* pScale = nullptr,
+const SfxItemSet* pCondSet = nullptr,
+SvtScriptType nScript = SvtScriptType::NONE) const
+{
+fillFontOnly(rFont, GetItemSet(), pOutDev, pScale, pCondSet, nScript);
+}
+
 /** Fills a font object from the own item set. */
-   

[Libreoffice-commits] core.git: sc/inc sc/qa sc/source test/Library_subsequenttest.mk test/source

2023-06-21 Thread Tomaž Vajngerl (via logerrit)
 sc/inc/unonames.hxx|2 ++
 sc/qa/extras/scstyleobj.cxx|   35 ++-
 sc/source/ui/unoobj/cellsuno.cxx   |   13 +
 sc/source/ui/unoobj/styleuno.cxx   |2 ++
 test/Library_subsequenttest.mk |1 +
 test/source/beans/xpropertyset.cxx |9 +
 6 files changed, 53 insertions(+), 9 deletions(-)

New commits:
commit 56e58e6a1280d9bdd23550ba998f14aef4980244
Author: Tomaž Vajngerl 
AuthorDate: Thu May 11 19:40:06 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Wed Jun 21 10:58:13 2023 +0200

sc: add CharComplexColor and CellBackgroundComplexColor properties

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

diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index 4617bcf46700..7a7396a358e4 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -50,6 +50,7 @@ inline constexpr OUStringLiteral SC_UNO_HASDRAWPAGES 
= u"HasDrawPages";
 
 //  CharacterProperties
 inline constexpr OUStringLiteral SC_UNONAME_CCOLOR   = u"CharColor";
+inline constexpr OUStringLiteral SC_UNONAME_CHAR_COMPLEX_COLOR = 
u"CharComplexColor";
 inline constexpr OUStringLiteral SC_UNONAME_CHEIGHT  = u"CharHeight";
 inline constexpr OUStringLiteral SC_UNONAME_CUNDER   = 
u"CharUnderline";
 inline constexpr OUStringLiteral SC_UNONAME_CUNDLCOL = 
u"CharUnderlineColor";
@@ -97,6 +98,7 @@ inline constexpr OUStringLiteral SC_UNO_CTL_CLOCAL   
= u"CharLocaleCompl
 //  CellProperties
 inline constexpr OUStringLiteral SC_UNONAME_CELLSTYL = u"CellStyle";
 inline constexpr OUStringLiteral SC_UNONAME_CELLBACK = 
u"CellBackColor";
+inline constexpr OUStringLiteral SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR = 
u"CellBackgroundComplexColor";
 inline constexpr OUStringLiteral SC_UNONAME_CELLTRAN = 
u"IsCellBackgroundTransparent";
 inline constexpr OUStringLiteral SC_UNONAME_CELLPRO  = 
u"CellProtection";
 inline constexpr OUStringLiteral SC_UNONAME_CELLHJUS = u"HoriJustify";
diff --git a/sc/qa/extras/scstyleobj.cxx b/sc/qa/extras/scstyleobj.cxx
index 7b8ca77c03ab..813a59db944b 100644
--- a/sc/qa/extras/scstyleobj.cxx
+++ b/sc/qa/extras/scstyleobj.cxx
@@ -59,15 +59,32 @@ public:
 ScStyleObj::ScStyleObj()
 : UnoApiTest("/sc/qa/extras/testdocuments")
 , XNamed("ScStyleObj")
-, XPropertySet({
-  "BottomBorder",  "BottomBorder2", "CellProtection", 
"CharLocale",
-  "CharLocaleAsian",   "CharLocaleComplex", "CharPosture",
"CharPostureAsian",
-  "CharPostureComplex","DiagonalBLTR",  "DiagonalBLTR2",  
"DiagonalTLBR",
-  "DiagonalTLBR2", "HoriJustify",   "LeftBorder", 
"LeftBorder2",
-  "NumberFormat",  "Orientation",   "RightBorder",
"RightBorder2",
-  "ShadowFormat",  "TableBorder",   "TopBorder",  
"TopBorder2",
-  "UserDefinedAttributes",
-  })
+, XPropertySet({ "BottomBorder",
+ "BottomBorder2",
+ "CellProtection",
+ "CharLocale",
+ "CharLocaleAsian",
+ "CharLocaleComplex",
+ "CharPosture",
+ "CharPostureAsian",
+ "CharPostureComplex",
+ "DiagonalBLTR",
+ "DiagonalBLTR2",
+ "DiagonalTLBR",
+ "DiagonalTLBR2",
+ "HoriJustify",
+ "LeftBorder",
+ "LeftBorder2",
+ "NumberFormat",
+ "Orientation",
+ "RightBorder",
+ "RightBorder2",
+ "ShadowFormat",
+ "TableBorder",
+ "TopBorder",
+ "TopBorder2",
+ "UserDefinedAttributes",
+ "CellBackgroundComplexColor" })
 {
 }
 
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 55f72d3dce09..371ea346d364 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -65,6 +65,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -156,9 +157,11 @@ static const SfxItemPropertySet* lcl_GetCellsPropertySet()
 { SC_UNONAME_BOTTBORDER,ATTR_BORDER,   
::cppu::UnoType::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
 { SC_UNONAME_BOTTBORDER2,ATTR_BORDER,  
::cppu::UnoType::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
 { SC_UNONAME_CELLBACK, ATTR_BACKGROUND,
cppu::UnoType::get(),0, MID_BACK_COLOR },
+{ SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR, ATTR_BACKGROUND, 
cppu::UnoType::get(), 0, MID_BACKGROUND_COMPLEX_COLOR 
},
 { SC_UNONAME_CELLPRO,  

[Libreoffice-commits] core.git: sc/inc sc/source

2023-06-17 Thread Eike Rathke (via logerrit)
 sc/inc/table.hxx |8 +-
 sc/source/core/data/documen3.cxx |3 -
 sc/source/core/data/table4.cxx   |  117 ---
 3 files changed, 81 insertions(+), 47 deletions(-)

New commits:
commit 30c48379c7b791edc615e7691691e344baa455a3
Author: Eike Rathke 
AuthorDate: Sat Jun 17 01:05:48 2023 +0200
Commit: Eike Rathke 
CommitDate: Sat Jun 17 16:10:08 2023 +0200

Resolves: tdf#153517 Use tools::Duration for FillSeries with (date+)time

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

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index a2cc60f9d70e..0662053cb89c 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -715,7 +715,8 @@ public:
  sc::UpdatedRangeNames& rIndexes) const;
 voidFill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
 sal_uInt64 nFillCount, FillDir eFillDir, FillCmd 
eFillCmd, FillDateCmd eFillDateCmd,
-double nStepValue, double nMaxValue, ScProgress* 
pProgress);
+double nStepValue, const tools::Duration& 
rDurationStep,
+double nMaxValue, ScProgress* pProgress);
 OUStringGetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW 
nEndY );
 
 void UpdateSelectionFunction( ScFunctionData& rData, const ScMarkData& 
rMark );
@@ -1191,13 +1192,14 @@ private:
 voidFillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
 sal_uInt64 nFillCount, FillDir eFillDir, 
FillCmd eFillCmd,
 FillDateCmd eFillDateCmd,
-double nStepValue, double nMaxValue, 
sal_uInt16 nMinDigits,
+double nStepValue, const tools::Duration& 
rDurationStep,
+double nMaxValue, sal_uInt16 nMinDigits,
 bool bAttribs, ScProgress* pProgress,
 bool bSkipOverlappedCells = false,
 std::vector* pNonOverlappedCellIdx 
= nullptr);
 voidFillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW 
nRow2,
 FillCmd& rCmd, FillDateCmd& rDateCmd,
-double& rInc, sal_uInt16& rMinDigits,
+double& rInc, tools::Duration& rDuration, 
sal_uInt16& rMinDigits,
 ScUserListData*& rListData, sal_uInt16& 
rListIndex,
 bool bHasFiltered, bool& rSkipOverlappedCells,
 std::vector& rNonOverlappedCellIdx 
);
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index b1cf5fe81b8c..8d0d2ba9a665 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1171,7 +1172,7 @@ void ScDocument::Fill(SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2, ScProg
 {
 maTabs[rTab]->Fill(nCol1, nRow1, nCol2, nRow2,
 nFillCount, eFillDir, eFillCmd, eFillDateCmd,
-nStepValue, nMaxValue, pProgress);
+nStepValue, tools::Duration(), nMaxValue, 
pProgress);
 RefreshAutoFilter(aRange.aStart.Col(), aRange.aStart.Row(), 
aRange.aEnd.Col(), aRange.aEnd.Row(), rTab);
 }
 }
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 10c27f8d2c84..9c6852990efe 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -215,32 +216,20 @@ double approxDiff( double a, double b )
 return rtl::math::round(c, -std::max(nExp, nExpArg));
 }
 
-double approxTimeDiff( double a, double b )
+double approxTypedDiff( double a, double b, bool bTime, tools::Duration& 
rDuration )
 {
-// Scale to hours, round to "nanohours" (multiple nanoseconds), scale back.
-// Get back 0.0417 instead of 0.04166700621136 or
-// 0.0414241347 (raw a-b) for one hour, or worse the approxDiff()
-// 0.0416665997 value. Though there is no such correct value,
-// IEEE-754 nearest values are
-// 0.041664353702032030923874117434024810791015625
-// (0x3FA5) and
-// 0.04167129259593593815225176513195037841796875
-// (0x3FA6).
-// This works also for a diff of seconds, unless corner cases would be
-// discovered, which would make it necessary to ditch the floating point
-// and convert to/from time structure values instead.
-return rtl::math::round((a - b) * 24, 9) / 24;
-}
-

[Libreoffice-commits] core.git: sc/inc sc/source

2023-06-14 Thread Noel Grandin (via logerrit)
 sc/inc/docuno.hxx  |5 -
 sc/source/ui/inc/gridwin.hxx   |3 ++-
 sc/source/ui/unoobj/docuno.cxx |   33 -
 sc/source/ui/view/gridwin4.cxx |8 
 4 files changed, 34 insertions(+), 15 deletions(-)

New commits:
commit 51819767d341950dfd67448a6cbbf8c1add45f6c
Author: Noel Grandin 
AuthorDate: Wed Jun 14 13:01:20 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Jun 14 20:53:11 2023 +0200

online: speed up scrolling large excel document

the expensive part is the GetTiledRenderingArea(), so lets only do that
once, instead of twice

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

diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 23de1dad63ce..a75afa2834df 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -308,7 +308,7 @@ public:
 tools::Long nTileHeight ) override;
 
 /// @see vcl::ITiledRenderable::getDocumentSize().
-virtual Size getDocumentSize() override;
+virtual Size getDocumentSize() final override;
 
 /// @see vcl::ITiledRenderable::getDataArea().
 virtual Size getDataArea(long nPart) override;
@@ -397,6 +397,9 @@ public:
 
 /// @see vcl::ITiledRenderable::getViewRenderState().
 OString getViewRenderState() override;
+
+private:
+Size getDocumentSize(SCCOL& rnTiledRenderingAreaEndCol, SCROW& 
rnTiledRenderingAreaEndRow );
 };
 
 class ScDrawPagesObj final : public cppu::WeakImplHelper<
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 635dd91dc393..ddc9815c2052 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -373,7 +373,8 @@ public:
 voidPaintTile( VirtualDevice& rDevice,
int nOutputWidth, int nOutputHeight,
int nTilePosX, int nTilePosY,
-   tools::Long nTileWidth, tools::Long nTileHeight 
);
+   tools::Long nTileWidth, tools::Long nTileHeight,
+   SCCOL nTiledRenderingAreaEndCol, SCROW 
nTiledRenderingAreaEndRow );
 
 /// @see Window::LogicInvalidate().
 void LogicInvalidate(const tools::Rectangle* pRectangle) override;
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 1358fb8ec56d..cf744dd97bec 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -550,11 +550,19 @@ void ScModelObj::paintTile( VirtualDevice& rDevice,
 //if (pGridWindow->GetOutputSizePixel() != aTileSize)
 //pGridWindow->SetOutputSizePixel(Size(nOutputWidth, nOutputHeight));
 // so instead for now, set the viewport size to document size
-Size aDocSize = getDocumentSize();
+
+// Fetch the document size and the tiled rendering area together,
+// because the tiled rendering area is not cheap to compute, and we want
+// to pass it down to ScGridWindow::PaintFile to avoid computing twice.
+SCCOL nTiledRenderingAreaEndCol = 0;
+SCROW nTiledRenderingAreaEndRow = 0;
+Size aDocSize = getDocumentSize(nTiledRenderingAreaEndCol, 
nTiledRenderingAreaEndRow);
+
 pGridWindow->SetOutputSizePixel(Size(aDocSize.Width() * 
pViewData->GetPPTX(), aDocSize.Height() * pViewData->GetPPTY()));
 
 pGridWindow->PaintTile( rDevice, nOutputWidth, nOutputHeight,
-nTilePosX, nTilePosY, nTileWidth, nTileHeight );
+nTilePosX, nTilePosY, nTileWidth, nTileHeight,
+nTiledRenderingAreaEndCol, 
nTiledRenderingAreaEndRow );
 
 // Draw Form controls
 ScDrawLayer* pDrawLayer = pDocShell->GetDocument().GetDrawLayer();
@@ -653,6 +661,13 @@ VclPtr ScModelObj::getDocWindow()
 }
 
 Size ScModelObj::getDocumentSize()
+{
+SCCOL nTiledRenderingAreaEndCol = 0;
+SCROW nTiledRenderingAreaEndRow = 0;
+return getDocumentSize(nTiledRenderingAreaEndCol, 
nTiledRenderingAreaEndRow);
+}
+
+Size ScModelObj::getDocumentSize(SCCOL& rnTiledRenderingAreaEndCol, SCROW& 
rnTiledRenderingAreaEndRow)
 {
 Size aSize(10, 10); // minimum size
 
@@ -661,11 +676,11 @@ Size ScModelObj::getDocumentSize()
 return aSize;
 
 SCTAB nTab = pViewData->GetTabNo();
-SCCOL nEndCol = 0;
-SCROW nEndRow = 0;
+rnTiledRenderingAreaEndCol = 0;
+rnTiledRenderingAreaEndRow = 0;
 const ScDocument& rDoc = pDocShell->GetDocument();
 
-rDoc.GetTiledRenderingArea(nTab, nEndCol, nEndRow);
+rDoc.GetTiledRenderingArea(nTab, rnTiledRenderingAreaEndCol, 
rnTiledRenderingAreaEndRow);
 
 const ScDocument* pThisDoc = 
 const double fPPTX = pViewData->GetPPTX();
@@ -676,8 +691,8 @@ Size ScModelObj::getDocumentSize()
 return ScViewData::ToPixel(nSize, fPPTX);
 };
 
-tools::Long nDocWidthPixel = 

[Libreoffice-commits] core.git: sc/inc sc/source

2023-06-09 Thread Czeber László Ádám (via logerrit)
 sc/inc/column.hxx  |6 ++
 sc/source/core/data/table1.cxx |   12 +---
 sc/source/core/data/table2.cxx |3 +++
 3 files changed, 14 insertions(+), 7 deletions(-)

New commits:
commit dd8e061406fac581d399da088c7f0187278035dc
Author: Czeber László Ádám 
AuthorDate: Thu Jun 8 14:55:34 2023 +0200
Commit: László Németh 
CommitDate: Fri Jun 9 15:41:38 2023 +0200

tdf#153437 sc: fix broken formatting without performance regression

Follow-up to commit 7be7e1ff95af485a9cb00748800d3d084f96387c
"tdf#153437 sc: fix broken formatting at Undo of row/column insertion"
by replacing that with a better version without performance
regression. This keeps the original performance fix of
commit 2e86718626a07e1656661df3ad69a64848bf4614
"don't allocate unnecessary columns when inserting a row"
related to the support of 16k columns.

The previous fix used extra memory to fix the broken formatting
of the cells. I have now solved the error in tdf#153437 without
taking extra memory. It doesn't change the reserved cells, it just
deletes a row from the default attribute of the cells when deleting
rows, so they don't slip. When deleting a column, the last column
in the still reserved area loses its formatting. I copied the default value 
back here, as the other columns have this value.

Change-Id: I35da1cb79ff4e3493e91d29766cc2b81412080eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152742
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 5c42f02794ab..4b64537e1705 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -172,6 +172,7 @@ public:
 
 boolTestInsertRow( SCSIZE nSize ) const;
 voidInsertRow( SCROW nStartRow, SCSIZE nSize );
+voidDeleteRow( SCROW nStartRow, SCSIZE nSize );
 };
 
 // Use protected inheritance to prevent publishing some internal ScColumnData
@@ -1057,4 +1058,9 @@ inline void ScColumnData::InsertRow( SCROW nStartRow, 
SCSIZE nSize )
 pAttrArray->InsertRow( nStartRow, nSize );
 }
 
+inline void ScColumnData::DeleteRow(SCROW nStartRow, SCSIZE nSize)
+{
+pAttrArray->DeleteRow( nStartRow, nSize );
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 99e0c5f39b0d..c5d4de055f8d 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1849,13 +1849,11 @@ void ScTable::UpdateReference(
 }
 else
 {
-// When deleting row(s) or column(s), allocate the last column
-// before updating the references
-if (nDx < 0 || nDy < 0)
-CreateColumnIfNotExists(rDocument.MaxCol());
-
-for (SCCOL col : GetColumnsRange(0, rDocument.MaxCol()))
-bUpdated |= CreateColumnIfNotExists(col).UpdateReference(rCxt, 
pUndoDoc);
+for (SCCOL col : GetAllocatedColumnsRange(0, rDocument.MaxCol()))
+bUpdated |= aCol[col].UpdateReference(rCxt, pUndoDoc);
+// When deleting row(s), delete same row from the default attribute
+if (nDy < 0)
+aDefaultColData.DeleteRow(nRow1+nDy, -nDy);
 }
 
 if ( bIncludeDraw )
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index b3a5b9aee9b9..b35caa7459bb 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -400,6 +400,9 @@ void ScTable::DeleteCol(
 {
 for (SCCOL nCol = nStartCol + nSize; nCol < aCol.size(); ++nCol)
 aCol[nCol].SwapCol(aCol[nCol - nSize]);
+// When delete column(s), inicialize the last columns from the default 
attributes
+for (SCCOL nCol = aCol.size() - nSize; nCol < aCol.size(); ++nCol)
+aCol[nCol].Init(nCol, aCol[nCol].GetTab(), rDocument, false);
 }
 else
 {


[Libreoffice-commits] core.git: sc/inc sc/source

2023-06-07 Thread Stephan Bergmann (via logerrit)
 sc/inc/patattr.hxx  |2 +-
 sc/source/core/data/patattr.cxx |8 
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit eb1ec67d4e3f1992d7f31d824f06e48df8429540
Author: Stephan Bergmann 
AuthorDate: Wed Jun 7 11:25:21 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Jun 7 13:33:06 2023 +0200

Avoid signed integer overflow

For whatever reason e5fe8434110c1299527a0d03bf450e1b6d08ca57 "use a SIMD
friendly hashcode for ScPatternAttr" had changed ScPatternAttr::mxHashCode 
from
sizt_t to sal_Int32, better use unsigned sal_uInt32 to avoid

> /sc/source/core/data/patattr.cxx:1444:17: runtime error: signed integer 
overflow: 31 * 887503681 cannot be represented in type 'int'

during e.g. CppunitTest_chart2_geometry
()

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

diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx
index 067193136fb9..49cae62994b4 100644
--- a/sc/inc/patattr.hxx
+++ b/sc/inc/patattr.hxx
@@ -53,7 +53,7 @@ enum ScAutoFontColorMode
 class SC_DLLPUBLIC ScPatternAttr final : public SfxSetItem
 {
 std::optional  pName;
-mutable std::optional mxHashCode;
+mutable std::optional mxHashCode;
 ScStyleSheet*  pStyle;
 sal_uInt64 mnKey;
 public:
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index d2be666aa349..2b347365f0c2 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -1435,10 +1435,10 @@ void ScPatternAttr::CalcHashCode() const
 // This is an unrolled hash function so the compiler/CPU can execute it in 
parallel,
 // because we hit this hard when loading documents with lots of styles.
 // Set up seed so that an empty pattern does not have an (invalid) hash of 
0.
-sal_Int32 h1 = 1;
-sal_Int32 h2 = 1;
-sal_Int32 h3 = 1;
-sal_Int32 h4 = 1;
+sal_uInt32 h1 = 1;
+sal_uInt32 h2 = 1;
+sal_uInt32 h3 = 1;
+sal_uInt32 h4 = 1;
 for (auto it = rSet.GetItems_Impl(), end = rSet.GetItems_Impl() + 
(compareSize / 4 * 4); it != end; )
 {
 h1 = 31 * h1 + reinterpret_cast(*it);


[Libreoffice-commits] core.git: sc/inc sc/source

2023-06-06 Thread Noel Grandin (via logerrit)
 sc/inc/patattr.hxx  |2 +-
 sc/source/core/data/patattr.cxx |   23 ---
 2 files changed, 21 insertions(+), 4 deletions(-)

New commits:
commit e5fe8434110c1299527a0d03bf450e1b6d08ca57
Author: Noel Grandin 
AuthorDate: Thu Jun 1 14:35:24 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jun 6 18:19:39 2023 +0200

use a SIMD friendly hashcode for ScPatternAttr

which shaves 5% off load time of a large sheet with lots of formats.

We are calculating a hash over a decent sized array of pointers, so
unroll the loop and reduce data-dependencies to give the compiler (and
the CPU) a chance to do work in parallel

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

diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx
index 5b031f488467..067193136fb9 100644
--- a/sc/inc/patattr.hxx
+++ b/sc/inc/patattr.hxx
@@ -53,7 +53,7 @@ enum ScAutoFontColorMode
 class SC_DLLPUBLIC ScPatternAttr final : public SfxSetItem
 {
 std::optional  pName;
-mutable std::optional mxHashCode;
+mutable std::optional mxHashCode;
 ScStyleSheet*  pStyle;
 sal_uInt64 mnKey;
 public:
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 532831f90a78..d2be666aa349 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -52,6 +52,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -64,7 +65,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -1432,8 +1432,25 @@ void ScPatternAttr::CalcHashCode() const
 mxHashCode = 0; // invalid
 return;
 }
-mxHashCode = 1; // Set up seed so that an empty pattern does not have an 
(invalid) hash of 0.
-boost::hash_range(*mxHashCode, rSet.GetItems_Impl(), rSet.GetItems_Impl() 
+ compareSize);
+// This is an unrolled hash function so the compiler/CPU can execute it in 
parallel,
+// because we hit this hard when loading documents with lots of styles.
+// Set up seed so that an empty pattern does not have an (invalid) hash of 
0.
+sal_Int32 h1 = 1;
+sal_Int32 h2 = 1;
+sal_Int32 h3 = 1;
+sal_Int32 h4 = 1;
+for (auto it = rSet.GetItems_Impl(), end = rSet.GetItems_Impl() + 
(compareSize / 4 * 4); it != end; )
+{
+h1 = 31 * h1 + reinterpret_cast(*it);
+++it;
+h2 = 31 * h2 + reinterpret_cast(*it);
+++it;
+h3 = 31 * h3 + reinterpret_cast(*it);
+++it;
+h4 = 31 * h4 + reinterpret_cast(*it);
+++it;
+}
+mxHashCode = h1 + h2 + h3 + h4;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: sc/inc sc/source

2023-06-04 Thread Mike Kaganski (via logerrit)
 sc/inc/userlist.hxx  |5 ++---
 sc/source/core/tool/userlist.cxx |   12 +---
 2 files changed, 7 insertions(+), 10 deletions(-)

New commits:
commit 4900217e74e29c8e19c9a697883c21cbd50c9dbc
Author: Mike Kaganski 
AuthorDate: Sun Jun 4 16:22:38 2023 +0200
Commit: Mike Kaganski 
CommitDate: Sun Jun 4 19:56:38 2023 +0200

Move uppercase to SubStr ctor

Change-Id: Ifeeaead20e3ad37705fea04a6c3b9efa4339ddc5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152543
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/inc/userlist.hxx b/sc/inc/userlist.hxx
index b421c33370db..5f913bc47dae 100644
--- a/sc/inc/userlist.hxx
+++ b/sc/inc/userlist.hxx
@@ -30,15 +30,14 @@
  */
 class SC_DLLPUBLIC ScUserListData final
 {
-public:
+private:
 struct SAL_DLLPRIVATE SubStr
 {
 OUString maReal;
 OUString maUpper;
-SubStr(OUString aReal, OUString aUpper);
+SubStr(OUString&& aReal);
 };
 
-private:
 std::vector maSubStrings;
 OUString aStr;
 
diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx
index b91d3ba3819a..b1030eca6293 100644
--- a/sc/source/core/tool/userlist.cxx
+++ b/sc/source/core/tool/userlist.cxx
@@ -17,7 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
+#include 
+
 #include 
 
 #include 
@@ -29,8 +30,8 @@
 #include 
 #include 
 
-ScUserListData::SubStr::SubStr(OUString aReal, OUString aUpper) :
-maReal(std::move(aReal)), maUpper(std::move(aUpper)) {}
+ScUserListData::SubStr::SubStr(OUString&& aReal) :
+maReal(std::move(aReal)), 
maUpper(ScGlobal::getCharClass().uppercase(maReal)) {}
 
 void ScUserListData::InitTokens()
 {
@@ -40,10 +41,7 @@ void ScUserListData::InitTokens()
 {
 OUString aSub = aStr.getToken(0, ScGlobal::cListDelimiter, nIndex);
 if (!aSub.isEmpty())
-{
-OUString aUpStr = ScGlobal::getCharClass().uppercase(aSub);
-maSubStrings.emplace_back(aSub, aUpStr);
-}
+maSubStrings.emplace_back(std::move(aSub));
 } while (nIndex >= 0);
 }
 


[Libreoffice-commits] core.git: sc/inc sc/source

2023-06-04 Thread Mike Kaganski (via logerrit)
 sc/inc/userlist.hxx  |3 ---
 sc/source/core/tool/userlist.cxx |   17 ++---
 2 files changed, 2 insertions(+), 18 deletions(-)

New commits:
commit 83eee0095c337e454acd5368f70855e34ec4a174
Author: Mike Kaganski 
AuthorDate: Sun Jun 4 14:34:47 2023 +0200
Commit: Mike Kaganski 
CommitDate: Sun Jun 4 16:50:36 2023 +0200

ScUserListData::InitTokens can't produce different splits

... for the same input, because ScGlobal::cListDelimiter is a constant.
This means, that the copy ctor and assignment operator can be default,
and ScUserListData comparison can be simplified.

Change-Id: I500892ab592fd0dd24550c5189151f670efed4d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152541
Reviewed-by: Noel Grandin 
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 

diff --git a/sc/inc/userlist.hxx b/sc/inc/userlist.hxx
index 1cf759e463e7..b421c33370db 100644
--- a/sc/inc/userlist.hxx
+++ b/sc/inc/userlist.hxx
@@ -46,9 +46,6 @@ private:
 
 public:
 ScUserListData(OUString aStr);
-// Copy ctor and assignment operator re-initialize tokens. Is this 
intended on copy?
-ScUserListData(const ScUserListData& rData);
-ScUserListData& operator=(const ScUserListData& rData);
 
 const OUString& GetString() const { return aStr; }
 void SetString(const OUString& rStr);
diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx
index 984b51c1058e..b91d3ba3819a 100644
--- a/sc/source/core/tool/userlist.cxx
+++ b/sc/source/core/tool/userlist.cxx
@@ -34,12 +34,11 @@ ScUserListData::SubStr::SubStr(OUString aReal, OUString 
aUpper) :
 
 void ScUserListData::InitTokens()
 {
-sal_Unicode cSep = ScGlobal::cListDelimiter;
 maSubStrings.clear();
 sal_Int32 nIndex = 0;
 do
 {
-OUString aSub = aStr.getToken(0, cSep, nIndex);
+OUString aSub = aStr.getToken(0, ScGlobal::cListDelimiter, nIndex);
 if (!aSub.isEmpty())
 {
 OUString aUpStr = ScGlobal::getCharClass().uppercase(aSub);
@@ -54,18 +53,6 @@ ScUserListData::ScUserListData(OUString _aStr) :
 InitTokens();
 }
 
-ScUserListData::ScUserListData(const ScUserListData& rData) :
-aStr(rData.aStr)
-{
-InitTokens();
-}
-
-ScUserListData& ScUserListData::operator=(const ScUserListData& rData)
-{
-SetString(rData.aStr);
-return *this;
-}
-
 void ScUserListData::SetString( const OUString& rStr )
 {
 aStr = rStr;
@@ -249,7 +236,7 @@ bool ScUserList::operator==( const ScUserList& r ) const
 {
 return std::equal(maData.begin(), maData.end(), r.maData.begin(), 
r.maData.end(),
 [](const ScUserListData& lhs, const ScUserListData& rhs) {
-return (lhs.GetString() == rhs.GetString()) && (lhs.GetSubCount() 
== rhs.GetSubCount());
+return lhs.GetString() == rhs.GetString();
 });
 }
 


[Libreoffice-commits] core.git: sc/inc sc/source

2023-06-04 Thread Mike Kaganski (via logerrit)
 sc/inc/userlist.hxx  |5 +-
 sc/source/core/tool/userlist.cxx |   67 ++-
 2 files changed, 14 insertions(+), 58 deletions(-)

New commits:
commit 7bbec0dfaac7b4a579c963e0724f5355da2b8df8
Author: Mike Kaganski 
AuthorDate: Sun Jun 4 13:50:45 2023 +0200
Commit: Mike Kaganski 
CommitDate: Sun Jun 4 14:56:12 2023 +0200

Simplify a bit

Change-Id: Iaea9a425fc93adc716bdb4944244a14175cf7538
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152540
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/inc/userlist.hxx b/sc/inc/userlist.hxx
index 80968361ceac..1cf759e463e7 100644
--- a/sc/inc/userlist.hxx
+++ b/sc/inc/userlist.hxx
@@ -39,8 +39,7 @@ public:
 };
 
 private:
-typedef std::vector SubStringsType;
-SubStringsType maSubStrings;
+std::vector maSubStrings;
 OUString aStr;
 
 SAL_DLLPRIVATE void InitTokens();
@@ -53,7 +52,7 @@ public:
 
 const OUString& GetString() const { return aStr; }
 void SetString(const OUString& rStr);
-size_t GetSubCount() const;
+size_t GetSubCount() const { return maSubStrings.size(); }
 bool GetSubIndex(const OUString& rSubStr, sal_uInt16& rIndex, bool& 
bMatchCase) const;
 OUString GetSubStr(sal_uInt16 nIndex) const;
 sal_Int32 Compare(const OUString& rSubStr1, const OUString& rSubStr2) 
const;
diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx
index f38a16d98f12..984b51c1058e 100644
--- a/sc/source/core/tool/userlist.cxx
+++ b/sc/source/core/tool/userlist.cxx
@@ -29,22 +29,6 @@
 #include 
 #include 
 
-namespace {
-
-class FindByName
-{
-const OUString& mrName;
-bool mbUpper;
-public:
-FindByName(const OUString& rName, bool bUpper) : mrName(rName), 
mbUpper(bUpper) {}
-bool operator() (const ScUserListData::SubStr& r) const
-{
-return mbUpper ? r.maUpper == mrName : r.maReal == mrName;
-}
-};
-
-}
-
 ScUserListData::SubStr::SubStr(OUString aReal, OUString aUpper) :
 maReal(std::move(aReal)), maUpper(std::move(aUpper)) {}
 
@@ -52,37 +36,16 @@ void ScUserListData::InitTokens()
 {
 sal_Unicode cSep = ScGlobal::cListDelimiter;
 maSubStrings.clear();
-const sal_Unicode* p = aStr.getStr();
-const sal_Unicode* p0 = p;
-sal_Int32 nLen = 0;
-bool bFirst = true;
-for (sal_Int32 i = 0, n = aStr.getLength(); i < n; ++i, ++p, ++nLen)
+sal_Int32 nIndex = 0;
+do
 {
-if (bFirst)
+OUString aSub = aStr.getToken(0, cSep, nIndex);
+if (!aSub.isEmpty())
 {
-// very first character, or the first character after a separator.
-p0 = p;
-nLen = 0;
-bFirst = false;
-}
-if (*p == cSep)
-{
-if (nLen)
-{
-OUString aSub(p0, nLen);
-OUString aUpStr = ScGlobal::getCharClass().uppercase(aSub);
-maSubStrings.emplace_back(aSub, aUpStr);
-}
-bFirst = true;
+OUString aUpStr = ScGlobal::getCharClass().uppercase(aSub);
+maSubStrings.emplace_back(aSub, aUpStr);
 }
-}
-
-if (nLen)
-{
-OUString aSub(p0, nLen);
-OUString aUpStr = ScGlobal::getCharClass().uppercase(aSub);
-maSubStrings.emplace_back(aSub, aUpStr);
-}
+} while (nIndex >= 0);
 }
 
 ScUserListData::ScUserListData(OUString _aStr) :
@@ -109,16 +72,11 @@ void ScUserListData::SetString( const OUString& rStr )
 InitTokens();
 }
 
-size_t ScUserListData::GetSubCount() const
-{
-return maSubStrings.size();
-}
-
 bool ScUserListData::GetSubIndex(const OUString& rSubStr, sal_uInt16& rIndex, 
bool& bMatchCase) const
 {
 // First, case sensitive search.
-SubStringsType::const_iterator itr = ::std::find_if(
-maSubStrings.begin(), maSubStrings.end(), FindByName(rSubStr, false));
+auto itr = ::std::find_if(maSubStrings.begin(), maSubStrings.end(),
+  [](const SubStr& item) { return 
item.maReal == rSubStr; });
 if (itr != maSubStrings.end())
 {
 rIndex = ::std::distance(maSubStrings.begin(), itr);
@@ -127,16 +85,15 @@ bool ScUserListData::GetSubIndex(const OUString& rSubStr, 
sal_uInt16& rIndex, bo
 }
 
 // When that fails, do a case insensitive search.
+bMatchCase = false;
 OUString aUpStr = ScGlobal::getCharClass().uppercase(rSubStr);
-itr = ::std::find_if(
-maSubStrings.begin(), maSubStrings.end(), FindByName(aUpStr, true));
+itr = ::std::find_if(maSubStrings.begin(), maSubStrings.end(),
+ [](const SubStr& item) { return item.maUpper 
== aUpStr; });
 if (itr != maSubStrings.end())
 {
 rIndex = ::std::distance(maSubStrings.begin(), itr);
-bMatchCase = false;
 return true;
 }
-bMatchCase = false;
 return false;
 }
 


[Libreoffice-commits] core.git: sc/inc sc/source

2023-06-04 Thread Mike Kaganski (via logerrit)
 sc/inc/userlist.hxx  |3 ++-
 sc/source/core/tool/appoptio.cxx |   12 +++-
 sc/source/core/tool/userlist.cxx |   21 +
 3 files changed, 18 insertions(+), 18 deletions(-)

New commits:
commit 182974354e4536af568dfb05a7400e48a2fe1032
Author: Mike Kaganski 
AuthorDate: Sun Jun 4 12:58:46 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sun Jun 4 14:17:35 2023 +0200

Optimize ScAppCfg::ReadSortListCfg

Do not initialize defaults when using custom user list.

Change-Id: I8428a20b65182011a25325f0b7298ea51998346b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152587
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/inc/userlist.hxx b/sc/inc/userlist.hxx
index 7625ad15f5ee..80968361ceac 100644
--- a/sc/inc/userlist.hxx
+++ b/sc/inc/userlist.hxx
@@ -69,9 +69,10 @@ class SC_DLLPUBLIC ScUserList
 DataType maData;
 
 public:
-ScUserList();
+explicit ScUserList(bool initDefault = true);
 ScUserList(const ScUserList& r) = default;
 
+void AddDefaults();
 void EraseData(size_t nIndex) { maData.erase(maData.cbegin() + nIndex); }
 
 const ScUserListData* GetData(const OUString& rSubStr) const;
diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx
index 16a0c4cb9174..9dbc85f310ae 100644
--- a/sc/source/core/tool/appoptio.cxx
+++ b/sc/source/core/tool/appoptio.cxx
@@ -407,16 +407,18 @@ void ScAppCfg::ReadSortListCfg()
 
 if (Sequence aSeq; aValues[SCSORTLISTOPT_LIST] >>= aSeq)
 {
-ScUserList aList;
+ScUserList aList(false); // Do not init defaults
 
-//  if setting is "default", keep default values from ScUserList ctor
+//  if setting is "default", keep default values
 //TODO: mark "default" in a safe way
 const bool bDefault = (aSeq.getLength() == 1 && aSeq[0] == "NULL");
 
-if (!bDefault)
+if (bDefault)
+{
+aList.AddDefaults();
+}
+else
 {
-aList.clear();
-
 for (const OUString& rStr : std::as_const(aSeq))
 {
 aList.emplace_back(rStr);
diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx
index 4540ad3ea0f6..f38a16d98f12 100644
--- a/sc/source/core/tool/userlist.cxx
+++ b/sc/source/core/tool/userlist.cxx
@@ -200,20 +200,18 @@ sal_Int32 ScUserListData::ICompare(const OUString& 
rSubStr1, const OUString& rSu
 return ScGlobal::GetTransliteration().compareString( rSubStr1, 
rSubStr2 );
 }
 
-ScUserList::ScUserList()
+ScUserList::ScUserList(bool initDefault)
 {
-using namespace ::com::sun::star;
+if (initDefault)
+AddDefaults();
+}
 
+void ScUserList::AddDefaults()
+{
 sal_Unicode cDelimiter = ScGlobal::cListDelimiter;
-uno::Sequence< i18n::CalendarItem2 > xCal;
-
-const uno::Sequence< i18n::Calendar2 > xCalendars(
-ScGlobal::getLocaleData().getAllCalendars() );
-
-for ( const auto& rCalendar : xCalendars )
+for (const auto& rCalendar : ScGlobal::getLocaleData().getAllCalendars())
 {
-xCal = rCalendar.Days;
-if ( xCal.hasElements() )
+if (const auto& xCal = rCalendar.Days; xCal.hasElements())
 {
 OUStringBuffer aDayShortBuf(32), aDayLongBuf(64);
 sal_Int32 i;
@@ -244,8 +242,7 @@ ScUserList::ScUserList()
 emplace_back(aDayLong);
 }
 
-xCal = rCalendar.Months;
-if ( xCal.hasElements() )
+if (const auto& xCal = rCalendar.Months; xCal.hasElements())
 {
 OUStringBuffer aMonthShortBuf(128), aMonthLongBuf(128);
 sal_Int32 i;


[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-06-04 Thread Mike Kaganski (via logerrit)
 sc/inc/userlist.hxx   |   37 ++---
 sc/qa/unit/copy_paste_test.cxx|3 -
 sc/source/core/tool/appoptio.cxx  |3 -
 sc/source/core/tool/userlist.cxx  |   80 +-
 sc/source/filter/oox/autofilterbuffer.cxx |2 
 sc/source/ui/optdlg/tpusrlst.cxx  |8 ---
 sc/source/ui/unoobj/appluno.cxx   |3 -
 7 files changed, 38 insertions(+), 98 deletions(-)

New commits:
commit 1fa085f223761b8dcd7e7ac592eb70450a774543
Author: Mike Kaganski 
AuthorDate: Sun Jun 4 12:48:50 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sun Jun 4 14:13:24 2023 +0200

Simplify ScUserList, don't use unique_ptr.

Change-Id: Idd0ce7bfff115a3b762e963dd6cea7927c78e295
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152586
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/inc/userlist.hxx b/sc/inc/userlist.hxx
index e91fbcc0164e..7625ad15f5ee 100644
--- a/sc/inc/userlist.hxx
+++ b/sc/inc/userlist.hxx
@@ -23,13 +23,12 @@
 
 #include 
 
-#include 
 #include 
 
 /**
  * Stores individual user-defined sort list.
  */
-class SC_DLLPUBLIC ScUserListData
+class SC_DLLPUBLIC ScUserListData final
 {
 public:
 struct SAL_DLLPRIVATE SubStr
@@ -48,8 +47,9 @@ private:
 
 public:
 ScUserListData(OUString aStr);
+// Copy ctor and assignment operator re-initialize tokens. Is this 
intended on copy?
 ScUserListData(const ScUserListData& rData);
-~ScUserListData();
+ScUserListData& operator=(const ScUserListData& rData);
 
 const OUString& GetString() const { return aStr; }
 void SetString(const OUString& rStr);
@@ -65,32 +65,31 @@ public:
  */
 class SC_DLLPUBLIC ScUserList
 {
-typedef std::vector> DataType;
+typedef std::vector DataType;
 DataType maData;
 
 public:
-typedef DataType::iterator iterator;
-typedef DataType::const_iterator const_iterator;
-
 ScUserList();
-ScUserList(const ScUserList& r);
+ScUserList(const ScUserList& r) = default;
+
+void EraseData(size_t nIndex) { maData.erase(maData.cbegin() + nIndex); }
 
 const ScUserListData* GetData(const OUString& rSubStr) const;
 /// If the list in rStr is already inserted
 bool HasEntry(std::u16string_view rStr) const;
 
-const ScUserListData& operator[](size_t nIndex) const;
-ScUserListData& operator[](size_t nIndex);
-ScUserList& operator=(const ScUserList& r);
+const ScUserListData& operator[](size_t nIndex) const { return 
maData[nIndex]; }
+ScUserListData& operator[](size_t nIndex) { return maData[nIndex]; }
+ScUserList& operator=(const ScUserList& r) = default;
 bool operator==(const ScUserList& r) const;
-bool operator!=(const ScUserList& r) const;
-
-iterator begin();
-const_iterator begin() const;
-void clear();
-size_t size() const;
-void push_back(ScUserListData* p);
-void erase(const iterator& itr);
+bool operator!=(const ScUserList& r) const { return !operator==(r); }
+
+void clear() { maData.clear(); }
+size_t size() const { return maData.size(); }
+template  void emplace_back(Args&&... args)
+{
+maData.emplace_back(std::forward(args)...);
+}
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx
index b91dee89dea2..879c01844ba3 100644
--- a/sc/qa/unit/copy_paste_test.cxx
+++ b/sc/qa/unit/copy_paste_test.cxx
@@ -613,8 +613,7 @@ void ScCopyPasteTest::tdf137205_autofillDatesInMergedCells()
 
 void ScCopyPasteTest::addToUserList(const OUString& rStr)
 {
-ScUserListData* aListData = new ScUserListData(rStr);
-ScGlobal::GetUserList()->push_back(aListData);
+ScGlobal::GetUserList()->emplace_back(rStr);
 }
 
 void ScCopyPasteTest::tdf137653_137654_autofillUserlist()
diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx
index 3b19fbed2204..16a0c4cb9174 100644
--- a/sc/source/core/tool/appoptio.cxx
+++ b/sc/source/core/tool/appoptio.cxx
@@ -419,8 +419,7 @@ void ScAppCfg::ReadSortListCfg()
 
 for (const OUString& rStr : std::as_const(aSeq))
 {
-ScUserListData* pNew = new ScUserListData(rStr);
-aList.push_back(pNew);
+aList.emplace_back(rStr);
 }
 }
 
diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx
index 6e0a4647a094..4540ad3ea0f6 100644
--- a/sc/source/core/tool/userlist.cxx
+++ b/sc/source/core/tool/userlist.cxx
@@ -97,8 +97,10 @@ ScUserListData::ScUserListData(const ScUserListData& rData) :
 InitTokens();
 }
 
-ScUserListData::~ScUserListData()
+ScUserListData& ScUserListData::operator=(const ScUserListData& rData)
 {
+SetString(rData.aStr);
+return *this;
 }
 
 void ScUserListData::SetString( const OUString& rStr )
@@ -237,9 +239,9 @@ ScUserList::ScUserList()
 OUString aDayLong = 

[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-05-31 Thread Tibor Nagy (via logerrit)
 sc/inc/conditio.hxx|2 +-
 sc/qa/unit/data/xlsx/tdf155321.xlsx|binary
 sc/qa/unit/subsequent_filters_test.cxx |   11 +++
 sc/source/core/data/colorscale.cxx |8 ++--
 4 files changed, 18 insertions(+), 3 deletions(-)

New commits:
commit 6a059f8d1b0a7a5b64bd272e1e7b8291979bcd56
Author: Tibor Nagy 
AuthorDate: Mon May 22 14:20:59 2023 +0200
Commit: László Németh 
CommitDate: Wed May 31 20:17:16 2023 +0200

tdf#155321 sc: fix color of the highest value on percentile color scale

if the highest value occurs multiple times in the data set.

Also for coloring based on the percentile, use always the end
of the color scale for the highest values, like other spreadsheets
do, i.e. not the first possible color in the case of repeating
values. For example, the corner case in the test document is not
a red and two yellow cells any more, but a red and two green cells.

Note: color of the other repeating values still differs from
MSO, but the same as in Google Sheets.

Change-Id: I1d7eacec6e442c1112a9568e64dd6461e2ff2fbd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152117
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 51786d3dc712..47f5fdb3addb 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -208,7 +208,7 @@ class ScConditionalFormat;
 struct ScDataBarInfo;
 struct ScIconSetInfo;
 
-struct ScCondFormatData
+struct SC_DLLPUBLIC ScCondFormatData
 {
 ScCondFormatData();
 ScCondFormatData(ScCondFormatData&&);
diff --git a/sc/qa/unit/data/xlsx/tdf155321.xlsx 
b/sc/qa/unit/data/xlsx/tdf155321.xlsx
new file mode 100644
index ..42299ff746cb
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf155321.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters_test.cxx 
b/sc/qa/unit/subsequent_filters_test.cxx
index 535afe72d818..d206ce2cbf69 100644
--- a/sc/qa/unit/subsequent_filters_test.cxx
+++ b/sc/qa/unit/subsequent_filters_test.cxx
@@ -123,6 +123,17 @@ void testContentImpl(ScDocument& rDoc, bool 
bCheckMergedCells)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest, testTdf155321_CondFormatColor_XLSX)
+{
+createScDoc("xlsx/tdf155321.xlsx");
+
+ScDocument* pDoc = getScDoc();
+ScConditionalFormat* pCondFormat = pDoc->GetCondFormat(0, 0, 0);
+ScRefCellValue aCellB1(*pDoc, ScAddress(1, 0, 0));
+Color aColor = pCondFormat->GetData(aCellB1, ScAddress(1, 0, 
0)).mxColorScale.value();
+CPPUNIT_ASSERT_EQUAL(Color(99, 190, 123), aColor);
+}
+
 CPPUNIT_TEST_FIXTURE(ScFiltersTest, testTdf138601_CondFormatXLSX)
 {
 createScDoc("xlsx/tdf138601.xlsx");
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 1d713c447c5b..4e61dbdbc228 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -657,11 +657,15 @@ std::optional ScColorScaleFormat::GetColor( const 
ScAddress& rAddr ) cons
 double nValMax = CalcValue(nMin, nMax, itr);
 Color rColMax = (*itr)->GetColor();
 
+// tdf#155321 for the last percentile value, use always the end of the 
color scale,
+// i.e. not the first possible color in the case of repeating values
+bool bEqual = COLORSCALE_PERCENTILE == (*itr)->GetType() && nVal == nMax 
&& nVal == nValMax;
+
 ++itr;
-while(itr != end() && nVal > nValMax)
+while(itr != end() && (nVal > nValMax || bEqual))
 {
 rColMin = rColMax;
-nValMin = nValMax;
+nValMin = !bEqual ? nValMax : nValMax - 1;
 rColMax = (*itr)->GetColor();
 nValMax = CalcValue(nMin, nMax, itr);
 ++itr;


[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-05-22 Thread Tibor Nagy (via logerrit)
 sc/inc/colorscale.hxx  |2 +
 sc/qa/unit/ucalc_condformat.cxx|   51 +
 sc/source/core/data/colorscale.cxx |   35 +
 3 files changed, 88 insertions(+)

New commits:
commit 8af6c46a9c0e86bbbd908e96ff236ad1d6c4ddab
Author: Tibor Nagy 
AuthorDate: Wed May 17 08:40:43 2023 +0200
Commit: László Németh 
CommitDate: Mon May 22 13:32:56 2023 +0200

tdf#155319 sc: fix conditional format data bar after copying

This is a follow up to commit I064fb3fe0443705553c6bbfcc34f2d717e0f6bd6
(tdf#154906 tdf#129813 tdf#129814 sc: fix conditional format color
 scale)

Change-Id: Iacc1f5af762e1f6a40ecd13c33384e4a3340822a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151860
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 90a973391995..6652e224fe67 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -313,6 +313,8 @@ public:
 const ScDataBarFormatData* GetDataBarData() const;
 ScDataBarFormatData* GetDataBarData();
 
+bool IsEqual(const ScFormatEntry& r, bool bIgnoreSrcPos) const override;
+
 virtual void UpdateReference( sc::RefUpdateContext& rCxt ) override;
 virtual void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ) 
override;
 virtual void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt ) 
override;
diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index bfece1515a89..78978daec33a 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -268,6 +268,57 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, 
testCondFormatInsertDeleteSheets)
 m_pDoc->DeleteTab(0);
 }
 
+CPPUNIT_TEST_FIXTURE(TestCondformat, testDataBarCondCopyPaste)
+{
+m_pDoc->InsertTab(0, "Test");
+
+auto pFormat = std::make_unique(1, m_pDoc);
+ScRange aCondFormatRange(0, 0, 0, 2, 0, 0);
+ScRangeList aRangeList(aCondFormatRange);
+pFormat->SetRange(aRangeList);
+
+ScDataBarFormat* pDatabar = new ScDataBarFormat(m_pDoc);
+ScDataBarFormatData* pFormatData = new ScDataBarFormatData();
+pFormatData->meAxisPosition = databar::AUTOMATIC;
+pFormatData->maPositiveColor = COL_BLUE;
+pFormatData->mxNegativeColor = COL_GREEN;
+pFormatData->mbGradient = true;
+
+pDatabar->SetDataBarData(pFormatData);
+pFormat->AddEntry(pDatabar);
+
+sal_uLong nIndex = m_pDoc->AddCondFormat(std::move(pFormat), 0);
+
+ScDocument aClipDoc(SCDOCMODE_CLIP);
+copyToClip(m_pDoc, aCondFormatRange, );
+
+ScRange aTargetRange(0, 3, 0, 2, 3, 0);
+pasteFromClip(m_pDoc, aTargetRange, );
+
+// Pasting the same conditional format must modify existing format, making 
its range
+// combined of previous range and newly pasted range having the 
conditional format.
+// No new conditional formats must be created.
+CPPUNIT_ASSERT_EQUAL(size_t(1), m_pDoc->GetCondFormList(0)->size());
+aRangeList.Join(aTargetRange);
+for (SCCOL nCol = 0; nCol < 3; ++nCol)
+{
+ScConditionalFormat* pPastedFormat = m_pDoc->GetCondFormat(nCol, 3, 0);
+CPPUNIT_ASSERT(pPastedFormat);
+CPPUNIT_ASSERT_EQUAL(aRangeList, pPastedFormat->GetRange());
+
+sal_uLong nPastedKey = pPastedFormat->GetKey();
+CPPUNIT_ASSERT_EQUAL(nIndex, nPastedKey);
+
+const SfxPoolItem* pItem = m_pDoc->GetAttr(nCol, 3, 0, 
ATTR_CONDITIONAL);
+const ScCondFormatItem* pCondFormatItem = static_cast(pItem);
+CPPUNIT_ASSERT(pCondFormatItem);
+CPPUNIT_ASSERT_EQUAL(size_t(1), 
pCondFormatItem->GetCondFormatData().size());
+CPPUNIT_ASSERT_EQUAL(sal_uInt32(nIndex), 
pCondFormatItem->GetCondFormatData().front());
+}
+
+m_pDoc->DeleteTab(0);
+}
+
 CPPUNIT_TEST_FIXTURE(TestCondformat, testColorScaleCondCopyPaste)
 {
 m_pDoc->InsertTab(0, "Test");
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 7fd48f47305d..1d713c447c5b 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -802,6 +802,41 @@ ScFormatEntry::Type ScDataBarFormat::GetType() const
 return Type::Databar;
 }
 
+bool ScDataBarFormat::IsEqual(const ScFormatEntry& rOther, bool 
/*bIgnoreSrcPos*/) const
+{
+if (GetType() != rOther.GetType())
+return false;
+
+const ScDataBarFormat& r = static_cast(rOther);
+
+bool bEq = 
(mpFormatData->maAxisColor.IsRGBEqual(r.mpFormatData->maAxisColor)
+&& 
mpFormatData->maPositiveColor.IsRGBEqual(r.mpFormatData->maPositiveColor)
+&& mpFormatData->mxNegativeColor == 
r.mpFormatData->mxNegativeColor
+&& mpFormatData->meAxisPosition == 
r.mpFormatData->meAxisPosition
+&& mpFormatData->mbGradient == r.mpFormatData->mbGradient
+&& mpFormatData->mbOnlyBar == r.mpFormatData->mbOnlyBar);
+
+if 

[Libreoffice-commits] core.git: sc/inc

2023-05-19 Thread Miklos Vajna (via logerrit)
 sc/inc/attrib.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d0a91310d481f4219608dedf481bd9824da97b2c
Author: Miklos Vajna 
AuthorDate: Fri May 19 10:44:45 2023 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 19 15:25:41 2023 +0200

CppunitTest_sc_dataprovider: fix sanitizers failure

Type info for ScCondFormatItem is now needed, see
.

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

diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx
index 6a27d2e840d2..dc394dfb1c08 100644
--- a/sc/inc/attrib.hxx
+++ b/sc/inc/attrib.hxx
@@ -269,7 +269,7 @@ private:
 
 typedef o3tl::sorted_vector ScCondFormatIndexes;
 
-class ScCondFormatItem final : public SfxPoolItem
+class SAL_DLLPUBLIC_RTTI ScCondFormatItem final : public SfxPoolItem
 {
 public:
 explicit ScCondFormatItem();


[Libreoffice-commits] core.git: sc/inc sc/source

2023-05-17 Thread Henry Castro (via logerrit)
 sc/inc/colorscale.hxx  |2 ++
 sc/source/core/data/colorscale.cxx |   15 +++
 2 files changed, 17 insertions(+)

New commits:
commit c85255fd7a62bec9342fa6f2a79d1395979d54be
Author: Henry Castro 
AuthorDate: Thu May 11 16:23:03 2023 -0400
Commit: Henry Castro 
CommitDate: Wed May 17 15:57:02 2023 +0200

tdf#154477: sc: copy cache values when clone color conditional format

When clone a conditional format list, also copy the cache
values that hold the min and max values, otherwise if clone
occurs when copying to the clipboard the values have wrong
data due to limiting range cells copied.

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

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index e78baf0871b2..90a973391995 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -224,6 +224,8 @@ public:
 virtual ~ScColorFormat() override;
 
 const ScRangeList& GetRange() const;
+void SetCache(const std::vector& aValues);
+std::vector GetCache() const;
 
 virtual void SetParent(ScConditionalFormat* pParent) override;
 
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 1bb36712fd13..7fd48f47305d 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -378,6 +378,9 @@ ScColorScaleFormat::ScColorScaleFormat(ScDocument* pDoc, 
const ScColorScaleForma
 {
 maColorScales.emplace_back(new ScColorScaleEntry(pDoc, *rxEntry));
 }
+
+auto aCache = rFormat.GetCache();
+SetCache(aCache);
 }
 
 ScColorFormat* ScColorScaleFormat::Clone(ScDocument* pDoc) const
@@ -457,6 +460,18 @@ const ScRangeList& ScColorFormat::GetRange() const
 return mpParent->GetRange();
 }
 
+std::vector ScColorFormat::GetCache() const
+{
+std::vector empty;
+return mpCache ? mpCache->maValues : empty;
+}
+
+void ScColorFormat::SetCache(const std::vector& aValues)
+{
+mpCache.reset(new ScColorFormatCache);
+mpCache->maValues = aValues;
+}
+
 std::vector& ScColorFormat::getValues() const
 {
 if(!mpCache)


[Libreoffice-commits] core.git: sc/inc sc/source

2023-05-10 Thread Caolán McNamara (via logerrit)
 sc/inc/documentlinkmgr.hxx|1 +
 sc/inc/globstr.hrc|2 ++
 sc/source/ui/docshell/docsh4.cxx  |   17 -
 sc/source/ui/docshell/documentlinkmgr.cxx |   18 ++
 4 files changed, 37 insertions(+), 1 deletion(-)

New commits:
commit a580a69a1e579755f726ffcd2a31a6f4f42c7100
Author: Caolán McNamara 
AuthorDate: Wed May 10 16:38:08 2023 +0100
Commit: Caolán McNamara 
CommitDate: Wed May 10 22:29:02 2023 +0200

reinforce the infobar warning when there are both external links...

and WEBSERVICE present. This information is also shown in the
"help" in the infobar

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

diff --git a/sc/inc/documentlinkmgr.hxx b/sc/inc/documentlinkmgr.hxx
index e37719a3431c..de36ec40fa81 100644
--- a/sc/inc/documentlinkmgr.hxx
+++ b/sc/inc/documentlinkmgr.hxx
@@ -54,6 +54,7 @@ public:
 
 bool hasDdeLinks() const;
 bool hasDdeOrOleOrWebServiceLinks() const;
+bool hasExternalRefLinks() const;
 
 bool updateDdeOrOleOrWebServiceLinks(weld::Window* pWin);
 
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 01e1ab47219b..600cf9354fc0 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -359,6 +359,8 @@
 #define STR_BY  NC_("STR_BY", "by")
 #define STR_ON  NC_("STR_ON", "on")
 #define STR_RELOAD_TABLES   NC_("STR_RELOAD_TABLES", 
"Automatic update of external links has been disabled.")
+#define STR_TRUST_DOCUMENT_WARNING  
NC_("STR_TRUST_DOCUMENT_WARNING", "Are you sure you trust this document?")
+#define STR_WEBSERVICE_WITH_LINKS_WARNING   
NC_("STR_WEBSERVICE_WITH_LINKS_WARNING", "Links to remote locations can be 
constructed that transmit local data to the remote server.")
 #define STR_REIMPORT_AFTER_LOAD NC_("STR_REIMPORT_AFTER_LOAD", 
"This file contains queries. The results of these queries were not saved.\nDo 
you want these queries to be repeated?")
 #define STR_INSERT_FULL NC_("STR_INSERT_FULL", "Filled 
cells cannot be shifted\nbeyond the sheet.")
 #define STR_TABINSERT_ERROR NC_("STR_TABINSERT_ERROR", 
"The table could not be inserted.")
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 611d6537456e..1a344af959fd 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -199,8 +199,23 @@ void ScDocShell::ReloadAllLinks()
 m_pDocument->UpdateAreaLinks();
 }
 
-IMPL_LINK_NOARG( ScDocShell, ReloadAllLinksHdl, weld::Button&, void )
+IMPL_LINK( ScDocShell, ReloadAllLinksHdl, weld::Button&, rButton, void )
 {
+ScDocument& rDoc = GetDocument();
+if (rDoc.HasLinkFormulaNeedingCheck() && 
rDoc.GetDocLinkManager().hasExternalRefLinks())
+{
+// If we have WEBSERVICE/Dde link and other external links in the 
document, it might indicate some
+// exfiltration attempt, add *another* warning about this on top of 
the "Security Warning"
+// shown in the infobar before they got here.
+std::unique_ptr 
xQueryBox(Application::CreateMessageDialog(,
+   
VclMessageType::Warning, VclButtonsType::YesNo,
+   
ScResId(STR_TRUST_DOCUMENT_WARNING)));
+
xQueryBox->set_secondary_text(ScResId(STR_WEBSERVICE_WITH_LINKS_WARNING));
+xQueryBox->set_default_response(RET_NO);
+if (xQueryBox->run() != RET_YES)
+return;
+}
+
 ReloadAllLinks();
 
 ScTabViewShell* pViewSh = GetBestViewShell();
diff --git a/sc/source/ui/docshell/documentlinkmgr.cxx 
b/sc/source/ui/docshell/documentlinkmgr.cxx
index 79a86d08b438..0fb89cfa0d18 100644
--- a/sc/source/ui/docshell/documentlinkmgr.cxx
+++ b/sc/source/ui/docshell/documentlinkmgr.cxx
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -153,6 +154,23 @@ bool 
DocumentLinkManager::hasDdeOrOleOrWebServiceLinks(bool bDde, bool bOle, boo
 return false;
 }
 
+bool DocumentLinkManager::hasExternalRefLinks() const
+{
+sfx2::LinkManager* pMgr = mpImpl->mpLinkManager;
+if (!pMgr)
+return false;
+
+const sfx2::SvBaseLinks& rLinks = pMgr->GetLinks();
+for (const auto & rLink : rLinks)
+{
+sfx2::SvBaseLink* pBase = rLink.get();
+if (dynamic_cast(pBase))
+return true;
+}
+
+return false;
+}
+
 bool DocumentLinkManager::updateDdeOrOleOrWebServiceLinks(weld::Window* pWin)
 {
 sfx2::LinkManager* pMgr = mpImpl->mpLinkManager;


[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-05-08 Thread Samuel Mehrbrodt (via logerrit)
 sc/inc/sortparam.hxx  |9 +++
 sc/inc/strings.hrc|1 
 sc/inc/table.hxx  |3 +
 sc/qa/uitest/autofilter/autofilter.py |1 
 sc/qa/uitest/autofilter2/tdf126306.py |3 +
 sc/qa/uitest/autofilter2/tdf141559.py |4 +
 sc/qa/uitest/autofilter2/tdf46184.py  |1 
 sc/qa/uitest/autofilter2/tdf68113.py  |2 
 sc/qa/unit/ucalc_sort.cxx |   21 +++
 sc/source/core/data/column3.cxx   |   63 +
 sc/source/core/data/table3.cxx|   31 ++
 sc/source/core/data/table5.cxx|   63 +
 sc/source/ui/dbgui/tpsort.cxx |2 
 sc/source/ui/view/gridwin.cxx |  102 +++---
 14 files changed, 238 insertions(+), 68 deletions(-)

New commits:
commit bb5e03681c576bc108c1e5c819957f1b34f80ca7
Author: Samuel Mehrbrodt 
AuthorDate: Wed Apr 26 15:46:26 2023 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Mon May 8 08:14:42 2023 +0200

tdf#95520 Autofilter: Sort by color

Change-Id: I2c1455cc2c741d16f09eccee0bf489f8990684f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151064
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sc/inc/sortparam.hxx b/sc/inc/sortparam.hxx
index 63d83e2c0595..94817b862b3e 100644
--- a/sc/inc/sortparam.hxx
+++ b/sc/inc/sortparam.hxx
@@ -24,17 +24,26 @@
 #include 
 
 #include "address.hxx"
+#include 
 #include 
 #include "scdllapi.h"
 
 struct ScSubTotalParam;
 struct ScQueryParam;
 
+enum class ScColorSortMode {
+None,
+TextColor,
+BackgroundColor
+};
+
 struct ScSortKeyState
 {
 SCCOLROW nField;
 bool bDoSort;
 bool bAscending;
+ScColorSortMode aColorSortMode;
+ColoraColorSortColor;
 };
 
 /** Struct to hold non-data extended area, used with
diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc
index 6c85b3d617da..cfc1eae6f7c2 100644
--- a/sc/inc/strings.hrc
+++ b/sc/inc/strings.hrc
@@ -43,6 +43,7 @@
 #define SCSTR_FILTER_BACKGROUND_COLOR_COND  
NC_("STANDARDFILTERDIALOG_COND", "Background color")
 #define SCSTR_FILTER_NO_FILL
NC_("SCSTR_FILTER_NO_FILL", "No Fill")
 #define SCSTR_FILTER_AUTOMATIC_COLOR
NC_("SCSTR_FILTER_AUTOMATIC_COLOR", "Automatic")
+#define SCSTR_SORT_COLORNC_("SCSTR_SORT_COLOR", 
"Sort by Color")
 #define SCSTR_NONAMENC_("SCSTR_NONAME", 
"unnamed")
 #define SCSTR_INSERT_RTLNC_("SCSTR_INSERT_RTL", 
"Shift cells left")
 // "%1 is replaced to column letter, such as 'Column A'"
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index cbce92da3998..a2cc60f9d70e 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -990,6 +990,9 @@ public:
 SCROW   LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
 SCROW   CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
 
+Color GetCellBackgroundColor(ScAddress aPos) const;
+Color GetCellTextColor(ScAddress aPos) const;
+
 bool IsManualRowHeight(SCROW nRow) const;
 
 bool HasUniformRowHeight( SCROW nRow1, SCROW nRow2 ) const;
diff --git a/sc/qa/uitest/autofilter/autofilter.py 
b/sc/qa/uitest/autofilter/autofilter.py
index 8ffba26539a5..fbf46cc5d397 100644
--- a/sc/qa/uitest/autofilter/autofilter.py
+++ b/sc/qa/uitest/autofilter/autofilter.py
@@ -476,6 +476,7 @@ class AutofilterTest(UITestCase):
 xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
 xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
 xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
 xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
 xSubFloatWindow = self.xUITest.getFloatWindow()
 xSubMenu = xSubFloatWindow.getChild("menu")
diff --git a/sc/qa/uitest/autofilter2/tdf126306.py 
b/sc/qa/uitest/autofilter2/tdf126306.py
index 51c099a3f3c2..2ebb3789bf8f 100644
--- a/sc/qa/uitest/autofilter2/tdf126306.py
+++ b/sc/qa/uitest/autofilter2/tdf126306.py
@@ -81,6 +81,7 @@ class tdf126306(UITestCase):
 xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
 xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
 xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
 xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
 xSubFloatWindow = self.xUITest.getFloatWindow()
 xSubMenu = xSubFloatWindow.getChild("menu")
@@ -107,6 +108,7 @@ class tdf126306(UITestCase):
 xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
 xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
 

[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-05-07 Thread Regina Henschel (via logerrit)
 sc/inc/drwlayer.hxx   |5 
 sc/qa/unit/data/ods/tdf139083_copy_without_resize.ods |binary
 sc/qa/unit/data/ods/tdf155093_double_names.ods|binary
 sc/qa/unit/scshapetest.cxx|   47 +
 sc/source/core/data/document.cxx  |   23 
 sc/source/core/data/drwlayer.cxx  |  444 --
 sc/source/core/data/table7.cxx|8 
 7 files changed, 378 insertions(+), 149 deletions(-)

New commits:
commit dfb0d118f6b23730bc632885eb4703a37eeaec16
Author: Regina Henschel 
AuthorDate: Sat Apr 8 18:38:04 2023 +0200
Commit: Regina Henschel 
CommitDate: Sun May 7 10:57:04 2023 +0200

tdf#139083 Only resize if 'resize with cell' is set

The copy of ranges with shapes had the following further bugs:
* For cell anchored shapes the position was taken from the source
rectangle instead of the anchor.
* Resizing was calculated from source and destination rectangle, but
should only depend on size of object range.
* tdf#125938 Shapes were moved without adapting the anchor.
* tdf#155091 Source with filtered rows produced doubled objects in
paste.
* The CopyToClip method has a useless NbcMove(size(0,0)). NbcMove
is a move 'by', not a move 'to'.
* tdf#155093 Pasted object has same name as source object and thus
is not accessible via Navigator.
* tdf#155094 Transposed pasted objects have wrong position
* tdf#155095 Objects over collapsed group are incorrectly resized
* tdf#141437, tdf#141436 transposed objects have wrong size

Only objects, which can really resize, are now resized. In case of
transposing no objects are resized. Transposing would need to
transpose the object geometry, but that is missing.
The offset inside the start anchor cell is adapted to the size of
the destination cell to keep the anchor in this cell.
Object resizing considers that filtered rows are removed whereas
collapsed or hidden rows are shown in pasted area.
Object resizing does no longer use global factors but calculate the
desired snap rectangle and fits the object into it.

Change-Id: I42924b28a2d652d8b70cb8e1a1d7ca4324b09cf6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150161
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx
index c127f597bab2..eea0b118b521 100644
--- a/sc/inc/drwlayer.hxx
+++ b/sc/inc/drwlayer.hxx
@@ -156,8 +156,9 @@ public:
 
 voidCopyToClip( ScDocument* pClipDoc, SCTAB nTab, const 
tools::Rectangle& rRange );
 voidCopyFromClip( ScDrawLayer* pClipModel,
-SCTAB nSourceTab, const tools::Rectangle& 
rSourceRange,
-const ScAddress& rDestPos, const 
tools::Rectangle& rDestRange );
+SCTAB nSourceTab, const ScRange& 
rSourceRange,
+const ScAddress& rDestPos, const ScRange& 
rDestRange,
+bool bTransposing = false);
 
 voidSetPageSize(sal_uInt16 nPageNo, const Size& rSize, bool 
bUpdateNoteCaptionPos,
 const ScObjectHandling eObjectHandling = 
ScObjectHandling::RecalcPosMode);
diff --git a/sc/qa/unit/data/ods/tdf139083_copy_without_resize.ods 
b/sc/qa/unit/data/ods/tdf139083_copy_without_resize.ods
new file mode 100644
index ..ea3b8908ede2
Binary files /dev/null and 
b/sc/qa/unit/data/ods/tdf139083_copy_without_resize.ods differ
diff --git a/sc/qa/unit/data/ods/tdf155093_double_names.ods 
b/sc/qa/unit/data/ods/tdf155093_double_names.ods
new file mode 100644
index ..6dd7a69554c4
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf155093_double_names.ods 
differ
diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
index 814384effe83..6f9a39c8eafa 100644
--- a/sc/qa/unit/scshapetest.cxx
+++ b/sc/qa/unit/scshapetest.cxx
@@ -999,6 +999,53 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, testLargeAnchorOffset)
 CPPUNIT_ASSERT_POINT_EQUAL_WITH_TOLERANCE(aOldPos, aNewPos, 1);
 }
 
+CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf139083_copy_without_resize)
+{
+// Load a document, which has a shape anchored to cell B2, but without 
'resize with cell'.
+// When the range B2:B3 is copied and pasted to D5, then the copied shape 
should keep its size.
+createScDoc("ods/tdf139083_copy_without_resize.ods");
+
+// Get document
+ScDocument* pDoc = getScDoc();
+
+// Copy cells B2:B3. They have row height 2cm and column width 3cm.
+goToCell("$B$2:$B$3");
+dispatchCommand(mxComponent, ".uno:Copy", {});
+
+// Paste to D5. There are row height 0.5cm and column width 1cm.
+goToCell("$D$5");
+dispatchCommand(mxComponent, ".uno:Paste", {});
+
+// Make sure original and pasted shape have the same size.
+// 

[Libreoffice-commits] core.git: sc/inc sc/source sc/uiconfig

2023-05-05 Thread Bartosz Kosiorek (via logerrit)
 sc/inc/strings.hrc |3 
 sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx |   32 
+++---
 sc/uiconfig/scalc/ui/randomnumbergenerator.ui  |1 
 3 files changed, 28 insertions(+), 8 deletions(-)

New commits:
commit 793cc7d2ef5967af90a6810e597e1e12bd42777c
Author: Bartosz Kosiorek 
AuthorDate: Fri May 5 20:15:19 2023 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sat May 6 03:54:25 2023 +0200

tdf#154872 Add Poisson distribution to Random Number Generators

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

diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc
index e860263424be..6c85b3d617da 100644
--- a/sc/inc/strings.hrc
+++ b/sc/inc/strings.hrc
@@ -266,9 +266,10 @@
 #define STR_DISTRIBUTION_CAUCHY 
NC_("STR_DISTRIBUTION_CAUCHY", "Cauchy")
 #define STR_DISTRIBUTION_BERNOULLI  
NC_("STR_DISTRIBUTION_BERNOULLI", "Bernoulli")
 #define STR_DISTRIBUTION_BINOMIAL   
NC_("STR_DISTRIBUTION_BINOMIAL", "Binomial")
-#define STR_DISTRIBUTION_NEGATIVE_BINOMIAL  
NC_("STR_DISTRIBUTION_NEGATIVE_BINOMIAL", "Negative Binomial")
 #define STR_DISTRIBUTION_CHI_SQUARED
NC_("STR_DISTRIBUTION_CHI_SQUARED", "Chi Squared")
 #define STR_DISTRIBUTION_GEOMETRIC  
NC_("STR_DISTRIBUTION_GEOMETRIC", "Geometric")
+#define STR_DISTRIBUTION_NEGATIVE_BINOMIAL  
NC_("STR_DISTRIBUTION_NEGATIVE_BINOMIAL", "Negative Binomial")
+#define STR_DISTRIBUTION_POISSON
NC_("STR_DISTRIBUTION_POISSON", "Poisson")
 #define STR_RNG_PARAMETER_MINIMUM   
NC_("STR_RNG_PARAMETER_MINIMUM", "Minimum")
 #define STR_RNG_PARAMETER_MAXIMUM   
NC_("STR_RNG_PARAMETER_MAXIMUM", "Maximum")
 #define STR_RNG_PARAMETER_MEAN  
NC_("STR_RNG_PARAMETER_MEAN", "Mean")
diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx 
b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
index 91b43cbe0433..2490ebf47301 100644
--- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx
@@ -36,6 +36,7 @@ const sal_Int64 DIST_CHI_SQUARED = 5;
 const sal_Int64 DIST_GEOMETRIC   = 6;
 const sal_Int64 DIST_NEGATIVE_BINOMIAL   = 7;
 const sal_Int64 DIST_UNIFORM_INTEGER = 8;
+const sal_Int64 DIST_POISSON = 9;
 
 const sal_Int64 PRECISION   = 1;
 const sal_Int64 DIGITS  = 4;
@@ -225,13 +226,6 @@ void 
ScRandomNumberGeneratorDialog::SelectGeneratorAndGenerateNumbers()
 GenerateNumbers(rng, STR_DISTRIBUTION_BINOMIAL, aDecimalPlaces);
 break;
 }
-case DIST_NEGATIVE_BINOMIAL:
-{
-std::negative_binomial_distribution<> 
distribution(parameterInteger2, parameter1);
-auto rng = std::bind(distribution, seed);
-GenerateNumbers(rng, STR_DISTRIBUTION_NEGATIVE_BINOMIAL, 
aDecimalPlaces);
-break;
-}
 case DIST_CHI_SQUARED:
 {
 std::chi_squared_distribution<> distribution(parameter1);
@@ -246,6 +240,20 @@ void 
ScRandomNumberGeneratorDialog::SelectGeneratorAndGenerateNumbers()
 GenerateNumbers(rng, STR_DISTRIBUTION_GEOMETRIC, aDecimalPlaces);
 break;
 }
+case DIST_NEGATIVE_BINOMIAL:
+{
+std::negative_binomial_distribution<> 
distribution(parameterInteger2, parameter1);
+auto rng = std::bind(distribution, seed);
+GenerateNumbers(rng, STR_DISTRIBUTION_NEGATIVE_BINOMIAL, 
aDecimalPlaces);
+break;
+}
+case DIST_POISSON:
+{
+std::poisson_distribution<> distribution(parameter1);
+auto rng = std::bind(distribution, seed);
+GenerateNumbers(rng, STR_DISTRIBUTION_POISSON, aDecimalPlaces);
+break;
+}
 }
 }
 
@@ -476,6 +484,16 @@ IMPL_LINK_NOARG(ScRandomNumberGeneratorDialog, 
DistributionChanged, weld::ComboB
 mxParameter2Value->hide();
 break;
 }
+case DIST_POISSON:
+{
+mxParameter1Text->set_label(ScResId(STR_RNG_PARAMETER_MEAN));
+mxParameter1Value->set_value(PRECISION);
+mxParameter1Value->set_increments(1000, 1);
+mxParameter1Value->set_min(1000);
+mxParameter2Text->hide();
+mxParameter2Value->hide();
+break;
+}
 }
 }
 
diff --git a/sc/uiconfig/scalc/ui/randomnumbergenerator.ui 
b/sc/uiconfig/scalc/ui/randomnumbergenerator.ui
index e6f8f93ba214..d9481046bd8f 100644
--- a/sc/uiconfig/scalc/ui/randomnumbergenerator.ui
+++ b/sc/uiconfig/scalc/ui/randomnumbergenerator.ui
@@ -240,6 +240,7 @@
   Chi Squared
  

[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-04-26 Thread Tibor Nagy (via logerrit)
 sc/inc/colorscale.hxx  |2 +
 sc/qa/unit/ucalc_condformat.cxx|   50 +
 sc/source/core/data/colorscale.cxx |   18 +
 3 files changed, 70 insertions(+)

New commits:
commit 3fa15dd614bd72ddb36dbe033abeef5609d31f38
Author: Tibor Nagy 
AuthorDate: Mon Apr 24 09:08:14 2023 +0200
Commit: Nagy Tibor 
CommitDate: Wed Apr 26 11:39:44 2023 +0200

tdf#154906 tdf#129813 tdf#129814 sc: fix conditional format color scale

This is a follow up to commit 3f614f431475e1bf3bb3bbeac59b0681309628b7
(tdf#95295: don't add duplicate conditional formats)
The above commit clearly describes how this fix works.

Change-Id: I064fb3fe0443705553c6bbfcc34f2d717e0f6bd6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150899
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index de74030dbc85..513eb11cf2f4 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -270,6 +270,8 @@ public:
 std::optional GetColor(const ScAddress& rAddr) const;
 void AddEntry(ScColorScaleEntry* pEntry);
 
+bool IsEqual(const ScFormatEntry& r, bool bIgnoreSrcPos) const override;
+
 virtual void UpdateReference( sc::RefUpdateContext& rCxt ) override;
 virtual void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ) 
override;
 virtual void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt ) 
override;
diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index 811cd0d540d8..bfece1515a89 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -268,6 +268,56 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, 
testCondFormatInsertDeleteSheets)
 m_pDoc->DeleteTab(0);
 }
 
+CPPUNIT_TEST_FIXTURE(TestCondformat, testColorScaleCondCopyPaste)
+{
+m_pDoc->InsertTab(0, "Test");
+
+auto pFormat = std::make_unique(1, m_pDoc);
+ScRange aCondFormatRange(0, 0, 0, 2, 0, 0);
+ScRangeList aRangeList(aCondFormatRange);
+pFormat->SetRange(aRangeList);
+
+ScColorScaleFormat* pColorScaleFormat = new ScColorScaleFormat(m_pDoc);
+ScColorScaleEntry* pEntryBlue = new ScColorScaleEntry(0, COL_BLUE);
+ScColorScaleEntry* pEntryGreen = new ScColorScaleEntry(1, COL_GREEN);
+ScColorScaleEntry* pEntryRed = new ScColorScaleEntry(2, COL_RED);
+pColorScaleFormat->AddEntry(pEntryBlue);
+pColorScaleFormat->AddEntry(pEntryGreen);
+pColorScaleFormat->AddEntry(pEntryRed);
+
+pFormat->AddEntry(pColorScaleFormat);
+sal_uLong nIndex = m_pDoc->AddCondFormat(std::move(pFormat), 0);
+
+ScDocument aClipDoc(SCDOCMODE_CLIP);
+copyToClip(m_pDoc, aCondFormatRange, );
+
+ScRange aTargetRange(0, 3, 0, 2, 3, 0);
+pasteFromClip(m_pDoc, aTargetRange, );
+
+// Pasting the same conditional format must modify existing format, making 
its range
+// combined of previous range and newly pasted range having the 
conditional format.
+// No new conditional formats must be created.
+CPPUNIT_ASSERT_EQUAL(size_t(1), m_pDoc->GetCondFormList(0)->size());
+aRangeList.Join(aTargetRange);
+for (SCCOL nCol = 0; nCol < 3; ++nCol)
+{
+ScConditionalFormat* pPastedFormat = m_pDoc->GetCondFormat(nCol, 3, 0);
+CPPUNIT_ASSERT(pPastedFormat);
+CPPUNIT_ASSERT_EQUAL(aRangeList, pPastedFormat->GetRange());
+
+sal_uLong nPastedKey = pPastedFormat->GetKey();
+CPPUNIT_ASSERT_EQUAL(nIndex, nPastedKey);
+
+const SfxPoolItem* pItem = m_pDoc->GetAttr(nCol, 3, 0, 
ATTR_CONDITIONAL);
+const ScCondFormatItem* pCondFormatItem = static_cast(pItem);
+CPPUNIT_ASSERT(pCondFormatItem);
+CPPUNIT_ASSERT_EQUAL(size_t(1), 
pCondFormatItem->GetCondFormatData().size());
+CPPUNIT_ASSERT_EQUAL(sal_uInt32(nIndex), 
pCondFormatItem->GetCondFormatData().front());
+}
+
+m_pDoc->DeleteTab(0);
+}
+
 CPPUNIT_TEST_FIXTURE(TestCondformat, testCondCopyPaste)
 {
 m_pDoc->InsertTab(0, "Test");
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 0a357828c61e..192dd1cea78c 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -404,6 +404,24 @@ void ScColorScaleFormat::AddEntry( ScColorScaleEntry* 
pEntry )
 maColorScales.back()->SetRepaintCallback(mpParent);
 }
 
+bool ScColorScaleFormat::IsEqual(const ScFormatEntry& rOther, bool 
/*bIgnoreSrcPos*/) const
+{
+if (GetType() != rOther.GetType())
+return false;
+
+const ScColorScaleFormat& r = static_cast(rOther);
+
+for (size_t i = 0; i < maColorScales.size(); ++i)
+{
+if 
(!maColorScales[i]->GetColor().IsRGBEqual(r.maColorScales[i]->GetColor().GetRGBColor())
+|| maColorScales[i]->GetType() != r.maColorScales[i]->GetType()
+|| maColorScales[i]->GetValue() != r.maColorScales[i]->GetValue())
+return false;
+}

[Libreoffice-commits] core.git: sc/inc sc/source

2023-04-24 Thread Arvind K (via logerrit)
 sc/inc/strings.hrc|4 
 sc/source/ui/dbgui/tpsort.cxx |   18 ++
 sc/source/ui/inc/tpsort.hxx   |4 
 3 files changed, 26 insertions(+)

New commits:
commit b7dfed873d79417fff83410760fec84567b534e9
Author: Arvind K 
AuthorDate: Fri Apr 14 23:49:51 2023 +0530
Commit: Andreas Heinisch 
CommitDate: Mon Apr 24 10:39:20 2023 +0200

tdf#139544 change boundary columns to rows in sort dialog

Change-Id: I7f525bea42e6efd3c7c4b62a21d2638b676cd836
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150432
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc
index f7d33399faa2..e860263424be 100644
--- a/sc/inc/strings.hrc
+++ b/sc/inc/strings.hrc
@@ -129,6 +129,10 @@
 #define SCSTR_FORMULA_SYNTAX_XL_R1C1
NC_("SCSTR_FORMULA_SYNTAX_XL_R1C1", "Excel R1C1")
 #define SCSTR_COL_LABEL NC_("SCSTR_COL_LABEL", 
"Range contains column la~bels" )
 #define SCSTR_ROW_LABEL NC_("SCSTR_ROW_LABEL", 
"Range contains ~row labels" )
+#define SCSTR_NOTES_COL_LABEL   
NC_("SCSTR_INCLUDE_NOTES_COL_LABEL","Include boundary column(s) containing only 
comments")
+#define SCSTR_NOTES_ROW_LABEL   
NC_("SCSTR_INCLUDE_NOTES_ROW_LABEL","Include boundary row(s) containing only 
comments")
+#define SCSTR_IMAGES_COL_LABEL  
NC_("SCSTR_INCLUDE_IMAGES_COL_LABEL","Include boundary column(s) containing 
only images")
+#define SCSTR_IMAGES_ROW_LABEL  
NC_("SCSTR_INCLUDE_IMAGES_ROW_LABEL","Include boundary row(s) containing only 
images")
 #define SCSTR_VALERRNC_("SCSTR_VALERR", 
"Invalid value" )
 #define STR_NOFORMULASPECIFIED  
NC_("STR_NOFORMULASPECIFIED", "No formula specified." )
 #define STR_NOCOLROWNC_("STR_NOCOLROW", 
"Neither row or column specified." )
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index 88d6cf6472e2..c137ec4cf898 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -492,6 +492,10 @@ void ScTabPageSortFields::AddSortKey( sal_uInt16 nItem )
 ScTabPageSortOptions::ScTabPageSortOptions(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet& rArgSet)
 : SfxTabPage(pPage, pController, "modules/scalc/ui/sortoptionspage.ui", 
"SortOptionsPage", )
 , aStrUndefined(ScResId(SCSTR_UNDEFINED))
+, aStrCommentsRowLabel(ScResId(SCSTR_NOTES_ROW_LABEL))
+, aStrCommentsColLabel(ScResId(SCSTR_NOTES_COL_LABEL))
+, aStrImgRowLabel(ScResId(SCSTR_IMAGES_ROW_LABEL))
+, aStrImgColLabel(ScResId(SCSTR_IMAGES_COL_LABEL))
 , nWhichSort(rArgSet.GetPool()->GetWhich(SID_SORT))
 , aSortData(rArgSet.Get(nWhichSort).GetSortData())
 , pViewData(nullptr)
@@ -557,6 +561,9 @@ void ScTabPageSortOptions::Init()
 m_xEdOutPos->set_text(OUString());
 }
 
+m_xBtnIncComments->set_label(aStrCommentsColLabel);
+m_xBtnIncImages->set_label(aStrImgColLabel);
+
 FillUserSortListBox();
 
 //  get available languages
@@ -681,6 +688,17 @@ void ScTabPageSortOptions::ActivatePage( const SfxItemSet& 
rSet )
 ScSortDlg* pDlg = static_cast(GetDialogController());
 if (!pDlg)
 return;
+
+if (aSortData.bByRow)
+{
+m_xBtnIncComments->set_label(aStrCommentsRowLabel);
+m_xBtnIncImages->set_label(aStrImgRowLabel);
+}
+else
+{
+m_xBtnIncComments->set_label(aStrCommentsColLabel);
+m_xBtnIncImages->set_label(aStrImgColLabel);
+}
 }
 
 DeactivateRC ScTabPageSortOptions::DeactivatePage( SfxItemSet* pSetP )
diff --git a/sc/source/ui/inc/tpsort.hxx b/sc/source/ui/inc/tpsort.hxx
index 4e6a36ca9da5..1c9d27926b1c 100644
--- a/sc/source/ui/inc/tpsort.hxx
+++ b/sc/source/ui/inc/tpsort.hxx
@@ -113,6 +113,10 @@ protected:
 
 private:
 OUStringaStrUndefined;
+OUStringaStrCommentsRowLabel;
+OUStringaStrCommentsColLabel;
+OUStringaStrImgRowLabel;
+OUStringaStrImgColLabel;
 
 TypedWhichId nWhichSort;
 ScSortParam aSortData;


[Libreoffice-commits] core.git: sc/inc sc/source

2023-04-20 Thread Eike Rathke (via logerrit)
 sc/inc/globstr.hrc |1 +
 sc/source/core/data/global.cxx |4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit df8ae4fddb77f5621f651f05e72f8c2bd4ae111b
Author: Eike Rathke 
AuthorDate: Wed Apr 19 21:45:22 2023 +0200
Commit: Eike Rathke 
CommitDate: Thu Apr 20 14:32:46 2023 +0200

Related: tdf#154915 #NULL! is not an "Internal syntactical error"

... but "Error: No code or intersection".

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

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 16fce3f32974..0aa8d010f9df 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -239,6 +239,7 @@
 #define STR_NO_MACRONC_("STR_NO_MACRO", "#MACRO?")
 #define STR_LONG_ERR_NO_MACRO   NC_("STR_LONG_ERR_NO_MACRO", 
"Error: Macro not found")
 #define STR_LONG_ERR_SYNTAX NC_("STR_LONG_ERR_SYNTAX", 
"Internal syntactical error")
+#define STR_LONG_ERR_NO_CODENC_("STR_LONG_ERR_NO_CODE", 
"Error: No code or intersection")
 #define STR_LONG_ERR_ILL_ARGNC_("STR_LONG_ERR_ILL_ARG", 
"Error: Invalid argument")
 #define STR_LONG_ERR_ILL_PARNC_("STR_LONG_ERR_ILL_PAR", 
"Error in parameter list")
 #define STR_LONG_ERR_ILL_CHAR   NC_("STR_LONG_ERR_ILL_CHAR", 
"Error: Invalid character")
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 61c873737dc1..02167599e926 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -391,9 +391,11 @@ OUString ScGlobal::GetLongErrorString(FormulaError nErr)
 case FormulaError::UnknownOpCode:
 case FormulaError::UnknownStackVariable:
 case FormulaError::UnknownToken:
-case FormulaError::NoCode:
 pErrNumber = STR_LONG_ERR_SYNTAX;
 break;
+case FormulaError::NoCode:
+pErrNumber = STR_LONG_ERR_NO_CODE;
+break;
 case FormulaError::CircularReference:
 pErrNumber = STR_LONG_ERR_CIRC_REF;
 break;


[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-04-17 Thread Maxim Monastirsky (via logerrit)
 sc/inc/postit.hxx   |4 +++-
 sc/qa/unit/subsequent_filters_test4.cxx |8 +++-
 sc/source/core/data/postit.cxx  |   14 ++
 sc/source/filter/xml/xmlcelli.cxx   |2 +-
 4 files changed, 21 insertions(+), 7 deletions(-)

New commits:
commit 0ee9501c0b7dc1a291715fff9c1934b1c08cb654
Author: Maxim Monastirsky 
AuthorDate: Thu Apr 13 18:57:26 2023 +0300
Commit: Maxim Monastirsky 
CommitDate: Tue Apr 18 01:57:24 2023 +0200

sc drawstyles: Assign the Note style to imported comments

... that don't have a style assignment. Typically in ods files
created by older versions or by 3rd party.

- For hidden comments this should make no difference, as we used
to apply the default comment formatting as DF underneath their
defined DF, just now we do that as a style assignment instead.

- Same for comments from xlsx and xls files.

- For visible comments from ods files created by OOo/LO, there
should be no difference either, as such files typically include
the shape formatting in them.

- For visible comments from ods files created by Excel, there
will be a difference, as Excel used to not include the full shape
formatting (known to be the case with Excel 2007 and 2016; can't
test any other version). This resulted with a weird look, e.g.
a line instead of an arrow, a default blue fill color and too
distant shadow, which clearly not how comments supposed to look.
Moreover, the comment will turn to transparent after hiding or
copying the cell, and will revert to the default look anyway
with resaving. Given that we were already enforcing the default
formatting for hidden comments and for foreign formats, I think
it's reasonable to do that for visible comments too (and in
general it's unclear to me why the ODF import treats visible
comments differently than hidden ones).

The main motivation of this change is to aid solving the shadow
issue - see the next commits.

Regarding the comment height change in the testCommentSize test:
This does *not* mean there is a change in that comment's import.
What this test does is to replace the existing comment with
a new comment, and that use the default formatting instead of
inheriting the formatting of the old one. But while the current
default formatting is whatever defined in the Note style, the old
default formatting was actually the draw pool defaults. This is
because we used to apply the comment formatting as DF, and the
relevant svx code (in SdrTextObj::NbcSetText) wasn't aware of the
fact that part of the DF was considered as default in this case.
Which means that this test was actually asserting a buggy behavior.

Change-Id: I37723cce3c719ecaa9c57bef25bcb168e353c55c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150489
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index 7da83a9ebea0..6b458ad41763 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -193,6 +193,8 @@ public:
 The underlying ScPostIt::ScNoteData::ScCaptionPtr takes managing
 ownership of the pointer.
 
+@param bHasStyle  Is there a drawing style set for the note.
+
 @return  Pointer to the new cell note object if insertion was
 successful (i.e. the passed cell position was valid), null
 otherwise. The Calc document is the owner of the note object. The
@@ -201,7 +203,7 @@ public:
  */
 static ScPostIt*CreateNoteFromCaption(
 ScDocument& rDoc, const ScAddress& rPos,
-SdrCaptionObj* pCaption );
+SdrCaptionObj* pCaption, bool bHasStyle );
 
 /** Creates a cell note based on the passed caption object data.
 
diff --git a/sc/qa/unit/subsequent_filters_test4.cxx 
b/sc/qa/unit/subsequent_filters_test4.cxx
index 06af93de19d9..c439a02c6582 100644
--- a/sc/qa/unit/subsequent_filters_test4.cxx
+++ b/sc/qa/unit/subsequent_filters_test4.cxx
@@ -45,6 +45,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -1580,6 +1582,10 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testCommentSize)
 SdrCaptionObj* pCaption = pNote->GetCaption();
 CPPUNIT_ASSERT(pCaption);
 
+// The values below depend on particular font and char size.
+// At least assert that the corresponding style was set:
+CPPUNIT_ASSERT_EQUAL(ScResId(STR_STYLENAME_NOTE), 
pCaption->GetStyleSheet()->GetName());
+
 const tools::Rectangle& rOldRect = pCaption->GetLogicRect();
 CPPUNIT_ASSERT_EQUAL(tools::Long(2899), rOldRect.getOpenWidth());
 CPPUNIT_ASSERT_EQUAL(tools::Long(939), rOldRect.getOpenHeight());
@@ -1588,7 +1594,7 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testCommentSize)
 
 const tools::Rectangle& rNewRect = 

[Libreoffice-commits] core.git: sc/inc sc/qa

2023-04-12 Thread Andreas Heinisch (via logerrit)
 sc/inc/global.hxx|3 ++-
 sc/qa/extras/macros-test.cxx |   37 +
 2 files changed, 39 insertions(+), 1 deletion(-)

New commits:
commit e8de03a18ed8684ed94d93b09aa1662ba799e877
Author: Andreas Heinisch 
AuthorDate: Mon Apr 10 19:44:38 2023 +0200
Commit: Andreas Heinisch 
CommitDate: Wed Apr 12 11:36:39 2023 +0200

tdf#116127 - Add EDITATTR to ALL flags to check for valid function inputs

Otherwise, the function clearcontents does not accept the EDITATTR flag as 
a valid input.

Change-Id: I8381014da7110d060167a814d9ea02e347d5a92b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150191
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 1e42e6060d0e..fb5af9e3e451 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -165,7 +165,8 @@ enum class InsertDeleteFlags : sal_uInt16
 FORGETCAPTIONS   = 0x2000,   /// Internal use only (d undo): do not 
delete caption objects of cell notes.
 ATTRIB   = HARDATTR | STYLES,
 CONTENTS = VALUE | DATETIME | STRING | NOTE | FORMULA | OUTLINE | 
SPARKLINES,
-ALL  = CONTENTS | ATTRIB | OBJECTS | SPARKLINES,
+// tdf#116127 - add EDITATTR to ALL flags in order to check for valid 
function inputs
+ALL  = CONTENTS | ATTRIB | OBJECTS | SPARKLINES | EDITATTR,
 /// Copy flags for auto/series fill functions: do not touch notes and 
drawing objects.
 AUTOFILL = ALL & ~(NOTE | OBJECTS)
 };
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index ec41a2fbe4a9..caa788e7a1f6 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -911,6 +911,43 @@ CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf147122)
 CPPUNIT_ASSERT_EQUAL(Any(OUString("This is a test")), aRet);
 }
 
+CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf116127)
+{
+mxComponent = loadFromDesktop("private:factory/scalc");
+
+css::uno::Reference xDocScr(mxComponent, 
UNO_QUERY_THROW);
+auto xLibs = xDocScr->getBasicLibraries();
+auto xLibrary = xLibs->createLibrary("TestLibrary");
+xLibrary->insertByName(
+"TestModule",
+uno::Any(OUString(
+"Function TestClearContents\n"
+// Insert test string into cell A1
+"  oActiveSheet = ThisComponent.CurrentController.ActiveSheet\n"
+"  oActiveCell = oActiveSheet.getCellRangeByName(\"A1\")\n"
+"  oActiveCell.setString(\"Italic Test\")\n"
+// Create a text cursor and and change the first letter to italic
+"  oCursor = oActiveCell.Text.createTextCursor()\n"
+"  oCursor.gotoStart(False)\n"
+"  oCursor.goRight(1, True)\n"
+"  oCursor.CharPosture = com.sun.star.awt.FontSlant.ITALIC\n"
+// Clear contents using EDITATTR cell flag to clear the italic 
char posture
+"  
oActiveCell.clearContents(com.sun.star.sheet.CellFlags.EDITATTR)\n"
+// Check the char posture of the first letter
+"  oCursor.gotoStart(False)\n"
+"  oCursor.goRight(1, True)\n"
+"  TestClearContents = oCursor.CharPosture <> 
com.sun.star.awt.FontSlant.ITALIC\n"
+"End Function\n")));
+
+Any aRet = 
executeMacro("vnd.sun.Star.script:TestLibrary.TestModule.TestClearContents?"
+"language=Basic=document");
+// Without the fix in place, this test would have failed with
+// - Expected : true
+// - Actual   : false
+// i.e. the formatting within parts of the cell contents (EDITATTR) were 
not deleted
+CPPUNIT_ASSERT_EQUAL(Any(true), aRet);
+}
+
 ScMacrosTest::ScMacrosTest()
   : UnoApiXmlTest("/sc/qa/extras/testdocuments")
 {


[Libreoffice-commits] core.git: sc/inc sc/qa sc/source svx/source

2023-04-07 Thread Maxim Monastirsky (via logerrit)
 sc/inc/postit.hxx   |4 +-
 sc/qa/unit/subsequent_export_test4.cxx  |   44 
 sc/source/core/data/postit.cxx  |   23 +++-
 sc/source/filter/excel/xiescher.cxx |2 -
 sc/source/filter/xml/xmlcelli.cxx   |   14 ++-
 svx/source/sdr/properties/captionproperties.cxx |5 ++
 6 files changed, 86 insertions(+), 6 deletions(-)

New commits:
commit 1e442e2c6800cf38e42749ac6644502cb3717bc3
Author: Maxim Monastirsky 
AuthorDate: Fri Mar 31 16:38:32 2023 +0300
Commit: Maxim Monastirsky 
CommitDate: Fri Apr 7 15:59:04 2023 +0200

sc drawstyles: Keep style assignment for comments

Need to handle 3 cases:

- Import of hidden comments (not too much useful by itself,
as we still force the default comment formatting as DF).

- Copying cells with comments.

- The comment popup that is shown when hovering over a
comment marker.

Change-Id: Ibf2e22f1432745fe46f89da624ed3586b5d9fb55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149943
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index 36473542e1df..7da83a9ebea0 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -216,6 +216,8 @@ public:
 formatting attributes of the caption object. This function takes
 ownership of the passed item set.
 
+@param rStyleName  Drawing style associated with the caption object.
+
 @param rOutlinerObj  An outliner object containing (formatted) text
 for the caption object.
 
@@ -229,7 +231,7 @@ public:
  */
 static ScPostIt*CreateNoteFromObjectData(
 ScDocument& rDoc, const ScAddress& rPos,
-SfxItemSet&& oItemSet,
+SfxItemSet&& oItemSet, const OUString& rStyleName,
 const OutlinerParaObject& rOutlinerObj,
 const tools::Rectangle& rCaptionRect, bool bShown 
);
 
diff --git a/sc/qa/unit/subsequent_export_test4.cxx 
b/sc/qa/unit/subsequent_export_test4.cxx
index 275493f61387..9d6e38ef8a09 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -32,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1540,6 +1542,48 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testShapeStyles)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest4, testCommentStyles)
+{
+createScDoc("ods/comment.ods");
+
+{
+ScDocument* pDoc = getScDoc();
+
+ScAddress aPos(0, 0, 0);
+ScPostIt* pNote = pDoc->GetNote(aPos);
+CPPUNIT_ASSERT(pNote);
+
+pNote->ShowCaption(aPos, true);
+auto pCaption = pNote->GetCaption();
+CPPUNIT_ASSERT(pCaption);
+
+auto pStyleSheet = >GetStyleSheetPool()->Make("MyStyle1", 
SfxStyleFamily::Frame);
+pCaption->SetStyleSheet(static_cast(pStyleSheet), 
true);
+
+// Hidden comments use different code path on import
+pNote->ShowCaption(aPos, false);
+}
+
+saveAndReload("calc8");
+
+{
+ScDocument aDoc;
+aDoc.InitDrawLayer();
+aDoc.TransferTab(*getScDoc(), 0, 0);
+
+ScAddress aPos(0, 0, 0);
+ScPostIt* pNote = aDoc.GetNote(aPos);
+CPPUNIT_ASSERT(pNote);
+
+pNote->ShowCaption(aPos, true);
+auto pCaption = pNote->GetCaption();
+CPPUNIT_ASSERT(pCaption);
+
+// Check that the style was imported, and survived copying
+CPPUNIT_ASSERT_EQUAL(OUString("MyStyle1"), 
pCaption->GetStyleSheet()->GetName());
+}
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 00aab1d52030..6da509043c12 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -47,6 +47,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -89,9 +90,9 @@ void ScCaptionUtil::SetCaptionLayer( SdrCaptionObj& rCaption, 
bool bShown )
 
 void ScCaptionUtil::SetBasicCaptionSettings( SdrCaptionObj& rCaption, bool 
bShown )
 {
-SetCaptionLayer( rCaption, bShown );
 rCaption.SetFixedTail();
 rCaption.SetSpecialTextBoxShadow();
+SetCaptionLayer( rCaption, bShown );
 }
 
 void ScCaptionUtil::SetCaptionUserData( SdrCaptionObj& rCaption, const 
ScAddress& rPos )
@@ -458,6 +459,7 @@ struct ScCaptionInitData
 {
 std::optional< SfxItemSet > moItemSet;  /// Caption object formatting.
 std::optional< OutlinerParaObject > mxOutlinerObj; /// Text object with 
all text portion formatting.
+OUStringmaStyleName;/// Drawing style associated with 
the caption object.
 OUStringmaSimpleText;   /// 

[Libreoffice-commits] core.git: sc/inc sc/source sc/uiconfig

2023-04-04 Thread Heiko Tietze (via logerrit)
 sc/inc/viewopti.hxx|4 -
 sc/source/core/tool/viewopti.cxx   |4 +
 sc/source/ui/inc/tpview.hxx|2 
 sc/source/ui/optdlg/tpview.cxx |   34 
 sc/source/ui/view/viewdata.cxx |   17 
 sc/uiconfig/scalc/ui/tpviewpage.ui |   75 +
 6 files changed, 15 insertions(+), 121 deletions(-)

New commits:
commit 2039fd382af9d110bd68be8629ab757b3617926a
Author: Heiko Tietze 
AuthorDate: Wed Mar 29 15:12:58 2023 +0200
Commit: Heiko Tietze 
CommitDate: Tue Apr 4 10:53:56 2023 +0200

Resolves tdf#154446 - Remove redundant option for grid line color

Change-Id: I41d39b763e651f90660f2a451ed0a9b473ead206
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149715
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 

diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx
index cd641198753b..b90e1b65f076 100644
--- a/sc/inc/viewopti.hxx
+++ b/sc/inc/viewopti.hxx
@@ -59,10 +59,6 @@ enum ScVObjType
 #define MAX_OPT sal_uInt16(VOPT_CLIPMARKS)+1
 #define MAX_TYPEsal_uInt16(VOBJ_TYPE_DRAW)+1
 
-// SC_STD_GRIDCOLOR is obsolete since tdf#152184 since GridColor == COL_AUTO
-// converts now to either light or dark but still used on options > view > 
visual aids
-#define SC_STD_GRIDCOLORCOL_LIGHTGRAY
-
 // SvxGrid options with standard operators
 
 class ScGridOptions : public SvxOptionsGrid
diff --git a/sc/source/core/tool/viewopti.cxx b/sc/source/core/tool/viewopti.cxx
index 6079323f13e7..f243289653cd 100644
--- a/sc/source/core/tool/viewopti.cxx
+++ b/sc/source/core/tool/viewopti.cxx
@@ -22,6 +22,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -111,7 +113,7 @@ void ScViewOptions::SetDefaults()
 aModeArr[VOBJ_TYPE_CHART] = VOBJ_MODE_SHOW;
 aModeArr[VOBJ_TYPE_DRAW ] = VOBJ_MODE_SHOW;
 
-aGridCol = SC_STD_GRIDCOLOR;
+aGridCol = svtools::ColorConfig().GetColorValue( svtools::CALCGRID 
).nColor;
 
 aGridOpt.SetDefaults();
 }
diff --git a/sc/source/ui/inc/tpview.hxx b/sc/source/ui/inc/tpview.hxx
index 7be90de5aceb..ad485b361580 100644
--- a/sc/source/ui/inc/tpview.hxx
+++ b/sc/source/ui/inc/tpview.hxx
@@ -29,8 +29,6 @@ class ScTpContentOptions : public SfxTabPage
 std::unique_ptr m_xLocalOptions;
 
 std::unique_ptr m_xGridLB;
-std::unique_ptr m_xColorFT;
-std::unique_ptr m_xColorLB;
 std::unique_ptr m_xBreakCB;
 std::unique_ptr m_xGuideLineCB;
 
diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx
index 926436864e79..f83ce9f033a5 100644
--- a/sc/source/ui/optdlg/tpview.cxx
+++ b/sc/source/ui/optdlg/tpview.cxx
@@ -30,15 +30,11 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 ScTpContentOptions::ScTpContentOptions(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet&  rArgSet)
 : SfxTabPage(pPage, pController, "modules/scalc/ui/tpviewpage.ui", 
"TpViewPage", )
 , m_xGridLB(m_xBuilder->weld_combo_box("grid"))
-, m_xColorFT(m_xBuilder->weld_label("color_label"))
-, m_xColorLB(new ColorListBox(m_xBuilder->weld_menu_button("color"),
-[this]{ return GetDialogController()->getDialog(); }))
 , m_xBreakCB(m_xBuilder->weld_check_button("break"))
 , m_xGuideLineCB(m_xBuilder->weld_check_button("guideline"))
 , m_xFormulaCB(m_xBuilder->weld_check_button("formula"))
@@ -88,14 +84,10 @@ ScTpContentOptions::ScTpContentOptions(weld::Container* 
pPage, weld::DialogContr
 m_xRowColHeaderCB->connect_toggled(aCBHdl);
 m_xSummaryCB->connect_toggled(aCBHdl);
 m_xThemedCursorRB->connect_toggled(aCBHdl);
-
-m_xColorLB->SetSlotId(SID_ATTR_CHAR_COLOR);
-m_xColorLB->SetAutoDisplayColor(SC_STD_GRIDCOLOR);
 }
 
 ScTpContentOptions::~ScTpContentOptions()
 {
-m_xColorLB.reset();
 }
 
 std::unique_ptr ScTpContentOptions::Create( weld::Container* 
pPage, weld::DialogController* pController,
@@ -123,19 +115,11 @@ boolScTpContentOptions::FillItemSet( SfxItemSet* 
rCoreSet )
 m_xVScrollCB->get_state_changed_from_saved() ||
 m_xTblRegCB->get_state_changed_from_saved() ||
 m_xOutlineCB->get_state_changed_from_saved() ||
-m_xColorLB->IsValueChangedFromSaved() ||
 m_xBreakCB->get_state_changed_from_saved() ||
 m_xSummaryCB->get_state_changed_from_saved() ||
 m_xThemedCursorRB->get_state_changed_from_saved() ||
 m_xGuideLineCB->get_state_changed_from_saved())
 {
-NamedColor aNamedColor = m_xColorLB->GetSelectedEntry();
-if (aNamedColor.first == COL_AUTO)
-{
-aNamedColor.first = SC_STD_GRIDCOLOR;
-aNamedColor.second.clear();
-}
-m_xLocalOptions->SetGridColor(aNamedColor.first, aNamedColor.second);
 rCoreSet->Put(ScTpViewItem(*m_xLocalOptions));
 bRet = true;
 }
@@ -211,7 +195,6 @@ voidScTpContentOptions::Reset( const SfxItemSet* 
rCoreSet )
 

[Libreoffice-commits] core.git: sc/inc sc/source

2023-03-30 Thread Maxim Monastirsky (via logerrit)
 sc/inc/bitmaps.hlst|1 +
 sc/inc/scstyles.hrc|9 +
 sc/source/ui/app/scmod.cxx |5 +
 3 files changed, 15 insertions(+)

New commits:
commit 1b463f697405e64a03378fb38a32172c4d3c25e6
Author: Maxim Monastirsky 
AuthorDate: Fri Mar 17 14:56:04 2023 +0200
Commit: Maxim Monastirsky 
CommitDate: Thu Mar 30 22:43:36 2023 +

sc drawstyles: Enable the UI

I believe it's in a usable state now. But keep in
mind that the work isn't finished yet. For example,
there is only one base default style, and the work to
support styles for comments wasn't merged yet.

Change-Id: I1ad3a4803ad91773906743e19a35405d5cd3255d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149754
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/sc/inc/bitmaps.hlst b/sc/inc/bitmaps.hlst
index 1b24f4b28851..422ed5ddeb63 100644
--- a/sc/inc/bitmaps.hlst
+++ b/sc/inc/bitmaps.hlst
@@ -61,6 +61,7 @@ inline constexpr OUStringLiteral RID_BMP_INPUT_OK = 
u"sc/res/sc26051.png";
 
 inline constexpr OUStringLiteral BMP_STYLES_FAMILY_CELL = u"sc/res/sf01.png";
 inline constexpr OUStringLiteral BMP_STYLES_FAMILY_PAGE = u"sc/res/sf02.png";
+inline constexpr OUStringLiteral BMP_STYLES_FAMILY_GRAPHICS = 
u"sd/res/sf01.png";
 
 inline constexpr OUStringLiteral BMP_ICON_SET_CIRCLES1_GRAY = 
u"sc/res/icon-set-circles1-gray.png";
 inline constexpr OUStringLiteral BMP_ICON_SET_CIRCLES1_GREEN = 
u"sc/res/icon-set-circles1-green.png";
diff --git a/sc/inc/scstyles.hrc b/sc/inc/scstyles.hrc
index 4e4c449d69c9..224f2cd475ac 100644
--- a/sc/inc/scstyles.hrc
+++ b/sc/inc/scstyles.hrc
@@ -41,4 +41,13 @@ const std::pair 
RID_PAGESTYLEFAMILY[] =
 { {}, SfxStyleSearchBits::Auto }
 };
 
+const std::pair RID_GRAPHICSTYLEFAMILY[] =
+{
+{ NC_("RID_GRAPHICSTYLEFAMILY", "All Styles") , 
SfxStyleSearchBits::AllVisible },
+{ NC_("RID_GRAPHICSTYLEFAMILY", "Hidden Styles") , 
SfxStyleSearchBits::Hidden },
+{ NC_("RID_GRAPHICSTYLEFAMILY", "Applied Styles") , 
SfxStyleSearchBits::Used },
+{ NC_("RID_GRAPHICSTYLEFAMILY", "Custom Styles") , 
SfxStyleSearchBits::UserDefined },
+{ {}, SfxStyleSearchBits::Auto }
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 18aa0845088c..2f84555fd3ca 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -2308,6 +2308,11 @@ std::optional 
ScModule::CreateStyleFamilies()
 BMP_STYLES_FAMILY_PAGE,
 RID_PAGESTYLEFAMILY, 
SC_MOD()->GetResLocale()));
 
+aStyleFamilies.emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Frame,
+
ScResId(STR_STYLE_FAMILY_GRAPHICS),
+BMP_STYLES_FAMILY_GRAPHICS,
+RID_GRAPHICSTYLEFAMILY, 
SC_MOD()->GetResLocale()));
+
 return aStyleFamilies;
 }
 


[Libreoffice-commits] core.git: sc/inc

2023-03-26 Thread Rafael Lima (via logerrit)
 sc/inc/scfuncs.hrc |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 998882138adf693b04a2061714fcc33646619912
Author: Rafael Lima 
AuthorDate: Mon Mar 27 00:07:29 2023 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Mar 27 04:25:17 2023 +

tdf#151309 Fix the use of t-test in the UI

As discussed in the ticket, we should use "t-test" instead of "T test".

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

diff --git a/sc/inc/scfuncs.hrc b/sc/inc/scfuncs.hrc
index 0e9d2b04ea12..cfb55d2be8bb 100644
--- a/sc/inc/scfuncs.hrc
+++ b/sc/inc/scfuncs.hrc
@@ -3002,7 +3002,7 @@ const TranslateId SC_OPCODE_F_TEST_MS_ARY[] =
 // -=*# Resource for function TTEST #*=-
 const TranslateId SC_OPCODE_T_TEST_ARY[] =
 {
-NC_("SC_OPCODE_T_TEST", "Calculates the T test."),
+NC_("SC_OPCODE_T_TEST", "Calculates the t-test."),
 NC_("SC_OPCODE_T_TEST", "Data 1"),
 NC_("SC_OPCODE_T_TEST", "The first record array."),
 NC_("SC_OPCODE_T_TEST", "Data 2"),
@@ -3010,13 +3010,13 @@ const TranslateId SC_OPCODE_T_TEST_ARY[] =
 NC_("SC_OPCODE_T_TEST", "Mode"),
 NC_("SC_OPCODE_T_TEST", "Mode specifies the number of distribution tails 
to return. 1 = one-tailed, 2 = two-tailed distribution"),
 NC_("SC_OPCODE_T_TEST", "Type"),
-NC_("SC_OPCODE_T_TEST", "The type of the T test.")
+NC_("SC_OPCODE_T_TEST", "The type of the t-test.")
 };
 
 // -=*# Resource for function T.TEST #*=-
 const TranslateId SC_OPCODE_T_TEST_MS_ARY[] =
 {
-NC_("SC_OPCODE_T_TEST_MS", "Calculates the T test."),
+NC_("SC_OPCODE_T_TEST_MS", "Calculates the t-test."),
 NC_("SC_OPCODE_T_TEST_MS", "Data 1"),
 NC_("SC_OPCODE_T_TEST_MS", "The first record array."),
 NC_("SC_OPCODE_T_TEST_MS", "Data 2"),
@@ -3024,7 +3024,7 @@ const TranslateId SC_OPCODE_T_TEST_MS_ARY[] =
 NC_("SC_OPCODE_T_TEST_MS", "Mode"),
 NC_("SC_OPCODE_T_TEST_MS", "Mode specifies the number of distribution 
tails to return. 1 = one-tailed, 2 = two-tailed distribution"),
 NC_("SC_OPCODE_T_TEST_MS", "Type"),
-NC_("SC_OPCODE_T_TEST_MS", "The type of the T test.")
+NC_("SC_OPCODE_T_TEST_MS", "The type of the t-test.")
 };
 
 // -=*# Resource for function RSQ #*=-


[Libreoffice-commits] core.git: sc/inc sc/source

2023-03-26 Thread Balazs Varga (via logerrit)
 sc/inc/document.hxx  |3 +-
 sc/inc/table.hxx |2 +
 sc/source/core/data/document.cxx |   12 +--
 sc/source/core/data/drwlayer.cxx |7 +-
 sc/source/core/data/table5.cxx   |   42 +++
 5 files changed, 58 insertions(+), 8 deletions(-)

New commits:
commit 69cc8bdd5f9109804d912b52d5ee1040d6e1868f
Author: Balazs Varga 
AuthorDate: Sat Mar 25 18:57:08 2023 +0100
Commit: Balazs Varga 
CommitDate: Sun Mar 26 16:37:32 2023 +

Related: tdf#154005 sc ods fileopen: fix dropdown form control size

Fixing the crashtesting assert/crash after the original change.
Also a little clean-up.

Change-Id: I35453fbc55b3d5d4064179e84755334c2d3a01ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149583
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Reviewed-by: Balazs Varga 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index f044eaf77f78..285fcf1a7d31 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2036,7 +2036,8 @@ public:
 SC_DLLPUBLIC SCROW  FirstVisibleRow(SCROW nStartRow, SCROW 
nEndRow, SCTAB nTab) const;
 SC_DLLPUBLIC SCROW  LastVisibleRow(SCROW nStartRow, SCROW nEndRow, 
SCTAB nTab) const;
 SCROW   CountVisibleRows(SCROW nStartRow, SCROW 
nEndRow, SCTAB nTab) const;
-SCCOL   CountVisibleCols(SCROW nStartCol, SCROW 
nEndCol, SCTAB nTab) const;
+SCROW   CountHiddenRows(SCROW nStartRow, SCROW 
nEndRow, SCTAB nTab) const;
+SCCOL   CountHiddenCols(SCROW nStartCol, SCROW 
nEndCol, SCTAB nTab) const;
 
 SC_DLLPUBLIC bool   RowFiltered(SCROW nRow, SCTAB nTab, SCROW* 
pFirstRow = nullptr, SCROW* pLastRow = nullptr) const;
 boolHasFilteredRows(SCROW nStartRow, SCROW 
nEndRow, SCTAB nTab) const;
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 5eefb5f95c38..cbce92da3998 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -971,9 +971,11 @@ public:
 SCROW   FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
 SCROW   LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
 SCROW   CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const;
+SCROW   CountHiddenRows(SCROW nStartRow, SCROW nEndRow) const;
 tools::Long GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow, bool 
bHiddenAsZero = true) const;
 
 SCCOL   CountVisibleCols(SCCOL nStartCol, SCCOL nEndCol) const;
+SCCOL   CountHiddenCols(SCCOL nStartCol, SCCOL nEndCol) const;
 
 SCCOLROWLastHiddenColRow(SCCOLROW nPos, bool bCol) const;
 
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index b295e68f69e0..afec7f072b3c 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -4561,12 +4561,20 @@ SCROW ScDocument::CountVisibleRows(SCROW nStartRow, 
SCROW nEndRow, SCTAB nTab) c
 return maTabs[nTab]->CountVisibleRows(nStartRow, nEndRow);
 }
 
-SCCOL ScDocument::CountVisibleCols(SCROW nStartCol, SCROW nEndCol, SCTAB nTab) 
const
+SCROW ScDocument::CountHiddenRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) 
const
 {
 if (!ValidTab(nTab) || nTab >= static_cast(maTabs.size()) || 
!maTabs[nTab])
 return 0;
 
-return maTabs[nTab]->CountVisibleCols(nStartCol, nEndCol);
+return maTabs[nTab]->CountHiddenRows(nStartRow, nEndRow);
+}
+
+SCCOL ScDocument::CountHiddenCols(SCROW nStartCol, SCROW nEndCol, SCTAB nTab) 
const
+{
+if (!ValidTab(nTab) || nTab >= static_cast(maTabs.size()) || 
!maTabs[nTab])
+return 0;
+
+return maTabs[nTab]->CountHiddenCols(nStartCol, nEndCol);
 }
 
 bool ScDocument::RowFiltered(SCROW nRow, SCTAB nTab, SCROW* pFirstRow, SCROW* 
pLastRow) const
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 653571cabd38..359bf3b1e7be 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -713,11 +713,8 @@ void lcl_SetLogicRectFromAnchor(SdrObject* pObj, const 
ScDrawObjData& rAnchor, c
 // tdf#154005: Handle hidden row/col: remove hidden row/cols size from the 
ScDrawObjData shape size in case of forms
 if (pObj->GetObjIdentifier() == SdrObjKind::UNO && pObj->GetObjInventor() 
== SdrInventor::FmForm)
 {
-nHiddenRows = ((rAnchor.maEnd.Row() - rAnchor.maStart.Row()) + 1) -
-(pDoc->CountVisibleRows(rAnchor.maStart.Row(), 
rAnchor.maEnd.Row(), rAnchor.maStart.Tab()));
-
-nHiddenCols = ((rAnchor.maEnd.Col() - rAnchor.maStart.Col()) + 1) -
-(pDoc->CountVisibleCols(rAnchor.maStart.Col(), 
rAnchor.maEnd.Col(), rAnchor.maStart.Tab()));
+nHiddenRows = pDoc->CountHiddenRows(rAnchor.maStart.Row(), 
rAnchor.maEnd.Row(), rAnchor.maStart.Tab());
+nHiddenCols = pDoc->CountHiddenCols(rAnchor.maStart.Col(), 
rAnchor.maEnd.Col(), rAnchor.maStart.Tab());
 }
 
 // In 

[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-03-22 Thread Xisco Fauli (via logerrit)
 sc/inc/chgtrack.hxx|1 +
 sc/inc/strings.hrc |1 +
 sc/qa/uitest/calc_tests4/trackedChanges.py |   28 ++--
 sc/source/core/tool/chgtrack.cxx   |   24 +++-
 4 files changed, 35 insertions(+), 19 deletions(-)

New commits:
commit 7131530929d3670b8c2db7dc0c1a86c822e05660
Author: Xisco Fauli 
AuthorDate: Tue Mar 21 11:04:32 2023 +0100
Commit: Xisco Fauli 
CommitDate: Wed Mar 22 07:26:40 2023 +

tdf#154274: show "Unknown Author" when no name is set

Same as in Writer

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

diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index 24e4f653b165..9e3aed17aa55 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -966,6 +966,7 @@ public:
 bool IsInDeleteTop() const { return bInDeleteTop; }
 bool IsInDeleteUndo() const { return bInDeleteUndo; }
 bool IsInPasteCut() const { return bInPasteCut; }
+void CreateAuthorName();
 SC_DLLPUBLIC void SetUser( const OUString& rUser );
 const OUString& GetUser() const { return maUser;}
 const std::set& GetUserCollection() const { return 
maUserCollection;}
diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc
index 24a40a41ef57..f7d33399faa2 100644
--- a/sc/inc/strings.hrc
+++ b/sc/inc/strings.hrc
@@ -202,6 +202,7 @@
 #define STR_CHG_REJECTEDNC_("STR_CHG_REJECTED", 
"Rejected")
 #define STR_CHG_NO_ENTRYNC_("STR_CHG_NO_ENTRY", 
"No Entry")
 #define STR_CHG_EMPTY   NC_("STR_CHG_EMPTY", 
"")
+#define STR_CHG_UNKNOWN_AUTHOR  
NC_("STR_CHG_UNKNOWN_AUTHOR", "Unknown Author")
 
 #define STR_NOT_PROTECTED   NC_("STR_NOT_PROTECTED", 
"Not protected")
 #define STR_NOT_PASS_PROTECTED  
NC_("STR_NOT_PASS_PROTECTED", "Not password-protected")
diff --git a/sc/qa/uitest/calc_tests4/trackedChanges.py 
b/sc/qa/uitest/calc_tests4/trackedChanges.py
index 53306de0c88b..0f38f9f3042c 100644
--- a/sc/qa/uitest/calc_tests4/trackedChanges.py
+++ b/sc/qa/uitest/calc_tests4/trackedChanges.py
@@ -70,7 +70,7 @@ class CalcTrackedChanges(UITestCase):
 xChangesList = xTrackDlg.getChild("calcchanges")
 self.assertEqual(1, len(xChangesList.getChildren()))
 
-textStart = "Changed contents\tSheet1.A1\t \t" + 
datetime.datetime.now().strftime("%m/%d/%Y")
+textStart = "Changed contents\tSheet1.A1\tUnknown Author\t" + 
datetime.datetime.now().strftime("%m/%d/%Y")
 
 xChild = xChangesList.getChild('0')
 
self.assertTrue(get_state_as_dict(xChild)["Text"].startswith(textStart))
@@ -78,11 +78,11 @@ class CalcTrackedChanges(UITestCase):
 xChild.executeAction("EXPAND", tuple())
 
 self.assertEqual(3, len(xChild.getChildren()))
-textStartChild1 = "\tSheet1.A1\t \t" + 
datetime.datetime.now().strftime("%m/%d/%Y")
+textStartChild1 = "\tSheet1.A1\tUnknown Author\t" + 
datetime.datetime.now().strftime("%m/%d/%Y")
 textEndChild1 = "(Original: )"
-textStartChild2 = "'Hello'\tSheet1.A1\t \t" + 
datetime.datetime.now().strftime("%m/%d/%Y")
+textStartChild2 = "'Hello'\tSheet1.A1\tUnknown Author\t" + 
datetime.datetime.now().strftime("%m/%d/%Y")
 textEndChild2 = "(Changed to 'Hello')"
-textStartChild3 = "'There'\tSheet1.A1\t \t" + 
datetime.datetime.now().strftime("%m/%d/%Y")
+textStartChild3 = "'There'\tSheet1.A1\tUnknown Author\t" + 
datetime.datetime.now().strftime("%m/%d/%Y")
 textEndChild3 = "(Changed to 'There')"
 
 
self.assertTrue(get_state_as_dict(xChild.getChild('0'))["Text"].startswith(textStartChild1))
@@ -113,7 +113,7 @@ class CalcTrackedChanges(UITestCase):
 xChangesList = xTrackDlg.getChild("calcchanges")
 self.assertEqual(1, len(xChangesList.getChildren()))
 
-textStart = "Row deleted\t(Sheet1.1:1)\t \t" + 
datetime.datetime.now().strftime("%m/%d/%Y")
+textStart = "Row deleted\t(Sheet1.1:1)\tUnknown Author\t" + 
datetime.datetime.now().strftime("%m/%d/%Y")
 textEnd = "(Row 1:1 deleted)"
 
 xChild = xChangesList.getChild('0')
@@ -125,7 +125,7 @@ class CalcTrackedChanges(UITestCase):
 xChild.executeAction("EXPAND", tuple())
 
 self.assertEqual(1, len(xChild.getChildren()))
-textStartChild1 = "Changed contents\t(Sheet1.A1)\t \t" + 
datetime.datetime.now().strftime("%m/%d/%Y")
+textStartChild1 = "Changed contents\t(Sheet1.A1)\tUnknown 
Author\t" + datetime.datetime.now().strftime("%m/%d/%Y")
  

[Libreoffice-commits] core.git: sc/inc sc/source

2023-03-19 Thread Maxim Monastirsky (via logerrit)
 sc/inc/document.hxx  |1 -
 sc/source/core/data/docpool.cxx  |1 +
 sc/source/core/data/documen2.cxx |2 +-
 sc/source/core/data/documen9.cxx |   18 --
 4 files changed, 2 insertions(+), 20 deletions(-)

New commits:
commit ba58d80a1a9c30e58b20184135e81cc1851bdd75
Author: Maxim Monastirsky 
AuthorDate: Sun Mar 19 00:16:00 2023 +0200
Commit: Maxim Monastirsky 
CommitDate: Sun Mar 19 17:40:26 2023 +

sc drawstyles: Delay the destruction of SdrItemPool

Nowadays SfxItemPool_Impl::mpSecondary is ref counted, so
there is no fear in destroying the draw layer before the doc
pool.

This kind of change is needed for drawing styles, as their
item set references the SdrItemPool with a raw pointer, but
they are destroyed as part of the styles pool, much later
than the draw layer.

Change-Id: I169bbacfbdbec2121217b13293b6f495898fe2e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149090
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 137b786e8c8b..9c6e376acca5 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2673,7 +2673,6 @@ private:
 voidImplCreateOptions(); // Suggestion: switch to on-demand?
 voidImplDeleteOptions();
 
-voidDeleteDrawLayer();
 SC_DLLPUBLIC bool   DrawGetPrintArea( ScRange& rRange, bool bSetHor, bool 
bSetVer ) const;
 
 voidUpdateDrawPrinter();
diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index e0a07582e453..47c485e4f139 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -327,6 +327,7 @@ ScDocumentPool::ScDocumentPool()
 ScDocumentPool::~ScDocumentPool()
 {
 Delete();
+SetSecondaryPool(nullptr);
 
 for ( sal_uInt16 i=0; i < ATTR_ENDINDEX-ATTR_STARTINDEX+1; i++ )
 {
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index a7ea162177a9..fa979a953cb8 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -386,7 +386,7 @@ ScDocument::~ScDocument()
 pDBCollection.reset();
 pSelectionAttr.reset();
 apTemporaryChartLock.reset();
-DeleteDrawLayer();
+mpDrawLayer.reset();
 mpPrinter.disposeAndClear();
 ImplDeleteOptions();
 pConsolidateDlgData.reset();
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index b471a9a0f0f6..e6a6501c46e4 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -226,24 +226,6 @@ IMPL_LINK( ScDocument, GetUserDefinedColor, sal_uInt16, 
nColorIndex, Color* )
 return 
const_cast(&(xColorList->GetColor(nColorIndex)->GetColor()));
 }
 
-void ScDocument::DeleteDrawLayer()
-{
-ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
-
-// remove DrawingLayer's SfxItemPool from Calc's SfxItemPool where
-// it is registered as secondary pool
-if (mxPoolHelper.is() && !IsClipOrUndo()) //Using IsClipOrUndo as a proxy 
for SharePooledResources called
-{
-ScDocumentPool* pLocalPool = mxPoolHelper->GetDocPool();
-
-if(pLocalPool && pLocalPool->GetSecondaryPool())
-{
-pLocalPool->SetSecondaryPool(nullptr);
-}
-}
-mpDrawLayer.reset();
-}
-
 bool ScDocument::DrawGetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer 
) const
 {
 return mpDrawLayer->GetPrintArea( rRange, bSetHor, bSetVer );


[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-03-13 Thread Balazs Varga (via logerrit)
 sc/inc/document.hxx   |1 +
 sc/qa/unit/data/ods/tdf154005.ods |binary
 sc/qa/unit/scshapetest.cxx|   30 ++
 sc/source/core/data/document.cxx  |8 
 sc/source/core/data/drwlayer.cxx  |   16 ++--
 5 files changed, 53 insertions(+), 2 deletions(-)

New commits:
commit 97a38dbfa998967c45efaf3303fedfa1a709a2bb
Author: Balazs Varga 
AuthorDate: Sun Mar 12 17:49:53 2023 +0100
Commit: Thorsten Behrens 
CommitDate: Tue Mar 14 02:04:50 2023 +

tdf#154005 sc ods fileopen: fix dropdown form control size

Dropdown form control size was increased by the size of hidden
rows or columns.

Regression from commit: 1f0b3c7a40edfa81bbc7a58d123a6a2dfd83e4ca
(Improve 'resize with cell' handling)

Change-Id: Ic903a488cab22286f95cfdf4ee559013fd7bfa02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148738
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 09fcc126ed06..137b786e8c8b 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2036,6 +2036,7 @@ public:
 SC_DLLPUBLIC SCROW  FirstVisibleRow(SCROW nStartRow, SCROW 
nEndRow, SCTAB nTab) const;
 SC_DLLPUBLIC SCROW  LastVisibleRow(SCROW nStartRow, SCROW nEndRow, 
SCTAB nTab) const;
 SCROW   CountVisibleRows(SCROW nStartRow, SCROW 
nEndRow, SCTAB nTab) const;
+SCCOL   CountVisibleCols(SCROW nStartCol, SCROW 
nEndCol, SCTAB nTab) const;
 
 SC_DLLPUBLIC bool   RowFiltered(SCROW nRow, SCTAB nTab, SCROW* 
pFirstRow = nullptr, SCROW* pLastRow = nullptr) const;
 boolHasFilteredRows(SCROW nStartRow, SCROW 
nEndRow, SCTAB nTab) const;
diff --git a/sc/qa/unit/data/ods/tdf154005.ods 
b/sc/qa/unit/data/ods/tdf154005.ods
new file mode 100644
index ..1349ec725869
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf154005.ods differ
diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
index dc60439a536f..c89189d892a9 100644
--- a/sc/qa/unit/scshapetest.cxx
+++ b/sc/qa/unit/scshapetest.cxx
@@ -57,6 +57,7 @@ public:
 void testTdf137576_LogicRectInNewMeasureline();
 void testMeasurelineHideColSave();
 void testHideColsShow();
+void testFormSizeWithHiddenCol();
 void testTdf138138_MoveCellWithRotatedShape();
 void testLoadVerticalFlip();
 void testTdf117948_CollapseBeforeShape();
@@ -85,6 +86,7 @@ public:
 CPPUNIT_TEST(testTdf137576_LogicRectInNewMeasureline);
 CPPUNIT_TEST(testMeasurelineHideColSave);
 CPPUNIT_TEST(testHideColsShow);
+CPPUNIT_TEST(testFormSizeWithHiddenCol);
 CPPUNIT_TEST(testTdf138138_MoveCellWithRotatedShape);
 CPPUNIT_TEST(testLoadVerticalFlip);
 CPPUNIT_TEST(testTdf117948_CollapseBeforeShape);
@@ -759,6 +761,34 @@ void ScShapeTest::testHideColsShow()
 CPPUNIT_ASSERT_RECTANGLE_EQUAL_WITH_TOLERANCE(aSnapRectOrig, 
aSnapRectShow, 1);
 }
 
+void ScShapeTest::testFormSizeWithHiddenCol()
+{
+// The document contains a form (Listbox) shape anchored "To Cell (resize 
with cell)" with starts in cell B5 and
+// ends in cell D5. The error was the form shape was resized if there was 
hidden col/row.
+
+createScDoc("tdf154005.ods");
+
+// Get document and shape
+ScDocument* pDoc = getScDoc();
+SdrUnoObj* pObj = 
static_cast(lcl_getSdrObjectWithAssert(*pDoc, 0));
+
+// Check Position and Size
+pDoc->SetDrawPageSize(0); // trigger recalcpos
+tools::Rectangle aRect(2432, 3981, 4932, 4631); // expected snap rect from 
values in file
+const tools::Rectangle& rShapeRect(pObj->GetSnapRect());
+CPPUNIT_ASSERT_RECTANGLE_EQUAL_WITH_TOLERANCE(aRect, rShapeRect, 1);
+
+// Check anchor
+ScDrawObjData* pData = ScDrawLayer::GetObjData(pObj);
+CPPUNIT_ASSERT_MESSAGE("expected object meta data", pData);
+
+const OUString sActual("start col " + 
OUString::number(pData->maStart.Col()) + " row "
+   + OUString::number(pData->maStart.Row()) + " end 
col "
+   + OUString::number(pData->maEnd.Col()) + " row "
+   + OUString::number(pData->maEnd.Row()));
+CPPUNIT_ASSERT_EQUAL(OUString("start col 1 row 4 end col 3 row 4"), 
sActual);
+}
+
 void ScShapeTest::testTdf138138_MoveCellWithRotatedShape()
 {
 // The document contains a 90deg rotated, cell-anchored rectangle in 
column D. Insert 2 columns
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index b53de471e776..eac0117f6994 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -4563,6 +4563,14 @@ SCROW ScDocument::CountVisibleRows(SCROW nStartRow, 
SCROW nEndRow, SCTAB nTab) c
 return maTabs[nTab]->CountVisibleRows(nStartRow, nEndRow);
 }
 
+SCCOL ScDocument::CountVisibleCols(SCROW nStartCol, SCROW nEndCol, SCTAB nTab) 
const
+{
+if 

[Libreoffice-commits] core.git: sc/inc

2023-03-08 Thread Heiko Tietze (via logerrit)
 sc/inc/ViewSettingsSequenceDefines.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f1306e1d0f52716cf44a9052654af4133fa2c6eb
Author: Heiko Tietze 
AuthorDate: Wed Mar 8 12:53:15 2023 +0100
Commit: Heiko Tietze 
CommitDate: Wed Mar 8 14:18:20 2023 +

Fix to SC_VIEWSETTINGS_COUNT

Missed in I8f3e368d4fdad362b819b4ce2fd6b0c32b5c1c0f

Change-Id: Ibb744c0c853813e379eca8558fa114d403a4f494
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148468
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 

diff --git a/sc/inc/ViewSettingsSequenceDefines.hxx 
b/sc/inc/ViewSettingsSequenceDefines.hxx
index 501a87cc1854..bf8fbfa0729a 100644
--- a/sc/inc/ViewSettingsSequenceDefines.hxx
+++ b/sc/inc/ViewSettingsSequenceDefines.hxx
@@ -24,7 +24,7 @@
 // this are the defines for the position of the settings in the
 // ViewSettingsSequence
 
-#define SC_VIEWSETTINGS_COUNT   25
+#define SC_VIEWSETTINGS_COUNT   26
 
 #define SC_VIEW_ID  0
 #define SC_TABLE_VIEWSETTINGS   1


[Libreoffice-commits] core.git: sc/inc sc/source sc/uiconfig

2023-03-08 Thread Grigory A. Mozhaev (via logerrit)
 sc/inc/ViewSettingsSequenceDefines.hxx |   31 +++---
 sc/inc/unonames.hxx|1 
 sc/inc/viewopti.hxx|1 
 sc/source/core/tool/viewopti.cxx   |   21 ++---
 sc/source/ui/inc/output.hxx|1 
 sc/source/ui/inc/tpview.hxx|1 
 sc/source/ui/optdlg/tpview.cxx |6 ++
 sc/source/ui/unoobj/confuno.cxx|5 ++
 sc/source/ui/unoobj/viewuno.cxx|4 +
 sc/source/ui/view/gridwin4.cxx |3 +
 sc/source/ui/view/gridwin5.cxx |   25 +++
 sc/source/ui/view/output.cxx   |   72 +
 sc/source/ui/view/viewdata.cxx |4 +
 sc/uiconfig/scalc/ui/tpviewpage.ui |   22 --
 14 files changed, 172 insertions(+), 25 deletions(-)

New commits:
commit 3fcf9f864f9d12fdb0ade4741127c81cec74378a
Author: Grigory A. Mozhaev 
AuthorDate: Mon Feb 27 16:03:39 2023 +0300
Commit: Heiko Tietze 
CommitDate: Wed Mar 8 10:51:42 2023 +

tdf#97551 Added marker and hint for formula to Calc

Added option "Formula indicator and hint" to LibreOffice Calc > View 
section (near to "Comment indicator"). This option turned off by default to 
avoid interfere existing UX.

Indicator displays in the bottom-left corner as blue triangle marker if 
cells contains formula (correctly reacts on cells merging and different sizing).

Hint displays when user hover cursor over the cell that contains the 
formula (uses already built-in mechanics for help tooltip).

More details about request and discussion of the feature in Bugzilla.

Change-Id: I8f3e368d4fdad362b819b4ce2fd6b0c32b5c1c0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147914
Tested-by: Jenkins
Tested-by: Heiko Tietze 
Reviewed-by: Heiko Tietze 

diff --git a/sc/inc/ViewSettingsSequenceDefines.hxx 
b/sc/inc/ViewSettingsSequenceDefines.hxx
index f22c4df5e05b..501a87cc1854 100644
--- a/sc/inc/ViewSettingsSequenceDefines.hxx
+++ b/sc/inc/ViewSettingsSequenceDefines.hxx
@@ -36,21 +36,22 @@
 #define SC_PAGE_BREAK_PREVIEW   7
 #define SC_SHOWZERO 8
 #define SC_SHOWNOTES9
-#define SC_SHOWGRID 10
-#define SC_GRIDCOLOR11
-#define SC_SHOWPAGEBR   12
-#define SC_COLROWHDR13
-#define SC_SHEETTABS14
-#define SC_OUTLSYMB 15
-#define SC_VALUE_HIGHLIGHTING   16
-#define SC_SNAPTORASTER 17
-#define SC_RASTERVIS18
-#define SC_RASTERRESX   19
-#define SC_RASTERRESY   20
-#define SC_RASTERSUBX   21
-#define SC_RASTERSUBY   22
-#define SC_RASTERSYNC   23
-#define SC_FORMULA_BAR_HEIGHT   24
+#define SC_SHOWFORMULASMARKS10
+#define SC_SHOWGRID 11
+#define SC_GRIDCOLOR12
+#define SC_SHOWPAGEBR   13
+#define SC_COLROWHDR14
+#define SC_SHEETTABS15
+#define SC_OUTLSYMB 16
+#define SC_VALUE_HIGHLIGHTING   17
+#define SC_SNAPTORASTER 18
+#define SC_RASTERVIS19
+#define SC_RASTERRESX   20
+#define SC_RASTERRESY   21
+#define SC_RASTERSUBX   22
+#define SC_RASTERSUBY   23
+#define SC_RASTERSYNC   24
+#define SC_FORMULA_BAR_HEIGHT   25
 
 // this are the defines for the position of the settings in the
 // TableViewSettingsSequence
diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index bdd37e666871..abb09c334c10 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -550,6 +550,7 @@ inline constexpr OUStringLiteral SC_UNO_SHOWFORM
 = u"ShowFormulas";
 inline constexpr OUStringLiteral SC_UNO_SHOWGRID = u"ShowGrid";
 inline constexpr OUStringLiteral SC_UNO_SHOWHELP = 
u"ShowHelpLines";
 inline constexpr OUStringLiteral SC_UNO_SHOWNOTES= u"ShowNotes";
+inline constexpr OUStringLiteral SC_UNO_SHOWFORMULASMARKS= 
u"ShowFormulasMarks";
 inline constexpr OUStringLiteral SC_UNO_SHOWOBJ  = u"ShowObjects";
 inline constexpr OUStringLiteral SC_UNO_SHOWPAGEBR   = 
u"ShowPageBreaks";
 inline constexpr OUStringLiteral SC_UNO_SHOWZERO = 
u"ShowZeroValues";
diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx
index 79819e7ca324..b5a15f016e1b 100644
--- a/sc/inc/viewopti.hxx
+++ b/sc/inc/viewopti.hxx
@@ -33,6 +33,7 @@ enum ScViewOption
 VOPT_NULLVALS,
 VOPT_SYNTAX,
 VOPT_NOTES,
+VOPT_FORMULAS_MARKS,
 VOPT_VSCROLL,
 VOPT_HSCROLL,
 VOPT_TABCONTROLS,
diff --git 

[Libreoffice-commits] core.git: sc/inc sc/source

2023-03-03 Thread Kohei Yoshida (via logerrit)
 sc/inc/columnspanset.hxx  |1 +
 sc/source/core/data/columnspanset.cxx |4 
 2 files changed, 5 insertions(+)

New commits:
commit c4187189060a104cf36d8a8c9b2958b8c28cde0b
Author: Kohei Yoshida 
AuthorDate: Thu Mar 2 23:29:15 2023 -0500
Commit: Kohei Yoshida 
CommitDate: Fri Mar 3 16:10:21 2023 +

tdf#148143: Reset the position hint when flat_segment_tree gets copied

std::optional stores the wrapped object as part of its memory footprint,
and when it gets copied, it copy-constructs the wrapped object too.  We
need to be aware of this when using std::optional inside std::vector
which may reallocate its internal buffer and copy the stored elements.

Change-Id: Ib8fab1295388ae2ee9ef3d044943ac3c2bc8e529
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148152
Tested-by: Jenkins
Reviewed-by: Kohei Yoshida 

diff --git a/sc/inc/columnspanset.hxx b/sc/inc/columnspanset.hxx
index d8cfc41f524b..5a3dc7645a43 100644
--- a/sc/inc/columnspanset.hxx
+++ b/sc/inc/columnspanset.hxx
@@ -58,6 +58,7 @@ private:
 ColumnSpansType::const_iterator miPos;
 
 ColumnType(SCROW nStart, SCROW nEnd, bool bInit);
+ColumnType(const ColumnType& rOther);
 };
 
 typedef std::vector> TableType;
diff --git a/sc/source/core/data/columnspanset.cxx 
b/sc/source/core/data/columnspanset.cxx
index eb09ea26be98..bec9c8a7e270 100644
--- a/sc/source/core/data/columnspanset.cxx
+++ b/sc/source/core/data/columnspanset.cxx
@@ -53,6 +53,9 @@ ColRowSpan::ColRowSpan(SCCOLROW nStart, SCCOLROW nEnd) : 
mnStart(nStart), mnEnd(
 ColumnSpanSet::ColumnType::ColumnType(SCROW nStart, SCROW nEnd, bool bInit) :
 maSpans(nStart, nEnd+1, bInit), miPos(maSpans.begin()) {}
 
+ColumnSpanSet::ColumnType::ColumnType(const ColumnType& rOther) :
+maSpans(rOther.maSpans), miPos(maSpans.begin()) {} // NB: copying maSpans 
invalidates miPos - reset it
+
 ColumnSpanSet::Action::~Action() {}
 void ColumnSpanSet::Action::startColumn(SCTAB /*nTab*/, SCCOL /*nCol*/) {}
 
@@ -142,6 +145,7 @@ void ColumnSpanSet::scan(
 
 ColumnNonEmptyRangesScanner aScanner(rCol.maSpans, bVal);
 ParseBlock(rSrcCells.begin(), rSrcCells, aScanner, nRow1, nRow2);
+rCol.miPos = rCol.maSpans.begin();
 }
 }
 


[Libreoffice-commits] core.git: sc/inc sc/Library_sc.mk sc/qa sc/source

2023-03-02 Thread Kohei Yoshida (via logerrit)
 sc/Library_sc.mk   |1 
 sc/inc/broadcast.hxx   |   86 +++
 sc/inc/calcmacros.hxx  |4 
 sc/inc/column.hxx  |3 
 sc/inc/document.hxx|7 -
 sc/inc/grouparealistener.hxx   |3 
 sc/inc/table.hxx   |3 
 sc/qa/unit/ucalc_formula.cxx   |   85 +--
 sc/source/core/data/bcaslot.cxx|   59 -
 sc/source/core/data/broadcast.cxx  |  164 +
 sc/source/core/data/column4.cxx|   31 ++
 sc/source/core/data/document.cxx   |8 -
 sc/source/core/data/document10.cxx |   15 +++
 sc/source/core/data/table7.cxx |6 +
 sc/source/core/inc/bcaslot.hxx |   15 +--
 15 files changed, 400 insertions(+), 90 deletions(-)

New commits:
commit 687b950702c49c90cff9a43655ea97a0343799a0
Author: Kohei Yoshida 
AuthorDate: Tue Feb 21 22:16:30 2023 -0500
Commit: Kohei Yoshida 
CommitDate: Thu Mar 2 23:35:56 2023 +

Add a means to query the internal broadcaster state ...

... and use it in one unit test case.  Also, remove the code inside
DEBUG_AREA_BROADCASTER macro since it no longer builds & has been
superceded by this new state query method.

Change-Id: I38691a76df5c63034ff488522936dd566bf8b4e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148079
Tested-by: Kohei Yoshida 
Reviewed-by: Kohei Yoshida 

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 4d3c7398b43d..49c36cf27d3c 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -104,6 +104,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/core/data/attrib \
 sc/source/core/data/autonamecache \
 sc/source/core/data/bcaslot \
+sc/source/core/data/broadcast \
 sc/source/core/data/bigrange \
 sc/source/core/data/celltextattr \
 sc/source/core/data/cellvalue \
diff --git a/sc/inc/broadcast.hxx b/sc/inc/broadcast.hxx
new file mode 100644
index ..b095f819acb7
--- /dev/null
+++ b/sc/inc/broadcast.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include "address.hxx"
+
+#include 
+#include 
+#include 
+
+class ScFormulaCell;
+class SvtListener;
+
+namespace sc
+{
+class FormulaGroupAreaListener;
+
+struct BroadcasterState
+{
+enum class CellListenerType
+{
+FormulaCell,
+Generic,
+};
+
+enum class AreaListenerType
+{
+FormulaCell,
+FormulaGroup,
+Generic,
+};
+
+struct CellListener
+{
+using DataType = std::variant;
+
+CellListenerType eType;
+DataType pData;
+
+CellListener(const ScFormulaCell* p);
+CellListener(const SvtListener* p);
+};
+
+struct AreaListener
+{
+using DataType = std::variant;
+
+AreaListenerType eType;
+DataType pData;
+
+AreaListener(const ScFormulaCell* p);
+AreaListener(const sc::FormulaGroupAreaListener* p);
+AreaListener(const SvtListener* p);
+};
+
+std::map> aCellListenerStore;
+std::map> aAreaListenerStore;
+
+/**
+ * Check if a formula cell listens on a single cell.
+ */
+bool hasFormulaCellListener(const ScAddress& rBroadcasterPos,
+const ScAddress& rFormulaPos) const;
+
+/**
+ * Check if a formula cell listens on a single range.
+ */
+bool hasFormulaCellListener(const ScRange& rBroadcasterRange,
+const ScAddress& rFormulaPos) const;
+
+/**
+ * Dump all broadcaster state in YAML format.
+ */
+void dump(std::ostream& rStrm, const ScDocument* pDoc = nullptr) const;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/calcmacros.hxx b/sc/inc/calcmacros.hxx
index c0c68d4487cf..ebe96654804a 100644
--- a/sc/inc/calcmacros.hxx
+++ b/sc/inc/calcmacros.hxx
@@ -12,7 +12,6 @@
 #define DEBUG_COLUMN_STORAGE 0
 #define DEBUG_PIVOT_TABLE 0
 #define DEBUG_FORMULA_COMPILER 0
-#define DEBUG_AREA_BROADCASTER 0
 
 #define DUMP_COLUMN_STORAGE 0
 #define DUMP_PIVOT_TABLE 0
@@ -26,8 +25,7 @@
 
 #if DUMP_PIVOT_TABLE || DEBUG_PIVOT_TABLE || \
 DUMP_COLUMN_STORAGE || DEBUG_COLUMN_STORAGE || \
-DEBUG_FORMULA_COMPILER || \
-DEBUG_AREA_BROADCASTER
+DEBUG_FORMULA_COMPILER
 #include 
 using std::cout;
 using std::cerr;
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 949ca30dd137..5c42f02794ab 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -42,6 +42,7 @@ namespace formula { struct VectorRefArray; }
 
 namespace sc {
 
+struct BroadcasterState;
 struct FormulaGroupEntry;
 

[Libreoffice-commits] core.git: sc/inc

2023-03-02 Thread Samuel Mehrbrodt (via logerrit)
 sc/inc/ViewSettingsSequenceDefines.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 31a503a0a10aea0489ac2ebe5abd745f37e6402b
Author: Samuel Mehrbrodt 
AuthorDate: Thu Mar 2 07:48:42 2023 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Thu Mar 2 08:37:22 2023 +

Fix viewsettings count

Was missed in d0cacf09a1105d89bf3df84b18623d790e3aeb82

Change-Id: I43c1c9b595a8fc8e2982027093695556e182074e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148081
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sc/inc/ViewSettingsSequenceDefines.hxx 
b/sc/inc/ViewSettingsSequenceDefines.hxx
index 7fd754a07b6d..f22c4df5e05b 100644
--- a/sc/inc/ViewSettingsSequenceDefines.hxx
+++ b/sc/inc/ViewSettingsSequenceDefines.hxx
@@ -24,7 +24,7 @@
 // this are the defines for the position of the settings in the
 // ViewSettingsSequence
 
-#define SC_VIEWSETTINGS_COUNT   24
+#define SC_VIEWSETTINGS_COUNT   25
 
 #define SC_VIEW_ID  0
 #define SC_TABLE_VIEWSETTINGS   1


[Libreoffice-commits] core.git: sc/inc sc/source

2023-02-27 Thread Kohei Yoshida (via logerrit)
 sc/inc/clipcontext.hxx  |   15 +
 sc/inc/column.hxx   |   19 +---
 sc/inc/document.hxx |3 +
 sc/source/core/data/clipcontext.cxx |   47 ++
 sc/source/core/data/column3.cxx |   55 +---
 sc/source/core/data/column4.cxx |   18 +++
 sc/source/core/data/document.cxx|   31 +---
 7 files changed, 157 insertions(+), 31 deletions(-)

New commits:
commit e83c243018c1c7f6662f9a8ecdc731c5c071ea31
Author: Kohei Yoshida 
AuthorDate: Tue Feb 21 22:16:30 2023 -0500
Commit: Kohei Yoshida 
CommitDate: Tue Feb 28 03:46:24 2023 +

tdf#153669: Track formulas that stopped listening ...

... then have them start listening again after the copy from
clipboard is complete.  Note that in case the pasted cells
are formula cells, those will be handled together as well.

Change-Id: Ia4be814b888734267a39f7c89435011968570b7f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147940
Tested-by: Jenkins
Reviewed-by: Kohei Yoshida 

diff --git a/sc/inc/clipcontext.hxx b/sc/inc/clipcontext.hxx
index b09e1be78761..b3ce874a6a7f 100644
--- a/sc/inc/clipcontext.hxx
+++ b/sc/inc/clipcontext.hxx
@@ -12,6 +12,7 @@
 #include "address.hxx"
 #include "cellvalue.hxx"
 #include "celltextattr.hxx"
+#include "columnspanset.hxx"
 #include "Sparkline.hxx"
 
 #include 
@@ -45,6 +46,9 @@ public:
 
 class SC_DLLPUBLIC CopyFromClipContext final : public ClipContextBase
 {
+/** Tracks modified formula group spans. */
+sc::ColumnSpanSet maListeningFormulaSpans;
+
 SCCOL mnDestCol1;
 SCCOL mnDestCol2;
 SCROW mnDestRow1;
@@ -101,6 +105,17 @@ public:
 void setDeleteFlag( InsertDeleteFlags nFlag );
 InsertDeleteFlags getDeleteFlag() const;
 
+/**
+ * Record a range of formula cells that need to start listening after the
+ * copy-from-clip is complete.
+ */
+void setListeningFormulaSpans( SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2 );
+
+/**
+ * Have the formula cells in the recorded ranges start listening.
+ */
+void startListeningFormulas();
+
 /**
  * Set the column size of a "single cell" row, which is used when copying
  * a single row of cells in a clip doc and pasting it into multiple
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 69f0d12d8273..949ca30dd137 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -22,6 +22,7 @@
 #include "global.hxx"
 #include "address.hxx"
 #include "cellvalue.hxx"
+#include "columnspanset.hxx"
 #include "rangelst.hxx"
 #include "types.hxx"
 #include "mtvelements.hxx"
@@ -48,8 +49,6 @@ class CopyFromClipContext;
 class CopyToClipContext;
 class CopyToDocContext;
 class MixDocContext;
-class ColumnSpanSet;
-class SingleColumnSpanSet;
 struct RefUpdateContext;
 struct RefUpdateInsertTabContext;
 struct RefUpdateDeleteTabContext;
@@ -837,9 +836,19 @@ private:
 
 void CopyCellTextAttrsToDocument(SCROW nRow1, SCROW nRow2, ScColumn& 
rDestCol) const;
 
-void DeleteCells(
-sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2, 
InsertDeleteFlags nDelFlag,
-sc::SingleColumnSpanSet& rDeleted );
+struct DeleteCellsResult
+{
+/** cell ranges that have been deleted. */
+sc::SingleColumnSpanSet aDeletedRows;
+/** formula cell range that has stopped listening. */
+std::vector> aFormulaRanges;
+
+DeleteCellsResult( const ScDocument& rDoc );
+DeleteCellsResult( const DeleteCellsResult& ) = delete;
+};
+
+std::unique_ptr DeleteCells(
+sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2, 
InsertDeleteFlags nDelFlag );
 
 /**
  * Get all non-grouped formula cells and formula cell groups in the whole
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index c6b2f2289ddb..092d9ba0d9a9 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1672,6 +1672,9 @@ public:
   SCCOL nCol2, SCROW nRow2, const ScMarkData& 
rMark, SCCOL nDx,
   SCROW& rClipStartRow, SCROW nClipEndRow);
 
+void StartListeningFromClip(
+sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt,
+SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
 void StartListeningFromClip( SCCOL nCol1, SCROW nRow1,
  SCCOL nCol2, SCROW nRow2,
  const ScMarkData& rMark, InsertDeleteFlags 
nInsFlag );
diff --git a/sc/source/core/data/clipcontext.cxx 
b/sc/source/core/data/clipcontext.cxx
index d291c7c91f49..ce6974d42334 100644
--- a/sc/source/core/data/clipcontext.cxx
+++ b/sc/source/core/data/clipcontext.cxx
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace sc {
 
@@ -113,6 +114,52 @@ InsertDeleteFlags CopyFromClipContext::getDeleteFlag() 
const

[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2023-02-27 Thread Laurent Balland (via logerrit)
 sc/inc/globstr.hrc |8 ++-
 sc/qa/uitest/calc_tests/calcSheetDelete.py |9 +--
 sc/qa/uitest/calc_tests2/tdf114992.py  |3 -
 sc/qa/uitest/range_name/tdf150307.py   |3 -
 sc/source/ui/view/tabvwshf.cxx |   71 ++---
 5 files changed, 66 insertions(+), 28 deletions(-)

New commits:
commit 41b991ea0cf3f8ce36cbdbf16b9c2c6d2bb16b5d
Author: Laurent Balland 
AuthorDate: Mon Feb 20 08:46:23 2023 +0100
Commit: Laurent Balland 
CommitDate: Mon Feb 27 09:43:03 2023 +

tdf#153709 Adapt message for Delete Sheet

When deleting sheets, the message is adapted to the count of selected
sheets (singular or plural).
The confirmation message is skipped if selected sheets are empty
The message for pivot table data losing is replaced by regular
confirmation message if both pivot table and data are selected

Update UItests when there is no more confirmation

Change-Id: I5cbd6d7cbe271ad86c5c68820b23df5a2307f3bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147309
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
Reviewed-by: Laurent Balland 

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 19e99d1c47d0..95f7138c81c9 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -268,7 +268,9 @@
 #define STR_OPTIONALNC_("STR_OPTIONAL", 
"(optional)")
 #define STR_REQUIREDNC_("STR_REQUIRED", 
"(required)")
 #define STR_NOTES   NC_("STR_NOTES", "Comments")
-#define STR_QUERY_DELTABNC_("STR_QUERY_DELTAB", "Are 
you sure you want to delete the selected sheet(s)?")
+/* %d will be replaced by the number of selected sheets
+ e.g. Are you sure you want to delete the 3 selected sheets? */
+#define STR_QUERY_DELTABNNC_("STR_QUERY_DELTAB", "Are 
you sure you want to delete the selected sheet?", "Are you sure you want to 
delete the %d selected sheets?")
 #define STR_QUERY_DELSCENARIO   NC_("STR_QUERY_DELSCENARIO", 
"Are you sure you want to delete the selected scenario?")
 #define STR_EXPORT_ASCIINC_("STR_EXPORT_ASCII", 
"Export Text File")
 #define STR_IMPORT_LOTUSNC_("STR_IMPORT_LOTUS", 
"Import Lotus files")
@@ -533,7 +535,9 @@
 #define STR_FRACTIONNC_("STR_FRACTION", "Fraction")
 #define STR_BOOLEAN_VALUE   NC_("STR_BOOLEAN_VALUE", 
"Boolean Value")
 #define STR_TEXTNC_("STR_TEXT", "Text")
-#define STR_QUERY_PIVOTTABLE_DELTAB 
NC_("STR_QUERY_PIVOTTABLE_DELTAB", "The selected sheet(s) contain source data 
of related pivot tables that will be lost. Are you sure you want to delete the 
selected sheet(s)?")
+/* %d will be replaced by the number of selected sheets
+e.g. The 3 selected sheets contain source data of related pivot tables 
that will be lost. */
+#define STR_QUERY_PIVOTTABLE_DELTAB 
NNC_("STR_QUERY_PIVOTTABLE_DELTAB", "The selected sheet contains source data of 
related pivot tables that will be lost.", "The %d selected sheets contain 
source data of related pivot tables that will be lost.")
 #define STR_ERR_NAME_INVALID_CELL_REF   
NC_("STR_ERR_NAME_INVALID_CELL_REF", "Invalid name. Reference to a cell, or a 
range of cells not allowed.")
 #define STR_ERR_LONG_LINK_FORMULA_NEEDING_CHECK 
NC_("STR_ERR_LONG_LINK_FORMULA_NEEDING_CHECK", "External content disabled.")
 #define STR_TEXTORIENTANGLE NC_("STR_TEXTORIENTANGLE", 
"Text orientation angle")
diff --git a/sc/qa/uitest/calc_tests/calcSheetDelete.py 
b/sc/qa/uitest/calc_tests/calcSheetDelete.py
index 3e9da3f516d4..380d6766943e 100644
--- a/sc/qa/uitest/calc_tests/calcSheetDelete.py
+++ b/sc/qa/uitest/calc_tests/calcSheetDelete.py
@@ -28,8 +28,7 @@ class calcSheetDelete(UITestCase):
 
 self.assertEqual(document.Sheets.getCount(), nrSheets + 1)
 
-with self.ui_test.execute_dialog_through_command(".uno:Remove", 
close_button="yes"):
-pass
+self.xUITest.executeCommand(".uno:Remove")
 xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
 xToolkit.processEventsToIdle()
 
@@ -85,8 +84,7 @@ class calcSheetDelete(UITestCase):
 self.xUITest.executeCommand(".uno:JumpToNextTableSel")  
#select next sheet
 i = i + 1
 
-with self.ui_test.execute_dialog_through_command(".uno:Remove", 
close_button="yes"):
-pass
+self.xUITest.executeCommand(".uno:Remove")
 
 xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
 xToolkit.processEventsToIdle()
@@ -115,8 +113,7 @@ class calcSheetDelete(UITestCase):
 self.xUITest.executeCommand(".uno:JumpToNextTableSel")  
#select 

[Libreoffice-commits] core.git: sc/inc sc/source

2023-02-24 Thread Noel Grandin (via logerrit)
 sc/inc/docpool.hxx  |4 
 sc/source/core/data/column.cxx  |2 --
 sc/source/core/data/column3.cxx |2 ++
 3 files changed, 2 insertions(+), 6 deletions(-)

New commits:
commit 3900f16e6939ba40f41b3ccd56a28f8275de318d
Author: Noel Grandin 
AuthorDate: Fri Feb 24 09:20:29 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Feb 24 12:37:38 2023 +

improved fix for CppunitTest_sc_uicalc

Revert the previous fix
(commit 0714dfe7fdb0cd3a49d4eb0e771da8eb4aa84d7a)
and implement a better fix, was just a stale pointer

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

diff --git a/sc/inc/docpool.hxx b/sc/inc/docpool.hxx
index 9a2e24796e80..9280fb3602b0 100644
--- a/sc/inc/docpool.hxx
+++ b/sc/inc/docpool.hxx
@@ -22,7 +22,6 @@
 #include 
 #include 
 #include "scdllapi.h"
-#include 
 
 class ScStyleSheet;
 class ScDocument;
@@ -33,9 +32,6 @@ class SC_DLLPUBLIC ScDocumentPool final : public SfxItemPool
 sal_uInt64 mnCurrentMaxKey;
 
 public:
-// used when doing loading in parallel to prevent concurrent mutation of 
the pool
-std::mutex maPoolMutex;
-
 ScDocumentPool();
 private:
 virtual ~ScDocumentPool() override;
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index d2506074070b..fea2f84e5be0 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -624,8 +624,6 @@ void ScColumn::ApplyAttr( SCROW nRow, const SfxPoolItem& 
rAttr )
 
 ScDocumentPool* pDocPool = GetDoc().GetPool();
 
-std::unique_lock aGuard(pDocPool->maPoolMutex);
-
 const ScPatternAttr* pOldPattern = pAttrArray->GetPattern( nRow );
 ScPatternAttr aTemp(*pOldPattern);
 aTemp.GetItemSet().Put(rAttr);
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index d92318134098..b0e22f98b3d1 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -867,6 +867,8 @@ bool ScColumn::UpdateScriptType( sc::CellTextAttr& rAttr, 
SCROW nRow, sc::CellSt
 
 SvNumberFormatter* pFormatter = rDocument.GetFormatTable();
 
+// fetch the pattern again, it might have changed under us
+pPattern = GetPattern(nRow);
 const Color* pColor;
 sal_uInt32 nFormat = pPattern->GetNumberFormat(pFormatter, pCondSet);
 OUString aStr = ScCellFormat::GetString(aCell, nFormat, , 
*pFormatter, rDocument);


[Libreoffice-commits] core.git: sc/inc sc/source

2023-02-23 Thread Noel Grandin (via logerrit)
 sc/inc/docpool.hxx |4 
 sc/source/core/data/column.cxx |2 ++
 2 files changed, 6 insertions(+)

New commits:
commit cacd5a0cd263dbf072d5ad36dc651ad1e7df5826
Author: Noel Grandin 
AuthorDate: Thu Feb 23 14:03:58 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Feb 23 15:52:29 2023 +

attempted fix for CppunitTest_sc_uicalc

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior 
include/svl/setitem.hxx:47:51 in
=
==357324==ERROR: AddressSanitizer: heap-use-after-free on address 
0x60c001c9c340 at pc 0x7fa4bb883389 bp 0x7ffc2482f5f0 sp 0x7ffc2482f5e8
READ of size 2 at 0x60c001c9c340 thread T0
#1 in SfxItemSet::Get(unsigned short, bool) const 
svl/source/items/itemset.cxx:801:26
#2 in SfxUInt32Item const& 
SfxItemSet::Get(TypedWhichId, bool) const 
include/svl/itemset.hxx:102:38
#3 in (anonymous namespace)::getNumberFormatKey(SfxItemSet const&) 
sc/source/core/data/patattr.cxx:1291:17
#4 in ScPatternAttr::GetNumberFormat(SvNumberFormatter*, SfxItemSet 
const*) const sc/source/core/data/patattr.cxx:1335:19
#5 in ScColumn::UpdateScriptType() 
sc/source/core/data/column3.cxx:871:36
#6 in ScColumn::GetRangeScriptType(...) 
sc/source/core/data/column2.cxx:2338:17
#7 in ScTable::GetRangeScriptType(sc::ColumnBlockPosition&, short, int, 
int) sc/source/core/data/table1.cxx:2487:23
#8 in ScDocument::GetRangeScriptType(sc::ColumnBlockPosition&, 
ScAddress const&, int) sc/source/core/data/documen6.cxx:189:32
#9 in (anonymous namespace)::ScriptTypeAggregator::execute(ScAddress 
const&, int, bool) sc/source/core/data/documen6.cxx:175:31
#10 in sc::ColumnSpanSet::executeAction(ScDocument&, 
sc::ColumnSpanSet::Action&) const sc/source/core/data/columnspanset.cxx:176:20
#11 in ScDocument::GetRangeScriptType(ScRangeList const&) 
sc/source/core/data/documen6.cxx:206:10
#12 in ScViewFunc::GetSelectionScriptType() 
sc/source/ui/view/viewfunc.cxx:898:24
#13 in ScFormatShell::GetAttrState(SfxItemSet&) 
sc/source/ui/view/formatsh.cxx:2001:34
...
#61 in main2() sal/cppunittester/cppunittester.cxx:483:16

0x60c001c9c340 is located 64 bytes inside of 120-byte region 
[0x60c001c9c300,0x60c001c9c378)
freed by thread T0 here:
#0 in operator delete(void*, unsigned long) 
/home/noel/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:164:3
#1 in ScPatternAttr::~ScPatternAttr() sc/inc/patattr.hxx:53:20
#2 in SfxItemPool::Remove(SfxPoolItem const&) 
svl/source/items/itempool.cxx:805:13
#3 in ScAttrArray::SetPatternAreaImpl(int, int, ScPatternAttr const*, 
bool, ScEditDataArray*, bool) sc/source/core/data/attarray.cxx:574:31
#4 in ScAttrArray::SetPattern(int, ScPatternAttr const*, bool) 
sc/inc/attarray.hxx:148:7
#5 in ScColumn::ApplyAttr(int, SfxPoolItem const&) 
sc/source/core/data/column.cxx:633:21
#6 in ScColumn::SetNumberFormat(int, unsigned int) 
sc/source/core/data/column2.cxx:3282:5
#7 in ScTable::SetNumberFormat(short, int, unsigned int) 
sc/source/core/data/table2.cxx:2278:35
#8 in ScDocument::SetNumberFormat(ScAddress const&, unsigned int) 
sc/source/core/data/document.cxx:3739:19
#9 in ScFormulaCell::InterpretTail(ScInterpreterContext&, 
ScFormulaCell::ScInterpretTailParameter) 
sc/source/core/data/formulacell.cxx:2157:31
#10 in ScFormulaCell::Interpret(int, int) 
sc/source/core/data/formulacell.cxx:1619:13
#11 in ScFormulaCell::MaybeInterpret() sc/inc/formulacell.hxx:468:17
#12 in ScFormulaCell::IsValue() 
sc/source/core/data/formulacell.cxx:2760:5
#13 in lcl_GetCellContent(ScRefCellValue&, bool, double&, 
rtl::OUString&, ScDocument const*) sc/source/core/data/conditio.cxx:744:40
#14 in ScConditionEntry::IsCellValid(ScRefCellValue&, ScAddress const&) 
const sc/source/core/data/conditio.cxx:1243:17
#15 in ScConditionalFormat::GetCellStyle(ScRefCellValue&, ScAddress 
const&) const sc/source/core/data/conditio.cxx:1812:24
#16 in ScDocument::GetCondResult(ScRefCellValue&, ScAddress const&, 
ScConditionalFormatList const&, o3tl::sorted_vector, o3tl::find_unique, true> const&) const 
sc/source/core/data/documen4.cxx:828:41
#17 in ScColumn::UpdateScriptType(sc::CellTextAttr&, int, 
mdds::mtv::soa::detail::iterator_base::iterator_trait>&)
 sc/source/core/data/column3.cxx:865:30
#18 in ScColumn::GetRangeScriptType(int, 
mdds::mtv::soa::detail::iterator_base::iterator_trait>
 const&) sc/source/core/data/column2.cxx:2338:17
#19 in ScTable::GetRangeScriptType(sc::ColumnBlockPosition&, short, 
int, int)
sc/source/core/data/table1.cxx:2487:23

previously allocated by thread T60 here:
#0 in operator new(unsigned long) 
/home/noel/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:95:3
#1 in 

[Libreoffice-commits] core.git: sc/inc sc/source

2023-02-14 Thread Noel Grandin (via logerrit)
 sc/inc/fielduno.hxx  |5 ++---
 sc/source/ui/unoobj/fielduno.cxx |   26 +++---
 2 files changed, 17 insertions(+), 14 deletions(-)

New commits:
commit 93059e2b164bd5eea4898519e45f1001f299c4ae
Author: Noel Grandin 
AuthorDate: Tue Feb 14 10:26:18 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Feb 14 14:24:44 2023 +

osl::Mutex->std::mutex in ScCellFieldsObj

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

diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx
index fc5ae6d15446..7cf455c7bcc3 100644
--- a/sc/inc/fielduno.hxx
+++ b/sc/inc/fielduno.hxx
@@ -31,7 +31,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -61,9 +60,9 @@ private:
 ScAddress   aCellPos;
 std::unique_ptr mpEditSource;
 /// List of refresh listeners.
-
std::unique_ptr>
 mpRefreshListeners;
+
std::unique_ptr>
 mpRefreshListeners;
 /// mutex to lock the InterfaceContainerHelper
-osl::Mutex  aMutex;
+std::mutex  aMutex;
 
 css::uno::Reference
 GetObjectByIndex_Impl(sal_Int32 Index) const;
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index afc27560c1fe..2a05a24fab75 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -276,21 +276,24 @@ ScCellFieldsObj::ScCellFieldsObj(
 
 ScCellFieldsObj::~ScCellFieldsObj()
 {
-SolarMutexGuard g;
+{
+SolarMutexGuard g;
 
-if (pDocShell)
-pDocShell->GetDocument().RemoveUnoObject(*this);
+if (pDocShell)
+pDocShell->GetDocument().RemoveUnoObject(*this);
 
-mpEditSource.reset();
+mpEditSource.reset();
+}
 
 // increment refcount to prevent double call off dtor
 osl_atomic_increment( _refCount );
 
+std::unique_lock g(aMutex);
 if (mpRefreshListeners)
 {
 lang::EventObject aEvent;
 aEvent.Source.set(static_cast(this));
-mpRefreshListeners->disposeAndClear(aEvent);
+mpRefreshListeners->disposeAndClear(g, aEvent);
 mpRefreshListeners.reset();
 }
 }
@@ -383,12 +386,13 @@ void SAL_CALL ScCellFieldsObj::removeContainerListener(
 // XRefreshable
 void SAL_CALL ScCellFieldsObj::refresh(  )
 {
+std::unique_lock g(aMutex);
 if (mpRefreshListeners)
 {
 //  Call all listeners.
 lang::EventObject aEvent;
 aEvent.Source.set(uno::Reference< util::XRefreshable >(this));
-mpRefreshListeners->notifyEach( ::XRefreshListener::refreshed, 
aEvent );
+mpRefreshListeners->notifyEach( g, ::XRefreshListener::refreshed, 
aEvent );
 }
 }
 
@@ -396,10 +400,10 @@ void SAL_CALL ScCellFieldsObj::addRefreshListener( const 
uno::Reference< util::X
 {
 if (xListener.is())
 {
-SolarMutexGuard aGuard;
+std::unique_lock g(aMutex);
 if (!mpRefreshListeners)
-mpRefreshListeners.reset( new 
comphelper::OInterfaceContainerHelper3(aMutex) );
-mpRefreshListeners->addInterface(xListener);
+mpRefreshListeners.reset( new 
comphelper::OInterfaceContainerHelper4() );
+mpRefreshListeners->addInterface(g, xListener);
 }
 }
 
@@ -407,9 +411,9 @@ void SAL_CALL ScCellFieldsObj::removeRefreshListener( const 
uno::ReferenceremoveInterface(xListener);
+mpRefreshListeners->removeInterface(g, xListener);
 }
 }
 


[Libreoffice-commits] core.git: sc/inc sc/source

2023-02-10 Thread Mike Kaganski (via logerrit)
 sc/inc/stlpool.hxx   |2 +
 sc/source/core/data/stlpool.cxx  |   10 
 sc/source/core/tool/interpr2.cxx |   45 ++-
 sc/source/ui/docshell/docsh4.cxx |6 -
 4 files changed, 44 insertions(+), 19 deletions(-)

New commits:
commit 208a4ecafafa97ea7fcc5a135fa8160e91ea0a74
Author: Mike Kaganski 
AuthorDate: Fri Feb 10 16:04:46 2023 +0300
Commit: Mike Kaganski 
CommitDate: Fri Feb 10 16:33:20 2023 +

tdf#153510: STYLE: try harder to detect when there's nothing to do

1. Find the real style names early, to avoid re-triggering style
application when STYLE arguments use wrong case;
2. Also check a (rare) case when both immediate and delayed styles
are the same as currently applied.

Change-Id: Id8ab2e321ede6d0f8f05ac5d1e63ade0212e5865
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146775
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/inc/stlpool.hxx b/sc/inc/stlpool.hxx
index f4e3ac757094..51694a405202 100644
--- a/sc/inc/stlpool.hxx
+++ b/sc/inc/stlpool.hxx
@@ -51,6 +51,8 @@ public:
 boolHasStandardStyles() const { return bHasStandardStyles; 
}
 
 ScStyleSheet*   FindCaseIns( const OUString& rName, SfxStyleFamily 
eFam );
+// Finds Para style with given name case-insensitively, or 
STR_STYLENAME_STANDARD
+ScStyleSheet*   FindAutoStyle(const OUString& rName);
 
 virtual SfxStyleSheetBase& Make( const OUString&, SfxStyleFamily eFam,
  SfxStyleSearchBits nMask = 
SfxStyleSearchBits::All) override;
diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index b08b6c2203c9..8f554896ff21 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -424,6 +424,16 @@ ScStyleSheet* ScStyleSheetPool::FindCaseIns( const 
OUString& rName, SfxStyleFami
 return first;
 }
 
+ScStyleSheet* ScStyleSheetPool::FindAutoStyle(const OUString& rName)
+{
+ScStyleSheet* pStyleSheet = FindCaseIns(rName, SfxStyleFamily::Para);
+if (!pStyleSheet)
+if (auto pFound = Find(ScResId(STR_STYLENAME_STANDARD), 
SfxStyleFamily::Para))
+if (pFound->isScStyleSheet()) // we do not know what kind of 
sheets we have
+pStyleSheet = static_cast(pFound);
+return pStyleSheet;
+}
+
 void ScStyleSheetPool::setAllParaStandard()
 {
 SfxStyleSheetBase* pSheet = First(SfxStyleFamily::Para);
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index c8015598891f..7826522a89bf 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -2595,38 +2596,54 @@ void ScInterpreter::ScStyle()
 if (!MustHaveParamCount(nParamCount, 1, 3))
 return;
 
-OUString aStyle2;   // Template after timer
+OUString aStyle2;   // Style after timer
 if (nParamCount >= 3)
 aStyle2 = GetString().getString();
 tools::Long nTimeOut = 0;  // timeout
 if (nParamCount >= 2)
 nTimeOut = static_cast(GetDouble()*1000.0);
-OUString aStyle1 = GetString().getString(); // Template for immediate
+OUString aStyle1 = GetString().getString(); // Style for immediate
 
 if (nTimeOut < 0)
 nTimeOut = 0;
 
-// Execute request to apply template
+// Execute request to apply style
 if ( !mrDoc.IsClipOrUndo() )
 {
 SfxObjectShell* pShell = mrDoc.GetDocumentShell();
 if (pShell)
 {
+// Normalize style names right here, making sure that character 
case is correct,
+// and that we only apply anything when there's something to apply
+auto pPool = mrDoc.GetStyleSheetPool();
+if (!aStyle1.isEmpty())
+{
+if (auto pNewStyle = pPool->FindAutoStyle(aStyle1))
+aStyle1 = pNewStyle->GetName();
+else
+aStyle1.clear();
+}
+if (!aStyle2.isEmpty())
+{
+if (auto pNewStyle = pPool->FindAutoStyle(aStyle2))
+aStyle2 = pNewStyle->GetName();
+else
+aStyle2.clear();
+}
 // notify object shell directly!
-bool bNotify = true;
-if (aStyle2.isEmpty())
+if (!aStyle1.isEmpty() || !aStyle2.isEmpty())
 {
 const ScStyleSheet* pStyle = mrDoc.GetStyle(aPos.Col(), 
aPos.Row(), aPos.Tab());
 
-if (pStyle && pStyle->GetName() == aStyle1)
-bNotify = false;
-}
-
-if (bNotify)
-{
-ScRange aRange(aPos);
-ScAutoStyleHint aHint( aRange, aStyle1, nTimeOut, aStyle2 );
-

[Libreoffice-commits] core.git: sc/inc sc/source

2023-02-08 Thread Noel Grandin (via logerrit)
 sc/inc/externalrefmgr.hxx|4 ++-
 sc/source/ui/docshell/externalrefmgr.cxx |   41 +--
 2 files changed, 26 insertions(+), 19 deletions(-)

New commits:
commit 6f1dd12d808a41ca70d4a33787f1bdff9d44a5ac
Author: Noel Grandin 
AuthorDate: Thu Feb 2 09:32:43 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Feb 8 17:30:59 2023 +

osl::Mutex->std::mutex in ScExternalRefCache

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

diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx
index 02a0b28e11f1..238c4a1d0f57 100644
--- a/sc/inc/externalrefmgr.hxx
+++ b/sc/inc/externalrefmgr.hxx
@@ -34,6 +34,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -360,9 +361,10 @@ private:
 };
 typedef std::unordered_map  DocDataType;
 DocItem* getDocItem(sal_uInt16 nFileId) const;
+DocItem* getDocItem(std::unique_lock& rGuard, sal_uInt16 
nFileId) const;
 
 private:
-mutable osl::Mutex maMtxDocs;
+mutable std::mutex maMtxDocs;
 mutable DocDataType maDocs;
 const ScDocument& mrDoc;
 };
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx 
b/sc/source/ui/docshell/externalrefmgr.cxx
index 933cc1ad5b11..7ba8527db28a 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -491,7 +491,7 @@ ScExternalRefCache::~ScExternalRefCache() {}
 
 const OUString* ScExternalRefCache::getRealTableName(sal_uInt16 nFileId, const 
OUString& rTabName) const
 {
-osl::MutexGuard aGuard();
+std::unique_lock aGuard(maMtxDocs);
 
 DocDataType::const_iterator itrDoc = maDocs.find(nFileId);
 if (itrDoc == maDocs.end())
@@ -513,7 +513,7 @@ const OUString* 
ScExternalRefCache::getRealTableName(sal_uInt16 nFileId, const O
 
 const OUString* ScExternalRefCache::getRealRangeName(sal_uInt16 nFileId, const 
OUString& rRangeName) const
 {
-osl::MutexGuard aGuard();
+std::unique_lock aGuard(maMtxDocs);
 
 DocDataType::const_iterator itrDoc = maDocs.find(nFileId);
 if (itrDoc == maDocs.end())
@@ -535,7 +535,7 @@ const OUString* 
ScExternalRefCache::getRealRangeName(sal_uInt16 nFileId, const O
 ScExternalRefCache::TokenRef ScExternalRefCache::getCellData(
 sal_uInt16 nFileId, const OUString& rTabName, SCCOL nCol, SCROW nRow, 
sal_uInt32* pnFmtIndex)
 {
-osl::MutexGuard aGuard();
+std::unique_lock aGuard(maMtxDocs);
 
 DocDataType::const_iterator itrDoc = maDocs.find(nFileId);
 if (itrDoc == maDocs.end())
@@ -565,7 +565,7 @@ ScExternalRefCache::TokenRef 
ScExternalRefCache::getCellData(
 ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData(
 sal_uInt16 nFileId, const OUString& rTabName, const ScRange& rRange)
 {
-osl::MutexGuard aGuard();
+std::unique_lock aGuard(maMtxDocs);
 
 DocDataType::iterator itrDoc = maDocs.find(nFileId);
 if (itrDoc == maDocs.end())
@@ -735,9 +735,9 @@ ScExternalRefCache::TokenArrayRef 
ScExternalRefCache::getCellRangeData(
 
 ScExternalRefCache::TokenArrayRef 
ScExternalRefCache::getRangeNameTokens(sal_uInt16 nFileId, const OUString& 
rName)
 {
-osl::MutexGuard aGuard();
+std::unique_lock aGuard(maMtxDocs);
 
-DocItem* pDoc = getDocItem(nFileId);
+DocItem* pDoc = getDocItem(aGuard, nFileId);
 if (!pDoc)
 return TokenArrayRef();
 
@@ -752,9 +752,9 @@ ScExternalRefCache::TokenArrayRef 
ScExternalRefCache::getRangeNameTokens(sal_uIn
 
 void ScExternalRefCache::setRangeNameTokens(sal_uInt16 nFileId, const 
OUString& rName, TokenArrayRef pArray)
 {
-osl::MutexGuard aGuard();
+std::unique_lock aGuard(maMtxDocs);
 
-DocItem* pDoc = getDocItem(nFileId);
+DocItem* pDoc = getDocItem(aGuard, nFileId);
 if (!pDoc)
 return;
 
@@ -766,9 +766,9 @@ void ScExternalRefCache::setRangeNameTokens(sal_uInt16 
nFileId, const OUString&
 
 bool ScExternalRefCache::isValidRangeName(sal_uInt16 nFileId, const OUString& 
rName) const
 {
-osl::MutexGuard aGuard();
+std::unique_lock aGuard(maMtxDocs);
 
-DocItem* pDoc = getDocItem(nFileId);
+DocItem* pDoc = getDocItem(aGuard, nFileId);
 if (!pDoc)
 return false;
 
@@ -779,9 +779,9 @@ bool ScExternalRefCache::isValidRangeName(sal_uInt16 
nFileId, const OUString& rN
 
 void ScExternalRefCache::setRangeName(sal_uInt16 nFileId, const OUString& 
rName)
 {
-osl::MutexGuard aGuard();
+std::unique_lock aGuard(maMtxDocs);
 
-DocItem* pDoc = getDocItem(nFileId);
+DocItem* pDoc = getDocItem(aGuard, nFileId);
 if (!pDoc)
 return;
 
@@ -1103,7 +1103,7 @@ SCTAB ScExternalRefCache::getTabSpan( sal_uInt16 nFileId, 
const OUString& rStart
 
 void ScExternalRefCache::getAllNumberFormats(vector& rNumFmts) 
const
 {
-osl::MutexGuard aGuard();
+std::unique_lock aGuard(maMtxDocs);
 
 using ::std::sort;
 using ::std::unique;
@@ 

[Libreoffice-commits] core.git: sc/inc sc/source

2023-02-05 Thread Balazs Varga (via logerrit)
 sc/inc/validat.hxx  |4 
 sc/source/core/data/validat.cxx |  196 +++-
 2 files changed, 79 insertions(+), 121 deletions(-)

New commits:
commit d8ae6d1388f28c405c4de2dfe93dbfe2d8acd470
Author: Balazs Varga 
AuthorDate: Tue Jan 31 14:21:31 2023 +0100
Commit: Balazs Varga 
CommitDate: Sun Feb 5 10:31:26 2023 +

Related: tdf#150098 sc validation: allowing formulas for validity test

Clean-up and a little optimization.

Change-Id: Ib56d959188912f4b18acb5466ce55bc7b5b4ee4b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146391
Tested-by: Jenkins
Reviewed-by: Balazs Varga 

diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx
index f28da4a1c50b..af43e37cc123 100644
--- a/sc/inc/validat.hxx
+++ b/sc/inc/validat.hxx
@@ -156,6 +156,10 @@ public:
 
 bool IsDataValid( ScRefCellValue& rCell, const ScAddress& rPos ) const;
 
+/** Test, if formula is valid. */
+bool isFormulaResultsValidatable(const OUString& rTest, const ScAddress& 
rPos, SvNumberFormatter* pFormatter,
+OUString& rStrResult, double& nVal, sal_uInt32& nFormat, bool& bIsVal) 
const;
+
 // TRUE -> break
 bool DoError(weld::Window* pParent, const OUString& rInput, const 
ScAddress& rPos) const;
 void DoCalcError( ScFormulaCell* pCell ) const;
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 2cdafa132594..8fb0f9f7924a 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -447,67 +447,12 @@ bool ScValidationData::IsDataValidCustom(
 
 if (rTest[0] == '=')
 {
-std::optional pFCell(std::in_place, *mpDoc, 
rPos, rTest, true);
-pFCell->SetLimitString(true);
-
-bool bColRowName = pFCell->HasColRowName();
-if (bColRowName)
-{
-// ColRowName from RPN-Code?
-if (pFCell->GetCode()->GetCodeLen() <= 1)
-{   // ==1: area
-// ==0: would be an area if...
-OUString aBraced = "(" + rTest + ")";
-pFCell.emplace(*mpDoc, rPos, aBraced, true);
-pFCell->SetLimitString(true);
-}
-else
-bColRowName = false;
-}
-
-FormulaError nErrCode = pFCell->GetErrCode();
-if (nErrCode == FormulaError::NONE || pFCell->IsMatrix())
-{
-pFormatter = mpDoc->GetFormatTable();
-const Color* pColor;
-if (pFCell->IsMatrix())
-{
-rStrResult = pFCell->GetString().getString();
-}
-else if (pFCell->IsValue())
-{
-nVal = pFCell->GetValue();
-nFormat = pFormatter->GetStandardFormat(nVal, 0,
-pFCell->GetFormatType(), ScGlobal::eLnge);
-pFormatter->GetOutputString(nVal, nFormat, rStrResult, 
);
-bIsVal = true;
-}
-else
-{
-nFormat = pFormatter->GetStandardFormat(
-pFCell->GetFormatType(), ScGlobal::eLnge);
-pFormatter->GetOutputString(pFCell->GetString().getString(), 
nFormat,
-rStrResult, );
-// Indicate it's a string, so a number string doesn't look 
numeric.
-// Escape embedded quotation marks first by doubling them, as
-// usual. Actually the result can be copy-pasted from the 
result
-// box as literal into a formula expression.
-rStrResult = "\"" + rStrResult.replaceAll("\"", "\"\"") + "\"";
-}
-
-ScRange aTestRange;
-if (bColRowName || (aTestRange.Parse(rTest, *mpDoc) & 
ScRefFlags::VALID))
-rStrResult += " ...";
-// area
-
-// check whether empty cells are allowed
-if (rStrResult.isEmpty())
-return IsIgnoreBlank();
-}
-else
-{
+if (!isFormulaResultsValidatable(rTest, rPos, pFormatter, rStrResult, 
nVal, nFormat, bIsVal))
 return false;
-}
+
+// check whether empty cells are allowed
+if (rStrResult.isEmpty())
+return IsIgnoreBlank();
 }
 else
 {
@@ -602,69 +547,14 @@ bool ScValidationData::IsDataValid(
 OUString rStrResult = "";
 bool bIsVal = false;
 
-if (rTest[0] == '=')   // formulas do not pass the validity test
+if (rTest[0] == '=')
 {
-std::optional pFCell(std::in_place, *mpDoc, 
rPos, rTest, true);
-pFCell->SetLimitString(true);
-
-bool bColRowName = pFCell->HasColRowName();
-if (bColRowName)
-{
-// ColRowName from RPN-Code?
-if (pFCell->GetCode()->GetCodeLen() <= 1)
-{   // ==1: area
-// ==0: would be an area if...
-OUString aBraced = "(" + rTest + ")";
-

[Libreoffice-commits] core.git: sc/inc sc/source

2023-01-22 Thread Noel Grandin (via logerrit)
 sc/inc/styleuno.hxx  |5 -
 sc/source/ui/unoobj/styleuno.cxx |6 +-
 2 files changed, 1 insertion(+), 10 deletions(-)

New commits:
commit b127033bf40fb912c35bfb8a659227b749a40ac2
Author: Noel Grandin 
AuthorDate: Sat Jan 21 21:18:28 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Jan 23 07:27:58 2023 +

XUnoTunnel->dynamic_cast in ScStyleObj

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

diff --git a/sc/inc/styleuno.hxx b/sc/inc/styleuno.hxx
index b09a95b71960..d19feed3563a 100644
--- a/sc/inc/styleuno.hxx
+++ b/sc/inc/styleuno.hxx
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -161,7 +160,6 @@ class ScStyleObj final : public ::cppu::WeakImplHelper<
 css::beans::XMultiPropertySet,
 css::beans::XPropertyState,
 css::beans::XMultiPropertyStates,
-css::lang::XUnoTunnel,
 css::lang::XServiceInfo >,
 public SfxListener
 {
@@ -262,9 +260,6 @@ public:
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 
override;
-
-// XUnoTunnel
-UNO3_GETIMPLEMENTATION_DECL(ScStyleObj)
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 4e60223ad0df..cddff8c73d00 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -677,7 +677,7 @@ void SAL_CALL ScStyleFamilyObj::insertByName( const 
OUString& aName, const uno::
 uno::Reference< uno::XInterface > xInterface(aElement, uno::UNO_QUERY);
 if ( xInterface.is() )
 {
-ScStyleObj* pStyleObj = comphelper::getFromUnoTunnel( 
xInterface );
+ScStyleObj* pStyleObj = dynamic_cast( xInterface.get() );
 if ( pStyleObj && pStyleObj->GetFamily() == eFamily &&
 !pStyleObj->IsInserted() )  // not yet inserted?
 {
@@ -962,10 +962,6 @@ ScStyleObj::~ScStyleObj()
 pDocShell->GetDocument().RemoveUnoObject(*this);
 }
 
-// XUnoTunnel
-
-UNO3_GETIMPLEMENTATION_IMPL(ScStyleObj);
-
 void ScStyleObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
 //  reference update does not matter here


[Libreoffice-commits] core.git: sc/inc sc/source

2023-01-22 Thread Noel Grandin (via logerrit)
 sc/inc/datauno.hxx   |5 -
 sc/source/ui/unoobj/cellsuno.cxx |2 +-
 sc/source/ui/unoobj/datauno.cxx  |4 
 3 files changed, 1 insertion(+), 10 deletions(-)

New commits:
commit 2f141c05a7205db660e79673ad2676e19d50583d
Author: Noel Grandin 
AuthorDate: Sat Jan 21 14:46:57 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Jan 23 06:34:10 2023 +

XUnoTunnel->dynamic_cast in ScSubTotalDescriptorBase

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

diff --git a/sc/inc/datauno.hxx b/sc/inc/datauno.hxx
index 528496380806..f2ee6b674129 100644
--- a/sc/inc/datauno.hxx
+++ b/sc/inc/datauno.hxx
@@ -38,7 +38,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -110,7 +109,6 @@ class ScSubTotalDescriptorBase : public 
cppu::WeakImplHelper<
 css::container::XEnumerationAccess,
 css::container::XIndexAccess,
 css::beans::XPropertySet,
-css::lang::XUnoTunnel,
 css::lang::XServiceInfo >
 {
 private:
@@ -160,9 +158,6 @@ public:
 virtual void SAL_CALL   removeVetoableChangeListener( const OUString& 
PropertyName,
 const css::uno::Reference< 
css::beans::XVetoableChangeListener >& aListener ) override;
 
-// XUnoTunnel
-UNO3_GETIMPLEMENTATION_DECL(ScSubTotalDescriptorBase)
-
 // XServiceInfo
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 5d44da0d8fca..69f4cbd5e61f 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -5526,7 +5526,7 @@ void SAL_CALL ScCellRangeObj::applySubTotals(
 
 ScDocShell* pDocSh = GetDocShell();
 ScSubTotalDescriptorBase* pImp =
-comphelper::getFromUnoTunnel( xDescriptor );
+dynamic_cast( xDescriptor.get() );
 
 if (!(pDocSh && pImp))
 return;
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index ee285d662b7c..5d4dc4761cbd 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -731,10 +731,6 @@ uno::Any SAL_CALL 
ScSubTotalDescriptorBase::getPropertyValue( const OUString& aP
 
 SC_IMPL_DUMMY_PROPERTY_LISTENER( ScSubTotalDescriptorBase )
 
-// XUnoTunnel
-
-UNO3_GETIMPLEMENTATION_IMPL(ScSubTotalDescriptorBase);
-
 ScSubTotalDescriptor::ScSubTotalDescriptor()
 {
 }


[Libreoffice-commits] core.git: sc/inc sc/source

2023-01-17 Thread Noel Grandin (via logerrit)
 sc/inc/dapiuno.hxx|   13 ++---
 sc/source/filter/oox/pivottablebuffer.cxx |2 +-
 sc/source/ui/unoobj/dapiuno.cxx   |   16 +---
 3 files changed, 4 insertions(+), 27 deletions(-)

New commits:
commit 8446cac7d39d3f09f9dd0d5b513ceb96184b0da8
Author: Noel Grandin 
AuthorDate: Mon Jan 16 14:02:15 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jan 17 14:45:46 2023 +

XUnoTunnel->dynamic_cast in ScDataPilotDescriptorBase

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

diff --git a/sc/inc/dapiuno.hxx b/sc/inc/dapiuno.hxx
index e10cf45f97e1..88c24ce1a4dc 100644
--- a/sc/inc/dapiuno.hxx
+++ b/sc/inc/dapiuno.hxx
@@ -26,7 +26,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -128,13 +127,11 @@ public:
 };
 
 //  ScDataPilotDescriptorBase is never instantiated directly
-class SAL_DLLPUBLIC_RTTI ScDataPilotDescriptorBase :
-  public cppu::WeakImplHelper<
+class SC_DLLPUBLIC ScDataPilotDescriptorBase : public cppu::WeakImplHelper<
 css::sheet::XDataPilotDescriptor,
 css::beans::XPropertySet,
 
css::sheet::XDataPilotDataLayoutFieldSupplier,
-css::lang::XServiceInfo,
-css::lang::XUnoTunnel>,
+css::lang::XServiceInfo>,
   public SfxListener
 {
 private:
@@ -193,12 +190,6 @@ public:
 virtual css::uno::Reference< css::sheet::XDataPilotField >
 SAL_CALL getDataLayoutField() override;
 
-// XUnoTunnel
-virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence<
-sal_Int8 >& aIdentifier ) override;
-
-SC_DLLPUBLIC static const css::uno::Sequence& getUnoTunnelId();
-
 // XServiceInfo is in derived classes
 };
 
diff --git a/sc/source/filter/oox/pivottablebuffer.cxx 
b/sc/source/filter/oox/pivottablebuffer.cxx
index d57c17571282..e936d0fadd87 100644
--- a/sc/source/filter/oox/pivottablebuffer.cxx
+++ b/sc/source/filter/oox/pivottablebuffer.cxx
@@ -1241,7 +1241,7 @@ void PivotTable::finalizeImport()
 mxDPDescriptor->setTag( maDefModel.maTag );
 
 // TODO: This is a hack. Eventually we need to convert the whole thing 
to the internal API.
-auto pImpl = 
comphelper::getFromUnoTunnel(mxDPDescriptor);
+auto pImpl = 
dynamic_cast(mxDPDescriptor.get());
 if (!pImpl)
 return;
 
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 4be1c767fad0..7247b655bf23 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -414,7 +414,7 @@ void SAL_CALL ScDataPilotTablesObj::insertNewByName( const 
OUString& aNewName,
 if (!pDocShell)
 throw RuntimeException("DocShell is null", 
static_cast(this));
 
-auto pImp = comphelper::getFromUnoTunnel( 
xDescriptor );
+auto pImp = dynamic_cast( xDescriptor.get() );
 if (!pImp)
 throw RuntimeException("Failed to get ScDataPilotDescriptor", 
static_cast(this));
 
@@ -973,20 +973,6 @@ Reference< XDataPilotField > SAL_CALL 
ScDataPilotDescriptorBase::getDataLayoutFi
 return nullptr;
 }
 
-// XUnoTunnel
-
-sal_Int64 SAL_CALL ScDataPilotDescriptorBase::getSomething(
-const Sequence& rId )
-{
-return comphelper::getSomethingImpl(rId, this);
-}
-
-const Sequence& ScDataPilotDescriptorBase::getUnoTunnelId()
-{
-static const comphelper::UnoIdInit theScDataPilotDescriptorBaseUnoTunnelId;
-return theScDataPilotDescriptorBaseUnoTunnelId.getSeq();
-}
-
 ScDataPilotTableObj::ScDataPilotTableObj(ScDocShell& rDocSh, SCTAB nT, 
OUString aN) :
 ScDataPilotDescriptorBase( rDocSh ),
 nTab( nT ),


[Libreoffice-commits] core.git: sc/inc sc/source

2023-01-17 Thread Noel Grandin (via logerrit)
 sc/inc/nameuno.hxx  |7 ---
 sc/source/ui/unoobj/nameuno.cxx |   14 --
 sc/source/ui/vba/vbaname.cxx|4 ++--
 3 files changed, 2 insertions(+), 23 deletions(-)

New commits:
commit 87d0f136dede84f694240f55a958d94e3d0fe9ce
Author: Noel Grandin 
AuthorDate: Mon Jan 16 14:05:19 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jan 17 11:28:43 2023 +

XUnoTunnel->dynamic_cast in ScNamedRangeObj

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

diff --git a/sc/inc/nameuno.hxx b/sc/inc/nameuno.hxx
index 4cd5423cfc0b..ee37dc365d2f 100644
--- a/sc/inc/nameuno.hxx
+++ b/sc/inc/nameuno.hxx
@@ -31,7 +31,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -47,7 +46,6 @@ class SC_DLLPUBLIC ScNamedRangeObj final : public 
::cppu::WeakImplHelper<
 css::sheet::XFormulaTokens,
 css::sheet::XCellRangeReferrer,
 css::beans::XPropertySet,
-css::lang::XUnoTunnel,
 css::lang::XServiceInfo >,
 public SfxListener
 {
@@ -109,11 +107,6 @@ public:
 virtual void SAL_CALL   removeVetoableChangeListener( const OUString& 
PropertyName,
 const css::uno::Reference< 
css::beans::XVetoableChangeListener >& aListener ) override;
 
-/// XUnoTunnel
-virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< 
sal_Int8 >& aIdentifier ) override;
-
-static const css::uno::Sequence& getUnoTunnelId();
-
 /// XServiceInfo
 virtual OUString SAL_CALL getImplementationName() override;
 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index 6d6a56a6d85b..a49748b1a951 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -419,20 +419,6 @@ uno::Sequence SAL_CALL 
ScNamedRangeObj::getSupportedServiceNames()
 return {SCNAMEDRANGEOBJ_SERVICE, SCLINKTARGET_SERVICE};
 }
 
-// XUnoTunnel
-
-sal_Int64 SAL_CALL ScNamedRangeObj::getSomething(
-const uno::Sequence& rId )
-{
-return comphelper::getSomethingImpl(rId, this);
-}
-
-const uno::Sequence& ScNamedRangeObj::getUnoTunnelId()
-{
-static const comphelper::UnoIdInit theScNamedRangeObjUnoTunnelId;
-return theScNamedRangeObjUnoTunnelId.getSeq();
-}
-
 ScNamedRangesObj::ScNamedRangesObj(ScDocShell* pDocSh) :
 mbModifyAndBroadcast(true),
 pDocShell( pDocSh )
diff --git a/sc/source/ui/vba/vbaname.cxx b/sc/source/ui/vba/vbaname.cxx
index ec0dbe982d28..98a242401e7d 100644
--- a/sc/source/ui/vba/vbaname.cxx
+++ b/sc/source/ui/vba/vbaname.cxx
@@ -87,7 +87,7 @@ ScVbaName::setVisible( sal_Bool /*bVisible*/ )
 
 OUString ScVbaName::getContent( const formula::FormulaGrammar::Grammar 
eGrammar )
 {
-ScNamedRangeObj* pNamedRange = comphelper::getFromUnoTunnel< 
ScNamedRangeObj >( mxNamedRange );
+ScNamedRangeObj* pNamedRange = dynamic_cast< ScNamedRangeObj* >( 
mxNamedRange.get() );
 OUString aContent;
 if ( pNamedRange )
 {
@@ -105,7 +105,7 @@ void  ScVbaName::setContent( const OUString& rContent, 
const formula::FormulaGra
 OUString sContent( rContent );
 if (sContent.startsWith("="))
 sContent = sContent.copy(1);
-ScNamedRangeObj* pNamedRange = comphelper::getFromUnoTunnel< 
ScNamedRangeObj >( mxNamedRange );
+ScNamedRangeObj* pNamedRange = dynamic_cast< ScNamedRangeObj* >( 
mxNamedRange.get() );
 
 // We should be able to do the below by just setting calling SetCode on 
pNamedRange
 // right?


[Libreoffice-commits] core.git: sc/inc sc/source

2023-01-05 Thread Arnaud VERSINI (via logerrit)
 sc/inc/compiler.hxx  |1 -
 sc/source/core/tool/compiler.cxx |   12 +---
 2 files changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 3ab8349a37215d8e355e79b93d66f631144e7c57
Author: Arnaud VERSINI 
AuthorDate: Sat Dec 31 19:22:03 2022 +0100
Commit: Eike Rathke 
CommitDate: Thu Jan 5 22:13:35 2023 +

sc : use std::mutex for CharClass initialisation

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

diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 0097486c223c..fbf5073743e1 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -258,7 +258,6 @@ public:
 
 private:
 
-static osl::Mutex   maMutex;
 static const CharClass  *pCharClassEnglish; // character 
classification for en_US locale
 static const CharClass  *pCharClassLocalized;   // character 
classification for UI locale
 static const Convention *pConventions[ 
formula::FormulaGrammar::CONV_LAST ];
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 371ee5aad209..f3861e4ddbbe 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -21,6 +21,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -77,7 +78,6 @@ using namespace formula;
 using namespace ::com::sun::star;
 using ::std::vector;
 
-osl::Mutex  ScCompiler::maMutex;
 const CharClass*ScCompiler::pCharClassEnglish = nullptr;
 const CharClass*ScCompiler::pCharClassLocalized = nullptr;
 const ScCompiler::Convention*   ScCompiler::pConventions[ ]   = { nullptr, 
nullptr, nullptr, nullptr, nullptr, nullptr };
@@ -222,11 +222,17 @@ bool ScCompiler::IsEnglishSymbol( const OUString& rName )
 return !aIntName.isEmpty();   // no valid function name
 }
 
+static std::mutex& getCharClassMutex()
+{
+static std::mutex aMutex;
+return aMutex;
+}
+
 const CharClass* ScCompiler::GetCharClassEnglish()
 {
 if (!pCharClassEnglish)
 {
-osl::MutexGuard aGuard(maMutex);
+std::scoped_lock aGuard(getCharClassMutex());
 if (!pCharClassEnglish)
 {
 pCharClassEnglish = new CharClass( 
::comphelper::getProcessComponentContext(),
@@ -242,7 +248,7 @@ const CharClass* ScCompiler::GetCharClassLocalized()
 {
 // Switching UI language requires restart; if not, we would have to
 // keep track of that.
-osl::MutexGuard aGuard(maMutex);
+std::scoped_lock aGuard(getCharClassMutex());
 if (!pCharClassLocalized)
 {
 pCharClassLocalized = new CharClass( 
::comphelper::getProcessComponentContext(),


[Libreoffice-commits] core.git: sc/inc sc/source

2022-12-22 Thread Rafael Lima (via logerrit)
 sc/inc/globstr.hrc |9 -
 sc/source/core/data/table3.cxx |   26 +-
 2 files changed, 33 insertions(+), 2 deletions(-)

New commits:
commit f5b3bfbded8ea8d4a0b854a62c82b66747b45833
Author: Rafael Lima 
AuthorDate: Wed Dec 21 14:10:32 2022 +
Commit: Olivier Hallot 
CommitDate: Thu Dec 22 08:11:29 2022 +

tdf#152535 Provide better localization for "Grand" subtotal strings

As discussed in the bug report, having the word "Grand" hardcoded first in 
subtotals is not great for translation, since for some languages the 
translation of "grand" would come second.

This patch creates separate strings for each case of Grand, f.i. "Grand 
Count", "Grand Sum" and so on. Now each of them will have their own translation.

Change-Id: Ib875bc1a7b2fcc8934ad85bfe09374f8d9d9a179
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144666
Tested-by: Jenkins
Reviewed-by: Olivier Hallot 

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index e1f1a485eed0..19e99d1c47d0 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -138,7 +138,6 @@
 #define STR_MSSG_SOLVE_2NC_("STR_MSSG_SOLVE_2", "Goal 
Seek failed.\n\n")
 #define STR_MSSG_SOLVE_3NC_("STR_MSSG_SOLVE_3", 
"Insert the closest value (")
 #define STR_MSSG_SOLVE_4NC_("STR_MSSG_SOLVE_4", ") 
into the variable cell anyway?")
-#define STR_TABLE_GRAND NC_("STR_TABLE_GRAND", "Grand")
 #define STR_TABLE_ERGEBNIS  NC_("STR_TABLE_ERGEBNIS", 
"Result")
 #define STR_UNDO_SPELLING   NC_("STR_UNDO_SPELLING", 
"Spellcheck")
 #define STR_TABLE_AND   NC_("STR_TABLE_AND", "AND")
@@ -196,6 +195,14 @@
 #define STR_FUN_TEXT_PRODUCTNC_("STR_FUN_TEXT_PRODUCT", 
"Product")
 #define STR_FUN_TEXT_STDDEV NC_("STR_FUN_TEXT_STDDEV", 
"StDev")
 #define STR_FUN_TEXT_VARNC_("STR_FUN_TEXT_VAR", "Var")
+#define STR_TABLE_GRAND_AVG NC_("STR_TABLE_GRAND_AVG", 
"Grand Average")
+#define STR_TABLE_GRAND_COUNT   NC_("STR_TABLE_GRAND_COUNT", 
"Grand Count")
+#define STR_TABLE_GRAND_MAX NC_("STR_TABLE_GRAND_MAX", 
"Grand Max")
+#define STR_TABLE_GRAND_MIN NC_("STR_TABLE_GRAND_MIN", 
"Grand Min")
+#define STR_TABLE_GRAND_PRODUCT NC_("STR_TABLE_GRAND_PRODUCT", 
"Grand Product")
+#define STR_TABLE_GRAND_STDDEV  NC_("STR_TABLE_GRAND_STDDEV", 
"Grand StdDev")
+#define STR_TABLE_GRAND_SUM NC_("STR_TABLE_GRAND_SUM", 
"Grand Sum")
+#define STR_TABLE_GRAND_VAR NC_("STR_TABLE_GRAND_VAR", 
"Grand Var")
 #define STR_NOCHARTATCURSOR NC_("STR_NOCHARTATCURSOR", "No 
chart found at this position.")
 #define STR_PIVOT_NOTFOUND  NC_("STR_PIVOT_NOTFOUND", "No 
pivot table found at this position.")
 #define STR_EMPTYDATA   NC_("STR_EMPTYDATA", "(empty)")
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index bdf16a69aad4..a535726fd8fc 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2058,6 +2058,30 @@ static TranslateId lcl_GetSubTotalStrId(int id)
 }
 }
 
+// Gets the string used for "Grand" results
+static TranslateId lcl_GetGrandSubTotalStrId(int id)
+{
+switch ( id )
+{
+case SUBTOTAL_FUNC_AVE: return STR_TABLE_GRAND_AVG;
+case SUBTOTAL_FUNC_CNT:
+case SUBTOTAL_FUNC_CNT2:return STR_TABLE_GRAND_COUNT;
+case SUBTOTAL_FUNC_MAX: return STR_TABLE_GRAND_MAX;
+case SUBTOTAL_FUNC_MIN: return STR_TABLE_GRAND_MIN;
+case SUBTOTAL_FUNC_PROD:return STR_TABLE_GRAND_PRODUCT;
+case SUBTOTAL_FUNC_STD:
+case SUBTOTAL_FUNC_STDP:return STR_TABLE_GRAND_STDDEV;
+case SUBTOTAL_FUNC_SUM: return STR_TABLE_GRAND_SUM;
+case SUBTOTAL_FUNC_VAR:
+case SUBTOTAL_FUNC_VARP:return STR_TABLE_GRAND_VAR;
+default:
+{
+ return STR_EMPTYDATA;
+// added to avoid warnings
+}
+}
+}
+
 //  new intermediate results
 //  rParam.nRow2 is changed!
 
@@ -2264,7 +2288,7 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam )
 DBShowRow(aRowEntry.nDestRow, true);
 
 // insert label
-OUString label = ScResId(STR_TABLE_GRAND) + " " + 
ScResId(lcl_GetSubTotalStrId(pResFunc[0]));
+OUString label = 
ScResId(lcl_GetGrandSubTotalStrId(pResFunc[0]));
 SetString(nGroupCol[aRowEntry.nGroupNo], aRowEntry.nDestRow, 
nTab, label);
 ApplyStyle(nGroupCol[aRowEntry.nGroupNo], aRowEntry.nDestRow, 
pStyle);
 }


[Libreoffice-commits] core.git: sc/inc sc/source

2022-12-11 Thread Caolán McNamara (via logerrit)
 sc/inc/globstr.hrc   |2 +-
 sc/source/ui/docshell/docsh4.cxx |5 -
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 4af3a2998dd36a940f741b335e8327da2a4dead9
Author: Caolán McNamara 
AuthorDate: Sun Dec 11 16:23:07 2022 +
Commit: Caolán McNamara 
CommitDate: Sun Dec 11 19:25:32 2022 +

reuse RID_SECURITY_WARNING_TITLE for update links infobar

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

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 9aaf84c8af7a..e1f1a485eed0 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -345,7 +345,7 @@
 #define STR_DOC_PRINTED NC_("STR_DOC_PRINTED", 
"Printed")
 #define STR_BY  NC_("STR_BY", "by")
 #define STR_ON  NC_("STR_ON", "on")
-#define STR_RELOAD_TABLES   NC_("STR_RELOAD_TABLES", 
"Security Warning: Automatic update of external links has been disabled.")
+#define STR_RELOAD_TABLES   NC_("STR_RELOAD_TABLES", 
"Automatic update of external links has been disabled.")
 #define STR_REIMPORT_AFTER_LOAD NC_("STR_REIMPORT_AFTER_LOAD", 
"This file contains queries. The results of these queries were not saved.\nDo 
you want these queries to be repeated?")
 #define STR_INSERT_FULL NC_("STR_INSERT_FULL", "Filled 
cells cannot be shifted\nbeyond the sheet.")
 #define STR_TABINSERT_ERROR NC_("STR_TABINSERT_ERROR", 
"The table could not be inserted.")
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 4c27228b1219..04b605edb57a 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -32,6 +32,8 @@ using namespace ::com::sun::star;
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -539,7 +541,8 @@ void ScDocShell::Execute( SfxRequest& rReq )
 if (pViewFrame)
 {
 pViewFrame->RemoveInfoBar(u"enablecontent");
-auto pInfoBar = 
pViewFrame->AppendInfoBar("enablecontent", "", ScResId(STR_RELOAD_TABLES), 
InfobarType::WARNING);
+auto pInfoBar = 
pViewFrame->AppendInfoBar("enablecontent", SfxResId(RID_SECURITY_WARNING_TITLE),
+  
ScResId(STR_RELOAD_TABLES), InfobarType::WARNING);
 if (pInfoBar)
 {
 weld::Button& rHelpBtn = pInfoBar->addButton();


[Libreoffice-commits] core.git: sc/inc sc/source

2022-12-08 Thread Eike Rathke (via logerrit)
 sc/inc/document.hxx |2 ++
 sc/source/core/data/clipcontext.cxx |8 ++--
 sc/source/core/data/column4.cxx |5 +
 sc/source/core/data/documen2.cxx|   11 +++
 4 files changed, 16 insertions(+), 10 deletions(-)

New commits:
commit 17b302b092b5c90552720097fe87c8eedc8f83df
Author: Eike Rathke 
AuthorDate: Wed Dec 7 22:05:15 2022 +0100
Commit: Eike Rathke 
CommitDate: Thu Dec 8 12:24:47 2022 +

Related: tdf#120190 Factor out ScDocument::CreateSharedStringTextObject()

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

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index cd7e08b0dde4..20e42a999ac8 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2510,6 +2510,8 @@ public:
 SC_DLLPUBLIC ScFieldEditEngine& GetEditEngine();
 SC_DLLPUBLIC ScNoteEditEngine&  GetNoteEngine();
 
+std::unique_ptr CreateSharedStringTextObject( const 
svl::SharedString& rSS );
+
 std::unique_ptr const & 
GetRefreshTimerControlAddress() const
{ return pRefreshTimerControl; }
 
diff --git a/sc/source/core/data/clipcontext.cxx 
b/sc/source/core/data/clipcontext.cxx
index ee97d315077b..d291c7c91f49 100644
--- a/sc/source/core/data/clipcontext.cxx
+++ b/sc/source/core/data/clipcontext.cxx
@@ -253,12 +253,8 @@ void CopyFromClipContext::setSingleCell( const ScAddress& 
rSrcPos, const ScColum
 // Turn this into a string or edit cell.
 if (rSrcCell.getFormula()->IsMultilineResult())
 {
-// TODO : Add shared string support to the edit engine to
-// make this process simpler.
-ScFieldEditEngine& rEngine = mrDestDoc.GetEditEngine();
-
rEngine.SetTextCurrentDefaults(rSrcCell.getFormula()->GetString().getString());
-std::unique_ptr 
pObj(rEngine.CreateTextObject());
-pObj->NormalizeString(mrDestDoc.GetSharedStringPool());
+std::unique_ptr 
pObj(mrDestDoc.CreateSharedStringTextObject(
+rSrcCell.getFormula()->GetString()));
 rSrcCell.set(*pObj);
 }
 else
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 83123dffd88b..0de5deff335c 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -501,10 +501,7 @@ public:
 case sc::FormulaResultValue::String:
 if (aRes.mbMultiLine)
 {
-ScFieldEditEngine& rEngine = mrDoc.GetEditEngine();
-rEngine.SetTextCurrentDefaults(aRes.maString.getString());
-std::unique_ptr 
pObj(rEngine.CreateTextObject());
-pObj->NormalizeString(mrDoc.GetSharedStringPool());
+std::unique_ptr 
pObj(mrDoc.CreateSharedStringTextObject(aRes.maString));
 maResValues.setValue(nRow, std::move(pObj));
 }
 else
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index af4629d7aef3..e21da4be599b 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -511,6 +511,17 @@ ScNoteEditEngine& ScDocument::GetNoteEngine()
 return *mpNoteEngine;
 }
 
+std::unique_ptr ScDocument::CreateSharedStringTextObject( 
const svl::SharedString& rSS )
+{
+/* TODO: Add shared string support to the edit engine to make this process
+ * simpler. */
+ScFieldEditEngine& rEngine = GetEditEngine();
+rEngine.SetTextCurrentDefaults( rSS.getString());
+std::unique_ptr pObj( rEngine.CreateTextObject());
+pObj->NormalizeString( GetSharedStringPool());
+return pObj;
+}
+
 void ScDocument::ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks )
 {
 if (bIsClip)


[Libreoffice-commits] core.git: sc/inc sc/source

2022-12-07 Thread Eike Rathke (via logerrit)
 sc/inc/cellvalues.hxx |3 +++
 sc/inc/formularesult.hxx  |3 ++-
 sc/source/core/data/cellvalues.cxx|7 +++
 sc/source/core/data/column4.cxx   |   22 ++
 sc/source/core/tool/formularesult.cxx |4 ++--
 5 files changed, 32 insertions(+), 7 deletions(-)

New commits:
commit 40a59e3e58de1c3f60ae52d09fbc386399f8f122
Author: Eike Rathke 
AuthorDate: Wed Dec 7 21:22:41 2022 +0100
Commit: Eike Rathke 
CommitDate: Wed Dec 7 23:41:51 2022 +

Resolves: tdf#120190 Handle multiline string in Formula to Value conversion

... as usual as EditTextObject.

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

diff --git a/sc/inc/cellvalues.hxx b/sc/inc/cellvalues.hxx
index 0043d65270e6..352a152ec891 100644
--- a/sc/inc/cellvalues.hxx
+++ b/sc/inc/cellvalues.hxx
@@ -15,6 +15,7 @@
 
 class ScColumn;
 class ScFormulaCell;
+class EditTextObject;
 
 namespace svl
 {
@@ -69,6 +70,8 @@ public:
 void reset(size_t nSize);
 void setValue(size_t nRow, double fVal);
 void setValue(size_t nRow, const svl::SharedString& rStr);
+/// Takes ownership of pEditText.
+void setValue(size_t nRow, std::unique_ptr pEditText);
 
 void swap(CellValues& r);
 
diff --git a/sc/inc/formularesult.hxx b/sc/inc/formularesult.hxx
index ff036a78bcb3..581d9a4bba3d 100644
--- a/sc/inc/formularesult.hxx
+++ b/sc/inc/formularesult.hxx
@@ -35,12 +35,13 @@ struct FormulaResultValue
 
 double mfValue;
 svl::SharedString maString;
+bool mbMultiLine = false;
 Type meType;
 FormulaError mnError;
 
 FormulaResultValue();
 FormulaResultValue( double fValue );
-FormulaResultValue( svl::SharedString aStr );
+FormulaResultValue( svl::SharedString aStr, bool bMultiLine );
 FormulaResultValue( FormulaError nErr );
 };
 
diff --git a/sc/source/core/data/cellvalues.cxx 
b/sc/source/core/data/cellvalues.cxx
index 290dc0d091a9..d23d7a9eccca 100644
--- a/sc/source/core/data/cellvalues.cxx
+++ b/sc/source/core/data/cellvalues.cxx
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -147,6 +148,12 @@ void CellValues::setValue( size_t nRow, const 
svl::SharedString& rStr )
 mpImpl->miAttrPos = mpImpl->maCellTextAttrs.set(mpImpl->miAttrPos, nRow, 
sc::CellTextAttr());
 }
 
+void CellValues::setValue( size_t nRow, std::unique_ptr 
pEditText )
+{
+mpImpl->miCellPos = mpImpl->maCells.set(mpImpl->miCellPos, nRow, 
pEditText.release());
+mpImpl->miAttrPos = mpImpl->maCellTextAttrs.set(mpImpl->miAttrPos, nRow, 
sc::CellTextAttr());
+}
+
 void CellValues::swap( CellValues& r )
 {
 std::swap(mpImpl, r.mpImpl);
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index ce982e920f8c..83123dffd88b 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -478,13 +479,15 @@ namespace {
 class ConvertFormulaToValueHandler
 {
 sc::CellValues maResValues;
+ScDocument& mrDoc;
 bool mbModified;
 
 public:
-ConvertFormulaToValueHandler(ScSheetLimits const & rSheetLimits) :
+ConvertFormulaToValueHandler(ScDocument& rDoc) :
+mrDoc(rDoc),
 mbModified(false)
 {
-maResValues.reset(rSheetLimits.GetMaxRowCount());
+maResValues.reset(mrDoc.GetSheetLimits().GetMaxRowCount());
 }
 
 void operator() ( size_t nRow, const ScFormulaCell* pCell )
@@ -496,7 +499,18 @@ public:
 maResValues.setValue(nRow, aRes.mfValue);
 break;
 case sc::FormulaResultValue::String:
-maResValues.setValue(nRow, aRes.maString);
+if (aRes.mbMultiLine)
+{
+ScFieldEditEngine& rEngine = mrDoc.GetEditEngine();
+rEngine.SetTextCurrentDefaults(aRes.maString.getString());
+std::unique_ptr 
pObj(rEngine.CreateTextObject());
+pObj->NormalizeString(mrDoc.GetSharedStringPool());
+maResValues.setValue(nRow, std::move(pObj));
+}
+else
+{
+maResValues.setValue(nRow, aRes.maString);
+}
 break;
 case sc::FormulaResultValue::Error:
 case sc::FormulaResultValue::Invalid:
@@ -528,7 +542,7 @@ void ScColumn::ConvertFormulaToValue(
 sc::SharedFormulaUtil::splitFormulaCellGroups(GetDoc(), maCells, aBounds);
 
 // Parse all formulas within the range and store their results into 
temporary storage.
-ConvertFormulaToValueHandler aFunc(GetDoc().GetSheetLimits());
+ConvertFormulaToValueHandler aFunc(GetDoc());
 sc::ParseFormula(maCells.begin(), maCells, nRow1, nRow2, aFunc);
 if (!aFunc.isModified())
 // No formula 

[Libreoffice-commits] core.git: sc/inc sc/source

2022-11-30 Thread offtkp (via logerrit)
 sc/inc/dbdata.hxx   |   10 +-
 sc/source/core/tool/dbdata.cxx  |   17 ++---
 sc/source/filter/excel/xedbdata.cxx |5 +++--
 sc/source/filter/inc/tablecolumnsbuffer.hxx |4 
 sc/source/filter/oox/tablecolumnsbuffer.cxx |   11 ++-
 5 files changed, 40 insertions(+), 7 deletions(-)

New commits:
commit 933e045422957e15cad47ef925d4f9a852c826b1
Author: offtkp 
AuthorDate: Thu Nov 17 16:41:42 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Wed Nov 30 14:24:10 2022 +0100

xlsx: Import table column attribute XML_totalsRowFunction

Import table column attribute totalsRowFunction and also export it,
which fixes a warning when roundtripped on a different office suite.

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

diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index 0e8d53830e53..482c55bc6aa4 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -43,6 +43,11 @@ enum class ScDBDataPortion
 AREA///< entire area
 };
 
+struct TableColumnAttributes
+{
+std::optional maTotalsFunction = std::nullopt;
+};
+
 /** Container base class to provide selected access for ScDBData. */
 class ScDBDataContainerBase
 {
@@ -93,6 +98,7 @@ private:
 boolbModified;  ///< is set/cleared for/by(?) 
UpdateReference
 
 ::std::vector< OUString > maTableColumnNames;   ///< names of table columns
+::std::vector< TableColumnAttributes > maTableColumnAttributes; ///< 
attributes of table columns
 boolmbTableColumnNamesDirty;
 SCSIZE  nFilteredRowCount;
 
@@ -147,6 +153,8 @@ public:
 voidEndTableColumnNamesListener();
 SC_DLLPUBLIC void SetTableColumnNames( ::std::vector< OUString >&& rNames 
);
 SC_DLLPUBLIC const ::std::vector< OUString >& GetTableColumnNames() const 
{ return maTableColumnNames; }
+SC_DLLPUBLIC void SetTableColumnAttributes( ::std::vector< 
TableColumnAttributes >&& rAttributes );
+SC_DLLPUBLIC const ::std::vector< TableColumnAttributes >& 
GetTableColumnAttributes() const { return maTableColumnAttributes; }
 boolAreTableColumnNamesDirty() const { return 
mbTableColumnNamesDirty; }
 
 /** Refresh/update the column names with the header row's cell contents. */
@@ -218,7 +226,7 @@ public:
 
 private:
 
-void AdjustTableColumnNames( UpdateRefMode eUpdateRefMode, SCCOL nDx, 
SCCOL nCol1,
+void AdjustTableColumnAttributes( UpdateRefMode eUpdateRefMode, SCCOL nDx, 
SCCOL nCol1,
 SCCOL nOldCol1, SCCOL nOldCol2, SCCOL nNewCol1, SCCOL nNewCol2 );
 void InvalidateTableColumnNames( bool bSwapToEmptyNames );
 };
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index cf518d0e2890..dc10d6a0503e 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -609,7 +609,7 @@ bool ScDBData::UpdateReference(const ScDocument* pDoc, 
UpdateRefMode eUpdateRefM
 if (bDoUpdate && eRet != UR_INVALID)
 {
 // MoveTo() invalidates column names via SetArea(); adjust, remember 
and set new.
-AdjustTableColumnNames( eUpdateRefMode, nDx, nCol1, nOldCol1, 
nOldCol2, theCol1, theCol2);
+AdjustTableColumnAttributes( eUpdateRefMode, nDx, nCol1, nOldCol1, 
nOldCol2, theCol1, theCol2);
 ::std::vector aNames( maTableColumnNames);
 bool bTableColumnNamesDirty = mbTableColumnNamesDirty;
 // tdf#48025, tdf#141946: update the column index of the filter 
criteria,
@@ -686,7 +686,12 @@ void ScDBData::SetTableColumnNames( ::std::vector< 
OUString >&& rNames )
 mbTableColumnNamesDirty = false;
 }
 
-void ScDBData::AdjustTableColumnNames( UpdateRefMode eUpdateRefMode, SCCOL 
nDx, SCCOL nCol1,
+void ScDBData::SetTableColumnAttributes( ::std::vector< TableColumnAttributes 
>&& rAttributes )
+{
+maTableColumnAttributes = std::move(rAttributes);
+}
+
+void ScDBData::AdjustTableColumnAttributes( UpdateRefMode eUpdateRefMode, 
SCCOL nDx, SCCOL nCol1,
 SCCOL nOldCol1, SCCOL nOldCol2, SCCOL nNewCol1, SCCOL nNewCol2 )
 {
 if (maTableColumnNames.empty())
@@ -698,6 +703,7 @@ void ScDBData::AdjustTableColumnNames( UpdateRefMode 
eUpdateRefMode, SCCOL nDx,
 return; // not moved or entirely moved, nothing to do
 
 ::std::vector aNewNames;
+::std::vector aNewAttributes;
 if (eUpdateRefMode == URM_INSDEL)
 {
 if (nDx > 0)
@@ -714,22 +720,27 @@ void ScDBData::AdjustTableColumnNames( UpdateRefMode 
eUpdateRefMode, SCCOL nDx,
 if (nDx > 0)
 n += nDx;
 aNewNames.resize(n);
+aNewAttributes.resize(n);
+maTableColumnAttributes.resize(n);
 // Copy head.
 for (size_t i = 0; i < nHead; ++i)
 {
 aNewNames[i] = maTableColumnNames[i];
+  

[Libreoffice-commits] core.git: sc/inc writerfilter/source

2022-11-14 Thread Stephan Bergmann (via logerrit)
 sc/inc/tabopparams.hxx  |2 +-
 writerfilter/source/dmapper/PropertyMap.cxx |2 +-
 writerfilter/source/dmapper/PropertyMap.hxx |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit d1faa8f62621221e85b8f7d42b766a6a4e76923f
Author: Stephan Bergmann 
AuthorDate: Mon Nov 14 11:58:53 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Nov 14 13:33:25 2022 +0100

Add some missing member operator== const qualifiers

...that were only detected now by GCC 13 trunk after


"c++: implement P2468R2, the equality operator you are looking for",

> sc/source/core/tool/interpr4.cxx: In member function ‘void 
ScInterpreter::ScTableOp()’:
> sc/source/core/tool/interpr4.cxx:3608:58: error: C++20 says that these 
are ambiguous, even though the second is reversed: [-Werror]
>  3608 | bool bReuseLastParams = (mrDoc.aLastTableOpParams == 
aTableOp);
>   |  ^~~~
> In file included from sc/inc/document.hxx:32,
>  from sc/inc/externalrefmgr.hxx:23,
>  from sc/source/core/inc/interpre.hxx:28,
>  from sc/source/core/tool/interpr4.cxx:22:
> sc/inc/tabopparams.hxx:76:10: note: candidate 1: ‘bool 
ScInterpreterTableOpParams::operator==(const ScInterpreterTableOpParams&)’
>76 | bool operator ==( const ScInterpreterTableOpParams& r )
>   |  ^~~~
> sc/inc/tabopparams.hxx:76:10: note: candidate 2: ‘bool 
ScInterpreterTableOpParams::operator==(const ScInterpreterTableOpParams&)’ 
(reversed)
> sc/inc/tabopparams.hxx:76:10: note: try making the operator a ‘const’ 
member function

etc.

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

diff --git a/sc/inc/tabopparams.hxx b/sc/inc/tabopparams.hxx
index b796ff8aded4..0ecd7271512c 100644
--- a/sc/inc/tabopparams.hxx
+++ b/sc/inc/tabopparams.hxx
@@ -73,7 +73,7 @@ struct ScInterpreterTableOpParams
 return *this;
 }
 
-bool operator ==( const ScInterpreterTableOpParams& r )
+bool operator ==( const ScInterpreterTableOpParams& r ) const
 {
 return
 bValid && r.bValid &&
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index eec9b678a209..b0e3b2146795 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -2119,7 +2119,7 @@ ParagraphProperties::ParagraphProperties()
 {
 }
 
-bool ParagraphProperties::operator==( const ParagraphProperties& rCompare )
+bool ParagraphProperties::operator==( const ParagraphProperties& rCompare ) 
const
 {
 return ( m_bFrameMode  == rCompare.m_bFrameMode &&
  m_nDropCap== rCompare.m_nDropCap &&
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx 
b/writerfilter/source/dmapper/PropertyMap.hxx
index 701546e2fb93..7ec406053f07 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -449,7 +449,7 @@ public:
 ParagraphProperties & operator =(ParagraphProperties &&) = default;
 
 // Does not compare the starting/ending range, m_sParaStyleName and 
m_nDropCapLength
-bool operator==( const ParagraphProperties& );
+bool operator==( const ParagraphProperties& ) const;
 
 sal_Int32 GetListId() const  { return m_nListId; }
 void  SetListId( sal_Int32 nId ) { m_nListId = nId; }


[Libreoffice-commits] core.git: sc/inc sc/source

2022-11-13 Thread Eike Rathke (via logerrit)
 sc/inc/interpretercontext.hxx  |4 ++--
 sc/source/core/data/documen2.cxx   |2 +-
 sc/source/core/tool/interpretercontext.cxx |   12 
 3 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit dffeb48f25123b16e60aed5aa4abaeefa92f83a1
Author: Eike Rathke 
AuthorDate: Sun Nov 13 01:41:11 2022 +0100
Commit: Eike Rathke 
CommitDate: Sun Nov 13 16:26:56 2022 +0100

Clear only lookup caches of calling document

It is the same for always reused interpreter context slots but
does not hurt and prepares for when more than one document is to
be cached.

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

diff --git a/sc/inc/interpretercontext.hxx b/sc/inc/interpretercontext.hxx
index 4ecb1ed9de1a..39d528cb6ca9 100644
--- a/sc/inc/interpretercontext.hxx
+++ b/sc/inc/interpretercontext.hxx
@@ -82,7 +82,7 @@ private:
 void ResetTokens();
 void SetDocAndFormatter(const ScDocument& rDoc, SvNumberFormatter* 
pFormatter);
 void Cleanup();
-void ClearLookupCache();
+void ClearLookupCache(const ScDocument* pDoc);
 void initFormatTable();
 SvNumberFormatter* mpFormatter;
 mutable NFIndexAndFmtType maNFTypeCache;
@@ -135,7 +135,7 @@ class ScInterpreterContextPool
 
 public:
 // Only to be used to clear lookup cache in all pool elements
-static void ClearLookupCaches();
+static void ClearLookupCaches(const ScDocument* pDoc);
 };
 
 class ScThreadedInterpreterContextGetterGuard
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index f784d510fe6c..af4629d7aef3 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1280,7 +1280,7 @@ void ScDocument::ClearLookupCaches()
 GetNonThreadedContext().mxScLookupCache.reset();
 mxScSortedRangeCache->aCacheMap.clear();
 // Clear lookup cache in all interpreter-contexts in the 
(threaded/non-threaded) pools.
-ScInterpreterContextPool::ClearLookupCaches();
+ScInterpreterContextPool::ClearLookupCaches(this);
 }
 
 bool ScDocument::IsCellInChangeTrack(const ScAddress ,Color 
*pColCellBorder)
diff --git a/sc/source/core/tool/interpretercontext.cxx 
b/sc/source/core/tool/interpretercontext.cxx
index e66a8b977446..deb6f6d0ed5b 100644
--- a/sc/source/core/tool/interpretercontext.cxx
+++ b/sc/source/core/tool/interpretercontext.cxx
@@ -74,7 +74,11 @@ void ScInterpreterContext::Cleanup()
 ResetTokens();
 }
 
-void ScInterpreterContext::ClearLookupCache() { mxScLookupCache.reset(); }
+void ScInterpreterContext::ClearLookupCache(const ScDocument* pDoc)
+{
+if (pDoc == mpDoc)
+mxScLookupCache.reset();
+}
 
 SvNumFormatType ScInterpreterContext::GetNumberFormatType(sal_uInt32 nFIndex) 
const
 {
@@ -161,12 +165,12 @@ void ScInterpreterContextPool::ReturnToPool()
 }
 
 // static
-void ScInterpreterContextPool::ClearLookupCaches()
+void ScInterpreterContextPool::ClearLookupCaches(const ScDocument* pDoc)
 {
 for (auto& rPtr : aThreadedInterpreterPool.maPool)
-rPtr->ClearLookupCache();
+rPtr->ClearLookupCache(pDoc);
 for (auto& rPtr : aNonThreadedInterpreterPool.maPool)
-rPtr->ClearLookupCache();
+rPtr->ClearLookupCache(pDoc);
 }
 
 /* ScThreadedInterpreterContextGetterGuard */


[Libreoffice-commits] core.git: sc/inc sc/qa sc/uiconfig

2022-11-02 Thread Bogdan B (via logerrit)
 sc/inc/globstr.hrc |4 ++--
 sc/qa/uitest/pageFormat/tdf123508.py   |6 +++---
 sc/uiconfig/scalc/ui/sheetprintpage.ui |4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit c4f5d456e5801843f00a43afd9c0fa43c412d265
Author: Bogdan B 
AuthorDate: Tue Nov 1 21:50:57 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Nov 2 11:13:22 2022 +0100

tdf#134882 Change label in the dialog: 'fit' is replaced with 'shrink'

...because shrink is the only effect of this option to the text.

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

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index edabc014d7bf..9aaf84c8af7a 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -330,8 +330,8 @@
 #define STR_SCATTR_PAGE_PRINTDIR
NC_("STR_SCATTR_PAGE_PRINTDIR", "Print direction")
 #define STR_SCATTR_PAGE_FIRSTPAGENO 
NC_("STR_SCATTR_PAGE_FIRSTPAGENO", "First page number")
 #define STR_SCATTR_PAGE_SCALE   NC_("STR_SCATTR_PAGE_SCALE", 
"Reduce/enlarge printout")
-#define STR_SCATTR_PAGE_SCALETOPAGES
NC_("STR_SCATTR_PAGE_SCALETOPAGES", "Fit print range(s) on number of pages")
-#define STR_SCATTR_PAGE_SCALETO NC_("STR_SCATTR_PAGE_SCALETO", 
"Fit print range(s) to width/height")
+#define STR_SCATTR_PAGE_SCALETOPAGES
NC_("STR_SCATTR_PAGE_SCALETOPAGES", "Shrink print range(s) on number of pages")
+#define STR_SCATTR_PAGE_SCALETO NC_("STR_SCATTR_PAGE_SCALETO", 
"Shrink print range(s) to width/height")
 #define STR_SCATTR_PAGE_SCALE_WIDTH 
NC_("STR_SCATTR_PAGE_SCALE_WIDTH", "Width")
 #define STR_SCATTR_PAGE_SCALE_HEIGHT
NC_("STR_SCATTR_PAGE_SCALE_HEIGHT", "Height")
 #define STR_SCATTR_PAGE_SCALE_PAGES 
NNC_("STR_SCATTR_PAGE_SCALE_PAGES", "One page", "%1 pages")
diff --git a/sc/qa/uitest/pageFormat/tdf123508.py 
b/sc/qa/uitest/pageFormat/tdf123508.py
index 041e375a7478..7e1f7e987b45 100644
--- a/sc/qa/uitest/pageFormat/tdf123508.py
+++ b/sc/qa/uitest/pageFormat/tdf123508.py
@@ -23,8 +23,8 @@ class tdf123508(UITestCase):
 scalingMode = xDialog.getChild("comboLB_SCALEMODE")
 spinEDSCALEPAGEWIDTH = xDialog.getChild("spinED_SCALEPAGEWIDTH")
 spinEDSCALEPAGEHEIGHT = xDialog.getChild("spinED_SCALEPAGEHEIGHT")
-#select "Fit print range(s) to width/height"  from the scale mode 
drop-down list
-select_by_text(scalingMode, "Fit print range(s) to width/height")
+#select "Shrink print range(s) to width/height"  from the scale 
mode drop-down list
+select_by_text(scalingMode, "Shrink print range(s) to 
width/height")
 #define a value for the page, e.g.: width   2; height  2
 spinEDSCALEPAGEWIDTH.executeAction("UP", tuple())
 spinEDSCALEPAGEHEIGHT.executeAction("UP", tuple())
@@ -38,7 +38,7 @@ class tdf123508(UITestCase):
 spinEDSCALEPAGEWIDTH = xDialog.getChild("spinED_SCALEPAGEWIDTH")
 spinEDSCALEPAGEHEIGHT = xDialog.getChild("spinED_SCALEPAGEHEIGHT")
 
-
self.assertEqual(get_state_as_dict(scalingMode)["SelectEntryText"], "Fit print 
range(s) to width/height")
+
self.assertEqual(get_state_as_dict(scalingMode)["SelectEntryText"], "Shrink 
print range(s) to width/height")
 self.assertEqual(get_state_as_dict(spinEDSCALEPAGEWIDTH)["Text"], 
"2")
 self.assertEqual(get_state_as_dict(spinEDSCALEPAGEHEIGHT)["Text"], 
"2")
 
diff --git a/sc/uiconfig/scalc/ui/sheetprintpage.ui 
b/sc/uiconfig/scalc/ui/sheetprintpage.ui
index 41ee7c089d2d..082457ba5747 100644
--- a/sc/uiconfig/scalc/ui/sheetprintpage.ui
+++ b/sc/uiconfig/scalc/ui/sheetprintpage.ui
@@ -642,8 +642,8 @@
 False
 
   Reduce/enlarge printout
-  Fit print range(s) to 
width/height
-  Fit print range(s) on number of 
pages
+  Shrink print range(s) to 
width/height
+  Shrink print range(s) on number of 
pages
 
 
   


[Libreoffice-commits] core.git: sc/inc

2022-10-24 Thread Eike Rathke (via logerrit)
 sc/inc/scfuncs.hrc |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6d4e290bfd38664eebb1a394563e89a845a85078
Author: Eike Rathke 
AuthorDate: Mon Oct 24 15:19:22 2022 +0200
Commit: Eike Rathke 
CommitDate: Mon Oct 24 20:28:32 2022 +0200

Related: tdf#140554 Function Wizard, FIXED() second parameter default is 2

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

diff --git a/sc/inc/scfuncs.hrc b/sc/inc/scfuncs.hrc
index 830f041c1536..51d317d486de 100644
--- a/sc/inc/scfuncs.hrc
+++ b/sc/inc/scfuncs.hrc
@@ -3748,7 +3748,7 @@ const TranslateId SC_OPCODE_FIXED_ARY[] =
 NC_("SC_OPCODE_FIXED", "Number"),
 NC_("SC_OPCODE_FIXED", "The number to be formatted."),
 NC_("SC_OPCODE_FIXED", "Decimals"),
-NC_("SC_OPCODE_FIXED", "Decimal places. The number of fixed decimal places 
that are to be displayed."),
+NC_("SC_OPCODE_FIXED", "Decimal places. The number of fixed decimal places 
that are to be displayed. Default 2."),
 NC_("SC_OPCODE_FIXED", "No thousands separators"),
 NC_("SC_OPCODE_FIXED", "Thousands separator. If 0 or omitted the locale 
group separator is used else the separator is suppressed.")
 };


[Libreoffice-commits] core.git: sc/inc sc/source

2022-10-18 Thread Noel Grandin (via logerrit)
 sc/inc/chart2uno.hxx  |9 +-
 sc/source/ui/unoobj/chart2uno.cxx |  130 --
 2 files changed, 74 insertions(+), 65 deletions(-)

New commits:
commit 03ef97c7605f4d3f537d5a1f31c2f131a439578d
Author: Noel Grandin 
AuthorDate: Tue Oct 18 14:16:08 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Oct 18 19:07:00 2022 +0200

tdf#131910 speed up chart display

the chart2 module likes cloning ScChart2DataSequence, which can take a
long time if we have lots of data, so share the data via shared_ptr

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

diff --git a/sc/inc/chart2uno.hxx b/sc/inc/chart2uno.hxx
index a5e4f53b032f..a8ac4422464e 100644
--- a/sc/inc/chart2uno.hxx
+++ b/sc/inc/chart2uno.hxx
@@ -205,6 +205,7 @@ public:
 ::std::vector&& rTokens, bool bIncludeHiddenCells );
 
 virtual ~ScChart2DataSequence() override;
+ScChart2DataSequence(ScDocument* pDoc, const ScChart2DataSequence&);
 ScChart2DataSequence(const ScChart2DataSequence&) = delete;
 ScChart2DataSequence& operator=(const ScChart2DataSequence&) = delete;
 
@@ -324,8 +325,6 @@ private:
 
 void StopListeningToAllExternalRefs();
 
-void CopyData(const ScChart2DataSequence& r);
-
 private:
 
 // data array
@@ -350,8 +349,10 @@ private:
 ScChart2DataSequence& mrParent;
 };
 
-/** This vector contains the cached data which was calculated with 
BuildDataCache(). */
-std::vector   m_aDataArray;
+/** This vector contains the cached data which was calculated with 
BuildDataCache().
+We use a shared_ptr because chart likes to Clone this class, which is 
very
+expensive when we have lots of data. */
+std::shared_ptr> m_xDataArray;
 
 /**
  * Cached data for getData.  We may also need to cache data for the
diff --git a/sc/source/ui/unoobj/chart2uno.cxx 
b/sc/source/ui/unoobj/chart2uno.cxx
index 729249790a9d..58ca25ae854e 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -2409,7 +2409,8 @@ void ScChart2DataSequence::HiddenRangeListener::notify()
 ScChart2DataSequence::ScChart2DataSequence( ScDocument* pDoc,
 vector&& rTokens,
 bool bIncludeHiddenCells )
-: m_bIncludeHiddenCells( bIncludeHiddenCells)
+: m_xDataArray(new std::vector)
+, m_bIncludeHiddenCells( bIncludeHiddenCells)
 , m_nObjectId( 0 )
 , m_pDocument( pDoc)
 , m_aTokens(std::move(rTokens))
@@ -2439,6 +2440,54 @@ ScChart2DataSequence::ScChart2DataSequence( ScDocument* 
pDoc,
 //  m_aIdentifier += OUString::valueOf( ++nID);
 }
 
+/** called from Clone() */
+ScChart2DataSequence::ScChart2DataSequence(ScDocument* pDoc, const 
ScChart2DataSequence& r)
+: m_xDataArray(r.m_xDataArray)
+, m_aHiddenValues(r.m_aHiddenValues)
+, m_aRole(r.m_aRole)
+, m_bIncludeHiddenCells( r.m_bIncludeHiddenCells)
+, m_nObjectId( 0 )
+, m_pDocument( pDoc)
+, m_aPropSet(lcl_GetDataSequencePropertyMap())
+, m_bGotDataChangedHint(false)
+, m_bExtDataRebuildQueued(false)
+, mbTimeBased(false)
+, mnTimeBasedStart(0)
+, mnTimeBasedEnd(0)
+, mnCurrentTab(0)
+{
+assert(pDoc);
+
+// Clone tokens.
+m_aTokens.reserve(r.m_aTokens.size());
+for (const auto& rxToken : m_aTokens)
+{
+ScTokenRef p(rxToken->Clone());
+m_aTokens.push_back(p);
+}
+
+m_pDocument->AddUnoObject( *this);
+m_nObjectId = m_pDocument->GetNewUnoId();
+
+if (r.m_oRangeIndices)
+m_oRangeIndices = *r.m_oRangeIndices;
+
+if (!r.m_pExtRefListener)
+return;
+
+// Re-register all external files that the old instance was
+// listening to.
+
+ScExternalRefManager* pRefMgr = m_pDocument->GetExternalRefManager();
+m_pExtRefListener.reset(new ExternalRefListener(*this, m_pDocument));
+const std::unordered_set& rFileIds = 
r.m_pExtRefListener->getAllFileIds();
+for (const auto& rFileId : rFileIds)
+{
+pRefMgr->addLinkListener(rFileId, m_pExtRefListener.get());
+m_pExtRefListener->addFileId(rFileId);
+}
+}
+
 ScChart2DataSequence::~ScChart2DataSequence()
 {
 SolarMutexGuard g;
@@ -2492,7 +2541,7 @@ void ScChart2DataSequence::BuildDataCache()
 {
 m_bExtDataRebuildQueued = false;
 
-if (!m_aDataArray.empty())
+if (!m_xDataArray->empty())
 return;
 
 StopListeningToAllExternalRefs();
@@ -2569,7 +2618,7 @@ void ScChart2DataSequence::BuildDataCache()
 
 aItem.mAddress = ScAddress(nCol, nRow, nTab);
 
-m_aDataArray.push_back(std::move(aItem));
+m_xDataArray->push_back(std::move(aItem));
 ++nDataCount;
 }
 }
@@ -2590,7 +2639,7 @@ void ScChart2DataSequence::RebuildDataCache()
 {
 if 

[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

2022-10-06 Thread Noel Grandin (via logerrit)
 sc/inc/address.hxx |2 
 sc/inc/docuno.hxx  |2 
 sc/inc/global.hxx  |2 
 sc/inc/rangeutl.hxx|   20 ++---
 sc/inc/scmod.hxx   |2 
 sc/inc/validat.hxx |2 
 sc/qa/unit/uicalc/uicalc.cxx   |   84 -
 sc/source/core/data/dpobject.cxx   |   26 +++
 sc/source/core/data/dptabres.cxx   |4 -
 sc/source/core/data/global.cxx |4 -
 sc/source/core/data/validat.cxx|4 -
 sc/source/core/opencl/formulagroupcl.cxx   |8 +-
 sc/source/core/tool/address.cxx|4 -
 sc/source/core/tool/compiler.cxx   |   10 +-
 sc/source/core/tool/interpr1.cxx   |6 -
 sc/source/core/tool/rangeutl.cxx   |   30 
 sc/source/filter/excel/excel.cxx   |6 -
 sc/source/filter/excel/xepivot.cxx |4 -
 sc/source/filter/excel/xeroot.cxx  |6 -
 sc/source/filter/excel/xihelper.cxx|   10 +-
 sc/source/filter/inc/addressconverter.hxx  |   12 +--
 sc/source/filter/inc/drawingfragment.hxx   |2 
 sc/source/filter/inc/formulaparser.hxx |4 -
 sc/source/filter/inc/numberformatsbuffer.hxx   |4 -
 sc/source/filter/inc/richstring.hxx|4 -
 sc/source/filter/inc/stylesbuffer.hxx  |2 
 sc/source/filter/inc/xeroot.hxx|2 
 sc/source/filter/inc/xihelper.hxx  |2 
 sc/source/filter/oox/addressconverter.cxx  |   45 ++---
 sc/source/filter/oox/defnamesbuffer.cxx|7 +-
 sc/source/filter/oox/drawingfragment.cxx   |   24 +++
 sc/source/filter/oox/formulaparser.cxx |   20 ++---
 sc/source/filter/oox/numberformatsbuffer.cxx   |   35 +-
 sc/source/filter/oox/pagesettings.cxx  |   18 ++---
 sc/source/filter/oox/richstring.cxx|   16 ++--
 sc/source/filter/oox/stylesbuffer.cxx  |4 -
 sc/source/filter/oox/worksheetfragment.cxx |6 -
 sc/source/filter/xml/XMLStylesExportHelper.cxx |8 +-
 sc/source/filter/xml/XMLStylesExportHelper.hxx |4 -
 sc/source/filter/xml/XMLTableShapeResizer.cxx  |4 -
 sc/source/filter/xml/XMLTableShapeResizer.hxx  |2 
 sc/source/filter/xml/celltextparacontext.cxx   |6 -
 sc/source/filter/xml/celltextparacontext.hxx   |2 
 sc/source/filter/xml/xmlcelli.cxx  |4 -
 sc/source/filter/xml/xmlcelli.hxx  |2 
 sc/source/filter/xml/xmlimprt.cxx  |   14 ++--
 sc/source/filter/xml/xmlimprt.hxx  |4 -
 sc/source/filter/xml/xmlsorti.cxx  |8 +-
 sc/source/filter/xml/xmlsorti.hxx  |2 
 sc/source/ui/app/inputhdl.cxx  |   18 ++---
 sc/source/ui/app/scmod.cxx |4 -
 sc/source/ui/inc/inputhdl.hxx  |2 
 sc/source/ui/inc/tpformula.hxx |2 
 sc/source/ui/optdlg/tpformula.cxx  |6 -
 sc/source/ui/pagedlg/areasdlg.cxx  |   19 ++---
 sc/source/ui/uitest/uiobject.cxx   |8 +-
 sc/source/ui/unoobj/docuno.cxx |2 
 57 files changed, 286 insertions(+), 278 deletions(-)

New commits:
commit ce6babf777882d78dbf322de74f321354ac7b351
Author: Noel Grandin 
AuthorDate: Thu Oct 6 08:57:27 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Oct 6 13:03:03 2022 +0200

use more string_view in sc

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

diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index c3171c8f8a84..85a581f5c765 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -973,6 +973,6 @@ inline OUString ScColToAlpha( SCCOL nCol )
 }
 
 /// get column number of A..IV... string
-bool AlphaToCol(const ScDocument& rDoc, SCCOL& rCol, const OUString& rStr);
+bool AlphaToCol(const ScDocument& rDoc, SCCOL& rCol, std::u16string_view rStr);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 420975ace5d7..cb1fd2049bb5 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -519,7 +519,7 @@ private:
 SCCOL   nEndCol;
 
 rtl::Reference GetObjectByIndex_Impl(sal_Int32 nIndex) 
const;
-rtl::Reference GetObjectByName_Impl(const OUString& 
aName) const;
+rtl::Reference GetObjectByName_Impl(std::u16string_view 
aName) const;
 
 public:
 ScTableColumnsObj(ScDocShell* pDocSh, SCTAB nT,
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 3be19f89dcc1..1e42e6060d0e 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -642,7 +642,7 @@ public:
 bool bForceSep = false 

[Libreoffice-commits] core.git: sc/inc sc/source

2022-09-29 Thread Luboš Luňák (via logerrit)
 sc/inc/table.hxx   |8 
 sc/source/core/data/table4.cxx |8 
 2 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 1c53f5b6647dcffa57012990d342b21eaff19888
Author: Luboš Luňák 
AuthorDate: Thu Sep 29 14:22:00 2022 +0200
Commit: Luboš Luňák 
CommitDate: Thu Sep 29 16:19:18 2022 +0200

introduce ScTable::GetColumnData() (tdf#151182)

This is intended to handle possibly unallocated columns similarly
to CreateColumnIfNotExists(), but unlike that one this one does not
allocate, if the column is not allocated then the default column
data is returned. This is intended for reading of columns.

Change-Id: Ic3b637eb3d16bac69ebc7ecd389973407db4f7fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140737
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 4d4e7a2f7830..a9d2ad71bd39 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -294,6 +294,14 @@ public:
 }
 // out-of-line the cold part of the function
 void CreateColumnIfNotExistsImpl( const SCCOL nScCol );
+
+ScColumnData& GetColumnData( SCCOL nCol )
+{
+if( nCol >= aCol.size())
+return aDefaultColData;
+return aCol[nCol];
+}
+
 sal_uInt64  GetCellCount() const;
 sal_uInt64  GetWeightedCount() const;
 sal_uInt64  GetWeightedCount(SCROW nStartRow, SCROW nEndRow) const;
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 6cf97e5d9caf..77f17feaa8f3 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -910,9 +910,9 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL 
nCol2, SCROW nRow2,
 if ( bGetPattern )
 {
 if (bVertical)  // rInner&:=nRow, rOuter&:=nCol
-pSrcPattern = 
aCol[nCol].GetPattern(static_cast(nAtSrc));
+pSrcPattern = 
GetColumnData(nCol).GetPattern(static_cast(nAtSrc));
 else// rInner&:=nCol, rOuter&:=nRow
-pSrcPattern = 
aCol[nAtSrc].GetPattern(static_cast(nRow));
+pSrcPattern = 
GetColumnData(nAtSrc).GetPattern(static_cast(nRow));
 bGetPattern = false;
 pStyleSheet = pSrcPattern->GetStyleSheet();
 // do transfer ATTR_MERGE / ATTR_MERGE_FLAG
@@ -1894,7 +1894,7 @@ void ScTable::FillAutoSimple(
 return;
 }
 const SvNumFormatType nFormatType = 
rDocument.GetFormatTable()->GetType(
-aCol[rCol].GetNumberFormat( 
rDocument.GetNonThreadedContext(), nSource));
+GetColumnData(rCol).GetNumberFormat( 
rDocument.GetNonThreadedContext(), nSource));
 bBooleanCell = (nFormatType == SvNumFormatType::LOGICAL);
 bPercentCell = (nFormatType == SvNumFormatType::PERCENT);
 
@@ -1903,7 +1903,7 @@ void ScTable::FillAutoSimple(
 {
 aSrcCell = GetCellValue(nSource, rRow);
 const SvNumFormatType nFormatType = 
rDocument.GetFormatTable()->GetType(
-aCol[nSource].GetNumberFormat( 
rDocument.GetNonThreadedContext(), rRow));
+GetColumnData(nSource).GetNumberFormat( 
rDocument.GetNonThreadedContext(), rRow));
 bBooleanCell = (nFormatType == SvNumFormatType::LOGICAL);
 bPercentCell = (nFormatType == SvNumFormatType::PERCENT);
 }


  1   2   3   4   5   6   7   8   9   10   >