core.git: sw/source

2024-11-07 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/uno/unotxdoc.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 0fe2b2545da977cd462c06e2a6ec6551b9903497
Author: Caolán McNamara 
AuthorDate: Thu Nov 7 11:57:14 2024 +
Commit: Caolán McNamara 
CommitDate: Thu Nov 7 17:15:55 2024 +0100

don't deref null m_pDocShell

in the case of a failed load m_pDocShell is null and continuing
is pointless.

 #0  0x7efca0f0b157 in SwDocShell::GetView (this=0x0) at 
sw/inc/docsh.hxx:223
 #1  SwXTextDocument::getViewRenderState(SfxViewShell*) () at 
sw/source/uibase/uno/unotxdoc.cxx:3448
 #2  0x7efcaec1d252 in doc_getCommandValues () at 
/opt/rh/devtoolset-12/root/usr/include/c++/12/bits/allocator.h:174
 #3  0x005d8195 in lok::Document::getCommandValues 
(pCommand=0xb1ba39 ".uno:ViewRenderState", this=)
 at include/LibreOfficeKit/LibreOfficeKit.hxx:492
 #4  Document::load(std::shared_ptr const&, std::string 
const&) () at kit/Kit.cpp:2012
 #5  0x005da582 in Document::onLoad(std::string const&, std::string 
const&, std::string const&) () at kit/Kit.cpp:1227

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

diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 794c88a463cd..c818997ca28f 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3556,6 +3556,9 @@ SwXTextDocument::getSearchResultRectangles(const char* 
pPayload)
 
 OString SwXTextDocument::getViewRenderState(SfxViewShell* pViewShell)
 {
+if (!m_pDocShell)
+return OString();
+
 OStringBuffer aState;
 SwView* pView = pViewShell ? dynamic_cast(pViewShell) : 
m_pDocShell->GetView();
 if (pView && pView->GetWrtShellPtr())


core.git: sw/source

2024-11-06 Thread Miklos Vajna (via logerrit)
 sw/source/uibase/docvw/edtwin.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit bb51c57fd515bd2b2a9d97aa9a371901a3af8092
Author: Miklos Vajna 
AuthorDate: Wed Nov 6 08:24:26 2024 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 6 12:32:48 2024 +0100

sw lok: async readonly dialog when pressing delete key on protected content

Open online.git/test/samples/writer.fodt, ctrl-a, del, the read-only
dialog is blocking.

This was working already for the character insert case, but not when going
via KEY_DELETE.

Fix the problem similar to what commit
0c03a97fb8844ad0de1abea79b5265617a509460 (sw edit win: fix read-only
selections while handling ExtTextInput, 2021-01-13) did, by switching to
the async path here.

There doesn't seem to be any reason for the old sync behavior, other
than the safe "keep things unchanged" default in InfoReadOnlyDialog().

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

diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index 0b5c7828600a..520f2951bddb 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -1967,7 +1967,7 @@ KEYINPUT_CHECKTABLE_INSDEL:
 }
 else if (!rSh.IsCursorInParagraphMetadataField())
 {
-rSh.InfoReadOnlyDialog(false);
+rSh.InfoReadOnlyDialog(/*bAsync=*/true);
 eKeyState = SwKeyState::End;
 }
 break;


core.git: sw/source

2024-11-06 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/dochdl/gloshdl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9a96f11eb0a8e439166df88e01b75d8248d5ebfd
Author: Caolán McNamara 
AuthorDate: Sat Nov 2 15:55:14 2024 +
Commit: Caolán McNamara 
CommitDate: Wed Nov 6 16:17:32 2024 +0100

make the autotext shortcut warning dialog async

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

diff --git a/sw/source/uibase/dochdl/gloshdl.cxx 
b/sw/source/uibase/dochdl/gloshdl.cxx
index 7706bf899b80..f6866e4b38a3 100644
--- a/sw/source/uibase/dochdl/gloshdl.cxx
+++ b/sw/source/uibase/dochdl/gloshdl.cxx
@@ -476,10 +476,10 @@ bool SwGlossaryHdl::Expand(weld::Window* pParent, const 
OUString& rShortName,
 }
 OUString aTmp( SwResId(STR_NOGLOS));
 aTmp = aTmp.replaceFirst("%1", aShortName);
