core.git: Branch 'libreoffice-24-2' - sw/source

2024-05-27 Thread Mike Kaganski (via logerrit)
 sw/source/core/draw/dcontact.cxx |   16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 660443e38c2d059d557298e1131cf42b96436e30
Author: Mike Kaganski 
AuthorDate: Sun Jan 14 12:31:48 2024 +0600
Commit: Xisco Fauli 
CommitDate: Mon May 27 11:06:28 2024 +0200

Simplify a bit

And avoid a second call of pObj->GetUserCall.

Change-Id: I4487ad33df594a8a96b517c5b4671512dea7116d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162042
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 5703d3af04b8fe78fdd4dbef14b08d8446402779)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167940
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 115887a368dc..a91e92569f7a 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -170,12 +170,16 @@ SwRect GetBoundRectOfAnchoredObj( const SdrObject* pObj )
 /// Returns the UserCall if applicable from the group object
 SwContact* GetUserCall( const SdrObject* pObj )
 {
-SdrObject *pTmp;
-while ( !pObj->GetUserCall() && nullptr != (pTmp = 
pObj->getParentSdrObjectFromSdrObject()) )
-pObj = pTmp;
-assert((!pObj->GetUserCall() || nullptr != dynamic_cast(pObj->GetUserCall())) &&
-"<::GetUserCall(..)> - wrong type of found object user call." );
-return static_cast(pObj->GetUserCall());
+for (; pObj; pObj = pObj->getParentSdrObjectFromSdrObject())
+{
+if (auto pUserCall = pObj->GetUserCall())
+{
+assert(dynamic_cast(pUserCall)
+   && "<::GetUserCall(..)> - wrong type of found object user 
call.");
+return static_cast(pUserCall);
+}
+}
+return nullptr;
 }
 
 /// Returns true if the SrdObject is a Marquee-Object (scrolling text)


core.git: Branch 'libreoffice-24-2' - sw/source

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

New commits:
commit bb2cd0f6bdb13186c4d67934d0db73151230a421
Author: Xisco Fauli 
AuthorDate: Wed May 22 22:34:52 2024 +0200
Commit: Xisco Fauli 
CommitDate: Thu May 23 12:46:48 2024 +0200

sw: warning C6011: Dereferencing NULL pointer

Change-Id: Ia4b7f98525e07c5a58b752d7e68d89705f87ac9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167936
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/uibase/utlui/unotools.cxx 
b/sw/source/uibase/utlui/unotools.cxx
index 93edfaad30a7..3105fa9607be 100644
--- a/sw/source/uibase/utlui/unotools.cxx
+++ b/sw/source/uibase/utlui/unotools.cxx
@@ -408,7 +408,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer, 
void )
 if (pDoc)
 {
 SwEditShell* pSh = pDoc->GetEditShell();
-if( pSh->ActionCount() )
+if( pSh && pSh->ActionCount() )
 {
 pSh->EndAllAction();
 pSh->UnlockPaint();


core.git: Branch 'libreoffice-24-2' - sw/source

2024-05-19 Thread Caolán McNamara (via logerrit)
 sw/source/ui/frmdlg/frmpage.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit bf877f3e10c3a2ce7267335a0c9c7cd828c373ca
Author: Caolán McNamara 
AuthorDate: Sun May 19 15:08:14 2024 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun May 19 21:05:55 2024 +0200

Resolves: tdf#151382 we want to save the FN_KEEP_ASPECT_RATIO state

and not if it is implied to be toggled on by SwFormatFrameSize::SYNCED
in which case on "ok" FN_KEEP_ASPECT_RATIO is set from the ui state

so both tdf#151382 and tdf132591 work

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

diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index b3e2a873ad18..8a7ec8d4ffe0 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -2306,6 +2306,8 @@ void SwFramePage::Init(const SfxItemSet& rSet)
 
 if (SfxItemState::SET == rSet.GetItemState(FN_KEEP_ASPECT_RATIO))
 m_xFixedRatioCB->set_active(rSet.Get(FN_KEEP_ASPECT_RATIO).GetValue());
+// see tdf#132591 and tdf#151382 for some examples of FN_KEEP_ASPECT_RATIO 
cases
+m_xFixedRatioCB->save_state();
 
 // columns
 SwFormatCol aCol( rSet.Get(RES_COL) );
@@ -2364,7 +2366,6 @@ void SwFramePage::Init(const SfxItemSet& rSet)
 
 if (rSize.GetWidthPercent() == SwFormatFrameSize::SYNCED || 
rSize.GetHeightPercent() == SwFormatFrameSize::SYNCED)
 m_xFixedRatioCB->set_active(true);
-m_xFixedRatioCB->save_state();
 if (rSize.GetWidthPercent() && rSize.GetWidthPercent() != 
SwFormatFrameSize::SYNCED &&
 !m_xRelWidthCB->get_active())
 {


core.git: Branch 'libreoffice-24-2' - sw/source

2024-05-16 Thread Xisco Fauli (via logerrit)
 sw/source/core/access/accfrmobj.cxx  |   15 ++-
 sw/source/core/doc/docdraw.cxx   |   12 +++
 sw/source/core/draw/dview.cxx|  108 ---
 sw/source/core/frmedt/fecopy.cxx |   25 +++---
 sw/source/core/frmedt/fefly1.cxx |   13 ++-
 sw/source/core/frmedt/feshview.cxx   |   37 ++---
 sw/source/core/layout/anchoreddrawobject.cxx |4 +
 sw/source/core/layout/anchoredobject.cxx |   11 +-
 sw/source/core/layout/fly.cxx|4 -
 sw/source/core/layout/flylay.cxx |   41 +-
 sw/source/core/layout/frmtool.cxx|   40 ++
 sw/source/core/layout/pagechg.cxx|   19 ++--
 sw/source/core/layout/trvlfrm.cxx|   39 +
 sw/source/core/txtnode/atrflyin.cxx  |3 
 sw/source/core/undo/undraw.cxx   |   31 ---
 15 files changed, 242 insertions(+), 160 deletions(-)

New commits:
commit 67af2cc487450a274ae7ba988249c9c362eaa95d
Author: Xisco Fauli 
AuthorDate: Thu Apr 25 18:15:12 2024 +0200
Commit: Christian Lohmaier 
CommitDate: Thu May 16 19:58:34 2024 +0200

sw: check GetUserCall

It might return nullptr
See 
https://crashreport.libreoffice.org/stats/signature/SwFEShell::ShouldObjectBeSelected(Point%20const%20&)

Change-Id: Ia0ed355a7eb9084b9f57163ffbfe6b549c8bdb3f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166642
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit 495b5db74f0db59395ff68bacc8d8ca67595b66e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166710
Reviewed-by: Christian Lohmaier 

diff --git a/sw/source/core/access/accfrmobj.cxx 
b/sw/source/core/access/accfrmobj.cxx
index f78dc2d155db..004ca4ab94e0 100644
--- a/sw/source/core/access/accfrmobj.cxx
+++ b/sw/source/core/access/accfrmobj.cxx
@@ -240,13 +240,16 @@ SwRect SwAccessibleChild::GetBox( const SwAccessibleMap& 
rAccMap ) const
 // by the mpFrame case above b) for genuine SdrObject this must be set
 // if it's connected to layout
 assert(dynamic_cast(pContact));
-SwPageFrame const*const pPage(const_cast(
-pContact->GetAnchoredObj(mpDrawObj))->FindPageFrameOfAnchor());
-if (pPage) // may end up here with partial layout -> not visible
+if (pContact)
 {
-aBox = SwRect( mpDrawObj->GetCurrentBoundRect() );
-// tdf#91260 drawing object may be partially off-page
-aBox.Intersection(pPage->getFrameArea());
+SwPageFrame const*const pPage(const_cast(
+pContact->GetAnchoredObj(mpDrawObj))->FindPageFrameOfAnchor());
+if (pPage) // may end up here with partial layout -> not visible
+{
+aBox = SwRect( mpDrawObj->GetCurrentBoundRect() );
+// tdf#91260 drawing object may be partially off-page
+aBox.Intersection(pPage->getFrameArea());
+}
 }
 }
 else if ( mpWindow )
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index 521ca2b0ba15..09b1d9afb697 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -68,6 +68,9 @@ static void lcl_AdjustPositioningAttr( SwDrawFrameFormat* 
_pFrameFormat,
 const SwContact* pContact = GetUserCall( &_rSdrObj );
 OSL_ENSURE( pContact, " - missing contact 
object." );
 
+if (!pContact)
+return;
+
 // determine position of new group object relative to its anchor frame 
position
 SwTwips nHoriRelPos = 0;
 SwTwips nVertRelPos = 0;
@@ -195,6 +198,9 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
 
 // Revoke anchor attribute.
 SwDrawContact *pMyContact = 
static_cast(GetUserCall(pObj));
+if (!pMyContact)
+return pNewContact;
+
 const SwFormatAnchor aAnch( pMyContact->GetFormat()->GetAnchor() );
 
 std::unique_ptr pUndo;
@@ -216,6 +222,9 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
 pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
 SwDrawContact *pContact = 
static_cast(GetUserCall(pObj));
 
+if (!pContact)
+continue;
+
 // #i53320#
 #if OSL_DEBUG_LEVEL > 0
 SwAnchoredDrawObject* pAnchoredDrawObj =
@@ -352,6 +361,9 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView )
 {
 SwDrawContact *pContact = 
static_cast(GetUserCall(pObj));
 
+if (!pContact)
+continue;
+
 std::shared_ptr pTextBoxNode;
 if (auto pGroupFormat = pContact->GetFormat())
 pTextBoxNode = pGroupFormat->GetOtherTextBoxFormats();
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index fe0db61925c4..39ecb982c00c 100644
--- a/sw/source/core/draw/dview.cxx
+++ 

core.git: Branch 'libreoffice-24-2' - sw/source

2024-05-14 Thread László Németh (via logerrit)
 sw/source/uibase/docvw/edtwin.cxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 95fdda2f027f2bcdd135b3f55c549d6f2339e086
Author: László Németh 
AuthorDate: Mon Apr 29 21:39:41 2024 +0200
Commit: Michael Stahl 
CommitDate: Tue May 14 11:06:09 2024 +0200

tdf#160836 sw: fix narrow selection area of cell border

Remove ShouldObjectBeSelected() condition to fix the
selection area around the horizontal border. (Its purpose
was to avoid of selection of the border, when covered by
an image: but that would be !ShouldObjectBeSelected(), with
the same problem: halved selection area.)

Clean-up commit commit 30de13743f144aced83bc43d310592f82788c910
"tdf#160836 sw: resize rows at images cropped by row height".

Change-Id: I6c812a150b67431c7ea3131f29489bda919c1724
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166877
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 38b6e89c9483fdfe3d26bef3b25f890528aef84e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167211
Reviewed-by: Michael Stahl 

diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index 9aa4862a43a4..c06276027582 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -3118,8 +3118,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
  SwTab::COL_NONE != (nMouseTabCol = rSh.WhichMouseTabCol( aDocPos ) ) 
&&
  ( !rSh.IsObjSelectable( aDocPos ) ||
  // allow resizing row height, if the image is anchored as 
character in the cell
- ( rSh.ShouldObjectBeSelected(aDocPos) &&
- !( SwTab::COL_VERT == nMouseTabCol || SwTab::COL_HORI == 
nMouseTabCol ) ) ) )
+ !( SwTab::COL_VERT == nMouseTabCol || SwTab::COL_HORI == 
nMouseTabCol ) ) )
 {
 // Enhanced table selection
 if ( SwTab::SEL_HORI <= nMouseTabCol && SwTab::COLSEL_VERT >= 
nMouseTabCol )
@@ -3992,8 +3991,7 @@ bool SwEditWin::changeMousePointer(Point const & 
rDocPoint)
 if ( SwTab::COL_NONE != (nMouseTabCol = rShell.WhichMouseTabCol( rDocPoint 
) ) &&
  ( !rShell.IsObjSelectable( rDocPoint ) ||
  // allow resizing row height, if the image is anchored as 
character in the cell
- ( rShell.ShouldObjectBeSelected(rDocPoint) &&
- !( SwTab::COL_VERT == nMouseTabCol || SwTab::COL_HORI == 
nMouseTabCol ) ) ) )
+ !( SwTab::COL_VERT == nMouseTabCol || SwTab::COL_HORI == 
nMouseTabCol ) ) )
 {
 PointerStyle nPointer = PointerStyle::Null;
 bool bChkTableSel = false;


core.git: Branch 'libreoffice-24-2' - sw/source

2024-05-10 Thread Michael Stahl (via logerrit)
 sw/source/uibase/utlui/content.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9f5757c3cbd1f9252f2ea82bc8bacab24d26822c
Author: Michael Stahl 
AuthorDate: Wed May 8 13:28:52 2024 +0200
Commit: Thorsten Behrens 
CommitDate: Fri May 10 23:35:20 2024 +0200

sw: Navigator: don't show virtual drawing objects

These can return a non-empty name now, so exclude them explicitly.

(regression from commit ae132145ff42a95dc24fb124847c04af4b8c8dab)

Change-Id: Ia7f7b9fd7abe67f3302e95b38e3b9fa30b769b5b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167349
Reviewed-by: Michael Stahl 
Tested-by: Jenkins
(cherry picked from commit 609d1e353cfd7a9b138fcbe656a2faae9f84c36a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167451
Reviewed-by: Thorsten Behrens 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 4e6704140334..c75f08430cea 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1010,7 +1010,7 @@ void SwContentType::FillMemberList(bool* pbContentChanged)
 for (const rtl::Reference& pTemp : *pPage)
 {
 // #i51726# - all drawing objects can be named now
-if (!pTemp->GetName().isEmpty())
+if (!pTemp->IsVirtualObj() && !pTemp->GetName().isEmpty())
 {
 tools::Long nYPos = LONG_MIN;
 const bool bIsVisible = 
rIDDMA.IsVisibleLayerId(pTemp->GetLayer());


core.git: Branch 'libreoffice-24-2' - sw/source

2024-05-07 Thread Michael Stahl (via logerrit)
 sw/source/core/doc/doctxm.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit fdd44d9e7c6066aac8572d6d78dedef339b6058e
Author: Michael Stahl 
AuthorDate: Fri May 3 17:33:56 2024 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue May 7 10:43:06 2024 +0200

tdf#40142 sw: only check level for table of contents

Only Table of Contents has level settings, the level is always 0 for the
other ToX types, which erroneously excludes nodes (as can be seen with
testFDO77715 failing with upcoming tdf#160402 bugfix).

(regression from commit 5c04c4474236cc50009aea6d89f7c443c861af19)

Change-Id: Iec1c2b8eaba0ad20b2ad7d8c6b20603315a7a83d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167096
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 7178d6197b892e456a8db8a3d085a24bfd52cf32)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167212
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index d29223050b6a..f9533b37f647 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1375,7 +1375,8 @@ void SwTOXBaseSection::UpdateTemplate(const SwTextNode* 
pOwnChapterNode,
 pTextNd->getLayoutFrame(pLayout) &&
 pTextNd->GetNodes().IsDocNodes() &&
 // tdf#40142 - consider level settings of the various text 
nodes
-o3tl::make_unsigned(pTextNd->GetAttrOutlineLevel()) <= 
GetLevel() &&
+(TOX_CONTENT != SwTOXBase::GetType() ||
+ o3tl::make_unsigned(pTextNd->GetAttrOutlineLevel()) <= 
GetLevel()) &&
 (!pLayout || !pLayout->HasMergedParas()
 || 
static_cast(pTextNd->getLayoutFrame(pLayout))->GetTextNodeForParaProps()
 == pTextNd) &&
 (!IsFromChapter() || IsHeadingContained(pOwnChapterNode, 
*pTextNd)))


core.git: Branch 'libreoffice-24-2' - sw/source

2024-04-29 Thread Michael Stahl (via logerrit)
 sw/source/filter/html/htmlctxt.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit d33d3bbd9fb021c9ef15689f4e8e5b9898541e70
Author: Michael Stahl 
AuthorDate: Thu Apr 25 18:20:20 2024 +0200
Commit: Xisco Fauli 
CommitDate: Mon Apr 29 18:39:36 2024 +0200

tdf#154581 tdf#157411 tdf#158549 sw: HTML import: fix SfxItemIter reuse

This is obviously wrong, as ALG just pointed out: the aIter is at the
end after the 1st loop, so the 2nd loop does nothing.
Thx Gabor for checking all the reported bugs.

(regression from commit db115bec9254417ef7a3faf687478fe5424ab378)

Change-Id: Iae37b9ab5c630d0ee774f42c84d5e76349b92a90
Tested-by: Gabor Kelemen 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166643
Reviewed-by: Michael Stahl 
Tested-by: Jenkins
(cherry picked from commit ac05822b8957d80018d3ce1cbf97cd9faa0dfe99)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166712
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/filter/html/htmlctxt.cxx 
b/sw/source/filter/html/htmlctxt.cxx
index 80245ba2ea6a..0e87b83644f8 100644
--- a/sw/source/filter/html/htmlctxt.cxx
+++ b/sw/source/filter/html/htmlctxt.cxx
@@ -656,7 +656,8 @@ void SwHTMLParser::InsertAttrs( SfxItemSet ,
 }
 #endif
 
-for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = 
aIter.NextItem())
+SfxItemIter aIter2(rItemSet);
+for (const SfxPoolItem* pItem = aIter2.GetCurItem(); pItem; pItem = 
aIter2.NextItem())
 {
 HTMLAttr **ppAttr = nullptr;
 


core.git: Branch 'libreoffice-24-2' - sw/source

2024-04-14 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/tabfrm.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 13e517aa5baa1ce9afefd84ff41496c1adeb5367
Author: Michael Stahl 
AuthorDate: Thu Apr 11 16:37:12 2024 +0200
Commit: Caolán McNamara 
CommitDate: Sun Apr 14 20:31:13 2024 +0200

sw: workaround crash in IsAllHiddenRow()

Not sure why but somehow still crashes in the code added in commit
ab7893544dc6be6dc192dffefd57cd5ddd421c35


https://crashreport.libreoffice.org/stats/crash_details/912e7417-5e04-4279-bbaf-380234f4cd33

Change-Id: I23b7ecdd83009cfe6584866ed72102d8f2179f86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166010
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 
(cherry picked from commit 44ff9907eb1f2851b3b9087e7ec5e5dfae5a00c6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165940
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index fe3a5232356e..adffbba17715 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1523,7 +1523,8 @@ namespace
 }
 }
 }
-if (rTab.IsCollapsingBorders() && !rCell.Lower()->IsRowFrame())
+assert(rCell.Lower());
+if (rTab.IsCollapsingBorders() && rCell.Lower() && 
!rCell.Lower()->IsRowFrame())
 {
 if (rRow.GetTopMarginForLowers() != 0
 || rRow.GetBottomMarginForLowers() != 0)


core.git: Branch 'libreoffice-24-2' - sw/source

2024-04-09 Thread Mike Kaganski (via logerrit)
 sw/source/core/fields/expfld.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 07a566f87213bd4c9c28b454ab4c4d30146fdaa4
Author: Mike Kaganski 
AuthorDate: Thu Apr 4 15:11:24 2024 +0500
Commit: Michael Stahl 
CommitDate: Tue Apr 9 10:34:14 2024 +0200

tdf#81012: avoid content frames in footnotes / endnotes

This makes the behavior of the endnotes in the end of sections consistent
with the behavior of dedicated endnote pages, where heading fields ignore
headings in endnote content.

Change-Id: Iad0218b75a678808b1266024fe4c81f040a631c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165789
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 746b21760b911860c7ac497f10ab07d60111e867)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165842
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index 6ed4cdb7c125..47c675cc42bf 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -233,7 +233,7 @@ const SwTextNode* GetBodyTextNode( const SwDoc& rDoc, 
SwPosition& rPos,
 else
 pContentFrame = pPgFrame->FindLastBodyContent();
 
-if( pContentFrame )
+if( pContentFrame && !pContentFrame->IsInFootnote() )
 {
 assert(pContentFrame->IsTextFrame());
 SwTextFrame const*const pFrame(static_cast(pContentFrame));


core.git: Branch 'libreoffice-24-2' - sw/source

2024-04-08 Thread Caolán McNamara (via logerrit)
 sw/source/ui/fldui/fldref.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 843b3abd2ab05c66533b12ef6a4b155247f99e58
Author: Caolán McNamara 
AuthorDate: Sun Apr 7 20:40:39 2024 +0100
Commit: Xisco Fauli 
CommitDate: Mon Apr 8 17:44:21 2024 +0200

Resolves: tdf#154715 don't use last-used field setting when editing field

If we are inserting a field it makes sense to use the last-used
settings, but if we are editing an existing field we naturally want to
populate with the current field.

Here we have IsRefresh used twice as a condition, one inside the other.
But if was true in the outer use, it will also be true in the inner
(this duplication exists all the way back to the initial commit) because
GetUserData() has no side effect.

IsRefresh is only true during EditNewField (which is the case of using
the "next/back" button to go to edit another field). So even before this
change if you click next and then back (assuming there is another field
to move to) then you then get the right results

Skip restoring the last-used settings in the EditField case, replace
the outer !IsRefresh() with !IsFieldEdit()

Change-Id: I4224302171d2e8d02a0f1e0efc9fdada5ada9d7f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165876
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit db609a58df7be082de7d5a20a2a924789d6a64a1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165840
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index a08715c8ca3c..434e10a6a2f2 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -268,7 +268,7 @@ void SwFieldRefPage::Reset(const SfxItemSet* )
 nFieldDlgFormatSel = 0;
 
 sal_uInt16 nFormatBoxPosition = USHRT_MAX;
-if( !IsRefresh() )
+if( !IsFieldEdit() )
 {
 sal_Int32 nIdx{ 0 };
 const OUString sUserData = GetUserData();


core.git: Branch 'libreoffice-24-2' - sw/source

2024-04-06 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/layact.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 9f20d89ded05600233ceed7db40cdef57aca1442
Author: Michael Stahl 
AuthorDate: Thu Apr 4 19:26:31 2024 +0200
Commit: Caolán McNamara 
CommitDate: Sat Apr 6 22:57:21 2024 +0200

sw: layout: remove superfluous pages again in InternalAction()

The bugdoc has a very large header containing hidden text changes height
when toggling Formatting Marks.  When toggling on, it crashes, because
UnHide() iterates the text frames in all headers, but after the first
one empty pages at the end of the document are removed, so UAF.

Remove the pages without content earlier; SwLayAction::InternalAction()
already does it after the "normal" page loop, but the 2nd page loop
following that may also move content off pages, so do it again.

Change-Id: Iaae6a16842b3494f25cba8fc036d15049b71961f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165801
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 759d822dac5edc6104ce61b70c578425d9f2470d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165727
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 06c3027bebc5..1a0a1260a135 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -809,6 +809,12 @@ void SwLayAction::InternalAction(OutputDevice* 
pRenderContext)
 unlockPositionOfObjects( pPg );
 pPg = static_cast(pPg->GetNext());
 }
+if (m_pRoot->IsSuperfluous()) // could be newly set now!
+{
+bool bOld = IsAgain();
+m_pRoot->RemoveSuperfluous();
+SetAgain(bOld);
+}
 // reset flag for special interrupt content formatting.
 mbFormatContentOnInterrupt = false;
 }


core.git: Branch 'libreoffice-24-2' - sw/source

2024-04-05 Thread Heiko Tietze (via logerrit)
 sw/source/ui/index/swuiidxmrk.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit d3871c6ac05bb9553aed1cc951ba18efcb06082a
Author: Heiko Tietze 
AuthorDate: Thu Apr 4 12:09:33 2024 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Fri Apr 5 08:02:19 2024 +0200

Resolves tdf#154209 - Fixes resize issue in Index Entry dialog

Change-Id: I83400b56d40f145c0e066c0c8b1783a1bae4cf28
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165788
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 
(cherry picked from commit ebfa0d061fdbca6a25d3efcff72ab5ed184a51dc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165722
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/source/ui/index/swuiidxmrk.cxx 
b/sw/source/ui/index/swuiidxmrk.cxx
index 8a6f74b86ee8..03d5733a87ad 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -441,6 +441,7 @@ IMPL_LINK_NOARG(SwIndexMarkPane, SyncSelectionHdl, 
weld::Button&, void)
 m_xApplyToAllCB->show();
 m_xSearchCaseSensitiveCB->show();
 m_xSearchCaseWordOnlyCB->show();
+m_xDialog->resize_to_request();
 m_xApplyToAllCB->set_sensitive(!m_aOrgStr.isEmpty() &&
 !(nFrameType & ( FrameTypeFlags::HEADER | FrameTypeFlags::FOOTER | 
FrameTypeFlags::FLY_ANY )));
 SearchTypeHdl(*m_xApplyToAllCB);


core.git: Branch 'libreoffice-24-2' - sw/source

2024-03-26 Thread Justin Luth (via logerrit)
 sw/source/core/layout/paintfrm.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 09b3dd1cb0c1741cf3560fc9faf2aec696d5c9a2
Author: Justin Luth 
AuthorDate: Mon Mar 25 19:20:32 2024 -0400
Commit: Rafael Lima 
CommitDate: Tue Mar 26 17:08:05 2024 +0100

tdf#129905 tdf#160365 sw: don't always draw text boundary on frames

This fixes a 7.6 regression caused by
commit 79811c27f34d3e752de1bc3959605c5d58ac2365
tdf#129905 Create toggle for Section boundaries

This fixes the toggle for View - Text boundaries,
so now images can have their thin gray border removed.

This also fixes the toggle for View - Table boundaries.

Change-Id: Idb75debf173d64b14a6864c61b4524e46898975f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165297
Reviewed-by: Justin Luth 
Tested-by: Jenkins
Reviewed-by: Rafael Lima 
Reviewed-by: Miklos Vajna 
(cherry picked from commit 47af9e64a573684eb42faa097e327e31777a2b58)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165311

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 0f048c4e805d..5472695e9732 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7012,7 +7012,8 @@ void SwPageFrame::RefreshSubsidiary( const SwRect  
) const
 void SwLayoutFrame::RefreshLaySubsidiary( const SwPageFrame *pPage,
 const SwRect  ) const
 {
-const bool bSubsOpt = isSubsidiaryLinesEnabled() || 
isSubsidiaryLinesForSectionsEnabled();
+const bool bSubsOpt
+= isSubsidiaryLinesEnabled() || (IsSctFrame() && 
isSubsidiaryLinesForSectionsEnabled());
 if ( bSubsOpt )
 PaintSubsidiaryLines( pPage, rRect );
 


core.git: Branch 'libreoffice-24-2' - sw/source

2024-03-26 Thread Julien Nabet (via logerrit)
 sw/source/ui/index/cnttab.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 81fdf964bec1c4555db2f08c300c7b3f09130fbc
Author: Julien Nabet 
AuthorDate: Mon Mar 25 13:59:06 2024 +0100
Commit: Xisco Fauli 
CommitDate: Tue Mar 26 14:17:35 2024 +0100

Related tdf#160351: the field name can be shorter than two symbols

Change-Id: Ieb6b78b3f9802e66de642a9e708b11c55c0d9a11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165285
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
(cherry picked from commit 02609da5ee8188cb00fc0b97052d2cc8d2576900)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165249
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index f07cf8ab2883..535dc298dd5a 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -3140,7 +3140,7 @@ void SwTokenWindow::InsertAtSelection(const SwFormToken& 
rToken)
 //use the first two chars as symbol
 OUString sTmp(SwAuthorityFieldType::GetAuthFieldName(
 
static_cast(aToInsertToken.nAuthorityField)));
-pButton->SetText(sTmp.copy(0, 2));
+pButton->SetText(sTmp.copy(0, std::min(sTmp.getLength(), 
sal_Int32(2;
 }
 
 pButton->Check();


core.git: Branch 'libreoffice-24-2' - sw/source

2024-03-26 Thread Mike Kaganski (via logerrit)
 sw/source/ui/index/cnttab.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0a86d2e2dd898aa1d455c0bbde91dd9a8b011daf
Author: Mike Kaganski 
AuthorDate: Mon Mar 25 17:41:24 2024 +0500
Commit: Xisco Fauli 
CommitDate: Tue Mar 26 09:23:57 2024 +0100

tdf#160351: the field name can be shorter than two symbols

Change-Id: Id834ae2919661752b921510f766c9e9ff7fc16fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165282
Reviewed-by: Julien Nabet 
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 4a14bad7232ecf23d23c1997dc20922d0b4892cb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165246
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index a5d3bf92ddef..f07cf8ab2883 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -2933,7 +2933,7 @@ SwTOXWidget* SwTokenWindow::InsertItem(const OUString& 
rText, const SwFormToken&
 //use the first two chars as symbol
 OUString sTmp(SwAuthorityFieldType::GetAuthFieldName(
 
static_cast(rToken.nAuthorityField)));
-pButton->SetText(sTmp.copy(0, 2));
+pButton->SetText(sTmp.copy(0, std::min(sTmp.getLength(), 
sal_Int32(2;
 }
 
 sal_uInt32 nIndex = GetControlIndex( rToken.eTokenType );


core.git: Branch 'libreoffice-24-2' - sw/source

2024-03-22 Thread Michael Stahl (via logerrit)
 sw/source/core/docnode/ndtbl.cxx |   15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 6c155583c83eb19c3520084c90df51eca725da00
Author: Michael Stahl 
AuthorDate: Fri Mar 22 14:27:01 2024 +0100
Commit: Xisco Fauli 
CommitDate: Fri Mar 22 17:48:23 2024 +0100

tdf#157241 sw: assert when importing ToX in table in rhbz589883-2.docx

ndtbl.cxx:1417: SwNodes::TextToTable(): Assertion `!rNode.IsSectionNode()' 
failed.

(regression from commit 62cb3b8b8d6106c6aeb073b12d84973a107182ef)

Change-Id: Iec12282573cb914d1924f4da4a28e26e01b866df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165164
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 
(cherry picked from commit df6fdb0041f8bfd251a4b03030b8bc47f0614c36)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165173
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index d052ed7eda4b..f3b3a07d63b5 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1413,16 +1413,19 @@ SwTableNode* SwNodes::TextToTable( const 
SwNodes::TableRanges_t & rTableNodes,
 // delete frames of all contained content nodes
 for( nLines = 0; aNodeIndex <= rTableNodes.rbegin()->rbegin()->aEnd; 
++aNodeIndex,++nLines )
 {
-SwNode& rNode = aNodeIndex.GetNode();
-assert(!rNode.IsSectionNode()); // not possible in writerfilter import
-if (rNode.IsTableNode())
+SwNode* pNode(());
+while (pNode->IsSectionNode()) // could be ToX field in table
 {
-lcl_RemoveBreaksTable(static_cast(rNode),
+pNode = pNode->GetNodes()[pNode->GetIndex()+1];
+}
+if (pNode->IsTableNode())
+{
+lcl_RemoveBreaksTable(static_cast(*pNode),
 (0 == nLines) ? pTableFormat : nullptr);
 }
-else if (rNode.IsContentNode())
+else if (pNode->IsContentNode())
 {
-lcl_RemoveBreaks(static_cast(rNode),
+lcl_RemoveBreaks(static_cast(*pNode),
 (0 == nLines) ? pTableFormat : nullptr);
 }
 }


core.git: Branch 'libreoffice-24-2' - sw/source

2024-03-19 Thread Armin Le Grand (allotropia) (via logerrit)
 sw/source/core/tox/tox.cxx|8 +++-
 sw/source/ui/index/swuiidxmrk.cxx |   37 -
 sw/source/uibase/index/toxmgr.cxx |3 ++-
 3 files changed, 29 insertions(+), 19 deletions(-)

New commits:
commit a48ee46a085abfa04779ece38c08dddb5bf017ea
Author: Armin Le Grand (allotropia) 
AuthorDate: Fri Jan 12 11:22:04 2024 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Mar 19 22:21:40 2024 +0100

tdf#158783 Correct compares of SwTOXMark Items

That item was never 'pooled', so operator== was not really
ever used. It just compared the 'type', so pretty many
instances were assumed to be equal, what is wrong.
We discussed to implement it (there is quite some content),
but we came to the point that it's only safe to say
instances are equal when same instance -> fallback to ptr
compare.
This came into play since I identified/changed many (160?)
places where SfxPoolItems were ptr-compared when doing that
paradigm change in Items. This leads to the two methods
'areSfxPoolItemPtrsEqual' which just makes ptr compare and
'SfxPoolItem::areSame' which also will use op==. For the
initial adaption I chose the wrong function adapting
places where SwTOXMark were involved.

Change-Id: I7df029ad4542719681b1455de17ed5990d248395
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161963
Reviewed-by: Michael Stahl 
Tested-by: Armin Le Grand 
(cherry picked from commit d22a86089edfcadbef5231525a2947b954f4784e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164996
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index 04f43e5d41f8..b29bafde11f6 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -148,7 +148,13 @@ void SwTOXMark::RegisterToTOXType(SwTOXType& rType)
 bool SwTOXMark::operator==( const SfxPoolItem& rAttr ) const
 {
 assert(SfxPoolItem::operator==(rAttr));
-return m_pType == static_cast(rAttr).m_pType;
+// tdf#158783 this item was never 'pooled', so operator== was not really
+// ever used. We discussed to implement it (there is quite some
+// content), but we came to the point that it's only safe to say
+// instances are equal when same instance -> fallback to ptr compare.
+// NOTE: Do *not* use areSfxPoolItemPtrsEqual here, with DBG_UTIL
+//   active the contol/test code there would again call operator==
+return this == 
 }
 
 SwTOXMark* SwTOXMark::Clone( SfxItemPool* ) const
diff --git a/sw/source/ui/index/swuiidxmrk.cxx 
b/sw/source/ui/index/swuiidxmrk.cxx
index 39443f7e7b04..8a6f74b86ee8 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -287,19 +287,20 @@ void SwIndexMarkPane::InitControls()
 bool bShow = false;
 
 pMoveMark = _pSh->GotoTOXMark( *pMark, TOX_PRV );
-if (!SfxPoolItem::areSame( pMoveMark, pMark ))
+// tdf#158783 ptr compare OK for SwTOXMark (more below)
+if (!areSfxPoolItemPtrsEqual( pMoveMark, pMark ))
 {
 m_pSh->GotoTOXMark( *pMoveMark, TOX_NXT );
 bShow = true;
 }
-m_xPrevBT->set_sensitive(!SfxPoolItem::areSame(pMoveMark, pMark));
+m_xPrevBT->set_sensitive(!areSfxPoolItemPtrsEqual(pMoveMark, pMark));
 pMoveMark = _pSh->GotoTOXMark( *pMark, TOX_NXT );
-if (!SfxPoolItem::areSame( pMoveMark, pMark ))
+if (!areSfxPoolItemPtrsEqual( pMoveMark, pMark ))
 {
 m_pSh->GotoTOXMark( *pMoveMark, TOX_PRV );
 bShow = true;
 }
-m_xNextBT->set_sensitive(!SfxPoolItem::areSame(pMoveMark, pMark));
+m_xNextBT->set_sensitive(!areSfxPoolItemPtrsEqual(pMoveMark, pMark));
 if( bShow )
 {
 m_xPrevBT->show();
@@ -308,19 +309,19 @@ void SwIndexMarkPane::InitControls()
 }
 
 pMoveMark = _pSh->GotoTOXMark( *pMark, TOX_SAME_PRV );
-if (!SfxPoolItem::areSame( pMoveMark, pMark ))
+if (!areSfxPoolItemPtrsEqual( pMoveMark, pMark ))
 {
 m_pSh->GotoTOXMark( *pMoveMark, TOX_SAME_NXT );
 bShow = true;
 }
-m_xPrevSameBT->set_sensitive(!SfxPoolItem::areSame(pMoveMark, pMark));
+m_xPrevSameBT->set_sensitive(!areSfxPoolItemPtrsEqual(pMoveMark, 
pMark));
 pMoveMark = _pSh->GotoTOXMark( *pMark, TOX_SAME_NXT );
-if (!SfxPoolItem::areSame( pMoveMark, pMark ))
+if (!areSfxPoolItemPtrsEqual( pMoveMark, pMark ))
 {
 m_pSh->GotoTOXMark( *pMoveMark, TOX_SAME_PRV );
 bShow = true;
 }
-m_xNextSameBT->set_sensitive(!SfxPoolItem::areSame(pMoveMark, pMark));
+m_xNextSameBT->set_sensitive(!areSfxPoolItemPtrsEqual(pMoveMark, 
pMark));
 if( bShow )
 {
 m_xNextSameBT->show();
@@ -894,25 +895,26 @@ void 

core.git: Branch 'libreoffice-24-2' - sw/source

2024-03-19 Thread Michael Stahl (via logerrit)
 sw/source/core/docnode/ndtbl.cxx |   36 +++-
 1 file changed, 35 insertions(+), 1 deletion(-)

New commits:
commit df5bb0c4343b4a090de3343c7d454a93099989c0
Author: Michael Stahl 
AuthorDate: Wed Mar 13 18:57:21 2024 +0100
Commit: Caolán McNamara 
CommitDate: Tue Mar 19 20:56:46 2024 +0100

tdf#157241 sw: fix crash on RTF paste or insert of nested tables

The problem is that there are tables with only empty cell frames in the
layout, which causes a crash in IsAllHiddenCell() added in commit
ab7893544dc6be6dc192dffefd57cd5ddd421c35.

This happens because first inner tables are created, with layout frames
because the layout already exists.

Then when SwNodes::TextToTable() is called for the outer table, it
deletes the SwTextFrames, but not the SwTabFrames/SwCellFrames, so they
remain uselessly in the layout.

Delete these too, they will be recreated when the frame for the outer
table is created.

Also the transfer of any existing break to the outer table was missing.

Change-Id: Idc2bc1d4c6572702510ae4355e4015c42770eb3e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164788
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 62cb3b8b8d6106c6aeb073b12d84973a107182ef)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164813
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index a7a2bee478da..d052ed7eda4b 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -888,6 +888,34 @@ const SwTable* SwDoc::TextToTable( const 
SwInsertTableOptions& rInsTableOpts,
 return 
 }
 
+static void lcl_RemoveBreaksTable(SwTableNode & rNode, SwTableFormat *const 
pTableFormat)
+{
+// delete old layout frames, new ones need to be created...
+rNode.DelFrames(nullptr);
+
+// remove PageBreaks/PageDesc/ColBreak
+SwFrameFormat & rFormat(*rNode.GetTable().GetFrameFormat());
+
+if (const SvxFormatBreakItem* pItem = rFormat.GetItemIfSet(RES_BREAK, 
false))
+{
+if (pTableFormat)
+{
+pTableFormat->SetFormatAttr(*pItem);
+}
+rFormat.ResetFormatAttr(RES_BREAK);
+}
+
+SwFormatPageDesc const*const 
pPageDescItem(rFormat.GetItemIfSet(RES_PAGEDESC, false));
+if (pPageDescItem && pPageDescItem->GetPageDesc())
+{
+if (pTableFormat)
+{
+pTableFormat->SetFormatAttr(*pPageDescItem);
+}
+rFormat.ResetFormatAttr(RES_PAGEDESC);
+}
+}
+
 static void lcl_RemoveBreaks(SwContentNode & rNode, SwTableFormat *const 
pTableFormat)
 {
 // delete old layout frames, new ones need to be created...
@@ -1386,7 +1414,13 @@ SwTableNode* SwNodes::TextToTable( const 
SwNodes::TableRanges_t & rTableNodes,
 for( nLines = 0; aNodeIndex <= rTableNodes.rbegin()->rbegin()->aEnd; 
++aNodeIndex,++nLines )
 {
 SwNode& rNode = aNodeIndex.GetNode();
-if( rNode.IsContentNode() )
+assert(!rNode.IsSectionNode()); // not possible in writerfilter import
+if (rNode.IsTableNode())
+{
+lcl_RemoveBreaksTable(static_cast(rNode),
+(0 == nLines) ? pTableFormat : nullptr);
+}
+else if (rNode.IsContentNode())
 {
 lcl_RemoveBreaks(static_cast(rNode),
 (0 == nLines) ? pTableFormat : nullptr);


core.git: Branch 'libreoffice-24-2' - sw/source

2024-03-15 Thread Miklos Vajna (via logerrit)
 sw/source/filter/ww8/wrtw8nds.cxx |   41 --
 1 file changed, 22 insertions(+), 19 deletions(-)

New commits:
commit 08d144dfafca6077d988a10ca005c8666470b94c
Author: Miklos Vajna 
AuthorDate: Wed Mar 13 14:07:50 2024 +0100
Commit: Xisco Fauli 
CommitDate: Fri Mar 15 12:53:33 2024 +0100

sw: fix fieldmark crash in MSWordExportBase::OutputTextNode()

Crashreport signature:

program/libmswordlo.so
  MSWordExportBase::OutputTextNode(SwTextNode&)
  sw/source/filter/ww8/wrtw8nds.cxx:2547
program/libmswordlo.so
  MSWordExportBase::WriteText()
  sw/source/filter/ww8/wrtww8.cxx:2936
program/libmswordlo.so
  DocxExport::WriteMainText()
  
/opt/rh/devtoolset-10/root/usr/include/c++/10/bits/stl_tree.h:1261
program/libmswordlo.so
  DocxExport::ExportDocument_Impl()
  sw/source/filter/ww8/docxexport.cxx:541

Keep the assert, because ideally it should not happen that we have no
fieldmark at CH_TXT_ATR_FIELDEND, but crashing in non-debug builds goes
a bit too far.

Change-Id: I428f46821771802a0ea2beaaf86463487e561aff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164844
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 27a41c7e4ec0e82e2ed0ca2577574f5295a16057)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164825
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/filter/ww8/wrtw8nds.cxx 
b/sw/source/filter/ww8/wrtw8nds.cxx
index 68437c9529b3..e33e8708f453 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2658,33 +2658,36 @@ void MSWordExportBase::OutputTextNode( SwTextNode& 
rNode )
 
 assert(pFieldmark);
 
-if (pFieldmark->GetFieldname() == ODF_FORMDATE)
+if (pFieldmark)
 {
-if(GetExportFormat() == 
MSWordExportBase::ExportFormat::DOCX) // supported by DOCX only
+if (pFieldmark->GetFieldname() == ODF_FORMDATE)
 {
-OutputField( nullptr, ww::eFORMDATE, OUString(), 
FieldFlags::Close );
+if(GetExportFormat() == 
MSWordExportBase::ExportFormat::DOCX) // supported by DOCX only
+{
+OutputField( nullptr, ww::eFORMDATE, 
OUString(), FieldFlags::Close );
+}
 }
-}
-else
-{
-ww::eField eFieldId = lcl_getFieldId( pFieldmark );
-if (pFieldmark->GetFieldname() == ODF_UNHANDLED)
+else
 {
-IFieldmark::parameter_map_t::const_iterator it = 
pFieldmark->GetParameters()->find( ODF_ID_PARAM );
-if ( it != pFieldmark->GetParameters()->end() )
+ww::eField eFieldId = lcl_getFieldId( pFieldmark );
+if (pFieldmark->GetFieldname() == ODF_UNHANDLED)
 {
-OUString sFieldId;
-it->second >>= sFieldId;
-eFieldId = 
static_cast(sFieldId.toInt32());
+IFieldmark::parameter_map_t::const_iterator it 
= pFieldmark->GetParameters()->find( ODF_ID_PARAM );
+if ( it != pFieldmark->GetParameters()->end() )
+{
+OUString sFieldId;
+it->second >>= sFieldId;
+eFieldId = 
static_cast(sFieldId.toInt32());
+}
 }
-}
 
-OutputField( nullptr, eFieldId, OUString(), 
FieldFlags::Close );
+OutputField( nullptr, eFieldId, OUString(), 
FieldFlags::Close );
 
-if (pFieldmark->GetFieldname() == ODF_FORMTEXT
- && GetExportFormat() != 
MSWordExportBase::ExportFormat::DOCX )
-{
-AppendBookmark( pFieldmark->GetName() );
+if (pFieldmark->GetFieldname() == ODF_FORMTEXT
+&& GetExportFormat() != 
MSWordExportBase::ExportFormat::DOCX )
+{
+AppendBookmark( pFieldmark->GetName() );
+}
 }
 }
 }


core.git: Branch 'libreoffice-24-2' - sw/source

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

New commits:
commit 2fa450193fbf6013144bdf436076aa4971c3a12e
Author: Michael Stahl 
AuthorDate: Tue Mar 12 16:21:57 2024 +0100
Commit: Xisco Fauli 
CommitDate: Wed Mar 13 11:42:03 2024 +0100

tdf#157241 sw: layout: inconsistent conditions in lcl_RecalcSplitLine()

A mistake, when checking before the condition is "if (pTab == )"
but when checking after it is "if (pTab)" - the latter is correct as the
former is checked *inside* the block, after resolving to top-level table.

This caused erroneously setting rIsFootnoteGrowth = true in
SwTabFrame::MakeAll() of tab 939 in the bugdoc, when in fact the footnote
container shrunk from 5 to 2 footnotes.

(regression from commit c303981cfd95ce1c3881366023d5495ae2edce97)

Change-Id: Ib4cad9fef0e500ebe7a3636c2371a4108b32fb5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164717
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 7d3b439de357c8e97c0a73f6f63e67ec980e432d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164733
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 8c49106364dc..c4a742c0373d 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -667,7 +667,7 @@ static bool lcl_RecalcSplitLine( SwRowFrame& rLastLine, 
SwRowFrame& rFollowLine,
 {
 SwContentFrame const*const pAnchor = pFootnote->GetRef();
 SwTabFrame const* pTab = pAnchor->FindTabFrame();
-if (pTab == )
+if (pTab)
 {
 while (pTab->GetUpper()->IsInTab())
 {


core.git: Branch 'libreoffice-24-2' - sw/source

2024-03-11 Thread Julien Nabet (via logerrit)
 sw/source/core/edit/edsect.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 1ecbee191411bf340173fd64d56888e245a54e08
Author: Julien Nabet 
AuthorDate: Fri Mar 8 17:35:00 2024 +0100
Commit: Xisco Fauli 
CommitDate: Mon Mar 11 10:01:00 2024 +0100

tdf#160095: fix crash when using ALT+RETURN twice

Change-Id: Idc4c84039115c8d88418246a17e281c26fb49b70
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164592
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
(cherry picked from commit 82e6236cd6ba6f45aa913a3be606e6b00f81fe07)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164614
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index daaa7296e81e..070a37a90d2f 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -316,6 +316,9 @@ static const SwNode* lcl_SpecialInsertNode(const 
SwPosition* pCurrentPos)
 // find the table/section which is close
 if( pTableNode == nullptr )
 {
+if( pSectionNode == nullptr )
+return nullptr;
+
 pInnermostNode = pSectionNode;
 pSection = _cast(pSectionNode)->GetSection();
 }


core.git: Branch 'libreoffice-24-2' - sw/source

2024-03-07 Thread Julien Nabet (via logerrit)
 sw/source/uibase/uiview/view2.cxx |   13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit c899c2e463c61d056e68efd180e0a596c7569a1e
Author: Julien Nabet 
AuthorDate: Fri Mar 1 12:14:52 2024 +0100
Commit: Xisco Fauli 
CommitDate: Thu Mar 7 12:17:59 2024 +0100

tdf#159955: fix custom page number

Change-Id: I1a56a4ba266dfb3c21e3b77263ecaa44b4e6dad5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164210
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
(cherry picked from commit d440dcfcaf688544a7a6d8bc478048159e5200f0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164197
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index cc6faf78a3c5..f7a10a49f747 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -286,14 +286,21 @@ OUString SwView::GetPageStr(sal_uInt16 nPhyNum, 
sal_uInt16 nVirtNum, const OUStr
 ? SwResId(STR_PAGE_COUNT_PRINTED)
 : (extra.isEmpty() ? SwResId(STR_PAGE_COUNT) : 
SwResId(STR_PAGE_COUNT_CUSTOM)));
 aStr = aStr.replaceFirst("%1", OUString::number(nPhyNum));
-aStr = aStr.replaceFirst("%2", OUString::number(nPageCount));
 if (nPageCount != nPrintedPageCount)
 {
+aStr = aStr.replaceFirst("%2", OUString::number(nPageCount));
 aStr = aStr.replaceFirst("%3", OUString::number(nPrintedPhyNum));
 aStr = aStr.replaceFirst("%4", OUString::number(nPrintedPageCount));
 }
-else
-aStr = aStr.replaceFirst("%3", extra);
+else {
+if (extra.isEmpty())
+aStr = aStr.replaceFirst("%2", OUString::number(nPageCount));
+else
+{
+aStr = aStr.replaceFirst("%2", extra);
+aStr = aStr.replaceFirst("%3", OUString::number(nPageCount));
+}
+}
 
 return aStr;
 }


core.git: Branch 'libreoffice-24-2' - sw/source

2024-03-04 Thread Caolán McNamara (via logerrit)
 sw/source/core/edit/edsect.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit c586333a1824b23b5cbde9416f5858ced0acd7a7
Author: Caolán McNamara 
AuthorDate: Sun Mar 3 13:58:31 2024 +
Commit: Xisco Fauli 
CommitDate: Mon Mar 4 09:46:53 2024 +0100

cid#1592908 Dereference null return value

and

cid#1592910 Dereference null return value

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

diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index 04ed95fa42cb..daaa7296e81e 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -333,9 +333,10 @@ static const SwNode* lcl_SpecialInsertNode(const 
SwPosition* pCurrentPos)
 pInnermostNode = pTableNode;
 }
 }
-bool bIsProtected = pInnermostNode->IsProtect();
 if(pInnermostNode != nullptr)
 {
+bool bIsProtected = pInnermostNode->IsProtect();
+
 //special case - ToxSection
 // - in this case the inner section could be tox header
 //   section but the new node should be before the content section
@@ -346,7 +347,10 @@ static const SwNode* lcl_SpecialInsertNode(const 
SwPosition* pCurrentPos)
  SectionType::ToxContent == pSection->GetType()))
 {
 if (SectionType::ToxHeader == pSection->GetType())
-pInnermostNode = 
pSection->GetParent()->GetFormat()->GetSectionNode();
+{
+if (const SwSection* pSectionParent = pSection->GetParent())
+pInnermostNode = 
pSectionParent->GetFormat()->GetSectionNode();
+}
 bIsProtected = static_cast(pInnermostNode)->IsInProtectSect();
 }
 


core.git: Branch 'libreoffice-24-2' - sw/source xmloff/source

2024-03-01 Thread Oliver Specht (via logerrit)
 sw/source/core/doc/doctxm.cxx   |2 
 sw/source/core/edit/edsect.cxx  |  147 ++--
 xmloff/source/text/XMLSectionExport.cxx |6 +
 3 files changed, 93 insertions(+), 62 deletions(-)

New commits:
commit 51f872cbc1291123401cf22f27a7185801660e4a
Author: Oliver Specht 
AuthorDate: Tue Feb 27 16:43:56 2024 +0100
Commit: Michael Stahl 
CommitDate: Fri Mar 1 15:28:26 2024 +0100

tdf#146356 insert new paragraph before table of contents

Alt+Enter inserts the new paragraph before the content section
of a table of contents.
At the same time protected indexes now also have the header
protected.

Change-Id: Iff267691d96796158c1593c4269b76226840c952
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164050
Tested-by: Jenkins
Tested-by: Gabor Kelemen 
Reviewed-by: Michael Stahl 
(cherry picked from commit aebdc79dbc5bf059ee0921a00d2795e526a52c42)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164128

diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index f03687d810e4..d29223050b6a 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1057,7 +1057,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
 SwSectionFormat* pSectFormat = rDoc.MakeSectionFormat();
 rDoc.GetNodes().InsertTextSection(
 *pHeadNd, *pSectFormat, headerData, nullptr, (), 
true, false);
-
+pSectFormat->GetSection()->SetProtect(SwTOXBase::IsProtected());
 if (pUndo)
 {
 pUndo->TitleSectionInserted(*pSectFormat);
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index a7e652aea9de..04ed95fa42cb 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -308,89 +308,114 @@ static const SwNode* lcl_SpecialInsertNode(const 
SwPosition* pCurrentPos)
 // pInnermostNode contains the section/table before/after which we should
 // insert our empty paragraph, or it will be NULL if none is found.
 const SwNode* pInnermostNode = nullptr;
+const SwSection* pSection = nullptr;
 {
 const SwNode* pTableNode = rCurrentNode.FindTableNode();
 const SwNode* pSectionNode = rCurrentNode.FindSectionNode();
 
 // find the table/section which is close
 if( pTableNode == nullptr )
+{
 pInnermostNode = pSectionNode;
+pSection = _cast(pSectionNode)->GetSection();
+}
 else if ( pSectionNode == nullptr )
 pInnermostNode = pTableNode;
 else
 {
 // compare and choose the larger one
-pInnermostNode =
-( pSectionNode->GetIndex() > pTableNode->GetIndex() )
-? pSectionNode : pTableNode;
+if (pSectionNode->GetIndex() > pTableNode->GetIndex())
+{
+pInnermostNode = pSectionNode;
+pSection = _cast(pSectionNode)->GetSection();
+}
+else
+pInnermostNode = pTableNode;
 }
 }
-
-// The previous version had a check to skip empty read-only sections. Those
-// shouldn't occur, so we only need to check whether our pInnermostNode is
-// inside a protected area.
-
-// Now, pInnermostNode is NULL or the innermost section or table node.
-if( (pInnermostNode != nullptr) && !pInnermostNode->IsProtect() )
+bool bIsProtected = pInnermostNode->IsProtect();
+if(pInnermostNode != nullptr)
 {
-OSL_ENSURE( pInnermostNode->IsTableNode() ||
-pInnermostNode->IsSectionNode(), "wrong node found" );
-OSL_ENSURE( ( pInnermostNode->GetIndex() <= rCurrentNode.GetIndex() )&&
-( pInnermostNode->EndOfSectionNode()->GetIndex() >=
-  rCurrentNode.GetIndex() ), "wrong node found" );
-
-// we now need to find the possible start/end positions
-
-// we found a start if
-// - we're at or just before a start node
-// - there are only start nodes between the current and pInnermostNode
-SwNodeIndex aBegin( pCurrentPos->GetNode() );
-if( rCurrentNode.IsContentNode() &&
-(pCurrentPos->GetContentIndex() == 0))
---aBegin;
-while( (aBegin != pInnermostNode->GetIndex()) &&
-   aBegin.GetNode().IsStartNode() )
---aBegin;
-bool bStart = ( aBegin == pInnermostNode->GetIndex() );
-
-// we found an end if
-// - we're at or just before an end node
-// - there are only end nodes between the current node and
-//   pInnermostNode's end node or
-// - there are only end nodes between the last table cell merged with
-//   the current cell and pInnermostNode's end node
-SwNodeIndex aEnd( pCurrentPos->GetNode() );
-if( rCurrentNode.IsContentNode() &&
-( 

core.git: Branch 'libreoffice-24-2' - sw/source

2024-02-21 Thread Miklos Vajna (via logerrit)
 sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 866e411950645f0b5e8d473adbf6c3505119f9da
Author: Miklos Vajna 
AuthorDate: Mon Feb 19 16:46:53 2024 +0100
Commit: Xisco Fauli 
CommitDate: Wed Feb 21 21:21:49 2024 +0100

sw: fix crash in SwSpellDialogChildWindow::LockFocusNotification()

Crashreport signature:

Fatal signal received: SIGSEGV code: 128 for address: 0x0
program/libswlo.so
SwSpellDialogChildWindow::GetNextWrongSentence(bool)

sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx:824
program/libcuilo.so

svx::SpellDialog::GetNextSentence_Impl(std::unique_ptr >*, bool, bool)

/opt/rh/devtoolset-10/root/usr/include/c++/10/bits/stl_vector.h:919
program/libcuilo.so

svx::SpellDialog::SpellContinue_Impl(std::unique_ptr >*, bool, bool)
cui/source/dialogs/SpellDialog.cxx:370
/opt/collaboraoffice/program/libcuilo.so
svx::SpellDialog::InitHdl(void*)

/opt/rh/devtoolset-10/root/usr/include/c++/10/bits/unique_ptr.h:173

Change-Id: I0ecae218beb30e5136f7a6f468e3eb9f6e6e5009
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163637
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit d505b8d2730b93cea8d2dcf2656af37c6c8cc580)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163615
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx 
b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
index 5af09a6adf52..869a0fba0025 100644
--- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
+++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
@@ -821,6 +821,11 @@ bool 
SwSpellDialogChildWindow::SpellDrawText_Impl(SwWrtShell& rSh, svx::SpellPor
 
 void SwSpellDialogChildWindow::LockFocusNotification(bool bLock)
 {
+if (!m_pSpellState)
+{
+return;
+}
+
 OSL_ENSURE(m_pSpellState->m_bLockFocus != bLock, "invalid locking - no 
change of state");
 m_pSpellState->m_bLockFocus = bLock;
 }


core.git: Branch 'libreoffice-24-2' - sw/source

2024-02-20 Thread Baole Fang (via logerrit)
 sw/source/ui/fldui/flddok.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9d48831793cdbf93975b71083fbcc9577c17fceb
Author: Baole Fang 
AuthorDate: Wed Feb 14 20:00:48 2024 -0500
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Feb 20 22:13:08 2024 +0100

tdf#159678: Fix heading dropdown list

Change-Id: I65b6e6e5484f26b27e7851a6615550f527fcfb06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163416
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 694b9b6422ee27da13ad455174cde50b1a673ac7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163406
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
index 1a2857bedbdd..5cb38a38aca9 100644
--- a/sw/source/ui/fldui/flddok.cxx
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -601,7 +601,7 @@ bool SwFieldDokPage::FillItemSet(SfxItemSet* )
 }
 
 case SwFieldTypesEnum::Chapter:
-aVal = OUString::number(m_xLevelED->get_active());
+aVal = m_xLevelED->get_active_text();
 break;
 
 default:


core.git: Branch 'libreoffice-24-2' - sw/source

2024-02-16 Thread Michael Weghorn (via logerrit)
 sw/source/uibase/docvw/SidebarWinAcc.cxx |   10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit cc88d26c8ebcf1dd828469eead40d7747f2b9129
Author: Michael Weghorn 
AuthorDate: Wed Feb 14 15:57:54 2024 +0100
Commit: Xisco Fauli 
CommitDate: Fri Feb 16 11:08:56 2024 +0100

tdf#92389 sw a11y: Use SolarMutex in SidebarWinAccessibleContext

Hold the SolarMutex instead of of using a custom mutex,
since `SwAccessibleMap` methods that get called require
the SolarMutex to be held.

Fixes a crash/assert when interacting with Writer comments
using the mouse while the Orca screen reader is running
when using the qt6 VCL plugin.

Backtrace:

Thread 1 received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=, 
signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
44  ./nptl/pthread_kill.c: No such file or directory.
(gdb) bt
#0  __pthread_kill_implementation (threadid=, 
signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1  0x7f0a462a81cf in __pthread_kill_internal (signo=6, 
threadid=) at ./nptl/pthread_kill.c:78
#2  0x7f0a4625a472 in __GI_raise (sig=sig@entry=6) at 
../sysdeps/posix/raise.c:26
#3  0x7f0a462444b2 in __GI_abort () at ./stdlib/abort.c:79
#4  0x7f0a462443d5 in __assert_fail_base
(fmt=0x7f0a463b8dc8 "%s%s%s:%u: %s%sAssertion `%s' failed.
%n", assertion=assertion@entry=0x7f0a3d775838 
"ImplGetSVData()->mpDefInst->GetYieldMutex()->IsCurrentThread() && \"SolarMutex 
not owned!\"", file=file@entry=0x7f0a3d7757f0 
".../libreoffice/vcl/source/app/dbggui.cxx", line=line@entry=35, 
function=function@entry=0x7f0a3d7757cc "void ImplDbgTestSolarMutex()") at 
./assert/assert.c:92
#5  0x7f0a462533a2 in __assert_fail
(assertion=0x7f0a3d775838 
"ImplGetSVData()->mpDefInst->GetYieldMutex()->IsCurrentThread() && \"SolarMutex 
not owned!\"", file=0x7f0a3d7757f0 ".../libreoffice/vcl/source/app/dbggui.cxx", 
line=35, function=0x7f0a3d7757cc "void ImplDbgTestSolarMutex()") at 
./assert/assert.c:101
#6  0x7f0a3ca733b4 in ImplDbgTestSolarMutex() () at 
.../libreoffice/vcl/source/app/dbggui.cxx:35
#7  0x7f0a452ccfbb in DbgTestSolarMutex() () at 
.../libreoffice/tools/source/debug/debug.cxx:54
#8  0x7f09f8fd3903 in SwAccessibleMap::GetContext(SwFrame const*, 
bool) (this=0x55fa8fd89930, pFrame=0x55fa8ecddb00, bCreate=false) at 
.../libreoffice/sw/source/core/access/accmap.cxx:1777
#9  0x7f09f906f684 in sw::sidebarwindows::(anonymous 
namespace)::SidebarWinAccessibleContext::getAccessibleParent() 
(this=0x55fa8f83e600) at 
.../libreoffice/sw/source/uibase/docvw/SidebarWinAcc.cxx:65
#10 0x7f0a31e6244c in QtAccessibleWidget::parent() const 
(this=0x7f0a280b6150) at 
.../libreoffice/vcl/qt6/../qt5/QtAccessibleWidget.cxx:322
#11 0x7f0a3095b51a in 
AtSpiAdaptor::accessibleInterface(QAccessibleInterface*, QString const&, 
QDBusMessage const&, QDBusConnection const&) (this=0x55fa884876c0, 
interface=0x7f0a280b6150, function=..., message=..., connection=...)
at .../qt5/qtbase/src/gui/accessible/linux/atspiadaptor.cpp:1592
#12 0x7f0a30959934 in AtSpiAdaptor::handleMessage(QDBusMessage 
const&, QDBusConnection const&) (this=0x55fa884876c0, message=..., 
connection=...)
at .../qt5/qtbase/src/gui/accessible/linux/atspiadaptor.cpp:1460
#13 0x7f0a2ee88ad3 in 
QDBusConnectionPrivate::activateObject(QDBusConnectionPrivate::ObjectTreeNode&, 
QDBusMessage const&, int) (this=0x7f0a28010b60, node=..., msg=..., 
pathStartPos=27)
at .../qt5/qtbase/src/dbus/qdbusintegrator.cpp:1448
#14 0x7f0a2ee897b8 in 
QDBusActivateObjectEvent::placeMetaCall(QObject*) (this=0x7f0a280b8400) at 
.../qt5/qtbase/src/dbus/qdbusintegrator.cpp:1604
#15 0x7f0a31445095 in QObject::event(QEvent*) (this=0x55fa884876c0, 
e=0x7f0a280b8400) at .../qt5/qtbase/src/corelib/kernel/qobject.cpp:1447
#16 0x7f0a2f5a696c in QApplicationPrivate::notify_helper(QObject*, 
QEvent*) (this=0x55fa872f63e0, receiver=0x55fa884876c0, e=0x7f0a280b8400) at 
.../qt5/qtbase/src/widgets/kernel/qapplication.cpp:3298
#17 0x7f0a2f5a677d in QApplication::notify(QObject*, QEvent*) 
(this=0x55fa873956b0, receiver=0x55fa884876c0, e=0x7f0a280b8400) at 
.../qt5/qtbase/src/widgets/kernel/qapplication.cpp:3249
#18 0x7f0a313b1162 in QCoreApplication::notifyInternal2(QObject*, 
QEvent*) (receiver=0x55fa884876c0, event=0x7f0a280b8400) at 
.../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1138
#19 0x7f0a313b1d0b in QCoreApplication::sendEvent(QObject*, 
QEvent*) (receiver=0x55fa884876c0, event=0x7f0a280b8400) at 
.../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1581
#20 0x7f0a313b33c4 in 

core.git: Branch 'libreoffice-24-2' - sw/source

2024-02-14 Thread Oliver Specht (via logerrit)
 sw/source/uibase/shells/textsh.cxx |   15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

New commits:
commit f5c3296eca92e8dd6b3bdf7410dd5a636a197d10
Author: Oliver Specht 
AuthorDate: Thu Jan 18 15:48:04 2024 +0100
Commit: Thorsten Behrens 
CommitDate: Wed Feb 14 09:26:09 2024 +0100

tdf#63259 rotate case also at start/end of a word

Rotate either rotates the selection or the word the cursor is directly 
before,
inside or directly after

Change-Id: Ia21e3120d2b00978b9f4ce06738b42e90d2ada62
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162256
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 3d01c4ee56e0435815977b1717c84b1a2c233bfc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163338
Reviewed-by: Thorsten Behrens 

diff --git a/sw/source/uibase/shells/textsh.cxx 
b/sw/source/uibase/shells/textsh.cxx
index 0924935b3d7e..97de98540151 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -877,7 +877,20 @@ void SwTextShell::ExecTransliteration( SfxRequest const & 
rReq )
 void SwTextShell::ExecRotateTransliteration( SfxRequest const & rReq )
 {
 if( rReq.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE )
-GetShell().TransliterateText( m_aRotateCase.getNextMode() );
+{
+SwWrtShell& rSh = GetShell();
+if (rSh.HasSelection())
+{
+rSh.TransliterateText(m_aRotateCase.getNextMode());
+}
+else
+{
+rSh.Push(); // save cur cursor
+if ((rSh.IsEndWrd() || rSh.IsStartWord() || rSh.IsInWord()) && 
rSh.SelWrd())
+rSh.TransliterateText(m_aRotateCase.getNextMode());
+rSh.Pop(SwCursorShell::PopMode::DeleteCurrent);
+}
+}
 }
 
 SwTextShell::SwTextShell(SwView &_rView) :


core.git: Branch 'libreoffice-24-2' - sw/source

2024-02-12 Thread Michael Weghorn (via logerrit)
 sw/source/uibase/dochdl/swdtflvr.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 0750cacbb165b733ab76bb54a6c0116e8266a01f
Author: Michael Weghorn 
AuthorDate: Fri Feb 9 21:02:59 2024 +0100
Commit: Michael Stahl 
CommitDate: Mon Feb 12 12:14:07 2024 +0100

tdf#158947 sw: Don't unrelatedly overwrite system clipboard on paste

In `SwTransferable::RemoveDDELinkFormat`, only update the
clipboard content with this `SwTransferable` after removing
the `SotClipboardFormatId::LINK` from the supported formats
if the `SwTransferable` was the clipboard content before
already.

Doing so always would unrelatedly overwrite what was previously
copied from another application to the clipboard for the
tdf#158947 scenario of pasting clipboard content of another
application over a selection when using the Qt-based VCL plugins
on Wayland (s. backtrace below that shows how the clipboard content
was overwritten, frame #17 is the method changed in this
commit).

My assumption why the clipboard content is explicitly overwritten
at all is to make sure that the system clipboard on some platforms
gets notified about the change in supported formats/mime
types after removing one. But that isn't necessary when the
transfer data modified here aren't the current clipboard content
in the first place.

Backtrace for how clipboard content was previously overwritten
for the tdf#158947 scenario with the qt6 VCL plugin on Wayland:

~"#0  QtClipboard::handleChanged(QClipboard::Mode) 
(this=0x557f90457770, aMode=QClipboard::Clipboard) at 
.../libreoffice/vcl/qt6/../qt5/QtClipboard.cxx:156
"
~"#1  0x7f26f08844ff in 
QtPrivate::FunctorCall, 
QtPrivate::List, void, void 
(QtClipboard::*)(QClipboard::Mode)>::call(void 
(QtClipboard::*)(QClipboard::Mode), QtClipboard*, 
void**)::{lambda()#1}::operator()() const (__closure=0x7ffe889a2c20) at 
.../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:153
"
~"#2  0x7f26f0884ffb in 
QtPrivate::FunctorCallBase::call_internal, 
QtPrivate::List, void, void 
(QtClipboard::*)(QClipboard::Mode)>::call(void 
(QtClipboard::*)(QClipboard::Mode), QtClipboard*, 
void**)::{lambda()#1}>(void**, 
QtPrivate::FunctorCall, 
QtPrivate::List, void, void 
(QtClipboard::*)(QClipboard::Mode)>::call(void 
(QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**)::{lambda()#1}&&) 
(args=0x7ffe889a2ed0, fn=...) at 
.../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:72
"
~"#3  0x7f26f088456f in 
QtPrivate::FunctorCall, 
QtPrivate::List, void, void 
(QtClipboard::*)(QClipboard::Mode)>::call(void 
(QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**) (f=(void 
(QtClipboard::*)(QtClipboard * const, QClipboard::Mode)) 0x7f26f087a76e 
, o=0x557f90457770, 
arg=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:152
"
~"#4  0x7f26f08833de in QtPrivate::FunctionPointer::call, 
void>(void (QtClipboard::*)(QClipboard::Mode), QtClipboard*, void**) (f=(void 
(QtClipboard::*)(QtClipboard * const, QClipboard::Mode)) 0x7f26f087a76e 
, o=0x557f90457770, 
arg=0x7ffe889a2ed0) at .../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:200
"
~"#5  0x7f26f0881f71 in QtPrivate::QCallableObject, 
void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) 
(which=1, this_=0x557f904555f0, r=0x557f90457770, a=0x7ffe889a2ed0, ret=0x0) at 
.../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:571
"
~"#6  0x7f26efdb863f in QtPrivate::QSlotObjectBase::call(QObject*, 
void**) (this=0x557f904555f0, r=0x557f90457770, a=0x7ffe889a2ed0) at 
.../qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:487
"
~"#7  0x7f26efe5772e in doActivate(QObject*, int, void**) 
(sender=0x557f8d510fd0, signal_index=3, argv=0x7ffe889a2ed0) at 
.../qt5/qtbase/src/corelib/kernel/qobject.cpp:4116
"
~"#8  0x7f26efe4cdef in QMetaObject::activate(QObject*, QMetaObject 
const*, int, void**) (sender=0x557f8d510fd0, m=0x7f26efa47cc0 
, local_signal_index=0, argv=0x7ffe889a2ed0) at 
.../qt5/qtbase/src/corelib/kernel/qobject.cpp:4176
"
~"#9  0x7f26eede9fcc in QClipboard::changed(QClipboard::Mode) 
(this=0x557f8d510fd0, _t1=QClipboard::Clipboard) at 
.../qt5/qtbase/src/gui/Gui_autogen/include/moc_qclipboard.cpp:182
"
~"#10 0x7f26eede9bc1 in QClipboard::emitChanged(QClipboard::Mode) 
(this=0x557f8d510fd0, mode=QClipboard::Clipboard) at 
.../qt5/qtbase/src/gui/kernel/qclipboard.cpp:558
"
~"#11 0x7f26eee4ed69 in 
QPlatformClipboard::emitChanged(QClipboard::Mode) (this=0x557f88019c20, 
mode=QClipboard::Clipboard) at 
.../qt5/qtbase/src/gui/kernel/qplatformclipboard.cpp:89
"
~"#12 0x7f26ed78809e in 
QtWaylandClient::QWaylandClipboard::setMimeData(QMimeData*, QClipboard::Mode) 
(this=0x557f88019c20, data=0x557f8fb87930, mode=QClipboard::Clipboard) at 

core.git: Branch 'libreoffice-24-2' - sw/source

2024-02-08 Thread Patrick Luby (via logerrit)
 sw/source/core/undo/undel.cxx |   27 +++
 1 file changed, 19 insertions(+), 8 deletions(-)

New commits:
commit e1c125f6027970710eaa27bfe3d39476060878ca
Author: Patrick Luby 
AuthorDate: Sat Jan 13 19:40:37 2024 -0500
Commit: Christian Lohmaier 
CommitDate: Thu Feb 8 13:30:44 2024 +0100

tdf#158740 fix crash by checking the end node's index

I don't know why m_nEndNode is larger than the size of the node
array, but adjusting m_nEndNode to the last element in the node
array stops the crashing.

Change-Id: I425589457c6729b6689a7046f063154a2496e811
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162035
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 9bfd8e69385930d8f558c767f7b29149324d1b70)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162211
Reviewed-by: Patrick Luby 
Reviewed-by: Christian Lohmaier 

diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 4c199c8ac321..7661b5951740 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -1152,14 +1152,25 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & 
rContext)
 SwNode& start(*rDoc.GetNodes()[m_nSttNode +
 ((m_bDelFullPara || !rDoc.GetNodes()[m_nSttNode]->IsTextNode() || 
pInsNd)
  ? 0 : 1)]);
-// don't include end node in the range: it may have been merged already
-// by the start node, or it may be merged by one of the moved nodes,
-// but if it isn't merged, its current frame(s) should be good...
-SwNode& end(*rDoc.GetNodes()[ m_bDelFullPara
-? delFullParaEndNode
-// tdf#147310 SwDoc::DeleteRowCol() may delete whole table - end 
must be node following table!
-: (m_nEndNode + (rDoc.GetNodes()[m_nSttNode]->IsTableNode() && 
rDoc.GetNodes()[m_nEndNode]->IsEndNode() ? 1 : 0))]);
-::MakeFrames(, start, end);
+// tdf#158740 fix crash by checking the end node's index
+// I don't know why m_nEndNode is larger than the size of the node
+// array, but adjusting m_nEndNode to the last element in the node
+// array stops the crashing.
+SwNodeOffset nCount(rDoc.GetNodes().Count());
+if (nCount > SwNodeOffset(0))
+{
+if (m_nEndNode > nCount - 1)
+m_nEndNode = nCount - 1;
+
+// don't include end node in the range: it may have been merged 
already
+// by the start node, or it may be merged by one of the moved 
nodes,
+// but if it isn't merged, its current frame(s) should be good...
+SwNode& end(*rDoc.GetNodes()[ m_bDelFullPara
+? delFullParaEndNode
+// tdf#147310 SwDoc::DeleteRowCol() may delete whole table - 
end must be node following table!
+: (m_nEndNode + (rDoc.GetNodes()[m_nSttNode]->IsTableNode() && 
rDoc.GetNodes()[m_nEndNode]->IsEndNode() ? 1 : 0))]);
+::MakeFrames(, start, end);
+}
 }
 
 if (pMovedNode)


core.git: Branch 'libreoffice-24-2' - sw/source

2024-02-06 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/fly.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 6f14c818ad25e7fb1feb65ab8072e2a9918398d6
Author: Michael Stahl 
AuthorDate: Thu Feb 1 15:11:03 2024 +0100
Commit: Caolán McNamara 
CommitDate: Tue Feb 6 20:35:19 2024 +0100

tdf#159015 sw: layout: fix infinite loop in ::CalcContent()

SwObjectFormatter::FormatObj() will just return if IsAgain() is set, so
the while loop here won't make any progress.

(regression from commit 191babee4f0ec643b80e96b0cd98c2d04ff96e4e)

Change-Id: I1c194b148760ae05cf4dee1d5729be28e87d6ba0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162880
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 13865c4da30a3a2a5ab8efbd568c47952d3ffcee)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162894
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index ba57cd6b4cdf..db50a42de053 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -43,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1741,6 +1742,10 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl )
 if (!SwObjectFormatter::FormatObj(*pAnchoredObj, 
pAnchorFrame, pAnchorPageFrame,
 rShell.Imp()->IsAction() ? 
()->GetLayAction() : nullptr))
 {
+if (rShell.Imp()->IsAction() && 
rShell.Imp()->GetLayAction().IsAgain())
+{   // tdf#159015 will always fail, don't loop
+return;
+}
 bRestartLayoutProcess = true;
 break;
 }


core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-31 Thread Heiko Tietze (via logerrit)
 sw/source/core/text/inftxt.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2920c56159320965e81de99b11fb1ca5dd42c8d5
Author: Heiko Tietze 
AuthorDate: Wed Jan 31 11:29:14 2024 +0100
Commit: Xisco Fauli 
CommitDate: Wed Jan 31 21:00:44 2024 +0100

Resolves tdf#159328 - Fix field shading regression

Introduced by 4d7a98b582dc70bbffc78e6622969e218f108433

Change-Id: Ibcc057e47c62d53dfa9e6410230c4b231df8551c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162799
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 
(cherry picked from commit 788ebd183b095ffb7369c4d518acd14bad72ae82)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162820
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 3d9121ef1ec2..8eced32e8990 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1426,8 +1426,8 @@ void SwTextPaintInfo::DrawViewOpt( const SwLinePortion 
,
   || m_pFrame->GetTextNodeForParaProps()->HasMarkedLabel())) 
// #i27615#
 {
 bDraw = PortionType::Footnote != nWhich || 
m_pFrame->IsFootnoteAllowed();
+bDraw &= GetOpt().IsHardBlank();
 }
-bDraw &= GetOpt().IsHardBlank();
 break;
 case PortionType::Bookmark:
 // no shading


core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-31 Thread Mike Kaganski (via logerrit)
 sw/source/core/unocore/unoportenum.cxx |   16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

New commits:
commit e4b66492cebe6cad3afa77e81db4d60eb9b7eba1
Author: Mike Kaganski 
AuthorDate: Tue Jan 30 12:37:36 2024 +0600
Commit: Xisco Fauli 
CommitDate: Wed Jan 31 17:52:54 2024 +0100

Make sure to only dynamic_cast once

Commit 3078020b07e41a6533ba71755d8cc8095bc3c3a7 (sw34bf04: #i109272#:
SwXTextPortionEnumeration: fix CrossRefBookmark handling 2011-03-01)
moved the dynamic_cast to the general case in lcl_FillBookmark. Later,
commit 9b01059f6e2143c5b5b481f3d321309648fc7dd4 (SwXTextPortionEnumeration
ctor: avoid dynamic_cast in the common case, 2014-10-28) split it into
two: for bookmark start, and for bookmark end. Both will happen, when
the bookmark is fully inside the node.

This makes sure to only dynamic_cast once, and only when necessary.

Change-Id: I3b88504b0cd21a644cf9933143312a4fb570b27a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162732
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162803

diff --git a/sw/source/core/unocore/unoportenum.cxx 
b/sw/source/core/unocore/unoportenum.cxx
index 4b50a72cf5ad..186b5c5b2354 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -133,12 +133,18 @@ namespace
 void lcl_FillBookmark(sw::mark::IMark* const pBkmk, const SwNode& 
rOwnNode, SwDoc& rDoc, SwXBookmarkPortion_ImplList& rBkmArr)
 {
 bool const hasOther = pBkmk->IsExpanded();
-
 const SwPosition& rStartPos = pBkmk->GetMarkStart();
-if(rStartPos.GetNode() == rOwnNode)
+const SwPosition& rEndPos = pBkmk->GetMarkEnd();
+bool const bStartPosInNode = rStartPos.GetNode() == rOwnNode;
+bool const bEndPosInNode = rEndPos.GetNode() == rOwnNode;
+sw::mark::CrossRefBookmark* const pCrossRefMark
+= !hasOther && (bStartPosInNode || bEndPosInNode)
+  ? dynamic_cast(pBkmk)
+  : nullptr;
+
+if (bStartPosInNode)
 {
 // #i109272#: cross reference marks: need special handling!
-::sw::mark::CrossRefBookmark *const pCrossRefMark(dynamic_cast< 
::sw::mark::CrossRefBookmark*>(pBkmk));
 BkmType const nType = (hasOther || pCrossRefMark)
 ? BkmType::Start : BkmType::StartEnd;
 rBkmArr.insert(std::make_shared(
@@ -146,13 +152,11 @@ namespace
 nType, rStartPos));
 }
 
-const SwPosition& rEndPos = pBkmk->GetMarkEnd();
-if(rEndPos.GetNode() != rOwnNode)
+if (!bEndPosInNode)
 return;
 
 std::optional oCrossRefEndPos;
 const SwPosition* pEndPos = nullptr;
-::sw::mark::CrossRefBookmark *const pCrossRefMark(dynamic_cast< 
::sw::mark::CrossRefBookmark*>(pBkmk));
 if(hasOther)
 {
 pEndPos = 


core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-30 Thread Balazs Varga (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 5f6542e77a3ae8313199ca6704ef050be336a2f0
Author: Balazs Varga 
AuthorDate: Mon Jan 29 22:05:28 2024 +0100
Commit: Michael Stahl 
CommitDate: Tue Jan 30 18:11:32 2024 +0100

tdf#159384 - A11y: fix simulated numbering warning in TOC

Do not complane about simulated numbering warning in TOC
if its contains a list with numbering.

Change-Id: Ib6a10d18d19cc9cb44ffd5b79e2106af457985d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162707
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 24a3f8269e427875fbe8013f88e83fc41b90b33a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162717

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index e4eaa089ef2f..e515b5cae7ed 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -344,6 +344,10 @@ public:
 if (!pNextTextNode)
 return;
 
+SwSectionNode* pNd = pCurrentTextNode->FindSectionNode();
+if (pNd && pNd->GetSection().GetType() == SectionType::ToxContent)
+return;
+
 for (auto& rPair : m_aNumberingCombinations)
 {
 if (pCurrentTextNode->GetText().startsWith(rPair.first)


core.git: Branch 'libreoffice-24-2' - sw/source vcl/qa

2024-01-26 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/frmtool.cxx   |   27 +
 sw/source/core/layout/trvlfrm.cxx   |   67 +-
 sw/source/core/text/EnhancedPDFExportHelper.cxx |5 
 vcl/qa/cppunit/pdfexport/data/LinkPages.fodt|  138 +
 vcl/qa/cppunit/pdfexport/pdfexport.cxx  |  607 
 5 files changed, 813 insertions(+), 31 deletions(-)

New commits:
commit 83d68d6ff1d19abf18bac8bfa35b200f45d91b5c
Author: Michael Stahl 
AuthorDate: Wed Jan 24 15:05:07 2024 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jan 26 09:56:33 2024 +0100

tdf#142806 sw: PDF export: fix multi-frame links/fields

* SwRootFrame::CalcFrameRects() assumption that there is only 1 frame is
  wrong, add a loop; also remove dead eMode check in else branch
* GetCursorRectsContainingText() cannot call GetCurrFrame() because that
  returns always the same frame, but it can be split across several
* fix GetFrameOfModify() to return the correct frame in case of a field
  (where it returned always the frame containing the start of the field,
  but pViewPosAndCalcFrame could be in a follow frame)

(regression from commit 5726be1314517d47dd733aabe64a3d85cce094c5)

Change-Id: I63a94080ee120f178580e0339db4541691165780
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162523
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 9ba8d68c2b2fd06340bbdcb61dc3d57f6e3eb974)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162565
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index e8fa815776e2..eeab5c60c1ce 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -3881,7 +3881,32 @@ SwFrame* GetFrameOfModify(SwRootFrame const*const 
pLayout, sw::BroadcastingModif
 } while( bClientIterChanged );
 
 if( pPos && pMinFrame && pMinFrame->IsTextFrame() )
-return static_cast(pMinFrame)->GetFrameAtPos( *pPos );
+{
+SwTextFrame * 
pAtPos(static_cast(pMinFrame)->GetFrameAtPos(*pPos));
+if (!pViewPosAndCalcFrame)
+{
+return pAtPos;
+}
+TextFrameIndex nPos(pAtPos->MapModelToViewPos(*pPos));
+SwPageFrame const*const pPage(pAtPos->getRootFrame()->GetPageAtPos(
+pViewPosAndCalcFrame->first, nullptr, true));
+SwFrame * pOnPage(pAtPos); // if all else fails return first one
+++nPos; // follow field portions are on follow frames that have 
mnOffset
+// already incremented past the field, need to check that index too
+while (pAtPos && pAtPos->GetOffset() <= nPos)
+{
+if (pAtPos->getFrameArea().Contains(pViewPosAndCalcFrame->first))
+{
+return pAtPos;
+}
+if (pAtPos->FindPageFrame() == pPage)
+{
+pOnPage = pAtPos;
+}
+pAtPos = pAtPos->GetFollow();
+}
+return pOnPage;
+}
 
 return pMinFrame;
 }
diff --git a/sw/source/core/layout/trvlfrm.cxx 
b/sw/source/core/layout/trvlfrm.cxx
index 459c046021f8..a8445e90dd5a 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -2600,40 +2600,49 @@ void SwRootFrame::CalcFrameRects(SwShellCursor const& 
rCursor, SwRects & rRects,
 // splitting of portions vertically (causes spurious extra PDF annotations)
 if (eMode == RectsMode::NoAnchoredFlys)
 {
-assert(pStartFrame == pEndFrame); // link or field all in 1 frame
-assert(pStartFrame->IsTextFrame());
-SwTextGridItem const*const 
pGrid(GetGridItem(pStartFrame->FindPageFrame()));
-SwTextPaintInfo info(static_cast(pStartFrame), 
pStartFrame->FindPageFrame()->getFrameArea());
-SwTextPainter painter(static_cast(pStartFrame), );
-// because nothing outside the start/end has been added, it doesn't
-// matter to match exactly the start/end, subtracting outside is no-op
-
painter.CharToLine(static_cast(pStartFrame)->MapModelToViewPos(*pStartPos));
-do
-{
-info.SetPos(painter.GetTopLeft());
-bool const bAdjustBaseLine(
-
painter.GetLineInfo().HasSpecialAlign(pStartFrame->IsVertical())
-|| nullptr != pGrid || 
painter.GetCurr()->GetHangingBaseline());
-SwTwips nAscent, nHeight;
-painter.CalcAscentAndHeight(nAscent, nHeight);
-SwTwips const nOldY(info.Y());
-for (SwLinePortion const* pLP = 
painter.GetCurr()->GetFirstPortion();
-pLP; pLP = pLP->GetNextPortion())
+for (SwContentFrame * pFrame = pStartFrame; ; pFrame = 
pFrame->GetFollow())
+{
+assert(pFrame->IsTextFrame());
+SwTextGridItem const*const 
pGrid(GetGridItem(pFrame->FindPageFrame()));
+SwTextPaintInfo info(static_cast(pFrame), 

core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-26 Thread Michael Stahl (via logerrit)
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 6155fe977b0462136fcccbc6f052518041b5e66f
Author: Michael Stahl 
AuthorDate: Wed Jan 24 20:18:01 2024 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jan 26 09:56:13 2024 +0100

tdf#142806 sw: slowness if Style Inspector visible during PDF export

There are loads of bookmarks in this bugdoc, WriterInspectorTextPanel
update functions somehow iterate them all, and it's entirely pointless
because the view doesn't repaint during store anyway.

PDF export does a lot of cursor moves at the shell to get selection
rectangles, and each one triggers the slow update in AttrChangedNotify.

Also simplify, the m_pShell is already there.

Change-Id: I2177db1a2ab712e8984772843bd5f995e6989a4f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162525
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 5314947eea119a1ed4960e23c61530669b97468e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162544
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx 
b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
index 49086fa9a04f..c6376910f1a5 100644
--- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
@@ -758,12 +758,18 @@ IMPL_LINK(WriterInspectorTextPanel, AttrChangedNotify, 
LinkParamNone*, pLink, vo
 if (m_oldLink.IsSet())
 m_oldLink.Call(pLink);
 
+if (m_pShell->IsViewLocked())
+{
+return; // tdf#142806 avoid slowdown when storing files
+}
+
 SwDocShell* pDocSh = m_pShell->GetDoc()->GetDocShell();
 std::vector aStore;
 
-SwEditShell* pEditSh = pDocSh ? pDocSh->GetDoc()->GetEditShell() : nullptr;
-if (pEditSh && pEditSh->GetCursor()->GetPointNode().GetTextNode())
-UpdateTree(*pDocSh, *pEditSh, aStore, m_nParIdx);
+if (m_pShell->GetCursor()->GetPointNode().GetTextNode())
+{
+UpdateTree(*pDocSh, *m_pShell, aStore, m_nParIdx);
+}
 
 updateEntries(aStore, m_nParIdx);
 }


core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-25 Thread Michael Stahl (via logerrit)
 sw/source/core/text/itrcrsr.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 4f8aee3ae8a792bb78bf89a0d9c5fa9c58114913
Author: Michael Stahl 
AuthorDate: Tue Jan 23 18:23:12 2024 +0100
Commit: Christian Lohmaier 
CommitDate: Thu Jan 25 14:29:12 2024 +0100

sw: fix crash in SwTextCursor::GetModelPositionForViewPoint()

With a field that spans 3 SwTextFrames, it happens that
rText[sal_Int32(nCurrStart + nLength) - 1]
results in rText[-1]; it looks like both nCurrStart and nLength are
correct (nCurrStart was decremented in line 1531 after "if (bFieldInfo)")
so there is a missing check here.

Change-Id: I0d5be617e8e54c20dc8633efd3a7d82510f4acd7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162522
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 42a315b4a777dc371297752b6233e437d36c456b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162543
Reviewed-by: Christian Lohmaier 

diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 30b605cac011..a39eb77301ba 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1621,8 +1621,11 @@ TextFrameIndex 
SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
 
 // Skip space at the end of the line
 if( bLastPortion && (m_pCurr->GetNext() || m_pFrame->GetFollow() )
-&& rText[sal_Int32(nCurrStart + nLength) - 1] == ' ' )
+&& sal_Int32(nLength) != 0
+&& rText[sal_Int32(nCurrStart + nLength) - 1] == ' ')
+{
 --nLength;
+}
 
 if( nWidth > nX ||
   ( nWidth == nX && pPor->IsMultiPortion() && 
static_cast(pPor)->IsDouble() ) )


core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-22 Thread Patrick Luby (via logerrit)
 sw/source/core/undo/untbl.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 8163882de6308e46b261af9e75906d1d05c4eb08
Author: Patrick Luby 
AuthorDate: Sat Jan 13 17:57:56 2024 -0500
Commit: Patrick Luby 
CommitDate: Tue Jan 23 01:18:20 2024 +0100

tdf#159025 skip undo if SwTableNode is a nullptr

I don't know what causes the SwTableNode to be a nullptr in the
case of tdf#159025, but at least stop the crashing by skipping
this undo request.

Change-Id: Idad1ed290af215e591018ea58732b77ca504ba01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162031
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Patrick Luby 
(cherry picked from commit f414c61f8dd2617baa0851525b8a7a630c5e34da)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162225

diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 6f122e73b6da..72f1c809e227 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -272,7 +272,14 @@ void SwUndoInsTable::UndoImpl(::sw::UndoRedoContext & 
rContext)
 SwNodeIndex aIdx( rDoc.GetNodes(), m_nStartNode );
 
 SwTableNode* pTableNd = aIdx.GetNode().GetTableNode();
-OSL_ENSURE( pTableNd, "no TableNode" );
+// tdf#159025 skip undo if SwTableNode is a nullptr
+// I don't know what causes the SwTableNode to be a nullptr in the
+// case of tdf#159025, but at least stop the crashing by skipping
+// this undo request.
+SAL_WARN_IF( !pTableNd, "sw.core", "no TableNode" );
+if( !pTableNd )
+return;
+
 pTableNd->DelFrames();
 
 if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ))


core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-22 Thread Matt K (via logerrit)
 sw/source/core/layout/anchoreddrawobject.cxx |   10 ++
 sw/source/core/layout/fly.cxx|   13 -
 2 files changed, 14 insertions(+), 9 deletions(-)

New commits:
commit d6466f9b1ec73011145d429d12003b52718b
Author: Matt K 
AuthorDate: Sun Jan 21 12:23:33 2024 -0600
Commit: Xisco Fauli 
CommitDate: Mon Jan 22 21:37:31 2024 +0100

tdf#132810 Prevent more crashes on gallery objects

This change is a follow-up to https://gerrit.libreoffice.org/c/core/+/161950
where there is still a crash occurring on application close, and
a general crash when using gallery objects.  The fix is to check for object
existence or if the object has the destructor bit set before using the
objects.

Here is the callstack for the assert that was removed:

>   swlo.dll!SwClient::GetRegisteredIn() Line 166   C++
swlo.dll!SwContact::GetFormat() Line 112C++
swlo.dll!SwAnchoredDrawObject::GetFrameFormat() Line 622C++
swlo.dll!SwAnchoredObject::FindAnchorCharFrame() Line 719   C++
swlo.dll!SwAnchoredObject::GetAnchorFrameContainingAnchPos() Line 
132   C++
swlo.dll!SwAnchoredObject::FindPageFrameOfAnchor() Line 697 C++
swlo.dll!SwObjectFormatterLayFrame::AdditionalFormatObjsOnPage() 
Line 144   C++
swlo.dll!SwObjectFormatterLayFrame::DoFormatObjs() Line 94  C++
swlo.dll!SwObjectFormatter::FormatObjsAtFrame(SwFrame & 
_rAnchorFrame, const SwPageFrame & _rPageFrame, SwLayAction * _pLayAction) Line 
160 C++
swlo.dll!SwLayAction::InternalAction(OutputDevice * pRenderContext) 
Line 565C++
swlo.dll!SwLayAction::Action(OutputDevice * pRenderContext) Line 
390C++
swlo.dll!SwViewShell::ImplEndAction(const bool bIdleEnd) Line 308   
C++
swlo.dll!SwViewShell::EndAction(const bool bIdleEnd) Line 628   C++
swlo.dll!SwCursorShell::EndAction(const bool bIdleEnd) Line 266 C++
swlo.dll!SwEditShell::EndAllAction() Line 102   C++
swlo.dll!SwWrtShell::Do(SwWrtShell::DoType eDoType, unsigned short 
nCnt, unsigned short nOffset) Line 60C++
swlo.dll!SwBaseShell::ExecUndo(SfxRequest & rReq) Line 655  C++

Change-Id: I90bd40f3ae864ec9655340c342ddc16b59d79aba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162349
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 6840c242684986483624557a405a00e91ea048e9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162370
Reviewed-by: Matt K 
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/layout/anchoreddrawobject.cxx 
b/sw/source/core/layout/anchoreddrawobject.cxx
index 77a19aa8295a..5a9e1245afd8 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -619,13 +619,15 @@ void SwAnchoredDrawObject::InvalidateObjPos()
 
 SwFrameFormat* SwAnchoredDrawObject::GetFrameFormat()
 {
-
assert(static_cast(GetUserCall(GetDrawObj()))->GetFormat());
-return static_cast(GetUserCall(GetDrawObj()))->GetFormat();
+if (SwDrawContact* pDC = 
static_cast(GetUserCall(GetDrawObj(
+return pDC->GetFormat();
+return nullptr;
 }
 const SwFrameFormat* SwAnchoredDrawObject::GetFrameFormat() const
 {
-
assert(static_cast(GetUserCall(GetDrawObj()))->GetFormat());
-return static_cast(GetUserCall(GetDrawObj()))->GetFormat();
+if (SwDrawContact* pDC = 
static_cast(GetUserCall(GetDrawObj(
+return pDC->GetFormat();
+return nullptr;
 }
 
 SwRect SwAnchoredDrawObject::GetObjRect() const
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 6e7e6235dcb3..ba57cd6b4cdf 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2594,12 +2594,15 @@ void SwFrame::RemoveDrawObj( SwAnchoredObject& 
_rToRemoveObj )
 {
 // Notify accessible layout.
 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
-SwViewShell* pSh = getRootFrame()->GetCurrShell();
-if( pSh )
+if (!mbInDtor)
 {
-SwRootFrame* pLayout = getRootFrame();
-if (pLayout && pLayout->IsAnyShellAccessible())
-pSh->Imp()->DisposeAccessibleObj(_rToRemoveObj.GetDrawObj(), 
false);
+SwViewShell* pSh = getRootFrame()->GetCurrShell();
+if (pSh)
+{
+SwRootFrame* pLayout = getRootFrame();
+if (pLayout && pLayout->IsAnyShellAccessible())
+pSh->Imp()->DisposeAccessibleObj(_rToRemoveObj.GetDrawObj(), 
false);
+}
 }
 #endif
 


core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-22 Thread Mike Kaganski (via logerrit)
 sw/source/uibase/docvw/edtwin.cxx |   35 ---
 sw/source/uibase/inc/edtwin.hxx   |3 ++-
 2 files changed, 26 insertions(+), 12 deletions(-)

New commits:
commit b2fe91897ac4f55bac93aa9f499ed8f29baecd7d
Author: Mike Kaganski 
AuthorDate: Mon Jan 22 02:03:13 2024 +0600
Commit: Xisco Fauli 
CommitDate: Mon Jan 22 21:36:18 2024 +0100

tdf#158139: show autotext / word completion tooltips also for delayed flush

The problem was that commit 843af72bcc9047867588e29c8e10b84a5e58d70e (make
win32 variant AnyInput() not deliver events (tdf#140293), 2021-02-11) made
AnyInput ~always return true, when called in SwEditWin::KeyInput. Calling
AnyInput(KEYBOARD) there is to query if there are more pending characters.
But in its new form on Windows, it tells if there are any keyboard-related
window events in the queue, where e.g. WM_KEYUP counts, which is for the
same keypress (WM_KEYDOWN) that is being handled right now - even though
those messages will not produce new characters.

When AnyInput() returns true, a delayed flush timer starts. Only immediate
flush was accompanied by tooltips.

To make sure that the tooltip is shown also for delayed flush, move the
tooltip code into SwEditWin::FlushInBuffer. Store the 'bNormalChar' flag
(which controlled if the tooltip was shown) in a new member in SwEditWin.

Change-Id: I51686b25f8d86df48ae9574ab8f3eb1d0e6ca985
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162350
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit d49b0c3654e50ff9b74545140e6f19e008009c33)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162372
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index d2c3f0e865d7..073b6b59649e 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -896,6 +896,25 @@ void SwEditWin::FlushInBuffer()
 return;
 
 SwWrtShell& rSh = m_rView.GetWrtShell();
+uno::Reference xRecorder
+= m_rView.GetViewFrame().GetBindings().GetRecorder();
+
+comphelper::ScopeGuard showTooltipGuard(
+[this, ]
+{
+SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
+const bool bAutoTextShown
+= rACfg.IsAutoTextTip() && 
ShowAutoText(rSh.GetChunkForAutoText());
+if (!bAutoTextShown)
+{
+SvxAutoCorrect* pACorr = rACfg.GetAutoCorrect();
+if (pACorr && pACorr->GetSwFlags().bAutoCompleteWords)
+ShowAutoCorrectQuickHelp(rSh.GetPrevAutoCorrWord(*pACorr), 
*pACorr);
+}
+});
+if (!m_bMaybeShowTooltipAfterBufferFlush || xRecorder)
+showTooltipGuard.dismiss();
+m_bMaybeShowTooltipAfterBufferFlush = false;
 
 // generate new sequence input checker if not already done
 if ( !pCheckIt )
@@ -993,8 +1012,6 @@ void SwEditWin::FlushInBuffer()
 }
 }
 
-uno::Reference< frame::XDispatchRecorder > xRecorder =
-m_rView.GetViewFrame().GetBindings().GetRecorder();
 if ( xRecorder.is() )
 {
 // determine shell
@@ -1381,6 +1398,9 @@ void SwEditWin::KeyInput(const KeyEvent )
 }
 }
 
+// Do not show autotext / word completion tooltips in intermediate flushes
+m_bMaybeShowTooltipAfterBufferFlush = false;
+
 sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode();
 
 if (nKey == KEY_ESCAPE)
@@ -2821,19 +2841,12 @@ KEYINPUT_CHECKTABLE_INSDEL:
 if( KEY_UP == nKey || KEY_DOWN == nKey || KEY_PAGEUP == nKey || 
KEY_PAGEDOWN == nKey )
 GetView().GetViewFrame().GetBindings().Update( FN_STAT_PAGE );
 
+m_bMaybeShowTooltipAfterBufferFlush = bNormalChar;
+
 // in case the buffered characters are inserted
 if( bFlushBuffer && !m_aInBuffer.isEmpty() )
 {
 FlushInBuffer();
-
-// maybe show Tip-Help
-if (bNormalChar)
-{
-const bool bAutoTextShown
-= pACfg && pACfg->IsAutoTextTip() && 
ShowAutoText(rSh.GetChunkForAutoText());
-if (!bAutoTextShown && pACorr && 
pACorr->GetSwFlags().bAutoCompleteWords)
-ShowAutoCorrectQuickHelp(rSh.GetPrevAutoCorrWord(*pACorr), 
*pACorr);
-}
 }
 
 // get the word count dialog to update itself
diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx
index 714e6bcc3be0..ceaa98657fe9 100644
--- a/sw/source/uibase/inc/edtwin.hxx
+++ b/sw/source/uibase/inc/edtwin.hxx
@@ -122,7 +122,8 @@ class SW_DLLPUBLIC SwEditWin final : public vcl::DocWindow,
 selection position depending on what has changed lately
  */
 m_bUseInputLanguage: 1,
-m_bObjectSelect   : 1;
+m_bObjectSelect   : 1,
+m_bMaybeShowTooltipAfterBufferFlush : 1 = false;
 

core.git: Branch 'libreoffice-24-2' - sw/source

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

New commits:
commit cafcc50570f9edaaebe74d2152bae5df1cc2edfe
Author: Jim Raykowski 
AuthorDate: Thu Jan 18 21:52:37 2024 -0900
Commit: Caolán McNamara 
CommitDate: Sun Jan 21 13:17:25 2024 +0100

tdf#159147 followup

Avoid unnecessary looping by immediate return from the function after
bringing content to attention.

Change-Id: I670dc5d0991d96e7ce2872d329e969f9c341d163
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162291
Tested-by: Jenkins
Reviewed-by: Jim Raykowski 
(cherry picked from commit a08197e7c376c72685260ae923483ae99f929d35)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162279
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 3bf29979ddf3..4e6704140334 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -6085,13 +6085,13 @@ void SwContentTree::BringEntryToAttention(const 
weld::TreeIter& rEntry)
 for (auto n = pFormats->size(); 1 < n;)
 {
 SwIterator 
aIter(*(*pFormats)[--n]);
-for (SwTextINetFormat* pFnd = aIter.First(); pFnd; pFnd = 
aIter.Next() )
+for (SwTextINetFormat* pFnd = aIter.First(); pFnd; pFnd = 
aIter.Next())
 {
 if (pTextINetFormat == pFnd)
 {
 BringURLFieldsToAttention(SwGetINetAttrs 
{SwGetINetAttr(pCnt->GetName(),
   
*pTextINetFormat)});
-break;
+return;
 }
 }
 }


core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-20 Thread Michael Stahl (via logerrit)
 sw/source/core/crsr/crsrsh.cxx |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 53d8675436cb500adff0f9f6aa0063b9c00962dd
Author: Michael Stahl 
AuthorDate: Thu Jan 18 14:29:06 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sat Jan 20 17:41:34 2024 +0100

tdf#139631 sw_redlinehide: fix IntelligentCut feature with redlines

Unfortunately forgot to adapt SwCursorShell::GetChar() to use the
SwTextFrame instead of the SwTextNode, so it returns non-visible
(deleted) characters to SwWrtShell::IntelligentCut(), breaking one of
our oldest AI features.

(regression from sw_redlinehide)

Change-Id: I0c19944159e7e3af323bfe626c0e496ad745ef35
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162253
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit ab2b0bd10481e9d0bb5bfea09ab0b034bb246c52)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162271
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 04b263cda754..173414ed4db7 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2936,6 +2936,7 @@ OUString SwCursorShell::GetSelText() const
 }
 
 /** get the nth character of the current SSelection
+in the same paragraph as the start/end.
 
 @param bEndStart counting from the end? From start otherwise.
 @param nOffset position of the character
@@ -2951,8 +2952,14 @@ sal_Unicode SwCursorShell::GetChar( bool bEnd, 
tools::Long nOffset )
 if( !pTextNd )
 return 0;
 
-const sal_Int32 nPos = pPos->GetContentIndex();
-const OUString& rStr = pTextNd->GetText();
+SwTextFrame const*const pFrame(static_cast(pTextNd->getLayoutFrame(GetLayout(;
+if (!pFrame)
+{
+return 0;
+}
+
+const sal_Int32 nPos(sal_Int32(pFrame->MapModelToViewPos(*pPos)));
+const OUString& rStr(pFrame->GetText());
 sal_Unicode cCh = 0;
 
 if (((nPos+nOffset) >= 0 ) && (nPos+nOffset) < rStr.getLength())


core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-20 Thread Michael Stahl (via logerrit)
 sw/source/core/crsr/crstrvl.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 908abf0b0e36fd1c6e8d3df48e9c35ce911c9bda
Author: Michael Stahl 
AuthorDate: Fri Jan 12 12:52:51 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sat Jan 20 17:39:02 2024 +0100

tdf#158783 sw: SwCursorShell::GotoTOXMark() must actually move cursor

The problem was that the buttons in SwIndexMarkPane got the
next/previous mark, but SwCursorShell::GotoTOXMark() may return the
next/previous mark without actually moving the cursor.

It happens that the current mark is outside a table and the next mark is
inside a table, then UpdateCursor() doesn't accept the invalid cursor
range and resets the point to its previous position.

Change-Id: I5c0fb4a9bbcbdd479581172834b6eda76a5abbc1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161970
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 3fefff7ce29a234694343105c50c7bc3259a9cb8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161949
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index db11d4ea334a..81323787d7cc 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -600,6 +600,7 @@ const SwTOXMark& SwCursorShell::GotoTOXMark( const 
SwTOXMark& rStart,
 SwPosition& rPos = *GetCursor()->GetPoint();
 rPos.Assign(rNewMark.GetTextTOXMark()->GetTextNode(),
  rNewMark.GetTextTOXMark()->GetStart() );
+GetCursor()->DeleteMark(); // tdf#158783 prevent UpdateCursor resetting 
point
 
 if( !m_pCurrentCursor->IsSelOvr() )
 UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE |


core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-17 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/utlui/content.cxx |   20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

New commits:
commit e8877f971a4b50e58bbbe3df1e14cde1a2e0d694
Author: Jim Raykowski 
AuthorDate: Fri Jan 12 23:56:43 2024 -0900
Commit: Xisco Fauli 
CommitDate: Wed Jan 17 20:26:44 2024 +0100

tdf#159147 Fix crash when editing hyperlink while navigator is open

by assuring the SwURLFieldContent::SwTextINetFormat pointer is still
valid before trying to bring the hyperlink content to attention

Change-Id: I7f672576ab2869c5483284b543e99e46a558acc9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162013
Tested-by: Jenkins
Tested-by: Xisco Fauli 
Reviewed-by: Jim Raykowski 
(cherry picked from commit b2500f0e32b33eec2740dc370238f66fb8b50ffb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162212
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 72fd76cbe1ce..3bf29979ddf3 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -6077,8 +6077,24 @@ void SwContentTree::BringEntryToAttention(const 
weld::TreeIter& rEntry)
 }
 else if (nType == ContentTypeId::URLFIELD)
 {
-BringURLFieldsToAttention(SwGetINetAttrs 
{SwGetINetAttr(pCnt->GetName(),
-
*static_cast(pCnt)->GetINetAttr())});
+// tdf#159147 - Assure the SwURLFieldContent::SwTextINetFormat 
pointer is valid
+// before bringing to attention.
+const SwTextINetFormat* pTextINetFormat
+= static_cast(pCnt)->GetINetAttr();
+const SwCharFormats* pFormats = 
m_pActiveShell->GetDoc()->GetCharFormats();
+for (auto n = pFormats->size(); 1 < n;)
+{
+SwIterator 
aIter(*(*pFormats)[--n]);
+for (SwTextINetFormat* pFnd = aIter.First(); pFnd; pFnd = 
aIter.Next() )
+{
+if (pTextINetFormat == pFnd)
+{
+BringURLFieldsToAttention(SwGetINetAttrs 
{SwGetINetAttr(pCnt->GetName(),
+  
*pTextINetFormat)});
+break;
+}
+}
+}
 }
 else if (nType == ContentTypeId::REFERENCE)
 {


core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-17 Thread Matthew Kogan (via logerrit)
 sw/source/core/text/porfld.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit ee0a6a4179b17b76dfd97982ef87d92661afc28c
Author: Matthew Kogan 
AuthorDate: Tue Jan 16 11:03:43 2024 +
Commit: Xisco Fauli 
CommitDate: Wed Jan 17 15:23:48 2024 +0100

tdf#159101 sw: Fix space appearing at start of line when field wraps

Adding the ' ' to ScanPortionEnd fails pretty quickly with infinite
loop.

The important part of fixing the forum-mso-en-13115.docx was that the
SetHasFollow(true) condition is not affected by a ' '.

(regression from commit 21473f46fda5f1c7f220493667a96fff7c78a7b3)

Change-Id: I6452673c0fe05ca549b63a398a977fc71db64bae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162167
Tested-by: Jenkins
Reviewed-by: Matthew Kogan 
Reviewed-by: Michael Stahl 
(cherry picked from commit 4cdb542348b20d8a558cd6413c7cccdc50241fa9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162146
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 1a30a4ecd7d1..a1f3b9729383 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -402,10 +402,13 @@ bool SwFieldPortion::Format( SwTextFormatInfo  )
 // These characters should not be contained in the follow
 // field portion. They are handled via the HookChar mechanism.
 const sal_Unicode nNew = !aNew.isEmpty() ? aNew[0] : 0;
-auto IsHook = [](const sal_Unicode cNew) -> bool
+auto IsHook = [](const sal_Unicode cNew, bool const isSpace = 
false) -> bool
 {
 switch (cNew)
 {
+case ' ': // tdf#159101 this one is not in ScanPortionEnd
+  // but is required for justified text
+return isSpace;
 case CH_BREAK:
 case CH_TAB:
 case CHAR_HARDHYPHEN: // non-breaking hyphen
@@ -422,7 +425,7 @@ bool SwFieldPortion::Format( SwTextFormatInfo  )
 return false;
 }
 };
-if (IsHook(nNew))
+if (IsHook(nNew, true))
 {
 if (nNew == CH_BREAK)
 {


core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-09 Thread Oliver Specht (via logerrit)
 sw/source/core/text/inftxt.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit dcfb786e5dee09a2ee28df9a4c64e08fef6180f9
Author: Oliver Specht 
AuthorDate: Thu Dec 21 13:59:03 2023 +0100
Commit: Michael Stahl 
CommitDate: Tue Jan 9 15:17:56 2024 +0100

tdf#98321 Checkbox: size like Word

Display checkboxes imported from docx/rtf in the same size as Word.
Additionally apply font highlighting if available.

Change-Id: Ifea4aebf8c39b6cdd750f3c90e121da0c4131d4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161124
Tested-by: Jenkins
Tested-by: Gabor Kelemen 
Reviewed-by: Thorsten Behrens 
(cherry picked from commit bece5f05a33ac7ac723b46d455d104930a3b0839)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161312
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 5e5d5718102f..3d9121ef1ec2 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1112,12 +1112,15 @@ void SwTextPaintInfo::DrawCheckBox(const 
SwFieldFormCheckboxPortion , bool
 {
 OutputDevice* pOut = const_cast(GetOut());
 pOut->Push( vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR );
-pOut->SetFillColor( GetOpt().GetFieldShadingsColor() );
+if( m_pFnt->GetHighlightColor() != COL_TRANSPARENT )
+pOut->SetFillColor(m_pFnt->GetHighlightColor());
+else
+pOut->SetFillColor(GetOpt().GetFieldShadingsColor());
 pOut->SetLineColor();
 pOut->DrawRect( aIntersect.SVRect() );
 pOut->Pop();
 }
-const int delta=10;
+const int delta = 25;
 tools::Rectangle r(aIntersect.Left()+delta, aIntersect.Top()+delta, 
aIntersect.Right()-delta, aIntersect.Bottom()-delta);
 m_pOut->Push( vcl::PushFlags::LINECOLOR | vcl::PushFlags::FILLCOLOR );
 m_pOut->SetLineColor( Color(0, 0, 0));


core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-09 Thread László Németh (via logerrit)
 sw/source/core/text/porlin.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit ac96909729152d01b0a20c8e6ca204e6bc3d7160
Author: László Németh 
AuthorDate: Fri Jan 5 08:00:19 2024 +0100
Commit: László Németh 
CommitDate: Tue Jan 9 10:36:08 2024 +0100

tdf#159034 sw smart justify: fix position of shading

E.g. shading of soft hyphens didn't follow space shrinking.

Follow-up to commit 20cbe88ce5610fd8ee302e5780a4c0821ddb3db4
"tdf#119908 tdf#158419 sw smart justify: fix cursor position".

Change-Id: Icdce4736d9c76ff1fbe9dd140b9f1c091e605452
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161654
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 7a1470fd97d52c5196a0800dd64f4c8899909c4b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161762
Tested-by: László Németh 

diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx
index 4f93c9d727ce..a420d64301ff 100644
--- a/sw/source/core/text/porlin.cxx
+++ b/sw/source/core/text/porlin.cxx
@@ -89,8 +89,8 @@ void SwLinePortion::PrePaint( const SwTextPaintInfo& rInf,
 const sal_uInt16 nHalfView = nViewWidth / 2;
 sal_uInt16 nLastWidth = pLast->Width() + pLast->ExtraBlankWidth();
 
-if ( pLast->InSpaceGrp() && rInf.GetSpaceAdd() )
-nLastWidth += pLast->CalcSpacing( rInf.GetSpaceAdd(), rInf );
+if ( pLast->InSpaceGrp() && rInf.GetSpaceAdd(/*bShrink=*/true) )
+nLastWidth += pLast->CalcSpacing( rInf.GetSpaceAdd(/*bShrink=*/true), 
rInf );
 
 sal_uInt16 nPos;
 SwTextPaintInfo aInf( rInf );


core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-08 Thread Julien Nabet (via logerrit)
 sw/source/ui/misc/num.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit b7e68d467f99c7db357685adad13f738799009be
Author: Julien Nabet 
AuthorDate: Mon Jan 1 22:40:09 2024 +0100
Commit: Xisco Fauli 
CommitDate: Mon Jan 8 09:48:33 2024 +0100

tdf#155649: EDITING Writer some position parameters cannot go beyond 17 mm

Change-Id: I70a80527dcc1c714fbe8783d1c4594bcc26b0624
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161528
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
(cherry picked from commit a254bb2d4fe269a63ccfc1811331272ac88b2523)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161630
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx
index 91e075d26124..fadef2466205 100644
--- a/sw/source/ui/misc/num.cxx
+++ b/sw/source/ui/misc/num.cxx
@@ -81,6 +81,10 @@ SwNumPositionTabPage::SwNumPositionTabPage(weld::Container* 
pPage, weld::DialogC
 {
 SetExchangeSupport();
 
+m_xAlignedAtMF->set_range(0, SAL_MAX_INT32, FieldUnit::NONE);
+m_xListtabMF->set_range(0, SAL_MAX_INT32, FieldUnit::NONE);
+m_xIndentAtMF->set_range(0, SAL_MAX_INT32, FieldUnit::NONE);
+
 m_xLevelLB->set_selection_mode(SelectionMode::Multiple);
 
 m_xRelativeCB->set_active(true);
@@ -494,9 +498,6 @@ void SwNumPositionTabPage::SetWrtShell(SwWrtShell* pSh)
 m_xDistBorderMF->set_max(m_xDistBorderMF->normalize( nWidth ), 
FieldUnit::TWIP );
 m_xDistNumMF->set_max(m_xDistNumMF->normalize( nWidth ), FieldUnit::TWIP);
 m_xIndentMF->set_max(m_xIndentMF->normalize( nWidth ), FieldUnit::TWIP );
-m_xListtabMF->set_max(m_xListtabMF->normalize( nWidth ), FieldUnit::TWIP );
-m_xAlignedAtMF->set_max(m_xAlignedAtMF->normalize( nWidth ), 
FieldUnit::TWIP );
-m_xIndentAtMF->set_max(m_xIndentAtMF->normalize( nWidth ), FieldUnit::TWIP 
);
 
 const SwRect& rPrtRect = m_pWrtSh->GetAnyCurRect(CurRectType::Page);
 m_aPreviewWIN.SetPageWidth(rPrtRect.Width());


core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-03 Thread Miklos Vajna (via logerrit)
 sw/source/uibase/uiview/view.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit adff88fb77ed9e5fd39bd113fde08c5ee06ed2d3
Author: Miklos Vajna 
AuthorDate: Wed Jan 3 08:10:47 2024 +0100
Commit: Miklos Vajna 
CommitDate: Wed Jan 3 15:41:47 2024 +0100

tdf#158532 sw: fix toolbar buttons remain disabled after pasting an image

Pasting an image and then quickly switching to text selection resulted
in e.g. the 'Insert Special Characters' toolbar button to remain
disabled, which is incorrect.

What happened is that the check in SwView::SelectShell() was poor, the
intent in commit 31cb5b5538b9fd91dafb067ce961f2540555ad2b (sw: fix
missing cache invalidation when switching between images, 2022-08-23)
was to handle the case when we switch between images, but it also
triggered for the case when we were switching from text to image.

Once the condition is fixed, an additional problem was that while
switching from text to image, m_nSelectionType is not yet updated, so
use IsSelFrameMode() instead, this way both the old and the new
use-cases work.

A testcase that covers this would look something like this:

createSwDoc();
SwDocShell* pDocShell = getSwDocShell();
SwView* pView = pDocShell->GetView();

pView->InsertGraphic(createFileURL(u"test.jpg"), OUString(), 
/*bAsLink=*/false,
 ::GetGraphicFilter());
dispatchCommand(mxComponent, ".uno:Escape", {});

std::unique_ptr pItem;
SfxItemState eState = 
pView->GetViewFrame().GetBindings().QueryState(SID_INSERT_DIAGRAM, pItem);
CPPUNIT_ASSERT_EQUAL(SfxItemState::DEFAULT, eState);

but for some reason that also passes without the fix, so probably this
change is hard to test from cppunit with reasonable amount of effort.

Change-Id: I16749455e093cecf17fa067d7ddf86cd007fd2d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161579
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit a586ce188086ff27b08b8a4de4672c07ddf8ed7c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161562

diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index ab8da1cc2d44..2d46cd04f260 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -284,12 +284,13 @@ void SwView::SelectShell()
 // Determine if a different fly frame was selected.
 bool bUpdateFly = false;
 const SwFrameFormat* pCurFlyFormat = nullptr;
-if (m_nSelectionType & SelectionType::Ole || m_nSelectionType & 
SelectionType::Graphic)
+if (m_pWrtShell->IsSelFrameMode())
 {
 pCurFlyFormat = m_pWrtShell->GetFlyFrameFormat();
 }
-if (pCurFlyFormat && pCurFlyFormat != m_pLastFlyFormat)
+if (pCurFlyFormat && m_pLastFlyFormat && pCurFlyFormat != m_pLastFlyFormat)
 {
+// Only do an explicit update when switching between flys.
 bUpdateFly = true;
 }
 m_pLastFlyFormat = pCurFlyFormat;


core.git: Branch 'libreoffice-24-2' - sw/source

2024-01-03 Thread Caolán McNamara (via logerrit)
 sw/source/ui/dialog/wordcountdialog.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 15e5f503c2c7e84eb424d265ed472cc2c5b1dc69
Author: Caolán McNamara 
AuthorDate: Sun Dec 31 15:12:21 2023 +
Commit: Xisco Fauli 
CommitDate: Wed Jan 3 10:36:48 2024 +0100

cid#1559993 Division or modulo by float zero

Change-Id: I071d576fc998022c76364778423e0346f69cb051
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161500
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 7cf623ae1771f448ab4f82c175156a7e776fa964)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161425
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/ui/dialog/wordcountdialog.cxx 
b/sw/source/ui/dialog/wordcountdialog.cxx
index b0b92a6ae1a7..1277545c6e12 100644
--- a/sw/source/ui/dialog/wordcountdialog.cxx
+++ b/sw/source/ui/dialog/wordcountdialog.cxx
@@ -67,9 +67,10 @@ void SwWordCountFloatDlg::SetValues(const SwDocStat& 
rCurrent, const SwDocStat&
 setValue(*m_xDocCjkcharsFT, rDoc.nAsianWord, rLocaleData);
 setValue(*m_xDocComments, rCurrent.nComments, rLocaleData);
 
-if (m_xStandardizedPagesLabelFT->get_visible())
+const sal_Int64 nCharsPerStandardizedPage = 
m_xStandardizedPagesLabelFT->get_visible() ?
+officecfg::Office::Writer::WordCount::StandardizedPageSize::get() : 0;
+if (nCharsPerStandardizedPage)
 {
-sal_Int64 nCharsPerStandardizedPage = 
officecfg::Office::Writer::WordCount::StandardizedPageSize::get();
 setDoubleValue(*m_xCurrentStandardizedPagesFT,
 static_cast(rCurrent.nChar) / nCharsPerStandardizedPage);
 setDoubleValue(*m_xDocStandardizedPagesFT,


core.git: Branch 'libreoffice-24-2' - sw/source

2023-12-29 Thread Michael Stahl (via logerrit)
 sw/source/core/unocore/unodraw.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit fc36057d77db18fc57b814d06d4593e0d7f116a6
Author: Michael Stahl 
AuthorDate: Thu Dec 21 19:59:48 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Dec 29 12:43:27 2023 +0100

tdf#158451 sw: fix crash in text formatting of as-char group shape

The problem is that during formatting of a SwTextFrame, SwTextFly
contains a list of all anchored objects that could overlap, and then
creating a portion for the as-char anchored group shape sets the anchor
property and thereby unexpectedly deletes the child anchored object,
while SwTextFly stores a pointer to it:

4  SwFlyLayFrame::~SwFlyLayFrame()
5  SwFrame::DestroyFrame()
6  SwFrameFormat::DelFrames()
7  SwDoc::SetFlyFrameAnchor()
8  lcl_SetFlyFrameAttr()
10 SwXFrame::setPropertyValue()
   (this=0x4042de0, rPropertyName="AnchorType", 
_rValue=uno::Any("com.sun.star.text.TextContentAnchorType": 
com::sun::star::text::TextContentAnchorType::TextContentAnchorType_AT_CHARACTER))
 at sw/source/core/unocore/unoframe.cxx:1941
11 SwTextBoxHelper::changeAnchor()
12 SwTextBoxHelper::synchronizeGroupTextBoxProperty()
13 SwTextBoxHelper::synchronizeGroupTextBoxProperty()
14 SwFlyCntPortion::SetBase()
15 sw::DrawFlyCntPortion::Create()
16 SwTextFormatter::NewFlyCntPortion()

This is because after the import is complete, only the group shape has
its anchor set, while the child shapes all have a default FLY_AT_PAGE
anchor.

There is already code in SwXShape::setPropertyValue() to propagate the
new anchor to children, but it's limited to group shape with more than 1
text frame; very unclear why this limit exists so just remove it.

Change-Id: Ide0f9def36e3b4eff6140206e3dfa4ee2c65e3eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161137
Tested-by: Jenkins
Reviewed-by: Regina Henschel 
Reviewed-by: Michael Stahl 
(cherry picked from commit 59ece793dbfc23dddccc56cfaff60d3558dc2b6b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161169
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/unocore/unodraw.cxx 
b/sw/source/core/unocore/unodraw.cxx
index a229c1f2031f..5bb5621d9575 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1364,12 +1364,12 @@ void SwXShape::setPropertyValue(const OUString& 
rPropertyName, const uno::Any& a
 // If this property is an anchor change, and there is a 
group shape with textboxes
 // do anchor sync in time unless the anchor sync in the 
porfly will cause crash during
 // layout calculation (When importing an inline shape in 
docx via dmapper).
-if (pFormat->Which() == RES_DRAWFRMFMT && 
pFormat->GetOtherTextBoxFormats()
-&& pFormat->GetOtherTextBoxFormats()->GetTextBoxCount()
-   > o3tl::make_unsigned(1))
+if (pFormat->Which() == RES_DRAWFRMFMT && 
pFormat->GetOtherTextBoxFormats())
+{
 SwTextBoxHelper::synchronizeGroupTextBoxProperty(
 SwTextBoxHelper::changeAnchor, pFormat,
 SdrObject::getSdrObjectFromXShape(mxShape));
+}
 }
 else
 pFormat->SetFormatAttr(aSet);


core.git: Branch 'libreoffice-24-2' - sw/source

2023-12-21 Thread Caolán McNamara (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 274380def4cdbf4cec86951c3a539b88043aa048
Author: Caolán McNamara 
AuthorDate: Thu Dec 21 16:47:18 2023 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Dec 21 23:30:15 2023 +0100

crashreporting: apparent null deref in a11y check

svl/source/items/itemset.cxx:801
svl/source/items/itemset.cxx:796
sw/source/core/access/AccessibilityCheck.cxx:1193
sw/source/core/access/AccessibilityCheck.cxx:1184
sw/source/core/access/AccessibilityCheck.cxx:1562
sw/source/core/access/AccessibilityCheck.cxx:1552
sw/source/core/txtnode/OnlineAccessibilityCheck.cxx:134
cppu/source/uno/copy.hxx:288
cppu/source/uno/any.cxx:72
cppu/source/typelib/typelib.cxx:1328
cppu/source/typelib/typelib.cxx:2169

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

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 2e3219765e22..36226b028937 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -1029,10 +1029,12 @@ public:
 return;
 
 // Check if it's a real caption
-const SwNode* aStartFly = pCurrent->FindFlyStartNode();
-if (aStartFly
-&& aStartFly->GetFlyFormat()->GetAnchor().GetAnchorId() != 
RndStdIds::FLY_AS_CHAR)
-return;
+if (const SwNode* pStartFly = pCurrent->FindFlyStartNode())
+{
+const SwFrameFormat* pFormat = pStartFly->GetFlyFormat();
+if (!pFormat || pFormat->GetAnchor().GetAnchorId() != 
RndStdIds::FLY_AS_CHAR)
+return;
+}
 
 auto aIter = SwIterator(*pTextNode);
 auto nCount = 0;


core.git: Branch 'libreoffice-24-2' - sw/source

2023-12-21 Thread Mike Kaganski (via logerrit)
 sw/source/core/edit/edtab.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 952ce9b534857151ae57e517bc7ab6c9190b9916
Author: Mike Kaganski 
AuthorDate: Wed Dec 20 18:52:17 2023 +0300
Commit: Xisco Fauli 
CommitDate: Thu Dec 21 12:03:58 2023 +0100

tdf#158794: do not try to insert DDE table into footnotes / endnotes

Until tdf#76007 is fixed, of course.

Change-Id: Iad7fb0de679e024a8cebdd005ac5a66af3ace163
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161078
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 3a33a97d2358a7ad2e67c01edc1fca29d1b7041c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161090
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx
index b011a182b3ca..5e318ea74820 100644
--- a/sw/source/core/edit/edtab.cxx
+++ b/sw/source/core/edit/edtab.cxx
@@ -225,6 +225,10 @@ void SwEditShell::InsertDDETable( const 
SwInsertTableOptions& rInsTableOpts,
   sal_uInt16 nRows, sal_uInt16 nCols )
 {
 SwPosition* pPos = GetCursor()->GetPoint();
+// Do not try to insert table into Footnotes/Endnotes! tdf#76007 prevents 
that.
+if (pPos->GetNode() < pPos->GetNodes().GetEndOfInserts()
+&& pPos->GetNode().GetIndex() >= 
pPos->GetNodes().GetEndOfInserts().StartOfSectionIndex())
+return;
 
 StartAllAction();
 


core.git: Branch 'libreoffice-24-2' - sw/source

2023-12-20 Thread Justin Luth (via logerrit)
 sw/source/core/layout/layact.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7b147751b26c1a8af31c4b41a2a9db0cb70aa9b2
Author: Justin Luth 
AuthorDate: Tue Dec 19 14:18:55 2023 -0500
Commit: Xisco Fauli 
CommitDate: Wed Dec 20 10:46:05 2023 +0100

related tdf#111969 fix smart tags job not being fired, due to typo

This fixes quikee's 7.5 regression
commit 01396925b76011ffccb6eea40956a22d58de6f17

If this is a help document, we don't want to run smart tags,
not the other way around.

It was correct originally - assuming this was just
a typo when the tests were pulled out into a function.

Change-Id: Ie21ed256539ce242a7892c1ddc1556319fc45310
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161006
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 2c92838583d59c543be136516db3de24b1613c93)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161015
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 84481981fd6e..747470129c96 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -2185,7 +2185,7 @@ bool SwLayIdle::isJobEnabled(IdleJobType eJob, const 
SwViewShell* pViewShell)
 case IdleJobType::SMART_TAGS:
 {
 const SwDoc* pDoc = pViewShell->GetDoc();
-if (!pDoc->GetDocShell()->IsHelpDocument() || pDoc->isXForms() || 
!SwSmartTagMgr::Get().IsSmartTagsEnabled())
+if (pDoc->GetDocShell()->IsHelpDocument() || pDoc->isXForms() || 
!SwSmartTagMgr::Get().IsSmartTagsEnabled())
 return false;
 return true;
 }


core.git: Branch 'libreoffice-24-2' - sw/source

2023-12-11 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/utlui/content.cxx |   34 ++
 1 file changed, 22 insertions(+), 12 deletions(-)

New commits:
commit dfb863c70fb0e924fdd053089a40cbcdd3dc5839
Author: Caolán McNamara 
AuthorDate: Sun Dec 10 12:48:48 2023 +
Commit: Xisco Fauli 
CommitDate: Mon Dec 11 20:40:50 2023 +0100

cid#1558174 Bad bit shift operation

and

cid#1558175 Bad bit shift operation

Change-Id: I44d6f351716cf722abcd19ff866bc247ba9f5cd0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160538
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 3f02996475aef76f4e4c7fbe1701534a154d3fe1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160572
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index d7e0a61d0b33..8d46ef52303a 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -2428,14 +2428,19 @@ void SwContentTree::Expand(const weld::TreeIter& 
rParent,
 {
 // m_nActiveBlock and m_nHiddenBlock are used to persist the content 
type expand state for
 // the all content view mode
-const sal_Int32 nOr = 1 << static_cast(eParentContentTypeId); 
//linear -> Bitposition
-if (State::HIDDEN != m_eState)
+const int nShift = static_cast(eParentContentTypeId);
+SAL_WARN_IF(nShift < 0, "sw.ui", "ContentTypeId::UNKNOWN negative 
shift");
+if (nShift >= 0)
 {
-m_nActiveBlock |= nOr;
-m_pConfig->SetActiveBlock(m_nActiveBlock);
+const sal_Int32 nOr = 1 << nShift; //linear -> Bitposition
+if (State::HIDDEN != m_eState)
+{
+m_nActiveBlock |= nOr;
+m_pConfig->SetActiveBlock(m_nActiveBlock);
+}
+else
+m_nHiddenBlock |= nOr;
 }
-else
-m_nHiddenBlock |= nOr;
 }
 
 if (m_nRootType == ContentTypeId::OUTLINE || (m_nRootType == 
ContentTypeId::UNKNOWN &&
@@ -2599,14 +2604,19 @@ IMPL_LINK(SwContentTree, CollapseHdl, const 
weld::TreeIter&, rParent, bool)
 }
 ContentTypeId eContentTypeId =
 
weld::fromId(m_xTreeView->get_id(rParent))->GetType();
-const sal_Int32 nAnd = ~(1 << static_cast(eContentTypeId));
-if (State::HIDDEN != m_eState)
+const int nShift = static_cast(eContentTypeId);
+SAL_WARN_IF(nShift < 0, "sw.ui", "ContentTypeId::UNKNOWN negative 
shift");
+if (nShift >= 0)
 {
-m_nActiveBlock &= nAnd;
-m_pConfig->SetActiveBlock(m_nActiveBlock);
+const sal_Int32 nAnd = ~(1 << nShift);
+if (State::HIDDEN != m_eState)
+{
+m_nActiveBlock &= nAnd;
+m_pConfig->SetActiveBlock(m_nActiveBlock);
+}
+else
+m_nHiddenBlock &= nAnd;
 }
-else
-m_nHiddenBlock &= nAnd;
 }
 else // content entry
 {


core.git: Branch 'libreoffice-24-2' - sw/source

2023-12-11 Thread Matt K (via logerrit)
 sw/source/core/edit/autofmt.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 8d3092eaea3fba2b96318d09722ca15b75a5b467
Author: Matt K 
AuthorDate: Sun Dec 10 12:20:32 2023 -0600
Commit: Xisco Fauli 
CommitDate: Mon Dec 11 14:14:44 2023 +0100

tdf#117651 Fix AutoCorrect support for italic, strike, bold, and underline

The previous change for italic had a "break" for "/", but it turns out
that code path is hit when trying to "Apply" with slashes around
some text, so we just move the "break" inside the check for French
language handling.  Note that trying "Apply" with this change will
crash on a debug build -- there is another fix for that problem
in a subsequent change.

Change-Id: I4bd76505b3fdfc9f5660eb6ae4a5c5c23e9672ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160529
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160563

diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 65324e0eb296..fda00e5dfa4c 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -2110,8 +2110,10 @@ void SwAutoFormat::AutoCorrect(TextFrameIndex nPos)
 
 SetRedlineText( STR_AUTOFMTREDL_NON_BREAK_SPACE );
 if (pATst->FnAddNonBrkSpace(aACorrDoc, *pText, 
sal_Int32(nPos), eLang, bNbspRunNext))
+{
 --nPos;
-break;
+break;
+}
 }
 [[fallthrough]];
 case '-':