core.git: 2 commits - sc/source

2024-06-07 Thread Caolán McNamara (via logerrit)
 sc/source/ui/view/gridwin.cxx |   32 
 1 file changed, 32 insertions(+)

New commits:
commit 4d599b5a9702863be8c5927ab657d4a3805570e7
Author: Caolán McNamara 
AuthorDate: Fri Jun 7 12:11:22 2024 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jun 7 15:55:49 2024 +0200

prep AutoFill menu in kit mode only

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

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index dcc4361a313f..5d298458cb75 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2370,32 +2370,35 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& 
rMEvt )
 {
 mrViewData.GetDispatcher().Execute( FID_FILL_AUTO, 
SfxCallMode::SLOT | SfxCallMode::RECORD );
 
-// prepare AutoFill menu items for "Copy Cells" and "Fill Series"
-ScTabViewShell* pViewShell = mrViewData.GetViewShell();
-boost::property_tree::ptree aMenu;
-boost::property_tree::ptree aItemTree;
-
-aItemTree.put("text", "~Copy Cells");
-aItemTree.put("type", "command");
-aItemTree.put("command", ".uno:AutoFill?Copy:bool=true");
-aItemTree.put("enabled", "true");
-aMenu.push_back(std::make_pair("", aItemTree));
-
-aItemTree.put("text", "~Fill Series");
-aItemTree.put("type", "command");
-aItemTree.put("command", ".uno:AutoFill?Copy:bool=false");
-aItemTree.put("enabled", "true");
-aMenu.push_back(std::make_pair("", aItemTree));
-aItemTree.clear();
-
-boost::property_tree::ptree aRoot;
-aRoot.add_child("menu", aMenu);
-
-std::stringstream aStream;
-boost::property_tree::write_json(aStream, aRoot, true);
-
-pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU,
-   OString(aStream.str()));
+if (comphelper::LibreOfficeKit::isActive())
+{
+// prepare AutoFill menu items for "Copy Cells" and "Fill 
Series"
+ScTabViewShell* pViewShell = mrViewData.GetViewShell();
+boost::property_tree::ptree aMenu;
+boost::property_tree::ptree aItemTree;
+
+aItemTree.put("text", "~Copy Cells");
+aItemTree.put("type", "command");
+aItemTree.put("command", ".uno:AutoFill?Copy:bool=true");
+aItemTree.put("enabled", "true");
+aMenu.push_back(std::make_pair("", aItemTree));
+
+aItemTree.put("text", "~Fill Series");
+aItemTree.put("type", "command");
+aItemTree.put("command", ".uno:AutoFill?Copy:bool=false");
+aItemTree.put("enabled", "true");
+aMenu.push_back(std::make_pair("", aItemTree));
+aItemTree.clear();
+
+boost::property_tree::ptree aRoot;
+aRoot.add_child("menu", aMenu);
+
+std::stringstream aStream;
+boost::property_tree::write_json(aStream, aRoot, true);
+
+
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU,
+   OString(aStream.str()));
+}
 }
 }
 else if (mrViewData.GetFillMode() == ScFillMode::MATRIX)
commit e2128b2ea88460bd33ec9b70974366699ef5ccae
Author: Bayram Çiçek 
AuthorDate: Mon May 27 12:14:56 2024 +0300
Commit: Caolán McNamara 
CommitDate: Fri Jun 7 15:55:42 2024 +0200

add AutoFill menu items - LOK_CALLBACK_CONTEXT_MENU

- added AutoFill menu items "Copy cells" and "Fill series"
- send information with LOK_CALLBACK_CONTEXT_MENU

Signed-off-by: Bayram Çiçek 
Change-Id: I3118f5535f74cfa4ab049e643930df83512b6850
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168086
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
(cherry picked from commit a3f4d31783721f61b8436c5f8032321b4c97de1a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168531
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index d73701241e7c..dcc4361a313f 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2367,7 +2367,36 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& 
rMEvt )
 }
 }
 else
+{
 mrViewData.GetDispatcher().Execute( FID_FILL_AUTO, 
SfxCallMode::SLOT | SfxCallMode::RECORD );
+
+// prepare AutoFill menu items for "Copy Cells" and "Fill Series"
+ScTabViewShell* pViewShell = mrViewData.GetViewShell();
+

core.git: 2 commits - sc/source sw/source

2024-06-03 Thread Caolán McNamara (via logerrit)
 sc/source/ui/navipi/content.cxx |2 +-
 sw/source/core/doc/docsort.cxx  |   21 +++--
 2 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit 2c0157fbe9b9338f98e66d300664fe3c710eb415
Author: Caolán McNamara 
AuthorDate: Mon Jun 3 20:09:16 2024 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jun 3 22:44:16 2024 +0200

cid#1602449 Resource leak

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

diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index df5aaf6e5c89..8f5e70d5110d 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -313,7 +313,7 @@ bool SwDoc::SortText(const SwPaM& rPaM, const 
SwSortOptions& rOpt)
 }
 
 std::optional pRedlPam;
-SwUndoRedlineSort* pRedlUndo = nullptr;
+std::unique_ptr xRedlUndo;
 SwUndoSort* pUndoSort = nullptr;
 
 // To-Do - add 'SwExtraRedlineTable' also ?
@@ -328,7 +328,7 @@ bool SwDoc::SortText(const SwPaM& rPaM, const 
SwSortOptions& rOpt)
 {
 if( bUndo )
 {
-pRedlUndo = new SwUndoRedlineSort( *pRedlPam,rOpt );
+xRedlUndo.reset(new SwUndoRedlineSort(*pRedlPam, rOpt));
 GetIDocumentUndoRedo().DoUndo(false);
 }
 // First copy the range
@@ -356,8 +356,8 @@ bool SwDoc::SortText(const SwPaM& rPaM, const 
SwSortOptions& rOpt)
 if (pCNd)
 pRedlPam->GetPoint()->SetContent( nCLen );
 
-if( pRedlUndo )
-pRedlUndo->SetValues( rPaM );
+if (xRedlUndo)
+xRedlUndo->SetValues(rPaM);
 }
 else
 {
@@ -380,7 +380,7 @@ bool SwDoc::SortText(const SwPaM& rPaM, const 
SwSortOptions& rOpt)
 SwNodeOffset nBeg = pStart->GetNodeIndex();
 SwNodeRange aRg( aStart, aStart );
 
-if( bUndo && !pRedlUndo )
+if (bUndo && !xRedlUndo)
 {
 pUndoSort = new SwUndoSort(rPaM, rOpt);
 GetIDocumentUndoRedo().AppendUndo(std::unique_ptr(pUndoSort));
@@ -412,12 +412,13 @@ bool SwDoc::SortText(const SwPaM& rPaM, const 
SwSortOptions& rOpt)
 
 if( pRedlPam )
 {
-if( pRedlUndo )
+SwUndoRedlineSort* pRedlUndo = xRedlUndo.get();
+if (pRedlUndo)
 {
-pRedlUndo->SetSaveRange( *pRedlPam );
+xRedlUndo->SetSaveRange(*pRedlPam);
 // UGLY: temp. enable Undo
 GetIDocumentUndoRedo().DoUndo(true);
-GetIDocumentUndoRedo().AppendUndo( 
std::unique_ptr(pRedlUndo) );
+GetIDocumentUndoRedo().AppendUndo(std::move(xRedlUndo));
 GetIDocumentUndoRedo().DoUndo(false);
 }
 
@@ -437,13 +438,13 @@ bool SwDoc::SortText(const SwPaM& rPaM, const 
SwSortOptions& rOpt)
 // the sorted range is inserted
 getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( 
RedlineType::Insert, *pRedlPam ), true);
 
-if( pRedlUndo )
+if (pRedlUndo)
 {
 SwNodeIndex aInsEndIdx( pRedlPam->GetMark()->GetNode(), -1 );
 SwContentNode *const pContentNode = 
aInsEndIdx.GetNode().GetContentNode();
 pRedlPam->GetMark()->Assign( *pContentNode, pContentNode->Len() );
 
-pRedlUndo->SetValues( *pRedlPam );
+pRedlUndo->SetValues(*pRedlPam);
 }
 
 pRedlPam.reset();
commit 16b0ad3cf76d9932ebbd169af64b7ad292e68426
Author: Caolán McNamara 
AuthorDate: Mon Jun 3 20:03:07 2024 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jun 3 22:44:08 2024 +0200

cid#1459023 Dereference null return value

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

diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 0ae1b45de7ee..c0e06a0f2b01 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -386,7 +386,7 @@ IMPL_LINK_NOARG(ScContentTree, ContentDoubleClickHdl, 
weld::TreeView&, bool)
 pParentWindow->SetCurrentCell( aPos.Col(), aPos.Row() );
 // Check whether the comment is currently visible and toggle 
its visibility
 ScDocument* pSrcDoc = GetSourceDocument();
-if (ScPostIt* pNote = pSrcDoc->GetNote(aPos.Col(), aPos.Row(), 
aPos.Tab()))
+if (ScPostIt* pNote = pSrcDoc ? pSrcDoc->GetNote(aPos.Col(), 
aPos.Row(), aPos.Tab()) : nullptr)
 {
 bool bVisible = pNote->IsCaptionShown();
 // Effectivelly set the visibility of the comment


core.git: 2 commits - sc/source sd/source

2024-06-02 Thread Caolán McNamara (via logerrit)
 sc/source/core/tool/dbdata.cxx   |2 +-
 sd/source/ui/view/ToolBarManager.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 1f15d097cace14ca6e44e7652f460aa3fa7bd150
Author: Caolán McNamara 
AuthorDate: Sun Jun 2 12:17:21 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sun Jun 2 22:46:51 2024 +0200

cid#1602446 silence Unchecked return value

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

diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index c2096b39c4d1..596f50f756a5 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -1598,7 +1598,7 @@ void ScDBCollection::CopyToTable(SCTAB nOldPos, SCTAB 
nNewPos)
 std::unique_ptr pDataCopy = 
std::make_unique(newName, *rxNamedDB);
 pDataCopy->UpdateMoveTab(nOldPos, nNewPos);
 pDataCopy->SetIndex(0);
-maNamedDBs.insert(std::move(pDataCopy));
+(void)maNamedDBs.insert(std::move(pDataCopy));
 }
 }
 
commit 68060a0213abbb9a6e16358f8deea4980dd22565
Author: Caolán McNamara 
AuthorDate: Sun Jun 2 12:11:43 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sun Jun 2 22:46:39 2024 +0200

cid#1602445 silence Uncaught exception

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

diff --git a/sd/source/ui/view/ToolBarManager.cxx 
b/sd/source/ui/view/ToolBarManager.cxx
index 545b3b748685..c8f40b99a0ef 100644
--- a/sd/source/ui/view/ToolBarManager.cxx
+++ b/sd/source/ui/view/ToolBarManager.cxx
@@ -287,7 +287,7 @@ public:
 public:
 explicit UpdateLockImplementation (Implementation& rImplementation)
 : mrImplementation(rImplementation) { 
mrImplementation.LockUpdate();  }
-~UpdateLockImplementation() { mrImplementation.UnlockUpdate(); }
+~UpdateLockImplementation() { 
suppress_fun_call_w_exception(mrImplementation.UnlockUpdate()); }
 private:
 Implementation& mrImplementation;
 };


core.git: 2 commits - sc/source sw/source

2024-06-01 Thread Noel Grandin (via logerrit)
 sc/source/ui/docshell/datastream.cxx  |2 
 sc/source/ui/docshell/dbdocimp.cxx|2 
 sc/source/ui/docshell/docfunc.cxx |8 -
 sc/source/ui/docshell/docsh.cxx   |   62 
 sc/source/ui/docshell/docsh2.cxx  |2 
 sc/source/ui/docshell/docsh3.cxx  |4 
 sc/source/ui/docshell/docsh4.cxx  |   14 -
 sc/source/ui/docshell/docsh5.cxx  |2 
 sc/source/ui/docshell/docsh8.cxx  |4 
 sc/source/ui/docshell/externalrefmgr.cxx  |2 
 sc/source/ui/docshell/impex.cxx   |6 
 sc/source/ui/docshell/macromgr.cxx|2 
 sc/source/ui/docshell/tablink.cxx |4 
 sc/source/ui/docshell/tpstat.cxx  |   12 -
 sw/source/filter/basflt/fltini.cxx|6 
 sw/source/filter/basflt/iodetect.cxx  |   12 -
 sw/source/filter/docx/swdocxreader.cxx|4 
 sw/source/filter/html/SwAppletImpl.cxx|   14 -
 sw/source/filter/html/htmlatr.cxx |2 
 sw/source/filter/html/htmlcss1.cxx|   10 -
 sw/source/filter/html/htmlflywriter.cxx   |8 -
 sw/source/filter/html/htmlform.cxx|  126 -
 sw/source/filter/html/htmlforw.cxx|  102 ++---
 sw/source/filter/html/htmlplug.cxx|   60 
 sw/source/filter/html/htmlreqifreader.cxx |   12 -
 sw/source/filter/html/swhtml.cxx  |8 -
 sw/source/filter/html/wrthtml.cxx |   40 ++---
 sw/source/filter/inc/IndexingExportFilter.hxx |4 
 sw/source/filter/rtf/swparrtf.cxx |4 
 sw/source/filter/xml/swxml.cxx|   70 -
 sw/source/filter/xml/wrtxml.cxx   |   68 -
 sw/source/filter/xml/xmlexp.cxx   |   26 +--
 sw/source/filter/xml/xmlfmt.cxx   |6 
 sw/source/filter/xml/xmlimp.cxx   |  190 +-
 sw/source/filter/xml/xmltble.cxx  |8 -
 sw/source/filter/xml/xmltbli.cxx  |   10 -
 sw/source/filter/xml/xmltexte.cxx |   34 ++--
 sw/source/filter/xml/xmltexti.cxx |   32 ++--
 sw/source/filter/xml/zorder.hxx   |6 
 39 files changed, 494 insertions(+), 494 deletions(-)

New commits:
commit 832211d7c5803d38997dddff55632ae0e582f5fc
Author: Noel Grandin 
AuthorDate: Sat Jun 1 10:27:38 2024 +0200
Commit: Noel Grandin 
CommitDate: Sat Jun 1 17:38:39 2024 +0200

loplugin:ostr in sc/../docshell

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

diff --git a/sc/source/ui/docshell/datastream.cxx 
b/sc/source/ui/docshell/datastream.cxx
index 998985bb78ff..6d28fff40fdc 100644
--- a/sc/source/ui/docshell/datastream.cxx
+++ b/sc/source/ui/docshell/datastream.cxx
@@ -249,7 +249,7 @@ void DataStream::MakeToolbarVisible()
 return;
 
 css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
-xPropSet->getPropertyValue("LayoutManager") >>= xLayoutManager;
+xPropSet->getPropertyValue(u"LayoutManager"_ustr) >>= xLayoutManager;
 if (!xLayoutManager.is())
 return;
 
diff --git a/sc/source/ui/docshell/dbdocimp.cxx 
b/sc/source/ui/docshell/dbdocimp.cxx
index 92f5d55376a8..70616d9382b5 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -79,7 +79,7 @@ void ScDBDocFunc::ShowInBeamer( const ScImportParam& rParam, 
const SfxViewFrame*
 uno::Reference xFrame = 
pFrame->GetFrame().GetFrameInterface();
 
 uno::Reference xBeamerFrame = xFrame->findFrame(
-"_beamer",
+u"_beamer"_ustr,
 frame::FrameSearchFlag::CHILDREN);
 if (!xBeamerFrame.is())
 return;
diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index 6e3e050b8366..61dc9d5603ae 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -3201,7 +3201,7 @@ static uno::Reference< uno::XInterface > 
GetDocModuleObject( const SfxObjectShel
 uno::Reference< uno::XInterface > xDocModuleApiObject;
 if ( xSF.is() )
 {
-xVBACodeNamedObjectAccess.set( 
xSF->createInstance("ooo.vba.VBAObjectModuleObjectProvider"), uno::UNO_QUERY );
+xVBACodeNamedObjectAccess.set( 
xSF->createInstance(u"ooo.vba.VBAObjectModuleObjectProvider"_ustr), 
uno::UNO_QUERY );
 xDocModuleApiObject.set( xVBACodeNamedObjectAccess->getByName( 
sCodeName ), uno::UNO_QUERY );
 }
 return xDocModuleApiObject;
@@ -3225,7 +3225,7 @@ void VBA_InsertModule( ScDocument& rDoc, SCTAB nTab, 
const OUString& sSource )
 uno::Reference< container::XNameContainer > xLib;
 if( xLibContainer.is() )
 {
-OUString aLibName( "Standard" );
+

core.git: 2 commits - sc/source sw/inc sw/source

2024-06-01 Thread Noel Grandin (via logerrit)
 sc/source/ui/drawfunc/chartsh.cxx |4 +--
 sc/source/ui/drawfunc/drawsh.cxx  |2 -
 sc/source/ui/drawfunc/drawsh2.cxx |   14 ++---
 sc/source/ui/drawfunc/drawsh5.cxx |   16 +++
 sc/source/ui/drawfunc/drformsh.cxx|4 +--
 sc/source/ui/drawfunc/drtxtob.cxx |4 +--
 sc/source/ui/drawfunc/drtxtob1.cxx|2 -
 sc/source/ui/drawfunc/fudraw.cxx  |2 -
 sc/source/ui/drawfunc/fuins1.cxx  |4 +--
 sc/source/ui/drawfunc/fuins2.cxx  |   16 +++
 sc/source/ui/drawfunc/fusel.cxx   |2 -
 sc/source/ui/drawfunc/graphsh.cxx |8 +++
 sc/source/ui/drawfunc/mediash.cxx |2 -
 sc/source/ui/drawfunc/oleobjsh.cxx|4 +--
 sw/inc/docary.hxx |6 +++--
 sw/source/core/doc/DocumentRedlineManager.cxx |7 +-
 sw/source/core/doc/docredln.cxx   |   27 ++
 17 files changed, 79 insertions(+), 45 deletions(-)

New commits:
commit ec49191e58df2f5cb37e2608f3262e9604385fb0
Author: Noel Grandin 
AuthorDate: Fri May 31 09:57:45 2024 +0200
Commit: Noel Grandin 
CommitDate: Sat Jun 1 10:23:29 2024 +0200

loplugin:ostr in sc/../drawfunc

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

diff --git a/sc/source/ui/drawfunc/chartsh.cxx 
b/sc/source/ui/drawfunc/chartsh.cxx
index e6378a5fa9cb..7a0a63b76195 100644
--- a/sc/source/ui/drawfunc/chartsh.cxx
+++ b/sc/source/ui/drawfunc/chartsh.cxx
@@ -61,7 +61,7 @@ void ScChartShell::InitInterface_Impl()
 SfxVisibilityFlags::Standard | 
SfxVisibilityFlags::Server,
 ToolbarId::Draw_Objectbar);
 
-GetStaticInterface()->RegisterPopupMenu("oleobject");
+GetStaticInterface()->RegisterPopupMenu(u"oleobject"_ustr);
 }
 
 void ScChartShell::Activate(bool bMDI)
@@ -97,7 +97,7 @@ void ScChartShell::Deactivate(bool bMDI)
 ScChartShell::ScChartShell(ScViewData& rData) :
 ScDrawShell(rData)
 {
-SetName( "ChartObject" );
+SetName( u"ChartObject"_ustr );
 
SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Chart));
 }
 
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 2e11d3817ee5..53ca99000933 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -92,7 +92,7 @@ void ScDrawShell::InitInterface_Impl()
 SfxVisibilityFlags::Standard | 
SfxVisibilityFlags::Server,
 ToolbarId::Draw_Objectbar);
 
-GetStaticInterface()->RegisterPopupMenu("draw");
+GetStaticInterface()->RegisterPopupMenu(u"draw"_ustr);
 
 
GetStaticInterface()->RegisterChildWindow(SvxFontWorkChildWindow::GetChildWindowId());
 }
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx 
b/sc/source/ui/drawfunc/drawsh2.cxx
index fddc50fe5c13..418d92d00f32 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -72,7 +72,7 @@ ScDrawShell::ScDrawShell( ScViewData& rData ) :
 {
 pMgr->SetMaxUndoActionCount( 0 );
 }
-SetName("Drawing");
+SetName(u"Drawing"_ustr);
 
 mpSelectionChangeHandler->Connect();
 }
@@ -341,12 +341,12 @@ static void setupFillColorForChart(const SfxViewShell* 
pShell, SfxItemSet& rSet)
 if (!xInfo.is())
 return;
 
-if (xInfo->hasPropertyByName("FillColor"))
+if (xInfo->hasPropertyByName(u"FillColor"_ustr))
 {
 sal_uInt32 nFillColor = 0;
-xPropSet->getPropertyValue("FillColor") >>= nFillColor;
+xPropSet->getPropertyValue(u"FillColor"_ustr) >>= nFillColor;
 
-XFillColorItem aFillColorItem("", Color(ColorTransparency, 
nFillColor));
+XFillColorItem aFillColorItem(u""_ustr, Color(ColorTransparency, 
nFillColor));
 rSet.Put(aFillColorItem);
 
 if (comphelper::LibreOfficeKit::isActive())
@@ -354,11 +354,11 @@ static void setupFillColorForChart(const SfxViewShell* 
pShell, SfxItemSet& rSet)
 (".uno:FillColor=" + OString::number(nFillColor)));
 }
 
-if (!(comphelper::LibreOfficeKit::isActive() && 
xInfo->hasPropertyByName("FillGradientName")))
+if (!(comphelper::LibreOfficeKit::isActive() && 
xInfo->hasPropertyByName(u"FillGradientName"_ustr)))
 return;
 
 OUString aGradientName;
-xPropSet->getPropertyValue("FillGradientName") >>= aGradientName;
+xPropSet->getPropertyValue(u"FillGradientName"_ustr) >>= aGradientName;
 
 ::css::uno::Reference< ::css::frame::XController > xChartController = 
xChart->getCurrentController();
 if( !xChartController.is() )
@@ -370,7 +370,7 @@ static void setupFillColorForChart(const 

core.git: 2 commits - sc/source sw/source

2024-05-30 Thread Noel Grandin (via logerrit)
 sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx|   56 ++--
 sc/source/ui/StatisticsDialogs/ChiSquareTestDialog.cxx |   10 
 sc/source/ui/StatisticsDialogs/CorrelationDialog.cxx   |4 
 sc/source/ui/StatisticsDialogs/CovarianceDialog.cxx|4 
 sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx |4 
 sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx  |6 
 sc/source/ui/StatisticsDialogs/FTestDialog.cxx |   26 +-
 sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx   |   18 -
 sc/source/ui/StatisticsDialogs/MovingAverageDialog.cxx |   10 
 sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx |   34 +-
 sc/source/ui/StatisticsDialogs/RegressionDialog.cxx|  130 
+-
 sc/source/ui/StatisticsDialogs/SamplingDialog.cxx  |   30 +-
 sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx |   20 -
 sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx |   26 +-
 sc/source/ui/StatisticsDialogs/TTestDialog.cxx |   18 -
 sc/source/ui/StatisticsDialogs/ZTestDialog.cxx |   26 +-
 sw/source/core/edit/edattr.cxx |   10 
 17 files changed, 214 insertions(+), 218 deletions(-)

New commits:
commit be568bf78939942153294727556a466e235e04d3
Author: Noel Grandin 
AuthorDate: Thu May 30 10:06:22 2024 +0200
Commit: Noel Grandin 
CommitDate: Thu May 30 17:21:38 2024 +0200

loplugin:ostr in sc/../StatisticsDialogs

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

diff --git a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx 
b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
index 6f1fccd9cb0d..acfab698b601 100644
--- a/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx
@@ -90,13 +90,13 @@ ScAnalysisOfVarianceDialog::ScAnalysisOfVarianceDialog(
 weld::Window* pParent, ScViewData& rViewData )
 : ScStatisticsInputOutputDialog(
 pSfxBindings, pChildWindow, pParent, rViewData,
-"modules/scalc/ui/analysisofvariancedialog.ui",
-"AnalysisOfVarianceDialog")
+u"modules/scalc/ui/analysisofvariancedialog.ui"_ustr,
+u"AnalysisOfVarianceDialog"_ustr)
 , meFactor(SINGLE_FACTOR)
-, mxAlphaField(m_xBuilder->weld_spin_button("alpha-spin"))
-, mxSingleFactorRadio(m_xBuilder->weld_radio_button("radio-single-factor"))
-, mxTwoFactorRadio(m_xBuilder->weld_radio_button("radio-two-factor"))
-, 
mxRowsPerSampleField(m_xBuilder->weld_spin_button("rows-per-sample-spin"))
+, mxAlphaField(m_xBuilder->weld_spin_button(u"alpha-spin"_ustr))
+, 
mxSingleFactorRadio(m_xBuilder->weld_radio_button(u"radio-single-factor"_ustr))
+, mxTwoFactorRadio(m_xBuilder->weld_radio_button(u"radio-two-factor"_ustr))
+, 
mxRowsPerSampleField(m_xBuilder->weld_spin_button(u"rows-per-sample-spin"_ustr))
 {
 mxSingleFactorRadio->connect_toggled( LINK( this, 
ScAnalysisOfVarianceDialog, FactorChanged ) );
 mxTwoFactorRadio->connect_toggled( LINK( this, ScAnalysisOfVarianceDialog, 
FactorChanged ) );
@@ -188,7 +188,7 @@ void 
ScAnalysisOfVarianceDialog::AnovaSingleFactor(AddressWalkerWriter& output,
 output.writeString(ScResId(STR_LABEL_ALPHA));
 output.nextColumn();
 output.writeValue(aAlphaValue);
-aTemplate.autoReplaceAddress("%ALPHA%", output.current());
+aTemplate.autoReplaceAddress(u"%ALPHA%"_ustr, output.current());
 output.newLine();
 output.newLine();
 
@@ -232,7 +232,7 @@ void 
ScAnalysisOfVarianceDialog::AnovaSingleFactor(AddressWalkerWriter& output,
 }
 output.nextRow();
 
-aTemplate.autoReplaceRange("%FIRST_COLUMN%", aRangeList[0]);
+aTemplate.autoReplaceRange(u"%FIRST_COLUMN%"_ustr, aRangeList[0]);
 
 // Between Groups
 {
@@ -243,26 +243,26 @@ void 
ScAnalysisOfVarianceDialog::AnovaSingleFactor(AddressWalkerWriter& output,
 
 // Sum of Squares
 
aTemplate.setTemplate("=SUMPRODUCT(%SUM_RANGE%;%MEAN_RANGE%)-SUM(%SUM_RANGE%)^2/SUM(%COUNT_RANGE%)");
-aTemplate.autoReplaceAddress("%BETWEEN_SS%", output.current());
+aTemplate.autoReplaceAddress(u"%BETWEEN_SS%"_ustr, output.current());
 output.writeFormula(aTemplate.getTemplate());
 output.nextColumn();
 
 // Degree of freedom
 aTemplate.setTemplate("=COUNT(%SUM_RANGE%)-1");
-aTemplate.autoReplaceAddress("%BETWEEN_DF%", output.current());
+aTemplate.autoReplaceAddress(u"%BETWEEN_DF%"_ustr, output.current());
 output.writeFormula(aTemplate.getTemplate());
 output.nextColumn();
 
 // MS
 aTemplate.setTemplate("=%BETWEEN_SS% / %BETWEEN_DF%");
-

core.git: 2 commits - sc/source

2024-05-26 Thread Caolán McNamara (via logerrit)
 sc/source/filter/ftools/ftools.cxx |   13 -
 1 file changed, 13 deletions(-)

New commits:
commit 07a372592cea4bded282b2ad9a67ca9e7b08c3cd
Author: Caolán McNamara 
AuthorDate: Sun May 26 15:06:56 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sun May 26 20:18:43 2024 +0200

drop unused __SIMPLE_FUNC

presumably unused since:

commit a3ce60eb3c8bb5c69ab41556398efa8316286477
Date:   Tue Nov 27 14:41:16 2012 +0200

We only support MSVC 2008 (_MSC_VER 1500) or later

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

diff --git a/sc/source/filter/ftools/ftools.cxx 
b/sc/source/filter/ftools/ftools.cxx
index 2f52cb183e99..d3145e537429 100644
--- a/sc/source/filter/ftools/ftools.cxx
+++ b/sc/source/filter/ftools/ftools.cxx
@@ -40,20 +40,6 @@
 // ScFilterTools::ReadLongDouble()
 
 void ScfTools::ReadLongDouble(SvStream& rStrm, double& fResult)
-
-#ifdef __SIMPLE_FUNC// for <=VC 1.5
-
-#error PRESUMABLY_NEVER_USED
-{
-long double fRet;
-bool bOk = 10 == rStrm.Read(, 10);
-if (!bOk)
-return;
-fResult = static_cast(fRet);
-}
-#undef __SIMPLE_FUNC
-
-#else   // detailed for all others
 {
 
 /*
@@ -111,7 +97,6 @@ SEEE  IMMM    
  
 
 fResult = static_cast(lfDouble);
 }
-#endif
 
 // *** common methods *** -
 
commit 3a647dd08e29dfb18382ede5506e913e8bd3bc04
Author: Caolán McNamara 
AuthorDate: Sun May 26 15:04:50 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sun May 26 20:18:36 2024 +0200

presumably __SIMPLE_FUNC is unused

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

diff --git a/sc/source/filter/ftools/ftools.cxx 
b/sc/source/filter/ftools/ftools.cxx
index bf2b784a994b..2f52cb183e99 100644
--- a/sc/source/filter/ftools/ftools.cxx
+++ b/sc/source/filter/ftools/ftools.cxx
@@ -42,6 +42,8 @@
 void ScfTools::ReadLongDouble(SvStream& rStrm, double& fResult)
 
 #ifdef __SIMPLE_FUNC// for <=VC 1.5
+
+#error PRESUMABLY_NEVER_USED
 {
 long double fRet;
 bool bOk = 10 == rStrm.Read(, 10);


core.git: 2 commits - sc/source

2024-05-24 Thread Caolán McNamara (via logerrit)
 sc/source/ui/undo/undotab.cxx |   51 --
 1 file changed, 25 insertions(+), 26 deletions(-)

New commits:
commit b227481b63000b556e648ad607ffeb86681482a0
Author: Caolán McNamara 
AuthorDate: Fri May 24 19:30:51 2024 +0100
Commit: Caolán McNamara 
CommitDate: Fri May 24 22:34:25 2024 +0200

pViewShell arg is never null, just use a reference here

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

diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index 3cdeaeed1f76..43f647debbd9 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -63,16 +63,16 @@ using ::std::vector;
 
 namespace
 {
-void lcl_OnTabsChanged(const ScTabViewShell* pViewShell, const ScDocument& 
rDoc, SCTAB nTab, bool bInvalidateTiles = false)
+void lcl_OnTabsChanged(const ScTabViewShell& rViewShell, const ScDocument& 
rDoc, SCTAB nTab, bool bInvalidateTiles = false)
 {
 for (SCTAB nTabIndex = nTab; nTabIndex < rDoc.GetTableCount(); ++nTabIndex)
 {
 if (!rDoc.IsVisible(nTabIndex))
 continue;
 if (bInvalidateTiles)
-pViewShell->libreOfficeKitViewInvalidateTilesCallback(nullptr, 
nTabIndex, 0);
+rViewShell.libreOfficeKitViewInvalidateTilesCallback(nullptr, 
nTabIndex, 0);
 ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
-pViewShell,
+,
 true /* bColsAffected */, true /* bRowsAffected */,
 true /* bSizes*/, true /* bHidden */, true /* bFiltered */,
 true /* bGroups */, nTabIndex);
@@ -99,7 +99,7 @@ void lcl_MakeJsonArray(tools::JsonWriter& rJson, const 
std::vector& v, const
 }
 }
 
-void lcl_UndoCommandResult(const ScTabViewShell* pViewShell,
+void lcl_UndoCommandResult(const ScTabViewShell& rViewShell,
const char *pCmdName, const char *pCmdType,
const std::vector* pNewTabs,
const std::vector* pOldTabs = nullptr)
@@ -116,7 +116,7 @@ void lcl_UndoCommandResult(const ScTabViewShell* pViewShell,
 lcl_MakeJsonArray(aJson, *pOldTabs, "oldTabs");
 }
 
-pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_UNO_COMMAND_RESULT, 
aJson.finishAndGetAsOString());
+rViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_UNO_COMMAND_RESULT, 
aJson.finishAndGetAsOString());
 }
 }
 
@@ -183,9 +183,9 @@ void ScUndoInsertTab::Undo()
 if (comphelper::LibreOfficeKit::isActive())
 {
 ScDocument& rDoc = pDocShell->GetDocument();
-lcl_OnTabsChanged(pViewShell, rDoc, nTab);
+lcl_OnTabsChanged(*pViewShell, rDoc, nTab);
 std::vector aTabs{nTab};
-lcl_UndoCommandResult(pViewShell, ".uno:Undo", "ScUndoInsertTab", 
);
+lcl_UndoCommandResult(*pViewShell, ".uno:Undo", "ScUndoInsertTab", 
);
 
 }
 
@@ -218,9 +218,9 @@ void ScUndoInsertTab::Redo()
 if (comphelper::LibreOfficeKit::isActive())
 {
 ScDocument& rDoc = pDocShell->GetDocument();
-lcl_OnTabsChanged(pViewShell, rDoc, nTab);
+lcl_OnTabsChanged(*pViewShell, rDoc, nTab);
 std::vector aTabs{nTab};
-lcl_UndoCommandResult(pViewShell, ".uno:Redo", "ScUndoInsertTab", 
);
+lcl_UndoCommandResult(*pViewShell, ".uno:Redo", "ScUndoInsertTab", 
);
 }
 }
 
@@ -450,8 +450,8 @@ void ScUndoDeleteTab::Undo()
 {
 if (pViewShell)
 {
-lcl_OnTabsChanged(pViewShell, rDoc, theTabs[0]);
-lcl_UndoCommandResult(pViewShell, ".uno:Undo", "ScUndoDeleteTab", 
);
+lcl_OnTabsChanged(*pViewShell, rDoc, theTabs[0]);
+lcl_UndoCommandResult(*pViewShell, ".uno:Undo", "ScUndoDeleteTab", 
);
 }
 }
 
@@ -493,8 +493,8 @@ void ScUndoDeleteTab::Redo()
 if (comphelper::LibreOfficeKit::isActive() && !theTabs.empty())
 {
 ScDocument& rDoc = pDocShell->GetDocument();
-lcl_OnTabsChanged(pViewShell, rDoc, theTabs[0]);
-lcl_UndoCommandResult(pViewShell, ".uno:Redo", "ScUndoDeleteTab", 
);
+lcl_OnTabsChanged(*pViewShell, rDoc, theTabs[0]);
+lcl_UndoCommandResult(*pViewShell, ".uno:Redo", "ScUndoDeleteTab", 
);
 }
 
 //  SetTabNo(...,sal_True) for all views to sync with drawing layer pages
@@ -653,8 +653,8 @@ void ScUndoMoveTab::DoChange( bool bUndo ) const
 const auto newTabsMinIt = std::min_element(mpNewTabs->begin(), 
mpNewTabs->end());
 const auto oldTabsMinIt = std::min_element(mpOldTabs->begin(), 
mpOldTabs->end());
 SCTAB nTab = std::min(*newTabsMinIt, *oldTabsMinIt);
-lcl_OnTabsChanged(pViewShell, rDoc, nTab, true /* bInvalidateTiles */);
-lcl_UndoCommandResult(pViewShell, bUndo ? ".uno:Undo" : ".uno:Redo", 
"ScUndoMoveTab", mpOldTabs.get(), mpNewTabs.get());
+lcl_OnTabsChanged(*pViewShell, rDoc, 

core.git: 2 commits - sc/source sfx2/qa

2024-05-15 Thread Caolán McNamara (via logerrit)
 sc/source/ui/docshell/docsh6.cxx |2 +-
 sfx2/qa/cppunit/view.cxx |4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit b5835c23cdf533be015e64d61ce1df250180f1fb
Author: Caolán McNamara 
AuthorDate: Wed May 15 11:32:57 2024 +0100
Commit: Caolán McNamara 
CommitDate: Wed May 15 20:46:29 2024 +0200

WaE: C6011 Dereferencing NULL pointer warnings

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

diff --git a/sfx2/qa/cppunit/view.cxx b/sfx2/qa/cppunit/view.cxx
index e0e8c69b2a36..9141e4fba36b 100644
--- a/sfx2/qa/cppunit/view.cxx
+++ b/sfx2/qa/cppunit/view.cxx
@@ -43,7 +43,9 @@ CPPUNIT_TEST_FIXTURE(Sfx2ViewTest, testReloadPage)
 aSet.Put(SfxInt32Item(SID_PAGE_NUMBER, 1));
 SfxRequest aReq(SID_RELOAD, SfxCallMode::SLOT, aSet);
 pFrame->ExecReload_Impl(aReq);
-uno::Reference xModel = 
SfxObjectShell::Current()->GetBaseModel();
+SfxObjectShell* pDocSh = SfxObjectShell::Current();
+CPPUNIT_ASSERT(pDocSh);
+uno::Reference xModel = pDocSh->GetBaseModel();
 mxComponent = xModel;
 
 // Check the current page after reload.
commit d5ff0410e7df5ca95ec3076386881e49eb46ddca
Author: Szymon Kłos 
AuthorDate: Tue May 7 15:33:21 2024 +0200
Commit: Caolán McNamara 
CommitDate: Wed May 15 20:46:16 2024 +0200

lok: don't show separator conversion dialog

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

Change-Id: I5a37865dbe63bca0c55205b59be3a64ceb824b17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167281
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Gökay ŞATIR 
(cherry picked from commit 83269aa84a0af8b9a32424af6b01815aaad4f42a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167672
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

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


core.git: 2 commits - sc/source test/source

2024-05-12 Thread Caolán McNamara (via logerrit)
 sc/source/ui/app/inputhdl.cxx|9 -
 sc/source/ui/docshell/docsh5.cxx |9 -
 test/source/diff/diff.cxx|2 ++
 test/source/xmltesttools.cxx |6 ++
 4 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit 034eb5078096d146fb5c5e6246a407f2aad09094
Author: Caolán McNamara 
AuthorDate: Sun May 12 12:52:14 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sun May 12 17:21:40 2024 +0200

help msvc -analyzer out wrt C6011 Dereferencing NULL pointer

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

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 6dd8315e7b4e..1c1aaf06963d 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -4227,6 +4227,13 @@ void ScInputHandler::InputCommand( const CommandEvent& 
rCEvt )
 }
 }
 
+static ScInputHdlState* getLastState(const ScInputHdlState* pState)
+{
+if (!pState)
+return nullptr;
+return new ScInputHdlState(*pState);
+}
+
 void ScInputHandler::NotifyChange( const ScInputHdlState* pState,
bool bForce, ScTabViewShell* pSourceSh,
bool bStopEditing)
@@ -4260,7 +4267,7 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* 
pState,
 
 if ( pState != pLastState.get() )
 {
-pLastState.reset( pState ? new ScInputHdlState( *pState ) : nullptr);
+pLastState.reset(getLastState(pState));
 }
 
 if ( pState && pActiveViewSh )
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 63bb94408eba..1b2ddf216b9f 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -508,6 +508,13 @@ static OUString lcl_GetAreaName( ScDocument* pDoc, const 
ScArea* pArea )
 return aName;
 }
 
+static ScDBData* getUndoData(ScDBData* pDestData)
+{
+if (!pDestData)
+return nullptr;
+return new ScDBData(*pDestData);
+}
+
 void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord 
)
 {
 ScConsData aData;
@@ -568,7 +575,7 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& 
rParam, bool bRecord )
 aData.GetSize( nColSize, nRowSize );
 if (bRecord && nColSize > 0 && nRowSize > 0)
 {
-std::unique_ptr pUndoData(pDestData ? new 
ScDBData(*pDestData) : nullptr);
+std::unique_ptr pUndoData(getUndoData(pDestData));
 
 SCTAB nDestTab = rParam.nTab;
 ScArea aDestArea( rParam.nTab, rParam.nCol, rParam.nRow,
commit 512e28bf8d10f9246df2d535f92c1ccef1628192
Author: Caolán McNamara 
AuthorDate: Sun May 12 12:00:27 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sun May 12 17:21:32 2024 +0200

WaE: C6011 Dereferencing NULL pointer warnings

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

diff --git a/test/source/diff/diff.cxx b/test/source/diff/diff.cxx
index 097452665308..dac6c1e4ed01 100644
--- a/test/source/diff/diff.cxx
+++ b/test/source/diff/diff.cxx
@@ -284,6 +284,8 @@ bool compareValuesWithTolerance(double val1, double val2, 
double tolerance, bool
 
 bool XMLDiff::compareAttributes(xmlNodePtr node1, xmlNodePtr node2)
 {
+CPPUNIT_ASSERT(node1);
+CPPUNIT_ASSERT(node2);
 xmlAttrPtr attr1 = nullptr;
 xmlAttrPtr attr2 = nullptr;
 for(attr1 = node1->properties, attr2 = node2->properties; attr1 != nullptr 
&& attr2 != nullptr; attr1 = attr1->next, attr2 = attr2->next)
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index b0e4cf48e989..22fa266a966d 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -92,6 +92,7 @@ OUString XmlTestTools::getXPath(const xmlDocUniquePtr& 
pXmlDoc, const OString& r
 xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath);
 CPPUNIT_ASSERT(pXmlObj);
 xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+CPPUNIT_ASSERT(pXmlNodes);
 CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OString::Concat("In <") + 
pXmlDoc->name + ">, XPath '" + rXPath + "' number of nodes is 
incorrect").getStr(),
  1, xmlXPathNodeSetGetLength(pXmlNodes));
 CPPUNIT_ASSERT(!rAttribute.isEmpty());
@@ -240,6 +241,7 @@ void XmlTestTools::assertXPathChildren(const 
xmlDocUniquePtr& pXmlDoc, const OSt
 #if LIBXML_VERSION >= 20703 /* xmlChildElementCount is only available in 
libxml2 >= 2.7.3 */
 xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath);
 xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+CPPUNIT_ASSERT(pXmlNodes);
 CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OString::Concat("In <") + 
pXmlDoc->name + ">, XPath '" + rXPath + "' number of nodes is 
incorrect").getStr(),
  1, 

core.git: 2 commits - sc/source

2024-05-10 Thread Gökay Şatır (via logerrit)
 sc/source/core/data/markdata.cxx  |   12 +++--
 sc/source/core/data/markmulti.cxx |   47 --
 sc/source/core/tool/address.cxx   |   42 +++--
 sc/source/ui/docshell/docfunc.cxx |8 +++---
 sc/source/ui/view/viewfunc.cxx|   28 --
 5 files changed, 68 insertions(+), 69 deletions(-)

New commits:
commit 8ab95722bc2e64a8cc1fd6b5aa36ecc599a8e1b6
Author: Gökay Şatır 
AuthorDate: Mon Oct 30 12:37:23 2023 +0300
Commit: Gökay ŞATIR 
CommitDate: Fri May 10 08:07:11 2024 +0200

Fix row deletion bug.

When multiple users are editing a Calc document:
* If one user selects a whole row and another one deletes a range of rows 
including or above the selected row, app crashes.
* This PR fixes the crash.
* Also when multiple rows are deleted, other user's selected row is moved 
only one row. This PR moves the selected row according to the deleted row count.
* The cursor position was also causing a crash, fixed.

Signed-off-by: Gökay Şatır 
Change-Id: Ie4b893fee7192492efacbb167b747434336384e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158650
Reviewed-by: Marco Cecchetti 
Tested-by: Marco Cecchetti 
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167374
Tested-by: Jenkins

diff --git a/sc/source/core/data/markdata.cxx b/sc/source/core/data/markdata.cxx
index afc875983ab1..98a3aebe5c8b 100644
--- a/sc/source/core/data/markdata.cxx
+++ b/sc/source/core/data/markdata.cxx
@@ -670,13 +670,11 @@ void ScMarkData::ShiftCols(const ScDocument& rDoc, SCCOL 
nStartCol, sal_Int32 nC
 void ScMarkData::ShiftRows(const ScDocument& rDoc, SCROW nStartRow, sal_Int32 
nRowOffset)
 {
 if (bMarked)
-{
 aMarkRange.IncRowIfNotLessThan(rDoc, nStartRow, nRowOffset);
-}
-else if (bMultiMarked)
+if (bMultiMarked)
 {
-aMultiSel.ShiftRows(nStartRow, nRowOffset);
 aMultiRange.IncRowIfNotLessThan(rDoc, nStartRow, nRowOffset);
+aMultiSel.ShiftRows(nStartRow, nRowOffset);
 }
 }
 
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index ba6f73f47bec..b976443fc649 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -2405,17 +2405,30 @@ void ScRange::IncColIfNotLessThan(const ScDocument& 
rDoc, SCCOL nStartCol, SCCOL
 
 void ScRange::IncRowIfNotLessThan(const ScDocument& rDoc, SCROW nStartRow, 
SCROW nOffset)
 {
-if (aStart.Row() >= nStartRow)
+SCROW offset;
+if (aStart.Row() > nStartRow)
 {
-aStart.IncRow(nOffset);
+offset = nOffset;
+if (nStartRow + nOffset > aStart.Row())
+offset = aStart.Row() - nStartRow;
+else if (nStartRow - nOffset > aStart.Row())
+offset = -1 * (aStart.Row() - nStartRow);
+
+aStart.IncRow(offset);
 if (aStart.Row() < 0)
 aStart.SetRow(0);
 else if(aStart.Row() > rDoc.MaxRow())
 aStart.SetRow(rDoc.MaxRow());
 }
-if (aEnd.Row() >= nStartRow)
+if (aEnd.Row() > nStartRow)
 {
-aEnd.IncRow(nOffset);
+offset = nOffset;
+if (nStartRow + nOffset > aEnd.Row())
+offset = aEnd.Row() - nStartRow;
+else if (nStartRow - nOffset > aEnd.Row())
+offset = -1 * (aEnd.Row() - nStartRow);
+
+aEnd.IncRow(offset);
 if (aEnd.Row() < 0)
 aEnd.SetRow(0);
 else if(aEnd.Row() > rDoc.MaxRow())
diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index 55f9c209f599..556cd6e6c940 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -2280,7 +2280,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const 
ScMarkData* pTabMark,
 
 if (bInsertRows)
 {
-pViewSh->OnLOKInsertDeleteRow(rRange.aStart.Row(), 1);
+pViewSh->OnLOKInsertDeleteRow(rRange.aStart.Row() - (eCmd == 
INS_INSROWS_BEFORE ? 1: 0), 1);
 }
 }
 
@@ -2860,7 +2860,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const 
ScMarkData* pTabMark,
 }
 if (eCmd == DelCellCmd::Rows)
 {
-pViewSh->OnLOKInsertDeleteRow(rRange.aStart.Row(), -1);
+pViewSh->OnLOKInsertDeleteRow(rRange.aStart.Row(), -1 * 
(rRange.aEnd.Row() - rRange.aStart.Row() + 1));
 }
 }
 
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index d0945c76febc..679f60295aff 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1776,11 +1776,17 @@ void ScViewFunc::OnLOKInsertDeleteRow(SCROW nStartRow, 
tools::Long nOffset)
 if (pTabViewShell->getPart() == nCurrentTabIndex)
 {
 SCROW nY = pTabViewShell->GetViewData().GetCurY();
-if (nY > nStartRow || (nY == nStartRow && nOffset > 0))
+

core.git: 2 commits - sc/source

2024-05-06 Thread Caolán McNamara (via logerrit)
 sc/source/core/data/documen7.cxx   |4 ++--
 sc/source/core/data/documen8.cxx   |1 +
 sc/source/core/data/dptabres.cxx   |   12 
 sc/source/core/data/funcdesc.cxx   |2 +-
 sc/source/core/data/patattr.cxx|1 +
 sc/source/core/data/postit.cxx |2 +-
 sc/source/core/data/stlsheet.cxx   |1 +
 sc/source/core/tool/detfunc.cxx|8 
 sc/source/core/tool/interpr4.cxx   |1 +
 sc/source/filter/excel/xeescher.cxx|4 
 sc/source/filter/excel/xeformula.cxx   |3 +++
 sc/source/filter/excel/xistyle.cxx |2 +-
 sc/source/filter/ftools/fapihelper.cxx |2 +-
 sc/source/filter/html/htmlpars.cxx |8 
 sc/source/filter/inc/tool.h|2 +-
 sc/source/filter/lotus/filter.cxx  |3 +++
 sc/source/filter/xml/xmlexprt.cxx  |2 ++
 sc/source/ui/app/scmod.cxx |6 --
 sc/source/ui/condformat/condformatdlg.cxx  |8 +++-
 sc/source/ui/condformat/condformatdlgentry.cxx |8 +++-
 sc/source/ui/dbgui/validate.cxx|   13 +
 sc/source/ui/docshell/dbdocimp.cxx |2 +-
 sc/source/ui/docshell/docsh4.cxx   |4 ++--
 sc/source/ui/drawfunc/drawsh2.cxx  |1 +
 sc/source/ui/drawfunc/drawsh5.cxx  |4 ++--
 sc/source/ui/drawfunc/fuconstr.cxx |1 +
 sc/source/ui/drawfunc/fudraw.cxx   |1 +
 sc/source/ui/drawfunc/fusel.cxx|2 ++
 sc/source/ui/drawfunc/futext.cxx   |1 +
 sc/source/ui/miscdlgs/autofmt.cxx  |4 ++--
 sc/source/ui/navipi/content.cxx|6 +++---
 sc/source/ui/uitest/uiobject.cxx   |2 +-
 sc/source/ui/undo/undoblk.cxx  |2 +-
 sc/source/ui/unoobj/afmtuno.cxx|4 ++--
 sc/source/ui/vba/vbarange.cxx  |2 ++
 sc/source/ui/view/drawview.cxx |4 +++-
 sc/source/ui/view/gridwin5.cxx |2 +-
 sc/source/ui/view/output2.cxx  |2 +-
 sc/source/ui/view/tabview5.cxx |8 ++--
 sc/source/ui/view/viewfun7.cxx |2 +-
 sc/source/ui/xmlsource/xmlsourcedlg.cxx|   10 +-
 41 files changed, 105 insertions(+), 52 deletions(-)

New commits:
commit 18b70ec7d9c4a0288f206cb64708f87a83789c00
Author: Caolán McNamara 
AuthorDate: Sun May 5 20:54:59 2024 +0100
Commit: Caolán McNamara 
CommitDate: Mon May 6 12:23:47 2024 +0200

wrong ScContentTree::SelectEntryByName early return condition

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

diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index b4c772e201f3..b1e8841b359c 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -1499,7 +1499,7 @@ void ScContentTree::SelectEntryByName(const ScContentId 
nRoot, std::u16string_vi
 {
 weld::TreeIter* pParent = m_aRootNodes[nRoot].get();
 
-if (pParent || !m_xTreeView->iter_has_child(*pParent))
+if (!pParent || !m_xTreeView->iter_has_child(*pParent))
 return;
 
 std::unique_ptr 
xEntry(m_xTreeView->make_iterator(pParent));
commit 0cd07e1fb7afc0a6831eaafabcead7e0c5f7ac3b
Author: Caolán McNamara 
AuthorDate: Sun May 5 20:53:49 2024 +0100
Commit: Caolán McNamara 
CommitDate: Mon May 6 12:23:39 2024 +0200

WaE: C6011 Dereferencing NULL pointer warnings

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

diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index f69585167c66..6ebc5d51ef77 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -281,7 +281,7 @@ void ScDocument::PutInFormulaTree( ScFormulaCell* pCell )
 void ScDocument::RemoveFromFormulaTree( ScFormulaCell* pCell )
 {
 ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
-OSL_ENSURE( pCell, "RemoveFromFormulaTree: pCell Null" );
+assert(pCell && "RemoveFromFormulaTree: pCell Null");
 ScFormulaCell* pPrev = pCell->GetPrevious();
 assert(pPrev != pCell); // pointing to itself?!?
 // if the cell is first or somewhere in chain
@@ -468,7 +468,7 @@ void ScDocument::AppendToFormulaTrack( ScFormulaCell* pCell 
)
 
 void ScDocument::RemoveFromFormulaTrack( ScFormulaCell* pCell )
 {
-OSL_ENSURE( pCell, "RemoveFromFormulaTrack: pCell Null" );
+assert(pCell && "RemoveFromFormulaTrack: pCell Null");
 ScFormulaCell* pPrev = pCell->GetPreviousTrack();
 

core.git: 2 commits - sc/source svx/source

2024-04-23 Thread Noel Grandin (via logerrit)
 sc/source/ui/unoobj/cellvaluebinding.cxx|   23 +++
 svx/source/sdr/overlay/overlayselection.cxx |   10 ++
 2 files changed, 33 insertions(+)

New commits:
commit 1f86fdd4b5428a8c7b253051cca93429dc71f894
Author: Noel Grandin 
AuthorDate: Tue Apr 23 16:10:48 2024 +0200
Commit: Noel Grandin 
CommitDate: Tue Apr 23 18:50:35 2024 +0200

tdf#160787 Calc active cell cursor has small transparent corners

clearly I don't understand something about B2DPolyPolygon, revert part
of

commit 7b1405689d4246e0e37e8759f03e1962af964cec
Author: Noel Grandin 
Date:   Fri Apr 19 22:56:04 2024 +0200
reduce the number of drawing primitives we create in
OverlaySelection

Change-Id: If8f07d021543e2686a3acfc6a0d38b2ebc962de4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166543
Reviewed-by: Noel Grandin 

diff --git a/svx/source/sdr/overlay/overlayselection.cxx 
b/svx/source/sdr/overlay/overlayselection.cxx
index d4a7b45beb8f..a5598c1d2125 100644
--- a/svx/source/sdr/overlay/overlayselection.cxx
+++ b/svx/source/sdr/overlay/overlayselection.cxx
@@ -214,6 +214,16 @@ namespace sdr::overlay
 aRGBColor = basegfx::BColor(1.0, 1.0, 1.0);
 }
 
+aRetval.resize(nCount);
+for(sal_uInt32 a(0);a < nCount; a++)
+{
+basegfx::B2DPolygon 
aPolygon(basegfx::utils::createPolygonFromRect(maRanges[a]));
+aRetval[a] =
+new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+basegfx::B2DPolyPolygon(std::move(aPolygon)),
+aRGBColor);
+}
+
 basegfx::B2DPolyPolygon aPolyPolygon;
 aPolyPolygon.reserve(nCount);
 for(sal_uInt32 a(0);a < nCount; a++)
commit 979164938007e4774b7718abcb20fded9a00839f
Author: Noel Grandin 
AuthorDate: Tue Apr 23 15:31:37 2024 +0200
Commit: Noel Grandin 
CommitDate: Tue Apr 23 18:50:20 2024 +0200

tdf#160768 Changing value in a text box control with a link cell set up, 
Crash

regression from
commit 7510cca63690ea97eb02a43f698fc183c3d0434a
Author: Noel Grandin 
Date:   Tue Mar 26 15:56:02 2024 +0200
convert OCellValueBinding to comphelper::WeakComponentImplHelper

Change-Id: I36ec4cca7a48992b29d6c2ff5c87fb0fed1c8c3f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166540
Reviewed-by: Noel Grandin 

diff --git a/sc/source/ui/unoobj/cellvaluebinding.cxx 
b/sc/source/ui/unoobj/cellvaluebinding.cxx
index d1fa61175557..c728f503a856 100644
--- a/sc/source/ui/unoobj/cellvaluebinding.cxx
+++ b/sc/source/ui/unoobj/cellvaluebinding.cxx
@@ -286,7 +286,12 @@ namespace calc
 OUString sText;
 aValue >>= sText;
 if ( m_xCellText.is() )
+{
+// might call back into us via modified(EventObject&)
+aGuard.unlock();
 m_xCellText->setString( sText );
+aGuard.lock();
+}
 }
 break;
 
@@ -302,7 +307,12 @@ namespace calc
 double nCellValue = bValue ? 1.0 : 0.0;
 
 if ( m_xCell.is() )
+{
+// might call back into us via modified(EventObject&)
+aGuard.unlock();
 m_xCell->setValue( nCellValue );
+aGuard.lock();
+}
 
 setBooleanFormat();
 }
@@ -315,7 +325,12 @@ namespace calc
 double nValue = 0;
 aValue >>= nValue;
 if ( m_xCell.is() )
+{
+// might call back into us via modified(EventObject&)
+aGuard.unlock();
 m_xCell->setValue( nValue );
+aGuard.lock();
+}
 }
 break;
 
@@ -327,7 +342,12 @@ namespace calc
 aValue >>= nValue;  // list index from control layer 
(0-based)
 ++nValue;   // the list position value in the cell 
is 1-based
 if ( m_xCell.is() )
+{
+// might call back into us via modified(EventObject&)
+aGuard.unlock();
 m_xCell->setValue( nValue );
+aGuard.lock();
+}
 }
 break;
 
@@ -341,7 +361,10 @@ namespace calc
 {
 Sequence aInner(1);// one 
empty element
 Sequence< Sequence > aOuter( , 1 ); // one 
row
+// might call back into us via modified(EventObject&)
+aGuard.unlock();
 xData->setDataArray( aOuter );
+aGuard.lock();
 }
 }

core.git: 2 commits - sc/source

2024-04-17 Thread Caolán McNamara (via logerrit)
 sc/source/filter/html/htmlpars.cxx |2 +-
 sc/source/ui/view/output3.cxx  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e16730a87c17d1a3e6219159d1d012caad4ebf13
Author: Caolán McNamara 
AuthorDate: Tue Apr 16 17:34:35 2024 +0100
Commit: Caolán McNamara 
CommitDate: Wed Apr 17 09:18:17 2024 +0200

ofz#68081 keep within bounds

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

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index 5d27f751ab6c..a09adb8c46eb 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -913,7 +913,7 @@ void ScHTMLLayoutParser::Colonize( ScEEParseEntry* pE )
 {   // Replaced
 nCol = pE->nCol - nColCntStart;
 SCCOL nCount = static_cast(xLocalColOffset->size());
-if ( nCol < nCount )
+if (nCol >= 0 && nCol < nCount)
 nColOffset = static_cast((*xLocalColOffset)[nCol]);
 else
 nColOffset = static_cast((*xLocalColOffset)[nCount - 
1]);
commit 1bfdf89dcf2ca4acfb63d9cdec7a620c08b750d0
Author: Andrea Gelmini 
AuthorDate: Tue Apr 16 23:07:39 2024 +0200
Commit: Julien Nabet 
CommitDate: Wed Apr 17 09:18:09 2024 +0200

Fix typo

Change-Id: I64398416dcad6b573cb2eeb2089a43bf42f5bed3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166163
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sc/source/ui/view/output3.cxx b/sc/source/ui/view/output3.cxx
index a54718076857..0015dde55783 100644
--- a/sc/source/ui/view/output3.cxx
+++ b/sc/source/ui/view/output3.cxx
@@ -210,7 +210,7 @@ void ScOutputData::DrawSelectiveObjects(SdrLayerID nLayer)
 // 'original' TargetDevice, mpDev might have been changed by a
 // call to ::SetContentDevice. That again might patch in a
 // pre-render device fetched from 
SdrPaintWindow::GetTargetOutputDevice
-// and thus the test if target is aregistered PageWindow would 
fail
+// and thus the test if target is a registered PageWindow 
would fail
 assert(nullptr != mpOriginalTargetDevice && 
"mpOriginalTargetDevice *must* be set when constructing ScOutputData (!)");
 if (nullptr != 
pPageView->FindPageWindow(*mpOriginalTargetDevice))
 {


core.git: 2 commits - sc/source

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

New commits:
commit 11e98a5087f39eb8ff6a0b8ce260169f213e7c67
Author: Caolán McNamara 
AuthorDate: Mon Apr 8 22:07:11 2024 +0100
Commit: Caolán McNamara 
CommitDate: Tue Apr 9 08:38:34 2024 +0200

ofz#67906 Integer-overflow

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

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index 4745be3526dd..83d9c01fbf7e 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1058,7 +1058,7 @@ void ScHTMLLayoutParser::TableDataOn( HtmlImportInfo* 
pInfo )
 case HtmlOptionId::COLSPAN:
 {
 sal_Int32 nColOverlap = rOption.GetString().toInt32();
-if (nColOverlap >= 0 && nColOverlap <= SCCOL_MAX)
+if (nColOverlap >= 0 && nColOverlap <= mpDoc->MaxCol())
 mxActEntry->nColOverlap = static_cast(nColOverlap);
 else
 SAL_WARN("sc", "ScHTMLLayoutParser::TableDataOn ignoring 
colspan: " << nColOverlap);
@@ -1067,7 +1067,7 @@ void ScHTMLLayoutParser::TableDataOn( HtmlImportInfo* 
pInfo )
 case HtmlOptionId::ROWSPAN:
 {
 sal_Int32 nRowOverlap = rOption.GetString().toInt32();
-if (nRowOverlap >= 0)
+if (nRowOverlap >= 0 && nRowOverlap <= mpDoc->MaxRow())
 mxActEntry->nRowOverlap = static_cast(nRowOverlap);
 else
 SAL_WARN("sc", "ScHTMLLayoutParser::TableDataOn ignoring 
rowspan: " << nRowOverlap);
commit 8527dc74eb1adc9fe4c25134ec853a83d46f1089
Author: Caolán McNamara 
AuthorDate: Mon Apr 8 21:59:41 2024 +0100
Commit: Caolán McNamara 
CommitDate: Tue Apr 9 08:38:23 2024 +0200

ofz#67904 Integer-overflow

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

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index 49e86d7ce1b2..4745be3526dd 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -541,7 +541,7 @@ void ScHTMLLayoutParser::SkipLocked( ScEEParseEntry* pE, 
bool bJoin )
 bool bFail = o3tl::checked_add(pE->nCol, pE->nColOverlap - 1, 
nEndCol) ||
  o3tl::checked_add(pE->nRow, pE->nRowOverlap - 1, 
nEndRow);
 
-if (bFail)
+if (bFail || nEndRow > mpDoc->MaxRow())
 {
 SAL_WARN("sc", "invalid range: " << pE->nCol << " " << pE->nColOverlap 
<<
  " " << pE->nRow << " " << 
pE->nRowOverlap);


core.git: 2 commits - sc/source

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

New commits:
commit 79d1c80892b36d2c155aa6112de8b1a7b1e07ae8
Author: Caolán McNamara 
AuthorDate: Fri Apr 5 10:40:36 2024 +0100
Commit: Caolán McNamara 
CommitDate: Fri Apr 5 15:19:27 2024 +0200

ofz#67854 UNKNOWN READ

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

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index 07a2c260a13e..49e86d7ce1b2 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -686,8 +686,8 @@ void ScHTMLLayoutParser::Adjust()
 SkipLocked(pE.get(), false);
 if ( pE->nCol != nColBeforeSkip )
 {
-SCCOL nCount = static_cast(maColOffset.size());
-if ( nCount <= pE->nCol )
+size_t nCount = maColOffset.size();
+if ( nCount <= o3tl::make_unsigned(pE->nCol) )
 {
 pE->nOffset = static_cast(maColOffset[nCount-1]);
 MakeCol( , pE->nOffset, pE->nWidth, 
nOffsetTolerance, nOffsetTolerance );
commit e74a8371f0ed92d11b652452d7ae85675d722279
Author: Caolán McNamara 
AuthorDate: Fri Apr 5 10:58:20 2024 +0100
Commit: Caolán McNamara 
CommitDate: Fri Apr 5 15:19:18 2024 +0200

ofz#67782 Integer-overflow

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

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index 45d21cea1720..07a2c260a13e 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1303,12 +1303,13 @@ void ScHTMLLayoutParser::TableOff( const 
HtmlImportInfo* pInfo )
 else
 pTab1 = it->second.get();
 SCROW nRowSpan = pE->nRowOverlap;
-SCROW nRowKGV;
+using SCUROW = std::make_unsigned_t;
+SCUROW nRowKGV;
 SCROW nRowsPerRow1; // Outer table
 SCROW nRowsPerRow2; // Inner table
 if ( nRowSpan > 1 )
 {   // LCM to which we can map the inner and outer rows
-nRowKGV = std::lcm( nRowSpan, nRows );
+nRowKGV = std::lcm(nRowSpan, nRows);
 nRowsPerRow1 = nRowKGV / nRowSpan;
 nRowsPerRow2 = nRowKGV / nRows;
 }


core.git: 2 commits - sc/source vcl/unx

2024-03-30 Thread Caolán McNamara (via logerrit)
 sc/source/filter/html/htmlpars.cxx |   12 ++--
 vcl/unx/gtk3/gtkinst.cxx   |3 ++-
 2 files changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 08d394857cf238bf62402b75eedd2609a3455a41
Author: Caolán McNamara 
AuthorDate: Fri Mar 29 19:53:17 2024 +
Commit: Caolán McNamara 
CommitDate: Sat Mar 30 15:09:34 2024 +0100

ofz#67708 ignore oversized colspans

that can't fit in SCCOL

ignore negative colspan and rowspans too

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

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index 5ea4c4a5997a..8786b55fcce2 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1057,12 +1057,20 @@ void ScHTMLLayoutParser::TableDataOn( HtmlImportInfo* 
pInfo )
 {
 case HtmlOptionId::COLSPAN:
 {
-mxActEntry->nColOverlap = 
static_cast(rOption.GetString().toInt32());
+sal_Int32 nColOverlap = rOption.GetString().toInt32();
+if (nColOverlap >= 0 && nColOverlap <= SCCOL_MAX)
+mxActEntry->nColOverlap = static_cast(nColOverlap);
+else
+SAL_WARN("sc", "ScHTMLLayoutParser::TableDataOn ignoring 
colspan: " << nColOverlap);
 }
 break;
 case HtmlOptionId::ROWSPAN:
 {
-mxActEntry->nRowOverlap = 
static_cast(rOption.GetString().toInt32());
+sal_Int32 nRowOverlap = rOption.GetString().toInt32();
+if (nRowOverlap >= 0)
+mxActEntry->nRowOverlap = static_cast(nRowOverlap);
+else
+SAL_WARN("sc", "ScHTMLLayoutParser::TableDataOn ignoring 
rowspan: " << nRowOverlap);
 }
 break;
 case HtmlOptionId::ALIGN:
commit c465642781485cda41bf4bd4fd3e0c0b1c7e53da
Author: Caolán McNamara 
AuthorDate: Fri Mar 29 20:10:02 2024 +
Commit: Caolán McNamara 
CommitDate: Sat Mar 30 15:09:22 2024 +0100

Resolves: tdf#159498 Items in Template Manager dropdown should be 
left-aligned

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index e535e302a09f..f966496b9ff7 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -5505,8 +5505,9 @@ public:
 {
 GtkBox *pBox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6));
 GtkWidget *pLabel = 
gtk_label_new_with_mnemonic(MapToGtkAccelerator(rStr).getStr());
+gtk_label_set_xalign(GTK_LABEL(pLabel), 0.0);
 pItem = eCheckRadioFalse != TRISTATE_INDET ? 
gtk_check_menu_item_new() : gtk_menu_item_new();
-gtk_box_pack_start(pBox, pImage, true, true, 0);
+gtk_box_pack_start(pBox, pImage, false, true, 0);
 gtk_box_pack_start(pBox, pLabel, true, true, 0);
 gtk_container_add(GTK_CONTAINER(pItem), GTK_WIDGET(pBox));
 gtk_widget_show_all(pItem);


core.git: 2 commits - sc/source vcl/source

2024-03-26 Thread Caolán McNamara (via logerrit)
 sc/source/core/tool/interpretercontext.cxx |5 +
 vcl/source/window/legacyaccessibility.cxx  |2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit ab9a4babe08b0c16ce4d199f2007bffb38d3f653
Author: Caolán McNamara 
AuthorDate: Tue Mar 26 09:04:29 2024 +
Commit: Caolán McNamara 
CommitDate: Tue Mar 26 18:25:33 2024 +0100

ofz#67600 manage removal of number formatter

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

diff --git a/sc/source/core/tool/interpretercontext.cxx 
b/sc/source/core/tool/interpretercontext.cxx
index ce9040ec30b4..f4fde3725414 100644
--- a/sc/source/core/tool/interpretercontext.cxx
+++ b/sc/source/core/tool/interpretercontext.cxx
@@ -103,7 +103,12 @@ void ScInterpreterContext::Cleanup()
 void ScInterpreterContext::ClearLookupCache(const ScDocument* pDoc)
 {
 if (pDoc == mpDoc)
+{
 mxScLookupCache.reset();
+mxLanguageData.reset();
+mpFormatter = nullptr;
+mpFormatData = nullptr;
+}
 }
 
 SvNumFormatType ScInterpreterContext::NFGetType(sal_uInt32 nFIndex) const
commit 23b72488140e7e2031e0071718d55d2b9e1c2bef
Author: Caolán McNamara 
AuthorDate: Tue Mar 26 15:38:51 2024 +
Commit: Caolán McNamara 
CommitDate: Tue Mar 26 18:25:21 2024 +0100

crash on deref null parent on attempting to find label

ImplFindDlgCtrlWindow always calls ImplGetChildWindow with first arg

which does

pParent = ImplGetTopParentOfTabHierarchy( pParent );
vcl::Window* pWindow = ImplGetSubChildWindow( pParent, n, nIndex );

ImplGetSubChildWindow always derefs its first arg and
ImplGetTopParentOfTabHierarchy only returns null if its input was null
so ImplFindDlgCtrlWindow shouldn't be called with null

program/libmergedlo.so(_ZNK3vcl6Window13ImplGetWindowEv+0x4)[0x7513e2a40e54]
program/libmergedlo.so(+0x33ba57c)[0x7513e29ba57c]
program/libmergedlo.so(+0x33ba97c)[0x7513e29ba97c]
program/libmergedlo.so(+0x33baf64)[0x7513e29baf64]
program/libmergedlo.so(+0x3378d47)[0x7513e2978d47]

program/libmergedlo.so(_ZNK3vcl6Window30GetAccessibleRelationLabeledByEv+0x19c)[0x7513e297866c]

program/libmergedlo.so(_ZN3vcl6Window18DumpAsPropertyTreeERN5tools10JsonWriterE+0x241)[0x7513e2a4b301]

program/libmergedlo.so(_ZN6Dialog18DumpAsPropertyTreeERN5tools10JsonWriterE+0x2e)[0x7513e29b217e]

program/libmergedlo.so(_ZN3vcl6Window18DumpAsPropertyTreeERN5tools10JsonWriterE+0x182)[0x7513e2a4b242]

program/libmergedlo.so(_ZN3vcl3lok9dumpStateERN3rtl13OStringBufferE+0xc0)[0x7513e2d6ee80]

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

diff --git a/vcl/source/window/legacyaccessibility.cxx 
b/vcl/source/window/legacyaccessibility.cxx
index 346e1fdc8f2a..a0f4aff33919 100644
--- a/vcl/source/window/legacyaccessibility.cxx
+++ b/vcl/source/window/legacyaccessibility.cxx
@@ -109,7 +109,7 @@ Window* 
Window::getLegacyNonLayoutAccessibleRelationLabelFor() const
 static Window* ImplGetLabeledBy( Window* pFrameWindow, WindowType nMyType, 
Window* pLabeled )
 {
 Window* pWindow = nullptr;
-if ( (nMyType != WindowType::GROUPBOX) && (nMyType != 
WindowType::FIXEDLINE) )
+if (pFrameWindow && nMyType != WindowType::GROUPBOX && nMyType != 
WindowType::FIXEDLINE)
 {
 // search for a control that labels this window
 // a label is considered the last fixed text, fixed line or group box


core.git: 2 commits - sc/source

2024-03-25 Thread Caolán McNamara (via logerrit)
 sc/source/core/data/SolverSettings.cxx |2 ++
 sc/source/core/tool/interpretercontext.cxx |4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit c80ed3ef7ce008d5fb8116e09b00b0a6cb6eb835
Author: Caolán McNamara 
AuthorDate: Mon Mar 25 10:16:22 2024 +
Commit: Caolán McNamara 
CommitDate: Mon Mar 25 20:23:00 2024 +0100

cid#1594674 Using invalid iterator

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

diff --git a/sc/source/core/data/SolverSettings.cxx 
b/sc/source/core/data/SolverSettings.cxx
index 64735722568f..99bb6d9af2fc 100644
--- a/sc/source/core/data/SolverSettings.cxx
+++ b/sc/source/core/data/SolverSettings.cxx
@@ -786,6 +786,8 @@ bool SolverSettings::TabHasSolverModel()
 {
 // Check if the named range for the objective value exists in the sheet
 const auto iter = m_mNamedRanges.find(SP_OBJ_CELL);
+if (iter == m_mNamedRanges.end())
+return false;
 OUString sRange = iter->second;
 ScRangeData* pRangeData
 = 
m_pRangeName->findByUpperName(ScGlobal::getCharClass().uppercase(sRange));
commit 064b9211ffdf82ef29ce02ff288d6a83d2a7d167
Author: Caolán McNamara 
AuthorDate: Mon Mar 25 10:15:09 2024 +
Commit: Caolán McNamara 
CommitDate: Mon Mar 25 20:22:47 2024 +0100

cid#1454847 Uninitialized pointer field

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

diff --git a/sc/source/core/tool/interpretercontext.cxx 
b/sc/source/core/tool/interpretercontext.cxx
index 6bd903d4de58..ce9040ec30b4 100644
--- a/sc/source/core/tool/interpretercontext.cxx
+++ b/sc/source/core/tool/interpretercontext.cxx
@@ -41,7 +41,9 @@ ScInterpreterContext::ScInterpreterContext(const ScDocument& 
rDoc, SvNumberForma
 , pInterpreter(nullptr)
 , mpFormatter(pFormatter)
 {
-if (pFormatter)
+if (!pFormatter)
+mpFormatData = nullptr;
+else
 {
 mxLanguageData.reset(new 
SvNFLanguageData(pFormatter->GetROLanguageData()));
 mpFormatData = >GetROFormatData();


core.git: 2 commits - sc/source

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

New commits:
commit b866019e6ee82ce19dacd653861f8d2b701d2a8e
Author: Caolán McNamara 
AuthorDate: Sat Mar 23 21:31:51 2024 +
Commit: Caolán McNamara 
CommitDate: Sun Mar 24 20:49:54 2024 +0100

ofz#67563 infinite loop

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

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index 7e83ce098979..e5b25bb42bd1 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -721,7 +721,6 @@ sal_uInt16 ScHTMLLayoutParser::GetWidth( const 
ScEEParseEntry* pE )
 
 void ScHTMLLayoutParser::SetWidths()
 {
-SCCOL nCol;
 if ( !nTableWidth )
 nTableWidth = static_cast(aPageSize.Width());
 SCCOL nColsPerRow = nMaxCol - nColCntStart;
@@ -732,7 +731,7 @@ void ScHTMLLayoutParser::SetWidths()
 sal_uInt16 nWidth = nTableWidth / static_cast(nColsPerRow);
 sal_uInt16 nOff = nColOffsetStart;
 xLocalColOffset->clear();
-for ( nCol = 0; nCol <= nColsPerRow; ++nCol, nOff = nOff + nWidth )
+for (int nCol = 0; nCol <= nColsPerRow; ++nCol, nOff = nOff + nWidth)
 {
 MakeColNoRef( xLocalColOffset.get(), nOff, 0, 0, 0 );
 }
@@ -767,7 +766,7 @@ void ScHTMLLayoutParser::SetWidths()
 auto& pE = maList[ i ];
 if ( pE->nTab == nTable && pE->nWidth )
 {
-nCol = pE->nCol - nColCntStart;
+SCCOL nCol = pE->nCol - nColCntStart;
 if ( nCol < nColsPerRow )
 {
 if ( pE->nColOverlap == 1 )
@@ -804,7 +803,7 @@ void ScHTMLLayoutParser::SetWidths()
 }
 sal_uInt16 nWidths = 0;
 sal_uInt16 nUnknown = 0;
-for ( nCol = 0; nCol < nColsPerRow; nCol++ )
+for (SCCOL nCol = 0; nCol < nColsPerRow; nCol++)
 {
 if ( pWidths[nCol] )
 nWidths = nWidths + pWidths[nCol];
@@ -816,18 +815,18 @@ void ScHTMLLayoutParser::SetWidths()
 sal_uInt16 nW = ((nWidths < nTableWidth) ?
 ((nTableWidth - nWidths) / nUnknown) :
 (nTableWidth / nUnknown));
-for ( nCol = 0; nCol < nColsPerRow; nCol++ )
+for (SCCOL nCol = 0; nCol < nColsPerRow; nCol++)
 {
 if ( !pWidths[nCol] )
 pWidths[nCol] = nW;
 }
 }
-for ( nCol = 1; nCol <= nColsPerRow; nCol++ )
+for (SCCOL nCol = 1; nCol <= nColsPerRow; nCol++)
 {
 pOffsets[nCol] = pOffsets[nCol-1] + pWidths[nCol-1];
 }
 xLocalColOffset->clear();
-for ( nCol = 0; nCol <= nColsPerRow; nCol++ )
+for (SCCOL nCol = 0; nCol <= nColsPerRow; nCol++)
 {
 MakeColNoRef( xLocalColOffset.get(), pOffsets[nCol], 0, 0, 0 );
 }
@@ -838,7 +837,7 @@ void ScHTMLLayoutParser::SetWidths()
 auto& pE = maList[ i ];
 if (pE->nTab != nTable)
 continue;
-nCol = pE->nCol - nColCntStart;
+SCCOL nCol = pE->nCol - nColCntStart;
 OSL_ENSURE( nCol < nColsPerRow, 
"ScHTMLLayoutParser::SetWidths: column overflow" );
 if (nCol >= nColsPerRow)
 continue;
commit 53680642cc5ea3df512b7e35a199b6ed6e9d9c39
Author: Caolán McNamara 
AuthorDate: Sat Mar 23 15:40:26 2024 +
Commit: Caolán McNamara 
CommitDate: Sun Mar 24 20:49:44 2024 +0100

ofz#67540 negative offset

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

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

core.git: 2 commits - sc/source

2024-03-19 Thread Caolán McNamara (via logerrit)
 sc/source/filter/html/htmlpars.cxx |   67 ++---
 sc/source/filter/inc/htmlpars.hxx  |8 ++--
 2 files changed, 37 insertions(+), 38 deletions(-)

New commits:
commit 4645391b56c32d59f241e66798f72183ad29ad13
Author: Caolán McNamara 
AuthorDate: Mon Mar 18 20:47:02 2024 +
Commit: Caolán McNamara 
CommitDate: Tue Mar 19 09:41:55 2024 +0100

AddressSanitizer: container-overflow in initial sc html fuzzing

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

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index 928674f31a3e..1e70163ddd82 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -737,12 +737,17 @@ void ScHTMLLayoutParser::SetWidths()
 MakeColNoRef( xLocalColOffset.get(), nOff, 0, 0, 0 );
 }
 nTableWidth = static_cast(xLocalColOffset->back() - 
xLocalColOffset->front());
+const auto nColsAvailable = xLocalColOffset->size();
 for ( size_t i = nFirstTableCell, nListSize = maList.size(); i < 
nListSize; ++i )
 {
 auto& pE = maList[ i ];
 if ( pE->nTab == nTable )
 {
-pE->nOffset = 
static_cast((*xLocalColOffset)[pE->nCol - nColCntStart]);
+const size_t nColRequested = pE->nCol - nColCntStart;
+if (nColRequested < nColsAvailable)
+pE->nOffset = 
static_cast((*xLocalColOffset)[nColRequested]);
+else
+SAL_WARN("sc", "missing information for column: " << 
nColRequested);
 pE->nWidth = 0; // to be recalculated later
 }
 }
commit 79ccc9866aff73e953642ec2610438855ab0f088
Author: Caolán McNamara 
AuthorDate: Mon Mar 18 19:32:26 2024 +
Commit: Caolán McNamara 
CommitDate: Tue Mar 19 09:41:47 2024 +0100

leaks in initial corpus for sc html import fuzzing

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

diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index 846feda1ca85..928674f31a3e 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -304,7 +304,7 @@ ScHTMLLayoutParser::ScHTMLLayoutParser(
 aPageSize( aPageSizeP ),
 aBaseURL(std::move( _aBaseURL )),
 xLockedList( new ScRangeList ),
-pLocalColOffset( new ScHTMLColOffset ),
+xLocalColOffset( new ScHTMLColOffset ),
 nFirstTableCell(0),
 nTableLevel(0),
 nTable(0),
@@ -320,20 +320,15 @@ ScHTMLLayoutParser::ScHTMLLayoutParser(
 bInCell( false ),
 bInTitle( false )
 {
-MakeColNoRef( pLocalColOffset, 0, 0, 0, 0 );
+MakeColNoRef( xLocalColOffset.get(), 0, 0, 0, 0 );
 MakeColNoRef( , 0, 0, 0, 0 );
 }
 
 ScHTMLLayoutParser::~ScHTMLLayoutParser()
 {
-while ( !aTableStack.empty() )
-{
-ScHTMLTableStackEntry * pS = aTableStack.top().get();
-if ( pS->pLocalColOffset != pLocalColOffset )
- delete pS->pLocalColOffset;
+while (!aTableStack.empty())
 aTableStack.pop();
-}
-delete pLocalColOffset;
+xLocalColOffset.reset();
 if ( pTables )
 {
 for( const auto& rEntry : *pTables)
@@ -716,9 +711,9 @@ sal_uInt16 ScHTMLLayoutParser::GetWidth( const 
ScEEParseEntry* pE )
 return pE->nWidth;
 sal_Int32 nTmp = std::min( static_cast( pE->nCol -
 nColCntStart + pE->nColOverlap),
-static_cast( pLocalColOffset->size() - 1));
+static_cast( xLocalColOffset->size() - 1));
 SCCOL nPos = (nTmp < 0 ? 0 : static_cast(nTmp));
-sal_uInt16 nOff2 = static_cast((*pLocalColOffset)[nPos]);
+sal_uInt16 nOff2 = static_cast((*xLocalColOffset)[nPos]);
 if ( pE->nOffset < nOff2 )
 return nOff2 - pE->nOffset;
 return 0;
@@ -732,22 +727,22 @@ void ScHTMLLayoutParser::SetWidths()
 SCCOL nColsPerRow = nMaxCol - nColCntStart;
 if ( nColsPerRow <= 0 )
 nColsPerRow = 1;
-if ( pLocalColOffset->size() <= 2 )
+if ( xLocalColOffset->size() <= 2 )
 {   // Only PageSize, there was no width setting
 sal_uInt16 nWidth = nTableWidth / static_cast(nColsPerRow);
 sal_uInt16 nOff = nColOffsetStart;
-pLocalColOffset->clear();
+xLocalColOffset->clear();
 for ( nCol = 0; nCol <= nColsPerRow; ++nCol, nOff = nOff + nWidth )
 {
-MakeColNoRef( pLocalColOffset, nOff, 0, 0, 0 );
+MakeColNoRef( xLocalColOffset.get(), nOff, 0, 0, 0 );
 }
-nTableWidth = static_cast(pLocalColOffset->back() - 
pLocalColOffset->front());
+nTableWidth = static_cast(xLocalColOffset->back() - 

core.git: 2 commits - sc/source sfx2/source

2024-03-18 Thread Caolán McNamara (via logerrit)
 sc/source/ui/unoobj/docuno.cxx |   54 +
 sfx2/source/sidebar/ControllerItem.cxx |2 -
 2 files changed, 29 insertions(+), 27 deletions(-)

New commits:
commit cda5ecdefe5a52184930aba56c2af20a8c30622d
Author: Caolán McNamara 
AuthorDate: Sun Mar 17 21:23:11 2024 +
Commit: Caolán McNamara 
CommitDate: Mon Mar 18 15:31:06 2024 +0100

cid#1594402 Unchecked dynamic_cast

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

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index eef74952df9a..a9bf8cc3c0c9 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -2354,32 +2354,34 @@ static void lcl_SetMediaScreen(const 
uno::Reference& xMediaShap
 OUString sMediaURL;
 uno::Reference xPropSet(xMediaShape, uno::UNO_QUERY);
 xPropSet->getPropertyValue("MediaURL") >>= sMediaURL;
-if (!sMediaURL.isEmpty())
-{
-OUString sTitle;
-xPropSet->getPropertyValue("Title") >>= sTitle;
-OUString sDescription;
-xPropSet->getPropertyValue("Description") >>= sDescription;
-OUString const altText(sTitle.isEmpty() ? sDescription
-   : sDescription.isEmpty()
-   ? sTitle
-   : OUString::Concat(sTitle) + 
OUString::Concat("
")
- + OUString::Concat(sDescription));
-
-OUString const 
mimeType(xPropSet->getPropertyValue("MediaMimeType").get());
-SdrObject* pSdrObj(SdrObject::getSdrObjectFromXShape(xMediaShape));
-vcl::PDFExtOutDevData* pPDF = 
dynamic_cast(pDev->GetExtOutDevData());
-sal_Int32 nScreenId = pPDF->CreateScreen(aRect, altText, mimeType, 
nPageNumb, pSdrObj);
-if (sMediaURL.startsWith("vnd.sun.star.Package:"))
-{
-// Embedded media
-OUString aTempFileURL;
-xPropSet->getPropertyValue("PrivateTempFileURL") >>= aTempFileURL;
-pPDF->SetScreenStream(nScreenId, aTempFileURL);
-}
-else // Linked media
-pPDF->SetScreenURL(nScreenId, sMediaURL);
-}
+if (sMediaURL.isEmpty())
+return;
+vcl::PDFExtOutDevData* pPDF = 
dynamic_cast(pDev->GetExtOutDevData());
+if (!pPDF)
+return;
+
+OUString sTitle;
+xPropSet->getPropertyValue("Title") >>= sTitle;
+OUString sDescription;
+xPropSet->getPropertyValue("Description") >>= sDescription;
+OUString const altText(sTitle.isEmpty() ? sDescription
+   : sDescription.isEmpty()
+   ? sTitle
+   : OUString::Concat(sTitle) + OUString::Concat("
")
+ + OUString::Concat(sDescription));
+
+OUString const 
mimeType(xPropSet->getPropertyValue("MediaMimeType").get());
+SdrObject* pSdrObj(SdrObject::getSdrObjectFromXShape(xMediaShape));
+sal_Int32 nScreenId = pPDF->CreateScreen(aRect, altText, mimeType, 
nPageNumb, pSdrObj);
+if (sMediaURL.startsWith("vnd.sun.star.Package:"))
+{
+// Embedded media
+OUString aTempFileURL;
+xPropSet->getPropertyValue("PrivateTempFileURL") >>= aTempFileURL;
+pPDF->SetScreenStream(nScreenId, aTempFileURL);
+}
+else // Linked media
+pPDF->SetScreenURL(nScreenId, sMediaURL);
 }
 
 static void lcl_PDFExportMediaShapeScreen(const OutputDevice* pDev, const 
ScPrintState& rState,
commit 3228b3966522c27ebe009a0abfdcabea37053865
Author: Caolán McNamara 
AuthorDate: Sun Mar 17 21:20:09 2024 +
Commit: Caolán McNamara 
CommitDate: Mon Mar 18 15:30:59 2024 +0100

cid#1594401 Explicit null dereferenced

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

diff --git a/sfx2/source/sidebar/ControllerItem.cxx 
b/sfx2/source/sidebar/ControllerItem.cxx
index 28248710f1a6..e84ab9b1f2e3 100644
--- a/sfx2/source/sidebar/ControllerItem.cxx
+++ b/sfx2/source/sidebar/ControllerItem.cxx
@@ -64,7 +64,7 @@ void ControllerItem::RequestUpdate()
 {
 std::unique_ptr pState;
 const SfxItemState eState (GetBindings().QueryState(GetId(), pState));
-if (GetId() == SID_ATTR_METRIC && comphelper::LibreOfficeKit::isActive())
+if (GetId() == SID_ATTR_METRIC && pState && 
comphelper::LibreOfficeKit::isActive())
 {
 MeasurementSystem eSystem
 = 
LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum();


core.git: 2 commits - sc/source vcl/qt5

2024-03-13 Thread Michael Weghorn (via logerrit)
 sc/source/filter/oox/workbookhelper.cxx |4 +
 sc/source/filter/xml/xmlimprt.cxx   |   73 
 sc/source/filter/xml/xmlimprt.hxx   |1 
 sc/source/ui/docshell/docsh.cxx |   56 
 sc/source/ui/inc/docsh.hxx  |2 
 vcl/qt5/QtInstance.cxx  |5 ++
 6 files changed, 68 insertions(+), 73 deletions(-)

New commits:
commit 86abb6fd8a8f680f9fc5ff1db775845c9f4e254b
Author: Michael Weghorn 
AuthorDate: Wed Mar 13 12:27:12 2024 +0100
Commit: Michael Weghorn 
CommitDate: Wed Mar 13 14:31:35 2024 +0100

tdf#159915 qt: Force Qt::HighDpiScaleFactorRoundingPolicy::Round

For now, force `Qt::HighDpiScaleFactorRoundingPolicy::Round`
for the HighDPI-scale factor rounding policy [1], which is the default
for Qt 5, while Qt 6 defaults to 
`Qt::HighDpiScaleFactorRoundingPolicy::PassThrough`
(see [2]), which resulted in broken rendering (e.g. "Help" -> "About"
dialog not showing the whole content) when fractional display scaling like 
150 %
is configured in the KDE Plasma display settings (in contrast to manually 
setting the
`QT_SCALE_FACTOR=1.5` env variable to apply scaling, which was working
fine).

Quoting from [3]:

> The two principal options are whether fractional scale factors should be
> rounded to an integer or not. Keeping the scale factor as-is will make
> the user interface size match the OS setting exactly, but may cause
> painting errors, for example with the Windows style.

Manually setting the env variable `QT_SCALE_FACTOR_ROUNDING_POLICY="Round"`
has the same effect (and can be used with LO versions not yet
containing this fix).

(There might be a way to adjust the way that scaling happens
to make other policies work, but for now, just hard-code to
the policy that is known to work.)

[1] https://doc.qt.io/qt-6/qt.html#HighDpiScaleFactorRoundingPolicy-enum
[2] https://doc.qt.io/qt-6/highdpi.html#environment-variable-reference
[3] 
https://doc.qt.io/qt-6/qguiapplication.html#setHighDpiScaleFactorRoundingPolicy

Change-Id: I8eb6911d4dd5faf00912b8f15a58e0bdace1995a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164768
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx
index 6b3bd0cc301a..2801601115ec 100644
--- a/vcl/qt5/QtInstance.cxx
+++ b/vcl/qt5/QtInstance.cxx
@@ -740,6 +740,11 @@ std::unique_ptr 
QtInstance::CreateQApplication(int& nArgc, char**
 // for scaled icons in the native menus
 QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
 #endif
+// force Qt::HighDpiScaleFactorRoundingPolicy::Round, which is the Qt 5 
default
+// policy and prevents incorrect rendering with the Qt 6 default policy
+// Qt::HighDpiScaleFactorRoundingPolicy::PassThrough (tdf#159915)
+QGuiApplication::setHighDpiScaleFactorRoundingPolicy(
+Qt::HighDpiScaleFactorRoundingPolicy::Round);
 
 FreeableCStr session_manager;
 if (getenv("SESSION_MANAGER") != nullptr)
commit 09d20ef6bd90d33a71b581d22d1312c5d26eb32b
Author: Justin Luth 
AuthorDate: Tue Mar 12 13:16:52 2024 -0400
Commit: Justin Luth 
CommitDate: Wed Mar 13 14:31:22 2024 +0100

tdf#123026: also use global config "RecalcOptimalRowHeightMode" for xlsx

24.8 commit 2d2974f22ab59ea7dab1aee778308c4f50ff5464 for tdf#124098
added a setting that prompts before recalculating optimal row height
on file open.  I can't think of any reason why that shouldn't apply
to all formats. It defaults to "always - without asking".

XLSX started optimal row height on file open for tdf#123026
with 24.2 commit d15c4caabaa21e0efe3a08ffbe145390e802bab9.

So this patch just moves the code to a more accessible location,
and then uses it for the XLSX case too.

Change-Id: Ia0c672c3aec788857dea09ac88e4395dcf6c2242
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164721
Tested-by: Jenkins
Reviewed-by: Balazs Varga 
Reviewed-by: Justin Luth 

diff --git a/sc/source/filter/oox/workbookhelper.cxx 
b/sc/source/filter/oox/workbookhelper.cxx
index 2361122e0bfe..270e5aca1dc6 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -639,7 +639,9 @@ void WorkbookGlobals::finalize()
 mpDoc->EnableExecuteLink(true);
 // #i79826# enable updating automatic row height after loading the document
 mpDoc->UnlockAdjustHeight();
-mpDocShell->UpdateAllRowHeights(/*bOnlyUsedRows=*/true);
+// check settings (potentially asking the user if optimal row height 
should be run now)
+if (mpDocShell->GetRecalcRowHeightsMode()) // default is to always update
+mpDocShell->UpdateAllRowHeights(/*bOnlyUsedRows=*/true);
 
 // #i76026# enable Undo after loading the document
 mpDoc->EnableUndo(true);
diff --git 

core.git: 2 commits - sc/source

2024-02-15 Thread Stephan Bergmann (via logerrit)
 sc/source/core/data/queryiter.cxx |5 +
 sc/source/core/inc/interpre.hxx   |3 +--
 sc/source/core/tool/interpr1.cxx  |1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 78b907e70359c11f5aba5568447056a130213ebd
Author: Stephan Bergmann 
AuthorDate: Thu Feb 15 14:49:10 2024 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Feb 15 19:44:28 2024 +0100

Move #include  to where it is actually used

f7039822c7ad3987326e1c20ea4a745c158f9682 "tdf#127293 Add Excel2021 function
XLOOKUP to Calc" had moved this #include around, with no documented 
rationale
and for no obvious reason.  Lets move it back.

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

diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index e577a5e2bf8a..ea30b57ae7ea 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -30,7 +30,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include "parclass.hxx"
 
 #include 
@@ -47,7 +47,6 @@ class ScFormulaCell;
 class ScDBRangeBase;
 struct ScQueryParam;
 struct ScDBQueryParamBase;
-struct ScQueryEntry;
 
 struct ScSingleRefData;
 struct ScComplexRefData;
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 960516d787ea..3d3b967ffaa0 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -62,6 +62,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
commit 33505523731b930c9a1282bab293e59c9922317f
Author: Stephan Bergmann 
AuthorDate: Thu Feb 15 12:30:20 2024 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Feb 15 19:44:15 2024 +0100

Explicitly instantiate templates

...that are used in inline functions in sc/inc/queryiter.hxx, but where the
template definition is only available in sc/source/core/data/queryiter.cxx, 
and
which had caused at least Clang PCH builds to now fail with

> ld.lld: error: undefined symbol: bool 
ScQueryCellIteratorAccessSpecific<(ScQueryCellIteratorAccess)1>::IncPosImpl()
> >>> referenced by queryiter.hxx:111 (sc/inc/queryiter.hxx:111)
> >>>   
workdir/CxxObject/sc/inc/pch/precompiled_sc.o:(ScQueryCellIteratorAccessSpecific<(ScQueryCellIteratorAccess)1>::IncPos())
>
> ld.lld: error: undefined symbol: bool 
ScQueryCellIteratorAccessSpecific<(ScQueryCellIteratorAccess)1>::IncPosImpl()
> >>> referenced by queryiter.hxx:112 (sc/inc/queryiter.hxx:112)
> >>>   
workdir/CxxObject/sc/inc/pch/precompiled_sc.o:(ScQueryCellIteratorAccessSpecific<(ScQueryCellIteratorAccess)1>::IncPosFast())
> clang++: error: linker command failed with exit code 1 (use -v to see 
invocation)
> make[1]: *** [sc/Library_sc.mk:10: instdir/program/libsclo.so] Error 1

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

diff --git a/sc/source/core/data/queryiter.cxx 
b/sc/source/core/data/queryiter.cxx
index 43996b1693eb..56d4081e7255 100644
--- a/sc/source/core/data/queryiter.cxx
+++ b/sc/source/core/data/queryiter.cxx
@@ -1284,6 +1284,11 @@ bool ScQueryCellIteratorAccessSpecific< 
ScQueryCellIteratorAccess::SortedCache >
 }
 }
 
+template
+bool 
ScQueryCellIteratorAccessSpecific::IncPosImpl();
+template
+bool 
ScQueryCellIteratorAccessSpecific::IncPosImpl();
+
 // Helper that allows binary search of unsorted cells using ScSortedRangeCache.
 // Rows in the given range are kept in a sorted vector and that vector is 
binary-searched.
 class ScQueryCellIteratorAccessSpecific< 
ScQueryCellIteratorAccess::SortedCache >::SortedCacheIndexer


core.git: 2 commits - sc/source vcl/source

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

New commits:
commit 9bc2872d5ff9e18c0d5d2b60dbd6670809f2faa5
Author: Caolán McNamara 
AuthorDate: Mon Feb 12 15:55:22 2024 +
Commit: Caolán McNamara 
CommitDate: Tue Feb 13 15:09:15 2024 +0100

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

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

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

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

core.git: 2 commits - sc/source

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

New commits:
commit c2c651ee229a1d153cf515777d018ca6eda55d98
Author: Marco Cecchetti 
AuthorDate: Thu Feb 1 22:45:42 2024 +0100
Commit: Caolán McNamara 
CommitDate: Thu Feb 8 20:51:37 2024 +0100

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

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

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

diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 7313337af681..8577e058ca17 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1352,6 +1352,13 @@ void ScUndoDragDrop::DoUndo( ScRange aRange )
 pDocShell->UpdatePaintExt(mnPaintExtFlags, aPaintRange);
 maPaintRanges.Join(aPaintRange);
 
+if (comphelper::LibreOfficeKit::isActive())
+{
+ScTabViewShell* pTabViewShell = ScTabViewShell::GetActiveViewShell();
+pTabViewShell->OnLOKSetWidthOrHeight(aPaintRange.aStart.Col(), true);
+pTabViewShell->OnLOKSetWidthOrHeight(aPaintRange.aStart.Row(), false);
+}
+
 ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
 ScTabViewShell::GetActiveViewShell(),
 true /* bColumns */, true /* bRows */,
@@ -1507,6 +1514,18 @@ void ScUndoDragDrop::Redo()
 
 if (comphelper::LibreOfficeKit::isActive())
 {
+SCCOL nStartCol = aDestRange.aStart.Col();
+SCROW nStartRow = aDestRange.aStart.Row();
+if (bCut)
+{
+nStartCol = std::min(nStartCol, aSrcRange.aStart.Col());
+nStartRow = std::min(nStartRow, aSrcRange.aStart.Row());
+}
+
+ScTabViewShell* pTabViewShell = ScTabViewShell::GetActiveViewShell();
+pTabViewShell->OnLOKSetWidthOrHeight(nStartCol, true);
+pTabViewShell->OnLOKSetWidthOrHeight(nStartRow, false);
+
 SCTAB nStartTab = aDestRange.aStart.Tab();
 SCTAB nEndTab = aDestRange.aEnd.Tab();
 if (bCut)
commit 25ebd193de97880ecca23afb473f0439dc3fb0ac
Author: Marco Cecchetti 
AuthorDate: Tue Jan 30 14:54:18 2024 +0100
Commit: Caolán McNamara 
CommitDate: Thu Feb 8 20:51:29 2024 +0100

lok: calc: missing update of sheet geometry data on undo a drag and drop

When undo/redo a drag and drop of a block of cells sheet geometry data
was not invalidated.

Change-Id: I0579de814ed61357c70a64d0e4ebf862525d3c79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162776
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163034
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 08f9958ebb59..7313337af681 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1351,6 +1351,12 @@ void ScUndoDragDrop::DoUndo( ScRange aRange )
 
 pDocShell->UpdatePaintExt(mnPaintExtFlags, aPaintRange);
 maPaintRanges.Join(aPaintRange);
+
+ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
+ScTabViewShell::GetActiveViewShell(),
+true /* bColumns */, true /* bRows */,
+true /* bSizes */, true /* bHidden */, true /* bFiltered */,
+true /* bGroups */, aPaintRange.aStart.Tab());
 }
 
 void ScUndoDragDrop::Undo()
@@ -1498,6 +1504,24 @@ void ScUndoDragDrop::Redo()
 
 EndRedo();
 SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+SCTAB nStartTab = aDestRange.aStart.Tab();
+SCTAB nEndTab = aDestRange.aEnd.Tab();
+if (bCut)
+{
+nStartTab = std::min(nStartTab, aSrcRange.aStart.Tab());
+nEndTab = std::max(nEndTab, aSrcRange.aEnd.Tab());
+}
+for (nTab = nStartTab; nTab <= nEndTab; ++nTab)
+{
+ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
+ScTabViewShell::GetActiveViewShell(), true /* bColumns */, 
true /* bRows */,
+true /* bSizes */, true /* bHidden */, true /* bFiltered */, 
true /* bGroups */,
+nTab);
+}
+}
 }
 
 void ScUndoDragDrop::Repeat(SfxRepeatTarget& /* rTarget */)


core.git: 2 commits - sc/source

2024-02-08 Thread Marco Cecchetti (via logerrit)
 sc/source/ui/view/cliputil.cxx |3 +++
 sc/source/ui/view/gridwin4.cxx |4 +++-
 sc/source/ui/view/viewfun3.cxx |7 +--
 3 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 5361fde2edb6886c85ab359166433bc077b9cafa
Author: Marco Cecchetti 
AuthorDate: Tue Jan 30 14:51:56 2024 +0100
Commit: Caolán McNamara 
CommitDate: Thu Feb 8 20:51:21 2024 +0100

lok: calc: missing invalidation of cached positions

When executing an external paste position cached by ScPositionHelper
where not invalidated causing misplaced tile rendering

Change-Id: Ia707e8de5a870f42a6dd303d87694f7ec8f0a105
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162775
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tomaž Vajngerl 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163033
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/ui/view/cliputil.cxx b/sc/source/ui/view/cliputil.cxx
index 9c7d25db1055..e4d75d3b34b5 100644
--- a/sc/source/ui/view/cliputil.cxx
+++ b/sc/source/ui/view/cliputil.cxx
@@ -126,6 +126,9 @@ void ScClipUtil::PasteFromClipboard( ScViewData& rViewData, 
ScTabViewShell* pTab
 const SfxBoolItem* pItem = rThisDoc.GetAttr(nThisCol, nThisRow, 
nThisTab, ATTR_LINEBREAK);
 if (pItem->GetValue() || entireColumnOrRowSelected)
 {
+pTabViewShell->OnLOKSetWidthOrHeight(nThisCol, true);
+pTabViewShell->OnLOKSetWidthOrHeight(nThisRow, false);
+
 ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
 pTabViewShell, true /* bColumns */, true /* bRows */, true /* 
bSizes*/,
 true /* bHidden */, true /* bFiltered */, true /* bGroups */, 
nThisTab);
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index fb0e469d5205..289776006284 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -755,8 +755,11 @@ bool ScViewFunc::PasteFromSystem( SotClipboardFormatId 
nFormatId, bool bApi )
 }
 else if (comphelper::LibreOfficeKit::isActive())
 {
-SfxViewShell* pViewShell = rViewData.GetViewShell();
-ScTabViewShell::notifyAllViewsSheetGeomInvalidation(pViewShell, 
true /* bColumns */, true /* bRows */,
+ScTabViewShell* pTabViewShell = rViewData.GetViewShell();
+pTabViewShell->OnLOKSetWidthOrHeight(rViewData.GetCurX(), true);
+pTabViewShell->OnLOKSetWidthOrHeight(rViewData.GetCurY(), false);
+
+ScTabViewShell::notifyAllViewsSheetGeomInvalidation(pTabViewShell, 
true /* bColumns */, true /* bRows */,
 true /* bSizes */, false /* bHidden */, false /* bFiltered */, 
false /* bGroups */, rViewData.GetTabNo());
 }
 }
commit 3c2a849c7fccaff7a9451056f82cbe18f0c146d8
Author: Marco Cecchetti 
AuthorDate: Tue Jan 23 17:34:20 2024 +0100
Commit: Caolán McNamara 
CommitDate: Thu Feb 8 20:51:08 2024 +0100

lok: calc: rtl - misplaced caret

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

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

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


core.git: 2 commits - sc/source vcl/source

2024-02-07 Thread Caolán McNamara (via logerrit)
 sc/source/ui/docshell/docsh.cxx   |7 ++-
 sc/source/ui/inc/docsh.hxx|4 +++-
 vcl/source/gdi/TypeSerializer.cxx |   16 ++--
 3 files changed, 19 insertions(+), 8 deletions(-)

New commits:
commit 58db061502241585b12e37618eddc508d41ecf5f
Author: Caolán McNamara 
AuthorDate: Wed Feb 7 09:08:29 2024 +
Commit: Caolán McNamara 
CommitDate: Wed Feb 7 16:00:08 2024 +0100

cid#1401342 silence Uncaught exception

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

diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 21c5cc68026c..1cfd3778d6be 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -3274,7 +3274,7 @@ ScDocShellModificator::ScDocShellModificator( ScDocShell& 
rDS )
 rDoc.EnableIdle(false);
 }
 
-ScDocShellModificator::~ScDocShellModificator() COVERITY_NOEXCEPT_FALSE
+void ScDocShellModificator::ImplDestroy()
 {
 ScDocument& rDoc = rDocShell.GetDocument();
 rDoc.SetAutoCalcShellDisabled( bAutoCalcShellDisabled );
@@ -3283,6 +3283,11 @@ ScDocShellModificator::~ScDocShellModificator() 
COVERITY_NOEXCEPT_FALSE
 rDoc.EnableIdle(bIdleEnabled);
 }
 
+ScDocShellModificator::~ScDocShellModificator()
+{
+suppress_fun_call_w_exception(ImplDestroy());
+}
+
 void ScDocShellModificator::SetDocumentModified()
 {
 ScDocument& rDoc = rDocShell.GetDocument();
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 12e6414262ae..2a87da31ee69 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -472,9 +472,11 @@ class ScDocShellModificator
 ScDocShellModificator( const ScDocShellModificator& ) = delete;
 ScDocShellModificator&  operator=( const ScDocShellModificator& ) = delete;
 
+void ImplDestroy();
+
 public:
 explicit ScDocShellModificator( ScDocShell& );
-~ScDocShellModificator() COVERITY_NOEXCEPT_FALSE;
+~ScDocShellModificator();
 voidSetDocumentModified();
 };
 
commit 81be82cce8774f6b29af627b738112ae068c2b76
Author: Caolán McNamara 
AuthorDate: Wed Feb 7 09:03:13 2024 +
Commit: Caolán McNamara 
CommitDate: Wed Feb 7 16:00:01 2024 +0100

cid#1591747 Unsigned compared against 0

and

cid#1591746 Operands don't affect result

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

diff --git a/vcl/source/gdi/TypeSerializer.cxx 
b/vcl/source/gdi/TypeSerializer.cxx
index d8522bad3615..68e072892183 100644
--- a/vcl/source/gdi/TypeSerializer.cxx
+++ b/vcl/source/gdi/TypeSerializer.cxx
@@ -447,16 +447,20 @@ static bool UselessScaleForMapMode(const Fraction& rScale)
 bool TypeSerializer::readMapMode(MapMode& rMapMode)
 {
 VersionCompatRead aCompat(mrStream);
-sal_uInt16 nUnit(0);
-Point aOrigin;
-Fraction aScaleX;
-Fraction aScaleY;
-bool bSimple(true);
 
-mrStream.ReadUInt16(nUnit);
+sal_Int16 nUnit(0);
+mrStream.ReadInt16(nUnit);
+
+Point aOrigin;
 readPoint(aOrigin);
+
+Fraction aScaleX;
 readFraction(aScaleX);
+
+Fraction aScaleY;
 readFraction(aScaleY);
+
+bool bSimple(true);
 mrStream.ReadCharAsBool(bSimple);
 
 if (nUnit < sal_Int16(MapUnit::Map100thMM) || nUnit > 
sal_Int16(MapUnit::LAST))


core.git: 2 commits - sc/source sw/inc sw/source

2024-01-30 Thread Noel Grandin (via logerrit)
 sc/source/core/data/colcontainer.cxx |5 +---
 sc/source/core/data/table2.cxx   |2 +
 sw/inc/swabstdlg.hxx |1 
 sw/source/ui/dialog/swdlgfact.cxx|8 +-
 sw/source/ui/dialog/swdlgfact.hxx|6 +++--
 sw/source/ui/misc/glossary.cxx   |8 --
 sw/source/uibase/dochdl/gloshdl.cxx  |   42 +--
 sw/source/uibase/inc/glossary.hxx|3 --
 sw/source/uibase/shells/textglos.cxx |3 --
 9 files changed, 44 insertions(+), 34 deletions(-)

New commits:
commit b4e5aa7bffc32aa15359808085cc69638467f5d5
Author: Noel Grandin 
AuthorDate: Tue Jan 30 15:22:36 2024 +0200
Commit: Noel Grandin 
CommitDate: Tue Jan 30 20:12:20 2024 +0100

make glossary dialog async

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

diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 65fbf918efca..f9398ad73fca 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -93,6 +93,7 @@ class AbstractGlossaryDlg : public VclAbstractDialog
 protected:
 virtual ~AbstractGlossaryDlg() override = default;
 public:
+virtual void Apply() = 0;
 virtual OUStringGetCurrGrpName() const = 0;
 virtual OUStringGetCurrShortName() const = 0;
 };
diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index 8676ec08a8d2..8b79dc4446bf 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -270,7 +270,13 @@ short AbstractSwModalRedlineAcceptDlg_Impl::Execute()
 
 short AbstractGlossaryDlg_Impl::Execute()
 {
-return m_xDlg->run();
+assert(false);
+return -1;
+}
+
+bool AbstractGlossaryDlg_Impl::StartExecuteAsync(AsyncContext )
+{
+return weld::GenericDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
 }
 
 short AbstractFieldInputDlg_Impl::Execute()
diff --git a/sw/source/ui/dialog/swdlgfact.hxx 
b/sw/source/ui/dialog/swdlgfact.hxx
index 2fd0b0b70183..c8c6de47d489 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -515,13 +515,15 @@ public:
 class SwGlossaryDlg;
 class AbstractGlossaryDlg_Impl : public AbstractGlossaryDlg
 {
-std::unique_ptr m_xDlg;
+std::shared_ptr m_xDlg;
 public:
-explicit AbstractGlossaryDlg_Impl(std::unique_ptr p)
+explicit AbstractGlossaryDlg_Impl(std::shared_ptr p)
 : m_xDlg(std::move(p))
 {
 }
 virtual short Execute() override;
+virtual bool StartExecuteAsync(AsyncContext ) override;
+virtual void Apply() override { m_xDlg->Apply(); }
 virtual OUStringGetCurrGrpName() const override;
 virtual OUStringGetCurrShortName() const override;
 };
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index 9769e78d8a0c..c68d4d75f86f 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -421,14 +421,6 @@ IMPL_LINK(SwGlossaryDlg, GrpSelect, weld::TreeView&, rBox, 
void)
 }
 }
 
-short SwGlossaryDlg::run()
-{
-short nRet = SfxDialogController::run();
-if (nRet == RET_OK)
-Apply();
-return nRet;
-}
-
 void SwGlossaryDlg::Apply()
 {
 const OUString aGlosName(m_xShortNameEdit->get_text());
diff --git a/sw/source/uibase/dochdl/gloshdl.cxx 
b/sw/source/uibase/dochdl/gloshdl.cxx
index e70ed7ffc4b2..dcc90033cd9b 100644
--- a/sw/source/uibase/dochdl/gloshdl.cxx
+++ b/sw/source/uibase/dochdl/gloshdl.cxx
@@ -69,25 +69,35 @@ struct TextBlockInfo_Impl
 void SwGlossaryHdl::GlossaryDlg()
 {
 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-ScopedVclPtr 
pDlg(pFact->CreateGlossaryDlg(m_rViewFrame, this, m_pWrtShell));
-OUString sName;
-OUString sShortName;
+VclPtr pDlg(pFact->CreateGlossaryDlg(m_rViewFrame, 
this, m_pWrtShell));
 
-if( RET_EDIT == pDlg->Execute() )
-{
-sName = pDlg->GetCurrGrpName();
-sShortName = pDlg->GetCurrShortName();
-}
+pDlg->StartExecuteAsync(
+[this, pDlg] (sal_Int32 nResult)->void
+{
+OUString sName;
+OUString sShortName;
+if (nResult == RET_OK)
+pDlg->Apply();
+if (nResult == RET_EDIT)
+{
+sName = pDlg->GetCurrGrpName();
+sShortName = pDlg->GetCurrShortName();
+}
+pDlg->disposeOnce();
+m_pCurGrp.reset();
+if(HasGlossaryList())
+{
+GetGlossaryList()->ClearGroups();
+}
 
-pDlg.disposeAndClear();
-m_pCurGrp.reset();
-if(HasGlossaryList())
-{
-GetGlossaryList()->ClearGroups();
-}
+if( !sName.isEmpty() || !sShortName.isEmpty() )
+m_rStatGlossaries.EditGroupDoc( sName, sShortName );
 
-if( !sName.isEmpty() || !sShortName.isEmpty() )
-

core.git: 2 commits - sc/source

2024-01-29 Thread Noel Grandin (via logerrit)
 sc/source/ui/docshell/docsh4.cxx |  259 ++-
 sc/source/ui/inc/docsh.hxx   |3 
 sc/source/ui/inc/tabvwsh.hxx |   17 +
 sc/source/ui/view/tabvwsha.cxx   |  367 ++-
 4 files changed, 362 insertions(+), 284 deletions(-)

New commits:
commit 92ba909fe8d9d1d1237571686e165c0a26def51d
Author: Noel Grandin 
AuthorDate: Mon Jan 29 14:24:37 2024 +0200
Commit: Noel Grandin 
CommitDate: Mon Jan 29 17:17:47 2024 +0100

extract SID_CHART_ADDSOURCE code into another method

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

diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 34e69724742c..c449a074ac73 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -380,132 +380,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
 
 case SID_CHART_SOURCE:
 case SID_CHART_ADDSOURCE:
-if (pReqArgs)
-{
-ScDocument& rDoc = GetDocument();
-const   SfxPoolItem* pItem;
-OUString  aChartName, aRangeName;
-
-ScRange aSingleRange;
-ScRangeListRef  aRangeListRef;
-boolbMultiRange = false;
-
-bool bColHeaders = true;
-bool bRowHeaders = true;
-bool bColInit = false;
-bool bRowInit = false;
-bool bAddRange = (nSlot == SID_CHART_ADDSOURCE);
-
-if( const SfxStringItem* pChartItem = pReqArgs->GetItemIfSet( 
SID_CHART_NAME ) )
-aChartName = pChartItem->GetValue();
-
-if( const SfxStringItem* pChartItem = pReqArgs->GetItemIfSet( 
SID_CHART_SOURCE ) )
-aRangeName = pChartItem->GetValue();
-
-if( pReqArgs->HasItem( FN_PARAM_1,  ) )
-{
-bColHeaders = static_cast(pItem)->GetValue();
-bColInit = true;
-}
-if( pReqArgs->HasItem( FN_PARAM_2,  ) )
-{
-bRowHeaders = static_cast(pItem)->GetValue();
-bRowInit = true;
-}
-
-ScAddress::Details aDetails(rDoc.GetAddressConvention(), 0, 0);
-bool bValid = (aSingleRange.ParseAny(aRangeName, rDoc, 
aDetails) & ScRefFlags::VALID) != ScRefFlags::ZERO;
-if (!bValid)
-{
-aRangeListRef = new ScRangeList;
-aRangeListRef->Parse( aRangeName, rDoc, 
rDoc.GetAddressConvention());
-if ( !aRangeListRef->empty() )
-{
-bMultiRange = true;
-aSingleRange = aRangeListRef->front(); // for header
-bValid = true;
-}
-else
-aRangeListRef.clear();
-}
-
-ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
-if (pViewSh && bValid && !aChartName.isEmpty() )
-{
-weld::Window* pParent = pViewSh->GetFrameWeld();
-
-SCCOL nCol1 = aSingleRange.aStart.Col();
-SCROW nRow1 = aSingleRange.aStart.Row();
-SCCOL nCol2 = aSingleRange.aEnd.Col();
-SCROW nRow2 = aSingleRange.aEnd.Row();
-SCTAB nTab = aSingleRange.aStart.Tab();
-
-//! limit always or not at all ???
-if (!bMultiRange)
-m_pDocument->LimitChartArea( nTab, nCol1,nRow1, 
nCol2,nRow2 );
-
-// Dialog for column/row headers
-bool bOk = true;
-if ( !bAddRange && ( !bColInit || !bRowInit ) )
-{
-ScChartPositioner aChartPositioner( *m_pDocument, 
nTab, nCol1,nRow1, nCol2,nRow2 );
-if (!bColInit)
-bColHeaders = aChartPositioner.HasColHeaders();
-if (!bRowInit)
-bRowHeaders = aChartPositioner.HasRowHeaders();
-
-ScAbstractDialogFactory* pFact = 
ScAbstractDialogFactory::Create();
-
-ScopedVclPtr 
pDlg(pFact->CreateScColRowLabelDlg(pParent, bRowHeaders, bColHeaders));
-if ( pDlg->Execute() == RET_OK )
-{
-bColHeaders = pDlg->IsRow();
-bRowHeaders = pDlg->IsCol();
-
-rReq.AppendItem(SfxBoolItem(FN_PARAM_1, 
bColHeaders));
-rReq.AppendItem(SfxBoolItem(FN_PARAM_2, 
bRowHeaders));
- 

core.git: 2 commits - sc/source

2024-01-24 Thread Noel Grandin (via logerrit)
 sc/source/ui/inc/tabvwsh.hxx   |2 
 sc/source/ui/view/tabvwshf.cxx |  463 +
 2 files changed, 242 insertions(+), 223 deletions(-)

New commits:
commit c38ebb561211e55d0a7eb5d2e3db6975f0cadbfc
Author: Noel Grandin 
AuthorDate: Wed Jan 24 12:36:03 2024 +0200
Commit: Noel Grandin 
CommitDate: Thu Jan 25 07:01:15 2024 +0100

split out set-bg-col logic from ScTabViewShell::ExecuteTable

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

diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 1191669f09c7..a5cafcb885d2 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -459,6 +459,7 @@ private:
 void ExecuteInsertTable( SfxRequest& rReq );
 void DoInsertTableFromDialog( SfxRequest& rReq, const 
VclPtr& pDlg );
 void ExecuteAppendOrRenameTable( SfxRequest& rReq );
+void ExecuteSetTableBackgroundCol( SfxRequest& rReq );
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index dd64c9e14dd1..0440fe8ac019 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -431,109 +431,8 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
 
 case FID_TAB_SET_TAB_BG_COLOR:
 case FID_TAB_MENU_SET_TAB_BG_COLOR:
-{
-if ( nSlot == FID_TAB_MENU_SET_TAB_BG_COLOR )
-nSlot = FID_TAB_SET_TAB_BG_COLOR;
-SCTAB nTabNr = rViewData.GetTabNo();
-ScMarkData& rMark = rViewData.GetMarkData();
-SCTAB nTabSelCount = rMark.GetSelectCount();
-if ( !rDoc.IsDocEditable() )
-break;
-
-if ( rDoc.IsTabProtected( nTabNr ) ) // ||nTabSelCount > 1
-break;
-
-if( pReqArgs != nullptr )
-{
-boolbDone = false;
-const SfxPoolItem*  pItem;
-Color   aColor;
-
-if( pReqArgs->HasItem( nSlot,  ) )
-aColor = static_cast(pItem)->GetValue();
-
-if ( nTabSelCount > 1 )
-{
-std::unique_ptr
-pTabColorList(new ScUndoTabColorInfo::List);
-for (const auto& rTab : rMark)
-{
-if ( !rDoc.IsTabProtected(rTab) )
-{
-ScUndoTabColorInfo aTabColorInfo(rTab);
-aTabColorInfo.maNewTabBgColor = aColor;
-pTabColorList->push_back(aTabColorInfo);
-}
-}
-bDone = SetTabBgColor( *pTabColorList );
-}
-else
-{
-bDone = SetTabBgColor( aColor, nCurrentTab ); 
//ScViewFunc.SetTabBgColor
-}
-if( bDone )
-{
-rReq.Done( *pReqArgs );
-}
-}
-else
-{
-sal_uInt16  nRet= RET_OK; /// temp
-boolbDone   = false; /// temp
-
-Color aTabBgColor = rDoc.GetTabBgColor( nCurrentTab );
-ScAbstractDialogFactory* pFact = 
ScAbstractDialogFactory::Create();
-ScopedVclPtr 
pDlg(pFact->CreateScTabBgColorDlg(
-GetFrameWeld(),
-
ScResId(SCSTR_SET_TAB_BG_COLOR),
-
ScResId(SCSTR_NO_TAB_BG_COLOR),
-aTabBgColor));
-while ( !bDone && nRet == RET_OK )
-{
-nRet = pDlg->Execute();
-if( nRet == RET_OK )
-{
-Color aSelectedColor;
-pDlg->GetSelectedColor(aSelectedColor);
-std::unique_ptr
-pTabColorList(new ScUndoTabColorInfo::List);
-if ( nTabSelCount > 1 )
-{
-for (const auto& rTab : rMark)
-{
-if ( !rDoc.IsTabProtected(rTab) )
-{
-ScUndoTabColorInfo aTabColorInfo(rTab);
-

core.git: 2 commits - sc/source svl/source

2024-01-13 Thread Caolán McNamara (via logerrit)
 sc/source/ui/cctrl/tbzoomsliderctrl.cxx |   11 ++-
 svl/source/items/itemset.cxx|2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit 2da65b3c04e35a293cd2e630ffd9bc24b3453814
Author: Caolán McNamara 
AuthorDate: Sat Jan 13 19:01:42 2024 +
Commit: Caolán McNamara 
CommitDate: Sat Jan 13 22:08:50 2024 +0100

cid#1585309 Dereference before null check

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 41051a981aa4..673cbea84c50 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -329,7 +329,7 @@ SfxPoolItem const* implCreateItemEntry(SfxItemPool& rPool, 
SfxPoolItem const* pS
 SfxItemPool* pMasterPool(rPool.GetMasterPool());
 assert(nullptr != pMasterPool);
 SfxItemPool* pTargetPool(pMasterPool);
-while (!pTargetPool->IsInRange(nWhich))
+while (pTargetPool && !pTargetPool->IsInRange(nWhich))
 pTargetPool = pTargetPool->GetSecondaryPool();
 
 // if this goes wrong, an Item with invalid ID for this pool is
commit 49cc32842a039ab6b8e180df5b24ae8a5b1bd27b
Author: Caolán McNamara 
AuthorDate: Sat Jan 13 18:59:32 2024 +
Commit: Caolán McNamara 
CommitDate: Sat Jan 13 22:08:38 2024 +0100

cid#1585306 Uninitialized scalar field

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

diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx 
b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
index d14dd1cb08c0..31eb73b0a8e5 100644
--- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
+++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
@@ -216,11 +216,12 @@ void ScZoomSliderWnd::dispose()
 
 ScZoomSlider::ScZoomSlider(css::uno::Reference< css::frame::XDispatchProvider> 
xDispatchProvider,
sal_uInt16 nCurrentZoom)
-: mnCurrentZoom( nCurrentZoom ),
-  mnMinZoom( 10 ),
-  mnMaxZoom( 400 ),
-  mbOmitPaint( false ),
-  m_xDispatchProvider(std::move(xDispatchProvider))
+: mnSliderLength(0)
+, mnCurrentZoom(nCurrentZoom)
+, mnMinZoom(10)
+, mnMaxZoom(400)
+, mbOmitPaint(false)
+, m_xDispatchProvider(std::move(xDispatchProvider))
 {
 maSliderButton  = Image(StockImage::Yes, RID_SVXBMP_SLIDERBUTTON);
 maIncreaseButton= Image(StockImage::Yes, RID_SVXBMP_SLIDERINCREASE);


core.git: 2 commits - sc/source sc/uiconfig

2024-01-07 Thread Andras Timar (via logerrit)
 sc/source/ui/view/editsh.cxx  |   11 +++
 sc/uiconfig/scalc/ui/conditionaleasydialog.ui |8 
 2 files changed, 11 insertions(+), 8 deletions(-)

New commits:
commit b7cba4953a072c88813ecd1886cd0fdaa5790de7
Author: Andras Timar 
AuthorDate: Fri Jan 5 14:44:21 2024 +0100
Commit: Andras Timar 
CommitDate: Sun Jan 7 16:36:40 2024 +0100

LOK: disallow entering multiple hyperlinks in spreadsheet cells

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

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

diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 9ed398fb9876..c392f111e203 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -572,8 +573,9 @@ void ScEditShell::Execute( SfxRequest& rReq )
 SvxLinkInsertMode eMode = pHyper->GetInsertMode();
 
 bool bCellLinksOnly
-= 
SC_MOD()->GetAppOptions().GetLinksInsertedLikeMSExcel()
-  && 
rViewData.GetSfxDocShell()->GetMedium()->GetFilter()->IsMSOFormat();
+= 
(SC_MOD()->GetAppOptions().GetLinksInsertedLikeMSExcel()
+  && 
rViewData.GetSfxDocShell()->GetMedium()->GetFilter()->IsMSOFormat())
+  || comphelper::LibreOfficeKit::isActive();
 
 bool bDone = false;
 if ( (eMode == HLINK_DEFAULT || eMode == HLINK_FIELD) && 
!bCellLinksOnly )
@@ -786,8 +788,9 @@ void ScEditShell::GetState( SfxItemSet& rSet )
 {
 SvxHyperlinkItem aHLinkItem;
 bool bCellLinksOnly
-= 
SC_MOD()->GetAppOptions().GetLinksInsertedLikeMSExcel()
-  && 
rViewData.GetSfxDocShell()->GetMedium()->GetFilter()->IsMSOFormat();
+= 
(SC_MOD()->GetAppOptions().GetLinksInsertedLikeMSExcel()
+  && 
rViewData.GetSfxDocShell()->GetMedium()->GetFilter()->IsMSOFormat())
+  || comphelper::LibreOfficeKit::isActive();
 std::unique_ptr 
aSvxFieldDataPtr(GetURLField());
 const SvxURLField* pURLField(static_cast(aSvxFieldDataPtr.get()));
 if (!bCellLinksOnly)
commit 96131f0e80f23ceeafab39508cafb68f33b8e58d
Author: Andras Timar 
AuthorDate: Fri Jan 5 12:02:41 2024 +0100
Commit: Andras Timar 
CommitDate: Sun Jan 7 16:36:29 2024 +0100

context="stock" is not good for non-stock translatable strings

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

diff --git a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui 
b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
index c7a43c4cb256..2440952dea4e 100644
--- a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
+++ b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui
@@ -5,7 +5,7 @@
   
 False
 6
-Apply 
conditional formatting...
+Apply conditional formatting...
 dialog
 
   
@@ -133,7 +133,7 @@
   
 True
 False
-with
+with
 
   
 
@@ -171,7 +171,7 @@
   
 True
 False
-Apply conditional formatting to cells: %1
+Apply conditional formatting to cells: 
%1
 
   
   
@@ -238,7 +238,7 @@
   
 True
 False
-Range:
+Range:
 
   
 


core.git: 2 commits - sc/source

2023-12-09 Thread Mike Kaganski (via logerrit)
 sc/source/ui/inc/tabvwsh.hxx   |2 +-
 sc/source/ui/view/tabvwsh4.cxx |   15 ++-
 2 files changed, 7 insertions(+), 10 deletions(-)

New commits:
commit 198035a18f28095b868f9e8ecc01c6b139e21896
Author: Mike Kaganski 
AuthorDate: Sat Dec 9 12:52:55 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat Dec 9 14:10:28 2023 +0100

Simplify a bit

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

diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index dc05f235c990..1b80b0ab2f25 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -94,8 +94,8 @@ class ScFormEditData;
 class ScViewOptiChangesListener;
 class SC_DLLPUBLIC ScTabViewShell : public SfxViewShell, public ScDBFunc
 {
-rtl::Reference mChangesListener;
 private:
+rtl::Reference mChangesListener;
 struct SendFormulabarUpdate
 {
 OUString m_aText;
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 3948a7d07843..2989d63b5f99 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1705,7 +1705,7 @@ private:
 
 void ScViewOptiChangesListener::stopListening()
 {
-if (m_xChangesNotifier.is())
+if (m_xChangesNotifier)
 m_xChangesNotifier->removeChangesListener(this);
 }
 
@@ -1736,19 +1736,16 @@ 
ScViewOptiChangesListener::ScViewOptiChangesListener(ScTabViewShell& rViewShell)
 uno::Reference xConfigurationProvider(
 
configuration::theDefaultProvider::get(comphelper::getProcessComponentContext()));
 
-beans::NamedValue aProperty;
-aProperty.Name = "nodepath";
-aProperty.Value <<= 
OUString("/org.openoffice.Office.Calc/Content/Display");
-
-uno::Sequence aArgumentList{ uno::Any(aProperty) };
+beans::NamedValue aProperty{ u"nodepath"_ustr,
+ 
uno::Any(u"/org.openoffice.Office.Calc/Content/Display"_ustr) };
 
 uno::Reference xConfigurationAccess
 = xConfigurationProvider->createInstanceWithArguments(
-"com.sun.star.configuration.ConfigurationAccess", aArgumentList);
+"com.sun.star.configuration.ConfigurationAccess", { 
uno::Any(aProperty) });
 
 m_xChangesNotifier.set(xConfigurationAccess, uno::UNO_QUERY);
 
-if (m_xChangesNotifier.is())
+if (m_xChangesNotifier)
 m_xChangesNotifier->addChangesListener(this);
 }
 
commit 6aa07b9e2bca206150de7d5d048833cef31b882a
Author: Mike Kaganski 
AuthorDate: Sat Dec 9 12:45:15 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat Dec 9 14:10:22 2023 +0100

Listen to the needed subnode

We don't need to know when other subnodes might change

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

diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index b7258e86e36e..3948a7d07843 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1715,7 +1715,7 @@ void SAL_CALL 
ScViewOptiChangesListener::changesOccurred(const util::ChangesEven
 for (const auto& change : rEvent.Changes)
 {
 if (OUString sChangedEntry;
-(change.Accessor >>= sChangedEntry) && sChangedEntry == 
"Display/ColumnRowHighlighting")
+(change.Accessor >>= sChangedEntry) && sChangedEntry == 
"ColumnRowHighlighting")
 {
 mrViewShell.GetViewData().GetView()->HighlightOverlay();
 break;
@@ -1738,7 +1738,7 @@ 
ScViewOptiChangesListener::ScViewOptiChangesListener(ScTabViewShell& rViewShell)
 
 beans::NamedValue aProperty;
 aProperty.Name = "nodepath";
-aProperty.Value <<= OUString("/org.openoffice.Office.Calc/Content");
+aProperty.Value <<= 
OUString("/org.openoffice.Office.Calc/Content/Display");
 
 uno::Sequence aArgumentList{ uno::Any(aProperty) };
 


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

2023-11-26 Thread Andrea Gelmini (via logerrit)
 sc/source/filter/oox/viewsettings.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 743e1188cc843e74b1b110675254a7d2329d1a2f
Author: Andrea Gelmini 
AuthorDate: Sat Nov 25 21:22:37 2023 +0100
Commit: Julien Nabet 
CommitDate: Sun Nov 26 13:15:42 2023 +0100

Remove exec bits on xcu file

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

diff --git a/sw/qa/uitest/writer_tests8_data/registrymodifications.xcu 
b/sw/qa/uitest/writer_tests8_data/registrymodifications.xcu
old mode 100755
new mode 100644
commit 2977ec6fc6b361b9edd4b9c0b32588bb0a7d8b28
Author: Andrea Gelmini 
AuthorDate: Sat Nov 25 21:23:03 2023 +0100
Commit: Julien Nabet 
CommitDate: Sun Nov 26 13:15:30 2023 +0100

Fix typo

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

diff --git a/sc/source/filter/oox/viewsettings.cxx 
b/sc/source/filter/oox/viewsettings.cxx
index fbf28be289b3..2badbd80a43a 100644
--- a/sc/source/filter/oox/viewsettings.cxx
+++ b/sc/source/filter/oox/viewsettings.cxx
@@ -374,7 +374,7 @@ void SheetViewSettings::finalizeImport()
 {
 /*  Frozen panes: handle split position as row/column positions.
 #i35812# Excel uses number of visible rows/columns in the
-frozen area (rows/columns scolled outside are not included),
+frozen area (rows/columns scrolled outside are not included),
 Calc uses absolute position of first unfrozen row/column. */
 const ScAddress& rMaxApiPos = getAddressConverter().getMaxApiAddress();
 if( (xModel->mfSplitX >= 1.0) && ( xModel->maFirstPos.Col() + 
xModel->mfSplitX <= rMaxApiPos.Col() ) )


[Libreoffice-commits] core.git: 2 commits - sc/source slideshow/source slideshow/test

2023-11-19 Thread Julien Nabet (via logerrit)
 sc/source/core/data/dpobject.cxx|4 ++--
 sc/source/core/data/dpsave.cxx  |4 ++--
 sc/source/core/tool/dbdata.cxx  |2 +-
 sc/source/core/tool/detdata.cxx |5 ++---
 sc/source/core/tool/rangelst.cxx|5 ++---
 sc/source/filter/inc/xerecord.hxx   |4 +---
 sc/source/filter/xml/xmlcondformat.cxx  |4 +---
 sc/source/ui/docshell/macromgr.cxx  |2 +-
 sc/source/ui/unoobj/viewuno.cxx |8 ++--
 sc/source/ui/view/gridwin.cxx   |2 +-
 slideshow/source/engine/pointersymbol.cxx   |8 +++-
 slideshow/source/engine/rehearsetimingsactivity.cxx |7 +++
 slideshow/source/engine/shapes/appletshape.cxx  |   10 ++
 slideshow/source/engine/shapes/backgroundshape.cxx  |   10 ++
 slideshow/source/engine/shapes/drawshape.cxx|   11 +++
 slideshow/source/engine/shapes/mediashape.cxx   |   10 ++
 slideshow/source/engine/slide/slideimpl.cxx |8 ++--
 slideshow/source/engine/slide/userpaintoverlay.cxx  |4 +---
 slideshow/source/engine/slideoverlaybutton.cxx  |5 +
 slideshow/source/engine/transitions/slidechangebase.cxx |8 ++--
 slideshow/source/engine/waitsymbol.cxx  |8 +++-
 slideshow/source/inc/listenercontainer.hxx  |7 +++
 slideshow/test/testshape.cxx|8 +++-
 23 files changed, 81 insertions(+), 63 deletions(-)

New commits:
commit 8158f016ea094ad48cdf11cd8ae46cd282af25d2
Author: Julien Nabet 
AuthorDate: Sat Nov 18 23:19:56 2023 +0100
Commit: Julien Nabet 
CommitDate: Sun Nov 19 13:41:30 2023 +0100

c++20: use std::erase(_if) instead of std::remove(_if)+erase (part 11)

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

diff --git a/slideshow/source/engine/pointersymbol.cxx 
b/slideshow/source/engine/pointersymbol.cxx
index 44f31d5129ee..9c0d6fa78a97 100644
--- a/slideshow/source/engine/pointersymbol.cxx
+++ b/slideshow/source/engine/pointersymbol.cxx
@@ -134,13 +134,11 @@ void PointerSymbol::viewAdded( const UnoViewSharedPtr& 
rView )
 
 void PointerSymbol::viewRemoved( const UnoViewSharedPtr& rView )
 {
-maViews.erase(
-std::remove_if(
-maViews.begin(), maViews.end(),
+std::erase_if(
+maViews,
 []
 ( const ViewsVecT::value_type& cp )
-{ return rView == cp.first; } ),
-maViews.end() );
+{ return rView == cp.first; } );
 }
 
 void PointerSymbol::viewChanged( const UnoViewSharedPtr& rView )
diff --git a/slideshow/source/engine/rehearsetimingsactivity.cxx 
b/slideshow/source/engine/rehearsetimingsactivity.cxx
index 8284a998900f..7afe8bca53f5 100644
--- a/slideshow/source/engine/rehearsetimingsactivity.cxx
+++ b/slideshow/source/engine/rehearsetimingsactivity.cxx
@@ -349,12 +349,11 @@ void RehearseTimingsActivity::viewAdded( const 
UnoViewSharedPtr& rView )
 
 void RehearseTimingsActivity::viewRemoved( const UnoViewSharedPtr& rView )
 {
-maViews.erase(
-std::remove_if( maViews.begin(), maViews.end(),
+std::erase_if(
+maViews,
 []
 ( const ViewsVecT::value_type& cp )
-{ return rView == cp.first; } ),
-maViews.end() );
+{ return rView == cp.first; } );
 }
 
 void RehearseTimingsActivity::viewChanged( const UnoViewSharedPtr& rView )
diff --git a/slideshow/source/engine/shapes/appletshape.cxx 
b/slideshow/source/engine/shapes/appletshape.cxx
index 6cc16ad6e500..9402a7f1194f 100644
--- a/slideshow/source/engine/shapes/appletshape.cxx
+++ b/slideshow/source/engine/shapes/appletshape.cxx
@@ -184,6 +184,8 @@ namespace slideshow::internal
 { return rLayer == 
pShape->getViewLayer(); } ) < 2,
 "AppletShape::removeViewLayer(): Duplicate ViewLayer 
entries!" );
 
+// TODO : needed for the moment since ANDROID doesn't know size_t return from 
std::erase_if
+#if defined ANDROID
 ViewAppletShapeVector::iterator aIter;
 
 if( (aIter=::std::remove_if( maViewAppletShapes.begin(),
@@ -200,6 +202,14 @@ namespace slideshow::internal
 maViewAppletShapes.erase( aIter, aEnd );
 
 return true;
+#else
+size_t nb = std::erase_if(maViewAppletShapes,
+ []
+ ( const ViewAppletShapeSharedPtr& 
pShape )
+ { return rLayer == 
pShape->getViewLayer(); } );
+// if nb == 0, it means view layer seemingly was not added, failed
+

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

2023-11-09 Thread Noel Grandin (via logerrit)
 sc/source/filter/xml/xmlcvali.cxx |   10 --
 sc/source/filter/xml/xmlstyli.cxx |4 ++--
 sc/source/filter/xml/xmlstyli.hxx |6 --
 3 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 38a4672bdb55314edc9ce2cd5224b879d8df007f
Author: Noel Grandin 
AuthorDate: Wed Nov 8 13:23:43 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 9 20:10:59 2023 +0100

loplugin:fieldcast in ScXMLContentValidationContext

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

diff --git a/sc/source/filter/xml/xmlcvali.cxx 
b/sc/source/filter/xml/xmlcvali.cxx
index 6a5669b7866a..20b1f235fd17 100644
--- a/sc/source/filter/xml/xmlcvali.cxx
+++ b/sc/source/filter/xml/xmlcvali.cxx
@@ -49,7 +49,7 @@ class ScXMLContentValidationContext : public 
ScXMLImportContext
 bool   bDisplayHelp;
 bool   bDisplayError;
 
-SvXMLImportContextRef   xEventContext;
+rtl::Reference xEventContext;
 
 css::sheet::ValidationAlertStyle GetAlertStyle() const;
 void SetFormula( OUString& rFormula, OUString& rFormulaNmsp, 
FormulaGrammar::Grammar& reGrammar,
@@ -232,8 +232,8 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL 
ScXMLContentValidationC
 pContext = new ScXMLErrorMacroContext( GetScImport(), pAttribList, 
this);
 break;
 case XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS):
-pContext = new XMLEventsImportContext( GetImport() );
-xEventContext = pContext;
+xEventContext = new XMLEventsImportContext( GetImport() );
+pContext = xEventContext.get();
 }
 
 return pContext;
@@ -357,10 +357,8 @@ void SAL_CALL 
ScXMLContentValidationContext::endFastElement( sal_Int32 /*nElemen
 // #i36650# event-listeners element moved up one level
 if (xEventContext.is())
 {
-XMLEventsImportContext* pEvents =
-static_cast(xEventContext.get());
 uno::Sequence aValues;
-pEvents->GetEventSequence( "OnError", aValues );
+xEventContext->GetEventSequence( "OnError", aValues );
 
 auto pValue = std::find_if(std::cbegin(aValues), std::cend(aValues),
 [](const beans::PropertyValue& rValue) {
commit f6370725d8a68645e82f16d61518fd2d400f148d
Author: Noel Grandin 
AuthorDate: Wed Nov 8 13:16:31 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 9 20:10:50 2023 +0100

loplugin:fieldcast in XMLTableStyleContext

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

diff --git a/sc/source/filter/xml/xmlstyli.cxx 
b/sc/source/filter/xml/xmlstyli.cxx
index 3d7d86488425..a607b013e9c7 100644
--- a/sc/source/filter/xml/xmlstyli.cxx
+++ b/sc/source/filter/xml/xmlstyli.cxx
@@ -426,7 +426,7 @@ void XMLTableStyleContext::SetAttribute( sal_Int32 nElement,
 
 
 XMLTableStyleContext::XMLTableStyleContext( ScXMLImport& rImport,
-SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, bool 
bDefaultStyle ) :
+XMLTableStylesContext& rStyles, XmlStyleFamily nFamily, bool 
bDefaultStyle ) :
 XMLPropStyleContext( rImport, rStyles, nFamily, bDefaultStyle ),
 pStyles(),
 nNumberFormat(-1),
@@ -563,7 +563,7 @@ void XMLTableStyleContext::AddProperty(const sal_Int16 
nContextID, const uno::An
 XMLPropertyState* property = FindProperty(nContextID);
 if (property)
 property->mnIndex = -1; // #i46996# remove old property, so it isn't 
double
-sal_Int32 nIndex(static_cast(pStyles)->GetIndex(nContextID));
+sal_Int32 nIndex(pStyles->GetIndex(nContextID));
 OSL_ENSURE(nIndex != -1, "Property not found in Map");
 XMLPropertyState aPropState(nIndex, rValue);
 GetProperties().push_back(aPropState); // has to be inserted in a sort 
order later
diff --git a/sc/source/filter/xml/xmlstyli.hxx 
b/sc/source/filter/xml/xmlstyli.hxx
index 8101a72b1f7c..e977b84e0ec6 100644
--- a/sc/source/filter/xml/xmlstyli.hxx
+++ b/sc/source/filter/xml/xmlstyli.hxx
@@ -63,11 +63,13 @@ public:
 ::std::vector< XMLPropertyState >& rProperties, sal_Int32 
nStartIndex, sal_Int32 nEndIndex ) const override;
 };
 
+class XMLTableStylesContext;
+
 class XMLTableStyleContext : public XMLPropStyleContext
 {
 OUString sDataStyleName;
 OUString   sPageStyle;
-SvXMLStylesContext* pStyles;
+XMLTableStylesContext*  pStyles;
 sal_Int32   nNumberFormat;
 SCTAB   nLastSheet;
 boolbParentSet;
@@ -85,7 +87,7 @@ protected:
 public:
 
 XMLTableStyleContext( ScXMLImport& rImport,
-SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, bool 
bDefaultStyle = false );
+XMLTableStylesContext& rStyles, XmlStyleFamily nFamily, bool 
bDefaultStyle = false 

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

2023-11-09 Thread Noel Grandin (via logerrit)
 sc/source/ui/vba/vbaaxes.cxx |3 +--
 sc/source/ui/vba/vbaaxis.cxx |6 +++---
 sc/source/ui/vba/vbaaxis.hxx |9 ++---
 sc/source/ui/vba/vbaformatconditions.cxx |6 +++---
 sc/source/ui/vba/vbaformatconditions.hxx |4 +++-
 5 files changed, 16 insertions(+), 12 deletions(-)

New commits:
commit a85c7cf02603408b09c15344803e293bb4b5bb81
Author: Noel Grandin 
AuthorDate: Wed Nov 8 13:09:48 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 9 09:10:20 2023 +0100

loplugin:fieldcast in ScVbaAxis

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

diff --git a/sc/source/ui/vba/vbaaxes.cxx b/sc/source/ui/vba/vbaaxes.cxx
index 5dc3fb7a07e9..0a377750aa59 100644
--- a/sc/source/ui/vba/vbaaxes.cxx
+++ b/sc/source/ui/vba/vbaaxes.cxx
@@ -79,8 +79,7 @@ ScVbaAxes::createAxis( const uno::Reference< excel::XChart >& 
xChart, const uno:
 }
 else
 DebugHelper::runtimeexception(ERRCODE_BASIC_METHOD_FAILED);
-uno::Reference< XHelperInterface > xParent( xChart, uno::UNO_QUERY_THROW );
-return new ScVbaAxis( xParent, xContext, xAxisPropertySet, nType, 
nAxisGroup);
+return new ScVbaAxis( pChart, xContext, xAxisPropertySet, nType, 
nAxisGroup);
 }
 
 namespace {
diff --git a/sc/source/ui/vba/vbaaxis.cxx b/sc/source/ui/vba/vbaaxis.cxx
index aa461abee0da..76cf9fe066e3 100644
--- a/sc/source/ui/vba/vbaaxis.cxx
+++ b/sc/source/ui/vba/vbaaxis.cxx
@@ -37,7 +37,7 @@ constexpr OUStringLiteral VBA_MAX(u"Min");
 ScVbaChart*
 ScVbaAxis::getChartPtr()
 {
-ScVbaChart* pChart = static_cast< ScVbaChart* >( moChartParent.get() );
+ScVbaChart* pChart = moChartParent.get();
 if ( !pChart )
 throw uno::RuntimeException("Can't access parent chart impl" );
 return pChart;
@@ -53,17 +53,17 @@ ScVbaAxis::isValueAxis()
 return true;
 }
 
-ScVbaAxis::ScVbaAxis( const uno::Reference< XHelperInterface >& xParent,
+ScVbaAxis::ScVbaAxis( const rtl::Reference< ScVbaChart >& xParent,
   const uno::Reference< uno::XComponentContext > & 
xContext,
   uno::Reference< beans::XPropertySet >  _xPropertySet,
   sal_Int32 _nType, sal_Int32 _nGroup )
   : ScVbaAxis_BASE( xParent, xContext ),
+moChartParent(xParent),
 mxPropertySet(std::move( _xPropertySet )),
 mnType( _nType ), mnGroup( _nGroup ),
 maShapeHelper( uno::Reference< drawing::XShape >( mxPropertySet, 
uno::UNO_QUERY ) ),
 bCrossesAreCustomized( false )
 {
-moChartParent.set( xParent, uno::UNO_QUERY_THROW  );
 setType(_nType);
 setCrosses(xlAxisCrossesAutomatic);
 }
diff --git a/sc/source/ui/vba/vbaaxis.hxx b/sc/source/ui/vba/vbaaxis.hxx
index 787d2e03763a..8fcb9a399092 100644
--- a/sc/source/ui/vba/vbaaxis.hxx
+++ b/sc/source/ui/vba/vbaaxis.hxx
@@ -21,12 +21,15 @@
 #include 
 #include 
 #include 
+#include 
 #include 
-typedef InheritedHelperInterfaceWeakImpl< ov::excel::XAxis >  ScVbaAxis_BASE;
+
 class ScVbaChart;
+
+typedef InheritedHelperInterfaceWeakImpl< ov::excel::XAxis >  ScVbaAxis_BASE;
 class ScVbaAxis : public ScVbaAxis_BASE
 {
-css::uno::Reference< ov::excel::XChart > moChartParent;
+rtl::Reference< ScVbaChart > moChartParent;
 css::uno::Reference< css::beans::XPropertySet > mxPropertySet;
 sal_Int32 mnType;
 sal_Int32 mnGroup;
@@ -39,7 +42,7 @@ class ScVbaAxis : public ScVbaAxis_BASE
 bool isValueAxis();
 
 public:
-ScVbaAxis( const css::uno::Reference< ov::XHelperInterface >& xParent, 
const css::uno::Reference< css::uno::XComponentContext > & xContext, 
css::uno::Reference< css::beans::XPropertySet >  _xPropertySet, sal_Int32 
_nType, sal_Int32 _nGroup );
+ScVbaAxis( const rtl::Reference< ScVbaChart >& xParent, const 
css::uno::Reference< css::uno::XComponentContext > & xContext, 
css::uno::Reference< css::beans::XPropertySet >  _xPropertySet, sal_Int32 
_nType, sal_Int32 _nGroup );
 // Methods
 virtual void SAL_CALL Delete(  ) override;
 virtual css::uno::Reference< ::ooo::vba::excel::XAxisTitle > SAL_CALL 
getAxisTitle(  ) override;
commit 33729810b5f8ff5232195a5390c58e6e50900253
Author: Noel Grandin 
AuthorDate: Wed Nov 8 13:07:19 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 9 09:10:12 2023 +0100

loplugin:fieldcast in ScVbaFormatConditions

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

diff --git a/sc/source/ui/vba/vbaformatconditions.cxx 
b/sc/source/ui/vba/vbaformatconditions.cxx
index a840a6fb5f78..a6c3ae4125e8 100644
--- a/sc/source/ui/vba/vbaformatconditions.cxx
+++ b/sc/source/ui/vba/vbaformatconditions.cxx
@@ -37,7 +37,7 @@ ScVbaFormatConditions::Delete(  )
 {
 try
 {
-ScVbaStyles* pStyles = static_cast< ScVbaStyles* >( 

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

2023-09-28 Thread Caolán McNamara (via logerrit)
 sc/source/ui/view/gridwin5.cxx   |7 +--
 sw/source/core/layout/ftnfrm.cxx |2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit a4716c316689de359eba1eb2a9f99e169c48cf59
Author: Caolán McNamara 
AuthorDate: Thu Sep 28 08:48:59 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Sep 28 11:40:03 2023 +0200

cid#1546174 Unused value

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

diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index b2edab893023..78d25949c91b 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -2294,7 +2294,7 @@ void SwFootnoteBossFrame::RearrangeFootnotes( const 
SwTwips nDeadLine, const boo
 {
 pLastFootnoteFrame->Cut();
 SwFrame::DestroyFrame(pLastFootnoteFrame);
-pLastFootnoteFrame = nullptr;
+// pLastFootnoteFrame overwritten at end of block
 }
 }
 if ( !bLock )
commit 337796cdab209f4dd0768bb61134a37f8f713371
Author: Caolán McNamara 
AuthorDate: Thu Sep 28 08:32:12 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Sep 28 11:39:53 2023 +0200

cid#1546404 Explicit null dereferenced

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

diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index 22ee3726b124..206b53843ed6 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -298,8 +298,11 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
 {
 if( aVEvt.meEvent == SdrEventKind::ExecuteUrl )
 {
-aHelpText = 
SfxHelp::GetURLHelpText(aVEvt.mpURLField->GetURL());
-aPixRect = LogicToPixel(aVEvt.mpObj->GetLogicRect());
+if (aVEvt.mpURLField)
+{
+aHelpText = 
SfxHelp::GetURLHelpText(aVEvt.mpURLField->GetURL());
+aPixRect = 
LogicToPixel(aVEvt.mpObj->GetLogicRect());
+}
 }
 else
 {


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

2023-09-01 Thread Henry Castro (via logerrit)
 sc/source/filter/inc/rtfexp.hxx |5 ++
 sc/source/filter/rtf/rtfexp.cxx |   75 
 2 files changed, 80 insertions(+)

New commits:
commit cb72f56977faccbda9490bc16ea3cbf7a22c01b0
Author: Henry Castro 
AuthorDate: Tue Jul 25 15:36:52 2023 -0400
Commit: Caolán McNamara 
CommitDate: Fri Sep 1 16:19:48 2023 +0200

sc: filter: rtf: add method "WriteFontTable"

Write the font table while visiting column/row and
get the unique index to reference it.

"The \fonttbl control word introduces the font table group.
Unique \fN control words define each font available in the document,
and are used to reference that font throughout the document."

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

diff --git a/sc/source/filter/inc/rtfexp.hxx b/sc/source/filter/inc/rtfexp.hxx
index 1c9f1bd7a4af..9d0b204540c7 100644
--- a/sc/source/filter/inc/rtfexp.hxx
+++ b/sc/source/filter/inc/rtfexp.hxx
@@ -28,12 +28,14 @@ class ScRTFExport : public ScExportBase
 {
 std::unique_ptr  m_pCellX; // cumulative range in a table
 std::map m_pFontTable;
+SvMemoryStream m_aFontStrm;
 SvMemoryStream m_aDocStrm;
 
 int AddFont( const SvxFontItem& rFontItem );
 voidWriteTab( SCTAB nTab );
 voidWriteRow( SCTAB nTab, SCROW nRow );
 voidWriteCell( SCTAB nTab,  SCROW nRow, SCCOL nCol );
+voidWriteFontTable(const SvxFontItem& rFontItem, int 
nIndex);
 
 public:
 
diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx
index 8d38def244b3..7349aa698591 100644
--- a/sc/source/filter/rtf/rtfexp.cxx
+++ b/sc/source/filter/rtf/rtfexp.cxx
@@ -19,6 +19,9 @@
 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -60,6 +63,8 @@ void ScRTFExport::Write()
 rStrm.WriteChar( '{' ).WriteOString( OOO_STRING_SVTOOLS_RTF_RTF );
 rStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_ANSI ).WriteOString( 
SAL_NEWLINE_STRING );
 
+m_aFontStrm.WriteChar( '{' ).WriteOString( OOO_STRING_SVTOOLS_RTF_FONTTBL 
);
+
 // Data
 for ( SCTAB nTab = aRange.aStart.Tab(); nTab <= aRange.aEnd.Tab(); nTab++ )
 {
@@ -68,6 +73,9 @@ void ScRTFExport::Write()
 WriteTab( nTab );
 }
 
+m_aFontStrm.WriteChar( '}' );
+m_aFontStrm.Seek(0);
+rStrm.WriteStream(m_aFontStrm);
 m_aDocStrm.Seek(0);
 rStrm.WriteStream(m_aDocStrm);
 rStrm.WriteChar( '}' ).WriteOString( SAL_NEWLINE_STRING );
@@ -148,6 +156,51 @@ void ScRTFExport::WriteRow( SCTAB nTab, SCROW nRow )
 m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_ROW ).WriteOString( 
SAL_NEWLINE_STRING );
 }
 
+void ScRTFExport::WriteFontTable(const SvxFontItem& rFontItem, int nIndex)
+{
+m_aFontStrm.WriteChar( '{' );
+m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_F );
+m_aFontStrm.WriteOString( OString::number(nIndex) );
+
+FontFamily eFamily = rFontItem.GetFamily();
+if (eFamily == FAMILY_DONTKNOW)
+m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_FNIL );
+else if (eFamily == FAMILY_DECORATIVE)
+m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_FDECOR );
+else if (eFamily == FAMILY_MODERN)
+m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_FMODERN );
+else if (eFamily == FAMILY_ROMAN)
+m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_FROMAN );
+else if (eFamily == FAMILY_SCRIPT)
+m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_FSCRIPT );
+else if (eFamily == FAMILY_SWISS)
+m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_FSWISS );
+
+m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_FPRQ );
+
+sal_uInt16 nVal = 0;
+FontPitch ePitch = rFontItem.GetPitch();
+if ( ePitch == PITCH_FIXED )
+nVal = 1;
+else if ( ePitch == PITCH_VARIABLE )
+nVal = 2;
+m_aFontStrm.WriteOString( OString::number(nVal) );
+
+rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252;
+rtl_TextEncoding eChrSet = rFontItem.GetCharSet();
+if (IsOpenSymbol(rFontItem.GetFamilyName()))
+eChrSet = RTL_TEXTENCODING_UTF8;
+else if( RTL_TEXTENCODING_DONTKNOW == eChrSet )
+eChrSet = osl_getThreadTextEncoding();
+
+m_aFontStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_FCHARSET );
+m_aFontStrm.WriteOString( 
OString::number(rtl_getBestWindowsCharsetFromTextEncoding( eChrSet )) );
+
+m_aFontStrm.WriteChar( ' ' );
+RTFOutFuncs::Out_String( m_aFontStrm, rFontItem.GetFamilyName(), eDestEnc 
);
+m_aFontStrm.WriteOString( ";}" );
+}
+
 int ScRTFExport::AddFont(const SvxFontItem& rFontItem)
 {
 auto nRet = m_pFontTable.size();
@@ -155,6 +208,7 @@ int 

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

2023-09-01 Thread Henry Castro (via logerrit)
 sc/source/filter/inc/rtfexp.hxx |3 +-
 sc/source/filter/rtf/rtfexp.cxx |   58 
 2 files changed, 32 insertions(+), 29 deletions(-)

New commits:
commit 18e8c72d680b91da730dd8bb7c26c60b954ee074
Author: Henry Castro 
AuthorDate: Tue Jul 25 15:28:39 2023 -0400
Commit: Caolán McNamara 
CommitDate: Fri Sep 1 16:19:27 2023 +0200

sc: filter: rtf: prefix m_* private members

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

diff --git a/sc/source/filter/inc/rtfexp.hxx b/sc/source/filter/inc/rtfexp.hxx
index 9a4fe43d9d02..14ee8ec023f7 100644
--- a/sc/source/filter/inc/rtfexp.hxx
+++ b/sc/source/filter/inc/rtfexp.hxx
@@ -25,7 +25,7 @@
 
 class ScRTFExport : public ScExportBase
 {
-std::unique_ptr  pCellX; // cumulative range in a table
+std::unique_ptr  m_pCellX; // cumulative range in a table
 SvMemoryStream m_aDocStrm;
 
 voidWriteTab( SCTAB nTab );
diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx
index 5cef70300617..99336e6f022c 100644
--- a/sc/source/filter/rtf/rtfexp.cxx
+++ b/sc/source/filter/rtf/rtfexp.cxx
@@ -46,7 +46,7 @@ void ScFormatFilterPluginImpl::ScExportRTF( SvStream& rStrm, 
ScDocument* pDoc,
 ScRTFExport::ScRTFExport( SvStream& rStrmP, ScDocument* pDocP, const ScRange& 
rRangeP )
 :
 ScExportBase( rStrmP, pDocP, rRangeP ),
-pCellX( new sal_uLong[ pDoc->MaxCol()+2 ] )
+m_pCellX( new sal_uLong[ pDoc->MaxCol()+2 ] )
 {
 }
 
@@ -77,12 +77,12 @@ void ScRTFExport::WriteTab( SCTAB nTab )
 m_aDocStrm.WriteChar( '{' ).WriteOString( SAL_NEWLINE_STRING );
 if ( pDoc->HasTable( nTab ) )
 {
-memset( [0], 0, (pDoc->MaxCol()+2) * sizeof(sal_uLong) );
+memset( _pCellX[0], 0, (pDoc->MaxCol()+2) * sizeof(sal_uLong) );
 SCCOL nCol;
 SCCOL nEndCol = aRange.aEnd.Col();
 for ( nCol = aRange.aStart.Col(); nCol <= nEndCol; nCol++ )
 {
-pCellX[nCol+1] = pCellX[nCol] + pDoc->GetColWidth( nCol, nTab );
+m_pCellX[nCol+1] = m_pCellX[nCol] + pDoc->GetColWidth( nCol, nTab 
);
 }
 
 SCROW nEndRow = aRange.aEnd.Row();
@@ -128,7 +128,7 @@ void ScRTFExport::WriteRow( SCTAB nTab, SCROW nRow )
 if ( pChar )
 m_aDocStrm.WriteOString( pChar );
 
-m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_CELLX ).WriteOString( 
OString::number(pCellX[nCol+1]) );
+m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_CELLX ).WriteOString( 
OString::number(m_pCellX[nCol+1]) );
 if ( (nCol & 0x0F) == 0x0F )
 m_aDocStrm.WriteOString( SAL_NEWLINE_STRING ); // Do not let lines 
get too long
 }
commit a0a3500c58ae5bcb8ffb4126c43227ba0544f8bf
Author: Henry Castro 
AuthorDate: Tue Jul 25 15:18:10 2023 -0400
Commit: Caolán McNamara 
CommitDate: Fri Sep 1 16:19:12 2023 +0200

sc: filter: rtf: use a separate document stream

"An RTF file has the following syntax:
'{'  '}' "

In order to build the header:


\rtf  \deff?  ? ? 
? ? ?

The font table should be created while visiting the column/rows.

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

diff --git a/sc/source/filter/inc/rtfexp.hxx b/sc/source/filter/inc/rtfexp.hxx
index 0d5e69f79d8e..9a4fe43d9d02 100644
--- a/sc/source/filter/inc/rtfexp.hxx
+++ b/sc/source/filter/inc/rtfexp.hxx
@@ -26,6 +26,7 @@
 class ScRTFExport : public ScExportBase
 {
 std::unique_ptr  pCellX; // cumulative range in a table
+SvMemoryStream m_aDocStrm;
 
 voidWriteTab( SCTAB nTab );
 voidWriteRow( SCTAB nTab, SCROW nRow );
diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx
index 32549cbff377..5cef70300617 100644
--- a/sc/source/filter/rtf/rtfexp.cxx
+++ b/sc/source/filter/rtf/rtfexp.cxx
@@ -63,16 +63,18 @@ void ScRTFExport::Write()
 for ( SCTAB nTab = aRange.aStart.Tab(); nTab <= aRange.aEnd.Tab(); nTab++ )
 {
 if ( nTab > aRange.aStart.Tab() )
-rStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_PAR );
+m_aDocStrm.WriteOString( OOO_STRING_SVTOOLS_RTF_PAR );
 WriteTab( nTab );
 }
 
+m_aDocStrm.Seek(0);
+rStrm.WriteStream(m_aDocStrm);
 rStrm.WriteChar( '}' ).WriteOString( SAL_NEWLINE_STRING );
 }
 
 void ScRTFExport::WriteTab( SCTAB nTab )
 {
-rStrm.WriteChar( '{' 

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

2023-08-18 Thread Caolán McNamara (via logerrit)
 sc/source/ui/inc/gridwin.hxx   |3 +--
 sc/source/ui/view/tabview3.cxx |7 ---
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 34d32740d89876c3d4fd2743a07d6e2578601683
Author: Caolán McNamara 
AuthorDate: Thu Aug 17 20:43:22 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 18 23:00:57 2023 +0200

on invalidating other views, specific what Tab is invalidated

the other views might be viewing other tabs and it is only
the tab ('part') this view is on which is invalidated

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

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 979767c6801b..deb3264c7759 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -320,8 +320,6 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public 
vcl::DocWindow, public DropTarget
 voidSetupInitialPageBreaks(const ScDocument& rDoc, SCTAB nTab);
 DECL_DLLPRIVATE_LINK(InitiatePageBreaksTimer, Timer*, void);
 
-voidLogicInvalidatePart(const tools::Rectangle* pRectangle, 
int nPart);
-
 protected:
 virtual voidPrePaint(vcl::RenderContext& rRenderContext) override;
 virtual voidPaint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle& rRect) override;
@@ -380,6 +378,7 @@ public:
 
 /// @see Window::LogicInvalidate().
 void LogicInvalidate(const tools::Rectangle* pRectangle) override;
+void LogicInvalidatePart(const tools::Rectangle* pRectangle, int nPart);
 
 /// Update the cell selection according to what handles have been dragged.
 /// @see vcl::ITiledRenderable::setTextSelection() for the values of nType.
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 38c8fcca449e..9a321f73eefe 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2200,6 +2200,7 @@ void ScTabView::KillEditView( bool bNoPaint )
 SCROW nRow1 = aViewData.GetEditStartRow();
 SCCOL nCol2 = aViewData.GetEditEndCol();
 SCROW nRow2 = aViewData.GetEditEndRow();
+SCTAB nTab = aViewData.GetTabNo();
 bool bPaint[4];
 bool bNotifyAcc = false;
 tools::Rectangle aRectangle[4];
@@ -2237,16 +2238,16 @@ void ScTabView::KillEditView( bool bNoPaint )
 if (comphelper::LibreOfficeKit::isActive())
 {
 const tools::Rectangle& rInvRect = aRectangle[i];
-pGridWin[i]->LogicInvalidate();
+pGridWin[i]->LogicInvalidatePart(, nTab);
 
 // invalidate other views
 auto lInvalidateWindows =
-[] (ScTabView* pTabView)
+[nTab, ] (ScTabView* pTabView)
 {
 for (VclPtr const & pWin: 
pTabView->pGridWin)
 {
 if (pWin)
-pWin->LogicInvalidate();
+pWin->LogicInvalidatePart(, nTab);
 }
 };
 
commit a35311beef378c15ecbb3bb0560035c17f4657ca
Author: Caolán McNamara 
AuthorDate: Thu Aug 17 20:33:14 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 18 23:00:48 2023 +0200

for LibreOfficeKit::isActive we can skip to LogicInvalidate

it should be the same effect

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

diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 03a15b4437d9..38c8fcca449e 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2237,7 +2237,7 @@ void ScTabView::KillEditView( bool bNoPaint )
 if (comphelper::LibreOfficeKit::isActive())
 {
 const tools::Rectangle& rInvRect = aRectangle[i];
-pGridWin[i]->Invalidate(rInvRect);
+pGridWin[i]->LogicInvalidate();
 
 // invalidate other views
 auto lInvalidateWindows =
@@ -2246,7 +2246,7 @@ void ScTabView::KillEditView( bool bNoPaint )
 for (VclPtr const & pWin: 
pTabView->pGridWin)
 {
 if (pWin)
-pWin->Invalidate(rInvRect);
+pWin->LogicInvalidate();
 }
 };
 


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

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

New commits:
commit a58b3984c1ad05d77eaefd424da12d9b833f76b8
Author: Henry Castro 
AuthorDate: Tue Jul 18 15:09:18 2023 -0400
Commit: Tomaž Vajngerl 
CommitDate: Tue Aug 8 16:44:24 2023 +0200

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

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

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

diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index 019bc460cb25..4faa5d89d569 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -198,6 +198,8 @@ void moveRefByCell(SCCOL& rNewX, SCROW& rNewY,
SCCOL nMovX, SCROW nMovY, SCTAB nRefTab,
const ScDocument& rDoc)
 {
+SCCOL nOldX = rNewX;
+SCROW nOldY = rNewY;
 bool bSelectLocked = true;
 bool bSelectUnlocked = true;
 const ScTableProtection* pTabProtection = rDoc.GetTabProtection(nRefTab);
@@ -224,6 +226,15 @@ void moveRefByCell(SCCOL& rNewX, SCROW& rNewY,
 }
 if (isCellQualified(, nTempX, rNewY, nRefTab, bSelectLocked, 
bSelectUnlocked))
 rNewX = nTempX;
+
+if (nMovX < 0 && rNewX > 0)
+{
+const ScMergeAttr* pMergeAttr = rDoc.GetAttr(rNewX, rNewY, 
nRefTab, ATTR_MERGE);
+if (pMergeAttr && pMergeAttr->IsMerged() &&
+nOldX >= rNewX &&
+nOldX <= rNewX + pMergeAttr->GetRowMerge() - 1)
+rNewX = rNewX - 1;
+}
 }
 
 if (nMovY)
@@ -240,6 +251,15 @@ void moveRefByCell(SCCOL& rNewX, SCROW& rNewY,
 }
 if (isCellQualified(, rNewX, nTempY, nRefTab, bSelectLocked, 
bSelectUnlocked))
 rNewY = nTempY;
+
+if (nMovY < 0 && rNewY > 0)
+{
+const ScMergeAttr* pMergeAttr = rDoc.GetAttr(rNewX, rNewY, 
nRefTab, ATTR_MERGE);
+if (pMergeAttr && pMergeAttr->IsMerged() &&
+nOldY >= rNewY &&
+nOldY <= rNewY + pMergeAttr->GetRowMerge() - 1)
+rNewY = rNewY - 1;
+}
 }
 
 rDoc.SkipOverlapped(rNewX, rNewY, nRefTab);
commit 6ca51786b90270c86e854f85728f77d0ef5cffa6
Author: Henry Castro 
AuthorDate: Mon Jul 17 09:41:55 2023 -0400
Commit: Tomaž Vajngerl 
CommitDate: Tue Aug 8 16:44:15 2023 +0200

tdf#155799: sc: abstraction "moveRefByCell"

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

diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index f80f0b309c15..019bc460cb25 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -194,6 +194,57 @@ bool checkBoundary(const ScDocument* pDoc, SCCOL& rCol, 
SCROW& rRow)
 return bGood;
 }
 
+void moveRefByCell(SCCOL& rNewX, SCROW& rNewY,
+   SCCOL nMovX, SCROW nMovY, SCTAB nRefTab,
+   const ScDocument& rDoc)
+{
+bool bSelectLocked = true;
+bool bSelectUnlocked = true;
+const ScTableProtection* pTabProtection = rDoc.GetTabProtection(nRefTab);
+if (pTabProtection && pTabProtection->isProtected())
+{
+bSelectLocked   = 
pTabProtection->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
+bSelectUnlocked = 
pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
+}
+
+moveCursorByProtRule(rNewX, rNewY, nMovX, nMovY, nRefTab, );
+checkBoundary(, rNewX, rNewY);
+
+if (nMovX)
+{
+SCCOL nTempX = rNewX;
+while (rDoc.IsHorOverlapped(nTempX, rNewY, nRefTab))
+{
+if (nMovX > 0)
+++nTempX;
+else
+--nTempX;
+if (!checkBoundary(, nTempX, rNewY))
+break;
+}
+if (isCellQualified(, nTempX, rNewY, nRefTab, bSelectLocked, 
bSelectUnlocked))
+rNewX = nTempX;
+}
+
+if (nMovY)
+{
+SCROW nTempY = rNewY;
+while (rDoc.IsVerOverlapped(rNewX, nTempY, nRefTab))
+{
+if (nMovY > 0)
+++nTempY;
+else
+--nTempY;
+if (!checkBoundary(, rNewX, nTempY))
+break;
+}
+if (isCellQualified(, rNewX, nTempY, nRefTab, bSelectLocked, 
bSelectUnlocked))
+rNewY = nTempY;
+}
+
+rDoc.SkipOverlapped(rNewX, rNewY, nRefTab);
+}
+
 void moveCursorByMergedCell(SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW 
nMovY, SCCOL nStartX,
  

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

2023-07-23 Thread Caolán McNamara (via logerrit)
 sc/source/filter/oox/workbookhelper.cxx |9 -
 sw/source/core/docnode/ndtbl.cxx|3 ++-
 2 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit d6f6bcec4dbfa30c199cb5f4db7bea88ebbeb85d
Author: Caolán McNamara 
AuthorDate: Sat Jul 22 19:55:06 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sun Jul 23 11:53:17 2023 +0200

cid#1401342 Uncaught exception

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

diff --git a/sc/source/filter/oox/workbookhelper.cxx 
b/sc/source/filter/oox/workbookhelper.cxx
index 817340afb341..3f9e3fe7d0ec 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -226,6 +226,8 @@ private:
 /** Finalizes the filter process (sets some needed document properties). */
 voidfinalize();
 
+voidImplDestroy();
+
 private:
 typedef ::std::unique_ptr< ScEditEngineDefaulter >
EditEngineDefaulterPtr;
 typedef ::std::unique_ptr< FormulaBuffer >  FormulaBufferPtr;
@@ -308,12 +310,17 @@ WorkbookGlobals::WorkbookGlobals( ExcelFilter& rFilter ) :
 initialize();
 }
 
-WorkbookGlobals::~WorkbookGlobals()
+void WorkbookGlobals::ImplDestroy()
 {
 finalize();
 mrExcelFilter.unregisterWorkbookGlobals();
 }
 
+WorkbookGlobals::~WorkbookGlobals()
+{
+suppress_fun_call_w_exception(ImplDestroy());
+}
+
 ScDocumentImport& WorkbookGlobals::getDocImport()
 {
 return *mxDocImport;
commit b6f3b76fb611a5f2c7f32296bc86316b6abb32cb
Author: Caolán McNamara 
AuthorDate: Sat Jul 22 19:52:03 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sun Jul 23 11:53:03 2023 +0200

cid#1538889 Pointer to local outside scope

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

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 42c62bc9f802..b182407db8ef 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1928,7 +1928,8 @@ void SwDoc::DelTable(SwTableNode *const pTableNd)
 {
 {
 // tdf#156267 remove DdeBookmarks before deleting nodes
-SwDataChanged aTmp(SwPaM(*pTableNd, *pTableNd->EndOfSectionNode()));
+SwPaM aTmpPaM(*pTableNd, *pTableNd->EndOfSectionNode());
+SwDataChanged aTmp(aTmpPaM);
 }
 
 bool bNewTextNd = false;


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

2023-07-05 Thread Noel Grandin (via logerrit)
 sc/source/ui/inc/output.hxx |2 +-
 sc/source/ui/view/output2.cxx   |   24 ++--
 sfx2/source/dialog/templdlg.cxx |9 +++--
 sfx2/source/inc/templdgi.hxx|2 +-
 sw/inc/authfld.hxx  |5 ++---
 sw/source/core/fields/authfld.cxx   |9 +++--
 sw/source/core/txtnode/atrref.cxx   |2 +-
 sw/source/uibase/dialog/regionsw.cxx|3 +--
 sw/source/uibase/fldui/fldmgr.cxx   |2 +-
 sw/source/uibase/inc/translatehelper.hxx|5 ++---
 sw/source/uibase/shells/textfld.cxx |7 +++
 sw/source/uibase/shells/textsh1.cxx |8 
 sw/source/uibase/shells/translatehelper.cxx |   20 +++-
 13 files changed, 35 insertions(+), 63 deletions(-)

New commits:
commit 1a561775a486b5daf4b04b287dc3849b387ec388
Author: Noel Grandin 
AuthorDate: Tue Jul 4 16:28:09 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Jul 5 09:34:11 2023 +0200

loplugin:constantparam

Change-Id: I0b4b2854f5e82e78e63b01b78b949e27011630c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153982
Tested-by: Noel Grandin 
Reviewed-by: Noel Grandin 

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 9aef5085cec6..6996f5090b68 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -221,10 +221,9 @@ public:
 OUString GetAbsoluteURL() const;
 
 /**
- * Returns full URI for the URL, relative if specified
- * \param   bRelative   whether the path should be relative (when dealing 
with local files)
+ * Returns relative URI for the URL
  */
-OUString GetURI(bool bRelative) const;
+OUString GetRelativeURI() const;
 
 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
diff --git a/sw/source/core/fields/authfld.cxx 
b/sw/source/core/fields/authfld.cxx
index 77b640739760..35ab9ca9c894 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -623,7 +623,7 @@ OUString SwAuthorityField::GetAuthority(const SwRootFrame* 
pLayout, const SwForm
 }
 else if (AUTH_FIELD_URL == eField)
 {
-aText += GetURI(true);
+aText += GetRelativeURI();
 }
 else
 {
@@ -656,7 +656,7 @@ OUString SwAuthorityField::GetAbsoluteURL() const
 
INetURLObject::DecodeMechanism::WithCharset);
 }
 
-OUString SwAuthorityField::GetURI(bool bRelative) const
+OUString SwAuthorityField::GetRelativeURI() const
 {
 OUString sTmp = GetFieldText(AUTH_FIELD_URL);
 
@@ -688,10 +688,7 @@ OUString SwAuthorityField::GetURI(bool bRelative) const
 sTmp = xUriRef->getUriReference();
 }
 
-// If the URI is not supposed to be relative, we return here the full URI
-if (!bRelative)
-return sTmp;
-
+// convert to relative
 bool bSaveRelFSys = 
officecfg::Office::Common::Save::URL::FileSystem::get();
 if (xUriRef.is() && bSaveRelFSys && xUriRef->getScheme() == aBaseURIScheme)
 {
diff --git a/sw/source/core/txtnode/atrref.cxx 
b/sw/source/core/txtnode/atrref.cxx
index ffb4509aee70..d7beb0e83bd0 100644
--- a/sw/source/core/txtnode/atrref.cxx
+++ b/sw/source/core/txtnode/atrref.cxx
@@ -179,7 +179,7 @@ void SwTextRefMark::UpdateFieldContent(SwDoc* pDoc, 
SwWrtShell& rWrtSh, OUString
 // Paste HTML content.
 SwPaM* pCursorPos = rWrtSh.GetCursor();
 *pCursorPos = aPasteEnd;
-SwTranslateHelper::PasteHTMLToPaM(rWrtSh, pCursorPos, 
aContent.toUtf8(), true);
+SwTranslateHelper::PasteHTMLToPaM(rWrtSh, pCursorPos, 
aContent.toUtf8());
 
 // Update the refmark to point to the new content.
 sal_Int32 nOldStart = this->GetStart();
diff --git a/sw/source/uibase/dialog/regionsw.cxx 
b/sw/source/uibase/dialog/regionsw.cxx
index 834f1b332bc5..9eaa64c89456 100644
--- a/sw/source/uibase/dialog/regionsw.cxx
+++ b/sw/source/uibase/dialog/regionsw.cxx
@@ -161,8 +161,7 @@ void SwBaseShell::InsertRegionDialog(SfxRequest& rReq)
 SwPaM* pCursorPos = rSh.GetCursor();
 pCursorPos->Move(fnMoveBackward, GoInContent);
 // Paste HTML content.
-SwTranslateHelper::PasteHTMLToPaM(rSh, pCursorPos, 
aSectionContent.toUtf8(),
-  /*bSetSelection=*/true);
+SwTranslateHelper::PasteHTMLToPaM(rSh, pCursorPos, 
aSectionContent.toUtf8());
 if (pCursorPos->GetPoint()->GetContentIndex() == 0)
 {
 // The paste created a last empty text node, remove it.
diff --git a/sw/source/uibase/fldui/fldmgr.cxx 
b/sw/source/uibase/fldui/fldmgr.cxx
index 1596b1094e89..b7c3e60e9a84 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -1086,7 +1086,7 @@ bool SwFieldMgr::InsertField(
 
 // Paste 

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

2023-07-03 Thread Tomaž Vajngerl (via logerrit)
 sc/source/ui/drawfunc/drawsh.cxx   |6 +++---
 svx/source/tbxctrls/PaletteManager.cxx |2 --
 2 files changed, 3 insertions(+), 5 deletions(-)

New commits:
commit 548e5b6d825606bd218ef18591df642872e6acd0
Author: Tomaž Vajngerl 
AuthorDate: Tue Jul 4 00:38:01 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 4 03:51:41 2023 +0200

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

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

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

diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 52ec9d9d438a..fde34e9d6686 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -260,9 +260,9 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
 
 if( pView->AreObjectsMarked() )
 {
-SfxItemSet aNewArgs = rReq.GetArgs()->CloneAsValue();
-lcl_convertStringArguments(aNewArgs);
-pView->SetAttrToMarked( aNewArgs, false );
+std::unique_ptr aNewArgs = 
rReq.GetArgs()->Clone();
+lcl_convertStringArguments(*aNewArgs);
+pView->SetAttrToMarked(*aNewArgs, false);
 }
 else
 pView->SetDefaultAttr( *rReq.GetArgs(), false);
commit cbc45a7f713ea1f2c44ed27b371e342ed7547e05
Author: Tomaž Vajngerl 
AuthorDate: Tue Jul 4 00:37:30 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 4 03:51:33 2023 +0200

svx: PaletteManager - remove printf

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

diff --git a/svx/source/tbxctrls/PaletteManager.cxx 
b/svx/source/tbxctrls/PaletteManager.cxx
index 7735e09d44e8..607bd60df921 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -430,8 +430,6 @@ void PaletteManager::DispatchColorCommand(const OUString& 
aCommand, const NamedC
 comphelper::makePropertyValue(aObj.GetURLPath()+ ".Color", 
sal_Int32(rColor.m_aColor)),
 };
 
-printf ("Sending: %s\n", aObj.GetURLPath().toUtf8().getStr());
-
 if (rColor.m_nThemeIndex != -1)
 {
 model::ComplexColor aComplexColor;


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

2023-06-18 Thread Mike Kaganski (via logerrit)
 sc/source/core/data/drawpage.cxx   |2 
 sc/source/ui/drawfunc/fuins2.cxx   |2 
 sc/source/ui/pagedlg/tphfedit.cxx  |2 
 sc/source/ui/unoobj/PivotTableDataProvider.cxx |2 
 sc/source/ui/unoobj/TablePivotCharts.cxx   |2 
 sc/source/ui/unoobj/celllistsource.cxx |8 +-
 sc/source/ui/unoobj/cellsuno.cxx   |6 -
 sc/source/ui/unoobj/cellvaluebinding.cxx   |8 +-
 sc/source/ui/unoobj/chart2uno.cxx  |2 
 sc/source/ui/unoobj/chartuno.cxx   |2 
 sc/source/ui/unoobj/dapiuno.cxx|   82 -
 sc/source/ui/unoobj/datauno.cxx|2 
 sc/source/ui/unoobj/dispuno.cxx|6 -
 sc/source/ui/unoobj/docuno.cxx |   10 +--
 sc/source/ui/unoobj/fielduno.cxx   |4 -
 sc/source/ui/unoobj/linkuno.cxx|6 -
 sc/source/ui/unoobj/nameuno.cxx|4 -
 sc/source/ui/unoobj/notesuno.cxx   |2 
 sc/source/ui/unoobj/servuno.cxx|8 +-
 sc/source/ui/unoobj/shapeuno.cxx   |   10 +--
 sc/source/ui/unoobj/styleuno.cxx   |2 
 sc/source/ui/unoobj/viewuno.cxx|   16 ++--
 sc/source/ui/vba/vbaaxes.cxx   |2 
 sc/source/ui/vba/vbachartobjects.cxx   |2 
 svl/source/fsstor/fsfactory.cxx|   20 ++
 svl/source/fsstor/fsstorage.cxx|   10 +--
 svl/source/fsstor/oinputstreamcontainer.cxx|2 
 svl/source/fsstor/ostreamcontainer.cxx |2 
 svl/source/items/style.cxx |2 
 29 files changed, 112 insertions(+), 116 deletions(-)

New commits:
commit 627984834cffbe6d1afce8b2be91277c221525b8
Author: Mike Kaganski 
AuthorDate: Sun Apr 23 20:14:58 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sun Jun 18 10:14:05 2023 +0200

Use getXWeak in svl

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

diff --git a/svl/source/fsstor/fsfactory.cxx b/svl/source/fsstor/fsfactory.cxx
index 81c2bcff307d..ed88fe789b72 100644
--- a/svl/source/fsstor/fsfactory.cxx
+++ b/svl/source/fsstor/fsfactory.cxx
@@ -45,12 +45,10 @@ uno::Reference< uno::XInterface > SAL_CALL 
FSStorageFactory::createInstance()
 aTempURL, uno::Reference< ucb::XCommandEnvironment >(),
 comphelper::getProcessComponentContext() );
 
-return uno::Reference< uno::XInterface >(
-static_cast< OWeakObject* >(
+return cppu::getXWeak(
 new FSStorage(  aResultContent,
 embed::ElementModes::READWRITE,
-m_xContext ) ),
-uno::UNO_QUERY );
+m_xContext ) );
 }
 
 /**
@@ -79,7 +77,7 @@ uno::Reference< uno::XInterface > SAL_CALL 
FSStorageFactory::createInstanceWithA
 ("second argument to css.embed.FileSystemStorageFactory."
  "createInstanceWithArguments must be a"
  " css.embed.ElementModes"),
-static_cast< OWeakObject * >(this), -1);
+getXWeak(), -1);
 }
 // it's always possible to read written storage in this implementation
 nStorageMode |= embed::ElementModes::READ;
@@ -94,7 +92,7 @@ uno::Reference< uno::XInterface > SAL_CALL 
FSStorageFactory::createInstanceWithA
 ("first argument to"
  " css.embed.FileSystemStorageFactory.createInstanceWithArguments"
  " must be a (non-empty) URL"),
-static_cast< OWeakObject * >(this), -1);
+getXWeak(), -1);
 }
 
 // allow to use other ucp's
@@ -107,7 +105,7 @@ uno::Reference< uno::XInterface > SAL_CALL 
FSStorageFactory::createInstanceWithA
 ("URL \"" + aURL + "\" passed as first argument to"
  " css.embed.FileSystemStorageFactory.createInstanceWithArguments"
  " must be a file URL denoting a directory"),
-static_cast< OWeakObject * >(this), -1);
+getXWeak(), -1);
 }
 
 if ( ( nStorageMode & embed::ElementModes::WRITE ) && !( nStorageMode & 
embed::ElementModes::NOCREATE ) )
@@ -117,18 +115,16 @@ uno::Reference< uno::XInterface > SAL_CALL 
FSStorageFactory::createInstanceWithA
 ("URL \"" + aURL + "\" passed to"
  " css.embed.FileSystemStorageFactory.createInstanceWithArguments"
  " does not denote an existing directory"),
-static_cast< OWeakObject * >(this));
+getXWeak());
 
 ::ucbhelper::Content aResultContent(
 aURL, uno::Reference< ucb::XCommandEnvironment >(),
 comphelper::getProcessComponentContext() );
 
 // create storage based on source
-return uno::Reference< uno::XInterface >(
-static_cast< OWeakObject* >( new FSStorage( aResultContent,
+

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

2023-06-12 Thread Caolán McNamara (via logerrit)
 sc/source/filter/oox/commentsbuffer.cxx  |1 +
 svgio/source/svgreader/svgfilternode.cxx |   12 ++--
 2 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit dee1cf105306d6795c50fdf53afe1d10fbf8552d
Author: Caolán McNamara 
AuthorDate: Sun Jun 11 21:35:28 2023 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jun 12 09:13:18 2023 +0200

cid#1532369 Unchecked dynamic_cast

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

diff --git a/sc/source/filter/oox/commentsbuffer.cxx 
b/sc/source/filter/oox/commentsbuffer.cxx
index 309d96ec377f..05deae3ee876 100644
--- a/sc/source/filter/oox/commentsbuffer.cxx
+++ b/sc/source/filter/oox/commentsbuffer.cxx
@@ -164,6 +164,7 @@ void Comment::finalizeImport()
 SdrCaptionObj* pCaption = pPostIt->GetOrCreateCaption( 
maModel.maRange.aStart );
 
 rtl::Reference< SvxShapeText > xAnnoShape( 
dynamic_cast(pCaption->getUnoShape().get() ) ); // SvxShapeText
+assert(xAnnoShape && "will not be null");
 // setting a property triggers expensive process, so set them all at 
once
 
 // Add shape formatting properties (autoFill, colHidden and rowHidden 
are dropped)
commit 081ceacde942f558e34cfef8ab64a9feed9b4549
Author: Caolán McNamara 
AuthorDate: Sun Jun 11 21:33:01 2023 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jun 12 09:13:06 2023 +0200

cid#1532368 Unchecked dynamic_cast

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

diff --git a/svgio/source/svgreader/svgfilternode.cxx 
b/svgio/source/svgreader/svgfilternode.cxx
index 12656a7c28e7..60d6371e1a0a 100644
--- a/svgio/source/svgreader/svgfilternode.cxx
+++ b/svgio/source/svgreader/svgfilternode.cxx
@@ -44,15 +44,15 @@ void 
SvgFilterNode::apply(drawinglayer::primitive2d::Primitive2DContainer& rTarg
 SvgNode* pCandidate = rChildren[a].get();
 if (pCandidate->getType() == SVGToken::FeGaussianBlur)
 {
-const SvgFeGaussianBlurNode* pFeGaussianBlurNode
-= dynamic_cast(pCandidate);
-pFeGaussianBlurNode->apply(rTarget);
+const SvgFeGaussianBlurNode& rFeGaussianBlurNode
+= dynamic_cast(*pCandidate);
+rFeGaussianBlurNode.apply(rTarget);
 }
 else if (pCandidate->getType() == SVGToken::FeColorMatrix)
 {
-const SvgFeColorMatrixNode* pFeColorMatrixNode
-= dynamic_cast(pCandidate);
-pFeColorMatrixNode->apply(rTarget);
+const SvgFeColorMatrixNode& rFeColorMatrixNode
+= dynamic_cast(*pCandidate);
+rFeColorMatrixNode.apply(rTarget);
 }
 }
 }


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

2023-05-30 Thread Dr. David Alan Gilbert (via logerrit)
 sc/source/core/data/conditio.cxx |2 ++
 sw/source/core/unocore/unofield.cxx  |6 +++---
 sw/source/ui/dbui/mmaddressblockpage.cxx |8 
 sw/source/ui/fldui/flddinf.cxx   |4 ++--
 sw/source/ui/fldui/fldref.cxx|6 +++---
 sw/source/ui/misc/outline.cxx|4 ++--
 sw/source/uibase/dbui/mmconfigitem.cxx   |4 ++--
 sw/source/uibase/sidebar/PageFormatPanel.cxx |   12 ++--
 sw/source/uibase/utlui/initui.cxx|4 ++--
 sw/source/uibase/utlui/unotools.cxx  |   17 -
 10 files changed, 30 insertions(+), 37 deletions(-)

New commits:
commit 4998370216bbea3bcaff7fac2d62cbb4ac978c5d
Author: Dr. David Alan Gilbert 
AuthorDate: Thu May 25 02:44:21 2023 +0100
Commit: Mike Kaganski 
CommitDate: Tue May 30 15:37:47 2023 +0200

tdf#145538,tdf#147021: sw/source: range based loops

A bunch of range based loop changes in sw/source

that also take out SAL_N_ELEMENTS usages

Change-Id: I28b929d2ecbe40c1b257454f21b5d2ff51d617e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152251
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 

diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index 36a4f5b27bc6..78b43b3158bd 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -183,9 +183,9 @@ const ServiceIdResId aServiceToRes[] =
 
 static SwFieldIds lcl_ServiceIdToResId(SwServiceType nServiceId)
 {
-for (size_t i=0; i 0
 OSL_FAIL("service id not found");
 #endif
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx 
b/sw/source/ui/dbui/mmaddressblockpage.cxx
index ad4a7bfc4b83..48d4e3dce117 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -494,10 +494,10 @@ 
SwCustomizeAddressBlockDialog::SwCustomizeAddressBlockDialog(
 m_xAddressElementsLB->append(OUString::number(USER_DATA_SALUTATION), 
SwResId(ST_SALUTATION));
 m_xAddressElementsLB->append(OUString::number(USER_DATA_PUNCTUATION), 
SwResId(ST_PUNCTUATION));
 m_xAddressElementsLB->append(OUString::number(USER_DATA_TEXT), 
SwResId(ST_TEXT));
-for (size_t i = 0; i < SAL_N_ELEMENTS(RA_SALUTATION); ++i)
-m_aSalutations.push_back(SwResId(RA_SALUTATION[i]));
-for (size_t i = 0; i < SAL_N_ELEMENTS(RA_PUNCTUATION); ++i)
-m_aPunctuations.push_back(SwResId(RA_PUNCTUATION[i]));
+for (auto const& aID : RA_SALUTATION)
+m_aSalutations.push_back(SwResId(aID));
+for (auto const& aID : RA_PUNCTUATION)
+m_aPunctuations.push_back(SwResId(aID));
 m_xDragED->SetText("");
 m_xDialog->set_title(SwResId(eType == GREETING_MALE ? ST_TITLE_MALE : 
ST_TITLE_FEMALE));
 m_xAddressElementsFT->set_label(SwResId(ST_SALUTATIONELEMENTS));
diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx
index 3fa401211b1f..7cb69c1d0e49 100644
--- a/sw/source/ui/fldui/flddinf.cxx
+++ b/sw/source/ui/fldui/flddinf.cxx
@@ -46,8 +46,8 @@ using namespace com::sun::star;
 
 void FillFieldSelect(weld::TreeView& rListBox)
 {
-for (size_t i = 0; i < SAL_N_ELEMENTS(FLD_SELECT); ++i)
-rListBox.append_text(SwResId(FLD_SELECT[i]));
+for (auto const& aID : FLD_SELECT)
+rListBox.append_text(SwResId(aID));
 }
 
 SwFieldDokInfPage::SwFieldDokInfPage(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet *const pCoreSet)
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index bd6fef539478..54f9c9fc98dc 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -70,10 +70,10 @@ SwFieldRefPage::SwFieldRefPage(weld::Container* pPage, 
weld::DialogController* p
 {
 m_xSelectionLB->make_sorted();
 // #i83479#
-for (size_t i = 0; i < SAL_N_ELEMENTS(FLD_REF_PAGE_TYPES); ++i)
+for (auto const& aID : FLD_REF_PAGE_TYPES)
 {
-m_xTypeLB->append_text(SwResId(FLD_REF_PAGE_TYPES[i]));
-m_xFormatLB->append_text(SwResId(FLD_REF_PAGE_TYPES[i]));
+m_xTypeLB->append_text(SwResId(aID));
+m_xFormatLB->append_text(SwResId(aID));
 }
 
 m_sBookmarkText = m_xTypeLB->get_text(0);
diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx
index 429cfb71915c..6500bfdd6eca 100644
--- a/sw/source/ui/misc/outline.cxx
+++ b/sw/source/ui/misc/outline.cxx
@@ -118,8 +118,8 @@ SwNumNamesDlg::SwNumNamesDlg(weld::Window *pParent)
 , m_xFormBox(m_xBuilder->weld_tree_view("form"))
 , m_xOKBtn(m_xBuilder->weld_button("ok"))
 {
-for (size_t i = 0; i < SAL_N_ELEMENTS(OUTLINE_STYLE); ++i)
-m_xFormBox->append_text(SwResId(OUTLINE_STYLE[i]));
+for (auto const& aID : OUTLINE_STYLE)
+m_xFormBox->append_text(SwResId(aID));
 
 m_xFormEdit->connect_changed(LINK(this, SwNumNamesDlg, ModifyHdl));
 

[Libreoffice-commits] core.git: 2 commits - sc/source sw/qa sw/source writerfilter/qa writerfilter/source

2023-05-30 Thread Miklos Vajna (via logerrit)
 sc/source/core/data/dociter.cxx  |
6 +-
 sw/qa/extras/rtfexport/rtfexport3.cxx|   
23 +++
 sw/source/filter/ww8/rtfexport.cxx   |
8 ++
 writerfilter/qa/cppunittests/rtftok/data/do-not-break-wrapped-tables.rtf |   
10 +++
 writerfilter/qa/cppunittests/rtftok/rtfdispatchflag.cxx  |   
17 +
 writerfilter/source/dmapper/SettingsTable.cxx|
3 -
 writerfilter/source/rtftok/rtfdispatchflag.cxx   |
8 --
 writerfilter/source/rtftok/rtfdispatchvalue.cxx  |   
30 --
 writerfilter/source/rtftok/rtfdocumentimpl.hxx   |
3 -
 9 files changed, 65 insertions(+), 43 deletions(-)

New commits:
commit d785d26a5599d3d546b96958b0f1c6d5ed777a0d
Author: Miklos Vajna 
AuthorDate: Tue May 30 08:21:33 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue May 30 12:49:52 2023 +0200

sw floattable: handle \nobrkwrptbl in the RTF filter

This is the RTF import/export for the functionality added in
commit 08fa2903df1a7cf9a1647fcf967e4c8b57dad793 (sw floattable: add a
DoNotBreakWrappedTables compat flag, 2023-05-24).

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

diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx 
b/sw/qa/extras/rtfexport/rtfexport3.cxx
index 2b45ca61f33e..8b5e2489a001 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace css;
 
@@ -430,6 +431,28 @@ DECLARE_RTFEXPORT_TEST(testTdf128428_dntblnsbdb, 
"tdf128428_dntblnsbdb.rtf")
 CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testDontBreakWrappedTables)
+{
+// Given a document with no DO_NOT_BREAK_WRAPPED_TABLES compat mode 
enabled:
+createSwDoc();
+{
+SwDoc* pDoc = getSwDoc();
+IDocumentSettingAccess& rIDSA = pDoc->getIDocumentSettingAccess();
+rIDSA.set(DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES, true);
+}
+
+// When saving to rtf:
+reload(mpFilter, "dont-break-wrapped-tables.rtf");
+
+// Then make sure \nobrkwrptbl is not written:
+SwDoc* pDoc = getSwDoc();
+IDocumentSettingAccess& rIDSA = pDoc->getIDocumentSettingAccess();
+bool bDontBreakWrappedTables = 
rIDSA.get(DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES);
+// Without the accompanying fix in place, this test would have failed, the 
compat flag was not
+// set.
+CPPUNIT_ASSERT(bDontBreakWrappedTables);
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testRtlGutter)
 {
 auto verify = [this]() {
diff --git a/sw/source/filter/ww8/rtfexport.cxx 
b/sw/source/filter/ww8/rtfexport.cxx
index 1bfc2ebc5740..96f0f628f6a9 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -829,7 +829,8 @@ ErrCode RtfExport::ExportDocument_Impl()
 Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_MARGMIRROR);
 
 // Gutter at top?
-if 
(m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::GUTTER_AT_TOP))
+IDocumentSettingAccess& rIDSA = m_rDoc.getIDocumentSettingAccess();
+if (rIDSA.get(DocumentSettingId::GUTTER_AT_TOP))
 {
 Strm().WriteOString(LO_STRING_SVTOOLS_RTF_GUTTERPRL);
 }
@@ -858,7 +859,10 @@ ErrCode RtfExport::ExportDocument_Impl()
 
 // Enable breaking wrapped tables across pages: the "no" in the control 
word's name is
 // confusing.
-Strm().WriteOString(LO_STRING_SVTOOLS_RTF_NOBRKWRPTBL);
+if (!rIDSA.get(DocumentSettingId::DO_NOT_BREAK_WRAPPED_TABLES))
+{
+Strm().WriteOString(LO_STRING_SVTOOLS_RTF_NOBRKWRPTBL);
+}
 
 // size and empty margins of the page
 if (m_rDoc.GetPageDescCnt())
diff --git 
a/writerfilter/qa/cppunittests/rtftok/data/do-not-break-wrapped-tables.rtf 
b/writerfilter/qa/cppunittests/rtftok/data/do-not-break-wrapped-tables.rtf
new file mode 100644
index ..f6ec013cb1dc
--- /dev/null
+++ b/writerfilter/qa/cppunittests/rtftok/data/do-not-break-wrapped-tables.rtf
@@ -0,0 +1,10 @@
+{\rtf1
+\paperw12240\paperh6203\margl1440\margr1440\margt1440\margb1440
+\pard\plain First paragraph\par
+\pard\plain\intbl A1\cell
+\pard\plain\trowd\trrh1812\tpvpara\tphcol\tposy10\tposx20\tdfrmtxtLeft30\tdfrmtxtRight40\cellx3828\row
+\pard\plain\intbl A2\cell
+\pard\plain\trowd\trrh1812\tpvpara\tphcol\tposy10\tposx20\tdfrmtxtLeft30\tdfrmtxtRight40\cellx3828\row
+\pard\plain Second paragraph.
+\par
+}
diff --git a/writerfilter/qa/cppunittests/rtftok/rtfdispatchflag.cxx 
b/writerfilter/qa/cppunittests/rtftok/rtfdispatchflag.cxx
index 810dc750d7d7..6d6b85be61c4 100644
--- a/writerfilter/qa/cppunittests/rtftok/rtfdispatchflag.cxx
+++ 

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

2023-05-13 Thread Caolán McNamara (via logerrit)
 sc/source/core/data/sortparam.cxx |1 +
 sd/source/ui/view/drviewsk.cxx|   18 ++
 2 files changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 439a78496a9a45c6e412fa93edb537727ab7862a
Author: Caolán McNamara 
AuthorDate: Fri May 12 21:17:57 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sat May 13 11:38:42 2023 +0200

cid#1530046 Unchecked dynamic_cast

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

diff --git a/sd/source/ui/view/drviewsk.cxx b/sd/source/ui/view/drviewsk.cxx
index 673416aff4f7..607b59d25111 100644
--- a/sd/source/ui/view/drviewsk.cxx
+++ b/sd/source/ui/view/drviewsk.cxx
@@ -23,19 +23,21 @@ void DrawViewShell::ConfigurationChanged( 
utl::ConfigurationBroadcaster* pCb, Co
 {
 svtools::ColorConfig *pColorConfig = 
dynamic_cast(pCb);
 ConfigureAppBackgroundColor(pColorConfig);
-SfxViewShell* pCurrentShell = SfxViewShell::Current();
-if (comphelper::LibreOfficeKit::isActive() && pCurrentShell)
+if (comphelper::LibreOfficeKit::isActive())
 {
-DrawViewShell* pCurrentDrawShell = nullptr;
+SfxViewShell* pCurrentShell = SfxViewShell::Current();
 ViewShellBase* pShellBase = 
dynamic_cast(pCurrentShell);
-if(pShellBase)
-pCurrentDrawShell = 
dynamic_cast(pShellBase->GetMainViewShell().get());
-pCurrentDrawShell->maViewOptions.mnDocBackgroundColor = 
pColorConfig->GetColorValue(svtools::DOCCOLOR).nColor;
-pCurrentDrawShell->maViewOptions.msColorSchemeName = 
pColorConfig->GetCurrentSchemeName();
+if (!pShellBase)
+return;
+if (DrawViewShell* pCurrentDrawShell = 
dynamic_cast(pShellBase->GetMainViewShell().get()))
+{
+pCurrentDrawShell->maViewOptions.mnDocBackgroundColor = 
pColorConfig->GetColorValue(svtools::DOCCOLOR).nColor;
+pCurrentDrawShell->maViewOptions.msColorSchemeName = 
pColorConfig->GetCurrentSchemeName();
+}
 SdXImpressDocument* pDoc = 
comphelper::getFromUnoTunnel(pCurrentShell->GetCurrentDocument());
 SfxLokHelper::notifyViewRenderState(pCurrentShell, pDoc);
 Color 
aFillColor(pColorConfig->GetColorValue(svtools::APPBACKGROUND).nColor);
-
SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR,
+
pCurrentShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR,
 aFillColor.AsRGBHexString().toUtf8());
 }
 }
commit 2ac8bf040be16eea79b1386a9466a058deee330f
Author: Caolán McNamara 
AuthorDate: Fri May 12 21:10:50 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sat May 13 11:38:35 2023 +0200

cid#1529965 Uninitialized scalar variable

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

diff --git a/sc/source/core/data/sortparam.cxx 
b/sc/source/core/data/sortparam.cxx
index 66b8c4f33db6..3e1506dbad7c 100644
--- a/sc/source/core/data/sortparam.cxx
+++ b/sc/source/core/data/sortparam.cxx
@@ -198,6 +198,7 @@ ScSortParam::ScSortParam( const ScSubTotalParam& rSub, 
const ScSortParam& rOld )
 key.bDoSort = true;
 key.nField = nThisField;
 key.bAscending = rOld.maKeyState[i].bAscending;
+key.aColorSortMode = ScColorSortMode::None;
 maKeyState.push_back(key);
 }
 }


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

2023-04-14 Thread Szymon Kłos (via logerrit)
 sc/source/ui/inc/tabview.hxx   |2 ++
 sc/source/ui/view/tabview2.cxx |9 +
 svx/source/svdraw/svdpntv.cxx  |2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 5a4fa04d9b161cdfc6d77f942aa38b8a73d025e8
Author: Szymon Kłos 
AuthorDate: Tue Feb 14 10:50:46 2023 +0100
Commit: Szymon Kłos 
CommitDate: Fri Apr 14 09:06:56 2023 +0200

lok: draw textboxes under edit

This fixes bug in impress:
- open in 2 views
- start editing textbox in 2. view on 2. slide
- start editing textbox in 1. view on 1. slide
Result: slide 2 textbox was dissapearing

We need to allow drawing textboxes edited by other views
so if we select non-editor for rendering we will see the
full content.

It was regression from
commit e496b55a592caf0ca07f5477285a72d50cee6501
lok: masterpage: don't render text edits from different mode

Change-Id: I7645496aec77d11d16621129dd6644d3b54a6010
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146999
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Henry Castro 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150096
Tested-by: Szymon Kłos 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150348
Tested-by: Jenkins

diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index c9a0df5291e9..825129b716b5 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -645,7 +645,7 @@ void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& 
rPaintWindow, bool bPaintFo
 static_cast< SdrView* >(this)->TextEditDrawing(rPaintWindow);
 }
 
-if (comphelper::LibreOfficeKit::isActive() && mbPaintTextEdit && 
pPageView)
+if (comphelper::LibreOfficeKit::isActive() && pPageView)
 {
 // Look for active text edits in other views showing the same page,
 // and show them as well. Show only if Page/MasterPage mode is 
matching.
commit 6c62b5a994b9045d1d7228fef655be1a8d3b5452
Author: Szymon Kłos 
AuthorDate: Fri Feb 17 10:47:53 2023 +0100
Commit: Szymon Kłos 
CommitDate: Fri Apr 14 09:06:47 2023 +0200

lok: setup LOK notifier for invalid range error

Change-Id: I63fc6fcdec873a9d0c8d54dd6a6f3783f2c15251
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147200
Reviewed-by: Henry Castro 
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150043
Tested-by: Szymon Kłos 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150347

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


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

2023-03-31 Thread Szymon Kłos (via logerrit)
 sc/source/ui/dbgui/sortkeydlg.cxx|   10 +++---
 vcl/inc/jsdialog/jsdialogbuilder.hxx |   13 +
 vcl/jsdialog/enabled.cxx |   13 -
 vcl/jsdialog/executor.cxx|6 +++---
 vcl/jsdialog/jsdialogbuilder.cxx |   34 ++
 vcl/source/window/layout.cxx |2 ++
 6 files changed, 71 insertions(+), 7 deletions(-)

New commits:
commit 078d8ce4d4add3c11df524ff92b337a58a75b004
Author: Szymon Kłos 
AuthorDate: Thu Mar 16 15:29:33 2023 +0100
Commit: Szymon Kłos 
CommitDate: Fri Mar 31 11:18:59 2023 +

jsdialog: enable page format (calc)

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

diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 9b391101693d..4b0061ea17e7 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -44,6 +44,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"cui/ui/imagetabpage.ui"
 || rUIFile == u"cui/ui/macroselectordialog.ui"
 || rUIFile == u"cui/ui/numberingformatpage.ui"
+|| rUIFile == u"cui/ui/pageformatpage.ui"
 || rUIFile == u"cui/ui/paragalignpage.ui"
 || rUIFile == u"cui/ui/paraindentspacing.ui"
 || rUIFile == u"cui/ui/paratabspage.ui"
@@ -91,12 +92,15 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"modules/scalc/ui/movingaveragedialog.ui"
 || rUIFile == u"modules/scalc/ui/optimalcolwidthdialog.ui"
 || rUIFile == u"modules/scalc/ui/optimalrowheightdialog.ui"
+|| rUIFile == u"modules/scalc/ui/pagetemplatedialog.ui"
+|| rUIFile == u"modules/scalc/ui/paratemplatedialog.ui"
 || rUIFile == u"modules/scalc/ui/pivotfielddialog.ui"
 || rUIFile == u"modules/scalc/ui/pivottablelayoutdialog.ui"
 || rUIFile == u"modules/scalc/ui/regressiondialog.ui"
 || rUIFile == u"modules/scalc/ui/rowheightdialog.ui"
 || rUIFile == u"modules/scalc/ui/samplingdialog.ui"
 || rUIFile == u"modules/scalc/ui/selectsource.ui"
+|| rUIFile == u"modules/scalc/ui/sheetprintpage.ui"
 || rUIFile == u"modules/scalc/ui/sortcriteriapage.ui"
 || rUIFile == u"modules/scalc/ui/sortdialog.ui"
 || rUIFile == u"modules/scalc/ui/sortkey.ui"
@@ -151,6 +155,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"sfx/ui/documentinfopage.ui"
 || rUIFile == u"sfx/ui/documentpropertiesdialog.ui"
 || rUIFile == u"sfx/ui/editdurationdialog.ui"
+|| rUIFile == u"svx/ui/headfootformatpage.ui"
 || rUIFile == u"sfx/ui/linefragment.ui"
 || rUIFile == u"sfx/ui/managestylepage.ui"
 || rUIFile == u"sfx/ui/password.ui"
@@ -163,7 +168,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"uui/ui/macrowarnmedium.ui"
 // vcl
 || rUIFile == u"vcl/ui/wizard.ui"
-// xmlsec
+// filter
 || rUIFile == u"filter/ui/pdfgeneralpage.ui"
 || rUIFile == u"filter/ui/pdflinkspage.ui"
 || rUIFile == u"filter/ui/pdfoptionsdialog.ui"
@@ -172,7 +177,9 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
 || rUIFile == u"filter/ui/pdfuserinterfacepage.ui"
 || rUIFile == u"filter/ui/pdfviewpage.ui"
 || rUIFile == u"filter/ui/warnpdfdialog.ui"
+// writerperfect
 || rUIFile == u"writerperfect/ui/exportepub.ui"
+// xmlsec
 || rUIFile == u"xmlsec/ui/certgeneral.ui"
 || rUIFile == u"xmlsec/ui/certpage.ui"
 || rUIFile == u"xmlsec/ui/digitalsignaturesdialog.ui"
commit e026ef65eed3c04df4d3dada09c4e1ef858d69a5
Author: Szymon Kłos 
AuthorDate: Mon Mar 13 14:34:49 2023 +0100
Commit: Szymon Kłos 
CommitDate: Fri Mar 31 11:18:51 2023 +

jsdialog: enable sort dialog

Change-Id: I694bf3ea9982032b0202e408f8121a6407427cca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148789
Reviewed-by: Pranam Lashkari 
Tested-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149820
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/sc/source/ui/dbgui/sortkeydlg.cxx 
b/sc/source/ui/dbgui/sortkeydlg.cxx
index 599280735be9..7e8397415018 100644
--- a/sc/source/ui/dbgui/sortkeydlg.cxx
+++ b/sc/source/ui/dbgui/sortkeydlg.cxx
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -65,10 +66,13 @@ void ScSortKeyWindow::AddSortKey( sal_uInt16 nItemNumber )
 pSortKeyItem->m_xFrame->set_label(aLine);
 
 // for ui-testing. Distinguish the sort keys
-if ( m_aSortKeyItems.size() > 0 )
+if 

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

2023-02-27 Thread Eike Rathke (via logerrit)
 sc/source/core/tool/interpr4.cxx |   26 --
 1 file changed, 20 insertions(+), 6 deletions(-)

New commits:
commit 4f7e8f0d819383a6953ccbb53f704d2265577a2f
Author: Eike Rathke 
AuthorDate: Mon Feb 27 23:14:01 2023 +0100
Commit: Eike Rathke 
CommitDate: Mon Feb 27 23:18:16 2023 +

Underflow assert also in already calculated path

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

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index e352f35a6e7b..97c3d06cdf49 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4007,9 +4007,20 @@ StackVar ScInterpreter::Interpret()
 (*aTokenMatrixMapIter).second->GetType() != svJumpMatrix)
 {
 // Path already calculated, reuse result.
-nStackBase = sp - pCur->GetParamCount();
-if ( nStackBase > sp )
-nStackBase = sp;// underflow?!?
+if (sp >= pCur->GetParamCount())
+nStackBase = sp - pCur->GetParamCount();
+else
+{
+SAL_WARN("sc.core", "Stack anomaly with calculated path at "
+<< aPos.Tab() << "," << aPos.Col() << "," << aPos.Row()
+<< "  " << aPos.Format(
+ScRefFlags::VALID | ScRefFlags::FORCE_DOC | 
ScRefFlags::TAB_3D, )
+<< "  eOp: " << static_cast(eOp)
+<< "  params: " << 
static_cast(pCur->GetParamCount())
+<< "  nStackBase: " << nStackBase << "  sp: " << sp);
+nStackBase = sp;
+assert(!"underflow");
+}
 sp = nStackBase;
 PushTokenRef( (*aTokenMatrixMapIter).second);
 }
commit 1db24b1798b80062a1d06104828d1ec6f32ae8ec
Author: Eike Rathke 
AuthorDate: Mon Feb 27 18:35:49 2023 +0100
Commit: Eike Rathke 
CommitDate: Mon Feb 27 23:18:06 2023 +

ConvertMatrixParameters() worth some asserts instead of OSL_ENSURE/OSL_FAIL

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

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 91f297a010db..e352f35a6e7b 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -21,6 +21,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -1456,14 +1457,16 @@ void ScInterpreter::ConvertMatrixJumpConditionToMatrix()
 bool ScInterpreter::ConvertMatrixParameters()
 {
 sal_uInt16 nParams = pCur->GetParamCount();
-OSL_ENSURE( nParams <= sp, "ConvertMatrixParameters: stack/param count 
mismatch");
+SAL_WARN_IF( nParams > sp, "sc.core", "ConvertMatrixParameters: 
stack/param count mismatch:  eOp: "
+<< static_cast(pCur->GetOpCode()) << "  sp: " << sp << "  
nParams: " << nParams);
+assert(nParams <= sp);
 SCSIZE nJumpCols = 0, nJumpRows = 0;
 for ( sal_uInt16 i=1; i <= nParams && i <= sp; ++i )
 {
 const FormulaToken* p = pStack[ sp - i ];
 if ( p->GetOpCode() != ocPush && p->GetOpCode() != ocMissing)
 {
-OSL_FAIL( "ConvertMatrixParameters: not a push");
+assert(!"ConvertMatrixParameters: not a push");
 }
 else
 {
@@ -1588,7 +1591,7 @@ bool ScInterpreter::ConvertMatrixParameters()
 }
 break;
 default:
-OSL_FAIL( "ConvertMatrixParameters: unknown parameter 
type");
+assert(!"ConvertMatrixParameters: unknown parameter type");
 }
 }
 }


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

2023-02-14 Thread Noel Grandin (via logerrit)
 sc/source/ui/docshell/datastream.cxx |   33 +++---
 sc/source/ui/inc/datastream.hxx  |4 
 ucb/source/sorter/sortresult.cxx |  166 ++-
 ucb/source/sorter/sortresult.hxx |   10 +-
 4 files changed, 95 insertions(+), 118 deletions(-)

New commits:
commit b429ca9b45b897da4c47a261ff582b536f27acd6
Author: Noel Grandin 
AuthorDate: Tue Feb 14 10:35:10 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Feb 14 16:31:59 2023 +

no need to use unique_ptr for LinesType

it is already a moveable type

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

diff --git a/sc/source/ui/docshell/datastream.cxx 
b/sc/source/ui/docshell/datastream.cxx
index f6669e3265f9..2124753bf529 100644
--- a/sc/source/ui/docshell/datastream.cxx
+++ b/sc/source/ui/docshell/datastream.cxx
@@ -99,8 +99,8 @@ class ReaderThread : public salhelper::Thread
 size_t mnColCount;
 std::atomic mbTerminate;
 
-std::queue> maPendingLines;
-std::queue> maUsedLines;
+std::queue maPendingLines;
+std::queue maUsedLines;
 std::mutex maMtxLines;
 
 osl::Condition maCondReadStream;
@@ -142,7 +142,7 @@ public:
 maCondConsume.reset();
 }
 
-std::unique_ptr popNewLines()
+DataStream::LinesType popNewLines()
 {
 auto pLines = std::move(maPendingLines.front());
 maPendingLines.pop();
@@ -160,7 +160,7 @@ public:
 return !maPendingLines.empty();
 }
 
-void pushUsedLines( std::unique_ptr pLines )
+void pushUsedLines( DataStream::LinesType pLines )
 {
 maUsedLines.push(std::move(pLines));
 }
@@ -175,24 +175,24 @@ private:
 {
 while (!isTerminateRequested())
 {
-std::unique_ptr pLines;
+std::optional oLines;
 std::unique_lock aGuard(maMtxLines);
 
 if (!maUsedLines.empty())
 {
 // Re-use lines from previous runs.
-pLines = std::move(maUsedLines.front());
+oLines = std::move(maUsedLines.front());
 maUsedLines.pop();
 aGuard.unlock(); // unlock
 }
 else
 {
 aGuard.unlock(); // unlock
-pLines.reset(new DataStream::LinesType(10));
+oLines.emplace(10);
 }
 
 // Read & store new lines from stream.
-for (DataStream::Line & rLine : *pLines)
+for (DataStream::Line & rLine : *oLines)
 {
 rLine.maCells.clear();
 mpStream->ReadLine(rLine.maLine);
@@ -210,7 +210,7 @@ private:
 maCondReadStream.reset();
 aGuard.lock(); // lock
 }
-maPendingLines.push(std::move(pLines));
+maPendingLines.push(std::move(*oLines));
 maCondConsume.set();
 if (!mpStream->good())
 requestTerminate();
@@ -305,20 +305,23 @@ DataStream::~DataStream()
 mxReaderThread->endThread();
 mxReaderThread->join();
 }
-mpLines.reset();
+moLines.reset();
 }
 
 DataStream::Line DataStream::ConsumeLine()
 {
-if (!mpLines || mnLinesCount >= mpLines->size())
+if (!moLines || mnLinesCount >= moLines->size())
 {
 mnLinesCount = 0;
 if (mxReaderThread->isTerminateRequested())
 return Line();
 
 std::unique_lock aGuard(mxReaderThread->getLinesMutex());
-if (mpLines)
-mxReaderThread->pushUsedLines(std::move(mpLines));
+if (moLines)
+{
+mxReaderThread->pushUsedLines(std::move(*moLines));
+moLines.reset();
+}
 
 while (!mxReaderThread->hasNewLines())
 {
@@ -327,10 +330,10 @@ DataStream::Line DataStream::ConsumeLine()
 aGuard.lock(); // lock
 }
 
-mpLines = mxReaderThread->popNewLines();
+moLines = mxReaderThread->popNewLines();
 mxReaderThread->resumeReadStream();
 }
-return mpLines->at(mnLinesCount++);
+return moLines->at(mnLinesCount++);
 }
 
 ScRange DataStream::GetRange() const
diff --git a/sc/source/ui/inc/datastream.hxx b/sc/source/ui/inc/datastream.hxx
index 790b85a6d743..849b3168236e 100644
--- a/sc/source/ui/inc/datastream.hxx
+++ b/sc/source/ui/inc/datastream.hxx
@@ -15,7 +15,7 @@
 #include 
 #include 
 #include 
-
+#include 
 #include 
 
 #include 
@@ -107,7 +107,7 @@ private:
 bool mbRunning;
 bool mbValuesInLine;
 bool mbRefreshOnEmptyLine;
-std::unique_ptr mpLines;
+std::optional moLines;
 size_t mnLinesCount;
 size_t mnLinesSinceRefresh;
 double mfLastRefreshTime;
commit 8ba547ae90991547ab46e5c9b871078c39f51174
Author: Noel Grandin 
AuthorDate: Tue Feb 14 16:23:10 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Feb 14 16:31:44 

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

2023-02-10 Thread Mike Kaganski (via logerrit)
 sc/source/core/data/stlpool.cxx  |   10 --
 sc/source/core/tool/interpr2.cxx |   64 ++-
 2 files changed, 39 insertions(+), 35 deletions(-)

New commits:
commit 2844670d2a47c606cbebb99f73389f30154a3c5e
Author: Mike Kaganski 
AuthorDate: Fri Feb 10 16:44:37 2023 +0300
Commit: Mike Kaganski 
CommitDate: Fri Feb 10 16:12:35 2023 +

Flatten ScInterpreter::ScStyle

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

diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 707d9c66cb3d..c8015598891f 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -2592,48 +2592,46 @@ void ScInterpreter::ScCurrent()
 void ScInterpreter::ScStyle()
 {
 sal_uInt8 nParamCount = GetByte();
-if (nParamCount >= 1 && nParamCount <= 3)
-{
-OUString aStyle2;   // Template 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
+if (!MustHaveParamCount(nParamCount, 1, 3))
+return;
 
-if (nTimeOut < 0)
-nTimeOut = 0;
+OUString aStyle2;   // Template 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
 
-// Execute request to apply template
-if ( !mrDoc.IsClipOrUndo() )
+if (nTimeOut < 0)
+nTimeOut = 0;
+
+// Execute request to apply template
+if ( !mrDoc.IsClipOrUndo() )
+{
+SfxObjectShell* pShell = mrDoc.GetDocumentShell();
+if (pShell)
 {
-SfxObjectShell* pShell = mrDoc.GetDocumentShell();
-if (pShell)
+// notify object shell directly!
+bool bNotify = true;
+if (aStyle2.isEmpty())
 {
-// notify object shell directly!
-bool bNotify = true;
-if (aStyle2.isEmpty())
-{
-const ScStyleSheet* pStyle = mrDoc.GetStyle(aPos.Col(), 
aPos.Row(), aPos.Tab());
+const ScStyleSheet* pStyle = mrDoc.GetStyle(aPos.Col(), 
aPos.Row(), aPos.Tab());
 
-if (pStyle && pStyle->GetName() == aStyle1)
-bNotify = false;
-}
+if (pStyle && pStyle->GetName() == aStyle1)
+bNotify = false;
+}
 
-if (bNotify)
-{
-ScRange aRange(aPos);
-ScAutoStyleHint aHint( aRange, aStyle1, nTimeOut, aStyle2 
);
-pShell->Broadcast( aHint );
-}
+if (bNotify)
+{
+ScRange aRange(aPos);
+ScAutoStyleHint aHint( aRange, aStyle1, nTimeOut, aStyle2 );
+pShell->Broadcast( aHint );
 }
 }
-
-PushDouble(0.0);
 }
-else
-PushIllegalParameter();
+
+PushDouble(0.0);
 }
 
 static ScDdeLink* lcl_GetDdeLink( const sfx2::LinkManager* pLinkMgr,
commit 2a984c77ccb1aa77d9bbd02218d4dc76aaff4a9e
Author: Mike Kaganski 
AuthorDate: Fri Feb 10 13:25:53 2023 +0300
Commit: Mike Kaganski 
CommitDate: Fri Feb 10 16:12:28 2023 +

tdf#153514: try to find exact match, even when searching case-insensitively

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

diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index 5ca89c37a510..b08b6c2203c9 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -408,14 +408,20 @@ ScStyleSheet* ScStyleSheetPool::FindCaseIns( const 
OUString& rName, SfxStyleFami
 CaseInsensitiveNamePredicate aPredicate(rName, eFam);
 std::vector aFoundPositions = 
GetIndexedStyleSheets().FindPositionsByPredicate(aPredicate);
 
+ScStyleSheet* first = nullptr; // first case insensitive match found
 for (const auto& rPos : aFoundPositions)
 {
 SfxStyleSheetBase *pFound = GetStyleSheetByPositionInIndex(rPos);
 // we do not know what kind of sheets we have.
 if (pFound->isScStyleSheet())
-return static_cast(pFound);
+{
+if (pFound->GetName() == rName) // exact case sensitive match
+return 

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

2023-02-05 Thread Noel Grandin (via logerrit)
 sc/source/ui/dataprovider/csvdataprovider.cxx |6 ++
 sc/source/ui/docshell/datastream.cxx  |   10 --
 sc/source/ui/inc/dataprovider.hxx |4 ++--
 3 files changed, 8 insertions(+), 12 deletions(-)

New commits:
commit 18f14b9e50407e4c0b97024c122f8ce7c0efaad4
Author: Noel Grandin 
AuthorDate: Thu Feb 2 09:37:42 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Feb 5 09:54:17 2023 +

osl::Mutex->std::atomic in sc::CSVFetchThread

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

diff --git a/sc/source/ui/dataprovider/csvdataprovider.cxx 
b/sc/source/ui/dataprovider/csvdataprovider.cxx
index c6e4c15dee6b..99533c9f7a6b 100644
--- a/sc/source/ui/dataprovider/csvdataprovider.cxx
+++ b/sc/source/ui/dataprovider/csvdataprovider.cxx
@@ -84,14 +84,12 @@ CSVFetchThread::~CSVFetchThread()
 
 bool CSVFetchThread::IsRequestedTerminate()
 {
-osl::MutexGuard aGuard(maMtxTerminate);
-return mbTerminate;
+return mbTerminate.load();
 }
 
 void CSVFetchThread::RequestTerminate()
 {
-osl::MutexGuard aGuard(maMtxTerminate);
-mbTerminate = true;
+mbTerminate.store(true);
 }
 
 void CSVFetchThread::EndThread()
diff --git a/sc/source/ui/inc/dataprovider.hxx 
b/sc/source/ui/inc/dataprovider.hxx
index e053a72eb4e2..680bf3819390 100644
--- a/sc/source/ui/inc/dataprovider.hxx
+++ b/sc/source/ui/inc/dataprovider.hxx
@@ -19,6 +19,7 @@
 
 #include 
 
+#include 
 #include 
 //#include 
 
@@ -37,8 +38,7 @@ class CSVFetchThread : public salhelper::Thread
 ScDocument& mrDocument;
 OUString maURL;
 
-bool mbTerminate;
-osl::Mutex maMtxTerminate;
+std::atomic mbTerminate;
 
 orcus::csv::parser_config maConfig;
 
commit 640202f5248de274b83356e963b0e1a2e405aa18
Author: Noel Grandin 
AuthorDate: Thu Feb 2 09:36:17 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Feb 5 09:54:04 2023 +

osl::Mutex->std::atomic in sc::ReaderThread

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

diff --git a/sc/source/ui/docshell/datastream.cxx 
b/sc/source/ui/docshell/datastream.cxx
index edd3aeaf26cd..dad99bba0e30 100644
--- a/sc/source/ui/docshell/datastream.cxx
+++ b/sc/source/ui/docshell/datastream.cxx
@@ -28,6 +28,7 @@
 
 #include 
 
+#include 
 #include 
 
 namespace com::sun::star::ui { class XUIElement; }
@@ -96,8 +97,7 @@ class ReaderThread : public salhelper::Thread
 {
 std::unique_ptr mpStream;
 size_t mnColCount;
-bool mbTerminate;
-osl::Mutex maMtxTerminate;
+std::atomic mbTerminate;
 
 std::queue> maPendingLines;
 std::queue> maUsedLines;
@@ -122,14 +122,12 @@ public:
 
 bool isTerminateRequested()
 {
-osl::MutexGuard aGuard(maMtxTerminate);
-return mbTerminate;
+return mbTerminate.load();
 }
 
 void requestTerminate()
 {
-osl::MutexGuard aGuard(maMtxTerminate);
-mbTerminate = true;
+mbTerminate.store(true);
 }
 
 void endThread()


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

2023-01-20 Thread Stephan Bergmann (via logerrit)
 sc/source/ui/unoobj/celllistsource.cxx   |2 +-
 sc/source/ui/unoobj/celllistsource.hxx   |   12 ++--
 sc/source/ui/unoobj/cellvaluebinding.cxx |2 +-
 sc/source/ui/unoobj/cellvaluebinding.hxx |   14 +++---
 4 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit 46f64f6df4a7e545114c4ec92598f6634d38b04b
Author: Stephan Bergmann 
AuthorDate: Fri Jan 20 14:48:46 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Jan 20 17:18:13 2023 +

Base OCellListSource on WeakComponentImplHelper

...rather than on the deprecated WeakAggComponentImplHelper4.

It was found that that class was implementing queryInterface in a way that 
is
incompatible with the XAggregation protocol inherited via
WeakAggComponentImplHelper4.  It looks like no code actually made use of the
XAggregation offered by this class, so the easiest fix for this 
queryInterface
implementation appears to switch from WeakAggComponentImplHelper4 to
WeakComponentImplHelper (thereby dropping XAggregation, and thus rendering 
the
existing queryInterface implementation OK).

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

diff --git a/sc/source/ui/unoobj/celllistsource.cxx 
b/sc/source/ui/unoobj/celllistsource.cxx
index 9c9d595465d9..81942e44fc09 100644
--- a/sc/source/ui/unoobj/celllistsource.cxx
+++ b/sc/source/ui/unoobj/celllistsource.cxx
@@ -93,7 +93,7 @@ namespace calc
 EventObject aDisposeEvent( *this );
 m_aListEntryListeners.disposeAndClear( aDisposeEvent );
 
-WeakAggComponentImplHelperBase::disposing();
+WeakComponentImplHelperBase::disposing();
 
 // TODO: clean up here whatever you need to clean up (e.g. revoking 
listeners etc.)
 }
diff --git a/sc/source/ui/unoobj/celllistsource.hxx 
b/sc/source/ui/unoobj/celllistsource.hxx
index 7a5f72c02bd7..c919c18ec27e 100644
--- a/sc/source/ui/unoobj/celllistsource.hxx
+++ b/sc/source/ui/unoobj/celllistsource.hxx
@@ -20,7 +20,7 @@
 #pragma once
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -41,11 +41,11 @@ namespace calc
 
 class OCellListSource;
 // the base for our interfaces
-typedef ::cppu::WeakAggComponentImplHelper4 <   
css::form::binding::XListEntryTypedSource
-,   css::util::XModifyListener
-,   css::lang::XServiceInfo
-,   css::lang::XInitialization
->   OCellListSource_Base;
+typedef ::cppu::WeakComponentImplHelper <   
css::form::binding::XListEntryTypedSource
+,   css::util::XModifyListener
+,   css::lang::XServiceInfo
+,   css::lang::XInitialization
+>   OCellListSource_Base;
 // the base for the property handling
 typedef ::comphelper::OPropertyContainerOCellListSource_PBase;
 // the second base for property handling
commit aaa30075e1a5e362ee8610e11ad1739947c06ebd
Author: Stephan Bergmann 
AuthorDate: Fri Jan 20 14:51:48 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Jan 20 17:18:03 2023 +

Base OCellValueBinding on WeakComponentImplHelper

...rather than on the deprecated WeakAggComponentImplHelper5.

It was found that that class was implementing queryInterface in a way that 
is
incompatible with the XAggregation protocol inherited via
WeakAggComponentImplHelper5.  It looks like no code actually made use of the
XAggregation offered by this class, so the easiest fix for this 
queryInterface
implementation appears to switch from WeakAggComponentImplHelper5 to
WeakComponentImplHelper (thereby dropping XAggregation, and thus rendering 
the
existing queryInterface implementation OK).

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

diff --git a/sc/source/ui/unoobj/cellvaluebinding.cxx 
b/sc/source/ui/unoobj/cellvaluebinding.cxx
index 29c15ceb12de..6a5b764546b6 100644
--- a/sc/source/ui/unoobj/cellvaluebinding.cxx
+++ b/sc/source/ui/unoobj/cellvaluebinding.cxx
@@ -95,7 +95,7 @@ namespace calc
 xBroadcaster->removeModifyListener( this );
 }
 
-WeakAggComponentImplHelperBase::disposing();
+WeakComponentImplHelperBase::disposing();
 
 // TODO: clean up here whatever you need to clean up (e.g. deregister 
as XEventListener
 // for the cell)
diff --git a/sc/source/ui/unoobj/cellvaluebinding.hxx 
b/sc/source/ui/unoobj/cellvaluebinding.hxx
index 

[Libreoffice-commits] core.git: 2 commits - sc/source sw/CppunitTest_sw_uibase_shells.mk sw/qa sw/sdi sw/source

2023-01-18 Thread Miklos Vajna (via logerrit)
 sc/source/ui/view/viewdata.cxx  |2 -
 sw/CppunitTest_sw_uibase_shells.mk  |1 
 sw/qa/uibase/shells/textfld.cxx |   61 
 sw/sdi/swriter.sdi  |2 -
 sw/source/uibase/shells/textfld.cxx |   10 +
 5 files changed, 74 insertions(+), 2 deletions(-)

New commits:
commit 1f8c02353d653a6d4a72d918aaf6be5f367137c9
Author: Miklos Vajna 
AuthorDate: Fri Jan 13 08:56:29 2023 +0100
Commit: Miklos Vajna 
CommitDate: Wed Jan 18 09:56:33 2023 +

sc: fix crash in ScViewData::GetCurXForTab()

Crashreport signature:

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

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

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

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 0ef96d96c7ae..ae68a5dfc725 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1429,7 +1429,7 @@ SCROW ScViewData::GetPosY( ScVSplitPos eWhich, SCTAB 
nForTab ) const
 
 SCCOL ScViewData::GetCurXForTab( SCTAB nTabIndex ) const
 {
-if (!ValidTab(nTabIndex) || (nTabIndex >= 
static_cast(maTabData.size(
+if (!ValidTab(nTabIndex) || (nTabIndex >= 
static_cast(maTabData.size())) || !maTabData[nTabIndex])
 return -1;
 
 return maTabData[nTabIndex]->nCurX;
commit e9d5ccd5a0822969412dbddf0191e28703e72e82
Author: Miklos Vajna 
AuthorDate: Wed Jan 18 08:20:24 2023 +0100
Commit: Miklos Vajna 
CommitDate: Wed Jan 18 09:56:23 2023 +

sw, .uno:InsertField: add a new Wrapper parameter

This is similar to ceea8f3924f26d5f10adc41b9ea587c77c2fda74 (sw:
.uno:TextFormField: add new Wrapper parameter, 2023-01-16), but that was
for fieldmarks & footnotes, while this is for refmarks & footnotes.

Also start a new test file as the one for the entire directory starts to
grow too long.

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

diff --git a/sw/CppunitTest_sw_uibase_shells.mk 
b/sw/CppunitTest_sw_uibase_shells.mk
index 14e961f4725d..932769a421e6 100644
--- a/sw/CppunitTest_sw_uibase_shells.mk
+++ b/sw/CppunitTest_sw_uibase_shells.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,sw_uibase_shells))
 $(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_uibase_shells))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,sw_uibase_shells, \
+sw/qa/uibase/shells/textfld \
 sw/qa/uibase/shells/shells \
 ))
 
diff --git a/sw/qa/uibase/shells/textfld.cxx b/sw/qa/uibase/shells/textfld.cxx
new file mode 100644
index ..ef4da3aa65b1
--- /dev/null
+++ b/sw/qa/uibase/shells/textfld.cxx
@@ -0,0 +1,61 @@
+/* -*- 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/.
+ */
+
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+namespace
+{
+/// Covers sw/source/uibase/shells/textfld.cxx fixes.
+class Test : public SwModelTestBase
+{
+public:
+Test()
+: SwModelTestBase("/sw/qa/uibase/shells/data/")
+{
+}
+};
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testInsertRefmarkFootnote)
+{
+// Given an empty document:
+createSwDoc();
+
+// When inserting a refmark inside a footnote:
+uno::Sequence aArgs = {
+comphelper::makePropertyValue("TypeName", 
uno::Any(OUString("SetRef"))),
+comphelper::makePropertyValue("Name", uno::Any(OUString("myref"))),
+comphelper::makePropertyValue("Content", 
uno::Any(OUString("content"))),
+comphelper::makePropertyValue("Wrapper", 
uno::Any(OUString("Footnote"))),
+};
+dispatchCommand(mxComponent, ".uno:InsertField", aArgs);
+
+// Then make sure that the note body contains the refmark:
+SwDoc* pDoc = getSwDoc();
+SwFootnoteIdxs& rNotes = pDoc->GetFootnoteIdxs();
+// Without the accompanying fix in place, 

[Libreoffice-commits] core.git: 2 commits - sc/source vcl/unx

2023-01-10 Thread Caolán McNamara (via logerrit)
 sc/source/ui/dbgui/tpsort.cxx   |   11 +++
 vcl/unx/generic/gdi/gdiimpl.cxx |4 
 vcl/unx/generic/gdi/gdiimpl.hxx |2 --
 3 files changed, 7 insertions(+), 10 deletions(-)

New commits:
commit 13810281fe1297833a849bf5adea0be8ea77ca88
Author: Caolán McNamara 
AuthorDate: Tue Jan 10 10:32:10 2023 +
Commit: Caolán McNamara 
CommitDate: Tue Jan 10 19:57:09 2023 +

Resolves: tdf#152950 don't set_active while frozen

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

diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index 3455f11006cf..35a24e633058 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -813,6 +813,8 @@ void ScTabPageSortOptions::EdOutPosModHdl()
 
 void ScTabPageSortOptions::FillAlgor()
 {
+tools::Long nCount = 0;
+
 m_xLbAlgorithm->freeze();
 m_xLbAlgorithm->clear();
 
@@ -830,18 +832,19 @@ void ScTabPageSortOptions::FillAlgor()
 lang::Locale aLocale( LanguageTag::convertToLocale( eLang ));
 const uno::Sequence aAlgos = 
m_xColWrap->listCollatorAlgorithms( aLocale );
 
-tools::Long nCount = aAlgos.getLength();
+nCount = aAlgos.getLength();
 for (const OUString& sAlg : aAlgos)
 {
 OUString sUser = m_xColRes->GetTranslation( sAlg );
 m_xLbAlgorithm->append_text(sUser);
 }
-m_xLbAlgorithm->set_active(0);   // first entry is default
-m_xFtAlgorithm->set_sensitive(nCount > 1);  // enable only if 
there is a choice
-m_xLbAlgorithm->set_sensitive(nCount > 1);  // enable only if 
there is a choice
 }
 
 m_xLbAlgorithm->thaw();
+
+m_xLbAlgorithm->set_active(nCount ? 0 : -1);// first entry is default
+m_xFtAlgorithm->set_sensitive(nCount > 1);  // enable only if there is 
a choice
+m_xLbAlgorithm->set_sensitive(nCount > 1);  // enable only if there is 
a choice
 }
 
 IMPL_LINK_NOARG(ScTabPageSortOptions, FillAlgorHdl, weld::ComboBox&, void)
commit 4a050ed9e8f5fc0a6df35adfcda5698af1e81d47
Author: Caolán McNamara 
AuthorDate: Tue Jan 10 09:35:12 2023 +
Commit: Caolán McNamara 
CommitDate: Tue Jan 10 19:56:59 2023 +

mpMonoGC is unused

since:

commit 837f171810a95a1d87907dd08d67e969276f0559
Date:   Thu Oct 1 14:20:31 2015 +0200

loplugin:unusedmethods in vcl

mpMaskGC is also unused.

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

diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index 3e2b520bd904..3e4256184674 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -110,9 +110,7 @@ X11SalGraphicsImpl::X11SalGraphicsImpl(X11SalGraphics& 
rParent):
 mpPenGC(nullptr),
 moPenColor( std::in_place, 0x00, 0x00, 0x00 ),
 mnPenPixel(0),
-mpMonoGC(nullptr),
 mpCopyGC(nullptr),
-mpMaskGC(nullptr),
 mpInvertGC(nullptr),
 mpStippleGC(nullptr)
 {
@@ -168,9 +166,7 @@ void X11SalGraphicsImpl::freeResources()
 
 freeGC( pDisplay, mpPenGC );
 freeGC( pDisplay, mpBrushGC );
-freeGC( pDisplay, mpMonoGC );
 freeGC( pDisplay, mpCopyGC );
-freeGC( pDisplay, mpMaskGC );
 freeGC( pDisplay, mpInvertGC );
 freeGC( pDisplay, mpStippleGC );
 mbTrackingGC = mbPenGC = mbBrushGC = mbCopyGC = mbInvertGC = mbInvert50GC 
= mbStippleGC = false;
diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx
index 1c7689b641f0..73bf4813ee42 100644
--- a/vcl/unx/generic/gdi/gdiimpl.hxx
+++ b/vcl/unx/generic/gdi/gdiimpl.hxx
@@ -64,9 +64,7 @@ private:
 Pixel mnPenPixel;
 
 
-GC mpMonoGC;
 GC mpCopyGC;
-GC mpMaskGC;
 GC mpInvertGC;
 GC mpStippleGC;
 


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

2023-01-04 Thread Noel Grandin (via logerrit)
 sc/source/core/tool/scmatrix.cxx  |   34 
 vcl/source/bitmap/BitmapMedianFilter.cxx  |  274 +--
 vcl/source/bitmap/BitmapMonochromeFilter.cxx  |  108 -
 vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx|  116 -
 vcl/source/bitmap/BitmapSepiaFilter.cxx   |  119 -
 vcl/source/bitmap/BitmapSimpleColorQuantizationFilter.cxx |  127 -
 vcl/source/bitmap/BitmapSobelGreyFilter.cxx   |  243 +-
 vcl/source/bitmap/bitmap.cxx  | 1222 ++
 vcl/source/bitmap/bitmappaint.cxx |  559 +++---
 vcl/source/bitmap/dibtools.cxx|   50 
 10 files changed, 1357 insertions(+), 1495 deletions(-)

New commits:
commit 5de1d0472b319e9d48972eb067fd8189507fa640
Author: Noel Grandin 
AuthorDate: Tue Jan 3 20:19:56 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Jan 4 15:36:08 2023 +

use sal_uInt8 for maMatFlag

which is way more cache-dense than double

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

diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index f5d04bdb3fb9..8afeb796b35e 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -64,10 +64,18 @@ struct matrix_trait
 
 typedef mdds::mtv::custom_block_func1 element_block_func;
 };
+struct matrix_flag_trait
+{
+typedef sc::string_block string_element_block;
+typedef mdds::mtv::uint8_element_block integer_element_block;
+
+typedef mdds::mtv::custom_block_func1 element_block_func;
+};
 
 }
 
 typedef mdds::multi_type_matrix MatrixImplType;
+typedef mdds::multi_type_matrix MatrixFlagImplType;
 
 namespace {
 
@@ -218,16 +226,14 @@ Comp CompareMatrixElemFunc::maComp;
 
 }
 
-/* TODO: it would be good if mdds had get/set additionally to
- * get/set, we're abusing double here. */
-typedef double TMatFlag;
-const TMatFlag SC_MATFLAG_EMPTYRESULT = 1.0;
-const TMatFlag SC_MATFLAG_EMPTYPATH   = 2.0;
+typedef uint8_t TMatFlag;
+const TMatFlag SC_MATFLAG_EMPTYRESULT = 1;
+const TMatFlag SC_MATFLAG_EMPTYPATH   = 2;
 
 class ScMatrixImpl
 {
 MatrixImplType maMat;
-MatrixImplType maMatFlag;
+MatrixFlagImplType maMatFlag;
 ScInterpreter* pErrorInterpreter;
 
 public:
@@ -706,7 +712,7 @@ svl::SharedString ScMatrixImpl::GetString( 
SvNumberFormatter& rFormatter, SCSIZE
 return maMat.get_string(aPos);
 case mdds::mtm::element_empty:
 {
-if (maMatFlag.get_numeric(nR, nC) != SC_MATFLAG_EMPTYPATH)
+if (maMatFlag.get(nR, nC) != SC_MATFLAG_EMPTYPATH)
 // not an empty path.
 return svl::SharedString::getEmptyString();
 
@@ -769,8 +775,8 @@ ScMatrixValue ScMatrixImpl::Get(SCSIZE nC, SCSIZE nR) const
 case mdds::mtm::element_empty:
 aVal.nType = ScMatValType::Empty;
 break;
-case mdds::mtm::element_numeric:
-aVal.nType = maMatFlag.get(nR, nC)
+case mdds::mtm::element_integer:
+aVal.nType = maMatFlag.get(nR, nC)
 == SC_MATFLAG_EMPTYPATH ? ScMatValType::EmptyPath 
: ScMatValType::Empty;
 break;
 default:
@@ -816,7 +822,7 @@ bool ScMatrixImpl::IsEmpty( SCSIZE nC, SCSIZE nR ) const
 // but not an 'empty path' element.
 ValidColRowReplicated( nC, nR );
 return maMat.get_type(nR, nC) == mdds::mtm::element_empty &&
-maMatFlag.get_numeric(nR, nC) != SC_MATFLAG_EMPTYPATH;
+maMatFlag.get_integer(nR, nC) != SC_MATFLAG_EMPTYPATH;
 }
 
 bool ScMatrixImpl::IsEmptyCell( SCSIZE nC, SCSIZE nR ) const
@@ -834,7 +840,7 @@ bool ScMatrixImpl::IsEmptyResult( SCSIZE nC, SCSIZE nR ) 
const
 // 'empty' or 'empty cell' or 'empty path' element.
 ValidColRowReplicated( nC, nR );
 return maMat.get_type(nR, nC) == mdds::mtm::element_empty &&
-maMatFlag.get_numeric(nR, nC) == SC_MATFLAG_EMPTYRESULT;
+maMatFlag.get_integer(nR, nC) == SC_MATFLAG_EMPTYRESULT;
 }
 
 bool ScMatrixImpl::IsEmptyPath( SCSIZE nC, SCSIZE nR ) const
@@ -842,7 +848,7 @@ bool ScMatrixImpl::IsEmptyPath( SCSIZE nC, SCSIZE nR ) const
 // Flag must indicate an 'empty path' element.
 if (ValidColRowOrReplicated( nC, nR ))
 return maMat.get_type(nR, nC) == mdds::mtm::element_empty &&
-maMatFlag.get_numeric(nR, nC) == SC_MATFLAG_EMPTYPATH;
+maMatFlag.get_integer(nR, nC) == SC_MATFLAG_EMPTYPATH;
 else
 return true;
 }
@@ -973,7 +979,7 @@ void ScMatrixImpl::PutEmptyResultVector( SCSIZE nCount, 
SCSIZE nC, SCSIZE nR )
 {
 maMat.set_empty(nR, nC, nCount);
 // Flag to indicate that this is 'empty result', not 'empty' or 'empty 

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

2022-09-22 Thread Luboš Luňák (via logerrit)
 sc/source/core/opencl/formulagroupcl.cxx   |6 -
 sc/source/core/opencl/op_financial_helpers.hxx |   27 -
 sc/source/core/opencl/op_math.cxx  |  125 +++--
 sc/source/core/opencl/op_math.hxx  |7 -
 sc/source/core/opencl/op_math_helpers.hxx  |   27 +
 sc/source/core/opencl/op_statistical.cxx   |   72 +++---
 6 files changed, 132 insertions(+), 132 deletions(-)

New commits:
commit 64426b95bd6c9f1fe7a40c2f2bfabb43b1ce658c
Author: Luboš Luňák 
AuthorDate: Thu Sep 22 09:54:56 2022 +0200
Commit: Luboš Luňák 
CommitDate: Thu Sep 22 17:58:57 2022 +0200

fix opencl round(), roundup() and rounddown()

These are quite tricky due to rounding errors, the pown() used
to "shift" the decimal point left-right increases the rounding error,
so this must be compensated for. The round adjustment is based
on rtl_math_round(), the up/down variants check for valid 12 places.

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

diff --git a/sc/source/core/opencl/op_financial_helpers.hxx 
b/sc/source/core/opencl/op_financial_helpers.hxx
index 060ed6813566..da2314ecc20f 100644
--- a/sc/source/core/opencl/op_financial_helpers.hxx
+++ b/sc/source/core/opencl/op_financial_helpers.hxx
@@ -9,36 +9,9 @@
 
 #pragma once
 
-const char nCorrValDecl[] ="double constant nCorrVal[]"
-"= {0, 9e-1, 9e-2, 9e-3, 9e-4, 9e-5, 9e-6, 9e-7, "
-"9e-8,9e-9, 9e-10, 9e-11, 9e-12, 9e-13, 9e-14, 9e-15};\n";
-
 const char SCdEpsilonDecl[] =
 "constant double SCdEpsilon = 1.0E-7;\n";
 
-const char RoundDecl[] = "double  Round(double fValue);\n";
-
-const char Round[] =
-"double  Round(double fValue)\n"
-"{\n"
-"if ( fValue == 0.0  )\n"
-"return fValue;\n"
-"\n"
-"double fFac = 0;\n"
-"int nExp;\n"
-"if ( fValue > 0.0 )\n"
-"nExp = ( floor( log10( fValue ) ) );\n"
-"else\n"
-"nExp = 0;\n"
-"int nIndex = 15 - nExp;\n"
-"if ( nIndex > 15 )\n"
-"nIndex = 15;\n"
-"else if ( nIndex <= 1 )\n"
-"nIndex = 0;\n"
-"fValue = floor( fValue + 0.5 + nCorrVal[nIndex] );\n"
-"return fValue;\n"
-"}\n";
-
 const char GetPMTDecl[] =
 "double GetPMT( double fRate, double fNper, double fPv, double fFv, bool 
bPayInAdvance);\n";
 
diff --git a/sc/source/core/opencl/op_math.cxx 
b/sc/source/core/opencl/op_math.cxx
index 430f8734f5f0..cd2f2f8b5396 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -861,6 +861,13 @@ void OpAverageIfs::GenSlidingWindowFunction(outputstream 
,
 ss << "}";
 }
 
+void OpRound::BinInlineFun(std::set& decls,std::set& 
funs)
+{
+decls.insert(nCorrValDecl);
+decls.insert(RoundDecl);
+funs.insert(Round);
+}
+
 void OpRound::GenSlidingWindowFunction(outputstream ,
  const std::string , SubArguments )
 {
@@ -868,25 +875,24 @@ void OpRound::GenSlidingWindowFunction(outputstream ,
 GenerateFunctionDeclaration( sSymName, vSubArguments, ss );
 ss << "{\n";
 ss << "int gid0=get_global_id(0);\n";
-ss << "int singleIndex =  gid0;\n";
-GenTmpVariables(ss,vSubArguments);
-CheckAllSubArgumentIsNan(ss,vSubArguments);
-if(vSubArguments.size() ==2)
-{
-ss << "for(int i=0;itmp1;i--)\n";
-ss << "tmp0 = tmp0 / 10;\n";
-}
-ss << "double tmp=round(tmp0);\n";
-if(vSubArguments.size() ==2)
+GenerateArg( "value", 0, vSubArguments, ss );
+if(vSubArguments.size() ==1)
+ss << "return round(value);\n";
+else
 {
-ss << "for(int i=0;itmp1;i--)\n";
-ss << "tmp = tmp * 10;\n";
+GenerateArg( "fDec", 1, vSubArguments, ss );
+ss << "int dec = floor( fDec );\n";
+ss << "if( dec < -20 || dec > 20 )\n";
+ss << "return CreateDoubleError( IllegalArgument );\n";
+ss << "if( dec == 0 )\n";
+ss << "return round(value);\n";
+ss << "double orig_value = value;\n";
+ss << "value = fabs(value);\n";
+ss << "double multiply = pown(10.0, dec);\n";
+ss << "double tmp = value*multiply;\n";
+ss << "tmp = Round( tmp );\n";
+ss << "return copysign(tmp/multiply, orig_value);\n";
 }
-ss << "return tmp;\n";
 ss << "}";
 }
 
@@ -897,32 +903,24 @@ void OpRoundUp::GenSlidingWindowFunction(outputstream ,
 GenerateFunctionDeclaration( sSymName, vSubArguments, ss );
 ss << "{\n";
 ss << "int gid0=get_global_id(0);\n";
-ss << "int singleIndex =  gid0;\n";
-ss << "int intTmp;\n";
-ss << "double tmp;\n";
-GenTmpVariables(ss,vSubArguments);
-CheckAllSubArgumentIsNan(ss,vSubArguments);
-if( vSubArguments.size() == 1 )
-ss << "double tmp1 = 0;\n";
-ss << "int shift = (int)tmp1;\n";

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

2022-09-21 Thread Luboš Luňák (via logerrit)
 sc/source/core/opencl/formulagroupcl.cxx |   66 --
 sc/source/core/opencl/op_statistical.cxx |  194 +--
 sc/source/core/opencl/op_statistical.hxx |4 
 3 files changed, 38 insertions(+), 226 deletions(-)

New commits:
commit bdb576ea889d944b2aa9d3dfaa8fbd7c07415c82
Author: Luboš Luňák 
AuthorDate: Tue Sep 20 18:08:42 2022 +0200
Commit: Luboš Luňák 
CommitDate: Wed Sep 21 10:24:26 2022 +0200

fix/simplify opencl GEOMEAN()

I don't quite see why this one would need such a special handling,
when most other functions (e.g. the very similar HARMEAN()) can do
with just generic handling.

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

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index af81125e9c99..a8dc885d1aa0 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1642,66 +1642,6 @@ public:
 {
 i += rxSubArgument->Marshal(k, argno + i, nVectorWidth, pProgram);
 }
-if (dynamic_cast(mpCodeGen.get()))
-{
-openclwrapper::KernelEnv kEnv;
-openclwrapper::setKernelEnv();
-cl_int err;
-cl_mem pClmem2;
-
-std::vector vclmem;
-for (const auto& rxSubArgument : mvSubArguments)
-{
-if (VectorRef* VR = 
dynamic_cast(rxSubArgument.get()))
-vclmem.push_back(VR->GetCLBuffer());
-else
-vclmem.push_back(nullptr);
-}
-pClmem2 = clCreateBuffer(kEnv.mpkContext, CL_MEM_READ_WRITE,
-sizeof(double) * nVectorWidth, nullptr, );
-if (CL_SUCCESS != err)
-throw OpenCLError("clCreateBuffer", err, __FILE__, __LINE__);
-SAL_INFO("sc.opencl", "Created buffer " << pClmem2 << " size " << 
sizeof(double) << "*" << nVectorWidth << "=" << (sizeof(double)*nVectorWidth));
-
-std::string kernelName = "GeoMean_reduction";
-cl_kernel redKernel = clCreateKernel(pProgram, kernelName.c_str(), 
);
-if (err != CL_SUCCESS)
-throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__);
-SAL_INFO("sc.opencl", "Created kernel " << redKernel << " with 
name " << kernelName << " in program " << pProgram);
-
-// set kernel arg of reduction kernel
-for (size_t j = 0; j < vclmem.size(); j++)
-{
-SAL_INFO("sc.opencl", "Kernel " << redKernel << " arg " << j 
<< ": " << (vclmem[j] ? "cl_mem" : "double") << ": " << vclmem[j]);
-err = clSetKernelArg(redKernel, j,
-vclmem[j] ? sizeof(cl_mem) : sizeof(double),
-static_cast([j]));
-if (CL_SUCCESS != err)
-throw OpenCLError("clSetKernelArg", err, __FILE__, 
__LINE__);
-}
-SAL_INFO("sc.opencl", "Kernel " << redKernel << " arg " << 
vclmem.size() << ": cl_mem: " << pClmem2);
-err = clSetKernelArg(redKernel, vclmem.size(), sizeof(cl_mem), 
static_cast());
-if (CL_SUCCESS != err)
-throw OpenCLError("clSetKernelArg", err, __FILE__, __LINE__);
-
-// set work group size and execute
-size_t global_work_size[] = { 256, 
static_cast(nVectorWidth) };
-size_t const local_work_size[] = { 256, 1 };
-SAL_INFO("sc.opencl", "Enqueuing kernel " << redKernel);
-err = clEnqueueNDRangeKernel(kEnv.mpkCmdQueue, redKernel, 2, 
nullptr,
-global_work_size, local_work_size, 0, nullptr, nullptr);
-if (CL_SUCCESS != err)
-throw OpenCLError("clEnqueueNDRangeKernel", err, __FILE__, 
__LINE__);
-err = clFinish(kEnv.mpkCmdQueue);
-if (CL_SUCCESS != err)
-throw OpenCLError("clFinish", err, __FILE__, __LINE__);
-
-// Pass pClmem2 to the "real" kernel
-SAL_INFO("sc.opencl", "Kernel " << k << " arg " << argno << ": 
cl_mem: " << pClmem2);
-err = clSetKernelArg(k, argno, sizeof(cl_mem), 
static_cast());
-if (CL_SUCCESS != err)
-throw OpenCLError("clSetKernelArg", err, __FILE__, __LINE__);
-}
 if (OpSumIfs* OpSumCodeGen = dynamic_cast(mpCodeGen.get()))
 {
 openclwrapper::KernelEnv kEnv;
@@ -2303,9 +2243,9 @@ 
DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config,
 case ocGauss:
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, 
ft->Children[i], std::make_shared(), nResultSize));
 break;
-/*case ocGeoMean:
-mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, 
ft->Children[i], 

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

2022-09-21 Thread Luboš Luňák (via logerrit)
 sc/source/core/opencl/formulagroupcl.cxx   |   72 -
 sc/source/core/opencl/op_financial.cxx |   65 --
 sc/source/core/opencl/op_financial.hxx |   22 +++
 sc/source/core/opencl/op_financial_helpers.hxx |   65 +++---
 sc/source/core/opencl/op_statistical.cxx   |   52 +-
 5 files changed, 132 insertions(+), 144 deletions(-)

New commits:
commit 380b42bd1b8be39d774245f93651515b45df150b
Author: Luboš Luňák 
AuthorDate: Tue Sep 20 18:08:31 2022 +0200
Commit: Luboš Luňák 
CommitDate: Wed Sep 21 10:23:36 2022 +0200

fix and enable some disabled opencl functions

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

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 75485b47dc21..af81125e9c99 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -2523,10 +2523,10 @@ 
DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config,
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,
 ft->Children[i], std::make_shared(), 
nResultSize));
 break;
-/*case ocGammaDist:
+case ocGammaDist:
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,
- ft->Children[i], std::make_sharedChildren[i], std::make_shared(), 
nResultSize));
+break;
 case ocLn:
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,
 ft->Children[i], std::make_shared(), 
nResultSize));
@@ -2551,10 +2551,10 @@ 
DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config,
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,
 ft->Children[i], std::make_shared(), 
nResultSize));
 break;
-/*case ocChiDist:
+case ocChiDist:
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,
- ft->Children[i],std::make_sharedChildren[i],std::make_shared(), 
nResultSize));
+break;
 case ocPow:
 case ocPower:
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,
@@ -2564,26 +2564,26 @@ 
DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config,
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,
 ft->Children[i], std::make_shared(), 
nResultSize));
 break;
-/*case ocChiSqDist:
+case ocChiSqDist:
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,
- ft->Children[i],std::make_sharedChildren[i],std::make_shared(), 
nResultSize));
 break;
 case ocChiSqInv:
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,
- ft->Children[i],std::make_sharedChildren[i],std::make_shared(), 
nResultSize));
 break;
 case ocGammaInv:
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,
- ft->Children[i], std::make_sharedChildren[i], std::make_shared(), 
nResultSize));
+break;
 case ocFloor:
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,
 ft->Children[i], std::make_shared(), 
nResultSize));
 break;
-/*case ocFInv:
+case ocFInv:
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,
- ft->Children[i], std::make_sharedChildren[i], std::make_shared(), 
nResultSize));
+break;
 case ocFTest:
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,
 ft->Children[i], std::make_shared(), 
nResultSize));
@@ -2664,10 +2664,10 @@ 
DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config,
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,
 ft->Children[i], std::make_shared(), 
nResultSize));
 break;
-/*case ocChiInv:
+case ocChiInv:
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,
- ft->Children[i],std::make_sharedChildren[i],std::make_shared(), 
nResultSize));
+break;
 case ocPoissonDist:
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,
 ft->Children[i], std::make_shared(), 
nResultSize));
@@ -2742,10 +2742,10 @@ 
DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config,
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,

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

2022-09-20 Thread Luboš Luňák (via logerrit)
 sc/source/core/opencl/formulagroupcl.cxx |   16 
 sc/source/core/opencl/op_statistical.cxx | 1399 ---
 sc/source/core/opencl/op_statistical.hxx |  158 ++-
 sc/source/core/opencl/opbase.cxx |7 
 sc/source/core/opencl/opbase.hxx |6 
 5 files changed, 326 insertions(+), 1260 deletions(-)

New commits:
commit 66ad69f5b300060f174fdc6c6e106dbba2b0140a
Author: Luboš Luňák 
AuthorDate: Mon Sep 19 17:51:02 2022 +0200
Commit: Luboš Luňák 
CommitDate: Tue Sep 20 08:46:10 2022 +0200

correct handling of 'nested' in opencl vectors

The 'nested' arguments means the value is used inside a loop, which
already implicitly does range checking.

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

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 564ee9cc6393..b4e35e932ba5 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -915,8 +915,8 @@ public:
 virtual std::string GenSlidingWindowDeclRef( bool nested ) const override
 {
 outputstream ss;
-ss << "(!isnan(" << VectorRef::GenSlidingWindowDeclRef();
-ss << ")?" << VectorRef::GenSlidingWindowDeclRef();
+ss << "(!isnan(" << VectorRef::GenSlidingWindowDeclRef(nested);
+ss << ")?" << VectorRef::GenSlidingWindowDeclRef(nested);
 ss << ":" << mStringArgument.GenSlidingWindowDeclRef(nested);
 ss << ")";
 return ss.str();
@@ -977,18 +977,18 @@ std::string 
DynamicKernelSlidingArgument::GenSlidingWindowDeclRef( bool ne
 outputstream ss;
 if (!bIsStartFixed && !bIsEndFixed)
 {
-if (nested)
+if (!nested)
 ss << "((i+gid0) <" << nArrayLength << "?";
 ss << Base::GetName() << "[i + gid0]";
-if (nested)
+if (!nested)
 ss << ":NAN)";
 }
 else
 {
-if (nested)
+if (!nested)
 ss << "(i <" << nArrayLength << "?";
 ss << Base::GetName() << "[i]";
-if (nested)
+if (!nested)
 ss << ":NAN)";
 }
 return ss.str();
@@ -1146,8 +1146,8 @@ public:
 virtual std::string GenSlidingWindowDeclRef( bool nested ) const override
 {
 outputstream ss;
-ss << "(!isnan(" << mDoubleArgument.GenSlidingWindowDeclRef();
-ss << ")?" << mDoubleArgument.GenSlidingWindowDeclRef();
+ss << "(!isnan(" << mDoubleArgument.GenSlidingWindowDeclRef(nested);
+ss << ")?" << mDoubleArgument.GenSlidingWindowDeclRef(nested);
 ss << ":" << mStringArgument.GenSlidingWindowDeclRef(nested);
 ss << ")";
 return ss.str();
commit 4c2b8db7814dead51607935c50c1d0160333d616
Author: Luboš Luňák 
AuthorDate: Mon Sep 19 17:50:58 2022 +0200
Commit: Luboš Luňák 
CommitDate: Tue Sep 20 08:45:48 2022 +0200

reduce opencl copy in op_statistical.cxx (svDoubleVectorRef pair)

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

diff --git a/sc/source/core/opencl/op_statistical.cxx 
b/sc/source/core/opencl/op_statistical.cxx
index 29e150de10cd..f4bf77715cde 100644
--- a/sc/source/core/opencl/op_statistical.cxx
+++ b/sc/source/core/opencl/op_statistical.cxx
@@ -586,293 +586,6 @@ void OpStDevP::GenSlidingWindowFunction(outputstream ,
 ss << "}\n";
 }
 
-void OpSlope::GenSlidingWindowFunction(outputstream ,
-const std::string , SubArguments )
-{
-CHECK_PARAMETER_COUNT(2,2);
-GenerateFunctionDeclaration( sSymName, vSubArguments, ss );
-ss << "{\n";
-ss << "int gid0 = get_global_id(0);\n";
-ss << "double fSumX = 0.0;\n";
-ss << "double fSumY = 0.0;\n";
-ss << "double fMeanX = 0.0;\n";
-ss << "double fMeanY = 0.0;\n";
-ss << "double fSumDeltaXDeltaY = 0.0;\n";
-ss << "double fSumSqrDeltaX = 0.0;\n";
-ss << "double fCount = 0.0;\n";
-ss << "double argX = 0.0;\n";
-ss << "double argY = 0.0;\n";
-FormulaToken *pCur = vSubArguments[1]->GetFormulaToken();
-FormulaToken *pCur1 = vSubArguments[0]->GetFormulaToken();
-assert(pCur);
-assert(pCur1);
-if (pCur->GetType() == formula::svDoubleVectorRef&&
-pCur1->GetType() == formula::svDoubleVectorRef)
-{
-const formula::DoubleVectorRefToken* pDVR =
-static_cast(pCur);
-const formula::DoubleVectorRefToken* pDVR1 =
-static_cast(pCur1);
-
-size_t nCurWindowSize = pDVR->GetRefRowSize();
-size_t nCurWindowSize1 = pDVR1->GetRefRowSize();
-size_t arrayLength = pDVR->GetArrayLength()<
-   pDVR1->GetArrayLength() ? pDVR->GetArrayLength():
-pDVR1->GetArrayLength();

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

2022-09-20 Thread Luboš Luňák (via logerrit)
 sc/source/core/opencl/op_statistical.cxx | 1410 +++
 sc/source/core/opencl/opbase.cxx |   85 +
 sc/source/core/opencl/opbase.hxx |9 
 3 files changed, 231 insertions(+), 1273 deletions(-)

New commits:
commit f0466cabc2d33877d5aaa86fcf71db753f400873
Author: Luboš Luňák 
AuthorDate: Mon Sep 19 17:43:19 2022 +0200
Commit: Luboš Luňák 
CommitDate: Tue Sep 20 08:44:30 2022 +0200

reduce opencl copy also when handling svDoubleVectorRef

This is for when a simple loop is enough to handle the ranges.

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

diff --git a/sc/source/core/opencl/op_statistical.cxx 
b/sc/source/core/opencl/op_statistical.cxx
index cdbfe8b10679..aedabb4fc14c 100644
--- a/sc/source/core/opencl/op_statistical.cxx
+++ b/sc/source/core/opencl/op_statistical.cxx
@@ -19,6 +19,7 @@ namespace sc::opencl {
 void OpVar::GenSlidingWindowFunction(outputstream ,
 const std::string , SubArguments )
 {
+CHECK_PARAMETER_COUNT( 1, 30 );
 GenerateFunctionDeclaration( sSymName, vSubArguments, ss );
 ss << "{\n";
 ss << "int gid0 = get_global_id(0);\n";
@@ -26,160 +27,18 @@ void OpVar::GenSlidingWindowFunction(outputstream ,
 ss << "double fMean = 0.0;\n";
 ss << "double vSum = 0.0;\n";
 ss << "double fCount = 0.0;\n";
-ss << "double arg = 0.0;\n";
-unsigned i = vSubArguments.size();
-while (i--)
-{
-FormulaToken *pCur = vSubArguments[i]->GetFormulaToken();
-assert(pCur);
-if(ocPush == vSubArguments[i]->GetFormulaToken()->GetOpCode())
-{
-if (pCur->GetType() == formula::svDoubleVectorRef)
-{
-const formula::DoubleVectorRefToken* pDVR =
-static_cast(pCur);
-size_t nCurWindowSize = pDVR->GetRefRowSize();
-ss << "for (int i = ";
-if (!pDVR->IsStartFixed() && pDVR->IsEndFixed())
-{
-ss << "gid0; i < " << pDVR->GetArrayLength();
-ss << " && i < " << nCurWindowSize  << "; i++)\n";
-ss << "{\n";
-}
-else if (pDVR->IsStartFixed() && !pDVR->IsEndFixed())
-{
-ss << "0; i < " << pDVR->GetArrayLength();
-ss << " && i < gid0+" << nCurWindowSize << "; i++)\n";
-ss << "{\n";
-}
-else if (!pDVR->IsStartFixed() && !pDVR->IsEndFixed())
-{
-ss << "0; i + gid0 < " << pDVR->GetArrayLength();
-ss << " &&  i < " << nCurWindowSize << "; i++)\n";
-ss << "{\n";
-}
-else
-{
-ss << "0; i < " << pDVR->GetArrayLength() << "; i++)\n";
-ss << "{\n";
-}
-ss << "arg = ";
-ss << vSubArguments[i]->GenSlidingWindowDeclRef();
-ss << ";\n";
-ss << "if (isnan(arg))\n";
-ss << "continue;\n";
-ss << "fSum += arg;\n";
-ss << "fCount += 1.0;\n";
-ss << "}\n";
-}
-else if (pCur->GetType() == formula::svSingleVectorRef)
-{
-const formula::SingleVectorRefToken* pSVR =
-static_cast< const formula::SingleVectorRefToken*>(pCur);
-ss << "if (gid0 < " << pSVR->GetArrayLength() << ")\n";
-ss << "{\n";
-ss << "arg = ";
-ss << vSubArguments[i]->GenSlidingWindowDeclRef() << ";\n";
-ss << "if (!isnan(arg))\n";
-ss << "{\n";
-ss << "fSum += arg;\n";
-ss << "fCount += 1.0;\n";
-ss << "}\n";
-ss << "}\n";
-}
-else
-{
-ss << "arg = " << pCur->GetDouble() << ";\n";
-ss << "fSum += arg;\n";
-ss << "fCount += 1.0;\n";
-}
-}
-else
-{
-ss << "arg = ";
-ss << vSubArguments[i]->GenSlidingWindowDeclRef() << ";\n";
-ss << "fSum += arg;\n";
-ss << "fCount += 1.0;\n";
-}
-if (i == 0)
-{
-ss << "fMean = fSum / fCount;\n";
-}
-}
-i = vSubArguments.size();
-while (i--)
-{
-FormulaToken *pCur = vSubArguments[i]->GetFormulaToken();
-assert(pCur);
-if(ocPush == vSubArguments[i]->GetFormulaToken()->GetOpCode())
-{
-   

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

2022-09-13 Thread Luboš Luňák (via logerrit)
 sc/source/core/opencl/op_financial.cxx   |2 
 sc/source/core/opencl/op_financial_helpers.hxx   |  245 +-
 sc/source/core/opencl/op_math.cxx| 2429 ++-
 sc/source/core/opencl/op_math.hxx|  351 +--
 sc/source/core/opencl/op_math_helpers.hxx|   39 
 sc/source/core/opencl/op_statistical.cxx |2 
 sc/source/core/opencl/op_statistical_helpers.hxx |  153 -
 sc/source/core/opencl/opbase.cxx |9 
 sc/source/core/opencl/opbase.hxx |4 
 sc/source/core/opencl/utils.hxx  |5 
 solenv/clang-format/excludelist  |6 
 11 files changed, 1066 insertions(+), 2179 deletions(-)

New commits:
commit aa0d6cb52979e29830596ec5a4e8e625500d6cb9
Author: Luboš Luňák 
AuthorDate: Tue Sep 6 12:38:00 2022 +0200
Commit: Luboš Luňák 
CommitDate: Tue Sep 13 09:05:34 2022 +0200

clean up opencl helper functions

It seems a bit wasteful to use std::string for const strings.

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

diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index 0840c334f7df..863fa2552cab 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -16,7 +16,7 @@ using namespace formula;
 
 namespace sc::opencl {
 // Definitions of inline functions
-#include "opinlinefun_finacial.cxx"
+#include "op_financial_helpers.hxx"
 
 void RRI::GenSlidingWindowFunction(
 outputstream , const std::string , SubArguments )
diff --git a/sc/source/core/opencl/opinlinefun_finacial.cxx 
b/sc/source/core/opencl/op_financial_helpers.hxx
similarity index 94%
rename from sc/source/core/opencl/opinlinefun_finacial.cxx
rename to sc/source/core/opencl/op_financial_helpers.hxx
index dd12767cf93a..eaf688af91c1 100644
--- a/sc/source/core/opencl/opinlinefun_finacial.cxx
+++ b/sc/source/core/opencl/op_financial_helpers.hxx
@@ -7,19 +7,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef SC_OPENCL_OPINLINFUN_finacial
-#define SC_OPENCL_OPINLINFUN_finacial
+#pragma once
 
-std::string nCorrValDecl ="double constant nCorrVal[]"
+const char nCorrValDecl[] ="double constant nCorrVal[]"
 "= {0, 9e-1, 9e-2, 9e-3, 9e-4, 9e-5, 9e-6, 9e-7, "
 "9e-8,9e-9, 9e-10, 9e-11, 9e-12, 9e-13, 9e-14, 9e-15};\n";
 
-std::string SCdEpsilonDecl =
+const char SCdEpsilonDecl[] =
 "constant double SCdEpsilon = 1.0E-7;\n";
 
-std::string RoundDecl = "double  Round(double fValue);\n";
+const char RoundDecl[] = "double  Round(double fValue);\n";
 
-std::string Round =
+const char Round[] =
 "double  Round(double fValue)\n"
 "{\n"
 "if ( fValue == 0.0  )\n"
@@ -40,10 +39,10 @@ std::string Round =
 "return fValue;\n"
 "}\n";
 
-std::string GetPMT_newDecl =
+const char GetPMT_newDecl[] =
 "double GetPMT_new( double fRate, double fNper, double fPv, double fFv,"
 "int nPayType );\n";
-std::string GetPMT_new=
+const char GetPMT_new[] =
 "double GetPMT_new( double fRate, double fNper, double fPv, double fFv,"
 "int nPayType)\n"
 "{\n"
@@ -57,11 +56,11 @@ std::string GetPMT_new=
 "1.0 - 1.0 / fTerm);\n"
 "return -fPmt;\n"
 "}\n";
-std::string GetFVDecl =
+const char GetFVDecl[] =
 "double GetFV( double fRate, double fNper, double fPmt,"
 "double fPv, int nPayType );\n";
 
-std::string GetFV =
+const char GetFV[] =
 "double GetFV( double fRate, double fNper, double fPmt,"
 "double fPv, int nPayType )\n"
 "{\n"
@@ -80,11 +79,11 @@ std::string GetFV =
 "return -fFv;\n"
 "}\n";
 
-std::string GetFV_newDecl =
+const char GetFV_newDecl[] =
 "double GetFV_new( double fRate, double fNper, double fPmt,"
 "double fPv, int nPayType );\n";
 
-std::string GetFV_new =
+const char GetFV_new[] =
 "double GetFV_new( double fRate, double fNper, double fPmt,"
 "double fPv, int nPayType )\n"
 "{\n"
@@ -98,20 +97,20 @@ std::string GetFV_new =
 "return -fFv;\n"
 "}\n";
 
-std::string IsLeapYearDecl =
+const char IsLeapYearDecl[] =
 "bool IsLeapYear( int n );\n";
 
-std::string IsLeapYear =
+const char IsLeapYear[] =
 "bool IsLeapYear( int n )\n"
 "{\n"
 "return ( (( ( n % 4 ) == 0 ) && ( ( n % 100 ) != 0)) || ( ( n % 400 ) == "
 "0 ) );\n"
 "}\n";
 
-std::string DaysInMonthDecl=
+const char DaysInMonthDecl[] =
 "int DaysInMonth( int nMonth, int nYear );\n";
 
-std::string DaysInMonth =
+const char DaysInMonth[] =
 "int DaysInMonth( int nMonth, int nYear )\n"
 "{\n"
 "int aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30,\n"
@@ -127,10 +126,10 @@ std::string DaysInMonth =
 "return aDaysInMonth[nMonth-1];\n"
 "}\n"
 "}\n";
-std::string DaysInMonth_newDecl=
+const char DaysInMonth_newDecl[] =
 "int DaysInMonth( int nMonth, int nYear );\n";
 
-std::string DaysInMonth_new =
+const char DaysInMonth_new[] =
 "int DaysInMonth( int nMonth, int nYear )\n"
 "{\n"
 "

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

2022-09-13 Thread Luboš Luňák (via logerrit)
 sc/source/core/opencl/formulagroupcl.cxx |   32 -
 sc/source/core/opencl/op_addin.cxx   |  124 -
 sc/source/core/opencl/op_array.cxx   |   33 -
 sc/source/core/opencl/op_database.cxx|  121 -
 sc/source/core/opencl/op_financial.cxx   |  586 -
 sc/source/core/opencl/op_logical.cxx |  346 +-
 sc/source/core/opencl/op_logical.hxx |   34 -
 sc/source/core/opencl/op_math.cxx|  657 
 sc/source/core/opencl/op_spreadsheet.cxx |   11 
 sc/source/core/opencl/op_statistical.cxx |  724 +--
 sc/source/core/opencl/opbase.cxx |   45 +
 sc/source/core/opencl/opbase.hxx |6 
 12 files changed, 466 insertions(+), 2253 deletions(-)

New commits:
commit 7ed959dfe96f3a4edc0ee00f23473aac28734e1f
Author: Luboš Luňák 
AuthorDate: Tue Sep 6 12:37:50 2022 +0200
Commit: Luboš Luňák 
CommitDate: Tue Sep 13 09:05:06 2022 +0200

reduce opencl copy in op_addin.cxx and op_logical.cxx

The svDoubleVectorRef stuff in OpAnd etc. didn't make sense, those
operators are required to do implicit intersection (which can be done
in sc core in ScCompiler::HandleIIOpCodeInternal()).

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

diff --git a/sc/source/core/opencl/op_addin.cxx 
b/sc/source/core/opencl/op_addin.cxx
index a9c2f9508ac8..602ed2dfb36d 100644
--- a/sc/source/core/opencl/op_addin.cxx
+++ b/sc/source/core/opencl/op_addin.cxx
@@ -23,69 +23,8 @@ void OpBesselj::GenSlidingWindowFunction(outputstream ,
 GenerateFunctionDeclaration( sSymName, vSubArguments, ss );
 ss << "{\n";
 ss << "int gid0 = get_global_id(0);\n";
-ss << "double x = 0.0;\n";
-ss << "double N = 0.0;\n";
-FormulaToken *tmpCur0 = vSubArguments[0]->GetFormulaToken();
-assert(tmpCur0);
-if(ocPush == vSubArguments[0]->GetFormulaToken()->GetOpCode())
-{
-if(tmpCur0->GetType() == formula::svSingleVectorRef)
-{
-const formula::SingleVectorRefToken*tmpCurSVR0 =
-static_cast(tmpCur0);
-ss << "if (gid0 < " << tmpCurSVR0->GetArrayLength() << ")\n";
-ss << "{\n";
-ss << "x = ";
-ss << vSubArguments[0]->GenSlidingWindowDeclRef() << ";\n";
-ss << "if (isnan(x))\n";
-ss << "x = 0.0;\n";
-ss << "}\n";
-}
-else if(tmpCur0->GetType() == formula::svDouble)
-{
-ss << "x = " << tmpCur0->GetDouble() << ";\n";
-}
-else
-{
-throw Unhandled(__FILE__, __LINE__);
-}
-}
-else
-{
-ss << "x = ";
-ss << vSubArguments[0]->GenSlidingWindowDeclRef() << ";\n";
-}
-
-FormulaToken *tmpCur1 = vSubArguments[1]->GetFormulaToken();
-assert(tmpCur1);
-if(ocPush == vSubArguments[1]->GetFormulaToken()->GetOpCode())
-{
-if(tmpCur1->GetType() == formula::svSingleVectorRef)
-{
-const formula::SingleVectorRefToken*tmpCurSVR1 =
-static_cast(tmpCur1);
-ss << "if (gid0 < " << tmpCurSVR1->GetArrayLength() << ")\n";
-ss << "{\n";
-ss << "N = ";
-ss << vSubArguments[1]->GenSlidingWindowDeclRef() << ";\n";
-ss << "if (isnan(N))\n";
-ss << "N = 0.0;\n";
-ss << "}\n";
-}
-else if(tmpCur1->GetType() == formula::svDouble)
-{
-ss << "N = " << tmpCur1->GetDouble() << ";\n";
-}
-else
-{
-throw Unhandled(__FILE__, __LINE__);
-}
-}
-else
-{
-ss << "N = ";
-ss << vSubArguments[1]->GenSlidingWindowDeclRef() << ";\n";
-}
+GenerateArg( "x", 0, vSubArguments, ss );
+GenerateArg( "N", 1, vSubArguments, ss );
 ss << "double f_2_DIV_PI = 2.0 / M_PI;\n";
 ss << "if( N < 0.0 )\n";
 ss << "return CreateDoubleError(IllegalArgument);\n";
@@ -170,44 +109,14 @@ void OpGestep::GenSlidingWindowFunction(
 outputstream ,const std::string ,
 SubArguments )
 {
+CHECK_PARAMETER_COUNT( 2, 2 );
 GenerateFunctionDeclaration( sSymName, vSubArguments, ss );
 ss << "{\n";
-ss << "double tmp=0,tmp0 =0,tmp1 = 0;\n";
+ss << "double tmp=0;\n";
 ss << "int gid0=get_global_id(0);\n";
 ss <<"\n";
-for (size_t i = 0; i < vSubArguments.size(); i++)
-{
-FormulaToken *pCur = vSubArguments[i]->GetFormulaToken();
-assert(pCur);
-if (pCur->GetType() == formula::svSingleVectorRef)
-{
-const formula::SingleVectorRefToken& rSVR =
-dynamic_cast< const formula::SingleVectorRefToken& >(*pCur);
-ss << 

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

2022-09-06 Thread Caolán McNamara (via logerrit)
 sc/source/ui/dbgui/PivotLayoutTreeListData.cxx |6 +++---
 vcl/source/control/calendar.cxx|2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 0e77a73f2f8bcdaa36dd3c099405123c614b4770
Author: Caolán McNamara 
AuthorDate: Tue Sep 6 14:07:45 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Sep 6 20:50:19 2022 +0200

cid#1500509 silence Out-of-bounds access

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

diff --git a/vcl/source/control/calendar.cxx b/vcl/source/control/calendar.cxx
index 7554d0d99a08..0227db0c3e79 100644
--- a/vcl/source/control/calendar.cxx
+++ b/vcl/source/control/calendar.cxx
@@ -525,7 +525,7 @@ void Calendar::ImplDrawDate(vcl::RenderContext& 
rRenderContext,
 bool bOther, sal_Int32 nToday )
 {
 Color const * pTextColor = nullptr;
-const OUString& rDay = maDayTexts[nDay - 1];
+const OUString& rDay = maDayTexts[(nDay - 1) % std::size(maDayTexts)];
 tools::Rectangle aDateRect(nX, nY, nX + mnDayWidth - 1, nY + mnDayHeight - 
1);
 
 bool bSel = false;
commit 37017c52ae3705e4d609e25a6722d588abe706c2
Author: Caolán McNamara 
AuthorDate: Tue Sep 6 14:04:47 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Sep 6 20:50:02 2022 +0200

cid#1500538 Big parameter passed by value

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

diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx 
b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
index 19992fc31831..7455613274c1 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
@@ -94,13 +94,13 @@ IMPL_LINK_NOARG(ScPivotLayoutTreeListData, DoubleClickHdl, 
weld::TreeView&, bool
 
 mpFunctionDlg = pFactory->CreateScDPFunctionDlg(mxControl.get(), 
mpParent->GetLabelDataVector(), rCurrentLabelData, rCurrentFunctionData);
 
-mpFunctionDlg->StartExecuteAsync([this, pCurrentItemValue,
-rCurrentLabelData, nEntry](int nResult) 
mutable {
+mpFunctionDlg->StartExecuteAsync([this, pCurrentItemValue, nEntry](int 
nResult) mutable {
 if (nResult == RET_OK)
 {
 ScPivotFuncData& rFunctionData = pCurrentItemValue->maFunctionData;
 rFunctionData.mnFuncMask = mpFunctionDlg->GetFuncMask();
-rCurrentLabelData.mnFuncMask = mpFunctionDlg->GetFuncMask();
+ScDPLabelData& rLabelData = 
mpParent->GetLabelData(rFunctionData.mnCol);
+rLabelData.mnFuncMask = mpFunctionDlg->GetFuncMask();
 
 rFunctionData.maFieldRef = mpFunctionDlg->GetFieldRef();
 


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

2022-09-06 Thread Caolán McNamara (via logerrit)
 sc/source/ui/view/gridwin.cxx  |1 +
 sw/source/core/text/porlay.cxx |1 +
 2 files changed, 2 insertions(+)

New commits:
commit 1fb2b68d89d80ccc1b546685ea26a72796060f0b
Author: Caolán McNamara 
AuthorDate: Tue Sep 6 13:17:28 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Sep 6 16:29:34 2022 +0200

cid#1500587 silence Dereference before null check

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

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index cb2f6141df0c..abec5048910f 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1523,6 +1523,7 @@ void ScGridWindow::FilterSelect( sal_uLong nSel )
 break;
 }
 
+// coverity[check_after_deref] - could be destroyed by ExecDataSelect
 if (mpFilterBox)
 mpFilterBox->popdown();
 
commit 2b9078b01889ededaf7de3e060ecf52261ef7815
Author: Caolán McNamara 
AuthorDate: Tue Sep 6 13:04:40 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Sep 6 16:29:20 2022 +0200

cid#1500607 silence bogus Use after free

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

diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index e85bcb8d3071..29df569143e7 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -429,6 +429,7 @@ void SwLineLayout::CalcLine( SwTextFormatter , 
SwTextFormatInfo  )
 
 // Null portions are eliminated. They can form if two FlyFrames
 // overlap.
+// coverity[deref_arg] - "Cut" means next "GetNextPortion" 
returns a different Portion
 if( !pPos->Compress() )
 {
 // Only take over Height and Ascent if the rest of the line


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

2022-09-06 Thread Luboš Luňák (via logerrit)
 sc/source/core/opencl/op_logical.cxx |5 +++
 sc/source/core/opencl/op_math.cxx|   55 +++
 sc/source/core/opencl/opbase.hxx |   10 +-
 3 files changed, 50 insertions(+), 20 deletions(-)

New commits:
commit 20caaffa82f701ef52900f4504227f88320d227f
Author: Luboš Luňák 
AuthorDate: Thu Sep 1 14:01:53 2022 +0200
Commit: Luboš Luňák 
CommitDate: Tue Sep 6 12:04:06 2022 +0200

check parameter count in opencl logical functions

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

diff --git a/sc/source/core/opencl/op_logical.cxx 
b/sc/source/core/opencl/op_logical.cxx
index 969b63d0ee7b..1fa21e8250e6 100644
--- a/sc/source/core/opencl/op_logical.cxx
+++ b/sc/source/core/opencl/op_logical.cxx
@@ -18,6 +18,7 @@ namespace sc::opencl {
 void OpAnd::GenSlidingWindowFunction(outputstream ,
 const std::string , SubArguments )
 {
+CHECK_PARAMETER_COUNT_MIN( 1 );
 ss << "\ndouble " << sSymName;
 ss << "_"<< BinFuncName() <<"(";
 for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -103,6 +104,7 @@ void OpAnd::GenSlidingWindowFunction(outputstream ,
 void OpOr::GenSlidingWindowFunction(outputstream ,
 const std::string , SubArguments )
 {
+CHECK_PARAMETER_COUNT_MIN( 1 );
 ss << "\ndouble " << sSymName;
 ss << "_"<< BinFuncName() <<"(";
 for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -182,6 +184,7 @@ void OpOr::GenSlidingWindowFunction(outputstream ,
 void OpNot::GenSlidingWindowFunction(outputstream ,
 const std::string , SubArguments )
 {
+CHECK_PARAMETER_COUNT( 1, 1 );
 ss << "\ndouble " << sSymName;
 ss << "_"<< BinFuncName() <<"(";
 for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -219,6 +222,7 @@ void OpNot::GenSlidingWindowFunction(outputstream ,
 void OpXor::GenSlidingWindowFunction(outputstream ,
 const std::string , SubArguments )
 {
+CHECK_PARAMETER_COUNT_MIN( 1 );
 ss << "\ndouble " << sSymName;
 ss << "_"<< BinFuncName() <<"(";
 for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -298,6 +302,7 @@ void OpXor::GenSlidingWindowFunction(outputstream ,
 void OpIf::GenSlidingWindowFunction(outputstream ,
 const std::string , SubArguments )
 {
+CHECK_PARAMETER_COUNT( 1, 3 );
 ss << "\ndouble " << sSymName;
 ss << "_"<< BinFuncName() <<"(";
 for (size_t i = 0; i < vSubArguments.size(); i++)
diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx
index 4262da8c35da..c56c02c855a3 100644
--- a/sc/source/core/opencl/opbase.hxx
+++ b/sc/source/core/opencl/opbase.hxx
@@ -70,14 +70,20 @@ public:
 int const mLineNumber;
 };
 
-// Helper macro to be used in code emitting OpenCL code for Calc functions.
-// Requires the vSubArguments parameter.
+// Helper macros to be used in code emitting OpenCL code for Calc functions.
+// Require the vSubArguments parameter.
 #define CHECK_PARAMETER_COUNT(min, max) \
 do { \
 const int count = vSubArguments.size(); \
 if( count < ( min ) || count > ( max )) \
 throw InvalidParameterCount( count, __FILE__, __LINE__ ); \
 } while( false )
+#define CHECK_PARAMETER_COUNT_MIN(min) \
+do { \
+const int count = vSubArguments.size(); \
+if( count < ( min )) \
+throw InvalidParameterCount( count, __FILE__, __LINE__ ); \
+} while( false )
 
 typedef std::shared_ptr FormulaTreeNodeRef;
 
commit 08b0c3b848b8f2bd667fad00068f3c828c709ef5
Author: Luboš Luňák 
AuthorDate: Thu Sep 1 13:59:50 2022 +0200
Commit: Luboš Luňák 
CommitDate: Tue Sep 6 12:03:50 2022 +0200

fixes to opencl rounding functions

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

diff --git a/sc/source/core/opencl/op_math.cxx 
b/sc/source/core/opencl/op_math.cxx
index 7cb632050aa4..edcc2b940bd6 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -1670,27 +1670,28 @@ void OpRoundUp::GenSlidingWindowFunction(outputstream 
,
 ss << "int gid0=get_global_id(0);\n";
 ss << "int singleIndex =  gid0;\n";
 ss << "int intTmp;\n";
-ss << "double doubleTmp;\n";
 ss << "double tmp;\n";
 GenTmpVariables(ss,vSubArguments);
 CheckAllSubArgumentIsNan(ss,vSubArguments);
 if( vSubArguments.size() == 1 )
 ss << "double tmp1 = 0;\n";
-ss << "if(tmp1 >20 || tmp1 < -20)";
+ss << "int shift = (int)tmp1;\n";
+ss << "if(shift >20 || shift < -20)";
 ss << "{\n";
 ss << "tmp = NAN;\n";
 ss << "}else\n";
 ss << "{\n";
-ss << "for(int i=0;ishift;i--)\n";
+ss << "multiply /= 10;\n";
+ss << "intTmp = (int)(tmp0*multiply);\n";
+ss << " 

[Libreoffice-commits] core.git: 2 commits - sc/source tsan-suppress.txt

2022-09-02 Thread Noel Grandin (via logerrit)
 sc/source/core/data/bcaslot.cxx |   41 
 sc/source/core/inc/bcaslot.hxx  |5 ++--
 tsan-suppress.txt   |1 
 3 files changed, 29 insertions(+), 18 deletions(-)

New commits:
commit 9fa65519ab203500928cd63560b35daedb6e5ed9
Author: Noel Grandin 
AuthorDate: Fri Sep 2 09:40:30 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 2 10:58:42 2022 +0200

add more tsan supress

for new glib functions that show up

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

diff --git a/tsan-suppress.txt b/tsan-suppress.txt
index 9c86e10f90cd..33452dac40cf 100644
--- a/tsan-suppress.txt
+++ b/tsan-suppress.txt
@@ -61,3 +61,4 @@ race:g_source_unref_internal
 race:g_task_finalize
 race:g_socket_send_message_with_timeout
 race:g_idle_source_new
+race:g_slice_alloc0
commit ac7be5bec77ff65969f923c417d88454a4e216ef
Author: Noel Grandin 
AuthorDate: Thu Sep 1 21:56:38 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 2 10:58:27 2022 +0200

no need to use unique_ptr for this map in TableSlotsMap

map is already a node based data structure, so the values will stay
in the same place in memory

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

diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx
index 09493963469c..a39d5b4812b4 100644
--- a/sc/source/core/data/bcaslot.cxx
+++ b/sc/source/core/data/bcaslot.cxx
@@ -555,10 +555,17 @@ ScBroadcastAreaSlotMachine::TableSlots::TableSlots(SCSIZE 
nBcaSlots)
 memset( ppSlots.get(), 0 , sizeof( ScBroadcastAreaSlot* ) * nBcaSlots );
 }
 
+ScBroadcastAreaSlotMachine::TableSlots::TableSlots(TableSlots&& rOther) 
noexcept
+: mnBcaSlots(rOther.mnBcaSlots)
+, ppSlots( std::move(rOther.ppSlots) )
+{
+}
+
 ScBroadcastAreaSlotMachine::TableSlots::~TableSlots()
 {
-for ( ScBroadcastAreaSlot** pp = ppSlots.get() + mnBcaSlots; --pp >= 
ppSlots.get(); /* nothing */ )
-delete *pp;
+if (ppSlots)
+for ( ScBroadcastAreaSlot** pp = ppSlots.get() + mnBcaSlots; --pp >= 
ppSlots.get(); /* nothing */ )
+delete *pp;
 }
 
 ScBroadcastAreaSlotMachine::ScBroadcastAreaSlotMachine(
@@ -789,8 +796,9 @@ void ScBroadcastAreaSlotMachine::StartListeningArea(
 {
 TableSlotsMap::iterator iTab( aTableSlotsMap.find( nTab));
 if (iTab == aTableSlotsMap.end())
-iTab = aTableSlotsMap.emplace(nTab, 
std::make_unique(mnBcaSlots)).first;
-ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots();
+iTab = aTableSlotsMap.emplace( std::piecewise_construct,
+std::forward_as_tuple(nTab), 
std::forward_as_tuple(mnBcaSlots) ).first;
+ScBroadcastAreaSlot** ppSlots = (*iTab).second.getSlots();
 SCSIZE nStart, nEnd, nRowBreak;
 ComputeAreaPoints( rRange, nStart, nEnd, nRowBreak );
 SCSIZE nOff = nStart;
@@ -837,7 +845,7 @@ void ScBroadcastAreaSlotMachine::EndListeningArea(
 for (TableSlotsMap::iterator iTab( aTableSlotsMap.lower_bound( 
rRange.aStart.Tab()));
 iTab != aTableSlotsMap.end() && (*iTab).first <= nEndTab; 
++iTab)
 {
-ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots();
+ScBroadcastAreaSlot** ppSlots = (*iTab).second.getSlots();
 SCSIZE nStart, nEnd, nRowBreak;
 ComputeAreaPoints( rRange, nStart, nEnd, nRowBreak );
 SCSIZE nOff = nStart;
@@ -875,7 +883,7 @@ bool ScBroadcastAreaSlotMachine::AreaBroadcast( const 
ScRange& rRange, SfxHintId
 for (TableSlotsMap::iterator iTab( aTableSlotsMap.lower_bound( 
rRange.aStart.Tab()));
 iTab != aTableSlotsMap.end() && (*iTab).first <= nEndTab; ++iTab)
 {
-ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots();
+ScBroadcastAreaSlot** ppSlots = (*iTab).second.getSlots();
 SCSIZE nStart, nEnd, nRowBreak;
 ComputeAreaPoints( rRange, nStart, nEnd, nRowBreak );
 SCSIZE nOff = nStart;
@@ -913,7 +921,7 @@ bool ScBroadcastAreaSlotMachine::AreaBroadcast( const 
ScHint& rHint ) const
 ScRange broadcastRange( rAddress,
 ScAddress( rAddress.Col(), rAddress.Row() + rHint.GetRowCount() - 
1, rAddress.Tab()));
 bool bBroadcasted = false;
-ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots();
+ScBroadcastAreaSlot** ppSlots = (*iTab).second.getSlots();
 SCSIZE nStart, nEnd, nRowBreak;
 ComputeAreaPoints( broadcastRange, nStart, nEnd, nRowBreak );
 SCSIZE nOff = nStart;
@@ -936,7 +944,7 @@ void ScBroadcastAreaSlotMachine::DelBroadcastAreasInRange(
 for (TableSlotsMap::iterator iTab( 

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

2022-09-01 Thread Luboš Luňák (via logerrit)
 sc/source/core/opencl/op_financial.cxx   |   18 ++
 sc/source/core/opencl/op_math.cxx|   25 +
 sc/source/core/opencl/op_statistical.cxx |2 ++
 3 files changed, 45 insertions(+)

New commits:
commit 256086fc9b3a00181c7022294712226cd920b2e1
Author: Luboš Luňák 
AuthorDate: Wed Aug 31 16:43:37 2022 +0200
Commit: Luboš Luňák 
CommitDate: Thu Sep 1 12:21:53 2022 +0200

check parameter count in various opencl functions

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

diff --git a/sc/source/core/opencl/op_financial.cxx 
b/sc/source/core/opencl/op_financial.cxx
index e3362ed08441..12acbb435081 100644
--- a/sc/source/core/opencl/op_financial.cxx
+++ b/sc/source/core/opencl/op_financial.cxx
@@ -21,6 +21,7 @@ namespace sc::opencl {
 void RRI::GenSlidingWindowFunction(
 outputstream , const std::string , SubArguments )
 {
+CHECK_PARAMETER_COUNT( 3, 3 );
 ss << "\ndouble " << sSymName;
 ss << "_"<< BinFuncName() <<"(";
 for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -148,6 +149,7 @@ vSubArguments)
 void OpDollarde::GenSlidingWindowFunction(
 outputstream , const std::string , SubArguments )
 {
+CHECK_PARAMETER_COUNT( 2, 2 );
 ss << "\ndouble " << sSymName;
 ss << "_"<< BinFuncName() <<"(";
 for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -512,6 +514,7 @@ void OpIPMT::GenSlidingWindowFunction(outputstream& ss,
 void OpISPMT::GenSlidingWindowFunction(outputstream& ss,
 const std::string , SubArguments& vSubArguments)
 {
+CHECK_PARAMETER_COUNT( 4, 4 );
 ss << "\ndouble " << sSymName;
 ss << "_" << BinFuncName() <<"(";
 for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -796,6 +799,7 @@ void Cumipmt::GenSlidingWindowFunction(
 outputstream , const std::string , SubArguments &
 vSubArguments)
 {
+CHECK_PARAMETER_COUNT( 6, 6 );
 ss << "\ndouble " << sSymName;
 ss << "_"<< BinFuncName() <<"(";
 for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -910,6 +914,7 @@ vSubArguments)
 void IRR::GenSlidingWindowFunction(outputstream ,
 const std::string , SubArguments )
 {
+CHECK_PARAMETER_COUNT( 2, 2 );
 ss << "\ndouble " << sSymName;
 ss << "_" << BinFuncName() << "(";
 for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -1181,6 +1186,7 @@ void XNPV::GenSlidingWindowFunction(
 void PriceMat::GenSlidingWindowFunction(
 outputstream , const std::string , SubArguments )
 {
+CHECK_PARAMETER_COUNT( 6, 6 );
 ss << "\ndouble " << sSymName;
 ss << "_"<< BinFuncName() <<"(";
 for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -1375,6 +1381,7 @@ void OpSYD::GenSlidingWindowFunction(outputstream ,
 void MIRR::GenSlidingWindowFunction(
 outputstream , const std::string , SubArguments )
 {
+CHECK_PARAMETER_COUNT( 3, 3 );
 FormulaToken* pCur = vSubArguments[0]->GetFormulaToken();
 assert(pCur);
 const formula::DoubleVectorRefToken* pCurDVR =
@@ -1591,6 +1598,7 @@ void OpCumprinc::BinInlineFun(std::set& 
decls,
 void OpCumprinc::GenSlidingWindowFunction(outputstream ,
 const std::string , SubArguments )
 {
+CHECK_PARAMETER_COUNT( 6, 6 );
 ss << "\ndouble " << sSymName;
 ss << "_"<< BinFuncName() <<"(";
 for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -1717,6 +1725,7 @@ void OpAccrint::GenSlidingWindowFunction(
 outputstream , const std::string ,
 SubArguments )
 {
+CHECK_PARAMETER_COUNT( 7, 7 );
 ss << "\ndouble " << sSymName;
 ss << "_"<< BinFuncName() <<"(";
 for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -1831,6 +1840,7 @@ void OpAccrintm::BinInlineFun(std::set& 
decls,
 void OpAccrintm::GenSlidingWindowFunction(
 outputstream , const std::string , SubArguments )
 {
+CHECK_PARAMETER_COUNT( 5, 5 );
 ss << "\ndouble " << sSymName;
 ss << "_"<< BinFuncName() <<"(";
 for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -1958,6 +1968,7 @@ void OpAccrintm::GenSlidingWindowFunction(
 void OpYield::GenSlidingWindowFunction(
 outputstream , const std::string , SubArguments )
 {
+CHECK_PARAMETER_COUNT( 7, 7 );
 ss << "\ndouble " << sSymName;
 ss << "_"<< BinFuncName() <<"(";
 for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -2174,6 +2185,7 @@ void OpSLN::GenSlidingWindowFunction(outputstream ,
 void OpYieldmat::GenSlidingWindowFunction(
 outputstream , const std::string , SubArguments )
 {
+CHECK_PARAMETER_COUNT( 6, 6 );
 ss << "\ndouble " << sSymName;
 ss << "_"<< BinFuncName() <<"(";
 for (size_t i = 0; i < vSubArguments.size(); i++)
@@ -3525,6 +3537,7 @@ void OpAmordegrc::BinInlineFun(std::set& 
decls,
 void OpAmordegrc::GenSlidingWindowFunction(outputstream ,
 const std::string , SubArguments )
 {
+CHECK_PARAMETER_COUNT( 6, 7 );
 ss << "\ndouble " << 

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

2022-09-01 Thread Luboš Luňák (via logerrit)
 sc/source/core/opencl/op_statistical.cxx |9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

New commits:
commit 1e3cf15e2d090671f0735faa83d8c57bea0a37d6
Author: Luboš Luňák 
AuthorDate: Wed Aug 31 16:43:29 2022 +0200
Commit: Luboš Luňák 
CommitDate: Thu Sep 1 12:21:24 2022 +0200

do not return "random" values from opencl FTEST if it can't handle something

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

diff --git a/sc/source/core/opencl/op_statistical.cxx 
b/sc/source/core/opencl/op_statistical.cxx
index b325a68ca41c..1225306b69fb 100644
--- a/sc/source/core/opencl/op_statistical.cxx
+++ b/sc/source/core/opencl/op_statistical.cxx
@@ -6529,13 +6529,9 @@ void OpFTest::GenSlidingWindowFunction(outputstream ,
 ss << "}\n";
 }
 else if (pCurSub->GetType() == formula::svSingleVectorRef)
-{
-ss << "return HUGE_VAL";
-}
+throw Unhandled(__FILE__, __LINE__);
 else if (pCurSub->GetType() == formula::svDouble)
-{
-ss << "return HUGE_VAL";
-}
+throw Unhandled(__FILE__, __LINE__);
 }
 ss << "double fS1 = (fSumSqr1-fSum1*fSum1/length0)/(length0-1.0);\n"
 "double fS2 = (fSumSqr2-fSum2*fSum2/length1)/(length1-1.0);\n"
commit e306e86ac70e6d47d779f0b63ea76b3a72645b5a
Author: Luboš Luňák 
AuthorDate: Wed Aug 31 16:43:23 2022 +0200
Commit: Luboš Luňák 
CommitDate: Thu Sep 1 12:21:05 2022 +0200

opencl LogNormDist cannot handle less than 4 arguments

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

diff --git a/sc/source/core/opencl/op_statistical.cxx 
b/sc/source/core/opencl/op_statistical.cxx
index d5dd0618e4ca..b325a68ca41c 100644
--- a/sc/source/core/opencl/op_statistical.cxx
+++ b/sc/source/core/opencl/op_statistical.cxx
@@ -5447,6 +5447,7 @@ void OpForecast::GenSlidingWindowFunction(outputstream 
,
 void OpLogNormDist::GenSlidingWindowFunction(outputstream ,
 const std::string , SubArguments )
 {
+CHECK_PARAMETER_COUNT(4,4);
 FormulaToken *tmpCur0 = vSubArguments[0]->GetFormulaToken();
 const formula::SingleVectorRefToken*tmpCurDVR0= static_cast(tmpCur0);


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

2022-08-31 Thread Luboš Luňák (via logerrit)
 sc/source/core/opencl/formulagroupcl.cxx |9 
 sc/source/core/opencl/op_math.cxx|   66 ---
 sc/source/core/opencl/op_math.hxx|9 
 3 files changed, 1 insertion(+), 83 deletions(-)

New commits:
commit 067610f46ae57f88439a1b7c5a28209d129e641e
Author: Luboš Luňák 
AuthorDate: Tue Aug 30 15:48:56 2022 +0200
Commit: Luboš Luňák 
CommitDate: Wed Aug 31 09:13:54 2022 +0200

do not accept strings for opencl equal operator

This is part of "using string hashes for strings is kind of stupid"
removal. And it seems this is never used for all of Calc's tests.
Just keep it for numeric comparison.

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

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 6855434d37b7..9ab5b83057e9 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -93,7 +93,6 @@ const char* const publicFunc =
  "double legalize(double a, double b) { return isnan(a)?b:a;}\n"
  "double fsub(double a, double b) { return a-b; }\n"
  "double fdiv(double a, double b) { return a/b; }\n"
- "double strequal(unsigned a, unsigned b) { return (a==b)?1.0:0; }\n"
  "int is_representable_integer(double a) {\n"
  "long kMaxInt = (1L << 53) - 1;\n"
  "if (a <= as_double(kMaxInt))\n"
@@ -1787,11 +1786,10 @@ public:
 virtual std::string Gen2( const std::string& lhs, const std::string& rhs ) 
const override
 {
 std::stringstream ss;
-ss << "strequal(" << lhs << "," << rhs << ")";
+ss << "(" << lhs << " == " << rhs << ")";
 return ss.str();
 }
 virtual std::string BinFuncName() const override { return "eq"; }
-virtual bool takeString() const override { return true; }
 };
 
 class OpLessEqual : public Binary
commit 975fa7d700d50d376090de6c370aa00b8b38e8cf
Author: Luboš Luňák 
AuthorDate: Tue Aug 30 15:48:40 2022 +0200
Commit: Luboš Luňák 
CommitDate: Wed Aug 31 09:13:37 2022 +0200

remove opencl implementation of CONVERT()

Part of removal of string handling in opencl (using the hash here
is not that bad, a hash collision is unlikely, but still).
And the code handles only two conversions (m<->km and sec<->min ?
I'm not even sure). And it seems it's not used a single time
for all of Calc's checks.
It could be added back if there's use for it (possibly with handling
the strings better, e.g. by converting them in the C++ code
to enumeration values passed to opencl).

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

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index b30fa97f854f..6855434d37b7 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -3771,11 +3771,6 @@ 
DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config,
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, 
ft->Children[i],
 std::make_shared(), nResultSize));
 }
-else if (pChild->GetExternal() == 
"com.sun.star.sheet.addin.Analysis.getConvert")
-{
-mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, 
ft->Children[i],
-std::make_shared(), nResultSize));
-}
 else if (pChild->GetExternal() == 
"com.sun.star.sheet.addin.Analysis.getIseven")
 {
 mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, 
ft->Children[i],
diff --git a/sc/source/core/opencl/op_math.cxx 
b/sc/source/core/opencl/op_math.cxx
index 4042e2511177..5914436ffd8e 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -2642,72 +2642,6 @@ void 
OpCombin::GenSlidingWindowFunction(std::stringstream ,
 ss << "return result;\n";
 ss << "}\n";
 }
-void OpConvert::GenSlidingWindowFunction(
-std::stringstream , const std::string ,
-SubArguments )
-{
-// The CONVERT function converts a value from one unit of
-// measurement to another. It takes the units of measurements to
-// convert between as string arguments. This implementation
-// handles just a very small subset of such conversions.
-
-int arg1=vSubArguments[1]->GetFormulaToken()->GetString().
-getString().toAsciiUpperCase().hashCode();
-int arg2=vSubArguments[2]->GetFormulaToken()->GetString().
-getString().toAsciiUpperCase().hashCode();
-
-// Check if the from and to units are those combinations that the
-// code below supports.
-if( !((arg1==5584&==108)||
-

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

2022-08-30 Thread Luboš Luňák (via logerrit)
 sc/source/core/opencl/op_spreadsheet.cxx |  213 +--
 1 file changed, 120 insertions(+), 93 deletions(-)

New commits:
commit 73f9048c4038707258ee42acaf1946d90df6270a
Author: Luboš Luňák 
AuthorDate: Tue Aug 30 12:19:46 2022 +0200
Commit: Luboš Luňák 
CommitDate: Tue Aug 30 15:52:21 2022 +0200

bail out in opencl unsorted vlookup as soon as a match is found

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

diff --git a/sc/source/core/opencl/op_spreadsheet.cxx 
b/sc/source/core/opencl/op_spreadsheet.cxx
index 09ef4e65ef65..4679b2d01f30 100644
--- a/sc/source/core/opencl/op_spreadsheet.cxx
+++ b/sc/source/core/opencl/op_spreadsheet.cxx
@@ -165,9 +165,10 @@ void OpVLookup::GenSlidingWindowFunction(std::stringstream 
,
 }
 else
 {
-ss << "if(tmp0 == tmp1 && rowNum == -1)\n";
+ss << "if(tmp0 == tmp1)\n";
 ss << "{\n";
 ss << "rowNum = doubleIndex;\n";
+ss << "break;\n";
 ss << "}\n";
 ss << "i++;\n";
 ss << "doubleIndex++;\n";
@@ -244,9 +245,10 @@ void OpVLookup::GenSlidingWindowFunction(std::stringstream 
,
 }
 else
 {
-ss << "if(tmp0 == tmp1 && rowNum == -1)\n";
+ss << "if(tmp0 == tmp1)\n";
 ss << "{\n";
 ss << "rowNum = doubleIndex;\n";
+ss << "break;\n";
 ss << "}\n";
 }
 ss << "}\n\n";
commit ad2b6f1623300d28723d66fa0ac40530498acc77
Author: Luboš Luňák 
AuthorDate: Tue Aug 30 12:19:41 2022 +0200
Commit: Luboš Luňák 
CommitDate: Tue Aug 30 15:52:05 2022 +0200

opencl vlookup, move constant condition out of a loop

There's no need to check in every loop iteration if the vlookup should
be sorted or unsorted, and this needless branching slows the execution.

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

diff --git a/sc/source/core/opencl/op_spreadsheet.cxx 
b/sc/source/core/opencl/op_spreadsheet.cxx
index d088b718b442..09ef4e65ef65 100644
--- a/sc/source/core/opencl/op_spreadsheet.cxx
+++ b/sc/source/core/opencl/op_spreadsheet.cxx
@@ -96,76 +96,85 @@ void OpVLookup::GenSlidingWindowFunction(std::stringstream 
,
 tmpCur = vSubArguments[1]->GetFormulaToken();
 pCurDVR = static_cast(tmpCur);
 size_t nCurWindowSize = std::min(pCurDVR->GetArrayLength(), 
pCurDVR->GetRefRowSize());
-int unrollSize = 8;
-ss << "int loop;\n";
+const int unrollSize = 8;
+
+ss << "\n";
+ss << "int loop = ";
 if (!pCurDVR->IsStartFixed() && pCurDVR->IsEndFixed())
 {
-ss << "loop = ("IsEndFixed())
 {
-ss << "loop = ("IsEndFixed())
-{
-ss << "int doubleIndex = i+gid0;\n";
-}
-else
-{
-ss << "int doubleIndex = i;\n";
-}
-ss << "if(tmp";
+ss << "if(tmp";
 ss << 3+(secondParaWidth-1);
-ss << " == 1)\n";
-ss << "{\n";
+ss << " == 0) /* unsorted vlookup */\n";
+ss << "{\n";
 
-for (int j = 0;j < unrollSize; j++)
+for( int sorted = 0; sorted < 2; ++sorted ) // sorted vs unsorted 
vlookup cases
 {
-CheckSubArgumentIsNan(ss,vSubArguments,1);
+if( sorted == 1 )
+{
+ss << "}\n";
+ss << "else\n";
+ss << "{ /* sorted vlookup */ \n";
+}
 
-ss << "if((tmp0 - tmp1)>=0 && intermediate > (tmp0 
-tmp1))\n";
-ss << "{\n";
-ss << "rowNum = doubleIndex;\n";
-ss << "intermediate = tmp0 - tmp1;\n";
-ss << "}\n";
-ss << "i++;\n";
-ss << "doubleIndex++;\n";
-}
+ss << "for ( int j = 0;j< loop; j++)\n";
+ss << "{\n";
+ss << "int i = ";
+if (!pCurDVR->IsStartFixed()&& pCurDVR->IsEndFixed())
+{
+ss << "gid0 + j * "<< unrollSize <<";\n";
+}
+else
+{
+ss << "j * "<< unrollSize <<";\n";
+}

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

2022-08-24 Thread Caolán McNamara (via logerrit)
 sc/source/ui/app/inputhdl.cxx|6 +-
 sd/source/ui/unoidl/unocpres.cxx |4 ++--
 2 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit ee7b7acba288d265001237e3d81a1791e322ed28
Author: Caolán McNamara 
AuthorDate: Wed Aug 24 13:04:28 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Aug 24 17:12:51 2022 +0200

cid#1509194 Dereference after null check

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

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index bfbb446e1364..f16e52af8fb6 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -3458,10 +3458,14 @@ void ScInputHandler::CancelHandler()
 
 eMode = SC_INPUT_NONE;
 StopInputWinEngine( true );
+SCCOL nMaxCol(MAXCOL);
 if (pExecuteSh)
+{
 pExecuteSh->StopEditShell();
+nMaxCol = pExecuteSh->GetViewData().GetDocument().MaxCol();
+}
 
-aCursorPos.Set(pExecuteSh->GetViewData().GetDocument().MaxCol()+1,0,0); // 
Invalid flag
+aCursorPos.Set(nMaxCol+1,0,0); // Invalid flag
 mpEditEngine->SetTextCurrentDefaults(OUString());
 
 if ( !pLastState && pExecuteSh )
commit 2f05a65a4eafcbda3438e50bd0b6518248c04d5d
Author: Caolán McNamara 
AuthorDate: Wed Aug 24 12:56:43 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Aug 24 17:12:36 2022 +0200

cid#1509207 Dereference after null check

remove useless null checks left behind after

commit bb674aa5503ff40a5619d1fb4c9f310da5f5c983
Date:   Thu Nov 17 13:16:30 2016 +0200

loplugin:unusedfields

showed they weren't consumed anyway

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

diff --git a/sd/source/ui/unoidl/unocpres.cxx b/sd/source/ui/unoidl/unocpres.cxx
index cc57b1e7941a..1f9bde3b98da 100644
--- a/sd/source/ui/unoidl/unocpres.cxx
+++ b/sd/source/ui/unoidl/unocpres.cxx
@@ -98,10 +98,10 @@ void SAL_CALL SdXCustomPresentation::insertByIndex( 
sal_Int32 Index, const uno::
 
 if(pPage)
 {
-if( nullptr == mpModel )
+if (!mpModel)
 mpModel = pPage->GetModel();
 
-if( nullptr != mpModel && nullptr == mpSdCustomShow && 
mpModel->GetDoc() )
+if (!mpSdCustomShow)
 mpSdCustomShow = new SdCustomShow;
 
 
mpSdCustomShow->PagesVector().insert(mpSdCustomShow->PagesVector().begin() + 
Index,


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

2022-08-18 Thread Caolán McNamara (via logerrit)
 sc/source/ui/docshell/olinefun.cxx |2 ++
 sw/source/core/unocore/unotbl.cxx  |6 +++---
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit b72ebcf5b26ab2e54c5251c5c45e6d45cade9236
Author: Caolán McNamara 
AuthorDate: Thu Aug 18 12:51:46 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu Aug 18 20:30:10 2022 +0200

cid#1509258 Dereference null return value

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

diff --git a/sc/source/ui/docshell/olinefun.cxx 
b/sc/source/ui/docshell/olinefun.cxx
index 70fafd8e1e2a..3b15989c3664 100644
--- a/sc/source/ui/docshell/olinefun.cxx
+++ b/sc/source/ui/docshell/olinefun.cxx
@@ -731,6 +731,8 @@ bool ScOutlineDocFunc::HideOutline( SCTAB nTab, bool 
bColumns, sal_uInt16 nLevel
 bRecord = false;
 
 ScOutlineTable* pTable = rDoc.GetOutlineTable( nTab );
+if (!pTable)
+return false;
 ScOutlineArray& rArray = bColumns ? pTable->GetColArray() : 
pTable->GetRowArray();
 ScOutlineEntry* pEntry = rArray.GetEntry( nLevel, nEntry );
 SCCOLROW nStart = pEntry->GetStart();
commit 3996ced5fbc75ed6a528969e29642eb60b7b6be5
Author: Caolán McNamara 
AuthorDate: Thu Aug 18 12:49:49 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu Aug 18 20:29:56 2022 +0200

cid#1509291 Unchecked dynamic_cast

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

diff --git a/sw/source/core/unocore/unotbl.cxx 
b/sw/source/core/unocore/unotbl.cxx
index 3349b54ed361..668c52065892 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -3522,9 +3522,9 @@ uno::Any SAL_CALL SwXCellRange::getPropertyValue(const 
OUString& rPropertyName)
 RES_UNKNOWNATR_CONTAINER>
 aSet(m_pImpl->m_pTableCursor->GetDoc().GetAttrPool());
 // first look at the attributes of the cursor
-SwUnoTableCursor *const pCursor =
-
dynamic_cast(&(*m_pImpl->m_pTableCursor));
-SwUnoCursorHelper::GetCursorAttr(pCursor->GetSelRing(), aSet);
+SwUnoTableCursor& rCursor =
+dynamic_cast(*m_pImpl->m_pTableCursor);
+SwUnoCursorHelper::GetCursorAttr(rCursor.GetSelRing(), aSet);
 m_pImpl->m_pPropSet->getPropertyValue(*pEntry, aSet, aRet);
 }
 }


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

2022-07-26 Thread Szymon Kłos (via logerrit)
 sc/source/ui/dbgui/csvgrid.cxx |3 ++
 sc/source/ui/view/tabview3.cxx |   44 +
 vcl/source/window/layout.cxx   |   16 +-
 3 files changed, 37 insertions(+), 26 deletions(-)

New commits:
commit 496475c5209dcb56f0bd1528b14dd8b689ca
Author: Szymon Kłos 
AuthorDate: Fri Jul 1 11:29:28 2022 +0200
Commit: Szymon Kłos 
CommitDate: Tue Jul 26 16:55:17 2022 +0200

lok: allow shrinking too big widgets

This is followup for:

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

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

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

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

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

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

MarkColumns should modify formula if editing is active

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

diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 1e0255788977..feab66cbd411 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1632,12 +1632,22 @@ void ScTabView::MarkColumns(SCCOL nCol, sal_Int16 
nModifier)
 if ((nModifier & KEY_SHIFT) == KEY_SHIFT)
 bMoveIsShift = true;
 
-DoneBlockMode( nModifier != 0 );
-InitBlockMode( nStartCol, 0, nTab, true, true);
-MarkCursor( 

[Libreoffice-commits] core.git: 2 commits - sc/source vcl/jsdialog

2022-07-26 Thread Szymon Kłos (via logerrit)
 sc/source/ui/app/inputhdl.cxx |8 
 vcl/jsdialog/executor.cxx |   12 
 2 files changed, 20 insertions(+)

New commits:
commit a66c2f55118aac03ee3a06ebdd97d48a93a6da9a
Author: Szymon Kłos 
AuthorDate: Wed Jul 6 18:08:16 2022 +0200
Commit: Szymon Kłos 
CommitDate: Tue Jul 26 10:27:32 2022 +0200

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

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

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 5cae17a057df..56ba5cfd9e72 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -4241,6 +4241,14 @@ void ScInputHandler::NotifyChange( const 
ScInputHdlState* pState,
 {
 EditView* pActiveView = pTopView ? pTopView : 
pTableView;
 ESelection aSel = pActiveView ? 
pActiveView->GetSelection() : ESelection();
+
+// if we switched content completly - don't send huge 
numbers
+if (aSel.nStartPara == EE_PARA_NOT_FOUND)
+aSel.nStartPara = 0;
+
+if (aSel.nEndPara == EE_PARA_NOT_FOUND)
+aSel.nEndPara = 0;
+
 ScInputHandler::LOKSendFormulabarUpdate(pActiveViewSh, 
aString, aSel);
 // TODO: deprecated?
 
pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_FORMULA, 
aString.toUtf8().getStr());
commit c2a52693770c7db4741dedfdb7222b93f045b101
Author: Szymon Kłos 
AuthorDate: Tue Jun 28 13:11:42 2022 +0200
Commit: Szymon Kłos 
CommitDate: Tue Jul 26 10:27:25 2022 +0200

jsdialog: add open/close instead of toggle menu from dropdown

it will make us sure we don't reopen popup when we just toggle
so we will be in sync

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

diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 24a5f9ba596d..0f8a2722bdac 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -319,6 +319,18 @@ bool ExecuteAction(const std::string& nWindowId, const 
OString& rWidget, StringM
 pToolbar->set_menu_item_active(sId, !bIsActive);
 return true;
 }
+else if (sAction == "closemenu")
+{
+OString sId = OUStringToOString(rData["data"], 
RTL_TEXTENCODING_ASCII_US);
+pToolbar->set_menu_item_active(sId, false);
+return true;
+}
+else if (sAction == "openmenu")
+{
+OString sId = OUStringToOString(rData["data"], 
RTL_TEXTENCODING_ASCII_US);
+pToolbar->set_menu_item_active(sId, true);
+return true;
+}
 }
 }
 else if (sControlType == "edit")


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

2022-05-22 Thread Caolán McNamara (via logerrit)
 sc/source/ui/miscdlgs/redcom.cxx |2 +-
 sc/source/ui/unoobj/docuno.cxx   |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 25747014cd54d66f55029f67886418b859f9b980
Author: Caolán McNamara 
AuthorDate: Sun May 22 12:24:47 2022 +0100
Commit: Caolán McNamara 
CommitDate: Sun May 22 15:17:08 2022 +0200

cid#1504538 Dereference after null check

and

cid#1504536 Dereference after null check

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

diff --git a/sc/source/ui/miscdlgs/redcom.cxx b/sc/source/ui/miscdlgs/redcom.cxx
index 30e2f8a591a9..f81da032b481 100644
--- a/sc/source/ui/miscdlgs/redcom.cxx
+++ b/sc/source/ui/miscdlgs/redcom.cxx
@@ -129,7 +129,7 @@ void ScRedComDialog::Execute()
 
 void ScRedComDialog::SelectCell()
 {
-if(pChangeAction==nullptr)
+if (!pChangeAction || !pDocShell)
 return;
 
 const ScChangeAction* pAction=pChangeAction;
commit 1a9c3c13cb5c652d7bc92618e0f1bebf58ed76c6
Author: Caolán McNamara 
AuthorDate: Sun May 22 12:23:36 2022 +0100
Commit: Caolán McNamara 
CommitDate: Sun May 22 15:16:54 2022 +0200

cid#1504545 Dereference after null check

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

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 79e51e44f633..9bc6d1604c70 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1683,7 +1683,7 @@ bool ScModelObj::FillRenderMarkData( const uno::Any& 
aSelection,
 
 // restrict to selected sheets if a view is available
 uno::Reference xSelectedSheets(xView, 
uno::UNO_QUERY);
-if (bSelectedSheetsOnly && xSelectedSheets.is())
+if (bSelectedSheetsOnly && pDocShell && xSelectedSheets.is())
 {
 const uno::Sequence aSelected = 
xSelectedSheets->getSelectedSheets();
 ScMarkData::MarkedTabsType aSelectedTabs;


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

2022-05-22 Thread Caolán McNamara (via logerrit)
 sc/source/ui/unoobj/docuno.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 8cdfc82557cf1256aaa3e1e8200d1b2ce9f16608
Author: Caolán McNamara 
AuthorDate: Sun May 22 12:06:36 2022 +0100
Commit: Caolán McNamara 
CommitDate: Sun May 22 14:35:37 2022 +0200

cid#1504534 Dereference before null check

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

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 822a0cf59b46..79e51e44f633 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -4015,8 +4015,8 @@ rtl::Reference 
ScTableColumnsObj::GetObjectByIndex_Impl(sal_In
 rtl::Reference ScTableColumnsObj::GetObjectByName_Impl(const 
OUString& aName) const
 {
 SCCOL nCol = 0;
-if ( ::AlphaToCol( pDocShell->GetDocument(), nCol, aName) )
-if ( pDocShell && nCol >= nStartCol && nCol <= nEndCol )
+if (pDocShell && ::AlphaToCol(pDocShell->GetDocument(), nCol, aName))
+if (nCol >= nStartCol && nCol <= nEndCol)
 return new ScTableColumnObj( pDocShell, nCol, nTab );
 
 return nullptr;
commit 66d7ed084a676ff7803a3c7672e80d9f7ca0e74e
Author: Caolán McNamara 
AuthorDate: Sun May 22 12:05:15 2022 +0100
Commit: Caolán McNamara 
CommitDate: Sun May 22 14:35:25 2022 +0200

cid#1504540 Dereference before null check

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

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 4645ec111d68..822a0cf59b46 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -4124,8 +4124,8 @@ sal_Bool SAL_CALL ScTableColumnsObj::hasByName( const 
OUString& aName )
 {
 SolarMutexGuard aGuard;
 SCCOL nCol = 0;
-if ( ::AlphaToCol( pDocShell->GetDocument(), nCol, aName) )
-if ( pDocShell && nCol >= nStartCol && nCol <= nEndCol )
+if (pDocShell && ::AlphaToCol(pDocShell->GetDocument(), nCol, aName))
+if (nCol >= nStartCol && nCol <= nEndCol)
 return true;
 
 return false;   // not found


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

2022-05-16 Thread Luboš Luňák (via logerrit)
 sc/source/ui/dbgui/tpsubt.cxx|3 +++
 vcl/source/treelist/treelist.cxx |4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit ea980b36a7b48a3c9c17cf08d15c5f4f27f79942
Author: Luboš Luňák 
AuthorDate: Mon May 16 22:38:03 2022 +0200
Commit: Luboš Luňák 
CommitDate: Tue May 17 07:37:15 2022 +0200

freeze() and thaw() a widget during creation (tdf#149112)

The repeated inserts each trigger SvTreeList::GetVisibleCount(),
which has a poor performance because of repeated uses of the
SvListView::Impl::m_DataTable map.

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

diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx
index 439ee359f203..aa5f38862701 100644
--- a/sc/source/ui/dbgui/tpsubt.cxx
+++ b/sc/source/ui/dbgui/tpsubt.cxx
@@ -257,6 +257,7 @@ void ScTpSubTotalGroup::FillListBoxes()
 mxLbColumns->clear();
 mxLbGroup->insert_text(0, aStrNone );
 
+mxLbColumns->freeze();
 sal_uInt16 i=0;
 for ( col=nFirstCol; col<=nMaxCol && 
iGetSheetLimits()); col++ )
 {
@@ -273,6 +274,8 @@ void ScTpSubTotalGroup::FillListBoxes()
 mxLbColumns->set_id(i, "0");
 i++;
 }
+mxLbColumns->thaw();
+
 // subsequent initialization of the constant:
 nFieldCount = i;
 }
commit 5bf7058f4959ce0cf217817d2b5a30b81c4a7ff9
Author: Luboš Luňák 
AuthorDate: Mon May 16 22:01:31 2022 +0200
Commit: Luboš Luňák 
CommitDate: Tue May 17 07:37:00 2022 +0200

std::map -> std::unordered_map (tdf#149112)

Faster and the ordering is not needed.

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

diff --git a/vcl/source/treelist/treelist.cxx b/vcl/source/treelist/treelist.cxx
index 35125edafe2e..07db41b54266 100644
--- a/vcl/source/treelist/treelist.cxx
+++ b/vcl/source/treelist/treelist.cxx
@@ -24,10 +24,10 @@
 #include 
 
 #include 
-#include 
+#include 
 
 
-typedef std::map> 
SvDataTable;
+typedef std::unordered_map> 
SvDataTable;
 
 struct SvListView::Impl
 {


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

2022-03-29 Thread Luboš Luňák (via logerrit)
 sc/source/core/data/document.cxx |   18 +-
 sc/source/core/data/table3.cxx   |4 
 2 files changed, 13 insertions(+), 9 deletions(-)

New commits:
commit e63704897b14085d1290f5112ebd7cf7c2f0b2c6
Author: Luboš Luňák 
AuthorDate: Tue Mar 29 20:44:10 2022 +0200
Commit: Luboš Luňák 
CommitDate: Wed Mar 30 00:02:23 2022 +0200

allocate columns for initDataRows()

Triggered by TestSort::testSortImages() with INITIALCOLCOUNT set to 1.

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

diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index fa47526f3f0f..511d4a3c80ed 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -474,6 +474,7 @@ std::unique_ptr 
ScTable::CreateSortInfoArray( const sc::Reorder
 pArray->SetKeepQuery(rParam.mbHiddenFiltered);
 pArray->SetUpdateRefs(rParam.mbUpdateRefs);
 
+CreateColumnIfNotExists(nCol2);
 initDataRows( *pArray, *this, aCol, nCol1, nRow1, nCol2, nRow2, 
rParam.mbHiddenFiltered,
 rParam.maDataAreaExtras.mbCellFormats, true, true, false);
 }
@@ -517,6 +518,7 @@ std::unique_ptr 
ScTable::CreateSortInfoArray(
 }
 }
 
+CreateColumnIfNotExists(rSortParam.nCol2);
 initDataRows( *pArray, *this, aCol, rSortParam.nCol1, nInd1, 
rSortParam.nCol2, nInd2, bKeepQuery,
 rSortParam.aDataAreaExtras.mbCellFormats, true, true, false);
 }
@@ -904,6 +906,7 @@ void ScTable::SortReorderAreaExtrasByRow( ScSortInfoArray* 
pArray,
 for (SCCOL nCol = rDataAreaExtras.mnStartCol; nCol < nDataCol1; nCol += 
nChunkCols)
 {
 const SCCOL nEndCol = std::min( nCol + nChunkCols - 1, 
nDataCol1 - 1);
+CreateColumnIfNotExists(nEndCol);
 initDataRows( *pArray, *this, aCol, nCol, nRow1, nEndCol, nLastRow, 
false,
 rDataAreaExtras.mbCellFormats, rDataAreaExtras.mbCellNotes, 
rDataAreaExtras.mbCellDrawObjects, true);
 SortReorderByRow( pArray, nCol, nEndCol, pProgress, true);
@@ -912,6 +915,7 @@ void ScTable::SortReorderAreaExtrasByRow( ScSortInfoArray* 
pArray,
 for (SCCOL nCol = nDataCol2 + 1; nCol <= rDataAreaExtras.mnEndCol; nCol += 
nChunkCols)
 {
 const SCCOL nEndCol = std::min( nCol + nChunkCols - 1, 
rDataAreaExtras.mnEndCol);
+CreateColumnIfNotExists(nEndCol);
 initDataRows( *pArray, *this, aCol, nCol, nRow1, nEndCol, nLastRow, 
false,
 rDataAreaExtras.mbCellFormats, rDataAreaExtras.mbCellNotes, 
rDataAreaExtras.mbCellDrawObjects, true);
 SortReorderByRow( pArray, nCol, nEndCol, pProgress, true);
commit cf560fd387ee9f54d3edaf066c70b411d1f7b299
Author: Luboš Luňák 
AuthorDate: Tue Mar 29 20:11:30 2022 +0200
Commit: Luboš Luňák 
CommitDate: Wed Mar 30 00:02:10 2022 +0200

use ScTable::ColumnData() in ScDocument::ExtendOverlapped()

Otherwise there's invalid array access triggered by
VBAMacroTest::testVba() with INITIALCOLCOUNT set to 1.

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

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 363bd168fcab..59d05432ae5c 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -5550,25 +5550,25 @@ void ScDocument::ExtendOverlapped( SCCOL& rStartCol, 
SCROW& rStartRow,
 
 //TODO: pass on ?
 
-ScAttrArray* pAttrArray = 
maTabs[nTab]->aCol[nOldCol].pAttrArray.get();
+const ScAttrArray& pAttrArray = 
maTabs[nTab]->ColumnData(nOldCol).AttrArray();
 SCSIZE nIndex;
-if ( pAttrArray->Count() )
-pAttrArray->Search( nOldRow, nIndex );
+if ( pAttrArray.Count() )
+pAttrArray.Search( nOldRow, nIndex );
 else
 nIndex = 0;
 SCROW nAttrPos = nOldRow;
 while (nAttrPos<=nEndRow)
 {
-OSL_ENSURE( nIndex < pAttrArray->Count(), "Wrong index in 
AttrArray" );
+OSL_ENSURE( nIndex < pAttrArray.Count(), "Wrong index in 
AttrArray" );
 
 bool bHorOverlapped;
-if ( pAttrArray->Count() )
-bHorOverlapped = 
pAttrArray->mvData[nIndex].pPattern->GetItem(ATTR_MERGE_FLAG).IsHorOverlapped();
+if ( pAttrArray.Count() )
+bHorOverlapped = 
pAttrArray.mvData[nIndex].pPattern->GetItem(ATTR_MERGE_FLAG).IsHorOverlapped();
 else
 bHorOverlapped = 
GetDefPattern()->GetItem(ATTR_MERGE_FLAG).IsHorOverlapped();
 if ( bHorOverlapped )
 {
-SCROW nEndRowSeg = (pAttrArray->Count()) ? 

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

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

New commits:
commit 851560310f93f87d923f39cd0cd01aa18db03ce3
Author: Szymon Kłos 
AuthorDate: Thu Mar 3 11:53:49 2022 +0100
Commit: Szymon Kłos 
CommitDate: Mon Mar 14 13:21:48 2022 +0100

lok: fix position og autofilter in RTL mode

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

diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 80ab426aa98d..094a3ef184a2 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -509,7 +509,7 @@ tools::Rectangle 
FloatingWindow::ImplConvertToAbsPos(vcl::Window* pReference, co
 
 // compare coordinates in absolute screen coordinates
 // Keep in sync with FloatingWindow::ImplFloatHitTest, e.g. fdo#33509
-if( pParentWinOutDev->HasMirroredGraphics()  )
+if( pParentWinOutDev->HasMirroredGraphics() && 
!comphelper::LibreOfficeKit::isActive() )
 {
 if(!pReference->IsRTLEnabled() )
 pParentWinOutDev->ReMirror(aFloatRect);
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 152d163f3399..453bf8e2ca14 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2712,11 +2712,14 @@ void Window::setPosSizePixel( tools::Long nX, 
tools::Long nY,
 {
 tools::Rectangle aRect( Point ( nX, nY ), Size( nWidth, 
nHeight ) );
 const OutputDevice *pParentOutDev = pParent->GetOutDev();
-pParentOutDev->ReMirror( aRect );
+if (!comphelper::LibreOfficeKit::isActive())
+pParentOutDev->ReMirror( aRect );
 nX = aRect.Left();
 }
 }
-if( !(nFlags & PosSizeFlags::X) && bHasValidSize && 
pWindow->mpWindowImpl->mpFrame->maGeometry.nWidth )
+if( !comphelper::LibreOfficeKit::isActive() &&
+!(nFlags & PosSizeFlags::X) && bHasValidSize &&
+pWindow->mpWindowImpl->mpFrame->maGeometry.nWidth )
 {
 // RTL: make sure the old right aligned position is not changed
 // system windows will always grow to the right
commit 68ff5bf424fd2813cb08dfa7f165e0227cb6a703
Author: Szymon Kłos 
AuthorDate: Fri Feb 25 13:22:36 2022 +0100
Commit: Szymon Kłos 
CommitDate: Mon Mar 14 13:21:36 2022 +0100

lok: send logic autofilter position

we need to show popup relative to the grid window

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

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index b5c6965cbcc1..da788bc9aa5b 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -909,7 +909,7 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW 
nRow)
 nSizeX = nSizeX / fZoomX;
 nSizeY = nSizeY / fZoomY;
 }
-tools::Rectangle aCellRect(OutputToScreenPixel(aPos), Size(nSizeX, 
nSizeY));
+tools::Rectangle aCellRect(bLOKActive ? aPos : OutputToScreenPixel(aPos), 
Size(nSizeX, nSizeY));
 
 ScDBData* pDBData = rDoc.GetDBAtCursor(nCol, nRow, nTab, 
ScDBDataPortion::AREA);
 if (!pDBData)
@@ -1229,7 +1229,8 @@ void ScGridWindow::LaunchPageFieldMenu( SCCOL nCol, SCROW 
nRow )
 Point aScrPos;
 Size aScrSize;
 getCellGeometry(aScrPos, aScrSize, mrViewData, nCol, nRow, eWhich);
-DPLaunchFieldPopupMenu(OutputToScreenPixel(aScrPos), aScrSize, 
ScAddress(nCol-1, nRow, nTab), pDPObj);
+bool bLOK = comphelper::LibreOfficeKit::isActive();
+DPLaunchFieldPopupMenu(bLOK ? aScrPos : OutputToScreenPixel(aScrPos), 
aScrSize, ScAddress(nCol-1, nRow, nTab), pDPObj);
 }
 
 void ScGridWindow::LaunchDPFieldMenu( SCCOL nCol, SCROW nRow )
@@ -1242,7 +1243,8 @@ void ScGridWindow::LaunchDPFieldMenu( SCCOL nCol, SCROW 
nRow )
 Point aScrPos;
 Size aScrSize;
 getCellGeometry(aScrPos, aScrSize, mrViewData, nCol, nRow, eWhich);
-DPLaunchFieldPopupMenu(OutputToScreenPixel(aScrPos), aScrSize, 
ScAddress(nCol, nRow, nTab), pDPObj);
+bool bLOK = comphelper::LibreOfficeKit::isActive();
+DPLaunchFieldPopupMenu(bLOK ? aScrPos : OutputToScreenPixel(aScrPos), 
aScrSize, ScAddress(nCol, nRow, nTab), pDPObj);
 }
 
 void 

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

2022-03-04 Thread Caolán McNamara (via logerrit)
 sc/source/ui/undo/undodat.cxx |2 ++
 svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx |2 ++
 2 files changed, 4 insertions(+)

New commits:
commit 5541b7b1dd0d683a7018f7499aec4dbe6626a25a
Author: Caolán McNamara 
AuthorDate: Fri Mar 4 15:22:45 2022 +
Commit: Caolán McNamara 
CommitDate: Fri Mar 4 22:37:15 2022 +0100

cid#1500546 silence Explicit null dereferenced

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

diff --git a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx 
b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx
index 7ec09e455d90..f7aa223f4997 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx
@@ -901,6 +901,8 @@ public:
 std::shared_ptr pFirstArg( std::move(rNodeStack.top()) 
);
 rNodeStack.pop();
 
+assert(pThirdArg && pSecondArg && pFirstArg);
+
 // create combined ExpressionNode
 auto pNode = std::make_shared( pFirstArg, pSecondArg, 
pThirdArg );
 // check for constness
commit b35571c348eb8816098f7c8786d8cc8ff9082f19
Author: Caolán McNamara 
AuthorDate: Fri Mar 4 15:20:48 2022 +
Commit: Caolán McNamara 
CommitDate: Fri Mar 4 22:36:58 2022 +0100

cid#1500566 Uninitialized scalar field

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

diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index 006527d7bacd..1ab89a8b543f 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -1707,6 +1707,8 @@ ScUndoChartData::ScUndoChartData( ScDocShell* 
pNewDocShell, const OUString& rNam
 bool bAdd ) :
 ScSimpleUndo( pNewDocShell ),
 aChartName( rName ),
+bOldColHeaders(false),
+bOldRowHeaders(false),
 aNewRangeListRef( rNew ),
 bNewColHeaders( bColHdr ),
 bNewRowHeaders( bRowHdr ),


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

2022-03-02 Thread Luboš Luňák (via logerrit)
 sc/source/filter/excel/xetable.cxx |   53 +++--
 sc/source/filter/inc/xetable.hxx   |1 
 2 files changed, 35 insertions(+), 19 deletions(-)

New commits:
commit 4e279e8c4986ca3de79bea2216c5783cb113a5bb
Author: Luboš Luňák 
AuthorDate: Tue Mar 1 15:07:02 2022 +0100
Commit: Luboš Luňák 
CommitDate: Wed Mar 2 09:27:33 2022 +0100

reuse a vector instead of repeatedly creating it (tdf#95346)

With some documents this actually is a noticeable cost.

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

diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index f2ed192c3c40..bf50dd647933 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -1918,7 +1918,7 @@ void XclExpRow::AppendCell( XclExpCellRef const & xCell, 
bool bIsMergedBase )
 InsertCell( xCell, maCellList.GetSize(), bIsMergedBase );
 }
 
-void XclExpRow::Finalize( const ScfUInt16Vec& rColXFIndexes, size_t 
nStartColAllDefault, bool bProgress )
+void XclExpRow::Finalize( const ScfUInt16Vec& rColXFIndexes, ScfUInt16Vec& 
aXFIndexes, size_t nStartColAllDefault, bool bProgress )
 {
 size_t nPos, nSize;
 
@@ -1928,7 +1928,11 @@ void XclExpRow::Finalize( const ScfUInt16Vec& 
rColXFIndexes, size_t nStartColAll
 size_t nColCount = GetMaxPos().Col() + 1;
 OSL_ENSURE( rColXFIndexes.size() == nColCount, "XclExpRow::Finalize - 
wrong column XF index count" );
 
-ScfUInt16Vec aXFIndexes( nColCount, EXC_XF_NOTFOUND );
+// The vector should be preset to all items being EXC_XF_NOTFOUND, to 
avoid repeated allocations
+// and clearing.
+assert( aXFIndexes.size() == nColCount );
+assert( aXFIndexes.front() == EXC_XF_NOTFOUND );
+assert( aXFIndexes.back() == EXC_XF_NOTFOUND );
 for( nPos = 0, nSize = maCellList.GetSize(); nPos < nSize; ++nPos )
 {
 XclExpCellBase* pCell = maCellList.GetRecord( nPos );
@@ -2084,6 +2088,9 @@ void XclExpRow::Finalize( const ScfUInt16Vec& 
rColXFIndexes, size_t nStartColAll
 else
 ++nPos;
 }
+// Ensure it's all EXC_XF_NOTFOUND again for next reuse.
+for( size_t i = 0; i < nStartAllNotFound; ++i )
+aXFIndexes[ i ] = EXC_XF_NOTFOUND;
 
 // progress bar includes disabled rows; only update it in the lead thread.
 if (bProgress)
@@ -2236,8 +2243,9 @@ public:
 void push_back( XclExpRow *pRow ) { maRows.push_back( pRow ); }
 virtual void doWork() override
 {
+ScfUInt16Vec aXFIndexes( mrColXFIndexes.size(), EXC_XF_NOTFOUND );
 for (XclExpRow* p : maRows)
-p->Finalize( mrColXFIndexes, mnStartColAllDefault, mbProgress );
+p->Finalize( mrColXFIndexes, aXFIndexes, mnStartColAllDefault, 
mbProgress );
 }
 };
 
@@ -2261,8 +2269,9 @@ void XclExpRowBuffer::Finalize( XclExpDefaultRowData& 
rDefRowData,
 #endif
 if (nThreads == 1)
 {
+ScfUInt16Vec aXFIndexes( rColXFIndexes.size(), EXC_XF_NOTFOUND );
 for (auto& rEntry : maRowMap)
-rEntry.second->Finalize( rColXFIndexes, nStartColAllDefault, true 
);
+rEntry.second->Finalize( rColXFIndexes, aXFIndexes, 
nStartColAllDefault, true );
 }
 else
 {
diff --git a/sc/source/filter/inc/xetable.hxx b/sc/source/filter/inc/xetable.hxx
index 1e9e7cd45d2c..ed16140f6d68 100644
--- a/sc/source/filter/inc/xetable.hxx
+++ b/sc/source/filter/inc/xetable.hxx
@@ -853,6 +853,7 @@ public:
 
 /** Converts all XF identifiers into the Excel XF indexes. */
 voidFinalize( const ScfUInt16Vec& rColXFIndexes,
+  ScfUInt16Vec& aXFIndexes,
   size_t nStartColAllDefault,
   bool bUpdateProgress );
 
commit f8edf0a94e9608d7e7d8ed5fb46036b2ceb71693
Author: Luboš Luňák 
AuthorDate: Tue Mar 1 14:53:46 2022 +0100
Commit: Luboš Luňák 
CommitDate: Wed Mar 2 09:27:20 2022 +0100

try to avoid using map when searching most used item (tdf#95346)

The last item is usually going to be the most common, so first
check that.

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

diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index 6945e724d6ba..f2ed192c3c40 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -1985,29 +1985,35 @@ void XclExpRow::Finalize( const ScfUInt16Vec& 
rColXFIndexes, size_t nStartColAll
 size_t nStartAllDefault = findFirstAllSameUntilEnd( aXFIndexes, 
EXC_XF_DEFAULTCELL, nStartSearchAllDefault);
 
 // find most used XF index in the row
-std::unordered_map< sal_uInt16, size_t > aIndexMap;
 sal_uInt16 

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

2022-02-26 Thread Caolán McNamara (via logerrit)
 sc/source/ui/undo/undodat.cxx  |2 ++
 sw/source/uibase/config/modcfg.cxx |5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 2e2bd25b4a13758745aa9ae687c5d94a0f32bb6e
Author: Caolán McNamara 
AuthorDate: Sat Feb 26 15:25:47 2022 +
Commit: Caolán McNamara 
CommitDate: Sat Feb 26 20:05:21 2022 +0100

cid#1500566 Uninitialized scalar field

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

diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index 5fdf3917aa6b..006527d7bacd 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -1690,6 +1690,8 @@ ScUndoChartData::ScUndoChartData( ScDocShell* 
pNewDocShell, const OUString& rNam
 bool bAdd ) :
 ScSimpleUndo( pNewDocShell ),
 aChartName( rName ),
+bOldColHeaders(false),
+bOldRowHeaders(false),
 bNewColHeaders( bColHdr ),
 bNewRowHeaders( bRowHdr ),
 bAddRange( bAdd )
commit 50cd7345dbafdf612f796fad8083e7ec0c7ace0c
Author: Caolán McNamara 
AuthorDate: Sat Feb 26 15:24:15 2022 +
Commit: Caolán McNamara 
CommitDate: Sat Feb 26 20:05:09 2022 +0100

cid#1500568 Uninitialized scalar field

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

diff --git a/sw/source/uibase/config/modcfg.cxx 
b/sw/source/uibase/config/modcfg.cxx
index 3f690795b41d..2b80d8127b74 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -229,8 +229,9 @@ const Sequence& 
SwRevisionConfig::GetPropertyNames()
 return aNames;
 }
 
-SwRevisionConfig::SwRevisionConfig() :
-ConfigItem("Office.Writer/Revision", ConfigItemMode::ReleaseTree)
+SwRevisionConfig::SwRevisionConfig()
+: ConfigItem("Office.Writer/Revision", ConfigItemMode::ReleaseTree)
+, m_nMarkAlign(0)
 {
 m_aInsertAttr.m_nItemId = SID_ATTR_CHAR_UNDERLINE;
 m_aInsertAttr.m_nAttr = LINESTYLE_SINGLE;


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

2022-02-10 Thread Luboš Luňák (via logerrit)
 sc/source/filter/excel/exctools.cxx |5 -
 sc/source/filter/excel/frmbase.cxx  |   29 -
 sc/source/filter/excel/impop.cxx|   12 ++--
 sc/source/filter/excel/xiroot.cxx   |9 +
 sc/source/filter/inc/formel.hxx |5 +++--
 sc/source/filter/inc/root.hxx   |4 
 sc/source/filter/inc/xiroot.hxx |3 +++
 7 files changed, 33 insertions(+), 34 deletions(-)

New commits:
commit a3510e31065245987e5314c821d5688e0d73442f
Author: Luboš Luňák 
AuthorDate: Thu Feb 10 14:24:51 2022 +0100
Commit: Luboš Luňák 
CommitDate: Thu Feb 10 21:54:18 2022 +0100

remove hardcoded MAXCOL/MAXROW in ScRangeListTabs

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

diff --git a/sc/source/filter/excel/frmbase.cxx 
b/sc/source/filter/excel/frmbase.cxx
index d7144c5edea2..73ef59dadc72 100644
--- a/sc/source/filter/excel/frmbase.cxx
+++ b/sc/source/filter/excel/frmbase.cxx
@@ -21,7 +21,8 @@
 
 #include 
 
-ScRangeListTabs::ScRangeListTabs()
+ScRangeListTabs::ScRangeListTabs( const XclImpRoot& rRoot )
+: XclImpRoot( rRoot )
 {
 }
 
@@ -32,15 +33,16 @@ ScRangeListTabs::~ScRangeListTabs()
 void ScRangeListTabs::Append( const ScAddress& aSRD, SCTAB nTab )
 {
 ScAddress a = aSRD;
+ScDocument& rDoc = GetRoot().GetDoc();
 
 if (a.Tab() > MAXTAB)
 a.SetTab(MAXTAB);
 
-if (a.Col() > MAXCOL)
-a.SetCol(MAXCOL);
+if (a.Col() > rDoc.MaxCol())
+a.SetCol(rDoc.MaxCol());
 
-if (a.Row() > MAXROW)
-a.SetRow(MAXROW);
+if (a.Row() > rDoc.MaxRow())
+a.SetRow(rDoc.MaxRow());
 
 if( nTab == SCTAB_MAX)
 return;
@@ -69,6 +71,7 @@ void ScRangeListTabs::Append( const ScAddress& aSRD, SCTAB 
nTab )
 void ScRangeListTabs::Append( const ScRange& aCRD, SCTAB nTab )
 {
 ScRange a = aCRD;
+ScDocument& rDoc = GetRoot().GetDoc();
 
 // ignore 3D ranges
 if (a.aStart.Tab() != a.aEnd.Tab())
@@ -79,23 +82,23 @@ void ScRangeListTabs::Append( const ScRange& aCRD, SCTAB 
nTab )
 else if (a.aStart.Tab() < 0)
 a.aStart.SetTab(0);
 
-if (a.aStart.Col() > MAXCOL)
-a.aStart.SetCol(MAXCOL);
+if (a.aStart.Col() > rDoc.MaxCol())
+a.aStart.SetCol(rDoc.MaxCol());
 else if (a.aStart.Col() < 0)
 a.aStart.SetCol(0);
 
-if (a.aStart.Row() > MAXROW)
-a.aStart.SetRow(MAXROW);
+if (a.aStart.Row() > rDoc.MaxRow())
+a.aStart.SetRow(rDoc.MaxRow());
 else if (a.aStart.Row() < 0)
 a.aStart.SetRow(0);
 
-if (a.aEnd.Col() > MAXCOL)
-a.aEnd.SetCol(MAXCOL);
+if (a.aEnd.Col() > rDoc.MaxCol())
+a.aEnd.SetCol(rDoc.MaxCol());
 else if (a.aEnd.Col() < 0)
 a.aEnd.SetCol(0);
 
-if (a.aEnd.Row() > MAXROW)
-a.aEnd.SetRow(MAXROW);
+if (a.aEnd.Row() > rDoc.MaxRow())
+a.aEnd.SetRow(rDoc.MaxRow());
 else if (a.aEnd.Row() < 0)
 a.aEnd.SetRow(0);
 
diff --git a/sc/source/filter/excel/xiroot.cxx 
b/sc/source/filter/excel/xiroot.cxx
index 4469a487fe2b..af04654de2cd 100644
--- a/sc/source/filter/excel/xiroot.cxx
+++ b/sc/source/filter/excel/xiroot.cxx
@@ -85,8 +85,8 @@ XclImpRoot::XclImpRoot( XclImpRootData& rImpRootData ) :
 mrImpData.mxPageSett = std::make_shared( GetRoot() );
 mrImpData.mxDocViewSett = std::make_shared( 
GetRoot() );
 mrImpData.mxTabViewSett = std::make_shared( 
GetRoot() );
-mrImpData.mpPrintRanges = std::make_unique();
-mrImpData.mpPrintTitles = std::make_unique();
+mrImpData.mpPrintRanges = std::make_unique( GetRoot() );
+mrImpData.mpPrintTitles = std::make_unique( GetRoot() );
 }
 
 void XclImpRoot::SetCodePage( sal_uInt16 nCodePage )
diff --git a/sc/source/filter/inc/formel.hxx b/sc/source/filter/inc/formel.hxx
index d9dcec6ec15b..2c01a560e842 100644
--- a/sc/source/filter/inc/formel.hxx
+++ b/sc/source/filter/inc/formel.hxx
@@ -22,6 +22,7 @@
 #include 
 
 #include "tokstack.hxx"
+#include "xiroot.hxx"
 
 #include 
 #include 
@@ -51,7 +52,7 @@ enum FORMULA_TYPE
 FT_CondFormat
 };
 
-class ScRangeListTabs
+class ScRangeListTabs : protected XclImpRoot
 {
 typedef ::std::vector RangeListType;
 typedef ::std::map TabRangeType;
@@ -60,7 +61,7 @@ class ScRangeListTabs
 RangeListType::const_iterator maItrCurEnd;
 
 public:
-ScRangeListTabs ();
+ScRangeListTabs( const XclImpRoot& rRoot );
 ~ScRangeListTabs();
 
 void Append( const ScAddress& aSRD, SCTAB nTab );
commit 6a6a147ecebfbc4f0c8a3d626737104155426393
Author: Luboš Luňák 
AuthorDate: Thu Feb 10 14:09:41 2022 +0100
Commit: Luboš Luňák 
CommitDate: Thu Feb 10 21:54:01 2022 +0100

move ScRangeListTabs members from RootData to XclImpRoot

A comment suggests that it's the thing to do, and I'll need access
to GetRoot() from ScRangeListTabs in another change.

Change-Id: 

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

2022-01-27 Thread Xisco Fauli (via logerrit)
 dev/null|binary
 sc/source/ui/view/gridwin4.cxx  |3 -
 sw/qa/extras/uiwriter/uiwriter4.cxx |   84 +---
 3 files changed, 15 insertions(+), 72 deletions(-)

New commits:
commit 4bd1cf9c1aece1bb405c157e6e6b2444517a27ae
Author: Xisco Fauli 
AuthorDate: Thu Jan 27 13:16:02 2022 +0100
Commit: Xisco Fauli 
CommitDate: Thu Jan 27 15:03:45 2022 +0100

CppunitTest_sw_uiwriter4: remove duplicated code

No need to have blank file either, just pass nullptr to
createSwDoc and it will create an empty file

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

diff --git a/sw/qa/extras/uiwriter/data/tdf113877_blank.odt 
b/sw/qa/extras/uiwriter/data/tdf113877_blank.odt
deleted file mode 100644
index 741d7d5e6d0a..
Binary files a/sw/qa/extras/uiwriter/data/tdf113877_blank.odt and /dev/null 
differ
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 3ad3f9f08382..52a4dcbe8489 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -219,7 +219,7 @@ public:
 void testTdf112025();
 void testTdf72942();
 
-void testTdf113877_mergeDocs(const char* aDestDoc, const char* aInsertDoc);
+void mergeDocs(const char* aDestDoc, const char* aInsertDoc);
 void testTdf113877();
 void testTdf113877NoMerge();
 void testTdf113877_default_style();
@@ -2144,24 +2144,9 @@ void SwUiWriterTest4::testTdf58604()
 
 void SwUiWriterTest4::testTdf112025()
 {
-createSwDoc(DATA_DIRECTORY, "fdo112025.odt");
-const int numberOfParagraphs = getParagraphs();
-CPPUNIT_ASSERT_EQUAL(1, numberOfParagraphs);
+mergeDocs("fdo112025.odt", "fdo112025-insert.docx");
 
-// get a page cursor
-uno::Reference xModel(mxComponent, uno::UNO_QUERY);
-uno::Reference xTextViewCursorSupplier(
-xModel->getCurrentController(), uno::UNO_QUERY);
-uno::Reference 
xCursor(xTextViewCursorSupplier->getViewCursor(),
-  uno::UNO_QUERY);
-xCursor->jumpToEndOfPage();
-
-OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"fdo112025-insert.docx";
-uno::Sequence aPropertyValues(
-comphelper::InitPropertySequence({ { "Name", 
uno::makeAny(insertFileid) } }));
-dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
-// something has been inserted + an additional paragraph
-CPPUNIT_ASSERT_GREATER(numberOfParagraphs, getParagraphs());
+CPPUNIT_ASSERT_EQUAL(3, getParagraphs());
 
 uno::Reference 
xStyle(getStyles("PageStyles")->getByName("Standard"),
uno::UNO_QUERY);
@@ -2170,20 +2155,7 @@ void SwUiWriterTest4::testTdf112025()
 
 void SwUiWriterTest4::testTdf72942()
 {
-createSwDoc(DATA_DIRECTORY, "fdo72942.docx");
-
-// get a page cursor
-uno::Reference xModel(mxComponent, uno::UNO_QUERY);
-uno::Reference xTextViewCursorSupplier(
-xModel->getCurrentController(), uno::UNO_QUERY);
-uno::Reference 
xCursor(xTextViewCursorSupplier->getViewCursor(),
-  uno::UNO_QUERY);
-xCursor->jumpToEndOfPage();
-
-OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"fdo72942-insert.docx";
-uno::Sequence aPropertyValues(
-comphelper::InitPropertySequence({ { "Name", 
uno::makeAny(insertFileid) } }));
-dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
+mergeDocs("fdo72942.docx", "fdo72942-insert.docx");
 
 // check styles of paragraphs added from [fdo72942.docx]
 const uno::Reference xRun1 = getRun(getParagraph(1), 1);
@@ -2232,7 +2204,7 @@ void SwUiWriterTest4::testTdf114306_2()
 CPPUNIT_ASSERT_EQUAL(4, getPages());
 }
 
-void SwUiWriterTest4::testTdf113877_mergeDocs(const char* aDestDoc, const 
char* aInsertDoc)
+void SwUiWriterTest4::mergeDocs(const char* aDestDoc, const char* aInsertDoc)
 {
 createSwDoc(DATA_DIRECTORY, aDestDoc);
 
@@ -2258,8 +2230,7 @@ void SwUiWriterTest4::testTdf113877_mergeDocs(const char* 
aDestDoc, const char*
 // we should merge both lists into one, when they have the same list properties
 void SwUiWriterTest4::testTdf113877()
 {
-testTdf113877_mergeDocs("tdf113877_insert_numbered_list.odt",
-"tdf113877_insert_numbered_list.odt");
+mergeDocs("tdf113877_insert_numbered_list.odt", 
"tdf113877_insert_numbered_list.odt");
 
 const OUString listId1 = getProperty(getParagraph(1), "ListId");
 const OUString listId4 = getProperty(getParagraph(4), "ListId");
@@ -2279,8 +2250,7 @@ void SwUiWriterTest4::testTdf113877()
 // The same test as testTdf113877() but merging of two list should not be 
performed.
 void SwUiWriterTest4::testTdf113877NoMerge()
 {
-

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

2021-10-06 Thread Szymon Kłos (via logerrit)
 sc/source/ui/unoobj/docuno.cxx |8 ++---
 sc/source/ui/view/gridwin4.cxx |   57 +++--
 2 files changed, 54 insertions(+), 11 deletions(-)

New commits:
commit 0ed940e3eb87c7048a1a8e6cfda14e7cef85d007
Author: Szymon Kłos 
AuthorDate: Wed Sep 15 14:37:37 2021 +0200
Commit: Szymon Kłos 
CommitDate: Wed Oct 6 11:11:30 2021 +0200

lok json: write correctly formatted array for comments

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

diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 7c5eafa81774..d1131d6f967b 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1112,10 +1112,10 @@ void ScModelObj::getPostIts(tools::JsonWriter& 
rJsonWriter)
 std::vector aNotes;
 rDoc.GetAllNoteEntries(aNotes);
 
-auto commentsNode = rJsonWriter.startNode("comments");
+auto commentsNode = rJsonWriter.startArray("comments");
 for (const sc::NoteEntry& aNote : aNotes)
 {
-auto commentNode = rJsonWriter.startNode("");
+auto commentNode = rJsonWriter.startStruct();
 
 rJsonWriter.put("id", aNote.mpNote->GetId());
 rJsonWriter.put("tab", aNote.maPos.Tab());
@@ -1154,10 +1154,10 @@ void ScModelObj::getPostItsPos(tools::JsonWriter& 
rJsonWriter)
 std::vector aNotes;
 rDoc.GetAllNoteEntries(aNotes);
 
-auto commentsNode = rJsonWriter.startNode("commentsPos");
+auto commentsNode = rJsonWriter.startArray("commentsPos");
 for (const sc::NoteEntry& aNote : aNotes)
 {
-auto commentNode = rJsonWriter.startNode("");
+auto commentNode = rJsonWriter.startStruct();
 
 rJsonWriter.put("id", aNote.mpNote->GetId());
 rJsonWriter.put("tab", aNote.maPos.Tab());
commit 57a628d540287c4bfa8251e50279f4879faa184d
Author: Szymon Kłos 
AuthorDate: Tue Aug 17 16:56:22 2021 +0200
Commit: Szymon Kłos 
CommitDate: Wed Oct 6 11:11:14 2021 +0200

calc: get rects faster for simple selection

In LOK when we select the full row using keyboard shortcut
Ctrl + Shift + right arrow we need to receive complete selection
so we will avoid requesting it by chunks, slowly moving the
view to the right.

So - don't clip the selection rects to the visible area.

It is needed only for simple selections so to avoid performance
issues - use simpler algorithm without loops checking every cell size.

Change-Id: I6ab975b6c155f3dde3014a52752ffdc79a93844f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120611
Reviewed-by: Henry Castro 
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122107
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123099
Tested-by: Jenkins

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index f810efbb8c19..e37949f7ef23 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -2115,14 +2115,60 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData 
,
   ::std::vector< tools::Rectangle >& rRects,
   bool bInPrintTwips) const
 {
-ScMarkData aMultiMark( rMarkData );
-aMultiMark.SetMarking( false );
-aMultiMark.MarkToMulti();
 ScDocument& rDoc = mrViewData.GetDocument();
 SCTAB nTab = mrViewData.GetTabNo();
-
+double nPPTX = mrViewData.GetPPTX();
+double nPPTY = mrViewData.GetPPTY();
 bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
 tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
+
+ScMarkData aMultiMark( rMarkData );
+aMultiMark.SetMarking( false );
+
+if (!aMultiMark.IsMultiMarked())
+{
+// simple range case - simplify calculation
+ScRange aSimpleRange;
+aMultiMark.GetMarkArea( aSimpleRange );
+
+aMultiMark.MarkToMulti();
+if ( !aMultiMark.IsMultiMarked() )
+return;
+
+SCCOL nX1 = aSimpleRange.aStart.Col();
+SCROW nY1 = aSimpleRange.aStart.Row();
+SCCOL nX2 = aSimpleRange.aEnd.Col();
+SCROW nY2 = aSimpleRange.aEnd.Row();
+
+PutInOrder( nX1, nX2 );
+PutInOrder( nY1, nY2 );
+
+Point aScrStartPos = bInPrintTwips ? mrViewData.GetPrintTwipsPos(nX1, 
nY1) :
+mrViewData.GetScrPos(nX1, nY1, eWhich);
+
+tools::Long nStartX = aScrStartPos.X();
+tools::Long nStartY = aScrStartPos.Y();
+
+Point aScrEndPos = bInPrintTwips ? mrViewData.GetPrintTwipsPos(nX2, 
nY2) :
+mrViewData.GetScrPos(nX2, nY2, eWhich);
+
+tools::Long nWidthTwips = rDoc.GetColWidth(nX2, nTab);
+const tools::Long nWidth = bInPrintTwips ?
+nWidthTwips : 

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

2021-09-07 Thread Michael Weghorn (via logerrit)
 sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx |4 ++--
 winaccessibility/source/UAccCOM/MAccessible.cxx  |   11 ---
 winaccessibility/source/UAccCOM/MAccessible.h|1 -
 3 files changed, 2 insertions(+), 14 deletions(-)

New commits:
commit 26e45694433721a8837a2133c05798776576def6
Author: Michael Weghorn 
AuthorDate: Mon Sep 6 15:54:13 2021 +0100
Commit: Michael Weghorn 
CommitDate: Tue Sep 7 08:18:22 2021 +0200

wina11y: Drop unused CMAccessible::IsDescendantManage

Change-Id: I90aa35ec3567d720c8adbe0cfc96343bef678ba1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121730
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx 
b/winaccessibility/source/UAccCOM/MAccessible.cxx
index d7e19374d8f2..e9c563b3da5e 100644
--- a/winaccessibility/source/UAccCOM/MAccessible.cxx
+++ b/winaccessibility/source/UAccCOM/MAccessible.cxx
@@ -1405,17 +1405,6 @@ IMAccessible* CMAccessible::GetChildInterface(long 
dChildID)//for test
 return nullptr;
 }
 
-/**
-* For List, tree and table,these roles belong to manage_descendant in UNO,
-* need to process specifically when navigate
-* @return  BOOL, if it is descendantmanager, return true.
-*/
-bool CMAccessible::IsDescendantManage()
-{
-
-return 
(m_iRole==ROLE_SYSTEM_LIST)||(m_iRole==ROLE_SYSTEM_OUTLINE)||(m_iRole==ROLE_SYSTEM_TABLE);
-}
-
 /**
 * for descendantmanager circumstance,provide child interface when navigate
 * @paramvarCur, the current child.
diff --git a/winaccessibility/source/UAccCOM/MAccessible.h 
b/winaccessibility/source/UAccCOM/MAccessible.h
index 4ad335579cce..80e9cb463ca1 100644
--- a/winaccessibility/source/UAccCOM/MAccessible.h
+++ b/winaccessibility/source/UAccCOM/MAccessible.h
@@ -208,7 +208,6 @@ private:
 HRESULT GetLastChild(VARIANT varStart,VARIANT* pvarEndUpAt);//for 
accNavigate implementation
 HRESULT GetNextSibling(VARIANT varStart,VARIANT* pvarEndUpAt);//for 
accNavigate implementation
 HRESULT GetPreSibling(VARIANT varStart,VARIANT* pvarEndUpAt);//for 
accNavigate implementation
-bool IsDescendantManage();//identify whether the current COM belongs to 
manage_descendant roles
 
 // the following private methods are used to implement accSelect method
 HRESULT SelectChild(css::accessibility::XAccessible* pItem);
commit c772f4458ec0ce486c8bfefecd99c37527bec732
Author: Michael Weghorn 
AuthorDate: Mon Sep 6 15:43:55 2021 +0100
Commit: Michael Weghorn 
CommitDate: Tue Sep 7 08:18:10 2021 +0200

Use while instead of for loop

... since only the condition and no init-statement or
iteration-expression is set anyway.

Change-Id: Icd9c5c9cf1e89f39984ed13624246731da0d7acc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121729
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx 
b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index e414074819dd..484ab05c0eb6 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -717,7 +717,7 @@ void ScAccessibleSpreadsheet::RemoveSelection(const 
ScMarkData )
 AccessibleEventObject aEvent;
 aEvent.Source = uno::Reference< XAccessible >(this);
 MAP_ADDR_XACC::iterator miRemove = m_mapSelectionSend.begin();
-for(;  miRemove != m_mapSelectionSend.end() ;)
+while (miRemove != m_mapSelectionSend.end())
 {
 if 
(refScMarkData.IsCellMarked(miRemove->first.Col(),miRemove->first.Row(),true) ||
 
refScMarkData.IsCellMarked(miRemove->first.Col(),miRemove->first.Row()) )
@@ -1567,7 +1567,7 @@ void ScAccessibleSpreadsheet::RemoveFormulaSelection(bool 
bRemoveAll )
 AccessibleEventObject aEvent;
 aEvent.Source = uno::Reference< XAccessible >(this);
 MAP_ADDR_XACC::iterator miRemove = m_mapFormulaSelectionSend.begin();
-for(;  miRemove != m_mapFormulaSelectionSend.end() ;)
+while (miRemove != m_mapFormulaSelectionSend.end())
 {
 if( !bRemoveAll && IsScAddrFormulaSel(miRemove->first) )
 {


[Libreoffice-commits] core.git: 2 commits - sc/source sc/uiconfig sc/UIConfig_scalc.mk

2021-08-30 Thread tushar (via logerrit)
 sc/UIConfig_scalc.mk |1 
 sc/source/filter/ftools/ftools.cxx   |   14 ++--
 sc/source/filter/inc/ftools.hxx  |2 
 sc/source/filter/inc/lotimpop.hxx|2 
 sc/source/filter/lotus/lotform.cxx   |   17 ++--
 sc/source/ui/dataprovider/datatransformation.cxx |   47 +
 sc/source/ui/inc/dataproviderdlg.hxx |1 
 sc/source/ui/inc/datatransformation.hxx  |   15 
 sc/source/ui/miscdlgs/dataproviderdlg.cxx|   56 
 sc/uiconfig/scalc/ui/swaprowsentry.ui|   80 +++
 10 files changed, 219 insertions(+), 16 deletions(-)

New commits:
commit a0b836f73f249138a231f01c1d0289a9b67dc62d
Author: tushar 
AuthorDate: Tue Aug 17 01:30:00 2021 +0530
Commit: Heiko Tietze 
CommitDate: Mon Aug 30 09:29:21 2021 +0200

Add Swap Rows Transformation.

Entries of given rows are swapped after applying transformation.

Change-Id: Iac9da1b15781656b4127bf74f6a95e8cb82fa3d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120556
Reviewed-by: Markus Mohrhard 
Tested-by: Jenkins

diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 114be7d8f602..ce625df9f301 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -171,6 +171,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/datetimetransformationentry \
sc/uiconfig/scalc/ui/findreplaceentry \
sc/uiconfig/scalc/ui/deleterowentry \
+   sc/uiconfig/scalc/ui/swaprowsentry \
sc/uiconfig/scalc/ui/movecopysheet \
sc/uiconfig/scalc/ui/movingaveragedialog \
sc/uiconfig/scalc/ui/multipleoperationsdialog \
diff --git a/sc/source/ui/dataprovider/datatransformation.cxx 
b/sc/source/ui/dataprovider/datatransformation.cxx
index e1013baa1e47..004c82a3c024 100644
--- a/sc/source/ui/dataprovider/datatransformation.cxx
+++ b/sc/source/ui/dataprovider/datatransformation.cxx
@@ -1261,6 +1261,53 @@ const OUString& DeleteRowTransformation::getFindString() 
const
 return maFindString;
 }
 
+SwapRowsTransformation::SwapRowsTransformation(SCROW mRow, SCROW nRow)
+: mxRow(mRow)
+, nxRow(nRow)
+{
+}
+
+void SwapRowsTransformation::Transform(ScDocument& rDoc) const
+{
+if (mxRow == -1 || nxRow == -1)
+return;
+
+for (SCCOL nCol = 0; nCol <= rDoc.MaxCol(); ++nCol)
+{
+CellType aType;
+rDoc.GetCellType(nCol, mxRow, 0, aType);
+if (aType == CELLTYPE_STRING)
+{
+OUString aStr = rDoc.GetString(nCol, mxRow, 0);
+OUString bStr = rDoc.GetString(nCol, nxRow, 0);
+rDoc.SetString(nCol, mxRow, 0, bStr);
+rDoc.SetString(nCol, nxRow, 0, aStr);
+}
+else if (aType == CELLTYPE_VALUE)
+{
+double aVal = rDoc.GetValue(nCol, mxRow, 0);
+double bVal = rDoc.GetValue(nCol, nxRow, 0);
+rDoc.SetValue(nCol, mxRow, 0, bVal);
+rDoc.SetValue(nCol, nxRow, 0, aVal);
+}
+}
+}
+
+TransformationType SwapRowsTransformation::getTransformationType() const
+{
+return TransformationType::SWAPROWS_TRANSFORMATION;
+}
+
+SCROW SwapRowsTransformation::getFirstRow() const
+{
+return mxRow;
+}
+
+SCROW SwapRowsTransformation::getSecondRow() const
+{
+return nxRow;
+}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/dataproviderdlg.hxx 
b/sc/source/ui/inc/dataproviderdlg.hxx
index ec054d283149..127b6361abbd 100644
--- a/sc/source/ui/inc/dataproviderdlg.hxx
+++ b/sc/source/ui/inc/dataproviderdlg.hxx
@@ -87,6 +87,7 @@ public:
 void dateTimeTransformation();
 void findReplaceTransformation();
 void deleteRowTransformation();
+void swapRowsTransformation();
 
 void updateApplyBtn(bool bValidConfig);
 void isValid();
diff --git a/sc/source/ui/inc/datatransformation.hxx 
b/sc/source/ui/inc/datatransformation.hxx
index e5bf96690da0..d575be4c4785 100644
--- a/sc/source/ui/inc/datatransformation.hxx
+++ b/sc/source/ui/inc/datatransformation.hxx
@@ -32,7 +32,8 @@ enum class TransformationType
 REMOVE_NULL_TRANSFORMATION,
 DATETIME_TRANSFORMATION,
 FINDREPLACE_TRANSFORMATION,
-DELETEROW_TRANSFORMATION
+DELETEROW_TRANSFORMATION,
+SWAPROWS_TRANSFORMATION
 };
 
 enum class TEXT_TRANSFORM_TYPE { TO_LOWER, TO_UPPER, CAPITALIZE, TRIM };
@@ -211,6 +212,18 @@ class DeleteRowTransformation : public DataTransformation
 const OUString & getFindString() const;
 };
 
+class SC_DLLPUBLIC SwapRowsTransformation : public DataTransformation
+{
+SCROW mxRow, nxRow;
+
+public:
+SwapRowsTransformation(SCROW mRow, SCROW nRow);
+virtual void Transform(ScDocument& rDoc) const override;
+virtual TransformationType getTransformationType() const override;
+SCROW getFirstRow() const;
+SCROW getSecondRow() const;
+};
+
 }
 
 /* vim:set 

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

2021-08-12 Thread Vasily Melenchuk (via logerrit)
 sc/source/ui/navipi/content.cxx  |7 ++-
 sc/source/ui/navipi/navipi.cxx   |1 -
 sw/qa/extras/uiwriter/data/tdf129270.odt |binary
 sw/qa/extras/uiwriter/uiwriter4.cxx  |   26 ++
 sw/source/core/txtnode/ndtxt.cxx |   10 +-
 5 files changed, 41 insertions(+), 3 deletions(-)

New commits:
commit a72f2dcf73df9b9f4420cc93aa57a77c165a0fcb
Author: Vasily Melenchuk 
AuthorDate: Mon Aug 9 18:42:02 2021 +0300
Commit: Michael Stahl 
CommitDate: Thu Aug 12 14:10:46 2021 +0200

tdf#129270: sw: do not copy list level on paragraph cut

Current list level (RES_PARATR_LIST_LEVEL) is initialized
before, but current value can overwrite it with invalid
in given context. So we could have mismatch of outline
style (which are not overwritten) and actual list level.

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

diff --git a/sw/qa/extras/uiwriter/data/tdf129270.odt 
b/sw/qa/extras/uiwriter/data/tdf129270.odt
new file mode 100644
index ..e86c1f872153
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf129270.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index d93447d71dc2..e079ff006aea 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -278,6 +278,7 @@ public:
 void testRedlineAutoCorrect();
 void testRedlineAutoCorrect2();
 void testEmojiAutoCorrect();
+void testTdf129270();
 void testInsertPdf();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest4);
@@ -393,6 +394,7 @@ public:
 CPPUNIT_TEST(testRedlineAutoCorrect);
 CPPUNIT_TEST(testRedlineAutoCorrect2);
 CPPUNIT_TEST(testEmojiAutoCorrect);
+CPPUNIT_TEST(testTdf129270);
 CPPUNIT_TEST(testInsertPdf);
 CPPUNIT_TEST_SUITE_END();
 };
@@ -3602,6 +3604,30 @@ void SwUiWriterTest4::testInsertLongDateFormat()
 CPPUNIT_ASSERT(xField->getString().indexOf(" ") > -1);
 }
 
+void SwUiWriterTest4::testTdf129270()
+{
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf129270.odt");
+CPPUNIT_ASSERT(pDoc);
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+SwXTextDocument* pXTextDocument = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pXTextDocument);
+
+// Go to document end
+pWrtShell->SttEndDoc(/*bStt=*/false);
+
+// Press enter
+pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RETURN);
+Scheduler::ProcessEventsToIdle();
+
+// Numbering for previous outline should remain the same "2"
+CPPUNIT_ASSERT_EQUAL(OUString("2"), getProperty(getParagraph(4), 
"ListLabelString"));
+
+// Numbering for newly created outline should be "2.1"
+CPPUNIT_ASSERT_EQUAL(OUString("2.1"),
+ getProperty(getParagraph(5), 
"ListLabelString"));
+}
+
 void SwUiWriterTest4::testInsertPdf()
 {
 auto pPdfium = vcl::pdf::PDFiumLibrary::get();
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index c65455722c85..626b3b21bdd0 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2497,7 +2497,15 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, 
const SwIndex & rDestStart,
 }
 else
 {
-GetpSwAttrSet()->CopyToModify( *pDest );
+// Copy all attrs except RES_PARATR_LIST_LEVEL: it was initialized 
before
+// and current SwTextNode can contain not suitable for pDest value
+SfxItemSet aCharSet(
+pDest->GetDoc().GetAttrPool(),
+svl::Items);
+aCharSet.Put(*GetpSwAttrSet());
+if (aCharSet.Count())
+pDest->SetAttr(aCharSet, nDestStart, nDestStart + nLen);
 }
 }
 
commit 38027099e773403ffd3314a5b54493adc65150ec
Author: Noel Grandin 
AuthorDate: Thu Aug 12 12:36:23 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Aug 12 14:10:37 2021 +0200

tdf#95549 speed up navigator tree load

(*) inline the load loop

(*) remove Refresh call from ScNavigatorDlg constructor, the SetListMode
call at the bottom will trigger a load of the tree content

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

diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index a5d464821f12..fe7c7f04f3e9 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -960,8 +960,13 @@ void ScContentTree::GetNoteStrings()
 // loop over cell notes
 std::vector aEntries;
 pDoc->GetAllNoteEntries(aEntries);
+weld::TreeIter* pParent = m_aRootNodes[ScContentId::NOTE].get();
 for (const auto& rEntry 

[Libreoffice-commits] core.git: 2 commits - sc/source solenv/sanitizers vcl/uiconfig vcl/UIConfig_vcl.mk vcl/unx

2021-08-11 Thread Caolán McNamara (via logerrit)
 sc/source/core/data/documen2.cxx |3 
 sc/source/ui/docshell/docfunc.cxx|5 
 solenv/sanitizers/ui/vcl.suppr   |6 -
 vcl/UIConfig_vcl.mk  |3 
 vcl/uiconfig/ui/menutogglebutton4.ui |   29 +
 vcl/unx/gtk3/gtkinst.cxx |  153 ++--
 vcl/unx/gtk4/convert3to4.cxx |  186 ++-
 7 files changed, 237 insertions(+), 148 deletions(-)

New commits:
commit 3ad8347f25935d60e55ff12fd1844001a50bedc4
Author: Caolán McNamara 
AuthorDate: Wed Aug 11 14:45:02 2021 +0100
Commit: Caolán McNamara 
CommitDate: Wed Aug 11 16:56:15 2021 +0200

add some --disable-scripting fixes

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

diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 1db11be0c777..28f19df43539 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -87,6 +87,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 
@@ -1026,11 +1027,13 @@ sal_uLong ScDocument::TransferTab( ScDocument& rSrcDoc, 
SCTAB nSrcPos,
 if ( pSrcShell )
 {
 OUString aLibName("Standard");
+#if HAVE_FEATURE_SCRIPTING
 const BasicManager *pBasicManager = pSrcShell->GetBasicManager();
 if (pBasicManager && !pBasicManager->GetName().isEmpty())
 {
 aLibName = pSrcShell->GetBasicManager()->GetName();
 }
+#endif
 OUString sSource;
 uno::Reference< script::XLibraryContainer > xLibContainer = 
pSrcShell->GetBasicContainer();
 uno::Reference< container::XNameContainer > xLib;
diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index ac011281dd36..d0ad63f1ff95 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -94,6 +94,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -3198,10 +3199,12 @@ void VBA_InsertModule( ScDocument& rDoc, SCTAB nTab, 
const OUString& sSource )
 if( xLibContainer.is() )
 {
 OUString aLibName( "Standard" );
+#if HAVE_FEATURE_SCRIPTING
 if ( rDocSh.GetBasicManager() && 
!rDocSh.GetBasicManager()->GetName().isEmpty() )
 {
 aLibName = rDocSh.GetBasicManager()->GetName();
 }
+#endif
 uno::Any aLibAny = xLibContainer->getByName( aLibName );
 aLibAny >>= xLib;
 }
@@ -3238,10 +3241,12 @@ void VBA_DeleteModule( ScDocShell& rDocSh, const 
OUString& sModuleName )
 if( xLibContainer.is() )
 {
 OUString aLibName( "Standard" );
+#if HAVE_FEATURE_SCRIPTING
 if ( rDocSh.GetBasicManager() && 
!rDocSh.GetBasicManager()->GetName().isEmpty() )
 {
 aLibName = rDocSh.GetBasicManager()->GetName();
 }
+#endif
 uno::Any aLibAny = xLibContainer->getByName( aLibName );
 aLibAny >>= xLib;
 }
commit 54c2de7e77dad1a1151c074f2ec5bfe1527d4d12
Author: Caolán McNamara 
AuthorDate: Wed Aug 11 10:53:44 2021 +0100
Commit: Caolán McNamara 
CommitDate: Wed Aug 11 16:56:02 2021 +0200

gtk4: get startcenter MenuToggleButton working

the button parts, not the menu part yet

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

diff --git a/solenv/sanitizers/ui/vcl.suppr b/solenv/sanitizers/ui/vcl.suppr
index c053a035fd32..a07c25780a76 100644
--- a/solenv/sanitizers/ui/vcl.suppr
+++ b/solenv/sanitizers/ui/vcl.suppr
@@ -7,8 +7,10 @@ vcl/uiconfig/ui/combobox.ui://GtkEntry[@id='entry'] 
no-labelled-by
 vcl/uiconfig/ui/combobox.ui://GtkToggleButton[@id='button'] button-no-label
 vcl/uiconfig/ui/combobox.ui://GtkMenuButton[@id='overlaybutton'] 
button-no-label
 vcl/uiconfig/ui/cupspassworddialog.ui://GtkLabel[@id='text'] orphan-label
-vcl/uiconfig/ui/menutogglebutton.ui://GtkToggleButton[@id='togglebutton'] 
button-no-label
-vcl/uiconfig/ui/menutogglebutton.ui://GtkButton[@id='menubutton'] 
button-no-label
+vcl/uiconfig/ui/menutogglebutton3.ui://GtkToggleButton[@id='togglebutton'] 
button-no-label
+vcl/uiconfig/ui/menutogglebutton3.ui://GtkButton[@id='menubutton'] 
button-no-label
+vcl/uiconfig/ui/menutogglebutton4.ui://GtkToggleButton[@id='togglebutton'] 
button-no-label
+vcl/uiconfig/ui/menutogglebutton4.ui://GtkButton[@id='menubutton'] 
button-no-label
 vcl/uiconfig/ui/printdialog.ui://GtkLabel[@id='totalnumpages'] orphan-label
 vcl/uiconfig/ui/printdialog.ui://GtkImage[@id='collateimage'] no-labelled-by
 vcl/uiconfig/ui/printdialog.ui://GtkLabel[@id='pagemargintxt2'] orphan-label
diff --git a/vcl/UIConfig_vcl.mk b/vcl/UIConfig_vcl.mk
index 72b7e08d2700..703cef1e6e1c 100644
--- a/vcl/UIConfig_vcl.mk
+++ 

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

2021-07-19 Thread Szymon Kłos (via logerrit)
 sc/source/ui/app/inputwin.cxx |   43 +-
 1 file changed, 42 insertions(+), 1 deletion(-)

New commits:
commit 3a84543c9b52f681304564ebfb00db8da6a1d407
Author: Szymon Kłos 
AuthorDate: Mon May 10 10:11:53 2021 +0200
Commit: Szymon Kłos 
CommitDate: Mon Jul 19 10:25:07 2021 +0200

LOK: inform when input bar has cursor and focus

Now the cursor is rendered on the Drawing Area so
we need to send special message to inform that
cursor is shown. This fixes bug in online where
without cursor instead of sending character to
formula bar is was send to the spreadsheet and
formula bar was loosing focus at that time.

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

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 3d87b97de754..7aa3084fe84e 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1313,6 +1313,26 @@ void ScTextWnd::Paint( vcl::RenderContext& 
rRenderContext, const tools::Rectangl
 }
 else
 WeldEditView::Paint(rRenderContext, rRect);
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+bool bIsFocused = false;
+if (HasFocus())
+{
+vcl::Cursor* pCursor = m_xEditView->GetCursor();
+if (pCursor)
+bIsFocused = true;
+}
+
+VclPtr pParent = 
mrGroupBar.GetVclParent().GetParentWithLOKNotifier();
+if (!pParent)
+return;
+
+const vcl::ILibreOfficeKitNotifier* pNotifier = 
pParent->GetLOKNotifier();
+std::vector aItems;
+aItems.emplace_back("visible", bIsFocused ? "true" : "false");
+pNotifier->notifyWindow(pParent->GetLOKWindowId(), "cursor_visible", 
aItems);
+}
 }
 
 EditView* ScTextWnd::GetEditView() const
commit 4bd116b28e8266558e40a8e7bf303a53da6a5730
Author: Szymon Kłos 
AuthorDate: Fri May 7 18:30:13 2021 +0200
Commit: Szymon Kłos 
CommitDate: Mon Jul 19 10:24:52 2021 +0200

LOK: Render correctly sized input bar

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

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index b9a5f567d251..3d87b97de754 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -44,6 +44,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -1291,7 +1292,27 @@ void ScTextWnd::Paint( vcl::RenderContext& 
rRenderContext, const tools::Rectangl
 }
 }
 
-WeldEditView::Paint(rRenderContext, rRect);
+if (comphelper::LibreOfficeKit::isActive() && m_xEditEngine)
+{
+// in LOK somehow text is rendered very overscaled so render the 
original content first
+// on a virtual device then redraw with correct scale to the target 
device
+
+ScopedVclPtrInstance pDevice;
+
+tools::Long aPaperWidth = m_xEditEngine->GetPaperSize().getWidth();
+double fRatio = static_cast(rRect.GetSize().getHeight()) / 
rRect.GetSize().getWidth();
+
+tools::Rectangle aPaperRect(Point(0, 0), Size(aPaperWidth, aPaperWidth 
* fRatio));
+aPaperRect = pDevice->PixelToLogic(aPaperRect);
+
+pDevice->SetOutputSize(aPaperRect.GetSize());
+
+WeldEditView::Paint(*pDevice, aPaperRect);
+
+rRenderContext.DrawOutDev(rRect.TopLeft(), rRect.GetSize(), 
Point(0,0), aPaperRect.GetSize(), *pDevice);
+}
+else
+WeldEditView::Paint(rRenderContext, rRect);
 }
 
 EditView* ScTextWnd::GetEditView() const
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/source svx/source vcl/source

2021-07-19 Thread Szymon Kłos (via logerrit)
 sc/source/ui/cctrl/cbnumberformat.cxx   |2 +-
 svx/source/tbxctrls/StylesPreviewWindow.cxx |2 +-
 vcl/source/window/toolbox2.cxx  |   13 +
 3 files changed, 11 insertions(+), 6 deletions(-)

New commits:
commit 9dd28785c7d0d1604c85e00247782e1ebd2d69f8
Author: Szymon Kłos 
AuthorDate: Wed Apr 28 15:20:35 2021 +0200
Commit: Szymon Kłos 
CommitDate: Mon Jul 19 09:01:25 2021 +0200

jsdialog: dump toolbox item's window if present

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

diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 291cad218c37..c7c1934270d5 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -1739,11 +1739,16 @@ void ToolBox::DumpAsPropertyTree(tools::JsonWriter& 
rJsonWriter)
 auto childrenNode = rJsonWriter.startArray("children");
 for (ToolBox::ImplToolItems::size_type i = 0; i < GetItemCount(); ++i)
 {
-ToolBoxItemType type = GetItemType(i);
-if (type == ToolBoxItemType::BUTTON)
+auto childNode = rJsonWriter.startStruct();
+ToolBoxItemId nId = GetItemId(i);
+
+vcl::Window* pWindow = GetItemWindow(nId);
+if (pWindow)
+{
+pWindow->DumpAsPropertyTree(rJsonWriter);
+}
+else
 {
-auto childNode = rJsonWriter.startStruct();
-ToolBoxItemId nId = GetItemId(i);
 if (!IsItemVisible(nId))
 continue;
 rJsonWriter.put("type", "toolitem");
commit 37192a6f87a82e83eab03c06258d455f16694154
Author: Szymon Kłos 
AuthorDate: Wed Apr 28 13:48:08 2021 +0200
Commit: Szymon Kłos 
CommitDate: Mon Jul 19 09:01:10 2021 +0200

notebookbar: fix welded controls in online

Additional parameter was introduced for InterimItemWindow
and value for it was missing.

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

diff --git a/sc/source/ui/cctrl/cbnumberformat.cxx 
b/sc/source/ui/cctrl/cbnumberformat.cxx
index 32bc0d76d0e1..29ab64e84e75 100644
--- a/sc/source/ui/cctrl/cbnumberformat.cxx
+++ b/sc/source/ui/cctrl/cbnumberformat.cxx
@@ -27,7 +27,7 @@
 #include 
 
 ScNumberFormat::ScNumberFormat(vcl::Window* pParent)
-: InterimItemWindow(pParent, "modules/scalc/ui/numberbox.ui", "NumberBox",
+: InterimItemWindow(pParent, "modules/scalc/ui/numberbox.ui", "NumberBox", 
true,
 reinterpret_cast(SfxViewShell::Current()))
 , m_xWidget(m_xBuilder->weld_combo_box("numbertype"))
 {
diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx 
b/svx/source/tbxctrls/StylesPreviewWindow.cxx
index eef8bba791e5..2051e2479a84 100644
--- a/svx/source/tbxctrls/StylesPreviewWindow.cxx
+++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx
@@ -479,7 +479,7 @@ void StylesPreviewWindow_Base::UpdateStylesList()
 StylesPreviewWindow_Impl::StylesPreviewWindow_Impl(
 vcl::Window* pParent, std::vector>& 
aDefaultStyles,
 const css::uno::Reference& 
xDispatchProvider)
-: InterimItemWindow(pParent, "svx/ui/stylespreview.ui", "ApplyStyleBox",
+: InterimItemWindow(pParent, "svx/ui/stylespreview.ui", "ApplyStyleBox", 
true,
 reinterpret_cast(SfxViewShell::Current()))
 , StylesPreviewWindow_Base(*m_xBuilder, aDefaultStyles, xDispatchProvider)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-02 Thread Noel Grandin (via logerrit)
 sc/source/ui/inc/pfuncache.hxx  |   14 +++---
 sc/source/ui/unoobj/docuno.cxx  |   12 ++--
 sw/source/uibase/uiview/uivwimp.cxx |2 ++
 3 files changed, 15 insertions(+), 13 deletions(-)

New commits:
commit 558dface96fbc5f487b16cfa1bf3c3ea20776331
Author: Noel Grandin 
AuthorDate: Fri Jul 2 11:19:39 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 2 12:29:42 2021 +0200

fix potential use-after-free in SwClipboardChangeListener

we think we're seeing this in COOL

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

diff --git a/sw/source/uibase/uiview/uivwimp.cxx 
b/sw/source/uibase/uiview/uivwimp.cxx
index 336ce8de1975..6ad240701960 100644
--- a/sw/source/uibase/uiview/uivwimp.cxx
+++ b/sw/source/uibase/uiview/uivwimp.cxx
@@ -287,6 +287,8 @@ SwClipboardChangeListener::~SwClipboardChangeListener()
 
 void SAL_CALL SwClipboardChangeListener::disposing( const EventObject& 
/*rEventObject*/ )
 {
+SolarMutexGuard aGuard;
+pView = nullptr; // so we don't touch the view if changedContents somehow 
fires afterwards
 }
 
 void SAL_CALL SwClipboardChangeListener::changedContents( const 
css::datatransfer::clipboard::ClipboardEvent& rEventObject )
commit e594c5e408593622bb70d54ef03ec5ca09a2d721
Author: Noel Grandin 
AuthorDate: Fri Jul 2 10:50:47 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 2 12:29:34 2021 +0200

convert ScPrintSelectionMode to scoped enum

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

diff --git a/sc/source/ui/inc/pfuncache.hxx b/sc/source/ui/inc/pfuncache.hxx
index 902ea7ade517..c3324e2f69f6 100644
--- a/sc/source/ui/inc/pfuncache.hxx
+++ b/sc/source/ui/inc/pfuncache.hxx
@@ -30,13 +30,13 @@ class OutputDevice;
 
 /** Possible types of selection for print functions */
 
-enum ScPrintSelectionMode
+enum class ScPrintSelectionMode
 {
-SC_PRINTSEL_INVALID,
-SC_PRINTSEL_DOCUMENT,
-SC_PRINTSEL_CURSOR,
-SC_PRINTSEL_RANGE,
-SC_PRINTSEL_RANGE_EXCLUSIVELY_OLE_AND_DRAW_OBJECTS
+Invalid,
+Document,
+Cursor,
+Range,
+RangeExclusivelyOleAndDrawObjects
 };
 
 /** Stores the selection in the ScPrintFuncCache so it is only used
@@ -49,7 +49,7 @@ class ScPrintSelectionStatus
 ScPrintOptions  aOptions;
 
 public:
-ScPrintSelectionStatus() : eMode(SC_PRINTSEL_INVALID) {}
+ScPrintSelectionStatus() : eMode(ScPrintSelectionMode::Invalid) {}
 
 voidSetMode(ScPrintSelectionMode eNew)  { eMode = eNew; }
 voidSetRanges(const ScRangeList& rNew)  { aRanges = rNew; }
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 5f625839f490..0836e0e7ed7f 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1577,10 +1577,10 @@ bool ScModelObj::FillRenderMarkData( const uno::Any& 
aSelection,
 if ( bCursor || bSheet )// nothing selected -> 
use whole tables
 {
 rMark.ResetMark();  // doesn't change table selection
-rStatus.SetMode( SC_PRINTSEL_CURSOR );
+rStatus.SetMode( ScPrintSelectionMode::Cursor );
 }
 else
-rStatus.SetMode( SC_PRINTSEL_RANGE );
+rStatus.SetMode( ScPrintSelectionMode::Range );
 
 rStatus.SetRanges( rRanges );
 bDone = true;
@@ -1603,7 +1603,7 @@ bool ScModelObj::FillRenderMarkData( const uno::Any& 
aSelection,
 
 if( rMark.IsMarked() && !rMark.IsMultiMarked() )
 {
-rStatus.SetMode( 
SC_PRINTSEL_RANGE_EXCLUSIVELY_OLE_AND_DRAW_OBJECTS );
+rStatus.SetMode( 
ScPrintSelectionMode::RangeExclusivelyOleAndDrawObjects );
 bDone = true;
 }
 }
@@ -1616,7 +1616,7 @@ bool ScModelObj::FillRenderMarkData( const uno::Any& 
aSelection,
 SCTAB nTabCount = pDocShell->GetDocument().GetTableCount();
 for (SCTAB nTab = 0; nTab < nTabCount; nTab++)
 rMark.SelectTable( nTab, true );
-rStatus.SetMode( SC_PRINTSEL_DOCUMENT );
+rStatus.SetMode( ScPrintSelectionMode::Document );
 bDone = true;
 }
 // other selection types aren't supported
@@ -1744,7 +1744,7 @@ static sal_Int32 lcl_GetRendererNum( sal_Int32 
nSelRenderer, const OUString& rPa
 
 static bool lcl_renderSelectionToGraphic( bool bRenderToGraphic, const 
ScPrintSelectionStatus& rStatus )
 {
-return bRenderToGraphic && rStatus.GetMode() == SC_PRINTSEL_RANGE;
+return bRenderToGraphic && rStatus.GetMode() == 
ScPrintSelectionMode::Range;
 }
 
 uno::Sequence SAL_CALL 

[Libreoffice-commits] core.git: 2 commits - sc/source vcl/unx

2021-05-11 Thread Caolán McNamara (via logerrit)
 sc/source/filter/oox/workbookhelper.cxx |3 +++
 vcl/unx/gtk3/gtkdata.cxx|5 -
 vcl/unx/gtk3/gtkinst.cxx|2 ++
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 948066dba3556598337b3b5db75f77439627f94f
Author: Caolán McNamara 
AuthorDate: Tue May 11 12:24:48 2021 +0100
Commit: Caolán McNamara 
CommitDate: Tue May 11 14:40:34 2021 +0200

gtk4: enable svg pointer cursors

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

diff --git a/vcl/unx/gtk3/gtkdata.cxx b/vcl/unx/gtk3/gtkdata.cxx
index eb534b0d42e6..a30e4df0b853 100644
--- a/vcl/unx/gtk3/gtkdata.cxx
+++ b/vcl/unx/gtk3/gtkdata.cxx
@@ -135,12 +135,7 @@ void GtkSalDisplay::monitorsChanged( GdkScreen const * 
pScreen )
 
 GdkCursor* GtkSalDisplay::getFromSvg(OUString const & name, int nXHot, int 
nYHot)
 {
-#if !GTK_CHECK_VERSION(4, 0, 0)
 GdkPixbuf* pPixBuf = load_icon_by_name(name);
-#else
-(void)name;
-GdkPixbuf* pPixBuf = nullptr;
-#endif
 assert(pPixBuf && "missing image?");
 if (!pPixBuf)
 return nullptr;
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index b8ddee717811..3f15bf1f9fe0 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -3665,6 +3665,7 @@ namespace
 return OUString(pText, pText ? strlen(pText) : 0, 
RTL_TEXTENCODING_UTF8);
 }
 }
+#endif
 
 namespace
 {
@@ -3702,6 +3703,7 @@ GdkPixbuf* load_icon_by_name(const OUString& rIconName)
 return load_icon_by_name_theme_lang(rIconName, sIconTheme, sUILang);
 }
 
+#if !GTK_CHECK_VERSION(4, 0, 0)
 namespace
 {
 GdkPixbuf* getPixbuf(const css::uno::Reference& 
rImage)
commit 31d3f7c7e571acbce0b4da98e6a240ecdc8ea014
Author: Noel Grandin 
AuthorDate: Tue May 11 12:30:43 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue May 11 14:40:15 2021 +0200

do not leak on error path

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

diff --git a/sc/source/filter/oox/workbookhelper.cxx 
b/sc/source/filter/oox/workbookhelper.cxx
index 7adb76bcb7ef..8c7ffb3de4d8 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -370,7 +370,10 @@ ScRangeData* lcl_addNewByNameAndTokens( ScDocument& rDoc, 
ScRangeName* pNames, c
 if ( pNames->insert(pNew) )
 bDone = true;
 if (!bDone)
+{
+delete pNew;
 throw RuntimeException();
+}
 return pNew;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - sc/source sd/source svx/source sw/source

2021-04-19 Thread merttumer (via logerrit)
 sc/source/ui/view/tabvwsh2.cxx   |2 ++
 sd/source/ui/view/drviewse.cxx   |4 
 svx/source/svdraw/svddrgv.cxx|   13 +
 sw/source/uibase/uiview/viewdraw.cxx |3 +++
 4 files changed, 18 insertions(+), 4 deletions(-)

New commits:
commit 2a91d96591001c83cac56e924fc6748c7900f7e5
Author: merttumer 
AuthorDate: Wed Mar 24 12:06:08 2021 +0300
Commit: Mert Tumer 
CommitDate: Tue Apr 20 04:32:22 2021 +0200

LOK: Fix Moving drag handles calculates wrong offset

When dragging the shape handles for resizing,
the handle's grid offset must be the shapes grid
offset. In small numbered row orders, it is
not visible much since the difference is very little
but as the number gets greater, the difference becomes more visible.

Change-Id: I44d03cc67a239c8b7758206930def331ed8e5e42
Signed-off-by: merttumer 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113028
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114026
Tested-by: Jenkins

diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx
index 9807a53bd99e..6cbba5494070 100644
--- a/svx/source/svdraw/svddrgv.cxx
+++ b/svx/source/svdraw/svddrgv.cxx
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace sdr;
 
@@ -206,10 +207,12 @@ bool SdrDragView::BegDragObj(const Point& rPnt, 
OutputDevice* pOut, SdrHdl* pHdl
 
 // Coordinate maybe affected by GridOffset, so we may need to
 // adapt to Model-coordinates here
-if(getPossibleGridOffsetForPosition(
+if((comphelper::LibreOfficeKit::isActive() && mpMarkedObj
+&& getPossibleGridOffsetForSdrObject(aGridOffset, 
GetMarkedObjectByIndex(0), GetSdrPageView()))
+|| (getPossibleGridOffsetForPosition(
 aGridOffset,
 basegfx::B2DPoint(aPnt.X(), aPnt.Y()),
-GetSdrPageView()))
+GetSdrPageView(
 {
 aPnt.AdjustX(basegfx::fround(-aGridOffset.getX()));
 aPnt.AdjustY(basegfx::fround(-aGridOffset.getY()));
@@ -508,10 +511,12 @@ void SdrDragView::MovDragObj(const Point& rPnt)
 
 // Coordinate maybe affected by GridOffset, so we may need to
 // adapt to Model-coordinates here
-if(getPossibleGridOffsetForPosition(
+if((comphelper::LibreOfficeKit::isActive() && mpMarkedObj
+&& getPossibleGridOffsetForSdrObject(aGridOffset, 
GetMarkedObjectByIndex(0), GetSdrPageView()))
+|| (getPossibleGridOffsetForPosition(
 aGridOffset,
 basegfx::B2DPoint(aPnt.X(), aPnt.Y()),
-GetSdrPageView()))
+GetSdrPageView(
 {
 aPnt.AdjustX(basegfx::fround(-aGridOffset.getX()));
 aPnt.AdjustY(basegfx::fround(-aGridOffset.getY()));
commit c853d446a7cd8a8436cb5f43bbf81a723bd86c99
Author: merttumer 
AuthorDate: Fri Mar 19 12:31:42 2021 +0300
Commit: Mert Tumer 
CommitDate: Tue Apr 20 04:32:00 2021 +0200

Fix Line and Connectors enable interactive drawing

We add them directly for LOK case and have no functionality
for interactive drawing.

Noticed that in Writer we didnt even add them directly
I also implemented that as well.

Change-Id: If90bfc8d2cdf84f200bc7963ae4126ef789524ff
Signed-off-by: merttumer 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112703
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Jan Holesovsky 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114025
Tested-by: Jenkins

diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx
index f213c5b822ef..652482ec5d6f 100644
--- a/sc/source/ui/view/tabvwsh2.cxx
+++ b/sc/source/ui/view/tabvwsh2.cxx
@@ -231,6 +231,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
 case SID_DRAW_ELLIPSE:
 case SID_DRAW_MEASURELINE:
 pTabView->SetDrawFuncPtr(new FuConstRectangle(*this, pWin, pView, 
pDoc, aNewReq));
+bCreateDirectly = comphelper::LibreOfficeKit::isActive();
 break;
 
 case SID_DRAW_CAPTION:
@@ -332,6 +333,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
 }
 else
 {
+GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, 
SfxCallMode::ASYNCHRON);
 ScViewData& rViewData = GetViewData();
 aInsertPos = rViewData.getLOKVisibleArea().Center();
 if (comphelper::LibreOfficeKit::isCompatFlagSet(
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index b833b1d3b719..2247294cfaba 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -605,6 +605,10 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
 if(!(HasCurrentFunction() && ((rReq.GetModifier() & KEY_MOD1) || 
bCreateDirectly)))
 return;
 
+// disable interactive drawing for LOK
+if (bCreateDirectly)
+

  1   2   3   4   5   >