-std::unique_ptr 
xInfoBox(Application::CreateMessageDialog(m_pWrtShell->GetView().GetFrameWeld(),
+std::shared_ptr 
xInfoBox(Application::CreateMessageDialog(m_pWrtShell->GetView().GetFrameWeld(),
   
VclMessageType::Info, VclButtonsType::Ok,
   aTmp));
-xInfoBox->run();
+xInfoBox->runAsync(xInfoBox, [] (sal_uInt32){ });
 }
 
 return false;


core.git: sw/source

2024-11-04 Thread Bogdan Buzea (via logerrit)
 sw/source/core/fields/reffld.cxx |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

New commits:
commit 9e3803ae438ddcf91ec0e15431be379561d28ba6
Author: Bogdan Buzea 
AuthorDate: Mon Oct 21 17:29:49 2024 +0200
Commit: David Gilbert 
CommitDate: Mon Nov 4 22:51:37 2024 +0100

tdf#163486: PVS: Identical branches

V1037 Two or more case-branches perform the same actions. Check lines: 609, 
637

Change-Id: I4376e86a5484886025152a9a407b23b3d05c3911
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175355
Tested-by: Jenkins
Reviewed-by: David Gilbert 

diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 8ca0cce869e1..e994dabfab17 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -606,6 +606,7 @@ void SwGetRefField::UpdateField(const SwTextField* 
pFieldTextAttr, SwFrame* pFra
 break;
 
 case REF_OUTLINE:
+case REF_SETREFATTR:
 nStart = nNumStart;
 nEnd = nNumEnd;
 break;
@@ -633,11 +634,6 @@ void SwGetRefField::UpdateField(const SwTextField* 
pFieldTextAttr, SwFrame* pFra
 nEnd = nLen;
 break;
 
-case REF_SETREFATTR:
-nStart = nNumStart;
-nEnd = nNumEnd;
-break;
-
 default:
 O3TL_UNREACHABLE;
 }


core.git: sw/source

2024-11-04 Thread Bogdan Buzea (via logerrit)
 sw/source/writerfilter/dmapper/NumberingManager.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit f0d1b3a0a3708864cdea1c04e90f666984b28575
Author: Bogdan Buzea 
AuthorDate: Mon Oct 21 11:39:11 2024 +0200
Commit: David Gilbert 
CommitDate: Mon Nov 4 22:48:27 2024 +0100

tdf#163486: PVS: Identical branches

V1037 Two or more case-branches perform the same actions. Check lines: 764, 
767

Change-Id: Ia8da107d28249132b92e7cf533505b09c0037188
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175310
Tested-by: Jenkins
Reviewed-by: David Gilbert 

diff --git a/sw/source/writerfilter/dmapper/NumberingManager.cxx 
b/sw/source/writerfilter/dmapper/NumberingManager.cxx
index 576a0caa4cce..d5d81d47b94b 100644
--- a/sw/source/writerfilter/dmapper/NumberingManager.cxx
+++ b/sw/source/writerfilter/dmapper/NumberingManager.cxx
@@ -760,10 +760,8 @@ void ListsManager::lcl_attribute( Id nName, const Value& 
rVal )
 AbstractListDef::SetValue( nName );
 break;
 case NS_ooxml::LN_CT_NumLvl_ilvl:
-//add a new level to the level vector and make it the current one
-m_pCurrentDefinition->AddLevel(rVal.getString().toUInt32());
-break;
 case NS_ooxml::LN_CT_Lvl_ilvl:
+//add a new level to the level vector and make it the current one
 m_pCurrentDefinition->AddLevel(rVal.getString().toUInt32());
 break;
 case NS_ooxml::LN_CT_AbstractNum_abstractNumId:


core.git: sw/source

2024-11-04 Thread Bogdan Buzea (via logerrit)
 sw/source/ui/fldui/fldvar.cxx |9 -
 1 file changed, 9 deletions(-)

New commits:
commit 22297112c55bc907a8f0b798e0fc7fd5812567c0
Author: Bogdan Buzea 
AuthorDate: Mon Oct 21 11:37:00 2024 +0200
Commit: David Gilbert 
CommitDate: Mon Nov 4 22:43:09 2024 +0100

tdf#163486: PVS: Identical branches

V1037 Two or more case-branches perform the same actions. Check lines: 767, 
777

Change-Id: Ie9a6d6376f5037ee075c95e62c2c7970b720e9a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175309
Tested-by: Jenkins
Reviewed-by: David Gilbert 

diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx
index 6b2bb3eb7c5b..52c045b9af7d 100644
--- a/sw/source/ui/fldui/fldvar.cxx
+++ b/sw/source/ui/fldui/fldvar.cxx
@@ -763,15 +763,6 @@ void SwFieldVarPage::FillFormatLB(SwFieldTypesEnum nTypeId)
 break;
 
 case SwFieldTypesEnum::Formel:
-{
-OUString sId(OUString::number(NUMBERFORMAT_ENTRY_NOT_FOUND));
-int nOldIndex = rWidget.get_selected_index();
-rWidget.insert(0, SwResId(FMT_GETVAR_NAME), &sId, nullptr, 
nullptr);
-if (nOldIndex != -1)
-rWidget.select(nOldIndex + 1);
-}
-break;
-
 case SwFieldTypesEnum::Get:
 {
 OUString sId(OUString::number(NUMBERFORMAT_ENTRY_NOT_FOUND));


core.git: sw/source

2024-11-04 Thread Ilmari Lauhakangas (via logerrit)
 sw/source/uibase/shells/textsh1.cxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit 182140d53ac767f5f31aefb2f00ac1f812245703
Author: Ilmari Lauhakangas 
AuthorDate: Mon Nov 4 16:17:44 2024 +0200
Commit: Ilmari Lauhakangas 
CommitDate: Mon Nov 4 16:28:51 2024 +0100

Remove commented out includes

Change-Id: I7aed7953f8d101f145a4267168c90623022677f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176012
Tested-by: Jenkins
Reviewed-by: Ilmari Lauhakangas 

diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index c770415f4a28..8942e812fd29 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -150,9 +150,6 @@
 #include 
 #include 
 
-//#include <../../../../chart2/source/controller/inc/ChartController.hxx>
-//#include 
-
 using namespace ::com::sun::star;
 using namespace com::sun::star::beans;
 using namespace ::com::sun::star::container;


core.git: sw/source

2024-11-03 Thread Bogdan Buzea (via logerrit)
 sw/source/filter/ww8/ww8par3.cxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit dce64cc7cfd5f696ef0c030524558306687ae3c7
Author: Bogdan Buzea 
AuthorDate: Sun Oct 20 20:42:16 2024 +0200
Commit: Noel Grandin 
CommitDate: Mon Nov 4 07:06:55 2024 +0100

tdf#163486: PVS: Identical branches

V1037 Two or more case-branches perform the same actions. Check lines: 883, 
893

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

diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 354f32ac4f86..41604594f92e 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -880,6 +880,7 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, 
std::unique_ptr

core.git: sw/source

2024-11-03 Thread Bogdan Buzea (via logerrit)
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   22 +--
 1 file changed, 2 insertions(+), 20 deletions(-)

New commits:
commit 937167cbc30f7f9b26e444eb03bc7dbda0464ff9
Author: Bogdan Buzea 
AuthorDate: Mon Oct 21 08:17:46 2024 +0200
Commit: David Gilbert 
CommitDate: Sun Nov 3 13:18:56 2024 +0100

tdf#163486: PVS: Identical branches

V1037 Two or more case-branches perform the same actions. Check lines: 
8172, 8405, 8484

Change-Id: I85ff9c6258fc855323c1ee814b981b3453db7651
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175275
Reviewed-by: David Gilbert 
Tested-by: Jenkins

diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index c2b4e3782d36..4503f6ef5273 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -8161,6 +8161,8 @@ void DomainMapper_Impl::CloseFieldCommand()
 case FIELD_INFO : break;
 case FIELD_INCLUDEPICTURE: break;
 case FIELD_KEYWORDS :
+case FIELD_SUBJECT  :
+case FIELD_TITLE:
 {
 if (!sFirstParam.isEmpty())
 {
@@ -8393,16 +8395,6 @@ void DomainMapper_Impl::CloseFieldCommand()
 handleFieldSet(pContext, xFieldInterface);
 break;
 case FIELD_SKIPIF   : break;
-case FIELD_SUBJECT  :
-{
-if (!sFirstParam.isEmpty())
-{
-xFieldInterface->setPropertyValue(
-getPropertyName( PROP_IS_FIXED ), uno::Any( 
true ));
-//PROP_CURRENT_PRESENTATION is set later anyway
-}
-}
-break;
 case FIELD_SYMBOL:
 {
 FieldContextPtr pOuter = 
GetParentFieldContext(m_aFieldStack);
@@ -8472,16 +8464,6 @@ void DomainMapper_Impl::CloseFieldCommand()
 SetNumberFormat( pContext->GetCommand(), xFieldInterface );
 }
 break;
-case FIELD_TITLE:
-{
-if (!sFirstParam.isEmpty())
-{
-xFieldInterface->setPropertyValue(
-getPropertyName( PROP_IS_FIXED ), uno::Any( 
true ));
-//PROP_CURRENT_PRESENTATION is set later anyway
-}
-}
-break;
 case FIELD_USERADDRESS  : //todo: user address collects 
street, city ...
 break;
 case FIELD_INDEX:


core.git: sw/source

2024-11-02 Thread Justin Luth (via logerrit)
 sw/source/writerfilter/dmapper/PropertyMap.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit c8cfe6822f148d6f4ac545a9c66f17c4bcb1d9a3
Author: Justin Luth 
AuthorDate: Sat Nov 2 19:22:13 2024 -0400
Commit: Justin Luth 
CommitDate: Sun Nov 3 01:40:15 2024 +0100

tdf#161349 writerfilter: only copy page background vml fill

This fixes my 24.8 regression.

I had this clause in earlier versions of the patchset,
but it moved along with most of the other logic
to the initialization of the default page style.

However, I certainly need to limit copying the properties
of the default page style to ONLY the fill properties here as well.

Change-Id: I168f13ebeea3720eba53703210314f069fb87ae2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175963
Reviewed-by: Justin Luth 
Tested-by: Jenkins

diff --git a/sw/source/writerfilter/dmapper/PropertyMap.cxx 
b/sw/source/writerfilter/dmapper/PropertyMap.cxx
index 04b773164d92..447999e0a908 100644
--- a/sw/source/writerfilter/dmapper/PropertyMap.cxx
+++ b/sw/source/writerfilter/dmapper/PropertyMap.cxx
@@ -1206,6 +1206,8 @@ void 
SectionPropertyMap::HandleMarginsHeaderFooter(DomainMapper_Impl& rDM_Impl)
 rDM_Impl.GetPageStyles()->getStyleByName(u"Standard"_ustr);
 for (const beans::Property& rProp : 
m_aPageStyle->getPropertySetInfo()->getProperties())
 {
+if (!rProp.Name.startsWith("Fill")) // only copy XATTR_FILL 
properties
+continue;
 try
 {
 const uno::Any aFillValue = 
xDefaultPageStyle->getPropertyValue(rProp.Name);


core.git: sw/source

2024-11-02 Thread Caolán McNamara (via logerrit)
 sw/source/filter/ww8/docxattributeoutput.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 5e9cfad321b55a431fcfeaaa444322b6034e39a8
Author: Caolán McNamara 
AuthorDate: Fri Nov 1 19:57:43 2024 +
Commit: Caolán McNamara 
CommitDate: Sat Nov 2 16:31:25 2024 +0100

cid#1494598 Uninitialized scalar field

since:

commit d87cf67f8f3346a1e380383917a3a4552fd9248e
CommitDate: Wed Oct 23 18:26:07 2024 +0200

tdf#131728 sw inline heading: fix missing/broken DOCX export

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

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index ff0e00475cf6..24ceb1a6e0f4 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -10378,7 +10378,8 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport 
&rExport, const FSHelperPtr
   m_bParaBeforeAutoSpacing(false),
   m_bParaAfterAutoSpacing(false),
   m_nParaBeforeSpacing(0),
-  m_nParaAfterSpacing(0)
+  m_nParaAfterSpacing(0),
+  m_bParaInlineHeading(false)
 , m_nStateOfFlyFrame( FLY_NOT_PROCESSED )
 {
 m_nHyperLinkCount.push_back(0);


core.git: sw/source

2024-11-02 Thread Adesola Samuel (via logerrit)
 sw/source/uibase/shells/textsh1.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 9b2c470c317fcf3cb248c4fffbbe21f4311205b2
Author: Adesola Samuel 
AuthorDate: Fri Nov 1 23:44:53 2024 +0100
Commit: Ilmari Lauhakangas 
CommitDate: Sat Nov 2 16:26:28 2024 +0100

tdf#145538 Use range based for loop in textsh1.cxx

Change-Id: I6e902b6947a27fe234d321ed3055dd0f867138a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175940
Reviewed-by: Ilmari Lauhakangas 
Tested-by: Jenkins

diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index 0480aeaf2b20..78ae5f81ebcd 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -525,9 +525,8 @@ void DeleteSections(SfxRequest& rReq, SwWrtShell& rWrtSh)
 SwDoc* pDoc = rWrtSh.GetDoc();
 SwSectionFormats& rFormats = pDoc->GetSections();
 std::vector aRemovals;
-for (size_t i = 0; i < rFormats.size(); ++i)
+for (SwSectionFormat* pFormat : rFormats)
 {
-SwSectionFormat* pFormat = rFormats[i];
 
 if (!aSectionNamePrefix.isEmpty())
 {


core.git: sw/source

2024-11-02 Thread Mike Kaganski (via logerrit)
 sw/source/core/layout/sectfrm.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 35dbbcefb2a31c211a879eb7d5cdd267dd763ccc
Author: Mike Kaganski 
AuthorDate: Sat Nov 2 14:23:34 2024 +0500
Commit: Mike Kaganski 
CommitDate: Sat Nov 2 11:40:58 2024 +0100

Fix unchecked dereference

After commit 0c96119895b347f8eb5bb89f393351bd3c02b9f1
("tdf#159565 prerequisite: make hidden sections have
zero-height frames", 2024-02-15).

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

diff --git a/sw/source/core/layout/sectfrm.cxx 
b/sw/source/core/layout/sectfrm.cxx
index 92d1e1bde1b5..11245f084a92 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2252,7 +2252,8 @@ bool SwSectionFrame::Growable() const
 
 SwTwips SwSectionFrame::Grow_(SwTwips nDist, SwResizeLimitReason& reason, bool 
bTst)
 {
-if (GetSection()->CalcHiddenFlag())
+SwSection* pSection = GetSection();
+if (pSection && pSection->CalcHiddenFlag())
 {
 reason = SwResizeLimitReason::Unspecified;
 return 0;
@@ -2279,7 +2280,6 @@ SwTwips SwSectionFrame::Grow_(SwTwips nDist, 
SwResizeLimitReason& reason, bool b
 bool bGrow = !Lower() || !Lower()->IsColumnFrame() || !Lower()->GetNext();
 if (!bGrow)
 {
-SwSection* pSection = GetSection();
 bGrow = pSection && 
pSection->GetFormat()->GetBalancedColumns().GetValue();
 if (!bGrow && nOrigDist)
 reason = SwResizeLimitReason::BalancedColumns;


core.git: sw/source

2024-11-01 Thread Noel Grandin (via logerrit)
 sw/source/core/txtnode/fntcache.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit f48198c5f35113f1a68e18ae100e129932928157
Author: Noel Grandin 
AuthorDate: Thu Oct 31 15:01:54 2024 +0200
Commit: Noel Grandin 
CommitDate: Fri Nov 1 12:52:06 2024 +0100

use double in SwFntObj::DrawText

after
  commit 11b15571475414ef853e21a6c96afa2ac81f848f
  "convert KernArray from sal_Int32 to double"

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

diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index 9d8b678b9681..740c419a7d25 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1117,7 +1117,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
 
 // Modify Array for special justifications
 
-tools::Long nSpaceAdd = rInf.GetSpace() / SPACING_PRECISION_FACTOR;
+double nSpaceAdd = rInf.GetSpace() / 
double(SPACING_PRECISION_FACTOR);
 bool bSpecialJust = false;
 
 if ( rInf.GetFont() && rInf.GetLen() )
@@ -1193,7 +1193,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
 }
 }
 
-tools::Long nKernSum = rInf.GetKern();
+double nKernSum = rInf.GetKern();
 
 if ( bStretch || m_bPaintBlank || rInf.GetKern() || bSpecialJust )
 {


core.git: sw/source

2024-10-31 Thread Bogdan Buzea (via logerrit)
 sw/source/filter/html/css1atr.cxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 42ee2dfc4065f92879d490bf9b3ad34e9564c0f3
Author: Bogdan Buzea 
AuthorDate: Mon Oct 21 16:12:18 2024 +0200
Commit: David Gilbert 
CommitDate: Fri Nov 1 02:01:40 2024 +0100

tdf#163486: PVS: Identical branches

V1037 Two or more case-branches perform the same actions. Check lines: 736, 
796

Change-Id: I612647fcf1f5ebb86c36373501b505b503a8fef7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175317
Tested-by: Jenkins
Reviewed-by: David Gilbert 

diff --git a/sw/source/filter/html/css1atr.cxx 
b/sw/source/filter/html/css1atr.cxx
index a0191f4e50ef..447e63351bd3 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -733,6 +733,8 @@ sal_uInt16 SwHTMLWriter::GetCSS1Selector( const SwFormat 
*pFormat, OString& rTok
 case RES_POOLCOLL_HEADLINE_BASE:
 case RES_POOLCOLL_STANDARD:
 // do not export this template
+case RES_POOLCOLL_HTML_HR:
+// do not export HR !
 bStop = (nDeep==0);
 break;
 case RES_POOLCOLL_TEXT:
@@ -791,10 +793,6 @@ sal_uInt16 SwHTMLWriter::GetCSS1Selector( const SwFormat 
*pFormat, OString& rTok
 else
 rToken = OOO_STRING_SVTOOLS_HTML_parabreak ""_ostr;
 break;
-case RES_POOLCOLL_HTML_HR:
-// do not export HR !
-bStop = (nDeep==0);
-break;
 case RES_POOLCOLL_FOOTNOTE:
 if( !nDeep )
 {


core.git: sw/source

2024-10-31 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/shells/textglos.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 8328c69858e7be8dbf82a8ec66948a3e1534a852
Author: Caolán McNamara 
AuthorDate: Wed Oct 30 12:20:02 2024 +
Commit: Caolán McNamara 
CommitDate: Thu Oct 31 09:24:42 2024 +0100

merge these lines

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

diff --git a/sw/source/uibase/shells/textglos.cxx 
b/sw/source/uibase/shells/textglos.cxx
index 7faa1aa58081..6d9bb08028a6 100644
--- a/sw/source/uibase/shells/textglos.cxx
+++ b/sw/source/uibase/shells/textglos.cxx
@@ -53,8 +53,7 @@ void SwTextShell::ExecGlossary(SfxRequest &rReq)
 break;
 case FN_EXPAND_GLOSSARY:
 {
-bool bReturn;
-bReturn = pGlosHdl->ExpandGlossary(rReq.GetFrameWeld());
+bool bReturn = pGlosHdl->ExpandGlossary(rReq.GetFrameWeld());
 rReq.SetReturnValue( SfxBoolItem( nSlot, bReturn ) );
 rReq.Done();
 }


core.git: sw/source

2024-10-31 Thread Heiko Tietze (via logerrit)
 sw/source/core/layout/paintfrm.cxx |   19 ++-
 1 file changed, 6 insertions(+), 13 deletions(-)

New commits:
commit 1a5b1552d8cee042466fc4c4ae5383c0ffbeb194
Author: Heiko Tietze 
AuthorDate: Wed Oct 30 16:59:51 2024 +0100
Commit: Heiko Tietze 
CommitDate: Thu Oct 31 16:14:56 2024 +0100

Resolves tdf#163537 && tdf#131253 - Make Boundaries independent from NPC

Sections and Objects are now toggled on/off independently from Text 
Boundaries. Both, single and multi-column sections receive a frame 
(multi-column in addition one for text boundaries).

Partially resolves 5bf7df62645f73ad69772f318ea3058dfd6fce12ommit.

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

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index a69ebc64ff4a..9c3fcf77eec8 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7099,9 +7099,10 @@ void SwPageFrame::RefreshSubsidiary( const SwRect &rRect 
) const
 void SwLayoutFrame::RefreshLaySubsidiary( const SwPageFrame *pPage,
 const SwRect &rRect ) const
 {
-const bool bSubsOpt
-= isSubsidiaryLinesEnabled() || (IsSctFrame() && 
isSubsidiaryLinesForSectionsEnabled());
-if ( bSubsOpt )
+const bool bSubsOpt = isSubsidiaryLinesEnabled()
+  || (IsSctFrame() && 
isSubsidiaryLinesForSectionsEnabled())
+  || (IsFlyFrame() && isSubsidiaryLinesFlysEnabled());
+if (bSubsOpt)
 PaintSubsidiaryLines( pPage, rRect );
 
 const SwFrame *pLow = Lower();
@@ -7482,11 +7483,7 @@ void SwSectionFrame::PaintSubsidiaryLines( const 
SwPageFrame * pPage,
 if (!gProp.pSGlobalShell->GetViewOptions()->IsSectionBoundaries())
 return;
 
-const bool bNoLowerColumn = !Lower() || !Lower()->IsColumnFrame();
-if ( bNoLowerColumn )
-{
-SwLayoutFrame::PaintSubsidiaryLines( pPage, rRect );
-}
+SwLayoutFrame::PaintSubsidiaryLines( pPage, rRect );
 }
 
 /**
@@ -7578,11 +7575,7 @@ void SwLayoutFrame::PaintSubsidiaryLines( const 
SwPageFrame *pPage,
 
 if (!bCell && IsFlyFrame())
 {
-// particularly with images (but also plausible for any kind of frame),
-// it is very disconcerting to see a fake border,
-// so (just like the page boundary) only show fly "text boundaries"
-// when "Show Formatting Marks" is turned on
-if (!gProp.pSGlobalShell->GetViewOptions()->IsViewMetaChars())
+if (!gProp.pSGlobalShell->GetViewOptions()->IsObjectBoundaries())
 return;
 
 // if the frame is wrap none or wrap through, then text boundary lines 
have no meaning


core.git: sw/source

2024-10-31 Thread Caolán McNamara (via logerrit)
 sw/source/core/doc/doc.cxx |   11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

New commits:
commit 011d5bbd068f00c9477b1fd68e8ba297d4e6998a
Author: Caolán McNamara 
AuthorDate: Sun Oct 27 17:47:11 2024 +
Commit: Caolán McNamara 
CommitDate: Thu Oct 31 09:24:27 2024 +0100

cid#1607883 Overflowed constant

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

diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index e19cfa10dc71..c70929b65953 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -999,15 +999,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting(
 // just one page is special ...
 if ( 1 == aVec.size() )
 {
-#if defined __GNUC__ && !defined __clang__ && __GNUC__ <= 14 && __cplusplus == 
202002L
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Warray-bounds"
-#pragma GCC diagnostic ignored "-Wstringop-overflow"
-#endif
-aVec.insert( aVec.begin() + 1, nullptr ); // insert a second empty page
-#if defined __GNUC__ && !defined __clang__ && __GNUC__ <= 14 && __cplusplus == 
202002L
-#pragma GCC diagnostic pop
-#endif
+aVec.push_back( nullptr ); // insert a second empty page
 }
 else
 {
@@ -1021,6 +1013,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting(
 // make sure that all pages are in correct order
 std::vector< const SwPageFrame * >::size_type nSPg = 0;
 std::vector< const SwPageFrame * >::size_type nEPg = aVec.size();
+assert(nEPg >= 2);
 sal_Int32 nStep = 1;
 if ( 0 == (nEPg & 1 ))  // there are no uneven ones!
 --nEPg;


core.git: sw/source

2024-10-30 Thread Pranam Lashkari (via logerrit)
 sw/source/uibase/docvw/PostItMgr.cxx |  337 +--
 1 file changed, 168 insertions(+), 169 deletions(-)

New commits:
commit ce4ae4f082d8fe80da242836c57d55a456eac5e0
Author: Pranam Lashkari 
AuthorDate: Wed Oct 30 05:11:49 2024 +0530
Commit: Pranam Lashkari 
CommitDate: Wed Oct 30 21:34:31 2024 +0100

sw: redline changes may try to set broadcast on non PostIt fields

broadcast was set from sw::UpdateFramesForRemoveDeleteRedline
which triggered SwPostItMgr::Notify
in that case SwFormatFieldHintWhich::INSERTED may have pField which maybe 
different from SwPostIt

fixed regression from 0b7a9c231f66b5c2659ab3aa6a0f3c7991b9e721

problem:(in LOK)
with tracked changed on delete a merge field
then reject the changes
LOK will crash

Change-Id: Ic1fafa1408d7a238133f5b3d18bf948d539aa991
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175808
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175833
Reviewed-by: Pranam Lashkari 
Tested-by: Jenkins

diff --git a/sw/source/uibase/docvw/PostItMgr.cxx 
b/sw/source/uibase/docvw/PostItMgr.cxx
index 447731267b40..bf1b56082fba 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -196,6 +196,171 @@ namespace {
 }
 }
 
+class FilterFunctor
+{
+public:
+virtual bool operator()(const SwFormatField* pField) const = 0;
+virtual ~FilterFunctor() {}
+};
+
+class IsPostitField : public FilterFunctor
+{
+public:
+bool operator()(const SwFormatField* pField) const override
+{
+return pField->GetField()->GetTyp()->Which() == SwFieldIds::Postit;
+}
+};
+
+class IsPostitFieldWithAuthorOf : public FilterFunctor
+{
+OUString m_sAuthor;
+public:
+explicit IsPostitFieldWithAuthorOf(OUString aAuthor)
+: m_sAuthor(std::move(aAuthor))
+{
+}
+bool operator()(const SwFormatField* pField) const override
+{
+if (pField->GetField()->GetTyp()->Which() != SwFieldIds::Postit)
+return false;
+return static_cast(pField->GetField())->GetPar1() == m_sAuthor;
+}
+};
+
+class IsPostitFieldWithPostitId : public FilterFunctor
+{
+sal_uInt32 m_nPostItId;
+public:
+explicit IsPostitFieldWithPostitId(sal_uInt32 nPostItId)
+: m_nPostItId(nPostItId)
+{}
+
+bool operator()(const SwFormatField* pField) const override
+{
+if (pField->GetField()->GetTyp()->Which() != SwFieldIds::Postit)
+return false;
+return static_cast(pField->GetField())->GetPostItId() == m_nPostItId;
+}
+};
+
+class IsFieldNotDeleted : public FilterFunctor
+{
+private:
+IDocumentRedlineAccess const& m_rIDRA;
+FilterFunctor const& m_rNext;
+
+public:
+IsFieldNotDeleted(IDocumentRedlineAccess const& rIDRA,
+const FilterFunctor & rNext)
+: m_rIDRA(rIDRA)
+, m_rNext(rNext)
+{
+}
+bool operator()(const SwFormatField* pField) const override
+{
+if (!m_rNext(pField))
+return false;
+if (!pField->GetTextField())
+return false;
+return !sw::IsFieldDeletedInModel(m_rIDRA, 
*pField->GetTextField());
+}
+};
+
+//Manages the passed in vector by automatically removing entries if they 
are deleted
+//and automatically adding entries if they appear in the document and 
match the
+//functor.
+//
+//This will completely refill in the case of a "anonymous" NULL pField 
stating
+//rather unhelpfully that "something changed" so you may process the same
+//Fields more than once.
+class FieldDocWatchingStack : public SfxListener
+{
+std::vector>& m_aSidebarItems;
+std::vector m_aFormatFields;
+SwDocShell& m_rDocShell;
+FilterFunctor& m_rFilter;
+
+virtual void Notify(SfxBroadcaster&, const SfxHint& rHint) override
+{
+if ( rHint.GetId() != SfxHintId::SwFormatField )
+return;
+const SwFormatFieldHint* pHint = static_cast(&rHint);
+
+bool bAllInvalidated = false;
+if (pHint->Which() == SwFormatFieldHintWhich::REMOVED)
+{
+const SwFormatField* pField = pHint->GetField();
+bAllInvalidated = pField == nullptr;
+if (!bAllInvalidated && m_rFilter(pField))
+{
+EndListening(const_cast(*pField));
+std::erase(m_aFormatFields, pField);
+}
+}
+else if (pHint->Which() == SwFormatFieldHintWhich::INSERTED)
+{
+co

core.git: sw/source

2024-10-30 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/wrtsh/wrtsh1.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 6af797a11a2f1c79303580c4d76401f0594dcc7d
Author: Caolán McNamara 
AuthorDate: Tue Oct 15 14:44:07 2024 +0100
Commit: Caolán McNamara 
CommitDate: Wed Oct 30 12:58:28 2024 +0100

We're not interested in using an empty reply

Change-Id: I6925879c83e188e892a375df5b295a48fb0f464d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174974
Tested-by: Jenkins CollaboraOffice 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 18e1f0e92aa20ba9c08ce553523f8a2cdec2e23d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175759
Tested-by: Jenkins

diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index c447eff36ca8..20e44c8a930d 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -2291,7 +2291,9 @@ void SwWrtShell::InsertPostIt(SwFieldMgr& rFieldMgr, 
const SfxRequest& rReq)
 sText = GetView().GetPostItMgr()->GetAnswerText();
 pPostItMgr->RegisterAnswerText(OUString());
 }
-oTextPara = *pAnswer;
+const EditTextObject& rTextObject = pAnswer->GetTextObject();
+if (rTextObject.GetParagraphCount() != 1 || 
!rTextObject.GetText(0).isEmpty())
+oTextPara = *pAnswer;
 }
 
 if ( HasSelection() && !IsTableMode() )


core.git: sw/source

2024-10-29 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/docvw/AnnotationWin2.cxx |2 +-
 sw/source/uibase/shells/textfld.cxx   |   10 ++
 sw/source/uibase/wrtsh/wrtsh1.cxx |   29 +++--
 3 files changed, 30 insertions(+), 11 deletions(-)

New commits:
commit a9d7ac5c8f7af0051b0df1c8a298f9823cd134aa
Author: Caolán McNamara 
AuthorDate: Mon Oct 7 11:16:10 2024 +0100
Commit: Caolán McNamara 
CommitDate: Tue Oct 29 12:36:19 2024 +0100

Allow replies with rich text content from command arguments

Change-Id: I46d200048bdfef767882e94c7544f40f2e0b3c8c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174593
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 
(cherry picked from commit 3eae55420d1d8daee6efad456f651a9ff189723b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175752
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins

diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 236fc9990fb0..b3634148e7fe 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -1059,7 +1059,7 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot)
 const bool bReply = nSlot == FN_REPLY;
 // if this note is empty, it will be deleted once losing the 
focus, so no reply, but only a new note
 // will be created
-if (!mpOutliner->GetEditEngine().GetText().isEmpty())
+if (!mrMgr.IsAnswer() && 
!mpOutliner->GetEditEngine().GetText().isEmpty())
 {
 OutlinerParaObject 
aPara(GetOutlinerView()->GetEditView().CreateTextObject());
 mrMgr.RegisterAnswer(aPara);
diff --git a/sw/source/uibase/shells/textfld.cxx 
b/sw/source/uibase/shells/textfld.cxx
index 7a7e410590f7..554ccb610a7c 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -513,6 +514,15 @@ void SwTextShell::ExecField(SfxRequest &rReq)
 auto pWin = 
pMgr->GetAnnotationWin(pIdItem->GetValue().toUInt32());
 if(pWin)
 {
+if (const SvxPostItTextItem* pHtmlItem = 
rReq.GetArg(SID_ATTR_POSTIT_HTML))
+{
+SwDocShell* pDocSh = GetView().GetDocShell();
+Outliner aOutliner(&pDocSh->GetPool(), 
OutlinerMode::TextObject);
+SwPostItHelper::ImportHTML(aOutliner, 
pHtmlItem->GetValue());
+if (std::optional oPara = 
aOutliner.CreateParaObject())
+pMgr->RegisterAnswer(oPara.value());
+}
+
 OUString sText;
 if(const auto pTextItem = 
rReq.GetArg(SID_ATTR_POSTIT_TEXT))
 sText = pTextItem->GetValue();
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 50d054b86ba8..c447eff36ca8 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2272,14 +2273,25 @@ void SwWrtShell::InsertPostIt(SwFieldMgr& rFieldMgr, 
const SfxRequest& rReq)
 if ( pTextItem )
 sText = pTextItem->GetValue();
 
-const SvxPostItTextItem* pHtmlItem = 
rReq.GetArg(SID_ATTR_POSTIT_HTML);
+std::optional oTextPara;
+if (const SvxPostItTextItem* pHtmlItem = 
rReq.GetArg(SID_ATTR_POSTIT_HTML))
+{
+SwDocShell* pDocSh = GetView().GetDocShell();
+Outliner aOutliner(&pDocSh->GetPool(), OutlinerMode::TextObject);
+SwPostItHelper::ImportHTML(aOutliner, pHtmlItem->GetValue());
+oTextPara = aOutliner.CreateParaObject();
+}
 
 // If we have a text already registered for answer, use that
-if (GetView().GetPostItMgr()->IsAnswer() && 
!GetView().GetPostItMgr()->GetAnswerText().isEmpty())
+SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
+if (OutlinerParaObject* pAnswer = pPostItMgr->IsAnswer())
 {
-sText = GetView().GetPostItMgr()->GetAnswerText();
-GetView().GetPostItMgr()->RegisterAnswerText(OUString());
-pHtmlItem = nullptr;
+if (!pPostItMgr->GetAnswerText().isEmpty())
+{
+sText = GetView().GetPostItMgr()->GetAnswerText();
+pPostItMgr->RegisterAnswerText(OUString());
+}
+oTextPara = *pAnswer;
 }
 
 if ( HasSelection() && !IsTableMode() )
@@ -2341,12 +2353,9 @@ void SwWrtShell::InsertPostIt(SwFieldMgr& rFieldMgr, 
const SfxRequest& rReq)
 SwCursorShell::Left(1, SwCursorSkipMode::Chars);
 pPostIt = static_cast(rFieldMgr.GetCurField());
 

core.git: sw/source

2024-10-29 Thread Oromidayo Owolabi (via logerrit)
 sw/source/filter/html/htmlctxt.cxx   |   12 ++--
 sw/source/filter/ww8/docxattributeoutput.cxx |   70 +--
 2 files changed, 41 insertions(+), 41 deletions(-)

New commits:
commit 7d942fbff01e69d10c23c6d20d10ecc8558004f3
Author: Oromidayo Owolabi 
AuthorDate: Wed Oct 23 19:22:11 2024 +0100
Commit: Hossein 
CommitDate: Tue Oct 29 09:50:33 2024 +0100

tdf#140226 use StaticWhichCast

Replace static_casts informed by .Which() for SfxPoolItems with 
StaticWhichCasts
where appropriate in htmlctxt.cxx and docxattributeoutput.cxx

Change-Id: I0a905c9e92cf39396bab0620ed35b201f8e6a8c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175515
Reviewed-by: Hossein   
Tested-by: Jenkins

diff --git a/sw/source/filter/html/htmlctxt.cxx 
b/sw/source/filter/html/htmlctxt.cxx
index 2358b3152cb2..7dad6a6065d4 100644
--- a/sw/source/filter/html/htmlctxt.cxx
+++ b/sw/source/filter/html/htmlctxt.cxx
@@ -575,17 +575,17 @@ void SwHTMLParser::InsertAttrs( SfxItemSet &rItemSet,
 {
 case RES_MARGIN_FIRSTLINE:
 {
-pFirstLineItem = static_cast(pItem);
+pFirstLineItem = 
&(pItem->StaticWhichCast(RES_MARGIN_FIRSTLINE));
 }
 break;
 case RES_MARGIN_TEXTLEFT:
 {
-pTextLeftMargin = static_cast(pItem);
+pTextLeftMargin = 
&(pItem->StaticWhichCast(RES_MARGIN_TEXTLEFT));
 }
 break;
 case RES_MARGIN_RIGHT:
 {
-pRightMargin = static_cast(pItem);
+pRightMargin = &(pItem->StaticWhichCast(RES_MARGIN_RIGHT));
 }
 break;
 }
@@ -669,7 +669,7 @@ void SwHTMLParser::InsertAttrs( SfxItemSet &rItemSet,
 {
 sal_uInt16 nUpper = 0, nLower = 0;
 GetULSpaceFromContext( nUpper, nLower );
-SvxULSpaceItem aULSpace( *static_cast(pItem) );
+SvxULSpaceItem aULSpace( pItem->StaticWhichCast(RES_UL_SPACE) 
);
 if( !rPropInfo.m_bTopMargin )
 aULSpace.SetUpper( nUpper );
 if( !rPropInfo.m_bBottomMargin )
@@ -708,7 +708,7 @@ void SwHTMLParser::InsertAttrs( SfxItemSet &rItemSet,
 if( bCharLvl )
 {
 // Convert the Frame attribute to a Char attribute (if needed)
-SvxBrushItem aBrushItem( *static_cast(pItem) );
+SvxBrushItem aBrushItem( 
pItem->StaticWhichCast(RES_BACKGROUND) );
 aBrushItem.SetWhich( RES_CHRATR_BACKGROUND );
 
 // Set the attribute
@@ -728,7 +728,7 @@ void SwHTMLParser::InsertAttrs( SfxItemSet &rItemSet,
 case RES_BOX:
 if( bCharLvl )
 {
-SvxBoxItem aBoxItem( *static_cast(pItem) );
+SvxBoxItem aBoxItem( pItem->StaticWhichCast(RES_BOX) );
 aBoxItem.SetWhich( RES_CHRATR_BOX );
 
 NewAttr(m_xAttrTab, &m_xAttrTab->pCharBox, aBoxItem);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index de5deb897463..e5f7e071f3fe 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1569,8 +1569,8 @@ void 
lcl_writeParagraphMarkerProperties(DocxAttributeOutput& rAttributeOutput, c
 }
 else if (nWhichId == RES_TXTATR_AUTOFMT)
 {
-const SwFormatAutoFormat* pAutoFormat = static_cast(pItem);
-lcl_writeParagraphMarkerProperties(rAttributeOutput, 
*pAutoFormat->GetStyleHandle());
+const SwFormatAutoFormat pAutoFormat = 
pItem->StaticWhichCast(RES_TXTATR_AUTOFMT);
+lcl_writeParagraphMarkerProperties(rAttributeOutput, 
*pAutoFormat.GetStyleHandle());
 }
 }
 nWhichId = aIter.NextWhich();
@@ -4957,53 +4957,53 @@ void DocxAttributeOutput::OutputDefaultItem(const 
SfxPoolItem& rHt)
 switch (rHt.Which())
 {
 case RES_CHRATR_CASEMAP:
-bMustWrite = static_cast< const SvxCaseMapItem& 
>(rHt).GetCaseMap() != SvxCaseMap::NotMapped;
+bMustWrite = rHt.StaticWhichCast(RES_CHRATR_CASEMAP).GetCaseMap() 
!= SvxCaseMap::NotMapped;
 break;
 case RES_CHRATR_COLOR:
-bMustWrite = static_cast< const SvxColorItem& >(rHt).GetValue() != 
COL_AUTO;
+bMustWrite = rHt.StaticWhichCast(RES_CHRATR_COLOR).GetValue() != 
COL_AUTO;
 break;
 case RES_CHRATR_CONTOUR:
-bMustWrite = static_cast< const SvxContourItem& >(rHt).GetValue();
+bMustWrite = rHt.StaticWhichCast(RES_CHRATR_CONTOUR).GetValue();
 break;
 case RES_CHRATR_CROSSEDOUT:
-bMustWrite = static_cast< const SvxCrossedOutItem& 
>(rHt).GetStrikeout() != STRIKEOUT_NONE;
+bMustWrite = 
rHt.StaticWhichCast(RES_CHRATR_CR

core.git: sw/source

2024-10-28 Thread Caolán McNamara (via logerrit)
 sw/source/core/layout/objectformattertxtfrm.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 268a82d43425534761ef243d9204bfe4f4d3abc6
Author: Caolán McNamara 
AuthorDate: Sun Oct 27 19:38:37 2024 +
Commit: Caolán McNamara 
CommitDate: Mon Oct 28 21:20:29 2024 +0100

crashtesting: crash on loading ooo71160-2.doc

since:

commit 2d6addb180ad30383f4aaec198c22ccbf936fa87
CommitDate: Mon Oct 21 15:16:57 2024 +0200

tdf#163486 sw: PVS: identical sub-expressions

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

diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx 
b/sw/source/core/layout/objectformattertxtfrm.cxx
index 2c0ea38aae43..0d55a90ac8b4 100644
--- a/sw/source/core/layout/objectformattertxtfrm.cxx
+++ b/sw/source/core/layout/objectformattertxtfrm.cxx
@@ -575,6 +575,8 @@ SwAnchoredObject* 
SwObjectFormatterTextFrame::GetFirstObjWithMovedFwdAnchor(
 static SwRowFrame const* FindTopLevelRowFrame(SwFrame const*const pFrame)
 {
 SwRowFrame * pRow = const_cast(pFrame)->FindRowFrame();
+if (!pRow)
+return nullptr;
 // looks like SwTabFrame has mbInfTab = true so go up 2 levels
 while (pRow->GetUpper()->GetUpper()->IsInTab())
 {


core.git: sw/source

2024-10-28 Thread Mike Kaganski (via logerrit)
 sw/source/core/unocore/unocoll.cxx |   68 +
 1 file changed, 17 insertions(+), 51 deletions(-)

New commits:
commit ff8e1b98529b0b278730035a37412a5cc0f58c0d
Author: Mike Kaganski 
AuthorDate: Mon Oct 28 09:23:09 2024 +0200
Commit: Mike Kaganski 
CommitDate: Mon Oct 28 09:58:04 2024 +0100

Simplify a bit

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

diff --git a/sw/source/core/unocore/unocoll.cxx 
b/sw/source/core/unocore/unocoll.cxx
index 70773c3bdbd3..9387752df234 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -1691,12 +1691,8 @@ sal_Int32 SwXFootnotes::getCount()
 {
 SolarMutexGuard aGuard;
 sal_Int32 nCount = 0;
-auto& rIdxs = GetDoc().GetFootnoteIdxs();
-const size_t nFootnoteCnt = rIdxs.size();
-SwTextFootnote* pTextFootnote;
-for( size_t n = 0; n < nFootnoteCnt; ++n )
+for (const SwTextFootnote* pTextFootnote : GetDoc().GetFootnoteIdxs())
 {
-pTextFootnote = rIdxs[n];
 const SwFormatFootnote& rFootnote = pTextFootnote->GetFootnote();
 if ( rFootnote.IsEndNote() != m_bEndnote )
 continue;
@@ -1707,38 +1703,28 @@ sal_Int32 SwXFootnotes::getCount()
 
 uno::Any SwXFootnotes::getByIndex(sal_Int32 nIndex)
 {
+if (nIndex < 0)
+throw IndexOutOfBoundsException();
 return uno::Any(uno::Reference< XFootnote >(getFootnoteByIndex(nIndex)));
 }
 
 rtl::Reference SwXFootnotes::getFootnoteByIndex(sal_Int32 nIndex)
 {
 SolarMutexGuard aGuard;
-rtl::Reference xRef;
 sal_Int32 nCount = 0;
 
 auto& rDoc = GetDoc();
-auto& rIdxs = rDoc.GetFootnoteIdxs();
-const size_t nFootnoteCnt = rIdxs.size();
-SwTextFootnote* pTextFootnote;
-for( size_t n = 0; n < nFootnoteCnt; ++n )
+for (const SwTextFootnote* pTextFootnote : rDoc.GetFootnoteIdxs())
 {
-pTextFootnote = rIdxs[n];
 const SwFormatFootnote& rFootnote = pTextFootnote->GetFootnote();
 if ( rFootnote.IsEndNote() != m_bEndnote )
 continue;
 
 if(nCount == nIndex)
-{
-xRef = SwXFootnote::CreateXFootnote(rDoc,
-&const_cast(rFootnote));
-break;
-}
+return SwXFootnote::CreateXFootnote(rDoc, 
&const_cast(rFootnote));
 nCount++;
 }
-if(!xRef.is())
-throw IndexOutOfBoundsException();
-
-return xRef;
+throw IndexOutOfBoundsException();
 }
 
 uno::Type SAL_CALL SwXFootnotes::getElementType()
@@ -1789,56 +1775,36 @@ sal_Int32 SwXReferenceMarks::getCount()
 
 uno::Any SwXReferenceMarks::getByIndex(sal_Int32 nIndex)
 {
-SolarMutexGuard aGuard;
-uno::Any aRet;
-uno::Reference< XTextContent >  xRef;
 if(0 <= nIndex && nIndex < SAL_MAX_UINT16)
 {
+SolarMutexGuard aGuard;
 auto& rDoc = GetDoc();
-SwFormatRefMark *const pMark = const_cast(
-rDoc.GetRefMark(o3tl::narrowing(nIndex)));
-if(pMark)
-{
-xRef = SwXReferenceMark::CreateXReferenceMark(rDoc, pMark);
-aRet <<= xRef;
-}
+if (auto* const pMark = 
const_cast(rDoc.GetRefMark(nIndex)))
+return uno::Any(
+
uno::Reference(SwXReferenceMark::CreateXReferenceMark(rDoc, 
pMark)));
 }
-if(!xRef.is())
-throw IndexOutOfBoundsException();
-return aRet;
+throw IndexOutOfBoundsException();
 }
 
 uno::Any SwXReferenceMarks::getByName(const OUString& rName)
 {
 SolarMutexGuard aGuard;
-uno::Any aRet;
-
 auto& rDoc = GetDoc();
-SwFormatRefMark *const pMark =
-const_cast(rDoc.GetRefMark(rName));
-if(!pMark)
-throw NoSuchElementException();
-
-uno::Reference const xRef =
-SwXReferenceMark::CreateXReferenceMark(rDoc, pMark);
-aRet <<= xRef;
+if (auto* const pMark = 
const_cast(rDoc.GetRefMark(rName)))
+return uno::Any(
+
uno::Reference(SwXReferenceMark::CreateXReferenceMark(rDoc, 
pMark)));
 
-return aRet;
+throw NoSuchElementException();
 }
 
 uno::Sequence< OUString > SwXReferenceMarks::getElementNames()
 {
 SolarMutexGuard aGuard;
-uno::Sequence aRet;
 
 std::vector aStrings;
-const sal_uInt16 nCount = GetDoc().GetRefMarks(&aStrings);
-aRet.realloc(nCount);
-OUString* pNames = aRet.getArray();
-for(sal_uInt16 i = 0; i < nCount; i++)
-pNames[i] = aStrings[i];
+GetDoc().GetRefMarks(&aStrings);
 
-return aRet;
+return comphelper::containerToSequence(aStrings);
 }
 
 sal_Bool SwXReferenceMarks::hasByName(const OUString& rName)


core.git: sw/source

2024-10-27 Thread Bogdan Buzea (via logerrit)
 sw/source/core/docnode/section.cxx |8 
 1 file changed, 8 deletions(-)

New commits:
commit a0aa09b34f68bef2b8fdd99776930430cb643958
Author: Bogdan Buzea 
AuthorDate: Mon Oct 21 11:42:55 2024 +0200
Commit: David Gilbert 
CommitDate: Sun Oct 27 18:57:49 2024 +0100

tdf#163486: PVS: Identical branches

V1037 Two or more case-branches perform the same actions. Check lines: 473, 
480
V1037 Two or more case-branches perform the same actions. Check lines: 763, 
768

Change-Id: I6f770cff57cac225729e7e1fb82c9b36fec929e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175311
Reviewed-by: David Gilbert 
Tested-by: Jenkins

diff --git a/sw/source/core/docnode/section.cxx 
b/sw/source/core/docnode/section.cxx
index 677fa0f75784..f9cb6efbee63 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -470,12 +470,6 @@ void SwSection::Notify(SfxHint const& rHint)
 break;
 
 case RES_FTN_AT_TXTEND:
-if( pNew && pOld )
-{
-bUpdateFootnote = true;
-}
-break;
-
 case RES_END_AT_TXTEND:
 if( pNew && pOld )
 {
@@ -760,8 +754,6 @@ void SwSectionFormat::SwClientNotify(const SwModify& rMod, 
const SfxHint& rHint)
 
 case RES_FTN_AT_TXTEND:
 case RES_END_AT_TXTEND:
-GetNotifier().Broadcast(sw::LegacyModifyHint(pOld, pNew));
-return;
 case RES_PROTECT:
 case RES_EDIT_IN_READONLY: // edit in readonly sections
 // Pass through these Messages until the End of the tree!


core.git: sw/source

2024-10-26 Thread Caolán McNamara (via logerrit)
 sw/source/core/crsr/crsrsh.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 50cb6fb476a678e6826e02ae3ffb217baa276615
Author: Caolán McNamara 
AuthorDate: Sat Oct 26 10:55:07 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sat Oct 26 16:29:26 2024 +0200

cid#1633842 Uninitialized scalar field

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

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 4df37884956a..fce43323b19b 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -3402,6 +3402,7 @@ SwCursorShell::SwCursorShell( SwDoc& rDoc, vcl::Window 
*pInitWin,
 m_bAllProtect = m_bVisPortChgd = m_bChgCallFlag = m_bInCMvVisportChgd =
 m_bGCAttr = m_bIgnoreReadonly = m_bSelTableCells = m_bBasicHideCursor =
 m_bOverwriteCursor = false;
+m_bIsCursorPosChanged = false;
 m_bSendAccessibleCursorEvents = true;
 m_bCallChgLnk = m_bHasFocus = m_bAutoUpdateCells = true;
 m_bSVCursorVis = true;


core.git: sw/source

2024-10-25 Thread Oliver Specht (via logerrit)
 sw/source/core/view/pagepreviewlayout.cxx |1 +
 sw/source/uibase/app/appopt.cxx   |6 ++
 sw/source/uibase/inc/pview.hxx|4 
 sw/source/uibase/uiview/pview.cxx |   10 ++
 4 files changed, 21 insertions(+)

New commits:
commit b310be24bc0af0871133e55057e3528148346660
Author: Oliver Specht 
AuthorDate: Tue Oct 22 16:10:24 2024 +0200
Commit: Thorsten Behrens 
CommitDate: Fri Oct 25 15:29:49 2024 +0200

tdf#161538 update page preview on changed printer settings

Updates the print preview if show/hide automatically
generated empty pages is changed.

Change-Id: I8ee53c575edb31f16556a66037260cf79f0fb4a7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175416
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
Tested-by: Gabor Kelemen 

diff --git a/sw/source/core/view/pagepreviewlayout.cxx 
b/sw/source/core/view/pagepreviewlayout.cxx
index b363d1a42fa6..35bf15bdc48c 100644
--- a/sw/source/core/view/pagepreviewlayout.cxx
+++ b/sw/source/core/view/pagepreviewlayout.cxx
@@ -250,6 +250,7 @@ void SwPagePreviewLayout::ApplyNewZoomAtViewShell( 
sal_uInt8 _aNewZoom )
 */
 void SwPagePreviewLayout::ReInit()
 {
+mbPrintEmptyPages = 
mrParentViewShell.getIDocumentDeviceAccess().getPrintData().IsPrintEmptyPages();
 // check environment and parameters
 {
 bool bLayoutSettingsValid = mbLayoutInfoValid && mbLayoutSizesValid;
diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx
index 32bc1f8d4cae..74d650ccf341 100644
--- a/sw/source/uibase/app/appopt.cxx
+++ b/sw/source/uibase/app/appopt.cxx
@@ -379,6 +379,12 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const 
SfxItemSet& rSet )
 if (pOpt)
 {
 *pOpt = *pAddPrinterAttr;
+SwPagePreview* pPagePreview = dynamic_cast( 
SfxViewShell::Current());
+if( pPagePreview !=nullptr )
+{
+
pPagePreview->GetViewShell()->getIDocumentDeviceAccess().setPrintData(*pOpt);
+pPagePreview->PrintSettingsChanged();
+}
 }
 }
 
diff --git a/sw/source/uibase/inc/pview.hxx b/sw/source/uibase/inc/pview.hxx
index e14ff5d419e7..b024f9e59fe5 100644
--- a/sw/source/uibase/inc/pview.hxx
+++ b/sw/source/uibase/inc/pview.hxx
@@ -152,6 +152,8 @@ public:
 bool SetBookPreviewMode( const bool _bBookPreview );
 
 virtual css::uno::Reference 
CreateAccessible() override;
+
+void ReInit();
 };
 
 /**
@@ -289,6 +291,8 @@ public:
 */
 void SetVScrollbarThumbPos( const sal_uInt16 _nNewThumbPos );
 
+void PrintSettingsChanged();
+
 SwPagePreview(SfxViewFrame& rFrame, SfxViewShell*);
 virtual ~SwPagePreview() override;
 };
diff --git a/sw/source/uibase/uiview/pview.cxx 
b/sw/source/uibase/uiview/pview.cxx
index 96789b67e33e..79d965c4061a 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -579,6 +579,10 @@ void SwPagePreviewWin::DataChanged( const 
DataChangedEvent& rDCEvt )
 }
 }
 
+void SwPagePreviewWin::ReInit()
+{
+mpPgPreviewLayout->ReInit();
+}
 /** help method to execute SfxRequest FN_PAGEUP and FN_PAGEDOWN */
 void SwPagePreview::ExecPgUpAndPgDown( const bool  _bPgUp,
 SfxRequest* _pReq )
@@ -1390,6 +1394,12 @@ void SwPagePreview::SetVisArea( const tools::Rectangle 
&rRect )
 m_pViewWin->Invalidate();
 }
 
+void SwPagePreview::PrintSettingsChanged()
+{
+m_pViewWin->ReInit();
+ChgPage( SwPagePreviewWin::MV_DOC_STT );
+}
+
 IMPL_LINK(SwPagePreview, HoriScrollHdl, weld::Scrollbar&, rScrollbar, void)
 {
 ScrollHdl(rScrollbar, true);


core.git: sw/source

2024-10-25 Thread Jack Honour (via logerrit)
 sw/source/uibase/sidebar/CommentsPanel.cxx |6 +++---
 sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit a308151714a2bc811f6f147055175de9767d313a
Author: Jack Honour 
AuthorDate: Thu Oct 24 14:15:56 2024 +0100
Commit: Hossein 
CommitDate: Fri Oct 25 15:22:52 2024 +0200

tdf#158237 Use C++20 contains() instead of find() and end()

Change-Id: I58be12e3b32a82f137486a314d28b1aaca2202fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175557
Reviewed-by: Hossein   
Tested-by: Jenkins

diff --git a/sw/source/uibase/sidebar/CommentsPanel.cxx 
b/sw/source/uibase/sidebar/CommentsPanel.cxx
index 33f656409caf..edad2a8d5c17 100644
--- a/sw/source/uibase/sidebar/CommentsPanel.cxx
+++ b/sw/source/uibase/sidebar/CommentsPanel.cxx
@@ -416,7 +416,7 @@ void CommentsPanel::populateComments()
 continue;
 sal_uInt32 nRootId = getPostItId(pRootNote);
 
-if (mpThreadsMap.find(nRootId) != mpThreadsMap.end())
+if (mpThreadsMap.contains(nRootId))
 {
 if (mxSortbyPosition->get_active())
 continue;
@@ -491,7 +491,7 @@ void CommentsPanel::addComment(const SwFormatField* pField)
 sw::annotation::SwAnnotationWin* pNote
 = mpPostItMgr->GetAnnotationWin(static_cast(pField->GetField()));
 // If comment is added to an existing thread
-if (mpThreadsMap.find(nRootId) != mpThreadsMap.end())
+if (mpThreadsMap.contains(nRootId))
 {
 auto& pThread = mpThreadsMap[nRootId];
 auto pComment = 
std::make_unique(pThread->getCommentBoxWidget(), *this);
@@ -561,7 +561,7 @@ void CommentsPanel::deleteComment(sal_uInt32 nId)
 if (--pThread->mnComments == 0)
 {
 mxThreadsContainer->move(pThread->get_widget(), nullptr);
-if (mpThreadsMap.find(nRootId) != mpThreadsMap.end())
+if (mpThreadsMap.contains(nRootId))
 mpThreadsMap.erase(nRootId);
 mnThreads--;
 }
diff --git a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx 
b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx
index 086230b0d941..f874466affdc 100644
--- a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx
+++ b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx
@@ -453,7 +453,7 @@ void OOXMLDocumentImpl::resolve(Stream & rStream)
 uno::Reference 
xDocumentPropertiesSupplier(mxModel, uno::UNO_QUERY);
 uno::Reference xDocumentProperties = 
xDocumentPropertiesSupplier->getDocumentProperties();
 comphelper::SequenceAsHashMap 
aMap(xDocumentProperties->getDocumentStatistics());
-if (aMap.find(u"ParagraphCount"_ustr) != aMap.end())
+if (aMap.contains(u"ParagraphCount"_ustr))
 {
 sal_Int32 nValue;
 if (aMap[u"ParagraphCount"_ustr] >>= nValue)


core.git: sw/source

2024-10-25 Thread Mike Kaganski (via logerrit)
 sw/source/core/unocore/unotbl.cxx |   51 --
 1 file changed, 22 insertions(+), 29 deletions(-)

New commits:
commit cc06aa263cb980e851496c31ff3d42fc0370cdbf
Author: Mike Kaganski 
AuthorDate: Fri Oct 25 10:22:09 2024 +0200
Commit: Mike Kaganski 
CommitDate: Fri Oct 25 13:32:18 2024 +0200

Simplify a bit

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

diff --git a/sw/source/core/unocore/unotbl.cxx 
b/sw/source/core/unocore/unotbl.cxx
index 2326dd007361..3d3f52d60516 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1757,7 +1757,7 @@ public:
 SwTableProperties_Impl();
 
 void SetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const 
uno::Any& aVal);
-bool GetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const 
uno::Any*& rpAny);
+const uno::Any* GetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId);
 void AddItemToSet(SfxItemSet& rSet, 
std::function()> aItemFactory,
 sal_uInt16 nWhich, std::initializer_list 
vMember, bool bAddTwips = false);
 void ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc);
@@ -1773,9 +1773,11 @@ void SwTableProperties_Impl::SetProperty(sal_uInt16 
nWhichId, sal_uInt16 nMember
 m_aAnyMap.SetValue(nWhichId, nMemberId, rVal);
 }
 
-bool SwTableProperties_Impl::GetProperty(sal_uInt16 nWhichId, sal_uInt16 
nMemberId, const uno::Any*& rpAny )
+const uno::Any* SwTableProperties_Impl::GetProperty(sal_uInt16 nWhichId, 
sal_uInt16 nMemberId)
 {
-return m_aAnyMap.FillValue(nWhichId, nMemberId, rpAny);
+const uno::Any* pAny = nullptr;
+m_aAnyMap.FillValue(nWhichId, nMemberId, pAny);
+return pAny;
 }
 
 void SwTableProperties_Impl::AddItemToSet(SfxItemSet& rSet,
@@ -1785,9 +1787,7 @@ void SwTableProperties_Impl::AddItemToSet(SfxItemSet& 
rSet,
 std::vector< std::pair > vMemberAndAny;
 for(sal_uInt16 nMember : vMember)
 {
-const uno::Any* pAny = nullptr;
-GetProperty(nWhich, nMember, pAny);
-if(pAny)
+if (const uno::Any* pAny = GetProperty(nWhich, nMember))
 vMemberAndAny.emplace_back(nMember, pAny);
 }
 if(!vMemberAndAny.empty())
@@ -1808,9 +1808,8 @@ void SwTableProperties_Impl::ApplyTableAttr(const 
SwTable& rTable, SwDoc& rDoc)
 RES_KEEP, RES_KEEP,
 RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT>
 aSet(rDoc.GetAttrPool());
-const uno::Any* pRepHead;
 const SwFrameFormat &rFrameFormat = *rTable.GetFrameFormat();
-if(GetProperty(FN_TABLE_HEADLINE_REPEAT, 0xff, pRepHead ))
+if (const uno::Any* pRepHead = GetProperty(FN_TABLE_HEADLINE_REPEAT, 0xff))
 {
 bool bVal(pRepHead->get());
 const_cast(rTable).SetRowsToRepeat( bVal ? 1 : 0 );  // 
TODO: MULTIHEADER
@@ -1824,8 +1823,10 @@ void SwTableProperties_Impl::ApplyTableAttr(const 
SwTable& rTable, SwDoc& rDoc)
 MID_GRAPHIC_FILTER });
 
 bool bPutBreak = true;
-const uno::Any* pPage;
-if(GetProperty(FN_UNO_PAGE_STYLE, 0, pPage) || GetProperty(RES_PAGEDESC, 
0xff, pPage))
+const uno::Any* pPage = GetProperty(FN_UNO_PAGE_STYLE, 0);
+if (!pPage)
+pPage = GetProperty(RES_PAGEDESC, 0xff);
+if (pPage)
 {
 OUString sPageStyle = pPage->get();
 if(!sPageStyle.isEmpty())
@@ -1835,8 +1836,7 @@ void SwTableProperties_Impl::ApplyTableAttr(const 
SwTable& rTable, SwDoc& rDoc)
 if(pDesc)
 {
 SwFormatPageDesc aDesc(pDesc);
-const uno::Any* pPgNo;
-if(GetProperty(RES_PAGEDESC, MID_PAGEDESC_PAGENUMOFFSET, 
pPgNo))
+if (const uno::Any* pPgNo = GetProperty(RES_PAGEDESC, 
MID_PAGEDESC_PAGENUMOFFSET))
 {
 aDesc.SetNumOffset(pPgNo->get());
 }
@@ -1853,23 +1853,19 @@ void SwTableProperties_Impl::ApplyTableAttr(const 
SwTable& rTable, SwDoc& rDoc)
 AddItemToSet(aSet, [&rFrameFormat]() { return 
std::unique_ptr(rFrameFormat.GetKeep().Clone()); }, RES_KEEP, {0});
 AddItemToSet(aSet, [&rFrameFormat]() { return 
std::unique_ptr(rFrameFormat.GetHoriOrient().Clone()); }, 
RES_HORI_ORIENT, {MID_HORIORIENT_ORIENT}, true);
 
-const uno::Any* pSzRel(nullptr);
-GetProperty(FN_TABLE_IS_RELATIVE_WIDTH, 0xff, pSzRel);
-const uno::Any* pRelWidth(nullptr);
-GetProperty(FN_TABLE_RELATIVE_WIDTH, 0xff, pRelWidth);
-const uno::Any* pWidth(nullptr);
-GetProperty(FN_TABLE_WIDTH, 0xff, pWidth);
+const uno::Any* pSzRel = GetProperty(FN_TABLE_IS_RELATIVE_WIDTH, 0xff);
+const uno::Any* pRelWidth = GetProperty(FN_TABLE_RELATIVE_WIDTH, 0xff);
 
-bool bPutSize = pWidth != nullptr;
+bool bPutSize = false;
 SwFormatFrameSize aSz(SwFrameSize::Variable);
-if(pWidth)
+if (const uno::Any* pWidth = GetProper

core.git: sw/source

2024-10-25 Thread Mike Kaganski (via logerrit)
 sw/source/core/unocore/unoframe.cxx |  506 ++--
 1 file changed, 206 insertions(+), 300 deletions(-)

New commits:
commit 22074628b2a020ca7103be27c4aecbb3927ecad9
Author: Mike Kaganski 
AuthorDate: Fri Oct 25 08:22:02 2024 +0200
Commit: Mike Kaganski 
CommitDate: Fri Oct 25 11:08:48 2024 +0200

Simplify a bit

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

diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index deb68a298ca5..9cac516808e5 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -152,7 +152,7 @@ public:
 virtual ~BaseFrameProperties_Impl();
 
 voidSetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const 
uno::Any& rVal);
-boolGetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, const 
uno::Any*& pAny );
+const uno::Any* GetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId);
 bool FillBaseProperties(SfxItemSet& rToSet, const SfxItemSet &rFromSet, 
bool& rSizeFound);
 
 virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& 
rSet, bool& rSizeFound) = 0;
@@ -167,9 +167,11 @@ void BaseFrameProperties_Impl::SetProperty(sal_uInt16 
nWID, sal_uInt8 nMemberId,
 m_aAnyMap.SetValue( nWID, nMemberId, rVal );
 }
 
-bool BaseFrameProperties_Impl::GetProperty(sal_uInt16 nWID, sal_uInt8 
nMemberId, const uno::Any*& rpAny)
+const uno::Any* BaseFrameProperties_Impl::GetProperty(sal_uInt16 nWID, 
sal_uInt8 nMemberId)
 {
-return m_aAnyMap.FillValue( nWID, nMemberId, rpAny );
+const uno::Any* pAny = nullptr;
+m_aAnyMap.FillValue(nWID, nMemberId, pAny);
+return pAny;
 }
 
 bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const 
SfxItemSet& rFromSet, bool& rSizeFound)
@@ -184,27 +186,23 @@ bool 
BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI
 bool bRet = true;
 // always add an anchor to the set
 SwFormatAnchor aAnchor ( rFromSet.Get ( RES_ANCHOR ) );
-{
-const ::uno::Any* pAnchorType;
-if(GetProperty(RES_ANCHOR, MID_ANCHOR_ANCHORTYPE, pAnchorType))
-bRet &= static_cast(aAnchor).PutValue(*pAnchorType, 
MID_ANCHOR_ANCHORTYPE);
-const ::uno::Any* pAnchorPgNo;
-if(GetProperty(RES_ANCHOR, MID_ANCHOR_PAGENUM, pAnchorPgNo))
-bRet &= static_cast(aAnchor).PutValue(*pAnchorPgNo, 
MID_ANCHOR_PAGENUM);
-}
+if (const uno::Any* pAnchorType = GetProperty(RES_ANCHOR, 
MID_ANCHOR_ANCHORTYPE))
+bRet &= aAnchor.PutValue(*pAnchorType, MID_ANCHOR_ANCHORTYPE);
+if (const uno::Any* pAnchorPgNo = GetProperty(RES_ANCHOR, 
MID_ANCHOR_PAGENUM))
+bRet &= aAnchor.PutValue(*pAnchorPgNo, MID_ANCHOR_PAGENUM);
 
 rToSet.Put(aAnchor);
 
 // check for SvxBrushItem (RES_BACKGROUND) properties
-const ::uno::Any* pCol = nullptr; GetProperty(RES_BACKGROUND, 
MID_BACK_COLOR, pCol );
-const ::uno::Any* pRGBCol = nullptr; GetProperty(RES_BACKGROUND, 
MID_BACK_COLOR_R_G_B, pRGBCol );
-const ::uno::Any* pColTrans = nullptr; GetProperty(RES_BACKGROUND, 
MID_BACK_COLOR_TRANSPARENCY, pColTrans);
-const ::uno::Any* pTrans = nullptr; GetProperty(RES_BACKGROUND, 
MID_GRAPHIC_TRANSPARENT, pTrans );
-const ::uno::Any* pGrLoc = nullptr; GetProperty(RES_BACKGROUND, 
MID_GRAPHIC_POSITION, pGrLoc );
-const ::uno::Any* pGraphic = nullptr; GetProperty(RES_BACKGROUND, 
MID_GRAPHIC, pGraphic );
-const ::uno::Any* pGrFilter = nullptr; GetProperty(RES_BACKGROUND, 
MID_GRAPHIC_FILTER, pGrFilter );
-const ::uno::Any* pGraphicURL = nullptr; GetProperty(RES_BACKGROUND, 
MID_GRAPHIC_URL, pGraphicURL );
-const ::uno::Any* pGrTransparency = nullptr; GetProperty(RES_BACKGROUND, 
MID_GRAPHIC_TRANSPARENCY, pGrTransparency );
+const uno::Any* pCol = GetProperty(RES_BACKGROUND, MID_BACK_COLOR);
+const uno::Any* pRGBCol = GetProperty(RES_BACKGROUND, 
MID_BACK_COLOR_R_G_B);
+const uno::Any* pColTrans = GetProperty(RES_BACKGROUND, 
MID_BACK_COLOR_TRANSPARENCY);
+const uno::Any* pTrans = GetProperty(RES_BACKGROUND, 
MID_GRAPHIC_TRANSPARENT);
+const uno::Any* pGrLoc = GetProperty(RES_BACKGROUND, MID_GRAPHIC_POSITION);
+const uno::Any* pGraphic = GetProperty(RES_BACKGROUND, MID_GRAPHIC);
+const uno::Any* pGrFilter = GetProperty(RES_BACKGROUND, 
MID_GRAPHIC_FILTER);
+const uno::Any* pGraphicURL = GetProperty(RES_BACKGROUND, MID_GRAPHIC_URL);
+const uno::Any* pGrTransparency = GetProperty(RES_BACKGROUND, 
MID_GRAPHIC_TRANSPARENCY);
 const bool bSvxBrushItemPropertiesUsed(
 pCol ||
 pTrans ||
@@ -217,39 +215,39 @@ bool 
BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI
 pRGBCol);
 
 // check for FillStyle properties in the range XATTR_FILL_FIRST, 
XATTR_FILL_LAST
-con

core.git: sw/source

2024-10-23 Thread Mike Kaganski (via logerrit)
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

New commits:
commit a3680f886569cb37876756da42c9dcef9d26cc51
Author: Mike Kaganski 
AuthorDate: Wed Oct 23 10:14:38 2024 +0200
Commit: Mike Kaganski 
CommitDate: Wed Oct 23 12:30:34 2024 +0200

Simplify a bit

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

diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 68b5c37aa2f1..962ab0668934 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -2232,13 +2232,12 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 
 const StyleSheetEntryPtr pEntry = 
GetStyleSheetTable()->FindStyleSheetByConvertedStyleName( 
GetCurrentParaStyleName() );
 SAL_WARN_IF(!pEntry, "writerfilter.dmapper", "no style sheet found");
-const StyleSheetPropertyMap* pStyleSheetProperties = pEntry ? 
pEntry->m_pProperties.get() : nullptr;
 sal_Int32 nListId = pParaContext ? pParaContext->props().GetListId() : -1;
 bool isNumberingViaStyle(false);
 bool isNumberingViaRule = nListId > -1;
-if ( !bRemove && pStyleSheetProperties && pParaContext )
+if (!bRemove && pEntry && pEntry->m_pProperties && pParaContext)
 {
-if (!pEntry || pEntry->m_nStyleTypeCode != StyleType::STYLE_TYPE_PARA) 
{
+if (pEntry->m_nStyleTypeCode != StyleType::STYLE_TYPE_PARA) {
 // We could not resolve paragraph style or it is not a paragraph 
style
 // Remove this style reference, otherwise it will cause exceptions 
during further
 // processing and not all paragraph styles will be initialized.
@@ -2299,13 +2298,13 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 const StyleSheetPropertyMap* pParentProperties = pParent ? 
pParent->m_pProperties.get() : nullptr;
 if (!pEntry->m_sBaseStyleIdentifier.isEmpty())
 {
-oProperty = 
pStyleSheetProperties->getProperty(PROP_PARA_FIRST_LINE_INDENT);
+oProperty = 
pEntry->m_pProperties->getProperty(PROP_PARA_FIRST_LINE_INDENT);
 if ( oProperty
 // If the numbering comes from a base style, indent of the 
base style has also priority.
 || (bNumberingFromBaseStyle && pParentProperties && 
(oProperty = pParentProperties->getProperty(PROP_PARA_FIRST_LINE_INDENT))) )
 pParaContext->Insert(PROP_PARA_FIRST_LINE_INDENT, 
oProperty->second, /*bOverwrite=*/false);
 }
-oProperty = 
pStyleSheetProperties->getProperty(PROP_PARA_LEFT_MARGIN);
+oProperty = 
pEntry->m_pProperties->getProperty(PROP_PARA_LEFT_MARGIN);
 if ( oProperty
 || (bNumberingFromBaseStyle && pParentProperties && (oProperty 
= pParentProperties->getProperty(PROP_PARA_LEFT_MARGIN))) )
 pParaContext->Insert(PROP_PARA_LEFT_MARGIN, oProperty->second, 
/*bOverwrite=*/false);
@@ -2323,8 +2322,8 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 pParaContext->Insert(PROP_PARA_LEFT_MARGIN, 
uno::Any(nParaLeftMargin), /*bOverwrite=*/false);
 
 // Override right margin value with value from current style, 
if any
-if (pStyleSheetProperties->isSet(PROP_PARA_RIGHT_MARGIN))
-nParaRightMargin = 
pStyleSheetProperties->getProperty(PROP_PARA_RIGHT_MARGIN)->second.get();
+if (pEntry->m_pProperties->isSet(PROP_PARA_RIGHT_MARGIN))
+nParaRightMargin = 
pEntry->m_pProperties->getProperty(PROP_PARA_RIGHT_MARGIN)->second.get();
 
 pParaContext->Insert(PROP_PARA_RIGHT_MARGIN, 
uno::Any(nParaRightMargin), /*bOverwrite=*/false);
 }


core.git: sw/source

2024-10-23 Thread Xisco Fauli (via logerrit)
 sw/source/filter/ww8/wrtww8.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9fb20b53416fdaabf50861941aed7f9b9e510478
Author: Xisco Fauli 
AuthorDate: Wed Oct 23 00:50:01 2024 +0200
Commit: Xisco Fauli 
CommitDate: Wed Oct 23 10:00:43 2024 +0200

tdf#163486: PVS: Expression is always true

V560A part of conditional expression is always true: pRotate.
V560A part of conditional expression is always true: pRotate.

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

diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index cf0e047dd9c2..5019c8c5f329 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2106,11 +2106,11 @@ static sal_uInt16 lcl_TCFlags(SwDoc &rDoc, const 
SwTableBox * pBox, sal_Int32 nR
 0, static_cast(pCNd)->GetText().getLength());
 if ( const SvxCharRotateItem * pRotate = 
aCoreSet.GetItemIfSet(RES_CHRATR_ROTATE))
 {
-if(pRotate && pRotate->GetValue() == 900_deg10)
+if(pRotate->GetValue() == 900_deg10)
 {
 nFlags = nFlags | 0x0004 | 0x0008;
 }
-else if(pRotate && pRotate->GetValue() == 2700_deg10 )
+else if(pRotate->GetValue() == 2700_deg10 )
 {
 nFlags = nFlags | 0x0004 | 0x0010;
 }


core.git: sw/source

2024-10-23 Thread Xisco Fauli (via logerrit)
 sw/source/core/unocore/unoframe.cxx |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

New commits:
commit adb561759ceb87b8bc0274a50b2ef546d137eae6
Author: Xisco Fauli 
AuthorDate: Wed Oct 23 01:16:02 2024 +0200
Commit: Xisco Fauli 
CommitDate: Wed Oct 23 09:25:42 2024 +0200

tdf#163486: PVS: Expression is always true

V547Expression 'pFollowTextFlow' is always true.

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

diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index a2a5e95ccf41..deb68a298ca5 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -921,11 +921,7 @@ bool 
BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI
 if (pFollowTextFlow)
 {
 SwFormatFollowTextFlow aFormatFollowTextFlow;
-if( pFollowTextFlow )
-{
-aFormatFollowTextFlow.PutValue(*pFollowTextFlow, 
MID_FOLLOW_TEXT_FLOW);
-}
-
+aFormatFollowTextFlow.PutValue(*pFollowTextFlow, MID_FOLLOW_TEXT_FLOW);
 rToSet.Put(aFormatFollowTextFlow);
 }
 


core.git: sw/source

2024-10-23 Thread Xisco Fauli (via logerrit)
 sw/source/uibase/app/docsh2.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c025cb6d125d8187453e06055dcf3e65d83d532c
Author: Xisco Fauli 
AuthorDate: Wed Oct 23 00:55:24 2024 +0200
Commit: Xisco Fauli 
CommitDate: Wed Oct 23 09:22:17 2024 +0200

tdf#163486: PVS: Expression is always true

V560A part of conditional expression is always true: pFlt.

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

diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index a6f5bf0728bd..0beb039d01d0 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -567,7 +567,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
 while( pFlt )
 {
 // --> OD #i117339#
-if( pFlt && pFlt->IsAllowedAsTemplate() &&
+if( pFlt->IsAllowedAsTemplate() &&
 ( pFlt->GetUserData() == "CXML" ||
   pFlt->GetUserData() == "CXMLV" ) )
 {


core.git: sw/source

2024-10-22 Thread Xisco Fauli (via logerrit)
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 95e7d7c2715b061409c84e1b7d2e1b750c47f8c7
Author: Xisco Fauli 
AuthorDate: Tue Oct 22 19:28:34 2024 +0200
Commit: Xisco Fauli 
CommitDate: Tue Oct 22 23:27:40 2024 +0200

tdf#163486: PVS: Expression is always true

V560A part of conditional expression is always true: 
pStyleSheetProperties.

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

diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 75e758c40523..68b5c37aa2f1 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -2323,7 +2323,7 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 pParaContext->Insert(PROP_PARA_LEFT_MARGIN, 
uno::Any(nParaLeftMargin), /*bOverwrite=*/false);
 
 // Override right margin value with value from current style, 
if any
-if (pStyleSheetProperties && 
pStyleSheetProperties->isSet(PROP_PARA_RIGHT_MARGIN))
+if (pStyleSheetProperties->isSet(PROP_PARA_RIGHT_MARGIN))
 nParaRightMargin = 
pStyleSheetProperties->getProperty(PROP_PARA_RIGHT_MARGIN)->second.get();
 
 pParaContext->Insert(PROP_PARA_RIGHT_MARGIN, 
uno::Any(nParaRightMargin), /*bOverwrite=*/false);


core.git: sw/source

2024-10-22 Thread Xisco Fauli (via logerrit)
 sw/source/filter/xml/xmltbli.cxx |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit a07b4b432f47902290ff698ec48c79c63d3419ad
Author: Xisco Fauli 
AuthorDate: Tue Oct 22 19:33:22 2024 +0200
Commit: Xisco Fauli 
CommitDate: Tue Oct 22 23:04:55 2024 +0200

tdf#163486: PVS: Expression is always true

V560A part of conditional expression is always true: pNumFormat.
V560A part of conditional expression is always true: pNumFormat != 
nullptr.

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

diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 76b62fe426f5..8bd58ca29baf 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -1926,7 +1926,7 @@ SwTableBox *SwXMLTableContext::MakeTableBox(
 // default num format?
 if( const SwTableBoxNumFormat* pNumFormat = 
pBoxFormat2->GetItemIfSet( RES_BOXATR_FORMAT, false ) )
 {
-if (pNumFormat && (pNumFormat->GetValue() % 
SV_COUNTRY_LANGUAGE_OFFSET) == 0)
+if ((pNumFormat->GetValue() % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
 {
 // only one text node?
 SwNodeIndex aNodeIndex( *(pCell->GetStartNode()), 1 );
@@ -1980,8 +1980,7 @@ SwTableBox *SwXMLTableContext::MakeTableBox(
 const SwDoc* pDoc = m_pBoxFormat->GetDoc();
 const SvNumberFormatter* pNumberFormatter = pDoc ?
 pDoc->GetNumberFormatter() : nullptr;
-if( pNumFormat != nullptr && pNumberFormatter &&
-!pNumberFormatter->GetEntry( pNumFormat->GetValue() 
)->IsTextFormat() )
+if( pNumberFormatter && !pNumberFormatter->GetEntry( 
pNumFormat->GetValue() )->IsTextFormat() )
 m_pBoxFormat->ResetFormatAttr( RES_BOXATR_FORMAT );
 }
 }


core.git: sw/source

2024-10-22 Thread Bogdan Buzea (via logerrit)
 sw/source/filter/html/wrthtml.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f85366c407e71fc4e382c449504940aaedab354f
Author: Bogdan Buzea 
AuthorDate: Mon Oct 21 18:06:31 2024 +0200
Commit: Xisco Fauli 
CommitDate: Tue Oct 22 14:30:26 2024 +0200

tdf#163486: PVS: Identical branches

Since
commit 97075a384aed0b4853b78bd5ffc681cdf9003f11
Author: Michael Brauer 
Date:   Wed Oct 24 13:16:17 2001 +

#91961#: Support of language

V1037 Two or more case-branches perform the same actions. Check lines: 
1462, 1465

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

diff --git a/sw/source/filter/html/wrthtml.cxx 
b/sw/source/filter/html/wrthtml.cxx
index 3b7e2f887886..b4a277ec5df4 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -1462,7 +1462,7 @@ TypedWhichId 
SwHTMLWriter::GetLangWhichIdFromScript( sal_uInt16
 nWhichId = RES_CHRATR_CJK_LANGUAGE;
 break;
 case CSS1_OUTMODE_CTL:
-nWhichId = RES_CHRATR_CJK_LANGUAGE;
+nWhichId = RES_CHRATR_CTL_LANGUAGE;
 break;
 default:
 nWhichId = RES_CHRATR_LANGUAGE;


core.git: sw/source

2024-10-22 Thread Caolán McNamara (via logerrit)
 sw/source/filter/ww8/wrtw8esh.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 7c76f391296ef129e89c724bff26cc1bd3aefa27
Author: Caolán McNamara 
AuthorDate: Sun Oct 20 15:02:04 2024 +0100
Commit: Caolán McNamara 
CommitDate: Tue Oct 22 11:55:20 2024 +0200

cid#1607845 silence Overflowed constant

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

diff --git a/sw/source/filter/ww8/wrtw8esh.cxx 
b/sw/source/filter/ww8/wrtw8esh.cxx
index c1066d355569..69707aa46c24 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -2208,8 +2208,10 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& 
rWW8Wrt)
 m_pTextBxs = mrWrt.m_pTextBxs.get();
 }
 
-for( ; i--; pSdrObjs = mrWrt.m_pSdrObjs.get(), m_pTextBxs = 
mrWrt.m_pTextBxs.get() )
+while (i > 0)
 {
+--i;
+
 // "dummy char" (or any Count ?) - why? Only Microsoft knows it.
 GetStream().WriteChar( i );
 
@@ -2308,6 +2310,9 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& 
rWW8Wrt)
 CloseContainer();   // ESCHER_SpContainer
 }
 CloseContainer();   // ESCHER_DgContainer
+
+pSdrObjs = mrWrt.m_pSdrObjs.get();
+m_pTextBxs = mrWrt.m_pTextBxs.get();
 }
 }
 


core.git: sw/source

2024-10-21 Thread Xisco Fauli (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |   25 +++--
 1 file changed, 19 insertions(+), 6 deletions(-)

New commits:
commit c796878e6af0fc7c886e813a0010d9402312eb5c
Author: Xisco Fauli 
AuthorDate: Mon Oct 21 15:56:25 2024 +0200
Commit: Xisco Fauli 
CommitDate: Mon Oct 21 17:42:04 2024 +0200

tdf#163543: check GetDocShell()

Similar to
commit c5f4fe10589acff4d253cc3d32acaf67c7456bd7
Author: Caolán McNamara 
Date:   Thu Oct 3 15:14:05 2024 +0100

check for null DocShell before deref

Change-Id: I910fb934a36b0e68fd8bda59516c21aa9d27d09a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175338
Reviewed-by: Balazs Varga 
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 2b6cce2107c8..db35a312a6d2 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -752,6 +752,10 @@ private:
 aBackgroundColor = nParaBackColor;
 else
 {
+SwDocShell* pDocShell = pTextNode->GetDoc().GetDocShell();
+if (!pDocShell)
+return;
+
 OUString sCharStyleName;
 Color nCharStyleBackColor(COL_AUTO);
 if (xProperties->getPropertyValue(u"CharStyleName"_ustr) >>= 
sCharStyleName)
@@ -759,7 +763,7 @@ private:
 try
 {
 uno::Reference 
xStyleFamiliesSupplier(
-pTextNode->GetDoc().GetDocShell()->GetModel(), 
uno::UNO_QUERY);
+pDocShell->GetModel(), uno::UNO_QUERY);
 uno::Reference xCont
 = xStyleFamiliesSupplier->getStyleFamilies();
 uno::Reference xStyleFamily(
@@ -1661,6 +1665,14 @@ public:
 
 SwTextNode* pTextNode = pCurrent->GetTextNode();
 SwDoc& rDocument = pTextNode->GetDoc();
+SwDocShell* pDocShell = rDocument.GetDocShell();
+if (!pDocShell)
+return;
+
+SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
+if (!pWrtShell)
+return;
+
 auto nParagraphLength = pTextNode->GetText().getLength();
 if (nParagraphLength == 0)
 {
@@ -1668,8 +1680,7 @@ public:
 if (!pPrevTextNode)
 return;
 
-SwWrtShell* pWrtShell = rDocument.GetDocShell()->GetWrtShell();
-if (pWrtShell && 
pPrevTextNode->getLayoutFrame(pWrtShell->GetLayout()))
+if (pPrevTextNode->getLayoutFrame(pWrtShell->GetLayout()))
 {
 if (pPrevTextNode->GetText().getLength() == 0)
 {
@@ -1683,8 +1694,7 @@ public:
 }
 else
 {
-SwWrtShell* pWrtShell = rDocument.GetDocShell()->GetWrtShell();
-if (pWrtShell && pTextNode->getLayoutFrame(pWrtShell->GetLayout()))
+if (pTextNode->getLayoutFrame(pWrtShell->GetLayout()))
 {
 // Check for excess lines inside this paragraph
 const OUString& sParagraphText = pTextNode->GetText();
@@ -2391,7 +2401,10 @@ public:
 }
 void check(SwDoc* pDoc) override
 {
-rtl::Reference xDoc = 
pDoc->GetDocShell()->GetBaseModel();
+SwDocShell* pDocShell = pDoc->GetDocShell();
+if (!pDocShell)
+return;
+rtl::Reference xDoc = pDocShell->GetBaseModel();
 if (!xDoc)
 return;
 uno::Reference xStyleFamilies = 
xDoc->getStyleFamilies();


core.git: sw/source

2024-10-21 Thread Xisco Fauli (via logerrit)
 sw/source/core/access/accmap.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3c0cd84287dc94858d9c92830d60eda59c626df3
Author: Xisco Fauli 
AuthorDate: Mon Oct 21 13:31:28 2024 +0200
Commit: Xisco Fauli 
CommitDate: Mon Oct 21 15:45:42 2024 +0200

tdf#163486: PVS: identical sub-expressions

Since
commit b7d2a9c824aca1a4dfd1b857a3620e73ade6bc0d
Author: Michael Weghorn 
Date:   Fri Oct 27 17:55:59 2023 +0200

tdf#135586 sw a11y: Use BLOCK_QUOTE role for "Block Quotation" para

V501There are identical sub-expressions 
'xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH' to the left 
and to the right of the '||' operator.

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

diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index ab44250bca8c..4dfe6284beb8 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -1612,7 +1612,7 @@ void SwAccessibleMap::DoInvalidateShapeSelection(bool 
bInvalidateFocusMode /*=fa
 uno::Reference< XAccessible > xPara = 
pAccShape->getAccessibleParent();
 uno::Reference< XAccessibleContext > xParaContext = 
xPara->getAccessibleContext();
 if (xParaContext.is() && (xParaContext->getAccessibleRole() == 
AccessibleRole::PARAGRAPH
-  || xParaContext->getAccessibleRole() == 
AccessibleRole::PARAGRAPH))
+  || xParaContext->getAccessibleRole() == 
AccessibleRole::BLOCK_QUOTE))
 {
 SwAccessibleParagraph* pAccPara = static_cast< 
SwAccessibleParagraph *>(xPara.get());
 if (m_setParaAdd.count(pAccPara) == 0 )


core.git: sw/source

2024-10-21 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/objectformattertxtfrm.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2d6addb180ad30383f4aaec198c22ccbf936fa87
Author: Michael Stahl 
AuthorDate: Mon Oct 21 12:02:01 2024 +0200
Commit: Michael Stahl 
CommitDate: Mon Oct 21 15:16:57 2024 +0200

tdf#163486 sw: PVS: identical sub-expressions

Copypasta in commit c799de145f7e289f31e3669646e5bd12814e6c5e, we want to
compare the rows where the 2 objects are anchored.

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

diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx 
b/sw/source/core/layout/objectformattertxtfrm.cxx
index a06cb6b679fb..2c0ea38aae43 100644
--- a/sw/source/core/layout/objectformattertxtfrm.cxx
+++ b/sw/source/core/layout/objectformattertxtfrm.cxx
@@ -733,7 +733,7 @@ bool SwObjectFormatterTextFrame::CheckMovedFwdCondition(
 // "below" and the row could potentially be 
split
 // TODO refine check if needed
 if (!pInBodyFrameAnchoredObj->IsInTab()
-|| 
FindTopLevelRowFrame(pInBodyFrameAnchoredObj)
+|| FindTopLevelRowFrame(pInBodyFrameObj)
 != 
FindTopLevelRowFrame(pInBodyFrameAnchoredObj))
 {   // anchored in next chain on same page
 SAL_INFO("sw.layout", 
"SwObjectFormatterTextFrame::CheckMovedFwdCondition(): 
o_rbPageHasFlysAnchoredBelowThis because next chain on same page");


core.git: sw/source

2024-10-21 Thread Xisco Fauli (via logerrit)
 sw/source/uibase/uno/dlelstnr.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e397437ebb7ec5c4c63de9dfbef7c5a1738abef0
Author: Xisco Fauli 
AuthorDate: Mon Oct 21 10:34:12 2024 +0200
Commit: Xisco Fauli 
CommitDate: Mon Oct 21 14:19:58 2024 +0200

tdf#163486: PVS: Two similar code fragments were found

commit 14a73d8de3f04e3087a8c2872cd1c53096f605ba
Author: Ivo Hinkelmann 
Date:   Wed Jul 16 12:35:11 2008 +

INTEGRATION: CWS tl55 (1.13.50); FILE MERGED

V778Two similar code fragments were found. Perhaps, this is a typo and 
'm_xGCIterator' variable should be used instead of 'm_xLngSvcMgr'.

Change-Id: Ic8df89aa951761903d955c4b571bd0b70829ad3f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175300
Reviewed-by: Xisco Fauli 
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/source/uibase/uno/dlelstnr.cxx 
b/sw/source/uibase/uno/dlelstnr.cxx
index 6cfe6f97191a..41551540101b 100644
--- a/sw/source/uibase/uno/dlelstnr.cxx
+++ b/sw/source/uibase/uno/dlelstnr.cxx
@@ -107,7 +107,7 @@ void SAL_CALL SwLinguServiceEventListener::disposing(
 
 if (m_xLngSvcMgr.is() && rEventObj.Source == m_xLngSvcMgr)
 m_xLngSvcMgr = nullptr;
-if (m_xLngSvcMgr.is() && rEventObj.Source == m_xGCIterator)
+if (m_xGCIterator.is() && rEventObj.Source == m_xGCIterator)
 m_xGCIterator = nullptr;
 }
 


core.git: sw/source

2024-10-21 Thread Mohit Marathe (via logerrit)
 sw/source/uibase/sidebar/CommentsPanel.cxx |8 
 sw/source/uibase/sidebar/CommentsPanel.hxx |2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 9fca60fb13a7ac30bf763e630c5fdaed2e98b119
Author: Mohit Marathe 
AuthorDate: Sat Oct 19 13:25:38 2024 +0530
Commit: Sarper Akdemir 
CommitDate: Mon Oct 21 13:30:59 2024 +0200

tdf#163551 fix filter comments by author bug

This patch fixes the bug in which you have to reset the date filter
for filter by author to work i.e. when switching the filter from one
author to another

Change-Id: Ib5d3bebf587c0e940d4984dd78f9d4a94f5cbb06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175189
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir 

diff --git a/sw/source/uibase/sidebar/CommentsPanel.cxx 
b/sw/source/uibase/sidebar/CommentsPanel.cxx
index 0b8fdb6d52c0..33f656409caf 100644
--- a/sw/source/uibase/sidebar/CommentsPanel.cxx
+++ b/sw/source/uibase/sidebar/CommentsPanel.cxx
@@ -682,7 +682,7 @@ IMPL_LINK_NOARG(CommentsPanel, FilterByAuthor, 
weld::ComboBox&, void)
 {
 for (auto & [ nId, pComment ] : mpCommentsMap)
 {
-if (!mbResetDate && mxFilterDate->get_date() != 
pComment->GetDate())
+if (mbDateSelected && mxFilterDate->get_date() != 
pComment->GetDate())
 continue;
 pComment->get_widget()->set_visible(true);
 }
@@ -693,7 +693,7 @@ IMPL_LINK_NOARG(CommentsPanel, FilterByAuthor, 
weld::ComboBox&, void)
 {
 if (sAuthor == pComment->GetAuthor())
 {
-if (!mbResetDate && mxFilterDate->get_date() != 
pComment->GetDate())
+if (mbDateSelected && mxFilterDate->get_date() != 
pComment->GetDate())
 continue;
 pComment->get_widget()->set_visible(true);
 }
@@ -707,6 +707,7 @@ IMPL_LINK_NOARG(CommentsPanel, FilterByAuthor, 
weld::ComboBox&, void)
 
 IMPL_LINK_NOARG(CommentsPanel, FilterByDate, SvtCalendarBox&, void)
 {
+mbDateSelected = true;
 Date aDate(mxFilterDate->get_date());
 for (auto & [ nId, pComment ] : mpCommentsMap)
 {
@@ -724,9 +725,8 @@ IMPL_LINK_NOARG(CommentsPanel, FilterByDate, 
SvtCalendarBox&, void)
 
 IMPL_LINK_NOARG(CommentsPanel, ResetDate, weld::Button&, void)
 {
-mbResetDate = true;
+mbDateSelected = false;
 FilterByAuthor(*mxFilterAuthor);
-mbResetDate = false;
 }
 
 IMPL_LINK_NOARG(CommentsPanel, ShowTimeHdl, weld::Toggleable&, void)
diff --git a/sw/source/uibase/sidebar/CommentsPanel.hxx 
b/sw/source/uibase/sidebar/CommentsPanel.hxx
index 48f63b9dc01a..832633b08a7e 100644
--- a/sw/source/uibase/sidebar/CommentsPanel.hxx
+++ b/sw/source/uibase/sidebar/CommentsPanel.hxx
@@ -169,7 +169,7 @@ private:
 std::unique_ptr mxThreadsContainer;
 
 sal_uInt16 mnThreads = 0;
-bool mbResetDate = false;
+bool mbDateSelected = false;
 
 // utility functions
 sw::annotation::SwAnnotationWin* getRootCommentWin(const SwFormatField* 
pField);


core.git: sw/source

2024-10-21 Thread Mike Kaganski (via logerrit)
 sw/source/core/unocore/unotext.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8fdf154cd8d4afafdbe068a3d764ac23f14549df
Author: Mike Kaganski 
AuthorDate: Mon Oct 21 11:39:43 2024 +0500
Commit: Mike Kaganski 
CommitDate: Mon Oct 21 12:40:34 2024 +0200

In MSVC, non-static constexpr objects are initialized at run-time

Similar to commit c785399884650fd0a1a4ffc3008fbb665e47a9d3 (In MSVC,
non-static constexpr objects are initialized at run-time, 2024-09-04).

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

diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index b78be39a98e9..efb5d7287501 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -2256,7 +2256,7 @@ SwXText::convertToSwTable(
 {
 try
 {
-constexpr auto vDenylist = 
frozen::make_unordered_set({
+static constexpr auto vDenylist = 
frozen::make_unordered_set({
 u"BottomBorder",
 u"CharAutoKerning",
 u"CharFontName",


core.git: sw/source xmloff/source

2024-10-21 Thread Tomaž Vajngerl (via logerrit)
 sw/source/writerfilter/dmapper/PropertyMap.cxx  |5 +++--
 xmloff/source/style/XMLRtlGutterPropertyHandler.cxx |5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 8c935c6ac1fb0b64cc35e6f610590f3a0e595a88
Author: Tomaž Vajngerl 
AuthorDate: Sat Oct 19 12:11:01 2024 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 21 09:34:08 2024 +0200

use frozen::make_unordered_set to skip the number of elements

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

diff --git a/sw/source/writerfilter/dmapper/PropertyMap.cxx 
b/sw/source/writerfilter/dmapper/PropertyMap.cxx
index c3087e72d6b5..04b773164d92 100644
--- a/sw/source/writerfilter/dmapper/PropertyMap.cxx
+++ b/sw/source/writerfilter/dmapper/PropertyMap.cxx
@@ -1476,12 +1476,13 @@ void 
SectionPropertyMap::CreateEvenOddPageStyleCopy(DomainMapper_Impl& rDM_Impl,
 const uno::Sequence 
propertyList(pagePropertiesInfo->getProperties());
 
 // Ignore write-only properties.
-static constexpr frozen::unordered_set 
staticDenylist = {
+static constexpr auto staticDenylist = 
frozen::make_unordered_set({
 u"FooterBackGraphicURL", u"BackGraphicURL", u"HeaderBackGraphicURL",
 u"HeaderIsOn", u"FooterIsOn",
 u"HeaderIsShared", u"FooterIsShared", u"FirstIsShared",
 u"HeaderText", u"HeaderTextLeft", u"HeaderTextFirst",
-u"FooterText", u"FooterTextLeft", u"FooterTextFirst" };
+u"FooterText", u"FooterTextLeft", u"FooterTextFirst"
+});
 
 bool isMirrorMargins = PageBreakType::Even == eBreakType && 
rDM_Impl.GetSettingsTable()->GetMirrorMarginSettings();
 for (const auto& rProperty : propertyList)
diff --git a/xmloff/source/style/XMLRtlGutterPropertyHandler.cxx 
b/xmloff/source/style/XMLRtlGutterPropertyHandler.cxx
index d5d94bdb44e4..f35438519e0d 100644
--- a/xmloff/source/style/XMLRtlGutterPropertyHandler.cxx
+++ b/xmloff/source/style/XMLRtlGutterPropertyHandler.cxx
@@ -32,8 +32,9 @@ XMLRtlGutterPropertyHandler::~XMLRtlGutterPropertyHandler() = 
default;
 
 namespace
 {
-constexpr frozen::unordered_set constRtlModes{ 
u"rl-tb", u"tb-rl", u"rl",
-   u"tb" };
+constexpr auto constRtlModes
+= frozen::make_unordered_set({ u"rl-tb", u"tb-rl", 
u"rl", u"tb" });
+
 } // end anonymous ns
 
 bool XMLRtlGutterPropertyHandler::importXML(const OUString& rStrImpValue, 
uno::Any& rValue,


core.git: sw/source

2024-10-20 Thread Caolán McNamara (via logerrit)
 sw/source/ui/dbui/mmoutputtypepage.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit b80001bbfd146fc62c491b78540216d41fd713f3
Author: Caolán McNamara 
AuthorDate: Fri Oct 18 20:50:08 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sun Oct 20 20:54:18 2024 +0200

cid#1555723 Data race condition

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

diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx 
b/sw/source/ui/dbui/mmoutputtypepage.cxx
index 27430ce63c60..c1ba1b3a2490 100644
--- a/sw/source/ui/dbui/mmoutputtypepage.cxx
+++ b/sw/source/ui/dbui/mmoutputtypepage.cxx
@@ -508,7 +508,13 @@ void SwSendMailDialog::UpdateTransferStatus()
 sStatus = m_sErrorStatus.replaceFirst("%1", 
OUString::number(m_nErrorCount) );
 m_xErrorStatus->set_label(sStatus);
 
-if (!m_pImpl->aDescriptors.empty())
+bool bEmpty;
+{
+std::scoped_lock aGuard(m_pImpl->aDescriptorMutex);
+bEmpty = m_pImpl->aDescriptors.empty();
+}
+
+if (!bEmpty)
 {
 assert(m_nExpectedCount && "div-by-zero");
 m_xProgressBar->set_percentage(m_nProcessedCount * 100 / 
m_nExpectedCount);


core.git: sw/source

2024-10-20 Thread Bogdan Buzea (via logerrit)
 sw/source/filter/ww8/ww8par.cxx |   14 --
 1 file changed, 14 deletions(-)

New commits:
commit 11a1b66554dbd8b05319a0d18008932057e41f17
Author: Bogdan Buzea 
AuthorDate: Sun Oct 20 11:54:37 2024 +0200
Commit: Xisco Fauli 
CommitDate: Sun Oct 20 19:55:03 2024 +0200

tdf#163486: PVS: Identical branches

V1037 Two or more case-branches perform the same actions. Check lines: 871, 
879
V1037 Two or more case-branches perform the same actions. Check lines: 891, 
899

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

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index c3a73e67490f..0d36189dd034 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -867,13 +867,6 @@ rtl::Reference 
SwMSDffManager::ProcessObj(SvStream& rSt,
 switch( eTextAnchor )
 {
 case mso_anchorTop:
-{
-if ( bVerticalText )
-eTHA = SDRTEXTHORZADJUST_RIGHT;
-else
-eTVA = SDRTEXTVERTADJUST_TOP;
-}
-break;
 case mso_anchorTopCentered:
 {
 if ( bVerticalText )
@@ -887,13 +880,6 @@ rtl::Reference 
SwMSDffManager::ProcessObj(SvStream& rSt,
 case mso_anchorMiddleCentered:
 break;
 case mso_anchorBottom:
-{
-if ( bVerticalText )
-eTHA = SDRTEXTHORZADJUST_LEFT;
-else
-eTVA = SDRTEXTVERTADJUST_BOTTOM;
-}
-break;
 case mso_anchorBottomCentered:
 {
 if ( bVerticalText )


core.git: sw/source

2024-10-20 Thread Caolán McNamara (via logerrit)
 sw/source/filter/ww8/ww8par2.cxx |   22 +-
 1 file changed, 17 insertions(+), 5 deletions(-)

New commits:
commit a901b1e307bf2a62e0af7ad5ebbfc77724fab657
Author: Caolán McNamara 
AuthorDate: Fri Oct 18 21:55:09 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sun Oct 20 15:39:12 2024 +0200

cid#1606970 Overflowed constant

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

diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 7919f57d7c71..f70889dd2720 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -4440,11 +4440,23 @@ void WW8RStyle::ImportOldFormatStyles()
 
 if (cb != 0xFF)
 {
-sal_uInt8 stc2(0);
-m_rStream.ReadUChar( stc2 );
-m_rStream.SeekRel(6);
-nByteCount+=7;
-sal_uInt8 nRemainder = cb-7;
+sal_uInt8 nRemainder;
+if (cb < 7)
+{
+SAL_WARN("sw.ww8", "WW8RStyle::ImportOldFormatStyles: expected 
byte count: "
+<< static_cast(cb) << " to be >= 7");
+m_rStream.SeekRel(cb);
+nByteCount += cb;
+nRemainder = 0;
+}
+else
+{
+sal_uInt8 stc2(0);
+m_rStream.ReadUChar(stc2);
+m_rStream.SeekRel(6);
+nByteCount += 7;
+nRemainder = cb-7;
+}
 
 aPAPXOffsets[stcp].mnOffset = m_rStream.Tell();
 aPAPXOffsets[stcp].mnSize = nRemainder;


core.git: sw/source

2024-10-20 Thread Caolán McNamara (via logerrit)
 sw/source/filter/ww8/ww8scan.cxx |   17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

New commits:
commit a14da9c96d8acca989175d94186037c31c84608b
Author: Caolán McNamara 
AuthorDate: Sat Oct 19 19:09:57 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sun Oct 20 15:35:31 2024 +0200

nRead is just an alias for m_cbSTDBaseInFile, clarify that

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

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index ab9e76db1226..2efeb1c1a49b 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -6965,7 +6965,6 @@ std::unique_ptr 
WW8Style::Read1STDFixed(sal_uInt16& rSkip)
 sal_uInt16 cbStd(0);
 m_rStream.ReadUInt16(cbStd);   // read length
 
-const sal_uInt16 nRead = m_cbSTDBaseInFile;
 if( cbStd >= m_cbSTDBaseInFile )
 {
 // Fixed part completely available
@@ -6976,7 +6975,7 @@ std::unique_ptr 
WW8Style::Read1STDFixed(sal_uInt16& rSkip)
 
 do
 {
-if( 2 > nRead ) break;
+if( 2 > m_cbSTDBaseInFile ) break;
 
 sal_uInt16 a16Bit = 0;
 m_rStream.ReadUInt16( a16Bit );
@@ -6986,38 +6985,38 @@ std::unique_ptr 
WW8Style::Read1STDFixed(sal_uInt16& rSkip)
 pStd->fHasUpe  = sal_uInt16(0 != ( a16Bit & 0x4000 ));
 pStd->fMassCopy= sal_uInt16(0 != ( a16Bit & 0x8000 ));
 
-if( 4 > nRead ) break;
+if( 4 > m_cbSTDBaseInFile ) break;
 a16Bit = 0;
 m_rStream.ReadUInt16( a16Bit );
 pStd->sgc  =   a16Bit & 0x000f   ;
 pStd->istdBase = ( a16Bit & 0xfff0 ) >> 4;
 
-if( 6 > nRead ) break;
+if( 6 > m_cbSTDBaseInFile ) break;
 a16Bit = 0;
 m_rStream.ReadUInt16( a16Bit );
 pStd->cupx =   a16Bit & 0x000f   ;
 pStd->istdNext = ( a16Bit & 0xfff0 ) >> 4;
 
-if( 8 > nRead ) break;
+if( 8 > m_cbSTDBaseInFile ) break;
 m_rStream.ReadUInt16( pStd->bchUpe );
 
 // from Ver8 this two fields should be added:
-if(10 > nRead ) break;
+if (10 > m_cbSTDBaseInFile) break;
 a16Bit = 0;
 m_rStream.ReadUInt16( a16Bit );
 pStd->fAutoRedef =   a16Bit & 0x0001   ;
 pStd->fHidden= ( a16Bit & 0x0002 ) >> 1;
 // You never know: cautionary skipped
-if (nRead > 10)
+if (m_cbSTDBaseInFile > 10)
 {
-auto nSkip = std::min(nRead - 10, 
m_rStream.remainingSize());
+auto nSkip = std::min(m_cbSTDBaseInFile - 10, 
m_rStream.remainingSize());
 m_rStream.Seek(m_rStream.Tell() + nSkip);
 }
 }
 while( false ); // trick: the block above will passed through exactly 
one time
 //   and can be left early with a "break"
 
-if (!m_rStream.good() || !nRead)
+if (!m_rStream.good() || !m_cbSTDBaseInFile)
 {
 pStd.reset(); // report error with NULL
 }


core.git: sw/source

2024-10-20 Thread Xisco Fauli (via logerrit)
 sw/source/core/unocore/unochart.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f03c221f5f4a4dfc0c75057f2505a7cc171a807b
Author: Xisco Fauli 
AuthorDate: Sun Oct 20 11:21:58 2024 +0200
Commit: Caolán McNamara 
CommitDate: Sun Oct 20 15:33:56 2024 +0200

tdf#163486: PVS: fix std:swap arguments

Since
commit 81c4be45829826ae73ac14e1cb862e38dd73344d
Author: Caolán McNamara 
Date:   Sat Dec 16 20:18:13 2023 +

cid#1545561 std::swap COPY_INSTEAD_OF_MOVE

V549The first argument of 'swap' function is equal to the second 
argument.

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

diff --git a/sw/source/core/unocore/unochart.cxx 
b/sw/source/core/unocore/unochart.cxx
index 8d170ff4893e..f0afc975e723 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -301,7 +301,7 @@ static bool GetTableAndCellsFromRangeRep(
 // need to switch start and end cell ?
 // (does not check for normalization here)
 if (bSortStartEndCells && 1 == sw_CompareCellsByColFirst( 
aStartCell, aEndCell ))
-std::swap(aStartCell, aStartCell);
+std::swap(aStartCell, aEndCell);
 }
 else// a single cell like in "Table1.B3"
 {


core.git: sw/source

2024-10-20 Thread Bogdan Buzea (via logerrit)
 sw/source/core/text/EnhancedPDFExportHelper.cxx |6 --
 1 file changed, 6 deletions(-)

New commits:
commit faafdec09ae2b17aa62d091f76e0cca1b0867d17
Author: Bogdan Buzea 
AuthorDate: Sat Oct 19 18:25:12 2024 +0200
Commit: Xisco Fauli 
CommitDate: Sun Oct 20 10:29:25 2024 +0200

tdf#163486: PVS: Identical branches

V1037 Two or more case-branches perform the same actions. Check lines: 976, 
983

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

diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 95c65bd495d7..4fcc8d5252ef 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -973,12 +973,6 @@ void SwTaggedPDFHelper::SetAttributes( 
vcl::PDFWriter::StructElement eType )
 break;
 
 case vcl::PDFWriter::Link :
-bTextDecorationType =
-bBaselineShift =
-bLinkAttribute =
-bLanguage = true;
-break;
-
 case vcl::PDFWriter::BibEntry :
 bTextDecorationType =
 bBaselineShift =


core.git: sw/source

2024-10-20 Thread Bogdan Buzea (via logerrit)
 sw/source/core/doc/DocumentRedlineManager.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 005eda09ef25dd09c1f69c163041dbb40c02ce02
Author: Bogdan Buzea 
AuthorDate: Fri Oct 18 22:22:47 2024 +0200
Commit: Xisco Fauli 
CommitDate: Sun Oct 20 10:26:12 2024 +0200

tdf#163486: PVS: The variable was assign the same value.

V1048 The 'bDec' variable was assigned the same value. Lines 1787 and 1799.

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

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index d510491fb8f4..34d9067a7201 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1796,7 +1796,6 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* 
pNewRedl, bool const bCall
 // totally rotten so it does happen and we
 // better fix it.
 n = 0;
-bDec = true;
 }
 
 maRedlineTable.DeleteAndDestroy( nToBeDeleted );


core.git: sw/source

2024-10-20 Thread Bogdan Buzea (via logerrit)
 sw/source/core/doc/docbm.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 2b2b1cc59aee0a21783e53df545f8b335cd4a5bb
Author: Bogdan Buzea 
AuthorDate: Fri Oct 18 22:25:24 2024 +0200
Commit: Xisco Fauli 
CommitDate: Sun Oct 20 10:23:07 2024 +0200

tdf#163486: PVS: The variable was assign the same value.

V1048 The 'bDeleteMark' variable was assigned the same value. See lines 983 
and 1001.

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

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 956af5c3afdd..1055799fca70 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -998,7 +998,6 @@ namespace sw::mark
   || pMark->GetMarkPos().GetContentIndex() != 
*oStartContentIdx;
 break;
 default:
-bDeleteMark = true;
 break;
 }
 }


core.git: sw/source

2024-10-19 Thread Andrea Gelmini (via logerrit)
 sw/source/filter/ww8/docxattributeoutput.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit aaf61a278a8f5c77059c33818e45f34e40a7fff6
Author: Andrea Gelmini 
AuthorDate: Sat Oct 19 15:48:01 2024 +0200
Commit: Julien Nabet 
CommitDate: Sat Oct 19 15:53:05 2024 +0200

Fix typo

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

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 5d375603e210..9ff7da04e015 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3542,7 +3542,7 @@ constexpr auto constTransformationToTokenId = 
frozen::make_unordered_map

core.git: sw/source

2024-10-19 Thread Andrea Gelmini (via logerrit)
 sw/source/uibase/shells/textsh1.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 797e5314d9e6ec910fe4ce4accc867085d81fd4b
Author: Andrea Gelmini 
AuthorDate: Fri Oct 18 18:26:14 2024 +0200
Commit: Julien Nabet 
CommitDate: Sat Oct 19 15:49:59 2024 +0200

Fix typo

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

diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index 70eb356cd72f..4f68ea196bcb 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -2955,7 +2955,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
 }
 else
 {
-lcl_LogWarning("FillApi chart filtter type not 
recognised: '"
+lcl_LogWarning("FillApi chart filter type not 
recognised: '"
+ aItem2.first + "'");
 }
 }
@@ -3174,7 +3174,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
 else
 {
 lcl_LogWarning(
-"FillApi contentControl filtter type not 
recognised: '"
+"FillApi contentControl filter type not 
recognised: '"
 + aItem2.first + "'");
 }
 }


core.git: sw/source

2024-10-19 Thread Andrea Gelmini (via logerrit)
 sw/source/uibase/shells/textsh1.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cfa3292c814ddedc48b92db856d65b10d16429ef
Author: Andrea Gelmini 
AuthorDate: Fri Oct 18 18:22:45 2024 +0200
Commit: Julien Nabet 
CommitDate: Sat Oct 19 15:46:54 2024 +0200

Fix typo

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

diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index aa2219dc2fb3..70eb356cd72f 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -2848,7 +2848,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
 else
 {
 lcl_LogWarning(
-"FillApi chart resize: not 
enought parameters"
+"FillApi chart resize: not 
enough parameters"
 " (x,y is needed)");
 }
 }


core.git: sw/source

2024-10-19 Thread Vladislav Tarakanov (via logerrit)
 sw/source/filter/ww8/docxattributeoutput.cxx  |  162 +++
 sw/source/filter/ww8/docxattributeoutput.hxx  |4 
 sw/source/writerfilter/dmapper/DomainMapper.cxx   |   37 +++
 sw/source/writerfilter/dmapper/TextEffectsHandler.cxx |  190 ++
 sw/source/writerfilter/dmapper/TextEffectsHandler.hxx |   16 +
 5 files changed, 365 insertions(+), 44 deletions(-)

New commits:
commit baf179188d8b9e29188387fd4b7d887dd3168792
Author: Vladislav Tarakanov 
AuthorDate: Sat Oct 19 00:12:34 2024 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sat Oct 19 14:26:23 2024 +0200

tdf#156333 Adding a tint/shade values to the model

Before implementing text effects from the TextFill tag, their values
must be directly saved in ComplexColor, without saving in GrabBag.
To achieve this, DomainMapper has introduced separate processing
of the LN_textFill_textFill tag using the new TextFillHandler class.

TextFillHandler inherits from TextEffectsHandler. As a parameter in
the constructor, it receives a reference to the ComplexColor to which
changes will be added. This is done because some text effects
(ThemeTint, ThemeShade) can be specified in the  tag, so
TextFill must complement existing transformations. For the same
reason, when processing LN_EG_RPrBase_color, the ComplexColor
value is taken from the context if it was placed there previously.

In docx export, existing "Tint" and "Shade" transformations are
preserved only in  and .
Because the Tint and Shade values from TextFill must be
distinguished from the values from color during export, the "Tint"
and "Shade" transforms have been renamed to "ThemeTint" and
"ThemeShade". Also added new "Tint" and "Shade" transformations,
which are currently only saved in TextFill.

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

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 295c043e3cb9..5d375603e210 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -298,44 +298,50 @@ auto 
detachFrom(rtl::Reference& src)
 return rtl::Reference(std::move(src));
 }
 
+constexpr auto constThemeColorTypeTokenMap = 
frozen::make_unordered_map({
+{ model::ThemeColorType::Dark1, "dark1" },
+{ model::ThemeColorType::Light1, "light1" },
+{ model::ThemeColorType::Dark2, "dark2" },
+{ model::ThemeColorType::Light2, "light2" },
+{ model::ThemeColorType::Accent1, "accent1" },
+{ model::ThemeColorType::Accent2, "accent2" },
+{ model::ThemeColorType::Accent3, "accent3" },
+{ model::ThemeColorType::Accent4, "accent4" },
+{ model::ThemeColorType::Accent5, "accent5" },
+{ model::ThemeColorType::Accent6, "accent6" },
+{ model::ThemeColorType::Hyperlink, "hyperlink" },
+{ model::ThemeColorType::FollowedHyperlink, "followedHyperlink" }
+});
+
+OString lclGetSchemeType(model::ComplexColor const& rComplexColor)
+{
+const auto iter = 
constThemeColorTypeTokenMap.find(rComplexColor.getThemeColorType());
+assert(iter != constThemeColorTypeTokenMap.end());
+OString sSchemeType = iter->second;
+if (rComplexColor.getThemeColorUsage() == model::ThemeColorUsage::Text)
+{
+if (rComplexColor.getThemeColorType() == model::ThemeColorType::Dark1)
+sSchemeType = "text1"_ostr;
+else if (rComplexColor.getThemeColorType() == 
model::ThemeColorType::Dark2)
+sSchemeType = "text2"_ostr;
+}
+else if (rComplexColor.getThemeColorUsage() == 
model::ThemeColorUsage::Background)
+{
+if (rComplexColor.getThemeColorType() == model::ThemeColorType::Light1)
+sSchemeType = "background1"_ostr;
+else if (rComplexColor.getThemeColorType() == 
model::ThemeColorType::Light2)
+sSchemeType = "background2"_ostr;
+}
+return sSchemeType;
+}
+
 void lclAddThemeValuesToCustomAttributes(
 rtl::Reference& pAttrList, 
model::ComplexColor const& rComplexColor,
 sal_Int32 nThemeAttrId, sal_Int32 nThemeTintAttrId, sal_Int32 
nThemeShadeAttrId)
 {
-static constexpr auto constThemeColorTypeTokenMap = 
frozen::make_unordered_map({
-{ model::ThemeColorType::Dark1, "dark1" },
-{ model::ThemeColorType::Light1, "light1" },
-{ model::ThemeColorType::Dark2, "dark2" },
-{ model::ThemeColorType::Light2, "light2" },
-{ model::ThemeColorType::Accent1, "accent1" },
-{ model::ThemeColorType::Accent2, "accent2" },
-{ model::ThemeColorType::Accent3, "accent3" },
-{ model::ThemeColorType::Accent4, "accent4" },
-{ model::ThemeColorType::Accent5, "accent5" },
-{ model::ThemeColorType::Accent6, "accent6" },
-{ model::ThemeColorType::Hyperlink, 

core.git: sw/source

2024-10-18 Thread Xisco Fauli (via logerrit)
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0d04f4957a6c264947ea75b0e700dac4ee983188
Author: Xisco Fauli 
AuthorDate: Fri Oct 18 16:35:12 2024 +0200
Commit: Xisco Fauli 
CommitDate: Fri Oct 18 19:49:26 2024 +0200

tdf#163486: PVS: The same value is assigned twice

V570The same value is assigned twice to the 'pEntry' variable.

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

diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 85b8109c4920..75e758c40523 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -1559,7 +1559,7 @@ uno::Any 
DomainMapper_Impl::GetInheritedParaProperty(PropertyIds eId)
 {
 StyleSheetEntryPtr pEntry;
 if ( m_bInStyleSheetImport )
-pEntry = pEntry = GetStyleSheetTable()->FindStyleSheetByISTD(
+pEntry = GetStyleSheetTable()->FindStyleSheetByISTD(
 GetStyleSheetTable()->GetCurrentEntry()->m_sBaseStyleIdentifier);
 else
 pEntry = 
GetStyleSheetTable()->FindStyleSheetByConvertedStyleName(GetCurrentParaStyleName());


core.git: sw/source

2024-10-17 Thread Juergen Funk (via logerrit)
 sw/source/uibase/shells/basesh.cxx |   23 +--
 1 file changed, 9 insertions(+), 14 deletions(-)

New commits:
commit 7303a0375bb3ae087fb4ff77d0efc9182c60a372
Author: Juergen Funk 
AuthorDate: Tue Oct 15 10:57:15 2024 +0200
Commit: Michael Stahl 
CommitDate: Thu Oct 17 13:53:28 2024 +0200

tdf#160163 improvment when reset placeholder in Text field

 - this patch improve e8a271dd53d605a835c493eef5c34e4fb077f16d
   when replace the empty-placholder, it was missing the selection
   of the whole placeholders.
 - with this change have solved a other problem, when select with
   the field with mouse or tab, and press backspace, then the cursor
   has the wrong position, after tip text the view was wrong.
 - reduce code

Change-Id: I6c2c7b2849298552770ea2d257ab844d250a97a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174965
Tested-by: Gabor Kelemen 
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/sw/source/uibase/shells/basesh.cxx 
b/sw/source/uibase/shells/basesh.cxx
index 1a7fc5b6c197..25a4465f30b0 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -292,29 +292,24 @@ void SwBaseShell::ExecDelete(SfxRequest &rReq)
 //#i42732# - notify the edit window that from now on we do not use the 
input language
 rTmpEditWin.SetUseInputLanguage( false );
 
-std::function
-NoEmptyTextField = [](SwPosition* sp, const IDocumentMarkAccess* 
pMarksAccess)
+// Test Fieldmark when empty reset the Placeholders
+const IDocumentMarkAccess* pMarksAccess = 
rSh.GetDoc()->getIDocumentMarkAccess();
+for (SwPaM &rPaM : rSh.GetCursor()->GetRingContainer())
 {
+const SwPosition* sp = rPaM.Start();
 // Legacy text/combo/checkbox: never return read-only when inside 
these form fields.
 sw::mark::Fieldmark* pA = pMarksAccess->getInnerFieldmarkFor(*sp);
 if (pA != nullptr)
 {
-bool fm = IDocumentMarkAccess::GetType(*pA) == 
IDocumentMarkAccess::MarkType::TEXT_FIELDMARK;
-if ((pA->GetContent().getLength() == 0) && fm)
+if ((IDocumentMarkAccess::GetType(*pA) == 
IDocumentMarkAccess::MarkType::TEXT_FIELDMARK) &&
+(pA->GetContent().getLength() == 0)
+   )
 {
 pA->ReplaceContent(vEnSpaces);
-};
+rSh.GotoFieldmark(pA);
+}
 }
-};
-
-const IDocumentMarkAccess* pMarksAccess = 
rSh.GetDoc()->getIDocumentMarkAccess();
-for (SwPaM& rPaM : rSh.GetCursor()->GetRingContainer())
-{
-auto [pStt, pEnd] = rPaM.StartEnd(); // SwPosition*
-NoEmptyTextField(pStt, pMarksAccess);
-NoEmptyTextField(pEnd, pMarksAccess);
 }
-
 }
 
 void SwBaseShell::ExecClpbrd(SfxRequest &rReq)


core.git: sw/source

2024-10-17 Thread Caolán McNamara (via logerrit)
 sw/source/core/access/accpara.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit c349892967ca97748fcd065918ada191c234b7c4
Author: Caolán McNamara 
AuthorDate: Wed Oct 16 20:43:42 2024 +0100
Commit: Caolán McNamara 
CommitDate: Thu Oct 17 13:27:19 2024 +0200

cid#1555042 Data race condition

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

diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index 8befa7e9ea34..4b5aeae0450d 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -3466,7 +3466,8 @@ bool SwAccessibleParagraph::GetSelectionAtIndex(
 
 sal_Int16 SAL_CALL SwAccessibleParagraph::getAccessibleRole()
 {
-SolarMutexGuard g;
+std::scoped_lock aGuard( m_Mutex );
+
 //Get the real heading level, Heading1 ~ Heading10
 if (m_nHeadingLevel > 0)
 return AccessibleRole::HEADING;


core.git: sw/source

2024-10-17 Thread Caolán McNamara (via logerrit)
 sw/source/core/table/swtable.cxx |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 8f55160f25600039cb584975b8ff893f0453e485
Author: Caolán McNamara 
AuthorDate: Tue Oct 15 13:05:28 2024 +0100
Commit: Caolán McNamara 
CommitDate: Thu Oct 17 13:19:02 2024 +0200

cid#1606687 silence Overflowed integer argument

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

diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index fbda582fb3f9..8fb34eb88f6b 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1221,14 +1221,13 @@ void SwTable::NewSetTabCols( Parm &rParm, const 
SwTabCols &rNew,
 }
 lcl_CalcNewWidths( aRowSpanPos, aCopy, rLines[nCurr],
 rParm.nOldWish, nOldWidth, true );
-bool bGoOn = !aRowSpanPos.empty();
 sal_uInt16 j = nCurr;
-while( bGoOn )
+while (!aRowSpanPos.empty() && j > 0)
 {
-lcl_CalcNewWidths( aRowSpanPos, aCopy, rLines[--j],
+j = o3tl::sanitizing_dec(j);
+lcl_CalcNewWidths( aRowSpanPos, aCopy, rLines[j],
 rParm.nOldWish, nOldWidth, true );
 lcl_AdjustWidthsInLine( rLines[j], aCopy, rParm, 0 );
-bGoOn = !aRowSpanPos.empty() && j > 0;
 }
 aRowSpanPos.clear();
 }


core.git: sw/source

2024-10-17 Thread Caolán McNamara (via logerrit)
 sw/source/core/doc/DocumentContentOperationsManager.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 3163717d4cfe39ce510de748a14f3f588eb2c867
Author: Caolán McNamara 
AuthorDate: Wed Oct 16 21:22:02 2024 +0100
Commit: Caolán McNamara 
CommitDate: Thu Oct 17 12:11:23 2024 +0200

cid#1606973 silence Overflowed constant

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

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index d8314992364a..cf0fa505c47b 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -1039,10 +1039,8 @@ namespace
 }
 }
 
-for (;;)
+while (nPos > 0)
 {
-if (!nPos)
-break;
 nPos--;
 pSrch = rFootnoteArr[ nPos ];
 pFootnoteNd = &pSrch->GetTextNode();


core.git: sw/source

2024-10-16 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/utlui/content.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 5cf912b08e4a22f66ab1ec5fa601ba3e50e3c4cc
Author: Jim Raykowski 
AuthorDate: Tue Oct 15 20:55:33 2024 -0800
Commit: Jim Raykowski 
CommitDate: Wed Oct 16 20:58:11 2024 +0200

Resolves: tdf#163448 An unsaved new document don't allow moving

headings with Content Navigation View option (by drag and drop)

Change-Id: Id1f4cbc0538e75abfb2a133d2d6fb82ddaf580fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174986
Reviewed-by: Jim Raykowski 
Tested-by: Jenkins

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 331a4b4f308f..828c295d77a0 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1267,6 +1267,8 @@ IMPL_LINK(SwContentTree, DragBeginHdl, bool&, 
rUnsetDragIcon, bool)
 continue;
 m_aDndOutlinesSelected.push_back(pOutlineContent->GetOutlinePos());
 } while (m_xTreeView->iter_next_sibling(*xEntry) && 
m_xTreeView->is_selected(*xEntry));
+
+bDisallow = false;
 }
 
 rtl::Reference xContainer = new 
TransferDataContainer;


core.git: sw/source

2024-10-14 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/inc/conttree.hxx  |2 +-
 sw/source/uibase/utlui/content.cxx |   22 ++
 2 files changed, 11 insertions(+), 13 deletions(-)

New commits:
commit dfeefe2e97a5412a445a3a508acb2d9ae05138e5
Author: Jim Raykowski 
AuthorDate: Mon Oct 14 12:22:05 2024 -0800
Commit: Jim Raykowski 
CommitDate: Tue Oct 15 03:54:06 2024 +0200

tdf#163191 Fix crash when dragging headings in Writer navigator

by keeping track of the selected entry positions in SwOutlineNodes
instead of iterators in the content tree.

Change-Id: Iad0a477d6e3b25a1d602e3f827f2590c441eb236
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174912
Reviewed-by: Patrick Luby 
Reviewed-by: Jim Raykowski 
Tested-by: Jenkins

diff --git a/sw/source/uibase/inc/conttree.hxx 
b/sw/source/uibase/inc/conttree.hxx
index a06ef17c1bdf..4a732f4e56ca 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -133,7 +133,7 @@ class SwContentTree final : public SfxListener
 boolm_bViewHasChanged :1;
 
 // outline root mode drag & drop
-std::vector> m_aDndOutlinesSelected;
+std::vector m_aDndOutlinesSelected;
 
 bool m_bDocHasChanged = true;
 bool m_bIgnoreDocChange = false; // used to prevent tracking update
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 1694f0e0e75b..331a4b4f308f 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1251,24 +1251,22 @@ IMPL_LINK(SwContentTree, DragBeginHdl, bool&, 
rUnsetDragIcon, bool)
 // Only move drag entry and continuous selected siblings:
 m_aDndOutlinesSelected.clear();
 
-std::unique_ptr xScratch(m_xTreeView->make_iterator());
+std::unique_ptr 
xScratch(m_xTreeView->make_iterator(xEntry.get()));
 
 // Find first selected of continuous siblings
-while (true)
+while (m_xTreeView->iter_previous_sibling(*xScratch) && 
m_xTreeView->is_selected(*xScratch))
 {
-m_xTreeView->copy_iterator(*xEntry, *xScratch);
-if (!m_xTreeView->iter_previous_sibling(*xScratch))
-break;
-if (!m_xTreeView->is_selected(*xScratch))
-break;
 m_xTreeView->copy_iterator(*xScratch, *xEntry);
 }
 // Record continuous selected siblings
 do
 {
-
m_aDndOutlinesSelected.push_back(m_xTreeView->make_iterator(xEntry.get()));
-}
-while (m_xTreeView->iter_next_sibling(*xEntry) && 
m_xTreeView->is_selected(*xEntry));
+SwOutlineContent* pOutlineContent
+= 
weld::fromId(m_xTreeView->get_id(*xEntry));
+if (!pOutlineContent) // shouldn't happen
+continue;
+m_aDndOutlinesSelected.push_back(pOutlineContent->GetOutlinePos());
+} while (m_xTreeView->iter_next_sibling(*xEntry) && 
m_xTreeView->is_selected(*xEntry));
 }
 
 rtl::Reference xContainer = new 
TransferDataContainer;
@@ -5022,9 +5020,9 @@ void SwContentTree::MoveOutline(SwOutlineNodes::size_type 
nTargetPos)
 
 bool bFirstMove = true;
 
-for (const auto& source : m_aDndOutlinesSelected)
+for (const SwOutlineNodes::size_type& nPos : m_aDndOutlinesSelected)
 {
-SwOutlineNodes::size_type nSourcePos = 
weld::fromId(m_xTreeView->get_id(*source))->GetOutlinePos();
+SwOutlineNodes::size_type nSourcePos = nPos;
 
 // Done on the first selection move
 if (bFirstMove) // only do once


core.git: sw/source

2024-10-14 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/utlui/content.cxx |1 +
 sw/source/uibase/utlui/navipi.cxx  |1 +
 2 files changed, 2 insertions(+)

New commits:
commit c69b16a0f859d71a101e2c138887e7975ec71e2a
Author: Jim Raykowski 
AuthorDate: Mon Oct 14 08:47:17 2024 -0800
Commit: Jim Raykowski 
CommitDate: Mon Oct 14 22:34:17 2024 +0200

Resolves tdf#163411 NAVIGATOR: In Content Navigation View buttons to

move heading disappear after first use

Change-Id: I816ff3a7e5016d6316b63c49e5620617fe5a068f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174907
Tested-by: Jenkins
Reviewed-by: Jim Raykowski 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 5b7416b9bbcf..1694f0e0e75b 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -4104,6 +4104,7 @@ void SwContentTree::ExecCommand(std::u16string_view rCmd, 
bool bOutlineWithChild
 return false;
 });
 }
+UpdateContentFunctionsToolbar();
 }
 else
 {
diff --git a/sw/source/uibase/utlui/navipi.cxx 
b/sw/source/uibase/utlui/navipi.cxx
index 8fcb96144228..f11c31fbe531 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -679,6 +679,7 @@ void SwNavigationPI::UpdateContentFunctionsToolbar()
 eContentTypeId = pContentType->GetType();
 if (eContentTypeId == ContentTypeId::OUTLINE)
 {
+// todo: make buttons sensitive to movability (think position and 
protection)
 m_xHeadingsContentFunctionsToolbar->show();
 }
 else if 
(m_xContentTree->IsSelectedEntryCurrentDocCursorPosition(*xEntry))


core.git: sw/source

2024-10-14 Thread Noel Grandin (via logerrit)
 sw/source/core/layout/paintfrm.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 574874a554531363f379cba39a4685cdeb0e4806
Author: Noel Grandin 
AuthorDate: Sat Oct 12 19:00:49 2024 +0200
Commit: Noel Grandin 
CommitDate: Mon Oct 14 14:21:06 2024 +0200

cid#1606629 Overflowed constant

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

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 460a56767df4..f18503ff07a7 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -741,6 +741,7 @@ void SwLineRects::ConnectEdges( OutputDevice const *pOut, 
SwPaintProperties cons
   SubColFlags::Tab);
 if ( isFull() )
 {
+assert(i > 0);
 --i;
 k = aCheck.size();
 break;


core.git: sw/source

2024-10-13 Thread Noel Grandin (via logerrit)
 sw/source/core/doc/gctable.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 643cbc920b57a27fb4ff5227232c08afa07fdc49
Author: Noel Grandin 
AuthorDate: Sat Oct 12 18:55:27 2024 +0200
Commit: Noel Grandin 
CommitDate: Sun Oct 13 18:44:15 2024 +0200

cid#1608032 Overflowed constant

Not sure if what the code is doing is valid, but this change
fixes the underflow without changing the behaviour

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

diff --git a/sw/source/core/doc/gctable.cxx b/sw/source/core/doc/gctable.cxx
index 2c207ede9364..845fa603c8eb 100644
--- a/sw/source/core/doc/gctable.cxx
+++ b/sw/source/core/doc/gctable.cxx
@@ -446,6 +446,8 @@ static bool lcl_MergeGCLine(SwTableLine* pLn, GCLinePara* 
pGCPara)
 {
 if( !lcl_MergeGCBox( pLn->GetTabBoxes()[nLen], pGCPara ))
 {
+if (nLen == 0)
+break;
 --nLen;
 continue;
 }


core.git: sw/source

2024-10-13 Thread Noel Grandin (via logerrit)
 sw/source/core/frmedt/feshview.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 901483b8d846d22e9ef7bba48e521209fb450c5e
Author: Noel Grandin 
AuthorDate: Sat Oct 12 18:59:10 2024 +0200
Commit: Noel Grandin 
CommitDate: Sun Oct 13 12:20:26 2024 +0200

cid#1606581 Overflowed constant

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

diff --git a/sw/source/core/frmedt/feshview.cxx 
b/sw/source/core/frmedt/feshview.cxx
index 1dc47d379e81..3e76f6c59830 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1078,7 +1078,9 @@ void SwFEShell::SelectionToBottom( bool bBottom )
 = 
pFormat->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel())
 if (auto pPage = pDrwModel->GetPage(0))
 {
-const auto pNextObj = 
pPage->SetObjectOrdNum(pObj->GetOrdNum() - 1, pObj->GetOrdNum() - 1);
+sal_uInt32 nOrdNum = pObj->GetOrdNum();
+assert(nOrdNum > 0);
+const auto pNextObj = pPage->SetObjectOrdNum(nOrdNum - 
1, nOrdNum - 1);
 // If there is a lower object (not null)...
 if (pNextObj)
 {


core.git: sw/source

2024-10-11 Thread Miklos Vajna (via logerrit)
 sw/source/core/doc/doc.cxx |   17 +
 1 file changed, 1 insertion(+), 16 deletions(-)

New commits:
commit 8a6919f39b4b871904a2a4199755ca619aa707e2
Author: Miklos Vajna 
AuthorDate: Fri Oct 11 08:29:09 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri Oct 11 23:08:33 2024 +0200

sw: use ForEachCharacterItem() in SwDoc::ForEachCharacterBrushItem()

Avoids a lot of duplication.

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

diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index a264090a92e9..e19cfa10dc71 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1458,22 +1458,7 @@ void SwDoc::ForEachCharacterUnderlineItem( const 
std::function& rFunc ) const
 {
-for(SwCharFormat* pFormat : *GetCharFormats())
-{
-const SwAttrSet& rAttrSet = pFormat->GetAttrSet();
-if (const SvxBrushItem* pItem = 
rAttrSet.GetItemIfSet(RES_CHRATR_BACKGROUND))
-if (!rFunc(*pItem))
-return;
-}
-std::vector> aStyles;
-for (auto eFamily : { IStyleAccess::AUTO_STYLE_CHAR, 
IStyleAccess::AUTO_STYLE_RUBY, IStyleAccess::AUTO_STYLE_PARA, 
IStyleAccess::AUTO_STYLE_NOTXT })
-{
-const_cast(this)->GetIStyleAccess().getAllStyles(aStyles, 
eFamily);
-for (const auto & rxItemSet : aStyles)
-if (const SvxBrushItem* pItem = 
rxItemSet->GetItemIfSet(RES_CHRATR_BACKGROUND))
-if (!rFunc(*pItem))
-return;
-}
+ForEachCharacterItem(this, RES_CHRATR_BACKGROUND, rFunc);
 }
 
 /// Iterate over all RES_TXTATR_UNKNOWN_CONTAINER SvXMLAttrContainerItem, if 
the function returns false, iteration is stopped


core.git: sw/source

2024-10-11 Thread Noel Grandin (via logerrit)
 sw/source/core/doc/DocumentContentOperationsManager.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 3ca44fbba078872e5f91e74d2e92cbef65b0358d
Author: Noel Grandin 
AuthorDate: Thu Oct 10 20:01:57 2024 +0200
Commit: Noel Grandin 
CommitDate: Fri Oct 11 21:34:48 2024 +0200

cid#1607965 Overflowed constant

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

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index bcd58192d800..d8314992364a 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -905,7 +905,8 @@ namespace
 rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( ( eOld & 
~RedlineFlags::Ignore) | RedlineFlags::On );
 SwRedlineTable& rRedlTable = 
rDoc.getIDocumentRedlineAccess().GetRedlineTable();
 
-do {
+for (;;)
+{
 SwRangeRedline* pTmp = rRedlTable[ nRedlPos ];
 
 auto [pRStt, pREnd] = pTmp->StartEnd(); // SwPosition*
@@ -957,7 +958,10 @@ namespace
 else
 break;
 
-} while( ++nRedlPos < 
rDoc.getIDocumentRedlineAccess().GetRedlineTable().size() );
+if (nRedlPos >= 
rDoc.getIDocumentRedlineAccess().GetRedlineTable().size())
+break;
+++nRedlPos;
+}
 rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
 }
 


core.git: sw/source

2024-10-11 Thread Mike Kaganski (via logerrit)
 sw/source/core/inc/txtfrm.hxx   |2 -
 sw/source/core/text/frmform.cxx |   44 +++-
 2 files changed, 22 insertions(+), 24 deletions(-)

New commits:
commit becc2cbaf376a5aabe294bcef370e7828c96d289
Author: Mike Kaganski 
AuthorDate: Fri Oct 11 16:47:08 2024 +0500
Commit: Mike Kaganski 
CommitDate: Fri Oct 11 19:51:57 2024 +0200

Simplify the "mode" argument of SwTextFrame::AdjustFollow_

Is second bit is never tested separately; and it is only ever set
together with the first - so a simple boolean is enough.

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

diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index eb0458a9022d..369ecb839ed0 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -209,7 +209,7 @@ class SW_DLLPUBLIC SwTextFrame final : public SwContentFrame
 
 // Separates the Master and creates a Follow or adjusts the data in the 
Follow
 void AdjustFollow_( SwTextFormatter &rLine, TextFrameIndex nOffset,
-   TextFrameIndex nStrEnd, const sal_uInt8 nMode );
+   TextFrameIndex nStrEnd, bool bDontJoin );
 
 // Iterates all Lines and sets the line spacing using the attribute
 void CalcLineSpace();
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 72856363a8bc..cd19d885222d 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -604,14 +604,12 @@ css::uno::Sequence< css::style::TabStop > 
SwTextFrame::GetTabStopInfo( SwTwips C
 // If it's 0, the FollowFrame is deleted.
 void SwTextFrame::AdjustFollow_( SwTextFormatter &rLine,
  const TextFrameIndex nOffset, const TextFrameIndex nEnd,
- const sal_uInt8 nMode )
+ const bool bDontJoin)
 {
 SwFrameSwapper aSwapper( this, false );
 
 // We got the rest of the text mass: Delete all Follows
 // DummyPortions() are a special case.
-// Special cases are controlled by parameter .
-bool bDontJoin = nMode & 1;
 if( HasFollow() && !bDontJoin && nOffset == nEnd )
 {
 while( GetFollow() )
@@ -684,7 +682,7 @@ void SwTextFrame::AdjustFollow_( SwTextFormatter &rLine,
 return;
 }
 
-if ( nMode )
+if (bDontJoin)
 GetFollow()->ManipOfst(TextFrameIndex(0));
 
 if ( CalcFollow( nNewOfst ) )   // CalcFollow only at the end, we do a 
SetOffset there
@@ -1203,22 +1201,21 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
 // Call base class method 
 // instead of method  to get a break,
 // even if due to widow rule no enough lines exists.
-sal_uInt8 nNew = ( !GetFollow() &&
+bool createNew = ( !GetFollow() &&
nEnd < nStrLen &&
( rLine.IsStop() ||
  ( bHasToFit
? ( rLine.GetLineNr() > 1 &&
!rFrameBreak.IsInside( rLine ) )
-   : rFrameBreak.IsBreakNow( rLine ) ) ) )
- ? 1 : 0;
+   : rFrameBreak.IsBreakNow( rLine ) ) ) );
 
 SwTextFormatInfo& rInf = rLine.GetInfo();
 bool bEmptyWithSplitFly = false;
-if (nNew == 0 && !nStrLen && !rInf.GetTextFly().IsOn() && 
IsEmptyWithSplitFly())
+if (!createNew && !nStrLen && !rInf.GetTextFly().IsOn() && 
IsEmptyWithSplitFly())
 {
 // Empty paragraph, so IsBreakNow() is not called, but we should split 
the fly portion and
 // the paragraph marker.
-nNew = 1;
+createNew = true;
 bEmptyWithSplitFly = true;
 }
 
@@ -1241,9 +1238,9 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
 else if (!isFirstVisibleFrameInPageBody(this))
 bLoneAsCharAnchoredObj = false;
 else
-nNew = 0;
+createNew = false;
 }
-else if (nNew)
+else if (createNew)
 {
 if (IsFollow())
 {
@@ -1253,7 +1250,7 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
 auto precedeText = precede->DynCastTextFrame();
 assert(precedeText);
 if (isReallyEmptyMaster(precedeText))
-nNew = 0;
+createNew = false;
 }
 else if (!bEmptyWithSplitFly)
 {
@@ -1262,22 +1259,23 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
 // frame if we have columns.
 if (pBodyFrame && !FindColFrame() && 
isFirstVisibleFrameInPageBody(this)
 && !hasFly(this) && !hasAtPageFly(pBodyFrame))
-nNew = 0;
+createNew = false;
 }
 }
 
-if (nNew && nEnd == TextFrameIndex(0) && !bEmptyWithSplitFly && 
HasFullPag

core.git: sw/source

2024-10-11 Thread Noel Grandin (via logerrit)
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 426019a4ed329a5b7af3ce998068ea3479e8bff7
Author: Noel Grandin 
AuthorDate: Thu Oct 10 19:59:42 2024 +0200
Commit: Noel Grandin 
CommitDate: Fri Oct 11 10:45:29 2024 +0200

cid#1606973 Overflowed constant

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

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index e8c0055f9e49..bcd58192d800 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -1035,9 +1035,15 @@ namespace
 }
 }
 
-while( nPos-- && ( pFootnoteNd = &( pSrch = rFootnoteArr[ nPos ] 
)->
-GetTextNode())->GetIndex() >= rSttNd.GetIndex() )
+for (;;)
 {
+if (!nPos)
+break;
+nPos--;
+pSrch = rFootnoteArr[ nPos ];
+pFootnoteNd = &pSrch->GetTextNode();
+if (pFootnoteNd->GetIndex() < rSttNd.GetIndex())
+break;
 const sal_Int32 nFootnoteSttIdx = pSrch->GetStart();
 if( !oEndCnt || !oSttCnt ||
 !  (( &rSttNd == pFootnoteNd &&


core.git: sw/source

2024-10-10 Thread Miklos Vajna (via logerrit)
 sw/source/core/doc/doc.cxx |   27 ++-
 1 file changed, 6 insertions(+), 21 deletions(-)

New commits:
commit e9dcbf84f94b90ee8cd78628a0c9b5fb131d1085
Author: Miklos Vajna 
AuthorDate: Thu Oct 10 08:05:01 2024 +0200
Commit: Miklos Vajna 
CommitDate: Thu Oct 10 13:19:03 2024 +0200

sw: use ForEachCharacterItem() in SwDoc::ForEachCharacterBoxItem()

Avoids a lot of duplication.

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

diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 6c3db0e7acaa..a264090a92e9 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1412,27 +1412,6 @@ void SwDoc::ForEachFormatURL( const 
std::function& rFu
 }
 }
 
-/// Iterate over all SwFormatURL, if the function returns false, iteration is 
stopped
-void SwDoc::ForEachCharacterBoxItem( const std::function& rFunc ) const
-{
-for(SwCharFormat* pFormat : *GetCharFormats())
-{
-const SwAttrSet& rAttrSet = pFormat->GetAttrSet();
-if (const SvxBoxItem* pBoxItem = rAttrSet.GetItemIfSet(RES_CHRATR_BOX))
-if (!rFunc(*pBoxItem))
-return;
-}
-std::vector> aStyles;
-for (auto eFamily : { IStyleAccess::AUTO_STYLE_CHAR, 
IStyleAccess::AUTO_STYLE_RUBY, IStyleAccess::AUTO_STYLE_PARA, 
IStyleAccess::AUTO_STYLE_NOTXT })
-{
-const_cast(this)->GetIStyleAccess().getAllStyles(aStyles, 
eFamily);
-for (const auto & rxItemSet : aStyles)
-if (const SvxBoxItem* pBoxItem = 
rxItemSet->GetItemIfSet(RES_CHRATR_BOX))
-if (!rFunc(*pBoxItem))
-return;
-}
-}
-
 namespace
 {
 /// Iterate over all pool item of type T, if the function returns false, 
iteration is stopped
@@ -1458,6 +1437,12 @@ void ForEachCharacterItem(const SwDoc* pDoc, 
TypedWhichId nWhich, const std::
 }
 }
 
+/// Iterate over all SwFormatURL, if the function returns false, iteration is 
stopped
+void SwDoc::ForEachCharacterBoxItem( const std::function& rFunc ) const
+{
+ForEachCharacterItem(this, RES_CHRATR_BOX, rFunc);
+}
+
 /// Iterate over all SvxColorItem, if the function returns false, iteration is 
stopped
 void SwDoc::ForEachCharacterColorItem( const std::function& rFunc ) const
 {


core.git: sw/source

2024-10-09 Thread Oliver Specht (via logerrit)
 sw/source/ui/config/optpage.cxx   |4 +++-
 sw/source/uibase/app/swmodul1.cxx |2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 9400c0cf10bc14963a994ec0c0caeeb22a7c2513
Author: Oliver Specht 
AuthorDate: Tue Oct 8 10:46:24 2024 +0200
Commit: Thorsten Behrens 
CommitDate: Wed Oct 9 20:15:46 2024 +0200

tdf#132274 follow-up fix to Writer zoom options

Applying the zoom value works now as expected. The prior
fix mixed up zoom value and 100% and didn't always apply
special zoom values.

Change-Id: I7cf1f34fca5724eea14339535e7614cfecffdd79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174688
Reviewed-by: Thorsten Behrens 
Tested-by: Jenkins

diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index ee8d46b1c401..476d4957257d 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -433,9 +433,11 @@ bool SwContentOptPage::FillItemSet(SfxItemSet* rSet)
 aElem.SetDefaultZoomValue(100);
 }
 else
+{
 aElem.SetDefaultZoomType(SvxZoomType::PERCENT);
+
aElem.SetDefaultZoomValue(m_xZoomValue->get_value(FieldUnit::PERCENT));
+}
 }
-aElem.SetDefaultZoomValue(m_xZoomValue->get_value(FieldUnit::PERCENT));
 
 bool bRet = !pOldAttr || aElem != *pOldAttr;
 if(bRet)
diff --git a/sw/source/uibase/app/swmodul1.cxx 
b/sw/source/uibase/app/swmodul1.cxx
index b246dbbb5b2e..be12a460ab6d 100644
--- a/sw/source/uibase/app/swmodul1.cxx
+++ b/sw/source/uibase/app/swmodul1.cxx
@@ -100,7 +100,7 @@ static void lcl_SetUIPrefs(const SwViewOption &rPref, 
SwView* pView, SwViewShell
 pView->CreateTab();
 else
 pView->KillTab();
-
+pView->SetZoom(rPref.GetZoomType(), rPref.GetZoom(), true);
 pView->GetPostItMgr()->PrepareView(true);
 }
 


core.git: sw/source

2024-10-08 Thread Caolán McNamara (via logerrit)
 sw/source/filter/ww8/wrtww8.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 38c47c91abc96c32f319bd6bd4015d6d9c04332f
Author: Caolán McNamara 
AuthorDate: Sun Oct 6 15:33:48 2024 +0100
Commit: Caolán McNamara 
CommitDate: Tue Oct 8 13:29:20 2024 +0200

cid#1607834 Overflowed constant

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

diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 2d476ead766b..df4b5f6627c6 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1079,8 +1079,8 @@ void WW8_WrPlcPn::WritePlc()
 m_Fkps[ i ]->GetStartFc() );
 }
 
-SwWW8Writer::WriteLong( *m_rWrt.m_pTableStrm,
-m_Fkps[ i - 1 ]->GetEndFc() );
+WW8_FC nEndFc = i > 0 ? m_Fkps[i - 1]->GetEndFc() : 0;
+SwWW8Writer::WriteLong(*m_rWrt.m_pTableStrm, nEndFc);
 
 // for every FKP output the page
 for (i = 0; i < m_Fkps.size(); ++i)


core.git: sw/source

2024-10-06 Thread Caolán McNamara (via logerrit)
 sw/source/core/docnode/ndtbl.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit ffd383c7051d02d8d9606fd6e5e0ae0be70b86f7
Author: Caolán McNamara 
AuthorDate: Sun Oct 6 14:48:38 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sun Oct 6 22:07:17 2024 +0200

clarify this a little

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

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index facfb5798ba5..b4c348d92e1b 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -3004,11 +3004,12 @@ void SwCollectTableLineBoxes::AddBox( const SwTableBox& 
rBox )
 
 const SwTableBox* SwCollectTableLineBoxes::GetBoxOfPos( const SwTableBox& rBox 
)
 {
-if (m_aPositionArr.empty())
+size_t nCount = m_aPositionArr.size();
+if (nCount == 0)
 return nullptr;
 
 std::vector::size_type n;
-for( n = 0; n < m_aPositionArr.size(); ++n )
+for (n = 0; n < nCount; ++n)
 {
 if( m_aPositionArr[ n ] == m_nWidth )
 break;
@@ -3020,7 +3021,7 @@ const SwTableBox* SwCollectTableLineBoxes::GetBoxOfPos( 
const SwTableBox& rBox )
 }
 }
 
-if( n >= m_aPositionArr.size() )
+if (n >= nCount)
 --n;
 
 m_nWidth = m_nWidth + 
o3tl::narrowing(rBox.GetFrameFormat()->GetFrameSize().GetWidth());


core.git: sw/source

2024-10-06 Thread Caolán McNamara (via logerrit)
 sw/source/core/docnode/ndtbl.cxx |   35 +--
 1 file changed, 17 insertions(+), 18 deletions(-)

New commits:
commit f60d768fad73494fbfd600d8c7f8a0f1c7e3e857
Author: Caolán McNamara 
AuthorDate: Sun Oct 6 14:45:00 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sun Oct 6 21:47:20 2024 +0200

flatten SwCollectTableLineBoxes::GetBoxOfPos

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

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index b36fd35dba4b..facfb5798ba5 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -3004,28 +3004,27 @@ void SwCollectTableLineBoxes::AddBox( const SwTableBox& 
rBox )
 
 const SwTableBox* SwCollectTableLineBoxes::GetBoxOfPos( const SwTableBox& rBox 
)
 {
-const SwTableBox* pRet = nullptr;
+if (m_aPositionArr.empty())
+return nullptr;
 
-if( !m_aPositionArr.empty() )
+std::vector::size_type n;
+for( n = 0; n < m_aPositionArr.size(); ++n )
 {
-std::vector::size_type n;
-for( n = 0; n < m_aPositionArr.size(); ++n )
-if( m_aPositionArr[ n ] == m_nWidth )
-break;
-else if( m_aPositionArr[ n ] > m_nWidth )
-{
-if( n )
---n;
-break;
-}
+if( m_aPositionArr[ n ] == m_nWidth )
+break;
+else if( m_aPositionArr[ n ] > m_nWidth )
+{
+if( n )
+--n;
+break;
+}
+}
 
-if( n >= m_aPositionArr.size() )
---n;
+if( n >= m_aPositionArr.size() )
+--n;
 
-m_nWidth = m_nWidth + 
o3tl::narrowing(rBox.GetFrameFormat()->GetFrameSize().GetWidth());
-pRet = m_Boxes[ n ];
-}
-return pRet;
+m_nWidth = m_nWidth + 
o3tl::narrowing(rBox.GetFrameFormat()->GetFrameSize().GetWidth());
+return m_Boxes[ n ];
 }
 
 bool SwCollectTableLineBoxes::Resize( sal_uInt16 nOffset, sal_uInt16 nOldWidth 
)


core.git: sw/source

2024-10-06 Thread Caolán McNamara (via logerrit)
 sw/source/filter/ww8/WW8TableInfo.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 5f64f05d3e42cee53423d7b7b80783fbca0aed23
Author: Caolán McNamara 
AuthorDate: Sat Oct 5 21:14:05 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sun Oct 6 15:31:22 2024 +0200

cid#1608177 silence Overflowed constant

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

diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx 
b/sw/source/filter/ww8/WW8TableInfo.cxx
index 5f843439bf2b..c148285e0ec0 100644
--- a/sw/source/filter/ww8/WW8TableInfo.cxx
+++ b/sw/source/filter/ww8/WW8TableInfo.cxx
@@ -1206,6 +1206,7 @@ WW8TableNodeInfo * 
WW8TableCellGrid::connectCells(RowEndInners_t &rLastRowEnds)
 
 if (pNode->IsEndNode())
 {
+assert(nDepthInCell > 0 && "otherwise overflow");
 nDepthInCell--;
 
 if (nDepthInCell == 0 && !pEndOfCellInfo)


core.git: sw/source

2024-10-06 Thread Andrea Gelmini (via logerrit)
 sw/source/uibase/docvw/AnnotationWin.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2ed39b9673474c59f3e38eb47263c99cdfb3c501
Author: Andrea Gelmini 
AuthorDate: Sat Oct 5 13:06:58 2024 +0200
Commit: Julien Nabet 
CommitDate: Sun Oct 6 10:11:15 2024 +0200

Fix typo

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

diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx 
b/sw/source/uibase/docvw/AnnotationWin.cxx
index bfd777c68630..24b4ee846252 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -493,7 +493,7 @@ void SwAnnotationWin::UpdateHTML(const OUString& rHtml)
sHtmlContent.getLength(), StreamMode::READ);
 SvKeyValueIteratorRef xValues(new SvKeyValueIterator);
 // Insert newlines for divs, not normally done, so to keep things simple
-// only enable tthat for this case.
+// only enable that for this case.
 xValues->Append(SvKeyValue("newline-on-div", "true"));
 GetOutlinerView()->Read(aHTMLStream, EETextFormat::Html, xValues.get());
 UpdateData();


core.git: sw/source

2024-10-05 Thread László Németh (via logerrit)
 sw/source/core/inc/scriptinfo.hxx |4 +-
 sw/source/core/text/porlay.cxx|   74 +-
 sw/source/core/text/porrst.cxx|   65 +
 sw/source/core/text/porrst.hxx|4 +-
 4 files changed, 127 insertions(+), 20 deletions(-)

New commits:
commit 3393e52be0900ad63ceee0a43cd44d473ec8248a
Author: László Németh 
AuthorDate: Tue Oct 1 19:33:46 2024 +0200
Commit: László Németh 
CommitDate: Sat Oct 5 16:20:57 2024 +0200

tdf#163309 sw: show rdf:type as labels on bookmark boundary marks

OOo's RDF handling had limited support to optional metadata visualization, 
like custom prefix/suffix of metadata fields.
This is a similar visualization for bookmark rdf:type metadata,
but without changing the text layout by enabling/disabling
View->Field Shading.

The labels, i.e. text content of rdf:type have left-aligned
top position after the opening bracket of the optional bookmark
boundary mark, and right-aligned bottom position before the
closing bracket. The labels don't overlap at multiple brackets.

Note: the labels are very next to the line text vertically
to support fixed line height better.

Follow-up to commit 412e0ab26618c38f548c340f85ef63bbe73ef6b2
"tdf#150717 sw RDF metadata: add custom color bookmark boundary marks"

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

diff --git a/sw/source/core/inc/scriptinfo.hxx 
b/sw/source/core/inc/scriptinfo.hxx
index 60cf9c542eab..65c34f407a3e 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -72,7 +72,7 @@ private:
 std::deque m_NoKashidaLine;
 std::deque m_NoKashidaLineEnd;
 std::vector m_HiddenChg;
-std::vector> 
m_Bookmarks;
+std::vector> m_Bookmarks;
 //! Records a single change in compression.
 struct CompressionChangeInfo
 {
@@ -184,7 +184,7 @@ public:
 }
 TextFrameIndex NextHiddenChg(TextFrameIndex nPos) const;
 TextFrameIndex NextBookmark(TextFrameIndex nPos) const;
-std::vector>
+std::vector>
 GetBookmarks(TextFrameIndex const nPos);
 static void CalcHiddenRanges(const SwTextNode& rNode,
 MultiSelection& rHiddenMulti,
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 39a260ac0ef8..9f0fd502114f 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -909,13 +909,54 @@ static Color getBookmarkColor(const SwTextNode& rNode, 
const sw::mark::Bookmark*
 return c;
 }
 
+static OUString getBookmarkType(const SwTextNode& rNode, const 
sw::mark::Bookmark* pBookmark)
+{
+// search ODF_PREFIX in metadata, otherwise use empty string;
+OUString sRet;
+
+try
+{
+SwDoc& rDoc = const_cast(rNode.GetDoc());
+const rtl::Reference< SwXBookmark > xRef = 
SwXBookmark::CreateXBookmark(rDoc,
+const_cast(static_cast(pBookmark)));
+const css::uno::Reference xSubject(xRef);
+rtl::Reference xModel = 
rDoc.GetDocShell()->GetBaseModel();
+
+static uno::Reference< uno::XComponentContext > xContext(
+::comphelper::getProcessComponentContext());
+
+static uno::Reference< rdf::XURI > xODF_PREFIX(
+rdf::URI::createKnown(xContext, rdf::URIs::RDF_TYPE), 
uno::UNO_SET_THROW);
+
+uno::Reference xDocumentMetadataAccess(
+rDoc.GetDocShell()->GetBaseModel());
+const uno::Reference& xRepository =
+xDocumentMetadataAccess->getRDFRepository();
+const uno::Reference xEnum(
+xRepository->getStatements(xSubject, xODF_PREFIX, nullptr), 
uno::UNO_SET_THROW);
+
+rdf::Statement stmt;
+if ( xEnum->hasMoreElements() && (xEnum->nextElement() >>= stmt) )
+{
+const uno::Reference xObject(stmt.Object, 
uno::UNO_QUERY);
+if ( xObject.is() )
+sRet = xObject->getValue();
+}
+}
+catch (const lang::IllegalArgumentException&)
+{
+}
+
+return sRet;
+}
+
 static void InitBookmarks(
 std::optional::const_iterator> oPrevIter,
 std::vector::const_iterator iter,
 std::vector::const_iterator const end,
 TextFrameIndex nOffset,
 std::vector> 
& rBookmarks,
-std::vector> & o_rBookmarks)
+std::vector> & o_rBookmarks)
 {
 SwTextNode const*const pNode(iter->pNode);
 for (auto const& it : rBookmarks)
@@ -925,7 +966,7 @@ static void InitBookmarks(
 
 // search for custom bookmark boundary mark color
 Color c = getBookmarkColor(*pNode, it.first);
-
+OUString sType = getBookmarkType(*pNode, it.first);
 switch (it.second)
 {
 case SwScriptInfo::MarkKind::Start:
@@ -953,7 +994,7 @@ static void InitBookmarks(
 }
   

core.git: sw/source

2024-10-04 Thread Stephan Bergmann (via logerrit)
 sw/source/core/doc/DocumentSettingManager.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 75f3ee7e8a06ed5fec17c358c62e3efeb8d13e8d
Author: Stephan Bergmann 
AuthorDate: Fri Oct 4 16:35:56 2024 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Oct 4 21:29:48 2024 +0200

Initialize sw::DocumentSettingManager::mbNoClippingWithWrapPolygon

...newly introduced in 3800ab58355385dcb482d3089accc7ce141f5ee9 "tdf#161233
paint pictures completely also with contour wrap", and which started to make
CppunitTest_vcl_pdfexport2 CPPUNIT_TEST_NAME=testTdf124272::TestBody fail 
with

> pdfexport2.cxx:180:Assertion
> Test name: (anonymous namespace)::testTdf124272::TestBody
> assertion failed
> - Expression: it != pEnd

in some builds like 

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

diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 942272abc3b6..9f3858f8c0b6 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -110,7 +110,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc 
&rDoc)
 mbUseVariableWidthNBSP(false),
 mbPaintHellOverHeaderFooter(false),
 mbMinRowHeightInclBorder(false),
-mbMsWordCompGridMetrics(false) // tdf#129808
+mbMsWordCompGridMetrics(false), // tdf#129808
+mbNoClippingWithWrapPolygon(false)
 
 // COMPATIBILITY FLAGS END
 {


core.git: sw/source

2024-10-03 Thread Caolán McNamara (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit c5f4fe10589acff4d253cc3d32acaf67c7456bd7
Author: Caolán McNamara 
AuthorDate: Thu Oct 3 15:14:05 2024 +0100
Commit: Xisco Fauli 
CommitDate: Thu Oct 3 23:37:51 2024 +0200

check for null DocShell before deref

an effort to fix:

https://crashreport.libreoffice.org/stats/signature/static%20void%20sw::%60anonymous%20namespace'::TextFormattingCheck::check(class%20SwNode%20*)

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

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 04ef133f8e7e..2b6cce2107c8 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1548,7 +1548,12 @@ public:
 return;
 
 SwTextNode* pTextNode = pCurrent->GetTextNode();
-SwWrtShell* pWrtShell = 
pTextNode->GetDoc().GetDocShell()->GetWrtShell();
+
+SwDocShell* pDocShell = pTextNode->GetDoc().GetDocShell();
+if (!pDocShell)
+return;
+
+SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
 if (pWrtShell && !pTextNode->getLayoutFrame(pWrtShell->GetLayout()))
 return;
 


core.git: sw/source

2024-10-02 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/paintfrm.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d5fcc8ea25e416a4d2bea5e0f92c0e403997d845
Author: Michael Stahl 
AuthorDate: Wed Oct 2 18:51:44 2024 +0200
Commit: Michael Stahl 
CommitDate: Wed Oct 2 21:27:13 2024 +0200

tdf#163032 sw: fix painting of row frame with rowspan > 1 cell

Super non intuitive representation of a rowspan > 1 cell split across
pages is that the follow frame will be in a row that's 0 height, but its
own height extends to the bottom of the following merged rows.

(regression from commit 13495926390ba54fbcd45ec00fbe613b1f2b734b)

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

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index e6088c22a778..5cad611eab7e 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3718,8 +3718,8 @@ SwShortCut::SwShortCut( const SwFrame& rFrame, const 
SwRect& rRect )
 
 void SwLayoutFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect 
const& rRect, PaintFrameMode ePaintFrameMode) const
 {
-if (!getFramePrintArea().HasArea())
-{
+if (!getFramePrintArea().HasArea() && !IsRowFrame())
+{   // tdf#163032 row frame may contain rowspan>1 cell that must be painted
 return; // do not paint hidden frame
 }
 


core.git: sw/source

2024-10-02 Thread Mohit Marathe (via logerrit)
 sw/source/uibase/sidebar/CommentsPanel.cxx |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 1a09da6c7ed13139586e5400fea223bac65fcac6
Author: Mohit Marathe 
AuthorDate: Fri Sep 27 16:49:39 2024 +0530
Commit: Sarper Akdemir 
CommitDate: Wed Oct 2 11:59:21 2024 +0200

sw: give warning when comment cannot be deleted in comments panel

Instead of crashing LO, this patch gives a warning if it is not
able to find the comment or thread to be deleted

Change-Id: Ia36e1b31929cea6c70322265b3062b5b8458291f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174107
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir 

diff --git a/sw/source/uibase/sidebar/CommentsPanel.cxx 
b/sw/source/uibase/sidebar/CommentsPanel.cxx
index 6bf6d8336a70..eb4a40747fd1 100644
--- a/sw/source/uibase/sidebar/CommentsPanel.cxx
+++ b/sw/source/uibase/sidebar/CommentsPanel.cxx
@@ -542,11 +542,19 @@ void CommentsPanel::deleteComment(sal_uInt32 nId)
 sal_uInt32 nRootId = getPostItId(pRootNote);
 
 if (mpThreadsMap.find(nRootId) == mpThreadsMap.end())
-throw std::runtime_error("Cannot delete comment: Thread does not 
exist");
+{
+SAL_WARN("sw",
+ "Comments Panel is unable to delete comment: Referenced 
thread does not exist!");
+return;
+}
 auto& pComment = mpCommentsMap[nId];
 auto& pThread = mpThreadsMap[nRootId];
 if (!pComment)
-throw std::runtime_error("Cannot delete comment: Comment does not 
exist");
+{
+SAL_WARN("sw",
+ "Comments Panel is unable to delete comment: Referenced 
comment does not exist!");
+return;
+}
 
 pThread->getCommentBoxWidget()->move(pComment->get_widget(), nullptr);
 mpCommentsMap.erase(nId);


core.git: sw/source

2024-09-29 Thread Julien Nabet (via logerrit)
 sw/source/uibase/docvw/PostItMgr.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit c6cc724d8805215c7b5ad7b76cd167c6640e8e52
Author: Julien Nabet 
AuthorDate: Sun Sep 29 22:00:58 2024 +0200
Commit: Julien Nabet 
CommitDate: Mon Sep 30 08:45:19 2024 +0200

tdf#158323: CRASH when switch back from HTML to Normal View...

after edit in HTML code.

bt:
0  rtl::Reference::get (this=0xb8) at 
include/rtl/ref.hxx:205
1  0x7f4361f3857c in SwDocStyleSheetPool::GetEEStyleSheetPool 
(this=0x0) at sw/inc/docstyle.hxx:236
2  0x7f4362dcb8e2 in SwPostItMgr::SwPostItMgr (this=0x558439087f60, 
pView=0x5584387f7e80) at 
/home/julien/lo/libreoffice/sw/source/uibase/docvw/PostItMgr.cxx:229
3  0x7f43630e6b14 in SwView::SwView (this=0x5584387f7e80, _rFrame=..., 
pOldSh=0x5584356fa360) at 
/home/julien/lo/libreoffice/sw/source/uibase/uiview/view.cxx:1003
4  0x7f43632fee79 in SwWebView::SwWebView (this=0x5584387f7e80, 
_rFrame=..., _pShell=0x5584356fa360) at 
/home/julien/lo/libreoffice/sw/source/uibase/web/wview.cxx:85
5  0x7f43632feb51 in SwWebView::CreateInstance (rFrame=..., 
pOldView=0x5584356fa360) at 
/home/julien/lo/libreoffice/sw/source/uibase/web/wview.cxx:67
6  0x7f4393710655 in SfxViewFactory::CreateInstance 
(this=0x558434c3a090, rFrame=..., pOldSh=0x5584356fa360) at 
/home/julien/lo/libreoffice/sfx2/source/view/viewfac.cxx:26
7  0x7f4393501e31 in SfxBaseModel::createViewController
   (this=0x558431de5a80, i_rViewName="Default", i_rArguments=empty 
uno::Sequence, i_rFrame=uno::Reference to ((anonymous namespace)::XFrameImpl *) 
0x5584360bf520)
   at /home/julien/lo/libreoffice/sfx2/source/doc/sfxbasemodel.cxx:4334
8  0x7f4393502a3f in non-virtual thunk to 
SfxBaseModel::createViewController(rtl::OUString const&, 
com::sun::star::uno::Sequence const&, 
com::sun::star::uno::Reference const&) () at 
/home/julien/lo/libreoffice/instdir/program/libsfxlo.so
9  0x7f43936b4ce4 in (anonymous 
namespace)::SfxFrameLoader_Impl::impl_createDocumentView
   (i_rModel=uno::Reference to (SwXTextDocument *) 0x558431de5b10, 
i_rFrame=uno::Reference to ((anonymous namespace)::XFrameImpl *) 
0x5584360bf520, i_rViewFactoryArgs=..., i_rViewName="Default")
   at /home/julien/lo/libreoffice/sfx2/source/view/frmload.cxx:577
10 0x7f43936b1f6c in (anonymous namespace)::SfxFrameLoader_Impl::load
   (this=0x558436633660, rArgs=uno::Sequence of length 18 = {...}, 
_rTargetFrame=uno::Reference to ((anonymous namespace)::XFrameImpl *) 
0x5584360bf520)
   at /home/julien/lo/libreoffice/sfx2/source/view/frmload.cxx:759
11 0x7f439441ea51 in framework::LoadEnv::impl_loadContent 
(this=0x7ffdd69352c8) at 
/home/julien/lo/libreoffice/framework/source/loadenv/loadenv.cxx:1176
12 0x7f439441b7d4 in framework::LoadEnv::start (this=0x7ffdd69352c8) at 
/home/julien/lo/libreoffice/framework/source/loadenv/loadenv.cxx:412

Regression from:

https://git.libreoffice.org/core/+/d934aeace6e7049db3959421538ae382cb97b1d1%5E%21
tdf#103064 sw,editeng: make para styles work inside comments

Change-Id: Ib9a1c9fe779ad14f93de0e1b3645beddb85e511d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174210
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Julien Nabet 

diff --git a/sw/source/uibase/docvw/PostItMgr.cxx 
b/sw/source/uibase/docvw/PostItMgr.cxx
index 03e2b9db6997..2d4ff760c04b 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -226,7 +226,9 @@ SwPostItMgr::SwPostItMgr(SwView* pView)
 StartListening(*mpView->GetDocShell());
 // listen to stylesheet pool to update on stylesheet rename,
 // as EditTextObject references styles by name.
-
StartListening(*static_cast(mpView->GetDocShell()->GetStyleSheetPool())->GetEEStyleSheetPool());
+SfxStyleSheetBasePool* pStyleSheetPool = 
mpView->GetDocShell()->GetStyleSheetPool();
+if (pStyleSheetPool)
+
StartListening(*static_cast(pStyleSheetPool)->GetEEStyleSheetPool());
 if (!mvPostItFields.empty())
 {
 mbWaitingForCalcRects = true;


core.git: sw/source

2024-09-29 Thread Noel Grandin (via logerrit)
 sw/source/core/doc/DocumentRedlineManager.cxx |   10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit bf340cc7d08545dd2fd9c1c53a9f2907df3ad533
Author: Noel Grandin 
AuthorDate: Sun Sep 29 13:28:26 2024 +0200
Commit: Noel Grandin 
CommitDate: Mon Sep 30 08:07:33 2024 +0200

cid#1606686 Overflowed constant

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

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index 411727e1880f..d510491fb8f4 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1204,15 +1204,13 @@ void DocumentRedlineManager::SetRedlineFlags( 
RedlineFlags eMode )
 }
 
 for (sal_uInt16 nLoop = 1; nLoop <= 2; ++nLoop)
-for (size_t i = 0; i < maRedlineTable.size(); ++i)
+for (size_t i = 0; i < maRedlineTable.size(); )
 {
 SwRangeRedline *const pRedline = maRedlineTable[i];
 (pRedline->*pFnc)(nLoop, i, false);
-while (maRedlineTable.size() <= i
-|| maRedlineTable[i] != pRedline)
-{// ensure current position
---i; // a previous redline may have been deleted
-}
+// a previous redline may have been deleted
+if (i < maRedlineTable.size() && maRedlineTable[i] == pRedline)
+++i;
 }
 
 //SwRangeRedline::MoveFromSection routinely changes


core.git: sw/source

2024-09-29 Thread Noel Grandin (via logerrit)
 sw/source/core/unocore/unochart.cxx |   21 ++---
 1 file changed, 6 insertions(+), 15 deletions(-)

New commits:
commit 358298fd29caf3f20f84445aad0a907ccf54aff7
Author: Noel Grandin 
AuthorDate: Sun Sep 29 12:27:06 2024 +0200
Commit: Noel Grandin 
CommitDate: Sun Sep 29 20:29:33 2024 +0200

simplify

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

diff --git a/sw/source/core/unocore/unochart.cxx 
b/sw/source/core/unocore/unochart.cxx
index 10c79c82cd10..8d170ff4893e 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -2205,15 +2205,12 @@ void SAL_CALL SwChartDataSequence::disposing( const 
lang::EventObject& rSource )
 
 void SAL_CALL SwChartDataSequence::dispose(  )
 {
-bool bMustDispose( false );
 {
 std::unique_lock aGuard( GetChartMutex() );
-bMustDispose = !m_bDisposed;
-if (!m_bDisposed)
-m_bDisposed = true;
+if (m_bDisposed)
+return;
+m_bDisposed = true;
 }
-if (!bMustDispose)
-return;
 
 if (m_xDataProvider.is())
 {
@@ -2653,19 +2650,13 @@ void SAL_CALL 
SwChartLabeledDataSequence::removeModifyListener(
 
 void SAL_CALL SwChartLabeledDataSequence::dispose(  )
 {
-bool bMustDispose( false );
-{
-std::unique_lock aGuard( GetChartMutex() );
-bMustDispose = !m_bDisposed;
-if (!m_bDisposed)
-m_bDisposed = true;
-}
-if (!bMustDispose)
+std::unique_lock aGuard( GetChartMutex() );
+if (m_bDisposed)
 return;
+m_bDisposed = true;
 
 // require listeners to release references to this object
 lang::EventObject aEvtObj( static_cast< chart2::data::XLabeledDataSequence 
* >(this) );
-std::unique_lock aGuard( GetChartMutex() );
 m_aModifyListeners.disposeAndClear( aGuard, aEvtObj );
 m_aEventListeners.disposeAndClear( aGuard, aEvtObj );
 }


core.git: sw/source

2024-09-29 Thread Noel Grandin (via logerrit)
 sw/source/core/doc/docglbl.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 2b4375fcfa5f1f852ab6c85ca82d55c2be324b70
Author: Noel Grandin 
AuthorDate: Sun Sep 29 13:25:08 2024 +0200
Commit: Noel Grandin 
CommitDate: Sun Sep 29 20:29:02 2024 +0200

cid#1606690 Overflowed constant

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

diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index 56f78b66cb9a..6066a230fb0f 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -369,7 +369,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& 
rPath, bool bOutline,
 
 // If FlyFrames are still around, delete these too
 auto& rSpzs = *GetSpzFrameFormats();
-
for(sw::FrameFormats::size_type n = 0; n < 
GetSpzFrameFormats()->size(); ++n)
+
for(sw::FrameFormats::size_type n = 0; n < 
GetSpzFrameFormats()->size(); )
 {
 auto pFly = rSpzs[n];
 const SwFormatAnchor* pAnchor = 
&pFly->GetAnchor();
@@ -382,8 +382,9 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& 
rPath, bool bOutline,
 *pAnchorNode < aEIdx.GetNode() )
 {
 
getIDocumentLayoutAccess().DelLayoutFormat( pFly );
---n;
 }
+else
+++n;
 }
 
 GetNodes().Delete( aSIdx, nNodeDiff );


core.git: sw/source

2024-09-29 Thread Noel Grandin (via logerrit)
 sw/source/core/unocore/XMLRangeHelper.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 9e5321f46d175e827924a8040f6325cdcd7d751f
Author: Noel Grandin 
AuthorDate: Sun Sep 29 12:18:09 2024 +0200
Commit: Noel Grandin 
CommitDate: Sun Sep 29 18:05:24 2024 +0200

cid#1606810 Overflowed constant

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

diff --git a/sw/source/core/unocore/XMLRangeHelper.cxx 
b/sw/source/core/unocore/XMLRangeHelper.cxx
index 6464543d51ca..ad2d56bd19d5 100644
--- a/sw/source/core/unocore/XMLRangeHelper.cxx
+++ b/sw/source/core/unocore/XMLRangeHelper.cxx
@@ -129,8 +129,9 @@ void lcl_getSingleCellAddressFromXMLString(
 rOutCell.bRelativeRow = true;
 
 // parse rest for column
+assert(i <= 6);
 sal_Int32 nPower = 1;
-while( rtl::isAsciiAlpha( pStrArray[ i ] ))
+while( i >= 0 && rtl::isAsciiAlpha( pStrArray[ i ] ))
 {
 nColumn += (pStrArray[ i ] - aLetterA + 1) * nPower;
 i--;


core.git: sw/source

2024-09-28 Thread Noel Grandin (via logerrit)
 sw/source/core/layout/pagechg.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e76c7bc413af5ca1d74acb71a5a8bb6095605a89
Author: Noel Grandin 
AuthorDate: Sat Sep 28 20:08:38 2024 +0200
Commit: Noel Grandin 
CommitDate: Sat Sep 28 21:25:31 2024 +0200

Revert "cid#1607805 Overflowed constant"

This reverts commit f063ea562c6ba14db15b9773bdcbb18af4a72ff8.

Reason for revert: bad idea. We're not going to re-evalute the loop 
condition if we use a goto

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

diff --git a/sw/source/core/layout/pagechg.cxx 
b/sw/source/core/layout/pagechg.cxx
index 351ad146d6e0..d086166caaef 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -411,7 +411,6 @@ static void lcl_MakeObjs(const 
sw::FrameFormats& rSpzs, SwP
 // formats are in the special table of the document
 for(size_t i = 0; i < rSpzs.size(); ++i )
 {
-LOOP_START:
 auto pSpz = rSpzs[i];
 const SwFormatAnchor &rAnch = pSpz->GetAnchor();
 if ( rAnch.GetPageNum() == pPage->GetPhyPageNum() )
@@ -435,7 +434,8 @@ static void lcl_MakeObjs(const 
sw::FrameFormats& rSpzs, SwP
 {
 OSL_FAIL( "DrawObject not found." );
 pSpz->GetDoc()->DelFrameFormat( pSpz );
-goto LOOP_START;
+--i;
+continue;
 }
 // The object might be anchored to another page, e.g. when 
inserting
 // a new page due to a page descriptor change. In such cases, the


core.git: sw/source

2024-09-28 Thread Caolán McNamara (via logerrit)
 sw/source/filter/ww8/wrtw8sty.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 8536bb07ac92ecf5a4046d5bacd968c4f8ed5763
Author: Caolán McNamara 
AuthorDate: Fri Sep 27 19:27:34 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sat Sep 28 20:22:07 2024 +0200

cid#1607672 silence Overflowed constant

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

diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index ff7d30bd84dc..c5868b517211 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -219,7 +219,7 @@ sal_uInt16 MSWordStyles::GetSlot( const SwFormat* pFormat ) 
const
 /// Get reserved slot number during building the style table.
 static sal_uInt16 BuildGetSlot(const SwFormat& rFormat)
 {
-switch (sal_uInt16 nRet = rFormat.GetPoolFormatId())
+switch (sal_uInt16 nId = rFormat.GetPoolFormatId())
 {
 case RES_POOLCOLL_STANDARD:
 return 0;
@@ -233,9 +233,11 @@ static sal_uInt16 BuildGetSlot(const SwFormat& rFormat)
 case RES_POOLCOLL_HEADLINE7:
 case RES_POOLCOLL_HEADLINE8:
 case RES_POOLCOLL_HEADLINE9:
-nRet -= RES_POOLCOLL_HEADLINE1-1;
+{
+sal_uInt16 nRet = nId - (RES_POOLCOLL_HEADLINE1 - 1);
 assert(nRet < WW8_RESERVED_SLOTS);
 return nRet;
+}
 }
 return 0xfff;
 }


core.git: sw/source

2024-09-28 Thread Caolán McNamara (via logerrit)
 sw/source/core/unocore/unochart.cxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit 33c4af119d9e6370316727a5b2271f80e4eef1fb
Author: Caolán McNamara 
AuthorDate: Fri Sep 27 20:57:53 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sat Sep 28 20:21:32 2024 +0200

cid#1608030 Check of thread-shared field evades lock acquisition

and

cid#1608103 Check of thread-shared field evades lock acquisition

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

diff --git a/sw/source/core/unocore/unochart.cxx 
b/sw/source/core/unocore/unochart.cxx
index bd7c95880c50..10c79c82cd10 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -2215,7 +2215,6 @@ void SAL_CALL SwChartDataSequence::dispose(  )
 if (!bMustDispose)
 return;
 
-m_bDisposed = true;
 if (m_xDataProvider.is())
 {
 const SwTable* pTable = SwTable::FindTable( GetFrameFormat() );
@@ -2664,8 +2663,6 @@ void SAL_CALL SwChartLabeledDataSequence::dispose(  )
 if (!bMustDispose)
 return;
 
-m_bDisposed = true;
-
 // require listeners to release references to this object
 lang::EventObject aEvtObj( static_cast< chart2::data::XLabeledDataSequence 
* >(this) );
 std::unique_lock aGuard( GetChartMutex() );


core.git: sw/source

2024-09-27 Thread Caolán McNamara (via logerrit)
 sw/source/core/unocore/unochart.cxx |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 6762578ee5d9c0b7670c5feea5b837130308a1be
Author: Caolán McNamara 
AuthorDate: Fri Sep 27 19:54:21 2024 +0100
Commit: Caolán McNamara 
CommitDate: Fri Sep 27 22:37:36 2024 +0200

use the same early return as the other ::dispose cases in this file

as done with:

commit 2bfd51eab364c6b00603e2fa1e9c354eec90dc7f
CommitDate: Fri Jul 31 11:00:25 2020 +0200

loplugin:flatten in sw/core/unocore

for consistency with the rest, no logic change intended

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

diff --git a/sw/source/core/unocore/unochart.cxx 
b/sw/source/core/unocore/unochart.cxx
index 996f96cfcc63..bd7c95880c50 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -2661,16 +2661,16 @@ void SAL_CALL SwChartLabeledDataSequence::dispose(  )
 if (!m_bDisposed)
 m_bDisposed = true;
 }
-if (bMustDispose)
-{
-m_bDisposed = true;
+if (!bMustDispose)
+return;
 
-// require listeners to release references to this object
-lang::EventObject aEvtObj( static_cast< 
chart2::data::XLabeledDataSequence * >(this) );
-std::unique_lock aGuard( GetChartMutex() );
-m_aModifyListeners.disposeAndClear( aGuard, aEvtObj );
-m_aEventListeners.disposeAndClear( aGuard, aEvtObj );
-}
+m_bDisposed = true;
+
+// require listeners to release references to this object
+lang::EventObject aEvtObj( static_cast< chart2::data::XLabeledDataSequence 
* >(this) );
+std::unique_lock aGuard( GetChartMutex() );
+m_aModifyListeners.disposeAndClear( aGuard, aEvtObj );
+m_aEventListeners.disposeAndClear( aGuard, aEvtObj );
 }
 
 void SAL_CALL SwChartLabeledDataSequence::addEventListener(


core.git: sw/source

2024-09-26 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/shells/textidx.cxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 5bebb6406a8ca0fa9de1051e8518bf84e070a3ef
Author: Caolán McNamara 
AuthorDate: Thu Sep 26 08:18:43 2024 +0100
Commit: Caolán McNamara 
CommitDate: Thu Sep 26 13:38:58 2024 +0200

cid#1619696 Dereference after null check

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

diff --git a/sw/source/uibase/shells/textidx.cxx 
b/sw/source/uibase/shells/textidx.cxx
index c8eb43dba577..7258e0d7c547 100644
--- a/sw/source/uibase/shells/textidx.cxx
+++ b/sw/source/uibase/shells/textidx.cxx
@@ -272,11 +272,14 @@ void SwTextShell::GetIdxState(SfxItemSet &rSet)
 else
 rSet.Put(SfxBoolItem(FN_INSERT_AUTH_ENTRY_DLG, true));
 
-SfxWhichIter aIter(rSet);
-if (aIter.FirstWhich() == FN_REMOVE_CUR_TOX)
+if (pBase)
 {
-const OUString sLabel = SwResId(STR_DELETEINDEX).replaceAll("%1", 
pBase->GetTypeName());
-rSet.Put(SfxStringItem(FN_REMOVE_CUR_TOX, sLabel));
+SfxWhichIter aIter(rSet);
+if (aIter.FirstWhich() == FN_REMOVE_CUR_TOX)
+{
+const OUString sLabel = 
SwResId(STR_DELETEINDEX).replaceAll("%1", pBase->GetTypeName());
+rSet.Put(SfxStringItem(FN_REMOVE_CUR_TOX, sLabel));
+}
 }
 }
 else if ( rSh.CursorInsideInputField() )


core.git: sw/source sw/uiconfig

2024-09-26 Thread Sohrab Kazak (via logerrit)
 sw/source/ui/index/cnttab.cxx  |   14 +-
 sw/source/uibase/inc/swuicnttab.hxx|1 
 sw/uiconfig/swriter/ui/tocindexpage.ui |   74 +
 3 files changed, 53 insertions(+), 36 deletions(-)

New commits:
commit 185899c145dba0c67e1d15e37dce206da8abc283
Author: Sohrab Kazak 
AuthorDate: Tue Aug 27 10:55:47 2024 -0700
Commit: Heiko Tietze 
CommitDate: Thu Sep 26 09:23:16 2024 +0200

tdf#148320 Toggle ToC/Index Title

Implements the checkbox to toggle the title in the ToC/Index.
The checkbox does not disable the text entry of the title only
hard codes the title to be an empty string.
Solution could use more work.

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

diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index d1146b5a05b5..e530a1c5e61d 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -761,6 +761,7 @@ SwTOXSelectTabPage::SwTOXSelectTabPage(weld::Container* 
pPage, weld::DialogContr
 , m_xTypeFT(m_xBuilder->weld_label(u"typeft"_ustr))
 , m_xTypeLB(m_xBuilder->weld_combo_box(u"type"_ustr))
 , m_xReadOnlyCB(m_xBuilder->weld_check_button(u"readonly"_ustr))
+, m_xTitleToggleCB(m_xBuilder->weld_check_button(u"usetitle"_ustr))
 , m_xAreaFrame(m_xBuilder->weld_widget(u"areaframe"_ustr))
 , m_xAreaLB(m_xBuilder->weld_combo_box(u"scope"_ustr))
 , m_xLevelFT(m_xBuilder->weld_label(u"levelft"_ustr))
@@ -848,6 +849,7 @@ SwTOXSelectTabPage::SwTOXSelectTabPage(weld::Container* 
pPage, weld::DialogContr
 m_xInitialCapsCB->connect_toggled(aLk);
 m_xKeyAsEntryCB->connect_toggled(aLk);
 m_xParaStyleCB->connect_toggled(aLk);
+m_xTitleToggleCB->connect_toggled(aLk);
 
 m_xTitleED->connect_changed(LINK(this, SwTOXSelectTabPage, 
ModifyEntryHdl));
 m_xLevelNF->connect_value_changed(LINK(this, SwTOXSelectTabPage, 
ModifySpinHdl));
@@ -957,7 +959,6 @@ void SwTOXSelectTabPage::ApplyTOXDescription()
 SwMultiTOXTabDialog* pTOXDlg = 
static_cast(GetDialogController());
 const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType();
 SwTOXDescription& rDesc = pTOXDlg->GetTOXDescription(aCurType);
-
 m_xReadOnlyCB->set_active(rDesc.IsReadonly());
 if (!m_xTitleED->get_value_changed_from_saved())
 {
@@ -967,6 +968,7 @@ void SwTOXSelectTabPage::ApplyTOXDescription()
 m_xTitleED->set_text(OUString());
 m_xTitleED->save_value();
 }
+m_xTitleToggleCB->set_active( !m_xTitleED->get_text().isEmpty() ); // if 
no title, toggle off
 
 m_xAreaLB->set_active(rDesc.IsFromChapter() ? 1 : 0);
 
@@ -1109,7 +,15 @@ void SwTOXSelectTabPage::FillTOXDescription()
 SwMultiTOXTabDialog* pTOXDlg = 
static_cast(GetDialogController());
 CurTOXType aCurType = pTOXDlg->GetCurrentTOXType();
 SwTOXDescription& rDesc = pTOXDlg->GetTOXDescription(aCurType);
-rDesc.SetTitle(m_xTitleED->get_text());
+if (m_xTitleToggleCB->get_active())
+{
+rDesc.SetTitle(m_xTitleED->get_text());
+}
+else
+{
+rDesc.SetTitle(OUString());
+}
+m_xTitleED->set_sensitive(m_xTitleToggleCB->get_active());
 rDesc.SetFromChapter(1 == m_xAreaLB->get_active());
 SwTOXElement nContentOptions = SwTOXElement::NONE;
 if (m_xTOXMarksCB->get_visible() && m_xTOXMarksCB->get_active())
diff --git a/sw/source/uibase/inc/swuicnttab.hxx 
b/sw/source/uibase/inc/swuicnttab.hxx
index 103f65e7cb93..254fda6a1ca6 100644
--- a/sw/source/uibase/inc/swuicnttab.hxx
+++ b/sw/source/uibase/inc/swuicnttab.hxx
@@ -133,6 +133,7 @@ class SwTOXSelectTabPage final : public SfxTabPage
 std::unique_ptr m_xTypeFT;
 std::unique_ptr m_xTypeLB;
 std::unique_ptr m_xReadOnlyCB;
+std::unique_ptr m_xTitleToggleCB;
 
 std::unique_ptr m_xAreaFrame;
 std::unique_ptr m_xAreaLB;
diff --git a/sw/uiconfig/swriter/ui/tocindexpage.ui 
b/sw/uiconfig/swriter/ui/tocindexpage.ui
index 7b0f30a5ffbb..0d3c90226132 100644
--- a/sw/uiconfig/swriter/ui/tocindexpage.ui
+++ b/sw/uiconfig/swriter/ui/tocindexpage.ui
@@ -86,38 +86,6 @@
 True
 6
 12
-
-  
-True
-False
-_Title:
-True
-title
-0
-  
-  
-0
-0
-  
-
-
-  
-True
-True
-True
-True
-True
-
-  
-Enter a title for 
the selected index.
-  
-
-  
-  
- 

core.git: sw/source

2024-09-25 Thread Miklos Vajna (via logerrit)
 sw/source/core/doc/doc.cxx |   39 +--
 1 file changed, 17 insertions(+), 22 deletions(-)

New commits:
commit b248260bf88360ff3ca41bb3c0ab6ca5a74f42c4
Author: Miklos Vajna 
AuthorDate: Wed Sep 25 08:23:14 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed Sep 25 10:33:21 2024 +0200

sw: extract SwDoc::ForEachCharacterItem() from Underline/ColorItems

This is meant to avoid copy&paste while keeping the public interface
template-free.

Change-Id: I3bc27d35b135df1693737de6b0e02444a06e4cbf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173890
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index fe9a5be66c00..f32c3655b571 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1433,46 +1433,41 @@ void SwDoc::ForEachCharacterBoxItem( const 
std::function& rFunc ) const
+namespace
 {
-for(SwCharFormat* pFormat : *GetCharFormats())
+/// Iterate over all pool item of type T, if the function returns false, 
iteration is stopped
+template
+void ForEachCharacterItem(const SwDoc* pDoc, TypedWhichId nWhich, const 
std::function& rFunc )
+{
+for(SwCharFormat* pFormat : *pDoc->GetCharFormats())
 {
 const SwAttrSet& rAttrSet = pFormat->GetAttrSet();
-if (const SvxColorItem* pColorItem = 
rAttrSet.GetItemIfSet(RES_CHRATR_COLOR))
+if (const T* pColorItem = rAttrSet.GetItemIfSet(nWhich))
 if (!rFunc(*pColorItem))
 return;
 }
 std::vector> aStyles;
 for (auto eFamily : { IStyleAccess::AUTO_STYLE_CHAR, 
IStyleAccess::AUTO_STYLE_RUBY, IStyleAccess::AUTO_STYLE_PARA, 
IStyleAccess::AUTO_STYLE_NOTXT })
 {
-const_cast(this)->GetIStyleAccess().getAllStyles(aStyles, 
eFamily);
+const_cast(pDoc)->GetIStyleAccess().getAllStyles(aStyles, 
eFamily);
 for (const auto & rxItemSet : aStyles)
-if (const SvxColorItem* pColorItem = 
rxItemSet->GetItemIfSet(RES_CHRATR_COLOR))
+if (const T* pColorItem = rxItemSet->GetItemIfSet(nWhich))
 if (!rFunc(*pColorItem))
 return;
 }
 }
+}
+
+/// Iterate over all SvxColorItem, if the function returns false, iteration is 
stopped
+void SwDoc::ForEachCharacterColorItem( const std::function& rFunc ) const
+{
+ForEachCharacterItem(this, RES_CHRATR_COLOR, rFunc);
+}
 
 /// Iterate over all SvxUnderlineItem, if the function returns false, 
iteration is stopped
 void SwDoc::ForEachCharacterUnderlineItem( const std::function& rFunc ) const
 {
-for(SwCharFormat* pFormat : *GetCharFormats())
-{
-const SwAttrSet& rAttrSet = pFormat->GetAttrSet();
-if (const SvxUnderlineItem* pItem = 
rAttrSet.GetItemIfSet(RES_CHRATR_UNDERLINE))
-if (!rFunc(*pItem))
-return;
-}
-std::vector> aStyles;
-for (auto eFamily : { IStyleAccess::AUTO_STYLE_CHAR, 
IStyleAccess::AUTO_STYLE_RUBY, IStyleAccess::AUTO_STYLE_PARA, 
IStyleAccess::AUTO_STYLE_NOTXT })
-{
-const_cast(this)->GetIStyleAccess().getAllStyles(aStyles, 
eFamily);
-for (const auto & rxItemSet : aStyles)
-if (const SvxUnderlineItem* pItem = 
rxItemSet->GetItemIfSet(RES_CHRATR_UNDERLINE))
-if (!rFunc(*pItem))
-return;
-}
+ForEachCharacterItem(this, RES_CHRATR_UNDERLINE, rFunc);
 }
 
 /// Iterate over all SvxBrushItem, if the function returns false, iteration is 
stopped


core.git: sw/source

2024-09-25 Thread Ashok (via logerrit)
 sw/source/core/unocore/unosett.cxx |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit dbccdea9744c5400a5dad908bce5d2973ac60f3c
Author: Ashok 
AuthorDate: Thu Sep 19 14:48:20 2024 -0700
Commit: Ilmari Lauhakangas 
CommitDate: Wed Sep 25 09:29:41 2024 +0200

tdf#42982 Improve Error Messages with RuntimeException in UNO API

Improved UNO API RuntimeException to return descriptive message.

Change-Id: Idae14c2ae095270c30b86cfad64936ccead5e4d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173686
Reviewed-by: Ilmari Lauhakangas 
Tested-by: Ilmari Lauhakangas 

diff --git a/sw/source/core/unocore/unosett.cxx 
b/sw/source/core/unocore/unosett.cxx
index 8d9d42b6c200..99f6e0ac1754 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -283,7 +283,7 @@ void SwXFootnoteProperties::setPropertyValue(const 
OUString& rPropertyName, cons
 {
 SolarMutexGuard aGuard;
 if(!m_pDoc)
-throw uno::RuntimeException();
+throw uno::RuntimeException(u"Footnote's document is not set."_ustr);
 
 const SfxItemPropertyMapEntry*  pEntry = 
m_pPropertySet->getPropertyMap().getByName( rPropertyName );
 if(!pEntry)
@@ -404,7 +404,7 @@ uno::Any SwXFootnoteProperties::getPropertyValue(const 
OUString& rPropertyName)
 SolarMutexGuard aGuard;
 uno::Any aRet;
 if(!m_pDoc)
-throw uno::RuntimeException();
+throw uno::RuntimeException(u"Footnote's document is not set."_ustr);
 
 const SfxItemPropertyMapEntry*  pEntry = 
m_pPropertySet->getPropertyMap().getByName( rPropertyName );
 if(!pEntry)
@@ -765,7 +765,7 @@ void SwXLineNumberingProperties::setPropertyValue(
 {
 SolarMutexGuard aGuard;
 if(!m_pDoc)
-throw uno::RuntimeException();
+throw uno::RuntimeException(u"Numbering's document is not set."_ustr);
 
 const SfxItemPropertyMapEntry*  pEntry = 
m_pPropertySet->getPropertyMap().getByName( rPropertyName );
 if(!pEntry)
@@ -879,7 +879,7 @@ Any SwXLineNumberingProperties::getPropertyValue(const 
OUString& rPropertyName)
 SolarMutexGuard aGuard;
 Any aRet;
 if(!m_pDoc)
-throw uno::RuntimeException();
+throw uno::RuntimeException(u"Numbering's document is not set."_ustr);
 
 const SfxItemPropertyMapEntry*  pEntry = 
m_pPropertySet->getPropertyMap().getByName( rPropertyName );
 if(!pEntry)
@@ -1191,7 +1191,7 @@ uno::Any SwXNumberingRules::getByIndex(sal_Int32 nIndex)
 aVal <<= aRet;
 }
 else
-throw uno::RuntimeException();
+throw uno::RuntimeException(u"Could not get numbering rule."_ustr);
 return aVal;
 }
 
@@ -2206,7 +2206,7 @@ void SwXNumberingRules::setPropertyValue( const OUString& 
rPropertyName, const A
 
 }
 if(!m_pNumRule && !pDocRule && !pCreatedRule)
-throw RuntimeException();
+throw RuntimeException(u"Could not set numbering rule property 
\'"_ustr + rPropertyName + u"\'."_ustr);
 
 if(rPropertyName == UNO_NAME_IS_AUTOMATIC)
 {
@@ -2265,7 +2265,7 @@ Any SwXNumberingRules::getPropertyValue( const OUString& 
rPropertyName )
 else if(m_pDoc && !m_sCreatedNumRuleName.isEmpty())
 pRule = m_pDoc->FindNumRulePtr( m_sCreatedNumRuleName );
 if(!pRule)
-throw RuntimeException();
+throw RuntimeException(u"Could not get numbering rule property 
\'"_ustr + rPropertyName + u"\'."_ustr);
 
 if(rPropertyName == UNO_NAME_IS_AUTOMATIC)
 {


core.git: sw/source

2024-09-25 Thread Mike Kaganski (via logerrit)
 sw/source/core/unocore/unosett.cxx |   17 -
 1 file changed, 4 insertions(+), 13 deletions(-)

New commits:
commit 40a38b305c4f8908f24192bd5dc796ebd6cf6d6e
Author: Mike Kaganski 
AuthorDate: Wed Sep 25 07:46:43 2024 +0200
Commit: Mike Kaganski 
CommitDate: Wed Sep 25 09:18:14 2024 +0200

Simplify a bit

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

diff --git a/sw/source/core/unocore/unosett.cxx 
b/sw/source/core/unocore/unosett.cxx
index 0dcea7091769..8d9d42b6c200 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -1157,23 +1157,14 @@ uno::Any 
SwXNumberingRules::getPropertyByIndex(sal_Int32 nIndex, const OUString&
 if(nIndex < 0 || MAXLEVEL <= nIndex)
 throw lang::IndexOutOfBoundsException();
 
-uno::Any aVal;
 const SwNumRule* pRule = m_pNumRule;
 if(!pRule && m_pDoc && !m_sCreatedNumRuleName.isEmpty())
 pRule = m_pDoc->FindNumRulePtr( m_sCreatedNumRuleName );
-if(pRule)
-{
-aVal = GetNumberingRuleByIndex( *pRule, nIndex, rPropName);
-
-}
-else if(m_pDocShell)
-{
-aVal = GetNumberingRuleByIndex(
-*m_pDocShell->GetDoc()->GetOutlineNumRule(), nIndex, 
rPropName);
-}
-else
+if (!pRule && m_pDocShell)
+pRule = m_pDocShell->GetDoc()->GetOutlineNumRule();
+if (!pRule)
 throw uno::RuntimeException();
-return aVal;
+return GetNumberingRuleByIndex(*pRule, nIndex, rPropName);
 }
 
 uno::Any SwXNumberingRules::getByIndex(sal_Int32 nIndex)


core.git: sw/source

2024-09-24 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/docvw/AnnotationWin2.cxx |2 ++
 sw/source/uibase/utlui/content.cxx|   12 
 2 files changed, 14 insertions(+)

New commits:
commit 6573d0ed5479fd543303e82ec23195bdc101ceb4
Author: Jim Raykowski 
AuthorDate: Mon Sep 23 07:16:39 2024 -0800
Commit: Jim Raykowski 
CommitDate: Wed Sep 25 07:05:46 2024 +0200

Resolves tdf#152297 Track comments in the Navigator also by focus

inside the comment box

Change-Id: I7ced30c606d89a11012e21bfce18939b7660f038
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173824
Tested-by: Jenkins
Reviewed-by: Jim Raykowski 

diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index f786c1f038f5..437ee6baa220 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -991,6 +991,8 @@ void SwAnnotationWin::ActivatePostIt()
 //ctrl+tab cycles between text and button so we don't waste time searching
 //thousands of SwAnnotationWins
 SetStyle(GetStyle() | WB_DIALOGCONTROL);
+
+
mrView.GetDocShell()->Broadcast(SfxHint(SfxHintId::SwNavigatorUpdateTracking));
 }
 
 void SwAnnotationWin::DeactivatePostIt()
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index b2571a7a68ff..5b7416b9bbcf 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -4499,6 +4499,18 @@ void SwContentTree::UpdateTracking()
 lcl_SelectByContentTypeAndAddress(this, *m_xTreeView, 
eCntTypeId, pField);
 return;
 }
+if (SwPostItMgr* pPostItMgr = m_pActiveShell->GetPostItMgr();
+pPostItMgr && pPostItMgr->HasActiveAnnotationWin()
+&& !(m_bIsRoot && m_nRootType != ContentTypeId::POSTIT))
+{
+if (mTrackContentType[ContentTypeId::POSTIT])
+{
+if (const SwField* pField = 
pPostItMgr->GetActiveSidebarWin()->GetPostItField())
+lcl_SelectByContentTypeAndAddress(this, *m_xTreeView, 
ContentTypeId::POSTIT,
+  pField);
+}
+return;
+}
 // table
 if (m_pActiveShell->IsCursorInTable() &&
 !(m_bIsRoot && m_nRootType != ContentTypeId::TABLE))


core.git: sw/source vcl/qa

2024-09-24 Thread Jonathan Clark (via logerrit)
 sw/source/core/text/portxt.cxx   |   21 
 sw/source/core/txtnode/fntcache.cxx  |   14 ++-
 vcl/qa/cppunit/pdfexport/data/tdf163105.fodt |  115 +++
 vcl/qa/cppunit/pdfexport/pdfexport2.cxx  |   44 ++
 4 files changed, 190 insertions(+), 4 deletions(-)

New commits:
commit 41671d732ad933175779b61159b56824ff77b2fe
Author: Jonathan Clark 
AuthorDate: Tue Sep 24 14:51:56 2024 -0600
Commit: Jonathan Clark 
CommitDate: Wed Sep 25 03:22:38 2024 +0200

tdf#163105 sw: Add some whitespace expansion to kashida justification

Tihs change updates Writer kashida justification to include some
whitespace expansion, mirroring the behavior of Edit Engine and other
word processor programs.

Each kashida and space character are given 1 unit each of extra space.

Change-Id: I8c9031a0d51844e532b9d1f7e3619c2c9ba23f6d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173884
Tested-by: Jenkins
Reviewed-by: Jonathan Clark 

diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index bd64b6336a15..4c71e5da2c29 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -43,6 +43,11 @@ using namespace ::sw::mark;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::i18n::ScriptType;
 
+static TextFrameIndex lcl_AddSpace_Latin(const SwTextSizeInfo& rInf, const 
OUString* pStr,
+ const SwLinePortion& rPor, 
TextFrameIndex nPos,
+ TextFrameIndex nEnd, const 
SwScriptInfo* pSI,
+ sal_uInt8 nScript);
+
 // Returns for how many characters an extra space has to be added
 // (for justified alignment).
 static TextFrameIndex lcl_AddSpace(const SwTextSizeInfo &rInf,
@@ -117,7 +122,11 @@ static TextFrameIndex lcl_AddSpace(const SwTextSizeInfo 
&rInf,
 // i60591: need to check result of KashidaJustify
 // determine if kashida justification is applicable
 if (nKashRes != -1)
-return TextFrameIndex(nKashRes);
+{
+// tdf#163105: For kashida justification, also expand 
whitespace.
+auto nCntLatin = lcl_AddSpace_Latin(rInf, pStr, rPor, nPos, 
nEnd, pSI, nScript);
+return nCntLatin + TextFrameIndex{ nKashRes };
+}
 }
 }
 
@@ -144,6 +153,16 @@ static TextFrameIndex lcl_AddSpace(const SwTextSizeInfo 
&rInf,
 }
 }
 
+return lcl_AddSpace_Latin(rInf, pStr, rPor, nPos, nEnd, pSI, nScript);
+}
+
+static TextFrameIndex lcl_AddSpace_Latin(const SwTextSizeInfo& rInf, const 
OUString* pStr,
+ const SwLinePortion& rPor, 
TextFrameIndex nPos,
+ TextFrameIndex nEnd, const 
SwScriptInfo* pSI,
+ sal_uInt8 nScript)
+{
+TextFrameIndex nCnt(0);
+
 // Here starts the good old "Look for blanks and add space to them" part.
 // Note: We do not want to add space to an isolated latin blank in front
 // of some complex characters in RTL environment
diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index 1e1fc24e0a5f..8b68e29b9ec3 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1135,7 +1135,9 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
  rInf.GetLen(), nSpaceAdd ) != 
-1 )
 {
 bSpecialJust = true;
-nSpaceAdd = 0;
+
+// Intentionally do not clear nSpaceAdd for 
kashida justification.
+// The rest of the space will be handled below.
 }
 else
 aKashidaArray.clear();
@@ -1348,7 +1350,10 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
 if ( pSI && pSI->CountKashida() &&
  pSI->KashidaJustify( &aKernArray, 
aKashidaArray.data(), rInf.GetIdx(),
   rInf.GetLen(), nSpaceAdd ) != -1 
)
-nSpaceAdd = 0;
+{
+// Intentionally do not clear nSpaceAdd for kashida 
justification.
+// The rest of the space will be handled below.
+}
 else
 {
 aKashidaArray.clear();
@@ -1838,7 +1843,10 @@ TextFrameIndex 
SwFntObj::GetModelPositionForViewPoint(SwDrawTextInfo &rInf)
 if ( pSI && pSI->CountKashida() &&
 pSI->KashidaJustify( &aKernArray, nullptr, rInf.GetIdx(), 
rInf.GetLen(),
  nSpaceAdd ) != -1 )
-nSpaceAdd = 0;
+  

  1   2   3   4   5   6   7   8   9   10   >